#ifndef QTMVVM_QQMLQUICKPRESENTER_H #define QTMVVM_QQMLQUICKPRESENTER_H #include #include #include #include #include #include #include #include #include #include namespace QtMvvm { class QQmlQuickPresenter : public QObject { Q_OBJECT Q_PROPERTY(QString currentStyle READ currentStyle CONSTANT) Q_PROPERTY(InputViewFactory* inputViewFactory READ inputViewFactory NOTIFY inputViewFactoryChanged) Q_PROPERTY(QObject* qmlPresenter MEMBER _qmlPresenter NOTIFY qmlPresenterChanged) Q_PROPERTY(bool viewLoading READ isViewLoading NOTIFY viewLoadingChanged) Q_PROPERTY(qreal loadingProgress READ loadingProgress NOTIFY loadingProgressChanged) public: explicit QQmlQuickPresenter(QQmlEngine *engine); QString currentStyle() const; InputViewFactory* inputViewFactory() const; bool isViewLoading() const; qreal loadingProgress() const; Q_INVOKABLE QStringList mimeTypeFilters(const QStringList &mimeTypes) const; public Q_SLOTS: void toggleDrawer(); Q_SIGNALS: void qmlPresenterChanged(QObject* qmlPresenter); void viewLoadingChanged(bool viewLoading); void loadingProgressChanged(qreal loadingProgress); void inputViewFactoryChanged(InputViewFactory* inputViewFactory); private Q_SLOTS: void present(QtMvvm::ViewModel *viewModel, const QVariantHash ¶ms, const QUrl &viewUrl, QPointer parent); void showDialog(const QtMvvm::MessageConfig &config, QtMvvm::MessageResult *result); void statusChanged(QQmlComponent::Status status); private: typedef std::tuple> PresentTuple; QQmlEngine *_engine; QPointer _qmlPresenter; QPointer _latestComponent; QCache _componentCache; QHash _loadCache; void addObject(QQmlComponent *component, ViewModel *viewModel, const QVariantHash ¶ms, QPointer parent); }; } #endif // QTMVVM_QQMLQUICKPRESENTER_H