Preferences UI: final cleanup

This commit does some final cleaning up to the code, mostly deleting
white space and comments.

Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
willemferguson 2019-12-12 10:28:04 +02:00 committed by Dirk Hohndel
parent 42a85dfa7e
commit 6212bb6721
18 changed files with 40 additions and 37 deletions

View file

@ -10,7 +10,6 @@ qPrefDiveComputer *qPrefDiveComputer::instance()
return self; return self;
} }
void qPrefDiveComputer::loadSync(bool doSync) void qPrefDiveComputer::loadSync(bool doSync)
{ {
// last computer used // last computer used
@ -30,7 +29,6 @@ void qPrefDiveComputer::loadSync(bool doSync)
DISK_DC(2) DISK_DC(2)
DISK_DC(3) DISK_DC(3)
DISK_DC(4) DISK_DC(4)
} }
// these are the 'active' settings // these are the 'active' settings

View file

@ -14,7 +14,6 @@ void qPrefEquipment::loadSync(bool doSync)
{ {
disk_default_cylinder(doSync); disk_default_cylinder(doSync);
disk_display_unused_tanks(doSync); disk_display_unused_tanks(doSync);
} }
HANDLE_PREFERENCE_TXT(Equipment, "default_cylinder", default_cylinder); HANDLE_PREFERENCE_TXT(Equipment, "default_cylinder", default_cylinder);

View file

