summaryrefslogtreecommitdiff
path: root/src/yuzu/main.h
diff options
context:
space:
mode:
authorFrozenAra <macjordan02@googlemail.com>2023-10-29 02:46:25 +0200
committerFrozenAra <macjordan02@googlemail.com>2023-10-29 20:29:17 +0100
commit0bb1c7c804a5dd8825acfe80f05b639c5752baf6 (patch)
tree2625bc15c111207c23f6c9350768b2c8676f607c /src/yuzu/main.h
parent43be2bfe332d5537041262eb08037993239eaf5f (diff)
Implemented wheel event for volume control in VolumeButton
Diffstat (limited to 'src/yuzu/main.h')
-rw-r--r--src/yuzu/main.h25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/yuzu/main.h b/src/yuzu/main.h
index 270a40c5f..f9c6efe4f 100644
--- a/src/yuzu/main.h
+++ b/src/yuzu/main.h
@@ -8,6 +8,7 @@
#include <QMainWindow>
#include <QMessageBox>
+#include <QPushButton>
#include <QTimer>
#include <QTranslator>
@@ -137,6 +138,28 @@ namespace VkDeviceInfo {
class Record;
}
+class VolumeButton : public QPushButton {
+ Q_OBJECT
+public:
+ explicit VolumeButton(QWidget* parent = nullptr) : QPushButton(parent), scroll_multiplier(1) {
+ connect(&scroll_timer, &QTimer::timeout, this, &VolumeButton::ResetMultiplier);
+ }
+
+signals:
+ void VolumeChanged();
+
+protected:
+ void wheelEvent(QWheelEvent* event) override;
+
+private slots:
+ void ResetMultiplier();
+
+private:
+ int scroll_multiplier;
+ QTimer scroll_timer;
+ constexpr static int MaxMultiplier = 8;
+};
+
class GMainWindow : public QMainWindow {
Q_OBJECT
@@ -481,7 +504,7 @@ private:
QPushButton* dock_status_button = nullptr;
QPushButton* filter_status_button = nullptr;
QPushButton* aa_status_button = nullptr;
- QPushButton* volume_button = nullptr;
+ VolumeButton* volume_button = nullptr;
QWidget* volume_popup = nullptr;
QSlider* volume_slider = nullptr;
QTimer status_bar_update_timer;