minor fixes for moving and deleting items
This commit is contained in:
@@ -1703,6 +1703,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
if (!mPlaylist->Empty() && current_screen == csPlaylist)
|
if (!mPlaylist->Empty() && current_screen == csPlaylist)
|
||||||
{
|
{
|
||||||
|
block_playlist_update = 1;
|
||||||
if (mPlaylist->IsAnySelected())
|
if (mPlaylist->IsAnySelected())
|
||||||
{
|
{
|
||||||
vector<int> list;
|
vector<int> list;
|
||||||
@@ -1717,15 +1718,17 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
block_playlist_update = 1;
|
|
||||||
dont_change_now_playing = 1;
|
dont_change_now_playing = 1;
|
||||||
mPlaylist->SetTimeout(50);
|
mPlaylist->SetTimeout(50);
|
||||||
while (!mPlaylist->Empty() && Keypressed(input, Key.Delete))
|
while (!mPlaylist->Empty() && Keypressed(input, Key.Delete))
|
||||||
{
|
{
|
||||||
|
int id = mPlaylist->GetChoice();
|
||||||
TraceMpdStatus();
|
TraceMpdStatus();
|
||||||
timer = time(NULL);
|
timer = time(NULL);
|
||||||
Mpd->QueueDeleteSong(mPlaylist->GetChoice());
|
if (now_playing > id) // needed for keeping proper
|
||||||
mPlaylist->DeleteOption(mPlaylist->GetChoice());
|
now_playing--; // position of now playing song.
|
||||||
|
Mpd->QueueDeleteSong(id);
|
||||||
|
mPlaylist->DeleteOption(id);
|
||||||
mPlaylist->Refresh();
|
mPlaylist->Refresh();
|
||||||
mPlaylist->ReadKey(input);
|
mPlaylist->ReadKey(input);
|
||||||
}
|
}
|
||||||
@@ -1892,6 +1895,9 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
int from, to;
|
int from, to;
|
||||||
from = to = mPlaylist->GetChoice();
|
from = to = mPlaylist->GetChoice();
|
||||||
|
// unbold now playing as if song changes during move, this won't be unbolded.
|
||||||
|
if (to == now_playing && to > 0)
|
||||||
|
mPlaylist->BoldOption(now_playing, 0);
|
||||||
while (Keypressed(input, Key.MvSongUp) && to > 0)
|
while (Keypressed(input, Key.MvSongUp) && to > 0)
|
||||||
{
|
{
|
||||||
TraceMpdStatus();
|
TraceMpdStatus();
|
||||||
@@ -1984,6 +1990,9 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
int from, to;
|
int from, to;
|
||||||
from = to = mPlaylist->GetChoice();
|
from = to = mPlaylist->GetChoice();
|
||||||
|
// unbold now playing as if song changes during move, this won't be unbolded.
|
||||||
|
if (to == now_playing && to < mPlaylist->Size()-1)
|
||||||
|
mPlaylist->BoldOption(now_playing, 0);
|
||||||
while (Keypressed(input, Key.MvSongDown) && to < mPlaylist->Size()-1)
|
while (Keypressed(input, Key.MvSongDown) && to < mPlaylist->Size()-1)
|
||||||
{
|
{
|
||||||
TraceMpdStatus();
|
TraceMpdStatus();
|
||||||
|
|||||||
@@ -284,8 +284,6 @@ void NcmpcppStatusChanged(MPDConnection *Mpd, MPDStatusChanges changed, void *da
|
|||||||
if (changed.SongID)
|
if (changed.SongID)
|
||||||
{
|
{
|
||||||
if (!mPlaylist->Empty() && now_playing >= 0)
|
if (!mPlaylist->Empty() && now_playing >= 0)
|
||||||
{
|
|
||||||
if (!mPlaylist->Empty())
|
|
||||||
{
|
{
|
||||||
if (Config.repeat_one_mode && repeat_one_allowed)
|
if (Config.repeat_one_mode && repeat_one_allowed)
|
||||||
{
|
{
|
||||||
@@ -298,7 +296,7 @@ void NcmpcppStatusChanged(MPDConnection *Mpd, MPDStatusChanges changed, void *da
|
|||||||
if (Config.autocenter_mode)
|
if (Config.autocenter_mode)
|
||||||
mPlaylist->Highlight(now_playing);
|
mPlaylist->Highlight(now_playing);
|
||||||
repeat_one_allowed = 0;
|
repeat_one_allowed = 0;
|
||||||
}
|
|
||||||
if (!Mpd->GetElapsedTime())
|
if (!Mpd->GetElapsedTime())
|
||||||
mvwhline(wFooter->RawWin(), 0, 0, 0, wFooter->GetWidth());
|
mvwhline(wFooter->RawWin(), 0, 0, 0, wFooter->GetWidth());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user