Merge PR #469: Make menu replace pages instead of pushing

This commit is contained in:
Jenkins nymea 2020-11-29 18:58:05 +01:00
commit b83ff3e758
2 changed files with 21 additions and 7 deletions

View File

@ -175,7 +175,7 @@ void JsonRpcClient::setNotificationsEnabledResponse(int /*commandId*/, const QVa
void JsonRpcClient::notificationReceived(const QVariantMap &data) void JsonRpcClient::notificationReceived(const QVariantMap &data)
{ {
qDebug() << "Notification received:" << data; // qDebug() << "Notification received:" << data;
if (data.value("notification").toString() == "JSONRPC.PushButtonAuthFinished") { if (data.value("notification").toString() == "JSONRPC.PushButtonAuthFinished") {
qDebug() << "Push button auth finished."; qDebug() << "Push button auth finished.";
if (data.value("params").toMap().value("transactionId").toInt() != m_pendingPushButtonTransaction) { if (data.value("params").toMap().value("transactionId").toInt() != m_pendingPushButtonTransaction) {

View File

@ -46,23 +46,37 @@ Item {
return swipeView.currentItem.handleAndroidBackButton() return swipeView.currentItem.handleAndroidBackButton()
} }
QtObject {
id: d
// We want only one of them pushed at a time
property var currentSettingsPage: null
function pushSettingsPage(page) {
if (d.currentSettingsPage != null) {
d.currentSettingsPage = swipeView.currentItem.pageStack.replace(d.currentSettingsPage, page);
} else {
d.currentSettingsPage = swipeView.currentItem.pageStack.push(page)
}
}
}
function openThingSettings() { function openThingSettings() {
swipeView.currentItem.pageStack.push("thingconfiguration/EditThingsPage.qml") d.pushSettingsPage("thingconfiguration/EditThingsPage.qml")
} }
function openMagicSettings() { function openMagicSettings() {
swipeView.currentItem.pageStack.push("MagicPage.qml") d.pushSettingsPage("MagicPage.qml")
} }
function openAppSettings() { function openAppSettings() {
swipeView.currentItem.pageStack.push("appsettings/AppSettingsPage.qml") d.pushSettingsPage("appsettings/AppSettingsPage.qml")
} }
function openSystemSettings() { function openSystemSettings() {
swipeView.currentItem.pageStack.push("SettingsPage.qml") d.pushSettingsPage("SettingsPage.qml")
} }
function startManualConnection() { function startManualConnection() {
swipeView.currentItem.pageStack.push("connection/ManualConnectPage.qml") d.pushSettingsPage("connection/ManualConnectPage.qml")
} }
function startWirelessSetup() { function startWirelessSetup() {
swipeView.currentItem.pageStack.push("connection/wifisetup/BluetoothDiscoveryPage.qml"); d.pushSettingsPage("connection/wifisetup/BluetoothDiscoveryPage.qml");
} }
function startDemoMode() { function startDemoMode() {
var host = discovery.nymeaHosts.createWanHost("Demo server", "nymea://nymea.nymea.io:2222") var host = discovery.nymeaHosts.createWanHost("Demo server", "nymea://nymea.nymea.io:2222")