2010-03-24 00:11:46 +01:00
|
|
|
/* This file is part of Clementine.
|
2010-11-20 14:27:10 +01:00
|
|
|
Copyright 2010, David Sansome <me@davidsansome.com>
|
2010-03-24 00:11:46 +01: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/>.
|
|
|
|
*/
|
|
|
|
|
2010-03-21 20:02:56 +01:00
|
|
|
#ifndef GLOBALSHORTCUTS_H
|
|
|
|
#define GLOBALSHORTCUTS_H
|
|
|
|
|
|
|
|
#include <QObject>
|
2010-05-17 13:06:50 +02:00
|
|
|
#include <QKeySequence>
|
|
|
|
#include <QMap>
|
|
|
|
#include <QSettings>
|
|
|
|
|
|
|
|
class QAction;
|
|
|
|
|
|
|
|
class GlobalShortcutBackend;
|
2010-12-17 01:21:20 +01:00
|
|
|
class QSignalMapper;
|
2010-03-21 20:02:56 +01:00
|
|
|
|
|
|
|
class GlobalShortcuts : public QObject {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
GlobalShortcuts(QObject* parent = 0);
|
|
|
|
|
2010-05-17 13:06:50 +02:00
|
|
|
static const char* kSettingsGroup;
|
2010-03-21 20:02:56 +01:00
|
|
|
|
2010-05-17 13:06:50 +02:00
|
|
|
struct Shortcut {
|
|
|
|
QString id;
|
|
|
|
QKeySequence default_key;
|
|
|
|
QAction* action;
|
|
|
|
};
|
2010-04-13 15:55:54 +02:00
|
|
|
|
2010-05-17 13:06:50 +02:00
|
|
|
QMap<QString, Shortcut> shortcuts() const { return shortcuts_; }
|
2010-05-17 02:31:39 +02:00
|
|
|
bool IsGsdAvailable() const;
|
2010-06-18 00:15:07 +02:00
|
|
|
bool IsMacAccessibilityEnabled() const;
|
2010-05-17 02:31:39 +02:00
|
|
|
|
2010-05-17 13:06:50 +02:00
|
|
|
public slots:
|
|
|
|
void ReloadSettings();
|
2010-06-18 00:15:07 +02:00
|
|
|
void ShowMacAccessibilityDialog();
|
2010-05-17 13:06:50 +02:00
|
|
|
|
2010-07-10 21:17:21 +02:00
|
|
|
void Unregister();
|
|
|
|
void Register();
|
|
|
|
|
2010-03-21 20:02:56 +01:00
|
|
|
signals:
|
2010-05-17 13:06:50 +02:00
|
|
|
void Play();
|
|
|
|
void Pause();
|
2010-03-21 20:02:56 +01:00
|
|
|
void PlayPause();
|
|
|
|
void Stop();
|
2010-05-17 13:06:50 +02:00
|
|
|
void StopAfter();
|
2010-03-21 20:02:56 +01:00
|
|
|
void Next();
|
|
|
|
void Previous();
|
2010-05-17 13:06:50 +02:00
|
|
|
void IncVolume();
|
|
|
|
void DecVolume();
|
|
|
|
void Mute();
|
|
|
|
void SeekForward();
|
|
|
|
void SeekBackward();
|
2010-07-24 14:39:09 +02:00
|
|
|
void ShowHide();
|
|
|
|
void ShowOSD();
|
2011-06-05 10:21:17 +02:00
|
|
|
void TogglePrettyOSD();
|
2010-12-17 01:21:20 +01:00
|
|
|
void RateCurrentSong(int);
|
2011-03-17 09:21:05 +01:00
|
|
|
void CycleShuffleMode();
|
|
|
|
void CycleRepeatMode();
|
2011-04-07 18:25:52 +02:00
|
|
|
void ToggleScrobbling();
|
2010-05-17 13:06:50 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
void AddShortcut(const QString& id, const QString& name, const char* signal,
|
|
|
|
const QKeySequence& default_key = QKeySequence(0));
|
2010-12-17 01:21:20 +01:00
|
|
|
void AddRatingShortcut(const QString& id, const QString& name, QSignalMapper* mapper,
|
|
|
|
int rating, const QKeySequence& default_key = QKeySequence(0));
|
|
|
|
Shortcut AddShortcut(const QString& id, const QString& name, const QKeySequence& default_key);
|
2010-03-21 20:02:56 +01:00
|
|
|
|
|
|
|
private:
|
2010-05-17 13:06:50 +02:00
|
|
|
GlobalShortcutBackend* gnome_backend_;
|
|
|
|
GlobalShortcutBackend* system_backend_;
|
2010-03-21 20:02:56 +01:00
|
|
|
|
2010-05-17 13:06:50 +02:00
|
|
|
QMap<QString, Shortcut> shortcuts_;
|
|
|
|
QSettings settings_;
|
2010-07-10 21:17:21 +02:00
|
|
|
|
|
|
|
bool use_gnome_;
|
2010-12-17 01:21:20 +01:00
|
|
|
QSignalMapper* rating_signals_mapper_;
|
2010-03-21 20:02:56 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|