aboutsummaryrefslogtreecommitdiffstats
path: root/core/settings
diff options
context:
space:
mode:
authorGravatar willemferguson <willemferguson@zoology.up.ac.za>2019-12-08 11:30:16 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-12-25 02:57:42 +0900
commit2ac279d12953ad840ade1c08d0eff5c2f4adb0b9 (patch)
tree9f2d70f50cb910803e260fa9d3bdad2687d820ad /core/settings
parent3e853e37a5b0b9509fb92b1ddb3031f117578fb9 (diff)
downloadsubsurface-2ac279d12953ad840ade1c08d0eff5c2f4adb0b9.tar.gz
Pereferences UI: add media tab
Remove the preference settings dealing with thumbnails (currently under General preferences and Profile preferences) and put them in a newly-created Media preference tab. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core/settings')
-rw-r--r--core/settings/qPrefGeneral.cpp13
-rw-r--r--core/settings/qPrefGeneral.h20
-rw-r--r--core/settings/qPrefMedia.cpp27
-rw-r--r--core/settings/qPrefMedia.h51
4 files changed, 78 insertions, 33 deletions
diff --git a/core/settings/qPrefGeneral.cpp b/core/settings/qPrefGeneral.cpp
index b3e9fb761..e3d3e6e0a 100644
--- a/core/settings/qPrefGeneral.cpp
+++ b/core/settings/qPrefGeneral.cpp
@@ -20,14 +20,9 @@ qPrefGeneral *qPrefGeneral::instance()
void qPrefGeneral::loadSync(bool doSync)
{
- disk_auto_recalculate_thumbnails(doSync);
- disk_auto_recalculate_thumbnails(doSync);
disk_default_filename(doSync);
disk_default_file_behavior(doSync);
disk_defaultsetpoint(doSync);
- disk_extract_video_thumbnails(doSync);
- disk_extract_video_thumbnails_position(doSync);
- disk_ffmpeg_executable(doSync);
disk_o2consumption(doSync);
disk_pscr_ratio(doSync);
disk_use_default_file(doSync);
@@ -41,8 +36,6 @@ void qPrefGeneral::loadSync(bool doSync)
}
}
-HANDLE_PREFERENCE_BOOL(General, "auto_recalculate_thumbnails", auto_recalculate_thumbnails);
-
HANDLE_PREFERENCE_TXT(General, "default_filename", default_filename);
@@ -77,12 +70,6 @@ void qPrefGeneral::disk_default_file_behavior(bool doSync)
HANDLE_PREFERENCE_INT(General, "defaultsetpoint", defaultsetpoint);
-HANDLE_PREFERENCE_BOOL(General, "extract_video_thumbnails", extract_video_thumbnails);
-
-HANDLE_PREFERENCE_INT(General, "extract_video_thumbnails_position", extract_video_thumbnails_position);
-
-HANDLE_PREFERENCE_TXT(General, "ffmpeg_executable", ffmpeg_executable);
-
HANDLE_PREFERENCE_INT(General, "o2consumption", o2consumption);
HANDLE_PREFERENCE_INT(General, "pscr_ratio", pscr_ratio);
diff --git a/core/settings/qPrefGeneral.h b/core/settings/qPrefGeneral.h
index c55063bd2..bb91d6501 100644
--- a/core/settings/qPrefGeneral.h
+++ b/core/settings/qPrefGeneral.h
@@ -7,13 +7,9 @@
class qPrefGeneral : public QObject {
Q_OBJECT
- Q_PROPERTY(bool auto_recalculate_thumbnails READ auto_recalculate_thumbnails WRITE set_auto_recalculate_thumbnails NOTIFY auto_recalculate_thumbnailsChanged)
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(bool extract_video_thumbnails READ extract_video_thumbnails WRITE set_extract_video_thumbnails NOTIFY extract_video_thumbnailsChanged)
- Q_PROPERTY(int extract_video_thumbnails_position READ extract_video_thumbnails_position WRITE set_extract_video_thumbnails_position NOTIFY extract_video_thumbnails_positionChanged)
- Q_PROPERTY(QString ffmpeg_executable READ ffmpeg_executable WRITE set_ffmpeg_executable NOTIFY ffmpeg_executableChanged)
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)
@@ -33,13 +29,9 @@ public:
static void sync() { return loadSync(true); }
public:
- static bool auto_recalculate_thumbnails() { return prefs.auto_recalculate_thumbnails; }
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 bool extract_video_thumbnails() { return prefs.extract_video_thumbnails; }
- static int extract_video_thumbnails_position() { return prefs.extract_video_thumbnails_position; }
- static QString ffmpeg_executable() { return prefs.ffmpeg_executable; }
static int o2consumption() { return prefs.o2consumption; }
static int pscr_ratio() { return prefs.pscr_ratio; }
static bool use_default_file() { return prefs.use_default_file; }
@@ -50,13 +42,9 @@ public:
static bool extraEnvironmentalDefault() { return prefs.extraEnvironmentalDefault; }
public slots:
- static void set_auto_recalculate_thumbnails(bool value);
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_extract_video_thumbnails(bool value);
- static void set_extract_video_thumbnails_position(int value);
- static void set_ffmpeg_executable(const QString& value);
static void set_o2consumption(int value);
static void set_pscr_ratio(int value);
static void set_use_default_file(bool value);
@@ -67,13 +55,9 @@ public slots:
static void set_extraEnvironmentalDefault(bool value);
signals:
- void auto_recalculate_thumbnailsChanged(bool value);
void default_filenameChanged(const QString& value);
void default_file_behaviorChanged(enum def_file_behavior value);
void defaultsetpointChanged(int value);
- void extract_video_thumbnailsChanged(bool value);
- void extract_video_thumbnails_positionChanged(int value);
- void ffmpeg_executableChanged(const QString& value);
void o2consumptionChanged(int value);
void pscr_ratioChanged(int value);
void use_default_fileChanged(bool value);
@@ -87,13 +71,9 @@ signals:
private:
qPrefGeneral() {}
- static void disk_auto_recalculate_thumbnails(bool doSync);
static void disk_default_filename(bool doSync);
static void disk_default_file_behavior(bool doSync);
static void disk_defaultsetpoint(bool doSync);
- static void disk_extract_video_thumbnails(bool doSync);
- static void disk_extract_video_thumbnails_position(bool doSync);
- static void disk_ffmpeg_executable(bool doSync);
static void disk_o2consumption(bool doSync);
static void disk_pscr_ratio(bool doSync);
static void disk_use_default_file(bool doSync);
diff --git a/core/settings/qPrefMedia.cpp b/core/settings/qPrefMedia.cpp
new file mode 100644
index 000000000..557b2124f
--- /dev/null
+++ b/core/settings/qPrefMedia.cpp
@@ -0,0 +1,27 @@
+// SPDX-License-Identifier: GPL-2.0
+#include "qPrefMedia.h"
+#include "qPrefPrivate.h"
+
+static const QString group = QStringLiteral("Media");
+
+qPrefMedia *qPrefMedia::instance()
+{
+ static qPrefMedia *self = new qPrefMedia;
+ return self;
+}
+
+void qPrefMedia::loadSync(bool doSync)
+{
+ disk_extract_video_thumbnails(doSync);
+ disk_extract_video_thumbnails_position(doSync);
+ disk_ffmpeg_executable(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, "extract_video_thumbnails", extract_video_thumbnails);
+HANDLE_PREFERENCE_INT(Media, "extract_video_thumbnails_position", extract_video_thumbnails_position);
+HANDLE_PREFERENCE_TXT(Media, "ffmpeg_executable", ffmpeg_executable);
+
diff --git a/core/settings/qPrefMedia.h b/core/settings/qPrefMedia.h
new file mode 100644
index 000000000..fab87f250
--- /dev/null
+++ b/core/settings/qPrefMedia.h
@@ -0,0 +1,51 @@
+// SPDX-License-Identifier: GPL-2.0
+#ifndef QPREFMEDIA_H
+#define QPREFMEDIA_H
+#include "core/pref.h"
+
+#include <QObject>
+
+class qPrefMedia : public QObject {
+ Q_OBJECT
+ Q_PROPERTY(bool auto_recalculate_thumbnails READ auto_recalculate_thumbnails WRITE set_auto_recalculate_thumbnails NOTIFY auto_recalculate_thumbnailsChanged)
+ Q_PROPERTY(bool extract_video_thumbnails READ extract_video_thumbnails WRITE set_extract_video_thumbnails NOTIFY extract_video_thumbnailsChanged)
+ Q_PROPERTY(int extract_video_thumbnails_position READ extract_video_thumbnails_position WRITE set_extract_video_thumbnails_position NOTIFY extract_video_thumbnails_positionChanged)
+ Q_PROPERTY(QString ffmpeg_executable READ ffmpeg_executable WRITE set_ffmpeg_executable NOTIFY ffmpeg_executableChanged)
+
+public:
+ static qPrefMedia *instance();
+
+ // Load/Sync local settings (disk) and struct preference
+ static void loadSync(bool doSync);
+ static void load() { loadSync(false); }
+ static void sync() { loadSync(true); }
+
+public:
+ static bool auto_recalculate_thumbnails() { return prefs.auto_recalculate_thumbnails; }
+ static bool extract_video_thumbnails() { return prefs.extract_video_thumbnails; }
+ static int extract_video_thumbnails_position() { return prefs.extract_video_thumbnails_position; }
+ static QString ffmpeg_executable() { return prefs.ffmpeg_executable; }
+
+public slots:
+ static void set_auto_recalculate_thumbnails(bool value);
+ static void set_extract_video_thumbnails(bool value);
+ static void set_extract_video_thumbnails_position(int value);
+ static void set_ffmpeg_executable(const QString& value);
+
+signals:
+ void auto_recalculate_thumbnailsChanged(bool value);
+ void extract_video_thumbnailsChanged(bool value);
+ void extract_video_thumbnails_positionChanged(int value);
+ void ffmpeg_executableChanged(const QString& value);
+
+private:
+ qPrefMedia() {}
+
+ static void disk_auto_recalculate_thumbnails(bool doSync);
+ static void disk_extract_video_thumbnails(bool doSync);
+ static void disk_extract_video_thumbnails_position(bool doSync);
+ static void disk_ffmpeg_executable(bool doSync);
+
+};
+
+#endif