diff options
author | Joakim Bygdell <j.bygdell@gmail.com> | 2017-07-19 16:35:46 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-07-23 03:20:58 +0900 |
commit | a66d876ed0f0f36ecf133ecaf61181c0133cb193 (patch) | |
tree | f8a8bb19c7ec2d0503634470c901feb43ea19fba /mobile-widgets | |
parent | 0eef27376a7f0f17ef0225d33db7bfe61f52d8f9 (diff) | |
download | subsurface-a66d876ed0f0f36ecf133ecaf61181c0133cb193.tar.gz |
QML UI: add checkbox to show/hide developer menu
Add a checkbox to the preferences page to facilitate selective visibility of the developer menu. With the coresponding function in qmlmanager.
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Diffstat (limited to 'mobile-widgets')
-rw-r--r-- | mobile-widgets/qml/Preferences.qml | 43 | ||||
-rw-r--r-- | mobile-widgets/qml/main.qml | 1 | ||||
-rw-r--r-- | mobile-widgets/qmlmanager.cpp | 11 | ||||
-rw-r--r-- | mobile-widgets/qmlmanager.h | 6 |
4 files changed, 61 insertions, 0 deletions
diff --git a/mobile-widgets/qml/Preferences.qml b/mobile-widgets/qml/Preferences.qml index e7d50f7de..2a12e71ac 100644 --- a/mobile-widgets/qml/Preferences.qml +++ b/mobile-widgets/qml/Preferences.qml @@ -321,6 +321,49 @@ Kirigami.ScrollablePage { text: qsTr("Save detailed log of interaction with the dive computer") } } + GridLayout { + id: developer + columns: 2 + width: parent.width - Kirigami.Units.gridUnit + Kirigami.Heading { + text: qsTr("Developer") + color: subsurfaceTheme.textColor + level: 4 + Layout.topMargin: Kirigami.Units.largeSpacing + Layout.bottomMargin: Kirigami.Units.largeSpacing / 2 + Layout.columnSpan: 2 + } + + CheckBox { + id: developerButton + checked: manager.developer + onClicked: { + manager.developer = checked + } + indicator: Rectangle { + implicitWidth: 20 + implicitHeight: 20 + x: developerButton.leftPadding + y: parent.height / 2 - height / 2 + radius: 4 + border.color: developerButton.down ? subsurfaceTheme.primaryColor : subsurfaceTheme.darkerPrimaryColor + color: subsurfaceTheme.backgroundColor + + Rectangle { + width: 12 + height: 12 + x: 4 + y: 4 + radius: 3 + color: developerButton.down ? subsurfaceTheme.primaryColor : subsurfaceTheme.darkerPrimaryColor + visible: developerButton.checked + } + } + } + Kirigami.Label { + text: qsTr("Display Developer menu") + } + } Item { height: Kirigami.Units.gridUnit * 6 } diff --git a/mobile-widgets/qml/main.qml b/mobile-widgets/qml/main.qml index 5b0c67db3..d1944a14e 100644 --- a/mobile-widgets/qml/main.qml +++ b/mobile-widgets/qml/main.qml @@ -251,6 +251,7 @@ if you have network connectivity and want to sync your data to cloud storage."), }, Kirigami.Action { text: qsTr("Developer") + visible: manager.developer Kirigami.Action { text: qsTr("App log") onTriggered: { diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index 13cf0b4fc..3612fb73c 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -1583,6 +1583,17 @@ void QMLManager::setLibdcLog(bool value) emit libdcLogChanged(); } +bool QMLManager::developer() const +{ + return m_developer; +} + +void QMLManager::setDeveloper(bool value) +{ + m_developer = value; + emit developerChanged(); +} + bool QMLManager::btEnabled() const { return m_btEnabled; diff --git a/mobile-widgets/qmlmanager.h b/mobile-widgets/qmlmanager.h index 8e4f05fa6..8f3db3266 100644 --- a/mobile-widgets/qmlmanager.h +++ b/mobile-widgets/qmlmanager.h @@ -42,6 +42,7 @@ class QMLManager : public QObject { Q_PROPERTY(bool showPin READ showPin WRITE setShowPin NOTIFY showPinChanged) Q_PROPERTY(QString progressMessage READ progressMessage WRITE setProgressMessage NOTIFY progressMessageChanged) Q_PROPERTY(bool libdcLog READ libdcLog WRITE setLibdcLog NOTIFY libdcLogChanged) + Q_PROPERTY(bool developer READ developer WRITE setDeveloper NOTIFY developerChanged) public: QMLManager(); @@ -119,6 +120,9 @@ public: bool libdcLog() const; void setLibdcLog(bool value); + bool developer() const; + void setDeveloper(bool value); + typedef void (QMLManager::*execute_function_type)(); DiveListSortModel *dlSortModel; @@ -219,6 +223,7 @@ private: DCDeviceData *m_device_data; QString m_progressMessage; bool m_libdcLog; + bool m_developer; bool m_btEnabled; #if defined(Q_OS_ANDROID) @@ -250,6 +255,7 @@ signals: void sendScreenChanged(QScreen *screen); void progressMessageChanged(); void libdcLogChanged(); + void developerChanged(); }; #endif |