2010-05-17 00:22:51 +02:00
|
|
|
/* This file is part of Clementine.
|
2010-11-20 14:27:10 +01:00
|
|
|
Copyright 2010, David Sansome <me@davidsansome.com>
|
2010-05-17 00:22:51 +02:00
|
|
|
|
|
|
|
Clementine is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
Clementine is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2011-08-14 01:07:10 +02:00
|
|
|
#ifndef GLOBALSHORTCUTSSETTINGSPAGE_H
|
|
|
|
#define GLOBALSHORTCUTSSETTINGSPAGE_H
|
2010-05-17 00:22:51 +02:00
|
|
|
|
2014-02-06 14:48:00 +01:00
|
|
|
#include <memory>
|
|
|
|
|
2010-05-17 00:22:51 +02:00
|
|
|
#include <QMap>
|
|
|
|
#include <QSettings>
|
|
|
|
|
2010-05-17 13:06:50 +02:00
|
|
|
#include "core/globalshortcuts.h"
|
2011-08-14 01:07:10 +02:00
|
|
|
#include "ui/settingspage.h"
|
2010-05-17 13:06:50 +02:00
|
|
|
|
2010-05-17 00:22:51 +02:00
|
|
|
class QTreeWidgetItem;
|
|
|
|
|
2011-08-14 01:07:10 +02:00
|
|
|
class Ui_GlobalShortcutsSettingsPage;
|
2010-05-17 00:22:51 +02:00
|
|
|
class GlobalShortcutGrabber;
|
|
|
|
|
2011-08-14 01:07:10 +02:00
|
|
|
class GlobalShortcutsSettingsPage : public SettingsPage {
|
2014-02-07 16:34:20 +01:00
|
|
|
Q_OBJECT
|
2010-05-17 00:22:51 +02:00
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
public:
|
2011-08-14 01:07:10 +02:00
|
|
|
GlobalShortcutsSettingsPage(SettingsDialog* dialog);
|
|
|
|
~GlobalShortcutsSettingsPage();
|
2010-05-17 00:22:51 +02:00
|
|
|
|
2011-08-14 01:07:10 +02:00
|
|
|
bool IsEnabled() const;
|
2010-05-17 00:22:51 +02:00
|
|
|
|
2010-06-23 18:27:23 +02:00
|
|
|
void Load();
|
|
|
|
void Save();
|
2010-05-17 00:22:51 +02:00
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
private slots:
|
2010-05-17 00:22:51 +02:00
|
|
|
void ItemClicked(QTreeWidgetItem*);
|
|
|
|
void NoneClicked();
|
|
|
|
void DefaultClicked();
|
|
|
|
void ChangeClicked();
|
|
|
|
|
2010-05-17 02:31:39 +02:00
|
|
|
void OpenGnomeKeybindingProperties();
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
private:
|
2010-05-17 00:22:51 +02:00
|
|
|
struct Shortcut {
|
2010-05-17 13:06:50 +02:00
|
|
|
GlobalShortcuts::Shortcut s;
|
2010-05-17 00:22:51 +02:00
|
|
|
QKeySequence key;
|
2010-05-17 13:06:50 +02:00
|
|
|
QTreeWidgetItem* item;
|
2010-05-17 00:22:51 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
void SetShortcut(const QString& id, const QKeySequence& key);
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
private:
|
2011-08-14 01:07:10 +02:00
|
|
|
Ui_GlobalShortcutsSettingsPage* ui_;
|
2010-05-17 00:22:51 +02:00
|
|
|
|
2011-08-14 01:07:10 +02:00
|
|
|
bool initialised_;
|
2014-02-06 14:48:00 +01:00
|
|
|
std::unique_ptr<GlobalShortcutGrabber> grabber_;
|
2010-05-17 00:22:51 +02:00
|
|
|
|
|
|
|
QSettings settings_;
|
|
|
|
QMap<QString, Shortcut> shortcuts_;
|
|
|
|
|
|
|
|
QString current_id_;
|
|
|
|
};
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
#endif // GLOBALSHORTCUTSSETTINGSPAGE_H
|