Chris@281: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@281: Chris@281: /* Chris@281: Sonic Visualiser Chris@281: An audio file viewer and annotation editor. Chris@281: Centre for Digital Music, Queen Mary, University of London. Chris@281: This file copyright 2007 QMUL. Chris@281: Chris@281: This program is free software; you can redistribute it and/or Chris@281: modify it under the terms of the GNU General Public License as Chris@281: published by the Free Software Foundation; either version 2 of the Chris@281: License, or (at your option) any later version. See the file Chris@281: COPYING included with this distribution for more information. Chris@281: */ Chris@281: Chris@281: #ifndef _KEY_REFERENCE_H_ Chris@281: #define _KEY_REFERENCE_H_ Chris@281: Chris@281: #include Chris@281: #include Chris@281: #include Chris@281: #include Chris@740: #include Chris@281: Chris@281: class QAction; Chris@281: class QTextEdit; Chris@282: class QDialog; Chris@282: class QAbstractButton; Chris@281: Chris@281: class KeyReference : public QObject Chris@281: { Chris@281: Q_OBJECT Chris@281: Chris@281: public: Chris@281: KeyReference(); Chris@281: virtual ~KeyReference(); Chris@281: Chris@281: void setCategory(QString category); Chris@281: Chris@281: void registerShortcut(QAction *, QString overrideName = ""); Chris@281: void registerAlternativeShortcut(QAction *, QString alternative); Chris@740: void registerAlternativeShortcut(QAction *, QKeySequence alternative); Chris@281: Chris@281: void registerShortcut(QString actionName, QString shortcut, QString tipText); Chris@281: void registerAlternativeShortcut(QString actionName, QString alternative); Chris@740: void registerAlternativeShortcut(QString actionName, QKeySequence alternative); Chris@281: Chris@281: void show(); Chris@609: void hide(); Chris@281: Chris@282: protected slots: Chris@282: void dialogButtonClicked(QAbstractButton *); Chris@282: Chris@281: protected: Chris@281: struct KeyDetails { Chris@281: QString actionName; Chris@281: QString shortcut; Chris@281: QString tip; Chris@281: std::vector alternatives; Chris@281: }; Chris@281: Chris@281: typedef std::vector KeyList; Chris@281: typedef std::map CategoryMap; Chris@281: typedef std::vector CategoryList; Chris@281: Chris@281: QString m_currentCategory; Chris@281: CategoryMap m_map; Chris@281: CategoryList m_categoryOrder; Chris@281: Chris@281: QTextEdit *m_text; Chris@282: QDialog *m_dialog; Chris@281: }; Chris@281: Chris@281: #endif