]> Johnzone git - learnqt-cm.git/commitdiff
project definition good, view files created
authorJohn Janus <mail@johnzone.org>
Tue, 14 Aug 2018 21:13:17 +0000 (23:13 +0200)
committerJohn Janus <mail@johnzone.org>
Tue, 14 Aug 2018 21:13:17 +0000 (23:13 +0200)
16 files changed:
.gitignore
cm-lib/cm-lib.pro
cm-lib/src/controllers/master-controller.h
cm-tests/cm-tests.pro
cm-ui/cm-ui.pro
cm-ui/src/main.cpp
cm-ui/views.qrc
cm-ui/views/CreateClientView.qml [new file with mode: 0644]
cm-ui/views/DashboardView.qml [new file with mode: 0644]
cm-ui/views/EditClientView.qml [new file with mode: 0644]
cm-ui/views/FindClientView.qml [new file with mode: 0644]
cm-ui/views/MasterView.qml
cm-ui/views/SplashView.qml [new file with mode: 0644]
learnqt-cm.pro
qmake-destination-path.pri [new file with mode: 0644]
qmake-target-platform.pri [new file with mode: 0644]

index 444078f3cdfe05a46896845ff964d55472f7467a..122c23363a71614e5ae404e285224328226bf2b8 100644 (file)
@@ -1,2 +1,3 @@
 *.pro.user
-
+binaries/
+build/
index f49eda2d9438bd90bb3a28a4065966594b21e690..e7987f6e9ae62c9af09e0b5f0c3bead7a00c4b10 100644 (file)
@@ -4,6 +4,9 @@
 #
 #-------------------------------------------------
 
+include(../qmake-target-platform.pri)
+include(../qmake-destination-path.pri)
+
 QT       -= gui
 
 TARGET = cm-lib
@@ -39,3 +42,12 @@ unix {
     target.path = /usr/lib
     INSTALLS += target
 }
+
+DESTDIR = $$PWD/../binaries/$$DESTINATION_PATH
+OBJECTS_DIR = $$PWD/build/$$DESTINATION_PATH/.obj
+MOC_DIR = $$PWD/build/$$DESTINATION_PATH/.moc
+RCC_DIR = $$PWD/build/$$DESTINATION_PATH/.qrc
+UI_DIR = $$PWD/build/$$DESTINATION_PATH/.ui
+
+message(cm-lib output dir: $${DESTDIR})
+message(cm-lib project dir: $${PWD})
index 52a2f6caf007a4683696f10b359da876dc2fffb8..791dc5c5601f0c3192b068221336f06792bb5baa 100644 (file)
@@ -2,6 +2,7 @@
 #define MASTERCONTROLLER_H
 
 #include <QObject>
+#include <QString>
 
 #include <cm-lib_global.h>
 