@ -2,7 +2,6 @@
#include "qPrefGeneral.h" #include "qPrefGeneral.h"
#include "qPrefPrivate.h" #include "qPrefPrivate.h"
static const QString group = QStringLiteral("GeneralSettings"); static const QString group = QStringLiteral("GeneralSettings");
QString qPrefGeneral::st_diveshareExport_uid; QString qPrefGeneral::st_diveshareExport_uid;
@ -17,7 +16,6 @@ qPrefGeneral *qPrefGeneral::instance()
return self; return self;
} }
void qPrefGeneral::loadSync(bool doSync) void qPrefGeneral::loadSync(bool doSync)
{ {
disk_defaultsetpoint(doSync); disk_defaultsetpoint(doSync);

View file

@ -17,7 +17,6 @@ void qPrefGeocoding::loadSync(bool doSync)
disk_third_taxonomy_category(doSync); disk_third_taxonomy_category(doSync);
} }
void qPrefGeocoding::set_first_taxonomy_category(taxonomy_category value) void qPrefGeocoding::set_first_taxonomy_category(taxonomy_category value)
{ {
if (value != prefs.geocoding.category[0]) { if (value != prefs.geocoding.category[0]) {
@ -34,7 +33,6 @@ void qPrefGeocoding::disk_first_taxonomy_category(bool doSync)
prefs.geocoding.category[0] = (enum taxonomy_category)qPrefPrivate::propValue(keyFromGroupAndName(group, "cat0"), default_prefs.geocoding.category[0]).toInt(); prefs.geocoding.category[0] = (enum taxonomy_category)qPrefPrivate::propValue(keyFromGroupAndName(group, "cat0"), default_prefs.geocoding.category[0]).toInt();
} }
void qPrefGeocoding::set_second_taxonomy_category(taxonomy_category value) void qPrefGeocoding::set_second_taxonomy_category(taxonomy_category value)
{ {
if (value != prefs.geocoding.category[1]) { if (value != prefs.geocoding.category[1]) {
@ -43,6 +41,7 @@ void qPrefGeocoding::set_second_taxonomy_category(taxonomy_category value)
emit instance()->second_taxonomy_categoryChanged(value); emit instance()->second_taxonomy_categoryChanged(value);
} }
} }
void qPrefGeocoding::disk_second_taxonomy_category(bool doSync) void qPrefGeocoding::disk_second_taxonomy_category(bool doSync)
{ {
if (doSync) if (doSync)
@ -60,6 +59,7 @@ void qPrefGeocoding::set_third_taxonomy_category(taxonomy_category value)
emit instance()->third_taxonomy_categoryChanged(value); emit instance()->third_taxonomy_categoryChanged(value);
} }
} }
void qPrefGeocoding::disk_third_taxonomy_category(bool doSync) void qPrefGeocoding::disk_third_taxonomy_category(bool doSync)
{ {
if (doSync) if (doSync)

View file

@ -5,7 +5,6 @@
#include <QObject> #include <QObject>
class qPrefGeocoding : public QObject { class qPrefGeocoding : public QObject {
Q_OBJECT Q_OBJECT
Q_PROPERTY(taxonomy_category first_taxonomy_category READ first_taxonomy_category WRITE set_first_taxonomy_category NOTIFY first_taxonomy_categoryChanged) Q_PROPERTY(taxonomy_category first_taxonomy_category READ first_taxonomy_category WRITE set_first_taxonomy_category NOTIFY first_taxonomy_categoryChanged)

View file

@ -19,8 +19,6 @@ void qPrefLog::loadSync(bool doSync)
disk_show_average_depth(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) void qPrefLog::set_default_file_behavior(enum def_file_behavior value)
{ {
if (value != prefs.default_file_behavior || if (value != prefs.default_file_behavior ||
@ -50,6 +48,7 @@ void qPrefLog::disk_default_file_behavior(bool doSync)
} }
} }
HANDLE_PREFERENCE_TXT(Log, "default_filename", default_filename);
HANDLE_PREFERENCE_BOOL(Log, "extraEnvironmentalDefault", extraEnvironmentalDefault); HANDLE_PREFERENCE_BOOL(Log, "extraEnvironmentalDefault", extraEnvironmentalDefault);

View file

@ -17,7 +17,6 @@ void qPrefMedia::loadSync(bool doSync)
disk_ffmpeg_executable(doSync); disk_ffmpeg_executable(doSync);
disk_auto_recalculate_thumbnails(doSync); disk_auto_recalculate_thumbnails(doSync);
disk_auto_recalculate_thumbnails(doSync); disk_auto_recalculate_thumbnails(doSync);
} }
HANDLE_PREFERENCE_BOOL(Media, "auto_recalculate_thumbnails", auto_recalculate_thumbnails); HANDLE_PREFERENCE_BOOL(Media, "auto_recalculate_thumbnails", auto_recalculate_thumbnails);

View file

@ -5,7 +5,6 @@
#include <QObject> #include <QObject>
class qPrefTechnicalDetails : public QObject { class qPrefTechnicalDetails : public QObject {
Q_OBJECT Q_OBJECT
Q_PROPERTY(bool calcalltissues READ calcalltissues WRITE set_calcalltissues NOTIFY calcalltissuesChanged) Q_PROPERTY(bool calcalltissues READ calcalltissues WRITE set_calcalltissues NOTIFY calcalltissuesChanged)

View file

@ -30,7 +30,6 @@ void PreferencesDc::on_resetRememberedDCs_clicked()
qPrefDiveComputer::set_vendor4(QString()); qPrefDiveComputer::set_vendor4(QString());
} }
void PreferencesDc::refreshSettings() void PreferencesDc::refreshSettings()
{ {
} }

View file

@ -22,12 +22,6 @@ PreferencesDefaults::~PreferencesDefaults()
delete ui; delete ui;
} }
/*void PreferencesDefaults::on_resetSettings_clicked()
{
auto dialog = PreferencesDialog::instance();
dialog->defaultsRequested();
} */
void PreferencesDefaults::refreshSettings() void PreferencesDefaults::refreshSettings()
{ {
ui->font->setCurrentFont(qPrefDisplay::divelist_font()); ui->font->setCurrentFont(qPrefDisplay::divelist_font());

View file

@ -9,8 +9,6 @@
#include <QMessageBox> #include <QMessageBox>
#include <QSortFilterProxyModel> #include <QSortFilterProxyModel>
#include "qt-models/models.h"
PreferencesEquipment::PreferencesEquipment() : AbstractPreferencesWidget(tr("Equipment"), QIcon(":preferences-equipment-icon"), 5) PreferencesEquipment::PreferencesEquipment() : AbstractPreferencesWidget(tr("Equipment"), QIcon(":preferences-equipment-icon"), 5)
{ {
ui = new Ui::PreferencesEquipment(); ui = new Ui::PreferencesEquipment();

View file

@ -14,11 +14,34 @@
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label_georef1">
<property name="toolTip">
<string extracomment="Help info 1"/>
</property>
<property name="text">
<string>Reverse dive site lookup format</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_georef2">
<property name="toolTip">
<string extracomment="Help info 1"/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="text">
<string>Selecting the blue globe icon to the right of Location in the Notes tab opens the Edit Dive Site panel. There, an icon to the right of the dive site coordinates allows reverse lookup of the dive site. This finds the country and closest town to the divesite and adds them as dive site tags above the dive site name in the Notes tab. The combo boxes below allow one to select the order in which these tags are shown in the Notes tab. This requires an Internet connection.</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QGroupBox" name="groupBox_12"> <widget class="QGroupBox" name="groupBox_12">
<property name="title">
<string>Dive site layout</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_10"> <layout class="QHBoxLayout" name="horizontalLayout_10">
<item> <item>
<widget class="QComboBox" name="first_item"> <widget class="QComboBox" name="first_item">

View file

@ -3,6 +3,7 @@
#include "ui_preferences_media.h" #include "ui_preferences_media.h"
#include "core/settings/qPrefMedia.h" #include "core/settings/qPrefMedia.h"
#include "core/qthelper.h" #include "core/qthelper.h"
#include "qt-models/models.h"
#include <QApplication> #include <QApplication>
#include <QMessageBox> #include <QMessageBox>
@ -10,13 +11,10 @@
#include <QFileDialog> #include <QFileDialog>
#include <QProcess> #include <QProcess>
#include "qt-models/models.h"
PreferencesMedia::PreferencesMedia() : AbstractPreferencesWidget(tr("Media"), QIcon(":preferences-media-icon"), 6) PreferencesMedia::PreferencesMedia() : AbstractPreferencesWidget(tr("Media"), QIcon(":preferences-media-icon"), 6)
{ {
ui = new Ui::PreferencesMedia(); ui = new Ui::PreferencesMedia();
ui->setupUi(this); ui->setupUi(this);
} }
PreferencesMedia::~PreferencesMedia() PreferencesMedia::~PreferencesMedia()
@ -75,7 +73,6 @@ void PreferencesMedia::refreshSettings()
ui->ffmpegExecutable->setText(qPrefMedia::ffmpeg_executable()); ui->ffmpegExecutable->setText(qPrefMedia::ffmpeg_executable());
ui->auto_recalculate_thumbnails->setChecked(prefs.auto_recalculate_thumbnails); ui->auto_recalculate_thumbnails->setChecked(prefs.auto_recalculate_thumbnails);
} }
void PreferencesMedia::syncSettings() void PreferencesMedia::syncSettings()
@ -85,5 +82,4 @@ void PreferencesMedia::syncSettings()
media->set_extract_video_thumbnails_position(ui->videoThumbnailPosition->value()); media->set_extract_video_thumbnails_position(ui->videoThumbnailPosition->value());
media->set_ffmpeg_executable(ui->ffmpegExecutable->text()); media->set_ffmpeg_executable(ui->ffmpegExecutable->text());
qPrefMedia::set_auto_recalculate_thumbnails(ui->auto_recalculate_thumbnails->isChecked()); qPrefMedia::set_auto_recalculate_thumbnails(ui->auto_recalculate_thumbnails->isChecked());
} }

