File indexing completed on 2024-05-12 04:45:34

0001 /*
0002     SnoreNotify is a Notification Framework based on Qt
0003     Copyright (C) 2013-2015  Hannah von Reth <vonreth@kde.org>
0004 
0005     SnoreNotify is free software: you can redistribute it and/or modify
0006     it under the terms of the GNU Lesser General Public License as published by
0007     the Free Software Foundation, either version 3 of the License, or
0008     (at your option) any later version.
0009 
0010     SnoreNotify is distributed in the hope that it will be useful,
0011     but WITHOUT ANY WARRANTY; without even the implied warranty of
0012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013     GNU Lesser General Public License for more details.
0014 
0015     You should have received a copy of the GNU Lesser General Public License
0016     along with SnoreNotify.  If not, see <http://www.gnu.org/licenses/>.
0017 */
0018 
0019 #ifndef SNORE_BACKEND_H
0020 #define SNORE_BACKEND_H
0021 #include "libsnore/snore_exports.h"
0022 #include "libsnore/plugins/plugins.h"
0023 #include "libsnore/notification/notification.h"
0024 #include "libsnore/snore.h"
0025 
0026 namespace Snore
0027 {
0028 
0029 class SNORE_EXPORT SnoreBackend : public SnorePlugin
0030 {
0031     Q_OBJECT
0032     Q_INTERFACES(Snore::SnorePlugin)
0033 public:
0034     SnoreBackend();
0035     virtual ~SnoreBackend();
0036 
0037     void requestCloseNotification(Snore::Notification notification, Notification::CloseReasons reason);
0038 
0039     virtual bool canCloseNotification() const;
0040     virtual bool canUpdateNotification() const;
0041     virtual int maxNumberOfActiveNotifications() const;
0042 
0043     PluginTypes type() const override;
0044 
0045 
0046 
0047 
0048 Q_SIGNALS:
0049     void notificationClosed(Snore::Notification);
0050 
0051 public Q_SLOTS:
0052     virtual void slotRegisterApplication(const Snore::Application &application);
0053     virtual void slotDeregisterApplication(const Snore::Application &application);
0054     virtual void slotNotify(Snore::Notification notification) = 0;
0055     virtual void slotCloseNotification(Snore::Notification notification);
0056 
0057 protected Q_SLOTS:
0058     void slotNotificationDisplayed(Notification notification);
0059     void slotNotificationActionInvoked(Notification notification, const Action &action = Action());
0060 
0061 protected:
0062     void closeNotification(Snore::Notification, Snore::Notification::CloseReasons);
0063 
0064 };
0065 
0066 }
0067 Q_DECLARE_INTERFACE(Snore::SnoreBackend,
0068                     "org.Snore.NotificationBackend/1.0")
0069 
0070 #endif//SNORE_BACKEND_H