1 /*************************************************************************** 2 * * 3 * This program is free software; you can redistribute it and/or modify * 4 * it under the terms of the GNU General Public License as published by * 5 * the Free Software Foundation; either version 3 of the License, or * 6 * (at your option) any later version. * 7 * * 8 ***************************************************************************/ 9 10 #pragma once 11 12 #include "dcpp/stdinc.h" 13 #include "dcpp/Singleton.h" 14 15 #include <QObject> 16 #include <QMap> 17 #include <QAction> 18 #include <QShortcut> 19 20 class ShortcutManager: public QObject, public dcpp::Singleton<ShortcutManager> 21 { 22 Q_OBJECT 23 24 friend class dcpp::Singleton<ShortcutManager>; 25 26 public: 27 bool registerShortcut(QAction *act, const QString &key); 28 bool updateShortcut(QAction *act, const QString &key); getShortcuts()29 QMap<QString, QKeySequence> getShortcuts() { return shortcuts; } 30 31 void save(); 32 33 private: 34 ShortcutManager(); ShortcutManager(const ShortcutManager &)35 ShortcutManager(const ShortcutManager&){} 36 virtual ~ShortcutManager(); 37 38 void load(); 39 40 QMap<QString, QKeySequence> shortcuts; 41 }; 42