summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/CMakeLists.txt10
-rw-r--r--core/settings/qPref.cpp3
-rw-r--r--core/settings/qPrefGeneral.cpp40
-rw-r--r--core/settings/qPrefGeneral.h21
-rw-r--r--core/settings/qPrefLog.cpp59
-rw-r--r--core/settings/qPrefLog.h57
-rw-r--r--core/settings/qPrefTechnicalDetails.cpp3
-rw-r--r--core/settings/qPrefTechnicalDetails.h5
-rw-r--r--desktop-widgets/preferences/CMakeLists.txt3
-rw-r--r--desktop-widgets/preferences/preferences_dc.cpp2
-rw-r--r--desktop-widgets/preferences/preferences_defaults.cpp66
-rw-r--r--desktop-widgets/preferences/preferences_defaults.h4
-rw-r--r--desktop-widgets/preferences/preferences_defaults.ui114
-rw-r--r--desktop-widgets/preferences/preferences_equipment.cpp2
-rw-r--r--desktop-widgets/preferences/preferences_georeference.cpp2
-rw-r--r--desktop-widgets/preferences/preferences_graph.cpp4
-rw-r--r--desktop-widgets/preferences/preferences_graph.ui18
-rw-r--r--desktop-widgets/preferences/preferences_language.cpp2
-rw-r--r--desktop-widgets/preferences/preferences_log.cpp90
-rw-r--r--desktop-widgets/preferences/preferences_log.h29
-rw-r--r--desktop-widgets/preferences/preferences_log.ui199
-rw-r--r--desktop-widgets/preferences/preferences_media.cpp2
-rw-r--r--desktop-widgets/preferences/preferences_network.cpp2
-rw-r--r--desktop-widgets/preferences/preferences_units.cpp2
-rw-r--r--desktop-widgets/preferences/preferencesdialog.cpp2
-rw-r--r--icons/pref_cloud.pngbin449 -> 1371 bytes
-rw-r--r--icons/pref_dc.pngbin1480 -> 1626 bytes
-rw-r--r--icons/pref_display.pngbin0 -> 969 bytes
-rw-r--r--icons/pref_log.pngbin0 -> 867 bytes
-rw-r--r--icons/pref_media.pngbin658 -> 1119 bytes
-rw-r--r--mobile-widgets/qmlmanager.cpp6
-rw-r--r--profile-widget/diveprofileitem.cpp3
-rw-r--r--subsurface.qrc2
-rw-r--r--tests/testqPrefGeneral.cpp53
-rw-r--r--tests/testqPrefTechnicalDetails.cpp19
35 files changed, 467 insertions, 357 deletions
diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt
index 875d144f5..381276e30 100644
--- a/core/CMakeLists.txt
+++ b/core/CMakeLists.txt
@@ -191,6 +191,8 @@ set(SUBSURFACE_CORE_LIB_SRCS
settings/qPrefDiveComputer.h
settings/qPrefDivePlanner.cpp
settings/qPrefDivePlanner.h
+ settings/qPrefEquipment.cpp
+ settings/qPrefEquipment.h
settings/qPrefGeneral.cpp
settings/qPrefGeneral.h
settings/qPrefGeocoding.cpp
@@ -199,6 +201,10 @@ set(SUBSURFACE_CORE_LIB_SRCS
settings/qPrefLanguage.h
settings/qPrefLocationService.cpp
settings/qPrefLocationService.h
+ settings/qPrefLog.cpp
+ settings/qPrefLog.h
+ settings/qPrefMedia.cpp
+ settings/qPrefMedia.h
settings/qPrefPartialPressureGas.cpp
settings/qPrefPartialPressureGas.h
settings/qPrefPrivate.cpp
@@ -211,10 +217,6 @@ set(SUBSURFACE_CORE_LIB_SRCS
settings/qPrefUnit.h
settings/qPrefUpdateManager.cpp
settings/qPrefUpdateManager.h
- settings/qPrefEquipment.cpp
- settings/qPrefEquipment.h
- settings/qPrefMedia.cpp
- settings/qPrefMedia.h
#Subsurface Qt have the Subsurface structs QObjectified for easy access via QML.
subsurface-qt/CylinderObjectHelper.cpp
diff --git a/core/settings/qPref.cpp b/core/settings/qPref.cpp
index 6b18d1915..4138b0c82 100644
--- a/core/settings/qPref.cpp
+++ b/core/settings/qPref.cpp
@@ -16,6 +16,7 @@
#include "qPrefUpdateManager.h"
#include "qPrefEquipment.h"
#include "qPrefMedia.h"
+#include "qPrefLog.h"
#include <QtQml>
#include <QQmlContext>
@@ -42,6 +43,7 @@ void qPref::loadSync(bool doSync)
qPrefUpdateManager::loadSync(doSync);
qPrefEquipment::loadSync(doSync);
qPrefMedia::loadSync(doSync);
+ qPrefLog::loadSync(doSync);
}
Q_DECLARE_METATYPE(deco_mode);
@@ -68,6 +70,7 @@ void qPref::registerQML(QQmlEngine *engine)
ct->setContextProperty("PrefEquipment", qPrefUpdateManager::instance());
ct->setContextProperty("PrefMedia", qPrefUpdateManager::instance());
ct->setContextProperty("PrefClearDc", qPrefUpdateManager::instance());
+ ct->setContextProperty("PrefLog", qPrefUpdateManager::instance());
}
// Register special types
diff --git a/core/settings/qPrefGeneral.cpp b/core/settings/qPrefGeneral.cpp
index e3d3e6e0a..25ed835f0 100644
--- a/core/settings/qPrefGeneral.cpp
+++ b/core/settings/qPrefGeneral.cpp
@@ -20,15 +20,11 @@ qPrefGeneral *qPrefGeneral::instance()
void qPrefGeneral::loadSync(bool doSync)
{
- disk_default_filename(doSync);
- disk_default_file_behavior(doSync);
disk_defaultsetpoint(doSync);
disk_o2consumption(doSync);
disk_pscr_ratio(doSync);
- disk_use_default_file(doSync);
disk_filterFullTextNotes(doSync);
disk_filterCaseSensitive(doSync);
- disk_extraEnvironmentalDefault(doSync);
if (!doSync) {
load_diveshareExport_uid();
@@ -36,48 +32,12 @@ void qPrefGeneral::loadSync(bool doSync)
}
}
-HANDLE_PREFERENCE_TXT(General, "default_filename", default_filename);
-
-
-void qPrefGeneral::set_default_file_behavior(enum def_file_behavior value)
-{
- if (value != prefs.default_file_behavior ||
- prefs.default_file_behavior != UNDEFINED_DEFAULT_FILE) {
-
- if (value == UNDEFINED_DEFAULT_FILE) {
- // undefined, so check if there's a filename set and
- // use that, otherwise go with no default file
- prefs.default_file_behavior = QString(prefs.default_filename).isEmpty() ? NO_DEFAULT_FILE : LOCAL_DEFAULT_FILE;
- } else {
- prefs.default_file_behavior = value;
- }
- disk_default_file_behavior(true);
- emit instance()->default_file_behaviorChanged(value);
- }
-}
-void qPrefGeneral::disk_default_file_behavior(bool doSync)
-{
- if (doSync) {
- qPrefPrivate::propSetValue(keyFromGroupAndName(group, "default_file_behavior"), prefs.default_file_behavior, default_prefs.default_file_behavior);
- } else {
- prefs.default_file_behavior = (enum def_file_behavior)qPrefPrivate::propValue(keyFromGroupAndName(group, "default_file_behavior"), default_prefs.default_file_behavior).toInt();
- if (prefs.default_file_behavior == UNDEFINED_DEFAULT_FILE)
- // undefined, so check if there's a filename set and
- // use that, otherwise go with no default file
- prefs.default_file_behavior = QString(prefs.default_filename).isEmpty() ? NO_DEFAULT_FILE : LOCAL_DEFAULT_FILE;
- }
-}
-
HANDLE_PREFERENCE_INT(General, "defaultsetpoint", defaultsetpoint);
HANDLE_PREFERENCE_INT(General, "o2consumption", o2consumption);
HANDLE_PREFERENCE_INT(General, "pscr_ratio", pscr_ratio);
-HANDLE_PREFERENCE_BOOL(General, "extraEnvironmentalDefault", extraEnvironmentalDefault);
-
-HANDLE_PREFERENCE_BOOL(General, "use_default_file", use_default_file);
-
HANDLE_PROP_QSTRING(General, "diveshareExport/uid", diveshareExport_uid);
HANDLE_PROP_BOOL(General, "diveshareExport/private", diveshareExport_private);
diff --git a/core/settings/qPrefGeneral.h b/core/settings/qPrefGeneral.h
index bb91d6501..236dc5b21 100644
--- a/core/settings/qPrefGeneral.h
+++ b/core/settings/qPrefGeneral.h
@@ -7,18 +7,13 @@
class qPrefGeneral : public QObject {
Q_OBJECT
- Q_PROPERTY(QString default_filename READ default_filename WRITE set_default_filename NOTIFY default_filenameChanged)
- Q_PROPERTY(enum def_file_behavior default_file_behavior READ default_file_behavior WRITE set_default_file_behavior NOTIFY default_file_behaviorChanged)
Q_PROPERTY(int defaultsetpoint READ defaultsetpoint WRITE set_defaultsetpoint NOTIFY defaultsetpointChanged)
Q_PROPERTY(int o2consumption READ o2consumption WRITE set_o2consumption NOTIFY o2consumptionChanged)
Q_PROPERTY(int pscr_ratio READ pscr_ratio WRITE set_pscr_ratio NOTIFY pscr_ratioChanged)
- Q_PROPERTY(bool use_default_file READ use_default_file WRITE set_use_default_file NOTIFY use_default_fileChanged)
Q_PROPERTY(QString diveshareExport_uid READ diveshareExport_uid WRITE set_diveshareExport_uid NOTIFY diveshareExport_uidChanged)
Q_PROPERTY(bool diveshareExport_private READ diveshareExport_private WRITE set_diveshareExport_private NOTIFY diveshareExport_privateChanged)
Q_PROPERTY(bool filterFullTextNotes READ filterFullTextNotes WRITE set_filterFullTextNotes NOTIFY filterFullTextNotesChanged)
Q_PROPERTY(bool filterCaseSensitive READ filterCaseSensitive WRITE set_filterCaseSensitive NOTIFY filterCaseSensitiveChanged)
- Q_PROPERTY(bool extraEnvironmentalDefault READ extraEnvironmentalDefault WRITE set_extraEnvironmentalDefault NOTIFY extraEnvironmentalDefaultChanged);
-
public:
static qPrefGeneral *instance();
@@ -29,57 +24,41 @@ public:
static void sync() { return loadSync(true); }
public:
- static QString default_filename() { return prefs.default_filename; }
- static enum def_file_behavior default_file_behavior() { return prefs.default_file_behavior; }
static int defaultsetpoint() { return prefs.defaultsetpoint; }
static int o2consumption() { return prefs.o2consumption; }
static int pscr_ratio() { return prefs.pscr_ratio; }
- static bool use_default_file() { return prefs.use_default_file; }
static QString diveshareExport_uid() { return st_diveshareExport_uid; }
static bool diveshareExport_private() { return st_diveshareExport_private; }
static bool filterFullTextNotes() { return prefs.filterFullTextNotes; }
static bool filterCaseSensitive() { return prefs.filterCaseSensitive; }
- static bool extraEnvironmentalDefault() { return prefs.extraEnvironmentalDefault; }
public slots:
- static void set_default_filename(const QString& value);
- static void set_default_file_behavior(enum def_file_behavior value);
static void set_defaultsetpoint(int value);
static void set_o2consumption(int value);
static void set_pscr_ratio(int value);
- static void set_use_default_file(bool value);
static void set_diveshareExport_uid(const QString& value);
static void set_diveshareExport_private(bool value);
static void set_filterFullTextNotes(bool value);
static void set_filterCaseSensitive(bool value);
- static void set_extraEnvironmentalDefault(bool value);
signals:
- void default_filenameChanged(const QString& value);
- void default_file_behaviorChanged(enum def_file_behavior value);
void defaultsetpointChanged(int value);
void o2consumptionChanged(int value);
void pscr_ratioChanged(int value);
- void use_default_fileChanged(bool value);
void diveshareExport_uidChanged(const QString& value);
void diveshareExport_privateChanged(bool value);
void filterFullTextNotesChanged(bool value);
void salinityEditDefaultChanged(bool value);
void filterCaseSensitiveChanged(bool value);
- void extraEnvironmentalDefaultChanged(bool value);
private:
qPrefGeneral() {}
- static void disk_default_filename(bool doSync);
- static void disk_default_file_behavior(bool doSync);
static void disk_defaultsetpoint(bool doSync);
static void disk_o2consumption(bool doSync);
static void disk_pscr_ratio(bool doSync);
- static void disk_use_default_file(bool doSync);
static void disk_filterFullTextNotes(bool doSync);
static void disk_filterCaseSensitive(bool doSync);
- static void disk_extraEnvironmentalDefault(bool doSync);
// class variables are load only
static void load_diveshareExport_uid();
diff --git a/core/settings/qPrefLog.cpp b/core/settings/qPrefLog.cpp
new file mode 100644
index 000000000..2ce9ae550
--- /dev/null
+++ b/core/settings/qPrefLog.cpp
@@ -0,0 +1,59 @@
+// SPDX-License-Identifier: GPL-2.0
+#include "qPrefLog.h"
+#include "qPrefPrivate.h"
+
+static const QString group = QStringLiteral("LogSettings");
+
+qPrefLog *qPrefLog::instance()
+{
+ static qPrefLog *self = new qPrefLog;
+ return self;
+}
+
+void qPrefLog::loadSync(bool doSync)
+{
+ disk_default_filename(doSync);
+ disk_default_file_behavior(doSync);
+ disk_use_default_file(doSync);
+ disk_extraEnvironmentalDefault(doSync);
+ disk_show_average_depth(doSync);
+}
+
+HANDLE_PREFERENCE_TXT(Log, "default_filename", default_filename);
+
+void qPrefLog::set_default_file_behavior(enum def_file_behavior value)
+{
+ if (value != prefs.default_file_behavior ||
+ prefs.default_file_behavior != UNDEFINED_DEFAULT_FILE) {
+
+ if (value == UNDEFINED_DEFAULT_FILE) {
+ // undefined, so check if there's a filename set and
+ // use that, otherwise go with no default file
+ prefs.default_file_behavior = QString(prefs.default_filename).isEmpty() ? NO_DEFAULT_FILE : LOCAL_DEFAULT_FILE;
+ } else {
+ prefs.default_file_behavior = value;
+ }
+ disk_default_file_behavior(true);
+ emit instance()->default_file_behaviorChanged(value);
+ }
+}
+void qPrefLog::disk_default_file_behavior(bool doSync)
+{
+ if (doSync) {
+ qPrefPrivate::propSetValue(keyFromGroupAndName(group, "default_file_behavior"), prefs.default_file_behavior, default_prefs.default_file_behavior);
+ } else {
+ prefs.default_file_behavior = (enum def_file_behavior)qPrefPrivate::propValue(keyFromGroupAndName(group, "default_file_behavior"), default_prefs.default_file_behavior).toInt();
+ if (prefs.default_file_behavior == UNDEFINED_DEFAULT_FILE)
+ // undefined, so check if there's a filename set and
+ // use that, otherwise go with no default file
+ prefs.default_file_behavior = QString(prefs.default_filename).isEmpty() ? NO_DEFAULT_FILE : LOCAL_DEFAULT_FILE;
+ }
+}
+
+
+HANDLE_PREFERENCE_BOOL(Log, "extraEnvironmentalDefault", extraEnvironmentalDefault);
+
+HANDLE_PREFERENCE_BOOL(Log, "use_default_file", use_default_file);
+
+HANDLE_PREFERENCE_BOOL(Log, "show_average_depth", show_average_depth);
+
diff --git a/core/settings/qPrefLog.h b/core/settings/qPrefLog.h
new file mode 100644
index 000000000..ee40bc9e7
--- /dev/null
+++ b/core/settings/qPrefLog.h
@@ -0,0 +1,57 @@
+// SPDX-License-Identifier: GPL-2.0
+#ifndef QPREFLOG_H
+#define QPREFLOG_H
+#include "core/pref.h"
+
+#include <QObject>
+
+class qPrefLog : public QObject {
+ Q_OBJECT
+ Q_PROPERTY(QString default_filename READ default_filename WRITE set_default_filename NOTIFY default_filenameChanged)
+ Q_PROPERTY(enum def_file_behavior default_file_behavior READ default_file_behavior WRITE set_default_file_behavior NOTIFY default_file_behaviorChanged)
+ Q_PROPERTY(bool use_default_file READ use_default_file WRITE set_use_default_file NOTIFY use_default_fileChanged)
+ Q_PROPERTY(bool extraEnvironmentalDefault READ extraEnvironmentalDefault WRITE set_extraEnvironmentalDefault NOTIFY extraEnvironmentalDefaultChanged);
+ Q_PROPERTY(bool show_average_depth READ show_average_depth WRITE set_show_average_depth NOTIFY show_average_depthChanged)
+
+
+public:
+ static qPrefLog *instance();
+
+ // Load/Sync local settings (disk) and struct preference
+ static void loadSync(bool doSync);
+ static void load() { return loadSync(false); }
+ static void sync() { return loadSync(true); }
+
+public:
+ static QString default_filename() { return prefs.default_filename; }
+ static enum def_file_behavior default_file_behavior() { return prefs.default_file_behavior; }
+ static bool use_default_file() { return prefs.use_default_file; }
+ static bool extraEnvironmentalDefault() { return prefs.extraEnvironmentalDefault; }
+ static bool show_average_depth() { return prefs.show_average_depth; }
+
+public slots:
+ static void set_default_filename(const QString& value);
+ static void set_default_file_behavior(enum def_file_behavior value);
+ static void set_use_default_file(bool value);
+ static void set_extraEnvironmentalDefault(bool value);
+ static void set_show_average_depth(bool value);
+
+signals:
+ void default_filenameChanged(const QString& value);
+ void default_file_behaviorChanged(enum def_file_behavior value);
+ void use_default_fileChanged(bool value);
+ void extraEnvironmentalDefaultChanged(bool value);
+ void show_average_depthChanged(bool value);
+
+private:
+ qPrefLog() {}
+
+ static void disk_default_filename(bool doSync);
+ static void disk_default_file_behavior(bool doSync);
+ static void disk_use_default_file(bool doSync);
+ static void disk_extraEnvironmentalDefault(bool doSync);
+ static void disk_show_average_depth(bool doSync);
+
+};
+
+#endif
diff --git a/core/settings/qPrefTechnicalDetails.cpp b/core/settings/qPrefTechnicalDetails.cpp
index 1d0e30c0c..2db4898ae 100644
--- a/core/settings/qPrefTechnicalDetails.cpp
+++ b/core/settings/qPrefTechnicalDetails.cpp
@@ -30,7 +30,6 @@ void qPrefTechnicalDetails::loadSync(bool doSync)
disk_percentagegraph(doSync);
disk_redceiling(doSync);
disk_rulergraph(doSync);
- disk_show_average_depth(doSync);
disk_show_ccr_sensors(doSync);
disk_show_ccr_setpoint(doSync);
disk_show_icd(doSync);
@@ -112,8 +111,6 @@ HANDLE_PREFERENCE_BOOL(TechnicalDetails, "redceiling", redceiling);
HANDLE_PREFERENCE_BOOL(TechnicalDetails, "RulerBar", rulergraph);
-HANDLE_PREFERENCE_BOOL(TechnicalDetails, "show_average_depth", show_average_depth);
-
HANDLE_PREFERENCE_BOOL(TechnicalDetails, "show_ccr_sensors", show_ccr_sensors);
HANDLE_PREFERENCE_BOOL(TechnicalDetails, "show_ccr_setpoint", show_ccr_setpoint);
diff --git a/core/settings/qPrefTechnicalDetails.h b/core/settings/qPrefTechnicalDetails.h
index dfd477320..5b62aa7ea 100644
--- a/core/settings/qPrefTechnicalDetails.h
+++ b/core/settings/qPrefTechnicalDetails.h
@@ -25,7 +25,6 @@ class qPrefTechnicalDetails : public QObject {
Q_PROPERTY(bool percentagegraph READ percentagegraph WRITE set_percentagegraph NOTIFY percentagegraphChanged)
Q_PROPERTY(bool redceiling READ redceiling WRITE set_redceiling NOTIFY redceilingChanged)
Q_PROPERTY(bool rulergraph READ rulergraph WRITE set_rulergraph NOTIFY rulergraphChanged)
- Q_PROPERTY(bool show_average_depth READ show_average_depth WRITE set_show_average_depth NOTIFY show_average_depthChanged)
Q_PROPERTY(bool show_ccr_sensors READ show_ccr_sensors WRITE set_show_ccr_sensors NOTIFY show_ccr_sensorsChanged)
Q_PROPERTY(bool show_ccr_setpoint READ show_ccr_setpoint WRITE set_show_ccr_setpoint NOTIFY show_ccr_setpointChanged)
Q_PROPERTY(bool show_icd READ show_icd WRITE set_show_icd NOTIFY show_icdChanged)
@@ -62,7 +61,6 @@ public:
static bool percentagegraph() { return prefs.percentagegraph; }
static bool redceiling() { return prefs.redceiling; }
static bool rulergraph() { return prefs.rulergraph; }
- static bool show_average_depth() { return prefs.show_average_depth; }
static bool show_ccr_sensors() { return prefs.show_ccr_sensors; }
static bool show_ccr_setpoint() { return prefs.show_ccr_setpoint; }
static bool show_icd() { return prefs.show_icd; }
@@ -91,7 +89,6 @@ public slots:
static void set_percentagegraph(bool value);
static void set_redceiling(bool value);
static void set_rulergraph(bool value);
- static void set_show_average_depth(bool value);
static void set_show_ccr_sensors(bool value);
static void set_show_ccr_setpoint(bool value);
static void set_show_icd(bool value);
@@ -120,7 +117,6 @@ signals:
void percentagegraphChanged(bool value);
void redceilingChanged(bool value);
void rulergraphChanged(bool value);
- void show_average_depthChanged(bool value);
void show_ccr_sensorsChanged(bool value);
void show_ccr_setpointChanged(bool value);
void show_icdChanged(bool value);
@@ -151,7 +147,6 @@ private:
static void disk_percentagegraph(bool doSync);
static void disk_redceiling(bool doSync);
static void disk_rulergraph(bool doSync);
- static void disk_show_average_depth(bool doSync);
static void disk_show_ccr_sensors(bool doSync);
static void disk_show_ccr_setpoint(bool doSync);
static void disk_show_icd(bool doSync);
diff --git a/desktop-widgets/preferences/CMakeLists.txt b/desktop-widgets/preferences/CMakeLists.txt
index cec31e6f3..2298db6b9 100644
--- a/desktop-widgets/preferences/CMakeLists.txt
+++ b/desktop-widgets/preferences/CMakeLists.txt
@@ -15,6 +15,7 @@ set(SUBSURFACE_PREFERENCES_UI
preferences_media.ui
preferences_equipment.ui
preferences_dc.ui
+ preferences_log.ui
)
qt5_wrap_ui(SUBSURFACE_PREFERENCES_UI_HDRS ${SUBSURFACE_PREFERENCES_UI})
@@ -38,6 +39,8 @@ set(SUBSURFACE_PREFERENCES_LIB_SRCS
preferences_graph.h
preferences_language.cpp
preferences_language.h
+ preferences_log.cpp
+ preferences_log.h
preferences_media.cpp
preferences_media.h
preferences_network.cpp
diff --git a/desktop-widgets/preferences/preferences_dc.cpp b/desktop-widgets/preferences/preferences_dc.cpp
index b88881bd8..c39754497 100644
--- a/desktop-widgets/preferences/preferences_dc.cpp
+++ b/desktop-widgets/preferences/preferences_dc.cpp
@@ -10,7 +10,7 @@
#include <QProcess>
#include <QMessageBox>
-PreferencesDc::PreferencesDc(): AbstractPreferencesWidget(tr("Dive download"), QIcon(":preferences-dc-icon"), 0 ), ui(new Ui::PreferencesDc())
+PreferencesDc::PreferencesDc(): AbstractPreferencesWidget(tr("Dive download"), QIcon(":preferences-dc-icon"), 3 ), ui(new Ui::PreferencesDc())
{
ui->setupUi(this);
const QSize BUTTON_SIZE = QSize(200, 22);
diff --git a/desktop-widgets/preferences/preferences_defaults.cpp b/desktop-widgets/preferences/preferences_defaults.cpp
index 2a76fe662..dbf1091e4 100644
--- a/desktop-widgets/preferences/preferences_defaults.cpp
+++ b/desktop-widgets/preferences/preferences_defaults.cpp
@@ -11,7 +11,7 @@
#include <QProcess>
#include <QMessageBox>
-PreferencesDefaults::PreferencesDefaults(): AbstractPreferencesWidget(tr("General"), QIcon(":preferences-other-icon"), 0 ), ui(new Ui::PreferencesDefaults())
+PreferencesDefaults::PreferencesDefaults(): AbstractPreferencesWidget(tr("Display"), QIcon(":preferences-display-icon"), 0 ), ui(new Ui::PreferencesDefaults())
{
ui->setupUi(this);
}
@@ -21,80 +21,16 @@ PreferencesDefaults::~PreferencesDefaults()
delete ui;
}
-void PreferencesDefaults::on_chooseFile_clicked()
-{
- QFileInfo fi(system_default_filename());
- QString choosenFileName = QFileDialog::getOpenFileName(this, tr("Open default log file"), fi.absolutePath(), tr("Subsurface files") + " (*.ssrf *.xml)");
-
- if (!choosenFileName.isEmpty())
- ui->defaultfilename->setText(choosenFileName);
-}
-
-void PreferencesDefaults::on_btnUseDefaultFile_toggled(bool toggle)
-{
- if (toggle) {
- ui->defaultfilename->setText(system_default_filename());
- ui->defaultfilename->setEnabled(false);
- } else {
- ui->defaultfilename->setEnabled(true);
- }
-}
-
-void PreferencesDefaults::on_localDefaultFile_toggled(bool toggle)
-{
- ui->defaultfilename->setEnabled(toggle);
- ui->btnUseDefaultFile->setEnabled(toggle);
- ui->chooseFile->setEnabled(toggle);
-}
-
-void PreferencesDefaults::on_resetSettings_clicked()
-{
- // apparently this button was never hooked up?
-}
-
void PreferencesDefaults::refreshSettings()
{
ui->font->setCurrentFont(qPrefDisplay::divelist_font());
ui->fontsize->setValue(qPrefDisplay::font_size());
- ui->defaultfilename->setText(qPrefGeneral::default_filename());
- ui->noDefaultFile->setChecked(qPrefGeneral::default_file_behavior() == NO_DEFAULT_FILE);
- ui->cloudDefaultFile->setChecked(qPrefGeneral::default_file_behavior() == CLOUD_DEFAULT_FILE);
- ui->localDefaultFile->setChecked(qPrefGeneral::default_file_behavior() == LOCAL_DEFAULT_FILE);
-
- ui->displayinvalid->setChecked(qPrefDisplay::display_invalid_dives());
ui->velocitySlider->setValue(qPrefDisplay::animation_speed());
- ui->btnUseDefaultFile->setChecked(qPrefGeneral::use_default_file());
-
- if (qPrefCloudStorage::cloud_verification_status() == qPrefCloudStorage::CS_VERIFIED) {
- ui->cloudDefaultFile->setEnabled(true);
- } else {
- if (ui->cloudDefaultFile->isChecked())
- ui->noDefaultFile->setChecked(true);
- ui->cloudDefaultFile->setEnabled(false);
- }
-
- ui->defaultfilename->setEnabled(qPrefGeneral::default_file_behavior() == LOCAL_DEFAULT_FILE);
- ui->btnUseDefaultFile->setEnabled(qPrefGeneral::default_file_behavior() == LOCAL_DEFAULT_FILE);
- ui->chooseFile->setEnabled(qPrefGeneral::default_file_behavior() == LOCAL_DEFAULT_FILE);
-
- ui->extraEnvironmentalDefault->setChecked(prefs.extraEnvironmentalDefault);
}
void PreferencesDefaults::syncSettings()
{
- auto general = qPrefGeneral::instance();
- general->set_default_filename(ui->defaultfilename->text());
- general->set_use_default_file(ui->btnUseDefaultFile->isChecked());
- if (ui->noDefaultFile->isChecked())
- general->set_default_file_behavior(NO_DEFAULT_FILE);
- else if (ui->localDefaultFile->isChecked())
- general->set_default_file_behavior(LOCAL_DEFAULT_FILE);
- else if (ui->cloudDefaultFile->isChecked())
- general->set_default_file_behavior(CLOUD_DEFAULT_FILE);
-
qPrefDisplay::set_divelist_font(ui->font->currentFont().toString());
qPrefDisplay::set_font_size(ui->fontsize->value());
- qPrefDisplay::set_display_invalid_dives(ui->displayinvalid->isChecked());
qPrefDisplay::set_animation_speed(ui->velocitySlider->value());
- qPrefGeneral::set_extraEnvironmentalDefault(ui->extraEnvironmentalDefault->isChecked());
}
diff --git a/desktop-widgets/preferences/preferences_defaults.h b/desktop-widgets/preferences/preferences_defaults.h
index ce0a8e2e1..cc92ade40 100644
--- a/desktop-widgets/preferences/preferences_defaults.h
+++ b/desktop-widgets/preferences/preferences_defaults.h
@@ -17,10 +17,6 @@ public:
void refreshSettings() override;
void syncSettings() override;
public slots:
- void on_chooseFile_clicked();
- void on_btnUseDefaultFile_toggled(bool toggled);
- void on_localDefaultFile_toggled(bool toggled);
- void on_resetSettings_clicked();
private:
Ui::PreferencesDefaults *ui;
diff --git a/desktop-widgets/preferences/preferences_defaults.ui b/desktop-widgets/preferences/preferences_defaults.ui
index f33cd099f..3d9e45c98 100644
--- a/desktop-widgets/preferences/preferences_defaults.ui
+++ b/desktop-widgets/preferences/preferences_defaults.ui
@@ -46,101 +46,7 @@
</layout>
</widget>
</item>
- <item>
- <widget class="QGroupBox" name="groupBox_3">
- <property name="title">
- <string>Default file</string>
- </property>
- <layout class="QFormLayout" name="formLayout_2">
- <property name="horizontalSpacing">
- <number>5</number>
- </property>
- <property name="verticalSpacing">
- <number>5</number>
- </property>
- <property name="margin">
- <number>5</number>
- </property>
- <item row="0" column="0">
- <widget class="QLabel" name="defaultDiveLogFileLabel">
- <property name="text">
- <string>Default dive log file</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <layout class="QHBoxLayout" name="defaultFileBehaviorLayout">
- <item>
- <widget class="QRadioButton" name="noDefaultFile">
- <property name="text">
- <string>&amp;No default file</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="localDefaultFile">
- <property name="text">
- <string>&amp;Local default file</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="cloudDefaultFile">
- <property name="text">
- <string>Clo&amp;ud storage default file</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_9">
- <property name="text">
- <string>Local dive log file</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <widget class="QLineEdit" name="defaultfilename"/>
- </item>
- <item>
- <widget class="QToolButton" name="btnUseDefaultFile">
- <property name="text">
- <string>Use default</string>
- </property>
- <property name="checkable">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="chooseFile">
- <property name="text">
- <string>...</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_10">
- <property name="text">
- <string>Display invalid</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QCheckBox" name="displayinvalid">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
+
<item>
<widget class="QGroupBox" name="groupBox_7">
<property name="title">
@@ -177,6 +83,7 @@
</layout>
</widget>
</item>
+
<item>
<widget class="QPushButton" name="resetSettings">
<property name="text">
@@ -184,22 +91,7 @@
</property>
</widget>
</item>
- <item>
- <widget class="QGroupBox" name="groupBox_extra_star_widgets">
- <property name="title">
- <string>Environmental parameters in Information tab</string>
- </property>
- <layout class="QHBoxLayout" name="extraWidgetLayout">
- <item>
- <widget class="QCheckBox" name="extraEnvironmentalDefault">
- <property name="text">
- <string>Show extended range of environmental paramaters</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
+
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
diff --git a/desktop-widgets/preferences/preferences_equipment.cpp b/desktop-widgets/preferences/preferences_equipment.cpp
index a446a279b..bd5ac4158 100644
--- a/desktop-widgets/preferences/preferences_equipment.cpp
+++ b/desktop-widgets/preferences/preferences_equipment.cpp
@@ -11,7 +11,7 @@
#include "qt-models/models.h"
-PreferencesEquipment::PreferencesEquipment() : AbstractPreferencesWidget(tr("Equipment"), QIcon(":preferences-equipment-icon"), 4)
+PreferencesEquipment::PreferencesEquipment() : AbstractPreferencesWidget(tr("Equipment"), QIcon(":preferences-equipment-icon"), 5)
{
ui = new Ui::PreferencesEquipment();
ui->setupUi(this);
diff --git a/desktop-widgets/preferences/preferences_georeference.cpp b/desktop-widgets/preferences/preferences_georeference.cpp
index 40196e44f..25433964f 100644
--- a/desktop-widgets/preferences/preferences_georeference.cpp
+++ b/desktop-widgets/preferences/preferences_georeference.cpp
@@ -7,7 +7,7 @@
#include <ctime>
-PreferencesGeoreference::PreferencesGeoreference() : AbstractPreferencesWidget(tr("Georeference"), QIcon(":geotag-icon"), 9)
+PreferencesGeoreference::PreferencesGeoreference() : AbstractPreferencesWidget(tr("Georeference"), QIcon(":geotag-icon"), 8)
{
ui = new Ui::PreferencesGeoreference();
ui->setupUi(this);
diff --git a/desktop-widgets/preferences/preferences_graph.cpp b/desktop-widgets/preferences/preferences_graph.cpp
index cdead91e0..b7fd5b4b9 100644
--- a/desktop-widgets/preferences/preferences_graph.cpp
+++ b/desktop-widgets/preferences/preferences_graph.cpp
@@ -9,7 +9,7 @@
#include "qt-models/models.h"
#include "core/deco.h"
-PreferencesGraph::PreferencesGraph() : AbstractPreferencesWidget(tr("Profile"), QIcon(":graph-icon"), 5)
+PreferencesGraph::PreferencesGraph() : AbstractPreferencesWidget(tr("Tech setup"), QIcon(":graph-icon"), 7)
{
ui = new Ui::PreferencesGraph();
ui->setupUi(this);
@@ -49,7 +49,6 @@ void PreferencesGraph::refreshSettings()
ui->psro2rate->setValue(prefs.o2consumption / 1000.0);
ui->pscrfactor->setValue(lrint(1000.0 / prefs.pscr_ratio));
- ui->show_average_depth->setChecked(prefs.show_average_depth);
ui->show_icd->setChecked(prefs.show_icd);
}
@@ -75,7 +74,6 @@ void PreferencesGraph::syncSettings()
qPrefTechnicalDetails::set_show_ccr_setpoint(ui->show_ccr_setpoint->isChecked());
qPrefTechnicalDetails::set_show_ccr_sensors(ui->show_ccr_sensors->isChecked());
qPrefTechnicalDetails::set_show_scr_ocpo2(ui->show_scr_ocpo2->isChecked());
- qPrefTechnicalDetails::set_show_average_depth(ui->show_average_depth->isChecked());
qPrefTechnicalDetails::set_show_icd(ui->show_icd->isChecked());
qPrefTechnicalDetails::set_display_deco_mode(ui->vpmb->isChecked() ? VPMB : BUEHLMANN);
}
diff --git a/desktop-widgets/preferences/preferences_graph.ui b/desktop-widgets/preferences/preferences_graph.ui
index 9fd3a11c7..d2633ff6b 100644
--- a/desktop-widgets/preferences/preferences_graph.ui
+++ b/desktop-widgets/preferences/preferences_graph.ui
@@ -349,22 +349,6 @@
</widget>
</item>
<item>
- <widget class="QGroupBox" name="groupBox_6">
- <property name="title">
- <string>Misc</string>
- </property>
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="0" column="0" colspan="2">
- <widget class="QCheckBox" name="show_average_depth">
- <property name="text">
- <string>Show mean depth in Profile</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -398,8 +382,6 @@
<tabstop>buehlmann</tabstop>
<tabstop>gflow</tabstop>
<tabstop>gfhigh</tabstop>
- <tabstop>display_unused_tanks</tabstop>
- <tabstop>show_average_depth</tabstop>
</tabstops>
<resources/>
<connections/>
diff --git a/desktop-widgets/preferences/preferences_language.cpp b/desktop-widgets/preferences/preferences_language.cpp
index 76763be14..9de6efb8f 100644
--- a/desktop-widgets/preferences/preferences_language.cpp
+++ b/desktop-widgets/preferences/preferences_language.cpp
@@ -10,7 +10,7 @@
#include "qt-models/models.h"
-PreferencesLanguage::PreferencesLanguage() : AbstractPreferencesWidget(tr("Language"), QIcon(":preferences-desktop-locale-icon"), 4)
+PreferencesLanguage::PreferencesLanguage() : AbstractPreferencesWidget(tr("Language"), QIcon(":preferences-desktop-locale-icon"), 1)
{
ui = new Ui::PreferencesLanguage();
ui->setupUi(this);
diff --git a/desktop-widgets/preferences/preferences_log.cpp b/desktop-widgets/preferences/preferences_log.cpp
new file mode 100644
index 000000000..9025945e3
--- /dev/null
+++ b/desktop-widgets/preferences/preferences_log.cpp
@@ -0,0 +1,90 @@
+// SPDX-License-Identifier: GPL-2.0
+#include "preferences_log.h"
+#include "ui_preferences_log.h"
+#include "core/dive.h"
+#include "core/settings/qPrefLog.h"
+#include "core/settings/qPrefDisplay.h"
+#include "core/settings/qPrefCloudStorage.h"
+#include "core/settings/qPrefDiveComputer.h"
+
+#include <QFileDialog>
+#include <QProcess>
+#include <QMessageBox>
+
+PreferencesLog::PreferencesLog(): AbstractPreferencesWidget(tr(" Dive log"), QIcon(":preferences-log-icon"), 4 ), ui(new Ui::PreferencesLog())
+{
+ ui->setupUi(this);
+}
+
+PreferencesLog::~PreferencesLog()
+{
+ delete ui;
+}
+
+void PreferencesLog::on_chooseFile_clicked()
+{
+ QFileInfo fi(system_default_filename());
+ QString choosenFileName = QFileDialog::getOpenFileName(this, tr("Open default log file"), fi.absolutePath(), tr("Subsurface files") + " (*.ssrf *.xml)");
+
+ if (!choosenFileName.isEmpty())
+ ui->defaultfilename->setText(choosenFileName);
+}
+
+void PreferencesLog::on_btnUseDefaultFile_toggled(bool toggle)
+{
+ if (toggle) {
+ ui->defaultfilename->setText(system_default_filename());
+ ui->defaultfilename->setEnabled(false);
+ } else {
+ ui->defaultfilename->setEnabled(true);
+ }
+}
+
+void PreferencesLog::on_localDefaultFile_toggled(bool toggle)
+{
+ ui->defaultfilename->setEnabled(toggle);
+ ui->btnUseDefaultFile->setEnabled(toggle);
+ ui->chooseFile->setEnabled(toggle);
+}
+
+void PreferencesLog::refreshSettings()
+{
+ ui->defaultfilename->setText(qPrefLog::default_filename());
+ ui->noDefaultFile->setChecked(qPrefLog::default_file_behavior() == NO_DEFAULT_FILE);
+ ui->cloudDefaultFile->setChecked(qPrefLog::default_file_behavior() == CLOUD_DEFAULT_FILE);
+ ui->localDefaultFile->setChecked(qPrefLog::default_file_behavior() == LOCAL_DEFAULT_FILE);
+
+ ui->btnUseDefaultFile->setChecked(qPrefLog::use_default_file());
+
+ if (qPrefCloudStorage::cloud_verification_status() == qPrefCloudStorage::CS_VERIFIED) {
+ ui->cloudDefaultFile->setEnabled(true);
+ } else {
+ if (ui->cloudDefaultFile->isChecked())
+ ui->noDefaultFile->setChecked(true);
+ ui->cloudDefaultFile->setEnabled(false);
+ }
+
+ ui->defaultfilename->setEnabled(qPrefLog::default_file_behavior() == LOCAL_DEFAULT_FILE);
+ ui->btnUseDefaultFile->setEnabled(qPrefLog::default_file_behavior() == LOCAL_DEFAULT_FILE);
+ ui->chooseFile->setEnabled(qPrefLog::default_file_behavior() == LOCAL_DEFAULT_FILE);
+ ui->show_average_depth->setChecked(prefs.show_average_depth);
+ ui->displayinvalid->setChecked(qPrefDisplay::display_invalid_dives());
+ ui->extraEnvironmentalDefault->setChecked(prefs.extraEnvironmentalDefault);
+}
+
+void PreferencesLog::syncSettings()
+{
+ auto log = qPrefLog::instance();
+ log->set_default_filename(ui->defaultfilename->text());
+ log->set_use_default_file(ui->btnUseDefaultFile->isChecked());
+ if (ui->noDefaultFile->isChecked())
+ log->set_default_file_behavior(NO_DEFAULT_FILE);
+ else if (ui->localDefaultFile->isChecked())
+ log->set_default_file_behavior(LOCAL_DEFAULT_FILE);
+ else if (ui->cloudDefaultFile->isChecked())
+ log->set_default_file_behavior(CLOUD_DEFAULT_FILE);
+
+ qPrefLog::set_show_average_depth(ui->show_average_depth->isChecked());
+ qPrefDisplay::set_display_invalid_dives(ui->displayinvalid->isChecked());
+ qPrefLog::set_extraEnvironmentalDefault(ui->extraEnvironmentalDefault->isChecked());
+}
diff --git a/desktop-widgets/preferences/preferences_log.h b/desktop-widgets/preferences/preferences_log.h
new file mode 100644
index 000000000..7382aae2b
--- /dev/null
+++ b/desktop-widgets/preferences/preferences_log.h
@@ -0,0 +1,29 @@
+// SPDX-License-Identifier: GPL-2.0
+#ifndef PREFERENCES_LOG_H
+#define PREFERENCES_LOG_H
+
+#include "abstractpreferenceswidget.h"
+#include "core/pref.h"
+
+namespace Ui {
+ class PreferencesLog;
+}
+
+class PreferencesLog : public AbstractPreferencesWidget {
+ Q_OBJECT
+public:
+ PreferencesLog();
+ ~PreferencesLog();
+ void refreshSettings() override;
+ void syncSettings() override;
+public slots:
+ void on_chooseFile_clicked();
+ void on_btnUseDefaultFile_toggled(bool toggled);
+ void on_localDefaultFile_toggled(bool toggled);
+
+private:
+ Ui::PreferencesLog *ui;
+};
+
+
+#endif
diff --git a/desktop-widgets/preferences/preferences_log.ui b/desktop-widgets/preferences/preferences_log.ui
new file mode 100644
index 000000000..8dd76ad4c
--- /dev/null
+++ b/desktop-widgets/preferences/preferences_log.ui
@@ -0,0 +1,199 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>PreferencesLog</class>
+ <widget class="QWidget" name="PreferencesLog">
+ <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_9">
+ <property name="text">
+ <string>DIVE LOG</string>
+ </property>
+ </widget>
+ </item>
+
+ <item>
+ <widget class="QGroupBox" name="groupBox_3">
+ <property name="title">
+ <string></string>
+ </property>
+ <layout class="QFormLayout" name="formLayout_2">
+ <property name="horizontalSpacing">
+ <number>5</number>
+ </property>
+ <property name="verticalSpacing">
+ <number>5</number>
+ </property>
+ <property name="margin">
+ <number>5</number>
+ </property>
+ <item row="0" column="0">
+ <widget class="QLabel" name="defaultDiveLogFileLabel">
+ <property name="text">
+ <string>Default dive log file</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <layout class="QHBoxLayout" name="defaultFileBehaviorLayout">
+ <item>
+ <widget class="QRadioButton" name="noDefaultFile">
+ <property name="text">
+ <string>&amp;No default file</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="localDefaultFile">
+ <property name="text">
+ <string>&amp;Local default file</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="cloudDefaultFile">
+ <property name="text">
+ <string>Clo&amp;ud storage default file</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_9">
+ <property name="text">
+ <string>Local dive log file</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QLineEdit" name="defaultfilename"/>
+ </item>
+ <item>
+ <widget class="QToolButton" name="btnUseDefaultFile">
+ <property name="text">
+ <string>Use default</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="chooseFile">
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+
+ <item>
+ <widget class="QCheckBox" name="displayinvalid">
+ <property name="text">
+ <string>In the Dive List, show dives that you have marked as invalid, e.g. pool dives</string>
+ </property>
+ </widget>
+ </item>
+
+ <item>
+ <widget class="QCheckBox" name="extraEnvironmentalDefault">
+ <property name="text">
+ <string>In the Information tab, show tools for recording wave height, surge and chill during a dive</string>
+ </property>
+ </widget>
+ </item>
+
+ <item>
+ <widget class="QCheckBox" name="show_average_depth">
+ <property name="text">
+ <string>In the Dive Profile, show mean depth</string>
+ </property>
+ </widget>
+ </item>
+
+ <item>
+ <spacer name="verticalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>0</width>
+ <height>195</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+
+ <resources/>
+ <connections>
+ <connection>
+ <sender>btnUseDefaultFile</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>chooseFile</receiver>
+ <slot>setHidden(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>462</x>
+ <y>136</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>528</x>
+ <y>145</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>velocitySlider</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>velocitySpinBox</receiver>
+ <slot>setValue(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>437</x>
+ <y>299</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>531</x>
+ <y>301</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>velocitySpinBox</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>velocitySlider</receiver>
+ <slot>setValue(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>547</x>
+ <y>274</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>482</x>
+ <y>276</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/desktop-widgets/preferences/preferences_media.cpp b/desktop-widgets/preferences/preferences_media.cpp
index 47a6285dd..14cdfe49c 100644
--- a/desktop-widgets/preferences/preferences_media.cpp
+++ b/desktop-widgets/preferences/preferences_media.cpp
@@ -12,7 +12,7 @@
#include "qt-models/models.h"
-PreferencesMedia::PreferencesMedia() : AbstractPreferencesWidget(tr("Media"), QIcon(":preferences-media-icon"), 8)
+PreferencesMedia::PreferencesMedia() : AbstractPreferencesWidget(tr("Media"), QIcon(":preferences-media-icon"), 6)
{
ui = new Ui::PreferencesMedia();
ui->setupUi(this);
diff --git a/desktop-widgets/preferences/preferences_network.cpp b/desktop-widgets/preferences/preferences_network.cpp
index 8a48b5a25..2b2f13ed1 100644
--- a/desktop-widgets/preferences/preferences_network.cpp
+++ b/desktop-widgets/preferences/preferences_network.cpp
@@ -6,7 +6,7 @@
#include "core/settings/qPrefProxy.h"
#include <QNetworkProxy>
-PreferencesNetwork::PreferencesNetwork() : AbstractPreferencesWidget(tr("Network"),QIcon(":preferences-system-network-icon"), 9), ui(new Ui::PreferencesNetwork())
+PreferencesNetwork::PreferencesNetwork() : AbstractPreferencesWidget(tr("Network"),QIcon(":preferences-system-network-icon"), 10), ui(new Ui::PreferencesNetwork())
{
ui->setupUi(this);
diff --git a/desktop-widgets/preferences/preferences_units.cpp b/desktop-widgets/preferences/preferences_units.cpp
index eaef36b39..db23efd37 100644
--- a/desktop-widgets/preferences/preferences_units.cpp
+++ b/desktop-widgets/preferences/preferences_units.cpp
@@ -4,7 +4,7 @@
#include "core/qthelper.h"
#include "core/settings/qPrefUnit.h"
-PreferencesUnits::PreferencesUnits(): AbstractPreferencesWidget(tr("Units"),QIcon(":units-icon"),1), ui(new Ui::PreferencesUnits())
+PreferencesUnits::PreferencesUnits(): AbstractPreferencesWidget(tr("Units"), QIcon(":units-icon"), 2), ui(new Ui::PreferencesUnits())
{
ui->setupUi(this);
}
diff --git a/desktop-widgets/preferences/preferencesdialog.cpp b/desktop-widgets/preferences/preferencesdialog.cpp
index f58829cc6..7602a3817 100644
--- a/desktop-widgets/preferences/preferencesdialog.cpp
+++ b/desktop-widgets/preferences/preferencesdialog.cpp
@@ -12,6 +12,7 @@
#include "preferences_equipment.h"
#include "preferences_media.h"
#include "preferences_dc.h"
+#include "preferences_log.h"
#include "core/qthelper.h"
@@ -73,6 +74,7 @@ PreferencesDialog::PreferencesDialog()
addPreferencePage(new PreferencesEquipment());
addPreferencePage(new PreferencesMedia());
addPreferencePage(new PreferencesDc());
+ addPreferencePage(new PreferencesLog());
refreshPages();
diff --git a/icons/pref_cloud.png b/icons/pref_cloud.png
index c038fdc9c..f98dfb09a 100644
--- a/icons/pref_cloud.png
+++ b/icons/pref_cloud.png
Binary files differ
diff --git a/icons/pref_dc.png b/icons/pref_dc.png
index a146ff050..059ced47f 100644
--- a/icons/pref_dc.png
+++ b/icons/pref_dc.png
Binary files differ
diff --git a/icons/pref_display.png b/icons/pref_display.png
new file mode 100644
index 000000000..51758210a
--- /dev/null
+++ b/icons/pref_display.png
Binary files differ
diff --git a/icons/pref_log.png b/icons/pref_log.png
new file mode 100644
index 000000000..165945fd7
--- /dev/null
+++ b/icons/pref_log.png
Binary files differ
diff --git a/icons/pref_media.png b/icons/pref_media.png
index 84fd986a9..c09fc0cc9 100644
--- a/icons/pref_media.png
+++ b/icons/pref_media.png
Binary files differ
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp
index f58fa7d83..289009eda 100644
--- a/mobile-widgets/qmlmanager.cpp
+++ b/mobile-widgets/qmlmanager.cpp
@@ -39,7 +39,7 @@
#include "core/selection.h"
#include "core/ssrf.h"
#include "core/save-profiledata.h"
-#include "core/settings/qPrefGeneral.h"
+#include "core/settings/qPrefLog.h"
#include "core/settings/qPrefLocationService.h"
#include "core/settings/qPrefTechnicalDetails.h"
#include "core/settings/qPrefPartialPressureGas.h"
@@ -1308,7 +1308,7 @@ void QMLManager::openNoCloudRepo()
if (git == dummy_git_repository) {
git_create_local_repo(filename);
set_filename(filename);
- auto s = qPrefGeneral::instance();
+ auto s = qPrefLog::instance();
s->set_default_filename(filename);
s->set_default_file_behavior(LOCAL_DEFAULT_FILE);
}
@@ -1324,7 +1324,7 @@ void QMLManager::saveChangesLocal()
char *filename = NOCLOUD_LOCALSTORAGE;
git_create_local_repo(filename);
set_filename(filename);
- auto s = qPrefGeneral::instance();
+ auto s = qPrefLog::instance();
s->set_default_filename(filename);
s->set_default_file_behavior(LOCAL_DEFAULT_FILE);
}
diff --git a/profile-widget/diveprofileitem.cpp b/profile-widget/diveprofileitem.cpp
index 2d50ad222..efb2fceb7 100644
--- a/profile-widget/diveprofileitem.cpp
+++ b/profile-widget/diveprofileitem.cpp
@@ -11,6 +11,7 @@
#include "qt-models/diveplannermodel.h"
#include "core/qthelper.h"
#include "core/settings/qPrefTechnicalDetails.h"
+#include "core/settings/qPrefLog.h"
#include "libdivecomputer/parser.h"
#include "profile-widget/profilewidget2.h"
@@ -635,7 +636,7 @@ void DiveMeanDepthItem::paint(QPainter *painter, const QStyleOptionGraphicsItem*
painter->setPen(pen());
painter->drawPolyline(polygon());
painter->restore();
- connect(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::show_average_depthChanged, this, &DiveAmbPressureItem::setVisible);
+ connect(qPrefLog::instance(), &qPrefLog::show_average_depthChanged, this, &DiveAmbPressureItem::setVisible);
}
void DiveMeanDepthItem::createTextItem()
diff --git a/subsurface.qrc b/subsurface.qrc
index 286e0bc6b..15d627e5c 100644
--- a/subsurface.qrc
+++ b/subsurface.qrc
@@ -16,6 +16,8 @@
<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="preferences-log-icon">icons/pref_log.png</file>
+ <file alias="preferences-display-icon">icons/pref_display.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>
diff --git a/tests/testqPrefGeneral.cpp b/tests/testqPrefGeneral.cpp
index 9718650ed..4910647f1 100644
--- a/tests/testqPrefGeneral.cpp
+++ b/tests/testqPrefGeneral.cpp
@@ -23,19 +23,13 @@ void TestQPrefGeneral::test_struct_get()
auto tst = qPrefGeneral::instance();
- prefs.default_filename = copy_qstring("new base12");
- prefs.default_file_behavior = UNDEFINED_DEFAULT_FILE;
prefs.defaultsetpoint = 14;
prefs.o2consumption = 17;
prefs.pscr_ratio = 18;
- prefs.use_default_file = true;
- QCOMPARE(tst->default_filename(), QString(prefs.default_filename));
- QCOMPARE(tst->default_file_behavior(), prefs.default_file_behavior);
QCOMPARE(tst->defaultsetpoint(), prefs.defaultsetpoint);
QCOMPARE(tst->o2consumption(), prefs.o2consumption);
QCOMPARE(tst->pscr_ratio(), prefs.pscr_ratio);
- QCOMPARE(tst->use_default_file(), prefs.use_default_file);
}
void TestQPrefGeneral::test_set_struct()
@@ -44,21 +38,15 @@ void TestQPrefGeneral::test_set_struct()
auto tst = qPrefGeneral::instance();
- tst->set_default_filename("new base22");
- tst->set_default_file_behavior(LOCAL_DEFAULT_FILE);
tst->set_defaultsetpoint(24);
tst->set_o2consumption(27);
tst->set_pscr_ratio(28);
- tst->set_use_default_file(false);
tst->set_diveshareExport_uid("uid1");
tst->set_diveshareExport_private(false);
- QCOMPARE(QString(prefs.default_filename), QString("new base22"));
- QCOMPARE(prefs.default_file_behavior, LOCAL_DEFAULT_FILE);
QCOMPARE(prefs.defaultsetpoint, 24);
QCOMPARE(prefs.o2consumption, 27);
QCOMPARE(prefs.pscr_ratio, 28);
- QCOMPARE(prefs.use_default_file, false);
QCOMPARE(tst->diveshareExport_uid(), QString("uid1"));
QCOMPARE(tst->diveshareExport_private(), false);
}
@@ -69,29 +57,20 @@ void TestQPrefGeneral::test_set_load_struct()
auto tst = qPrefGeneral::instance();
- tst->set_default_filename("new base32");
- tst->set_default_file_behavior(NO_DEFAULT_FILE);
tst->set_defaultsetpoint(34);
tst->set_o2consumption(37);
tst->set_pscr_ratio(38);
- tst->set_use_default_file(true);
tst->set_diveshareExport_uid("uid2");
tst->set_diveshareExport_private(true);
- prefs.default_filename = copy_qstring("error");
- prefs.default_file_behavior = UNDEFINED_DEFAULT_FILE;
prefs.defaultsetpoint = 14;
prefs.o2consumption = 17;
prefs.pscr_ratio = 18;
- prefs.use_default_file = false;
tst->load();
- QCOMPARE(QString(prefs.default_filename), QString("new base32"));
- QCOMPARE(prefs.default_file_behavior, NO_DEFAULT_FILE);
QCOMPARE(prefs.defaultsetpoint, 34);
QCOMPARE(prefs.o2consumption, 37);
QCOMPARE(prefs.pscr_ratio, 38);
- QCOMPARE(prefs.use_default_file, true);
QCOMPARE(tst->diveshareExport_uid(), QString("uid2"));
QCOMPARE(tst->diveshareExport_private(), true);
}
@@ -102,28 +81,19 @@ void TestQPrefGeneral::test_struct_disk()
auto tst = qPrefGeneral::instance();
- prefs.default_filename = copy_qstring("base42");
- prefs.default_file_behavior = CLOUD_DEFAULT_FILE;
prefs.defaultsetpoint = 44;
prefs.o2consumption = 47;
prefs.pscr_ratio = 48;
- prefs.use_default_file = true;
tst->sync();
- prefs.default_filename = copy_qstring("error");
- prefs.default_file_behavior = UNDEFINED_DEFAULT_FILE;
prefs.defaultsetpoint = 14;
prefs.o2consumption = 17;
prefs.pscr_ratio = 18;
- prefs.use_default_file = false;
tst->load();
- QCOMPARE(QString(prefs.default_filename), QString("base42"));
- QCOMPARE(prefs.default_file_behavior, CLOUD_DEFAULT_FILE);
QCOMPARE(prefs.defaultsetpoint, 44);
QCOMPARE(prefs.o2consumption, 47);
QCOMPARE(prefs.pscr_ratio, 48);
- QCOMPARE(prefs.use_default_file, true);
}
void TestQPrefGeneral::test_multiple()
@@ -150,63 +120,40 @@ void TestQPrefGeneral::test_oldPreferences()
{
auto general = qPrefGeneral::instance();
- general->set_default_filename("filename");
- general->set_default_file_behavior(LOCAL_DEFAULT_FILE);
general->set_defaultsetpoint(0);
general->set_o2consumption(0);
general->set_pscr_ratio(0);
- general->set_use_default_file(true);
- TEST(general->default_filename(), QStringLiteral("filename"));
- TEST(general->default_file_behavior(), LOCAL_DEFAULT_FILE); // since we have a default file, here it returns
TEST(general->defaultsetpoint(), 0);
TEST(general->o2consumption(), 0);
TEST(general->pscr_ratio(), 0);
- TEST(general->use_default_file(), true);
-
- general->set_default_filename("no_file_name");
- //TODOl: Change this to a enum.
- general->set_default_file_behavior(CLOUD_DEFAULT_FILE);
general->set_defaultsetpoint(1);
general->set_o2consumption(1);
general->set_pscr_ratio(1);
- general->set_use_default_file(false);
- TEST(general->default_filename(), QStringLiteral("no_file_name"));
- TEST(general->default_file_behavior(), CLOUD_DEFAULT_FILE);
TEST(general->defaultsetpoint(), 1);
TEST(general->o2consumption(), 1);
TEST(general->pscr_ratio(), 1);
- TEST(general->use_default_file(), false);
}
void TestQPrefGeneral::test_signals()
{
- QSignalSpy spy3(qPrefGeneral::instance(), &qPrefGeneral::default_filenameChanged);
- QSignalSpy spy4(qPrefGeneral::instance(), &qPrefGeneral::default_file_behaviorChanged);
QSignalSpy spy5(qPrefGeneral::instance(), &qPrefGeneral::defaultsetpointChanged);
QSignalSpy spy9(qPrefGeneral::instance(), &qPrefGeneral::o2consumptionChanged);
QSignalSpy spy10(qPrefGeneral::instance(), &qPrefGeneral::pscr_ratioChanged);
- QSignalSpy spy11(qPrefGeneral::instance(), &qPrefGeneral::use_default_fileChanged);
QSignalSpy spy12(qPrefGeneral::instance(), &qPrefGeneral::diveshareExport_uidChanged);
QSignalSpy spy13(qPrefGeneral::instance(), &qPrefGeneral::diveshareExport_privateChanged);
- qPrefGeneral::set_default_filename("new base22");
- qPrefGeneral::set_default_file_behavior(LOCAL_DEFAULT_FILE);
qPrefGeneral::set_defaultsetpoint(24);
qPrefGeneral::set_o2consumption(27);
qPrefGeneral::set_pscr_ratio(28);
- qPrefGeneral::set_use_default_file(false);
qPrefGeneral::set_diveshareExport_uid("uid1");
qPrefGeneral::set_diveshareExport_private(false);
- qPrefGeneral::set_default_filename("new base22");
- qPrefGeneral::set_default_file_behavior(LOCAL_DEFAULT_FILE);
qPrefGeneral::set_defaultsetpoint(24);
qPrefGeneral::set_o2consumption(27);
qPrefGeneral::set_pscr_ratio(28);
- qPrefGeneral::set_use_default_file(false);
qPrefGeneral::set_diveshareExport_uid("uid1");
qPrefGeneral::set_diveshareExport_private(false);
}
diff --git a/tests/testqPrefTechnicalDetails.cpp b/tests/testqPrefTechnicalDetails.cpp
index b6272dbff..49a6829d6 100644
--- a/tests/testqPrefTechnicalDetails.cpp
+++ b/tests/testqPrefTechnicalDetails.cpp
@@ -39,7 +39,6 @@ void TestQPrefTechnicalDetails::test_struct_get()
prefs.percentagegraph = true;
prefs.redceiling = true;
prefs.rulergraph = true;
- prefs.show_average_depth = true;
prefs.show_ccr_sensors = true;
prefs.show_ccr_setpoint = true;
prefs.show_icd = true;
@@ -65,7 +64,6 @@ void TestQPrefTechnicalDetails::test_struct_get()
QCOMPARE(tst->percentagegraph(), prefs.percentagegraph);
QCOMPARE(tst->redceiling(), prefs.redceiling);
QCOMPARE(tst->rulergraph(), prefs.rulergraph);
- QCOMPARE(tst->show_average_depth(), prefs.show_average_depth);
QCOMPARE(tst->show_ccr_sensors(), prefs.show_ccr_sensors);
QCOMPARE(tst->show_ccr_setpoint(), prefs.show_ccr_setpoint);
QCOMPARE(tst->show_icd(), prefs.show_icd);
@@ -99,7 +97,6 @@ void TestQPrefTechnicalDetails::test_set_struct()
tst->set_percentagegraph(false);
tst->set_redceiling(false);
tst->set_rulergraph(false);
- tst->set_show_average_depth(false);
tst->set_show_ccr_sensors(false);
tst->set_show_ccr_setpoint(false);
tst->set_show_icd(false);
@@ -125,7 +122,6 @@ void TestQPrefTechnicalDetails::test_set_struct()
QCOMPARE(prefs.percentagegraph, false);
QCOMPARE(prefs.redceiling, false);
QCOMPARE(prefs.rulergraph, false);
- QCOMPARE(prefs.show_average_depth, false);
QCOMPARE(prefs.show_ccr_sensors, false);
QCOMPARE(prefs.show_ccr_setpoint, false);
QCOMPARE(prefs.show_icd, false);
@@ -159,7 +155,6 @@ void TestQPrefTechnicalDetails::test_set_load_struct()
tst->set_percentagegraph(false);
tst->set_redceiling(false);
tst->set_rulergraph(false);
- tst->set_show_average_depth(true);
tst->set_show_ccr_sensors(true);
tst->set_show_ccr_setpoint(true);
tst->set_show_icd(true);
@@ -186,7 +181,6 @@ void TestQPrefTechnicalDetails::test_set_load_struct()
prefs.percentagegraph = true;
prefs.redceiling = true;
prefs.rulergraph = true;
- prefs.show_average_depth = false;
prefs.show_ccr_sensors = false;
prefs.show_ccr_setpoint = false;
prefs.show_icd = false;
@@ -213,7 +207,6 @@ void TestQPrefTechnicalDetails::test_set_load_struct()
QCOMPARE(prefs.percentagegraph, false);
QCOMPARE(prefs.redceiling, false);
QCOMPARE(prefs.rulergraph, false);
- QCOMPARE(prefs.show_average_depth, true);
QCOMPARE(prefs.show_ccr_sensors, true);
QCOMPARE(prefs.show_ccr_setpoint, true);
QCOMPARE(prefs.show_icd, true);
@@ -247,7 +240,6 @@ void TestQPrefTechnicalDetails::test_struct_disk()
prefs.percentagegraph = true;
prefs.redceiling = true;
prefs.rulergraph = true;
- prefs.show_average_depth = true;
prefs.show_ccr_sensors = true;
prefs.show_ccr_setpoint = true;
prefs.show_icd = true;
@@ -275,7 +267,6 @@ void TestQPrefTechnicalDetails::test_struct_disk()
prefs.percentagegraph = false;
prefs.redceiling = false;
prefs.rulergraph = false;
- prefs.show_average_depth = false;
prefs.show_ccr_sensors = false;
prefs.show_ccr_setpoint = false;
prefs.show_icd = false;
@@ -302,7 +293,6 @@ void TestQPrefTechnicalDetails::test_struct_disk()
QCOMPARE(prefs.percentagegraph, true);
QCOMPARE(prefs.redceiling, true);
QCOMPARE(prefs.rulergraph, true);
- QCOMPARE(prefs.show_average_depth, true);
QCOMPARE(prefs.show_ccr_sensors, true);
QCOMPARE(prefs.show_ccr_setpoint, true);
QCOMPARE(prefs.show_icd, true);
@@ -389,8 +379,6 @@ void TestQPrefTechnicalDetails::test_oldPreferences()
TEST(tecDetails->zoomed_plot(), true);
tecDetails->set_show_sac(true);
TEST(tecDetails->show_sac(), true);
- tecDetails->set_show_average_depth(true);
- TEST(tecDetails->show_average_depth(), true);
tecDetails->set_show_pictures_in_profile(true);
TEST(tecDetails->show_pictures_in_profile(), true);
@@ -426,8 +414,6 @@ void TestQPrefTechnicalDetails::test_oldPreferences()
TEST(tecDetails->zoomed_plot(), false);
tecDetails->set_show_sac(false);
TEST(tecDetails->show_sac(), false);
- tecDetails->set_show_average_depth(false);
- TEST(tecDetails->show_average_depth(), false);
tecDetails->set_show_pictures_in_profile(false);
TEST(tecDetails->show_pictures_in_profile(), false);
}
@@ -450,7 +436,6 @@ void TestQPrefTechnicalDetails::test_signals()
QSignalSpy spy15(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::percentagegraphChanged);
QSignalSpy spy16(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::redceilingChanged);
QSignalSpy spy17(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::rulergraphChanged);
- QSignalSpy spy18(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::show_average_depthChanged);
QSignalSpy spy19(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::show_ccr_sensorsChanged);
QSignalSpy spy20(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::show_ccr_setpointChanged);
QSignalSpy spy21(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::show_icdChanged);
@@ -489,8 +474,6 @@ void TestQPrefTechnicalDetails::test_signals()
qPrefTechnicalDetails::set_redceiling(false);
prefs.rulergraph = true;
qPrefTechnicalDetails::set_rulergraph(false);
- prefs.show_average_depth = true;
- qPrefTechnicalDetails::set_show_average_depth(false);
prefs.show_ccr_sensors = true;
qPrefTechnicalDetails::set_show_ccr_sensors(false);
prefs.show_ccr_setpoint = true;
@@ -525,7 +508,6 @@ void TestQPrefTechnicalDetails::test_signals()
QCOMPARE(spy15.count(), 1);
QCOMPARE(spy16.count(), 1);
QCOMPARE(spy17.count(), 1);
- QCOMPARE(spy18.count(), 1);
QCOMPARE(spy19.count(), 1);
QCOMPARE(spy20.count(), 1);
QCOMPARE(spy21.count(), 1);
@@ -552,7 +534,6 @@ void TestQPrefTechnicalDetails::test_signals()
QVERIFY(spy15.takeFirst().at(0).toBool() == false);
QVERIFY(spy16.takeFirst().at(0).toBool() == false);
QVERIFY(spy17.takeFirst().at(0).toBool() == false);
- QVERIFY(spy18.takeFirst().at(0).toBool() == false);
QVERIFY(spy19.takeFirst().at(0).toBool() == false);
QVERIFY(spy20.takeFirst().at(0).toBool() == false);
QVERIFY(spy21.takeFirst().at(0).toBool() == false);