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 <QShortcut>
31 #include <QObject>
32 
33 class Shortcut;
34 class ShortcutWidget;
35 
36 #define ShortcutPrivate private
37 
43  public QObject,
44  public SayonaraClass
45 {
46  Q_OBJECT
47  SINGLETON(ShortcutHandler)
48  PIMPL(ShortcutHandler)
49 
50 
51 friend class Shortcut;
52 ShortcutPrivate:
53  void qt_shortcuts_added(ShortcutIdentifier identifier, const QList<QShortcut*>& shortcuts);
54 
55 signals:
56  void sig_shortcut_changed(ShortcutIdentifier identifier);
57 
58 public:
64  Shortcut shortcut(ShortcutIdentifier identifier) const;
65 
71  void set_shortcut(ShortcutIdentifier identifier, const QStringList& shortcut);
72 
78 
79  QString identifier(ShortcutIdentifier id) const;
80  QString shortcut_text(ShortcutIdentifier id) const;
81 };
82 
83 #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:42
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:41
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
Definition: org_mpris_media_player2_adaptor.h:20