From ab6998ea8bc2b096666cdb89aca4077032174936 Mon Sep 17 00:00:00 2001 From: John Janus Date: Tue, 28 Aug 2018 22:45:37 +0200 Subject: [PATCH] register command controller --- cm-lib/src/controllers/master-controller.cpp | 7 +++++++ cm-lib/src/controllers/master-controller.h | 4 ++++ cm-ui/src/main.cpp | 7 ++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/cm-lib/src/controllers/master-controller.cpp b/cm-lib/src/controllers/master-controller.cpp index a1bf6f6..f6b95ac 100644 --- a/cm-lib/src/controllers/master-controller.cpp +++ b/cm-lib/src/controllers/master-controller.cpp @@ -9,10 +9,12 @@ namespace cm::controllers { : masterController(_masterController) { navigationController = new NavigationController(_masterController); + commandController = new CommandController(_masterController); } MasterController* masterController{nullptr}; NavigationController* navigationController{nullptr}; + CommandController* commandController{nullptr}; QString welcomeMessage = "This is MasterController to Major Tom"; }; @@ -31,6 +33,11 @@ namespace cm::controllers { return implementation->navigationController; } + CommandController* MasterController::commandController() + { + return implementation->commandController; + } + const QString& MasterController::welcomeMessage() const { return implementation->welcomeMessage; diff --git a/cm-lib/src/controllers/master-controller.h b/cm-lib/src/controllers/master-controller.h index 6856512..bf2db84 100644 --- a/cm-lib/src/controllers/master-controller.h +++ b/cm-lib/src/controllers/master-controller.h @@ -7,6 +7,7 @@ #include "cm-lib_global.h" #include "controllers/navigation-controller.h" +#include "controllers/commandcontroller.h" namespace cm::controllers { @@ -15,11 +16,14 @@ class CMLIBSHARED_EXPORT MasterController : public QObject Q_OBJECT Q_PROPERTY( QString ui_welcomeMessage READ welcomeMessage CONSTANT ) Q_PROPERTY( cm::controllers::NavigationController* ui_navigationController READ navigationController CONSTANT ) + Q_PROPERTY( cm::controllers::CommandController* ui_commandController READ commandController CONSTANT ) public: explicit MasterController(QObject *parent = nullptr); ~MasterController(); + NavigationController* navigationController(); + CommandController* commandController(); const QString& welcomeMessage() const; private: diff --git a/cm-ui/src/main.cpp b/cm-ui/src/main.cpp index e31bd85..c2e2059 100644 --- a/cm-ui/src/main.cpp +++ b/cm-ui/src/main.cpp @@ -1,7 +1,9 @@ #include #include #include -#include +#include "controllers/master-controller.h" +#include "controllers/commandcontroller.h" +#include "framework/command.h" int main(int argc, char *argv[]) { @@ -12,6 +14,9 @@ int main(int argc, char *argv[]) QGuiApplication app(argc, argv); qmlRegisterType("CM", 1, 0, "MasterController"); qmlRegisterType("CM", 1, 0, "NavigationController"); + qmlRegisterType("CM", 1, 0, "CommandController"); + qmlRegisterType("CM", 1, 0, "Command"); + cm::controllers::MasterController masterController; QQmlApplicationEngine engine; -- 2.47.0