20 #ifndef STELSHORTCUT_HPP
21 #define STELSHORTCUT_HPP
27 QT_FORWARD_DECLARE_CLASS(StelShortcutGroup)
29 class StelShortcut : public QObject
33 StelShortcut(
const QString&
id, StelShortcutGroup* group,
const QString& text,
34 const QString& primaryKey,
const QString& altKey,
35 bool checkable,
bool autoRepeat =
true,
bool global =
false, QGraphicsWidget *parent = NULL);
39 QAction* getAction()
const {
return m_action; }
40 StelShortcutGroup* getGroup()
const {
return m_group; }
42 QString getId()
const {
return m_id; }
43 QString getText()
const {
return m_text; }
44 QKeySequence getPrimaryKey()
const {
return m_primaryKey; }
45 QKeySequence getAltKey()
const {
return m_altKey; }
46 bool isTemporary()
const {
return m_temporary; }
48 QVariant toQVariant()
const;
50 void setText(
const QString& text);
51 void setPrimaryKey(
const QKeySequence& key);
52 void setAltKey(
const QKeySequence& key);
53 void setCheckable(
bool c);
54 void setAutoRepeat(
bool ar);
55 void setGlobal(
bool g);
56 void setTemporary(
bool temp);
57 #ifndef DISABLE_SCRIPTING
58 void setScript(
const QString& scriptText);
59 void setScriptPath(
const QString& scriptPath);
63 void shortcutChanged(StelShortcut* shortcut);
65 #ifndef DISABLE_SCRIPTING
67 void runScript()
const;
71 void updateActionShortcuts();
75 StelShortcutGroup*
m_group;
79 QKeySequence
m_primaryKey;
80 QKeySequence
m_altKey;
92 class StelShortcutGroup :
public QObject
96 StelShortcutGroup(QString
id, QString text =
"");
100 QAction* registerAction(
const QString& actionId,
bool temporary,
const QString& text,
const QString& primaryKey,
101 const QString& altKey,
bool checkable,
bool autoRepeat =
true,
102 bool global =
false, QGraphicsWidget *parent = 0);
104 QAction* getAction(
const QString &actionId);
105 StelShortcut* getShortcut(
const QString&
id);
106 QList<StelShortcut*> getActionList()
const;
108 QString getId()
const {
return m_id; }
109 QString getText()
const {
return m_text; }
110 QString getPluginId()
const {
return m_pluginId; }
111 bool isEnabled()
const {
return m_enabled; }
113 QVariant toQVariant()
const;
116 void shortcutChanged(StelShortcut* shortcut);
121 void setEnabled(
bool enable);
122 void setPluginId(
const QString& pluginId);
130 QMap<QString, StelShortcut*>
m_shortcuts;
133 #endif // STELSHORTCUT_HPP