mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-20 16:55:40 -04:00
Qt: Support axes in input binding widgets
This commit is contained in:
@ -6,7 +6,37 @@ class QTimer;
|
||||
|
||||
class QtHostInterface;
|
||||
|
||||
class InputButtonBindingWidget : public QPushButton
|
||||
class InputBindingWidget : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
InputBindingWidget(QtHostInterface* host_interface, QString setting_name, QWidget* parent);
|
||||
~InputBindingWidget();
|
||||
|
||||
protected:
|
||||
virtual bool eventFilter(QObject* watched, QEvent* event) override;
|
||||
|
||||
protected Q_SLOTS:
|
||||
void onPressed();
|
||||
void onInputListenTimerTimeout();
|
||||
|
||||
protected:
|
||||
virtual void startListeningForInput();
|
||||
virtual void stopListeningForInput();
|
||||
|
||||
bool isListeningForInput() const { return m_input_listen_timer != nullptr; }
|
||||
void setNewBinding();
|
||||
|
||||
QtHostInterface* m_host_interface;
|
||||
QString m_setting_name;
|
||||
QString m_current_binding_value;
|
||||
QString m_new_binding_value;
|
||||
QTimer* m_input_listen_timer = nullptr;
|
||||
u32 m_input_listen_remaining_seconds = 0;
|
||||
};
|
||||
|
||||
class InputButtonBindingWidget : public InputBindingWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -18,23 +48,30 @@ protected:
|
||||
bool eventFilter(QObject* watched, QEvent* event) override;
|
||||
|
||||
private Q_SLOTS:
|
||||
void onPressed();
|
||||
void onInputListenTimerTimeout();
|
||||
void bindToControllerAxis(int controller_index, int axis_index, bool positive);
|
||||
void bindToControllerButton(int controller_index, int button_index);
|
||||
|
||||
private:
|
||||
bool isListeningForInput() const { return m_input_listen_timer != nullptr; }
|
||||
void startListeningForInput();
|
||||
void stopListeningForInput();
|
||||
void setNewBinding();
|
||||
protected:
|
||||
void startListeningForInput() override;
|
||||
void stopListeningForInput() override;
|
||||
void hookControllerInput();
|
||||
void unhookControllerInput();
|
||||
};
|
||||
|
||||
class InputAxisBindingWidget : public InputBindingWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
InputAxisBindingWidget(QtHostInterface* host_interface, QString setting_name, QWidget* parent);
|
||||
~InputAxisBindingWidget();
|
||||
|
||||
private Q_SLOTS:
|
||||
void bindToControllerAxis(int controller_index, int axis_index);
|
||||
|
||||
protected:
|
||||
void startListeningForInput() override;
|
||||
void stopListeningForInput() override;
|
||||
void hookControllerInput();
|
||||
void unhookControllerInput();
|
||||
|
||||
QtHostInterface* m_host_interface;
|
||||
QString m_setting_name;
|
||||
QString m_current_binding_value;
|
||||
QString m_new_binding_value;
|
||||
QTimer* m_input_listen_timer = nullptr;
|
||||
u32 m_input_listen_remaining_seconds = 0;
|
||||
};
|
||||
|
Reference in New Issue
Block a user