uniformize ways to convert strings into screen type
This commit is contained in:
@@ -18,43 +18,72 @@
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#include "screen_type.h"
|
||||
|
||||
ScreenType stringtoStarterScreenType(const std::string &s)
|
||||
#include "browser.h"
|
||||
#include "clock.h"
|
||||
#include "help.h"
|
||||
#include "lastfm.h"
|
||||
#include "lyrics.h"
|
||||
#include "media_library.h"
|
||||
#include "outputs.h"
|
||||
#include "playlist.h"
|
||||
#include "playlist_editor.h"
|
||||
#include "search_engine.h"
|
||||
#include "sel_items_adder.h"
|
||||
#include "server_info.h"
|
||||
#include "song_info.h"
|
||||
#include "sort_playlist.h"
|
||||
#include "tag_editor.h"
|
||||
#include "tiny_tag_editor.h"
|
||||
#include "visualizer.h"
|
||||
|
||||
ScreenType stringtoStartupScreenType(const std::string &s)
|
||||
{
|
||||
ScreenType result = ScreenType::Unknown;
|
||||
if (s == "browser")
|
||||
result = ScreenType::Browser;
|
||||
# ifdef ENABLE_CLOCK
|
||||
else if (s == "clock")
|
||||
result = ScreenType::Clock;
|
||||
# endif // ENABLE_CLOCK
|
||||
else if (s == "help")
|
||||
result = ScreenType::Help;
|
||||
else if (s == "media_library")
|
||||
result = ScreenType::MediaLibrary;
|
||||
# ifdef ENABLE_OUTPUTS
|
||||
else if (s == "outputs")
|
||||
result = ScreenType::Outputs;
|
||||
# endif // ENABLE_OUTPUTS
|
||||
else if (s == "playlist")
|
||||
result = ScreenType::Playlist;
|
||||
else if (s == "playlist_editor")
|
||||
result = ScreenType::PlaylistEditor;
|
||||
else if (s == "search_engine")
|
||||
result = ScreenType::SearchEngine;
|
||||
# ifdef HAVE_TAGLIB_H
|
||||
else if (s == "tag_editor")
|
||||
result = ScreenType::TagEditor;
|
||||
# endif // HAVE_TAGLIB_H
|
||||
# ifdef ENABLE_VISUALIZER
|
||||
else if (s == "visualizer")
|
||||
result = ScreenType::Visualizer;
|
||||
# endif // ENABLE_VISUALIZER
|
||||
return result;
|
||||
}
|
||||
|
||||
ScreenType stringToScreenType(const std::string &s)
|
||||
{
|
||||
ScreenType result = stringtoStarterScreenType(s);
|
||||
ScreenType result = stringtoStartupScreenType(s);
|
||||
if (result == ScreenType::Unknown)
|
||||
{
|
||||
if (s == "last_fm")
|
||||
result = ScreenType::Lastfm;
|
||||
else if (s == "lyrics")
|
||||
if (s == "lyrics")
|
||||
result = ScreenType::Lyrics;
|
||||
# ifdef HAVE_CURL_CURL_H
|
||||
else if (s == "last_fm")
|
||||
result = ScreenType::Lastfm;
|
||||
# endif // HAVE_CURL_CURL_H
|
||||
else if (s == "selected_items_adder")
|
||||
result = ScreenType::SelectedItemsAdder;
|
||||
else if (s == "server_info")
|
||||
@@ -63,8 +92,61 @@ ScreenType stringToScreenType(const std::string &s)
|
||||
result = ScreenType::SongInfo;
|
||||
else if (s == "sort_playlist_dialog")
|
||||
result = ScreenType::SortPlaylistDialog;
|
||||
# ifdef HAVE_TAGLIB_H
|
||||
else if (s == "tiny_tag_editor")
|
||||
result = ScreenType::TinyTagEditor;
|
||||
# endif // HAVE_TAGLIB_H
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
BaseScreen *toScreen(ScreenType st)
|
||||
{
|
||||
switch (st)
|
||||
{
|
||||
case ScreenType::Browser:
|
||||
return myBrowser;
|
||||
# ifdef ENABLE_CLOCK
|
||||
case ScreenType::Clock:
|
||||
return myClock;
|
||||
# endif // ENABLE_CLOCK
|
||||
case ScreenType::Help:
|
||||
return myHelp;
|
||||
case ScreenType::Lastfm:
|
||||
return myLastfm;
|
||||
case ScreenType::Lyrics:
|
||||
return myLyrics;
|
||||
case ScreenType::MediaLibrary:
|
||||
return myLibrary;
|
||||
# ifdef ENABLE_OUTPUTS
|
||||
case ScreenType::Outputs:
|
||||
return myOutputs;
|
||||
# endif // ENABLE_OUTPUTS
|
||||
case ScreenType::Playlist:
|
||||
return myPlaylist;
|
||||
case ScreenType::PlaylistEditor:
|
||||
return myPlaylistEditor;
|
||||
case ScreenType::SearchEngine:
|
||||
return mySearcher;
|
||||
case ScreenType::SelectedItemsAdder:
|
||||
return mySelectedItemsAdder;
|
||||
case ScreenType::ServerInfo:
|
||||
return myServerInfo;
|
||||
case ScreenType::SongInfo:
|
||||
return mySongInfo;
|
||||
case ScreenType::SortPlaylistDialog:
|
||||
return mySortPlaylistDialog;
|
||||
# ifdef HAVE_TAGLIB_H
|
||||
case ScreenType::TagEditor:
|
||||
return myTagEditor;
|
||||
case ScreenType::TinyTagEditor:
|
||||
return myTinyTagEditor;
|
||||
# endif // HAVE_TAGLIB_H
|
||||
# ifdef ENABLE_VISUALIZER
|
||||
case ScreenType::Visualizer:
|
||||
return myVisualizer;
|
||||
# endif // ENABLE_VISUALIZER
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user