new feature: separators between albums in playlist
This commit is contained in:
@@ -226,6 +226,8 @@
|
|||||||
#
|
#
|
||||||
#playlist_show_remaining_time = "no"
|
#playlist_show_remaining_time = "no"
|
||||||
#
|
#
|
||||||
|
#playlist_separate_albums = "no"
|
||||||
|
#
|
||||||
#playlist_display_mode = "classic" (classic/columns)
|
#playlist_display_mode = "classic" (classic/columns)
|
||||||
#
|
#
|
||||||
#browser_display_mode = "classic" (classic/columns)
|
#browser_display_mode = "classic" (classic/columns)
|
||||||
|
|||||||
2
doc/keys
2
doc/keys
@@ -152,6 +152,8 @@
|
|||||||
#
|
#
|
||||||
#key_toggle_display_mode = 'p'
|
#key_toggle_display_mode = 'p'
|
||||||
#
|
#
|
||||||
|
#key_toggle_separators_in_playlist = '!'
|
||||||
|
#
|
||||||
#key_toggle_lyrics_db = 'L'
|
#key_toggle_lyrics_db = 'L'
|
||||||
#
|
#
|
||||||
#key_go_to_containing_directory = 'G'
|
#key_go_to_containing_directory = 'G'
|
||||||
|
|||||||
@@ -171,6 +171,9 @@ Number of default mode used in search engine.
|
|||||||
.B playlist_show_remaining_time = yes/no
|
.B playlist_show_remaining_time = yes/no
|
||||||
If enabled, time remaining to end of playlist will be shown after playlist's statistics.
|
If enabled, time remaining to end of playlist will be shown after playlist's statistics.
|
||||||
.TP
|
.TP
|
||||||
|
.B playlist_separate_albums = yes/no
|
||||||
|
If enabled, separators will be placed between albums in playlist.
|
||||||
|
.TP
|
||||||
.B playlist_display_mode = classic/columns
|
.B playlist_display_mode = classic/columns
|
||||||
Default display mode for Playlist.
|
Default display mode for Playlist.
|
||||||
.TP
|
.TP
|
||||||
|
|||||||
@@ -125,6 +125,12 @@ void Display::SongsInColumns(const MPD::Song &s, void *, Menu<MPD::Song> *menu)
|
|||||||
if (Config.columns.empty())
|
if (Config.columns.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
bool separate_albums = Config.playlist_separate_albums
|
||||||
|
&& s.GetPosition()+1 < myPlaylist->Items->Size()
|
||||||
|
&& (*myPlaylist->Items)[s.GetPosition()+1].GetAlbum() != s.GetAlbum();
|
||||||
|
if (separate_albums)
|
||||||
|
*menu << fmtUnderline;
|
||||||
|
|
||||||
std::vector<Column>::const_iterator next2last, last, it;
|
std::vector<Column>::const_iterator next2last, last, it;
|
||||||
size_t where = 0;
|
size_t where = 0;
|
||||||
int width;
|
int width;
|
||||||
@@ -260,6 +266,8 @@ void Display::SongsInColumns(const MPD::Song &s, void *, Menu<MPD::Song> *menu)
|
|||||||
*menu << clEnd;
|
*menu << clEnd;
|
||||||
if (is_now_playing)
|
if (is_now_playing)
|
||||||
*menu << Config.now_playing_suffix;
|
*menu << Config.now_playing_suffix;
|
||||||
|
if (separate_albums)
|
||||||
|
*menu << fmtUnderlineEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Display::Songs(const MPD::Song &s, void *data, Menu<MPD::Song> *menu)
|
void Display::Songs(const MPD::Song &s, void *data, Menu<MPD::Song> *menu)
|
||||||
@@ -271,6 +279,15 @@ void Display::Songs(const MPD::Song &s, void *data, Menu<MPD::Song> *menu)
|
|||||||
if (is_now_playing)
|
if (is_now_playing)
|
||||||
*menu << Config.now_playing_prefix;
|
*menu << Config.now_playing_prefix;
|
||||||
|
|
||||||
|
bool separate_albums = Config.playlist_separate_albums
|
||||||
|
&& s.GetPosition()+1 < myPlaylist->Items->Size()
|
||||||
|
&& (*myPlaylist->Items)[s.GetPosition()+1].GetAlbum() != s.GetAlbum();
|
||||||
|
if (separate_albums)
|
||||||
|
{
|
||||||
|
*menu << fmtUnderline;
|
||||||
|
mvwhline(menu->Raw(), menu->Y(), 0, ' ', menu->GetWidth());
|
||||||
|
}
|
||||||
|
|
||||||
bool discard_colors = Config.discard_colors_if_item_is_selected && menu->isSelected(menu->CurrentlyDrawedPosition());
|
bool discard_colors = Config.discard_colors_if_item_is_selected && menu->isSelected(menu->CurrentlyDrawedPosition());
|
||||||
|
|
||||||
std::string line = s.toString(*static_cast<std::string *>(data), "$");
|
std::string line = s.toString(*static_cast<std::string *>(data), "$");
|
||||||
@@ -298,6 +315,8 @@ void Display::Songs(const MPD::Song &s, void *data, Menu<MPD::Song> *menu)
|
|||||||
if (is_now_playing)
|
if (is_now_playing)
|
||||||
buf << Config.now_playing_suffix;
|
buf << Config.now_playing_suffix;
|
||||||
*menu << XY(menu->GetWidth()-buf.Str().length()-(menu->isSelected(menu->CurrentlyDrawedPosition()) ? Config.selected_item_suffix_length : 0), menu->Y()) << buf;
|
*menu << XY(menu->GetWidth()-buf.Str().length()-(menu->isSelected(menu->CurrentlyDrawedPosition()) ? Config.selected_item_suffix_length : 0), menu->Y()) << buf;
|
||||||
|
if (separate_albums)
|
||||||
|
*menu << fmtUnderlineEnd;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else // not a color nor right align, just a random character
|
else // not a color nor right align, just a random character
|
||||||
@@ -315,6 +334,8 @@ void Display::Songs(const MPD::Song &s, void *data, Menu<MPD::Song> *menu)
|
|||||||
}
|
}
|
||||||
if (is_now_playing)
|
if (is_now_playing)
|
||||||
*menu << Config.now_playing_suffix;
|
*menu << Config.now_playing_suffix;
|
||||||
|
if (separate_albums)
|
||||||
|
*menu << fmtUnderlineEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Display::Tags(const MPD::Song &s, void *data, Menu<MPD::Song> *menu)
|
void Display::Tags(const MPD::Song &s, void *data, Menu<MPD::Song> *menu)
|
||||||
|
|||||||
@@ -209,6 +209,7 @@ void Help::GetKeybindings()
|
|||||||
# endif // HAVE_TAGLIB_H
|
# endif // HAVE_TAGLIB_H
|
||||||
*w << DisplayKeys(Key.ToggleDisplayMode) << "Toggle display mode\n";
|
*w << DisplayKeys(Key.ToggleDisplayMode) << "Toggle display mode\n";
|
||||||
*w << DisplayKeys(Key.ToggleInterface) << "Toggle user interface\n";
|
*w << DisplayKeys(Key.ToggleInterface) << "Toggle user interface\n";
|
||||||
|
*w << DisplayKeys(Key.ToggleSeparatorsInPlaylist) << "Toggle displaying separators between albums in playlist\n";
|
||||||
*w << DisplayKeys(Key.GoToPosition) << "Go to given position in current song (in % by default)\n";
|
*w << DisplayKeys(Key.GoToPosition) << "Go to given position in current song (in % by default)\n";
|
||||||
*w << DisplayKeys(Key.SongInfo) << "Show song info\n";
|
*w << DisplayKeys(Key.SongInfo) << "Show song info\n";
|
||||||
# ifdef HAVE_CURL_CURL_H
|
# ifdef HAVE_CURL_CURL_H
|
||||||
|
|||||||
@@ -542,7 +542,7 @@ int main(int argc, char *argv[])
|
|||||||
else if (mouse_event.bstate & (BUTTON1_PRESSED | BUTTON2_PRESSED | BUTTON3_PRESSED | BUTTON4_PRESSED))
|
else if (mouse_event.bstate & (BUTTON1_PRESSED | BUTTON2_PRESSED | BUTTON3_PRESSED | BUTTON4_PRESSED))
|
||||||
myScreen->MouseButtonPressed(mouse_event);
|
myScreen->MouseButtonPressed(mouse_event);
|
||||||
}
|
}
|
||||||
if (Keypressed(input, Key.ToggleInterface))
|
else if (Keypressed(input, Key.ToggleInterface))
|
||||||
{
|
{
|
||||||
Config.new_design = !Config.new_design;
|
Config.new_design = !Config.new_design;
|
||||||
Config.statusbar_visibility = Config.new_design ? 0 : real_statusbar_visibility;
|
Config.statusbar_visibility = Config.new_design ? 0 : real_statusbar_visibility;
|
||||||
@@ -940,8 +940,8 @@ int main(int argc, char *argv[])
|
|||||||
if (modify_now_playing)
|
if (modify_now_playing)
|
||||||
--myPlaylist->NowPlaying;
|
--myPlaylist->NowPlaying;
|
||||||
--to;
|
--to;
|
||||||
myPlaylist->Items->at(from).SetPosition(to);
|
myPlaylist->Items->at(to+1).SetPosition(to);
|
||||||
myPlaylist->Items->at(to).SetPosition(from);
|
myPlaylist->Items->at(to).SetPosition(to+1);
|
||||||
myPlaylist->Items->Swap(to, to+1);
|
myPlaylist->Items->Swap(to, to+1);
|
||||||
myPlaylist->Items->Scroll(wUp);
|
myPlaylist->Items->Scroll(wUp);
|
||||||
myPlaylist->Items->Refresh();
|
myPlaylist->Items->Refresh();
|
||||||
@@ -1066,8 +1066,8 @@ int main(int argc, char *argv[])
|
|||||||
if (modify_now_playing)
|
if (modify_now_playing)
|
||||||
++myPlaylist->NowPlaying;
|
++myPlaylist->NowPlaying;
|
||||||
++to;
|
++to;
|
||||||
myPlaylist->Items->at(from).SetPosition(to);
|
myPlaylist->Items->at(to-1).SetPosition(to);
|
||||||
myPlaylist->Items->at(to).SetPosition(from);
|
myPlaylist->Items->at(to).SetPosition(to-1);
|
||||||
myPlaylist->Items->Swap(to, to-1);
|
myPlaylist->Items->Swap(to, to-1);
|
||||||
myPlaylist->Items->Scroll(wDown);
|
myPlaylist->Items->Scroll(wDown);
|
||||||
myPlaylist->Items->Refresh();
|
myPlaylist->Items->Refresh();
|
||||||
@@ -1315,6 +1315,11 @@ int main(int argc, char *argv[])
|
|||||||
mySearcher->Main()->SetTitle(Config.columns_in_search_engine ? Display::Columns() : "");
|
mySearcher->Main()->SetTitle(Config.columns_in_search_engine ? Display::Columns() : "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (Keypressed(input, Key.ToggleSeparatorsInPlaylist))
|
||||||
|
{
|
||||||
|
Config.playlist_separate_albums = !Config.playlist_separate_albums;
|
||||||
|
ShowMessage("Separators between albums in playlist: %s", Config.playlist_separate_albums ? "On" : "Off");
|
||||||
|
}
|
||||||
# ifdef HAVE_CURL_CURL_H
|
# ifdef HAVE_CURL_CURL_H
|
||||||
else if (Keypressed(input, Key.ToggleLyricsDB))
|
else if (Keypressed(input, Key.ToggleLyricsDB))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -228,6 +228,7 @@ void NcmpcppKeys::SetDefaults()
|
|||||||
ToggleAutoCenter[0] = 'U';
|
ToggleAutoCenter[0] = 'U';
|
||||||
ToggleDisplayMode[0] = 'p';
|
ToggleDisplayMode[0] = 'p';
|
||||||
ToggleInterface[0] = '\\';
|
ToggleInterface[0] = '\\';
|
||||||
|
ToggleSeparatorsInPlaylist[0] = '!';
|
||||||
ToggleLyricsDB[0] = 'L';
|
ToggleLyricsDB[0] = 'L';
|
||||||
GoToParentDir[0] = KEY_BACKSPACE;
|
GoToParentDir[0] = KEY_BACKSPACE;
|
||||||
SwitchTagTypeList[0] = '`';
|
SwitchTagTypeList[0] = '`';
|
||||||
@@ -308,6 +309,7 @@ void NcmpcppKeys::SetDefaults()
|
|||||||
ToggleAutoCenter[1] = NullKey;
|
ToggleAutoCenter[1] = NullKey;
|
||||||
ToggleDisplayMode[1] = NullKey;
|
ToggleDisplayMode[1] = NullKey;
|
||||||
ToggleInterface[1] = NullKey;
|
ToggleInterface[1] = NullKey;
|
||||||
|
ToggleSeparatorsInPlaylist[1] = NullKey;
|
||||||
ToggleLyricsDB[1] = NullKey;
|
ToggleLyricsDB[1] = NullKey;
|
||||||
GoToParentDir[1] = 127;
|
GoToParentDir[1] = 127;
|
||||||
SwitchTagTypeList[1] = NullKey;
|
SwitchTagTypeList[1] = NullKey;
|
||||||
@@ -354,6 +356,7 @@ void NcmpcppConfig::SetDefaults()
|
|||||||
colors_enabled = true;
|
colors_enabled = true;
|
||||||
fancy_scrolling = true;
|
fancy_scrolling = true;
|
||||||
playlist_show_remaining_time = false;
|
playlist_show_remaining_time = false;
|
||||||
|
playlist_separate_albums = false;
|
||||||
columns_in_playlist = false;
|
columns_in_playlist = false;
|
||||||
columns_in_browser = false;
|
columns_in_browser = false;
|
||||||
columns_in_search_engine = false;
|
columns_in_search_engine = false;
|
||||||
@@ -571,6 +574,8 @@ void NcmpcppKeys::Read()
|
|||||||
GetKeys(key, ToggleAutoCenter);
|
GetKeys(key, ToggleAutoCenter);
|
||||||
else if (key.find("key_toggle_display_mode ") != std::string::npos)
|
else if (key.find("key_toggle_display_mode ") != std::string::npos)
|
||||||
GetKeys(key, ToggleDisplayMode);
|
GetKeys(key, ToggleDisplayMode);
|
||||||
|
else if (key.find("key_toggle_separators_in_playlist ") != std::string::npos)
|
||||||
|
GetKeys(key, ToggleSeparatorsInPlaylist);
|
||||||
else if (key.find("key_toggle_lyrics_db ") != std::string::npos)
|
else if (key.find("key_toggle_lyrics_db ") != std::string::npos)
|
||||||
GetKeys(key, ToggleLyricsDB);
|
GetKeys(key, ToggleLyricsDB);
|
||||||
else if (key.find("key_go_to_containing_directory ") != std::string::npos)
|
else if (key.find("key_go_to_containing_directory ") != std::string::npos)
|
||||||
@@ -826,6 +831,10 @@ void NcmpcppConfig::Read()
|
|||||||
{
|
{
|
||||||
playlist_show_remaining_time = v == "yes";
|
playlist_show_remaining_time = v == "yes";
|
||||||
}
|
}
|
||||||
|
else if (cl.find("playlist_separate_albums") != std::string::npos)
|
||||||
|
{
|
||||||
|
playlist_separate_albums = v == "yes";
|
||||||
|
}
|
||||||
else if (cl.find("playlist_display_mode") != std::string::npos)
|
else if (cl.find("playlist_display_mode") != std::string::npos)
|
||||||
{
|
{
|
||||||
columns_in_playlist = v == "columns";
|
columns_in_playlist = v == "columns";
|
||||||
|
|||||||
@@ -132,6 +132,7 @@ struct NcmpcppKeys
|
|||||||
int ToggleAutoCenter[2];
|
int ToggleAutoCenter[2];
|
||||||
int ToggleDisplayMode[2];
|
int ToggleDisplayMode[2];
|
||||||
int ToggleInterface[2];
|
int ToggleInterface[2];
|
||||||
|
int ToggleSeparatorsInPlaylist[2];
|
||||||
int ToggleLyricsDB[2];
|
int ToggleLyricsDB[2];
|
||||||
int GoToParentDir[2];
|
int GoToParentDir[2];
|
||||||
int SwitchTagTypeList[2];
|
int SwitchTagTypeList[2];
|
||||||
@@ -195,6 +196,7 @@ struct NcmpcppConfig
|
|||||||
bool colors_enabled;
|
bool colors_enabled;
|
||||||
bool fancy_scrolling;
|
bool fancy_scrolling;
|
||||||
bool playlist_show_remaining_time;
|
bool playlist_show_remaining_time;
|
||||||
|
bool playlist_separate_albums;
|
||||||
bool columns_in_playlist;
|
bool columns_in_playlist;
|
||||||
bool columns_in_browser;
|
bool columns_in_browser;
|
||||||
bool columns_in_search_engine;
|
bool columns_in_search_engine;
|
||||||
|
|||||||
Reference in New Issue
Block a user