Sayonara Player
ShortcutHandler.h
1 /* ShortcutHandler.h */
2 
3 /* Copyright (C) 2011-2017 Lucio Carreras
4  *
5  * This file is part of sayonara player
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16 
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef SHORTCUTHANDLER_H
22 #define SHORTCUTHANDLER_H
23 
24 
25 #include "ShortcutIdentifier.h"
26 #include "Utils/Singleton.h"
27 #include "Utils/Settings/SayonaraClass.h"
28 #include "Utils/Pimpl.h"
29 
30 #include <QList>
31 #include <QShortcut>
32 #include <QObject>
33 
34 class ShortcutWidget;
35 class QString;
36 class QStringList;
37 class Shortcut;
38 
39 #define ShortcutPrivate private
40 
46  public QObject,
47  public SayonaraClass
48 {
49  Q_OBJECT
50  SINGLETON(ShortcutHandler)
51  PIMPL(ShortcutHandler)
52 
53 
54 friend class Shortcut;
55 ShortcutPrivate:
56  void qt_shortcuts_added(ShortcutIdentifier identifier, const QList<QShortcut*>& shortcuts);
57 
58 signals:
59  void sig_shortcut_changed(ShortcutIdentifier identifier);
60 
61 public:
67  Shortcut shortcut(ShortcutIdentifier identifier) const;
68 
74  void set_shortcut(ShortcutIdentifier identifier, const QStringList& shortcut);
75 
81 
82  QString identifier(ShortcutIdentifier id) const;
83  QString shortcut_text(ShortcutIdentifier id) const;
84 };
85 
86 #endif // SHORTCUTHANDLER_H
The SayonaraClass class provides access to Settings and notifications.
Definition: SayonaraClass.h:29
A singleton class for retrieving shortcuts.
Definition: ShortcutHandler.h:45
QList< ShortcutIdentifier > shortcuts_ids() const
get all shortcuts
A single shortcut managed by ShortcutHandler. This class holds information about the default shortcut...
Definition: Shortcut.h:42
ShortcutIdentifier identifier() const
get the unique identifier
const QStringList & shortcuts() const
get a human-readable list of mapped shortcuts
void set_shortcut(ShortcutIdentifier identifier, const QStringList &shortcut)
set the shortcut by its unique identifier
Shortcut shortcut(ShortcutIdentifier identifier) const
get a shortcut by its unique identifier
Interface that should be implemented when using configurable shortcuts.
Definition: ShortcutWidget.h:32