Changeset View
Changeset View
Standalone View
Standalone View
libs/widgetutils/kis_action_registry.h
Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Line(s) | |||||
42 | 42 | | |||
43 | public: | 43 | public: | ||
44 | static KisActionRegistry *instance(); | 44 | static KisActionRegistry *instance(); | ||
45 | 45 | | |||
46 | 46 | | |||
47 | /** | 47 | /** | ||
48 | * Get shortcut for an action | 48 | * Get shortcut for an action | ||
49 | */ | 49 | */ | ||
50 | QKeySequence getPreferredShortcut(QString name); | 50 | QKeySequence getPreferredShortcut(const QString &name); | ||
51 | 51 | | |||
52 | /** | 52 | /** | ||
53 | * Get shortcut for an action | 53 | * Get shortcut for an action | ||
54 | */ | 54 | */ | ||
55 | QKeySequence getDefaultShortcut(QString name); | 55 | QKeySequence getDefaultShortcut(const QString &name); | ||
56 | 56 | | |||
57 | /** | 57 | /** | ||
58 | * Get custom shortcut for an action | 58 | * Get custom shortcut for an action | ||
59 | */ | 59 | */ | ||
60 | QKeySequence getCustomShortcut(QString name); | 60 | QKeySequence getCustomShortcut(const QString &name); | ||
61 | | ||||
62 | | ||||
63 | /** | ||||
64 | * Get category name | ||||
65 | */ | ||||
66 | QKeySequence getCategory(const QString &name); | ||||
61 | 67 | | |||
62 | /** | 68 | /** | ||
63 | * @return DOM info for an action @a name. | 69 | * @return DOM info for an action @a name. Might be private. | ||
64 | * | 70 | * | ||
65 | * Allows somewhat flexible info structure for KisActions, QActions, | 71 | * Allows somewhat flexible info structure for KisActions, QActions, | ||
66 | * whatever else we decide on doing later. | 72 | * whatever else we decide on doing later. | ||
67 | */ | 73 | */ | ||
68 | QDomElement getActionXml(QString name); | 74 | QDomElement getActionXml(const QString &name); | ||
69 | 75 | | |||
70 | 76 | | |||
71 | /** | 77 | /** | ||
72 | * Saves action in a category. Note that this grabs ownership of the action. | 78 | * Saves action in a category. Note that this grabs ownership of the action. | ||
73 | */ | 79 | */ | ||
74 | void addAction(QString name, QAction *a, QString category = "Krita"); | 80 | void addAction(const QString &name, QAction *a); | ||
75 | 81 | | |||
76 | 82 | | |||
77 | /** | 83 | /** | ||
78 | * Produces a new QAction based on the .action data files. | 84 | * Produces a new QAction based on the .action data files. | ||
85 | * | ||||
86 | * N.B. this action will not be saved in the registry. | ||||
79 | */ | 87 | */ | ||
80 | QAction * makeQAction(QString name, QObject *parent, QString category = QString()); | 88 | QAction * makeQAction(const QString &name, QObject *parent); | ||
81 | | ||||
82 | KActionCollection * getDefaultCollection(); | | |||
83 | 89 | | |||
84 | /** | 90 | /** | ||
85 | * Fills the standard QAction properties of an action. | 91 | * Fills the standard QAction properties of an action. | ||
86 | * | 92 | * | ||
87 | * @return true if the action was loaded successfully. | 93 | * @return true if the action was loaded successfully. | ||
88 | */ | 94 | */ | ||
89 | bool propertizeAction(QString name, QAction *a); | 95 | bool propertizeAction(const QString &name, QAction *a); | ||
90 | 96 | | |||
91 | 97 | | |||
92 | /** | 98 | /** | ||
93 | * @return list of actions with data available. | 99 | * @return list of actions with data available. | ||
94 | */ | 100 | */ | ||
95 | QStringList allActions(); | 101 | QStringList allActions(); | ||
96 | 102 | | |||
97 | /** | 103 | /** | ||
98 | * Save settings. Not implemented yet. | 104 | * Save settings. Not implemented yet. | ||
99 | */ | 105 | */ | ||
100 | // void writeSettings(KActionCollection *ac); | 106 | // void writeSettings(KActionCollection *ac); | ||
101 | 107 | | |||
102 | 108 | | |||
103 | /** | 109 | /** | ||
104 | * Run shortcuts dialog. | 110 | * Display the shortcut configuration dialog. | ||
105 | */ | 111 | */ | ||
106 | void configureShortcuts(KActionCollection *ac); | 112 | void configureShortcuts(KActionCollection *ac); | ||
107 | 113 | | |||
114 | | ||||
115 | /** | ||||
116 | * Call after settings are changed. | ||||
117 | */ | ||||
118 | void notifySettingsUpdated(); | ||||
119 | | ||||
108 | /** | 120 | /** | ||
109 | * Constructor. Please don't touch! | 121 | * Constructor. Please don't touch! | ||
110 | */ | 122 | */ | ||
111 | KisActionRegistry(); | 123 | KisActionRegistry(); | ||
112 | 124 | | |||
125 | // Undocumented | ||||
126 | void updateShortcut(const QString &name, QAction *ac); | ||||
127 | KActionCollection * getDefaultCollection(); | ||||
128 | | ||||
129 | | ||||
130 | | ||||
113 | private: | 131 | private: | ||
114 | class Private; | 132 | class Private; | ||
115 | Private * const d; | 133 | Private * const d; | ||
116 | }; | 134 | }; | ||
117 | 135 | |