lighter deletion + playlist status added
This commit is contained in:
@@ -82,6 +82,54 @@ void WindowTitle(const string &status)
|
|||||||
printf("\033]0;%s\7",status.c_str());
|
printf("\033]0;%s\7",status.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string TotalPlaylistLength()
|
||||||
|
{
|
||||||
|
const int MINUTE = 60;
|
||||||
|
const int HOUR = 60*MINUTE;
|
||||||
|
const int DAY = 24*HOUR;
|
||||||
|
const int YEAR = 365*DAY;
|
||||||
|
string result;
|
||||||
|
int length = 0;
|
||||||
|
for (vector<Song *>::const_iterator it = vPlaylist.begin(); it != vPlaylist.end(); it++)
|
||||||
|
length += (*it)->GetTotalLength();
|
||||||
|
|
||||||
|
int years = length/YEAR;
|
||||||
|
if (years)
|
||||||
|
{
|
||||||
|
result += IntoStr(years) + (years == 1 ? " year" : " years");
|
||||||
|
length -= years*YEAR;
|
||||||
|
if (length)
|
||||||
|
result += ", ";
|
||||||
|
}
|
||||||
|
int days = length/DAY;
|
||||||
|
if (days)
|
||||||
|
{
|
||||||
|
result += IntoStr(days) + (days == 1 ? " day" : " days");
|
||||||
|
length -= days*DAY;
|
||||||
|
if (length)
|
||||||
|
result += ", ";
|
||||||
|
}
|
||||||
|
int hours = length/HOUR;
|
||||||
|
if (hours)
|
||||||
|
{
|
||||||
|
result += IntoStr(hours) + (hours == 1 ? " hour" : " hours");
|
||||||
|
length -= hours*HOUR;
|
||||||
|
if (length)
|
||||||
|
result += ", ";
|
||||||
|
}
|
||||||
|
int minutes = length/MINUTE;
|
||||||
|
if (minutes)
|
||||||
|
{
|
||||||
|
result += IntoStr(minutes) + (minutes == 1 ? " minute" : " minutes");
|
||||||
|
length -= minutes*MINUTE;
|
||||||
|
if (length)
|
||||||
|
result += ", ";
|
||||||
|
}
|
||||||
|
if (length)
|
||||||
|
result += IntoStr(length) + (length == 1 ? " second" : " seconds");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
string DisplaySong(const Song &s, const string &song_template)
|
string DisplaySong(const Song &s, const string &song_template)
|
||||||
{
|
{
|
||||||
string result;
|
string result;
|
||||||
@@ -506,6 +554,7 @@ bool GetSongInfo(Song &s)
|
|||||||
|
|
||||||
void GetDirectory(string dir)
|
void GetDirectory(string dir)
|
||||||
{
|
{
|
||||||
|
int highlightme = -1;
|
||||||
browsed_dir_scroll_begin = 0;
|
browsed_dir_scroll_begin = 0;
|
||||||
if (browsed_dir != dir)
|
if (browsed_dir != dir)
|
||||||
mBrowser->Reset();
|
mBrowser->Reset();
|
||||||
@@ -545,8 +594,7 @@ void GetDirectory(string dir)
|
|||||||
vBrowser.push_back(directory);
|
vBrowser.push_back(directory);
|
||||||
mBrowser->AddOption("[" + directory.name + "]");
|
mBrowser->AddOption("[" + directory.name + "]");
|
||||||
if (directory.name == browsed_subdir)
|
if (directory.name == browsed_subdir)
|
||||||
mBrowser->Highlight(mBrowser->MaxChoice());
|
highlightme = mBrowser->MaxChoice();
|
||||||
redraw_me = 1;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MPD_DATA_TYPE_SONG:
|
case MPD_DATA_TYPE_SONG:
|
||||||
@@ -571,6 +619,7 @@ void GetDirectory(string dir)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mBrowser->Highlight(highlightme);
|
||||||
mpd_data_free(browser);
|
mpd_data_free(browser);
|
||||||
browsed_subdir.clear();
|
browsed_subdir.clear();
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ extern ncmpcpp_config Config;
|
|||||||
bool SortSongsByTrack(const Song &, const Song &);
|
bool SortSongsByTrack(const Song &, const Song &);
|
||||||
bool CaseInsensitiveComparison(string, string);
|
bool CaseInsensitiveComparison(string, string);
|
||||||
void WindowTitle(const string &);
|
void WindowTitle(const string &);
|
||||||
|
string TotalPlaylistLength();
|
||||||
string DisplaySong(const Song &, const string & = Config.song_list_format);
|
string DisplaySong(const Song &, const string & = Config.song_list_format);
|
||||||
void ShowMessage(const string &, int = Config.message_delay_time);
|
void ShowMessage(const string &, int = Config.message_delay_time);
|
||||||
void GetDirectory(string);
|
void GetDirectory(string);
|
||||||
|
|||||||
64
src/menu.cpp
64
src/menu.cpp
@@ -214,29 +214,26 @@ void Menu::DeleteOption(int no)
|
|||||||
if (itsHighlight > itsOptions.size()-1)
|
if (itsHighlight > itsOptions.size()-1)
|
||||||
itsHighlight = itsOptions.size()-1;
|
itsHighlight = itsOptions.size()-1;
|
||||||
|
|
||||||
|
idlok(itsWindow, 1);
|
||||||
|
scrollok(itsWindow, 1);
|
||||||
int MaxBeginning = itsOptions.size() < itsHeight ? 0 : itsOptions.size()-itsHeight;
|
int MaxBeginning = itsOptions.size() < itsHeight ? 0 : itsOptions.size()-itsHeight;
|
||||||
if (itsBeginning > MaxBeginning)
|
if (itsBeginning > MaxBeginning)
|
||||||
{
|
{
|
||||||
itsBeginning = MaxBeginning;
|
itsBeginning = MaxBeginning;
|
||||||
NeedsRedraw.push_back(itsHighlight);
|
wmove(itsWindow, no-1-itsBeginning, 0);
|
||||||
Refresh();
|
wdeleteln(itsWindow);
|
||||||
redraw_screen();
|
wscrl(itsWindow, -1);
|
||||||
|
NeedsRedraw.push_back(itsBeginning);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vector<Option *>::const_iterator it = itsOptions.begin()+itsHighlight;
|
wmove(itsWindow, no-1-itsBeginning, 0);
|
||||||
NeedsRedraw.reserve(itsHeight);
|
wdeleteln(itsWindow);
|
||||||
int i = itsHighlight;
|
|
||||||
for (; i < itsBeginning+itsHeight && it != itsOptions.end(); i++, it++)
|
|
||||||
NeedsRedraw.push_back(i);
|
|
||||||
for (; i < itsBeginning+itsHeight; i++)
|
|
||||||
mvwhline(itsWindow, i, 0, 32, itsWidth);
|
|
||||||
}
|
}
|
||||||
|
NeedsRedraw.push_back(itsHighlight);
|
||||||
/*if (itsBeginning > 0 && itsBeginning == itsOptions.size()-itsHeight)
|
NeedsRedraw.push_back(itsBeginning+itsHeight-1);
|
||||||
itsBeginning--;
|
scrollok(itsWindow, 0);
|
||||||
Go(UP);*/
|
idlok(itsWindow, 0);
|
||||||
//Window::Clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Menu::redraw_screen()
|
void Menu::redraw_screen()
|
||||||
@@ -511,17 +508,46 @@ void Menu::Go(WHERE where)
|
|||||||
|
|
||||||
void Menu::Highlight(int which)
|
void Menu::Highlight(int which)
|
||||||
{
|
{
|
||||||
if (which <= itsOptions.size())
|
which--;
|
||||||
itsHighlight = which-1;
|
|
||||||
|
int old_highlight = itsHighlight;
|
||||||
|
int old_beginning = itsBeginning;
|
||||||
|
|
||||||
|
if (which < itsOptions.size())
|
||||||
|
itsHighlight = which;
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (which > itsHeight)
|
if (which >= itsHeight)
|
||||||
|
{
|
||||||
itsBeginning = itsHighlight-itsHeight/2;
|
itsBeginning = itsHighlight-itsHeight/2;
|
||||||
|
if (itsBeginning > itsOptions.size()-itsHeight)
|
||||||
|
itsBeginning = itsOptions.size()-itsHeight;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
itsBeginning = 0;
|
itsBeginning = 0;
|
||||||
|
|
||||||
redraw_screen();
|
int howmuch = itsBeginning-old_beginning;
|
||||||
|
|
||||||
|
if (Abs(howmuch) > itsHeight/2)
|
||||||
|
redraw_screen();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
idlok(itsWindow, 1);
|
||||||
|
scrollok(itsWindow, 1);
|
||||||
|
if (old_highlight >= itsBeginning && old_highlight < itsBeginning+itsHeight)
|
||||||
|
NeedsRedraw.push_back(old_highlight);
|
||||||
|
wscrl(itsWindow, howmuch);
|
||||||
|
if (howmuch < 0)
|
||||||
|
for (int i = 0; i < Abs(howmuch); i++)
|
||||||
|
NeedsRedraw.push_back(itsBeginning+i);
|
||||||
|
else
|
||||||
|
for (int i = 0; i < Abs(howmuch); i++)
|
||||||
|
NeedsRedraw.push_back(itsBeginning+itsHeight-1-i);
|
||||||
|
NeedsRedraw.push_back(itsHighlight);
|
||||||
|
scrollok(itsWindow, 0);
|
||||||
|
idlok(itsWindow, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Menu::Reset()
|
void Menu::Reset()
|
||||||
|
|||||||
11
src/misc.cpp
11
src/misc.cpp
@@ -22,16 +22,16 @@
|
|||||||
|
|
||||||
using std::stringstream;
|
using std::stringstream;
|
||||||
|
|
||||||
|
int Abs(int num)
|
||||||
|
{
|
||||||
|
return (num < 0 ? -num : num);
|
||||||
|
}
|
||||||
|
|
||||||
int StrToInt(string str)
|
int StrToInt(string str)
|
||||||
{
|
{
|
||||||
return atoi(str.c_str());
|
return atoi(str.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
int StrToInt(char str[])
|
|
||||||
{
|
|
||||||
return atoi(str);
|
|
||||||
}
|
|
||||||
|
|
||||||
string IntoStr(int liczba)
|
string IntoStr(int liczba)
|
||||||
{
|
{
|
||||||
stringstream ss;
|
stringstream ss;
|
||||||
@@ -66,4 +66,3 @@ string ShowTime(int length)
|
|||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -28,8 +28,9 @@
|
|||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
|
int Abs(int);
|
||||||
|
|
||||||
int StrToInt(string);
|
int StrToInt(string);
|
||||||
int StrToInt(char);
|
|
||||||
|
|
||||||
string IntoStr(int);
|
string IntoStr(int);
|
||||||
string IntoStr(double, int);
|
string IntoStr(double, int);
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ time_t now;
|
|||||||
int now_playing = -1;
|
int now_playing = -1;
|
||||||
int playing_song_scroll_begin = 0;
|
int playing_song_scroll_begin = 0;
|
||||||
int browsed_dir_scroll_begin = 0;
|
int browsed_dir_scroll_begin = 0;
|
||||||
|
int stats_scroll_begin = 0;
|
||||||
|
|
||||||
int block_statusbar_update_delay = -1;
|
int block_statusbar_update_delay = -1;
|
||||||
|
|
||||||
@@ -118,6 +119,7 @@ bool title_allowed = 0;
|
|||||||
|
|
||||||
bool header_update_status = 0;
|
bool header_update_status = 0;
|
||||||
|
|
||||||
|
bool dont_change_now_playing = 0;
|
||||||
bool block_progressbar_update = 0;
|
bool block_progressbar_update = 0;
|
||||||
bool block_statusbar_update = 0;
|
bool block_statusbar_update = 0;
|
||||||
bool allow_statusbar_unblock = 1;
|
bool allow_statusbar_unblock = 1;
|
||||||
@@ -134,6 +136,8 @@ extern string UNKNOWN_ARTIST;
|
|||||||
extern string UNKNOWN_TITLE;
|
extern string UNKNOWN_TITLE;
|
||||||
extern string UNKNOWN_ALBUM;
|
extern string UNKNOWN_ALBUM;
|
||||||
|
|
||||||
|
extern string playlist_stats;
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
DefaultConfiguration(Config);
|
DefaultConfiguration(Config);
|
||||||
@@ -308,7 +312,7 @@ int main(int argc, char *argv[])
|
|||||||
title = "Help";
|
title = "Help";
|
||||||
break;
|
break;
|
||||||
case csPlaylist:
|
case csPlaylist:
|
||||||
title = "Playlist";
|
title = "Playlist ";
|
||||||
break;
|
break;
|
||||||
case csBrowser:
|
case csBrowser:
|
||||||
title = "Browse: ";
|
title = "Browse: ";
|
||||||
@@ -329,6 +333,40 @@ int main(int argc, char *argv[])
|
|||||||
wHeader->Bold(1);
|
wHeader->Bold(1);
|
||||||
wHeader->WriteXY(0, 0, title, 1);
|
wHeader->WriteXY(0, 0, title, 1);
|
||||||
wHeader->Bold(0);
|
wHeader->Bold(0);
|
||||||
|
|
||||||
|
if (current_screen == csPlaylist && !playlist_stats.empty())
|
||||||
|
{
|
||||||
|
int max_length = wHeader->GetWidth()-volume_state.length()-title.length();
|
||||||
|
if (playlist_stats.length() > max_length)
|
||||||
|
wHeader->WriteXY(title.length(), 0, playlist_stats.substr(0, max_length));
|
||||||
|
else
|
||||||
|
wHeader->WriteXY(title.length(), 0, playlist_stats);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (current_screen == csBrowser)
|
||||||
|
{
|
||||||
|
int max_length_without_scroll = wHeader->GetWidth()-volume_state.length()-title.length();
|
||||||
|
ncmpcpp_string_t wbrowseddir = NCMPCPP_TO_WSTRING(browsed_dir);
|
||||||
|
wHeader->Bold(1);
|
||||||
|
if (browsed_dir.length() > max_length_without_scroll)
|
||||||
|
{
|
||||||
|
# ifdef UTF8_ENABLED
|
||||||
|
wbrowseddir += L" ** ";
|
||||||
|
# else
|
||||||
|
wbrowseddir += " ** ";
|
||||||
|
# endif
|
||||||
|
const int scrollsize = max_length_without_scroll;
|
||||||
|
ncmpcpp_string_t part = wbrowseddir.substr(browsed_dir_scroll_begin++, scrollsize);
|
||||||
|
if (part.length() < scrollsize)
|
||||||
|
part += wbrowseddir.substr(0, scrollsize-part.length());
|
||||||
|
wHeader->WriteXY(title.length(), 0, part);
|
||||||
|
if (browsed_dir_scroll_begin >= wbrowseddir.length())
|
||||||
|
browsed_dir_scroll_begin = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
wHeader->WriteXY(title.length(), 0, browsed_dir);
|
||||||
|
wHeader->Bold(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
wHeader->WriteXY(0, 0, "[b]1:[/b]Help [b]2:[/b]Playlist [b]3:[/b]Browse [b]4:[/b]Search [b]5:[/b]Library", 1);
|
wHeader->WriteXY(0, 0, "[b]1:[/b]Help [b]2:[/b]Playlist [b]3:[/b]Browse [b]4:[/b]Search [b]5:[/b]Library", 1);
|
||||||
@@ -336,31 +374,6 @@ int main(int argc, char *argv[])
|
|||||||
wHeader->SetColor(Config.volume_color);
|
wHeader->SetColor(Config.volume_color);
|
||||||
wHeader->WriteXY(max_allowed_title_length, 0, volume_state);
|
wHeader->WriteXY(max_allowed_title_length, 0, volume_state);
|
||||||
wHeader->SetColor(Config.header_color);
|
wHeader->SetColor(Config.header_color);
|
||||||
|
|
||||||
if (current_screen == csBrowser)
|
|
||||||
{
|
|
||||||
int max_length_without_scroll = wHeader->GetWidth()-volume_state.length()-title.length();
|
|
||||||
ncmpcpp_string_t wbrowseddir = NCMPCPP_TO_WSTRING(browsed_dir);
|
|
||||||
wHeader->Bold(1);
|
|
||||||
if (browsed_dir.length() > max_length_without_scroll)
|
|
||||||
{
|
|
||||||
# ifdef UTF8_ENABLED
|
|
||||||
wbrowseddir += L" ** ";
|
|
||||||
# else
|
|
||||||
wbrowseddir += " ** ";
|
|
||||||
# endif
|
|
||||||
const int scrollsize = max_length_without_scroll;
|
|
||||||
ncmpcpp_string_t part = wbrowseddir.substr(browsed_dir_scroll_begin++, scrollsize);
|
|
||||||
if (part.length() < scrollsize)
|
|
||||||
part += wbrowseddir.substr(0, scrollsize-part.length());
|
|
||||||
wHeader->WriteXY(8, 0, part);
|
|
||||||
if (browsed_dir_scroll_begin >= wbrowseddir.length())
|
|
||||||
browsed_dir_scroll_begin = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
wHeader->WriteXY(8, 0, browsed_dir);
|
|
||||||
wHeader->Bold(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current_screen == csLibrary && !block_library_update)
|
if (current_screen == csLibrary && !block_library_update)
|
||||||
@@ -1161,6 +1174,7 @@ int main(int argc, char *argv[])
|
|||||||
if (!mPlaylist->Empty() && current_screen == csPlaylist)
|
if (!mPlaylist->Empty() && current_screen == csPlaylist)
|
||||||
{
|
{
|
||||||
block_playlist_update = 1;
|
block_playlist_update = 1;
|
||||||
|
dont_change_now_playing = 1;
|
||||||
mPlaylist->Timeout(50);
|
mPlaylist->Timeout(50);
|
||||||
int id = mPlaylist->GetChoice()-1;
|
int id = mPlaylist->GetChoice()-1;
|
||||||
|
|
||||||
@@ -1174,17 +1188,18 @@ int main(int argc, char *argv[])
|
|||||||
id = mPlaylist->GetChoice()-1;
|
id = mPlaylist->GetChoice()-1;
|
||||||
|
|
||||||
mpd_playlist_queue_delete_pos(conn, id);
|
mpd_playlist_queue_delete_pos(conn, id);
|
||||||
if (now_playing > id)
|
|
||||||
now_playing--;
|
|
||||||
delete vPlaylist[id];
|
delete vPlaylist[id];
|
||||||
vPlaylist.erase(vPlaylist.begin()+id);
|
vPlaylist.erase(vPlaylist.begin()+id);
|
||||||
mPlaylist->DeleteOption(id+1);
|
mPlaylist->DeleteOption(id+1);
|
||||||
|
if (now_playing > id)
|
||||||
|
now_playing--;
|
||||||
mPlaylist->Refresh();
|
mPlaylist->Refresh();
|
||||||
}
|
}
|
||||||
mPlaylist->ReadKey(input);
|
mPlaylist->ReadKey(input);
|
||||||
}
|
}
|
||||||
mpd_playlist_queue_commit(conn);
|
mpd_playlist_queue_commit(conn);
|
||||||
mPlaylist->Timeout(ncmpcpp_window_timeout);
|
mPlaylist->Timeout(ncmpcpp_window_timeout);
|
||||||
|
dont_change_now_playing = 0;
|
||||||
block_playlist_update = 0;
|
block_playlist_update = 0;
|
||||||
}
|
}
|
||||||
if (current_screen == csBrowser)
|
if (current_screen == csBrowser)
|
||||||
@@ -1385,7 +1400,6 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
if (current_screen == csPlaylist && now_playing >= 0)
|
if (current_screen == csPlaylist && now_playing >= 0)
|
||||||
mPlaylist->Highlight(now_playing+1);
|
mPlaylist->Highlight(now_playing+1);
|
||||||
redraw_me = 1;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'r': // switch repeat state
|
case 'r': // switch repeat state
|
||||||
@@ -1536,7 +1550,7 @@ int main(int argc, char *argv[])
|
|||||||
timer = time(NULL);
|
timer = time(NULL);
|
||||||
if (findme.empty())
|
if (findme.empty())
|
||||||
break;
|
break;
|
||||||
transform(findme.begin(), findme.end(), findme.end(), tolower);
|
transform(findme.begin(), findme.end(), findme.begin(), tolower);
|
||||||
|
|
||||||
if (input == '/') // forward
|
if (input == '/') // forward
|
||||||
{
|
{
|
||||||
@@ -1562,7 +1576,10 @@ int main(int argc, char *argv[])
|
|||||||
if (vFoundPositions.empty())
|
if (vFoundPositions.empty())
|
||||||
ShowMessage("Unable to find \"" + findme + "\"");
|
ShowMessage("Unable to find \"" + findme + "\"");
|
||||||
else
|
else
|
||||||
|
{
|
||||||
mCurrent->Highlight(vFoundPositions.front());
|
mCurrent->Highlight(vFoundPositions.front());
|
||||||
|
mCurrent->Highlighting(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ extern CurrScreen current_screen;
|
|||||||
|
|
||||||
extern bool header_update_status;
|
extern bool header_update_status;
|
||||||
|
|
||||||
|
extern bool dont_change_now_playing;
|
||||||
extern bool allow_statusbar_unblock;
|
extern bool allow_statusbar_unblock;
|
||||||
extern bool block_progressbar_update;
|
extern bool block_progressbar_update;
|
||||||
extern bool block_statusbar_update;
|
extern bool block_statusbar_update;
|
||||||
@@ -81,6 +82,8 @@ long long playlist_old_id = -1;
|
|||||||
|
|
||||||
int old_playing;
|
int old_playing;
|
||||||
|
|
||||||
|
string playlist_stats;
|
||||||
|
|
||||||
void TraceMpdStatus()
|
void TraceMpdStatus()
|
||||||
{
|
{
|
||||||
mpd_status_update(conn);
|
mpd_status_update(conn);
|
||||||
@@ -130,7 +133,7 @@ void NcmpcppStatusChanged(MpdObj *conn, ChangedStatusType what)
|
|||||||
wFooter->Bold(1);
|
wFooter->Bold(1);
|
||||||
wFooter->GetXY(sx, sy);
|
wFooter->GetXY(sx, sy);
|
||||||
|
|
||||||
if (now_playing != mpd_player_get_current_song_pos(conn) || what & MPD_CST_SONGID)
|
if ((now_playing != mpd_player_get_current_song_pos(conn) || what & MPD_CST_SONGID) && !dont_change_now_playing)
|
||||||
{
|
{
|
||||||
old_playing = now_playing;
|
old_playing = now_playing;
|
||||||
now_playing = mpd_player_get_current_song_pos(conn);
|
now_playing = mpd_player_get_current_song_pos(conn);
|
||||||
@@ -208,9 +211,12 @@ void NcmpcppStatusChanged(MpdObj *conn, ChangedStatusType what)
|
|||||||
|
|
||||||
if (vPlaylist.empty())
|
if (vPlaylist.empty())
|
||||||
{
|
{
|
||||||
|
playlist_stats.clear();
|
||||||
mPlaylist->Reset();
|
mPlaylist->Reset();
|
||||||
ShowMessage("Cleared playlist!");
|
ShowMessage("Cleared playlist!");
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
playlist_stats = "(" + IntoStr(vPlaylist.size()) + (vPlaylist.size() == 1 ? " song" : " songs") + ", length: " + TotalPlaylistLength() + ")";
|
||||||
|
|
||||||
if (current_screen == csBrowser)
|
if (current_screen == csBrowser)
|
||||||
{
|
{
|
||||||
@@ -422,7 +428,6 @@ void NcmpcppStatusChanged(MpdObj *conn, ChangedStatusType what)
|
|||||||
{
|
{
|
||||||
if (!vPlaylist.empty() && now_playing >= 0)
|
if (!vPlaylist.empty() && now_playing >= 0)
|
||||||
{
|
{
|
||||||
Song &s = *vPlaylist[now_playing];
|
|
||||||
if (!mPlaylist->Empty())
|
if (!mPlaylist->Empty())
|
||||||
{
|
{
|
||||||
if (old_playing >= 0)
|
if (old_playing >= 0)
|
||||||
@@ -447,5 +452,6 @@ void NcmpcppStatusChanged(MpdObj *conn, ChangedStatusType what)
|
|||||||
wFooter->Refresh();
|
wFooter->Refresh();
|
||||||
wFooter->AutoRefresh(1);
|
wFooter->AutoRefresh(1);
|
||||||
wFooter->EnableBB();
|
wFooter->EnableBB();
|
||||||
|
wCurrent->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user