annotate widgets/KeyReference.h @ 988:4f4f0e158ecf 3.0-integration

Merge from branch simple-fft-model
author Chris Cannam
date Wed, 01 Jul 2015 13:27:03 +0100
parents a31c8ee2e17e
children 05d614f6e46d
rev   line source
Chris@281 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@281 2
Chris@281 3 /*
Chris@281 4 Sonic Visualiser
Chris@281 5 An audio file viewer and annotation editor.
Chris@281 6 Centre for Digital Music, Queen Mary, University of London.
Chris@281 7 This file copyright 2007 QMUL.
Chris@281 8
Chris@281 9 This program is free software; you can redistribute it and/or
Chris@281 10 modify it under the terms of the GNU General Public License as
Chris@281 11 published by the Free Software Foundation; either version 2 of the
Chris@281 12 License, or (at your option) any later version. See the file
Chris@281 13 COPYING included with this distribution for more information.
Chris@281 14 */
Chris@281 15
Chris@281 16 #ifndef _KEY_REFERENCE_H_
Chris@281 17 #define _KEY_REFERENCE_H_
Chris@281 18
Chris@281 19 #include <QObject>
Chris@281 20 #include <QString>
Chris@281 21 #include <vector>
Chris@281 22 #include <map>
Chris@740 23 #include <QKeySequence>
Chris@281 24
Chris@281 25 class QAction;
Chris@281 26 class QTextEdit;
Chris@282 27 class QDialog;
Chris@282 28 class QAbstractButton;
Chris@281 29
Chris@281 30 class KeyReference : public QObject
Chris@281 31 {
Chris@281 32 Q_OBJECT
Chris@281 33
Chris@281 34 public:
Chris@281 35 KeyReference();
Chris@281 36 virtual ~KeyReference();
Chris@281 37
Chris@281 38 void setCategory(QString category);
Chris@281 39
Chris@281 40 void registerShortcut(QAction *, QString overrideName = "");
Chris@281 41 void registerAlternativeShortcut(QAction *, QString alternative);
Chris@740 42 void registerAlternativeShortcut(QAction *, QKeySequence alternative);
Chris@281 43
Chris@281 44 void registerShortcut(QString actionName, QString shortcut, QString tipText);
Chris@281 45 void registerAlternativeShortcut(QString actionName, QString alternative);
Chris@740 46 void registerAlternativeShortcut(QString actionName, QKeySequence alternative);
Chris@281 47
Chris@281 48 void show();
Chris@609 49 void hide();
Chris@281 50
Chris@282 51 protected slots:
Chris@282 52 void dialogButtonClicked(QAbstractButton *);
Chris@282 53
Chris@281 54 protected:
Chris@281 55 struct KeyDetails {
Chris@281 56 QString actionName;
Chris@281 57 QString shortcut;
Chris@281 58 QString tip;
Chris@281 59 std::vector<QString> alternatives;
Chris@281 60 };
Chris@281 61
Chris@281 62 typedef std::vector<KeyDetails> KeyList;
Chris@281 63 typedef std::map<QString, KeyList> CategoryMap;
Chris@281 64 typedef std::vector<QString> CategoryList;
Chris@281 65
Chris@281 66 QString m_currentCategory;
Chris@281 67 CategoryMap m_map;
Chris@281 68 CategoryList m_categoryOrder;
Chris@281 69
Chris@281 70 QTextEdit *m_text;
Chris@282 71 QDialog *m_dialog;
Chris@281 72 };
Chris@281 73
Chris@281 74 #endif