]> git.sur5r.net Git - minitube/blob - src/globalshortcuts.h
Imported Upstream version 1.2
[minitube] / src / globalshortcuts.h
1 #ifndef GLOBALSHORTCUTS_H
2 #define GLOBALSHORTCUTS_H
3
4 #include <QtCore>
5 #include <QAction>
6
7 class GlobalShortcutBackend;
8
9 class GlobalShortcuts : public QObject {
10
11     Q_OBJECT
12
13 public:
14     static GlobalShortcuts& instance();
15
16     struct Shortcut {
17         QString id;
18         QKeySequence default_key;
19         QAction* action;
20     };
21
22     QMap<QString, Shortcut> shortcuts() const { return shortcuts_; }
23     void setBackend(GlobalShortcutBackend* backend) {
24         this->backend = backend;
25         reload();
26     }
27
28 public slots:
29     void reload();
30
31 signals:
32     void Play();
33     void Pause();
34     void PlayPause();
35     void Stop();
36     void StopAfter();
37     void Next();
38     void Previous();
39     void IncVolume();
40     void DecVolume();
41     void Mute();
42     void SeekForward();
43     void SeekBackward();
44
45 private:
46     GlobalShortcuts(QObject* parent = 0);
47     void AddShortcut(const QString& id, const QString& name, const char* signal,
48                      const QKeySequence& default_key = QKeySequence(0));
49
50 private:
51     GlobalShortcutBackend* backend;
52
53     QMap<QString, Shortcut> shortcuts_;
54 };
55
56 #endif