KeyReference.h

Go to the documentation of this file.
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
00002 
00003 /*
00004     Sonic Visualiser
00005     An audio file viewer and annotation editor.
00006     Centre for Digital Music, Queen Mary, University of London.
00007     This file copyright 2007 QMUL.
00008     
00009     This program is free software; you can redistribute it and/or
00010     modify it under the terms of the GNU General Public License as
00011     published by the Free Software Foundation; either version 2 of the
00012     License, or (at your option) any later version.  See the file
00013     COPYING included with this distribution for more information.
00014 */
00015 
00016 #ifndef _KEY_REFERENCE_H_
00017 #define _KEY_REFERENCE_H_
00018 
00019 #include <QObject>
00020 #include <QString>
00021 #include <vector>
00022 #include <map>
00023 
00024 class QAction;
00025 class QTextEdit;
00026 class QDialog;
00027 class QAbstractButton;
00028 
00029 class KeyReference : public QObject
00030 {
00031     Q_OBJECT
00032 
00033 public:
00034     KeyReference();
00035     virtual ~KeyReference();
00036 
00037     void setCategory(QString category);
00038 
00039     void registerShortcut(QAction *, QString overrideName = "");
00040     void registerAlternativeShortcut(QAction *, QString alternative);
00041 
00042     void registerShortcut(QString actionName, QString shortcut, QString tipText);
00043     void registerAlternativeShortcut(QString actionName, QString alternative);
00044 
00045     void show();
00046 
00047 protected slots:
00048     void dialogButtonClicked(QAbstractButton *);
00049 
00050 protected:
00051     struct KeyDetails {
00052         QString actionName;
00053         QString shortcut;
00054         QString tip;
00055         std::vector<QString> alternatives;
00056     };
00057 
00058     typedef std::vector<KeyDetails> KeyList;
00059     typedef std::map<QString, KeyList> CategoryMap;
00060     typedef std::vector<QString> CategoryList;
00061     
00062     QString m_currentCategory;
00063     CategoryMap m_map;
00064     CategoryList m_categoryOrder;
00065 
00066     QTextEdit *m_text;
00067     QDialog *m_dialog;
00068 };
00069 
00070 #endif

Generated on Wed Feb 20 15:45:26 2008 for SonicVisualiser by  doxygen 1.5.1