From 332a9e41732cf1b105d58a5d7a230b14805d5eaf Mon Sep 17 00:00:00 2001 From: John Janus Date: Wed, 21 Mar 2018 00:06:45 +0100 Subject: [PATCH] initial commit, project set up --- cm-lib/cm-lib.pro | 41 +++ cm-lib/src/cm-lib_global.h | 12 + cm-lib/src/controllers/master-controller.cpp | 9 + cm-lib/src/controllers/master-controller.h | 22 ++ cm-lib/src/models/client.cpp | 6 + cm-lib/src/models/client.h | 13 + cm-tests/cm-tests.pro | 34 ++ cm-tests/src/models/client-tests.cpp | 36 ++ cm-ui/cm-ui.pro | 30 ++ cm-ui/src/main.cpp | 18 + cm-ui/views.qrc | 5 + cm-ui/views/MasterView.qml | 9 + learnqt-cm.pro | 6 + learnqt-cm.pro.user | 333 +++++++++++++++++++ 14 files changed, 574 insertions(+) create mode 100644 cm-lib/cm-lib.pro create mode 100644 cm-lib/src/cm-lib_global.h create mode 100644 cm-lib/src/controllers/master-controller.cpp create mode 100644 cm-lib/src/controllers/master-controller.h create mode 100644 cm-lib/src/models/client.cpp create mode 100644 cm-lib/src/models/client.h create mode 100644 cm-tests/cm-tests.pro create mode 100644 cm-tests/src/models/client-tests.cpp create mode 100644 cm-ui/cm-ui.pro create mode 100644 cm-ui/src/main.cpp create mode 100644 cm-ui/views.qrc create mode 100644 cm-ui/views/MasterView.qml create mode 100644 learnqt-cm.pro create mode 100644 learnqt-cm.pro.user diff --git a/cm-lib/cm-lib.pro b/cm-lib/cm-lib.pro new file mode 100644 index 0000000..f49eda2 --- /dev/null +++ b/cm-lib/cm-lib.pro @@ -0,0 +1,41 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2018-03-20T23:34:17 +# +#------------------------------------------------- + +QT -= gui + +TARGET = cm-lib +TEMPLATE = lib + +CONFIG += c++17 + +DEFINES += CMLIB_LIBRARY + +# The following define makes your compiler emit warnings if you use +# any feature of Qt which has been marked as deprecated (the exact warnings +# depend on your compiler). Please consult the documentation of the +# deprecated API in order to know how to port your code away from it. +DEFINES += QT_DEPRECATED_WARNINGS + +# You can also make your code fail to compile if you use deprecated APIs. +# In order to do so, uncomment the following line. +# 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 + +SOURCES += \ + src/models/client.cpp \ + src/controllers/master-controller.cpp + +HEADERS += \ + src/models/client.h \ + src/cm-lib_global.h \ + src/controllers/master-controller.h + +unix { + target.path = /usr/lib + INSTALLS += target +} diff --git a/cm-lib/src/cm-lib_global.h b/cm-lib/src/cm-lib_global.h new file mode 100644 index 0000000..899255c --- /dev/null +++ b/cm-lib/src/cm-lib_global.h @@ -0,0 +1,12 @@ +#ifndef CMLIB_GLOBAL_H +#define CMLIB_GLOBAL_H + +#include + +#if defined(CMLIB_LIBRARY) +# define CMLIBSHARED_EXPORT Q_DECL_EXPORT +#else +# define CMLIBSHARED_EXPORT Q_DECL_IMPORT +#endif + +#endif // CMLIB_GLOBAL_H diff --git a/cm-lib/src/controllers/master-controller.cpp b/cm-lib/src/controllers/master-controller.cpp new file mode 100644 index 0000000..9601bc4 --- /dev/null +++ b/cm-lib/src/controllers/master-controller.cpp @@ -0,0 +1,9 @@ +#include "master-controller.h" + +namespace cm::controllers { +MasterController::MasterController(QObject *parent) : QObject(parent) +{ + +} + +} diff --git a/cm-lib/src/controllers/master-controller.h b/cm-lib/src/controllers/master-controller.h new file mode 100644 index 0000000..52a2f6c --- /dev/null +++ b/cm-lib/src/controllers/master-controller.h @@ -0,0 +1,22 @@ +#ifndef MASTERCONTROLLER_H +#define MASTERCONTROLLER_H + +#include + +#include + +namespace cm::controllers { + +class CMLIBSHARED_EXPORT MasterController : public QObject +{ + Q_OBJECT +public: + explicit MasterController(QObject *parent = nullptr); + +signals: + +public slots: +}; +} + +#endif // MASTERCONTROLLER_H diff --git a/cm-lib/src/models/client.cpp b/cm-lib/src/models/client.cpp new file mode 100644 index 0000000..5e8dcfb --- /dev/null +++ b/cm-lib/src/models/client.cpp @@ -0,0 +1,6 @@ +#include "client.h" + + +Client::Client() +{ +} diff --git a/cm-lib/src/models/client.h b/cm-lib/src/models/client.h new file mode 100644 index 0000000..d917e02 --- /dev/null +++ b/cm-lib/src/models/client.h @@ -0,0 +1,13 @@ +#ifndef CLIENT_H +#define CLIENT_H + +#include "cm-lib_global.h" + +class CMLIBSHARED_EXPORT Client +{ + +public: + Client(); +}; + +#endif // CLIENT_H diff --git a/cm-tests/cm-tests.pro b/cm-tests/cm-tests.pro new file mode 100644 index 0000000..4b775be --- /dev/null +++ b/cm-tests/cm-tests.pro @@ -0,0 +1,34 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2018-03-20T23:36:27 +# +#------------------------------------------------- + +QT += testlib + +QT -= gui + +TARGET = client-tests +CONFIG += console +CONFIG += c++17 +CONFIG -= app_bundle + +TEMPLATE = app + +# The following define makes your compiler emit warnings if you use +# any feature of Qt which has been marked as deprecated (the exact warnings +# depend on your compiler). Please consult the documentation of the +# deprecated API in order to know how to port your code away from it. +DEFINES += QT_DEPRECATED_WARNINGS + +# You can also make your code fail to compile if you use deprecated APIs. +# In order to do so, uncomment the following line. +# 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 + +SOURCES += \ + src/models/client-tests.cpp + +DEFINES += SRCDIR=\\\"$$PWD/\\\" diff --git a/cm-tests/src/models/client-tests.cpp b/cm-tests/src/models/client-tests.cpp new file mode 100644 index 0000000..d997298 --- /dev/null +++ b/cm-tests/src/models/client-tests.cpp @@ -0,0 +1,36 @@ +#include +#include + +class ClientTests : public QObject +{ + Q_OBJECT + +public: + ClientTests(); + +private Q_SLOTS: + void initTestCase(); + void cleanupTestCase(); + void testCase1(); +}; + +ClientTests::ClientTests() +{ +} + +void ClientTests::initTestCase() +{ +} + +void ClientTests::cleanupTestCase() +{ +} + +void ClientTests::testCase1() +{ + QVERIFY2(true, "Failure"); +} + +QTEST_APPLESS_MAIN(ClientTests) + +#include "client-tests.moc" diff --git a/cm-ui/cm-ui.pro b/cm-ui/cm-ui.pro new file mode 100644 index 0000000..e10d5fe --- /dev/null +++ b/cm-ui/cm-ui.pro @@ -0,0 +1,30 @@ +QT += qml quick +CONFIG += c++17 + +# The following define makes your compiler emit warnings if you use +# any feature of Qt which as been marked deprecated (the exact warnings +# depend on your compiler). Please consult the documentation of the +# deprecated API in order to know how to port your code away from it. +DEFINES += QT_DEPRECATED_WARNINGS + +# You can also make your code fail to compile if you use deprecated APIs. +# In order to do so, uncomment the following line. +# 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 + +SOURCES += src/main.cpp + +RESOURCES += views.qrc + +# Additional import path used to resolve QML modules in Qt Creator's code model +QML_IMPORT_PATH = $$PWD + +# Additional import path used to resolve QML modules just for Qt Quick Designer +QML_DESIGNER_IMPORT_PATH = + +# Default rules for deployment. +qnx: target.path = /tmp/$${TARGET}/bin +else: unix:!android: target.path = /opt/$${TARGET}/bin +!isEmpty(target.path): INSTALLS += target diff --git a/cm-ui/src/main.cpp b/cm-ui/src/main.cpp new file mode 100644 index 0000000..93604f7 --- /dev/null +++ b/cm-ui/src/main.cpp @@ -0,0 +1,18 @@ +#include +#include + +int main(int argc, char *argv[]) +{ +#if defined(Q_OS_WIN) + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); +#endif + + QGuiApplication app(argc, argv); + + QQmlApplicationEngine engine; + engine.load(QUrl(QStringLiteral("qrc:/views/MasterView.qml"))); + if (engine.rootObjects().isEmpty()) + return -1; + + return app.exec(); +} diff --git a/cm-ui/views.qrc b/cm-ui/views.qrc new file mode 100644 index 0000000..08d094a --- /dev/null +++ b/cm-ui/views.qrc @@ -0,0 +1,5 @@ + + + views/MasterView.qml + + diff --git a/cm-ui/views/MasterView.qml b/cm-ui/views/MasterView.qml new file mode 100644 index 0000000..a0fca36 --- /dev/null +++ b/cm-ui/views/MasterView.qml @@ -0,0 +1,9 @@ +import QtQuick 2.10 +import QtQuick.Window 2.10 + +Window { + visible: true + width: 640 + height: 480 + title: qsTr("Hello World") +} diff --git a/learnqt-cm.pro b/learnqt-cm.pro new file mode 100644 index 0000000..d5d407e --- /dev/null +++ b/learnqt-cm.pro @@ -0,0 +1,6 @@ +TEMPLATE = subdirs + +SUBDIRS += \ + cm-ui \ + cm-lib \ + cm-tests diff --git a/learnqt-cm.pro.user b/learnqt-cm.pro.user new file mode 100644 index 0000000..dc77dfb --- /dev/null +++ b/learnqt-cm.pro.user @@ -0,0 +1,333 @@ + + + + + + EnvironmentId + {3bdbaa42-a62d-4fd6-a95f-f30efc0faa3c} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + true + false + 1 + true + true + 0 + 8 + true + 1 + true + true + true + true + + + + ProjectExplorer.Project.PluginSettings + + + + ProjectExplorer.Project.Target.0 + + Desktop + Desktop + {a671f4e8-86eb-425f-a894-40cc201878a4} + 0 + 0 + 0 + + /home/john/devel/qt5/build-learnqt-cm-Desktop-Debug + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + + Qt4ProjectManager.Qt4BuildConfiguration + 2 + true + + + /home/john/devel/qt5/build-learnqt-cm-Desktop-Release + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + + /home/john/devel/qt5/build-learnqt-cm-Desktop-Profile + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + true + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + 3 + + + 0 + Deploy + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deploy locally + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + true + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + -1 + + + + %{buildDir} + Custom Executable + + ProjectExplorer.CustomExecutableRunConfiguration + 3768 + false + true + false + false + true + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 18 + + + Version + 18 + + -- 2.47.0