mirror of
https://github.com/moonlight-stream/moonlight-qt
synced 2025-01-09 09:48:43 +00:00
d1ccd19fcc
This removes the need for several hacks in SettingsView to force updates and improves performance by not reloading preferences all over the place.
41 lines
823 B
C++
41 lines
823 B
C++
#pragma once
|
|
|
|
#include <QTimer>
|
|
#include <QEvent>
|
|
|
|
#include <SDL.h>
|
|
|
|
#include "settings/streamingpreferences.h"
|
|
|
|
class SdlGamepadKeyNavigation : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
SdlGamepadKeyNavigation(StreamingPreferences* prefs);
|
|
|
|
~SdlGamepadKeyNavigation();
|
|
|
|
Q_INVOKABLE void enable();
|
|
|
|
Q_INVOKABLE void disable();
|
|
|
|
Q_INVOKABLE void setUiNavMode(bool settingsMode);
|
|
|
|
Q_INVOKABLE int getConnectedGamepads();
|
|
|
|
private:
|
|
void sendKey(QEvent::Type type, Qt::Key key, Qt::KeyboardModifiers modifiers = Qt::NoModifier);
|
|
|
|
private slots:
|
|
void onPollingTimerFired();
|
|
|
|
private:
|
|
StreamingPreferences* m_Prefs;
|
|
QTimer* m_PollingTimer;
|
|
QList<SDL_GameController*> m_Gamepads;
|
|
bool m_Enabled;
|
|
bool m_UiNavMode;
|
|
bool m_FirstPoll;
|
|
Uint32 m_LastAxisNavigationEventTime;
|
|
};
|