2010-08-25 15:02:53 +02:00
|
|
|
/* This file is part of Clementine.
|
2010-11-20 14:27:10 +01:00
|
|
|
Copyright 2010, David Sansome <me@davidsansome.com>
|
2010-08-25 15:02:53 +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/>.
|
|
|
|
*/
|
|
|
|
|
2010-08-25 15:51:30 +02:00
|
|
|
#ifndef WIIMOTEDEV_SHORTCUTS_H
|
|
|
|
#define WIIMOTEDEV_SHORTCUTS_H
|
2010-08-25 15:02:53 +02:00
|
|
|
|
2014-02-06 14:48:00 +01:00
|
|
|
#include <memory>
|
|
|
|
|
2010-09-01 02:10:30 +02:00
|
|
|
#include <QWidget>
|
2010-08-30 19:31:42 +02:00
|
|
|
|
2010-09-01 16:46:15 +02:00
|
|
|
#include "dbus/wiimotedev.h"
|
2010-08-25 15:02:53 +02:00
|
|
|
#include "core/player.h"
|
2010-09-01 16:46:15 +02:00
|
|
|
#include "widgets/osd.h"
|
2010-08-25 15:02:53 +02:00
|
|
|
|
|
|
|
class QSettings;
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
class WiimotedevShortcuts : public QObject {
|
2010-08-25 15:02:53 +02:00
|
|
|
Q_OBJECT
|
2014-02-07 16:34:20 +01:00
|
|
|
public:
|
2010-08-25 16:58:22 +02:00
|
|
|
static const char* kActionsGroup;
|
2010-08-25 15:02:53 +02:00
|
|
|
static const char* kSettingsGroup;
|
|
|
|
|
2014-02-10 16:03:54 +01:00
|
|
|
WiimotedevShortcuts(OSD* osd, QWidget* window, QObject* parent = nullptr);
|
2010-08-25 16:58:22 +02:00
|
|
|
|
2010-08-25 15:51:30 +02:00
|
|
|
enum Action {
|
2010-09-01 17:37:09 +02:00
|
|
|
WiimotedevActiveDeactive = 0,
|
2010-08-25 15:02:53 +02:00
|
|
|
PlayerNextTrack,
|
|
|
|
PlayerPreviousTrack,
|
|
|
|
PlayerPlay,
|
|
|
|
PlayerStop,
|
|
|
|
PlayerIncVolume,
|
|
|
|
PlayerDecVolume,
|
|
|
|
PlayerMute,
|
|
|
|
PlayerPause,
|
|
|
|
PlayerTogglePause,
|
|
|
|
PlayerSeekBackward,
|
|
|
|
PlayerSeekForward,
|
|
|
|
PlayerStopAfter,
|
2010-08-26 17:37:07 +02:00
|
|
|
PlayerShowOSD,
|
2014-02-07 16:34:20 +01:00
|
|
|
ActionNone = 0xff
|
2010-08-25 15:02:53 +02:00
|
|
|
};
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
public slots:
|
2010-08-30 19:31:42 +02:00
|
|
|
void SetWiimotedevInterfaceActived(bool actived);
|
|
|
|
void ReloadSettings();
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
private slots:
|
2010-09-01 16:46:15 +02:00
|
|
|
void DbusWiimoteBatteryLife(uint id, uchar life);
|
|
|
|
void DbusWiimoteConnected(uint id);
|
|
|
|
void DbusWiimoteDisconnected(uint id);
|
2010-08-31 01:57:31 +02:00
|
|
|
void DbusWiimoteGeneralButtons(uint id, qulonglong value);
|
2010-08-30 19:31:42 +02:00
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
private:
|
2010-09-01 16:46:15 +02:00
|
|
|
OSD* osd_;
|
2010-09-01 02:10:30 +02:00
|
|
|
QWidget* main_window_;
|
2010-08-30 19:31:42 +02:00
|
|
|
Player* player_;
|
2010-08-25 15:02:53 +02:00
|
|
|
|
2010-09-01 16:46:15 +02:00
|
|
|
bool low_battery_notification_;
|
|
|
|
bool critical_battery_notification_;
|
2010-09-01 17:37:09 +02:00
|
|
|
bool actived_;
|
2010-09-01 16:46:15 +02:00
|
|
|
|
2010-08-30 19:31:42 +02:00
|
|
|
bool wiimotedev_active_;
|
|
|
|
quint64 wiimotedev_buttons_;
|
|
|
|
quint32 wiimotedev_device_;
|
|
|
|
bool wiimotedev_enable_;
|
|
|
|
bool wiimotedev_focus_;
|
2014-02-06 14:48:00 +01:00
|
|
|
std::unique_ptr<OrgWiimotedevDeviceEventsInterface> wiimotedev_iface_;
|
2010-08-30 19:31:42 +02:00
|
|
|
bool wiimotedev_notification_;
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
QHash<quint64, quint32> actions_;
|
2010-08-30 19:31:42 +02:00
|
|
|
QSettings settings_;
|
2010-09-01 16:46:15 +02:00
|
|
|
|
|
|
|
signals:
|
2010-09-01 17:37:09 +02:00
|
|
|
void WiiremoteActived(int);
|
|
|
|
void WiiremoteDeactived(int);
|
2010-09-01 16:46:15 +02:00
|
|
|
void WiiremoteConnected(int);
|
|
|
|
void WiiremoteDisconnected(int);
|
|
|
|
void WiiremoteLowBattery(int, int);
|
|
|
|
void WiiremoteCriticalBattery(int, int);
|
2010-08-25 15:02:53 +02:00
|
|
|
};
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
#endif // WIIMOTEDEV_SHORTCUTS_H
|