File indexing completed on 2024-04-21 04:47:50

0001 /****************************************************************************************
0002  * Copyright (c) 2009-2011 Kevin Funk <krf@electrostorm.net>                            *
0003  *                                                                                      *
0004  * This program is free software; you can redistribute it and/or modify it under        *
0005  * the terms of the GNU General Public License as published by the Free Software        *
0006  * Foundation; either version 2 of the License, or (at your option) any later           *
0007  * version.                                                                             *
0008  *                                                                                      *
0009  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0011  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0012  *                                                                                      *
0013  * You should have received a copy of the GNU General Public License along with         *
0014  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0015  ****************************************************************************************/
0016 
0017 #ifndef AMAROK_KNOTIFICATIONBACKEND_H
0018 #define AMAROK_KNOTIFICATIONBACKEND_H
0019 
0020 #include "core/meta/forward_declarations.h"
0021 
0022 #include <QObject>
0023 #include <QPixmap>
0024 #include <QPointer>
0025 
0026 class KNotification;
0027 
0028 namespace Amarok {
0029 
0030 /**
0031  * Class for accessing KNotify in KDE
0032  **/
0033 class KNotificationBackend : public QObject
0034 {
0035     Q_OBJECT
0036 
0037 public:
0038     static KNotificationBackend *instance();
0039     static void destroy();
0040 
0041     void setEnabled( bool enabled );
0042     bool isEnabled() const;
0043 
0044     /**
0045      * Checks if a fullscreen window is currently active.
0046      */
0047     bool isFullscreenWindowActive() const;
0048 
0049 public Q_SLOTS:
0050 
0051     /**
0052      * Shows a message. Warning, this method doesn't check isEnabled(), you
0053      * should do it yourself.
0054      */
0055     void show( const QString &title, const QString &body, const QPixmap &pixmap = QPixmap() );
0056 
0057     /**
0058      * @param force - if true, isEnabled() is not checked, otherwise it is
0059      */
0060     void showCurrentTrack( bool force = false );
0061 
0062 private:
0063     KNotificationBackend();
0064     ~KNotificationBackend() override;
0065 
0066     static KNotificationBackend *s_instance;
0067 
0068     bool m_enabled;
0069     QPointer<KNotification> m_notify;
0070 };
0071 
0072 }
0073 
0074 #endif