new feature: display remaining time of song instead of elapsed time
This commit is contained in:
@@ -1115,7 +1115,13 @@ int main(int argc, char *argv[])
|
||||
*wFooter << fmtBold;
|
||||
if (Config.new_design)
|
||||
{
|
||||
tracklength = Song::ShowTime(songpos);
|
||||
if (Config.display_remaining_time)
|
||||
{
|
||||
tracklength = "-";
|
||||
tracklength += Song::ShowTime(s->GetTotalLength()-songpos);
|
||||
}
|
||||
else
|
||||
tracklength = Song::ShowTime(songpos);
|
||||
tracklength += "/";
|
||||
tracklength += s->GetLength();
|
||||
*wHeader << XY(0, 0) << tracklength << " ";
|
||||
@@ -1123,7 +1129,17 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else
|
||||
{
|
||||
tracklength = "[" + Song::ShowTime(songpos) + "/" + s->GetLength() + "]";
|
||||
tracklength = "[";
|
||||
if (Config.display_remaining_time)
|
||||
{
|
||||
tracklength += "-";
|
||||
tracklength += Song::ShowTime(s->GetTotalLength()-songpos);
|
||||
}
|
||||
else
|
||||
tracklength = Song::ShowTime(songpos);
|
||||
tracklength += "/";
|
||||
tracklength += s->GetLength();
|
||||
tracklength += "]";
|
||||
*wFooter << XY(wFooter->GetWidth()-tracklength.length(), 1) << tracklength;
|
||||
}
|
||||
double progressbar_size = songpos/double(s->GetTotalLength());
|
||||
|
||||
@@ -292,6 +292,7 @@ void DefaultConfiguration(ncmpcpp_config &conf)
|
||||
conf.jump_to_now_playing_song_at_start = true;
|
||||
conf.clock_display_seconds = false;
|
||||
conf.display_bitrate = false;
|
||||
conf.display_remaining_time = false;
|
||||
conf.ignore_leading_the = false;
|
||||
conf.block_search_constraints_change = true;
|
||||
conf.use_console_editor = false;
|
||||
@@ -743,6 +744,10 @@ void ReadConfiguration(ncmpcpp_config &conf)
|
||||
{
|
||||
conf.display_bitrate = v == "yes";
|
||||
}
|
||||
else if (cl.find("display_remaining_time") != std::string::npos)
|
||||
{
|
||||
conf.display_remaining_time = v == "yes";
|
||||
}
|
||||
else if (cl.find("ignore_leading_the") != std::string::npos)
|
||||
{
|
||||
conf.ignore_leading_the = v == "yes";
|
||||
|
||||
@@ -190,6 +190,7 @@ struct ncmpcpp_config
|
||||
bool jump_to_now_playing_song_at_start;
|
||||
bool clock_display_seconds;
|
||||
bool display_bitrate;
|
||||
bool display_remaining_time;
|
||||
bool ignore_leading_the;
|
||||
bool block_search_constraints_change;
|
||||
bool use_console_editor;
|
||||
|
||||
@@ -415,7 +415,13 @@ void NcmpcppStatusChanged(Connection *, StatusChanges changed, void *)
|
||||
std::string tracklength;
|
||||
if (Config.new_design)
|
||||
{
|
||||
tracklength = Song::ShowTime(elapsed);
|
||||
if (Config.display_remaining_time)
|
||||
{
|
||||
tracklength = "-";
|
||||
tracklength += Song::ShowTime(np.GetTotalLength()-elapsed);
|
||||
}
|
||||
else
|
||||
tracklength = Song::ShowTime(elapsed);
|
||||
if (np.GetTotalLength())
|
||||
{
|
||||
tracklength += "/";
|
||||
@@ -466,7 +472,13 @@ void NcmpcppStatusChanged(Connection *, StatusChanges changed, void *)
|
||||
tracklength += " [";
|
||||
if (np.GetTotalLength())
|
||||
{
|
||||
tracklength += Song::ShowTime(elapsed);
|
||||
if (Config.display_remaining_time)
|
||||
{
|
||||
tracklength += "-";
|
||||
tracklength += Song::ShowTime(np.GetTotalLength()-elapsed);
|
||||
}
|
||||
else
|
||||
tracklength += Song::ShowTime(elapsed);
|
||||
tracklength += "/";
|
||||
tracklength += np.GetLength();
|
||||
tracklength += "]";
|
||||
|
||||
Reference in New Issue
Block a user