actions: add support for range selection and make a few actions work on ranges

This commit is contained in:
Andrzej Rybczak
2015-05-23 22:55:04 +02:00
parent 274c075ffd
commit 1b6cb65f3a
10 changed files with 119 additions and 38 deletions

View File

@@ -49,7 +49,7 @@ enum class Type
SetCrossfade, SetVolume, EditSong, EditLibraryTag, EditLibraryAlbum, EditDirectoryName,
EditPlaylistName, EditLyrics, JumpToBrowser, JumpToMediaLibrary,
JumpToPlaylistEditor, ToggleScreenLock, JumpToTagEditor, JumpToPositionInSong,
SelectItem, ReverseSelection, RemoveSelection, SelectAlbum, AddSelectedItems,
SelectItem, SelectRange, ReverseSelection, RemoveSelection, SelectAlbum, AddSelectedItems,
CropMainPlaylist, CropPlaylist, ClearMainPlaylist, ClearPlaylist, SortPlaylist,
ReversePlaylist, Find, FindItemForward, FindItemBackward,
NextFoundItem, PreviousFoundItem, ToggleFindMode, ToggleReplayGainMode,
@@ -581,7 +581,11 @@ struct Shuffle: BaseAction
Shuffle(): BaseAction(Type::Shuffle, "shuffle") { }
private:
virtual bool canBeRun() OVERRIDE;
virtual void run() OVERRIDE;
NC::Menu<MPD::Song>::ConstIterator m_begin;
NC::Menu<MPD::Song>::ConstIterator m_end;
};
struct ToggleRandom: BaseAction
@@ -776,6 +780,19 @@ private:
NC::List *m_list;
};
struct SelectRange: BaseAction
{
SelectRange(): BaseAction(Type::SelectRange, "select_range") { }
private:
virtual bool canBeRun() OVERRIDE;
virtual void run() OVERRIDE;
NC::List *m_list;
NC::List::Iterator m_begin;
NC::List::Iterator m_end;
};
struct ReverseSelection: BaseAction
{
ReverseSelection(): BaseAction(Type::ReverseSelection, "reverse_selection") { }
@@ -869,6 +886,9 @@ struct ReversePlaylist: BaseAction
private:
virtual bool canBeRun() OVERRIDE;
virtual void run() OVERRIDE;
NC::Menu<MPD::Song>::ConstIterator m_begin;
NC::Menu<MPD::Song>::ConstIterator m_end;
};
struct Find: BaseAction