CuteLogger
Fast and simple logging solution for Qt based applications
settings.h
1 /*
2  * Copyright (c) 2013-2019 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 
97  int playerAudioChannels() const;
98  void setPlayerAudioChannels(int);
99  QString playerDeinterlacer() const;
100  void setPlayerDeinterlacer(const QString&);
101  QString playerExternal() const;
102  void setPlayerExternal(const QString&);
103  QString playerGamma() const;
104  void setPlayerGamma(const QString&);
105  bool playerGPU() const;
106  void setPlayerGPU(bool);
107  bool playerWarnGPU() const;
108  QString playerInterpolation() const;
109  void setPlayerInterpolation(const QString&);
110  bool playerJACK() const;
111  void setPlayerJACK(bool);
112  int playerKeyerMode() const;
113  void setPlayerKeyerMode(int);
114  bool playerMuted() const;
115  void setPlayerMuted(bool);
116  QString playerProfile() const;
117  void setPlayerProfile(const QString&);
118  bool playerProgressive() const;
119  void setPlayerProgressive(bool);
120  bool playerRealtime() const;
121  void setPlayerRealtime(bool);
122  bool playerScrubAudio() const;
123  void setPlayerScrubAudio(bool);
124  int playerVolume() const;
125  void setPlayerVolume(int);
126  float playerZoom() const;
127  void setPlayerZoom(float);
128 
129  QString playlistThumbnails() const;
130  void setPlaylistThumbnails(const QString&);
131  bool playlistAutoplay() const;
132  void setPlaylistAutoplay(bool);
133 
134  bool timelineShowWaveforms() const;
135  void setTimelineShowWaveforms(bool);
136  bool timelineShowThumbnails() const;
137  void setTimelineShowThumbnails(bool);
138 
139  bool timelineRipple() const;
140  void setTimelineRipple(bool);
141  bool timelineRippleAllTracks() const;
142  void setTimelineRippleAllTracks(bool);
143  bool timelineSnap() const;
144  void setTimelineSnap(bool);
145  bool timelineCenterPlayhead() const;
146  void setTimelineCenterPlayhead(bool);
147  int timelineTrackHeight() const;
148  void setTimelineTrackHeight(int);
149 
150  QString filterFavorite(const QString& filterName);
151  void setFilterFavorite(const QString& filterName, const QString& value);
152 
153  double audioInDuration() const;
154  void setAudioInDuration(double);
155 
156  double audioOutDuration() const;
157  void setAudioOutDuration(double);
158 
159  double videoInDuration() const;
160  void setVideoInDuration(double);
161 
162  double videoOutDuration() const;
163  void setVideoOutDuration(double);
164 
165  bool loudnessScopeShowMeter(const QString& meter) const;
166  void setLoudnessScopeShowMeter(const QString& meter, bool b);
167 
168  int drawMethod() const;
169  void setDrawMethod(int);
170 
171  bool noUpgrade() const;
172  void setNoUpgrade(bool value);
173  bool checkUpgradeAutomatic();
174  void setCheckUpgradeAutomatic(bool b);
175  bool askUpgradeAutmatic();
176  void setAskUpgradeAutomatic(bool b);
177 
178  void sync();
179  QString appDataLocation() const;
180  static void setAppDataForSession(const QString& location);
181  void setAppDataLocally(const QString& location);
182 
183  QStringList layouts() const;
184  bool setLayout(const QString& name, const QByteArray& geometry, const QByteArray& state);
185  QByteArray layoutGeometry(const QString& name);
186  QByteArray layoutState(const QString& name);
187  bool removeLayout(const QString& name);
188 
189  bool clearRecent() const;
190  void setClearRecent(bool);
191 
192  QString projectsFolder() const;
193  void setProjectsFolder(const QString& path);
194 
195  int undoLimit() const;
196 
197 signals:
198  void openPathChanged();
199  void savePathChanged();
200  void timelineShowWaveformsChanged();
201  void timelineShowThumbnailsChanged();
202  void timelineRippleChanged();
203  void timelineRippleAllTracksChanged();
204  void timelineSnapChanged();
205  void timelineCenterPlayheadChanged();
206  void playerAudioChannelsChanged(int);
207  void playerGpuChanged();
208  void audioInDurationChanged();
209  void audioOutDurationChanged();
210  void videoInDurationChanged();
211  void videoOutDurationChanged();
212  void playlistThumbnailsChanged();
213  void viewModeChanged();
214  void smallIconsChanged();
215 
216 private:
217  QSettings settings;
218  QString m_appDataLocation;
219 };
220 
221 #define Settings ShotcutSettings::singleton()
222 
223 #endif // SETTINGS_H