remove snore() from plugins
This commit is contained in:
parent
5825bd7638
commit
97d7031719
|
@ -59,16 +59,6 @@ bool SnorePlugin::isInitialized() const
|
||||||
return m_initialized;
|
return m_initialized;
|
||||||
}
|
}
|
||||||
|
|
||||||
SnoreCore *SnorePlugin::snore()
|
|
||||||
{
|
|
||||||
return &SnoreCore::instance();
|
|
||||||
}
|
|
||||||
|
|
||||||
const SnoreCore *SnorePlugin::snore() const
|
|
||||||
{
|
|
||||||
return &SnoreCore::instance();
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariant SnorePlugin::value(const QString &key) const
|
QVariant SnorePlugin::value(const QString &key) const
|
||||||
{
|
{
|
||||||
return SnoreCore::instance().settings()->value(normaliseKey(key));
|
return SnoreCore::instance().settings()->value(normaliseKey(key));
|
||||||
|
|
|
@ -48,8 +48,6 @@ public:
|
||||||
virtual bool initialize();
|
virtual bool initialize();
|
||||||
virtual bool deinitialize();
|
virtual bool deinitialize();
|
||||||
bool isInitialized() const;
|
bool isInitialized() const;
|
||||||
LIBSNORE_DEPRECATED SnoreCore *snore();
|
|
||||||
LIBSNORE_DEPRECATED const SnoreCore *snore() const;
|
|
||||||
|
|
||||||
const QString &name() const;
|
const QString &name() const;
|
||||||
PluginTypes type() const;
|
PluginTypes type() const;
|
||||||
|
|
|
@ -173,7 +173,7 @@ bool SnoreBackend::deinitialize()
|
||||||
requestCloseNotification(n, Notification::DISMISSED);
|
requestCloseNotification(n, Notification::DISMISSED);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(const Application & a, snore()->aplications()) {
|
for(const Application & a : SnoreCore::instance().aplications()) {
|
||||||
slotDeregisterApplication(a);
|
slotDeregisterApplication(a);
|
||||||
}
|
}
|
||||||
disconnect(SnoreCorePrivate::instance(), SIGNAL(applicationRegistered(Snore::Application)), this, SLOT(slotRegisterApplication(Snore::Application)));
|
disconnect(SnoreCorePrivate::instance(), SIGNAL(applicationRegistered(Snore::Application)), this, SLOT(slotRegisterApplication(Snore::Application)));
|
||||||
|
|
|
@ -49,7 +49,7 @@ public:
|
||||||
if (msg->message == SNARL_GLOBAL_MESSAGE) {
|
if (msg->message == SNARL_GLOBAL_MESSAGE) {
|
||||||
int action = msg->wParam;
|
int action = msg->wParam;
|
||||||
if (action == SnarlEnums::SnarlLaunched) {
|
if (action == SnarlEnums::SnarlLaunched) {
|
||||||
foreach(const Application & a, m_snarl->snore()->aplications()) {
|
for(const Application & a : SnoreCore::instance().aplications()) {
|
||||||
m_snarl->slotRegisterApplication(a);
|
m_snarl->slotRegisterApplication(a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,7 @@ uint FreedesktopFrontend::Notify(const QString &app_name, uint replaces_id,
|
||||||
icon = Icon(":/root/snore.png");
|
icon = Icon(":/root/snore.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!snore()->aplications().contains(app_name)) {
|
if (!SnoreCore::instance().aplications().contains(app_name)) {
|
||||||
qDebug() << QIcon::themeSearchPaths();
|
qDebug() << QIcon::themeSearchPaths();
|
||||||
QIcon qicon = QIcon::fromTheme(app_icon, QIcon(":/root/snore.png"));
|
QIcon qicon = QIcon::fromTheme(app_icon, QIcon(":/root/snore.png"));
|
||||||
QSize max;
|
QSize max;
|
||||||
|
@ -109,9 +109,9 @@ uint FreedesktopFrontend::Notify(const QString &app_name, uint replaces_id,
|
||||||
Alert alert("DBus Alert", appIcon);
|
Alert alert("DBus Alert", appIcon);
|
||||||
app = Application(app_name, appIcon);
|
app = Application(app_name, appIcon);
|
||||||
app.addAlert(alert);
|
app.addAlert(alert);
|
||||||
snore()->registerApplication(app);
|
SnoreCore::instance().registerApplication(app);
|
||||||
} else {
|
} else {
|
||||||
app = snore()->aplications()[app_name];
|
app = SnoreCore::instance().aplications()[app_name];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hints.contains("urgency")) {
|
if (hints.contains("urgency")) {
|
||||||
|
@ -119,8 +119,8 @@ uint FreedesktopFrontend::Notify(const QString &app_name, uint replaces_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
Notification noti;
|
Notification noti;
|
||||||
if (replaces_id != 0 && snore()->getActiveNotificationByID(replaces_id).isValid()) {
|
if (replaces_id != 0 && SnoreCore::instance().getActiveNotificationByID(replaces_id).isValid()) {
|
||||||
noti = Notification(snore()->getActiveNotificationByID(replaces_id), summary, body, icon, timeout == -1 ? Notification::defaultTimeout() : timeout / 1000, priotity);
|
noti = Notification(SnoreCore::instance().getActiveNotificationByID(replaces_id), summary, body, icon, timeout == -1 ? Notification::defaultTimeout() : timeout / 1000, priotity);
|
||||||
} else {
|
} else {
|
||||||
noti = Notification(app, *app.alerts().begin(), summary, body, icon, timeout == -1 ? Notification::defaultTimeout() : timeout / 1000, priotity);
|
noti = Notification(app, *app.alerts().begin(), summary, body, icon, timeout == -1 ? Notification::defaultTimeout() : timeout / 1000, priotity);
|
||||||
}
|
}
|
||||||
|
@ -129,15 +129,15 @@ uint FreedesktopFrontend::Notify(const QString &app_name, uint replaces_id,
|
||||||
noti.addAction(Action(actions.at(i).toInt(), actions.at(i + 1)));
|
noti.addAction(Action(actions.at(i).toInt(), actions.at(i + 1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
snore()->broadcastNotification(noti);
|
SnoreCore::instance().broadcastNotification(noti);
|
||||||
return noti.id();
|
return noti.id();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FreedesktopFrontend::CloseNotification(uint id)
|
void FreedesktopFrontend::CloseNotification(uint id)
|
||||||
{
|
{
|
||||||
Notification noti = snore()->getActiveNotificationByID(id);
|
Notification noti = SnoreCore::instance().getActiveNotificationByID(id);
|
||||||
if (noti.isValid()) {
|
if (noti.isValid()) {
|
||||||
snore()->requestCloseNotification(noti, Notification::TIMED_OUT);
|
SnoreCore::instance().requestCloseNotification(noti, Notification::TIMED_OUT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -108,8 +108,8 @@ void Parser::parse(Notification &sNotification, const QString &msg, QTcpSocket *
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case NOTIFICATION: {
|
case NOTIFICATION: {
|
||||||
if (!snarl->snore()->aplications().contains(app.name())) {
|
if (!SnoreCore::instance().aplications().contains(app.name())) {
|
||||||
snarl->snore()->registerApplication(app);
|
SnoreCore::instance().registerApplication(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!alert.isActive()) {
|
if (!alert.isActive()) {
|
||||||
|
@ -136,7 +136,7 @@ void Parser::parse(Notification &sNotification, const QString &msg, QTcpSocket *
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case UNREGISTER:
|
case UNREGISTER:
|
||||||
snarl->snore()->deregisterApplication(app);
|
SnoreCore::instance().deregisterApplication(app);
|
||||||
snarl->m_applications.take(client);
|
snarl->m_applications.take(client);
|
||||||
break;
|
break;
|
||||||
case ERROR:
|
case ERROR:
|
||||||
|
|
|
@ -103,7 +103,7 @@ void SnarlNetworkFrontend::handleMessages()
|
||||||
Notification noti;
|
Notification noti;
|
||||||
parser->parse(noti, s, client);
|
parser->parse(noti, s, client);
|
||||||
if (noti.isValid()) {
|
if (noti.isValid()) {
|
||||||
snore()->broadcastNotification(noti);
|
SnoreCore::instance().broadcastNotification(noti);
|
||||||
write(client, QString("%1/%2\r\n").arg(out, QString::number(noti.id())));
|
write(client, QString("%1/%2\r\n").arg(out, QString::number(noti.id())));
|
||||||
} else {
|
} else {
|
||||||
write(client, QString("%1\r\n").arg(out));
|
write(client, QString("%1\r\n").arg(out));
|
||||||
|
|
Loading…
Reference in New Issue