diff options
author | willemferguson <willemferguson@zoology.up.ac.za> | 2019-12-08 15:44:14 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-12-25 02:57:42 +0900 |
commit | b24caa4e2db42d300e3806ca3d13ce72202a24d8 (patch) | |
tree | 31b0d4c9824427f19ab757ecf185a714ae6b80ac | |
parent | f63f3eb4ae0cd3621cf5748dfd76749b40b6d886 (diff) | |
download | subsurface-b24caa4e2db42d300e3806ca3d13ce72202a24d8.tar.gz |
Preferenced UI: add dive download tab
Add a preferences tab for dive download, allowing resetting the
buttons representing download connections in the Download panel.
Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | core/settings/qPref.cpp | 4 | ||||
-rw-r--r-- | desktop-widgets/preferences/CMakeLists.txt | 7 | ||||
-rw-r--r-- | desktop-widgets/preferences/preferences_dc.cpp | 41 | ||||
-rw-r--r-- | desktop-widgets/preferences/preferences_dc.h | 27 | ||||
-rw-r--r-- | desktop-widgets/preferences/preferences_dc.ui | 97 | ||||
-rw-r--r-- | desktop-widgets/preferences/preferences_defaults.cpp | 8 | ||||
-rw-r--r-- | desktop-widgets/preferences/preferences_defaults.h | 1 | ||||
-rw-r--r-- | desktop-widgets/preferences/preferences_defaults.ui | 22 | ||||
-rw-r--r-- | desktop-widgets/preferences/preferencesdialog.cpp | 2 | ||||
-rw-r--r-- | icons/pref_dc.png | bin | 0 -> 1480 bytes | |||
-rw-r--r-- | subsurface.qrc | 1 |
11 files changed, 180 insertions, 30 deletions
diff --git a/core/settings/qPref.cpp b/core/settings/qPref.cpp index c70ad4dbe..6b18d1915 100644 --- a/core/settings/qPref.cpp +++ b/core/settings/qPref.cpp @@ -15,6 +15,7 @@ #include "qPrefUnit.h" #include "qPrefUpdateManager.h" #include "qPrefEquipment.h" +#include "qPrefMedia.h" #include <QtQml> #include <QQmlContext> @@ -40,6 +41,7 @@ void qPref::loadSync(bool doSync) qPrefUnits::loadSync(doSync); qPrefUpdateManager::loadSync(doSync); qPrefEquipment::loadSync(doSync); + qPrefMedia::loadSync(doSync); } Q_DECLARE_METATYPE(deco_mode); @@ -64,6 +66,8 @@ void qPref::registerQML(QQmlEngine *engine) ct->setContextProperty("PrefUnits", qPrefUnits::instance()); ct->setContextProperty("PrefUpdateManager", qPrefUpdateManager::instance()); ct->setContextProperty("PrefEquipment", qPrefUpdateManager::instance()); + ct->setContextProperty("PrefMedia", qPrefUpdateManager::instance()); + ct->setContextProperty("PrefClearDc", qPrefUpdateManager::instance()); } // Register special types diff --git a/desktop-widgets/preferences/CMakeLists.txt b/desktop-widgets/preferences/CMakeLists.txt index c0b0de7ab..cec31e6f3 100644 --- a/desktop-widgets/preferences/CMakeLists.txt +++ b/desktop-widgets/preferences/CMakeLists.txt @@ -14,6 +14,7 @@ set(SUBSURFACE_PREFERENCES_UI preferences_language.ui preferences_media.ui preferences_equipment.ui + preferences_dc.ui ) qt5_wrap_ui(SUBSURFACE_PREFERENCES_UI_HDRS ${SUBSURFACE_PREFERENCES_UI}) @@ -23,6 +24,10 @@ source_group("Subsurface Interface Files" FILES ${SUBSURFACE_PREFERENCES_UI}) set(SUBSURFACE_PREFERENCES_LIB_SRCS abstractpreferenceswidget.cpp abstractpreferenceswidget.h + preferences_cloud.cpp + preferences_cloud.h + preferences_dc.cpp + preferences_dc.h preferences_defaults.cpp preferences_defaults.h preferences_equipment.cpp @@ -37,8 +42,6 @@ set(SUBSURFACE_PREFERENCES_LIB_SRCS preferences_media.h preferences_network.cpp preferences_network.h - preferences_cloud.cpp - preferences_cloud.h preferences_units.cpp preferences_units.h preferencesdialog.cpp diff --git a/desktop-widgets/preferences/preferences_dc.cpp b/desktop-widgets/preferences/preferences_dc.cpp new file mode 100644 index 000000000..b88881bd8 --- /dev/null +++ b/desktop-widgets/preferences/preferences_dc.cpp @@ -0,0 +1,41 @@ +// SPDX-License-Identifier: GPL-2.0 +#include "preferences_dc.h" +#include "ui_preferences_dc.h" +#include "core/dive.h" +#include "core/settings/qPrefDisplay.h" +#include "core/settings/qPrefCloudStorage.h" +#include "core/settings/qPrefDiveComputer.h" + +#include <QFileDialog> +#include <QProcess> +#include <QMessageBox> + +PreferencesDc::PreferencesDc(): AbstractPreferencesWidget(tr("Dive download"), QIcon(":preferences-dc-icon"), 0 ), ui(new Ui::PreferencesDc()) +{ + ui->setupUi(this); + const QSize BUTTON_SIZE = QSize(200, 22); + ui->resetRememberedDCs->resize(BUTTON_SIZE); +} + +PreferencesDc::~PreferencesDc() +{ + delete ui; +} + +void PreferencesDc::on_resetRememberedDCs_clicked() +{ + qPrefDiveComputer::set_vendor1(QString()); + qPrefDiveComputer::set_vendor2(QString()); + qPrefDiveComputer::set_vendor3(QString()); + qPrefDiveComputer::set_vendor4(QString()); +} + + +void PreferencesDc::refreshSettings() +{ +} + +void PreferencesDc::syncSettings() +{ +} + diff --git a/desktop-widgets/preferences/preferences_dc.h b/desktop-widgets/preferences/preferences_dc.h new file mode 100644 index 000000000..4919c15a0 --- /dev/null +++ b/desktop-widgets/preferences/preferences_dc.h @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: GPL-2.0 +#ifndef PREFERENCES_DC_H +#define PREFERENCES_DC_H + +#include "abstractpreferenceswidget.h" +#include "core/pref.h" + +namespace Ui { + class PreferencesDc; +} + +class PreferencesDc : public AbstractPreferencesWidget { + Q_OBJECT +public: + PreferencesDc(); + ~PreferencesDc(); + void refreshSettings() override; + void syncSettings() override; +public slots: + void on_resetRememberedDCs_clicked(); + +private: + Ui::PreferencesDc *ui; +}; + + +#endif diff --git a/desktop-widgets/preferences/preferences_dc.ui b/desktop-widgets/preferences/preferences_dc.ui new file mode 100644 index 000000000..cb93eddae --- /dev/null +++ b/desktop-widgets/preferences/preferences_dc.ui @@ -0,0 +1,97 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>PreferencesDc</class> + <widget class="QWidget" name="PreferencesDc"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>561</width> + <height>558</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + + <item> + <widget class="QLabel" name="label_help2"> + <property name="toolTip"> + <string extracomment="Help info 1"/> + </property> + <property name="text"> + <string>DIVE COMPUTER</string> + </property> + </widget> + </item> + + <item> + <widget class="QGroupBox" name="groupBox_10"> + <layout class="QGridLayout" name="gridlayout"> + + <item row="0" column="0"> + <widget class="QLabel" name="label_help2"> + <property name="toolTip"> + <string extracomment="Help info 1"/> + </property> + <property name="text"> + <string>Delete connections</string> + </property> + </widget> + </item> + + <item row="1" column="0" colspan="2"> + <widget class="QLabel" name="label_help2"> + <property name="toolTip"> + <string extracomment="Help info 1"/> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + <property name="text"> + <string>When importing dives from a dive computer (DC), Subsurface remembers the connection(s), showing them as selectable buttons in the Download panel. This is useful for DCs using Bluetooth for communication. In order to clear all this information, click on the button below. After clearing the information the buttons on the Download panel disappear and it is necessary to establish new connection(s) with dive computer(s) before importing dives again.</string> + </property> + </widget> + </item> + + <item row="2" column="0"> + <widget class="QPushButton" name="resetRememberedDCs"> + <property name="text"> + <string>Delete all dive computer connections</string> + </property> + </widget> + </item> + + <item row="2" column="1"> + <widget class="QLabel" name="label_help2"> + <property name="text"> + <string> </string> + </property> + </widget> + </item> + + </layout> + </widget> + </item> + + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + + </layout> + </widget> + <resources/> + <connections> + </connections> +</ui> diff --git a/desktop-widgets/preferences/preferences_defaults.cpp b/desktop-widgets/preferences/preferences_defaults.cpp index 549475a23..2a76fe662 100644 --- a/desktop-widgets/preferences/preferences_defaults.cpp +++ b/desktop-widgets/preferences/preferences_defaults.cpp @@ -47,14 +47,6 @@ void PreferencesDefaults::on_localDefaultFile_toggled(bool toggle) ui->chooseFile->setEnabled(toggle); } -void PreferencesDefaults::on_resetRememberedDCs_clicked() -{ - qPrefDiveComputer::set_vendor1(QString()); - qPrefDiveComputer::set_vendor2(QString()); - qPrefDiveComputer::set_vendor3(QString()); - qPrefDiveComputer::set_vendor4(QString()); -} - void PreferencesDefaults::on_resetSettings_clicked() { // apparently this button was never hooked up? diff --git a/desktop-widgets/preferences/preferences_defaults.h b/desktop-widgets/preferences/preferences_defaults.h index 4c18fcdd9..ce0a8e2e1 100644 --- a/desktop-widgets/preferences/preferences_defaults.h +++ b/desktop-widgets/preferences/preferences_defaults.h @@ -21,7 +21,6 @@ public slots: void on_btnUseDefaultFile_toggled(bool toggled); void on_localDefaultFile_toggled(bool toggled); void on_resetSettings_clicked(); - void on_resetRememberedDCs_clicked(); private: Ui::PreferencesDefaults *ui; diff --git a/desktop-widgets/preferences/preferences_defaults.ui b/desktop-widgets/preferences/preferences_defaults.ui index 50cb95b35..f33cd099f 100644 --- a/desktop-widgets/preferences/preferences_defaults.ui +++ b/desktop-widgets/preferences/preferences_defaults.ui @@ -178,26 +178,10 @@ </widget> </item> <item> - <widget class="QGroupBox" name="groupBox_9"> - <property name="title"> - <string>Clear settings</string> + <widget class="QPushButton" name="resetSettings"> + <property name="text"> + <string>Reset all settings to their default value</string> </property> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QPushButton" name="resetRememberedDCs"> - <property name="text"> - <string>Reset remembered dive computers</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="resetSettings"> - <property name="text"> - <string>Reset all settings to their default value</string> - </property> - </widget> - </item> - </layout> </widget> </item> <item> diff --git a/desktop-widgets/preferences/preferencesdialog.cpp b/desktop-widgets/preferences/preferencesdialog.cpp index dd5adeb7b..f58829cc6 100644 --- a/desktop-widgets/preferences/preferencesdialog.cpp +++ b/desktop-widgets/preferences/preferencesdialog.cpp @@ -11,6 +11,7 @@ #include "preferences_cloud.h" #include "preferences_equipment.h" #include "preferences_media.h" +#include "preferences_dc.h" #include "core/qthelper.h" @@ -71,6 +72,7 @@ PreferencesDialog::PreferencesDialog() addPreferencePage(new PreferencesCloud()); addPreferencePage(new PreferencesEquipment()); addPreferencePage(new PreferencesMedia()); + addPreferencePage(new PreferencesDc()); refreshPages(); diff --git a/icons/pref_dc.png b/icons/pref_dc.png Binary files differnew file mode 100644 index 000000000..a146ff050 --- /dev/null +++ b/icons/pref_dc.png diff --git a/subsurface.qrc b/subsurface.qrc index f7eef4908..286e0bc6b 100644 --- a/subsurface.qrc +++ b/subsurface.qrc @@ -15,6 +15,7 @@ <file alias="preferences-cloud-icon">icons/pref_cloud.png</file> <file alias="preferences-equipment-icon">icons/pref_equipment.png</file> <file alias="preferences-media-icon">icons/pref_media.png</file> + <file alias="preferences-dc-icon">icons/pref_dc.png</file> <file alias="scale-graph-icon">icons/graph.png</file> <file alias="value-minimum-icon">icons/minimum.png</file> <file alias="value-maximum-icon">icons/maximum.png</file> |