CuteLogger
Fast and simple logging solution for Qt based applications
settings.h
1/*
2 * Copyright (c) 2013-2022 Meltytech, LLC
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef SETTINGS_H
19#define SETTINGS_H
20
21#include <QKeySequence>
22#include <QObject>
23#include <QSettings>
24#include <QStringList>
25#include <QByteArray>
26#include <QThread>
27
28class ShotcutSettings : public QObject
29{
30 Q_OBJECT
31 Q_PROPERTY(bool timelineDragScrub READ timelineDragScrub WRITE setTimelineDragScrub NOTIFY
32 timelineDragScrubChanged)
33 Q_PROPERTY(bool timelineShowWaveforms READ timelineShowWaveforms WRITE setTimelineShowWaveforms
34 NOTIFY timelineShowWaveformsChanged)
35 Q_PROPERTY(bool timelineShowThumbnails READ timelineShowThumbnails WRITE setTimelineShowThumbnails
36 NOTIFY timelineShowThumbnailsChanged)
37 Q_PROPERTY(bool timelineRipple READ timelineRipple WRITE setTimelineRipple NOTIFY
38 timelineRippleChanged)
39 Q_PROPERTY(bool timelineRippleAllTracks READ timelineRippleAllTracks WRITE
40 setTimelineRippleAllTracks NOTIFY timelineRippleAllTracksChanged)
41 Q_PROPERTY(bool timelineRippleMarkers READ timelineRippleMarkers WRITE setTimelineRippleMarkers
42 NOTIFY timelineRippleMarkersChanged)
43 Q_PROPERTY(bool timelineSnap READ timelineSnap WRITE setTimelineSnap NOTIFY timelineSnapChanged)
44 Q_PROPERTY(bool timelineCenterPlayhead READ timelineCenterPlayhead WRITE setTimelineCenterPlayhead
45 NOTIFY timelineCenterPlayheadChanged)
46 Q_PROPERTY(bool timelineScrollZoom READ timelineScrollZoom WRITE setTimelineScrollZoom NOTIFY
47 timelineScrollZoomChanged)
48 Q_PROPERTY(bool timelineFramebufferWaveform READ timelineFramebufferWaveform WRITE
49 setTimelineFramebufferWaveform NOTIFY timelineFramebufferWaveformChanged)
50 Q_PROPERTY(QString openPath READ openPath WRITE setOpenPath NOTIFY openPathChanged)
51 Q_PROPERTY(QString savePath READ savePath WRITE setSavePath NOTIFY savePathChanged)
52 Q_PROPERTY(QString playlistThumbnails READ playlistThumbnails WRITE setPlaylistThumbnails NOTIFY
53 playlistThumbnailsChanged)
54 Q_PROPERTY(QString viewMode READ viewMode WRITE setViewMode NOTIFY viewModeChanged)
55 Q_PROPERTY(int playerAudioChannels READ playerAudioChannels NOTIFY playerAudioChannelsChanged)
56 Q_PROPERTY(bool playerGPU READ playerGPU NOTIFY playerGpuChanged)
57 Q_PROPERTY(double audioInDuration READ audioInDuration WRITE setAudioInDuration NOTIFY
58 audioInDurationChanged)
59 Q_PROPERTY(double audioOutDuration READ audioOutDuration WRITE setAudioOutDuration NOTIFY
60 audioOutDurationChanged)
61 Q_PROPERTY(double videoInDuration READ videoInDuration WRITE setVideoInDuration NOTIFY
62 videoInDurationChanged)
63 Q_PROPERTY(double videoOutDuration READ videoOutDuration WRITE setVideoOutDuration NOTIFY
64 videoOutDurationChanged)
65 Q_PROPERTY(bool smallIcons READ smallIcons WRITE setSmallIcons NOTIFY smallIconsChanged)
66 Q_PROPERTY(bool askOutputFilter READ askOutputFilter WRITE setAskOutputFilter NOTIFY
67 askOutputFilterChanged)
68
69public:
70 static ShotcutSettings &singleton();
71 explicit ShotcutSettings() : QObject() {}
72 explicit ShotcutSettings(const QString &appDataLocation);
73 void log();
74
75 // general
76 QString language() const;
77 void setLanguage(const QString &);
78 double imageDuration() const;
79 void setImageDuration(double);
80 QString openPath() const;
81 void setOpenPath(const QString &);
82 QString savePath() const;
83 void setSavePath(const QString &);
84 QStringList recent() const;
85 void setRecent(const QStringList &);
86 QString theme() const;
87 void setTheme(const QString &);
88 QThread::Priority jobPriority() const;
89 void setJobPriority(const QString &);
90 bool showTitleBars() const;
91 void setShowTitleBars(bool);
92 bool showToolBar() const;
93 void setShowToolBar(bool);
94 bool textUnderIcons() const;
95 void setTextUnderIcons(bool);
96 bool smallIcons() const;
97 void setSmallIcons(bool);
98 QByteArray windowGeometry() const;
99 void setWindowGeometry(const QByteArray &);
100 QByteArray windowGeometryDefault() const;
101 void setWindowGeometryDefault(const QByteArray &);
102 QByteArray windowState() const;
103 void setWindowState(const QByteArray &);
104 QByteArray windowStateDefault() const;
105 void setWindowStateDefault(const QByteArray &);
106 QString viewMode() const;
107 void setViewMode(const QString &viewMode);
108 QString exportFrameSuffix() const;
109 void setExportFrameSuffix(const QString &suffix);
110 bool convertAdvanced() const;
111 void setConvertAdvanced(bool);
112
113 // encode
114 QString encodePath() const;
115 void setEncodePath(const QString &);
116 bool encodeFreeSpaceCheck() const;
117 void setEncodeFreeSpaceCheck(bool);
118 bool encodeUseHardware() const;
119 void setEncodeUseHardware(bool);
120 QStringList encodeHardware() const;
121 void setEncodeHardware(const QStringList &);
122 bool encodeAdvanced() const;
123 void setEncodeAdvanced(bool);
124 bool showConvertClipDialog() const;
125 void setShowConvertClipDialog(bool);
126 bool encodeParallelProcessing() const;
127 void setEncodeParallelProcessing(bool);
128
129 // player
130 int playerAudioChannels() const;
131 void setPlayerAudioChannels(int);
132 QString playerDeinterlacer() const;
133 void setPlayerDeinterlacer(const QString &);
134 QString playerExternal() const;
135 void setPlayerExternal(const QString &);
136 QString playerGamma() const;
137 void setPlayerGamma(const QString &);
138 bool playerGPU() const;
139 void setPlayerGPU(bool);
140 bool playerWarnGPU() const;
141 QString playerInterpolation() const;
142 void setPlayerInterpolation(const QString &);
143 bool playerJACK() const;
144 void setPlayerJACK(bool);
145 int playerKeyerMode() const;
146 void setPlayerKeyerMode(int);
147 bool playerMuted() const;
148 void setPlayerMuted(bool);
149 QString playerProfile() const;
150 void setPlayerProfile(const QString &);
151 bool playerProgressive() const;
152 void setPlayerProgressive(bool);
153 bool playerRealtime() const;
154 void setPlayerRealtime(bool);
155 bool playerScrubAudio() const;
156 void setPlayerScrubAudio(bool);
157 int playerVolume() const;
158 void setPlayerVolume(int);
159 float playerZoom() const;
160 void setPlayerZoom(float);
161 int playerPreviewScale() const;
162 void setPlayerPreviewScale(int);
163 int playerVideoDelayMs() const;
164 void setPlayerVideoDelayMs(int);
165
166 // playlist
167 QString playlistThumbnails() const;
168 void setPlaylistThumbnails(const QString &);
169 bool playlistAutoplay() const;
170 void setPlaylistAutoplay(bool);
171
172 // timeline
173 bool timelineDragScrub() const;
174 void setTimelineDragScrub(bool);
175 bool timelineShowWaveforms() const;
176 void setTimelineShowWaveforms(bool);
177 bool timelineShowThumbnails() const;
178 void setTimelineShowThumbnails(bool);
179 bool timelineRipple() const;
180 void setTimelineRipple(bool);
181 bool timelineRippleAllTracks() const;
182 void setTimelineRippleAllTracks(bool);
183 bool timelineRippleMarkers() const;
184 void setTimelineRippleMarkers(bool);
185 bool timelineSnap() const;
186 void setTimelineSnap(bool);
187 bool timelineCenterPlayhead() const;
188 void setTimelineCenterPlayhead(bool);
189 int timelineTrackHeight() const;
190 void setTimelineTrackHeight(int);
191 bool timelineScrollZoom() const;
192 void setTimelineScrollZoom(bool);
193 bool timelineFramebufferWaveform() const;
194 void setTimelineFramebufferWaveform(bool);
195 int audioReferenceTrack() const;
196 void setAudioReferenceTrack(int);
197 double audioReferenceSpeedRange() const;
198 void setAudioReferenceSpeedRange(double);
199 bool timelinePreviewTransition() const;
200 void setTimelinePreviewTransition(bool);
201
202 // filter
203 QString filterFavorite(const QString &filterName);
204 void setFilterFavorite(const QString &filterName, const QString &value);
205 double audioInDuration() const;
206 void setAudioInDuration(double);
207 double audioOutDuration() const;
208 void setAudioOutDuration(double);
209 double videoInDuration() const;
210 void setVideoInDuration(double);
211 double videoOutDuration() const;
212 void setVideoOutDuration(double);
213 bool askOutputFilter() const;
214 void setAskOutputFilter(bool);
215
216 // scope
217 bool loudnessScopeShowMeter(const QString &meter) const;
218 void setLoudnessScopeShowMeter(const QString &meter, bool b);
219
220 // Markers
221 void setMarkerColor(const QColor &color);
222 QColor markerColor() const;
223 void setMarkersShowColumn(const QString &column, bool b);
224 bool markersShowColumn(const QString &column) const;
225 void setMarkerSort(int column, Qt::SortOrder order);
226 int getMarkerSortColumn();
227 Qt::SortOrder getMarkerSortOrder();
228
229 // general continued
230 int drawMethod() const;
231 void setDrawMethod(int);
232 bool noUpgrade() const;
233 void setNoUpgrade(bool value);
234 bool checkUpgradeAutomatic();
235 void setCheckUpgradeAutomatic(bool b);
236 bool askUpgradeAutomatic();
237 void setAskUpgradeAutomatic(bool b);
238
239 void sync();
240 QString appDataLocation() const;
241 static void setAppDataForSession(const QString &location);
242 void setAppDataLocally(const QString &location);
243
244 // layout
245 QStringList layouts() const;
246 bool setLayout(const QString &name, const QByteArray &geometry, const QByteArray &state);
247 QByteArray layoutGeometry(const QString &name);
248 QByteArray layoutState(const QString &name);
249 bool removeLayout(const QString &name);
250 int layoutMode() const;
251 void setLayoutMode(int mode = 0);
252
253 // general continued
254 bool clearRecent() const;
255 void setClearRecent(bool);
256 QString projectsFolder() const;
257 void setProjectsFolder(const QString &path);
258 QString audioInput() const;
259 void setAudioInput(const QString &name);
260 QString videoInput() const;
261 void setVideoInput(const QString &name);
262 QString glaxnimatePath() const;
263 void setGlaxnimatePath(const QString &path);
264 bool exportRangeMarkers() const;
265 void setExportRangeMarkers(bool);
266 int undoLimit() const;
267
268 // proxy
269 bool proxyEnabled() const;
270 void setProxyEnabled(bool);
271 QString proxyFolder() const;
272 void setProxyFolder(const QString &path);
273 bool proxyUseProjectFolder() const;
274 void setProxyUseProjectFolder(bool);
275 bool proxyUseHardware() const;
276 void setProxyUseHardware(bool);
277
278 // Shortcuts
279 void clearShortcuts(const QString &name);
280 void setShortcuts(const QString &name, const QList<QKeySequence> &shortcuts);
281 QList<QKeySequence> shortcuts(const QString &name);
282
283public slots:
284 void reset();
285
286signals:
287 void openPathChanged();
288 void savePathChanged();
289 void timelineDragScrubChanged();
290 void timelineShowWaveformsChanged();
291 void timelineShowThumbnailsChanged();
292 void timelineRippleChanged();
293 void timelineRippleAllTracksChanged();
294 void timelineRippleMarkersChanged();
295 void timelineSnapChanged();
296 void timelineCenterPlayheadChanged();
297 void timelineScrollZoomChanged();
298 void timelineFramebufferWaveformChanged();
299 void playerAudioChannelsChanged(int);
300 void playerGpuChanged();
301 void audioInDurationChanged();
302 void audioOutDurationChanged();
303 void videoInDurationChanged();
304 void videoOutDurationChanged();
305 void playlistThumbnailsChanged();
306 void viewModeChanged();
307 void smallIconsChanged();
308 void askOutputFilterChanged();
309
310private:
311 QSettings settings;
312 QString m_appDataLocation;
313};
314
315#define Settings ShotcutSettings::singleton()
316
317#endif // SETTINGS_H