diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2019-02-13 22:48:50 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-02-14 09:05:58 -0800 |
commit | 9d582c5512c261bbea5d6257375c291a06721950 (patch) | |
tree | 03f3b1d90cff89e75db383bc4e5a182f04341b22 /mobile-widgets | |
parent | f35a0f3b09197b56a7ecdd63a6689d8b69b36ce8 (diff) | |
download | subsurface-9d582c5512c261bbea5d6257375c291a06721950.tar.gz |
Mobile: only show dive computers in the Bluetooth connection list
And offer an option to show all devices in the settings. This is intentionally
not stored in the preferences as this should never be needed. We don't support
BT or BLE dive computers that we don't recognize. This is a last resort in case
a new firmware were to change the name or some other weird issue causes us not
to recognize a dive computer - and that should be fixed instead of worked
around.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets')
-rw-r--r-- | mobile-widgets/qml/Settings.qml | 35 | ||||
-rw-r--r-- | mobile-widgets/qmlmanager.cpp | 9 | ||||
-rw-r--r-- | mobile-widgets/qmlmanager.h | 5 |
3 files changed, 48 insertions, 1 deletions
diff --git a/mobile-widgets/qml/Settings.qml b/mobile-widgets/qml/Settings.qml index 358d89a04..6a3302eb8 100644 --- a/mobile-widgets/qml/Settings.qml +++ b/mobile-widgets/qml/Settings.qml @@ -531,6 +531,41 @@ Kirigami.ScrollablePage { } GridLayout { + id: whichBluetoothDevices + columns: 2 + Controls.Label { + text: qsTr("Bluetooth") + font.pointSize: subsurfaceTheme.headingPointSize + font.weight: Font.Light + color: subsurfaceTheme.textColor + Layout.topMargin: Kirigami.Units.largeSpacing + Layout.bottomMargin: Kirigami.Units.largeSpacing / 2 + Layout.columnSpan: 2 + } + + Controls.Label { + text: qsTr("Show all bluetooth devices \neven if not recognized as dive computers") + font.pointSize: subsurfaceTheme.regularPointSize + Layout.preferredWidth: gridWidth * 0.75 + } + SsrfSwitch { + id: nonDCButton + checked: manager.showNonDiveComputers + Layout.preferredWidth: gridWidth * 0.25 + onClicked: { + manager.showNonDiveComputers = checked + } + } + } + + Rectangle { + color: subsurfaceTheme.darkerPrimaryColor + height: 1 + opacity: 0.5 + Layout.fillWidth: true + } + + GridLayout { id: developer columns: 2 Controls.Label { diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index 570ab0c67..8973aef43 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -144,7 +144,8 @@ QMLManager::QMLManager() : m_locationServiceEnabled(false), m_updateSelectedDive(-1), m_selectedDiveTimestamp(0), alreadySaving(false), - m_pluggedInDeviceName("") + m_pluggedInDeviceName(""), + m_showNonDiveComputers(false) { LOG_STP("qmlmgr starting"); m_instance = this; @@ -1979,6 +1980,12 @@ void QMLManager::setFilter(const QString filterText) }); } +void QMLManager::setShowNonDiveComputers(bool show) +{ + m_showNonDiveComputers = show; + BTDiscovery::instance()->showNonDiveComputers(show); +} + #if defined(Q_OS_ANDROID) // implemented in core/android.cpp void checkPendingIntents(); diff --git a/mobile-widgets/qmlmanager.h b/mobile-widgets/qmlmanager.h index 5636af379..7d10f78b2 100644 --- a/mobile-widgets/qmlmanager.h +++ b/mobile-widgets/qmlmanager.h @@ -48,6 +48,7 @@ class QMLManager : public QObject { Q_PROPERTY(bool DC_saveDump READ DC_saveDump WRITE DC_setSaveDump) Q_PROPERTY(int DC_deviceId READ DC_deviceId WRITE DC_setDeviceId) Q_PROPERTY(QString pluggedInDeviceName MEMBER m_pluggedInDeviceName NOTIFY pluggedInDeviceNameChanged) + Q_PROPERTY(bool showNonDiveComputers MEMBER m_showNonDiveComputers WRITE setShowNonDiveComputers NOTIFY showNonDiveComputersChanged) public: QMLManager(); ~QMLManager(); @@ -126,6 +127,8 @@ public: bool btEnabled() const; void setBtEnabled(bool value); + void setShowNonDiveComputers(bool show); + DiveListSortModel *dlSortModel; QStringList suitList() const; @@ -234,6 +237,7 @@ private: bool m_btEnabled; void updateAllGlobalLists(); QString m_pluggedInDeviceName; + bool m_showNonDiveComputers; struct dive *m_copyPasteDive = NULL; struct dive_components what; @@ -262,6 +266,7 @@ signals: void locationListChanged(); void waitingForPositionChanged(); void pluggedInDeviceNameChanged(); + void showNonDiveComputersChanged(); }; #endif |