cleanup backend api
This commit is contained in:
parent
22b4d50ce3
commit
8fc1907d6d
|
@ -29,10 +29,8 @@
|
|||
|
||||
using namespace Snore;
|
||||
|
||||
SnoreBackend::SnoreBackend(const QString &name , bool canCloseNotification, bool canUpdateNotifications) :
|
||||
SnorePlugin(name),
|
||||
m_canCloseNotification(canCloseNotification),
|
||||
m_canUpdateNotification(canUpdateNotifications)
|
||||
SnoreBackend::SnoreBackend(const QString &name) :
|
||||
SnorePlugin(name)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -147,12 +145,12 @@ void SnoreSecondaryBackend::slotNotificationDisplayed(Notification)
|
|||
|
||||
bool SnoreBackend::canCloseNotification() const
|
||||
{
|
||||
return m_canCloseNotification;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SnoreBackend::canUpdateNotification() const
|
||||
{
|
||||
return m_canUpdateNotification;
|
||||
return false;
|
||||
}
|
||||
|
||||
void SnoreBackend::slotRegisterApplication(const Application &application)
|
||||
|
|
|
@ -31,15 +31,15 @@ class SNORE_EXPORT SnoreBackend : public SnorePlugin
|
|||
Q_OBJECT
|
||||
Q_INTERFACES(Snore::SnorePlugin)
|
||||
public:
|
||||
SnoreBackend(const QString &name, bool canCloseNotification, bool canUpdateNotifications = false);
|
||||
SnoreBackend(const QString &name);
|
||||
virtual ~SnoreBackend();
|
||||
virtual bool initialize() override;
|
||||
virtual bool deinitialize() override;
|
||||
|
||||
void requestCloseNotification(Snore::Notification notification, Notification::CloseReasons reason);
|
||||
|
||||
bool canCloseNotification() const;
|
||||
bool canUpdateNotification() const;
|
||||
virtual bool canCloseNotification() const;
|
||||
virtual bool canUpdateNotification() const;
|
||||
|
||||
signals:
|
||||
void notificationClosed(Snore::Notification);
|
||||
|
@ -57,9 +57,6 @@ protected slots:
|
|||
protected:
|
||||
void closeNotification(Snore::Notification, Snore::Notification::CloseReasons);
|
||||
|
||||
private:
|
||||
bool m_canCloseNotification;
|
||||
bool m_canUpdateNotification;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Snore;
|
|||
GrowlBackend *GrowlBackend::s_instance = nullptr;
|
||||
|
||||
GrowlBackend::GrowlBackend():
|
||||
SnoreBackend("Growl", false, false)
|
||||
SnoreBackend("Growl")
|
||||
{
|
||||
setDefaultValue("Host", "localhost");
|
||||
setDefaultValue("Password", "");
|
||||
|
|
|
@ -112,7 +112,7 @@ private:
|
|||
};
|
||||
|
||||
SnarlBackend::SnarlBackend():
|
||||
SnoreBackend("Snarl", true, true)
|
||||
SnoreBackend("Snarl")
|
||||
{
|
||||
setDefaultValue("Password", QString());
|
||||
}
|
||||
|
@ -154,6 +154,16 @@ PluginSettingsWidget *SnarlBackend::settingsWidget()
|
|||
return new SnarlSettings(this);
|
||||
}
|
||||
|
||||
bool SnarlBackend::canCloseNotification() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SnarlBackend::canUpdateNotification() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void SnarlBackend::slotRegisterApplication(const Application &application)
|
||||
{
|
||||
|
||||
|
|
|
@ -33,6 +33,9 @@ public:
|
|||
bool deinitialize() override;
|
||||
Snore::PluginSettingsWidget *settingsWidget() override;
|
||||
|
||||
virtual bool canCloseNotification() const override;
|
||||
virtual bool canUpdateNotification() const override;
|
||||
|
||||
private:
|
||||
class SnarlWidget;
|
||||
SnarlBackend::SnarlWidget *m_eventLoop;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
using namespace Snore;
|
||||
|
||||
SnoreNotifier::SnoreNotifier():
|
||||
SnoreBackend("Snore", true, true),
|
||||
SnoreBackend("Snore"),
|
||||
m_widgets(3),
|
||||
m_timer(new QTimer(this))
|
||||
{
|
||||
|
@ -142,6 +142,16 @@ bool SnoreNotifier::deinitialize()
|
|||
return false;
|
||||
}
|
||||
|
||||
bool SnoreNotifier::canCloseNotification() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SnoreNotifier::canUpdateNotification() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
PluginSettingsWidget *SnoreNotifier::settingsWidget()
|
||||
{
|
||||
return new SnoreNotifierSettings(this);
|
||||
|
|
|
@ -35,6 +35,9 @@ public:
|
|||
bool initialize() override;
|
||||
bool deinitialize() override;
|
||||
|
||||
virtual bool canCloseNotification() const override;
|
||||
virtual bool canUpdateNotification() const override;
|
||||
|
||||
Snore::PluginSettingsWidget *settingsWidget() override;
|
||||
|
||||
public slots:
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
using namespace Snore;
|
||||
|
||||
SnoreToast::SnoreToast():
|
||||
SnoreBackend("Windows 8", true, false)
|
||||
SnoreBackend("Windows 8")
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,11 @@ bool SnoreToast::initialize()
|
|||
return SnoreBackend::initialize();
|
||||
}
|
||||
|
||||
bool SnoreToast::canCloseNotification() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void SnoreToast::slotNotify(Notification notification)
|
||||
{
|
||||
QProcess *p = new QProcess(this);
|
||||
|
|
|
@ -14,6 +14,8 @@ public:
|
|||
~SnoreToast();
|
||||
virtual bool initialize() override;
|
||||
|
||||
virtual bool canCloseNotification() const override;
|
||||
|
||||
public slots:
|
||||
void slotNotify(Snore::Notification notification) override;
|
||||
void slotRegisterApplication(const Snore::Application &application) override;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
using namespace Snore;
|
||||
|
||||
TrayIconNotifer::TrayIconNotifer() :
|
||||
SnoreBackend("System Tray Icon", true, false),
|
||||
SnoreBackend("System Tray Icon"),
|
||||
m_currentlyDisplaying(false)
|
||||
{
|
||||
|
||||
|
@ -27,6 +27,11 @@ bool TrayIconNotifer::deinitialize()
|
|||
return false;
|
||||
}
|
||||
|
||||
bool TrayIconNotifer::canCloseNotification() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void TrayIconNotifer::slotNotify(Notification notification)
|
||||
{
|
||||
QSystemTrayIcon *icon = trayIcon(notification.application());
|
||||
|
|
|
@ -18,6 +18,9 @@ public:
|
|||
TrayIconNotifer();
|
||||
virtual ~TrayIconNotifer() override;
|
||||
virtual bool deinitialize() override;
|
||||
|
||||
virtual bool canCloseNotification() const override;
|
||||
|
||||
public slots:
|
||||
void slotNotify(Snore::Notification notification);
|
||||
void slotCloseNotification(Snore::Notification notification);
|
||||
|
|
Loading…
Reference in New Issue