mirror of
https://github.com/status-im/snorenotify.git
synced 2025-01-24 23:41:10 +00:00
move SnoreSecondaryBackend to its own header
This commit is contained in:
parent
cdc651b6e6
commit
92b2c38d07
@ -3,6 +3,7 @@ set(SnoreNotify_SRCS ${SnoreNotify_SRCS}
|
|||||||
plugins/plugins.cpp
|
plugins/plugins.cpp
|
||||||
plugins/snorefrontend.cpp
|
plugins/snorefrontend.cpp
|
||||||
plugins/snorebackend.cpp
|
plugins/snorebackend.cpp
|
||||||
|
plugins/snoresecondarybackend.cpp
|
||||||
plugins/pluginsettingswidget.cpp
|
plugins/pluginsettingswidget.cpp
|
||||||
PARENT_SCOPE)
|
PARENT_SCOPE)
|
||||||
|
|
||||||
@ -10,6 +11,7 @@ set(SnoreNotify_HDR
|
|||||||
plugins.h
|
plugins.h
|
||||||
snorefrontend.h
|
snorefrontend.h
|
||||||
snorebackend.h
|
snorebackend.h
|
||||||
|
snoresecondarybackend.h
|
||||||
pluginsettingswidget.h)
|
pluginsettingswidget.h)
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ using namespace Snore;
|
|||||||
|
|
||||||
SnoreBackend::SnoreBackend()
|
SnoreBackend::SnoreBackend()
|
||||||
{
|
{
|
||||||
connect(this, &SnoreSecondaryBackend::enabledChanged, [this](bool enabled) {
|
connect(this, &SnoreBackend::enabledChanged, [this](bool enabled) {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
connect(SnoreCorePrivate::instance(), &SnoreCorePrivate::applicationRegistered, this, &SnoreBackend::slotRegisterApplication, Qt::QueuedConnection);
|
connect(SnoreCorePrivate::instance(), &SnoreCorePrivate::applicationRegistered, this, &SnoreBackend::slotRegisterApplication, Qt::QueuedConnection);
|
||||||
connect(SnoreCorePrivate::instance(), &SnoreCorePrivate::applicationDeregistered, this, &SnoreBackend::slotDeregisterApplication, Qt::QueuedConnection);
|
connect(SnoreCorePrivate::instance(), &SnoreCorePrivate::applicationDeregistered, this, &SnoreBackend::slotDeregisterApplication, Qt::QueuedConnection);
|
||||||
@ -89,34 +89,6 @@ void SnoreBackend::slotCloseNotification(Notification notification)
|
|||||||
Q_UNUSED(notification)
|
Q_UNUSED(notification)
|
||||||
}
|
}
|
||||||
|
|
||||||
SnoreSecondaryBackend::SnoreSecondaryBackend()
|
|
||||||
{
|
|
||||||
connect(this, &SnoreSecondaryBackend::enabledChanged, [this](bool enabled) {
|
|
||||||
if (enabled) {
|
|
||||||
connect(SnoreCorePrivate::instance(), &SnoreCorePrivate::notify, this, &SnoreSecondaryBackend::slotNotify, Qt::QueuedConnection);
|
|
||||||
connect(SnoreCorePrivate::instance(), &SnoreCorePrivate::notificationDisplayed, this, &SnoreSecondaryBackend::slotNotificationDisplayed, Qt::QueuedConnection);
|
|
||||||
} else {
|
|
||||||
disconnect(SnoreCorePrivate::instance(), &SnoreCorePrivate::notify, this, &SnoreSecondaryBackend::slotNotify);
|
|
||||||
disconnect(SnoreCorePrivate::instance(), &SnoreCorePrivate::notificationDisplayed, this, &SnoreSecondaryBackend::slotNotificationDisplayed);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
SnoreSecondaryBackend::~SnoreSecondaryBackend()
|
|
||||||
{
|
|
||||||
snoreDebug(SNORE_DEBUG) << "Deleting" << name();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SnoreSecondaryBackend::slotNotify(Notification)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void SnoreSecondaryBackend::slotNotificationDisplayed(Notification)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SnoreBackend::canCloseNotification() const
|
bool SnoreBackend::canCloseNotification() const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -61,27 +61,4 @@ protected:
|
|||||||
Q_DECLARE_INTERFACE(Snore::SnoreBackend,
|
Q_DECLARE_INTERFACE(Snore::SnoreBackend,
|
||||||
"org.Snore.NotificationBackend/1.0")
|
"org.Snore.NotificationBackend/1.0")
|
||||||
|
|
||||||
namespace Snore
|
|
||||||
{
|
|
||||||
class SnoreCore;
|
|
||||||
|
|
||||||
class SNORE_EXPORT SnoreSecondaryBackend : public SnorePlugin
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
Q_INTERFACES(Snore::SnorePlugin Snore::SnorePlugin)
|
|
||||||
public:
|
|
||||||
SnoreSecondaryBackend();
|
|
||||||
virtual ~SnoreSecondaryBackend();
|
|
||||||
|
|
||||||
public Q_SLOTS:
|
|
||||||
virtual void slotNotify(Snore::Notification notification);
|
|
||||||
virtual void slotNotificationDisplayed(Snore::Notification notification);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Q_DECLARE_INTERFACE(Snore::SnoreSecondaryBackend,
|
|
||||||
"org.Snore.SecondaryNotificationBackend/1.0")
|
|
||||||
|
|
||||||
#endif//SNORE_BACKEND_H
|
#endif//SNORE_BACKEND_H
|
||||||
|
51
src/libsnore/plugins/snoresecondarybackend.cpp
Normal file
51
src/libsnore/plugins/snoresecondarybackend.cpp
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
SnoreNotify is a Notification Framework based on Qt
|
||||||
|
Copyright (C) 2015 Patrick von Reth <vonreth@kde.org>
|
||||||
|
|
||||||
|
SnoreNotify is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
SnoreNotify is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with SnoreNotify. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "snoresecondarybackend.h"
|
||||||
|
|
||||||
|
#include "../snore_p.h"
|
||||||
|
|
||||||
|
using namespace Snore;
|
||||||
|
|
||||||
|
SnoreSecondaryBackend::SnoreSecondaryBackend()
|
||||||
|
{
|
||||||
|
connect(this, &SnoreSecondaryBackend::enabledChanged, [this](bool enabled) {
|
||||||
|
if (enabled) {
|
||||||
|
connect(SnoreCorePrivate::instance(), &SnoreCorePrivate::notify, this, &SnoreSecondaryBackend::slotNotify, Qt::QueuedConnection);
|
||||||
|
connect(SnoreCorePrivate::instance(), &SnoreCorePrivate::notificationDisplayed, this, &SnoreSecondaryBackend::slotNotificationDisplayed, Qt::QueuedConnection);
|
||||||
|
} else {
|
||||||
|
disconnect(SnoreCorePrivate::instance(), &SnoreCorePrivate::notify, this, &SnoreSecondaryBackend::slotNotify);
|
||||||
|
disconnect(SnoreCorePrivate::instance(), &SnoreCorePrivate::notificationDisplayed, this, &SnoreSecondaryBackend::slotNotificationDisplayed);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
SnoreSecondaryBackend::~SnoreSecondaryBackend()
|
||||||
|
{
|
||||||
|
snoreDebug(SNORE_DEBUG) << "Deleting" << name();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SnoreSecondaryBackend::slotNotify(Notification)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void SnoreSecondaryBackend::slotNotificationDisplayed(Notification)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
48
src/libsnore/plugins/snoresecondarybackend.h
Normal file
48
src/libsnore/plugins/snoresecondarybackend.h
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
SnoreNotify is a Notification Framework based on Qt
|
||||||
|
Copyright (C) 2015 Patrick von Reth <vonreth@kde.org>
|
||||||
|
|
||||||
|
SnoreNotify is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
SnoreNotify is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with SnoreNotify. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SNORESECONDARYBACKEND_H
|
||||||
|
#define SNORESECONDARYBACKEND_H
|
||||||
|
|
||||||
|
#include "libsnore/snore_exports.h"
|
||||||
|
#include "libsnore/plugins/plugins.h"
|
||||||
|
|
||||||
|
namespace Snore
|
||||||
|
{
|
||||||
|
class SnoreCore;
|
||||||
|
|
||||||
|
class SNORE_EXPORT SnoreSecondaryBackend : public SnorePlugin
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_INTERFACES(Snore::SnorePlugin Snore::SnorePlugin)
|
||||||
|
public:
|
||||||
|
SnoreSecondaryBackend();
|
||||||
|
virtual ~SnoreSecondaryBackend();
|
||||||
|
|
||||||
|
public Q_SLOTS:
|
||||||
|
virtual void slotNotify(Snore::Notification notification);
|
||||||
|
virtual void slotNotificationDisplayed(Snore::Notification notification);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_DECLARE_INTERFACE(Snore::SnoreSecondaryBackend,
|
||||||
|
"org.Snore.SecondaryNotificationBackend/1.0")
|
||||||
|
|
||||||
|
#endif // SNORESECONDARYBACKEND_H
|
@ -19,7 +19,7 @@ FreedesktopBackend::FreedesktopBackend()
|
|||||||
reply.waitForFinished();
|
reply.waitForFinished();
|
||||||
QStringList caps = reply.value();
|
QStringList caps = reply.value();
|
||||||
m_supportsRichtext = caps.contains(QLatin1String("body-markup"));
|
m_supportsRichtext = caps.contains(QLatin1String("body-markup"));
|
||||||
connect(this, &SnoreSecondaryBackend::enabledChanged, [this](bool enabled) {
|
connect(this, &FreedesktopBackend::enabledChanged, [this](bool enabled) {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
connect(m_interface, &org::freedesktop::Notifications::ActionInvoked, this, &FreedesktopBackend::slotActionInvoked);
|
connect(m_interface, &org::freedesktop::Notifications::ActionInvoked, this, &FreedesktopBackend::slotActionInvoked);
|
||||||
connect(m_interface, &org::freedesktop::Notifications::NotificationClosed, this , &FreedesktopBackend::slotNotificationClosed);
|
connect(m_interface, &org::freedesktop::Notifications::NotificationClosed, this , &FreedesktopBackend::slotNotificationClosed);
|
||||||
|
@ -18,7 +18,8 @@
|
|||||||
#include "nma.h"
|
#include "nma.h"
|
||||||
#include "nmasettings.h"
|
#include "nmasettings.h"
|
||||||
|
|
||||||
#include"libsnore/utils.h"
|
#include "libsnore/log.h"
|
||||||
|
#include "libsnore/utils.h"
|
||||||
|
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QNetworkRequest>
|
#include <QNetworkRequest>
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#ifndef NMA_H
|
#ifndef NMA_H
|
||||||
#define NMA_H
|
#define NMA_H
|
||||||
|
|
||||||
#include "libsnore/plugins/snorebackend.h"
|
#include "libsnore/plugins/snoresecondarybackend.h"
|
||||||
|
|
||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include "pushover.h"
|
#include "pushover.h"
|
||||||
#include "pushoversettings.h"
|
#include "pushoversettings.h"
|
||||||
|
|
||||||
|
#include "libsnore/log.h"
|
||||||
#include "libsnore/utils.h"
|
#include "libsnore/utils.h"
|
||||||
#include "libsnore/notification/notification_p.h"
|
#include "libsnore/notification/notification_p.h"
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#ifndef PUSHOVER_H
|
#ifndef PUSHOVER_H
|
||||||
#define PUSHOVER_H
|
#define PUSHOVER_H
|
||||||
|
|
||||||
#include "libsnore/plugins/snorebackend.h"
|
#include "libsnore/plugins/snoresecondarybackend.h"
|
||||||
|
|
||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
|
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include "soundsettings.h"
|
#include "soundsettings.h"
|
||||||
|
|
||||||
|
#include "libsnore/log.h"
|
||||||
|
|
||||||
#include <QtMultimedia/QMediaPlayer>
|
#include <QtMultimedia/QMediaPlayer>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#ifndef SOUND_H
|
#ifndef SOUND_H
|
||||||
#define SOUND_H
|
#define SOUND_H
|
||||||
|
|
||||||
#include "libsnore/plugins/snorebackend.h"
|
#include "libsnore/plugins/snoresecondarybackend.h"
|
||||||
|
|
||||||
class QMediaPlayer;
|
class QMediaPlayer;
|
||||||
|
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
#include "toasty.h"
|
#include "toasty.h"
|
||||||
#include "toastysettings.h"
|
#include "toastysettings.h"
|
||||||
|
|
||||||
|
#include "libsnore/log.h"
|
||||||
#include "libsnore/utils.h"
|
#include "libsnore/utils.h"
|
||||||
|
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#ifndef TOASTY_H
|
#ifndef TOASTY_H
|
||||||
#define TOASTY_H
|
#define TOASTY_H
|
||||||
|
|
||||||
#include "libsnore/plugins/snorebackend.h"
|
#include "libsnore/plugins/snoresecondarybackend.h"
|
||||||
|
|
||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user