From 49601423cf1ae8158dd2ad746f69a12df1590c14 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Fri, 11 Jan 2019 20:21:45 +0100 Subject: [PATCH] Fix scroll over icon to change track feature --- src/core/qtsystemtrayicon.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/core/qtsystemtrayicon.cpp b/src/core/qtsystemtrayicon.cpp index 17e117678..aef44b543 100644 --- a/src/core/qtsystemtrayicon.cpp +++ b/src/core/qtsystemtrayicon.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include "song.h" #include "iconloader.h" @@ -37,6 +38,8 @@ #include "systemtrayicon.h" #include "qtsystemtrayicon.h" +#include "settings/behavioursettingspage.h" + QtSystemTrayIcon::QtSystemTrayIcon(QObject *parent) : SystemTrayIcon(parent), tray_(new QSystemTrayIcon(this)), @@ -92,7 +95,21 @@ bool QtSystemTrayIcon::eventFilter(QObject *object, QEvent *event) { } } else { - emit ChangeVolume(e->delta()); + QSettings s; + s.beginGroup(BehaviourSettingsPage::kSettingsGroup); + bool prev_next_track = s.value("scrolltrayicon").toBool(); + s.endGroup(); + if (prev_next_track) { + if (e->delta() < 0) { + emit NextTrack(); + } + else { + emit PreviousTrack(); + } + } + else { + emit ChangeVolume(e->delta()); + } } return true; }