openbsd-ports/audio/last.fm/patches/patch-src_systray_cpp
dcoppa ed80a78265 Update to last.fm 1.5.4.27091
Still happy with gcc 3.3.5

Tested on sparc64 and i386
2011-03-30 14:00:48 +00:00

52 lines
1.7 KiB
Plaintext

$OpenBSD: patch-src_systray_cpp,v 1.2 2011/03/30 14:00:48 dcoppa Exp $
--- src/systray.cpp.orig Wed Mar 30 13:41:47 2011
+++ src/systray.cpp Wed Mar 30 13:42:35 2011
@@ -25,6 +25,7 @@
#include "container.h"
#include "LastFmSettings.h"
#include "MooseCommon.h"
+#include <QWheelEvent>
TrayIcon::TrayIcon( QObject* parent )
@@ -55,6 +56,8 @@ TrayIcon::setUser( LastFmUserSettings& currentUser )
{
#ifdef Q_WS_MAC
icon = m_pixmap;
+ #elif defined(Q_WS_X11)
+ icon = IconShack::instance().GetTrayIcon( iconColour );
#else
icon = IconShack::instance().GetGoodUserIcon( iconColour );
#endif
@@ -63,6 +66,8 @@ TrayIcon::setUser( LastFmUserSettings& currentUser )
{
#ifdef Q_WS_MAC
icon = QIcon( m_pixmap ).pixmap( 19, 12, QIcon::Disabled );
+ #elif defined Q_WS_X11
+ icon = IconShack::instance().GetDisabledTrayIcon( iconColour );
#else
icon = IconShack::instance().GetDisabledUserIcon( iconColour );
#endif
@@ -152,4 +157,21 @@ void
TrayIcon::stopIpodScrobblingAnimation()
{
m_animationTimer.stop();
+}
+
+
+bool
+TrayIcon::event( QEvent* e )
+{
+ // Beginning with Qt 4.3, QSystemTrayIcon supports wheel events.
+ // Let's make it adjust the volume.
+ if ( e->type() == QEvent::Wheel )
+ {
+ int numDegrees = ((QWheelEvent*)e)->delta() / 8;
+ int numSteps = numDegrees / 15;
+ int volume = Container::instance().ui.playcontrols.volume->value() + ( 5 * numSteps );
+ Container::instance().ui.playcontrols.volume->setValue( volume );
+ return true;
+ }
+ return QSystemTrayIcon::event( e );
}