Sophie

Sophie

distrib > * > 2008.0 > x86_64 > by-pkgid > 749d95b410bf3bb4e88011a8139ff957 > files > 5

lastfm-player-1.3.1.0-3mdv2008.0.src.rpm

--- last.fm-1.3.0.62.orig/src/container.h
+++ last.fm-1.3.0.62/src/container.h
@@ -38,6 +38,7 @@
     Q_OBJECT
 
         friend class SysTray; // needed in SysTray ctor
+        friend class SysTrayIcon;
         friend int main( int, char** ); // singleton is instantiated here
 
         static Container *s_instance;
--- last.fm-1.3.0.62.orig/src/src.pro
+++ last.fm-1.3.0.62/src/src.pro
@@ -89,6 +89,7 @@
           logindialog.h \
           iconshack.h \
           systray.h \
+          systrayicon.h \
           progressframe.h \
           trayicon/trayicon.h \
           checkdirtree.h \
@@ -154,6 +155,7 @@
           logindialog.cpp \
           iconshack.cpp \
           systray.cpp \
+          systrayicon.cpp \
           progressframe.cpp \
           trayicon/trayicon.cpp \
           checkdirtree.cpp \
--- last.fm-1.3.0.62.orig/src/systray.cpp
+++ last.fm-1.3.0.62/src/systray.cpp
@@ -28,7 +28,7 @@
 #include "containerutils.h"
 #include "trayicon/trayicon.h"
 #include "Settings.h"
-#include <QSystemTrayIcon>
+#include "systrayicon.h"
 
 
 /******************************************************************************
@@ -36,7 +36,7 @@
 ******************************************************************************/
 SysTray::SysTray( Container* parent )
       : QObject( parent ),
-        m_trayIcon( new QSystemTrayIcon( parent ) ),
+        m_trayIcon( new SysTrayIcon( parent ) ),
         m_trayMenu( new QMenu( parent ) ),
         m_tipFormat( QString("%1 ") + QChar(8211) /*en dash*/ + " %2 | %3" )
 {
--- last.fm-1.3.0.62.orig/src/systray.h
+++ last.fm-1.3.0.62/src/systray.h
@@ -27,7 +27,7 @@
 
 #include <QPixmap>
 #include <QString>
-#include <QSystemTrayIcon>
+#include "systrayicon.h"
 
 class QMenu;
 
@@ -53,7 +53,7 @@
     private:
         void refreshToolTip();
 
-        QSystemTrayIcon *m_trayIcon;
+        SysTrayIcon *m_trayIcon;
         
         #ifdef Q_WS_MAC
         QPixmap m_pixmap;
--- /dev/null
+++ last.fm-1.3.0.62/src/systrayicon.cpp
@@ -0,0 +1,41 @@
+/***************************************************************************
+ *   Copyright (C) 2007 by John Stamp, <jstamp@users.sourceforge.net>      *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU General Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ ***************************************************************************/
+
+#include "systrayicon.h"
+#include "container.h"
+
+SysTrayIcon::SysTrayIcon( QObject* parent ) : QSystemTrayIcon( parent )
+{
+}
+
+bool
+SysTrayIcon::event( QEvent* e )
+{
+    // Beginning with Qt 4.3, QSystemTrayIcon supports wheel events, but only
+    // on X11.  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 );
+}
--- /dev/null
+++ last.fm-1.3.0.62/src/systrayicon.h
@@ -0,0 +1,34 @@
+/***************************************************************************
+ *   Copyright (C) 2007 by John Stamp, <jstamp@users.sourceforge.net>      *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU General Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ ***************************************************************************/
+
+#ifndef SYSTRAY_ICON_H
+#define SYSTRAY_ICON_H
+
+#include <QSystemTrayIcon>
+
+class SysTrayIcon : public QSystemTrayIcon
+{
+    Q_OBJECT
+
+    public:
+        SysTrayIcon( QObject* parent );
+        virtual bool event( QEvent* e );
+};
+
+#endif