BALL 1.5.0
shortcutRegistry.h
Go to the documentation of this file.
1// -*- Mode: C++; tab-width: 2; -*-
2// vi: set ts=2:
3//
4
5#ifndef BALL_VIEW_KERNEL_SHORTCUTREGISTRY_H
6#define BALL_VIEW_KERNEL_SHORTCUTREGISTRY_H
7
8#ifndef BALL_CONCEPT_EMBEDDABLE_H
10#endif
11
12#include <map>
13
14#ifndef BALL_DATATYPE_HASHSET_H
16#endif
17
18#ifndef BALL_VIEW_KERNEL_PREFERENCESENTRY_H
20#endif
21
22#include <QtCore/QObject>
23
24class QAction;
25class QKeySequence;
26
27namespace BALL
28{
29 namespace VIEW
30 {
37 : public QObject,
38 public Embeddable,
40 {
41 Q_OBJECT
42
43 public:
45
46
48
51 virtual ~ShortcutRegistry();
52
54 void registerShortcut(String description, QAction* shortcut);
55
57 void clear();
58
60 void clearKeySequences();
61
63 bool readShortcutsFromFile(const String& filename);
64
66 bool writeShortcutsToFile(const String& filename);
67
69 bool changeShortcut(QAction* shortcut, const String& new_sequence);
70 bool changeShortcut(int index, const String& new_sequence);
71
72 size_t size();
73
74 bool hasDescription(const String& description);
75 bool hasKey(const QString& key_seq);
76 bool hasKey(const QKeySequence& key_seq);
77 bool hasKey(const String& key_seq);
78
79 std::pair<String, QAction*> operator[](Index i);
80
81 // needed for storing this classes' preferences
82 virtual bool getValue(String&) const;
83 virtual bool setValue(const String&);
84
85 Q_SIGNALS:
86 void shortcutChanged();
87
88 protected:
89 static const char* BETWEEN_SC_SEPERATOR;
90 static const char* IN_SC_SEPERATOR;
91
92 std::pair<String, QAction*> getEntry_(Index pos);
93
94 std::map<String, QAction*> shortcuts_;
95 std::map<String, String> unknown_shortcuts_;
96 HashSet<String> shortcut_keys_;
97 };
98
99 }// namespace VIEW
100}// namespace BALL
101
102#endif // BALL_VIEW_KERNEL_SHORTCUTREGISTRY_H
103
#define BALL_EMBEDDABLE(TYPE, BASE)
Definition: embeddable.h:31
STL namespace.
Definition: constants.h:13
#define BALL_VIEW_EXPORT
Definition: COMMON/global.h:52