Index: denali.pro =================================================================== diff -u -rb798668f16ad0967ab97e96f5f9a2cdd821e899f -rd4b88173e0d4a683a315d2fc57b8e1ec356b1232 --- denali.pro (.../denali.pro) (revision b798668f16ad0967ab97e96f5f9a2cdd821e899f) +++ denali.pro (.../denali.pro) (revision d4b88173e0d4a683a315d2fc57b8e1ec356b1232) @@ -1,6 +1,6 @@ QT += widgets qml quick serialbus concurrent CONFIG += c++17 warn_on -QMAKE_CXXFLAGS += -Wall -Werror -Wimplicit-fallthrough # -save-temps +QMAKE_CXXFLAGS += -Wall -Werror -Wimplicit-fallthrough # -save-temps // see .ii and .s files #CONFIG += disable_crc disable_crc { Index: denali.qrc =================================================================== diff -u -r34471900489397f483e052870ddc46059cef49fb -rd4b88173e0d4a683a315d2fc57b8e1ec356b1232 --- denali.qrc (.../denali.qrc) (revision 34471900489397f483e052870ddc46059cef49fb) +++ denali.qrc (.../denali.qrc) (revision d4b88173e0d4a683a315d2fc57b8e1ec356b1232) @@ -8,6 +8,7 @@ sources/gui/qml/dialogs/PowerOff.qml sources/gui/qml/dialogs/AutoHideInfo.qml + sources/gui/qml/dialogs/NotificationDialog.qml resources/images/Settings_gear_setting_tools-128.png @@ -18,6 +19,7 @@ resources/images/ArrowRight.png resources/images/logo d Dark Transparent.png resources/images/Close.png + resources/images/alarm.svg sources/gui/qml/components/MainMenu.qml Index: main.cpp =================================================================== diff -u -r95c671ab7037af055db551456a719ff67bf10262 -rd4b88173e0d4a683a315d2fc57b8e1ec356b1232 --- main.cpp (.../main.cpp) (revision 95c671ab7037af055db551456a719ff67bf10262) +++ main.cpp (.../main.cpp) (revision d4b88173e0d4a683a315d2fc57b8e1ec356b1232) @@ -66,7 +66,7 @@ int gFakeInterval = 0 ; QByteArray gFakeData = "" ; const char *gFakeData_default = "00" ; -bool gSendEmptyKeepAwake = true ; +bool gSendEmptyKeepAwake = false ; bool gFakeSeqAtBegin = false ; bool gDisableHunhandledReport = false ; @@ -113,8 +113,8 @@ parser.addOption(optionConsoleoutFrameInterface); // --- -0 : disable-keep-awake (the fast mode) - QCommandLineOption optionSendEmptyKeepAwake(QStringList() << "0" << "disable-keep-awake", - QCoreApplication::translate("main", "Disable send low priority, empty message on the CANBus just to keep UI board CAN driver awake")); + QCommandLineOption optionSendEmptyKeepAwake(QStringList() << "0" << "enable-keep-awake", + QCoreApplication::translate("main", "Enable send low priority, empty message on the CANBus just to keep UI board CAN driver awake")); parser.addOption(optionSendEmptyKeepAwake); // --- -i : fake-interval @@ -152,7 +152,7 @@ gConsoleoutFrameInterface = parser.isSet(optionConsoleoutFrameInterface ); gDisableHunhandledReport = parser.isSet(optionDisableHunhandledReport ); - if (parser.isSet(optionSendEmptyKeepAwake)) gSendEmptyKeepAwake = false; + if (parser.isSet(optionSendEmptyKeepAwake)) gSendEmptyKeepAwake = true; bool ok = false; if (parser.isSet(optionFakeInterval)) { Index: sources/gui/qml/components/ModalDialog.qml =================================================================== diff -u -rf148379112a69d1c52027f2667e95f3f96d948ad -rd4b88173e0d4a683a315d2fc57b8e1ec356b1232 --- sources/gui/qml/components/ModalDialog.qml (.../ModalDialog.qml) (revision f148379112a69d1c52027f2667e95f3f96d948ad) +++ sources/gui/qml/components/ModalDialog.qml (.../ModalDialog.qml) (revision d4b88173e0d4a683a315d2fc57b8e1ec356b1232) @@ -24,9 +24,13 @@ * \brief The parent item for modal dialogs */ Dialog { id : _root - property bool autoHide : false - property int autoHideDuration : 1000 - property alias notificationText : _notification.text + property bool autoHide : false; + property int autoHideDuration : 1000; + property alias notificationText : _notification.text; + property alias backgroundColor : _backgroundRect.color; + property alias textColor : _notification.textColor; + property alias border : _backgroundRect.border; + property alias radius : _backgroundRect.radius; width : Variables.dialogWidth height : Variables.dialogHeight Index: sources/gui/qml/components/NotificationBar.qml =================================================================== diff -u -r909090c5bae8b2fcc9aed6c2b55078b4f3d26fdd -rd4b88173e0d4a683a315d2fc57b8e1ec356b1232 --- sources/gui/qml/components/NotificationBar.qml (.../NotificationBar.qml) (revision 909090c5bae8b2fcc9aed6c2b55078b4f3d26fdd) +++ sources/gui/qml/components/NotificationBar.qml (.../NotificationBar.qml) (revision d4b88173e0d4a683a315d2fc57b8e1ec356b1232) @@ -22,8 +22,9 @@ Rectangle { id: _root objectName: "NotificationBar" - property alias text : _text.text - property int level : 0 + property alias text : _text.text; + property alias textColor : _text.color; + property int level : 0; visible : _text.text @@ -45,23 +46,6 @@ } onLevelChanged: { - switch (level) { - case GuiActions.ALARM_PRIORITY_HIGH: - _root.color = Colors.textNotificationHighBg; - _text.color = Colors.textNotificationHighFg; - break; - case GuiActions.ALARM_PRIORITY_MEDIUM: - _root.color = Colors.textNotificationMedBg; - _text.color = Colors.textNotificationMedFg; - break; - case GuiActions.ALARM_PRIORITY_LOW: - _root.color = Colors.textNotificationLowBg; - _text.color = Colors.textNotificationLowFg; - break; - default : // GuiActions.ALARM_PRIORITY_NONE - _root.color = Colors.textNotificationNoneBg; - _text.color = Colors.textNotificationNoneFg; - break; - } + [_root.color, _text.color] = getRootTextFromAlarmLevel(level); } } Index: sources/gui/qml/components/TouchRect.qml =================================================================== diff -u -r45617764a63d5573bfb942b039f2854ed25ba15d -rd4b88173e0d4a683a315d2fc57b8e1ec356b1232 --- sources/gui/qml/components/TouchRect.qml (.../TouchRect.qml) (revision 45617764a63d5573bfb942b039f2854ed25ba15d) +++ sources/gui/qml/components/TouchRect.qml (.../TouchRect.qml) (revision d4b88173e0d4a683a315d2fc57b8e1ec356b1232) @@ -71,12 +71,12 @@ radius : Variables.touchRectRadius color : backgroundColor border { - color: Colors.borderButton + color: borderColor width: Variables.borderWidth } Text { id: _text anchors.centerIn: parent - color: Colors.textMain + color: textColor font.pixelSize: Fonts.fontPixelButton } MouseArea { id: _mouseArea Index: sources/gui/qml/globals/Colors.qml =================================================================== diff -u -r45617764a63d5573bfb942b039f2854ed25ba15d -rd4b88173e0d4a683a315d2fc57b8e1ec356b1232 --- sources/gui/qml/globals/Colors.qml (.../Colors.qml) (revision 45617764a63d5573bfb942b039f2854ed25ba15d) +++ sources/gui/qml/globals/Colors.qml (.../Colors.qml) (revision d4b88173e0d4a683a315d2fc57b8e1ec356b1232) @@ -77,4 +77,7 @@ readonly property color textNotificationHighBg : "#c53b33" // red readonly property color textNotificationHighFg : "white" + + readonly property color backgroundAlarmTopBar : "#831913" + } Index: sources/gui/qml/globals/Fonts.qml =================================================================== diff -u -r5c5fa01738826261e0b3647db6b7b3fc26b04251 -rd4b88173e0d4a683a315d2fc57b8e1ec356b1232 --- sources/gui/qml/globals/Fonts.qml (.../Fonts.qml) (revision 5c5fa01738826261e0b3647db6b7b3fc26b04251) +++ sources/gui/qml/globals/Fonts.qml (.../Fonts.qml) (revision d4b88173e0d4a683a315d2fc57b8e1ec356b1232) @@ -24,6 +24,7 @@ QtObject { readonly property int fontPixelButton : 24 readonly property int fontPixelTitle : 42 + readonly property int fontPixelDialogText : 22 readonly property int fontPixelTouchAreaTitle : 16 Index: sources/gui/qml/globals/Variables.qml =================================================================== diff -u -r9ec7a27375189ad75f0bef142cd6beb386db0955 -rd4b88173e0d4a683a315d2fc57b8e1ec356b1232 --- sources/gui/qml/globals/Variables.qml (.../Variables.qml) (revision 9ec7a27375189ad75f0bef142cd6beb386db0955) +++ sources/gui/qml/globals/Variables.qml (.../Variables.qml) (revision d4b88173e0d4a683a315d2fc57b8e1ec356b1232) @@ -24,6 +24,10 @@ QtObject { readonly property int applicationWidth : 1280 readonly property int applicationHeight : 800 + readonly property int buttonSpacing : 150 + readonly property int dialogSVGHeight : 50 + readonly property int dialogSVGWidth : 50 + readonly property int dialogSVGIconOffset : 25 readonly property int headerHeight : 100 readonly property int mainMenuHeight : 70 Index: sources/gui/qml/main.qml =================================================================== diff -u -r95c671ab7037af055db551456a719ff67bf10262 -rd4b88173e0d4a683a315d2fc57b8e1ec356b1232 --- sources/gui/qml/main.qml (.../main.qml) (revision 95c671ab7037af055db551456a719ff67bf10262) +++ sources/gui/qml/main.qml (.../main.qml) (revision d4b88173e0d4a683a315d2fc57b8e1ec356b1232) @@ -166,11 +166,40 @@ NotificationBar { id: _alarm + // TODO: Maybe add semi-transparent speaker icon inside the notification bar to toggle alarm + // OR, Create a dialog that has the OK button and dismiss button with + // metadata of the alarm that can be viewed when tapping on the notification bar + // TODO: Also need to create UX diagram flow and put it in the SRS, talk to Nick and Blaine for approval + // The highest priority alarm will unsilence itself automatically every minute. FW controls audio output + // When the highest priority alarm unsilences itself, the dialog should show again. The dialog may need to + // be implemented or a base dialog qml object should be used. + // The alarm should be controllable from the Dialog or the notification bar or both. (Settings page, too?) + anchors.bottom: _mainMenu.top level : vAlarmStatus.alarm_Priority - text : vAlarmStatus.text + text : vAlarmStatus.text; + + MouseArea { + id: _TouchArea + anchors.fill: parent; + onClicked: { + notification.visible = true; + notification.titleText = "Alarm"; + notification.description = vAlarmStatus.text; + [notification.backgroundColor, notification.textColor] = getRootTextFromAlarmLevel(vAlarmStatus.alarm_Priority); + _alarm.visible = false; + notification.dismissBtn.callback = (function() {vAlarmStatus.dismissAlarm();}); + notification.okayBtn.callback = (function() {vAlarmStatus.okayAlarm();}); + } + } } + NotificationDialog { id: notification + onClosed: { + _alarm.visible = true; + } + } + // 9 - Others Text { // TEST : Application version should be moved into the information screen later. color: Colors.textMain @@ -186,4 +215,29 @@ text: Qt.application.version font.pixelSize: 14 } + + function getRootTextFromAlarmLevel(level) { + let root_color = ""; + let text_color = ""; + switch (level) { + case GuiActions.ALARM_PRIORITY_HIGH: + root_color = Colors.textNotificationHighBg; + text_color = Colors.textNotificationHighFg; + break; + case GuiActions.ALARM_PRIORITY_MEDIUM: + root_color = Colors.textNotificationMedBg; + text_color = Colors.textNotificationMedFg; + break; + case GuiActions.ALARM_PRIORITY_LOW: + root_color = Colors.textNotificationLowBg; + text_color = Colors.textNotificationLowFg; + break; + default : // GuiActions.ALARM_PRIORITY_NONE + root_color = Colors.textNotificationNoneBg; + text_color = Colors.textNotificationNoneFg; + + } + return [root_color, text_color]; + + } } Index: sources/view/valarmstatus.cpp =================================================================== diff -u -rfa1f16359855b827d0e63e48df4f448ab11f54b9 -rd4b88173e0d4a683a315d2fc57b8e1ec356b1232 --- sources/view/valarmstatus.cpp (.../valarmstatus.cpp) (revision fa1f16359855b827d0e63e48df4f448ab11f54b9) +++ sources/view/valarmstatus.cpp (.../valarmstatus.cpp) (revision d4b88173e0d4a683a315d2fc57b8e1ec356b1232) @@ -81,7 +81,37 @@ return QString("ALARM_ID_UNDEFINED [%1]").arg(vEnum); } -QString View::VAlarmStatus::text() +/*! + * \brief VAlarmStatus::text + * \return Gets the alarm text from the alarm ID and returns it as a QString + */ +QString VAlarmStatus::text() { return alarmIDText(static_cast(alarm_AlarmID())); } + +/*! + * \brief VAlarmStatus::id + * \return Gets the id of the alarm and returns the ID number as a QString + */ +QString VAlarmStatus::id() +{ + return QString("%0").arg(static_cast(alarm_AlarmID())); +} + +/*! + * \brief VAlarmStatus::dismissAlarm + * Callback from qml - alarm dismissed by user + */ +void VAlarmStatus::dismissAlarm() { + qDebug() << "Alarm dismissed"; + +} + +/*! + * \brief VAlarmStatus::okayAlarm + * Callback from qml - alarm acknowledged by user. + */ +void VAlarmStatus::okayAlarm() { + qDebug() << "Alarm acknowledged."; +} Index: sources/view/valarmstatus.h =================================================================== diff -u -rb798668f16ad0967ab97e96f5f9a2cdd821e899f -rd4b88173e0d4a683a315d2fc57b8e1ec356b1232 --- sources/view/valarmstatus.h (.../valarmstatus.h) (revision b798668f16ad0967ab97e96f5f9a2cdd821e899f) +++ sources/view/valarmstatus.h (.../valarmstatus.h) (revision d4b88173e0d4a683a315d2fc57b8e1ec356b1232) @@ -44,7 +44,10 @@ PROPERTY( bool , alarm_Flag_alarmsToEscalate , false) PROPERTY( bool , alarm_Flag_alarmsSilenced , false) + + Q_PROPERTY(QString text READ text NOTIFY alarm_AlarmIDChanged) + Q_PROPERTY(QString id READ id NOTIFY alarm_AlarmIDChanged) VIEW_DEC(VAlarmStatus, AlarmStatusData) @@ -54,6 +57,9 @@ public slots: QString text(); + QString id(); + void dismissAlarm(); + void okayAlarm(); };