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