mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-20 16:55:40 -04:00
Qt: Initial hotkey implementation
This commit is contained in:
35
src/duckstation-qt/inputbindingwidgets.h
Normal file
35
src/duckstation-qt/inputbindingwidgets.h
Normal file
@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
#include "core/types.h"
|
||||
#include <QtWidgets/QPushButton>
|
||||
|
||||
class QTimer;
|
||||
|
||||
class QtHostInterface;
|
||||
|
||||
class InputButtonBindingWidget : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
InputButtonBindingWidget(QtHostInterface* host_interface, QString setting_name, QWidget* parent);
|
||||
~InputButtonBindingWidget();
|
||||
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent* event) override;
|
||||
void keyReleaseEvent(QKeyEvent* event) override;
|
||||
|
||||
private Q_SLOTS:
|
||||
void onPressed();
|
||||
void onInputListenTimerTimeout();
|
||||
|
||||
private:
|
||||
bool isListeningForInput() const { return m_input_listen_timer != nullptr; }
|
||||
void startListeningForInput();
|
||||
void stopListeningForInput();
|
||||
|
||||
QtHostInterface* m_host_interface;
|
||||
QString m_setting_name;
|
||||
QString m_current_binding_value;
|
||||
QTimer* m_input_listen_timer = nullptr;
|
||||
u32 m_input_listen_remaining_seconds = 0;
|
||||
};
|
Reference in New Issue
Block a user