Make 'update_environment' action also update local mpd status
This commit is contained in:
1
NEWS
1
NEWS
@@ -17,6 +17,7 @@ ncmpcpp-0.8 (????-??-??)
|
|||||||
* Added 'statusbar_time_color' and 'player_state_color' configuration variables for further customization of statusbar.
|
* Added 'statusbar_time_color' and 'player_state_color' configuration variables for further customization of statusbar.
|
||||||
* Format information can now be attached to selected color variables in the configuration file. Because of that variable 'progressbar_boldness' is now deprecated in favor of extended 'progressbar_color' and 'progressbar_elapsed_color' (for more information see example configuration file).
|
* Format information can now be attached to selected color variables in the configuration file. Because of that variable 'progressbar_boldness' is now deprecated in favor of extended 'progressbar_color' and 'progressbar_elapsed_color' (for more information see example configuration file).
|
||||||
* Lyrics and last_fm can now be startup screens and are lockable.
|
* Lyrics and last_fm can now be startup screens and are lockable.
|
||||||
|
* Action 'update_environment' now also synchronizes status with MPD.
|
||||||
|
|
||||||
ncmpcpp-0.7.7 (2016-10-31)
|
ncmpcpp-0.7.7 (2016-10-31)
|
||||||
* Fixed compilation on 32bit platforms.
|
* Fixed compilation on 32bit platforms.
|
||||||
|
|||||||
@@ -330,7 +330,7 @@ UpdateEnvironment::UpdateEnvironment()
|
|||||||
, m_past(boost::posix_time::from_time_t(0))
|
, m_past(boost::posix_time::from_time_t(0))
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
void UpdateEnvironment::run(bool update_timer, bool refresh_window)
|
void UpdateEnvironment::run(bool update_timer, bool refresh_window, bool mpd_sync)
|
||||||
{
|
{
|
||||||
using Global::Timer;
|
using Global::Timer;
|
||||||
|
|
||||||
@@ -352,11 +352,19 @@ void UpdateEnvironment::run(bool update_timer, bool refresh_window)
|
|||||||
|
|
||||||
if (refresh_window)
|
if (refresh_window)
|
||||||
myScreen->refreshWindow();
|
myScreen->refreshWindow();
|
||||||
|
|
||||||
|
// We want to synchronize with MPD during execution of an action chain.
|
||||||
|
if (mpd_sync)
|
||||||
|
{
|
||||||
|
int flags = Mpd.noidle();
|
||||||
|
if (flags)
|
||||||
|
Status::update(flags);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateEnvironment::run()
|
void UpdateEnvironment::run()
|
||||||
{
|
{
|
||||||
run(true, true);
|
run(true, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MouseEvent::canBeRun()
|
bool MouseEvent::canBeRun()
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ struct UpdateEnvironment: BaseAction
|
|||||||
{
|
{
|
||||||
UpdateEnvironment();
|
UpdateEnvironment();
|
||||||
|
|
||||||
void run(bool update_status, bool refresh_window);
|
void run(bool update_status, bool refresh_window, bool mpd_sync);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
boost::posix_time::ptime m_past;
|
boost::posix_time::ptime m_past;
|
||||||
|
|||||||
@@ -161,8 +161,7 @@ int main(int argc, char **argv)
|
|||||||
auto input = NC::Key::None;
|
auto input = NC::Key::None;
|
||||||
auto connect_attempt = boost::posix_time::from_time_t(0);
|
auto connect_attempt = boost::posix_time::from_time_t(0);
|
||||||
auto update_environment = static_cast<Actions::UpdateEnvironment &>(
|
auto update_environment = static_cast<Actions::UpdateEnvironment &>(
|
||||||
Actions::get(Actions::Type::UpdateEnvironment)
|
Actions::get(Actions::Type::UpdateEnvironment));
|
||||||
);
|
|
||||||
|
|
||||||
while (!Actions::ExitMainLoop)
|
while (!Actions::ExitMainLoop)
|
||||||
{
|
{
|
||||||
@@ -196,7 +195,7 @@ int main(int argc, char **argv)
|
|||||||
run_resize_screen = false;
|
run_resize_screen = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
update_environment.run(!key_pressed, key_pressed);
|
update_environment.run(!key_pressed, key_pressed, false);
|
||||||
|
|
||||||
input = readKey(*wFooter);
|
input = readKey(*wFooter);
|
||||||
key_pressed = input != NC::Key::None;
|
key_pressed = input != NC::Key::None;
|
||||||
|
|||||||
Reference in New Issue
Block a user