diff --git a/src/libsnore/application_p.cpp b/src/libsnore/application_p.cpp index 90e81e2..83b9b37 100644 --- a/src/libsnore/application_p.cpp +++ b/src/libsnore/application_p.cpp @@ -28,7 +28,7 @@ ApplicationData::ApplicationData(const QString &name, const Icon &icon): Q_ASSERT_X(!name.isEmpty(), Q_FUNC_INFO, "invalid name detected"); m_hint.setValue("pushover-token", QLatin1String("aFB1TPCyZkkr7mubCGEKy5vJEWak9t")); m_hint.setValue("use-markup", false); - m_hint.setValue("silent", SnoreCore::instance().value(QLatin1String("Silent"), LOCAL_SETTING)); + m_hint.setValue("silent", SnoreCore::instance().settingsValue(QLatin1String("Silent"), LOCAL_SETTING)); } ApplicationData::~ApplicationData() diff --git a/src/libsnore/notification/notification.cpp b/src/libsnore/notification/notification.cpp index 4b1bd25..64ee1a4 100644 --- a/src/libsnore/notification/notification.cpp +++ b/src/libsnore/notification/notification.cpp @@ -184,7 +184,7 @@ NotificationData *Notification::data() int Notification::defaultTimeout() { - return SnoreCore::instance().value(QLatin1String("Timeout"), LOCAL_SETTING).toInt(); + return SnoreCore::instance().settingsValue(QLatin1String("Timeout"), LOCAL_SETTING).toInt(); } QDataStream &operator<< (QDataStream &stream, const Notification ¬i) diff --git a/src/libsnore/plugins/plugins.cpp b/src/libsnore/plugins/plugins.cpp index cc03aca..3ff0137 100644 --- a/src/libsnore/plugins/plugins.cpp +++ b/src/libsnore/plugins/plugins.cpp @@ -44,7 +44,7 @@ SnorePlugin::~SnorePlugin() bool SnorePlugin::initialize() { - setDefaultValue(QLatin1String("Enabled"), false, LOCAL_SETTING); + setDefaultSettingsValue(QLatin1String("Enabled"), false, LOCAL_SETTING); if (m_initialized) { qFatal("Something went wrong, plugin %s is already initialized", this->name().toLatin1().constData()); return false; @@ -59,19 +59,19 @@ bool SnorePlugin::isInitialized() const return m_initialized; } -QVariant SnorePlugin::value(const QString &key, SettingsType type) const +QVariant SnorePlugin::settingsValue(const QString &key, SettingsType type) const { - return SnoreCore::instance().value(normaliseKey(key), type); + return SnoreCore::instance().settingsValue(normaliseKey(key), type); } -void SnorePlugin::setValue(const QString &key, const QVariant &value, SettingsType type) +void SnorePlugin::setSettingsValue(const QString &key, const QVariant &value, SettingsType type) { - SnoreCore::instance().setValue(normaliseKey(key), value, type); + SnoreCore::instance().setSettingsValue(normaliseKey(key), value, type); } -void SnorePlugin::setDefaultValue(const QString &key, const QVariant &value, SettingsType type) +void SnorePlugin::setDefaultSettingsValue(const QString &key, const QVariant &value, SettingsType type) { - SnoreCore::instance().setDefaultValue(normaliseKey(key), value, type); + SnoreCore::instance().setDefaultSettingsValue(normaliseKey(key), value, type); } Snore::PluginSettingsWidget *SnorePlugin::settingsWidget() diff --git a/src/libsnore/plugins/plugins.h b/src/libsnore/plugins/plugins.h index 9358cd6..d0b5543 100644 --- a/src/libsnore/plugins/plugins.h +++ b/src/libsnore/plugins/plugins.h @@ -63,9 +63,9 @@ public: PluginTypes type() const; const QString typeName() const; - QVariant value(const QString &key, SettingsType type = GLOBAL_SETTING) const; - void setValue(const QString &key, const QVariant &value, SettingsType type = GLOBAL_SETTING); - void setDefaultValue(const QString &key, const QVariant &value, SettingsType type = GLOBAL_SETTING); + QVariant settingsValue(const QString &key, SettingsType type = GLOBAL_SETTING) const; + void setSettingsValue(const QString &key, const QVariant &settingsValue, SettingsType type = GLOBAL_SETTING); + void setDefaultSettingsValue(const QString &key, const QVariant &settingsValue, SettingsType type = GLOBAL_SETTING); virtual PluginSettingsWidget *settingsWidget(); diff --git a/src/libsnore/plugins/pluginsettingswidget.cpp b/src/libsnore/plugins/pluginsettingswidget.cpp index 6631e09..299031a 100644 --- a/src/libsnore/plugins/pluginsettingswidget.cpp +++ b/src/libsnore/plugins/pluginsettingswidget.cpp @@ -56,7 +56,7 @@ void PluginSettingsWidget::addRow(const QString &label, QWidget *widget) void PluginSettingsWidget::loadSettings() { if (m_snorePlugin->type() != SnorePlugin::BACKEND) { - m_enabled->setChecked(m_snorePlugin->value(QLatin1String("Enabled"), LOCAL_SETTING).toBool()); + m_enabled->setChecked(m_snorePlugin->settingsValue(QLatin1String("Enabled"), LOCAL_SETTING).toBool()); } load(); } @@ -64,7 +64,7 @@ void PluginSettingsWidget::loadSettings() void PluginSettingsWidget::saveSettings() { if (m_snorePlugin->type() != SnorePlugin::BACKEND) { - m_snorePlugin->setValue(QLatin1String("Enabled"), m_enabled->isChecked(), LOCAL_SETTING); + m_snorePlugin->setSettingsValue(QLatin1String("Enabled"), m_enabled->isChecked(), LOCAL_SETTING); } save(); } @@ -74,15 +74,15 @@ bool PluginSettingsWidget::isDirty() return m_dirty; } -QVariant PluginSettingsWidget::value(const QString &key, SettingsType type) const +QVariant PluginSettingsWidget::settingsValue(const QString &key, SettingsType type) const { - return m_snorePlugin->value(key, type); + return m_snorePlugin->settingsValue(key, type); } -void PluginSettingsWidget::setValue(const QString &key, const QVariant &value, SettingsType type) +void PluginSettingsWidget::setSettingsValue(const QString &key, const QVariant &value, SettingsType type) { - if (this->value(key) != value) { - m_snorePlugin->setValue(key, value, type); + if (this->settingsValue(key) != value) { + m_snorePlugin->setSettingsValue(key, value, type); m_dirty = true; } } diff --git a/src/libsnore/plugins/pluginsettingswidget.h b/src/libsnore/plugins/pluginsettingswidget.h index b947aa3..9c75395 100644 --- a/src/libsnore/plugins/pluginsettingswidget.h +++ b/src/libsnore/plugins/pluginsettingswidget.h @@ -46,8 +46,8 @@ public: bool isDirty(); protected: - QVariant value(const QString &key, Snore::SettingsType type = Snore::GLOBAL_SETTING) const; - void setValue(const QString &key, const QVariant &value, Snore::SettingsType type = Snore::GLOBAL_SETTING); + QVariant settingsValue(const QString &key, Snore::SettingsType type = Snore::GLOBAL_SETTING) const; + void setSettingsValue(const QString &key, const QVariant &settingsValue, Snore::SettingsType type = Snore::GLOBAL_SETTING); virtual void load(); virtual void save(); diff --git a/src/libsnore/settingsdialog.cpp b/src/libsnore/settingsdialog.cpp index d89d452..2e587df 100644 --- a/src/libsnore/settingsdialog.cpp +++ b/src/libsnore/settingsdialog.cpp @@ -42,7 +42,7 @@ SettingsDialog::~SettingsDialog() void SettingsDialog::initTabs() { - SnorePlugin::PluginTypes types = SnoreCore::instance().value(QLatin1String("PluginTypes"), LOCAL_SETTING).value(); + SnorePlugin::PluginTypes types = SnoreCore::instance().settingsValue(QLatin1String("PluginTypes"), LOCAL_SETTING).value(); if (types == SnorePlugin::NONE) { types = SnorePlugin::ALL; } @@ -80,19 +80,19 @@ void Snore::SettingsDialog::on_pushButton_clicked() void SettingsDialog::load() { snoreDebug(SNORE_DEBUG) << "loading"; - if (SnoreCore::instance().value(QLatin1String("PluginTypes"), LOCAL_SETTING).value() & SnorePlugin::BACKEND) { + if (SnoreCore::instance().settingsValue(QLatin1String("PluginTypes"), LOCAL_SETTING).value() & SnorePlugin::BACKEND) { ui->primaryBackendComboBox->clear(); QStringList list = SnoreCore::instance().pluginNames(SnorePlugin::BACKEND); ui->primaryBackendComboBox->addItems(list); - ui->primaryBackendComboBox->setCurrentIndex(list.indexOf(SnoreCore::instance().value(QLatin1String("PrimaryBackend"), LOCAL_SETTING).toString())); + ui->primaryBackendComboBox->setCurrentIndex(list.indexOf(SnoreCore::instance().settingsValue(QLatin1String("PrimaryBackend"), LOCAL_SETTING).toString())); ui->primaryBackendComboBox->setVisible(true); ui->primaryBackendLabel->setVisible(true); } else { ui->primaryBackendComboBox->setVisible(false); ui->primaryBackendLabel->setVisible(false); } - ui->timeoutSpinBox->setValue(SnoreCore::instance().value(QLatin1String("Timeout"), LOCAL_SETTING).toInt()); - ui->disableNotificationSoundCheckBox->setChecked(SnoreCore::instance().value(QLatin1String("Silent"), LOCAL_SETTING).toBool()); + ui->timeoutSpinBox->setValue(SnoreCore::instance().settingsValue(QLatin1String("Timeout"), LOCAL_SETTING).toInt()); + ui->disableNotificationSoundCheckBox->setChecked(SnoreCore::instance().settingsValue(QLatin1String("Silent"), LOCAL_SETTING).toBool()); for (auto widget : m_tabs) { widget->loadSettings(); } @@ -106,13 +106,13 @@ void SettingsDialog::save() w->saveSettings(); dirty |= w->isDirty(); } - dirty |= SnoreCore::instance().value(QLatin1String("PrimaryBackend"), LOCAL_SETTING).toString() != ui->primaryBackendComboBox->currentText(); - dirty |= SnoreCore::instance().value(QLatin1String("Timeout"), LOCAL_SETTING).toInt() != ui->timeoutSpinBox->value(); - dirty |= SnoreCore::instance().value(QLatin1String("Silent"), LOCAL_SETTING).toBool() != ui->disableNotificationSoundCheckBox->isChecked(); + dirty |= SnoreCore::instance().settingsValue(QLatin1String("PrimaryBackend"), LOCAL_SETTING).toString() != ui->primaryBackendComboBox->currentText(); + dirty |= SnoreCore::instance().settingsValue(QLatin1String("Timeout"), LOCAL_SETTING).toInt() != ui->timeoutSpinBox->value(); + dirty |= SnoreCore::instance().settingsValue(QLatin1String("Silent"), LOCAL_SETTING).toBool() != ui->disableNotificationSoundCheckBox->isChecked(); - SnoreCore::instance().setValue(QLatin1String("PrimaryBackend"), ui->primaryBackendComboBox->currentText(), LOCAL_SETTING); - SnoreCore::instance().setValue(QLatin1String("Timeout"), ui->timeoutSpinBox->value(), LOCAL_SETTING); - SnoreCore::instance().setValue(QLatin1String("Silent"), ui->disableNotificationSoundCheckBox->isChecked(), LOCAL_SETTING); + SnoreCore::instance().setSettingsValue(QLatin1String("PrimaryBackend"), ui->primaryBackendComboBox->currentText(), LOCAL_SETTING); + SnoreCore::instance().setSettingsValue(QLatin1String("Timeout"), ui->timeoutSpinBox->value(), LOCAL_SETTING); + SnoreCore::instance().setSettingsValue(QLatin1String("Silent"), ui->disableNotificationSoundCheckBox->isChecked(), LOCAL_SETTING); if (dirty) { SnoreCorePrivate::instance()->syncSettings(); diff --git a/src/libsnore/snore.cpp b/src/libsnore/snore.cpp index 741252d..eb3e931 100644 --- a/src/libsnore/snore.cpp +++ b/src/libsnore/snore.cpp @@ -67,7 +67,7 @@ void SnoreCore::loadPlugins(SnorePlugin::PluginTypes types) return; } Q_D(SnoreCore); - setValue(QLatin1String("PluginTypes"), QVariant::fromValue(types), LOCAL_SETTING); + setSettingsValue(QLatin1String("PluginTypes"), QVariant::fromValue(types), LOCAL_SETTING); snoreDebug(SNORE_DEBUG) << "Loading plugin types:" << types; for (SnorePlugin::PluginTypes type : SnorePlugin::types()) { if (type != SnorePlugin::ALL && types & type) { @@ -82,7 +82,7 @@ void SnoreCore::loadPlugins(SnorePlugin::PluginTypes types) case SnorePlugin::SECONDARY_BACKEND: case SnorePlugin::FRONTEND: case SnorePlugin::PLUGIN: { - if (plugin->value(QLatin1String("Enabled"), LOCAL_SETTING).toBool()) { + if (plugin->settingsValue(QLatin1String("Enabled"), LOCAL_SETTING).toBool()) { if (!plugin->initialize()) { snoreDebug(SNORE_WARNING) << "Failed to initialize" << plugin->name(); plugin->deinitialize(); @@ -203,26 +203,26 @@ QList SnoreCore::settingWidgets(SnorePlugin::PluginTypes return list; } -QVariant SnoreCore::value(const QString &key, SettingsType type) const +QVariant SnoreCore::settingsValue(const QString &key, SettingsType type) const { Q_D(const SnoreCore); - QString nk = d->normalizeKey(key, type); + QString nk = d->normalizeSettingsKey(key, type); if(type == LOCAL_SETTING && !d->m_settings->contains(nk)){ - nk = d->normalizeKey(key + QStringLiteral("-SnoreDefault"),type); + nk = d->normalizeSettingsKey(key + QStringLiteral("-SnoreDefault"),type); } return d->m_settings->value(nk); } -void SnoreCore::setValue(const QString &key, const QVariant &value, SettingsType type) +void SnoreCore::setSettingsValue(const QString &key, const QVariant &value, SettingsType type) { Q_D(SnoreCore); - d->m_settings->setValue(d->normalizeKey(key, type), value); + d->m_settings->setValue(d->normalizeSettingsKey(key, type), value); } -void SnoreCore::setDefaultValue(const QString &key, const QVariant &value, SettingsType type) +void SnoreCore::setDefaultSettingsValue(const QString &key, const QVariant &value, SettingsType type) { Q_D(SnoreCore); - QString nk = d->normalizeKey(key, type); + QString nk = d->normalizeSettingsKey(key, type); if (!d->m_settings->contains(nk)) { snoreDebug(SNORE_DEBUG) << "Set default value" << nk << value; d->m_settings->setValue(nk, value); diff --git a/src/libsnore/snore.h b/src/libsnore/snore.h index 925475c..c31f86e 100644 --- a/src/libsnore/snore.h +++ b/src/libsnore/snore.h @@ -145,9 +145,9 @@ public: */ QList settingWidgets(SnorePlugin::PluginTypes type); - QVariant value(const QString &key, SettingsType type = GLOBAL_SETTING) const; - void setValue(const QString &key, const QVariant &value, SettingsType type = GLOBAL_SETTING); - void setDefaultValue(const QString &key, const QVariant &value, SettingsType type = GLOBAL_SETTING); + QVariant settingsValue(const QString &key, SettingsType type = GLOBAL_SETTING) const; + void setSettingsValue(const QString &key, const QVariant &settingsValue, SettingsType type = GLOBAL_SETTING); + void setDefaultSettingsValue(const QString &key, const QVariant &settingsValue, SettingsType type = GLOBAL_SETTING); Notification getActiveNotificationByID(uint id) const; diff --git a/src/libsnore/snore_p.cpp b/src/libsnore/snore_p.cpp index e919603..96387aa 100644 --- a/src/libsnore/snore_p.cpp +++ b/src/libsnore/snore_p.cpp @@ -42,7 +42,7 @@ SnoreCorePrivate::SnoreCorePrivate(): snoreDebug(SNORE_DEBUG) << "Temp dir is" << tempPath(); snoreDebug(SNORE_DEBUG) << "Snore settings are located in" << m_settings->fileName(); - snoreDebug(SNORE_DEBUG) << "Snore local settings are located in" << normalizeKey(QLatin1String("Test"), LOCAL_SETTING); + snoreDebug(SNORE_DEBUG) << "Snore local settings are located in" << normalizeSettingsKey(QLatin1String("Test"), LOCAL_SETTING); connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(slotAboutToQuit())); } @@ -96,7 +96,7 @@ bool SnoreCorePrivate::setBackendIfAvailible(const QString &backend) } m_notificationBackend = b; - q->setValue(QLatin1String("PrimaryBackend"), backend, LOCAL_SETTING); + q->setSettingsValue(QLatin1String("PrimaryBackend"), backend, LOCAL_SETTING); return true; } return false; @@ -105,8 +105,8 @@ bool SnoreCorePrivate::setBackendIfAvailible(const QString &backend) bool SnoreCorePrivate::initPrimaryNotificationBackend() { Q_Q(SnoreCore); - snoreDebug(SNORE_DEBUG) << q->value(QLatin1String("PrimaryBackend"), LOCAL_SETTING).toString(); - if (setBackendIfAvailible(q->value(QLatin1String("PrimaryBackend"), LOCAL_SETTING).toString())) { + snoreDebug(SNORE_DEBUG) << q->settingsValue(QLatin1String("PrimaryBackend"), LOCAL_SETTING).toString(); + if (setBackendIfAvailible(q->settingsValue(QLatin1String("PrimaryBackend"), LOCAL_SETTING).toString())) { return true; } #ifdef Q_OS_WIN @@ -140,15 +140,15 @@ bool SnoreCorePrivate::initPrimaryNotificationBackend() void SnoreCorePrivate::init() { Q_Q(SnoreCore); - setDefaultValueIntern(QLatin1String("Timeout"), 10); - setDefaultValueIntern(QLatin1String("Silent"), false); + setDefaultSettingsValueIntern(QLatin1String("Timeout"), 10); + setDefaultSettingsValueIntern(QLatin1String("Silent"), false); m_defaultApp = Application(QLatin1String("SnoreNotify"), Icon::defaultIcon()); } -void SnoreCorePrivate::setDefaultValueIntern(const QString &key, const QVariant &value) +void SnoreCorePrivate::setDefaultSettingsValueIntern(const QString &key, const QVariant &value) { Q_Q(SnoreCore); - QString nk = normalizeKey( key + QLatin1String("-SnoreDefault"), LOCAL_SETTING); + QString nk = normalizeSettingsKey( key + QLatin1String("-SnoreDefault"), LOCAL_SETTING); if (!m_settings->contains(nk)) { m_settings->setValue(nk, value); } @@ -157,7 +157,7 @@ void SnoreCorePrivate::setDefaultValueIntern(const QString &key, const QVariant void SnoreCorePrivate::syncSettings() { Q_Q(SnoreCore); - QString newBackend = q->value(QLatin1String("PrimaryBackend"), LOCAL_SETTING).toString(); + QString newBackend = q->settingsValue(QLatin1String("PrimaryBackend"), LOCAL_SETTING).toString(); if (!newBackend.isEmpty()) { QString oldBackend; if (m_notificationBackend) { @@ -166,7 +166,7 @@ void SnoreCorePrivate::syncSettings() m_notificationBackend = nullptr; } if (!setBackendIfAvailible(newBackend)) { - snoreDebug(SNORE_WARNING) << "Failed to set new backend" << q->value(QLatin1String("PrimaryBackend"), LOCAL_SETTING).toString() << "restoring" << oldBackend; + snoreDebug(SNORE_WARNING) << "Failed to set new backend" << q->settingsValue(QLatin1String("PrimaryBackend"), LOCAL_SETTING).toString() << "restoring" << oldBackend; setBackendIfAvailible(oldBackend); } } @@ -176,7 +176,7 @@ void SnoreCorePrivate::syncSettings() for(auto type : types) { for (auto &pluginName : m_pluginNames[type]) { SnorePlugin *plugin = m_plugins.value(pluginName); - bool enable = m_plugins[pluginName]->value(QLatin1String("Enabled"), LOCAL_SETTING).toBool(); + bool enable = m_plugins[pluginName]->settingsValue(QLatin1String("Enabled"), LOCAL_SETTING).toBool(); if (!plugin->isInitialized() && enable) { plugin->initialize(); } else if (plugin->isInitialized() && !enable) { diff --git a/src/libsnore/snore_p.h b/src/libsnore/snore_p.h index a4912d7..7f2ea1f 100644 --- a/src/libsnore/snore_p.h +++ b/src/libsnore/snore_p.h @@ -58,7 +58,7 @@ public: void syncSettings(); - QString normalizeKey(const QString &key, SettingsType type) const + QString normalizeSettingsKey(const QString &key, SettingsType type) const { return Snore::Utils::normalizeSettingsKey(key, type, m_localSettingsPrefix); } @@ -70,7 +70,7 @@ public: /** * Set a default value wich can be overritten by a client application call to SnoreCore::setDefaultValue() */ - void setDefaultValueIntern(const QString &key, const QVariant &value); + void setDefaultSettingsValueIntern(const QString &key, const QVariant &value); private Q_SLOTS: //TODO: find a better solutinon for the slots in this section diff --git a/src/plugins/backends/growl/growlbackend.cpp b/src/plugins/backends/growl/growlbackend.cpp index 6712f6d..601e70c 100644 --- a/src/plugins/backends/growl/growlbackend.cpp +++ b/src/plugins/backends/growl/growlbackend.cpp @@ -32,8 +32,8 @@ GrowlBackend *GrowlBackend::s_instance = nullptr; bool GrowlBackend::initialize() { - setDefaultValue(QLatin1String("Host"), QLatin1String("localhost")); - setDefaultValue(QLatin1String("Password"), QString()); + setDefaultSettingsValue(QLatin1String("Host"), QLatin1String("localhost")); + setDefaultSettingsValue(QLatin1String("Password"), QString()); if(!SnoreBackend::initialize()) { return false; @@ -63,7 +63,7 @@ bool GrowlBackend::initialize() s_instance->closeNotification(n, r); }; if (Growl::init((GROWL_CALLBACK)static_cast(func)) - && Growl::isRunning(GROWL_TCP, value(QLatin1String("Host")).toString().toUtf8().constData())) { + && Growl::isRunning(GROWL_TCP, settingsValue(QLatin1String("Host")).toString().toUtf8().constData())) { return true; } snoreDebug(SNORE_DEBUG) << "Growl is not running"; @@ -87,8 +87,8 @@ void GrowlBackend::slotRegisterApplication(const Application &application) alerts.push_back(a.name().toUtf8().constData()); } - Growl *growl = new Growl(GROWL_TCP, value(QLatin1String("Host")).toString().toUtf8().constData(), - value(QLatin1String("Password")).toString().toUtf8().constData(), + Growl *growl = new Growl(GROWL_TCP, settingsValue(QLatin1String("Host")).toString().toUtf8().constData(), + settingsValue(QLatin1String("Password")).toString().toUtf8().constData(), application.name().toUtf8().constData()); m_applications.insert(application.name(), growl); growl->Register(alerts, application.icon().localUrl().toUtf8().constData()); diff --git a/src/plugins/backends/growl/growlsettings.cpp b/src/plugins/backends/growl/growlsettings.cpp index a96b519..44aeaa8 100644 --- a/src/plugins/backends/growl/growlsettings.cpp +++ b/src/plugins/backends/growl/growlsettings.cpp @@ -38,13 +38,13 @@ GrowlSettings::~GrowlSettings() void GrowlSettings::load() { - m_host->setText(value(QLatin1String("Host")).toString()); - m_password->setText(value(QLatin1String("Password")).toString()); + m_host->setText(settingsValue(QLatin1String("Host")).toString()); + m_password->setText(settingsValue(QLatin1String("Password")).toString()); } void GrowlSettings::save() { - setValue(QLatin1String("Host"), m_host->text()); - setValue(QLatin1String("Password"), m_password->text()); + setSettingsValue(QLatin1String("Host"), m_host->text()); + setSettingsValue(QLatin1String("Password"), m_password->text()); } diff --git a/src/plugins/backends/snarl/snarl.cpp b/src/plugins/backends/snarl/snarl.cpp index a9c72b1..bca2f51 100644 --- a/src/plugins/backends/snarl/snarl.cpp +++ b/src/plugins/backends/snarl/snarl.cpp @@ -113,7 +113,7 @@ private: bool SnarlBackend::initialize() { - setDefaultValue(QLatin1String("Password"), QString()); + setDefaultSettingsValue(QLatin1String("Password"), QString()); if(!SnoreBackend::initialize()) { return false; @@ -168,7 +168,7 @@ void SnarlBackend::slotRegisterApplication(const Application &application) m_applications.insert(application.name(), snarlInterface); QString appName = application.name().replace(QLatin1Char(' '), QLatin1Char('_')); //app sig must not contain spaces - QString password = value(QLatin1String("Password")).toString(); + QString password = settingsValue(QLatin1String("Password")).toString(); LONG32 result = snarlInterface->Register(appName.toUtf8().constData(), application.name().toUtf8().constData(), application.icon().localUrl().toUtf8().constData(), diff --git a/src/plugins/backends/snarl/snarlsettings.cpp b/src/plugins/backends/snarl/snarlsettings.cpp index 5ead11d..aacd468 100644 --- a/src/plugins/backends/snarl/snarlsettings.cpp +++ b/src/plugins/backends/snarl/snarlsettings.cpp @@ -36,11 +36,11 @@ SnarlSettings::~SnarlSettings() void SnarlSettings::load() { - m_password->setText(value(QLatin1String("Password")).toString()); + m_password->setText(settingsValue(QLatin1String("Password")).toString()); } void SnarlSettings::save() { - setValue(QLatin1String("Password"), m_password->text()); + setSettingsValue(QLatin1String("Password"), m_password->text()); } diff --git a/src/plugins/backends/snore/notifywidget.cpp b/src/plugins/backends/snore/notifywidget.cpp index 19075ff..8630bdc 100644 --- a/src/plugins/backends/snore/notifywidget.cpp +++ b/src/plugins/backends/snore/notifywidget.cpp @@ -148,7 +148,7 @@ int NotifyWidget::id() Qt::Corner NotifyWidget::corner() { - return static_cast(m_parent->value(QLatin1String("Position")).toInt()); + return static_cast(m_parent->settingsValue(QLatin1String("Position")).toInt()); } qlonglong NotifyWidget::wid() diff --git a/src/plugins/backends/snore/snorenotifier.cpp b/src/plugins/backends/snore/snorenotifier.cpp index 7495fd8..a141466 100644 --- a/src/plugins/backends/snore/snorenotifier.cpp +++ b/src/plugins/backends/snore/snorenotifier.cpp @@ -107,7 +107,7 @@ void SnoreNotifier::slotCloseNotification(Snore::Notification notification) bool SnoreNotifier::initialize() { - setDefaultValue(QLatin1String("Position"), Qt::TopRightCorner); + setDefaultSettingsValue(QLatin1String("Position"), Qt::TopRightCorner); if (SnoreBackend::initialize()) { for (int i = 0; i < m_widgets.size(); ++i) { diff --git a/src/plugins/backends/snore/snorenotifiersettings.cpp b/src/plugins/backends/snore/snorenotifiersettings.cpp index b39a109..c1efe7f 100644 --- a/src/plugins/backends/snore/snorenotifiersettings.cpp +++ b/src/plugins/backends/snore/snorenotifiersettings.cpp @@ -40,10 +40,10 @@ SnoreNotifierSettings::~SnoreNotifierSettings() void SnoreNotifierSettings::load() { - m_comboBox->setCurrentIndex(value(QLatin1String("Position")).toInt()); + m_comboBox->setCurrentIndex(settingsValue(QLatin1String("Position")).toInt()); } void SnoreNotifierSettings::save() { - setValue(QLatin1String("Position"), m_comboBox->currentIndex()); + setSettingsValue(QLatin1String("Position"), m_comboBox->currentIndex()); } diff --git a/src/plugins/frontends/pushover/pushover_frontend.cpp b/src/plugins/frontends/pushover/pushover_frontend.cpp index f8e6cac..0e2f70b 100644 --- a/src/plugins/frontends/pushover/pushover_frontend.cpp +++ b/src/plugins/frontends/pushover/pushover_frontend.cpp @@ -50,8 +50,8 @@ PushoverFrontend::PushoverFrontend() bool PushoverFrontend::initialize() { - setDefaultValue(QLatin1String("Secret"), QString(), LOCAL_SETTING); - setDefaultValue(QLatin1String("DeviceID"), QString(), LOCAL_SETTING); + setDefaultSettingsValue(QLatin1String("Secret"), QString(), LOCAL_SETTING); + setDefaultSettingsValue(QLatin1String("DeviceID"), QString(), LOCAL_SETTING); if(!SnoreFrontend::initialize()) { return false; @@ -81,7 +81,7 @@ PluginSettingsWidget *PushoverFrontend::settingsWidget() void PushoverFrontend::login(const QString &email, const QString &password, const QString &deviceName) { - setValue(QLatin1String("DeviceName"), deviceName, Snore::LOCAL_SETTING); + setSettingsValue(QLatin1String("DeviceName"), deviceName, Snore::LOCAL_SETTING); QNetworkRequest request(QUrl(QLatin1String("https://api.pushover.net/1/users/login.json"))); @@ -110,8 +110,8 @@ void PushoverFrontend::login(const QString &email, const QString &password, cons void PushoverFrontend::logOut() { - setValue(QLatin1String("Secret"), QString(), LOCAL_SETTING); - setValue(QLatin1String("DeviceID"), QString(), LOCAL_SETTING); + setSettingsValue(QLatin1String("Secret"), QString(), LOCAL_SETTING); + setSettingsValue(QLatin1String("DeviceID"), QString(), LOCAL_SETTING); m_socket->close(); m_socket->deleteLater(); emit loggedInChanged(false); @@ -137,12 +137,12 @@ void PushoverFrontend::slotActionInvoked(Notification notification) QString PushoverFrontend::secret() { - return value(QLatin1String("Secret"), LOCAL_SETTING).toString(); + return settingsValue(QLatin1String("Secret"), LOCAL_SETTING).toString(); } QString PushoverFrontend::device() { - return value(QLatin1String("DeviceID"), LOCAL_SETTING).toString(); + return settingsValue(QLatin1String("DeviceID"), LOCAL_SETTING).toString(); } void PushoverFrontend::connectToService() @@ -211,8 +211,8 @@ void PushoverFrontend::registerDevice(const QString &secret, const QString &devi reply->deleteLater(); QJsonObject message = QJsonDocument::fromJson(input).object(); if(message.value(QLatin1String("status")).toInt() == 1) { - setValue(QLatin1String("Secret"), secret, LOCAL_SETTING); - setValue(QLatin1String("DeviceID"), message.value(QLatin1String("id")).toString(), LOCAL_SETTING);; + setSettingsValue(QLatin1String("Secret"), secret, LOCAL_SETTING); + setSettingsValue(QLatin1String("DeviceID"), message.value(QLatin1String("id")).toString(), LOCAL_SETTING);; connectToService(); } else { snoreDebug(SNORE_WARNING) << "An error occure" << input; diff --git a/src/plugins/frontends/pushover/pushoversettings.cpp b/src/plugins/frontends/pushover/pushoversettings.cpp index 3759b75..8d7e9de 100644 --- a/src/plugins/frontends/pushover/pushoversettings.cpp +++ b/src/plugins/frontends/pushover/pushoversettings.cpp @@ -72,7 +72,7 @@ PushoverSettings::~PushoverSettings() void PushoverSettings::load() { - m_deviceLineEdit->setText(value(QLatin1String("DeviceName"), Snore::LOCAL_SETTING).toString()); + m_deviceLineEdit->setText(settingsValue(QLatin1String("DeviceName"), Snore::LOCAL_SETTING).toString()); } void PushoverSettings::save() diff --git a/src/plugins/secondary_backends/nma/nma.cpp b/src/plugins/secondary_backends/nma/nma.cpp index 09c553c..8bd4a77 100644 --- a/src/plugins/secondary_backends/nma/nma.cpp +++ b/src/plugins/secondary_backends/nma/nma.cpp @@ -28,7 +28,7 @@ using namespace Snore; void NotifyMyAndroid::slotNotify(Notification notification) { - QString key = value(QLatin1String("ApiKey")).toString(); + QString key = settingsValue(QLatin1String("ApiKey")).toString(); if (key.isEmpty()) { return; } @@ -64,7 +64,7 @@ void NotifyMyAndroid::slotNotify(Notification notification) bool NotifyMyAndroid::initialize() { - setDefaultValue(QLatin1String("ApiKey"), QString()); + setDefaultSettingsValue(QLatin1String("ApiKey"), QString()); return SnoreSecondaryBackend::initialize(); } diff --git a/src/plugins/secondary_backends/nma/nmasettings.cpp b/src/plugins/secondary_backends/nma/nmasettings.cpp index 2d2e360..2dd7f3c 100644 --- a/src/plugins/secondary_backends/nma/nmasettings.cpp +++ b/src/plugins/secondary_backends/nma/nmasettings.cpp @@ -34,10 +34,10 @@ NotifyMyAndroidSettings::~NotifyMyAndroidSettings() void NotifyMyAndroidSettings::load() { - m_lineEdit->setText(value(QLatin1String("ApiKey")).toString()); + m_lineEdit->setText(settingsValue(QLatin1String("ApiKey")).toString()); } void NotifyMyAndroidSettings::save() { - setValue(QLatin1String("ApiKey"), m_lineEdit->text()); + setSettingsValue(QLatin1String("ApiKey"), m_lineEdit->text()); } diff --git a/src/plugins/secondary_backends/pushover/pushover.cpp b/src/plugins/secondary_backends/pushover/pushover.cpp index 08723de..c6b57aa 100644 --- a/src/plugins/secondary_backends/pushover/pushover.cpp +++ b/src/plugins/secondary_backends/pushover/pushover.cpp @@ -29,7 +29,7 @@ using namespace Snore; void Pushover::slotNotify(Notification notification) { - QString key = value(QLatin1String("UserKey")).toString(); + QString key = settingsValue(QLatin1String("UserKey")).toString(); if (key.isEmpty()) { return; } @@ -83,14 +83,14 @@ void Pushover::slotNotify(Notification notification) if (notification.hints().value("silent").toBool()) { sound.setBody("none"); } else { - sound.setBody(value(QLatin1String("Sound"), LOCAL_SETTING).toString().toUtf8().constData()); + sound.setBody(settingsValue(QLatin1String("Sound"), LOCAL_SETTING).toString().toUtf8().constData()); } mp->append(sound); - if (!value(QLatin1String("Devices"), LOCAL_SETTING).toString().isEmpty()) { + if (!settingsValue(QLatin1String("Devices"), LOCAL_SETTING).toString().isEmpty()) { QHttpPart devices; devices.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant(QLatin1String("form-data; name=\"device\""))); - devices.setBody(value(QLatin1String("Devices"), LOCAL_SETTING).toString().toUtf8().constData()); + devices.setBody(settingsValue(QLatin1String("Devices"), LOCAL_SETTING).toString().toUtf8().constData()); mp->append(devices); } @@ -118,9 +118,9 @@ void Pushover::slotNotify(Notification notification) bool Pushover::initialize() { - setDefaultValue(QLatin1String("UserKey"), QString()); - setDefaultValue(QLatin1String("Sound"), QLatin1String("pushover"), LOCAL_SETTING); - setDefaultValue(QLatin1String("Devices"), QString(), LOCAL_SETTING); + setDefaultSettingsValue(QLatin1String("UserKey"), QString()); + setDefaultSettingsValue(QLatin1String("Sound"), QLatin1String("pushover"), LOCAL_SETTING); + setDefaultSettingsValue(QLatin1String("Devices"), QString(), LOCAL_SETTING); return SnoreSecondaryBackend::initialize(); } diff --git a/src/plugins/secondary_backends/pushover/pushoversettings.cpp b/src/plugins/secondary_backends/pushover/pushoversettings.cpp index 7b435a6..7782252 100644 --- a/src/plugins/secondary_backends/pushover/pushoversettings.cpp +++ b/src/plugins/secondary_backends/pushover/pushoversettings.cpp @@ -38,14 +38,14 @@ PushoverSettings::~PushoverSettings() void PushoverSettings::load() { - m_keyLineEdit->setText(value(QLatin1String("UserKey")).toString()); - m_soundLineEdit->setText(value(QLatin1String("Sound"), Snore::LOCAL_SETTING).toString()); - m_deviceLineEdit->setText(value(QLatin1String("Devices"), Snore::LOCAL_SETTING).toString()); + m_keyLineEdit->setText(settingsValue(QLatin1String("UserKey")).toString()); + m_soundLineEdit->setText(settingsValue(QLatin1String("Sound"), Snore::LOCAL_SETTING).toString()); + m_deviceLineEdit->setText(settingsValue(QLatin1String("Devices"), Snore::LOCAL_SETTING).toString()); } void PushoverSettings::save() { - setValue(QLatin1String("UserKey"), m_keyLineEdit->text()); - setValue(QLatin1String("Sound"), m_soundLineEdit->text(), Snore::LOCAL_SETTING); - setValue(QLatin1String("Devices"), m_deviceLineEdit->text(), Snore::LOCAL_SETTING); + setSettingsValue(QLatin1String("UserKey"), m_keyLineEdit->text()); + setSettingsValue(QLatin1String("Sound"), m_soundLineEdit->text(), Snore::LOCAL_SETTING); + setSettingsValue(QLatin1String("Devices"), m_deviceLineEdit->text(), Snore::LOCAL_SETTING); } diff --git a/src/plugins/secondary_backends/sound/sound.cpp b/src/plugins/secondary_backends/sound/sound.cpp index 9b8ef67..d960e76 100644 --- a/src/plugins/secondary_backends/sound/sound.cpp +++ b/src/plugins/secondary_backends/sound/sound.cpp @@ -36,8 +36,8 @@ Sound::Sound(): bool Sound::initialize() { - setDefaultValue(QLatin1String("Volume"), 50); - m_player->setVolume(value(QLatin1String("Volume")).toInt()); + setDefaultSettingsValue(QLatin1String("Volume"), 50); + m_player->setVolume(settingsValue(QLatin1String("Volume")).toInt()); return SnoreSecondaryBackend::initialize(); } @@ -55,7 +55,7 @@ void Sound::slotNotificationDisplayed(Snore::Notification notification) QString sound = notification.hints().value("sound").toString(); if (sound.isEmpty()) { - sound = value(QLatin1String("Sound")).toString(); + sound = settingsValue(QLatin1String("Sound")).toString(); } snoreDebug(SNORE_DEBUG) << "SoundFile:" << sound; if (!sound.isEmpty()) { diff --git a/src/plugins/secondary_backends/sound/soundsettings.cpp b/src/plugins/secondary_backends/sound/soundsettings.cpp index 2a73609..fe1e7b1 100644 --- a/src/plugins/secondary_backends/sound/soundsettings.cpp +++ b/src/plugins/secondary_backends/sound/soundsettings.cpp @@ -53,13 +53,13 @@ SoundSettings::~SoundSettings() void SoundSettings::load() { - m_lineEditFileName->setText(value(QLatin1String("Sound")).toString()); - m_spinBoxVolume->setValue(value(QLatin1String("Volume")).toInt()); + m_lineEditFileName->setText(settingsValue(QLatin1String("Sound")).toString()); + m_spinBoxVolume->setValue(settingsValue(QLatin1String("Volume")).toInt()); } void SoundSettings::save() { - setValue(QLatin1String("Sound"), m_lineEditFileName->text()); - setValue(QLatin1String("Volume"), m_spinBoxVolume->value()); + setSettingsValue(QLatin1String("Sound"), m_lineEditFileName->text()); + setSettingsValue(QLatin1String("Volume"), m_spinBoxVolume->value()); } diff --git a/src/plugins/secondary_backends/toasty/toasty.cpp b/src/plugins/secondary_backends/toasty/toasty.cpp index 8557dae..c17ee68 100644 --- a/src/plugins/secondary_backends/toasty/toasty.cpp +++ b/src/plugins/secondary_backends/toasty/toasty.cpp @@ -29,7 +29,7 @@ using namespace Snore; void Toasty::slotNotify(Notification notification) { - QString key = value(QLatin1String("DeviceID")).toString(); + QString key = settingsValue(QLatin1String("DeviceID")).toString(); if (key.isEmpty()) { return; } @@ -80,7 +80,7 @@ void Toasty::slotNotify(Notification notification) bool Toasty::initialize() { - setDefaultValue(QLatin1String("DeviceID"), QString()); + setDefaultSettingsValue(QLatin1String("DeviceID"), QString()); return SnoreSecondaryBackend::initialize(); } diff --git a/src/plugins/secondary_backends/toasty/toastysettings.cpp b/src/plugins/secondary_backends/toasty/toastysettings.cpp index 56d47f7..6b48a2f 100644 --- a/src/plugins/secondary_backends/toasty/toastysettings.cpp +++ b/src/plugins/secondary_backends/toasty/toastysettings.cpp @@ -34,10 +34,10 @@ ToastySettings::~ToastySettings() void ToastySettings::load() { - m_lineEdit->setText(value(QLatin1String("DeviceID")).toString()); + m_lineEdit->setText(settingsValue(QLatin1String("DeviceID")).toString()); } void ToastySettings::save() { - setValue(QLatin1String("DeviceID"), m_lineEdit->text()); + setSettingsValue(QLatin1String("DeviceID"), m_lineEdit->text()); }