use flag to force status update rather than doing additional update
This commit is contained in:
@@ -44,6 +44,7 @@ namespace Global
|
||||
|
||||
extern bool BlockItemListUpdate;
|
||||
|
||||
extern bool UpdateStatusImmediately;
|
||||
extern bool MessagesAllowed;
|
||||
extern bool RedrawHeader;
|
||||
|
||||
|
||||
@@ -196,7 +196,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
ShowMessage("Connected to %s!", Mpd->GetHostname().c_str());
|
||||
MessagesAllowed = 0;
|
||||
Mpd->UpdateStatus();
|
||||
UpdateStatusImmediately = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -551,17 +551,17 @@ int main(int argc, char *argv[])
|
||||
else if (Keypressed(input, Key.Prev))
|
||||
{
|
||||
Mpd->Prev();
|
||||
Mpd->UpdateStatus();
|
||||
UpdateStatusImmediately = 1;
|
||||
}
|
||||
else if (Keypressed(input, Key.Next))
|
||||
{
|
||||
Mpd->Next();
|
||||
Mpd->UpdateStatus();
|
||||
UpdateStatusImmediately = 1;
|
||||
}
|
||||
else if (Keypressed(input, Key.Pause))
|
||||
{
|
||||
Mpd->Pause();
|
||||
Mpd->UpdateStatus();
|
||||
UpdateStatusImmediately = 1;
|
||||
}
|
||||
else if (Keypressed(input, Key.SavePlaylist))
|
||||
{
|
||||
@@ -618,7 +618,7 @@ int main(int argc, char *argv[])
|
||||
else if (Keypressed(input, Key.Stop))
|
||||
{
|
||||
Mpd->Stop();
|
||||
Mpd->UpdateStatus();
|
||||
UpdateStatusImmediately = 1;
|
||||
}
|
||||
else if (Keypressed(input, Key.MvSongUp))
|
||||
{
|
||||
@@ -991,7 +991,7 @@ int main(int argc, char *argv[])
|
||||
wFooter->Refresh();
|
||||
}
|
||||
Mpd->Seek(songpos);
|
||||
Mpd->UpdateStatus();
|
||||
UpdateStatusImmediately = 1;
|
||||
|
||||
UnlockProgressbar();
|
||||
UnlockStatusbar();
|
||||
@@ -1081,17 +1081,17 @@ int main(int argc, char *argv[])
|
||||
else if (Keypressed(input, Key.ToggleRepeat))
|
||||
{
|
||||
Mpd->SetRepeat(!Mpd->GetRepeat());
|
||||
Mpd->UpdateStatus();
|
||||
UpdateStatusImmediately = 1;
|
||||
}
|
||||
else if (Keypressed(input, Key.Shuffle))
|
||||
{
|
||||
Mpd->Shuffle();
|
||||
Mpd->UpdateStatus();
|
||||
UpdateStatusImmediately = 1;
|
||||
}
|
||||
else if (Keypressed(input, Key.ToggleRandom))
|
||||
{
|
||||
Mpd->SetRandom(!Mpd->GetRandom());
|
||||
Mpd->UpdateStatus();
|
||||
UpdateStatusImmediately = 1;
|
||||
}
|
||||
else if (Keypressed(input, Key.ToggleSingle))
|
||||
{
|
||||
@@ -1106,18 +1106,18 @@ int main(int argc, char *argv[])
|
||||
else
|
||||
{
|
||||
Mpd->SetSingle(!Mpd->GetSingle());
|
||||
Mpd->UpdateStatus();
|
||||
UpdateStatusImmediately = 1;
|
||||
}
|
||||
}
|
||||
else if (Keypressed(input, Key.ToggleConsume))
|
||||
{
|
||||
Mpd->SetConsume(!Mpd->GetConsume());
|
||||
Mpd->UpdateStatus();
|
||||
UpdateStatusImmediately = 1;
|
||||
}
|
||||
else if (Keypressed(input, Key.ToggleCrossfade))
|
||||
{
|
||||
Mpd->SetCrossfade(Mpd->GetCrossfade() ? 0 : Config.crossfade_time);
|
||||
Mpd->UpdateStatus();
|
||||
UpdateStatusImmediately = 1;
|
||||
}
|
||||
else if (Keypressed(input, Key.SetCrossfade))
|
||||
{
|
||||
@@ -1130,7 +1130,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
Config.crossfade_time = cf;
|
||||
Mpd->SetCrossfade(cf);
|
||||
Mpd->UpdateStatus();
|
||||
UpdateStatusImmediately = 1;
|
||||
}
|
||||
}
|
||||
else if (Keypressed(input, Key.EditTags))
|
||||
@@ -1345,7 +1345,7 @@ int main(int argc, char *argv[])
|
||||
else
|
||||
ShowMessage("Out of bounds, 1-99 possible for %, %d given.", newpos);
|
||||
}
|
||||
Mpd->UpdateStatus();
|
||||
UpdateStatusImmediately = 1;
|
||||
}
|
||||
else if (Keypressed(input, Key.ReverseSelection))
|
||||
{
|
||||
@@ -1551,7 +1551,6 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
Mpd->ClearPlaylist();
|
||||
}
|
||||
Mpd->UpdateStatus();
|
||||
ShowMessage("Cleared playlist!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ void Playlist::EnterPressed()
|
||||
if (!w->Empty())
|
||||
{
|
||||
Mpd->PlayID(w->Current().GetID());
|
||||
Mpd->UpdateStatus();
|
||||
UpdateStatusImmediately = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,8 @@ using std::string;
|
||||
|
||||
string Global::VolumeState;
|
||||
|
||||
bool Global::UpdateStatusImmediately = 0;
|
||||
|
||||
namespace
|
||||
{
|
||||
time_t time_of_statusbar_lock;
|
||||
@@ -115,13 +117,15 @@ void TraceMpdStatus()
|
||||
static timeval past, now;
|
||||
|
||||
gettimeofday(&now, 0);
|
||||
if (Mpd->Connected()
|
||||
&& ((now.tv_sec == past.tv_sec && now.tv_usec >= past.tv_usec+500000) || now.tv_sec > past.tv_sec)
|
||||
if ((Mpd->Connected()
|
||||
&& ((now.tv_sec == past.tv_sec && now.tv_usec >= past.tv_usec+500000) || now.tv_sec > past.tv_sec))
|
||||
|| UpdateStatusImmediately
|
||||
)
|
||||
{
|
||||
Mpd->UpdateStatus();
|
||||
BlockItemListUpdate = 0;
|
||||
Playlist::BlockUpdate = 0;
|
||||
UpdateStatusImmediately = 0;
|
||||
gettimeofday(&past, 0);
|
||||
}
|
||||
wFooter->Refresh();
|
||||
|
||||
Reference in New Issue
Block a user