add a styleController to have better control over styles
This commit is contained in:
parent
5922a48b65
commit
256149c5de
15
mea/main.cpp
15
mea/main.cpp
@ -53,6 +53,7 @@
|
|||||||
#include "models/eventdescriptorparamsfiltermodel.h"
|
#include "models/eventdescriptorparamsfiltermodel.h"
|
||||||
#include "basicconfiguration.h"
|
#include "basicconfiguration.h"
|
||||||
#include "wifisetup/networkmanagercontroler.h"
|
#include "wifisetup/networkmanagercontroler.h"
|
||||||
|
#include "stylecontroller.h"
|
||||||
|
|
||||||
static QObject* interfacesModel_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
|
static QObject* interfacesModel_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
|
||||||
{
|
{
|
||||||
@ -166,15 +167,17 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Engine::instance();
|
Engine::instance();
|
||||||
|
|
||||||
QQmlApplicationEngine engine;
|
QQmlApplicationEngine *engine = new QQmlApplicationEngine();
|
||||||
#ifdef BRANDING
|
#ifdef BRANDING
|
||||||
engine.rootContext()->setContextProperty("appBranding", BRANDING);
|
engine->rootContext()->setContextProperty("appBranding", BRANDING);
|
||||||
QQuickStyle::setStyle(QString(":/styles/%1").arg(BRANDING));
|
|
||||||
#else
|
#else
|
||||||
QSettings settings;
|
engine->rootContext()->setContextProperty("appBranding", "");
|
||||||
QQuickStyle::setStyle(":/styles/" + settings.value("style", "light").toString());
|
|
||||||
#endif
|
#endif
|
||||||
engine.load(QUrl(QLatin1String("qrc:/ui/main.qml")));
|
|
||||||
|
StyleController styleController;
|
||||||
|
engine->rootContext()->setContextProperty("styleController", &styleController);
|
||||||
|
|
||||||
|
engine->load(QUrl(QLatin1String("qrc:/ui/main.qml")));
|
||||||
|
|
||||||
return application.exec();
|
return application.exec();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,7 +45,8 @@ HEADERS += engine.h \
|
|||||||
wifisetup/wirelessaccesspoint.h \
|
wifisetup/wirelessaccesspoint.h \
|
||||||
wifisetup/wirelessaccesspoints.h \
|
wifisetup/wirelessaccesspoints.h \
|
||||||
wifisetup/wirelesssetupmanager.h \
|
wifisetup/wirelesssetupmanager.h \
|
||||||
wifisetup/networkmanagercontroler.h
|
wifisetup/networkmanagercontroler.h \
|
||||||
|
stylecontroller.h
|
||||||
|
|
||||||
|
|
||||||
SOURCES += main.cpp \
|
SOURCES += main.cpp \
|
||||||
@ -87,7 +88,8 @@ SOURCES += main.cpp \
|
|||||||
wifisetup/wirelessaccesspoint.cpp \
|
wifisetup/wirelessaccesspoint.cpp \
|
||||||
wifisetup/wirelessaccesspoints.cpp \
|
wifisetup/wirelessaccesspoints.cpp \
|
||||||
wifisetup/wirelesssetupmanager.cpp \
|
wifisetup/wirelesssetupmanager.cpp \
|
||||||
wifisetup/networkmanagercontroler.cpp
|
wifisetup/networkmanagercontroler.cpp \
|
||||||
|
stylecontroller.cpp
|
||||||
|
|
||||||
withavahi {
|
withavahi {
|
||||||
DEFINES += WITH_AVAHI
|
DEFINES += WITH_AVAHI
|
||||||
|
|||||||
38
mea/stylecontroller.cpp
Normal file
38
mea/stylecontroller.cpp
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#include <QSettings>
|
||||||
|
#include <QQuickStyle>
|
||||||
|
#include <QDir>
|
||||||
|
|
||||||
|
#include "stylecontroller.h"
|
||||||
|
|
||||||
|
StyleController::StyleController(QObject *parent) : QObject(parent)
|
||||||
|
{
|
||||||
|
#ifdef BRANDING
|
||||||
|
QQuickStyle::setStyle(QString(":/styles/%1").arg(BRANDING));
|
||||||
|
#else
|
||||||
|
QQuickStyle::setStyle(QString(":/styles/%1").arg(currentStyle()));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
QString StyleController::currentStyle() const
|
||||||
|
{
|
||||||
|
#ifdef BRANDING
|
||||||
|
return BRANDING;
|
||||||
|
#endif
|
||||||
|
QSettings settings;
|
||||||
|
return settings.value("style", "light").toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
void StyleController::setCurrentStyle(const QString ¤tStyle)
|
||||||
|
{
|
||||||
|
QSettings settings;
|
||||||
|
if (settings.value("style").toString() != currentStyle) {
|
||||||
|
settings.setValue("style", currentStyle);
|
||||||
|
emit currentStyleChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList StyleController::allStyles() const
|
||||||
|
{
|
||||||
|
QDir dir(":/styles/");
|
||||||
|
return dir.entryList(QDir::Dirs);
|
||||||
|
}
|
||||||
25
mea/stylecontroller.h
Normal file
25
mea/stylecontroller.h
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#ifndef STYLECONTROLLER_H
|
||||||
|
#define STYLECONTROLLER_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
class StyleController : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_PROPERTY(QString currentStyle READ currentStyle WRITE setCurrentStyle NOTIFY currentStyleChanged)
|
||||||
|
Q_PROPERTY(QStringList allStyles READ allStyles CONSTANT)
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit StyleController(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
QString currentStyle() const;
|
||||||
|
void setCurrentStyle(const QString ¤tStyle);
|
||||||
|
|
||||||
|
QStringList allStyles() const;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void currentStyleChanged();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // STYLECONTROLLER_H
|
||||||
@ -1,7 +1,6 @@
|
|||||||
import QtQuick 2.4
|
import QtQuick 2.4
|
||||||
import QtQuick.Controls 2.1
|
import QtQuick.Controls 2.1
|
||||||
import QtQuick.Layouts 1.2
|
import QtQuick.Layouts 1.2
|
||||||
|
|
||||||
import "components"
|
import "components"
|
||||||
import Mea 1.0
|
import Mea 1.0
|
||||||
|
|
||||||
@ -22,6 +21,7 @@ Page {
|
|||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
spacing: app.margins
|
||||||
|
|
||||||
BusyIndicator {
|
BusyIndicator {
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
@ -77,5 +77,4 @@ Page {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,40 +10,13 @@ Page {
|
|||||||
|
|
||||||
readonly property bool haveHosts: discovery.discoveryModel.count > 0
|
readonly property bool haveHosts: discovery.discoveryModel.count > 0
|
||||||
|
|
||||||
header: GuhHeader {
|
|
||||||
text: qsTr("Connect nymea")
|
|
||||||
backButtonVisible: false
|
|
||||||
menuButtonVisible: true
|
|
||||||
onMenuPressed: connectionMenu.open()
|
|
||||||
}
|
|
||||||
|
|
||||||
Menu {
|
|
||||||
id: connectionMenu
|
|
||||||
width: implicitWidth + app.margins
|
|
||||||
|
|
||||||
IconMenuItem {
|
|
||||||
iconSource: "../images/network-vpn.svg"
|
|
||||||
text: qsTr("Manual connect")
|
|
||||||
onTriggered: pageStack.push(manualConnectPage)
|
|
||||||
}
|
|
||||||
|
|
||||||
MenuSeparator {}
|
|
||||||
|
|
||||||
IconMenuItem {
|
|
||||||
iconSource: "../images/bluetooth.svg"
|
|
||||||
text: qsTr("Wireless setup")
|
|
||||||
onTriggered: pageStack.push(Qt.resolvedUrl("BluetoothDiscoveryPage.qml"))
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
print("completed connectPage. last connected host:", settings.lastConnectedHost)
|
print("completed connectPage. last connected host:", settings.lastConnectedHost)
|
||||||
if (settings.lastConnectedHost.length > 0) {
|
if (settings.lastConnectedHost.length > 0) {
|
||||||
pageStack.push(connectingPage)
|
pageStack.push(connectingPage)
|
||||||
Engine.connection.connect(settings.lastConnectedHost)
|
Engine.connection.connect(settings.lastConnectedHost)
|
||||||
|
} else {
|
||||||
|
pageStack.push(discoveryPage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,130 +30,170 @@ Page {
|
|||||||
}
|
}
|
||||||
onConnectionError: {
|
onConnectionError: {
|
||||||
pageStack.pop(root)
|
pageStack.pop(root)
|
||||||
|
pageStack.push(discoveryPage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
Component {
|
||||||
anchors.fill: parent
|
id: discoveryPage
|
||||||
anchors.topMargin: app.bigMargins
|
|
||||||
spacing: app.margins
|
|
||||||
|
|
||||||
ColumnLayout {
|
Page {
|
||||||
Layout.fillWidth: true
|
header: GuhHeader {
|
||||||
Layout.margins: app.margins
|
text: qsTr("Connect nymea")
|
||||||
spacing: app.margins
|
backButtonVisible: false
|
||||||
|
menuButtonVisible: true
|
||||||
Label {
|
onMenuPressed: connectionMenu.open()
|
||||||
Layout.fillWidth: true
|
|
||||||
text: root.haveHosts ? qsTr("Oh, look!") : qsTr("Uh oh")
|
|
||||||
//color: "black"
|
|
||||||
font.pixelSize: app.largeFont
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Timer {
|
||||||
Layout.fillWidth: true
|
id: startupTimer
|
||||||
text: root.haveHosts ?
|
interval: 5000
|
||||||
qsTr("There are %1 nymea boxes in your network! Which one would you like to use?").arg(discovery.discoveryModel.count)
|
repeat: false
|
||||||
: qsTr("There doesn't seem to be a nymea box installed in your network. Please make sure your nymea box is correctly set up and connected.")
|
running: true
|
||||||
wrapMode: Text.WordWrap
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
Menu {
|
||||||
Layout.fillWidth: true
|
id: connectionMenu
|
||||||
Layout.preferredHeight: 1
|
width: implicitWidth + app.margins
|
||||||
color: Material.accent
|
|
||||||
}
|
|
||||||
|
|
||||||
ListView {
|
IconMenuItem {
|
||||||
Layout.fillWidth: true
|
iconSource: "../images/network-vpn.svg"
|
||||||
Layout.fillHeight: true
|
text: qsTr("Manual connect")
|
||||||
model: discovery.discoveryModel
|
onTriggered: pageStack.push(manualConnectPage)
|
||||||
clip: true
|
|
||||||
|
|
||||||
delegate: ItemDelegate {
|
|
||||||
width: parent.width
|
|
||||||
height: app.delegateHeight
|
|
||||||
ColumnLayout {
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.margins: app.margins
|
|
||||||
Label {
|
|
||||||
text: model.name
|
|
||||||
}
|
|
||||||
Label {
|
|
||||||
text: model.hostAddress
|
|
||||||
font.pixelSize: app.smallFont
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
onClicked: {
|
|
||||||
print("Should connect to", model.nymeaRpcUrl)
|
MenuSeparator {}
|
||||||
Engine.connection.connect(model.nymeaRpcUrl)
|
|
||||||
pageStack.push(connectingPage)
|
IconMenuItem {
|
||||||
|
iconSource: "../images/bluetooth.svg"
|
||||||
|
text: qsTr("Wireless setup")
|
||||||
|
onTriggered: pageStack.push(Qt.resolvedUrl("BluetoothDiscoveryPage.qml"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Column {
|
ColumnLayout {
|
||||||
anchors.centerIn: parent
|
anchors.fill: parent
|
||||||
spacing: app.margins
|
spacing: app.margins
|
||||||
visible: !root.haveHosts
|
|
||||||
|
|
||||||
Label {
|
ColumnLayout {
|
||||||
text: qsTr("Searching for nymea boxes...")
|
Layout.fillWidth: true
|
||||||
|
Layout.margins: app.margins
|
||||||
|
spacing: app.margins
|
||||||
|
|
||||||
|
Label {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
text: root.haveHosts ? qsTr("Oh, look!") : startupTimer.running ? qsTr("Just a moment...") : qsTr("Uh oh")
|
||||||
|
//color: "black"
|
||||||
|
font.pixelSize: app.largeFont
|
||||||
|
}
|
||||||
|
|
||||||
|
Label {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
text: root.haveHosts ?
|
||||||
|
qsTr("There are %1 nymea boxes in your network! Which one would you like to use?").arg(discovery.discoveryModel.count)
|
||||||
|
: startupTimer.running ? qsTr("We haven't found any nymea boxes in your network yet.")
|
||||||
|
: qsTr("There doesn't seem to be a nymea box installed in your network. Please make sure your nymea box is correctly set up and connected.")
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BusyIndicator {
|
Rectangle {
|
||||||
running: visible
|
Layout.fillWidth: true
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
Layout.preferredHeight: 1
|
||||||
|
color: Material.accent
|
||||||
|
}
|
||||||
|
|
||||||
|
ListView {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.fillHeight: true
|
||||||
|
model: discovery.discoveryModel
|
||||||
|
clip: true
|
||||||
|
|
||||||
|
delegate: ItemDelegate {
|
||||||
|
width: parent.width
|
||||||
|
height: app.delegateHeight
|
||||||
|
ColumnLayout {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: app.margins
|
||||||
|
Label {
|
||||||
|
text: model.name
|
||||||
|
}
|
||||||
|
Label {
|
||||||
|
text: model.hostAddress
|
||||||
|
font.pixelSize: app.smallFont
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onClicked: {
|
||||||
|
print("Should connect to", model.nymeaRpcUrl)
|
||||||
|
Engine.connection.connect(model.nymeaRpcUrl)
|
||||||
|
pageStack.push(connectingPage)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
spacing: app.margins
|
||||||
|
visible: !root.haveHosts
|
||||||
|
|
||||||
|
Label {
|
||||||
|
text: qsTr("Searching for nymea boxes...")
|
||||||
|
}
|
||||||
|
|
||||||
|
BusyIndicator {
|
||||||
|
running: visible
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: 1
|
||||||
|
color: Material.accent
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.margins: app.margins
|
||||||
|
visible: root.haveHosts
|
||||||
|
Label {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
text: qsTr("Not the ones you're looking for? We're looking for more!")
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
}
|
||||||
|
|
||||||
|
BusyIndicator { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.preferredHeight: 1
|
|
||||||
color: Material.accent
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.margins: app.margins
|
|
||||||
visible: root.haveHosts
|
|
||||||
Label {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
text: qsTr("Not the ones you're looking for? We're looking for more!")
|
|
||||||
wrapMode: Text.WordWrap
|
|
||||||
}
|
|
||||||
|
|
||||||
BusyIndicator { }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: manualConnectPage
|
id: manualConnectPage
|
||||||
|
|
||||||
Page {
|
Page {
|
||||||
|
|
||||||
header: GuhHeader {
|
header: GuhHeader {
|
||||||
text: qsTr("Manual connect to nymea")
|
text: qsTr("Manual connection")
|
||||||
onBackPressed: pageStack.pop()
|
onBackPressed: pageStack.pop()
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
anchors.fill: parent
|
anchors { left: parent.left; top: parent.top; right: parent.right }
|
||||||
anchors.margins: app.margins
|
anchors.margins: app.margins
|
||||||
spacing: app.margins
|
spacing: app.margins
|
||||||
|
|
||||||
GridLayout {
|
GridLayout {
|
||||||
Layout.fillHeight: true
|
|
||||||
Layout.fillWidth: true
|
|
||||||
|
|
||||||
columns: 2
|
columns: 2
|
||||||
|
|
||||||
|
Label {
|
||||||
|
text: qsTr("Protocol")
|
||||||
|
}
|
||||||
|
|
||||||
ComboBox {
|
ComboBox {
|
||||||
id: connectionTypeComboBox
|
id: connectionTypeComboBox
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.columnSpan: 2
|
|
||||||
model: [ qsTr("TCP"), qsTr("Websocket") ]
|
model: [ qsTr("TCP"), qsTr("Websocket") ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,7 +277,7 @@ Page {
|
|||||||
spacing: app.margins
|
spacing: app.margins
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
text: qsTr("Connecting to your nymea box...")
|
text: qsTr("Trying to connect...")
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
font.pixelSize: app.largeFont
|
font.pixelSize: app.largeFont
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@ -275,7 +288,8 @@ Page {
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
onClicked: {
|
onClicked: {
|
||||||
Engine.connection.disconnect()
|
Engine.connection.disconnect()
|
||||||
pageStack.pop();
|
pageStack.pop(root);
|
||||||
|
pageStack.push(discoveryPage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -68,20 +68,19 @@ Page {
|
|||||||
text: "Style"
|
text: "Style"
|
||||||
}
|
}
|
||||||
ComboBox {
|
ComboBox {
|
||||||
model: ["light", "dark", "maveo"]
|
model: styleController.allStyles
|
||||||
currentIndex: {
|
currentIndex: styleController.allStyles.indexOf(styleController.currentStyle)
|
||||||
switch (settings.style) {
|
|
||||||
case "light":
|
|
||||||
return 0;
|
|
||||||
case "dark":
|
|
||||||
return 1;
|
|
||||||
case "maveo":
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onActivated: {
|
onActivated: {
|
||||||
settings.style = model[index]
|
styleController.currentStyle = model[index]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: styleController
|
||||||
|
onCurrentStyleChanged: {
|
||||||
|
var popup = styleChangedDialog.createObject(root)
|
||||||
|
popup.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -167,6 +166,7 @@ Page {
|
|||||||
Button {
|
Button {
|
||||||
id: debugServerButton
|
id: debugServerButton
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.margins: app.margins
|
||||||
visible: debugServerEnabledSwitch.checked
|
visible: debugServerEnabledSwitch.checked
|
||||||
text: qsTr("Open debug interface")
|
text: qsTr("Open debug interface")
|
||||||
onClicked: Qt.openUrlExternally("http://" + Engine.connection.hostAddress + "/debug")
|
onClicked: Qt.openUrlExternally("http://" + Engine.connection.hostAddress + "/debug")
|
||||||
@ -192,4 +192,30 @@ Page {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: styleChangedDialog
|
||||||
|
Dialog {
|
||||||
|
width: Math.min(parent.width * .8, contentLabel.implicitWidth)
|
||||||
|
x: (parent.width - width) / 2
|
||||||
|
y: (parent.height - height) / 2
|
||||||
|
modal: true
|
||||||
|
|
||||||
|
title: qsTr("Style changed")
|
||||||
|
|
||||||
|
standardButtons: Dialog.Ok
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: content
|
||||||
|
anchors { left: parent.left; top: parent.top; right: parent.right }
|
||||||
|
|
||||||
|
Label {
|
||||||
|
id: contentLabel
|
||||||
|
Layout.fillWidth: true
|
||||||
|
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||||
|
text: qsTr("The application needs to be restarted for style changes to take effect.")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,6 +12,14 @@ ApplicationWindow {
|
|||||||
height: 580
|
height: 580
|
||||||
visibility: settings.viewMode
|
visibility: settings.viewMode
|
||||||
font: Qt.application.font
|
font: Qt.application.font
|
||||||
|
title: {
|
||||||
|
switch (appBranding) {
|
||||||
|
case "maveo":
|
||||||
|
return qsTr("Maveo Pro Box Dashboard")
|
||||||
|
default:
|
||||||
|
return "Mea";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
property int margins: 14
|
property int margins: 14
|
||||||
property int bigMargins: 20
|
property int bigMargins: 20
|
||||||
@ -109,7 +117,10 @@ ApplicationWindow {
|
|||||||
|
|
||||||
onClosing: {
|
onClosing: {
|
||||||
if (Qt.platform.os == "android") {
|
if (Qt.platform.os == "android") {
|
||||||
if (pageStack.depth > 1) {
|
// If we're connected, allow going back up to MainPage
|
||||||
|
if ((Engine.jsonRpcClient.connected && pageStack.depth > 1)
|
||||||
|
// if we're not connected, only allow using the back button in wizards
|
||||||
|
|| (!Engine.jsonRpcClient.connected && pageStack.depth > 3)) {
|
||||||
close.accepted = false;
|
close.accepted = false;
|
||||||
pageStack.pop();
|
pageStack.pop();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user