Sayonara Player
SettingKey.h
1 /* SettingKey.h */
2 
3 /* Copyright (C) 2011-2017 Lucio Carreras
4  *
5  * This file is part of sayonara player
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16 
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21  // clazy:excludeall=non-pod-global-static
22 
23 #ifndef SETTINGKEY_H
24 #define SETTINGKEY_H
25 
26 #include "Utils/typedefs.h"
27 
28 class QString;
29 class QStringList;
30 class QPoint;
31 class QSize;
32 class QByteArray;
33 
34 class EQ_Setting;
35 struct RawShortcutMap;
36 
37 namespace Playlist
38 {
39  class Mode;
40 }
41 
42 namespace Library
43 {
44  class Sortings;
45  class Info;
46 }
47 
48 
53 enum class SettingKey : unsigned short
54 {
55  LFM_Active=0,
56  LFM_ScrobbleTimeSec,
57  LFM_Login,
58  LFM_Username,
59  LFM_Password,
60  LFM_Corrections,
61  LFM_ShowErrors,
62  LFM_SessionKey,
63 
64  Eq_Last,
65  Eq_List,
66  Eq_Gauss,
67 
68  Lib_Show,
69  Lib_Path,
70  Lib_ColsTitle,
71  Lib_ColsArtist,
72  Lib_ColsAlbum,
73  Lib_LiveSearch,
74  Lib_Sorting,
75  Lib_CurPlugin,
76  Lib_SplitterStateArtist,
77  Lib_SplitterStateTrack,
78  Lib_SplitterStateGenre,
79  Lib_SplitterStateDate,
80  Lib_OldWidth,
81  Lib_DC_DoNothing,
82  Lib_DC_PlayIfStopped,
83  Lib_DC_PlayImmediately,
84  Lib_DD_DoNothing,
85  Lib_DD_PlayIfStoppedAndEmpty,
86  Lib_FontSize,
87  Lib_FontBold,
88  Lib_SearchMode,
89  Lib_AutoUpdate,
90  Lib_ShowAlbumArtists,
91  Lib_ShowAlbumCovers,
92  Lib_CoverZoom,
93  Lib_CoverShowUtils,
94  Lib_CoverShowArtist,
95  Lib_GenreTree,
96  Lib_LastIndex,
97  Lib_AllLibraries, // deprecated
98  Lib_UseViewClearButton,
99 
100  Dir_ShowTracks,
101  Dir_SplitterDirFile,
102  Dir_SplitterTracks,
103 
104  Player_Version,
105  Player_Language,
106  Player_FontName,
107  Player_FontSize,
108  Player_Style,
109  Player_ControlStyle,
110  Player_Size,
111  Player_Pos,
112  Player_Fullscreen,
113  Player_Maximized,
114  Player_ShownPlugin,
115  Player_OneInstance,
116  Player_Min2Tray,
117  Player_StartInTray,
118  Player_ShowTrayIcon,
119  Player_NotifyNewVersion,
120  Player_SplitterState,
121  Player_Shortcuts,
122  Player_SplitterControls,
123  Player_PrivId,
124  Player_PublicId,
125 
126  PL_Playlist,
127  PL_LoadSavedPlaylists,
128  PL_LoadTemporaryPlaylists,
129  PL_LoadLastTrack,
130  PL_RememberTime,
131  PL_StartPlaying,
132  PL_LastTrack,
133  PL_LastTrackBeforeStop,
134  PL_LastPlaylist,
135  PL_Mode,
136  PL_ShowNumbers,
137  PL_EntryLook,
138  PL_FontSize,
139  PL_ShowClearButton,
140  PL_RememberTrackAfterStop,
141  PL_ShowCovers,
142  PL_ShowRating,
143 
144  Notification_Show,
145  Notification_Timeout,
146  Notification_Name,
147 
148  Engine_Name,
149  Engine_Vol,
150  Engine_Mute,
151  Engine_ConvertQuality,
152  Engine_CovertTargetPath,
153  Engine_SpectrumBins,
154  Engine_ShowSpectrum,
155  Engine_ShowLevel,
156  Engine_CurTrackPos_s,
157  Engine_CrossFaderActive,
158  Engine_CrossFaderTime,
159  Engine_Pitch,
160  Engine_PreservePitch,
161  Engine_Speed,
162  Engine_SpeedActive,
163  Engine_Sink,
164 
165  Engine_SR_Active,
166  Engine_SR_Warning,
167  Engine_SR_Path,
168  Engine_SR_SessionPath,
169  Engine_SR_SessionPathTemplate,
170  Engine_SR_AutoRecord,
171 
172  Spectrum_Style,
173  Level_Style,
174 
175  Broadcast_Active,
176  Broadcast_Prompt,
177  Broadcast_Port,
178 
179  MP3enc_found,
180  Pitch_found,
181  Player_Quit,
182 
183  Remote_Active,
184  Remote_Port,
185 
186  Stream_NewTab,
187  Stream_ShowHistory,
188 
189  Lyrics_Zoom,
190  Lyrics_Server,
191 
192  Cover_Server,
193  Cover_LoadFromFile,
194  Cover_StartSearch,
195  Icon_Theme,
196  Icon_ForceInDarkTheme,
197 
198  Proxy_Active,
199  Proxy_Username,
200  Proxy_Password,
201  Proxy_Hostname,
202  Proxy_Port,
203  Proxy_SavePw,
204 
205  Logger_Level,
206  Settings_Revision,
207 
208  Num_Setting_Keys
209 };
210 
211 
212 template<typename DataType, SettingKey keyIndex>
214 {
215 public:
216  using Data=DataType;
217  const static SettingKey key=keyIndex;
218 
219 private:
220  SettingIdentifier()=delete;
222 };
223 
224 #define INST(type, settingkey) using settingkey = SettingIdentifier<type, SettingKey:: settingkey>;
225 
230 namespace Set
231 {
232  //typedef SettingKey<bool, SK::LFM_Active> LFM_Active_t; const LFM_Active_t LFM_Active
233  INST(bool, LFM_Active) /* is lastFM active? */
234  INST(int, LFM_ScrobbleTimeSec) /* time in sec when to scrobble */
235  INST(StringPair, LFM_Login) /* deprecated: 2-Tupel, username, password */
236  INST(QString, LFM_Username) /* username*/
237  INST(QString, LFM_Password) /* encrypted password */
238 
239  INST(bool, LFM_Corrections) /* propose lfm corrections */
240  INST(bool, LFM_ShowErrors) /* get error message, if there are lfm problems */
241  INST(QString, LFM_SessionKey) /* lfm session key */
242 
243  INST(int, Eq_Last) /* last equalizer index */
244  INST(QList<EQ_Setting>, Eq_List) /* All equalizers */
245  INST(bool, Eq_Gauss) /* do curve, when changing eq setting */
246 
247  INST(bool, Lib_Show) /* show library */
248  INST(QString, Lib_Path) // deprecated
249  INST(BoolList, Lib_ColsTitle) /* shown columns tracks */
250  INST(BoolList, Lib_ColsArtist) /* shown columns artist */
251  INST(BoolList, Lib_ColsAlbum) /* shown columns albums */
252  INST(bool, Lib_LiveSearch) /* library live search */
253  INST(::Library::Sortings, Lib_Sorting) /* how to sort in lib */
254  INST(QString, Lib_CurPlugin) /* Current shown library plugin */
255  INST(QByteArray, Lib_SplitterStateArtist) /* Splitter state between artists and albums */
256  INST(QByteArray, Lib_SplitterStateTrack) /* Splitter state between artists and tracks */
257  INST(QByteArray, Lib_SplitterStateGenre) /* Splitter state between tracks and genres */
258  INST(QByteArray, Lib_SplitterStateDate) /* Splitter state between tracks and genres */
259  INST(int, Lib_OldWidth) /* Old library width when hiding library */
260  INST(bool, Lib_DC_DoNothing) /* when double clicked, create playlist and do nothing*/
261  INST(bool, Lib_DC_PlayIfStopped) /* when double clicked, play if stopped */
262  INST(bool, Lib_DC_PlayImmediately) /* when double clicked, play immediately */
263  INST(bool, Lib_DD_DoNothing) /* when drag dropped, insert tracks and do nothing */
264  INST(bool, Lib_DD_PlayIfStoppedAndEmpty) /* when drag dropped, play if playlist is empty and stopped */
265  INST(int, Lib_FontSize) /* current library font size */
266  INST(bool, Lib_FontBold) /* current library font weight */
267  INST(int, Lib_SearchMode) /* Search mode in library. See */
268  INST(bool, Lib_AutoUpdate) /* Automatic update of library */
269  INST(bool, Lib_ShowAlbumArtists) /* Show album artists instead of artists */
270  INST(bool, Lib_ShowAlbumCovers) /* Show album cover view */
271  INST(int, Lib_CoverZoom) /* Zoom of album cover view */
272  INST(bool, Lib_CoverShowUtils) /* Show utils bar in cover view */
273  INST(bool, Lib_CoverShowArtist) /* Show artist name in cover view */
274  INST(bool, Lib_GenreTree) /* Show tree view of genres */
275  INST(QList<::Library::Info>, Lib_AllLibraries) // deprecated
276  INST(int, Lib_LastIndex) /* Last selected library */
277  INST(bool, Lib_UseViewClearButton) /* Show clear button in single view */
278 
279  INST(bool, Dir_ShowTracks) /* show tracks panel in directory view */
280  INST(QByteArray, Dir_SplitterDirFile) /* Splitter state between dirs and files */
281  INST(QByteArray, Dir_SplitterTracks) /* Splitter between upper and track view */
282 
283 
284  INST(QString, Player_Version) /* Version string of player */
285  INST(QString, Player_Language) /* language of player */
286  INST(int, Player_Style) /* dark or native: native = 0, dark = 1 */
287  INST(int, Player_ControlStyle) /* Big cover or not */
288  INST(QString, Player_FontName) /* current font name */
289  INST(int, Player_FontSize) /* current font size */
290  INST(QSize, Player_Size) /* player size */
291  INST(QPoint, Player_Pos) /* player position */
292  INST(bool, Player_Fullscreen) /* player fullscreen */
293  INST(bool, Player_Maximized) /* player maximized */
294  INST(QString, Player_ShownPlugin) /* current shown plugin in player, empty if none */
295  INST(bool, Player_OneInstance) /* only one Sayonara instance is allowed */
296  INST(bool, Player_Min2Tray) /* minimize Sayonara to tray */
297  INST(bool, Player_ShowTrayIcon) /* Show/hide the tray icon */
298  INST(bool, Player_StartInTray) /* start in tray */
299  INST(bool, Player_NotifyNewVersion) /* check for new version on startup */
300  INST(QByteArray, Player_SplitterState) /* spliter state between playlist and library */
301  INST(RawShortcutMap, Player_Shortcuts) /* player shortcuts */
302  INST(QByteArray, Player_SplitterControls) /* Splitter state between controls and playlist */
303  INST(QByteArray, Player_PrivId) /* Unique identifier */
304  INST(QByteArray, Player_PublicId) /* Unique identifier */
305 
306  INST(QStringList, PL_Playlist) /* old playlist: list of integers in case of library tracks, if no library track, filepath */
307  INST(bool, PL_LoadSavedPlaylists) /* load saved playlists on startup */
308  INST(bool, PL_LoadTemporaryPlaylists) /* load temporary playlists on startup */
309  INST(bool, PL_LoadLastTrack) /* load last track on startup */
310  INST(bool, PL_RememberTime) /* remember time of last track */
311  INST(bool, PL_StartPlaying) /* start playing immediately when opening Sayonara */
312  INST(int, PL_LastTrack) /* last track idx in playlist */
313  INST(int, PL_LastTrackBeforeStop) /* last track before stop */
314  INST(int, PL_LastPlaylist) /* last Playlist id, where LastTrack has been played */
315  INST(QString, PL_EntryLook) /* formatting of playlist entry */
316  INST(int, PL_FontSize) /* current playlist font size */
317  INST(bool, PL_ShowClearButton) /* show clear button in playlist */
318  INST(Playlist::Mode, PL_Mode) /* playlist mode: rep1, repAll, shuffle... */
319  INST(bool, PL_ShowNumbers) /* show numbers in playlist */
320  INST(bool, PL_RememberTrackAfterStop) /* when stop button is pressed, remember last track index */
321  INST(bool, PL_ShowCovers) /* Show covers in Playlist */
322  INST(bool, PL_ShowRating) /* Show rating in playlist */
323 
324  INST(bool, Notification_Show) /* show notifications */
325  INST(int, Notification_Timeout) /* notification timeout */
326  INST(QString, Notification_Name) /* type of notifications: libnotify or empty for native baloons :( */
327 
328  INST(QString, Engine_Name) /* Deprecated: Engine name */
329  INST(int, Engine_Vol) /* Volume */
330  INST(bool, Engine_Mute) /* Muted/unmuted */
331  INST(int, Engine_CurTrackPos_s) /* position of track (used to load old position) */
332  INST(int, Engine_ConvertQuality) /* Convert quality, 1-10 for variable, > 64 for fixed bitrate */
333  INST(QString, Engine_CovertTargetPath) /* last convert path */
334  INST(int, Engine_SpectrumBins) /* number of spectrum bins */
335  INST(bool, Engine_ShowSpectrum) /* show spectrum */
336  INST(bool, Engine_ShowLevel) /* show level */
337  INST(bool, Engine_CrossFaderActive) /* crossfader, but not gapless active */
338  INST(int, Engine_CrossFaderTime) /* crossfader overlap time */
339  INST(int, Engine_Pitch) /* hertz of a */
340  INST(bool, Engine_SpeedActive) /* is speed control active? */
341  INST(float, Engine_Speed) /* if yes, set speed */
342  INST(bool, Engine_PreservePitch) /* if yes, should pitch be preserved? */
343  INST(QString, Engine_Sink) /* Alsa, pulseaudio */
344 
345  INST(bool, Engine_SR_Active) /* Streamripper active */
346  INST(bool, Engine_SR_Warning) /* streamripper warnings */
347  INST(QString, Engine_SR_Path) /* streamripper paths */
348  INST(bool, Engine_SR_SessionPath) /* create streamripper session path? */
349  INST(QString, Engine_SR_SessionPathTemplate) /* streamripper session path template*/
350  INST(bool, Engine_SR_AutoRecord) /* streamripper automatic recording */
351 
352  INST(int, Spectrum_Style) /* index of spectrum style */
353  INST(int, Level_Style) /* index of level style */
354  INST(bool, Broadcast_Active) /* is broadcast active? */
355  INST(bool, Broadcast_Prompt) /* prompt when new connection arrives? */
356  INST(int, Broadcast_Port) /* broadcast port */
357 
358  INST(bool, Remote_Active) /* Remote control activated */
359  INST(int, Remote_Port) /* Remote control port */
360 
361  INST(bool, Stream_NewTab) /* Open Streams in new tab */
362  INST(bool, Stream_ShowHistory) /* Show history when playing streams */
363 
364  INST(int, Lyrics_Zoom) /* Zoom factor in lyrics window */
365  INST(QString, Lyrics_Server) /* Lyrics server */
366 
367  INST(QStringList, Cover_Server) /* Cover server */
368  INST(bool, Cover_LoadFromFile) /* load covers from audio file, if available */
369  INST(bool, Cover_StartSearch) /* start alternative cover search automatically */
370  INST(QString, Icon_Theme) /* Current icon theme */
371  INST(bool, Icon_ForceInDarkTheme) /* Current icon theme */
372 
373  INST(bool, Proxy_Active) /* Is proxy server active */
374  INST(QString, Proxy_Username) /* Proxy Username */
375  INST(QString, Proxy_Password) /* Proxy Password */
376  INST(QString, Proxy_Hostname) /* Proxy Hostname/IP Address */
377  INST(int, Proxy_Port) /* Proxy Port 3128 */
378  INST(bool, Proxy_SavePw) /* Should password be saved */
379 
380  INST(int, Settings_Revision) /* Version number of settings */
381 
382  INST(int, Logger_Level) /* Also log development: */
383 }
384 
385 namespace SetNoDB
386 {
387  INST(bool, MP3enc_found)
388  INST(bool, Pitch_found)
389  INST(bool, Player_Quit)
390 }
391 
392 #endif // SETTINGKEY_H
The Mode class.
Definition: PlaylistMode.h:32
SettingKey
The SK namespace is used to access setting keys.
Definition: SettingKey.h:53
The Sortings class.
Definition: Sorting.h:33
The EQ_Setting class. Container for Equalizer configurations.
Definition: EqualizerPresets.h:33
Set namespace defines the setting: Which key and which type.
Definition: SettingKey.h:230
Definition: typedefs.h:28
An interface class needed when implementing a library plugin.
Definition: CachingThread.h:31
The RawShortcutMap struct consisting of a specifier writable into database and a shortcut....
Definition: RawShortcutMap.h:35
Definition: SettingKey.h:213
Definition: org_mpris_media_player2_adaptor.h:20