View file

@ -35,7 +35,7 @@
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="text"> <property name="text">
<string>Photographs or videos are sometimes edited. If a photo is more recent than its thumbnail, checking the checkbox below will allow creating a new thumbnail after the media has been edited.</string> <string>Photographs or videos are sometimes edited after being uploaded and linked to Subsurface. If a photo is therefore more recent than its original thumbnail, checking the checkbox below will allow creating a new thumbnail after the media has been edited.</string>
</property> </property>
</widget> </widget>
</item> </item>

View file

@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
#include "preferences_reset.h" #include "preferences_reset.h"
#include "ui_preferences_reset.h" #include "ui_preferences_reset.h"
#include "core/dive.h"
#include "preferencesdialog.h" #include "preferencesdialog.h"
PreferencesReset::PreferencesReset(): AbstractPreferencesWidget(tr("Reset"), QIcon(":preferences-reset-icon"), 11 ), ui(new Ui::PreferencesReset()) PreferencesReset::PreferencesReset(): AbstractPreferencesWidget(tr("Reset"), QIcon(":preferences-reset-icon"), 11 ), ui(new Ui::PreferencesReset())

View file

@ -22,8 +22,8 @@ public slots:
private: private:
Ui::PreferencesReset *ui; Ui::PreferencesReset *ui;
};
};
#endif #endif

View file

@ -15,9 +15,6 @@
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2"> <item row="0" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
@ -39,7 +36,7 @@
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="text"> <property name="text">
<string>Selecting this button will reset all settings to their default values</string> <string>Selecting this button will reset all preferences to their default values</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -50,7 +47,7 @@
<item row="1" column="0"> <item row="1" column="0">
<widget class="QPushButton" name="resetSettings"> <widget class="QPushButton" name="resetSettings">
<property name="text"> <property name="text">
<string>Reset all settings</string> <string>Reset all preferences</string>
</property> </property>
</widget> </widget>
</item> </item>

View file

@ -101,6 +101,9 @@ SOURCES += ../../subsurface-mobile-main.cpp \
../../core/settings/qPrefProxy.cpp \ ../../core/settings/qPrefProxy.cpp \
../../core/settings/qPrefTechnicalDetails.cpp \ ../../core/settings/qPrefTechnicalDetails.cpp \
../../core/settings/qPrefUnit.cpp \ ../../core/settings/qPrefUnit.cpp \
../../core/settings/qPrefEquipment.cpp \
../../core/settings/qPrefLog.cpp \
../../core/settings/qPrefMedia.cpp \
../../core/settings/qPrefUpdateManager.cpp \ ../../core/settings/qPrefUpdateManager.cpp \
../../core/subsurface-qt/CylinderObjectHelper.cpp \ ../../core/subsurface-qt/CylinderObjectHelper.cpp \
../../core/subsurface-qt/DiveObjectHelper.cpp \ ../../core/subsurface-qt/DiveObjectHelper.cpp \
@ -226,6 +229,9 @@ HEADERS += \
../../core/settings/qPrefProxy.h \ ../../core/settings/qPrefProxy.h \
../../core/settings/qPrefTechnicalDetails.h \ ../../core/settings/qPrefTechnicalDetails.h \
../../core/settings/qPrefUnit.h \ ../../core/settings/qPrefUnit.h \
../../core/settings/qPrefEquipment.h \
../../core/settings/qPrefLog.h \
../../core/settings/qPrefMedia.h \
../../core/settings/qPrefUpdateManager.h \ ../../core/settings/qPrefUpdateManager.h \
../../core/subsurface-qt/CylinderObjectHelper.h \ ../../core/subsurface-qt/CylinderObjectHelper.h \
../../core/subsurface-qt/DiveObjectHelper.h \ ../../core/subsurface-qt/DiveObjectHelper.h \