| 1 |
/**************************************************************************************** |
| 2 |
* Copyright (c) 2003 Stanislav Karchebny <berkus@users.sf.net> * |
| 3 |
* Copyright (c) 2009 Kevin Funk <krf@electrostorm.net> * |
| 4 |
* Copyright (c) 2009 Mark Kretschmann <kretschmann@kde.org> * |
| 5 |
* * |
| 6 |
* This program is free software; you can redistribute it and/or modify it under * |
| 7 |
* the terms of the GNU General Public License as published by the Free Software * |
| 8 |
* Foundation; either version 2 of the License, or (at your option) any later * |
| 9 |
* version. * |
| 10 |
* * |
| 11 |
* This program is distributed in the hope that it will be useful, but WITHOUT ANY * |
| 12 |
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * |
| 13 |
* PARTICULAR PURPOSE. See the GNU General Public License for more details. * |
| 14 |
* * |
| 15 |
* You should have received a copy of the GNU General Public License along with * |
| 16 |
* this program. If not, see <http://www.gnu.org/licenses/>. * |
| 17 |
****************************************************************************************/ |
| 18 |
|
| 19 |
#ifndef AMAROK_TRAYICONLEGACY_H |
| 20 |
#define AMAROK_TRAYICONLEGACY_H |
| 21 |
|
| 22 |
#include "core/engine/EngineObserver.h" //baseclass |
| 23 |
#include "core/meta/Meta.h" |
| 24 |
#include "core/support/SmartPointerList.h" |
| 25 |
|
| 26 |
#include <KSystemTrayIcon> //baseclass |
| 27 |
|
| 28 |
#include <QPointer> |
| 29 |
|
| 30 |
class QEvent; |
| 31 |
class App; |
| 32 |
|
| 33 |
|
| 34 |
namespace Amarok { |
| 35 |
|
| 36 |
class TrayIcon : public KSystemTrayIcon, public Engine::EngineObserver, public Meta::Observer |
| 37 |
{ |
| 38 |
Q_OBJECT |
| 39 |
|
| 40 |
public: |
| 41 |
TrayIcon( QWidget *widget ); |
| 42 |
friend class ::App; |
| 43 |
|
| 44 |
void setVisible( bool visible ); |
| 45 |
|
| 46 |
protected: |
| 47 |
// reimplemented from engineobserver |
| 48 |
virtual void engineStateChanged( Phonon::State state, Phonon::State oldState = Phonon::StoppedState ); |
| 49 |
virtual void engineNewTrackPlaying(); |
| 50 |
virtual void engineTrackPositionChanged( qint64 position, bool /*userSeek*/ ); |
| 51 |
virtual void engineVolumeChanged( int percent ); |
| 52 |
virtual void engineMuteStateChanged( bool mute ); |
| 53 |
|
| 54 |
//Reimplemented from Meta::Observer |
| 55 |
using Observer::metadataChanged; |
| 56 |
virtual void metadataChanged( Meta::TrackPtr track ); |
| 57 |
|
| 58 |
// get notified of 'highlight' color change |
| 59 |
virtual void paletteChange( const QPalette & oldPalette ); |
| 60 |
|
| 61 |
private slots: |
| 62 |
void slotActivated( QSystemTrayIcon::ActivationReason reason ); |
| 63 |
|
| 64 |
private: |
| 65 |
virtual bool event( QEvent *e ); |
| 66 |
void setupMenu(); |
| 67 |
void setupToolTip(); |
| 68 |
|
| 69 |
void paintIcon( qint64 trackPosition = -1 ); |
| 70 |
void blendOverlay( const QPixmap &overlay ); |
| 71 |
|
| 72 |
Meta::TrackPtr m_track; |
| 73 |
qint64 m_trackLength; |
| 74 |
|
| 75 |
QPixmap m_baseIcon, m_grayedIcon, m_icon; |
| 76 |
QPixmap m_playOverlay, m_pauseOverlay; |
| 77 |
SmartPointerList<QAction> m_extraActions; |
| 78 |
QPointer<QAction> m_separator; |
| 79 |
}; |
| 80 |
|
| 81 |
} |
| 82 |
|
| 83 |
#endif // AMAROK_TRAYICONLEGACY_H |