actions: ShowMediaLibrary -> ShowMediaLibrary/ToggleMediaLibraryColumnsMode
This commit is contained in:
@@ -190,6 +190,9 @@
|
|||||||
#def_key "4"
|
#def_key "4"
|
||||||
# show_media_library
|
# show_media_library
|
||||||
#
|
#
|
||||||
|
#def_key "4"
|
||||||
|
# toggle_media_library_columns_mode
|
||||||
|
#
|
||||||
#def_key "5"
|
#def_key "5"
|
||||||
# show_playlist_editor
|
# show_playlist_editor
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -437,8 +437,6 @@
|
|||||||
#
|
#
|
||||||
#media_library_display_empty_tag = "yes"
|
#media_library_display_empty_tag = "yes"
|
||||||
#
|
#
|
||||||
#media_library_disable_two_column_mode = "no"
|
|
||||||
#
|
|
||||||
#enable_window_title = "yes"
|
#enable_window_title = "yes"
|
||||||
#
|
#
|
||||||
##
|
##
|
||||||
|
|||||||
@@ -330,9 +330,6 @@ If enabled, dates of albums in media library will be displayed and respected in
|
|||||||
.B media_library_display_empty_tag = yes/no
|
.B media_library_display_empty_tag = yes/no
|
||||||
If enabled, left column will contain entry for 'empty' tag, otherwise not.
|
If enabled, left column will contain entry for 'empty' tag, otherwise not.
|
||||||
.TP
|
.TP
|
||||||
.B media_library_disable_two_column_mode = yes/no
|
|
||||||
If enabled, pressing the key for the media library twice won't switch it to two column mode.
|
|
||||||
.TP
|
|
||||||
.B enable_window_title = yes/no
|
.B enable_window_title = yes/no
|
||||||
If enabled, ncmpcpp will override current window title with its own one.
|
If enabled, ncmpcpp will override current window title with its own one.
|
||||||
.TP
|
.TP
|
||||||
|
|||||||
@@ -2392,18 +2392,31 @@ void ResetSearchEngine::Run()
|
|||||||
mySearcher->reset();
|
mySearcher->reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_TAGLIB_H
|
|
||||||
bool ShowMediaLibrary::canBeRun() const
|
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()
|
void ShowMediaLibrary::Run()
|
||||||
{
|
{
|
||||||
myLibrary->switchTo();
|
myLibrary->switchTo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ToggleMediaLibraryColumnsMode::canBeRun() const
|
||||||
|
{
|
||||||
|
return myScreen == myLibrary;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ToggleMediaLibraryColumnsMode::Run()
|
||||||
|
{
|
||||||
|
myLibrary->toggleColumnsMode();
|
||||||
|
myLibrary->refresh();
|
||||||
|
}
|
||||||
|
|
||||||
bool ShowPlaylistEditor::canBeRun() const
|
bool ShowPlaylistEditor::canBeRun() const
|
||||||
{
|
{
|
||||||
return myScreen != myPlaylistEditor
|
return myScreen != myPlaylistEditor
|
||||||
@@ -2624,6 +2637,7 @@ void populateActions()
|
|||||||
insertAction(new ShowSearchEngine());
|
insertAction(new ShowSearchEngine());
|
||||||
insertAction(new ResetSearchEngine());
|
insertAction(new ResetSearchEngine());
|
||||||
insertAction(new ShowMediaLibrary());
|
insertAction(new ShowMediaLibrary());
|
||||||
|
insertAction(new ToggleMediaLibraryColumnsMode());
|
||||||
insertAction(new ShowPlaylistEditor());
|
insertAction(new ShowPlaylistEditor());
|
||||||
insertAction(new ShowTagEditor());
|
insertAction(new ShowTagEditor());
|
||||||
insertAction(new ShowOutputs());
|
insertAction(new ShowOutputs());
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ enum ActionType
|
|||||||
aRefetchLyrics, aRefetchArtistInfo, aSetSelectedItemsPriority, aFilterPlaylistOnPriorities,
|
aRefetchLyrics, aRefetchArtistInfo, aSetSelectedItemsPriority, aFilterPlaylistOnPriorities,
|
||||||
aShowSongInfo, aShowArtistInfo,
|
aShowSongInfo, aShowArtistInfo,
|
||||||
aShowLyrics, aQuit, aNextScreen, aPreviousScreen, aShowHelp, aShowPlaylist, aShowBrowser, aChangeBrowseMode,
|
aShowLyrics, aQuit, aNextScreen, aPreviousScreen, aShowHelp, aShowPlaylist, aShowBrowser, aChangeBrowseMode,
|
||||||
aShowSearchEngine, aResetSearchEngine, aShowMediaLibrary, aShowPlaylistEditor, aShowTagEditor, aShowOutputs,
|
aShowSearchEngine, aResetSearchEngine, aShowMediaLibrary, aToggleMediaLibraryColumnsMode, aShowPlaylistEditor, aShowTagEditor, aShowOutputs,
|
||||||
aShowVisualizer, aShowClock, aShowServerInfo
|
aShowVisualizer, aShowClock, aShowServerInfo
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1033,9 +1033,17 @@ struct ShowMediaLibrary : public Action
|
|||||||
ShowMediaLibrary() : Action(aShowMediaLibrary, "show_media_library") { }
|
ShowMediaLibrary() : Action(aShowMediaLibrary, "show_media_library") { }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
# ifdef HAVE_TAGLIB_H
|
|
||||||
virtual bool canBeRun() const;
|
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();
|
virtual void Run();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -319,7 +319,10 @@ void BindingsConfiguration::generateDefaults()
|
|||||||
bind(k, aResetSearchEngine);
|
bind(k, aResetSearchEngine);
|
||||||
}
|
}
|
||||||
if (notBound(k = stringToKey("4")))
|
if (notBound(k = stringToKey("4")))
|
||||||
|
{
|
||||||
bind(k, aShowMediaLibrary);
|
bind(k, aShowMediaLibrary);
|
||||||
|
bind(k, aToggleMediaLibraryColumnsMode);
|
||||||
|
}
|
||||||
if (notBound(k = stringToKey("5")))
|
if (notBound(k = stringToKey("5")))
|
||||||
bind(k, aShowPlaylistEditor);
|
bind(k, aShowPlaylistEditor);
|
||||||
if (notBound(k = stringToKey("6")))
|
if (notBound(k = stringToKey("6")))
|
||||||
|
|||||||
@@ -311,8 +311,7 @@ void Help::GetKeybindings()
|
|||||||
KeyDesc(aResetSearchEngine, "Reset search constraints and clear results");
|
KeyDesc(aResetSearchEngine, "Reset search constraints and clear results");
|
||||||
|
|
||||||
KeysSection("Media library");
|
KeysSection("Media library");
|
||||||
if (!Config.media_library_disable_two_column_mode)
|
KeyDesc(aToggleMediaLibraryColumnsMode, "Switch between two/three columns mode");
|
||||||
KeyDesc(aShowMediaLibrary, "Switch between two/three columns mode");
|
|
||||||
KeyDesc(aPreviousColumn, "Previous column");
|
KeyDesc(aPreviousColumn, "Previous column");
|
||||||
KeyDesc(aNextColumn, "Next column");
|
KeyDesc(aNextColumn, "Next column");
|
||||||
KeyDesc(aPressEnter, "Add item to playlist and play it");
|
KeyDesc(aPressEnter, "Add item to playlist and play it");
|
||||||
|
|||||||
@@ -198,40 +198,10 @@ void MediaLibrary::refresh()
|
|||||||
|
|
||||||
void MediaLibrary::switchTo()
|
void MediaLibrary::switchTo()
|
||||||
{
|
{
|
||||||
if (myScreen == this)
|
SwitchTo::execute(this);
|
||||||
{
|
markSongsInPlaylist(songsProxyList());
|
||||||
if (!Config.media_library_disable_two_column_mode)
|
drawHeader();
|
||||||
{
|
refresh();
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::wstring MediaLibrary::title()
|
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()
|
int MediaLibrary::Columns()
|
||||||
{
|
{
|
||||||
if (hasTwoColumns)
|
if (hasTwoColumns)
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ struct MediaLibrary: Screen<NC::Window *>, Filterable, HasColumns, HasSongs, Sea
|
|||||||
virtual void nextColumn() OVERRIDE;
|
virtual void nextColumn() OVERRIDE;
|
||||||
|
|
||||||
// private members
|
// private members
|
||||||
|
void toggleColumnsMode();
|
||||||
int Columns();
|
int Columns();
|
||||||
void LocateSong(const MPD::Song &);
|
void LocateSong(const MPD::Song &);
|
||||||
std::shared_ptr<ProxySongList> songsProxyList();
|
std::shared_ptr<ProxySongList> songsProxyList();
|
||||||
|
|||||||
@@ -244,7 +244,6 @@ void Configuration::SetDefaults()
|
|||||||
tag_editor_extended_numeration = false;
|
tag_editor_extended_numeration = false;
|
||||||
media_library_display_date = true;
|
media_library_display_date = true;
|
||||||
media_library_display_empty_tag = true;
|
media_library_display_empty_tag = true;
|
||||||
media_library_disable_two_column_mode = false;
|
|
||||||
discard_colors_if_item_is_selected = true;
|
discard_colors_if_item_is_selected = true;
|
||||||
store_lyrics_in_song_dir = false;
|
store_lyrics_in_song_dir = false;
|
||||||
ask_for_locked_screen_width_part = true;
|
ask_for_locked_screen_width_part = true;
|
||||||
@@ -798,10 +797,6 @@ void Configuration::Read()
|
|||||||
{
|
{
|
||||||
media_library_display_empty_tag = v == "yes";
|
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")
|
else if (name == "discard_colors_if_item_is_selected")
|
||||||
{
|
{
|
||||||
discard_colors_if_item_is_selected = v == "yes";
|
discard_colors_if_item_is_selected = v == "yes";
|
||||||
|
|||||||
@@ -182,7 +182,6 @@ struct Configuration
|
|||||||
bool tag_editor_extended_numeration;
|
bool tag_editor_extended_numeration;
|
||||||
bool media_library_display_date;
|
bool media_library_display_date;
|
||||||
bool media_library_display_empty_tag;
|
bool media_library_display_empty_tag;
|
||||||
bool media_library_disable_two_column_mode;
|
|
||||||
bool discard_colors_if_item_is_selected;
|
bool discard_colors_if_item_is_selected;
|
||||||
bool store_lyrics_in_song_dir;
|
bool store_lyrics_in_song_dir;
|
||||||
bool ask_for_locked_screen_width_part;
|
bool ask_for_locked_screen_width_part;
|
||||||
|
|||||||
Reference in New Issue
Block a user