mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
ccdd92aeb7
This is a messy commit, because the "qPref" system relies heavily on QString, which means lots of conversions between the two worlds. Ultimately, I plan to base the preferences system on std::string and only convert to QString when pushing through Qt's property system or when writing into Qt's settings. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
51 lines
2.1 KiB
C++
51 lines
2.1 KiB
C++
// 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 QString::fromStdString(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
|