Make jump_to_playing_song not runnable if there is no playing song
This commit is contained in:
1
NEWS
1
NEWS
@@ -19,6 +19,7 @@ ncmpcpp-0.8 (????-??-??)
|
|||||||
* 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.
|
* Action 'update_environment' now also synchronizes status with MPD.
|
||||||
* Fixed an issue that could cause some MPD events to be missed.
|
* Fixed an issue that could cause some MPD events to be missed.
|
||||||
|
* ACtion 'jump_to_playing_song' is not runnable now if there is no playing song.
|
||||||
|
|
||||||
ncmpcpp-0.7.7 (2016-10-31)
|
ncmpcpp-0.7.7 (2016-10-31)
|
||||||
* Fixed compilation on 32bit platforms.
|
* Fixed compilation on 32bit platforms.
|
||||||
|
|||||||
@@ -1204,27 +1204,26 @@ void UpdateDatabase::run()
|
|||||||
|
|
||||||
bool JumpToPlayingSong::canBeRun()
|
bool JumpToPlayingSong::canBeRun()
|
||||||
{
|
{
|
||||||
return myScreen == myPlaylist
|
m_song = myPlaylist->nowPlayingSong();
|
||||||
|| myScreen == myBrowser
|
return !m_song.empty()
|
||||||
|| myScreen == myLibrary;
|
&& (myScreen == myPlaylist
|
||||||
|
|| myScreen == myBrowser
|
||||||
|
|| myScreen == myLibrary);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JumpToPlayingSong::run()
|
void JumpToPlayingSong::run()
|
||||||
{
|
{
|
||||||
auto s = myPlaylist->nowPlayingSong();
|
|
||||||
if (s.empty())
|
|
||||||
return;
|
|
||||||
if (myScreen == myPlaylist)
|
if (myScreen == myPlaylist)
|
||||||
{
|
{
|
||||||
myPlaylist->locateSong(s);
|
myPlaylist->locateSong(m_song);
|
||||||
}
|
}
|
||||||
else if (myScreen == myBrowser)
|
else if (myScreen == myBrowser)
|
||||||
{
|
{
|
||||||
myBrowser->locateSong(s);
|
myBrowser->locateSong(m_song);
|
||||||
}
|
}
|
||||||
else if (myScreen == myLibrary)
|
else if (myScreen == myLibrary)
|
||||||
{
|
{
|
||||||
myLibrary->locateSong(s);
|
myLibrary->locateSong(m_song);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -682,6 +682,8 @@ struct JumpToPlayingSong: BaseAction
|
|||||||
private:
|
private:
|
||||||
virtual bool canBeRun() override;
|
virtual bool canBeRun() override;
|
||||||
virtual void run() override;
|
virtual void run() override;
|
||||||
|
|
||||||
|
MPD::Song m_song;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ToggleRepeat: BaseAction
|
struct ToggleRepeat: BaseAction
|
||||||
|
|||||||
Reference in New Issue
Block a user