@@ -10,8 +11,10 @@ namespace cm::controllers {
 class CMLIBSHARED_EXPORT MasterController : public QObject
 {
   Q_OBJECT
+  Q_PROPERTY(QString ui_welcomeMessage MEMBER welcomeMessage CONSTANT)
 public:
   explicit MasterController(QObject *parent = nullptr);
+  QString welcomeMessage = "This is MasterController to Major Tom";
 
 signals:
 
index 4b775bef164f6fc09cd967ecf857244b93d9e76f..4f90cb8d25f01c798a5ae25e943c79da85149e86 100644 (file)
@@ -4,6 +4,9 @@
 #
 #-------------------------------------------------
 
+include(../qmake-target-platform.pri)
+include(../qmake-destination-path.pri)
+
 QT       += testlib
 
 QT       -= gui
@@ -31,4 +34,14 @@ INCLUDEPATH += src
 SOURCES += \
         src/models/client-tests.cpp
 
+LIBS += -L$$PWD/../binaries/$$DESTINATION_PATH -lcm-lib
+
+
 DEFINES += SRCDIR=\\\"$$PWD/\\\"
+
+DESTDIR = $$PWD/../binaries/$$DESTINATION_PATH
+OBJECTS_DIR = $$PWD/build/$$DESTINATION_PATH/.obj
+MOC_DIR = $$PWD/build/$$DESTINATION_PATH/.moc
+RCC_DIR = $$PWD/build/$$DESTINATION_PATH/.qrc
+UI_DIR = $$PWD/build/$$DESTINATION_PATH/.ui
+
index e10d5febdb7b3594da993615cb808e991c20a41c..bc9861208827c5d7543815ff2a9a0f01cc53fc48 100644 (file)
@@ -1,3 +1,6 @@
+include(../qmake-target-platform.pri)
+include(../qmake-destination-path.pri)
+
 QT += qml quick
 CONFIG += c++17
 
@@ -12,12 +15,15 @@ DEFINES += QT_DEPRECATED_WARNINGS
 # You can also select to disable deprecated APIs only up to a certain version of Qt.
 DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
 
-INCLUDEPATH += src
+INCLUDEPATH += src \
+    ../cm-lib/src
 
 SOURCES += src/main.cpp
 
 RESOURCES += views.qrc
 
+LIBS += -L$$PWD/../binaries/$$DESTINATION_PATH -lcm-lib
+
 # Additional import path used to resolve QML modules in Qt Creator's code model
 QML_IMPORT_PATH = $$PWD
 
@@ -28,3 +34,10 @@ QML_DESIGNER_IMPORT_PATH =
 qnx: target.path = /tmp/$${TARGET}/bin
 else: unix:!android: target.path = /opt/$${TARGET}/bin
 !isEmpty(target.path): INSTALLS += target
+
+DESTDIR = $$PWD/../binaries/$$DESTINATION_PATH
+OBJECTS_DIR = $$PWD/build/$$DESTINATION_PATH/.obj
+MOC_DIR = $$PWD/build/$$DESTINATION_PATH/.moc
+RCC_DIR = $$PWD/build/$$DESTINATION_PATH/.qrc
+UI_DIR = $$PWD/build/$$DESTINATION_PATH/.ui
+
index 93604f70522dda7b28efc14c8221e9bbeb4080f0..e390e7e3ee11cc544953fa6c7f3520a2bd34b7bb 100644 (file)
@@ -1,5 +1,7 @@
 #include <QGuiApplication>
 #include <QQmlApplicationEngine>
+#include <QQmlContext>
+#include <controllers/master-controller.h>
 
 int main(int argc, char *argv[])
 {
@@ -8,8 +10,11 @@ int main(int argc, char *argv[])
 #endif
 
   QGuiApplication app(argc, argv);
+  qmlRegisterType<cm::controllers::MasterController>("CM", 1, 0, "MasterController");
+  cm::controllers::MasterController masterController;
 
   QQmlApplicationEngine engine;
+  engine.rootContext()->setContextProperty("masterController", &masterController);
   engine.load(QUrl(QStringLiteral("qrc:/views/MasterView.qml")));
   if (engine.rootObjects().isEmpty())
     return -1;
index 08d094af53dd10dd98ad3c3c2a911efd91cd1fc5..260da156de2616116adbfc9771c3e6077df65038 100644 (file)
@@ -1,5 +1,10 @@
 <RCC>
     <qresource prefix="/views">
         <file alias="MasterView.qml">views/MasterView.qml</file>
+        <file alias="SplashView.qml">views/SplashView.qml</file>
+        <file alias="DashboardView.qml">views/DashboardView.qml</file>
+        <file alias="CreateClientView.qml">views/CreateClientView.qml</file>
+        <file alias="EditClientView.qml">views/EditClientView.qml</file>
+        <file alias="FindClientView.qml">views/FindClientView.qml</file>
     </qresource>
 </RCC>
diff --git a/cm-ui/views/CreateClientView.qml b/cm-ui/views/CreateClientView.qml
new file mode 100644 (file)
index 0000000..9c36e13
--- /dev/null
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+
+}
diff --git a/cm-ui/views/DashboardView.qml b/cm-ui/views/DashboardView.qml
new file mode 100644 (file)
index 0000000..9c36e13
--- /dev/null
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+
+}
diff --git a/cm-ui/views/EditClientView.qml b/cm-ui/views/EditClientView.qml
new file mode 100644 (file)
index 0000000..9c36e13
--- /dev/null
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+
+}
diff --git a/cm-ui/views/FindClientView.qml b/cm-ui/views/FindClientView.qml
new file mode 100644 (file)
index 0000000..9c36e13
--- /dev/null
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+
+}
index a0fca3690ee3e193758877037c5a60bbd754c96a..efb366b9112f4625daad68b85a559bba908a65a9 100644 (file)
@@ -5,5 +5,9 @@ Window {
   visible: true
   width: 640
   height: 480
-  title: qsTr("Hello World")
+  title: qsTr("Client Management")
+
+  Text {
+    text: masterController.ui_welcomeMessage
+  }
 }
