scrollpad: explicitely include iostream
[ncmpcpp.git] / src / screen_type.cpp
blob20f3c4f2339770d732aca6e3da57666be8a72701
1 /***************************************************************************
2 * Copyright (C) 2008-2014 by Andrzej Rybczak *
3 * electricityispower@gmail.com *
4 * *
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. *
9 * *
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. *
14 * *
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 ***************************************************************************/
21 #include "config.h"
22 #include "screen_type.h"
24 #include "browser.h"
25 #include "clock.h"
26 #include "help.h"
27 #include "lastfm.h"
28 #include "lyrics.h"
29 #include "media_library.h"
30 #include "outputs.h"
31 #include "playlist.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;
45 if (s == "browser")
46 result = ScreenType::Browser;
47 # ifdef ENABLE_CLOCK
48 else if (s == "clock")
49 result = ScreenType::Clock;
50 # endif // ENABLE_CLOCK
51 else if (s == "help")
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;
65 # ifdef HAVE_TAGLIB_H
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
73 return result;
76 ScreenType stringToScreenType(const std::string &s)
78 ScreenType result = stringtoStartupScreenType(s);
79 if (result == ScreenType::Unknown)
81 if (s == "lyrics")
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;
95 # ifdef HAVE_TAGLIB_H
96 else if (s == "tiny_tag_editor")
97 result = ScreenType::TinyTagEditor;
98 # endif // HAVE_TAGLIB_H
100 return result;
103 BaseScreen *toScreen(ScreenType st)
105 switch (st)
107 case ScreenType::Browser:
108 return myBrowser;
109 # ifdef ENABLE_CLOCK
110 case ScreenType::Clock:
111 return myClock;
112 # endif // ENABLE_CLOCK
113 case ScreenType::Help:
114 return myHelp;
115 # ifdef HAVE_CURL_CURL_H
116 case ScreenType::Lastfm:
117 return myLastfm;
118 # endif // HAVE_CURL_CURL_H
119 case ScreenType::Lyrics:
120 return myLyrics;
121 case ScreenType::MediaLibrary:
122 return myLibrary;
123 # ifdef ENABLE_OUTPUTS
124 case ScreenType::Outputs:
125 return myOutputs;
126 # endif // ENABLE_OUTPUTS
127 case ScreenType::Playlist:
128 return myPlaylist;
129 case ScreenType::PlaylistEditor:
130 return myPlaylistEditor;
131 case ScreenType::SearchEngine:
132 return mySearcher;
133 case ScreenType::SelectedItemsAdder:
134 return mySelectedItemsAdder;
135 case ScreenType::ServerInfo:
136 return myServerInfo;
137 case ScreenType::SongInfo:
138 return mySongInfo;
139 case ScreenType::SortPlaylistDialog:
140 return mySortPlaylistDialog;
141 # ifdef HAVE_TAGLIB_H
142 case ScreenType::TagEditor:
143 return myTagEditor;
144 case ScreenType::TinyTagEditor:
145 return myTinyTagEditor;
146 # endif // HAVE_TAGLIB_H
147 # ifdef ENABLE_VISUALIZER
148 case ScreenType::Visualizer:
149 return myVisualizer;
150 # endif // ENABLE_VISUALIZER
151 default:
152 return nullptr;