mirror of
https://github.com/status-im/snorenotify.git
synced 2025-01-10 08:35:54 +00:00
remove d() in snorecore
This commit is contained in:
parent
8217239c4b
commit
5825bd7638
@ -71,20 +71,20 @@ const SnoreCore *SnorePlugin::snore() const
|
||||
|
||||
QVariant SnorePlugin::value(const QString &key) const
|
||||
{
|
||||
return snore()->settings()->value(normaliseKey(key));
|
||||
return SnoreCore::instance().settings()->value(normaliseKey(key));
|
||||
}
|
||||
|
||||
void SnorePlugin::setValue(const QString &key, const QVariant &value)
|
||||
{
|
||||
snore()->settings()->setValue(normaliseKey(key), value);
|
||||
SnoreCore::instance().settings()->setValue(normaliseKey(key), value);
|
||||
}
|
||||
|
||||
void SnorePlugin::setDefaultValue(const QString &key, const QVariant &value, const QString &help)
|
||||
{
|
||||
QString pk(normaliseKey(key));
|
||||
snore()->d()->addSettingsDescription(pk, help);
|
||||
if (!snore()->settings()->contains(pk)) {
|
||||
snore()->settings()->setValue(normaliseKey(key), value);
|
||||
SnoreCorePrivate::instance()->addSettingsDescription(pk, help);
|
||||
if (!SnoreCore::instance().settings()->contains(pk)) {
|
||||
SnoreCore::instance().settings()->setValue(normaliseKey(key), value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,13 +49,13 @@ bool SnoreBackend::initialize()
|
||||
return false;
|
||||
}
|
||||
|
||||
connect(snore()->d(), SIGNAL(applicationRegistered(Snore::Application)), this, SLOT(slotRegisterApplication(Snore::Application)), Qt::QueuedConnection);
|
||||
connect(snore()->d(), SIGNAL(applicationDeregistered(Snore::Application)), this, SLOT(slotDeregisterApplication(Snore::Application)), Qt::QueuedConnection);
|
||||
connect(SnoreCorePrivate::instance(), SIGNAL(applicationRegistered(Snore::Application)), this, SLOT(slotRegisterApplication(Snore::Application)), Qt::QueuedConnection);
|
||||
connect(SnoreCorePrivate::instance(), SIGNAL(applicationDeregistered(Snore::Application)), this, SLOT(slotDeregisterApplication(Snore::Application)), Qt::QueuedConnection);
|
||||
|
||||
connect(this, SIGNAL(notificationClosed(Snore::Notification)), snore()->d(), SLOT(slotNotificationClosed(Snore::Notification)), Qt::QueuedConnection);
|
||||
connect(snore()->d(), SIGNAL(notify(Snore::Notification)), this, SLOT(slotNotify(Snore::Notification)), Qt::QueuedConnection);
|
||||
connect(this, SIGNAL(notificationClosed(Snore::Notification)), SnoreCorePrivate::instance(), SLOT(slotNotificationClosed(Snore::Notification)), Qt::QueuedConnection);
|
||||
connect(SnoreCorePrivate::instance(), SIGNAL(notify(Snore::Notification)), this, SLOT(slotNotify(Snore::Notification)), Qt::QueuedConnection);
|
||||
|
||||
foreach(const Application & a, snore()->aplications()) {
|
||||
for(const Application & a : SnoreCore::instance().aplications()) {
|
||||
this->slotRegisterApplication(a);
|
||||
}
|
||||
|
||||
@ -113,14 +113,14 @@ bool SnoreSecondaryBackend::initialize()
|
||||
if (!SnorePlugin::initialize()) {
|
||||
return false;
|
||||
}
|
||||
connect(snore()->d(), SIGNAL(notify(Snore::Notification)), this, SLOT(slotNotify(Snore::Notification)), Qt::QueuedConnection);
|
||||
connect(SnoreCorePrivate::instance(), SIGNAL(notify(Snore::Notification)), this, SLOT(slotNotify(Snore::Notification)), Qt::QueuedConnection);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SnoreSecondaryBackend::deinitialize()
|
||||
{
|
||||
if (SnorePlugin::deinitialize()) {
|
||||
disconnect(snore()->d(), SIGNAL(notify(Snore::Notification)), this, SLOT(slotNotify(Snore::Notification)));
|
||||
disconnect(SnoreCorePrivate::instance(), SIGNAL(notify(Snore::Notification)), this, SLOT(slotNotify(Snore::Notification)));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -176,11 +176,11 @@ bool SnoreBackend::deinitialize()
|
||||
foreach(const Application & a, snore()->aplications()) {
|
||||
slotDeregisterApplication(a);
|
||||
}
|
||||
disconnect(snore()->d(), SIGNAL(applicationRegistered(Snore::Application)), this, SLOT(slotRegisterApplication(Snore::Application)));
|
||||
disconnect(snore()->d(), SIGNAL(applicationDeregistered(Snore::Application)), this, SLOT(slotDeregisterApplication(Snore::Application)));
|
||||
disconnect(SnoreCorePrivate::instance(), SIGNAL(applicationRegistered(Snore::Application)), this, SLOT(slotRegisterApplication(Snore::Application)));
|
||||
disconnect(SnoreCorePrivate::instance(), SIGNAL(applicationDeregistered(Snore::Application)), this, SLOT(slotDeregisterApplication(Snore::Application)));
|
||||
|
||||
disconnect(this, SIGNAL(notificationClosed(Snore::Notification)), snore()->d(), SLOT(slotNotificationClosed(Snore::Notification)));
|
||||
disconnect(snore()->d(), SIGNAL(notify(Snore::Notification)), this, SLOT(slotNotify(Snore::Notification)));
|
||||
disconnect(this, SIGNAL(notificationClosed(Snore::Notification)), SnoreCorePrivate::instance(), SLOT(slotNotificationClosed(Snore::Notification)));
|
||||
disconnect(SnoreCorePrivate::instance(), SIGNAL(notify(Snore::Notification)), this, SLOT(slotNotify(Snore::Notification)));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -209,9 +209,9 @@ void SnoreBackend::notificationTimedOut()
|
||||
{
|
||||
|
||||
QTimer *timer = qobject_cast<QTimer *>(sender());
|
||||
Notification n = snore()->getActiveNotificationByID(timer->property("notificationID").toUInt());
|
||||
Notification n = SnoreCore::instance().getActiveNotificationByID(timer->property("notificationID").toUInt());
|
||||
if (n.isValid()) {
|
||||
snoreDebug(SNORE_DEBUG) << n;
|
||||
snore()->requestCloseNotification(n, Notification::TIMED_OUT);
|
||||
SnoreCore::instance().requestCloseNotification(n, Notification::TIMED_OUT);
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ void SettingsDialog::load()
|
||||
void SettingsDialog::save()
|
||||
{
|
||||
snoreDebug(SNORE_DEBUG) << "saving";
|
||||
SnoreCore::instance().d()->setBackendIfAvailible(ui->primaryBackendComboBox->currentText());
|
||||
SnoreCorePrivate::instance()->setBackendIfAvailible(ui->primaryBackendComboBox->currentText());
|
||||
for (auto w : m_tabs) {
|
||||
w->saveSettings();
|
||||
}
|
||||
|
@ -209,9 +209,3 @@ const QHash<QString, QString> &SnoreCore::settingsDescription() const
|
||||
Q_D(const SnoreCore);
|
||||
return d->m_help;
|
||||
}
|
||||
|
||||
SnoreCorePrivate *SnoreCore::d()
|
||||
{
|
||||
Q_D(SnoreCore);
|
||||
return d;
|
||||
}
|
||||
|
@ -154,11 +154,6 @@ public:
|
||||
*/
|
||||
const QHash<QString, QString> &settingsDescription() const;
|
||||
|
||||
/**
|
||||
* @return a pointer to the private class, for internal use only.
|
||||
*/
|
||||
SnoreCorePrivate *d();
|
||||
|
||||
signals:
|
||||
/**
|
||||
* This signal is emitted when an action on the Notification was performed.
|
||||
|
@ -154,6 +154,11 @@ QString SnoreCorePrivate::tempPath()
|
||||
return dir.path();
|
||||
}
|
||||
|
||||
SnoreCorePrivate *SnoreCorePrivate::instance()
|
||||
{
|
||||
return SnoreCore::instance().d_ptr;
|
||||
}
|
||||
|
||||
bool SnoreCorePrivate::primaryBackendCanUpdateNotification() const
|
||||
{
|
||||
return m_notificationBackend->canUpdateNotification();
|
||||
|
@ -47,7 +47,7 @@ public:
|
||||
static QString tempPath();
|
||||
|
||||
public:
|
||||
SnoreCorePrivate();
|
||||
static SnoreCorePrivate *instance();
|
||||
~SnoreCorePrivate();
|
||||
const Application defaultApplication() const;
|
||||
|
||||
@ -77,6 +77,7 @@ private slots:
|
||||
void slotAboutToQuit();
|
||||
|
||||
private:
|
||||
SnoreCorePrivate();
|
||||
SnoreCore *q_ptr;
|
||||
|
||||
QHash<QString, Application> m_applications;
|
||||
|
@ -101,7 +101,7 @@ void GrowlBackend::gntpCallback(growl_callback_data *data)
|
||||
{
|
||||
if (s_instance) {
|
||||
snoreDebug(SNORE_DEBUG) << data->id << QString(data->reason) << QString(data->data);
|
||||
Notification n = s_instance->snore()->getActiveNotificationByID(data->id);
|
||||
Notification n = SnoreCore::instance().getActiveNotificationByID(data->id);
|
||||
if (!n.isValid()) {
|
||||
return;
|
||||
}
|
||||
@ -113,7 +113,7 @@ void GrowlBackend::gntpCallback(growl_callback_data *data)
|
||||
r = Notification::DISMISSED;
|
||||
} else if (reason == "CLICK") {
|
||||
r = Notification::CLOSED;
|
||||
s_instance->snore()->d()->notificationActionInvoked(n);
|
||||
SnoreCorePrivate::instance()->notificationActionInvoked(n);
|
||||
}
|
||||
s_instance->closeNotification(n, r);
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
|
||||
Notification notification;
|
||||
if (msg->lParam != 0) {
|
||||
notification = m_snarl->snore()->getActiveNotificationByID(m_snarl->m_idMap.value(msg->lParam));
|
||||
notification = SnoreCore::instance().getActiveNotificationByID(m_snarl->m_idMap.value(msg->lParam));
|
||||
}
|
||||
|
||||
Notification::CloseReasons reason = Notification::NONE;
|
||||
@ -72,7 +72,7 @@ public:
|
||||
reason = Notification::CLOSED;
|
||||
if (notification.isValid()) {
|
||||
notification.data()->setActionInvoked(data);
|
||||
m_snarl->snore()->d()->notificationActionInvoked(notification);
|
||||
SnoreCorePrivate::instance()->notificationActionInvoked(notification);
|
||||
}
|
||||
break;
|
||||
case SnarlEnums::CallbackClosed:
|
||||
|
@ -95,7 +95,7 @@ void SnoreNotifier::slotInvoked()
|
||||
{
|
||||
NotifyWidget *widget = qobject_cast<NotifyWidget *>(sender());
|
||||
Notification notification = widget->notification();
|
||||
snore()->d()->notificationActionInvoked(notification);
|
||||
SnoreCorePrivate::instance()->notificationActionInvoked(notification);
|
||||
closeNotification(notification, Notification::CLOSED);
|
||||
slotCloseNotification(notification);
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ void SnoreToast::slotToastNotificationClosed(int code, QProcess::ExitStatus)
|
||||
switch (code) {
|
||||
case 0:
|
||||
reason = Notification::CLOSED;
|
||||
snore()->d()->notificationActionInvoked(n);
|
||||
SnoreCorePrivate::instance()->notificationActionInvoked(n);
|
||||
break;
|
||||
case 1:
|
||||
//hidden;
|
||||
|
@ -92,7 +92,7 @@ void TrayIconNotifer::actionInvoked()
|
||||
Notification n = getActiveNotificationByID(m_displayed);
|
||||
QSystemTrayIcon *icon = trayIcon(n.application());
|
||||
if (icon && n.isValid()) {
|
||||
snore()->d()->notificationActionInvoked(n);
|
||||
SnoreCorePrivate::instance()->notificationActionInvoked(n);
|
||||
closeNotification(n, Notification::CLOSED);
|
||||
m_currentlyDisplaying = false;
|
||||
displayNotification(icon);
|
||||
|
Loading…
x
Reference in New Issue
Block a user