Update UI to latest changes

This commit is contained in:
Michael Zanetti 2021-01-13 12:34:33 +01:00
parent 14fe5bb610
commit 94483e92c5
5 changed files with 27 additions and 12 deletions

View File

@ -348,7 +348,9 @@ void BtWiFiSetup::processWiFiPacket(const QVariantMap &data)
accessPoint->setProtected(data.toMap().value("p").toBool()); accessPoint->setProtected(data.toMap().value("p").toBool());
accessPoint->setHostAddress(""); accessPoint->setHostAddress("");
m_accessPoints->addWirelessAccessPoint(accessPoint); m_accessPoints->addWirelessAccessPoint(accessPoint);
} }
loadCurrentConnection();
break; break;
case WirelessServiceCommandConnect: case WirelessServiceCommandConnect:
qDebug() << "Connect call succeeded"; qDebug() << "Connect call succeeded";
@ -374,6 +376,12 @@ void BtWiFiSetup::processWiFiPacket(const QVariantMap &data)
} }
qDebug() << "current connection is:" << m_currentConnection; qDebug() << "current connection is:" << m_currentConnection;
emit currentConnectionChanged(); emit currentConnectionChanged();
if (m_bluetoothStatus != BluetoothStatusLoaded) {
m_bluetoothStatus = BluetoothStatusLoaded;
emit bluetoothStatusChanged(m_bluetoothStatus);
}
break; break;
case WirelessServiceCommandScan: case WirelessServiceCommandScan:
if (responseCode == WirelessServiceResponseSuccess) { if (responseCode == WirelessServiceResponseSuccess) {
@ -439,7 +447,7 @@ void BtWiFiSetup::characteristicChanged(const QLowEnergyCharacteristic &characte
} else if (characteristic.uuid() == networkStatusCharacteristicUuid) { } else if (characteristic.uuid() == networkStatusCharacteristicUuid) {
m_networkStatus = static_cast<NetworkStatus>(value.toHex().toInt(nullptr, 16)); m_networkStatus = static_cast<NetworkStatus>(value.toHex().toInt(nullptr, 16));
qDebug() << "Network status changed:" << m_networkStatus; qDebug() << "Network status changed:" << m_networkStatus;
if (m_networkStatus == NetworkStatusGlobal) { if (m_networkStatus == NetworkStatusGlobal || m_networkStatus == NetworkStatusLocal || m_networkStatus == NetworkStatusConnectedSite) {
loadCurrentConnection(); loadCurrentConnection();
} }

View File

@ -32,7 +32,8 @@ public:
enum BluetoothStatus { enum BluetoothStatus {
BluetoothStatusDisconnected, BluetoothStatusDisconnected,
BluetoothStatusConnectingToBluetooth, BluetoothStatusConnectingToBluetooth,
BluetoothStatusConnectedToBluetooth BluetoothStatusConnectedToBluetooth,
BluetoothStatusLoaded,
}; };
Q_ENUM(BluetoothStatus) Q_ENUM(BluetoothStatus)

View File

@ -49,15 +49,17 @@ Page {
BtWiFiSetup { BtWiFiSetup {
id: wifiSetup id: wifiSetup
onStatusChanged: { onBluetoothStatusChanged: {
print("status changed", status) print("status changed", status)
switch (status) { switch (status) {
case BtWiFiSetup.StatusDisconnected: case BtWiFiSetup.BluetoothStatusDisconnected:
pageStack.pop(root) pageStack.pop(root)
break; break;
case BtWiFiSetup.StatusConnectingToBluetooth: case BtWiFiSetup.BluetoothStatusConnectingToBluetooth:
break; break;
case BtWiFiSetup.StatusConnectedToBluetooth: case BtWiFiSetup.BluetoothStatusConnectedToBluetooth:
break;
case BtWiFiSetup.BluetoothStatusLoaded:
if (!wifiSetup.networkingEnabled) { if (!wifiSetup.networkingEnabled) {
wifiSetup.networkingEnabled = true; wifiSetup.networkingEnabled = true;
} }
@ -66,12 +68,12 @@ Page {
} }
setupDevice() setupDevice()
break; break;
case BtWiFiSetup.StatusConnectingToWiFi:
break;
case BtWiFiSetup.StatusConnectedToWiFi:
print("Connected to wifi!")
} }
} }
onWirelessStatusChanged: {
}
onBluetoothConnectionError: { onBluetoothConnectionError: {
print("Error") print("Error")
pageStack.pop(root) pageStack.pop(root)

View File

@ -86,7 +86,7 @@ Page {
function updateConnectButton() { function updateConnectButton() {
if (!root.wifiSetup.currentConnection) { if (!root.wifiSetup.currentConnection) {
connectButton.url = ""; connectButton.host = null;
return; return;
} }
@ -102,7 +102,7 @@ Page {
updateConnectButton(); updateConnectButton();
}) })
} }
connectButton.url = ""; connectButton.host = null;
} }
ColumnLayout { ColumnLayout {

View File

@ -54,6 +54,10 @@ SettingsPageBase {
text: root.thingClass.displayName text: root.thingClass.displayName
subText: root.thingClass.id.toString().replace(/[{}]/g, "") subText: root.thingClass.id.toString().replace(/[{}]/g, "")
progressive: false progressive: false
onClicked: {
PlatformHelper.toClipBoard(subText);
ToolTip.show(qsTr("ID copied to clipboard"), 500);
}
} }
SettingsPageSectionHeader { SettingsPageSectionHeader {