1 //////////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (c) 2004-2021 musikcube team
4 //
5 // All rights reserved.
6 //
7 // Redistribution and use in source and binary forms, with or without
8 // modification, are permitted provided that the following conditions are met:
9 //
10 //    * Redistributions of source code must retain the above copyright notice,
11 //      this list of conditions and the following disclaimer.
12 //
13 //    * Redistributions in binary form must reproduce the above copyright
14 //      notice, this list of conditions and the following disclaimer in the
15 //      documentation and/or other materials provided with the distribution.
16 //
17 //    * Neither the name of the author nor the names of other contributors may
18 //      be used to endorse or promote products derived from this software
19 //      without specific prior written permission.
20 //
21 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 // POSSIBILITY OF SUCH DAMAGE.
32 //
33 //////////////////////////////////////////////////////////////////////////////
34 
35 #pragma once
36 
37 #include <stdafx.h>
38 
39 #include <cursespp/INavigationKeys.h>
40 
41 namespace musik {
42     namespace cube {
43         class Hotkeys {
44             public:
45                 enum Id {
46                     /* selection */
47                     Up = 0,
48                     Down,
49                     Left,
50                     Right,
51                     PageUp,
52                     PageDown,
53                     Home,
54                     End,
55 
56                     /* navigation */
57                     NavigateLibrary,
58                     NavigateLibraryBrowse,
59                     NavigateLibraryBrowseArtists,
60                     NavigateLibraryBrowseAlbums,
61                     NavigateLibraryBrowseGenres,
62                     NavigateLibraryBrowseAlbumArtists,
63                     NavigateLibraryBrowsePlaylists,
64                     NavigateLibraryBrowseChooseCategory,
65                     NavigateLibraryBrowseDirectories,
66                     NavigateLibraryFilter,
67                     NavigateLibraryTracks,
68                     NavigateLibraryPlayQueue,
69                     NavigateConsole,
70                     NavigateLyrics,
71                     NavigateHotkeys,
72                     NavigateJumpToPlaying,
73                     NavigateSettings,
74 
75                     /* views */
76                     ViewRefresh,
77                     ToggleVisualizer,
78                     ShowEqualizer,
79 
80                     /* playback */
81                     ToggleMute,
82                     TogglePause,
83                     Next,
84                     Previous,
85                     VolumeUp,
86                     VolumeDown,
87                     SeekForward,
88                     SeekForwardProportional,
89                     SeekBackProportional,
90                     SeekBack,
91                     ToggleRepeat,
92                     ToggleShuffle,
93                     Stop,
94 
95                     /* play queue */
96                     PlayQueueMoveUp,
97                     PlayQueueMoveDown,
98                     PlayQueueDelete,
99                     PlayQueuePlaylistLoad,
100                     PlayQueuePlaylistSave,
101                     PlayQueuePlaylistRename,
102                     PlayQueuePlaylistDelete,
103                     PlayQueueHotSwap,
104                     PlayQueueClear,
105 
106                     /* browse -> playlists */
107                     BrowsePlaylistsNew,
108                     BrowsePlaylistsSave,
109                     BrowsePlaylistsRename,
110                     BrowsePlaylistsDelete,
111 
112                     /* tracklist items */
113                     TrackListRateTrack,
114                     TrackListChangeSortOrder,
115                     TrackListNextGroup,
116                     TrackListPreviousGroup,
117                     TrackListPlayFromTop,
118 
119                     /* search input */
120                     SearchInputToggleMatchType,
121 
122                     /* lyrics */
123                     LyricsRetry,
124 
125                     /* indexer */
126                     RescanMetadata,
127 
128                     /* hotkeys */
129                     HotkeysResetToDefault,
130                     HotkeysBackup,
131 
132                     /* general */
133                     ContextMenu,
134 
135                     /* :3 */
136                     COUNT
137                 };
138 
139                 static bool Is(Id id, const std::string& kn);
140                 static std::string Get(Id id);
141                 static void Set(Id id, const std::string& kn);
142                 static void Reset();
143                 static std::string Existing(const std::string& kn);
144                 static std::string Name(Id id);
145                 static std::string Default(Id id);
146                 static std::string Custom(Id id);
147                 static std::shared_ptr<cursespp::INavigationKeys> NavigationKeys();
148 
149             private:
150                 DELETE_CLASS_DEFAULTS(Hotkeys)
151         };
152     }
153 }
154