Index: sources/device/DeviceController.cpp =================================================================== diff -u -raad4ef16cb210459b60d16aa01a4dcbd909d9a1f -r3ee91a030e9affe0a50acdee33520c985c05d779 --- sources/device/DeviceController.cpp (.../DeviceController.cpp) (revision aad4ef16cb210459b60d16aa01a4dcbd909d9a1f) +++ sources/device/DeviceController.cpp (.../DeviceController.cpp) (revision 3ee91a030e9affe0a50acdee33520c985c05d779) @@ -253,27 +253,30 @@ */ void DeviceController::checkWiFi() { - QString mIP = tr("WiFi Connection Error"); + if ( ! _wifiAvailable) { + emit didWiFiData(tr("WiFi Connection Error")); + return; + } - if (_wifiValid) { - mIP = tr("No WiFi"); - const QNetworkInterface dev = QNetworkInterface::interfaceFromName("wlan0"); + const QNetworkInterface dev = QNetworkInterface::interfaceFromName("wlan0"); + if ( ! dev.isValid() ) { + emit didWiFiData(tr("No WiFi")); + return; + } - if ( dev.isValid() ) { - auto addresses = dev.addressEntries(); + QList addresses = dev.addressEntries(); + if ( addresses.isEmpty() ) { + emit didWiFiData(tr("WiFi Not Connected")); + return; + } - if ( addresses.count() ) { - if ( dev.flags().testFlag(QNetworkInterface::IsUp) && dev.flags().testFlag(QNetworkInterface::IsRunning) ) { - mIP = addresses.first().ip().toString(); - } - else { - mIP = tr("WiFi Not Connected"); - } - } - } + if ( ! (dev.flags().testFlag(QNetworkInterface::IsUp) && + dev.flags().testFlag(QNetworkInterface::IsRunning))) { + emit didWiFiData(tr("WiFi Not Connected")); + return; } - emit didWiFiData(mIP); + emit didWiFiData(addresses.first().ip().toString()); } /*! @@ -1063,7 +1066,7 @@ */ void DeviceController::wifiInfoRequest() { - // ----- check that script exists. + // ----- check that script exists. QString script; if ( checkError( DeviceError::checkScript(script, Scripts_Wifi_Info), _deviceWifiInfoResponse, script) ) return; @@ -1079,8 +1082,6 @@ TimedProcess *timedProcess = new TimedProcess(&_processWifiInfo, script, timeout_ms, {}); timedProcess->start(); - _wifiValid = true; - MDeviceWifiInfoResponse model; model._data.mCompleted = false; model._data.mAccepted = false; @@ -1104,6 +1105,7 @@ } } else { + _wifiAvailable = true; processWifiInfoComplete(model, vExitCode, vStatus); emit didAttributeResponse(model.data()); model._data.clear(); Index: sources/device/DeviceController.h =================================================================== diff -u -raad4ef16cb210459b60d16aa01a4dcbd909d9a1f -r3ee91a030e9affe0a50acdee33520c985c05d779 --- sources/device/DeviceController.h (.../DeviceController.h) (revision aad4ef16cb210459b60d16aa01a4dcbd909d9a1f) +++ sources/device/DeviceController.h (.../DeviceController.h) (revision 3ee91a030e9affe0a50acdee33520c985c05d779) @@ -221,7 +221,7 @@ bool _hasThread = false; bool _hasSalt = false; - bool _wifiValid = false; + bool _wifiAvailable = false; //TODO: all of these should use the TimesProcess (instead of QProcess) // to be able to kill the process automatically after the set time out. Index: sources/device/DeviceView.cpp =================================================================== diff -u -rb38e1590d137f607b982d336e60b614c2ae685c2 -r3ee91a030e9affe0a50acdee33520c985c05d779 --- sources/device/DeviceView.cpp (.../DeviceView.cpp) (revision b38e1590d137f607b982d336e60b614c2ae685c2) +++ sources/device/DeviceView.cpp (.../DeviceView.cpp) (revision 3ee91a030e9affe0a50acdee33520c985c05d779) @@ -32,7 +32,7 @@ connect(&_DeviceController , SIGNAL(didPOSTOSVersionData(QString)), this , SLOT( onPOSTOSVersionData(QString))); connect(&_DeviceController , SIGNAL(didWiFiData(QString)), - this , SLOT( onWiFiData(QString))); + this , SLOT( onWiFiIP(QString))); } // ================================================================================================== @@ -627,7 +627,7 @@ } // ================================================= WiFi Indicator -void VDevice::onWiFiData (const QString &vData) +void VDevice::onWiFiIP (const QString &vData) { ipAddress(vData); } Index: sources/device/DeviceView.h =================================================================== diff -u -r3bee9f20350882eca47f3d18b0accf5bec3933d4 -r3ee91a030e9affe0a50acdee33520c985c05d779 --- sources/device/DeviceView.h (.../DeviceView.h) (revision 3bee9f20350882eca47f3d18b0accf5bec3933d4) +++ sources/device/DeviceView.h (.../DeviceView.h) (revision 3ee91a030e9affe0a50acdee33520c985c05d779) @@ -135,7 +135,7 @@ private slots: void onPOSTOSVersionData (const QString &vOSVersion); - void onWiFiData (const QString &vData); + void onWiFiIP (const QString &vData); private: void parseWifiListResult(const QString &vResult); Index: sources/gui/qml/components/HeaderBar.qml =================================================================== diff -u -r51c91d35b3d0d1acac4dfccf6057d3949f302448 -r3ee91a030e9affe0a50acdee33520c985c05d779 --- sources/gui/qml/components/HeaderBar.qml (.../HeaderBar.qml) (revision 51c91d35b3d0d1acac4dfccf6057d3949f302448) +++ sources/gui/qml/components/HeaderBar.qml (.../HeaderBar.qml) (revision 3ee91a030e9affe0a50acdee33520c985c05d779) @@ -17,16 +17,6 @@ GradientStop { position: 0.8; color: Qt.darker (Colors.backgroundMain, 1.2) } } - ListModel { id: _buttonModel - ListElement { image : "qrc:/images/iPrescription"; func : function() { print("Prescription button pressed!")} } - ListElement { image : "qrc:/images/iWifi"; func : function() { _wifiDialog.open() } } - ListElement { image : "qrc:/images/iBluetooth"; func : function() { print("Bluetooth button pressed!")} } - ListElement { image : "qrc:/images/iCloudSync"; func : function() { print("CloudSync button pressed!")} } - ListElement { image : "qrc:/images/iStorage"; func : function() { print("Storage button pressed!")} } - ListElement { image : "qrc:/images/iSettings"; func : function() { print("Storage button Settings!")} } - ListElement { image : "qrc:/images/iInformation"; func : function() { print("Information button pressed!")} } - } - function setXPos ( button, dialog ) { dialog.x = button.mapToItem(null, button.width, 0).x - dialog.width } Item { id: _dateTimeItem @@ -123,20 +113,63 @@ rightMargin : _headerButtonRow.spacing } - Repeater { id: _repeater - model: _buttonModel + IconButton { id : _prescriptionButton + iconSize : Variables.headerIconDiameter + iconImageSource : "qrc:/images/iPrescription" + extraSpace : _headerButtonRow.spacing - delegate: IconButton { id : _button - iconSize : Variables.headerIconDiameter - iconImageSource : image - extraSpace : _headerButtonRow.spacing + onPressed: print("Prescription button pressed!") + } - onPressed : func() - } + IconButton { id : _wifiButton + iconSize : Variables.headerIconDiameter + iconImageSource : "qrc:/images/iWifi" + extraSpace : _headerButtonRow.spacing + onPressed : _wifiDialog.open() } + + IconButton { id : _bluetoothButton + iconSize : Variables.headerIconDiameter + iconImageSource : "qrc:/images/iBluetooth" + extraSpace : _headerButtonRow.spacing + + onPressed: print("Bluetooth button pressed!") + } + + IconButton { id : _cloudSyncButton + iconSize : Variables.headerIconDiameter + iconImageSource : "qrc:/images/iCloudSync" + extraSpace : _headerButtonRow.spacing + + onPressed: print("CloudSync button pressed!") + } + + IconButton { id : _storageButton + iconSize : Variables.headerIconDiameter + iconImageSource : "qrc:/images/iStorage" + extraSpace : _headerButtonRow.spacing + + onPressed: print("Storage button pressed!") + } + + IconButton { id : _settingsButton + iconSize : Variables.headerIconDiameter + iconImageSource : "qrc:/images/iSettings" + extraSpace : _headerButtonRow.spacing + + onPressed: print("Settings button pressed!") + } + + IconButton { id : _informationButton + iconSize : Variables.headerIconDiameter + iconImageSource : "qrc:/images/iInformation" + extraSpace : _headerButtonRow.spacing + + onPressed: print("Information button pressed!") + } } Connections { target: _wifiDialog - function onAdjustPosition(type) { setXPos(_repeater.itemAt(type), _wifiDialog) } + function onAdjustPosition() { setXPos(_wifiButton, _wifiDialog) } } } Index: sources/gui/qml/components/HeaderBarPopup.qml =================================================================== diff -u -r51c91d35b3d0d1acac4dfccf6057d3949f302448 -r3ee91a030e9affe0a50acdee33520c985c05d779 --- sources/gui/qml/components/HeaderBarPopup.qml (.../HeaderBarPopup.qml) (revision 51c91d35b3d0d1acac4dfccf6057d3949f302448) +++ sources/gui/qml/components/HeaderBarPopup.qml (.../HeaderBarPopup.qml) (revision 3ee91a030e9affe0a50acdee33520c985c05d779) @@ -5,18 +5,8 @@ import "qrc:/components" ModalDialog { id: _root - property int type: -1 + signal adjustPosition () - signal adjustPosition (var type) - - enum Button { Prescription, - WiFi, - BlueTooth, - CloudSync, - Storage, - Settings, - Information } - implicitWidth : contentItem.implicitWidth + padding * 2 // Auto-size to content implicitHeight : contentItem.implicitHeight + padding * 2 width : implicitWidth @@ -28,5 +18,5 @@ backgroundColor : "#D2D6DB" showDropShadow : true - onImplicitWidthChanged: Qt.callLater(function() { adjustPosition(type) }) + onImplicitWidthChanged: Qt.callLater(function() { adjustPosition() }) } Index: sources/gui/qml/dialogs/headerbar/WiFiDialog.qml =================================================================== diff -u -r51c91d35b3d0d1acac4dfccf6057d3949f302448 -r3ee91a030e9affe0a50acdee33520c985c05d779 --- sources/gui/qml/dialogs/headerbar/WiFiDialog.qml (.../WiFiDialog.qml) (revision 51c91d35b3d0d1acac4dfccf6057d3949f302448) +++ sources/gui/qml/dialogs/headerbar/WiFiDialog.qml (.../WiFiDialog.qml) (revision 3ee91a030e9affe0a50acdee33520c985c05d779) @@ -7,8 +7,6 @@ readonly property int pixelSize : Fonts.fontPixelDialogText readonly property bool isConnected : vDevice.ssid !== "" - type : HeaderBarPopup.Button.WiFi - // TODO: Later add Securty type and signal strength if needed contentItem: Column { id : _dialogColumn anchors.centerIn : parent