| 1 |
/**************************************************************************************** |
| 2 |
* Copyright (c) 2009 Kevin Funk <krf@electrostorm.net> * |
| 3 |
* * |
| 4 |
* This program is free software; you can redistribute it and/or modify it under * |
| 5 |
* the terms of the GNU General Public License as published by the Free Software * |
| 6 |
* Foundation; either version 2 of the License, or (at your option) any later * |
| 7 |
* version. * |
| 8 |
* * |
| 9 |
* This program is distributed in the hope that it will be useful, but WITHOUT ANY * |
| 10 |
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * |
| 11 |
* PARTICULAR PURPOSE. See the GNU General Public License for more details. * |
| 12 |
* * |
| 13 |
* You should have received a copy of the GNU General Public License along with * |
| 14 |
* this program. If not, see <http://www.gnu.org/licenses/>. * |
| 15 |
****************************************************************************************/ |
| 16 |
|
| 17 |
#ifndef AMAROK_KNOTIFICATIONBACKEND_H |
| 18 |
#define AMAROK_KNOTIFICATIONBACKEND_H |
| 19 |
|
| 20 |
#include "core/engine/EngineObserver.h" |
| 21 |
|
| 22 |
#include <KNotification> |
| 23 |
|
| 24 |
namespace Amarok { |
| 25 |
|
| 26 |
/** |
| 27 |
* Class for accessing KNotify in KDE |
| 28 |
**/ |
| 29 |
class KNotificationBackend : public QObject, public Engine::EngineObserver |
| 30 |
{ |
| 31 |
Q_OBJECT |
| 32 |
|
| 33 |
public: |
| 34 |
static KNotificationBackend* instance(); |
| 35 |
static void destroy(); |
| 36 |
|
| 37 |
void setEnabled(bool enabled); |
| 38 |
bool isEnabled() const; |
| 39 |
|
| 40 |
public Q_SLOTS: |
| 41 |
void showCurrentTrack(); |
| 42 |
|
| 43 |
protected: |
| 44 |
// Reimplemented from engineobserver |
| 45 |
virtual void engineStateChanged( Phonon::State state, Phonon::State oldState = Phonon::StoppedState ); |
| 46 |
virtual void engineNewTrackPlaying(); |
| 47 |
|
| 48 |
private slots: |
| 49 |
void notificationClosed(); |
| 50 |
|
| 51 |
private: |
| 52 |
KNotificationBackend(); |
| 53 |
~KNotificationBackend(); |
| 54 |
|
| 55 |
static KNotificationBackend *s_instance; |
| 56 |
|
| 57 |
KNotification* m_notify; |
| 58 |
|
| 59 |
bool m_enabled; |
| 60 |
|
| 61 |
QTimer *m_timer; |
| 62 |
}; |
| 63 |
|
| 64 |
} |
| 65 |
|
| 66 |
#endif |