Fix enum values

This commit is contained in:
Hannah von Reth 2015-12-03 15:04:45 +01:00
parent 28c1edb783
commit f90bc36fb7
28 changed files with 98 additions and 99 deletions

View File

@ -17,7 +17,7 @@ public:
{
SnoreCore &instance = SnoreCore::instance();
instance.loadPlugins(SnorePlugin::Backend);
instance.setSettingsValue(QStringLiteral("Timeout"), 5, LocalSettings);
instance.setSettingsValue(QStringLiteral("Timeout"), 5, LocalSetting);
SnoreCore::instance().registerApplication(app);
}
@ -42,7 +42,7 @@ private:
QString old = snore.primaryNotificationBackend();
while (snore.primaryNotificationBackend() == old) {
QString p = backends.takeLast();
snore.setSettingsValue(QStringLiteral("PrimaryBackend"), p, LocalSettings);
snore.setSettingsValue(QStringLiteral("PrimaryBackend"), p, LocalSetting);
SnoreCorePrivate::instance()->syncSettings();
if (snore.primaryNotificationBackend() == p) {
qDebug() << p;

View File

@ -16,7 +16,7 @@ public:
{
SnoreCore &instance = SnoreCore::instance();
instance.loadPlugins(SnorePlugin::Backend);
instance.setSettingsValue(QStringLiteral("Timeout"), 1, LocalSettings);
instance.setSettingsValue(QStringLiteral("Timeout"), 1, LocalSetting);
}
// clazy is complaining about this string but QStringLiteral won't work for the multiline string, so use QStringBuilder to silence it.

View File

@ -36,7 +36,7 @@ ApplicationData::ApplicationData(const QString &key, const QString &name, const
m_hint.setValue("pushover-token", QLatin1String("aFB1TPCyZkkr7mubCGEKy5vJEWak9t"));
m_hint.setValue("use-markup", false);
m_hint.setValue("silent", QVariant::fromValue(LambdaHint([]() {
return SnoreCore::instance().settingsValue(QStringLiteral("Silent"), LocalSettings);
return SnoreCore::instance().settingsValue(QStringLiteral("Silent"), LocalSetting);
})));
}

View File

@ -21,7 +21,6 @@
#include "notification/icon.h"
#include "notification/notification_p.h"
#include "plugins/plugincontainer.h"
#include <Qt>
using namespace Snore;
@ -182,7 +181,7 @@ NotificationData *Notification::data()
int Notification::defaultTimeout()
{
return SnoreCore::instance().settingsValue(QStringLiteral("Timeout"), LocalSettings).toInt();
return SnoreCore::instance().settingsValue(QStringLiteral("Timeout"), LocalSetting).toInt();
}
QDataStream &operator<< (QDataStream &stream, const Notification &noti)

View File

@ -101,7 +101,7 @@ QString SnorePlugin::settingsVersion() const
void SnorePlugin::setDefaultSettings()
{
setDefaultSettingsValue(QStringLiteral("Enabled"), false, LocalSettings);
setDefaultSettingsValue(QStringLiteral("Enabled"), false, LocalSetting);
}
void SnorePlugin::setErrorString(const QString &_error)

View File

@ -132,9 +132,9 @@ public:
*/
QString errorString() const;
QVariant settingsValue(const QString &key, SettingsType type = GlobalSettings) const;
void setSettingsValue(const QString &key, const QVariant &settingsValue, SettingsType type = GlobalSettings);
void setDefaultSettingsValue(const QString &key, const QVariant &settingsValue, SettingsType type = GlobalSettings);
QVariant settingsValue(const QString &key, SettingsType type = GlobalSetting) const;
void setSettingsValue(const QString &key, const QVariant &settingsValue, SettingsType type = GlobalSetting);
void setDefaultSettingsValue(const QString &key, const QVariant &settingsValue, SettingsType type = GlobalSetting);
Q_SIGNALS:
void enabledChanged(bool enabled);

View File

@ -61,7 +61,7 @@ void PluginSettingsWidget::addRow(const QString &label, QWidget *widget, const Q
void PluginSettingsWidget::loadSettings()
{
if (m_snorePlugin->type() != SnorePlugin::Backend) {
m_enabled->setChecked(m_snorePlugin->settingsValue(QStringLiteral("Enabled"), LocalSettings).toBool());
m_enabled->setChecked(m_snorePlugin->settingsValue(QStringLiteral("Enabled"), LocalSetting).toBool());
}
load();
}
@ -69,7 +69,7 @@ void PluginSettingsWidget::loadSettings()
void PluginSettingsWidget::saveSettings()
{
if (m_snorePlugin->type() != SnorePlugin::Backend) {
m_snorePlugin->setSettingsValue(QStringLiteral("Enabled"), m_enabled->isChecked(), LocalSettings);
m_snorePlugin->setSettingsValue(QStringLiteral("Enabled"), m_enabled->isChecked(), LocalSetting);
}
save();
}

View File

@ -46,8 +46,8 @@ public:
bool isDirty();
protected:
QVariant settingsValue(const QString &key, Snore::SettingsType type = Snore::GlobalSettings) const;
void setSettingsValue(const QString &key, const QVariant &settingsValue, Snore::SettingsType type = Snore::GlobalSettings);
QVariant settingsValue(const QString &key, Snore::SettingsType type = Snore::GlobalSetting) const;
void setSettingsValue(const QString &key, const QVariant &settingsValue, Snore::SettingsType type = Snore::GlobalSetting);
virtual void load();
virtual void save();

View File

@ -42,7 +42,7 @@ SettingsDialog::~SettingsDialog()
void SettingsDialog::initTabs()
{
SnorePlugin::PluginTypes types = SnoreCore::instance().settingsValue(QStringLiteral("PluginTypes"), LocalSettings).value<SnorePlugin::PluginTypes>();
SnorePlugin::PluginTypes types = SnoreCore::instance().settingsValue(QStringLiteral("PluginTypes"), LocalSetting).value<SnorePlugin::PluginTypes>();
if (types == SnorePlugin::None) {
types = SnorePlugin::All;
}
@ -90,9 +90,9 @@ void SettingsDialog::on_pushButton_clicked()
void SettingsDialog::load()
{
qCDebug(SNORE) << "loading";
loadPrimaryBackendBox(SnoreCore::instance().settingsValue(QStringLiteral("PrimaryBackend"), LocalSettings).toString());
ui->timeoutSpinBox->setValue(SnoreCore::instance().settingsValue(QStringLiteral("Timeout"), LocalSettings).toInt());
ui->disableNotificationSoundCheckBox->setChecked(SnoreCore::instance().settingsValue(QStringLiteral("Silent"), LocalSettings).toBool());
loadPrimaryBackendBox(SnoreCore::instance().settingsValue(QStringLiteral("PrimaryBackend"), LocalSetting).toString());
ui->timeoutSpinBox->setValue(SnoreCore::instance().settingsValue(QStringLiteral("Timeout"), LocalSetting).toInt());
ui->disableNotificationSoundCheckBox->setChecked(SnoreCore::instance().settingsValue(QStringLiteral("Silent"), LocalSetting).toBool());
foreach(auto widget, m_tabs) {
widget->loadSettings();
}
@ -100,7 +100,7 @@ void SettingsDialog::load()
void SettingsDialog::loadPrimaryBackendBox(const QString &backend)
{
if (SnoreCore::instance().settingsValue(QStringLiteral("PluginTypes"), LocalSettings).value<SnorePlugin::PluginTypes>() & SnorePlugin::Backend) {
if (SnoreCore::instance().settingsValue(QStringLiteral("PluginTypes"), LocalSetting).value<SnorePlugin::PluginTypes>() & SnorePlugin::Backend) {
ui->primaryBackendComboBox->clear();
QStringList list = SnoreCore::instance().pluginNames(SnorePlugin::Backend);
ui->primaryBackendComboBox->addItems(list);
@ -121,13 +121,13 @@ void SettingsDialog::save()
w->saveSettings();
dirty |= w->isDirty();
}
dirty |= SnoreCore::instance().settingsValue(QStringLiteral("PrimaryBackend"), LocalSettings).toString() != ui->primaryBackendComboBox->currentText();
dirty |= SnoreCore::instance().settingsValue(QStringLiteral("Timeout"), LocalSettings).toInt() != ui->timeoutSpinBox->value();
dirty |= SnoreCore::instance().settingsValue(QStringLiteral("Silent"), LocalSettings).toBool() != ui->disableNotificationSoundCheckBox->isChecked();
dirty |= SnoreCore::instance().settingsValue(QStringLiteral("PrimaryBackend"), LocalSetting).toString() != ui->primaryBackendComboBox->currentText();
dirty |= SnoreCore::instance().settingsValue(QStringLiteral("Timeout"), LocalSetting).toInt() != ui->timeoutSpinBox->value();
dirty |= SnoreCore::instance().settingsValue(QStringLiteral("Silent"), LocalSetting).toBool() != ui->disableNotificationSoundCheckBox->isChecked();
SnoreCore::instance().setSettingsValue(QStringLiteral("PrimaryBackend"), ui->primaryBackendComboBox->currentText(), LocalSettings);
SnoreCore::instance().setSettingsValue(QStringLiteral("Timeout"), ui->timeoutSpinBox->value(), LocalSettings);
SnoreCore::instance().setSettingsValue(QStringLiteral("Silent"), ui->disableNotificationSoundCheckBox->isChecked(), LocalSettings);
SnoreCore::instance().setSettingsValue(QStringLiteral("PrimaryBackend"), ui->primaryBackendComboBox->currentText(), LocalSetting);
SnoreCore::instance().setSettingsValue(QStringLiteral("Timeout"), ui->timeoutSpinBox->value(), LocalSetting);
SnoreCore::instance().setSettingsValue(QStringLiteral("Silent"), ui->disableNotificationSoundCheckBox->isChecked(), LocalSetting);
if (dirty) {
SnoreCorePrivate::instance()->syncSettings();

View File

@ -74,7 +74,7 @@ void SnoreCore::loadPlugins(SnorePlugin::PluginTypes types)
return;
}
Q_D(SnoreCore);
setSettingsValue(QStringLiteral("PluginTypes"), QVariant::fromValue(types), LocalSettings);
setSettingsValue(QStringLiteral("PluginTypes"), QVariant::fromValue(types), LocalSetting);
qCDebug(SNORE) << "Loading plugin types:" << types;
foreach(const SnorePlugin::PluginTypes type, SnorePlugin::types()) {
if (type != SnorePlugin::All && types & type) {
@ -91,7 +91,7 @@ void SnoreCore::loadPlugins(SnorePlugin::PluginTypes types)
case SnorePlugin::Frontend:
case SnorePlugin::Plugin:
case SnorePlugin::Settings:
plugin->setEnabled(plugin->settingsValue(QStringLiteral("Enabled"), LocalSettings).toBool());
plugin->setEnabled(plugin->settingsValue(QStringLiteral("Enabled"), LocalSetting).toBool());
break;
default:
qCWarning(SNORE) << "Plugin Cache corrupted\n" << info->file() << info->type();
@ -213,7 +213,7 @@ QVariant SnoreCore::settingsValue(const QString &key, SettingsType type) const
{
Q_D(const SnoreCore);
QString nk = d->normalizeSettingsKey(key, type);
if (type == LocalSettings && !d->m_settings->contains(nk)) {
if (type == LocalSetting && !d->m_settings->contains(nk)) {
nk = d->normalizeSettingsKey(key + QStringLiteral("-SnoreDefault"), type);
}
return d->m_settings->value(nk);

View File

@ -138,9 +138,9 @@ public:
*/
void setDefaultApplication(Application app);
QVariant settingsValue(const QString &key, SettingsType type = GlobalSettings) const;
void setSettingsValue(const QString &key, const QVariant &settingsValue, SettingsType type = GlobalSettings);
void setDefaultSettingsValue(const QString &key, const QVariant &settingsValue, SettingsType type = GlobalSettings);
QVariant settingsValue(const QString &key, SettingsType type = GlobalSetting) const;
void setSettingsValue(const QString &key, const QVariant &settingsValue, SettingsType type = GlobalSetting);
void setDefaultSettingsValue(const QString &key, const QVariant &settingsValue, SettingsType type = GlobalSetting);
Notification getActiveNotificationByID(uint id) const;

View File

@ -52,7 +52,7 @@ SnoreCorePrivate::SnoreCorePrivate():
qCDebug(SNORE) << "Temp dir is" << tempPath();
qCDebug(SNORE) << "Snore settings are located in" << m_settings->fileName();
qCDebug(SNORE) << "Snore local settings are located in" << normalizeSettingsKey(QStringLiteral("Test"), LocalSettings);
qCDebug(SNORE) << "Snore local settings are located in" << normalizeSettingsKey(QStringLiteral("Test"), LocalSetting);
connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(slotAboutToQuit()));
}
@ -107,7 +107,7 @@ bool SnoreCorePrivate::setBackendIfAvailible(const QString &backend)
}
m_notificationBackend = b;
m_notificationBackend->enable();
q->setSettingsValue(QStringLiteral("PrimaryBackend"), backend, LocalSettings);
q->setSettingsValue(QStringLiteral("PrimaryBackend"), backend, LocalSetting);
connect(b, &SnoreBackend::error, [this, b](const QString &) {
slotInitPrimaryNotificationBackend();
@ -121,8 +121,8 @@ bool SnoreCorePrivate::setBackendIfAvailible(const QString &backend)
bool SnoreCorePrivate::slotInitPrimaryNotificationBackend()
{
Q_Q(SnoreCore);
qCDebug(SNORE) << q->settingsValue(QStringLiteral("PrimaryBackend"), LocalSettings).toString();
if (setBackendIfAvailible(q->settingsValue(QStringLiteral("PrimaryBackend"), LocalSettings).toString())) {
qCDebug(SNORE) << q->settingsValue(QStringLiteral("PrimaryBackend"), LocalSetting).toString();
if (setBackendIfAvailible(q->settingsValue(QStringLiteral("PrimaryBackend"), LocalSetting).toString())) {
return true;
}
#ifdef Q_OS_WIN
@ -162,7 +162,7 @@ void SnoreCorePrivate::init()
void SnoreCorePrivate::setDefaultSettingsValueIntern(const QString &key, const QVariant &value)
{
QString nk = normalizeSettingsKey(key + QLatin1String("-SnoreDefault"), LocalSettings);
QString nk = normalizeSettingsKey(key + QLatin1String("-SnoreDefault"), LocalSetting);
if (!m_settings->contains(nk)) {
m_settings->setValue(nk, value);
}
@ -171,7 +171,7 @@ void SnoreCorePrivate::setDefaultSettingsValueIntern(const QString &key, const Q
void SnoreCorePrivate::syncSettings()
{
Q_Q(SnoreCore);
QString newBackend = q->settingsValue(QStringLiteral("PrimaryBackend"), LocalSettings).toString();
QString newBackend = q->settingsValue(QStringLiteral("PrimaryBackend"), LocalSetting).toString();
if (!newBackend.isEmpty()) {
QString oldBackend;
if (m_notificationBackend) {
@ -180,7 +180,7 @@ void SnoreCorePrivate::syncSettings()
m_notificationBackend = nullptr;
}
if (!setBackendIfAvailible(newBackend)) {
qCWarning(SNORE) << "Failed to set new backend" << q->settingsValue(QStringLiteral("PrimaryBackend"), LocalSettings).toString() << "restoring" << oldBackend;
qCWarning(SNORE) << "Failed to set new backend" << q->settingsValue(QStringLiteral("PrimaryBackend"), LocalSetting).toString() << "restoring" << oldBackend;
setBackendIfAvailible(oldBackend);
}
}
@ -191,7 +191,7 @@ void SnoreCorePrivate::syncSettings()
foreach(auto & pluginName, m_pluginNames[type]) {
auto key = qMakePair(type, pluginName);
SnorePlugin *plugin = m_plugins.value(key);
bool enable = m_plugins[key]->settingsValue(QStringLiteral("Enabled"), LocalSettings).toBool();
bool enable = m_plugins[key]->settingsValue(QStringLiteral("Enabled"), LocalSetting).toBool();
plugin->setEnabled(enable);
}
}

View File

@ -27,8 +27,8 @@ namespace Snore
{
enum SettingsType {
GlobalSettings,
LocalSettings
GlobalSetting,
LocalSetting
};
}

View File

@ -121,7 +121,7 @@ public:
*/
static inline QString normalizeSettingsKey(const QString &key, SettingsType type, const QString &application)
{
if (type == LocalSettings) {
if (type == LocalSetting) {
return settingsVersionSchema() + QLatin1String("/LocalSettings/") + application + QLatin1Char('/') + key;
} else {
return settingsVersionSchema() + QLatin1String("/GlobalSettings/") + key;

View File

@ -39,17 +39,17 @@ GrowlBackend::GrowlBackend()
{
return;
}
Notification::CloseReasons r = Notification::NONE;
Notification::CloseReasons r = Notification::None;
std::string reason(data->reason);
if (reason == "TIMEDOUT")
{
r = Notification::TIMED_OUT;
r = Notification::TimedOut;
} else if (reason == "CLOSED")
{
r = Notification::DISMISSED;
r = Notification::Dismissed;
} else if (reason == "CLICK")
{
r = Notification::ACTIVATED;
r = Notification::Activated;
s_instance->slotNotificationActionInvoked(n);
}
s_instance->closeNotification(n, r);

View File

@ -76,7 +76,7 @@ BOOL installNSBundleHook()
return;
}
auto snoreNotification = m_IdToNotification.take(notificationId);
snoreNotification.data()->setCloseReason(Notification::ACTIVATED);
snoreNotification.data()->setCloseReason(Notification::Activated);
emitNotificationClicked(snoreNotification);
}
@end

View File

@ -69,22 +69,22 @@ public:
Notification::CloseReasons reason = Notification::NONE;
switch (action) {
case SnarlEnums::CallbackInvoked:
reason = Notification::ACTIVATED;
reason = Notification::Activated;
qCDebug(SNORE) << "Notification clicked";
break;
case SnarlEnums::NotifyAction:
reason = Notification::ACTIVATED;
reason = Notification::Activated;
qCDebug(SNORE) << "Notification action invoked";
if (notification.isValid()) {
m_snarl->slotNotificationActionInvoked(notification, notification.actions().value(data));
}
break;
case SnarlEnums::CallbackClosed:
reason = Notification::DISMISSED;
reason = Notification::Dismissed;
qCDebug(SNORE) << "Notification dismissed";
break;
case SnarlEnums::CallbackTimedOut:
reason = Notification::TIMED_OUT;
reason = Notification::TimedOut;
qCDebug(SNORE) << "Notification timed out";
break;
//away stuff

View File

@ -51,21 +51,21 @@ void SnoreToast::slotNotify(Notification notification)
qCDebug(SNORE) << "SnoreToast" << arguements;
connect(p, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished), [this, notification](int code) {
Notification::CloseReasons reason = Notification::NONE;
Notification::CloseReasons reason = Notification::None;
switch (code) {
case 0:
reason = Notification::ACTIVATED;
reason = Notification::Activated;
slotNotificationActionInvoked(notification);
break;
case 1:
//hidden;
break;
case 2:
reason = Notification::DISMISSED;
reason = Notification::Dismissed;
break;
case 3:
reason = Notification::TIMED_OUT;
reason = Notification::TimedOut;
break;
case -1:
//failed
@ -127,7 +127,7 @@ QProcess *SnoreToast::createProcess(Notification noti)
setErrorString(name() + p->errorString());
qCDebug(SNORE) << p->readAll();
if (noti.isValid()) {
closeNotification(noti, Notification::NONE);
closeNotification(noti, Notification::None);
}
p->deleteLater();
});

View File

@ -27,7 +27,7 @@ void TrayIconNotifer::slotNotify(Notification notification)
m_notificationQue.append(notification);
displayNotification(icon);
} else {
closeNotification(notification, Notification::CLOSED);
closeNotification(notification, Notification::Closed);
setErrorString(QLatin1String("No tray-icon hint provided for ") + notification.application().name());
}
}
@ -89,7 +89,7 @@ void TrayIconNotifer::actionInvoked()
QSystemTrayIcon *icon = trayIcon(n.application());
if (icon && n.isValid()) {
slotNotificationActionInvoked(n);
closeNotification(n, Notification::ACTIVATED);
closeNotification(n, Notification::Activated);
m_currentlyDisplaying = false;
displayNotification(icon);
}

View File

@ -73,7 +73,7 @@ uint FreedesktopFrontend::Notify(const QString &app_name, uint replaces_id,
const QStringList &actions, const QVariantMap &hints, int timeout)
{
Application app;
Notification::Prioritys priotity = Notification::NORMAL;
Notification::Prioritys priotity = Notification::Normal;
if (!SnoreCore::instance().aplications().contains(app_name)) {
Icon appIcon(QIcon::fromTheme(app_icon, QIcon(QStringLiteral(":/root/snore.png"))));
@ -116,19 +116,19 @@ void FreedesktopFrontend::CloseNotification(uint id)
{
Notification noti = SnoreCore::instance().getActiveNotificationByID(id);
if (noti.isValid()) {
SnoreCore::instance().requestCloseNotification(noti, Notification::TIMED_OUT);
SnoreCore::instance().requestCloseNotification(noti, Notification::TimedOut);
}
}
QStringList FreedesktopFrontend::GetCapabilities()
{
return QStringList()
<< QStringLiteral("body")
<< QStringLiteral("urgency")
<< QStringLiteral("body-hyperlinks")
<< QStringLiteral("body-markup")
<< QStringLiteral("icon-static")
<< QStringLiteral("actions");
return QStringList({ QStringLiteral("body"),
QStringLiteral("urgency"),
QStringLiteral("body-hyperlinks"),
QStringLiteral("body-markup"),
QStringLiteral("icon-static"),
QStringLiteral("actions")
});
}
QString FreedesktopFrontend::GetServerInformation(QString &vendor, QString &version, QString &specVersion)

View File

@ -52,7 +52,7 @@ PushoverFrontend::PushoverFrontend()
void PushoverFrontend::login(const QString &email, const QString &password, const QString &deviceName)
{
setSettingsValue(QStringLiteral("DeviceName"), deviceName, Snore::LOCAL_SETTING);
setSettingsValue(QStringLiteral("DeviceName"), deviceName, Snore::LocalSetting);
QNetworkRequest request(QUrl(QStringLiteral("https://api.pushover.net/1/users/login.json")));
@ -78,8 +78,8 @@ void PushoverFrontend::login(const QString &email, const QString &password, cons
void PushoverFrontend::logOut()
{
setSettingsValue(QStringLiteral("Secret"), QString(), LOCAL_SETTING);
setSettingsValue(QStringLiteral("DeviceID"), QString(), LOCAL_SETTING);
setSettingsValue(QStringLiteral("Secret"), QString(), LocalSetting);
setSettingsValue(QStringLiteral("DeviceID"), QString(), LocalSetting);
m_socket->close();
m_socket->deleteLater();
emit loggedInChanged(false);
@ -97,14 +97,14 @@ QString PushoverFrontend::errorMessage()
void PushoverFrontend::setDefaultSettings()
{
setDefaultSettingsValue(QStringLiteral("Secret"), QString(), LOCAL_SETTING);
setDefaultSettingsValue(QStringLiteral("DeviceID"), QString(), LOCAL_SETTING);
setDefaultSettingsValue(QStringLiteral("Secret"), QString(), LocalSetting);
setDefaultSettingsValue(QStringLiteral("DeviceID"), QString(), LocalSetting);
SnoreFrontend::setDefaultSettings();
}
void PushoverFrontend::slotActionInvoked(Notification notification)
{
if (notification.priority() == Notification::EMERGENCY) {
if (notification.priority() == Notification::Emergency) {
qCWarning(SNORE) << "emergeency notification" << notification;
acknowledgeNotification(notification);
}
@ -112,12 +112,12 @@ void PushoverFrontend::slotActionInvoked(Notification notification)
QString PushoverFrontend::secret()
{
return settingsValue(QStringLiteral("Secret"), LOCAL_SETTING).toString();
return settingsValue(QStringLiteral("Secret"), LocalSetting).toString();
}
QString PushoverFrontend::device()
{
return settingsValue(QStringLiteral("DeviceID"), LOCAL_SETTING).toString();
return settingsValue(QStringLiteral("DeviceID"), LocalSetting).toString();
}
void PushoverFrontend::connectToService()
@ -195,8 +195,8 @@ void PushoverFrontend::registerDevice(const QString &secret, const QString &devi
reply->deleteLater();
QJsonObject message = QJsonDocument::fromJson(input).object();
if (message.value(QStringLiteral("status")).toInt() == 1) {
setSettingsValue(QStringLiteral("Secret"), secret, LOCAL_SETTING);
setSettingsValue(QStringLiteral("DeviceID"), message.value(QStringLiteral("id")).toString(), LOCAL_SETTING);;
setSettingsValue(QStringLiteral("Secret"), secret, LocalSetting);
setSettingsValue(QStringLiteral("DeviceID"), message.value(QStringLiteral("id")).toString(), LocalSetting);;
connectToService();
} else {
qCWarning(SNORE) << "An error occure" << input;
@ -247,7 +247,7 @@ void PushoverFrontend::getMessages()
notification.value(QStringLiteral("message")).toString(),
app.icon(), Notification::defaultTimeout(),
static_cast<Notification::Prioritys>(notification.value(QStringLiteral("priority")).toInt()));
if (n.priority() == Notification::EMERGENCY) {
if (n.priority() == Notification::Emergency) {
n.hints().setValue("receipt", notification.value(QStringLiteral("receipt")).toString());
n.hints().setValue("acked", notification.value(QStringLiteral("acked")).toInt());
}

View File

@ -74,7 +74,7 @@ PushoverSettings::~PushoverSettings()
void PushoverSettings::load()
{
m_deviceLineEdit->setText(settingsValue(QStringLiteral("DeviceName"), Snore::LOCAL_SETTING).toString());
m_deviceLineEdit->setText(settingsValue(QStringLiteral("DeviceName"), Snore::LocalSetting).toString());
}
void PushoverSettings::save()

View File

@ -62,13 +62,13 @@ void SnarlNetworkFrontend::slotNotificationClosed(Snore::Notification notificati
if (notification.removeActiveIn(this)) {
switch (notification.closeReason()) {
case Notification::TIMED_OUT:
case Notification::TimedOut:
callback(notification, QStringLiteral("SNP/1.1/303/Notification timed out/"));
break;
case Notification::ACTIVATED:
case Notification::Activated:
callback(notification, QStringLiteral("SNP/1.1/307/Notification closed/"));
break;
case Notification::DISMISSED:
case Notification::Dismissed:
callback(notification, QStringLiteral("SNP/1.1/302/Notification cancelled/"));
break;
default:

View File

@ -41,8 +41,8 @@ void NotifyMyAndroid::slotNotify(Notification notification)
+ QLatin1String("&description=");
if (notification.constHints().value("supports-markup").toBool()) {
data += notification.text(Utils::HREF | Utils::BOLD | Utils::BREAK |
Utils::UNDERLINE | Utils::FONT | Utils::ITALIC)
data += notification.text(Utils::Href | Utils::Bold | Utils::Break |
Utils::Underline | Utils::Font | Utils::Italic)
+ QLatin1String("&content-type=text/html");
} else {
data += notification.text();

View File

@ -47,7 +47,7 @@ void Pushover::slotNotify(Notification notification)
QString textString;
if (notification.constHints().value("use-markup").toBool()) {
textString = notification.text(Utils::HREF | Utils::BOLD | Utils::UNDERLINE | Utils::FONT | Utils::ITALIC);
textString = notification.text(Utils::Href | Utils::Bold | Utils::Underline | Utils::Font | Utils::Italic);
QHttpPart html;
html.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant(QLatin1String("form-data; name=\"html\"")));
@ -68,7 +68,7 @@ void Pushover::slotNotify(Notification notification)
priority.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant(QLatin1String("form-data; name=\"priority\"")));
priority.setBody(QString::number(notification.priority()).toUtf8().constData());
mp->append(priority);
if (notification.priority() == Notification::EMERGENCY) {
if (notification.priority() == Notification::Emergency) {
QHttpPart retry;
retry.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant(QLatin1String("form-data; name=\"retry\"")));
@ -86,14 +86,14 @@ void Pushover::slotNotify(Notification notification)
if (notification.hints().value("silent").toBool()) {
sound.setBody("none");
} else {
sound.setBody(settingsValue(QStringLiteral("Sound"), LOCAL_SETTING).toString().toUtf8().constData());
sound.setBody(settingsValue(QStringLiteral("Sound"), LocalSetting).toString().toUtf8().constData());
}
mp->append(sound);
if (!settingsValue(QStringLiteral("Devices"), LOCAL_SETTING).toString().isEmpty()) {
if (!settingsValue(QStringLiteral("Devices"), LocalSetting).toString().isEmpty()) {
QHttpPart devices;
devices.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant(QLatin1String("form-data; name=\"device\"")));
devices.setBody(settingsValue(QStringLiteral("Devices"), LOCAL_SETTING).toString().toUtf8().constData());
devices.setBody(settingsValue(QStringLiteral("Devices"), LocalSetting).toString().toUtf8().constData());
mp->append(devices);
}
@ -122,7 +122,7 @@ void Pushover::slotNotify(Notification notification)
void Pushover::setDefaultSettings()
{
setDefaultSettingsValue(QStringLiteral("UserKey"), QString());
setDefaultSettingsValue(QStringLiteral("Sound"), QLatin1String("pushover"), LOCAL_SETTING);
setDefaultSettingsValue(QStringLiteral("Devices"), QString(), LOCAL_SETTING);
setDefaultSettingsValue(QStringLiteral("Sound"), QLatin1String("pushover"), LocalSetting);
setDefaultSettingsValue(QStringLiteral("Devices"), QString(), LocalSetting);
SnoreSecondaryBackend::setDefaultSettings();
}

View File

@ -41,13 +41,13 @@ PushoverSettings::~PushoverSettings()
void PushoverSettings::load()
{
m_keyLineEdit->setText(settingsValue(QStringLiteral("UserKey")).toString());
m_soundLineEdit->setText(settingsValue(QStringLiteral("Sound"), Snore::LOCAL_SETTING).toString());
m_deviceLineEdit->setText(settingsValue(QStringLiteral("Devices"), Snore::LOCAL_SETTING).toString());
m_soundLineEdit->setText(settingsValue(QStringLiteral("Sound"), Snore::LocalSetting).toString());
m_deviceLineEdit->setText(settingsValue(QStringLiteral("Devices"), Snore::LocalSetting).toString());
}
void PushoverSettings::save()
{
setSettingsValue(QStringLiteral("UserKey"), m_keyLineEdit->text());
setSettingsValue(QStringLiteral("Sound"), m_soundLineEdit->text(), Snore::LOCAL_SETTING);
setSettingsValue(QStringLiteral("Devices"), m_deviceLineEdit->text(), Snore::LOCAL_SETTING);
setSettingsValue(QStringLiteral("Sound"), m_soundLineEdit->text(), Snore::LocalSetting);
setSettingsValue(QStringLiteral("Devices"), m_deviceLineEdit->text(), Snore::LocalSetting);
}

View File

@ -38,6 +38,6 @@ private:
};
SNORE_DECLARE_SETTINGS_PLUGIN(ToastySettings);
SNORE_DECLARE_SETTINGS_PLUGIN(ToastySettings)
#endif // TOASTYSETTINGS_H

View File

@ -108,9 +108,9 @@ int main(int argc, char *argv[])
QString appName = parser.value(appNameCommand);
SettingsType type = GlobalSettings;
if (appName != QStringLiteral("global")) {
type = LocalSettings;
SettingsType type = GlobalSetting;
if (appName != QLatin1String("global")) {
type = LocalSetting;
}
if (parser.isSet(listAppsCommand)) {