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 #ifndef SETTINGKEY_H
22 #define SETTINGKEY_H
23 
24 #include "Helper/typedefs.h"
25 
26 class QString;
27 class QStringList;
28 class QPoint;
29 class QSize;
30 
31 class EQ_Setting;
32 struct RawShortcutMap;
33 
34 namespace Playlist
35 {
36  class Mode;
37 }
38 
39 namespace Library
40 {
41  class Sortings;
42  class DateFilter;
43 }
44 
45 
50 namespace SK {
51  enum SettingKey {
52  LFM_Active=0,
53  LFM_ScrobbleTimeSec,
54  LFM_Login,
55  LFM_Corrections,
56  LFM_ShowErrors,
57  LFM_SessionKey,
58 
59  Eq_Last,
60  Eq_List,
61  Eq_Gauss,
62 
63  Lib_Show,
64  Lib_Path,
65  Lib_ColsTitle,
66  Lib_ColsArtist,
67  Lib_ColsAlbum,
68  Lib_LiveSearch,
69  Lib_Sorting,
70  Lib_CurPlugin,
71  Lib_SplitterStateArtist,
72  Lib_SplitterStateTrack,
73  Lib_SplitterStateGenre,
74  Lib_SplitterStateDate,
75  Lib_OldWidth,
76  Lib_DC_DoNothing,
77  Lib_DC_PlayIfStopped,
78  Lib_DC_PlayImmediately,
79  Lib_DD_DoNothing,
80  Lib_DD_PlayIfStoppedAndEmpty,
81  Lib_FontSize,
82  Lib_FontBold,
83  Lib_SearchMode,
84  Lib_AutoUpdate,
85  Lib_DateFilters,
86  Lib_ShowAlbumArtists,
87  Lib_ShowAlbumCovers,
88  Lib_CoverZoom,
89  Lib_GenreTree,
90 
91  Player_Version,
92  Player_Language,
93  Player_FontName,
94  Player_FontSize,
95  Player_Style,
96  Player_Size,
97  Player_Pos,
98  Player_Fullscreen,
99  Player_Maximized,
100  Player_ShownPlugin,
101  Player_OneInstance,
102  Player_Min2Tray,
103  Player_StartInTray,
104  Player_ShowTrayIcon,
105  Player_NotifyNewVersion,
106  Player_SplitterState,
107  Player_Shortcuts,
108 
109  PL_Playlist,
110  PL_LoadSavedPlaylists,
111  PL_LoadTemporaryPlaylists,
112  PL_LoadLastTrack,
113  PL_RememberTime,
114  PL_StartPlaying,
115  PL_LastTrack,
116  PL_LastPlaylist,
117  PL_Mode,
118  PL_ShowNumbers,
119  PL_EntryLook,
120  PL_FontSize,
121  PL_ShowClearButton,
122 
123  Notification_Show,
124  Notification_Timeout,
125  Notification_Name,
126 
127  Engine_Name,
128  Engine_Vol,
129  Engine_Mute,
130  Engine_ConvertQuality,
131  Engine_CovertTargetPath,
132  Engine_SpectrumBins,
133  Engine_ShowSpectrum,
134  Engine_ShowLevel,
135  Engine_CurTrackPos_s,
136  Engine_CrossFaderActive,
137  Engine_CrossFaderTime,
138  Engine_Pitch,
139  Engine_PreservePitch,
140  Engine_Speed,
141  Engine_SpeedActive,
142 
143  Engine_SR_Active,
144  Engine_SR_Warning,
145  Engine_SR_Path,
146  Engine_SR_SessionPath,
147  Engine_SR_AutoRecord,
148 
149 
150  Spectrum_Style,
151  Level_Style,
152 
153  Broadcast_Active,
154  Broadcast_Prompt,
155  Broadcast_Port,
156 
157  MP3enc_found,
158  Pitch_found,
159  Player_Quit,
160 
161  Remote_Active,
162  Remote_Port,
163 
164  Lyrics_Zoom,
165  Lyrics_Server,
166 
167  Cover_Server,
168 
169  Num_Setting_Keys
170  };
171 }
172 
173 template<typename T, SK::SettingKey S>
175 {
176  public:
177  T* p=nullptr;
178  SettingKey() {}
179  ~SettingKey() {}
180 };
181 
182 
183 /*
184  * typedef SettingKey<QString, SK::Lib_Path> LibPath_t; LibPath_t LibPath;
185  *
186  */
187 
194 #define INST(type, settingkey) typedef SettingKey<type, SK:: settingkey> settingkey##_t; const settingkey##_t settingkey
195 
200 namespace Set
201 {
202  //typedef SettingKey<bool, SK::LFM_Active> LFM_Active_t; const LFM_Active_t LFM_Active
203  INST(bool, LFM_Active); /* is lastFM active? */
204  INST(int, LFM_ScrobbleTimeSec); /* time in sec when to scrobble */
205  INST(StringPair, LFM_Login); /* 2-Tupel, username, password */
206 
207  INST(bool, LFM_Corrections); /* propose lfm corrections */
208  INST(bool, LFM_ShowErrors); /* get error message, if there are lfm problems */
209  INST(QString, LFM_SessionKey); /* lfm session key */
210 
211  INST(int, Eq_Last); /* last equalizer index */
212  INST(QList<EQ_Setting>, Eq_List); /* All equalizers */
213  INST(bool, Eq_Gauss); /* do curve, when changing eq setting */
214 
215  INST(bool, Lib_Show); /* show library */
216  INST(QString, Lib_Path); /* library path */
217  INST(BoolList, Lib_ColsTitle); /* shown columns tracks */
218  INST(BoolList, Lib_ColsArtist); /* shown columns artist */
219  INST(BoolList, Lib_ColsAlbum); /* shown columns albums */
220  INST(bool, Lib_LiveSearch); /* library live search */
221  INST(Library::Sortings, Lib_Sorting); /* how to sort in lib */
222  INST(QString, Lib_CurPlugin); /* Current shown library plugin */
223  INST(QByteArray, Lib_SplitterStateArtist); /* Splitter state between artists and albums */
224  INST(QByteArray, Lib_SplitterStateTrack); /* Splitter state between artists and tracks */
225  INST(QByteArray, Lib_SplitterStateGenre); /* Splitter state between tracks and genres */
226  INST(QByteArray, Lib_SplitterStateDate); /* Splitter state between tracks and genres */
227  INST(int, Lib_OldWidth); /* Old library width when hiding library */
228  INST(bool, Lib_DC_DoNothing); /* when double clicked, create playlist and do nothing*/
229  INST(bool, Lib_DC_PlayIfStopped); /* when double clicked, play if stopped */
230  INST(bool, Lib_DC_PlayImmediately); /* when double clicked, play immediately */
231  INST(bool, Lib_DD_DoNothing); /* when drag dropped, insert tracks and do nothing */
232  INST(bool, Lib_DD_PlayIfStoppedAndEmpty); /* when drag dropped, play if playlist is empty and stopped */
233  INST(int, Lib_FontSize); /* current library font size */
234  INST(bool, Lib_FontBold); /* current library font weight */
235  INST(int, Lib_SearchMode); /* Search mode in library. See */
236  INST(bool, Lib_AutoUpdate); /* Automatic update of library */
237  INST(QList<Library::DateFilter>, Lib_DateFilters); /* Date filters appearing in library window */
238  INST(bool, Lib_ShowAlbumArtists); /* Show album artists instead of artists */
239  INST(bool, Lib_ShowAlbumCovers); /* Show album cover view */
240  INST(int, Lib_CoverZoom); /* Zoom of album cover view */
241  INST(bool, Lib_GenreTree); /* Show tree view of genres */
242 
243 
244  INST(QString, Player_Version); /* Version string of player */
245  INST(QString, Player_Language); /* language of player */
246  INST(int, Player_Style); /* dark or native: native = 0, dark = 1 */
247  INST(QString, Player_FontName); /* current font name */
248  INST(int, Player_FontSize); /* current font size */
249  INST(QSize, Player_Size); /* player size */
250  INST(QPoint, Player_Pos); /* player position */
251  INST(bool, Player_Fullscreen); /* player fullscreen */
252  INST(bool, Player_Maximized); /* player maximized */
253  INST(QString, Player_ShownPlugin); /* current shown plugin in player, empty if none */
254  INST(bool, Player_OneInstance); /* only one Sayonara instance is allowed */
255  INST(bool, Player_Min2Tray); /* minimize Sayonara to tray */
256  INST(bool, Player_ShowTrayIcon); /* Show/hide the tray icon */
257  INST(bool, Player_StartInTray); /* start in tray */
258  INST(bool, Player_NotifyNewVersion); /* check for new version on startup */
259  INST(QByteArray, Player_SplitterState); /* spliter state between playlist and library */
260  INST(RawShortcutMap, Player_Shortcuts); /* player shortcuts */
261 
262  INST(QStringList, PL_Playlist); /* old playlist: list of integers in case of library tracks, if no library track, filepath */
263  INST(bool, PL_LoadSavedPlaylists); /* load saved playlists on startup */
264  INST(bool, PL_LoadTemporaryPlaylists); /* load temporary playlists on startup */
265  INST(bool, PL_LoadLastTrack); /* load last track on startup */
266  INST(bool, PL_RememberTime); /* remember time of last track */
267  INST(bool, PL_StartPlaying); /* start playing immediately when opening Sayonara */
268  INST(int, PL_LastTrack); /* last track idx in playlist */
269  INST(int, PL_LastPlaylist); /* last Playlist id, where LastTrack has been played */
270  INST(QString, PL_EntryLook); /* formatting of playlist entry */
271  INST(int, PL_FontSize); /* current playlist font size */
272  INST(bool, PL_ShowClearButton); /* show clear button in playlist */
273 
274  INST(Playlist::Mode, PL_Mode); /* playlist mode: rep1, repAll, shuffle... */
275  INST(bool, PL_ShowNumbers); /* show numbers in playlist */
276  INST(bool, Notification_Show); /* show notifications */
277  INST(int, Notification_Timeout); /* notification timeout */
278  INST(QString, Notification_Name); /* type of notifications: libnotify or empty for native baloons :( */
279 
280  INST(QString, Engine_Name); /* Deprecated: Engine name */
281  INST(int, Engine_Vol); /* Volume */
282  INST(bool, Engine_Mute); /* Muted/unmuted */
283  INST(int, Engine_CurTrackPos_s); /* position of track (used to load old position) */
284  INST(int, Engine_ConvertQuality); /* Convert quality, 1-10 for variable, > 64 for fixed bitrate */
285  INST(QString, Engine_CovertTargetPath); /* last convert path */
286  INST(int, Engine_SpectrumBins); /* number of spectrum bins */
287  INST(bool, Engine_ShowSpectrum); /* show spectrum */
288  INST(bool, Engine_ShowLevel); /* show level */
289  INST(bool, Engine_CrossFaderActive); /* crossfader active */
290  INST(int, Engine_CrossFaderTime); /* crossfader overlap time */
291  INST(int, Engine_Pitch); /* hertz of a */
292  INST(bool, Engine_SpeedActive); /* is speed control active? */
293  INST(float, Engine_Speed); /* if yes, set speed */
294  INST(bool, Engine_PreservePitch); /* if yes, should pitch be preserved? */
295 
296  INST(bool, Engine_SR_Active); /* Streamripper active */
297  INST(bool, Engine_SR_Warning); /* streamripper warnings */
298  INST(QString, Engine_SR_Path); /* streamripper paths */
299  INST(bool, Engine_SR_SessionPath); /* streamripper session path */
300  INST(bool, Engine_SR_AutoRecord); /* streamripper automatic recording */
301 
302  INST(int, Spectrum_Style); /* index of spectrum style */
303  INST(int, Level_Style); /* index of level style */
304  INST(bool, Broadcast_Active); /* is broadcast active? */
305  INST(bool, Broadcast_Prompt); /* prompt when new connection arrives? */
306  INST(int, Broadcast_Port); /* broadcast port */
307 
308  INST(bool, Remote_Active); /* Remote control activated */
309  INST(int, Remote_Port); /* Remote control port */
310 
311  INST(int, Lyrics_Zoom); /* Zoom factor in lyrics window */
312  INST(QString, Lyrics_Server); /* Lyrics server */
313 
314  INST(QStringList, Cover_Server); /* Cover server */
315 
316 
317 }
318 
319 namespace SetNoDB
320 {
321  INST(bool, MP3enc_found);
322  INST(bool, Pitch_found);
323  INST(bool, Player_Quit);
324 }
325 
326 #endif // SETTINGKEY_H
The Mode class.
Definition: PlaylistMode.h:31
#define INST(type, settingkey)
MACRO INST use this macro to declare a setting: INST(boo, LFM_Active) is expanded to typedef Setting...
Definition: SettingKey.h:194
QPair< QString, QString > StringPair
Sayonara Typedefs.
Definition: typedefs.h:33
The Sortings class.
Definition: Sorting.h:34
Definition: SettingKey.h:174
The EQ_Setting class. Container for Equalizer configurations.
Definition: EqualizerPresets.h:32
Set namespace defines the setting: Which key and which type.
Definition: SettingKey.h:200
The SK namespace is used to access setting keys.
Definition: SettingKey.h:50
Definition: SettingKey.h:319
Definition: DatabaseAlbums.h:29
The RawShortcutMap struct consisting of a specifier writable into database and a shortcut. This class is used for converting a shortcut map into its database representation.
Definition: RawShortcutMap.h:35
Definition: PlaylistFwd.h:47