1 /* 2 * Strawberry Music Player 3 * This file was part of Clementine. 4 * Copyright 2010, David Sansome <me@davidsansome.com> 5 * Copyright 2018-2021, Jonas Kvinge <jonas@jkvinge.net> 6 * 7 * Strawberry 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 * Strawberry 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 Strawberry. If not, see <http://www.gnu.org/licenses/>. 19 * 20 */ 21 22 #ifndef GLOBALSHORTCUTSSETTINGSPAGE_H 23 #define GLOBALSHORTCUTSSETTINGSPAGE_H 24 25 #include "config.h" 26 27 #include <memory> 28 29 #include <QObject> 30 #include <QSettings> 31 #include <QMap> 32 #include <QString> 33 #include <QKeySequence> 34 35 #include "globalshortcuts/globalshortcutsmanager.h" 36 #include "settingspage.h" 37 38 class QTreeWidgetItem; 39 class GlobalShortcutGrabber; 40 class SettingsDialog; 41 class Ui_GlobalShortcutsSettingsPage; 42 43 class GlobalShortcutsSettingsPage : public SettingsPage { 44 Q_OBJECT 45 46 public: 47 explicit GlobalShortcutsSettingsPage(SettingsDialog *dialog, QWidget *parent = nullptr); 48 ~GlobalShortcutsSettingsPage() override; 49 50 static const char *kSettingsGroup; 51 52 void Load() override; 53 void Save() override; 54 55 private slots: 56 void ShortcutOptionsChanged(); 57 void OpenGnomeKeybindingProperties(); 58 void OpenMateKeybindingProperties(); 59 60 void ItemClicked(QTreeWidgetItem*); 61 void NoneClicked(); 62 void DefaultClicked(); 63 void ChangeClicked(); 64 65 private: 66 struct Shortcut { 67 GlobalShortcutsManager::Shortcut s; 68 QKeySequence key; 69 QTreeWidgetItem *item; 70 }; 71 72 void SetShortcut(const QString &id, const QKeySequence &key); 73 74 void X11Warning(); 75 76 private: 77 Ui_GlobalShortcutsSettingsPage *ui_; 78 79 bool initialized_; 80 std::unique_ptr<GlobalShortcutGrabber> grabber_; 81 82 QMap<QString, Shortcut> shortcuts_; 83 84 QString current_id_; 85 QString de_; 86 87 }; 88 89 #endif // GLOBALSHORTCUTSSETTINGSPAGE_H 90