Sayonara Player
ShortcutHandler.h
1/* ShortcutHandler.h */
2
3/* Copyright (C) 2011-2020 Michael Lugmair (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/Pimpl.h"
28
29#include <QShortcut>
30#include <QObject>
31
32class Shortcut;
33
34#define ShortcutPrivate private
35
41 public QObject
42{
43 Q_OBJECT
44 SINGLETON(ShortcutHandler)
45 PIMPL(ShortcutHandler)
46
47 friend class Shortcut;
48
49ShortcutPrivate:
50 void qtShortcutsAdded(ShortcutIdentifier databaseKey, const QList<QShortcut*>& qtShortcuts);
51
52signals:
53 void sigShortcutChanged(ShortcutIdentifier databaseKey);
54
55public:
61 Shortcut shortcut(ShortcutIdentifier databaseKey) const;
62
68 void setShortcut(ShortcutIdentifier databaseKey, const QStringList& shortcut);
69
75
76 QString databaseKey(ShortcutIdentifier id) const;
77 QString shortcut_text(ShortcutIdentifier id) const;
78
79private slots:
80 void qtShortcutDestroyed();
81};
82
83#endif // SHORTCUTHANDLER_H
A singleton class for retrieving shortcuts.
Definition: ShortcutHandler.h:42
void setShortcut(ShortcutIdentifier databaseKey, const QStringList &shortcut)
set the shortcut by its unique identifier
QList< ShortcutIdentifier > allIdentifiers() const
get all shortcuts
Shortcut shortcut(ShortcutIdentifier databaseKey) const
get a shortcut by its unique identifier
A single shortcut managed by ShortcutHandler. This class holds information about the default shortcut...
Definition: Shortcut.h:42