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