Index: leahi.qrc =================================================================== diff -u -r4b86351821cd865f5d0383190a17b2137f79f9aa -rabb959f145f8af64bab3b8f24314bf0ba8f3bb0e --- leahi.qrc (.../leahi.qrc) (revision 4b86351821cd865f5d0383190a17b2137f79f9aa) +++ leahi.qrc (.../leahi.qrc) (revision abb959f145f8af64bab3b8f24314bf0ba8f3bb0e) @@ -138,6 +138,9 @@ resources/images/sun.png resources/images/carbon_filter_1.png resources/images/carbon_filter_2.png + resources/images/refresh.png + resources/images/export.png + resources/images/refresh_disabled.png sources/gui/qml/components/MainMenu.qml @@ -166,7 +169,6 @@ sources/gui/qml/components/StepIndicator.qml sources/gui/qml/components/TimeText.qml sources/gui/qml/components/ProgressCircle.qml - sources/gui/qml/components/Slider.qml sources/gui/qml/components/ProgressBarEx.qml sources/gui/qml/components/CloseButton.qml sources/gui/qml/components/ConfirmButton.qml Index: sources/device/DeviceView.cpp =================================================================== diff -u -r6e18f1d24b8cc3d84d26f46f36f73deb34e54371 -rabb959f145f8af64bab3b8f24314bf0ba8f3bb0e --- sources/device/DeviceView.cpp (.../DeviceView.cpp) (revision 6e18f1d24b8cc3d84d26f46f36f73deb34e54371) +++ sources/device/DeviceView.cpp (.../DeviceView.cpp) (revision abb959f145f8af64bab3b8f24314bf0ba8f3bb0e) @@ -25,7 +25,7 @@ #include "encryption.h" #include "MWifiNetwork.h" -VIEW_DEF_CLASS_EX(VDevice, QAbstractListModel) +VIEW_DEF_CLASS(VDevice) void VDevice::initConnections() { @@ -34,6 +34,15 @@ this , SLOT( onPOSTOSVersionData(QString))); connect(&_DeviceController , SIGNAL(didWiFiIP(QString, bool)), this , SLOT( onWiFiIP(QString, bool))); + + _wifiModel.setRoleNames({ { eRole_WifiMacAddress , "wifiMacAddress" }, + { eRole_WifiSsid , "wifiSsid" }, + { eRole_WifiSecurityTypes , "wifiSecurityTypes" }, + { eRole_WifiSignalLevel , "wifiSignalLevel" }, + { eRole_WifiSupported , "wifiSupported" }, + { eRole_WifiConnected , "wifiConnected" }, + }); + _wifiModel.clear(); } // ================================================================================================== @@ -264,7 +273,7 @@ void VDevice::wifiListRequest(const QStringList &) { status( "" ); wifiList({}); - dataClear(); + _wifiModel.clear(); wifiListEnabled(false); DeviceWifiListRequestData data ; emit didAttributeRequest( data ); @@ -310,6 +319,7 @@ eRSN_FLAGS , eIN_USE , }; + enum ValueUnit_Enum { eValue , eUnit , @@ -417,87 +427,33 @@ } } - _dataList.clear(); + QList> connected; + QList> supported; + QList> unsupported; + for (const auto &ssid: qAsConst(ssidInfoList)) { - DataModel data; - data.mWifiMacAddress = ssid.mBSSID; - data.mWifiSSID = ssid.mSSID; - data.mWifiSecurityTypes = ssid.mSECURITY; - data.mWifiSignalLevel = ssid.mSIGNAL_Max; - data.mWifiSupported = ssid.mSupported; - data.mWifiConnected = ssid.mInUse ; + bool inUse = ssid.mSSID == _ssid; + QHash vData; + vData[eRole_WifiMacAddress ] = ssid.mBSSID ; + vData[eRole_WifiSsid ] = ssid.mSSID ; + vData[eRole_WifiSecurityTypes ] = ssid.mSECURITY ; + vData[eRole_WifiSignalLevel ] = ssid.mSIGNAL_Max ; + vData[eRole_WifiSupported ] = ssid.mSupported ; + vData[eRole_WifiConnected ] = inUse ; - dataAppend( data, ssid.mInUse, ssid.mSupported); + if (inUse) { connected.append(vData); } + else if (ssid.mSupported) { supported.append(vData); } + else { unsupported.append(vData);} } -} -void View::VDevice::dataAppend(const DataModel &vData, bool vFirst, bool vSecond) { - beginInsertRows(QModelIndex(), rowCount(), rowCount()); - if ( vFirst && _dataList.count() >= 0 ) { _dataList.insert(0, vData); goto lOut; } - if ( vSecond && _dataList.count() >= 1 ) { _dataList.insert(1, vData); goto lOut; } + _wifiModel.clear(); - _dataList.append( vData); -lOut: - endInsertRows(); + // sort wifi list from top to bottom (Connected, Supported, Not Supported) + for (const auto &row : connected) { _wifiModel.appendRow(row); } + for (const auto &row : supported) { _wifiModel.appendRow(row); } + for (const auto &row : unsupported) { _wifiModel.appendRow(row); } } -void View::VDevice::dataClear() { - beginRemoveRows(QModelIndex(), 0, rowCount()); - _dataList.clear(); - endRemoveRows(); -} - -QVariant View::VDevice::data(const QModelIndex &vIndex, int vRole) const { - if (! vIndex.isValid() || vIndex.row() >= _dataList.count()) - return QVariant(); - - DataModel dataList = _dataList[vIndex.row()]; - - switch (vRole) { - // ----- WiFi - case eRole_WifiMacAddress : return dataList.mWifiMacAddress ; - case eRole_WifiSsid : return dataList.mWifiSSID ; - case eRole_WifiSecurityTypes : return dataList.mWifiSecurityTypes ; - case eRole_WifiSignalLevel : return dataList.mWifiSignalLevel ; - case eRole_WifiSupported : return dataList.mWifiSupported ; - case eRole_WifiConnected : return dataList.mWifiConnected ; - - // ----- Bluetooth - case eRole_BLE_UNUSED : return ""; ; - } - - return QString("Wifi %1").arg(vIndex.row()); -} - -bool View::VDevice::setData(const QModelIndex &vIndex, const QVariant& vValue, int vRole) { - if (! vIndex.isValid() || vIndex.row() >= _dataList.count()) { - return false; - } - - DataModel &dataItem = _dataList[vIndex.row()]; - - switch (vRole) { - case eRole_WifiConnected: { - if (dataItem.mWifiConnected != vValue.toBool()) { - dataItem.mWifiConnected = vValue.toBool(); - } - break; - } - default: - return false; - } - - // explicitly emit a dataChanged signal to notify anybody bound to this property (vRole) - emit dataChanged(vIndex, vIndex, QVector(1, vRole)); - return true; -} - -QModelIndex View::VDevice::index(int vRow, int vColumn, const QModelIndex &vParent) const { - return hasIndex(vRow, vColumn, vParent) - ? createIndex(vRow, vColumn) - : QModelIndex(); -} - // ================================================= WifiInfo void VDevice::doInitWifiInfo() { wifiInfoRequest({}); @@ -573,8 +529,8 @@ } void VDevice::updateWifiList() { - for (int row = 0; row < rowCount(); row++) { - setData(index(row,0), _dataList[row].mWifiSSID == ssid(), eRole_WifiConnected); + for (int row = 0; row < _wifiModel.rowCount(); row++) { + _wifiModel.updateData(row, eRole_WifiConnected, _wifiModel.data(_wifiModel.index(row, 0), eRole_WifiSsid).toString() == _ssid); } } Index: sources/device/DeviceView.h =================================================================== diff -u -r6e18f1d24b8cc3d84d26f46f36f73deb34e54371 -rabb959f145f8af64bab3b8f24314bf0ba8f3bb0e --- sources/device/DeviceView.h (.../DeviceView.h) (revision 6e18f1d24b8cc3d84d26f46f36f73deb34e54371) +++ sources/device/DeviceView.h (.../DeviceView.h) (revision abb959f145f8af64bab3b8f24314bf0ba8f3bb0e) @@ -23,6 +23,7 @@ #include "VView.h" #include "DeviceGlobals.h" #include "DeviceModels.h" +#include "MListModel.h" // define @@ -34,7 +35,7 @@ * \details The device view to interact with the UI. * */ -class VDevice : public QAbstractListModel { +class VDevice : public QObject { Q_OBJECT @@ -52,45 +53,6 @@ eRole_BLE_UNUSED , }; - QHash dataRoles { - // ----- WiFi - { eRole_WifiMacAddress , "wifiMacAddress" }, - { eRole_WifiSsid , "wifiSsid" }, - { eRole_WifiSecurityTypes , "wifiSecurityTypes" }, - { eRole_WifiSignalLevel , "wifiSignalLevel" }, - { eRole_WifiSupported , "wifiSupported" }, - { eRole_WifiConnected , "wifiConnected" }, - // ----- Bluetooth - }; - - struct DataModel { - // ----- WiFi - QString mWifiMacAddress ; - QString mWifiSSID ; - QString mWifiSecurityTypes ; - qint16 mWifiSignalLevel ; - bool mWifiSupported = false ; - bool mWifiConnected = false ; - QString mWifiIpAddress ; - QString mWifiGateway ; - QString mWifiSubnetMask ; - QString mWifiDns ; - - // ----- Bluetooth - QString mBle_Unused ; - }; - typedef QList TDataList; - TDataList _dataList; - - typedef QHash TDataRoles; - TDataRoles roleNames ( ) const override { return dataRoles; } - int rowCount (const QModelIndex & = QModelIndex() ) const override { return _dataList.count(); } - QVariant data (const QModelIndex &vIndex , int vRole = Qt::DisplayRole ) const override ; - void dataAppend (const DataModel &vData , bool vFirst , bool vSecond); - void dataClear ( ); - bool setData (const QModelIndex &vIndex, const QVariant& vValue, int vRole = Qt::EditRole) override; - QModelIndex index (int vRow, int vColumn, const QModelIndex &vParent = QModelIndex()) const override; - private: TRIGGER ( bool , response , true) @@ -130,8 +92,10 @@ READONLY ( QString , subnetMask , "" ) READONLY ( QString , dns , "" ) - VIEW_DEC_CLASS_EX(VDevice, QAbstractListModel) + Q_PROPERTY(MListModel* model READ model NOTIFY didModelChange ) + VIEW_DEC_CLASS(VDevice) + public slots: void doWifiConnect(bool vConnect, const QString &vSsid, const QString &vPassword); void doDateTime ( const QString &vYear, const QString &vMonth, const QString &vDay, @@ -145,12 +109,17 @@ void parseWifiListResult(const QString &vResult); void parseWifiInfoResult(const QString &vResult); void updateWifiList(); + MListModel* model () { return &_wifiModel; } + MListModel _wifiModel; bool isCompleteResponse(Model::MDeviceResponseBase::Data vData) { // Either the script exited successfully or the script failed and the reason is provided // There are situations that the script is using the attribute response to update the UI // but it is not the final/completed response return vData.mAccepted || (!vData.mAccepted && vData.mReason != 0 ); } + +signals: + void didModelChange(); }; } Index: sources/gui/qml/components/ReviewContainer.qml =================================================================== diff -u -rc16cfee6212ad1ba9f788c41d4a4c916daa43c9c -rabb959f145f8af64bab3b8f24314bf0ba8f3bb0e --- sources/gui/qml/components/ReviewContainer.qml (.../ReviewContainer.qml) (revision c16cfee6212ad1ba9f788c41d4a4c916daa43c9c) +++ sources/gui/qml/components/ReviewContainer.qml (.../ReviewContainer.qml) (revision abb959f145f8af64bab3b8f24314bf0ba8f3bb0e) @@ -15,6 +15,9 @@ property var precision : Array(label.count).fill(0) // default all 0 precision property string title : "" + property int cellHeight : Variables.createRxLabelUnitContainerHeight + property int valuePixelSize : Fonts.fontPixelValueControl + height : _column.implicitHeight + 10 width : parent.width radius : 9 @@ -29,7 +32,7 @@ Column { id: _column Rectangle { id: _header width : _root.width - height : Variables.createRxLabelUnitContainerHeight + height : _root.cellHeight color : Colors.panelBackgroundColor radius : _root.radius @@ -61,6 +64,7 @@ text : modelData color : Colors.transparent width : parent.width + height : _root.cellHeight unitText : _root.units[index] border.width: 0 @@ -77,7 +81,7 @@ text : typeof _root.initial[index] === "number" ? _root.initial[index].toFixed(_root.precision[index]) ?? "" : _root.initial[index] ?? "" color : Colors.offWhite - font.pixelSize : Fonts.fontPixelValueControl + font.pixelSize : _root.valuePixelSize verticalAlignment : Text.AlignVCenter visible : _root.initial[index] !== "" } @@ -86,7 +90,7 @@ text : typeof _root.actual[index] === "number" ? _root.actual[index].toFixed(_root.precision[index]) ?? "" : _root.actual[index] ?? "" color : Colors.ufVolumeGoalText - font.pixelSize : Fonts.fontPixelValueControl + font.pixelSize : _root.valuePixelSize verticalAlignment : Text.AlignVCenter visible : _root.actual[index] !== "" } Fisheye: Tag abb959f145f8af64bab3b8f24314bf0ba8f3bb0e refers to a dead (removed) revision in file `sources/gui/qml/components/Slider.qml'. Fisheye: No comparison available. Pass `N' to diff? Index: sources/gui/qml/compounds/SettingsSlider.qml =================================================================== diff -u -r69c86c57349b7d4a6ba47a801ba27b1c470fade5 -rabb959f145f8af64bab3b8f24314bf0ba8f3bb0e --- sources/gui/qml/compounds/SettingsSlider.qml (.../SettingsSlider.qml) (revision 69c86c57349b7d4a6ba47a801ba27b1c470fade5) +++ sources/gui/qml/compounds/SettingsSlider.qml (.../SettingsSlider.qml) (revision abb959f145f8af64bab3b8f24314bf0ba8f3bb0e) @@ -12,26 +12,41 @@ property alias value : _slider.value property alias iconImage : _image.source property alias slider : _slider + property alias text : _text.text + property bool textOnly : false - readonly property color sliderBkgndColor: Colors.dialogShadowColor + property color sliderBkgndColor: Colors.dialogShadowColor readonly property color sliderColor : Colors.highlightProgressBar readonly property color valueColor : Colors.dialogValueColor readonly property int sliderMargins : Variables.defaultMargin * 3.5 // margins added to visible background to make a larger hitbox readonly property int hitboxMargins : Variables.defaultMargin * -2 // negative margins added to create larger hitbox for touch readonly property int knobDiameter : 20 readonly property int hitboxHeight : 70 + readonly property int textWidth : 200 Image { id : _image anchors { left : parent.left verticalCenter : parent.verticalCenter } + visible : ! _root.textOnly } + Text { id : _text + anchors { + left : parent.left + verticalCenter : parent.verticalCenter + } + font.pixelSize : Fonts.fontPixelContainerTitle + color : Colors.offWhite + visible : _root.textOnly + width : _root.textWidth + } + Slider { id: _slider anchors { - left : _image.right + left : _root.textOnly ? _text.right : _image.right leftMargin : _root.hitboxMargins right : parent.right rightMargin : _root.hitboxMargins Index: sources/gui/qml/dialogs/headerbar/HeaderbarSettings.qml =================================================================== diff -u -r8f6ecb60abf6d47d4554cfd3019ca496d79b6f69 -rabb959f145f8af64bab3b8f24314bf0ba8f3bb0e --- sources/gui/qml/dialogs/headerbar/HeaderbarSettings.qml (.../HeaderbarSettings.qml) (revision 8f6ecb60abf6d47d4554cfd3019ca496d79b6f69) +++ sources/gui/qml/dialogs/headerbar/HeaderbarSettings.qml (.../HeaderbarSettings.qml) (revision abb959f145f8af64bab3b8f24314bf0ba8f3bb0e) @@ -64,6 +64,6 @@ Connections { target: vDevice // TODO do something with rejection message - function onStatusChanged ( vValue ) { print("**** Brightness Status: " + vValue) } + function onStatusChanged ( vValue ) { print("**** Status: " + vValue) } } } Index: sources/gui/qml/pages/settings/SettingsInformation.qml =================================================================== diff -u -r934354462a353ff5e7fc2ddfe6f3a8f0121a8f3f -rabb959f145f8af64bab3b8f24314bf0ba8f3bb0e --- sources/gui/qml/pages/settings/SettingsInformation.qml (.../SettingsInformation.qml) (revision 934354462a353ff5e7fc2ddfe6f3a8f0121a8f3f) +++ sources/gui/qml/pages/settings/SettingsInformation.qml (.../SettingsInformation.qml) (revision abb959f145f8af64bab3b8f24314bf0ba8f3bb0e) @@ -19,8 +19,8 @@ // Qml imports import "qrc:/globals" import "qrc:/compounds" +import "qrc:/components" - /*! * \brief SettingsInformation is the screen * which queries the system for the versions and serial numbers and service records @@ -30,76 +30,79 @@ itemIndex : SettingsStack.Information confirmVisible : false - contentItem: TouchGrid { - colCount : 2 - colSpacing : 50 - rowCount : 12 // this number indicates when to move to the next column - rowSpacing : 0 - itemHeight : 50 - itemWidth : 575 - touchable : false - itemsHasLine: [ - 0, // title C1 - 1,1,1,1,1,1,1,1,1,1, - 0,0,0, - 0,// title C2 - 1,1,1,1, - 0, // title C2B - 1,1,1,1 - ] - itemsHasIndent: [ - 0, // title C1 - 1,1,1,1,1,1,1,1,1,1, - 0,0,0, - 0, // title C2 - 1,1,1,1, - 0, // title C2B - 1,1,1,1 - ] - itemsValueLeftMargin: itemWidth / 2 + 50 - itemsUnitLeftMargin : itemWidth / 4 + 50 - itemsValue : [ - "" , - vDevice .osVersion , - Qt .application.version, - vAdjustmentVersions .tdVerDevice , - vAdjustmentVersions .tdVerFPGA , - vAdjustmentVersions .tdSerial , - vAdjustmentVersions .ddVerDevice , - vAdjustmentVersions .ddVerFPGA , - vAdjustmentVersions .ddSerial , - vAdjustmentVersions .fpVerDevice , - vAdjustmentVersions .fpVerFPGA , - "", "", "", "", // Space and title - vAdjustmentServiceDates .hdLastServiceDate , - vAdjustmentServiceDates .hdNextServiceDate , - vAdjustmentServiceDates .dgLastServiceDate , - vAdjustmentServiceDates .dgNextServiceDate , - "", // Space and title - "", // Space for Water Configuration Setting - ] - itemsText : [ - qsTr("Versions" ), // col1 title - qsTr("OS Version" ), - qsTr("UI Version" ), - qsTr("TD Version" ), - qsTr("TD FPGA Version" ), - qsTr("TD Serial Number" ), - qsTr("DD Version" ), - qsTr("DD FPGA Version" ), - qsTr("DD Serial Number" ), - qsTr("FP Version" ), - qsTr("FP FPGA Version" ), - "", "", "", // Holders for last elements + contentItem: Row { + anchors.fill: parent + spacing : Variables.defaultMargin * 2 - qsTr("Service" ), // col2 title - qsTr("TD Last Service Date" ), - qsTr("TD Next Service Date" ), - qsTr("DD Last Service Date" ), - qsTr("DD Next Service Date" ), + ReviewContainer { id: _versions + title : qsTr("Versions") + width : parent.width / 2 - Variables.defaultMargin + cellHeight : 65 + valuePixelSize : Fonts.fontPixelDefaultButton - qsTr("Water Configuration" ), - qsTr("Water Input" ), - ] + label : [ qsTr("OS Version" ), + qsTr("UI Version" ), + qsTr("TD Version" ), + qsTr("TD FPGA Version" ), + qsTr("TD Serial Number" ), + qsTr("DD Version" ), + qsTr("DD FPGA Version" ), + qsTr("DD Serial Number" ), + qsTr("FP Version" ), + qsTr("FP FPGA Version" )] + + initial : [ vDevice .osVersion , + Qt .application.version, + vAdjustmentVersions .tdVerDevice , + vAdjustmentVersions .tdVerFPGA , + vAdjustmentVersions .tdSerial , + vAdjustmentVersions .ddVerDevice , + vAdjustmentVersions .ddVerFPGA , + vAdjustmentVersions .ddSerial , + vAdjustmentVersions .fpVerDevice , + vAdjustmentVersions .fpVerFPGA ] + + actual : ["","","","","","","","","",""] + units : ["","","","","","","","","",""] + } + + Column { + width : parent.width / 2 - Variables.defaultMargin + spacing : Variables.defaultMargin * 2 + + ReviewContainer { id: _service + title : qsTr("Service") + width : parent.width + cellHeight : 65 + valuePixelSize : Fonts.fontPixelDefaultButton + + label : [ qsTr("TD Last Service Date" ), + qsTr("TD Next Service Date" ), + qsTr("DD Last Service Date" ), + qsTr("DD Next Service Date" )] + + initial : [ vAdjustmentServiceDates .hdLastServiceDate , + vAdjustmentServiceDates .hdNextServiceDate , + vAdjustmentServiceDates .dgLastServiceDate , + vAdjustmentServiceDates .dgNextServiceDate ] + + actual : ["","","",""] + units : ["","","",""] + } + + ReviewContainer { id: _waterConfiguration + title : qsTr("Water Configuration") + width : parent.width + cellHeight : 65 + valuePixelSize : Fonts.fontPixelDefaultButton + + label : [ qsTr("Water Input" )] + + initial : [ qsTr("RO Water %1" ).arg(vSettings.roWaterMode ? qsTr("Featured") : qsTr("Defeatured")) ] + + actual : [""] + units : [""] + } + } } } Index: sources/gui/qml/pages/settings/SettingsStack.qml =================================================================== diff -u -r72550dbbd6db8eab40aad38956b32f99416600c8 -rabb959f145f8af64bab3b8f24314bf0ba8f3bb0e --- sources/gui/qml/pages/settings/SettingsStack.qml (.../SettingsStack.qml) (revision 72550dbbd6db8eab40aad38956b32f99416600c8) +++ sources/gui/qml/pages/settings/SettingsStack.qml (.../SettingsStack.qml) (revision abb959f145f8af64bab3b8f24314bf0ba8f3bb0e) @@ -104,7 +104,7 @@ } property var itemsText : [ qsTr("Device Information" ), // Device Information - qsTr("Volume And Brightness" ), // VolumeBrightness + qsTr("Display and Volume" ), // VolumeBrightness qsTr("Wi-Fi" ), // WiFi qsTr("Device Cleaning" ), // DGCleaning qsTr("DG Scheduling" ), // DGScheduling Index: sources/gui/qml/pages/settings/SettingsVolumeBrightness.qml =================================================================== diff -u -r934354462a353ff5e7fc2ddfe6f3a8f0121a8f3f -rabb959f145f8af64bab3b8f24314bf0ba8f3bb0e --- sources/gui/qml/pages/settings/SettingsVolumeBrightness.qml (.../SettingsVolumeBrightness.qml) (revision 934354462a353ff5e7fc2ddfe6f3a8f0121a8f3f) +++ sources/gui/qml/pages/settings/SettingsVolumeBrightness.qml (.../SettingsVolumeBrightness.qml) (revision abb959f145f8af64bab3b8f24314bf0ba8f3bb0e) @@ -22,119 +22,90 @@ // Qml imports import "qrc:/globals" import "qrc:/components" +import "qrc:/compounds" /*! * \brief SettingsVolumeBrightness is used to adjust the * volume (alarm/system), brightness on the device */ SettingsBase { id: _root - itemIndex : SettingsStack.VolumeBrightness - readonly property int spacing: 100 - confirmVisible : false + itemIndex : SettingsStack.VolumeBrightness + confirmVisible : false + notificationText : "" + contentArea.anchors.topMargin : Variables.defaultMargin * 10 - notificationText: "" + QtObject { id: _private + readonly property int contentWidth : _root.width / 2.5 + } - contentArea.anchors.topMargin: Variables.defaultMargin * 10 - contentItem: Column { spacing : _root.spacing - Row { - spacing : _root.spacing + Row { id: _themeRow anchors.horizontalCenter: parent.horizontalCenter - Label { - anchors.verticalCenter: parent.verticalCenter - width : labelWidth - text : qsTr("Brightness") + width : _private.contentWidth + + Text { id : _text + font.pixelSize : Fonts.fontPixelContainerTitle + color : Colors.offWhite + width : 200 + text : qsTr("Theme") } - Slider { id : _brightness - anchors.verticalCenter: parent.verticalCenter - width : 500 - step : 1 // no zero - minimum : 1 - maximum : 5 - ticks : true - unit : "" - onReleased : vDevice.brightness = _brightness.value - Connections { target: vDevice - // in case the value is rejecte it will be set to the previous value - // also the init value shall be set when navigate to the screen - function onBrightnessChanged ( vValue ) { _brightness.reset(vValue) } - function onStatusChanged ( vValue ) { _root.notificationText = vValue } + + BaseSwitch { id: _darkMode + source : vSettings.darkMode ? "qrc:/images/iMoon" : "qrc:/images/iSun" + checked : vSettings.darkMode + activeColor : Colors.switchActiveColor + inactiveColor : Colors.switchInactiveColor + knobColor : vSettings.darkMode ? Colors.switchKnobActiveColor : + Colors.switchKnobInactiveColor + + onClicked: { + vSettings.darkMode = ! vSettings.darkMode } } - Label { - anchors.verticalCenter: parent.verticalCenter - width : 100 - text : vDevice.brightness + _brightness.unit - } } - Row { - spacing : _root.spacing + SettingsSlider { id: _brightness anchors.horizontalCenter: parent.horizontalCenter - Label { - anchors.verticalCenter: parent.verticalCenter - width : labelWidth - text: qsTr("Alarm Volume") - } - Slider { id : _alarmVolume - anchors.verticalCenter: parent.verticalCenter - width : 500 - step : 1 // no zero - minimum : 1 - maximum : 5 - ticks : true - unit : "" - onReleased : { - vAdjustmentAlarmVolume.doAdjustment( _alarmVolume.value ) - } - Connections { target: vAdjustmentAlarmVolume - function onAdjustmentTriggered ( vValue ) { - if ( vAdjustmentAlarmVolume.adjustment_Accepted ) { - vSettings .alarmVolume = vAdjustmentAlarmVolume.hdAlarmVolume - _root.notificationText = "" - } - else { - _root.notificationText = vAdjustmentAlarmVolume.adjustment_ReasonText - } - // regardless of the rejection or acceptance the value will be sent from C++ to be adjusted. - _alarmVolume.reset ( vAdjustmentAlarmVolume.hdAlarmVolume ) - } - } - } - Label { - anchors.verticalCenter: parent.verticalCenter - width : 100 - text : vAdjustmentAlarmVolume.hdAlarmVolume + _alarmVolume.unit - } + width : _private.contentWidth + value : vDevice.brightnesss ?? 0 + text : qsTr("Brightness") + textOnly : true + sliderBkgndColor : Colors.createTreatmentInactive + + onValueChanged : vDevice.brightness = slider.value } - Row { - visible : false - spacing : _root.spacing + SettingsSlider { id: _volume anchors.horizontalCenter: parent.horizontalCenter - Label { - anchors.verticalCenter: parent.verticalCenter - width : labelWidth - text : qsTr("System Volume") + width : _private.contentWidth + value : vAdjustmentAlarmVolume.hdAlarmVolume ?? 0 + text : qsTr("Alarm Volume") + textOnly : true + sliderBkgndColor : Colors.createTreatmentInactive + + onValueChanged : vAdjustmentAlarmVolume.doAdjustment( slider.value ) + } + } + + Connections { target: vAdjustmentAlarmVolume + function onAdjustmentTriggered ( vValue ) { + if ( vAdjustmentAlarmVolume.adjustment_Accepted ) { + vSettings .alarmVolume = vAdjustmentAlarmVolume.hdAlarmVolume + _root.notificationText = "" } - Slider { id : _systemVolume - anchors.verticalCenter: parent.verticalCenter - width : 500 - step : 20 // no zero - minimum : 20 // 1 - maximum : 100 // 5 - ticks : true - unit : qsTr("%") + else { + _root.notificationText = vAdjustmentAlarmVolume.adjustment_ReasonText } - Label { - anchors.verticalCenter: parent.verticalCenter - width : 100 - text : "0" + _systemVolume.unit - } + // regardless of the rejection or acceptance the value will be sent from C++ to be adjusted. + _alarmVolume.reset ( vAdjustmentAlarmVolume.hdAlarmVolume ) } } + + Connections { target: vDevice + function onStatusChanged ( vValue ) { _root.notificationText = vValue ? qsTr("Brightness Status: %1" ).arg(vValue) : "" } + } } Index: sources/gui/qml/pages/settings/SettingsWiFi.qml =================================================================== diff -u -r94c7a571dc12f24aa072ac2b14199432ce9f3821 -rabb959f145f8af64bab3b8f24314bf0ba8f3bb0e --- sources/gui/qml/pages/settings/SettingsWiFi.qml (.../SettingsWiFi.qml) (revision 94c7a571dc12f24aa072ac2b14199432ce9f3821) +++ sources/gui/qml/pages/settings/SettingsWiFi.qml (.../SettingsWiFi.qml) (revision abb959f145f8af64bab3b8f24314bf0ba8f3bb0e) @@ -14,13 +14,13 @@ */ // Qt -import QtQuick 2.12 +import QtQuick 2.15 // Project -import Gui.Actions 0.1 // Qml imports import "qrc:/globals" +import "qrc:/compounds" import "qrc:/components" import "qrc:/pages" @@ -44,163 +44,219 @@ readonly property int topMargin : 160 readonly property bool isConnected : vDevice.ssid !== "" + confirmVisible : false - readonly property bool isValid : - _ipAddress .textInput.acceptableInput - && _gateway .textInput.acceptableInput - && _subnetmask .textInput.acceptableInput - && _dns .textInput.acceptableInput - - confirmEnabled : isValid - confirmVisible : false // since the static setting is done one by one seems confirm is not needed for now. - firstFocusInput : _ipAddress notificationText: vDevice.status - Column { id : _ipColumn - spacing : _root.spacing - y : _root.topMargin - anchors.left : parent.left - anchors.leftMargin : _root.leftMargin - TextEntry { id : _ssid - nextInput : _ipAddress // helps user to tap on enter to go to the next entry, keyboard visibility is handled by TextEntry. - textInput.text : vDevice.ssid - label.text : qsTr("SSID") - textInput.width : entryWidth - label.width : labelWidth - hasCursor : false // set false for now to disable the static IP entry for phase 1 - textInput.color : Colors.textMain - } + contentItem: Item { id: _contentRow + anchors.fill: parent - TextEntry { id : _ipAddress - nextInput : _gateway // helps user to tap on enter to go to the next entry, keyboard visibility is handled by TextEntry. - textInput.text : vDevice.ipAddress - textInput.visible: _root.isConnected - label.text : qsTr("IP Address") - textInput.width : entryWidth - label.width : labelWidth - hasCursor : false // set false for now to disable the static IP entry for phase 1 - textInput.color : Colors.textMain - } + Item { id: _wifiItem + anchors { + left : parent.left + verticalCenter : parent.verticalCenter + } - TextEntry { id : _gateway - nextInput : _subnetmask // helps user to tap on enter to go to the next entry, keyboard visibility is handled by TextEntry. - textInput.text : vDevice.gateway - textInput.visible: _root.isConnected - textInput.width : entryWidth - label.width : labelWidth - label.text : qsTr("Gateway") - hasCursor : false // set false for now to disable the static IP entry for phase 1 - textInput.color : Colors.textMain - } + width : parent.width / 2.5 + height : parent.height - TextEntry { id : _subnetmask - nextInput : _dns // helps user to tap on enter to go to the next entry, keyboard visibility is handled by TextEntry. - textInput.text : vDevice.subnetMask - textInput.visible: _root.isConnected - textInput.width : entryWidth - label.width : labelWidth - label.text : qsTr("Subnet Mask") - hasCursor : false // set false for now to disable the static IP entry for phase 1 - textInput.color : Colors.textMain - } + Text { id : _wifiInfoTitle + anchors { + top : parent.top + left: parent.left + } + width : parent.width + height : 60 + text : qsTr("Current Wi-Fi Information") + font.pixelSize : Fonts.fontPixelButton + font.weight : Font.Medium + color : Colors.offWhite - TextEntry { id : _dns - textInput.text : vDevice.dns - textInput.visible: _root.isConnected - textInput.width : entryWidth - textInput.wrapMode : Text.WordWrap - label.width : labelWidth - label.text : qsTr("DNS") - hasCursor : false // set false for now to disable the static IP entry for phase 1 - textInput.color : Colors.textMain - } - } - - TouchRect { id : _scanButton - anchors.bottom : parent.bottom - anchors.bottomMargin: Variables.mainMenuHeight * 2 + Variables.minVGap - anchors.left : parent.left - anchors.leftMargin : _root.leftMargin - text.text : qsTr("SCAN") - width : 350 - isDefault : true - enabled : vDevice.wifiListEnabled - onClicked : vDevice.wifiList = "" - } - - ScrollBar { flickable : _networkList - anchors.fill: _networkList - } - ListView { id : _networkList - model : vDevice - clip : true - spacing : 7 - y : _root.topMargin - width : 450 - anchors.top : _ipColumn.top - anchors.bottom : _scanButton.bottom - anchors.right : _root.right - anchors.rightMargin : _root.rightMargin - delegate : - TouchRect { id : _delegate - readonly property color networkDelegateTextColor : wifiSupported ? Colors.textMain : Colors.textDisableButton - readonly property string postSecurityTypeLabel : wifiSupported ? "" : " - " + qsTr("Not Supported") - readonly property bool isConnected : wifiConnected - onIsConnectedChanged: { - if ( isConnected ) { - vDevice.doInitWifiInfo() + Line { id: _divider + color : Colors.panelBorderColor + anchors { + bottom : parent.bottom + bottomMargin: 10 + left : parent.left + right : parent.right + } } } - clip : true - text.text : wifiSsid - text.elide : Text.ElideLeft - text.color : _delegate.networkDelegateTextColor - width : _networkList.width - Variables.minVGap - height : 75 - radius : Variables.dialogRadius - - text.anchors.horizontalCenter : undefined - text.horizontalAlignment : Text.AlignLeft - text.leftPadding : 5 - border.width : 1 - borderColor : wifiConnected ? Colors.borderButtonSelected : Colors.borderButton - - Text { id : _securityLevel + TouchGrid { id: _currentWifi anchors { - left : parent.left - leftMargin : 10 - bottom : parent.bottom + top : _wifiInfoTitle.bottom + left: _wifiInfoTitle.left } - font.pixelSize : Fonts.fontPixelDialogText - text : wifiSecurityTypes + _delegate.postSecurityTypeLabel - color : _delegate.networkDelegateTextColor + width : parent.width + touchable : false + alignCenter : false + rowCount : 5 + colCount : 1 + itemWidth : width + itemsText : [ qsTr("SSID") , + qsTr("IP Address") , + qsTr("Gateway") , + qsTr("Subnet Mask") , + qsTr("DNS") ] + lineColor : Colors.panelBorderColor + + itemsValue : [ vDevice.ssid , + _root.isConnected ? vDevice.ipAddress : "" , + vDevice.gateway , + vDevice.subnetMask , + vDevice.dns ] + + delegateColor : Colors.transparent + itemsHasLine : Array(itemsText.length).fill(true) // sets all to true + itemsHasImage : Array(itemsText.length).fill(false) // sets all to false } + } - Text { id : _isConnected + Column { id: _networkColumn anchors { - right : parent.right - rightMargin : 10 - bottom : parent.bottom + right : parent.right + verticalCenter : parent.verticalCenter } - font.pixelSize : Fonts.fontPixelDialogText - text : wifiConnected ? qsTr("Connected") : "" - color : _delegate.networkDelegateTextColor - } + width : parent.width / 2.5 + height : parent.height - onClicked : { - if( wifiSupported ) { - _userConfirmation.isPassword = ! wifiConnected - _userConfirmation.ssid = wifiSsid - _userConfirmation.macAddress = wifiMacAddress - push( _userConfirmation ) - _userConfirmation.setFocus() + Rectangle { id: _header + width : parent.width + height : 75 + color : Colors.panelBackgroundColor + radius : 9 + + border { + width: 1 + color: Colors.panelBorderColor + } + + Text { id: _title + text : qsTr("Available Networks") + color : Colors.offWhite + font.family : Fonts.fontFamilyFixed + font.weight : Font.DemiBold + font.pixelSize : Fonts.fontPixelTextRectTitle + anchors { + left : parent.left + leftMargin : Variables.defaultMargin + verticalCenter : parent.verticalCenter + } + } + + IconButton { id: _refreshIcon + anchors { + right : parent.right + rightMargin : Variables.defaultMargin + verticalCenter : parent.verticalCenter + } + iconSize : Variables.iconsDiameter + iconImageSource : enabled ? "qrc:/images/iRefresh" : "qrc:/images/iRefreshDisabled" + enabled : vDevice.wifiListEnabled + + onPressed : vDevice.wifiList = "" + } } - } + + Item { id: _wifiListItem + width : parent.width + height : _contentRow.height + + ScrollBar { + flickable : _networkList + anchors.fill : _networkList + scrollColor : Colors.scrollBarColor + handleWidth : 5 + } + + ListView { id : _networkList + model : vDevice.model + clip : true + width : parent.width + height : parent.height + + + delegate : TouchRect { id : _delegate + readonly property color networkDelegateTextColor : wifiSupported ? Colors.textMain : Colors.textDisableButton + readonly property string postSecurityTypeLabel : wifiSupported ? "" : " - " + qsTr("Not Supported") + readonly property bool isConnected : wifiConnected + onIsConnectedChanged: { + if ( isConnected ) { + vDevice.doInitWifiInfo() + } + } + + clip : true + text.text : wifiSsid + text.elide : Text.ElideLeft + text.color : _delegate.networkDelegateTextColor + width : _networkList.width - Variables.minVGap + height : 75 + radius : Variables.dialogRadius + + text.anchors.horizontalCenter : undefined + text.horizontalAlignment : Text.AlignLeft + text.leftPadding : 5 + border.width : 1 + borderColor : wifiConnected ? Colors.borderButtonSelected : Colors.borderButton + + Text { id : _securityLevel + anchors { + left : parent.left + leftMargin : 10 + bottom : parent.bottom + } + font.pixelSize : Fonts.fontPixelDialogText + text : wifiSecurityTypes + _delegate.postSecurityTypeLabel + color : _delegate.networkDelegateTextColor + } + + Text { id : _isConnected + anchors { + right : parent.right + rightMargin : 10 + bottom : parent.bottom + } + font.pixelSize : Fonts.fontPixelDialogText + text : wifiConnected ? qsTr("Connected") : "" + color : _delegate.networkDelegateTextColor + } + + onClicked : { + if( wifiSupported ) { + _userConfirmation.isPassword = ! wifiConnected + _userConfirmation.ssid = wifiSsid + _userConfirmation.macAddress = wifiMacAddress + push( _userConfirmation ) + _userConfirmation.setFocus() + } + } + } + } + } +// } + } } + +// TouchRect { id : _scanButton +// anchors.bottom : parent.bottom +// anchors.bottomMargin: Variables.mainMenuHeight * 2 + Variables.minVGap +// anchors.left : parent.left +// anchors.leftMargin : _root.leftMargin +// text.text : qsTr("SCAN") +// width : 350 +// isDefault : true +// enabled : vDevice.wifiListEnabled +// onClicked : vDevice.wifiList = "" +// } + + + + UserConfirmation { id : _userConfirmation property string ssid : "" property string macAddress : ""