Don't set plugin name in constructor.
This commit is contained in:
parent
8fc1907d6d
commit
051e2d1818
|
@ -54,8 +54,7 @@ SnorePlugin *PluginContainer::load()
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
SnorePlugin *plugin = qobject_cast<SnorePlugin *> (m_loader.instance());
|
SnorePlugin *plugin = qobject_cast<SnorePlugin *> (m_loader.instance());
|
||||||
Q_ASSERT_X(m_pluginName == plugin->name(), Q_FUNC_INFO, "The plugin name is different to the one in the meta data.");
|
plugin->m_container = this;
|
||||||
plugin->m_type = type();
|
|
||||||
return plugin;
|
return plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,28 +29,27 @@
|
||||||
|
|
||||||
using namespace Snore;
|
using namespace Snore;
|
||||||
|
|
||||||
SnorePlugin::SnorePlugin(const QString &name) :
|
SnorePlugin::SnorePlugin()
|
||||||
m_name(name)
|
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(thread() == qApp->thread(), Q_FUNC_INFO, "Plugin initialized in wrong thread");
|
Q_ASSERT_X(thread() == qApp->thread(), Q_FUNC_INFO, "Plugin initialized in wrong thread");
|
||||||
if (thread() != qApp->thread()) {
|
if (thread() != qApp->thread()) {
|
||||||
snoreDebug(SNORE_WARNING) << "Plugin initialized in wrong thread.";
|
snoreDebug(SNORE_WARNING) << "Plugin initialized in wrong thread.";
|
||||||
}
|
}
|
||||||
setDefaultValue("Enabled", false, LOCAL_SETTING);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SnorePlugin::~SnorePlugin()
|
SnorePlugin::~SnorePlugin()
|
||||||
{
|
{
|
||||||
snoreDebug(SNORE_DEBUG) << m_name << this << "deleted";
|
snoreDebug(SNORE_DEBUG) << name() << this << "deleted";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SnorePlugin::initialize()
|
bool SnorePlugin::initialize()
|
||||||
{
|
{
|
||||||
|
setDefaultValue("Enabled", false, LOCAL_SETTING);
|
||||||
if (m_initialized) {
|
if (m_initialized) {
|
||||||
qFatal("Something went wrong, plugin %s is already initialized", this->name().toLatin1().constData());
|
qFatal("Something went wrong, plugin %s is already initialized", this->name().toLatin1().constData());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
snoreDebug(SNORE_DEBUG) << "Initialize" << m_name << this;
|
snoreDebug(SNORE_DEBUG) << "Initialize" << name() << this;
|
||||||
m_initialized = true;
|
m_initialized = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -86,22 +85,24 @@ Snore::PluginSettingsWidget *SnorePlugin::settingsWidget()
|
||||||
|
|
||||||
QString SnorePlugin::normaliseKey(const QString &key) const
|
QString SnorePlugin::normaliseKey(const QString &key) const
|
||||||
{
|
{
|
||||||
return QString("%1/%2.%3").arg(m_name, key, settingsVersion());
|
return QString("%1/%2.%3").arg(name(), key, settingsVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString &SnorePlugin::name() const
|
const QString &SnorePlugin::name() const
|
||||||
{
|
{
|
||||||
return m_name;
|
Q_ASSERT_X(m_container, Q_FUNC_INFO, "Plugin container not set.");
|
||||||
|
return m_container->name();
|
||||||
}
|
}
|
||||||
|
|
||||||
SnorePlugin::PluginTypes SnorePlugin::type() const
|
SnorePlugin::PluginTypes SnorePlugin::type() const
|
||||||
{
|
{
|
||||||
return m_type;
|
Q_ASSERT_X(m_container, Q_FUNC_INFO, "Plugin container not set.");
|
||||||
|
return m_container->type();
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString SnorePlugin::typeName() const
|
const QString SnorePlugin::typeName() const
|
||||||
{
|
{
|
||||||
return SnorePlugin::typeToString(m_type);
|
return SnorePlugin::typeToString(type());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SnorePlugin::settingsVersion() const
|
QString SnorePlugin::settingsVersion() const
|
||||||
|
@ -112,7 +113,7 @@ QString SnorePlugin::settingsVersion() const
|
||||||
bool SnorePlugin::deinitialize()
|
bool SnorePlugin::deinitialize()
|
||||||
{
|
{
|
||||||
if (m_initialized) {
|
if (m_initialized) {
|
||||||
snoreDebug(SNORE_DEBUG) << "Deinitialize" << m_name << this;
|
snoreDebug(SNORE_DEBUG) << "Deinitialize" << name() << this;
|
||||||
m_initialized = false;
|
m_initialized = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
namespace Snore
|
namespace Snore
|
||||||
{
|
{
|
||||||
|
|
||||||
|
class PluginContainer;
|
||||||
|
|
||||||
class SNORE_EXPORT SnorePlugin : public QObject
|
class SNORE_EXPORT SnorePlugin : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -48,7 +50,7 @@ public:
|
||||||
static QString typeToString(const PluginTypes t);
|
static QString typeToString(const PluginTypes t);
|
||||||
static QList<PluginTypes> types();
|
static QList<PluginTypes> types();
|
||||||
|
|
||||||
SnorePlugin(const QString &name);
|
SnorePlugin();
|
||||||
virtual ~SnorePlugin();
|
virtual ~SnorePlugin();
|
||||||
virtual bool initialize();
|
virtual bool initialize();
|
||||||
virtual bool deinitialize();
|
virtual bool deinitialize();
|
||||||
|
@ -68,12 +70,10 @@ protected:
|
||||||
virtual QString settingsVersion() const;
|
virtual QString settingsVersion() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SnorePlugin() = delete;
|
|
||||||
QString normaliseKey(const QString &key) const;
|
QString normaliseKey(const QString &key) const;
|
||||||
|
|
||||||
QString m_name;
|
|
||||||
bool m_initialized = false;
|
bool m_initialized = false;
|
||||||
PluginTypes m_type = NONE;
|
PluginContainer *m_container = nullptr;
|
||||||
|
|
||||||
friend class PluginContainer;
|
friend class PluginContainer;
|
||||||
|
|
||||||
|
|
|
@ -29,12 +29,6 @@
|
||||||
|
|
||||||
using namespace Snore;
|
using namespace Snore;
|
||||||
|
|
||||||
SnoreBackend::SnoreBackend(const QString &name) :
|
|
||||||
SnorePlugin(name)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
SnoreBackend::~SnoreBackend()
|
SnoreBackend::~SnoreBackend()
|
||||||
{
|
{
|
||||||
snoreDebug(SNORE_DEBUG) << "Deleting" << name();
|
snoreDebug(SNORE_DEBUG) << "Deleting" << name();
|
||||||
|
@ -102,12 +96,6 @@ void SnoreBackend::slotCloseNotification(Notification notification)
|
||||||
Q_UNUSED(notification)
|
Q_UNUSED(notification)
|
||||||
}
|
}
|
||||||
|
|
||||||
SnoreSecondaryBackend::SnoreSecondaryBackend(const QString &name):
|
|
||||||
SnorePlugin(name)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
SnoreSecondaryBackend::~SnoreSecondaryBackend()
|
SnoreSecondaryBackend::~SnoreSecondaryBackend()
|
||||||
{
|
{
|
||||||
snoreDebug(SNORE_DEBUG) << "Deleting" << name();
|
snoreDebug(SNORE_DEBUG) << "Deleting" << name();
|
||||||
|
|
|
@ -31,7 +31,7 @@ class SNORE_EXPORT SnoreBackend : public SnorePlugin
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_INTERFACES(Snore::SnorePlugin)
|
Q_INTERFACES(Snore::SnorePlugin)
|
||||||
public:
|
public:
|
||||||
SnoreBackend(const QString &name);
|
SnoreBackend() = default;
|
||||||
virtual ~SnoreBackend();
|
virtual ~SnoreBackend();
|
||||||
virtual bool initialize() override;
|
virtual bool initialize() override;
|
||||||
virtual bool deinitialize() override;
|
virtual bool deinitialize() override;
|
||||||
|
@ -73,7 +73,7 @@ class SNORE_EXPORT SnoreSecondaryBackend : public SnorePlugin
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_INTERFACES(Snore::SnorePlugin Snore::SnorePlugin)
|
Q_INTERFACES(Snore::SnorePlugin Snore::SnorePlugin)
|
||||||
public:
|
public:
|
||||||
SnoreSecondaryBackend(const QString &name);
|
SnoreSecondaryBackend() = default;
|
||||||
virtual ~SnoreSecondaryBackend();
|
virtual ~SnoreSecondaryBackend();
|
||||||
virtual bool initialize();
|
virtual bool initialize();
|
||||||
virtual bool deinitialize();
|
virtual bool deinitialize();
|
||||||
|
|
|
@ -21,12 +21,6 @@
|
||||||
|
|
||||||
using namespace Snore;
|
using namespace Snore;
|
||||||
|
|
||||||
SnoreFrontend::SnoreFrontend(const QString &name) :
|
|
||||||
SnorePlugin(name)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
SnoreFrontend::~SnoreFrontend()
|
SnoreFrontend::~SnoreFrontend()
|
||||||
{
|
{
|
||||||
snoreDebug(SNORE_DEBUG) << "Deleting" << name();
|
snoreDebug(SNORE_DEBUG) << "Deleting" << name();
|
||||||
|
|
|
@ -31,7 +31,7 @@ class SNORE_EXPORT SnoreFrontend: public SnorePlugin
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_INTERFACES(Snore::SnorePlugin)
|
Q_INTERFACES(Snore::SnorePlugin)
|
||||||
public:
|
public:
|
||||||
SnoreFrontend(const QString &name);
|
SnoreFrontend() = default;
|
||||||
virtual ~SnoreFrontend();
|
virtual ~SnoreFrontend();
|
||||||
|
|
||||||
virtual bool initialize() override;
|
virtual bool initialize() override;
|
||||||
|
|
|
@ -29,19 +29,12 @@ using namespace Snore;
|
||||||
|
|
||||||
GrowlBackend *GrowlBackend::s_instance = nullptr;
|
GrowlBackend *GrowlBackend::s_instance = nullptr;
|
||||||
|
|
||||||
GrowlBackend::GrowlBackend():
|
|
||||||
SnoreBackend("Growl")
|
|
||||||
{
|
|
||||||
setDefaultValue("Host", "localhost");
|
|
||||||
setDefaultValue("Password", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
GrowlBackend::~GrowlBackend()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GrowlBackend::initialize()
|
bool GrowlBackend::initialize()
|
||||||
{
|
{
|
||||||
|
setDefaultValue("Host", "localhost");
|
||||||
|
setDefaultValue("Password", "");
|
||||||
|
|
||||||
s_instance = this;
|
s_instance = this;
|
||||||
auto func = [](growl_callback_data * data)->void {
|
auto func = [](growl_callback_data * data)->void {
|
||||||
snoreDebug(SNORE_DEBUG) << data->id << QString(data->reason) << QString(data->data);
|
snoreDebug(SNORE_DEBUG) << data->id << QString(data->reason) << QString(data->data);
|
||||||
|
|
|
@ -30,8 +30,8 @@ class GrowlBackend: public Snore::SnoreBackend
|
||||||
Q_PLUGIN_METADATA(IID "org.Snore.NotificationBackend/1.0" FILE "plugin.json")
|
Q_PLUGIN_METADATA(IID "org.Snore.NotificationBackend/1.0" FILE "plugin.json")
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GrowlBackend();
|
GrowlBackend() = default;
|
||||||
~GrowlBackend();
|
~GrowlBackend() = default;
|
||||||
bool initialize() override;
|
bool initialize() override;
|
||||||
bool deinitialize() override;
|
bool deinitialize() override;
|
||||||
Snore::PluginSettingsWidget *settingsWidget() override;
|
Snore::PluginSettingsWidget *settingsWidget() override;
|
||||||
|
|
|
@ -111,19 +111,10 @@ private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
SnarlBackend::SnarlBackend():
|
|
||||||
SnoreBackend("Snarl")
|
|
||||||
{
|
|
||||||
setDefaultValue("Password", QString());
|
|
||||||
}
|
|
||||||
|
|
||||||
SnarlBackend::~SnarlBackend()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SnarlBackend::initialize()
|
bool SnarlBackend::initialize()
|
||||||
{
|
{
|
||||||
|
setDefaultValue("Password", QString());
|
||||||
|
|
||||||
SnarlInterface *snarlInterface = new SnarlInterface();
|
SnarlInterface *snarlInterface = new SnarlInterface();
|
||||||
if (!snarlInterface->IsSnarlRunning()) {
|
if (!snarlInterface->IsSnarlRunning()) {
|
||||||
snoreDebug(SNORE_WARNING) << "Snarl is not running";
|
snoreDebug(SNORE_WARNING) << "Snarl is not running";
|
||||||
|
|
|
@ -27,8 +27,8 @@ class SnarlBackend: public Snore::SnoreBackend
|
||||||
Q_INTERFACES(Snore::SnoreBackend)
|
Q_INTERFACES(Snore::SnoreBackend)
|
||||||
Q_PLUGIN_METADATA(IID "org.Snore.NotificationBackend/1.0" FILE "plugin.json")
|
Q_PLUGIN_METADATA(IID "org.Snore.NotificationBackend/1.0" FILE "plugin.json")
|
||||||
public:
|
public:
|
||||||
SnarlBackend();
|
SnarlBackend() = default;
|
||||||
~SnarlBackend();
|
~SnarlBackend() = default;
|
||||||
bool initialize() override;
|
bool initialize() override;
|
||||||
bool deinitialize() override;
|
bool deinitialize() override;
|
||||||
Snore::PluginSettingsWidget *settingsWidget() override;
|
Snore::PluginSettingsWidget *settingsWidget() override;
|
||||||
|
|
|
@ -27,18 +27,16 @@
|
||||||
using namespace Snore;
|
using namespace Snore;
|
||||||
|
|
||||||
SnoreNotifier::SnoreNotifier():
|
SnoreNotifier::SnoreNotifier():
|
||||||
SnoreBackend("Snore"),
|
|
||||||
m_widgets(3),
|
m_widgets(3),
|
||||||
m_timer(new QTimer(this))
|
m_timer(new QTimer(this))
|
||||||
{
|
{
|
||||||
setDefaultValue("Position", Qt::TopRightCorner);
|
|
||||||
m_timer->setInterval(500);
|
m_timer->setInterval(500);
|
||||||
connect(m_timer, &QTimer::timeout, [this]() {
|
connect(m_timer, &QTimer::timeout, [this]() {
|
||||||
if (m_queue.isEmpty()) {
|
if (m_queue.isEmpty()) {
|
||||||
snoreDebug(SNORE_DEBUG) << "queue is empty";
|
snoreDebug(SNORE_DEBUG) << "queue is empty";
|
||||||
m_timer->stop();
|
m_timer->stop();
|
||||||
} else {
|
} else {
|
||||||
foreach(NotifyWidget * w, m_widgets) {
|
for(NotifyWidget * w : m_widgets) {
|
||||||
if (w->acquire()) {
|
if (w->acquire()) {
|
||||||
Notification notification = m_queue.takeFirst();
|
Notification notification = m_queue.takeFirst();
|
||||||
w->display(notification);
|
w->display(notification);
|
||||||
|
@ -88,7 +86,7 @@ void SnoreNotifier::slotNotify(Snore::Notification notification)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (m_queue.isEmpty()) {
|
if (m_queue.isEmpty()) {
|
||||||
foreach(NotifyWidget * w, m_widgets) {
|
for(NotifyWidget * w : m_widgets) {
|
||||||
if (w->acquire()) {
|
if (w->acquire()) {
|
||||||
display(w, notification);
|
display(w, notification);
|
||||||
return;
|
return;
|
||||||
|
@ -109,6 +107,8 @@ void SnoreNotifier::slotCloseNotification(Snore::Notification notification)
|
||||||
|
|
||||||
bool SnoreNotifier::initialize()
|
bool SnoreNotifier::initialize()
|
||||||
{
|
{
|
||||||
|
setDefaultValue("Position", Qt::TopRightCorner);
|
||||||
|
|
||||||
if (SnoreBackend::initialize()) {
|
if (SnoreBackend::initialize()) {
|
||||||
for (int i = 0; i < m_widgets.size(); ++i) {
|
for (int i = 0; i < m_widgets.size(); ++i) {
|
||||||
NotifyWidget *w = new NotifyWidget(i, this);
|
NotifyWidget *w = new NotifyWidget(i, this);
|
||||||
|
|
|
@ -35,8 +35,8 @@ public:
|
||||||
bool initialize() override;
|
bool initialize() override;
|
||||||
bool deinitialize() override;
|
bool deinitialize() override;
|
||||||
|
|
||||||
virtual bool canCloseNotification() const override;
|
bool canCloseNotification() const override;
|
||||||
virtual bool canUpdateNotification() const override;
|
bool canUpdateNotification() const override;
|
||||||
|
|
||||||
Snore::PluginSettingsWidget *settingsWidget() override;
|
Snore::PluginSettingsWidget *settingsWidget() override;
|
||||||
|
|
||||||
|
|
|
@ -14,16 +14,6 @@
|
||||||
|
|
||||||
using namespace Snore;
|
using namespace Snore;
|
||||||
|
|
||||||
SnoreToast::SnoreToast():
|
|
||||||
SnoreBackend("Windows 8")
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
SnoreToast::~SnoreToast()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SnoreToast::initialize()
|
bool SnoreToast::initialize()
|
||||||
{
|
{
|
||||||
if (QSysInfo::windowsVersion() < QSysInfo::WV_WINDOWS8) {
|
if (QSysInfo::windowsVersion() < QSysInfo::WV_WINDOWS8) {
|
||||||
|
|
|
@ -10,8 +10,8 @@ class SnoreToast : public Snore::SnoreBackend
|
||||||
Q_INTERFACES(Snore::SnoreBackend)
|
Q_INTERFACES(Snore::SnoreBackend)
|
||||||
Q_PLUGIN_METADATA(IID "org.Snore.NotificationBackend/1.0" FILE "plugin.json")
|
Q_PLUGIN_METADATA(IID "org.Snore.NotificationBackend/1.0" FILE "plugin.json")
|
||||||
public:
|
public:
|
||||||
SnoreToast();
|
SnoreToast() = default;
|
||||||
~SnoreToast();
|
~SnoreToast() = default;
|
||||||
virtual bool initialize() override;
|
virtual bool initialize() override;
|
||||||
|
|
||||||
virtual bool canCloseNotification() const override;
|
virtual bool canCloseNotification() const override;
|
||||||
|
|
|
@ -6,17 +6,6 @@
|
||||||
#include <QSystemTrayIcon>
|
#include <QSystemTrayIcon>
|
||||||
using namespace Snore;
|
using namespace Snore;
|
||||||
|
|
||||||
TrayIconNotifer::TrayIconNotifer() :
|
|
||||||
SnoreBackend("System Tray Icon"),
|
|
||||||
m_currentlyDisplaying(false)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
TrayIconNotifer::~TrayIconNotifer()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TrayIconNotifer::deinitialize()
|
bool TrayIconNotifer::deinitialize()
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,8 +15,8 @@ class TrayIconNotifer: public Snore::SnoreBackend
|
||||||
Q_INTERFACES(Snore::SnoreBackend)
|
Q_INTERFACES(Snore::SnoreBackend)
|
||||||
Q_PLUGIN_METADATA(IID "org.Snore.NotificationBackend/1.0" FILE "plugin.json")
|
Q_PLUGIN_METADATA(IID "org.Snore.NotificationBackend/1.0" FILE "plugin.json")
|
||||||
public:
|
public:
|
||||||
TrayIconNotifer();
|
TrayIconNotifer() = default;
|
||||||
virtual ~TrayIconNotifer() override;
|
~TrayIconNotifer() = default;
|
||||||
virtual bool deinitialize() override;
|
virtual bool deinitialize() override;
|
||||||
|
|
||||||
virtual bool canCloseNotification() const override;
|
virtual bool canCloseNotification() const override;
|
||||||
|
@ -31,7 +31,7 @@ private:
|
||||||
QSystemTrayIcon *trayIcon(const Snore::Application &app);
|
QSystemTrayIcon *trayIcon(const Snore::Application &app);
|
||||||
QList<Snore::Notification > m_notificationQue;
|
QList<Snore::Notification > m_notificationQue;
|
||||||
Snore::Notification m_displayed;
|
Snore::Notification m_displayed;
|
||||||
bool m_currentlyDisplaying;
|
bool m_currentlyDisplaying = false;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void displayNotification(QSystemTrayIcon *icon);
|
void displayNotification(QSystemTrayIcon *icon);
|
||||||
|
|
|
@ -29,16 +29,6 @@
|
||||||
|
|
||||||
using namespace Snore;
|
using namespace Snore;
|
||||||
|
|
||||||
FreedesktopFrontend::FreedesktopFrontend():
|
|
||||||
SnoreFrontend("Freedesktop")
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
FreedesktopFrontend::~FreedesktopFrontend()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool FreedesktopFrontend::initialize()
|
bool FreedesktopFrontend::initialize()
|
||||||
{
|
{
|
||||||
m_adaptor = new NotificationsAdaptor(this);
|
m_adaptor = new NotificationsAdaptor(this);
|
||||||
|
|
|
@ -29,10 +29,10 @@ class FreedesktopFrontend : public Snore::SnoreFrontend
|
||||||
Q_INTERFACES(Snore::SnoreFrontend)
|
Q_INTERFACES(Snore::SnoreFrontend)
|
||||||
Q_PLUGIN_METADATA(IID "org.Snore.NotificationFrontend/1.0" FILE "plugin.json")
|
Q_PLUGIN_METADATA(IID "org.Snore.NotificationFrontend/1.0" FILE "plugin.json")
|
||||||
public:
|
public:
|
||||||
FreedesktopFrontend();
|
FreedesktopFrontend() = default;
|
||||||
~FreedesktopFrontend();
|
~FreedesktopFrontend() = default;
|
||||||
virtual bool initialize() override;
|
bool initialize() override;
|
||||||
virtual bool deinitialize() override;
|
bool deinitialize() override;
|
||||||
|
|
||||||
uint Notify(const QString &app_name, uint replaces_id, const QString &app_icon, const QString &summary, const QString &body, const QStringList &actions, const QVariantMap &hints, int timeout);
|
uint Notify(const QString &app_name, uint replaces_id, const QString &app_icon, const QString &summary, const QString &body, const QStringList &actions, const QVariantMap &hints, int timeout);
|
||||||
void CloseNotification(uint id);
|
void CloseNotification(uint id);
|
||||||
|
|
|
@ -26,16 +26,6 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
using namespace Snore;
|
using namespace Snore;
|
||||||
|
|
||||||
SnarlNetworkFrontend::SnarlNetworkFrontend():
|
|
||||||
SnoreFrontend("SnarlNetwork")
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
SnarlNetworkFrontend::~SnarlNetworkFrontend()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SnarlNetworkFrontend::initialize()
|
bool SnarlNetworkFrontend::initialize()
|
||||||
{
|
{
|
||||||
parser = new Parser(this);
|
parser = new Parser(this);
|
||||||
|
|
|
@ -35,8 +35,8 @@ public:
|
||||||
static const int port = 9887;
|
static const int port = 9887;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SnarlNetworkFrontend();
|
SnarlNetworkFrontend() = default;
|
||||||
~SnarlNetworkFrontend();
|
~SnarlNetworkFrontend() = default;
|
||||||
virtual bool initialize() override;
|
virtual bool initialize() override;
|
||||||
virtual bool deinitialize() override;
|
virtual bool deinitialize() override;
|
||||||
|
|
||||||
|
|
|
@ -26,17 +26,6 @@
|
||||||
|
|
||||||
using namespace Snore;
|
using namespace Snore;
|
||||||
|
|
||||||
NotifyMyAndroid::NotifyMyAndroid():
|
|
||||||
SnoreSecondaryBackend("NotifyMyAndroid")
|
|
||||||
{
|
|
||||||
setDefaultValue("ApiKey", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
NotifyMyAndroid::~NotifyMyAndroid()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void NotifyMyAndroid::slotNotify(Notification notification)
|
void NotifyMyAndroid::slotNotify(Notification notification)
|
||||||
{
|
{
|
||||||
QString key = value("ApiKey").toString();
|
QString key = value("ApiKey").toString();
|
||||||
|
@ -67,6 +56,12 @@ void NotifyMyAndroid::slotNotify(Notification notification)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool NotifyMyAndroid::initialize()
|
||||||
|
{
|
||||||
|
setDefaultValue("ApiKey", "");
|
||||||
|
return SnoreSecondaryBackend::initialize();
|
||||||
|
}
|
||||||
|
|
||||||
PluginSettingsWidget *NotifyMyAndroid::settingsWidget()
|
PluginSettingsWidget *NotifyMyAndroid::settingsWidget()
|
||||||
{
|
{
|
||||||
return new NotifyMyAndroidSettings(this);
|
return new NotifyMyAndroidSettings(this);
|
||||||
|
|
|
@ -28,8 +28,10 @@ class NotifyMyAndroid : public Snore::SnoreSecondaryBackend
|
||||||
Q_INTERFACES(Snore::SnoreSecondaryBackend)
|
Q_INTERFACES(Snore::SnoreSecondaryBackend)
|
||||||
Q_PLUGIN_METADATA(IID "org.Snore.SecondaryNotificationBackend/1.0" FILE "plugin.json")
|
Q_PLUGIN_METADATA(IID "org.Snore.SecondaryNotificationBackend/1.0" FILE "plugin.json")
|
||||||
public:
|
public:
|
||||||
NotifyMyAndroid();
|
NotifyMyAndroid() = default;
|
||||||
~NotifyMyAndroid();
|
~NotifyMyAndroid() = default;
|
||||||
|
|
||||||
|
virtual bool initialize() override;
|
||||||
|
|
||||||
Snore::PluginSettingsWidget *settingsWidget() override;
|
Snore::PluginSettingsWidget *settingsWidget() override;
|
||||||
|
|
||||||
|
|
|
@ -27,19 +27,6 @@
|
||||||
|
|
||||||
using namespace Snore;
|
using namespace Snore;
|
||||||
|
|
||||||
Pushover::Pushover():
|
|
||||||
SnoreSecondaryBackend("Pushover")
|
|
||||||
{
|
|
||||||
setDefaultValue("UserKey", "");
|
|
||||||
setDefaultValue("Sound", "pushover", LOCAL_SETTING);
|
|
||||||
setDefaultValue("Devices", "", LOCAL_SETTING);
|
|
||||||
}
|
|
||||||
|
|
||||||
Pushover::~Pushover()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Pushover::slotNotify(Notification notification)
|
void Pushover::slotNotify(Notification notification)
|
||||||
{
|
{
|
||||||
QString key = value("ApiKey").toString();
|
QString key = value("ApiKey").toString();
|
||||||
|
@ -109,6 +96,14 @@ void Pushover::slotNotify(Notification notification)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Pushover::initialize()
|
||||||
|
{
|
||||||
|
setDefaultValue("UserKey", "");
|
||||||
|
setDefaultValue("Sound", "pushover", LOCAL_SETTING);
|
||||||
|
setDefaultValue("Devices", "", LOCAL_SETTING);
|
||||||
|
return SnoreSecondaryBackend::initialize();
|
||||||
|
}
|
||||||
|
|
||||||
PluginSettingsWidget *Pushover::settingsWidget()
|
PluginSettingsWidget *Pushover::settingsWidget()
|
||||||
{
|
{
|
||||||
return new PushoverSettings(this);
|
return new PushoverSettings(this);
|
||||||
|
|
|
@ -28,8 +28,10 @@ class Pushover : public Snore::SnoreSecondaryBackend
|
||||||
Q_INTERFACES(Snore::SnoreSecondaryBackend)
|
Q_INTERFACES(Snore::SnoreSecondaryBackend)
|
||||||
Q_PLUGIN_METADATA(IID "org.Snore.SecondaryNotificationBackend/1.0" FILE "plugin.json")
|
Q_PLUGIN_METADATA(IID "org.Snore.SecondaryNotificationBackend/1.0" FILE "plugin.json")
|
||||||
public:
|
public:
|
||||||
Pushover();
|
Pushover() = default;
|
||||||
~Pushover();
|
~Pushover() = default;
|
||||||
|
|
||||||
|
bool initialize() override;
|
||||||
|
|
||||||
Snore::PluginSettingsWidget *settingsWidget() override;
|
Snore::PluginSettingsWidget *settingsWidget() override;
|
||||||
|
|
||||||
|
|
|
@ -24,11 +24,8 @@
|
||||||
using namespace Snore;
|
using namespace Snore;
|
||||||
|
|
||||||
Sound::Sound():
|
Sound::Sound():
|
||||||
SnoreSecondaryBackend("Sound"),
|
|
||||||
m_player(new QMediaPlayer(this))
|
m_player(new QMediaPlayer(this))
|
||||||
{
|
{
|
||||||
setDefaultValue("Volume", 50);
|
|
||||||
m_player->setVolume(value("Volume").toInt());
|
|
||||||
// connect(m_player,QMediaPlayer::positionChanged,[](qint64 pos){
|
// connect(m_player,QMediaPlayer::positionChanged,[](qint64 pos){
|
||||||
// snoreDebug(SNORE_DEBUG) << "Player: " << pos;
|
// snoreDebug(SNORE_DEBUG) << "Player: " << pos;
|
||||||
// });
|
// });
|
||||||
|
@ -37,9 +34,12 @@ Sound::Sound():
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Sound::~Sound()
|
bool Sound::initialize()
|
||||||
{
|
{
|
||||||
|
setDefaultValue("Volume", 50);
|
||||||
|
m_player->setVolume(value("Volume").toInt());
|
||||||
|
|
||||||
|
return SnoreSecondaryBackend::initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginSettingsWidget *Sound::settingsWidget()
|
PluginSettingsWidget *Sound::settingsWidget()
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
|
|
||||||
#include "libsnore/plugins/snorebackend.h"
|
#include "libsnore/plugins/snorebackend.h"
|
||||||
|
|
||||||
|
class QMediaPlayer;
|
||||||
|
|
||||||
class Sound : public Snore::SnoreSecondaryBackend
|
class Sound : public Snore::SnoreSecondaryBackend
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -27,14 +29,16 @@ class Sound : public Snore::SnoreSecondaryBackend
|
||||||
Q_PLUGIN_METADATA(IID "org.Snore.SecondaryNotificationBackend/1.0" FILE "plugin.json")
|
Q_PLUGIN_METADATA(IID "org.Snore.SecondaryNotificationBackend/1.0" FILE "plugin.json")
|
||||||
public:
|
public:
|
||||||
Sound();
|
Sound();
|
||||||
~Sound();
|
~Sound() = default;
|
||||||
|
|
||||||
|
virtual bool initialize() override;
|
||||||
|
|
||||||
Snore::PluginSettingsWidget *settingsWidget() override;
|
Snore::PluginSettingsWidget *settingsWidget() override;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void slotNotificationDisplayed(Snore::Notification notification) override;
|
void slotNotificationDisplayed(Snore::Notification notification) override;
|
||||||
private:
|
private:
|
||||||
class QMediaPlayer *m_player;
|
QMediaPlayer *m_player;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SOUND_H
|
#endif // SOUND_H
|
||||||
|
|
|
@ -27,17 +27,6 @@
|
||||||
|
|
||||||
using namespace Snore;
|
using namespace Snore;
|
||||||
|
|
||||||
Toasty::Toasty():
|
|
||||||
SnoreSecondaryBackend("Toasty")
|
|
||||||
{
|
|
||||||
setDefaultValue("DeviceID", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
Toasty::~Toasty()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Toasty::slotNotify(Notification notification)
|
void Toasty::slotNotify(Notification notification)
|
||||||
{
|
{
|
||||||
QString key = value("DeviceID").toString();
|
QString key = value("DeviceID").toString();
|
||||||
|
@ -89,6 +78,12 @@ void Toasty::slotNotify(Notification notification)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Toasty::initialize()
|
||||||
|
{
|
||||||
|
setDefaultValue("DeviceID", "");
|
||||||
|
return SnoreSecondaryBackend::initialize();
|
||||||
|
}
|
||||||
|
|
||||||
PluginSettingsWidget *Toasty::settingsWidget()
|
PluginSettingsWidget *Toasty::settingsWidget()
|
||||||
{
|
{
|
||||||
return new ToastySettings(this);
|
return new ToastySettings(this);
|
||||||
|
|
|
@ -28,8 +28,10 @@ class Toasty : public Snore::SnoreSecondaryBackend
|
||||||
Q_INTERFACES(Snore::SnoreSecondaryBackend)
|
Q_INTERFACES(Snore::SnoreSecondaryBackend)
|
||||||
Q_PLUGIN_METADATA(IID "org.Snore.SecondaryNotificationBackend/1.0" FILE "plugin.json")
|
Q_PLUGIN_METADATA(IID "org.Snore.SecondaryNotificationBackend/1.0" FILE "plugin.json")
|
||||||
public:
|
public:
|
||||||
Toasty();
|
Toasty() = default;
|
||||||
~Toasty();
|
~Toasty() = default;
|
||||||
|
|
||||||
|
bool initialize() override;
|
||||||
|
|
||||||
Snore::PluginSettingsWidget *settingsWidget() override;
|
Snore::PluginSettingsWidget *settingsWidget() override;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue