Index: .gitignore =================================================================== diff -u --- .gitignore (revision 0) +++ .gitignore (revision 09e6b966b0e44bad7540f1571e7562b28e3d9fe7) @@ -0,0 +1 @@ +*.pro.user* Index: denali.pro =================================================================== diff -u --- denali.pro (revision 0) +++ denali.pro (revision 09e6b966b0e44bad7540f1571e7562b28e3d9fe7) @@ -0,0 +1,61 @@ +QT += quick +CONFIG += c++11 + +# The following define makes your compiler emit warnings if you use +# any Qt feature that has been marked deprecated (the exact warnings +# depend on your compiler). Refer to the documentation for the +# deprecated API to know how to port your code away from it. +DEFINES += QT_DEPRECATED_WARNINGS + +# You can also make your code fail to compile if it uses 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 += \ + sources \ + sources/storage \ + sources/gui + +HEADERS += \ + sources/applicationcontroller.h \ + sources/applicationpost.h \ + sources/canbus/canbus.h \ + sources/configuration/display.h \ + sources/configuration/sound.h \ + sources/gui/guiactions.h \ + sources/gui/guiview.h \ + sources/gui/guicontroller.h \ + sources/maintimer.h \ + sources/storage/filehandler.h \ + sources/storage/logger.h \ + sources/storage/settings.h + +SOURCES += \ + main.cpp \ + sources/applicationcontroller.cpp \ + sources/applicationpost.cpp \ + sources/canbus/canbus.cpp \ + sources/configuration/display.cpp \ + sources/configuration/sound.cpp \ + sources/gui/guiactions.cpp \ + sources/gui/guiview.cpp \ + sources/gui/guicontroller.cpp \ + sources/maintimer.cpp \ + sources/storage/filehandler.cpp \ + sources/storage/logger.cpp \ + sources/storage/settings.cpp + +RESOURCES += \ + denali.qrc + +# Additional import path used to resolve QML modules in Qt Creator's code model +QML_IMPORT_PATH = + +# 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 Index: denali.qrc =================================================================== diff -u --- denali.qrc (revision 0) +++ denali.qrc (revision 09e6b966b0e44bad7540f1571e7562b28e3d9fe7) @@ -0,0 +1,21 @@ + + + sources/gui/qml/Home.ui.qml + sources/gui/qml/main.qml + sources/gui/qml/StartTreatment.ui.qml + sources/gui/qml/TreatmentManager.ui.qml + + + resources/images/Vegetables_Outline-03-128.png + resources/images/brightness_low_battery_sun_light-128.png + resources/images/brightness_high_business_building_sky-128.png + resources/images/Streamline-18-128.png + resources/images/Settings_gear_setting_tools-128.png + resources/images/ic_format_list_bulleted_48px-128.png + resources/images/00-ELASTOFONT-STORE-READY_user-circle-128.png + + + qtquickcontrols2.conf + + + Index: main.cpp =================================================================== diff -u --- main.cpp (revision 0) +++ main.cpp (revision 09e6b966b0e44bad7540f1571e7562b28e3d9fe7) @@ -0,0 +1,47 @@ +/*! \mainpage UI Software Design Description + * \section Detailed Description + * This document has been generated by Doxygen.\n + * This document describes the detail description of the UI Application Software design.\n + * UI Application starts by Appliucation Initialization which happens in \ref main.cpp "Initialization section".\n + */ + +// Qt +#include +#include +#include + +// Project +#include "maintimer.h" +#include "applicationcontroller.h" + +/*! \brief Application Initialization\n + * this section includes: + */ +int main(int argc, char *argv[]) +{ + //! - Qt Application initialization and parameters settings + // Qt Core Application parameters settings + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + // Qt Core Application Initialization + QGuiApplication app(argc, argv); + QCoreApplication::setApplicationVersion(QT_VERSION_STR); + QCoreApplication::setApplicationName(QLatin1String("Denali")); + QCoreApplication::setOrganizationName(QLatin1String("Diality Inc.")); + + //! - Tranlation initialization + QTranslator translator; + if (translator.load(QLocale(), app.applicationName(), QLatin1String("_"), QLatin1String(":/translations"))) + app.installTranslator(&translator); + + //! - Initializing Main Timer + MainTimer::I()->init(); + //! - Initializing Application Controller + QObject::connect(ApplicationController::I(), &ApplicationController::quit, &app, [](int retcode) { + // TODO : Logger needs to log this issue + qDebug() << "Application Terminated:" << retcode; + QCoreApplication::exit(retcode); + }, Qt::QueuedConnection); + ApplicationController::I()->init(); + + return app.exec(); +} Index: qtquickcontrols2.conf =================================================================== diff -u --- qtquickcontrols2.conf (revision 0) +++ qtquickcontrols2.conf (revision 09e6b966b0e44bad7540f1571e7562b28e3d9fe7) @@ -0,0 +1,2 @@ +[Controls] +Style=Imagine Index: resources/images/00-ELASTOFONT-STORE-READY_user-circle-128.png =================================================================== diff -u Binary files differ Index: resources/images/Settings_gear_setting_tools-128.png =================================================================== diff -u Binary files differ Index: resources/images/Streamline-18-128.png =================================================================== diff -u Binary files differ Index: resources/images/Vegetables_Outline-03-128.png =================================================================== diff -u Binary files differ Index: resources/images/brightness_high_business_building_sky-128.png =================================================================== diff -u Binary files differ Index: resources/images/brightness_low_battery_sun_light-128.png =================================================================== diff -u Binary files differ Index: resources/images/ic_format_list_bulleted_48px-128.png =================================================================== diff -u Binary files differ Index: resources/images/logo.png =================================================================== diff -u Binary files differ Index: sources/applicationcontroller.cpp =================================================================== diff -u --- sources/applicationcontroller.cpp (revision 0) +++ sources/applicationcontroller.cpp (revision 09e6b966b0e44bad7540f1571e7562b28e3d9fe7) @@ -0,0 +1,48 @@ +#include "applicationcontroller.h" + +// Qt +#include + +// Project + +ApplicationController *ApplicationController::_instance = nullptr; +ApplicationController::ApplicationController(QObject *parent) : QObject(parent) +{ + _guiController = Gui::GuiController::I(); + _fileHandler = new Storage::FileHandler (this); + _applicationPost = new ApplicationPost(this); + connect(_guiController,&GuiController::initialized,this, &ApplicationController::UiInitialized); +} + +bool ApplicationController::event(QEvent *event) +{ + return QObject::event(event); +} + +ApplicationController *ApplicationController::I() +{ + if (!_instance) { + _instance = new ApplicationController(); + } + return _instance; +} + +bool ApplicationController::init() +{ + if (!_fileHandler ->init()) return false; + if (!_applicationPost->init()) return false; + _guiController->init(); + return true; +} + +void ApplicationController::UiInitialized(bool ok) +{ + if(ok) { + if(_applicationPost->init()) { + _applicationPost->start(); + } + } + else { + quit(-1); + } +} Index: sources/applicationcontroller.h =================================================================== diff -u --- sources/applicationcontroller.h (revision 0) +++ sources/applicationcontroller.h (revision 09e6b966b0e44bad7540f1571e7562b28e3d9fe7) @@ -0,0 +1,40 @@ +#pragma once + +// Qt +#include +#include + +// Project +#include "filehandler.h" +#include "applicationpost.h" +#include "guicontroller.h" +using namespace Storage; +using namespace Gui; + + +class ApplicationController : public QObject +{ + Q_OBJECT + + static ApplicationController *_instance; + ApplicationPost *_applicationPost = nullptr; + FileHandler *_fileHandler = nullptr; + + QPointer _guiController; + + explicit ApplicationController(QObject *parent = nullptr); + + bool event(QEvent *event) override; + +public: + static ApplicationController *I(); + bool init(); + +signals: + void quit(int retcode=0); + +private slots: + void UiInitialized(bool ok); + +}; + Index: sources/applicationpost.cpp =================================================================== diff -u --- sources/applicationpost.cpp (revision 0) +++ sources/applicationpost.cpp (revision 09e6b966b0e44bad7540f1571e7562b28e3d9fe7) @@ -0,0 +1,16 @@ +#include "applicationpost.h" + +ApplicationPost::ApplicationPost(QObject *parent) : QObject(parent) +{ + +} + +bool ApplicationPost::init() +{ + return true; +} + +bool ApplicationPost::start() +{ + return true; +} Index: sources/applicationpost.h =================================================================== diff -u --- sources/applicationpost.h (revision 0) +++ sources/applicationpost.h (revision 09e6b966b0e44bad7540f1571e7562b28e3d9fe7) @@ -0,0 +1,17 @@ +#pragma once + +#include + +class ApplicationPost : public QObject +{ + Q_OBJECT +public: + explicit ApplicationPost(QObject *parent = nullptr); + bool init(); + bool start(); + +signals: + +public slots: +}; + Index: sources/canbus/canbus.cpp =================================================================== diff -u --- sources/canbus/canbus.cpp (revision 0) +++ sources/canbus/canbus.cpp (revision 09e6b966b0e44bad7540f1571e7562b28e3d9fe7) @@ -0,0 +1,10 @@ +#include "canbus.h" + +/*! + * \brief CanBus::CanBus + * \param parent + */ +CanBus::CanBus(QObject *parent) : QObject(parent) +{ + +} Index: sources/canbus/canbus.h =================================================================== diff -u --- sources/canbus/canbus.h (revision 0) +++ sources/canbus/canbus.h (revision 09e6b966b0e44bad7540f1571e7562b28e3d9fe7) @@ -0,0 +1,22 @@ +#pragma once + +#include + +/*! + * \brief The CanBus class + * This class contains the interface to CanBus\n + * And utilizes Qt QCanBus to interact with the CanBus\n + * On the OS size there is a driver installed to convert SPI to CAN\n + * Since the GUI Board by itself doesn't contain the CAN Bus. + * \image html CanInterface.png + */ +class CanBus : public QObject +{ + Q_OBJECT +public: + explicit CanBus(QObject *parent = nullptr); + +signals: + +public slots: +}; Index: sources/configuration/display.cpp =================================================================== diff -u --- sources/configuration/display.cpp (revision 0) +++ sources/configuration/display.cpp (revision 09e6b966b0e44bad7540f1571e7562b28e3d9fe7) @@ -0,0 +1,8 @@ +#include "display.h" + +using namespace Configuration; + +display::display(QObject *parent) : QObject(parent) +{ + +} Index: sources/configuration/display.h =================================================================== diff -u --- sources/configuration/display.h (revision 0) +++ sources/configuration/display.h (revision 09e6b966b0e44bad7540f1571e7562b28e3d9fe7) @@ -0,0 +1,17 @@ +#pragma once + +#include +namespace Configuration { + +class display : public QObject +{ + Q_OBJECT +public: + explicit display(QObject *parent = nullptr); + +signals: + +public slots: +}; + +} Index: sources/configuration/sound.cpp =================================================================== diff -u --- sources/configuration/sound.cpp (revision 0) +++ sources/configuration/sound.cpp (revision 09e6b966b0e44bad7540f1571e7562b28e3d9fe7) @@ -0,0 +1,8 @@ +#include "sound.h" + +using namespace Configuration; + +sound::sound(QObject *parent) : QObject(parent) +{ + +} Index: sources/configuration/sound.h =================================================================== diff -u --- sources/configuration/sound.h (revision 0) +++ sources/configuration/sound.h (revision 09e6b966b0e44bad7540f1571e7562b28e3d9fe7) @@ -0,0 +1,18 @@ +#pragma once + +#include + +namespace Configuration { + +class sound : public QObject +{ + Q_OBJECT +public: + explicit sound(QObject *parent = nullptr); + +signals: + +public slots: +}; + +} Index: sources/gui/guiactions.cpp =================================================================== diff -u --- sources/gui/guiactions.cpp (revision 0) +++ sources/gui/guiactions.cpp (revision 09e6b966b0e44bad7540f1571e7562b28e3d9fe7) @@ -0,0 +1,7 @@ +#include "guiactions.h" + +using namespace Gui; + +GuiActions::GuiActions() +{ +} Index: sources/gui/guiactions.h =================================================================== diff -u --- sources/gui/guiactions.h (revision 0) +++ sources/gui/guiactions.h (revision 09e6b966b0e44bad7540f1571e7562b28e3d9fe7) @@ -0,0 +1,23 @@ +#pragma once + +#include + +namespace Gui { + +class GuiActions +{ + Q_GADGET + explicit GuiActions(); +public: + enum GuiActions_Enum { + ActStartTreatment, + ActBack, + ActConfirm + }; + + Q_ENUM(GuiActions_Enum) + +}; +typedef GuiActions::GuiActions_Enum GuiAction; + +} Index: sources/gui/guicontroller.cpp =================================================================== diff -u --- sources/gui/guicontroller.cpp (revision 0) +++ sources/gui/guicontroller.cpp (revision 09e6b966b0e44bad7540f1571e7562b28e3d9fe7) @@ -0,0 +1,73 @@ +#include "guicontroller.h" + +// Qt + +// Project +#include "guiview.h" +#include "maintimer.h" + +using namespace Gui; + +GuiController *GuiController::_instance = nullptr; +void GuiController::registerView() +{ + qRegisterMetaType("GuiAction"); + qmlRegisterType ("Gui.View", 0, 1, "GuiView"); + qmlRegisterUncreatableType ("Gui.Actions", 0, 1, "GuiActions",QStringLiteral("Used only for enums no need to have an object")); +} + +GuiController::GuiController(QObject *parent) : QObject(parent) +{ + registerView(); + connect(this ,&GuiController::actionRequested, this, &GuiController::actionEvaluation); +} + +GuiController *GuiController::I() +{ + if (!_instance) { + _instance = new GuiController(); + } + return _instance; +} + +void GuiController::init() +{ + connect(&_viewer, &QQuickView::statusChanged, this, &GuiController::onUiStatusChanged); + const QUrl url(QML("main")); + _viewer.setSource(url); +} + +void GuiController::onUiStatusChanged(QQuickView::Status vStatus) +{ + bool ok = vStatus == QQuickView::Ready; + if (ok) { + _viewer.show(); + } + emit initialized(ok); +} + +/*! + * \brief GuiController::actionEvaluation + * This method evaluated that if the action is accepted or not,\n + * Regarding to the current state and the action.\n + * These actions are only user actions and there is only one user interaction,\n + * So no need to capture from which screen this action comes since we have the current state.\n + * Sometimes GuiController requires to investigate with the ApplicationController to get approval from HD device.\n + * \param vAction - User requested Action + */ +void GuiController::actionEvaluation(GuiAction vAction) +{ + static bool requested = false; + qDebug() << "actionRequested : " << vAction; + + // TEST : check state and evaluate. + if (!requested) { + requested = true; + qDebug() << "Ask again: " << vAction; + actionEvaluated(vAction, false); + return; + } + requested = false; + qDebug() << "Got it: " << vAction; + actionEvaluated(vAction, true); +} Index: sources/gui/guicontroller.h =================================================================== diff -u --- sources/gui/guicontroller.h (revision 0) +++ sources/gui/guicontroller.h (revision 09e6b966b0e44bad7540f1571e7562b28e3d9fe7) @@ -0,0 +1,39 @@ +#pragma once + +// Qt +#include +#include +// Project +#include "guiactions.h" + +#define QML(qml) QStringLiteral("qrc:/qml/" qml ".qml") + +namespace Gui { + +class GuiController : public QObject +{ + Q_OBJECT + + QQuickView _viewer; + void registerView(); + + static GuiController *_instance; + explicit GuiController(QObject *parent = nullptr); + +public: + static GuiController *I(); + void init(); + + +private slots: + void onUiStatusChanged(QQuickView::Status vStatus); + void actionEvaluation(GuiAction vAction); + +signals: + void initialized(bool ok); + + void actionRequested(GuiAction vAction); + void actionEvaluated(GuiAction vAction, bool vAccepted); +}; + +} Index: sources/gui/guiview.cpp =================================================================== diff -u --- sources/gui/guiview.cpp (revision 0) +++ sources/gui/guiview.cpp (revision 09e6b966b0e44bad7540f1571e7562b28e3d9fe7) @@ -0,0 +1,20 @@ +#include "guiview.h" + +// Project +#include "guicontroller.h" + +using namespace Gui; + +// We don't have access to view object since it has been created in the GUI +// So here connect to the controller which we have access to. +// Also here emit the controller signal since for the same reason. +GuiView::GuiView(QQuickItem *parent) +{ + Q_UNUSED(parent) + connect(GuiController::I(), &GuiController::actionEvaluated, this, &GuiView::actionEvaluated); +} + +void GuiView::notifyActionRequest(GuiAction vAction) +{ + emit GuiController::I()->actionRequested(vAction); +} Index: sources/gui/guiview.h =================================================================== diff -u --- sources/gui/guiview.h (revision 0) +++ sources/gui/guiview.h (revision 09e6b966b0e44bad7540f1571e7562b28e3d9fe7) @@ -0,0 +1,24 @@ +#pragma once + +// Qt +#include +// Project +#include "guiactions.h" + +namespace Gui { + +class GuiView : public QQuickItem +{ + Q_OBJECT + +public: + explicit GuiView(QQuickItem *parent = nullptr); + +public slots: + void notifyActionRequest(GuiAction vAction); + +signals: + void actionEvaluated(GuiAction vAction, bool vAccepted); +}; + +} Index: sources/gui/qml/Home.ui.qml =================================================================== diff -u --- sources/gui/qml/Home.ui.qml (revision 0) +++ sources/gui/qml/Home.ui.qml (revision 09e6b966b0e44bad7540f1571e7562b28e3d9fe7) @@ -0,0 +1,252 @@ +import QtQuick 2.12 +import QtQuick.Controls 2.12 + +Page { + width: 1280 + height: 800 + property alias mouseAreaTreatmentHistory: mouseAreaTreatmentHistory + property alias mouseAreaDeviceSettings: mouseAreaDeviceSettings + property alias mouseAreaTreatmentManager: mouseAreaTreatmentManager + property alias mouseAreaDayNightMode: mouseAreaDayNightMode + property alias mouseAreaStartTreatment: mouseAreaStartTreatment + property bool nightMode: false + + property int gW: 500 + property int gH: 125 + property int gFontPixelButton: 12 * 2 + property int gFontPixelTitle: 12 * 4 + property int gBorderWidth: 3 + property color borderColor: "#4370b3" + + title: "Home" + Rectangle { + id: backgroundRect + color: "#709aca" + anchors.fill: parent + Rectangle { + id: rectStartTreatment + x: 80 + y: 230 + width: gW + height: gH + color: "#dae8fc" + radius: 10 + border.color: borderColor + border.width: gBorderWidth + + Text { + id: textStartTreatment + text: qsTr("Start Treatment") + anchors.fill: parent + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + font.pixelSize: gFontPixelButton + } + + Image { + id: imageStartTreatment + x: 20 + y: 10 + width: 100 + anchors.left: parent.left + anchors.leftMargin: 20 + anchors.bottom: parent.bottom + anchors.bottomMargin: 10 + anchors.top: parent.top + anchors.topMargin: 10 + source: "qrc:/images/startTreatment" + z: 1 + fillMode: Image.PreserveAspectFit + } + + MouseArea { + id: mouseAreaStartTreatment + anchors.fill: parent + } + } + + Rectangle { + id: rectDayNightMode + x: 700 + y: 230 + width: gW + height: gH + color: "#dae8fc" + radius: 10 + border.color: borderColor + border.width: gBorderWidth + + Text { + id: textDayNightMode + text: qsTr("Day/Night Mode") + anchors.fill: parent + verticalAlignment: Text.AlignVCenter + font.pixelSize: gFontPixelButton + horizontalAlignment: Text.AlignHCenter + } + + Image { + id: imageDayNightMode + width: 100 + height: 100 + anchors.left: parent.left + anchors.leftMargin: 20 + anchors.bottom: parent.bottom + anchors.bottomMargin: 10 + anchors.top: parent.top + anchors.topMargin: 10 + source: nightMode ? "qrc:/images/nightMode" : "qrc:/images/dayMode" + fillMode: Image.PreserveAspectFit + } + + MouseArea { + id: mouseAreaDayNightMode + anchors.fill: parent + } + } + + Rectangle { + id: rectTreatmentManager + x: 80 + y: 410 + width: gW + height: gH + color: "#dae8fc" + radius: 10 + border.color: borderColor + border.width: gBorderWidth + + Text { + id: textTreatmentManager + text: qsTr("Treatment Manager") + anchors.fill: parent + verticalAlignment: Text.AlignVCenter + font.pixelSize: gFontPixelButton + horizontalAlignment: Text.AlignHCenter + } + + Image { + id: imageTreatmentManager + width: 100 + height: 100 + anchors.bottom: parent.bottom + anchors.bottomMargin: 10 + anchors.top: parent.top + anchors.topMargin: 10 + anchors.left: parent.left + anchors.leftMargin: 20 + source: "qrc:/images/treatmentManager" + fillMode: Image.PreserveAspectFit + } + + MouseArea { + id: mouseAreaTreatmentManager + anchors.fill: parent + } + } + + Rectangle { + id: rectDeviceSettings + x: 700 + y: 410 + width: gW + height: gH + color: "#dae8fc" + radius: 10 + border.color: borderColor + border.width: gBorderWidth + + Text { + id: textDeviceSettings + text: qsTr("Device Settings") + anchors.fill: parent + verticalAlignment: Text.AlignVCenter + font.pixelSize: gFontPixelButton + horizontalAlignment: Text.AlignHCenter + } + + Image { + id: imageDeviceSettings + width: 100 + height: 100 + anchors.bottom: parent.bottom + anchors.bottomMargin: 10 + anchors.top: parent.top + anchors.topMargin: 10 + anchors.left: parent.left + anchors.leftMargin: 20 + source: "qrc:/images/deviceSettings" + fillMode: Image.PreserveAspectFit + } + + MouseArea { + id: mouseAreaDeviceSettings + anchors.fill: parent + } + } + + Rectangle { + id: rectTreatmentHistory + x: 80 + y: 590 + width: gW + height: gH + color: "#dae8fc" + radius: 10 + border.color: borderColor + border.width: gBorderWidth + + Text { + id: textTreatmentHistory + text: qsTr("Treatment History") + anchors.fill: parent + verticalAlignment: Text.AlignVCenter + font.pixelSize: gFontPixelButton + horizontalAlignment: Text.AlignHCenter + } + + Image { + id: imageTreatmentHistory + width: 100 + height: 100 + anchors.bottom: parent.bottom + anchors.bottomMargin: 10 + anchors.top: parent.top + anchors.topMargin: 10 + anchors.left: parent.left + anchors.leftMargin: 20 + source: "qrc:/images/treatmentHistory" + fillMode: Image.PreserveAspectFit + } + + MouseArea { + id: mouseAreaTreatmentHistory + anchors.fill: parent + } + } + + Text { + id: textHeader + text: qsTr("Diality Home Dialysis") + anchors.right: parent.right + anchors.rightMargin: 576 + anchors.left: parent.left + anchors.leftMargin: 576 + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + anchors.top: parent.top + anchors.topMargin: 64 + font.pixelSize: gFontPixelTitle + } + + Image { + id: imageHeader + x: 1100 + y: 22 + width: 100 + height: 100 + source: "qrc:/images/home" + fillMode: Image.PreserveAspectFit + } + } +} Index: sources/gui/qml/StartTreatment.ui.qml =================================================================== diff -u --- sources/gui/qml/StartTreatment.ui.qml (revision 0) +++ sources/gui/qml/StartTreatment.ui.qml (revision 09e6b966b0e44bad7540f1571e7562b28e3d9fe7) @@ -0,0 +1,16 @@ +import QtQuick 2.12 +import QtQuick.Controls 2.12 + +Item { + width: 1280 + height: 800 + + property alias btnBack: btnBack + + Button { + id: btnBack + x: 12 + y: 747 + text: qsTr("Back") + } +} Index: sources/gui/qml/TreatmentManager.ui.qml =================================================================== diff -u --- sources/gui/qml/TreatmentManager.ui.qml (revision 0) +++ sources/gui/qml/TreatmentManager.ui.qml (revision 09e6b966b0e44bad7540f1571e7562b28e3d9fe7) @@ -0,0 +1,16 @@ +import QtQuick 2.12 +import QtQuick.Controls 2.5 + +Item { + width: 1280 + height: 800 + + property alias btnBack: btnBack + + Button { + id: btnBack + x: 12 + y: 747 + text: qsTr("Back") + } +} Index: sources/gui/qml/main.qml =================================================================== diff -u --- sources/gui/qml/main.qml (revision 0) +++ sources/gui/qml/main.qml (revision 09e6b966b0e44bad7540f1571e7562b28e3d9fe7) @@ -0,0 +1,67 @@ +import QtQuick 2.12 +import QtQuick.Controls 2.12 +import Gui.View 0.1; +import Gui.Actions 0.1; + +/* + Copyright Diality Inc. 2019-2020 All Rights Reserved. + Diality Inc. + Denali Project + main.qml + Initialization and start point of the QML + Behrouz NematiPour, bNematiPour@Diality.com + //Revision History (optional) + */ +Item { id: _itemWindow + visible: true + width: 1280 + height: 800 + + GuiView { id: _guiView + onActionEvaluated: { + if (vAction === GuiActions.ActBack) { + if (vAccepted) { + _stackView.pop() + } + } + if (vAction === GuiActions.ActConfirm) { + // NoOp + } + } + } + + StartTreatment { id: _startTreatmentScreen + btnBack.onClicked: { + _guiView.notifyActionRequest(GuiActions.ActBack) + abc() + } + btnBack.onPressAndHold: { + _guiView.notifyActionRequest(GuiActions.ActConfirm) + } + } + + TreatmentManager { id: _treatmentMansagerScreen + btnBack.onClicked: { + _guiView.notifyActionRequest(GuiActions.ActBack) + } + } + + Home { id: _homeScreen + visible: true + mouseAreaStartTreatment.onClicked: { + _stackView.push(_startTreatmentScreen) + } + mouseAreaDayNightMode.onClicked: { + nightMode = !nightMode + } + mouseAreaTreatmentManager.onClicked: { + _stackView.push(_treatmentMansagerScreen) + } + } + + StackView { + id: _stackView + initialItem: _homeScreen + anchors.fill: parent + } +} Index: sources/maintimer.cpp =================================================================== diff -u --- sources/maintimer.cpp (revision 0) +++ sources/maintimer.cpp (revision 09e6b966b0e44bad7540f1571e7562b28e3d9fe7) @@ -0,0 +1,35 @@ +#include "maintimer.h" + +//Qt +#include + +//Project + +// Class instance init +MainTimer *MainTimer::_instance = nullptr; + +MainTimer::MainTimer(QObject *parent) : QObject(parent) +{ + _timer = new QTimer(this); +} + +void MainTimer::init() +{ + connect(_timer, SIGNAL(timeout()), this, SLOT(onTimeout())); + connect(_timer, SIGNAL(timeout()), this, SIGNAL(timeout())); + _timer->start(_timeout); +} + +MainTimer *MainTimer::I() +{ + if (!_instance) { + _instance = new MainTimer(); + } + return _instance; +} + +void MainTimer::onTimeout() +{ + // no op yet +} + Index: sources/maintimer.h =================================================================== diff -u --- sources/maintimer.h (revision 0) +++ sources/maintimer.h (revision 09e6b966b0e44bad7540f1571e7562b28e3d9fe7) @@ -0,0 +1,28 @@ +#pragma once + +// Qt +#include + +// Project + +class QTimer; +class MainTimer : public QObject +{ + Q_OBJECT + + static const int _timeout = 1000; //ms + + QTimer *_timer = nullptr; + static MainTimer *_instance; + explicit MainTimer(QObject *parent = nullptr); + +public: + static MainTimer *I(); + void init(); + +signals: + void timeout(); + +private slots: + void onTimeout(); +}; Index: sources/storage/filehandler.cpp =================================================================== diff -u --- sources/storage/filehandler.cpp (revision 0) +++ sources/storage/filehandler.cpp (revision 09e6b966b0e44bad7540f1571e7562b28e3d9fe7) @@ -0,0 +1,30 @@ +#include "filehandler.h" + +//Qt +#include +#include + +// Project + +using namespace Storage; +FileHandler::FileHandler(QObject *parent) : QObject(parent) +{ + connect(&fsWatcher, &QFileSystemWatcher::directoryChanged, this, &FileHandler::directoryChanged); +} + +bool FileHandler::init() +{ + fsWatcher.addPath("/dev/"); + return true; +} + +void FileHandler::directoryChanged() +{ + qDebug() << QFileInfo::exists("/dev/sda"); +} + +bool FileHandler::mountUsb() +{ + return true; +} + Index: sources/storage/filehandler.h =================================================================== diff -u --- sources/storage/filehandler.h (revision 0) +++ sources/storage/filehandler.h (revision 09e6b966b0e44bad7540f1571e7562b28e3d9fe7) @@ -0,0 +1,33 @@ +#pragma once + +// Qt +#include +#include +// Project + +namespace Storage { + +class FileHandler : public QObject +{ + Q_OBJECT + + const char *_usbMount = "/media"; + + QFileSystemWatcher fsWatcher; + +public: + explicit FileHandler(QObject *parent = nullptr); + + bool init(); + bool doExport(); + bool doImport(); + +signals: + void usbStatusChanged(bool available); + +private slots: + void directoryChanged(); + bool mountUsb(); +}; + +} Index: sources/storage/logger.cpp =================================================================== diff -u --- sources/storage/logger.cpp (revision 0) +++ sources/storage/logger.cpp (revision 09e6b966b0e44bad7540f1571e7562b28e3d9fe7) @@ -0,0 +1,8 @@ +#include "logger.h" + +using namespace Storage; + +Logger::Logger(QObject *parent) : QObject(parent) +{ + +} Index: sources/storage/logger.h =================================================================== diff -u --- sources/storage/logger.h (revision 0) +++ sources/storage/logger.h (revision 09e6b966b0e44bad7540f1571e7562b28e3d9fe7) @@ -0,0 +1,18 @@ +#pragma once + +#include + +namespace Storage { + +class Logger : public QObject +{ + Q_OBJECT +public: + explicit Logger(QObject *parent = nullptr); + +signals: + +public slots: +}; + +} Index: sources/storage/settings.cpp =================================================================== diff -u --- sources/storage/settings.cpp (revision 0) +++ sources/storage/settings.cpp (revision 09e6b966b0e44bad7540f1571e7562b28e3d9fe7) @@ -0,0 +1,8 @@ +#include "settings.h" + +using namespace Storage; + +Settings::Settings(QObject *parent) : QObject(parent) +{ + +} Index: sources/storage/settings.h =================================================================== diff -u --- sources/storage/settings.h (revision 0) +++ sources/storage/settings.h (revision 09e6b966b0e44bad7540f1571e7562b28e3d9fe7) @@ -0,0 +1,18 @@ +#pragma once + +#include + +namespace Storage { + +class Settings : public QObject +{ + Q_OBJECT +public: + explicit Settings(QObject *parent = nullptr); + +signals: + +public slots: +}; + +}