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 #include @@ -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 +#include +#include + +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 @@ + + + PreferencesDc + + + + 0 + 0 + 561 + 558 + + + + Form + + + + + + + + + + DIVE COMPUTER + + + + + + + + + + + + + + + Delete connections + + + + + + + + + + + true + + + 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. + + + + + + + + Delete all dive computer connections + + + + + + + + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + 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 @@ - - - Clear settings + + + Reset all settings to their default value - - - - - Reset remembered dive computers - - - - - - - Reset all settings to their default value - - - - 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 new file mode 100644 index 000000000..a146ff050 Binary files /dev/null and b/icons/pref_dc.png differ diff --git a/subsurface.qrc b/subsurface.qrc index f7eef4908..286e0bc6b 100644 --- a/subsurface.qrc +++ b/subsurface.qrc @@ -15,6 +15,7 @@ icons/pref_cloud.png icons/pref_equipment.png icons/pref_media.png + icons/pref_dc.png icons/graph.png icons/minimum.png icons/maximum.png