1 /***************************************************************************
2 * Copyright (C) 2008-2014 by Andrzej Rybczak *
3 * electricityispower@gmail.com *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
22 #include "screen_type.h"
29 #include "media_library.h"
32 #include "playlist_editor.h"
33 #include "search_engine.h"
34 #include "sel_items_adder.h"
35 #include "server_info.h"
36 #include "song_info.h"
37 #include "sort_playlist.h"
38 #include "tag_editor.h"
39 #include "tiny_tag_editor.h"
40 #include "visualizer.h"
42 ScreenType
stringtoStartupScreenType(const std::string
&s
)
44 ScreenType result
= ScreenType::Unknown
;
46 result
= ScreenType::Browser
;
48 else if (s
== "clock")
49 result
= ScreenType::Clock
;
50 # endif // ENABLE_CLOCK
52 result
= ScreenType::Help
;
53 else if (s
== "media_library")
54 result
= ScreenType::MediaLibrary
;
55 # ifdef ENABLE_OUTPUTS
56 else if (s
== "outputs")
57 result
= ScreenType::Outputs
;
58 # endif // ENABLE_OUTPUTS
59 else if (s
== "playlist")
60 result
= ScreenType::Playlist
;
61 else if (s
== "playlist_editor")
62 result
= ScreenType::PlaylistEditor
;
63 else if (s
== "search_engine")
64 result
= ScreenType::SearchEngine
;
66 else if (s
== "tag_editor")
67 result
= ScreenType::TagEditor
;
68 # endif // HAVE_TAGLIB_H
69 # ifdef ENABLE_VISUALIZER
70 else if (s
== "visualizer")
71 result
= ScreenType::Visualizer
;
72 # endif // ENABLE_VISUALIZER
76 ScreenType
stringToScreenType(const std::string
&s
)
78 ScreenType result
= stringtoStartupScreenType(s
);
79 if (result
== ScreenType::Unknown
)
82 result
= ScreenType::Lyrics
;
83 # ifdef HAVE_CURL_CURL_H
84 else if (s
== "last_fm")
85 result
= ScreenType::Lastfm
;
86 # endif // HAVE_CURL_CURL_H
87 else if (s
== "selected_items_adder")
88 result
= ScreenType::SelectedItemsAdder
;
89 else if (s
== "server_info")
90 result
= ScreenType::ServerInfo
;
91 else if (s
== "song_info")
92 result
= ScreenType::SongInfo
;
93 else if (s
== "sort_playlist_dialog")
94 result
= ScreenType::SortPlaylistDialog
;
96 else if (s
== "tiny_tag_editor")
97 result
= ScreenType::TinyTagEditor
;
98 # endif // HAVE_TAGLIB_H
103 BaseScreen
*toScreen(ScreenType st
)
107 case ScreenType::Browser
:
110 case ScreenType::Clock
:
112 # endif // ENABLE_CLOCK
113 case ScreenType::Help
:
115 # ifdef HAVE_CURL_CURL_H
116 case ScreenType::Lastfm
:
118 # endif // HAVE_CURL_CURL_H
119 case ScreenType::Lyrics
:
121 case ScreenType::MediaLibrary
:
123 # ifdef ENABLE_OUTPUTS
124 case ScreenType::Outputs
:
126 # endif // ENABLE_OUTPUTS
127 case ScreenType::Playlist
:
129 case ScreenType::PlaylistEditor
:
130 return myPlaylistEditor
;
131 case ScreenType::SearchEngine
:
133 case ScreenType::SelectedItemsAdder
:
134 return mySelectedItemsAdder
;
135 case ScreenType::ServerInfo
:
137 case ScreenType::SongInfo
:
139 case ScreenType::SortPlaylistDialog
:
140 return mySortPlaylistDialog
;
141 # ifdef HAVE_TAGLIB_H
142 case ScreenType::TagEditor
:
144 case ScreenType::TinyTagEditor
:
145 return myTinyTagEditor
;
146 # endif // HAVE_TAGLIB_H
147 # ifdef ENABLE_VISUALIZER
148 case ScreenType::Visualizer
:
150 # endif // ENABLE_VISUALIZER