diff --git a/cm-ui/views/SplashView.qml b/cm-ui/views/SplashView.qml
new file mode 100644 (file)
index 0000000..9c36e13
--- /dev/null
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+
+}
index d5d407e5f6294d178a06d499c09cb6eeb539b1ff..b0ddb3a21599e6b9ddb1a5ef11bf4e1e7fbf8d0f 100644 (file)
@@ -4,3 +4,5 @@ SUBDIRS += \
     cm-ui \
     cm-lib \
     cm-tests
+
+message(cm project dir: $${PWD})
diff --git a/qmake-destination-path.pri b/qmake-destination-path.pri
new file mode 100644 (file)
index 0000000..9d942d6
--- /dev/null
@@ -0,0 +1,45 @@
+platform_path = unknown-platform
+compiler_path = unknown-compiler
+processor_path = unknown-processor
+build_path = unknown-build
+
+PLATFORM_WIN {
+  platform_path = windows
+}
+
+PLATFORM_OSX {
+  platform_path = osx
+}
+
+PLATFORM_LINUX {
+  platform_path = linux
+}
+
+COMPILER_GCC {
+  compiler_path = gcc
+}
+
+COMPILER_MSVC2017 {
+  compiler_path = msvc2017
+}
+
+COMPILER_CLANG {
+  compiler_path = clang
+}
+
+PROCESSOR_x64 {
+  processor_path = x64
+}
+
+PROCESSOR_x86 {
+  processor_path = x86
+}
+
+BUILD_DEBUG {
+  build_path = debug
+} else {
+  build_path = release
+}
+DESTINATION_PATH = $$platform_path/$$compiler_path/$$processor_path/$$build_path
+
+message(Dest path: $${DESTINATION_PATH})
diff --git a/qmake-target-platform.pri b/qmake-target-platform.pri
new file mode 100644 (file)
index 0000000..b3aeba2
--- /dev/null
@@ -0,0 +1,57 @@
+win32 {
+  CONFIG += PLATFORM_WIN
+  message(PLATFORM_WIN)
+  win32-g++ {
+    CONFIG += COMPILER_GCC
+    message(COMPILER_GCC)
+  }
+  win32-msvc2017 {
+    CONFIG += COMPILER_MSVC2017
+    message(COMPILER_MSVC2017)
+    win32-msvc2017:QMAKE_TARGET.arch = x86_64
+  }
+}
+
+linux {
+  CONFIG += PLATFORM_LINUX
+  message(PLATFORM_LINUX)
+  # Make QMAKE_TARGET arch available for Linux
+  !contains(QT_ARCH, x86_64){
+    QMAKE_TARGET.arch = x86
+  } else {
+    QMAKE_TARGET.arch = x86_64
+  }
+  linux-g++{
+    CONFIG += COMPILER_GCC
+    message(COMPILER_GCC)
+  }
+}
+
+macx {
+  CONFIG += PLATFORM_OSX
+  message(PLATFORM_OSX)
+  macx-clang {
+    CONFIG += COMPILER_CLANG
+    message(COMPILER_CLANG)
+    QMAKE_TARGET.arch = x86_64
+  }
+  macx-clang-32{
+    CONFIG += COMPILER_CLANG
+    message(COMPILER_CLANG)
+    QMAKE_TARGET.arch = x86
+  }
+}
+contains(QMAKE_TARGET.arch, x86_64) {
+  CONFIG += PROCESSOR_x64
+  message(PROCESSOR_x64)
+} else {
+  CONFIG += PROCESSOR_x86
+  message(PROCESSOR_x86)
+}
+CONFIG(debug, release|debug) {
+  CONFIG += BUILD_DEBUG
+  message(BUILD_DEBUG)
+} else {
+  CONFIG += BUILD_RELEASE
+  message(BUILD_RELEASE)
+}