forked from easymodo/qimgv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.h
164 lines (151 loc) · 4.55 KB
/
settings.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#ifndef SETTINGS_H
#define SETTINGS_H
#include <QObject>
#include <QSettings>
#include <QApplication>
#include <QStandardPaths>
#include <QDebug>
#include <QImageReader>
#include <QStringList>
#include <QColor>
#include <QDir>
#include <QKeySequence>
#include <QMap>
#include <QVersionNumber>
#include "utils/script.h"
enum SortingMode {
NAME_ASC,
NAME_DESC,
DATE_ASC,
DATE_DESC,
SIZE_ASC,
SIZE_DESC
};
enum ImageFitMode {
FIT_WINDOW,
FIT_WIDTH,
FIT_ORIGINAL,
FIT_FREE
};
enum PanelHPosition {
PANEL_TOP,
PANEL_BOTTOM
};
enum PanelVPosition {
PANEL_LEFT,
PANEL_RIGHT
};
class Settings : public QObject
{
Q_OBJECT
public:
static Settings* getInstance();
static void validate();
QStringList supportedMimeTypes();
QString supportedFormatsString();
bool useFastScale();
void setUseFastScale(bool mode);
QString lastDirectory();
void setLastDirectory(QString path);
unsigned int lastFilePosition();
void setLastFilePosition(unsigned int pos);
unsigned int mainPanelSize();
void setMainPanelSize(unsigned int size);
bool usePreloader();
void setUsePreloader(bool mode);
QColor backgroundColor();
void setBackgroundColor(QColor color);
QColor accentColor();
void setAccentColor(QColor color);
bool fullscreenMode();
void setFullscreenMode(bool mode);
ImageFitMode imageFitMode();
void setImageFitMode(ImageFitMode mode);
QRect windowGeometry();
void setWindowGeometry(QRect geometry);
bool reduceRamUsage();
void setReduceRamUsage(bool mode);
bool playWebm();
void setPlayWebm(bool mode);
bool playVideoSounds();
void setPlayVideoSounds(bool mode);
QString cacheDir();
QString mpvBinary();
void setMpvBinary(QString path);
bool showThumbnailLabels();
void setShowThumbnailLabels(bool mode);
PanelHPosition panelPosition();
void setPanelPosition(PanelHPosition);
~Settings();
bool infiniteScrolling();
void setInfiniteScrolling(bool mode);
bool fullscreenTaskbarShown();
void setFullscreenTaskbarShown(bool mode);
QStringList supportedFormats();
void readShortcuts(QMap<QString, QString> &shortcuts);
void saveShortcuts(const QMap<QString, QString> &shortcuts);
bool panelEnabled();
void setPanelEnabled(bool mode);
int lastDisplay();
void setLastDisplay(int display);
bool mouseWrapping();
void setMouseWrapping(bool mode);
bool squareThumbnails();
void setSquareThumbnails(bool mode);
bool drawThumbnailSelectionBorder();
void setDrawThumbnailSelectionBorder(bool mode);
bool transparencyGrid();
void setTransparencyGrid(bool mode);
bool forceSmoothScroll();
void setForceSmoothScroll(bool mode);
bool useThumbnailCache();
void setUseThumbnailCache(bool mode);
QStringList savedPaths();
void setSavedPaths(QStringList paths);
QString tempDir();
int thumbnailerThreadCount();
void setThumbnailerThreadCount(int count);
bool smoothUpscaling();
void setSmoothUpscaling(bool mode);
int maxZoomedResolution();
void setMaxZoomedResolution(int value);
int maximumZoom();
void setMaximumZoom(int value);
void setExpandImage(bool mode);
bool expandImage();
int scalingFilter();
void setScalingFilter(int mode);
bool smoothAnimatedImages();
void setSmoothAnimatedImages(bool mode);
bool panelFullscreenOnly();
void setPanelFullscreenOnly(bool mode);
bool playMp4();
void setPlayMp4(bool mode);
QVersionNumber lastVersion();
void setLastVersion(QVersionNumber &ver);
void setShowChangelogs(bool mode);
bool showChangelogs();
qreal backgroundOpacity();
void setBackgroundOpacity(qreal value);
bool blurBackground();
void setBlurBackground(bool mode);
void setSortingMode(SortingMode mode);
SortingMode sortingMode();
void readScripts(QMap<QString, Script> &scripts);
void saveScripts(const QMap<QString, Script> &scripts);
bool showInfoOverlay();
void setShowInfoOverlay(bool mode);
bool firstRun();
void setFirstRun(bool mode);
private:
explicit Settings(QObject *parent = nullptr);
const unsigned int mainPanelSizeDefault = 210;
QSettings *s;
QDir *cacheDirectory, *thumbnailDirectory;
signals:
void settingsChanged();
public slots:
void sendChangeNotification();
};
extern Settings *settings;
#endif // SETTINGS_H