Loading...
Searching...
No Matches
shortcutRegistry.h
Go to the documentation of this file.
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
#ifndef BALL_VIEW_KERNEL_SHORTCUTREGISTRY_H
#define BALL_VIEW_KERNEL_SHORTCUTREGISTRY_H
#ifndef BALL_CONCEPT_EMBEDDABLE_H
# include <BALL/CONCEPT/embeddable.h>
#endif
#include <map>
#ifndef BALL_DATATYPE_HASHSET_H
# include <BALL/DATATYPE/hashSet.h>
#endif
#ifndef BALL_VIEW_KERNEL_PREFERENCESENTRY_H
# include <BALL/VIEW/KERNEL/preferencesEntry.h>
#endif
#include <QtCore/QObject>
class QAction;
class QKeySequence;
namespace BALL
{
namespace VIEW
{
class BALL_VIEW_EXPORT ShortcutRegistry
: public QObject,
public Embeddable,
public PreferencesEntry::ExtendedPreferencesObject
{
Q_OBJECT
public:
BALL_EMBEDDABLE(ShortcutRegistry, Embeddable)
ShortcutRegistry();
virtual ~ShortcutRegistry();
void registerShortcut(String description, QAction* shortcut);
void clear();
void clearKeySequences();
bool readShortcutsFromFile(const String& filename);
bool writeShortcutsToFile(const String& filename);
bool changeShortcut(QAction* shortcut, const String& new_sequence);
bool changeShortcut(int index, const String& new_sequence);
size_t size();
bool hasDescription(const String& description);
bool hasKey(const QString& key_seq);
bool hasKey(const QKeySequence& key_seq);
bool hasKey(const String& key_seq);
std::pair<String, QAction*> operator[](Index i);
// needed for storing this classes' preferences
virtual bool getValue(String&) const;
virtual bool setValue(const String&);
Q_SIGNALS:
void shortcutChanged();
protected:
static const char* BETWEEN_SC_SEPERATOR;
static const char* IN_SC_SEPERATOR;
std::pair<String, QAction*> getEntry_(Index pos);
std::map<String, QAction*> shortcuts_;
std::map<String, String> unknown_shortcuts_;
HashSet<String> shortcut_keys_;
};
}// namespace VIEW
}// namespace BALL
#endif // BALL_VIEW_KERNEL_SHORTCUTREGISTRY_H
BALL_VIEW_EXPORT
#define BALL_VIEW_EXPORT
Definition COMMON/global.h:52
BALL::Embeddable::Embeddable
Embeddable(const String &identifier="<Embeddable>")
BALL::HashSet
Definition hashSet.h:46
BALL::String
Definition string.h:57
BALL::VIEW::PreferencesEntry::ExtendedPreferencesObject
Definition preferencesEntry.h:79
BALL::VIEW::ShortcutRegistry::readShortcutsFromFile
bool readShortcutsFromFile(const String &filename)
Read the shortcuts from a data file.
BALL::VIEW::ShortcutRegistry::shortcutChanged
void shortcutChanged()
BALL::VIEW::ShortcutRegistry::shortcuts_
std::map< String, QAction * > shortcuts_
Definition shortcutRegistry.h:94
BALL::VIEW::ShortcutRegistry::unknown_shortcuts_
std::map< String, String > unknown_shortcuts_
Definition shortcutRegistry.h:95
BALL::VIEW::ShortcutRegistry::clearKeySequences
void clearKeySequences()
Clear all key sequences for all registered QActions.
BALL::VIEW::ShortcutRegistry::BETWEEN_SC_SEPERATOR
static const char * BETWEEN_SC_SEPERATOR
Definition shortcutRegistry.h:89
BALL::VIEW::ShortcutRegistry::IN_SC_SEPERATOR
static const char * IN_SC_SEPERATOR
Definition shortcutRegistry.h:90
BALL::VIEW::ShortcutRegistry::ShortcutRegistry
ShortcutRegistry()
BALL::VIEW::ShortcutRegistry::clear
void clear()
BALL::VIEW::ShortcutRegistry::getValue
virtual bool getValue(String &) const
Overload this in derived classes!
BALL::VIEW::ShortcutRegistry::hasKey
bool hasKey(const QString &key_seq)
BALL::VIEW::ShortcutRegistry::registerShortcut
void registerShortcut(String description, QAction *shortcut)
BALL::VIEW::ShortcutRegistry::changeShortcut
bool changeShortcut(QAction *shortcut, const String &new_sequence)
BALL::VIEW::ShortcutRegistry::shortcut_keys_
HashSet< String > shortcut_keys_
Definition shortcutRegistry.h:96
BALL::VIEW::ShortcutRegistry::writeShortcutsToFile
bool writeShortcutsToFile(const String &filename)
Write the shortcuts to a data file.
BALL::VIEW::ShortcutRegistry::getEntry_
std::pair< String, QAction * > getEntry_(Index pos)
BALL::VIEW::ShortcutRegistry::setValue
virtual bool setValue(const String &)
Overload this in derived classes!
BALL::VIEW::ShortcutRegistry::size
size_t size()
BALL::VIEW::ShortcutRegistry::hasDescription
bool hasDescription(const String &description)
QObject
embeddable.h
BALL_EMBEDDABLE
#define BALL_EMBEDDABLE(TYPE, BASE)
Definition embeddable.h:31
hashSet.h
BALL::VIEW
Definition constraints.h:35
BALL
Definition constants.h:13
BALL::Index
BALL_INDEX_TYPE Index
Definition COMMON/global.h:105
std
STL namespace.
preferencesEntry.h