actions: ShowMediaLibrary -> ShowMediaLibrary/ToggleMediaLibraryColumnsMode
This commit is contained in:
@@ -2392,18 +2392,31 @@ void ResetSearchEngine::Run()
|
||||
mySearcher->reset();
|
||||
}
|
||||
|
||||
#ifdef HAVE_TAGLIB_H
|
||||
bool ShowMediaLibrary::canBeRun() const
|
||||
{
|
||||
return myScreen != myTinyTagEditor;
|
||||
return myScreen != myLibrary
|
||||
# ifdef HAVE_TAGLIB_H
|
||||
&& myScreen != myTinyTagEditor
|
||||
# endif // HAVE_TAGLIB_H
|
||||
;
|
||||
}
|
||||
#endif // HAVE_TAGLIB_H
|
||||
|
||||
void ShowMediaLibrary::Run()
|
||||
{
|
||||
myLibrary->switchTo();
|
||||
}
|
||||
|
||||
bool ToggleMediaLibraryColumnsMode::canBeRun() const
|
||||
{
|
||||
return myScreen == myLibrary;
|
||||
}
|
||||
|
||||
void ToggleMediaLibraryColumnsMode::Run()
|
||||
{
|
||||
myLibrary->toggleColumnsMode();
|
||||
myLibrary->refresh();
|
||||
}
|
||||
|
||||
bool ShowPlaylistEditor::canBeRun() const
|
||||
{
|
||||
return myScreen != myPlaylistEditor
|
||||
@@ -2624,6 +2637,7 @@ void populateActions()
|
||||
insertAction(new ShowSearchEngine());
|
||||
insertAction(new ResetSearchEngine());
|
||||
insertAction(new ShowMediaLibrary());
|
||||
insertAction(new ToggleMediaLibraryColumnsMode());
|
||||
insertAction(new ShowPlaylistEditor());
|
||||
insertAction(new ShowTagEditor());
|
||||
insertAction(new ShowOutputs());
|
||||
|
||||
@@ -47,7 +47,7 @@ enum ActionType
|
||||
aRefetchLyrics, aRefetchArtistInfo, aSetSelectedItemsPriority, aFilterPlaylistOnPriorities,
|
||||
aShowSongInfo, aShowArtistInfo,
|
||||
aShowLyrics, aQuit, aNextScreen, aPreviousScreen, aShowHelp, aShowPlaylist, aShowBrowser, aChangeBrowseMode,
|
||||
aShowSearchEngine, aResetSearchEngine, aShowMediaLibrary, aShowPlaylistEditor, aShowTagEditor, aShowOutputs,
|
||||
aShowSearchEngine, aResetSearchEngine, aShowMediaLibrary, aToggleMediaLibraryColumnsMode, aShowPlaylistEditor, aShowTagEditor, aShowOutputs,
|
||||
aShowVisualizer, aShowClock, aShowServerInfo
|
||||
};
|
||||
|
||||
@@ -1033,9 +1033,17 @@ struct ShowMediaLibrary : public Action
|
||||
ShowMediaLibrary() : Action(aShowMediaLibrary, "show_media_library") { }
|
||||
|
||||
protected:
|
||||
# ifdef HAVE_TAGLIB_H
|
||||
virtual bool canBeRun() const;
|
||||
# endif // HAVE_TAGLIB_H
|
||||
virtual void Run();
|
||||
};
|
||||
|
||||
struct ToggleMediaLibraryColumnsMode : public Action
|
||||
{
|
||||
ToggleMediaLibraryColumnsMode()
|
||||
: Action(aToggleMediaLibraryColumnsMode, "toggle_media_library_columns_mode") { }
|
||||
|
||||
protected:
|
||||
virtual bool canBeRun() const;
|
||||
virtual void Run();
|
||||
};
|
||||
|
||||
|
||||
@@ -319,7 +319,10 @@ void BindingsConfiguration::generateDefaults()
|
||||
bind(k, aResetSearchEngine);
|
||||
}
|
||||
if (notBound(k = stringToKey("4")))
|
||||
{
|
||||
bind(k, aShowMediaLibrary);
|
||||
bind(k, aToggleMediaLibraryColumnsMode);
|
||||
}
|
||||
if (notBound(k = stringToKey("5")))
|
||||
bind(k, aShowPlaylistEditor);
|
||||
if (notBound(k = stringToKey("6")))
|
||||
|
||||
@@ -311,8 +311,7 @@ void Help::GetKeybindings()
|
||||
KeyDesc(aResetSearchEngine, "Reset search constraints and clear results");
|
||||
|
||||
KeysSection("Media library");
|
||||
if (!Config.media_library_disable_two_column_mode)
|
||||
KeyDesc(aShowMediaLibrary, "Switch between two/three columns mode");
|
||||
KeyDesc(aToggleMediaLibraryColumnsMode, "Switch between two/three columns mode");
|
||||
KeyDesc(aPreviousColumn, "Previous column");
|
||||
KeyDesc(aNextColumn, "Next column");
|
||||
KeyDesc(aPressEnter, "Add item to playlist and play it");
|
||||
|
||||
@@ -198,40 +198,10 @@ void MediaLibrary::refresh()
|
||||
|
||||
void MediaLibrary::switchTo()
|
||||
{
|
||||
if (myScreen == this)
|
||||
{
|
||||
if (!Config.media_library_disable_two_column_mode)
|
||||
{
|
||||
hasTwoColumns = !hasTwoColumns;
|
||||
Tags.clear();
|
||||
Albums.clear();
|
||||
Albums.reset();
|
||||
Songs.clear();
|
||||
if (hasTwoColumns)
|
||||
{
|
||||
if (isActiveWindow(Tags))
|
||||
nextColumn();
|
||||
if (Config.titles_visibility)
|
||||
{
|
||||
std::string item_type = lowercase(tagTypeToString(Config.media_lib_primary_tag));
|
||||
Albums.setTitle("Albums (sorted by " + item_type + ")");
|
||||
}
|
||||
else
|
||||
Albums.setTitle("");
|
||||
}
|
||||
else
|
||||
Albums.setTitle(Config.titles_visibility ? "Albums" : "");
|
||||
resize();
|
||||
refresh();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SwitchTo::execute(this);
|
||||
markSongsInPlaylist(songsProxyList());
|
||||
drawHeader();
|
||||
refresh();
|
||||
}
|
||||
SwitchTo::execute(this);
|
||||
markSongsInPlaylist(songsProxyList());
|
||||
drawHeader();
|
||||
refresh();
|
||||
}
|
||||
|
||||
std::wstring MediaLibrary::title()
|
||||
@@ -742,6 +712,30 @@ void MediaLibrary::nextColumn()
|
||||
|
||||
/***********************************************************************/
|
||||
|
||||
void MediaLibrary::toggleColumnsMode()
|
||||
{
|
||||
hasTwoColumns = !hasTwoColumns;
|
||||
Tags.clear();
|
||||
Albums.clear();
|
||||
Albums.reset();
|
||||
Songs.clear();
|
||||
if (hasTwoColumns)
|
||||
{
|
||||
if (isActiveWindow(Tags))
|
||||
nextColumn();
|
||||
if (Config.titles_visibility)
|
||||
{
|
||||
std::string item_type = lowercase(tagTypeToString(Config.media_lib_primary_tag));
|
||||
Albums.setTitle("Albums (sorted by " + item_type + ")");
|
||||
}
|
||||
else
|
||||
Albums.setTitle("");
|
||||
}
|
||||
else
|
||||
Albums.setTitle(Config.titles_visibility ? "Albums" : "");
|
||||
resize();
|
||||
}
|
||||
|
||||
int MediaLibrary::Columns()
|
||||
{
|
||||
if (hasTwoColumns)
|
||||
|
||||
@@ -68,6 +68,7 @@ struct MediaLibrary: Screen<NC::Window *>, Filterable, HasColumns, HasSongs, Sea
|
||||
virtual void nextColumn() OVERRIDE;
|
||||
|
||||
// private members
|
||||
void toggleColumnsMode();
|
||||
int Columns();
|
||||
void LocateSong(const MPD::Song &);
|
||||
std::shared_ptr<ProxySongList> songsProxyList();
|
||||
|
||||
@@ -244,7 +244,6 @@ void Configuration::SetDefaults()
|
||||
tag_editor_extended_numeration = false;
|
||||
media_library_display_date = true;
|
||||
media_library_display_empty_tag = true;
|
||||
media_library_disable_two_column_mode = false;
|
||||
discard_colors_if_item_is_selected = true;
|
||||
store_lyrics_in_song_dir = false;
|
||||
ask_for_locked_screen_width_part = true;
|
||||
@@ -798,10 +797,6 @@ void Configuration::Read()
|
||||
{
|
||||
media_library_display_empty_tag = v == "yes";
|
||||
}
|
||||
else if (name == "media_library_disable_two_column_mode")
|
||||
{
|
||||
media_library_disable_two_column_mode = v == "yes";
|
||||
}
|
||||
else if (name == "discard_colors_if_item_is_selected")
|
||||
{
|
||||
discard_colors_if_item_is_selected = v == "yes";
|
||||
|
||||
@@ -182,7 +182,6 @@ struct Configuration
|
||||
bool tag_editor_extended_numeration;
|
||||
bool media_library_display_date;
|
||||
bool media_library_display_empty_tag;
|
||||
bool media_library_disable_two_column_mode;
|
||||
bool discard_colors_if_item_is_selected;
|
||||
bool store_lyrics_in_song_dir;
|
||||
bool ask_for_locked_screen_width_part;
|
||||
|
||||
Reference in New Issue
Block a user