Sayonara Player
SettingKey.h
1 /* SettingKey.h */
2 
3 /* Copyright (C) 2011-2020 Michael Lugmair (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 enum class SettingKey : unsigned short
29 {
30  LFM_Active=0,
31  LFM_ScrobbleTimeSec,
32  LFM_Login,
33  LFM_Username,
34  LFM_Password,
35  LFM_Corrections,
36  LFM_ShowErrors,
37  LFM_SessionKey,
38  Eq_Last,
39  Eq_List,
40  Eq_Gauss,
41  Lib_Show,
42  Lib_Path,
43  Lib_ColStateAlbums,
44  Lib_ColStateArtists,
45  Lib_ColStateTracks,
46  Lib_LiveSearch,
47  Lib_Sorting,
48  Lib_CurPlugin,
49  Lib_SplitterStateArtist,
50  Lib_SplitterStateTrack,
51  Lib_SplitterStateGenre,
52  Lib_SplitterStateDate,
53  Lib_OldWidth,
54  Lib_DC_DoNothing,
55  Lib_DC_PlayIfStopped,
56  Lib_DC_PlayImmediately,
57  Lib_DD_DoNothing,
58  Lib_DD_PlayIfStoppedAndEmpty,
59  Lib_FontSize,
60  Lib_FontBold,
61  Lib_SearchMode,
62  Lib_AutoUpdate,
63  Lib_ShowAlbumArtists,
64  Lib_ShowAlbumCovers,
65  Lib_ViewType,
66  Lib_CoverZoom,
67  Lib_CoverShowUtils,
68  Lib_CoverShowArtist,
69  Lib_CoverOrigPMCache,
70  Lib_CoverScaledPMCache,
71  Lib_GenreTree,
72  Lib_LastIndex,
73  Lib_AllLibraries,
74  Lib_UseViewClearButton,
75  Lib_ShowFilterExtBar,
76  Lib_SortIgnoreArtistArticle,
77  Lib_HeaderAutoResizeArtists,
78  Lib_HeaderAutoResizeAlbums,
79  Lib_HeaderAutoResizeTracks,
80  Dir_ShowTracks,
81  Dir_SplitterDirFile,
82  Dir_SplitterTracks,
83  Dir_TagToFilenameExpression,
84  Player_Version,
85  Player_Language,
86  Player_FontName,
87  Player_FontSize,
88  Player_Style,
89  Player_MetaStyle,
90  Player_FadingCover,
91  Player_ControlStyle,
92  Player_Geometry,
93  Player_Fullscreen,
94  Player_Maximized,
95  Player_ShownPlugin,
96  Player_OneInstance,
97  Player_Min2Tray,
98  Player_StartInTray,
99  Player_ShowTrayIcon,
100  Player_514Fix,
101  Player_NotifyNewVersion,
102  Player_SplitterState,
103  Player_SplitterControls,
104  Player_PrivId,
105  Player_PublicId,
106  PL_EntryLook,
107  PL_FontSize,
108  PL_LastTrack,
109  PL_LastTrackBeforeStop,
110  PL_LastPlaylist,
111  PL_LoadLastTrack,
112  PL_LoadSavedPlaylists,
113  PL_LoadTemporaryPlaylists,
114  PL_Mode,
115  PL_Playlist,
116  PL_RememberTime,
117  PL_RememberTrackAfterStop,
118  PL_ShowClearButton,
119  PL_ShowCovers,
120  PL_ShowNumbers,
121  PL_ShowBottomBar,
122  PL_ShowRating,
123  PL_StartPlaying,
124  Notification_Show,
125  Notification_Timeout,
126  Notification_Name,
127  Engine_Name,
128  Engine_Vol,
129  Engine_Mute,
130  AudioConvert_NumberThreads,
131  AudioConvert_PreferredConverter,
132  AudioConvert_QualityLameVBR,
133  AudioConvert_QualityLameCBR,
134  AudioConvert_QualityOgg,
135  Engine_CovertTargetPath,
136  Engine_SpectrumBins,
137  Engine_ShowSpectrum,
138  Engine_ShowLevel,
139  Engine_CurTrackPos_s,
140  Engine_CrossFaderActive,
141  Engine_CrossFaderTime,
142  Engine_Pitch,
143  Engine_PreservePitch,
144  Engine_Speed,
145  Engine_SpeedActive,
146  Engine_Sink,
147  Engine_AlsaDevice,
148  Engine_BufferSizeMS,
149  Engine_SR_Active,
150  Engine_SR_Warning,
151  Engine_SR_Path,
152  Engine_SR_SessionPath,
153  Engine_SR_SessionPathTemplate,
154  Engine_SR_AutoRecord,
155  Spectrum_Style,
156  Level_Style,
157  Broadcast_Active,
158  Broadcast_Prompt,
159  Broadcast_Port,
160  MP3enc_found,
161  Pitch_found,
162  Player_Quit,
163  Remote_Active,
164  Remote_Port,
165  Remote_Discoverable,
166  Remote_DiscoverPort,
167  Stream_NewTab,
168  Stream_ShowHistory,
169  Stream_SearchWindowSize,
170  Lyrics_Zoom,
171  Lyrics_Server,
172  Cover_Server,
173  Cover_FetchFromWWW,
174  Cover_SaveToDB,
175  Cover_StartSearch,
176  Cover_SaveToLibrary,
177  Cover_SaveToSayonaraDir,
178  Cover_TemplatePath,
179  Icon_Theme,
180  Icon_ForceInDarkTheme,
181  Proxy_Active,
182  Proxy_Username,
183  Proxy_Password,
184  Proxy_Hostname,
185  Proxy_Port,
186  Proxy_SavePw,
187  Speed_LastTab,
188  InfoDialog_Size,
189  AlternativeCovers_Size,
190  Logger_Level,
191  Settings_Revision,
192  Num_Setting_Keys
193 };
194 
195 class QString;
196 class QStringList;
197 class QPoint;
198 class QSize;
199 class QByteArray;
200 
201 class EqualizerSetting;
202 struct RawShortcutMap;
203 
204 namespace Playlist
205 {
206  class Mode;
207 }
208 
209 namespace Library
210 {
211  class Sortings;
212  class Info;
213  enum class ViewType : quint8;
214 }
215 
216 template<typename DataType, SettingKey keyIndex>
218 {
219  public:
220  using Data=DataType;
221  const static SettingKey key=keyIndex;
222 
223  private:
224  SettingIdentifier()=delete;
226 };
227 
228 
229 #define INST_ABSTR(ns, type, settingkey) \
230  namespace ns { \
231  using settingkey = SettingIdentifier<type, SettingKey:: settingkey>; \
232  }
233 
234 #define INST(type, settingkey) INST_ABSTR(Set, type, settingkey)
235 #define INST_NO_DB(type, settingkey) INST_ABSTR(SetNoDB, type, settingkey)
236 
241  INST(bool, LFM_Active) /* is lastFM active? */
242  INST(int, LFM_ScrobbleTimeSec) /* time in sec when to scrobble */
243  INST(StringPair, LFM_Login) /* deprecated: 2-Tupel, username, password */
244  INST(QString, LFM_Username) /* username*/
245  INST(QString, LFM_Password) /* encrypted password */
246 
247  INST(bool, LFM_Corrections) /* propose lfm corrections */
248  INST(bool, LFM_ShowErrors) /* get error message, if there are lfm problems */
249  INST(QString, LFM_SessionKey) /* lfm session key */
250 
251  INST(int, Eq_Last) /* last equalizer index */
252  INST(QList<EqualizerSetting>, Eq_List) /* All equalizers */
253  INST(bool, Eq_Gauss) /* do curve, when changing eq setting */
254 
255  INST(bool, Lib_Show) /* show library */
256  INST(QString, Lib_Path) // deprecated
257  INST(QByteArray, Lib_ColStateAlbums)
258  INST(QByteArray, Lib_ColStateArtists)
259  INST(QByteArray, Lib_ColStateTracks)
260  INST(bool, Lib_LiveSearch) /* library live search */
261  INST(::Library::Sortings, Lib_Sorting) /* how to sort in lib */
262  INST(QString, Lib_CurPlugin) /* Current shown library plugin */
263  INST(QByteArray, Lib_SplitterStateArtist) /* Splitter state between artists and albums */
264  INST(QByteArray, Lib_SplitterStateTrack) /* Splitter state between artists and tracks */
265  INST(QByteArray, Lib_SplitterStateGenre) /* Splitter state between tracks and genres */
266  INST(QByteArray, Lib_SplitterStateDate) /* Splitter state between tracks and genres */
267  INST(int, Lib_OldWidth) /* Old library width when hiding library */
268  INST(bool, Lib_DC_DoNothing) /* when double clicked, create playlist and do nothing*/
269  INST(bool, Lib_DC_PlayIfStopped) /* when double clicked, play if stopped */
270  INST(bool, Lib_DC_PlayImmediately) /* when double clicked, play immediately */
271  INST(bool, Lib_DD_DoNothing) /* when drag dropped, insert tracks and do nothing */
272  INST(bool, Lib_DD_PlayIfStoppedAndEmpty) /* when drag dropped, play if playlist is empty and stopped */
273  INST(int, Lib_FontSize) /* current library font size */
274  INST(bool, Lib_FontBold) /* current library font weight */
275  INST(int, Lib_SearchMode) /* Search mode in library. See */
276  INST(bool, Lib_AutoUpdate) /* Automatic update of library */
277  INST(bool, Lib_ShowAlbumArtists) /* Show album artists instead of artists */
278  INST(bool, Lib_ShowAlbumCovers) /* Show album cover view */
279  INST(::Library::ViewType, Lib_ViewType) /* Standard view, CoverView, LibraryView */
280  INST(int, Lib_CoverZoom) /* Zoom of album cover view */
281  INST(int, Lib_CoverOrigPMCache) /* Original sized pixmap cache */
282  INST(int, Lib_CoverScaledPMCache) /* Scaled sized pixmap cache */
283  INST(bool, Lib_CoverShowUtils) /* Show utils bar in cover view */
284  INST(bool, Lib_CoverShowArtist) /* Show artist name in cover view */
285  INST(bool, Lib_GenreTree) /* Show tree view of genres */
286  INST(QList<::Library::Info>, Lib_AllLibraries) // deprecated
287  INST(int, Lib_LastIndex) /* Last selected library */
288  INST(bool, Lib_UseViewClearButton) /* Show clear button in single view */
289  INST(bool, Lib_ShowFilterExtBar) /* Show the file extension filter bar in track view */
290  INST(bool, Lib_SortIgnoreArtistArticle) /* ignore article for artist */
291  INST(bool, Lib_HeaderAutoResizeArtists) /* resize columns automatically in artists */
292  INST(bool, Lib_HeaderAutoResizeAlbums) /* resize columns automatically in albums */
293  INST(bool, Lib_HeaderAutoResizeTracks) /* resize columns automatically in tracks */
294 
295  INST(bool, Dir_ShowTracks) /* show tracks panel in directory view */
296  INST(QByteArray, Dir_SplitterDirFile) /* Splitter state between dirs and files */
297  INST(QByteArray, Dir_SplitterTracks) /* Splitter between upper and track view */
298  INST(QString, Dir_TagToFilenameExpression) /* Last used expression when converting tags to filename */
299 
300  INST(QString, Player_Version) /* Version string of player */
301  INST(QString, Player_Language) /* language of player */
302  INST(int, Player_Style) /* dark or native: native = 0, dark = 1 */
303  INST(int, Player_ControlStyle) /* Big cover or not */
304  INST(QString, Player_FontName) /* current font name */
305  INST(int, Player_FontSize) /* current font size */
306  INST(bool, Player_FadingCover) /* If cover buttons should fade */
307  INST(bool, Player_Fullscreen) /* player fullscreen */
308  INST(bool, Player_Maximized) /* player maximized */
309  INST(QByteArray, Player_Geometry) /* player geometry */
310  INST(QString, Player_ShownPlugin) /* current shown plugin in player, empty if none */
311  INST(bool, Player_OneInstance) /* only one Sayonara instance is allowed */
312  INST(bool, Player_Min2Tray) /* minimize Sayonara to tray */
313  INST(bool, Player_ShowTrayIcon) /* Show/hide the tray icon */
314  INST(bool, Player_StartInTray) /* start in tray */
315  INST(bool, Player_514Fix) /* https://bugs.archlinux.org/task/59451 */
316  INST(bool, Player_NotifyNewVersion) /* check for new version on startup */
317  INST(QByteArray, Player_SplitterState) /* spliter state between playlist and library */
318  //INST(RawShortcutMap, Player_Shortcuts) /* player shortcuts */
319  INST(QByteArray, Player_SplitterControls) /* Splitter state between controls and playlist */
320  INST(QByteArray, Player_PrivId) /* Unique identifier */
321  INST(QByteArray, Player_PublicId) /* Unique identifier */
322 
323  INST(QStringList, PL_Playlist) /* old playlist: list of integers in case of library tracks, if no library track, filepath */
324  INST(bool, PL_LoadSavedPlaylists) /* load saved playlists on startup */
325  INST(bool, PL_LoadTemporaryPlaylists) /* load temporary playlists on startup */
326  INST(bool, PL_LoadLastTrack) /* load last track on startup */
327  INST(bool, PL_RememberTime) /* remember time of last track */
328  INST(bool, PL_StartPlaying) /* start playing immediately when opening Sayonara */
329  INST(int, PL_LastTrack) /* last track idx in playlist */
330  INST(int, PL_LastTrackBeforeStop) /* last track before stop */
331  INST(int, PL_LastPlaylist) /* last Playlist id, where LastTrack has been played */
332  INST(QString, PL_EntryLook) /* formatting of playlist entry */
333  INST(int, PL_FontSize) /* current playlist font size */
334  INST(bool, PL_ShowClearButton) /* show clear button in playlist */
335  INST(Playlist::Mode, PL_Mode) /* playlist mode: rep1, repAll, shuffle... */
336  INST(bool, PL_ShowNumbers) /* show numbers in playlist */
337  INST(bool, PL_ShowBottomBar) /* Show bottom bar in playlist */
338  INST(bool, PL_RememberTrackAfterStop) /* when stop button is pressed, remember last track index */
339  INST(bool, PL_ShowCovers) /* Show covers in Playlist */
340  INST(bool, PL_ShowRating) /* Show rating in playlist */
341 
342  INST(bool, Notification_Show) /* show notifications */
343  INST(int, Notification_Timeout) /* notification timeout */
344  INST(QString, Notification_Name) /* type of notifications: libnotify or empty for native baloons :( */
345 
346  INST(int, AudioConvert_NumberThreads) /* Number of threads */
347  INST(QString, AudioConvert_PreferredConverter) /* Preferred Converter: ogg, lame cbr, lame vbr */
348  INST(int, AudioConvert_QualityLameVBR) /* Lame Quality for variable bitrate 1-10 */
349  INST(int, AudioConvert_QualityLameCBR) /* 64 - 320 */
350  INST(int, AudioConvert_QualityOgg) /* 1 - 10 */
351 
352  INST(QString, Engine_Name) /* Deprecated: Engine name */
353  INST(int, Engine_Vol) /* Volume */
354  INST(bool, Engine_Mute) /* Muted/unmuted */
355  INST(int, Engine_CurTrackPos_s) /* position of track (used to load old position) */
356  INST(QString, Engine_CovertTargetPath) /* last convert path */
357  INST(int, Engine_SpectrumBins) /* number of spectrum bins */
358  INST(bool, Engine_ShowSpectrum) /* show spectrum */
359  INST(bool, Engine_ShowLevel) /* show level */
360  INST(bool, Engine_CrossFaderActive) /* crossfader, but not gapless active */
361  INST(int, Engine_CrossFaderTime) /* crossfader overlap time */
362  INST(int, Engine_Pitch) /* hertz of a */
363  INST(bool, Engine_SpeedActive) /* is speed control active? */
364  INST(float, Engine_Speed) /* if yes, set speed */
365  INST(bool, Engine_PreservePitch) /* if yes, should pitch be preserved? */
366  INST(QString, Engine_Sink) /* Alsa, pulseaudio */
367  INST(QString, Engine_AlsaDevice) /* Specific alsa device */
368  INST(int, Engine_BufferSizeMS) /* Buffer size for streaming */
369 
370  INST(bool, Engine_SR_Active) /* Streamripper active */
371  INST(bool, Engine_SR_Warning) /* streamripper warnings */
372  INST(QString, Engine_SR_Path) /* streamripper paths */
373  INST(bool, Engine_SR_SessionPath) /* create streamripper session path? */
374  INST(QString, Engine_SR_SessionPathTemplate) /* streamripper session path template*/
375  INST(bool, Engine_SR_AutoRecord) /* streamripper automatic recording */
376 
377  INST(int, Spectrum_Style) /* index of spectrum style */
378  INST(int, Level_Style) /* index of level style */
379  INST(bool, Broadcast_Active) /* is broadcast active? */
380  INST(bool, Broadcast_Prompt) /* prompt when new connection arrives? */
381  INST(int, Broadcast_Port) /* broadcast port */
382 
383  INST(bool, Remote_Active) /* Remote control activated */
384  INST(int, Remote_Port) /* Remote control port */
385  INST(bool, Remote_Discoverable) /* broadcast is discoverable via UDP */
386  INST(int, Remote_DiscoverPort) /* UDP port for remote discovering */
387 
388  INST(bool, Stream_NewTab) /* Open Streams in new tab */
389  INST(bool, Stream_ShowHistory) /* Show history when playing streams */
390  INST(QSize, Stream_SearchWindowSize)
391 
392  INST(int, Lyrics_Zoom) /* Zoom factor in lyrics window */
393  INST(QString, Lyrics_Server) /* Lyrics server */
394 
395  INST(QStringList, Cover_Server) /* Cover server */
396  INST(bool, Cover_FetchFromWWW) /* Fetch covers from www */
397  INST(bool, Cover_SaveToDB) /* Save covers to DB */
398  INST(bool, Cover_StartSearch) /* start alternative cover search automatically */
399  INST(bool, Cover_SaveToLibrary) /* Save covers in library */
400  INST(bool, Cover_SaveToSayonaraDir) /* Save covers in library */
401  INST(QString, Cover_TemplatePath) /* Name of cover file in library */
402  INST(QString, Icon_Theme) /* Current icon theme */
403  INST(bool, Icon_ForceInDarkTheme) /* Current icon theme */
404 
405  INST(bool, Proxy_Active) /* Is proxy server active */
406  INST(QString, Proxy_Username) /* Proxy Username */
407  INST(QString, Proxy_Password) /* Proxy Password */
408  INST(QString, Proxy_Hostname) /* Proxy Hostname/IP Address */
409  INST(int, Proxy_Port) /* Proxy Port 3128 */
410  INST(bool, Proxy_SavePw) /* Should password be saved */
411 
412  INST(int, Speed_LastTab) /* Last tab selected int he speed/pitch plugin */
413 
414  INST(QSize, InfoDialog_Size) /* Size of Info Dialog */
415  INST(QSize, AlternativeCovers_Size) /* Size of Alternative Cover Dialog */
416 
417  INST(int, Settings_Revision) /* Version number of settings */
418 
419  INST(int, Logger_Level) /* Also log development: */
420 
421  INST_NO_DB(bool, MP3enc_found)
422  INST_NO_DB(bool, Pitch_found)
423  INST_NO_DB(bool, Player_Quit)
424  INST_NO_DB(int, Player_MetaStyle) /* Whenever some value which is associated with style changes */
425 
426 #endif // SETTINGKEY_H
QPair
Definition: typedefs.h:32
Library::Sortings
The Sortings class.
Definition: Sorting.h:37
INST
INST(bool, LFM_Active) INST(int
Set namespace defines the setting: Which key and which type.
QList
Definition: EngineUtils.h:33
EqualizerSetting
The EQ_Setting class. Container for Equalizer configurations.
Definition: EqualizerSetting.h:37
SettingIdentifier
Definition: SettingKey.h:218
Library
An interface class needed when implementing a library plugin.
Definition: LocalLibraryWatcher.h:31
Playlist::Mode
The Mode class.
Definition: PlaylistMode.h:42
RawShortcutMap
The RawShortcutMap struct consisting of a specifier writable into database and a shortcut....
Definition: RawShortcutMap.h:38