annotate widgets/KeyReference.h @ 640:c6d705bf1672

Merge from branch "qt5". This revision actually builds with Qt4 (late releases) or Qt5, though it will warn on configure with Qt4.
author Chris Cannam
date Tue, 14 May 2013 12:36:43 +0100
parents 5f3f5c1e23e8
children a31c8ee2e17e
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@281 23
Chris@281 24 class QAction;
Chris@281 25 class QTextEdit;
Chris@282 26 class QDialog;
Chris@282 27 class QAbstractButton;
Chris@281 28
Chris@281 29 class KeyReference : public QObject
Chris@281 30 {
Chris@281 31 Q_OBJECT
Chris@281 32
Chris@281 33 public:
Chris@281 34 KeyReference();
Chris@281 35 virtual ~KeyReference();
Chris@281 36
Chris@281 37 void setCategory(QString category);
Chris@281 38
Chris@281 39 void registerShortcut(QAction *, QString overrideName = "");
Chris@281 40 void registerAlternativeShortcut(QAction *, QString alternative);
Chris@281 41
Chris@281 42 void registerShortcut(QString actionName, QString shortcut, QString tipText);
Chris@281 43 void registerAlternativeShortcut(QString actionName, QString alternative);
Chris@281 44
Chris@281 45 void show();
Chris@609 46 void hide();
Chris@281 47
Chris@282 48 protected slots:
Chris@282 49 void dialogButtonClicked(QAbstractButton *);
Chris@282 50
Chris@281 51 protected:
Chris@281 52 struct KeyDetails {
Chris@281 53 QString actionName;
Chris@281 54 QString shortcut;
Chris@281 55 QString tip;
Chris@281 56 std::vector<QString> alternatives;
Chris@281 57 };
Chris@281 58
Chris@281 59 typedef std::vector<KeyDetails> KeyList;
Chris@281 60 typedef std::map<QString, KeyList> CategoryMap;
Chris@281 61 typedef std::vector<QString> CategoryList;
Chris@281 62
Chris@281 63 QString m_currentCategory;
Chris@281 64 CategoryMap m_map;
Chris@281 65 CategoryList m_categoryOrder;
Chris@281 66
Chris@281 67 QTextEdit *m_text;
Chris@282 68 QDialog *m_dialog;
Chris@281 69 };
Chris@281 70
Chris@281 71 #endif