From 8c7afac64c37fcd1a5a5752056f2f563dcc7a311 Mon Sep 17 00:00:00 2001 From: Skycoder42 Date: Tue, 13 Feb 2018 22:37:19 +0100 Subject: [PATCH] added quick project skeletons managed to get the example working... --- .qmake.conf | 1 + examples/examples.pro | 3 +- .../mvvmquick/SampleQuick/SampleQuick.pro | 70 ++++++++++++++ examples/mvvmquick/SampleQuick/main.cpp | 22 +++++ examples/mvvmquick/SampleQuick/main.qml | 6 ++ examples/mvvmquick/SampleQuick/qml.qrc | 5 + examples/mvvmquick/mvvmquick.pro | 5 + examples/mvvmwidgets/mvvmwidgets.pro | 1 + src/imports/imports.pro | 4 + src/imports/mvvmquick/App.qml | 11 +++ src/imports/mvvmquick/PresenterProgress.qml | 13 +++ src/imports/mvvmquick/PresentingStackView.qml | 95 +++++++++++++++++++ src/imports/mvvmquick/mvvmquick.pro | 39 ++++++++ src/imports/mvvmquick/plugins.qmltypes | 19 ++++ src/imports/mvvmquick/qmldir | 8 ++ src/imports/mvvmquick/qqmlquickpresenter.cpp | 6 ++ src/imports/mvvmquick/qqmlquickpresenter.h | 18 ++++ src/imports/mvvmquick/qtmvvmquick_plugin.cpp | 22 +++++ src/imports/mvvmquick/qtmvvmquick_plugin.h | 16 ++++ src/mvvmcore/translations/qtmvvmcore_de.ts | 38 ++++++++ .../translations/qtmvvmcore_template.ts | 38 ++++++++ src/mvvmquick/builddummy.cpp | 6 -- src/mvvmquick/builddummy.h | 12 --- src/mvvmquick/mvvmquick.pro | 4 +- src/mvvmquick/quickpresenter.cpp | 17 ++++ src/mvvmquick/quickpresenter.h | 26 +++++ .../translations/qtmvvmwidgets_de.ts | 13 +++ .../translations/qtmvvmwidgets_template.ts | 13 +++ src/src.pro | 3 +- 29 files changed, 512 insertions(+), 22 deletions(-) create mode 100644 examples/mvvmquick/SampleQuick/SampleQuick.pro create mode 100644 examples/mvvmquick/SampleQuick/main.cpp create mode 100644 examples/mvvmquick/SampleQuick/main.qml create mode 100644 examples/mvvmquick/SampleQuick/qml.qrc create mode 100644 examples/mvvmquick/mvvmquick.pro create mode 100644 src/imports/imports.pro create mode 100644 src/imports/mvvmquick/App.qml create mode 100644 src/imports/mvvmquick/PresenterProgress.qml create mode 100644 src/imports/mvvmquick/PresentingStackView.qml create mode 100644 src/imports/mvvmquick/mvvmquick.pro create mode 100644 src/imports/mvvmquick/plugins.qmltypes create mode 100644 src/imports/mvvmquick/qmldir create mode 100644 src/imports/mvvmquick/qqmlquickpresenter.cpp create mode 100644 src/imports/mvvmquick/qqmlquickpresenter.h create mode 100644 src/imports/mvvmquick/qtmvvmquick_plugin.cpp create mode 100644 src/imports/mvvmquick/qtmvvmquick_plugin.h delete mode 100644 src/mvvmquick/builddummy.cpp delete mode 100644 src/mvvmquick/builddummy.h create mode 100644 src/mvvmquick/quickpresenter.cpp create mode 100644 src/mvvmquick/quickpresenter.h diff --git a/.qmake.conf b/.qmake.conf index 8780c87..4872a0c 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -1,6 +1,7 @@ load(qt_build_config) CONFIG += warning_clean exceptions c++14 +CONFIG += samples_in_build win32:cross_compile: CONFIG += winrt DEFINES += QT_DEPRECATED_WARNINGS QT_ASCII_CAST_WARNINGS diff --git a/examples/examples.pro b/examples/examples.pro index 045dc3d..0ce43fa 100644 --- a/examples/examples.pro +++ b/examples/examples.pro @@ -1,6 +1,7 @@ TEMPLATE = subdirs SUBDIRS = mvvmcore \ - mvvmwidgets + mvvmwidgets \ + mvvmquick CONFIG += ordered diff --git a/examples/mvvmquick/SampleQuick/SampleQuick.pro b/examples/mvvmquick/SampleQuick/SampleQuick.pro new file mode 100644 index 0000000..0bc86a0 --- /dev/null +++ b/examples/mvvmquick/SampleQuick/SampleQuick.pro @@ -0,0 +1,70 @@ +TEMPLATE = app + +QT += core gui qml quick mvvmquick + +TARGET = SampleQuick + +SOURCES += main.cpp + +RESOURCES += qml.qrc + +target.path = $$[QT_INSTALL_EXAMPLES]/mvvmquick/$$TARGET +INSTALLS += target + +#not found by linker? +unix:!mac { + LIBS += -L$$OUT_PWD/../../../lib #required to make this the first place to search + LIBS += -L$$[QT_INSTALL_LIBS] -licudata + LIBS += -L$$[QT_INSTALL_LIBS] -licui18n + LIBS += -L$$[QT_INSTALL_LIBS] -licuuc +} + +#add lib dir to rpath +mac: QMAKE_LFLAGS += '-Wl,-rpath,\'$$OUT_PWD/../../../lib\'' + +#link to core lib +win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../../mvvmcore/SampleCore/release/ -lSampleCore +else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../../mvvmcore/SampleCore/debug/ -lSampleCore +else:unix: LIBS += -L$$OUT_PWD/../../mvvmcore/SampleCore/ -lSampleCore + +INCLUDEPATH += $$PWD/../../mvvmcore/SampleCore +DEPENDPATH += $$PWD/../../mvvmcore/SampleCore + +win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../../mvvmcore/SampleCore/release/libSampleCore.a +else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../../mvvmcore/SampleCore/debug/libSampleCore.a +else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../../mvvmcore/SampleCore/release/SampleCore.lib +else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../../mvvmcore/SampleCore/debug/SampleCore.lib +else:unix: PRE_TARGETDEPS += $$OUT_PWD/../../mvvmcore/SampleCore/libSampleCore.a + +#hacky code to make it possible to use the example from within a shadowed build +samples_in_build { + # first, create a fake qml imports dir + FAKEPATH = qml/de/skycoder42/qtmvvm/quick + ORIGPATH = ../../../../../../../../qml/de/skycoder42/qtmvvm/quick + QMLDEPPATH = $$PWD/../../../src/imports/mvvmquick + system($$QMAKE_MKDIR $$shell_quote($$shell_path($$FAKEPATH))) + + # next, symlink all "compiled" files + build_symlink_target.target = create_qml_build_symlinks + build_symlink_target.commands += $$QMAKE_SYMBOLIC_LINK $$shell_path($$ORIGPATH/libdeclarative_mvvmquick.so) $$shell_quote($$shell_path($$FAKEPATH/libdeclarative_mvvmquick.so)) \ + $$escape_expand(\n\t)$$QMAKE_SYMBOLIC_LINK $$shell_path($$ORIGPATH/plugins.qmltypes) $$shell_quote($$shell_path($$FAKEPATH/plugins.qmltypes)) \ + $$escape_expand(\n\t)$$QMAKE_SYMBOLIC_LINK $$shell_path($$ORIGPATH/qmldir) $$shell_quote($$shell_path($$FAKEPATH/qmldir)) + QMAKE_EXTRA_TARGETS += build_symlink_target + + # next, prepare compiler to symlink all the qml files + qml_symlink_compiler.name = symlink ${QMAKE_FILE_IN} + qml_symlink_compiler.input = QML_MODULE_DEPFILES + qml_symlink_compiler.variable_out = QML_MODULE_DEPFILES_LINKS + qml_symlink_compiler.output = $$FAKEPATH/${QMAKE_FILE_BASE}.qml + qml_symlink_compiler.commands = $$QMAKE_SYMBOLIC_LINK $$QMLDEPPATH/${QMAKE_FILE_BASE}.qml ${QMAKE_FILE_OUT} + qml_symlink_compiler.depends = create_qml_build_symlinks + qml_symlink_compiler.CONFIG += no_link target_predeps + QMAKE_EXTRA_COMPILERS += qml_symlink_compiler + + #finally, add the files to make it work + QML_MODULE_DEPFILES += $$files($$QMLDEPPATH/*.qml) + + # also, add it as import path for QtCreator and the src files + QML_IMPORT_PATH = $$OUT_PWD/qml/ + DEFINES += QML_PATH=\\\"$$QML_IMPORT_PATH\\\" +} diff --git a/examples/mvvmquick/SampleQuick/main.cpp b/examples/mvvmquick/SampleQuick/main.cpp new file mode 100644 index 0000000..789e944 --- /dev/null +++ b/examples/mvvmquick/SampleQuick/main.cpp @@ -0,0 +1,22 @@ +#include +#include + +#include + +QTMVVM_REGISTER_CORE_APP(SampleCoreApp) + +int main(int argc, char *argv[]) +{ + qputenv("QML2_IMPORT_PATH", QML_PATH); + + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + + QGuiApplication app(argc, argv); + + QQmlApplicationEngine engine; + engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); + if (engine.rootObjects().isEmpty()) + return -1; + + return app.exec(); +} diff --git a/examples/mvvmquick/SampleQuick/main.qml b/examples/mvvmquick/SampleQuick/main.qml new file mode 100644 index 0000000..65960ee --- /dev/null +++ b/examples/mvvmquick/SampleQuick/main.qml @@ -0,0 +1,6 @@ +import QtQuick 2.10 +import de.skycoder42.qtmvvm.quick 1.0 + +App { + title: qsTr("Hello World") +} diff --git a/examples/mvvmquick/SampleQuick/qml.qrc b/examples/mvvmquick/SampleQuick/qml.qrc new file mode 100644 index 0000000..5f6483a --- /dev/null +++ b/examples/mvvmquick/SampleQuick/qml.qrc @@ -0,0 +1,5 @@ + + + main.qml + + diff --git a/examples/mvvmquick/mvvmquick.pro b/examples/mvvmquick/mvvmquick.pro new file mode 100644 index 0000000..91a808b --- /dev/null +++ b/examples/mvvmquick/mvvmquick.pro @@ -0,0 +1,5 @@ +TEMPLATE = subdirs +QT_FOR_CONFIG += quick + +SUBDIRS += \ + SampleQuick diff --git a/examples/mvvmwidgets/mvvmwidgets.pro b/examples/mvvmwidgets/mvvmwidgets.pro index ec249f6..2b96b01 100644 --- a/examples/mvvmwidgets/mvvmwidgets.pro +++ b/examples/mvvmwidgets/mvvmwidgets.pro @@ -1,4 +1,5 @@ TEMPLATE = subdirs +QT_FOR_CONFIG += widgets SUBDIRS += \ SampleWidgets diff --git a/src/imports/imports.pro b/src/imports/imports.pro new file mode 100644 index 0000000..413847b --- /dev/null +++ b/src/imports/imports.pro @@ -0,0 +1,4 @@ +TEMPLATE = subdirs + +SUBDIRS += \ + mvvmquick diff --git a/src/imports/mvvmquick/App.qml b/src/imports/mvvmquick/App.qml new file mode 100644 index 0000000..04acf2b --- /dev/null +++ b/src/imports/mvvmquick/App.qml @@ -0,0 +1,11 @@ +import QtQuick 2.10 +import QtQuick.Controls 2.3 + +ApplicationWindow { + id: _root + visible: true + width: 360 + height: 520 + + PresenterProgress {} +} diff --git a/src/imports/mvvmquick/PresenterProgress.qml b/src/imports/mvvmquick/PresenterProgress.qml new file mode 100644 index 0000000..4155843 --- /dev/null +++ b/src/imports/mvvmquick/PresenterProgress.qml @@ -0,0 +1,13 @@ +import QtQuick 2.10 +import QtQuick.Controls 2.3 +import de.skycoder42.qtmvvm.quick 1.0 + +ProgressBar { + visible: QuickPresenter.viewLoading + value: QuickPresenter.loadingProgress + + anchors.left: parent.left + anchors.right: parent.right + anchors.top: parent.top + z: 10 +} diff --git a/src/imports/mvvmquick/PresentingStackView.qml b/src/imports/mvvmquick/PresentingStackView.qml new file mode 100644 index 0000000..524e6ea --- /dev/null +++ b/src/imports/mvvmquick/PresentingStackView.qml @@ -0,0 +1,95 @@ +import QtQuick 2.10 +import QtQuick.Controls 2.3 +import de.skycoder42.qtmvvm.quick 1.0 + +StackView { + id: mainStack + anchors.fill: parent + + readonly property int animDuration: 150 + readonly property int opDuration: 75 + + function presentItem(item) { + if(push(item)) { + QuickPresenter.qmlPresenter.opened(item); + return true; + } else + return false; + } + + function withdrawItem(item) { + if(currentItem === item) { + if(pop()) { + QuickPresenter.qmlPresenter.closed(item); + return true; + } + } + + return false; + } + + function closeAction() { + if(typeof mainStack.currentItem.closeAction != "undefined") { + if(mainStack.currentItem.closeAction()) + return true; + } + + if(mainStack.depth <= 1) + return false; + else { + var item = mainStack.pop(); + if(item) { + QuickPresenter.qmlPresenter.closed(item); + return true; + } else + return false; + } + } + + pushEnter: Transition { + PropertyAnimation { + property: "y" + easing.type: Easing.InOutQuad + from: height * 0.3 + to: 0 + duration: mainStack.animDuration + } + PropertyAnimation { + property: "opacity" + from: 0.0 + to: 1.0 + duration: mainStack.opDuration + } + } + pushExit: Transition { + PauseAnimation { + duration: mainStack.animDuration + } + } + popEnter: Transition { + PauseAnimation { + duration: mainStack.animDuration + } + } + popExit: Transition { + PropertyAnimation { + property: "y" + easing.type: Easing.InOutQuad + from: 0 + to: height * 0.3 + duration: mainStack.animDuration + } + SequentialAnimation { + PauseAnimation { + duration: mainStack.animDuration - mainStack.opDuration + } + PropertyAnimation { + id: pp1 + property: "opacity" + from: 1.0 + to: 0.0 + duration: mainStack.opDuration + } + } + } +} diff --git a/src/imports/mvvmquick/mvvmquick.pro b/src/imports/mvvmquick/mvvmquick.pro new file mode 100644 index 0000000..e11524d --- /dev/null +++ b/src/imports/mvvmquick/mvvmquick.pro @@ -0,0 +1,39 @@ +QT += core qml quick mvvmquick +CXX_MODULE = mvvmquick +TARGETPATH = de/skycoder42/qtmvvm/quick +TARGET = declarative_mvvmquick +IMPORT_VERSION = 1.0 + +HEADERS += \ + qtmvvmquick_plugin.h \ + qqmlquickpresenter.h + +SOURCES += \ + qtmvvmquick_plugin.cpp \ + qqmlquickpresenter.cpp + +QML_FILES += \ + App.qml \ + PresentingStackView.qml \ + PresenterProgress.qml + +OTHER_FILES += qmldir + +generate_qmltypes { + typeextra1.target = qmltypes + typeextra1.depends += export LD_LIBRARY_PATH := "$$shadowed($$dirname(_QMAKE_CONF_))/lib/:$(LD_LIBRARY_PATH)" + qmltypes.depends += typeextra1 + + typeextra2.target = qmltypes + typeextra2.depends += export QML2_IMPORT_PATH := "$$shadowed($$dirname(_QMAKE_CONF_))/qml/" + qmltypes.depends += typeextra2 + QMAKE_EXTRA_TARGETS += typeextra1 typeextra2 +} + +load(qml_plugin) + +generate_qmltypes { + mfirst.target = all + mfirst.depends += qmltypes + QMAKE_EXTRA_TARGETS += mfirst +} diff --git a/src/imports/mvvmquick/plugins.qmltypes b/src/imports/mvvmquick/plugins.qmltypes new file mode 100644 index 0000000..0221911 --- /dev/null +++ b/src/imports/mvvmquick/plugins.qmltypes @@ -0,0 +1,19 @@ +import QtQuick.tooling 1.2 + +// This file describes the plugin-supplied types contained in the library. +// It is used for QML tooling purposes only. +// +// This file was auto-generated by: +// 'qmlplugindump -nonrelocatable de.skycoder42.qtmvvm.quick 1.0' + +Module { + dependencies: ["QtQuick 2.8"] + Component { + name: "QtMvvm::QQmlQuickPresenter" + prototype: "QObject" + exports: ["de.skycoder42.qtmvvm.quick/QuickPresenter 1.0"] + isCreatable: false + isSingleton: true + exportMetaObjectRevisions: [0] + } +} diff --git a/src/imports/mvvmquick/qmldir b/src/imports/mvvmquick/qmldir new file mode 100644 index 0000000..a731895 --- /dev/null +++ b/src/imports/mvvmquick/qmldir @@ -0,0 +1,8 @@ +module de.skycoder42.qtmvvm.quick +plugin declarative_mvvmquick +classname QtMvvmQuickDeclarativeModule +typeinfo plugins.qmltypes + +App 1.0 App.qml +PresenterProgress 1.0 PresenterProgress.qml +PresentingStackView 1.0 PresentingStackView.qml diff --git a/src/imports/mvvmquick/qqmlquickpresenter.cpp b/src/imports/mvvmquick/qqmlquickpresenter.cpp new file mode 100644 index 0000000..3dfd9a0 --- /dev/null +++ b/src/imports/mvvmquick/qqmlquickpresenter.cpp @@ -0,0 +1,6 @@ +#include "qqmlquickpresenter.h" +using namespace QtMvvm; + +QQmlQuickPresenter::QQmlQuickPresenter(QObject *parent) : + QObject(parent) +{} diff --git a/src/imports/mvvmquick/qqmlquickpresenter.h b/src/imports/mvvmquick/qqmlquickpresenter.h new file mode 100644 index 0000000..62a26f1 --- /dev/null +++ b/src/imports/mvvmquick/qqmlquickpresenter.h @@ -0,0 +1,18 @@ +#ifndef QTMVVM_QQMLQUICKPRESENTER_H +#define QTMVVM_QQMLQUICKPRESENTER_H + +#include + +namespace QtMvvm { + +class QQmlQuickPresenter : public QObject +{ + Q_OBJECT + +public: + explicit QQmlQuickPresenter(QObject *parent = nullptr); +}; + +} + +#endif // QTMVVM_QQMLQUICKPRESENTER_H diff --git a/src/imports/mvvmquick/qtmvvmquick_plugin.cpp b/src/imports/mvvmquick/qtmvvmquick_plugin.cpp new file mode 100644 index 0000000..5f44dbd --- /dev/null +++ b/src/imports/mvvmquick/qtmvvmquick_plugin.cpp @@ -0,0 +1,22 @@ +#include "qtmvvmquick_plugin.h" + +#include + +#include "qqmlquickpresenter.h" + +static QObject *createQuickPresenterQmlSingleton(QQmlEngine *qmlEngine, QJSEngine *jsEngine) +{ + Q_UNUSED(jsEngine) + return new QtMvvm::QQmlQuickPresenter(qmlEngine); +} + +QtMvvmQuickDeclarativeModule::QtMvvmQuickDeclarativeModule(QObject *parent) : + QQmlExtensionPlugin(parent) +{} + +void QtMvvmQuickDeclarativeModule::registerTypes(const char *uri) +{ + Q_ASSERT(qstrcmp(uri, "de.skycoder42.qtmvvm.quick") == 0); + + qmlRegisterSingletonType(uri, 1, 0, "QuickPresenter", createQuickPresenterQmlSingleton); +} diff --git a/src/imports/mvvmquick/qtmvvmquick_plugin.h b/src/imports/mvvmquick/qtmvvmquick_plugin.h new file mode 100644 index 0000000..a0fde9a --- /dev/null +++ b/src/imports/mvvmquick/qtmvvmquick_plugin.h @@ -0,0 +1,16 @@ +#ifndef QTMVVMQUICK_PLUGIN_H +#define QTMVVMQUICK_PLUGIN_H + +#include + +class QtMvvmQuickDeclarativeModule : public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) + +public: + QtMvvmQuickDeclarativeModule(QObject *parent = nullptr); + void registerTypes(const char *uri) override; +}; + +#endif // QTMVVMQUICK_PLUGIN_H diff --git a/src/mvvmcore/translations/qtmvvmcore_de.ts b/src/mvvmcore/translations/qtmvvmcore_de.ts index 1552582..4a00af8 100644 --- a/src/mvvmcore/translations/qtmvvmcore_de.ts +++ b/src/mvvmcore/translations/qtmvvmcore_de.ts @@ -1,4 +1,42 @@ + + MessageConfig + + + %1 — Version %2 + + + + + (Built with %1) + + + + + Qt-Version: <a href="https://www.qt.io/">%1</a> + + + + + Developed by: %1 + + + + + Project Website: <a href="%1">%2</a> + + + + + License: <a href="%1">%2</a> + + + + + License: %1 + + + diff --git a/src/mvvmcore/translations/qtmvvmcore_template.ts b/src/mvvmcore/translations/qtmvvmcore_template.ts index 6401616..d8499d7 100644 --- a/src/mvvmcore/translations/qtmvvmcore_template.ts +++ b/src/mvvmcore/translations/qtmvvmcore_template.ts @@ -1,4 +1,42 @@ + + MessageConfig + + + %1 — Version %2 + + + + + (Built with %1) + + + + + Qt-Version: <a href="https://www.qt.io/">%1</a> + + + + + Developed by: %1 + + + + + Project Website: <a href="%1">%2</a> + + + + + License: <a href="%1">%2</a> + + + + + License: %1 + + + diff --git a/src/mvvmquick/builddummy.cpp b/src/mvvmquick/builddummy.cpp deleted file mode 100644 index cbc41c3..0000000 --- a/src/mvvmquick/builddummy.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "builddummy.h" - -builddummy::builddummy() -{ - -} diff --git a/src/mvvmquick/builddummy.h b/src/mvvmquick/builddummy.h deleted file mode 100644 index f596e24..0000000 --- a/src/mvvmquick/builddummy.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef BUILDDUMMY_H -#define BUILDDUMMY_H - -#include "qtmvvmquick_global.h" - -class Q_MVVMQUICK_EXPORT builddummy -{ -public: - builddummy(); -}; - -#endif // BUILDDUMMY_H diff --git a/src/mvvmquick/mvvmquick.pro b/src/mvvmquick/mvvmquick.pro index 508964c..07d9251 100644 --- a/src/mvvmquick/mvvmquick.pro +++ b/src/mvvmquick/mvvmquick.pro @@ -4,10 +4,10 @@ QT = core gui widgets mvvmcore HEADERS += \ qtmvvmquick_global.h \ - builddummy.h + quickpresenter.h SOURCES += \ - builddummy.cpp + quickpresenter.cpp TRANSLATIONS += \ translations/qtmvvmquick_de.ts \ diff --git a/src/mvvmquick/quickpresenter.cpp b/src/mvvmquick/quickpresenter.cpp new file mode 100644 index 0000000..8514d14 --- /dev/null +++ b/src/mvvmquick/quickpresenter.cpp @@ -0,0 +1,17 @@ +#include "quickpresenter.h" +using namespace QtMvvm; + +QuickPresenter::QuickPresenter(QObject *parent) : + QObject(parent), + IPresenter() +{} + +void QuickPresenter::present(QtMvvm::ViewModel *viewModel, const QVariantHash ¶ms, QPointer parent) +{ + +} + +void QuickPresenter::showDialog(const QtMvvm::MessageConfig &config, QtMvvm::MessageResult *result) +{ + +} diff --git a/src/mvvmquick/quickpresenter.h b/src/mvvmquick/quickpresenter.h new file mode 100644 index 0000000..7fbba06 --- /dev/null +++ b/src/mvvmquick/quickpresenter.h @@ -0,0 +1,26 @@ +#ifndef QTMVVM_QUICKPRESENTER_H +#define QTMVVM_QUICKPRESENTER_H + +#include + +#include + +#include "QtMvvmQuick/qtmvvmquick_global.h" + +namespace QtMvvm { + +class Q_MVVMQUICK_EXPORT QuickPresenter : public QObject, public IPresenter +{ + Q_OBJECT + Q_INTERFACES(QtMvvm::IPresenter) + +public: + explicit QuickPresenter(QObject *parent = nullptr); + + void present(ViewModel *viewModel, const QVariantHash ¶ms, QPointer parent) override; + void showDialog(const MessageConfig &config, MessageResult *result) override; +}; + +} + +#endif // QTMVVM_QUICKPRESENTER_H diff --git a/src/mvvmwidgets/translations/qtmvvmwidgets_de.ts b/src/mvvmwidgets/translations/qtmvvmwidgets_de.ts index 1552582..52168fc 100644 --- a/src/mvvmwidgets/translations/qtmvvmwidgets_de.ts +++ b/src/mvvmwidgets/translations/qtmvvmwidgets_de.ts @@ -1,4 +1,17 @@ + + QtMvvm::WidgetsPresenter + + + About + + + + + About &Qt + + + diff --git a/src/mvvmwidgets/translations/qtmvvmwidgets_template.ts b/src/mvvmwidgets/translations/qtmvvmwidgets_template.ts index 6401616..5a49548 100644 --- a/src/mvvmwidgets/translations/qtmvvmwidgets_template.ts +++ b/src/mvvmwidgets/translations/qtmvvmwidgets_template.ts @@ -1,4 +1,17 @@ + + QtMvvm::WidgetsPresenter + + + About + + + + + About &Qt + + + diff --git a/src/src.pro b/src/src.pro index 3862d68..b8a0c46 100644 --- a/src/src.pro +++ b/src/src.pro @@ -3,7 +3,8 @@ CONFIG += ordered SUBDIRS += mvvmcore \ mvvmwidgets \ - mvvmquick + mvvmquick \ + imports prepareRecursiveTarget(lrelease) QMAKE_EXTRA_TARGETS += lrelease