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