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