]> Johnzone git - learnqt-cm.git/commitdiff
register command controller
authorJohn Janus <mail@johnzone.org>
Tue, 28 Aug 2018 20:45:37 +0000 (22:45 +0200)
committerJohn Janus <mail@johnzone.org>
Tue, 28 Aug 2018 20:45:37 +0000 (22:45 +0200)
cm-lib/src/controllers/master-controller.cpp
cm-lib/src/controllers/master-controller.h
cm-ui/src/main.cpp

index a1bf6f6d8f25e05ae2b989b738b1421c5a973ef8..f6b95ac331a7238c1fdbf82547b1a3b18819ef2a 100644 (file)
@@ -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;
index 685651219ef43d359d1866f6e3e652dd722e9e49..bf2db84ffff4f2f17fd31cc2aa02a7ef362f375d 100644 (file)
@@ -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:
index e31bd850d203cec772054ea0d33192e64ed1dccd..c2e20591f34722fef731f56761b60ff4851265c2 100644 (file)
@@ -1,7 +1,9 @@
 #include <QGuiApplication>
 #include <QQmlApplicationEngine>
 #include <QQmlContext>
-#include <controllers/master-controller.h>
+#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::controllers::MasterController>("CM", 1, 0, "MasterController");
   qmlRegisterType<cm::controllers::NavigationController>("CM", 1, 0, "NavigationController");
+  qmlRegisterType<cm::controllers::CommandController>("CM", 1, 0, "CommandController");
+  qmlRegisterType<cm::framework::Command>("CM", 1, 0, "Command");
+
   cm::controllers::MasterController masterController;
 
   QQmlApplicationEngine engine;