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