change version to 0.7.3
[ncmpcpp.git] / src / actions.h
blobc4354a279987a1f055e6752b1e655bf8813d21b3
1 /***************************************************************************
2 * Copyright (C) 2008-2014 by Andrzej Rybczak *
3 * electricityispower@gmail.com *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
21 #ifndef NCMPCPP_ACTIONS_H
22 #define NCMPCPP_ACTIONS_H
24 #include <boost/date_time/posix_time/posix_time_types.hpp>
25 #include <boost/format.hpp>
26 #include <map>
27 #include <string>
28 #include "interfaces.h"
29 #include "window.h"
31 // forward declarations
32 struct SongList;
34 namespace Actions {
36 enum class Type
38 MacroUtility = 0,
39 Dummy, UpdateEnvironment, MouseEvent, ScrollUp, ScrollDown, ScrollUpArtist, ScrollUpAlbum,
40 ScrollDownArtist, ScrollDownAlbum, PageUp, PageDown, MoveHome, MoveEnd,
41 ToggleInterface, JumpToParentDirectory, RunAction, PreviousColumn,
42 NextColumn, MasterScreen, SlaveScreen, VolumeUp, VolumeDown, AddItemToPlaylist, PlayItem,
43 DeletePlaylistItems, DeleteStoredPlaylist, DeleteBrowserItems, ReplaySong, Previous,
44 Next, Pause, Stop, ExecuteCommand, SavePlaylist, MoveSortOrderUp, MoveSortOrderDown,
45 MoveSelectedItemsUp, MoveSelectedItemsDown, MoveSelectedItemsTo, Add,
46 SeekForward, SeekBackward, ToggleDisplayMode, ToggleSeparatorsBetweenAlbums,
47 ToggleLyricsUpdateOnSongChange, ToggleLyricsFetcher, ToggleFetchingLyricsInBackground,
48 TogglePlayingSongCentering, UpdateDatabase, JumpToPlayingSong, ToggleRepeat, Shuffle,
49 ToggleRandom, StartSearching, SaveTagChanges, ToggleSingle, ToggleConsume, ToggleCrossfade,
50 SetCrossfade, SetVolume, EnterDirectory, EditSong, EditLibraryTag, EditLibraryAlbum, EditDirectoryName,
51 EditPlaylistName, EditLyrics, JumpToBrowser, JumpToMediaLibrary,
52 JumpToPlaylistEditor, ToggleScreenLock, JumpToTagEditor, JumpToPositionInSong,
53 SelectItem, SelectRange, ReverseSelection, RemoveSelection, SelectAlbum, SelectFoundItems,
54 AddSelectedItems, CropMainPlaylist, CropPlaylist, ClearMainPlaylist, ClearPlaylist,
55 SortPlaylist, ReversePlaylist, Find, FindItemForward, FindItemBackward,
56 NextFoundItem, PreviousFoundItem, ToggleFindMode, ToggleReplayGainMode,
57 ToggleAddMode, ToggleMouse, ToggleBitrateVisibility,
58 AddRandomItems, ToggleBrowserSortMode, ToggleLibraryTagType,
59 ToggleMediaLibrarySortMode, RefetchLyrics,
60 SetSelectedItemsPriority, ToggleOutput, ToggleVisualizationType, SetVisualizerSampleMultiplier,
61 ShowSongInfo, ShowArtistInfo, ShowLyrics, Quit, NextScreen, PreviousScreen,
62 ShowHelp, ShowPlaylist, ShowBrowser, ChangeBrowseMode, ShowSearchEngine,
63 ResetSearchEngine, ShowMediaLibrary, ToggleMediaLibraryColumnsMode,
64 ShowPlaylistEditor, ShowTagEditor, ShowOutputs, ShowVisualizer,
65 ShowClock, ShowServerInfo,
66 _numberOfActions // needed to dynamically calculate size of action array
69 void validateScreenSize();
70 void initializeScreens();
71 void setResizeFlags();
72 void resizeScreen(bool reload_main_window);
73 void setWindowsDimensions();
75 void confirmAction(const boost::format &description);
76 inline void confirmAction(const std::string &description)
78 confirmAction(boost::format(description));
81 bool isMPDMusicDirSet();
83 extern bool OriginalStatusbarVisibility;
84 extern bool ExitMainLoop;
86 extern size_t HeaderHeight;
87 extern size_t FooterHeight;
88 extern size_t FooterStartY;
90 struct BaseAction
92 BaseAction(Type type_, const char *name_): m_name(name_), m_type(type_) { }
94 const std::string &name() const { return m_name; }
95 Type type() const { return m_type; }
97 virtual bool canBeRun() { return true; }
99 bool execute()
101 if (canBeRun())
103 run();
104 return true;
106 return false;
109 protected:
110 std::string m_name;
112 private:
113 virtual void run() = 0;
115 Type m_type;
118 BaseAction &get(Type at);
119 BaseAction *get(const std::string &name);
121 struct Dummy: BaseAction
123 Dummy(): BaseAction(Type::Dummy, "dummy") { }
125 private:
126 virtual void run() OVERRIDE { }
129 struct UpdateEnvironment: BaseAction
131 UpdateEnvironment();
133 void run(bool update_status, bool refresh_window);
135 private:
136 boost::posix_time::ptime m_past;
138 virtual void run() OVERRIDE;
141 struct MouseEvent: BaseAction
143 MouseEvent(): BaseAction(Type::MouseEvent, "mouse_event")
145 m_old_mouse_event.bstate = 0;
146 m_mouse_event.bstate = 0;
149 private:
150 virtual bool canBeRun() OVERRIDE;
151 virtual void run() OVERRIDE;
153 MEVENT m_mouse_event;
154 MEVENT m_old_mouse_event;
157 struct ScrollUp: BaseAction
159 ScrollUp(): BaseAction(Type::ScrollUp, "scroll_up") { }
161 private:
162 virtual void run() OVERRIDE;
165 struct ScrollDown: BaseAction
167 ScrollDown(): BaseAction(Type::ScrollDown, "scroll_down") { }
169 private:
170 virtual void run() OVERRIDE;
173 struct ScrollUpArtist: BaseAction
175 ScrollUpArtist(): BaseAction(Type::ScrollUpArtist, "scroll_up_artist") { }
177 private:
178 virtual bool canBeRun() OVERRIDE;
179 virtual void run() OVERRIDE;
181 NC::List *m_list;
182 SongList *m_songs;
185 struct ScrollUpAlbum: BaseAction
187 ScrollUpAlbum(): BaseAction(Type::ScrollUpAlbum, "scroll_up_album") { }
189 private:
190 virtual bool canBeRun() OVERRIDE;
191 virtual void run() OVERRIDE;
193 NC::List *m_list;
194 SongList *m_songs;
197 struct ScrollDownArtist: BaseAction
199 ScrollDownArtist(): BaseAction(Type::ScrollDownArtist, "scroll_down_artist") { }
201 private:
202 virtual bool canBeRun() OVERRIDE;
203 virtual void run() OVERRIDE;
205 NC::List *m_list;
206 SongList *m_songs;
209 struct ScrollDownAlbum: BaseAction
211 ScrollDownAlbum(): BaseAction(Type::ScrollDownAlbum, "scroll_down_album") { }
213 private:
214 virtual bool canBeRun() OVERRIDE;
215 virtual void run() OVERRIDE;
217 NC::List *m_list;
218 SongList *m_songs;
221 struct PageUp: BaseAction
223 PageUp(): BaseAction(Type::PageUp, "page_up") { }
225 private:
226 virtual void run() OVERRIDE;
229 struct PageDown: BaseAction
231 PageDown(): BaseAction(Type::PageDown, "page_down") { }
233 private:
234 virtual void run() OVERRIDE;
237 struct MoveHome: BaseAction
239 MoveHome(): BaseAction(Type::MoveHome, "move_home") { }
241 private:
242 virtual void run() OVERRIDE;
245 struct MoveEnd: BaseAction
247 MoveEnd(): BaseAction(Type::MoveEnd, "move_end") { }
249 private:
250 virtual void run() OVERRIDE;
253 struct ToggleInterface: BaseAction
255 ToggleInterface(): BaseAction(Type::ToggleInterface, "toggle_interface") { }
257 private:
258 virtual void run() OVERRIDE;
261 struct JumpToParentDirectory: BaseAction
263 JumpToParentDirectory(): BaseAction(Type::JumpToParentDirectory, "jump_to_parent_directory") { }
265 private:
266 virtual bool canBeRun() OVERRIDE;
267 virtual void run() OVERRIDE;
270 struct RunAction: BaseAction
272 RunAction(): BaseAction(Type::RunAction, "run_action") { }
274 private:
275 virtual bool canBeRun() OVERRIDE;
276 virtual void run() OVERRIDE;
278 HasActions *m_ha;
281 struct PreviousColumn: BaseAction
283 PreviousColumn(): BaseAction(Type::PreviousColumn, "previous_column") { }
285 private:
286 virtual bool canBeRun() OVERRIDE;
287 virtual void run() OVERRIDE;
289 HasColumns *m_hc;
292 struct NextColumn: BaseAction
294 NextColumn(): BaseAction(Type::NextColumn, "next_column") { }
296 private:
297 virtual bool canBeRun() OVERRIDE;
298 virtual void run() OVERRIDE;
300 HasColumns *m_hc;
303 struct MasterScreen: BaseAction
305 MasterScreen(): BaseAction(Type::MasterScreen, "master_screen") { }
307 private:
308 virtual bool canBeRun() OVERRIDE;
309 virtual void run() OVERRIDE;
312 struct SlaveScreen: BaseAction
314 SlaveScreen(): BaseAction(Type::SlaveScreen, "slave_screen") { }
316 private:
317 virtual bool canBeRun() OVERRIDE;
318 virtual void run() OVERRIDE;
321 struct VolumeUp: BaseAction
323 VolumeUp(): BaseAction(Type::VolumeUp, "volume_up") { }
325 private:
326 virtual void run() OVERRIDE;
329 struct VolumeDown: BaseAction
331 VolumeDown(): BaseAction(Type::VolumeDown, "volume_down") { }
333 private:
334 virtual void run() OVERRIDE;
337 struct AddItemToPlaylist: BaseAction
339 AddItemToPlaylist(): BaseAction(Type::AddItemToPlaylist, "add_item_to_playlist") { }
341 private:
342 virtual bool canBeRun() OVERRIDE;
343 virtual void run() OVERRIDE;
345 HasSongs *m_hs;
348 struct PlayItem: BaseAction
350 PlayItem(): BaseAction(Type::PlayItem, "play_item") { }
352 private:
353 virtual bool canBeRun() OVERRIDE;
354 virtual void run() OVERRIDE;
356 HasSongs *m_hs;
359 struct DeletePlaylistItems: BaseAction
361 DeletePlaylistItems(): BaseAction(Type::DeletePlaylistItems, "delete_playlist_items") { }
363 private:
364 virtual bool canBeRun() OVERRIDE;
365 virtual void run() OVERRIDE;
368 struct DeleteStoredPlaylist: BaseAction
370 DeleteStoredPlaylist(): BaseAction(Type::DeleteStoredPlaylist, "delete_stored_playlist") { }
372 private:
373 virtual bool canBeRun() OVERRIDE;
374 virtual void run() OVERRIDE;
377 struct DeleteBrowserItems: BaseAction
379 DeleteBrowserItems(): BaseAction(Type::DeleteBrowserItems, "delete_browser_items") { }
381 private:
382 virtual bool canBeRun() OVERRIDE;
383 virtual void run() OVERRIDE;
386 struct ReplaySong: BaseAction
388 ReplaySong(): BaseAction(Type::ReplaySong, "replay_song") { }
390 private:
391 virtual void run() OVERRIDE;
394 struct PreviousSong: BaseAction
396 PreviousSong(): BaseAction(Type::Previous, "previous") { }
398 private:
399 virtual void run() OVERRIDE;
402 struct NextSong: BaseAction
404 NextSong(): BaseAction(Type::Next, "next") { }
406 private:
407 virtual void run() OVERRIDE;
410 struct Pause: BaseAction
412 Pause(): BaseAction(Type::Pause, "pause") { }
414 private:
415 virtual void run() OVERRIDE;
418 struct Stop: BaseAction
420 Stop(): BaseAction(Type::Stop, "stop") { }
422 private:
423 virtual void run() OVERRIDE;
426 struct ExecuteCommand: BaseAction
428 ExecuteCommand(): BaseAction(Type::ExecuteCommand, "execute_command") { }
430 private:
431 virtual void run() OVERRIDE;
434 struct SavePlaylist: BaseAction
436 SavePlaylist(): BaseAction(Type::SavePlaylist, "save_playlist") { }
438 private:
439 virtual void run() OVERRIDE;
442 struct MoveSortOrderUp: BaseAction
444 MoveSortOrderUp(): BaseAction(Type::MoveSortOrderUp, "move_sort_order_up") { }
446 private:
447 virtual bool canBeRun() OVERRIDE;
448 virtual void run() OVERRIDE;
451 struct MoveSortOrderDown: BaseAction
453 MoveSortOrderDown(): BaseAction(Type::MoveSortOrderDown, "move_sort_order_down") { }
455 private:
456 virtual bool canBeRun() OVERRIDE;
457 virtual void run() OVERRIDE;
460 struct MoveSelectedItemsUp: BaseAction
462 MoveSelectedItemsUp(): BaseAction(Type::MoveSelectedItemsUp, "move_selected_items_up") { }
464 private:
465 virtual bool canBeRun() OVERRIDE;
466 virtual void run() OVERRIDE;
469 struct MoveSelectedItemsDown: BaseAction
471 MoveSelectedItemsDown(): BaseAction(Type::MoveSelectedItemsDown, "move_selected_items_down") { }
473 private:
474 virtual bool canBeRun() OVERRIDE;
475 virtual void run() OVERRIDE;
478 struct MoveSelectedItemsTo: BaseAction
480 MoveSelectedItemsTo(): BaseAction(Type::MoveSelectedItemsTo, "move_selected_items_to") { }
482 private:
483 virtual bool canBeRun() OVERRIDE;
484 virtual void run() OVERRIDE;
487 struct Add: BaseAction
489 Add(): BaseAction(Type::Add, "add") { }
491 private:
492 virtual bool canBeRun() OVERRIDE;
493 virtual void run() OVERRIDE;
496 struct SeekForward: BaseAction
498 SeekForward(): BaseAction(Type::SeekForward, "seek_forward") { }
500 private:
501 virtual bool canBeRun() OVERRIDE;
502 virtual void run() OVERRIDE;
505 struct SeekBackward: BaseAction
507 SeekBackward(): BaseAction(Type::SeekBackward, "seek_backward") { }
509 private:
510 virtual bool canBeRun() OVERRIDE;
511 virtual void run() OVERRIDE;
514 struct ToggleDisplayMode: BaseAction
516 ToggleDisplayMode(): BaseAction(Type::ToggleDisplayMode, "toggle_display_mode") { }
518 private:
519 virtual bool canBeRun() OVERRIDE;
520 virtual void run() OVERRIDE;
523 struct ToggleSeparatorsBetweenAlbums: BaseAction
525 ToggleSeparatorsBetweenAlbums()
526 : BaseAction(Type::ToggleSeparatorsBetweenAlbums, "toggle_separators_between_albums") { }
528 private:
529 virtual bool canBeRun() OVERRIDE;
530 virtual void run() OVERRIDE;
533 struct ToggleLyricsUpdateOnSongChange: BaseAction
535 ToggleLyricsUpdateOnSongChange()
536 : BaseAction(Type::ToggleLyricsUpdateOnSongChange, "toggle_lyrics_update_on_song_change") { }
538 private:
539 virtual bool canBeRun() OVERRIDE;
540 virtual void run() OVERRIDE;
543 struct ToggleLyricsFetcher: BaseAction
545 ToggleLyricsFetcher(): BaseAction(Type::ToggleLyricsFetcher, "toggle_lyrics_fetcher") { }
547 private:
548 # ifndef HAVE_CURL_CURL_H
549 virtual bool canBeRun() OVERRIDE;
550 # endif // NOT HAVE_CURL_CURL_H
551 virtual void run() OVERRIDE;
554 struct ToggleFetchingLyricsInBackground: BaseAction
556 ToggleFetchingLyricsInBackground()
557 : BaseAction(Type::ToggleFetchingLyricsInBackground, "toggle_fetching_lyrics_in_background") { }
559 private:
560 # ifndef HAVE_CURL_CURL_H
561 virtual bool canBeRun() OVERRIDE;
562 # endif // NOT HAVE_CURL_CURL_H
563 virtual void run() OVERRIDE;
566 struct TogglePlayingSongCentering: BaseAction
568 TogglePlayingSongCentering()
569 : BaseAction(Type::TogglePlayingSongCentering, "toggle_playing_song_centering") { }
571 private:
572 virtual void run() OVERRIDE;
575 struct UpdateDatabase: BaseAction
577 UpdateDatabase(): BaseAction(Type::UpdateDatabase, "update_database") { }
579 private:
580 virtual void run() OVERRIDE;
583 struct JumpToPlayingSong: BaseAction
585 JumpToPlayingSong(): BaseAction(Type::JumpToPlayingSong, "jump_to_playing_song") { }
587 private:
588 virtual bool canBeRun() OVERRIDE;
589 virtual void run() OVERRIDE;
592 struct ToggleRepeat: BaseAction
594 ToggleRepeat(): BaseAction(Type::ToggleRepeat, "toggle_repeat") { }
596 private:
597 virtual void run() OVERRIDE;
600 struct Shuffle: BaseAction
602 Shuffle(): BaseAction(Type::Shuffle, "shuffle") { }
604 private:
605 virtual bool canBeRun() OVERRIDE;
606 virtual void run() OVERRIDE;
608 NC::Menu<MPD::Song>::ConstIterator m_begin;
609 NC::Menu<MPD::Song>::ConstIterator m_end;
612 struct ToggleRandom: BaseAction
614 ToggleRandom(): BaseAction(Type::ToggleRandom, "toggle_random") { }
616 private:
617 virtual void run() OVERRIDE;
620 struct StartSearching: BaseAction
622 StartSearching(): BaseAction(Type::StartSearching, "start_searching") { }
624 private:
625 virtual bool canBeRun() OVERRIDE;
626 virtual void run() OVERRIDE;
629 struct SaveTagChanges: BaseAction
631 SaveTagChanges(): BaseAction(Type::SaveTagChanges, "save_tag_changes") { }
633 private:
634 virtual bool canBeRun() OVERRIDE;
635 virtual void run() OVERRIDE;
638 struct ToggleSingle: BaseAction
640 ToggleSingle(): BaseAction(Type::ToggleSingle, "toggle_single") { }
642 private:
643 virtual void run() OVERRIDE;
646 struct ToggleConsume: BaseAction
648 ToggleConsume(): BaseAction(Type::ToggleConsume, "toggle_consume") { }
650 private:
651 virtual void run() OVERRIDE;
654 struct ToggleCrossfade: BaseAction
656 ToggleCrossfade(): BaseAction(Type::ToggleCrossfade, "toggle_crossfade") { }
658 private:
659 virtual void run() OVERRIDE;
662 struct SetCrossfade: BaseAction
664 SetCrossfade(): BaseAction(Type::SetCrossfade, "set_crossfade") { }
666 private:
667 virtual void run() OVERRIDE;
670 struct SetVolume: BaseAction
672 SetVolume(): BaseAction(Type::SetVolume, "set_volume") { }
674 private:
675 virtual void run() OVERRIDE;
678 struct EnterDirectory: BaseAction
680 EnterDirectory(): BaseAction(Type::EnterDirectory, "enter_directory") { }
682 private:
683 virtual bool canBeRun() OVERRIDE;
684 virtual void run() OVERRIDE;
688 struct EditSong: BaseAction
690 EditSong(): BaseAction(Type::EditSong, "edit_song") { }
692 private:
693 virtual bool canBeRun() OVERRIDE;
694 virtual void run() OVERRIDE;
696 #ifdef HAVE_TAGLIB_H
697 const MPD::Song *m_song;
698 #endif // HAVE_TAGLIB_H
701 struct EditLibraryTag: BaseAction
703 EditLibraryTag(): BaseAction(Type::EditLibraryTag, "edit_library_tag") { }
705 private:
706 virtual bool canBeRun() OVERRIDE;
707 virtual void run() OVERRIDE;
710 struct EditLibraryAlbum: BaseAction
712 EditLibraryAlbum(): BaseAction(Type::EditLibraryAlbum, "edit_library_album") { }
714 private:
715 virtual bool canBeRun() OVERRIDE;
716 virtual void run() OVERRIDE;
719 struct EditDirectoryName: BaseAction
721 EditDirectoryName(): BaseAction(Type::EditDirectoryName, "edit_directory_name") { }
723 private:
724 virtual bool canBeRun() OVERRIDE;
725 virtual void run() OVERRIDE;
728 struct EditPlaylistName: BaseAction
730 EditPlaylistName(): BaseAction(Type::EditPlaylistName, "edit_playlist_name") { }
732 private:
733 virtual bool canBeRun() OVERRIDE;
734 virtual void run() OVERRIDE;
737 struct EditLyrics: BaseAction
739 EditLyrics(): BaseAction(Type::EditLyrics, "edit_lyrics") { }
741 private:
742 virtual bool canBeRun() OVERRIDE;
743 virtual void run() OVERRIDE;
746 struct JumpToBrowser: BaseAction
748 JumpToBrowser(): BaseAction(Type::JumpToBrowser, "jump_to_browser") { }
750 private:
751 virtual bool canBeRun() OVERRIDE;
752 virtual void run() OVERRIDE;
754 const MPD::Song *m_song;
757 struct JumpToMediaLibrary: BaseAction
759 JumpToMediaLibrary(): BaseAction(Type::JumpToMediaLibrary, "jump_to_media_library") { }
761 private:
762 virtual bool canBeRun() OVERRIDE;
763 virtual void run() OVERRIDE;
765 const MPD::Song *m_song;
768 struct JumpToPlaylistEditor: BaseAction
770 JumpToPlaylistEditor(): BaseAction(Type::JumpToPlaylistEditor, "jump_to_playlist_editor") { }
772 private:
773 virtual bool canBeRun() OVERRIDE;
774 virtual void run() OVERRIDE;
777 struct ToggleScreenLock: BaseAction
779 ToggleScreenLock(): BaseAction(Type::ToggleScreenLock, "toggle_screen_lock") { }
781 private:
782 virtual void run() OVERRIDE;
785 struct JumpToTagEditor: BaseAction
787 JumpToTagEditor(): BaseAction(Type::JumpToTagEditor, "jump_to_tag_editor") { }
789 private:
790 virtual bool canBeRun() OVERRIDE;
791 virtual void run() OVERRIDE;
793 #ifdef HAVE_TAGLIB_H
794 const MPD::Song *m_song;
795 #endif // HAVE_TAGLIB_H
798 struct JumpToPositionInSong: BaseAction
800 JumpToPositionInSong(): BaseAction(Type::JumpToPositionInSong, "jump_to_position_in_song") { }
802 private:
803 virtual bool canBeRun() OVERRIDE;
804 virtual void run() OVERRIDE;
807 struct SelectItem: BaseAction
809 SelectItem(): BaseAction(Type::SelectItem, "select_item") { }
811 private:
812 virtual bool canBeRun() OVERRIDE;
813 virtual void run() OVERRIDE;
815 NC::List *m_list;
818 struct SelectRange: BaseAction
820 SelectRange(): BaseAction(Type::SelectRange, "select_range") { }
822 private:
823 virtual bool canBeRun() OVERRIDE;
824 virtual void run() OVERRIDE;
826 NC::List *m_list;
827 NC::List::Iterator m_begin;
828 NC::List::Iterator m_end;
831 struct ReverseSelection: BaseAction
833 ReverseSelection(): BaseAction(Type::ReverseSelection, "reverse_selection") { }
835 private:
836 virtual bool canBeRun() OVERRIDE;
837 virtual void run() OVERRIDE;
839 NC::List *m_list;
842 struct RemoveSelection: BaseAction
844 RemoveSelection(): BaseAction(Type::RemoveSelection, "remove_selection") { }
846 private:
847 virtual bool canBeRun() OVERRIDE;
848 virtual void run() OVERRIDE;
850 NC::List *m_list;
853 struct SelectAlbum: BaseAction
855 SelectAlbum(): BaseAction(Type::SelectAlbum, "select_album") { }
857 private:
858 virtual bool canBeRun() OVERRIDE;
859 virtual void run() OVERRIDE;
861 NC::List *m_list;
862 SongList *m_songs;
865 struct SelectFoundItems: BaseAction
867 SelectFoundItems(): BaseAction(Type::SelectFoundItems, "select_found_items") { }
869 private:
870 virtual bool canBeRun() OVERRIDE;
871 virtual void run() OVERRIDE;
873 NC::List *m_list;
874 Searchable *m_searchable;
877 struct AddSelectedItems: BaseAction
879 AddSelectedItems(): BaseAction(Type::AddSelectedItems, "add_selected_items") { }
881 private:
882 virtual bool canBeRun() OVERRIDE;
883 virtual void run() OVERRIDE;
886 struct CropMainPlaylist: BaseAction
888 CropMainPlaylist(): BaseAction(Type::CropMainPlaylist, "crop_main_playlist") { }
890 private:
891 virtual void run() OVERRIDE;
894 struct CropPlaylist: BaseAction
896 CropPlaylist(): BaseAction(Type::CropPlaylist, "crop_playlist") { }
898 private:
899 virtual bool canBeRun() OVERRIDE;
900 virtual void run() OVERRIDE;
903 struct ClearMainPlaylist: BaseAction
905 ClearMainPlaylist(): BaseAction(Type::ClearMainPlaylist, "clear_main_playlist") { }
907 private:
908 virtual void run() OVERRIDE;
911 struct ClearPlaylist: BaseAction
913 ClearPlaylist(): BaseAction(Type::ClearPlaylist, "clear_playlist") { }
915 private:
916 virtual bool canBeRun() OVERRIDE;
917 virtual void run() OVERRIDE;
920 struct SortPlaylist: BaseAction
922 SortPlaylist(): BaseAction(Type::SortPlaylist, "sort_playlist") { }
924 private:
925 virtual bool canBeRun() OVERRIDE;
926 virtual void run() OVERRIDE;
929 struct ReversePlaylist: BaseAction
931 ReversePlaylist(): BaseAction(Type::ReversePlaylist, "reverse_playlist") { }
933 private:
934 virtual bool canBeRun() OVERRIDE;
935 virtual void run() OVERRIDE;
937 NC::Menu<MPD::Song>::ConstIterator m_begin;
938 NC::Menu<MPD::Song>::ConstIterator m_end;
941 struct Find: BaseAction
943 Find(): BaseAction(Type::Find, "find") { }
945 private:
946 virtual bool canBeRun() OVERRIDE;
947 virtual void run() OVERRIDE;
950 struct FindItemForward: BaseAction
952 FindItemForward(): BaseAction(Type::FindItemForward, "find_item_forward") { }
954 private:
955 virtual bool canBeRun() OVERRIDE;
956 virtual void run() OVERRIDE;
959 struct FindItemBackward: BaseAction
961 FindItemBackward(): BaseAction(Type::FindItemBackward, "find_item_backward") { }
963 private:
964 virtual bool canBeRun() OVERRIDE;
965 virtual void run() OVERRIDE;
968 struct NextFoundItem: BaseAction
970 NextFoundItem(): BaseAction(Type::NextFoundItem, "next_found_item") { }
972 private:
973 virtual bool canBeRun() OVERRIDE;
974 virtual void run() OVERRIDE;
977 struct PreviousFoundItem: BaseAction
979 PreviousFoundItem(): BaseAction(Type::PreviousFoundItem, "previous_found_item") { }
981 private:
982 virtual bool canBeRun() OVERRIDE;
983 virtual void run() OVERRIDE;
986 struct ToggleFindMode: BaseAction
988 ToggleFindMode(): BaseAction(Type::ToggleFindMode, "toggle_find_mode") { }
990 private:
991 virtual void run() OVERRIDE;
994 struct ToggleReplayGainMode: BaseAction
996 ToggleReplayGainMode(): BaseAction(Type::ToggleReplayGainMode, "toggle_replay_gain_mode") { }
998 private:
999 virtual void run() OVERRIDE;
1002 struct ToggleAddMode: BaseAction
1004 ToggleAddMode(): BaseAction(Type::ToggleAddMode, "toggle_add_mode") { }
1006 private:
1007 virtual void run() OVERRIDE;
1010 struct ToggleMouse: BaseAction
1012 ToggleMouse(): BaseAction(Type::ToggleMouse, "toggle_mouse") { }
1014 private:
1015 virtual void run() OVERRIDE;
1018 struct ToggleBitrateVisibility: BaseAction
1020 ToggleBitrateVisibility(): BaseAction(Type::ToggleBitrateVisibility, "toggle_bitrate_visibility") { }
1022 private:
1023 virtual void run() OVERRIDE;
1026 struct AddRandomItems: BaseAction
1028 AddRandomItems(): BaseAction(Type::AddRandomItems, "add_random_items") { }
1030 private:
1031 virtual void run() OVERRIDE;
1034 struct ToggleBrowserSortMode: BaseAction
1036 ToggleBrowserSortMode(): BaseAction(Type::ToggleBrowserSortMode, "toggle_browser_sort_mode") { }
1038 private:
1039 virtual bool canBeRun() OVERRIDE;
1040 virtual void run() OVERRIDE;
1043 struct ToggleLibraryTagType: BaseAction
1045 ToggleLibraryTagType(): BaseAction(Type::ToggleLibraryTagType, "toggle_library_tag_type") { }
1047 private:
1048 virtual bool canBeRun() OVERRIDE;
1049 virtual void run() OVERRIDE;
1052 struct ToggleMediaLibrarySortMode: BaseAction
1054 ToggleMediaLibrarySortMode()
1055 : BaseAction(Type::ToggleMediaLibrarySortMode, "toggle_media_library_sort_mode") { }
1057 private:
1058 virtual bool canBeRun() OVERRIDE;
1059 virtual void run() OVERRIDE;
1062 struct RefetchLyrics: BaseAction
1064 RefetchLyrics(): BaseAction(Type::RefetchLyrics, "refetch_lyrics") { }
1066 private:
1067 virtual bool canBeRun() OVERRIDE;
1068 virtual void run() OVERRIDE;
1071 struct SetSelectedItemsPriority: BaseAction
1073 SetSelectedItemsPriority()
1074 : BaseAction(Type::SetSelectedItemsPriority, "set_selected_items_priority") { }
1076 private:
1077 virtual bool canBeRun() OVERRIDE;
1078 virtual void run() OVERRIDE;
1081 struct ToggleOutput: BaseAction
1083 ToggleOutput(): BaseAction(Type::ToggleOutput, "toggle_output") { }
1085 private:
1086 virtual bool canBeRun() OVERRIDE;
1087 virtual void run() OVERRIDE;
1090 struct ToggleVisualizationType: BaseAction
1092 ToggleVisualizationType()
1093 : BaseAction(Type::ToggleVisualizationType, "toggle_visualization_type") { }
1095 private:
1097 virtual bool canBeRun() OVERRIDE;
1098 virtual void run() OVERRIDE;
1101 struct SetVisualizerSampleMultiplier: BaseAction
1103 SetVisualizerSampleMultiplier()
1104 : BaseAction(Type::SetVisualizerSampleMultiplier, "set_visualizer_sample_multiplier") { }
1106 private:
1107 virtual bool canBeRun() OVERRIDE;
1108 virtual void run() OVERRIDE;
1111 struct ShowSongInfo: BaseAction
1113 ShowSongInfo(): BaseAction(Type::ShowSongInfo, "show_song_info") { }
1115 private:
1116 virtual void run() OVERRIDE;
1119 struct ShowArtistInfo: BaseAction
1121 ShowArtistInfo(): BaseAction(Type::ShowArtistInfo, "show_artist_info") { }
1123 private:
1124 virtual bool canBeRun() OVERRIDE;
1125 virtual void run() OVERRIDE;
1128 struct ShowLyrics: BaseAction
1130 ShowLyrics(): BaseAction(Type::ShowLyrics, "show_lyrics") { }
1132 private:
1133 virtual void run() OVERRIDE;
1136 struct Quit: BaseAction
1138 Quit(): BaseAction(Type::Quit, "quit") { }
1140 private:
1141 virtual void run() OVERRIDE;
1144 struct NextScreen: BaseAction
1146 NextScreen(): BaseAction(Type::NextScreen, "next_screen") { }
1148 private:
1149 virtual void run() OVERRIDE;
1152 struct PreviousScreen: BaseAction
1154 PreviousScreen(): BaseAction(Type::PreviousScreen, "previous_screen") { }
1156 private:
1157 virtual void run() OVERRIDE;
1160 struct ShowHelp: BaseAction
1162 ShowHelp(): BaseAction(Type::ShowHelp, "show_help") { }
1164 private:
1165 virtual bool canBeRun() OVERRIDE;
1166 virtual void run() OVERRIDE;
1169 struct ShowPlaylist: BaseAction
1171 ShowPlaylist(): BaseAction(Type::ShowPlaylist, "show_playlist") { }
1173 private:
1174 virtual bool canBeRun() OVERRIDE;
1175 virtual void run() OVERRIDE;
1178 struct ShowBrowser: BaseAction
1180 ShowBrowser(): BaseAction(Type::ShowBrowser, "show_browser") { }
1182 private:
1183 virtual bool canBeRun() OVERRIDE;
1184 virtual void run() OVERRIDE;
1187 struct ChangeBrowseMode: BaseAction
1189 ChangeBrowseMode(): BaseAction(Type::ChangeBrowseMode, "change_browse_mode") { }
1191 private:
1192 virtual bool canBeRun() OVERRIDE;
1193 virtual void run() OVERRIDE;
1196 struct ShowSearchEngine: BaseAction
1198 ShowSearchEngine(): BaseAction(Type::ShowSearchEngine, "show_search_engine") { }
1200 private:
1201 virtual bool canBeRun() OVERRIDE;
1202 virtual void run() OVERRIDE;
1205 struct ResetSearchEngine: BaseAction
1207 ResetSearchEngine(): BaseAction(Type::ResetSearchEngine, "reset_search_engine") { }
1209 private:
1210 virtual bool canBeRun() OVERRIDE;
1211 virtual void run() OVERRIDE;
1214 struct ShowMediaLibrary: BaseAction
1216 ShowMediaLibrary(): BaseAction(Type::ShowMediaLibrary, "show_media_library") { }
1218 private:
1219 virtual bool canBeRun() OVERRIDE;
1220 virtual void run() OVERRIDE;
1223 struct ToggleMediaLibraryColumnsMode: BaseAction
1225 ToggleMediaLibraryColumnsMode()
1226 : BaseAction(Type::ToggleMediaLibraryColumnsMode, "toggle_media_library_columns_mode") { }
1228 private:
1229 virtual bool canBeRun() OVERRIDE;
1230 virtual void run() OVERRIDE;
1233 struct ShowPlaylistEditor: BaseAction
1235 ShowPlaylistEditor(): BaseAction(Type::ShowPlaylistEditor, "show_playlist_editor") { }
1237 private:
1238 virtual bool canBeRun() OVERRIDE;
1239 virtual void run() OVERRIDE;
1242 struct ShowTagEditor: BaseAction
1244 ShowTagEditor(): BaseAction(Type::ShowTagEditor, "show_tag_editor") { }
1246 private:
1247 virtual bool canBeRun() OVERRIDE;
1248 virtual void run() OVERRIDE;
1251 struct ShowOutputs: BaseAction
1253 ShowOutputs(): BaseAction(Type::ShowOutputs, "show_outputs") { }
1255 private:
1256 virtual bool canBeRun() OVERRIDE;
1257 virtual void run() OVERRIDE;
1260 struct ShowVisualizer: BaseAction
1262 ShowVisualizer(): BaseAction(Type::ShowVisualizer, "show_visualizer") { }
1264 private:
1265 virtual bool canBeRun() OVERRIDE;
1266 virtual void run() OVERRIDE;
1269 struct ShowClock: BaseAction
1271 ShowClock(): BaseAction(Type::ShowClock, "show_clock") { }
1273 private:
1274 virtual bool canBeRun() OVERRIDE;
1275 virtual void run() OVERRIDE;
1278 struct ShowServerInfo: BaseAction
1280 ShowServerInfo(): BaseAction(Type::ShowServerInfo, "show_server_info") { }
1282 private:
1283 # ifdef HAVE_TAGLIB_H
1284 virtual bool canBeRun() OVERRIDE;
1285 # endif // HAVE_TAGLIB_H
1286 virtual void run() OVERRIDE;
1291 #endif // NCMPCPP_ACTIONS_H