CuteLogger
Fast and simple logging solution for Qt based applications
settings.h
1 /*
2  * Copyright (c) 2013-2020 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 <QObject>
22 #include <QSettings>
23 #include <QStringList>
24 #include <QByteArray>
25 
26 class ShotcutSettings : public QObject
27 {
28  Q_OBJECT
29  Q_PROPERTY(bool timelineShowWaveforms READ timelineShowWaveforms WRITE setTimelineShowWaveforms NOTIFY timelineShowWaveformsChanged)
30  Q_PROPERTY(bool timelineShowThumbnails READ timelineShowThumbnails WRITE setTimelineShowThumbnails NOTIFY timelineShowThumbnailsChanged)
31  Q_PROPERTY(bool timelineRipple READ timelineRipple WRITE setTimelineRipple NOTIFY timelineRippleChanged)
32  Q_PROPERTY(bool timelineRippleAllTracks READ timelineRippleAllTracks WRITE setTimelineRippleAllTracks NOTIFY timelineRippleAllTracksChanged)
33  Q_PROPERTY(bool timelineSnap READ timelineSnap WRITE setTimelineSnap NOTIFY timelineSnapChanged)
34  Q_PROPERTY(bool timelineCenterPlayhead READ timelineCenterPlayhead WRITE setTimelineCenterPlayhead NOTIFY timelineCenterPlayheadChanged)
35  Q_PROPERTY(QString openPath READ openPath WRITE setOpenPath NOTIFY openPathChanged)
36  Q_PROPERTY(QString savePath READ savePath WRITE setSavePath NOTIFY savePathChanged)
37  Q_PROPERTY(QString playlistThumbnails READ playlistThumbnails WRITE setPlaylistThumbnails NOTIFY playlistThumbnailsChanged)
38  Q_PROPERTY(QString viewMode READ viewMode WRITE setViewMode NOTIFY viewModeChanged)
39  Q_PROPERTY(int playerAudioChannels READ playerAudioChannels NOTIFY playerAudioChannelsChanged)
40  Q_PROPERTY(bool playerGPU READ playerGPU NOTIFY playerGpuChanged)
41  Q_PROPERTY(double audioInDuration READ audioInDuration WRITE setAudioInDuration NOTIFY audioInDurationChanged)
42  Q_PROPERTY(double audioOutDuration READ audioOutDuration WRITE setAudioOutDuration NOTIFY audioOutDurationChanged)
43  Q_PROPERTY(double videoInDuration READ videoInDuration WRITE setVideoInDuration NOTIFY videoInDurationChanged)
44  Q_PROPERTY(double videoOutDuration READ videoOutDuration WRITE setVideoOutDuration NOTIFY videoOutDurationChanged)
45  Q_PROPERTY(bool smallIcons READ smallIcons WRITE setSmallIcons NOTIFY smallIconsChanged)
46 
47 public:
48  static ShotcutSettings& singleton();
49  explicit ShotcutSettings() : QObject() {}
50  explicit ShotcutSettings(const QString& appDataLocation);
51  void log();
52 
53  QString language() const;
54  void setLanguage(const QString&);
55  double imageDuration() const;
56  void setImageDuration(double);
57  QString openPath() const;
58  void setOpenPath(const QString&);
59  QString savePath() const;
60  void setSavePath(const QString&);
61  QStringList recent() const;
62  void setRecent(const QStringList&);
63  QString theme() const;
64  void setTheme(const QString&);
65  bool showTitleBars() const;
66  void setShowTitleBars(bool);
67  bool showToolBar() const;
68  void setShowToolBar(bool);
69  bool textUnderIcons() const;
70  void setTextUnderIcons(bool);
71  bool smallIcons() const;
72  void setSmallIcons(bool);
73  QByteArray windowGeometry() const;
74  void setWindowGeometry(const QByteArray&);
75  QByteArray windowGeometryDefault() const;
76  void setWindowGeometryDefault(const QByteArray&);
77  QByteArray windowState() const;
78  void setWindowState(const QByteArray&);
79  QByteArray windowStateDefault() const;
80  void setWindowStateDefault(const QByteArray&);
81  QString viewMode() const;
82  void setViewMode(const QString& viewMode);
83 
84  QString encodePath() const;
85  void setEncodePath(const QString&);
86  bool encodeFreeSpaceCheck() const;
87  void setEncodeFreeSpaceCheck(bool);
88  bool encodeUseHardware() const;
89  void setEncodeUseHardware(bool);
90  QStringList encodeHardware() const;
91  void setEncodeHardware(const QStringList&);
92  bool encodeAdvanced() const;
93  void setEncodeAdvanced(bool);
94  bool showConvertClipDialog() const;
95  void setShowConvertClipDialog(bool);
96  bool encodeParallelProcessing() const;
97  void setEncodeParallelProcessing(bool);
98 
99  int playerAudioChannels() const;
100  void setPlayerAudioChannels(int);
101  QString playerDeinterlacer() const;
102  void setPlayerDeinterlacer(const QString&);
103  QString playerExternal() const;
104  void setPlayerExternal(const QString&);
105  QString playerGamma() const;
106  void setPlayerGamma(const QString&);
107  bool playerGPU() const;
108  void setPlayerGPU(bool);
109  bool playerWarnGPU() const;
110  QString playerInterpolation() const;
111  void setPlayerInterpolation(const QString&);
112  bool playerJACK() const;
113  void setPlayerJACK(bool);
114  int playerKeyerMode() const;
115  void setPlayerKeyerMode(int);
116  bool playerMuted() const;
117  void setPlayerMuted(bool);
118  QString playerProfile() const;
119  void setPlayerProfile(const QString&);
120  bool playerProgressive() const;
121  void setPlayerProgressive(bool);
122  bool playerRealtime() const;
123  void setPlayerRealtime(bool);
124  bool playerScrubAudio() const;
125  void setPlayerScrubAudio(bool);
126  int playerVolume() const;
127  void setPlayerVolume(int);
128  float playerZoom() const;
129  void setPlayerZoom(float);
130  int playerPreviewScale() const;
131  void setPlayerPreviewScale(int);
132 
133  QString playlistThumbnails() const;
134  void setPlaylistThumbnails(const QString&);
135  bool playlistAutoplay() const;
136  void setPlaylistAutoplay(bool);
137 
138  bool timelineShowWaveforms() const;
139  void setTimelineShowWaveforms(bool);
140  bool timelineShowThumbnails() const;
141  void setTimelineShowThumbnails(bool);
142 
143  bool timelineRipple() const;
144  void setTimelineRipple(bool);
145  bool timelineRippleAllTracks() const;
146  void setTimelineRippleAllTracks(bool);
147  bool timelineSnap() const;
148  void setTimelineSnap(bool);
149  bool timelineCenterPlayhead() const;
150  void setTimelineCenterPlayhead(bool);
151  int timelineTrackHeight() const;
152  void setTimelineTrackHeight(int);
153 
154  QString filterFavorite(const QString& filterName);
155  void setFilterFavorite(const QString& filterName, const QString& value);
156 
157  double audioInDuration() const;
158  void setAudioInDuration(double);
159 
160  double audioOutDuration() const;
161  void setAudioOutDuration(double);
162 
163  double videoInDuration() const;
164  void setVideoInDuration(double);
165 
166  double videoOutDuration() const;
167  void setVideoOutDuration(double);
168 
169  bool loudnessScopeShowMeter(const QString& meter) const;
170  void setLoudnessScopeShowMeter(const QString& meter, bool b);
171 
172  int drawMethod() const;
173  void setDrawMethod(int);
174 
175  bool noUpgrade() const;
176  void setNoUpgrade(bool value);
177  bool checkUpgradeAutomatic();
178  void setCheckUpgradeAutomatic(bool b);
179  bool askUpgradeAutmatic();
180  void setAskUpgradeAutomatic(bool b);
181 
182  void sync();
183  QString appDataLocation() const;
184  static void setAppDataForSession(const QString& location);
185  void setAppDataLocally(const QString& location);
186 
187  QStringList layouts() const;
188  bool setLayout(const QString& name, const QByteArray& geometry, const QByteArray& state);
189  QByteArray layoutGeometry(const QString& name);
190  QByteArray layoutState(const QString& name);
191  bool removeLayout(const QString& name);
192 
193  bool clearRecent() const;
194  void setClearRecent(bool);
195 
196  QString projectsFolder() const;
197  void setProjectsFolder(const QString& path);
198 
199  int undoLimit() const;
200 
201 signals:
202  void openPathChanged();
203  void savePathChanged();
204  void timelineShowWaveformsChanged();
205  void timelineShowThumbnailsChanged();
206  void timelineRippleChanged();
207  void timelineRippleAllTracksChanged();
208  void timelineSnapChanged();
209  void timelineCenterPlayheadChanged();
210  void playerAudioChannelsChanged(int);
211  void playerGpuChanged();
212  void audioInDurationChanged();
213  void audioOutDurationChanged();
214  void videoInDurationChanged();
215  void videoOutDurationChanged();
216  void playlistThumbnailsChanged();
217  void viewModeChanged();
218  void smallIconsChanged();
219 
220 private:
221  QSettings settings;
222  QString m_appDataLocation;
223 };
224 
225 #define Settings ShotcutSettings::singleton()
226 
227 #endif // SETTINGS_H