Make 'update_environment' action also update local mpd status
[ncmpcpp.git] / src / actions.h
blobe24ce27bbe6de2187cc80a0e2bed6f85c974010b
1 /***************************************************************************
2 * Copyright (C) 2008-2016 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 "curses/window.h"
29 #include "interfaces.h"
31 // forward declarations
32 struct SongList;
34 namespace Actions {
36 enum class Type
38 MacroUtility = -1,
39 Dummy,
40 UpdateEnvironment,
41 MouseEvent,
42 ScrollUp,
43 ScrollDown,
44 ScrollUpArtist,
45 ScrollUpAlbum,
46 ScrollDownArtist,
47 ScrollDownAlbum,
48 PageUp,
49 PageDown,
50 MoveHome,
51 MoveEnd,
52 ToggleInterface,
53 JumpToParentDirectory,
54 RunAction,
55 PreviousColumn,
56 NextColumn,
57 MasterScreen,
58 SlaveScreen,
59 VolumeUp,
60 VolumeDown,
61 AddItemToPlaylist,
62 PlayItem,
63 DeletePlaylistItems,
64 DeleteStoredPlaylist,
65 DeleteBrowserItems,
66 ReplaySong,
67 Previous,
68 Next,
69 Pause,
70 Stop,
71 ExecuteCommand,
72 SavePlaylist,
73 MoveSortOrderUp,
74 MoveSortOrderDown,
75 MoveSelectedItemsUp,
76 MoveSelectedItemsDown,
77 MoveSelectedItemsTo,
78 Add,
79 SeekForward,
80 SeekBackward,
81 ToggleDisplayMode,
82 ToggleSeparatorsBetweenAlbums,
83 ToggleLyricsUpdateOnSongChange,
84 ToggleLyricsFetcher,
85 ToggleFetchingLyricsInBackground,
86 TogglePlayingSongCentering,
87 UpdateDatabase,
88 JumpToPlayingSong,
89 ToggleRepeat,
90 Shuffle,
91 ToggleRandom,
92 StartSearching,
93 SaveTagChanges,
94 ToggleSingle,
95 ToggleConsume,
96 ToggleCrossfade,
97 SetCrossfade,
98 SetVolume,
99 EnterDirectory,
100 EditSong,
101 EditLibraryTag,
102 EditLibraryAlbum,
103 EditDirectoryName,
104 EditPlaylistName,
105 EditLyrics,
106 JumpToBrowser,
107 JumpToMediaLibrary,
108 JumpToPlaylistEditor,
109 ToggleScreenLock,
110 JumpToTagEditor,
111 JumpToPositionInSong,
112 SelectItem,
113 SelectRange,
114 ReverseSelection,
115 RemoveSelection,
116 SelectAlbum,
117 SelectFoundItems,
118 AddSelectedItems,
119 CropMainPlaylist,
120 CropPlaylist,
121 ClearMainPlaylist,
122 ClearPlaylist,
123 SortPlaylist,
124 ReversePlaylist,
125 ApplyFilter,
126 Find,
127 FindItemForward,
128 FindItemBackward,
129 NextFoundItem,
130 PreviousFoundItem,
131 ToggleFindMode,
132 ToggleReplayGainMode,
133 ToggleAddMode,
134 ToggleMouse,
135 ToggleBitrateVisibility,
136 AddRandomItems,
137 ToggleBrowserSortMode,
138 ToggleLibraryTagType,
139 ToggleMediaLibrarySortMode,
140 FetchLyricsInBackground,
141 RefetchLyrics,
142 SetSelectedItemsPriority,
143 ToggleOutput,
144 ToggleVisualizationType,
145 ShowSongInfo,
146 ShowArtistInfo,
147 ShowLyrics,
148 Quit,
149 NextScreen,
150 PreviousScreen,
151 ShowHelp,
152 ShowPlaylist,
153 ShowBrowser,
154 ChangeBrowseMode,
155 ShowSearchEngine,
156 ResetSearchEngine,
157 ShowMediaLibrary,
158 ToggleMediaLibraryColumnsMode,
159 ShowPlaylistEditor,
160 ShowTagEditor,
161 ShowOutputs,
162 ShowVisualizer,
163 ShowClock,
164 ShowServerInfo,
165 _numberOfActions // needed to dynamically calculate size of action array
168 void validateScreenSize();
169 void initializeScreens();
170 void setResizeFlags();
171 void resizeScreen(bool reload_main_window);
172 void setWindowsDimensions();
174 void confirmAction(const boost::format &description);
175 inline void confirmAction(const std::string &description)
177 confirmAction(boost::format(description));
180 bool isMPDMusicDirSet();
182 extern bool OriginalStatusbarVisibility;
183 extern bool ExitMainLoop;
185 extern size_t HeaderHeight;
186 extern size_t FooterHeight;
187 extern size_t FooterStartY;
189 struct BaseAction
191 BaseAction(Type type_, const char *name_): m_name(name_), m_type(type_) { }
193 const std::string &name() const { return m_name; }
194 Type type() const { return m_type; }
196 virtual bool canBeRun() { return true; }
198 bool execute()
200 if (canBeRun())
202 run();
203 return true;
205 return false;
208 protected:
209 std::string m_name;
211 private:
212 virtual void run() = 0;
214 Type m_type;
217 BaseAction &get(Type at);
219 std::shared_ptr<BaseAction> get_(Type at);
220 std::shared_ptr<BaseAction> get_(const std::string &name);
222 struct Dummy: BaseAction
224 Dummy(): BaseAction(Type::Dummy, "dummy") { }
226 private:
227 virtual void run() override { }
230 struct UpdateEnvironment: BaseAction
232 UpdateEnvironment();
234 void run(bool update_status, bool refresh_window, bool mpd_sync);
236 private:
237 boost::posix_time::ptime m_past;
239 virtual void run() override;
242 struct MouseEvent: BaseAction
244 MouseEvent(): BaseAction(Type::MouseEvent, "mouse_event")
246 m_old_mouse_event.bstate = 0;
247 m_mouse_event.bstate = 0;
250 private:
251 virtual bool canBeRun() override;
252 virtual void run() override;
254 MEVENT m_mouse_event;
255 MEVENT m_old_mouse_event;
258 struct ScrollUp: BaseAction
260 ScrollUp(): BaseAction(Type::ScrollUp, "scroll_up") { }
262 private:
263 virtual void run() override;
266 struct ScrollDown: BaseAction
268 ScrollDown(): BaseAction(Type::ScrollDown, "scroll_down") { }
270 private:
271 virtual void run() override;
274 struct ScrollUpArtist: BaseAction
276 ScrollUpArtist(): BaseAction(Type::ScrollUpArtist, "scroll_up_artist") { }
278 private:
279 virtual bool canBeRun() override;
280 virtual void run() override;
282 NC::List *m_list;
283 const SongList *m_songs;
286 struct ScrollUpAlbum: BaseAction
288 ScrollUpAlbum(): BaseAction(Type::ScrollUpAlbum, "scroll_up_album") { }
290 private:
291 virtual bool canBeRun() override;
292 virtual void run() override;
294 NC::List *m_list;
295 const SongList *m_songs;
298 struct ScrollDownArtist: BaseAction
300 ScrollDownArtist(): BaseAction(Type::ScrollDownArtist, "scroll_down_artist") { }
302 private:
303 virtual bool canBeRun() override;
304 virtual void run() override;
306 NC::List *m_list;
307 const SongList *m_songs;
310 struct ScrollDownAlbum: BaseAction
312 ScrollDownAlbum(): BaseAction(Type::ScrollDownAlbum, "scroll_down_album") { }
314 private:
315 virtual bool canBeRun() override;
316 virtual void run() override;
318 NC::List *m_list;
319 const SongList *m_songs;
322 struct PageUp: BaseAction
324 PageUp(): BaseAction(Type::PageUp, "page_up") { }
326 private:
327 virtual void run() override;
330 struct PageDown: BaseAction
332 PageDown(): BaseAction(Type::PageDown, "page_down") { }
334 private:
335 virtual void run() override;
338 struct MoveHome: BaseAction
340 MoveHome(): BaseAction(Type::MoveHome, "move_home") { }
342 private:
343 virtual void run() override;
346 struct MoveEnd: BaseAction
348 MoveEnd(): BaseAction(Type::MoveEnd, "move_end") { }
350 private:
351 virtual void run() override;
354 struct ToggleInterface: BaseAction
356 ToggleInterface(): BaseAction(Type::ToggleInterface, "toggle_interface") { }
358 private:
359 virtual void run() override;
362 struct JumpToParentDirectory: BaseAction
364 JumpToParentDirectory(): BaseAction(Type::JumpToParentDirectory, "jump_to_parent_directory") { }
366 private:
367 virtual bool canBeRun() override;
368 virtual void run() override;
371 struct RunAction: BaseAction
373 RunAction(): BaseAction(Type::RunAction, "run_action") { }
375 private:
376 virtual bool canBeRun() override;
377 virtual void run() override;
379 HasActions *m_ha;
382 struct PreviousColumn: BaseAction
384 PreviousColumn(): BaseAction(Type::PreviousColumn, "previous_column") { }
386 private:
387 virtual bool canBeRun() override;
388 virtual void run() override;
390 HasColumns *m_hc;
393 struct NextColumn: BaseAction
395 NextColumn(): BaseAction(Type::NextColumn, "next_column") { }
397 private:
398 virtual bool canBeRun() override;
399 virtual void run() override;
401 HasColumns *m_hc;
404 struct MasterScreen: BaseAction
406 MasterScreen(): BaseAction(Type::MasterScreen, "master_screen") { }
408 private:
409 virtual bool canBeRun() override;
410 virtual void run() override;
413 struct SlaveScreen: BaseAction
415 SlaveScreen(): BaseAction(Type::SlaveScreen, "slave_screen") { }
417 private:
418 virtual bool canBeRun() override;
419 virtual void run() override;
422 struct VolumeUp: BaseAction
424 VolumeUp(): BaseAction(Type::VolumeUp, "volume_up") { }
426 private:
427 virtual void run() override;
430 struct VolumeDown: BaseAction
432 VolumeDown(): BaseAction(Type::VolumeDown, "volume_down") { }
434 private:
435 virtual void run() override;
438 struct AddItemToPlaylist: BaseAction
440 AddItemToPlaylist(): BaseAction(Type::AddItemToPlaylist, "add_item_to_playlist") { }
442 private:
443 virtual bool canBeRun() override;
444 virtual void run() override;
446 HasSongs *m_hs;
449 struct PlayItem: BaseAction
451 PlayItem(): BaseAction(Type::PlayItem, "play_item") { }
453 private:
454 virtual bool canBeRun() override;
455 virtual void run() override;
457 HasSongs *m_hs;
460 struct DeletePlaylistItems: BaseAction
462 DeletePlaylistItems(): BaseAction(Type::DeletePlaylistItems, "delete_playlist_items") { }
464 private:
465 virtual bool canBeRun() override;
466 virtual void run() override;
469 struct DeleteStoredPlaylist: BaseAction
471 DeleteStoredPlaylist(): BaseAction(Type::DeleteStoredPlaylist, "delete_stored_playlist") { }
473 private:
474 virtual bool canBeRun() override;
475 virtual void run() override;
478 struct DeleteBrowserItems: BaseAction
480 DeleteBrowserItems(): BaseAction(Type::DeleteBrowserItems, "delete_browser_items") { }
482 private:
483 virtual bool canBeRun() override;
484 virtual void run() override;
487 struct ReplaySong: BaseAction
489 ReplaySong(): BaseAction(Type::ReplaySong, "replay_song") { }
491 private:
492 virtual void run() override;
495 struct PreviousSong: BaseAction
497 PreviousSong(): BaseAction(Type::Previous, "previous") { }
499 private:
500 virtual void run() override;
503 struct NextSong: BaseAction
505 NextSong(): BaseAction(Type::Next, "next") { }
507 private:
508 virtual void run() override;
511 struct Pause: BaseAction
513 Pause(): BaseAction(Type::Pause, "pause") { }
515 private:
516 virtual void run() override;
519 struct Stop: BaseAction
521 Stop(): BaseAction(Type::Stop, "stop") { }
523 private:
524 virtual void run() override;
527 struct ExecuteCommand: BaseAction
529 ExecuteCommand(): BaseAction(Type::ExecuteCommand, "execute_command") { }
531 private:
532 virtual void run() override;
535 struct SavePlaylist: BaseAction
537 SavePlaylist(): BaseAction(Type::SavePlaylist, "save_playlist") { }
539 private:
540 virtual void run() override;
543 struct MoveSortOrderUp: BaseAction
545 MoveSortOrderUp(): BaseAction(Type::MoveSortOrderUp, "move_sort_order_up") { }
547 private:
548 virtual bool canBeRun() override;
549 virtual void run() override;
552 struct MoveSortOrderDown: BaseAction
554 MoveSortOrderDown(): BaseAction(Type::MoveSortOrderDown, "move_sort_order_down") { }
556 private:
557 virtual bool canBeRun() override;
558 virtual void run() override;
561 struct MoveSelectedItemsUp: BaseAction
563 MoveSelectedItemsUp(): BaseAction(Type::MoveSelectedItemsUp, "move_selected_items_up") { }
565 private:
566 virtual bool canBeRun() override;
567 virtual void run() override;
570 struct MoveSelectedItemsDown: BaseAction
572 MoveSelectedItemsDown(): BaseAction(Type::MoveSelectedItemsDown, "move_selected_items_down") { }
574 private:
575 virtual bool canBeRun() override;
576 virtual void run() override;
579 struct MoveSelectedItemsTo: BaseAction
581 MoveSelectedItemsTo(): BaseAction(Type::MoveSelectedItemsTo, "move_selected_items_to") { }
583 private:
584 virtual bool canBeRun() override;
585 virtual void run() override;
588 struct Add: BaseAction
590 Add(): BaseAction(Type::Add, "add") { }
592 private:
593 virtual bool canBeRun() override;
594 virtual void run() override;
597 struct SeekForward: BaseAction
599 SeekForward(): BaseAction(Type::SeekForward, "seek_forward") { }
601 private:
602 virtual bool canBeRun() override;
603 virtual void run() override;
606 struct SeekBackward: BaseAction
608 SeekBackward(): BaseAction(Type::SeekBackward, "seek_backward") { }
610 private:
611 virtual bool canBeRun() override;
612 virtual void run() override;
615 struct ToggleDisplayMode: BaseAction
617 ToggleDisplayMode(): BaseAction(Type::ToggleDisplayMode, "toggle_display_mode") { }
619 private:
620 virtual bool canBeRun() override;
621 virtual void run() override;
624 struct ToggleSeparatorsBetweenAlbums: BaseAction
626 ToggleSeparatorsBetweenAlbums()
627 : BaseAction(Type::ToggleSeparatorsBetweenAlbums, "toggle_separators_between_albums") { }
629 private:
630 virtual bool canBeRun() override;
631 virtual void run() override;
634 struct ToggleLyricsUpdateOnSongChange: BaseAction
636 ToggleLyricsUpdateOnSongChange()
637 : BaseAction(Type::ToggleLyricsUpdateOnSongChange, "toggle_lyrics_update_on_song_change") { }
639 private:
640 virtual bool canBeRun() override;
641 virtual void run() override;
644 struct ToggleLyricsFetcher: BaseAction
646 ToggleLyricsFetcher(): BaseAction(Type::ToggleLyricsFetcher, "toggle_lyrics_fetcher") { }
648 private:
649 virtual void run() override;
652 struct ToggleFetchingLyricsInBackground: BaseAction
654 ToggleFetchingLyricsInBackground()
655 : BaseAction(Type::ToggleFetchingLyricsInBackground, "toggle_fetching_lyrics_in_background") { }
657 private:
658 virtual void run() override;
661 struct TogglePlayingSongCentering: BaseAction
663 TogglePlayingSongCentering()
664 : BaseAction(Type::TogglePlayingSongCentering, "toggle_playing_song_centering") { }
666 private:
667 virtual void run() override;
670 struct UpdateDatabase: BaseAction
672 UpdateDatabase(): BaseAction(Type::UpdateDatabase, "update_database") { }
674 private:
675 virtual void run() override;
678 struct JumpToPlayingSong: BaseAction
680 JumpToPlayingSong(): BaseAction(Type::JumpToPlayingSong, "jump_to_playing_song") { }
682 private:
683 virtual bool canBeRun() override;
684 virtual void run() override;
687 struct ToggleRepeat: BaseAction
689 ToggleRepeat(): BaseAction(Type::ToggleRepeat, "toggle_repeat") { }
691 private:
692 virtual void run() override;
695 struct Shuffle: BaseAction
697 Shuffle(): BaseAction(Type::Shuffle, "shuffle") { }
699 private:
700 virtual bool canBeRun() override;
701 virtual void run() override;
703 NC::Menu<MPD::Song>::ConstIterator m_begin;
704 NC::Menu<MPD::Song>::ConstIterator m_end;
707 struct ToggleRandom: BaseAction
709 ToggleRandom(): BaseAction(Type::ToggleRandom, "toggle_random") { }
711 private:
712 virtual void run() override;
715 struct StartSearching: BaseAction
717 StartSearching(): BaseAction(Type::StartSearching, "start_searching") { }
719 private:
720 virtual bool canBeRun() override;
721 virtual void run() override;
724 struct SaveTagChanges: BaseAction
726 SaveTagChanges(): BaseAction(Type::SaveTagChanges, "save_tag_changes") { }
728 private:
729 virtual bool canBeRun() override;
730 virtual void run() override;
733 struct ToggleSingle: BaseAction
735 ToggleSingle(): BaseAction(Type::ToggleSingle, "toggle_single") { }
737 private:
738 virtual void run() override;
741 struct ToggleConsume: BaseAction
743 ToggleConsume(): BaseAction(Type::ToggleConsume, "toggle_consume") { }
745 private:
746 virtual void run() override;
749 struct ToggleCrossfade: BaseAction
751 ToggleCrossfade(): BaseAction(Type::ToggleCrossfade, "toggle_crossfade") { }
753 private:
754 virtual void run() override;
757 struct SetCrossfade: BaseAction
759 SetCrossfade(): BaseAction(Type::SetCrossfade, "set_crossfade") { }
761 private:
762 virtual void run() override;
765 struct SetVolume: BaseAction
767 SetVolume(): BaseAction(Type::SetVolume, "set_volume") { }
769 private:
770 virtual void run() override;
773 struct EnterDirectory: BaseAction
775 EnterDirectory(): BaseAction(Type::EnterDirectory, "enter_directory") { }
777 private:
778 virtual bool canBeRun() override;
779 virtual void run() override;
783 struct EditSong: BaseAction
785 EditSong(): BaseAction(Type::EditSong, "edit_song") { }
787 private:
788 virtual bool canBeRun() override;
789 virtual void run() override;
791 #ifdef HAVE_TAGLIB_H
792 const MPD::Song *m_song;
793 #endif // HAVE_TAGLIB_H
796 struct EditLibraryTag: BaseAction
798 EditLibraryTag(): BaseAction(Type::EditLibraryTag, "edit_library_tag") { }
800 private:
801 virtual bool canBeRun() override;
802 virtual void run() override;
805 struct EditLibraryAlbum: BaseAction
807 EditLibraryAlbum(): BaseAction(Type::EditLibraryAlbum, "edit_library_album") { }
809 private:
810 virtual bool canBeRun() override;
811 virtual void run() override;
814 struct EditDirectoryName: BaseAction
816 EditDirectoryName(): BaseAction(Type::EditDirectoryName, "edit_directory_name") { }
818 private:
819 virtual bool canBeRun() override;
820 virtual void run() override;
823 struct EditPlaylistName: BaseAction
825 EditPlaylistName(): BaseAction(Type::EditPlaylistName, "edit_playlist_name") { }
827 private:
828 virtual bool canBeRun() override;
829 virtual void run() override;
832 struct EditLyrics: BaseAction
834 EditLyrics(): BaseAction(Type::EditLyrics, "edit_lyrics") { }
836 private:
837 virtual bool canBeRun() override;
838 virtual void run() override;
841 struct JumpToBrowser: BaseAction
843 JumpToBrowser(): BaseAction(Type::JumpToBrowser, "jump_to_browser") { }
845 private:
846 virtual bool canBeRun() override;
847 virtual void run() override;
849 const MPD::Song *m_song;
852 struct JumpToMediaLibrary: BaseAction
854 JumpToMediaLibrary(): BaseAction(Type::JumpToMediaLibrary, "jump_to_media_library") { }
856 private:
857 virtual bool canBeRun() override;
858 virtual void run() override;
860 const MPD::Song *m_song;
863 struct JumpToPlaylistEditor: BaseAction
865 JumpToPlaylistEditor(): BaseAction(Type::JumpToPlaylistEditor, "jump_to_playlist_editor") { }
867 private:
868 virtual bool canBeRun() override;
869 virtual void run() override;
872 struct ToggleScreenLock: BaseAction
874 ToggleScreenLock(): BaseAction(Type::ToggleScreenLock, "toggle_screen_lock") { }
876 private:
877 virtual void run() override;
880 struct JumpToTagEditor: BaseAction
882 JumpToTagEditor(): BaseAction(Type::JumpToTagEditor, "jump_to_tag_editor") { }
884 private:
885 virtual bool canBeRun() override;
886 virtual void run() override;
888 #ifdef HAVE_TAGLIB_H
889 const MPD::Song *m_song;
890 #endif // HAVE_TAGLIB_H
893 struct JumpToPositionInSong: BaseAction
895 JumpToPositionInSong(): BaseAction(Type::JumpToPositionInSong, "jump_to_position_in_song") { }
897 private:
898 virtual bool canBeRun() override;
899 virtual void run() override;
902 struct SelectItem: BaseAction
904 SelectItem(): BaseAction(Type::SelectItem, "select_item") { }
906 private:
907 virtual bool canBeRun() override;
908 virtual void run() override;
910 NC::List *m_list;
913 struct SelectRange: BaseAction
915 SelectRange(): BaseAction(Type::SelectRange, "select_range") { }
917 private:
918 virtual bool canBeRun() override;
919 virtual void run() override;
921 NC::List *m_list;
922 NC::List::Iterator m_begin;
923 NC::List::Iterator m_end;
926 struct ReverseSelection: BaseAction
928 ReverseSelection(): BaseAction(Type::ReverseSelection, "reverse_selection") { }
930 private:
931 virtual bool canBeRun() override;
932 virtual void run() override;
934 NC::List *m_list;
937 struct RemoveSelection: BaseAction
939 RemoveSelection(): BaseAction(Type::RemoveSelection, "remove_selection") { }
941 private:
942 virtual bool canBeRun() override;
943 virtual void run() override;
945 NC::List *m_list;
948 struct SelectAlbum: BaseAction
950 SelectAlbum(): BaseAction(Type::SelectAlbum, "select_album") { }
952 private:
953 virtual bool canBeRun() override;
954 virtual void run() override;
956 NC::List *m_list;
957 SongList *m_songs;
960 struct SelectFoundItems: BaseAction
962 SelectFoundItems(): BaseAction(Type::SelectFoundItems, "select_found_items") { }
964 private:
965 virtual bool canBeRun() override;
966 virtual void run() override;
968 NC::List *m_list;
969 Searchable *m_searchable;
972 struct AddSelectedItems: BaseAction
974 AddSelectedItems(): BaseAction(Type::AddSelectedItems, "add_selected_items") { }
976 private:
977 virtual bool canBeRun() override;
978 virtual void run() override;
981 struct CropMainPlaylist: BaseAction
983 CropMainPlaylist(): BaseAction(Type::CropMainPlaylist, "crop_main_playlist") { }
985 private:
986 virtual void run() override;
989 struct CropPlaylist: BaseAction
991 CropPlaylist(): BaseAction(Type::CropPlaylist, "crop_playlist") { }
993 private:
994 virtual bool canBeRun() override;
995 virtual void run() override;
998 struct ClearMainPlaylist: BaseAction
1000 ClearMainPlaylist(): BaseAction(Type::ClearMainPlaylist, "clear_main_playlist") { }
1002 private:
1003 virtual void run() override;
1006 struct ClearPlaylist: BaseAction
1008 ClearPlaylist(): BaseAction(Type::ClearPlaylist, "clear_playlist") { }
1010 private:
1011 virtual bool canBeRun() override;
1012 virtual void run() override;
1015 struct SortPlaylist: BaseAction
1017 SortPlaylist(): BaseAction(Type::SortPlaylist, "sort_playlist") { }
1019 private:
1020 virtual bool canBeRun() override;
1021 virtual void run() override;
1024 struct ReversePlaylist: BaseAction
1026 ReversePlaylist(): BaseAction(Type::ReversePlaylist, "reverse_playlist") { }
1028 private:
1029 virtual bool canBeRun() override;
1030 virtual void run() override;
1032 NC::Menu<MPD::Song>::ConstIterator m_begin;
1033 NC::Menu<MPD::Song>::ConstIterator m_end;
1036 struct ApplyFilter: public BaseAction
1038 ApplyFilter(): BaseAction(Type::ApplyFilter, "apply_filter") { }
1040 private:
1041 virtual bool canBeRun() override;
1042 virtual void run() override;
1044 Filterable *m_filterable;
1047 struct Find: BaseAction
1049 Find(): BaseAction(Type::Find, "find") { }
1051 private:
1052 virtual bool canBeRun() override;
1053 virtual void run() override;
1056 struct FindItemForward: BaseAction
1058 FindItemForward(): BaseAction(Type::FindItemForward, "find_item_forward") { }
1060 private:
1061 virtual bool canBeRun() override;
1062 virtual void run() override;
1065 struct FindItemBackward: BaseAction
1067 FindItemBackward(): BaseAction(Type::FindItemBackward, "find_item_backward") { }
1069 private:
1070 virtual bool canBeRun() override;
1071 virtual void run() override;
1074 struct NextFoundItem: BaseAction
1076 NextFoundItem(): BaseAction(Type::NextFoundItem, "next_found_item") { }
1078 private:
1079 virtual bool canBeRun() override;
1080 virtual void run() override;
1083 struct PreviousFoundItem: BaseAction
1085 PreviousFoundItem(): BaseAction(Type::PreviousFoundItem, "previous_found_item") { }
1087 private:
1088 virtual bool canBeRun() override;
1089 virtual void run() override;
1092 struct ToggleFindMode: BaseAction
1094 ToggleFindMode(): BaseAction(Type::ToggleFindMode, "toggle_find_mode") { }
1096 private:
1097 virtual void run() override;
1100 struct ToggleReplayGainMode: BaseAction
1102 ToggleReplayGainMode(): BaseAction(Type::ToggleReplayGainMode, "toggle_replay_gain_mode") { }
1104 private:
1105 virtual void run() override;
1108 struct ToggleAddMode: BaseAction
1110 ToggleAddMode(): BaseAction(Type::ToggleAddMode, "toggle_add_mode") { }
1112 private:
1113 virtual void run() override;
1116 struct ToggleMouse: BaseAction
1118 ToggleMouse(): BaseAction(Type::ToggleMouse, "toggle_mouse") { }
1120 private:
1121 virtual void run() override;
1124 struct ToggleBitrateVisibility: BaseAction
1126 ToggleBitrateVisibility(): BaseAction(Type::ToggleBitrateVisibility, "toggle_bitrate_visibility") { }
1128 private:
1129 virtual void run() override;
1132 struct AddRandomItems: BaseAction
1134 AddRandomItems(): BaseAction(Type::AddRandomItems, "add_random_items") { }
1136 private:
1137 virtual void run() override;
1140 struct ToggleBrowserSortMode: BaseAction
1142 ToggleBrowserSortMode(): BaseAction(Type::ToggleBrowserSortMode, "toggle_browser_sort_mode") { }
1144 private:
1145 virtual bool canBeRun() override;
1146 virtual void run() override;
1149 struct ToggleLibraryTagType: BaseAction
1151 ToggleLibraryTagType(): BaseAction(Type::ToggleLibraryTagType, "toggle_library_tag_type") { }
1153 private:
1154 virtual bool canBeRun() override;
1155 virtual void run() override;
1158 struct ToggleMediaLibrarySortMode: BaseAction
1160 ToggleMediaLibrarySortMode()
1161 : BaseAction(Type::ToggleMediaLibrarySortMode, "toggle_media_library_sort_mode") { }
1163 private:
1164 virtual bool canBeRun() override;
1165 virtual void run() override;
1168 struct FetchLyricsInBackground: BaseAction
1170 FetchLyricsInBackground()
1171 : BaseAction(Type::FetchLyricsInBackground, "fetch_lyrics_in_background") { }
1173 private:
1174 virtual bool canBeRun() override;
1175 virtual void run() override;
1177 HasSongs *m_hs;
1180 struct RefetchLyrics: BaseAction
1182 RefetchLyrics(): BaseAction(Type::RefetchLyrics, "refetch_lyrics") { }
1184 private:
1185 virtual bool canBeRun() override;
1186 virtual void run() override;
1189 struct SetSelectedItemsPriority: BaseAction
1191 SetSelectedItemsPriority()
1192 : BaseAction(Type::SetSelectedItemsPriority, "set_selected_items_priority") { }
1194 private:
1195 virtual bool canBeRun() override;
1196 virtual void run() override;
1199 struct ToggleOutput: BaseAction
1201 ToggleOutput(): BaseAction(Type::ToggleOutput, "toggle_output") { }
1203 private:
1204 virtual bool canBeRun() override;
1205 virtual void run() override;
1208 struct ToggleVisualizationType: BaseAction
1210 ToggleVisualizationType()
1211 : BaseAction(Type::ToggleVisualizationType, "toggle_visualization_type") { }
1213 private:
1215 virtual bool canBeRun() override;
1216 virtual void run() override;
1219 struct ShowSongInfo: BaseAction
1221 ShowSongInfo(): BaseAction(Type::ShowSongInfo, "show_song_info") { }
1223 private:
1224 virtual void run() override;
1227 struct ShowArtistInfo: BaseAction
1229 ShowArtistInfo(): BaseAction(Type::ShowArtistInfo, "show_artist_info") { }
1231 private:
1232 virtual bool canBeRun() override;
1233 virtual void run() override;
1236 struct ShowLyrics: BaseAction
1238 ShowLyrics(): BaseAction(Type::ShowLyrics, "show_lyrics") { }
1240 private:
1241 virtual bool canBeRun() override;
1242 virtual void run() override;
1244 const MPD::Song *m_song;
1247 struct Quit: BaseAction
1249 Quit(): BaseAction(Type::Quit, "quit") { }
1251 private:
1252 virtual void run() override;
1255 struct NextScreen: BaseAction
1257 NextScreen(): BaseAction(Type::NextScreen, "next_screen") { }
1259 private:
1260 virtual void run() override;
1263 struct PreviousScreen: BaseAction
1265 PreviousScreen(): BaseAction(Type::PreviousScreen, "previous_screen") { }
1267 private:
1268 virtual void run() override;
1271 struct ShowHelp: BaseAction
1273 ShowHelp(): BaseAction(Type::ShowHelp, "show_help") { }
1275 private:
1276 virtual bool canBeRun() override;
1277 virtual void run() override;
1280 struct ShowPlaylist: BaseAction
1282 ShowPlaylist(): BaseAction(Type::ShowPlaylist, "show_playlist") { }
1284 private:
1285 virtual bool canBeRun() override;
1286 virtual void run() override;
1289 struct ShowBrowser: BaseAction
1291 ShowBrowser(): BaseAction(Type::ShowBrowser, "show_browser") { }
1293 private:
1294 virtual bool canBeRun() override;
1295 virtual void run() override;
1298 struct ChangeBrowseMode: BaseAction
1300 ChangeBrowseMode(): BaseAction(Type::ChangeBrowseMode, "change_browse_mode") { }
1302 private:
1303 virtual bool canBeRun() override;
1304 virtual void run() override;
1307 struct ShowSearchEngine: BaseAction
1309 ShowSearchEngine(): BaseAction(Type::ShowSearchEngine, "show_search_engine") { }
1311 private:
1312 virtual bool canBeRun() override;
1313 virtual void run() override;
1316 struct ResetSearchEngine: BaseAction
1318 ResetSearchEngine(): BaseAction(Type::ResetSearchEngine, "reset_search_engine") { }
1320 private:
1321 virtual bool canBeRun() override;
1322 virtual void run() override;
1325 struct ShowMediaLibrary: BaseAction
1327 ShowMediaLibrary(): BaseAction(Type::ShowMediaLibrary, "show_media_library") { }
1329 private:
1330 virtual bool canBeRun() override;
1331 virtual void run() override;
1334 struct ToggleMediaLibraryColumnsMode: BaseAction
1336 ToggleMediaLibraryColumnsMode()
1337 : BaseAction(Type::ToggleMediaLibraryColumnsMode, "toggle_media_library_columns_mode") { }
1339 private:
1340 virtual bool canBeRun() override;
1341 virtual void run() override;
1344 struct ShowPlaylistEditor: BaseAction
1346 ShowPlaylistEditor(): BaseAction(Type::ShowPlaylistEditor, "show_playlist_editor") { }
1348 private:
1349 virtual bool canBeRun() override;
1350 virtual void run() override;
1353 struct ShowTagEditor: BaseAction
1355 ShowTagEditor(): BaseAction(Type::ShowTagEditor, "show_tag_editor") { }
1357 private:
1358 virtual bool canBeRun() override;
1359 virtual void run() override;
1362 struct ShowOutputs: BaseAction
1364 ShowOutputs(): BaseAction(Type::ShowOutputs, "show_outputs") { }
1366 private:
1367 virtual bool canBeRun() override;
1368 virtual void run() override;
1371 struct ShowVisualizer: BaseAction
1373 ShowVisualizer(): BaseAction(Type::ShowVisualizer, "show_visualizer") { }
1375 private:
1376 virtual bool canBeRun() override;
1377 virtual void run() override;
1380 struct ShowClock: BaseAction
1382 ShowClock(): BaseAction(Type::ShowClock, "show_clock") { }
1384 private:
1385 virtual bool canBeRun() override;
1386 virtual void run() override;
1389 struct ShowServerInfo: BaseAction
1391 ShowServerInfo(): BaseAction(Type::ShowServerInfo, "show_server_info") { }
1393 private:
1394 # ifdef HAVE_TAGLIB_H
1395 virtual bool canBeRun() override;
1396 # endif // HAVE_TAGLIB_H
1397 virtual void run() override;
1402 #endif // NCMPCPP_ACTIONS_H