1 #ifndef SHORTCUTS_MANAGER_H
2 #define SHORTCUTS_MANAGER_H
3 
4 #include <QObject>
5 #include <QKeySequence>
6 #include <QString>
7 #include <QMap>
8 
9 class QAction;
10 
11 //QAction: used setData() and data() for storing (userData) an identifier for each QAction. This value is ussed in QSettings
12 
13 class ShortcutsManager
14 {
15 private:
16     ShortcutsManager();
17     QMap<QString, QKeySequence> defaultShorcuts;
18     QList<QAction *> actions; //all actions registered, used for checking conflicts
19 
20     void initDefaultShorcuts();
21 
22 public:
getShortcutsManager()23     static ShortcutsManager &getShortcutsManager()
24     {
25         static ShortcutsManager manager;
26         return manager;
27     }
28 
29     void resetToDefaults();
30     QString getShortcut(const QString &name);
31     void saveShortcut(QAction *action);
32     void registerActions(const QList<QAction *> &actions);
33     bool checkConflicts(const QKeySequence &shortcut, const QAction *dest);
34 };
35 
36 //ACTION NAMES YACReaderLibrary
37 #define BACK_ACTION_YL "BACK_ACTION_YL"
38 #define FORWARD_ACTION_YL "FORWARD_ACTION_YL"
39 #define CREATE_LIBRARY_ACTION_YL "CREATE_LIBRARY_ACTION_YL"
40 #define OPEN_LIBRARY_ACTION_YL "OPEN_LIBRARY_ACTION_YL"
41 #define EXPORT_COMICS_INFO_ACTION_YL "EXPORT_COMICS_INFO_ACTION_YL"
42 #define IMPORT_COMICS_INFO_ACTION_YL "IMPORT_COMICS_INFO_ACTION_YL"
43 #define EXPORT_LIBRARY_ACTION_YL "EXPORT_LIBRARY_ACTION_YL"
44 #define IMPORT_LIBRARY_ACTION_YL "IMPORT_LIBRARY_ACTION_YL"
45 #define UPDATE_LIBRARY_ACTION_YL "UPDATE_LIBRARY_ACTION_YL"
46 #define RENAME_LIBRARY_ACTION_YL "RENAME_LIBRARY_ACTION_YL"
47 #define REMOVE_LIBRARY_ACTION_YL "REMOVE_LIBRARY_ACTION_YL"
48 #define OPEN_COMIC_ACTION_YL "OPEN_COMIC_ACTION_YL"
49 #define SET_AS_READ_ACTION_YL "SET_AS_READ_ACTION_YL"
50 #define SET_AS_NON_READ_ACTION_YL "SET_AS_NON_READ_ACTION_YL"
51 #define SET_AS_MANGA_ACTION_YL "SET_AS_MANGA_ACTION_YL"
52 #define SET_AS_NORMAL_ACTION_YL "SET_AS_MANGA_ACTION_YL"
53 #define SHOW_HIDE_MARKS_ACTION_YL "SHOW_HIDE_MARKS_ACTION_YL"
54 #define TOGGLE_FULL_SCREEN_ACTION_YL "TOGGLE_FULL_SCREEN_ACTION_YL"
55 #define HELP_ABOUT_ACTION_YL "HELP_ABOUT_ACTION_YL"
56 #define SET_ROOT_INDEX_ACTION_YL "SET_ROOT_INDEX_ACTION_YL"
57 #define EXPAND_ALL_NODES_ACTION_YL "EXPAND_ALL_NODES_ACTION_YL"
58 #define COLAPSE_ALL_NODES_ACTION_YL "COLAPSE_ALL_NODES_ACTION_YL"
59 #define OPTIONS_ACTION_YL "OPTIONS_ACTION_YL"
60 #define SERVER_CONFIG_ACTION_YL "SERVER_CONFIG_ACTION_YL"
61 #define TOGGLE_COMICS_VIEW_ACTION_YL "TOGGLE_COMICS_VIEW_ACTION_YL"
62 #define OPEN_CONTAINING_FOLDER_ACTION_YL "OPEN_CONTAINING_FOLDER_ACTION_YL"
63 #define SET_FOLDER_AS_NOT_COMPLETED_ACTION_YL "SET_FOLDER_AS_NOT_COMPLETED_ACTION_YL"
64 #define SET_FOLDER_AS_COMPLETED_ACTION_YL "SET_FOLDER_AS_COMPLETED_ACTION_YL"
65 #define SET_FOLDER_AS_READ_ACTION_YL "SET_FOLDER_AS_READ_ACTION_YL"
66 #define SET_FOLDER_AS_UNREAD_ACTION_YL "SET_FOLDER_AS_UNREAD_ACTION_YL"
67 #define SET_FOLDER_AS_MANGA_ACTION_YL "SET_FOLDER_AS_MANGA_ACTION_YL"
68 #define SET_FOLDER_AS_NORMAL_ACTION_YL "SET_FOLDER_AS_NORMAL_ACTION_YL"
69 #define OPEN_CONTAINING_FOLDER_COMIC_ACTION_YL "OPEN_CONTAINING_FOLDER_COMIC_ACTION_YL"
70 #define RESET_COMIC_RATING_ACTION_YL "RESET_COMIC_RATING_ACTION_YL"
71 #define SELECT_ALL_COMICS_ACTION_YL "SELECT_ALL_COMICS_ACTION_YL"
72 #define EDIT_SELECTED_COMICS_ACTION_YL "EDIT_SELECTED_COMICS_ACTION_YL"
73 #define ASIGN_ORDER_ACTION_YL "ASIGN_ORDER_ACTION_YL"
74 #define FORCE_COVER_EXTRACTED_ACTION_YL "FORCE_COVER_EXTRACTED_ACTION_YL"
75 #define DELETE_COMICS_ACTION_YL "DELETE_COMICS_ACTION_YL"
76 #define HIDE_COMIC_VIEW_ACTION_YL "HIDE_COMIC_VIEW_ACTION_YL"
77 #define GET_INFO_ACTION_YL "GET_INFO_ACTION_YL"
78 #define FOCUS_SEARCH_LINE_ACTION_YL "FOCUS_SEARCH_LINE_ACTION_YL"
79 #define FOCUS_COMICS_VIEW_ACTION_YL "FOCUS_COMICS_VIEW_ACTION_YL"
80 #define SHOW_EDIT_SHORTCUTS_ACTION_YL "SHOW_EDIT_SHORTCUTS_ACTION_YL"
81 #define QUIT_ACTION_YL "QUIT_ACTION_YL"
82 #define UPDATE_CURRENT_FOLDER_ACTION_YL "UPDATE_CURRENT_FOLDER_ACTION_YL"
83 #define ADD_FOLDER_ACTION_YL "ADD_FOLDER_ACTION_YL"
84 #define REMOVE_FOLDER_ACTION_YL "REMOVE_FOLDER_ACTION_YL"
85 #define ADD_READING_LIST_ACTION_YL "ADD_READING_LIST_ACTION_YL"
86 #define REMOVE_READING_LIST_ACTION_YL "REMOVE_READING_LIST_ACTION_YL"
87 #define ADD_LABEL_ACTION_YL "ADD_LABEL_ACTION_YL"
88 #define RENAME_LIST_ACTION_YL "RENAME_LIST_ACTION_YL"
89 #define ADD_TO_FAVORITES_ACTION_YL "ADD_TO_FAVORITES_ACTION_YL"
90 #define SAVE_COVERS_TO_ACTION_YL "SAVE_COVERS_TO_ACTION_YL"
91 //COMMANDS YACReaderLibrary
92 
93 //ACTION NAMES YACReader
94 #define OPEN_ACTION_Y "OPEN_ACTION_Y"
95 #define NEW_INSTANCE_ACTION_Y "NEW_INSTANCE_ACTION_Y"
96 #define OPEN_FOLDER_ACTION_Y "OPEN_FOLDER_ACTION_Y"
97 #define SAVE_IMAGE_ACTION_Y "SAVE_IMAGE_ACTION_Y"
98 #define OPEN_PREVIOUS_COMIC_ACTION_Y "OPEN_PREVIOUS_COMIC_ACTION_Y"
99 #define OPEN_NEXT_COMIC_ACTION_Y "OPEN_NEXT_COMIC_ACTION_Y"
100 #define PREV_ACTION_Y "PREV_ACTION_Y"
101 #define NEXT_ACTION_Y "NEXT_ACTION_Y"
102 #define ADJUST_HEIGHT_ACTION_Y "ADJUST_HEIGHT_Y"
103 #define ADJUST_WIDTH_ACTION_Y "ADJUST_WIDTH_Y"
104 #define LEFT_ROTATION_ACTION_Y "LEFT_ROTATION_ACTION_Y"
105 #define RIGHT_ROTATION_ACTION_Y "RIGHT_ROTATION_ACTION_Y"
106 #define DOUBLE_PAGE_ACTION_Y "DOUBLE_PAGE_ACTION_Y"
107 #define DOUBLE_MANGA_PAGE_ACTION_Y "DOUBLE_MANGA_PAGE_ACTION_Y"
108 #define GO_TO_PAGE_ACTION_Y "GO_TO_PAGE_ACTION_Y"
109 #define OPTIONS_ACTION_Y "OPTIONS_ACTION_Y"
110 #define HELP_ABOUT_ACTION_Y "HELP_ABOUT_ACTION_Y"
111 #define SHOW_MAGNIFYING_GLASS_ACTION_Y "SHOW_MAGNIFYING_GLASS_ACTION_Y"
112 #define SET_BOOKMARK_ACTION_Y "SET_BOOKMARK_ACTION_Y"
113 #define SHOW_BOOKMARKS_ACTION_Y "SHOW_BOOKMARKS_ACTION_Y"
114 #define SHOW_SHORCUTS_ACTION_Y "SHOW_SHORCUTS_ACTION_Y"
115 #define SHOW_INFO_ACTION_Y "SHOW_INFO_ACTION_Y"
116 #define CLOSE_ACTION_Y "CLOSE_ACTION_Y"
117 #define SHOW_DICTIONARY_ACTION_Y "SHOW_DICTIONARY_ACTION_Y"
118 #define ALWAYS_ON_TOP_ACTION_Y "ALWAYS_ON_TOP_ACTION_Y"
119 #define ADJUST_TO_FULL_SIZE_ACTION_Y "ADJUST_TO_FULL_SIZE_ACTION_Y"
120 #define FIT_TO_PAGE_ACTION_Y "FIT_TO_PAGE_ACTION_Y"
121 #define SHOW_FLOW_ACTION_Y "SHOW_FLOW_ACTION_Y"
122 #define SHOW_EDIT_SHORTCUTS_ACTION_Y "SHOW_EDIT_SHORTCUTS_ACTION_Y"
123 #define OPEN_LATEST_COMIC_Y "OPEN_LATEST_COMIC_Y"
124 
125 //COMMANDS YACReader
126 //main_viewer_window
127 #define TOGGLE_FULL_SCREEN_ACTION_Y "TOGGLE_FULL_SCREEN_ACTION_Y"
128 #define TOGGLE_TOOL_BARS_ACTION_Y "TOGGLE_TOOL_BARS_ACTION_Y"
129 #define CHANGE_FIT_ACTION_Y "CHANGE_FIT_ACTION_Y"
130 #define ZOOM_PLUS_ACTION_Y "ZOOM_PLUS_ACTION_Y"
131 #define ZOOM_MINUS_ACTION_Y "ZOOM_MINUS_ACTION_Y"
132 #define RESET_ZOOM_ACTION_Y "RESET_ZOOM_ACTION_Y"
133 //viewer
134 #define AUTO_SCROLL_FORWARD_ACTION_Y "AUTO_SCROLL_FORWARD_ACTION_Y"
135 #define AUTO_SCROLL_BACKWARD_ACTION_Y "AUTO_SCROLL_BACKWARD_ACTION_Y"
136 #define AUTO_SCROLL_FORWARD_VERTICAL_FIRST_ACTION_Y "AUTO_SCROLL_FORWARD_VERTICAL_FIRST_ACTION_Y"
137 #define AUTO_SCROLL_BACKWARD_VERTICAL_FIRST_ACTION_Y "AUTO_SCROLL_BACKWARD_VERTICAL_FIRST_ACTION_Y"
138 #define AUTO_SCROLL_FORWARD_HORIZONTAL_FIRST_ACTION_Y "AUTO_SCROLL_FORWARD_HORIZONTAL_FIRST_ACTION_Y"
139 #define AUTO_SCROLL_BACKWARD_HORIZONTAL_FIRST_ACTION_Y "AUTO_SCROLL_BACKWARD_HORIZONTAL_FIRST_ACTION_Y"
140 #define MOVE_DOWN_ACTION_Y "MOVE_DOWN_ACTION_Y"
141 #define MOVE_UP_ACTION_Y "MOVE_UP_ACTION_Y"
142 #define MOVE_LEFT_ACTION_Y "MOVE_LEFT_ACTION_Y"
143 #define MOVE_RIGHT_ACTION_Y "MOVE_RIGHT_ACTION_Y"
144 #define GO_TO_FIRST_PAGE_ACTION_Y "GO_TO_FIRST_PAGE_ACTION_Y"
145 #define GO_TO_LAST_PAGE_ACTION_Y "GO_TO_LAST_PAGE_ACTION_Y"
146 //mglass
147 #define SIZE_UP_MGLASS_ACTION_Y "SIZE_UP_MGLASS_ACTION_Y"
148 #define SIZE_DOWN_MGLASS_ACTION_Y "SIZE_DOWN_MGLASS_ACTION_Y"
149 #define ZOOM_IN_MGLASS_ACTION_Y "ZOOM_IN_MGLASS_ACTION_Y"
150 #define ZOOM_OUT_MGLASS_ACTION_Y "ZOOM_OUT_MGLASS_ACTION_Y"
151 
152 #endif // SHORTCUTS_MANAGER_H
153