summaryrefslogtreecommitdiffstats
path: root/src/yuzu/main.h
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2023-10-30 20:32:39 +0100
committerGitHub <noreply@github.com>2023-10-30 20:32:39 +0100
commit5e69769356c7667fc5c66b60207c6c5b79e53ed3 (patch)
tree14313f84874976c3c6c4371db2df4cc66d5d7935 /src/yuzu/main.h
parentMerge pull request #11728 from liushuyu/update-deps (diff)
parentImplemented wheel event for volume control in VolumeButton (diff)
downloadyuzu-5e69769356c7667fc5c66b60207c6c5b79e53ed3.tar
yuzu-5e69769356c7667fc5c66b60207c6c5b79e53ed3.tar.gz
yuzu-5e69769356c7667fc5c66b60207c6c5b79e53ed3.tar.bz2
yuzu-5e69769356c7667fc5c66b60207c6c5b79e53ed3.tar.lz
yuzu-5e69769356c7667fc5c66b60207c6c5b79e53ed3.tar.xz
yuzu-5e69769356c7667fc5c66b60207c6c5b79e53ed3.tar.zst
yuzu-5e69769356c7667fc5c66b60207c6c5b79e53ed3.zip
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;