| 1 |
/**************************************************************************************** |
| 2 |
* Copyright (c) 2003 Stanislav Karchebny <berkus@users.sf.net> * |
| 3 |
* Copyright (c) 2009 Mark Kretschmann <kretschmann@kde.org> * |
| 4 |
* Copyright (c) 2009,2010 Kevin Funk <krf@electrostorm.net> * |
| 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_TRAYICON_H |
| 20 |
#define AMAROK_TRAYICON_H |
| 21 |
|
| 22 |
#include "core/engine/EngineObserver.h" // baseclass |
| 23 |
#include "core/meta/Meta.h" |
| 24 |
#include "core/support/SmartPointerList.h" |
| 25 |
|
| 26 |
#include <KStatusNotifierItem> // baseclass |
| 27 |
|
| 28 |
#include <QAction> |
| 29 |
#include <QPointer> |
| 30 |
|
| 31 |
|
| 32 |
namespace Amarok { |
| 33 |
|
| 34 |
class TrayIcon : public KStatusNotifierItem, public Engine::EngineObserver, public Meta::Observer |
| 35 |
{ |
| 36 |
Q_OBJECT |
| 37 |
|
| 38 |
public: |
| 39 |
TrayIcon( QObject *parent ); |
| 40 |
|
| 41 |
void setVisible( bool visible ); |
| 42 |
|
| 43 |
protected: |
| 44 |
// reimplemented from engineobserver |
| 45 |
virtual void engineStateChanged( Phonon::State state, Phonon::State oldState = Phonon::StoppedState ); |
| 46 |
virtual void engineNewTrackPlaying(); |
| 47 |
virtual void engineVolumeChanged( int percent ); |
| 48 |
virtual void engineMuteStateChanged( bool mute ); |
| 49 |
|
| 50 |
// reimplemented from Meta::Observer |
| 51 |
using Observer::metadataChanged; |
| 52 |
virtual void metadataChanged( Meta::TrackPtr track ); |
| 53 |
virtual void metadataChanged( Meta::AlbumPtr album ); |
| 54 |
|
| 55 |
private slots: |
| 56 |
void slotActivated(); |
| 57 |
void slotScrollRequested( int delta, Qt::Orientation orientation ); |
| 58 |
|
| 59 |
private: |
| 60 |
void setupMenu(); |
| 61 |
void setupToolTip( bool updateIcon ); |
| 62 |
|
| 63 |
Meta::TrackPtr m_track; |
| 64 |
|
| 65 |
SmartPointerList<QAction> m_extraActions; |
| 66 |
QPointer<QAction> m_separator; |
| 67 |
}; |
| 68 |
|
| 69 |
} |
| 70 |
|
| 71 |
#endif // AMAROK_TRAYICON_H |