From 09620f66f071dbe32d88215827e248fde9da795a Mon Sep 17 00:00:00 2001 From: Patrick von Reth Date: Fri, 3 Jul 2015 11:43:18 +0200 Subject: [PATCH] style fixes, kde-dev-scripts/astyle-kdelibs --- autotest/snorebenchmark.cpp | 55 ++++++------ src/libsnore/application.cpp | 2 +- src/libsnore/hint.cpp | 22 ++--- src/libsnore/hint.h | 16 ++-- src/libsnore/log.cpp | 4 +- src/libsnore/notification/notification_p.cpp | 4 +- src/libsnore/plugins/plugincontainer.cpp | 10 +-- src/libsnore/plugins/plugincontainer.h | 4 +- src/libsnore/plugins/plugins.h | 1 - src/libsnore/plugins/snorebackend.h | 1 - src/libsnore/snore.cpp | 13 ++- src/libsnore/snore_p.cpp | 8 +- src/libsnore/utils.cpp | 84 +++++++++---------- src/libsnore/utils.h | 4 +- .../freedesktop/fredesktopnotification.cpp | 1 - .../freedesktopnotification_backend.cpp | 16 ++-- src/plugins/backends/growl/growlbackend.cpp | 7 +- src/plugins/backends/snarl/snarl.cpp | 12 +-- src/plugins/backends/snore/snorenotifier.cpp | 4 +- .../backends/snoretoast/snoretoast.cpp | 2 +- .../backends/trayicon/trayiconnotifer.cpp | 1 - .../freedesktopnotificationfrontend.cpp | 4 +- .../frontends/pushover/pushover_frontend.cpp | 71 +++++++--------- .../frontends/pushover/pushover_frontend.h | 6 +- .../frontends/pushover/pushoversettings.cpp | 12 +-- .../frontends/pushover/pushoversettings.h | 1 - src/plugins/frontends/snarlnetwork/parser.cpp | 2 +- .../frontends/snarlnetwork/snarlnetwork.cpp | 6 +- src/plugins/secondary_backends/nma/nma.cpp | 14 ++-- .../secondary_backends/pushover/pushover.cpp | 4 +- src/settings/main.cpp | 6 +- 31 files changed, 183 insertions(+), 214 deletions(-) diff --git a/autotest/snorebenchmark.cpp b/autotest/snorebenchmark.cpp index dc59496..69a6c87 100644 --- a/autotest/snorebenchmark.cpp +++ b/autotest/snorebenchmark.cpp @@ -11,47 +11,46 @@ using namespace Snore; - -class SnoreBenchmark : public QObject{ +class SnoreBenchmark : public QObject +{ Q_OBJECT public: - SnoreBenchmark(){ + SnoreBenchmark() + { SnoreCore::instance(); } - QString htmlTestString = QLatin1String("Italic A
" - "Italic B
" - "Bold
" - "Underline
" - "Font
" - "<&>
" - "Website
"); + "Italic B
" + "Bold
" + "Underline
" + "Font
" + "<&>
" + "Website
"); private Q_SLOTS: -void benchmarkUtilsToHtml(); -void benchmarkUtilsToHtmlAllMarkup(); -void benchmarkUtilsToPlain(); + void benchmarkUtilsToHtml(); + void benchmarkUtilsToHtmlAllMarkup(); + void benchmarkUtilsToPlain(); }; - -void SnoreBenchmark::benchmarkUtilsToHtml(){ - +void SnoreBenchmark::benchmarkUtilsToHtml() +{ QCOMPARE(Utils::normalizeMarkup(htmlTestString, Utils::NO_MARKUP), QLatin1String("Italic A\n" - "Italic B\n" - "Bold\n" - "Underline\n" - "Font\n" - "<&>\n" - "Website\n")); + "Italic B\n" + "Bold\n" + "Underline\n" + "Font\n" + "<&>\n" + "Website\n")); QCOMPARE(Utils::normalizeMarkup(htmlTestString, Utils::HREF), QLatin1String("Italic A\n" - "Italic B\n" - "Bold\n" - "Underline\n" - "Font\n" - "<&>\n" - "Website\n")); + "Italic B\n" + "Bold\n" + "Underline\n" + "Font\n" + "<&>\n" + "Website\n")); QCOMPARE(Utils::normalizeMarkup(htmlTestString, Utils::HREF | Utils::BOLD | Utils::BREAK | Utils::UNDERLINE | Utils::FONT | Utils::ITALIC), htmlTestString); QBENCHMARK{ diff --git a/src/libsnore/application.cpp b/src/libsnore/application.cpp index cbe8909..20b4dc6 100644 --- a/src/libsnore/application.cpp +++ b/src/libsnore/application.cpp @@ -92,7 +92,7 @@ QDebug operator<< (QDebug debug, const Snore::Application &app) { if (app.isValid()) { debug << "Snore::Application(" << app.name() << ", "; - foreach(const Alert & a, app.alerts()) { + foreach (const Alert &a, app.alerts()) { debug << a << ", "; } debug << ")" ; diff --git a/src/libsnore/hint.cpp b/src/libsnore/hint.cpp index 8934bc8..c7c4071 100644 --- a/src/libsnore/hint.cpp +++ b/src/libsnore/hint.cpp @@ -24,7 +24,7 @@ Hint::Hint() { } -void Hint::setValue(const QByteArray & key, const QVariant &value) +void Hint::setValue(const QByteArray &key, const QVariant &value) { m_data.insert(key, value); } @@ -34,34 +34,34 @@ QVariant Hint::value(const QByteArray &key) const return m_data.value(key); } -QVariant Hint::take(const QByteArray & key) +QVariant Hint::take(const QByteArray &key) { return m_data.take(key); } -bool Hint::contains(const QByteArray & key) const +bool Hint::contains(const QByteArray &key) const { return m_data.contains(key); } -void Hint::setPrivateValue(const void *owner, const QByteArray & key, const QVariant &value) +void Hint::setPrivateValue(const void *owner, const QByteArray &key, const QVariant &value) { - m_privateData.insert(qMakePair((quintptr)owner,key), value); + m_privateData.insert(qMakePair((quintptr)owner, key), value); } QVariant Hint::privateValue(const void *owner, const QByteArray &key) const { - return m_privateData.value(qMakePair((quintptr)owner,key)); + return m_privateData.value(qMakePair((quintptr)owner, key)); } -bool Hint::containsPrivateValue(const void *owner, const QByteArray & key) const +bool Hint::containsPrivateValue(const void *owner, const QByteArray &key) const { - return m_privateData.contains(qMakePair((quintptr)owner,key)); + return m_privateData.contains(qMakePair((quintptr)owner, key)); } -QVariant Hint::takePrivateValue(const void *owner, const QByteArray & key) +QVariant Hint::takePrivateValue(const void *owner, const QByteArray &key) { - return m_privateData.take(qMakePair((quintptr)owner,key)); + return m_privateData.take(qMakePair((quintptr)owner, key)); } QDebug operator<<(QDebug debug, const Snore::Hint &hint) @@ -72,7 +72,7 @@ QDebug operator<<(QDebug debug, const Snore::Hint &hint) debug << "(" << it.key() << ", " << it.value(); } for (auto it = hint.m_privateData.cbegin(); it != hint.m_privateData.cend(); ++it) { - debug << ", "; + debug << ", "; debug << "(" << it.key() << ", " << it.value(); } debug << ")" ; diff --git a/src/libsnore/hint.h b/src/libsnore/hint.h index ec34fa3..0473134 100644 --- a/src/libsnore/hint.h +++ b/src/libsnore/hint.h @@ -48,28 +48,26 @@ public: * @param key the key * @param value the value */ - void setValue(const QByteArray & key, const QVariant &value); - + void setValue(const QByteArray &key, const QVariant &value); /** * The associated value of the key. * @param key the key */ - QVariant value(const QByteArray & key) const; - + QVariant value(const QByteArray &key) const; /** * The associated value of the key. * @param key the key */ - QVariant take(const QByteArray & key); + QVariant take(const QByteArray &key); /** * * @param key the key * @return whether the key is set */ - bool contains(const QByteArray & key) const; + bool contains(const QByteArray &key) const; /** * Sets the value for the key depending on the owner @@ -77,14 +75,14 @@ public: * @param key the key * @param value the value */ - void setPrivateValue(const void *owner, const QByteArray & key, const QVariant &value); + void setPrivateValue(const void *owner, const QByteArray &key, const QVariant &value); /** * The associated value of the key if present. * @param owner the owner * @param key the key */ - QVariant privateValue(const void *owner, const QByteArray & key) const; + QVariant privateValue(const void *owner, const QByteArray &key) const; /** * @@ -92,7 +90,7 @@ public: * @param key the key * @return whether the key is set */ - bool containsPrivateValue(const void *owner, const QByteArray & key) const; + bool containsPrivateValue(const void *owner, const QByteArray &key) const; /** * The associated value of the key if present. diff --git a/src/libsnore/log.cpp b/src/libsnore/log.cpp index be08961..8ba9cdb 100644 --- a/src/libsnore/log.cpp +++ b/src/libsnore/log.cpp @@ -37,8 +37,8 @@ static void init() if (qgetenv("LIBSNORE_LOG_TO_FILE").toInt() == 1) { QString name = QDir::tempPath() + QLatin1String("/libsnore/") + - (qApp->applicationName().isEmpty() ? QString::number(qApp->applicationPid()) : qApp->applicationName()) + - QLatin1String("-log.txt"); + (qApp->applicationName().isEmpty() ? QString::number(qApp->applicationPid()) : qApp->applicationName()) + + QLatin1String("-log.txt"); if (!qgetenv("LIBSNORE_LOGFILE").isNull()) { name = QString::fromUtf8(qgetenv("LIBSNORE_LOGFILE")); } else { diff --git a/src/libsnore/notification/notification_p.cpp b/src/libsnore/notification/notification_p.cpp index f1e7f9c..2cb594e 100644 --- a/src/libsnore/notification/notification_p.cpp +++ b/src/libsnore/notification/notification_p.cpp @@ -94,8 +94,8 @@ void NotificationData::setTimeoutTimer(QTimer *timer) QString NotificationData::resolveMarkup(const QString &string, Utils::MARKUP_FLAGS flags) { - if(!m_hints.value("use-markup").toBool()) { - if(flags == Utils::NO_MARKUP){ + if (!m_hints.value("use-markup").toBool()) { + if (flags == Utils::NO_MARKUP) { return string; } else { return Utils::normalizeMarkup(string.toHtmlEscaped(), flags); diff --git a/src/libsnore/plugins/plugincontainer.cpp b/src/libsnore/plugins/plugincontainer.cpp index 8d41df6..9c99fbf 100644 --- a/src/libsnore/plugins/plugincontainer.cpp +++ b/src/libsnore/plugins/plugincontainer.cpp @@ -87,15 +87,15 @@ void PluginContainer::updatePluginCache() { snoreDebug(SNORE_DEBUG) << "Updating plugin cache"; for (auto list : s_pluginCache) { - foreach(PluginContainer * p, list.values()) { + foreach (PluginContainer *p, list.values()) { delete p; } list.clear(); } - foreach(const SnorePlugin::PluginTypes type, SnorePlugin::types()) { - foreach(const QFileInfo & file, pluginDir().entryInfoList( - QStringList(pluginFileFilters(type)), QDir::Files)) { + foreach (const SnorePlugin::PluginTypes type, SnorePlugin::types()) { + foreach (const QFileInfo &file, pluginDir().entryInfoList( + QStringList(pluginFileFilters(type)), QDir::Files)) { snoreDebug(SNORE_DEBUG) << "adding" << file.absoluteFilePath(); QPluginLoader loader(file.absoluteFilePath()); QJsonObject data = loader.metaData()[QLatin1String("MetaData")].toObject(); @@ -152,7 +152,7 @@ const QDir &PluginContainer::pluginDir() << appDir + suffix << appDir + QLatin1String("/../lib/plugins") + suffix << appDir + QLatin1String("/../lib64/plugins") + suffix; - for(const QString & p : list) { + for (const QString &p : list) { path = QDir(p); if (!path.entryInfoList(pluginFileFilters()).isEmpty()) { diff --git a/src/libsnore/plugins/plugincontainer.h b/src/libsnore/plugins/plugincontainer.h index 87cb9d8..cd41295 100644 --- a/src/libsnore/plugins/plugincontainer.h +++ b/src/libsnore/plugins/plugincontainer.h @@ -68,7 +68,7 @@ private: static inline const QStringList pluginFileFilters() { QStringList out; - for(const QString &extention : pluginExtentions()) { + for (const QString &extention : pluginExtentions()) { out << QString(QLatin1String("libsnore_*.%1")).arg(extention); } return out; @@ -77,7 +77,7 @@ private: static inline const QStringList pluginFileFilters(Snore::SnorePlugin::PluginTypes type) { QStringList out; - for(const QString &extention : pluginExtentions()) { + for (const QString &extention : pluginExtentions()) { out << QString(QLatin1String("libsnore_%1_*.%2")).arg(SnorePlugin::typeToString(type).toLower(), extention); } return out; diff --git a/src/libsnore/plugins/plugins.h b/src/libsnore/plugins/plugins.h index d0b5543..bb5d9a5 100644 --- a/src/libsnore/plugins/plugins.h +++ b/src/libsnore/plugins/plugins.h @@ -53,7 +53,6 @@ public: SnorePlugin(); virtual ~SnorePlugin(); - // TODO: remove need of recursive calling of parent methode.... virtual bool initialize(); virtual bool deinitialize(); diff --git a/src/libsnore/plugins/snorebackend.h b/src/libsnore/plugins/snorebackend.h index d8a1f1c..e4a303e 100644 --- a/src/libsnore/plugins/snorebackend.h +++ b/src/libsnore/plugins/snorebackend.h @@ -57,7 +57,6 @@ protected Q_SLOTS: protected: void closeNotification(Snore::Notification, Snore::Notification::CloseReasons); - }; } diff --git a/src/libsnore/snore.cpp b/src/libsnore/snore.cpp index eb3e931..4d60229 100644 --- a/src/libsnore/snore.cpp +++ b/src/libsnore/snore.cpp @@ -46,7 +46,7 @@ SnoreCore::SnoreCore(QObject *parent): SnoreCore &SnoreCore::instance() { static SnoreCore *instance = nullptr; - if(!instance){ + if (!instance) { instance = new SnoreCore(qApp); SnoreCorePrivate::instance()->init(); } @@ -91,7 +91,7 @@ void SnoreCore::loadPlugins(SnorePlugin::PluginTypes types) } } } - break; + break; default: snoreDebug(SNORE_WARNING) << "Plugin Cache corrupted\n" << info->file() << info->type(); continue; @@ -207,8 +207,8 @@ QVariant SnoreCore::settingsValue(const QString &key, SettingsType type) const { Q_D(const SnoreCore); QString nk = d->normalizeSettingsKey(key, type); - if(type == LOCAL_SETTING && !d->m_settings->contains(nk)){ - nk = d->normalizeSettingsKey(key + QStringLiteral("-SnoreDefault"),type); + if (type == LOCAL_SETTING && !d->m_settings->contains(nk)) { + nk = d->normalizeSettingsKey(key + QStringLiteral("-SnoreDefault"), type); } return d->m_settings->value(nk); } @@ -235,13 +235,12 @@ Notification SnoreCore::getActiveNotificationByID(uint id) const return d->m_activeNotifications.value(id); } - void SnoreCore::displayExapleNotification() { Application app = SnoreCorePrivate::instance()->defaultApplication(); QString text = QLatin1String("") + tr("This is Snore") + QLatin1String("
") + - QLatin1String("") + tr("Project Website") + QLatin1String("
"); - if(!app.constHints().value("use-markup").toBool()) { + QLatin1String("") + tr("Project Website") + QLatin1String("
"); + if (!app.constHints().value("use-markup").toBool()) { text = Utils::normalizeMarkup(text, Utils::NO_MARKUP); } Notification noti(app, app.defaultAlert(), tr("Hello World"), text, app.icon()); diff --git a/src/libsnore/snore_p.cpp b/src/libsnore/snore_p.cpp index 96387aa..2946ad5 100644 --- a/src/libsnore/snore_p.cpp +++ b/src/libsnore/snore_p.cpp @@ -148,7 +148,7 @@ void SnoreCorePrivate::init() void SnoreCorePrivate::setDefaultSettingsValueIntern(const QString &key, const QVariant &value) { Q_Q(SnoreCore); - QString nk = normalizeSettingsKey( key + QLatin1String("-SnoreDefault"), LOCAL_SETTING); + QString nk = normalizeSettingsKey(key + QLatin1String("-SnoreDefault"), LOCAL_SETTING); if (!m_settings->contains(nk)) { m_settings->setValue(nk, value); } @@ -173,7 +173,7 @@ void SnoreCorePrivate::syncSettings() auto types = SnorePlugin::types(); types.removeOne(SnorePlugin::BACKEND); - for(auto type : types) { + for (auto type : types) { for (auto &pluginName : m_pluginNames[type]) { SnorePlugin *plugin = m_plugins.value(pluginName); bool enable = m_plugins[pluginName]->settingsValue(QLatin1String("Enabled"), LOCAL_SETTING).toBool(); @@ -262,11 +262,11 @@ static void registerMetaTypes() qRegisterMetaTypeStreamOperators(); } -static void snoreStartup(){ +static void snoreStartup() +{ loadTranslator(); registerMetaTypes(); } Q_COREAPP_STARTUP_FUNCTION(snoreStartup) - diff --git a/src/libsnore/utils.cpp b/src/libsnore/utils.cpp index f1524da..9048295 100644 --- a/src/libsnore/utils.cpp +++ b/src/libsnore/utils.cpp @@ -71,57 +71,55 @@ void Utils::raiseWindowToFront(qlonglong wid) #endif } - #define HTML_REPLACE(STRING, PATTERN){\ - static QRegExp regexp(QLatin1String(PATTERN));\ - STRING = STRING.replace(regexp, QLatin1String("\\1"));\ + static QRegExp regexp(QLatin1String(PATTERN));\ + STRING = STRING.replace(regexp, QLatin1String("\\1"));\ }\ + QString Utils::normalizeMarkup(QString string, MARKUP_FLAGS tags) + { + static QMutex mutex; + if (tags == ALL_MARKUP) { + return string; + } else if (tags == NO_MARKUP) { + return QTextDocumentFragment::fromHtml(string).toPlainText(); + } -QString Utils::normalizeMarkup(QString string, MARKUP_FLAGS tags) -{ - static QMutex mutex; - if(tags == ALL_MARKUP){ + QMutexLocker lock(&mutex); + if (~tags & Utils::BREAK) { + static QRegExp br(QLatin1String("
")); + string = string.replace(br, QLatin1String("\n")); + } + if (~tags & Utils::HREF) { + HTML_REPLACE(string, "([^<]*)"); + } + if (~tags & Utils::ITALIC) { + HTML_REPLACE(string, "([^<]*)"); + } + if (~tags & Utils::BOLD) { + HTML_REPLACE(string, "([^<]*)"); + } + if (~tags & Utils::UNDERLINE) { + HTML_REPLACE(string, "([^<]*)"); + } + if (~tags & Utils::FONT) { + HTML_REPLACE(string, "([^<]*)"); + } return string; - } else if(tags == NO_MARKUP) { - return QTextDocumentFragment::fromHtml(string).toPlainText(); } - QMutexLocker lock(&mutex); - if (~tags & Utils::BREAK) { - static QRegExp br(QLatin1String("
")); - string = string.replace(br, QLatin1String("\n")); - } - if (~tags & Utils::HREF) { - HTML_REPLACE(string, "([^<]*)"); - } - if (~tags & Utils::ITALIC) { - HTML_REPLACE(string, "([^<]*)"); - } - if (~tags & Utils::BOLD) { - HTML_REPLACE(string, "([^<]*)"); - } - if (~tags & Utils::UNDERLINE) { - HTML_REPLACE(string, "([^<]*)"); - } - if (~tags & Utils::FONT) { - HTML_REPLACE(string, "([^<]*)"); - } - return string; -} - #ifdef Q_OS_WIN -int Utils::attatchToActiveProcess() -{ - int idActive = GetWindowThreadProcessId(GetForegroundWindow(), NULL); - return AttachThreadInput(GetCurrentThreadId(), idActive, TRUE) ? idActive : -1; -} - -void Utils::detatchActiveProcess(int idActive) -{ - if (idActive != -1) { - AttachThreadInput(GetCurrentThreadId(), idActive, FALSE); + int Utils::attatchToActiveProcess() + { + int idActive = GetWindowThreadProcessId(GetForegroundWindow(), NULL); + return AttachThreadInput(GetCurrentThreadId(), idActive, TRUE) ? idActive : -1; + } + + void Utils::detatchActiveProcess(int idActive) + { + if (idActive != -1) { + AttachThreadInput(GetCurrentThreadId(), idActive, FALSE); + } } -} #endif diff --git a/src/libsnore/utils.h b/src/libsnore/utils.h index cc72f89..3d5799b 100644 --- a/src/libsnore/utils.h +++ b/src/libsnore/utils.h @@ -31,7 +31,7 @@ class SNORE_EXPORT Utils : public QObject { Q_OBJECT public: - enum MARKUP_FLAG{ + enum MARKUP_FLAG { NO_MARKUP = 0, HREF = 1 << 0, BREAK = 1 << 1, @@ -42,7 +42,7 @@ public: ALL_MARKUP = ~0 }; - Q_DECLARE_FLAGS(MARKUP_FLAGS,MARKUP_FLAG) + Q_DECLARE_FLAGS(MARKUP_FLAGS, MARKUP_FLAG) Utils(QObject *parent = nullptr); ~Utils(); diff --git a/src/plugins/backends/freedesktop/fredesktopnotification.cpp b/src/plugins/backends/freedesktop/fredesktopnotification.cpp index f40dc00..e63d4bd 100644 --- a/src/plugins/backends/freedesktop/fredesktopnotification.cpp +++ b/src/plugins/backends/freedesktop/fredesktopnotification.cpp @@ -23,7 +23,6 @@ int FreedesktopImageHint::imageHintID = qDBusRegisterMetaType(); - FreedesktopImageHint::FreedesktopImageHint(const QImage &img) { QImage image(img.convertToFormat(QImage::Format_ARGB32)); diff --git a/src/plugins/backends/freedesktop/freedesktopnotification_backend.cpp b/src/plugins/backends/freedesktop/freedesktopnotification_backend.cpp index f1a9ab5..c8fcc5e 100644 --- a/src/plugins/backends/freedesktop/freedesktopnotification_backend.cpp +++ b/src/plugins/backends/freedesktop/freedesktopnotification_backend.cpp @@ -14,7 +14,7 @@ bool FreedesktopBackend::initialize() { m_interface = new org::freedesktop::Notifications(QLatin1String("org.freedesktop.Notifications"), - QLatin1String("/org/freedesktop/Notifications"), + QLatin1String("/org/freedesktop/Notifications"), QDBusConnection::sessionBus(), this); QDBusPendingReply reply = m_interface->GetCapabilities(); @@ -53,7 +53,7 @@ bool FreedesktopBackend::canUpdateNotification() const void FreedesktopBackend::slotNotify(Notification noti) { QStringList actions; - foreach(int k, noti.actions().keys()) { + foreach (int k, noti.actions().keys()) { actions << QString::number(k) << noti.actions()[k].name(); } QVariantMap hints; @@ -61,13 +61,13 @@ void FreedesktopBackend::slotNotify(Notification noti) FreedesktopImageHint image(noti.icon().image()); hints.insert(QLatin1String("image_data"), QVariant::fromValue(image)); } - + char urgency = '1'; - if(noti.priority() < 0){ - urgency = '0'; - } else if(noti.priority() > 2) { - urgency = '2'; - } + if (noti.priority() < 0) { + urgency = '0'; + } else if (noti.priority() > 2) { + urgency = '2'; + } hints.insert(QLatin1String("urgency"), urgency); if (noti.application().constHints().contains("desktop-entry")) { diff --git a/src/plugins/backends/growl/growlbackend.cpp b/src/plugins/backends/growl/growlbackend.cpp index 601e70c..30809fe 100644 --- a/src/plugins/backends/growl/growlbackend.cpp +++ b/src/plugins/backends/growl/growlbackend.cpp @@ -29,13 +29,12 @@ using namespace Snore; GrowlBackend *GrowlBackend::s_instance = nullptr; - bool GrowlBackend::initialize() { setDefaultSettingsValue(QLatin1String("Host"), QLatin1String("localhost")); setDefaultSettingsValue(QLatin1String("Password"), QString()); - if(!SnoreBackend::initialize()) { + if (!SnoreBackend::initialize()) { return false; } @@ -80,9 +79,9 @@ bool GrowlBackend::deinitialize() void GrowlBackend::slotRegisterApplication(const Application &application) { - snoreDebug( SNORE_DEBUG ) << application.name(); + snoreDebug(SNORE_DEBUG) << application.name(); std::vector alerts; - foreach(const Alert & a, application.alerts()) { + foreach (const Alert &a, application.alerts()) { snoreDebug(SNORE_DEBUG) << a.name(); alerts.push_back(a.name().toUtf8().constData()); } diff --git a/src/plugins/backends/snarl/snarl.cpp b/src/plugins/backends/snarl/snarl.cpp index bca2f51..92c9c9b 100644 --- a/src/plugins/backends/snarl/snarl.cpp +++ b/src/plugins/backends/snarl/snarl.cpp @@ -115,7 +115,7 @@ bool SnarlBackend::initialize() { setDefaultSettingsValue(QLatin1String("Password"), QString()); - if(!SnoreBackend::initialize()) { + if (!SnoreBackend::initialize()) { return false; } @@ -176,7 +176,7 @@ void SnarlBackend::slotRegisterApplication(const Application &application) (HWND)m_eventLoop->winId(), SNORENOTIFIER_MESSAGE_ID); snoreDebug(SNORE_DEBUG) << result; - foreach(const Alert & alert, application.alerts()) { + foreach (const Alert &alert, application.alerts()) { snarlInterface->AddClass(alert.name().toUtf8().constData(), alert.name().toUtf8().constData(), 0, 0, alert.icon().localUrl().toUtf8().constData()); @@ -205,11 +205,11 @@ void SnarlBackend::slotNotify(Notification notification) SnarlInterface *snarlInterface = m_applications.value(notification.application().name()); Snarl::V42::SnarlEnums::MessagePriority priority = Snarl::V42::SnarlEnums::PriorityUndefined; - if(notification.priority() > 1){ + if (notification.priority() > 1) { priority = Snarl::V42::SnarlEnums::PriorityHigh; - } else if(notification.priority() < -1) { + } else if (notification.priority() < -1) { priority = Snarl::V42::SnarlEnums::PriorityLow; - }else{ + } else { priority = static_cast(notification.priority()); } @@ -225,7 +225,7 @@ void SnarlBackend::slotNotify(Notification notification) !notification.icon().isLocalFile() ? Icon::dataFromImage(notification.icon().image()).toBase64().constData() : 0, priority); - foreach(const Action & a, notification.actions()) { + foreach (const Action &a, notification.actions()) { snarlInterface->AddAction(id, a.name().toUtf8().constData(), (QLatin1Char('@') + QString::number(a.id())).toUtf8().constData()); } m_idMap[id] = notification; diff --git a/src/plugins/backends/snore/snorenotifier.cpp b/src/plugins/backends/snore/snorenotifier.cpp index a141466..8673a0d 100644 --- a/src/plugins/backends/snore/snorenotifier.cpp +++ b/src/plugins/backends/snore/snorenotifier.cpp @@ -36,7 +36,7 @@ SnoreNotifier::SnoreNotifier(): snoreDebug(SNORE_DEBUG) << "queue is empty"; m_timer->stop(); } else { - for(NotifyWidget * w : m_widgets) { + for (NotifyWidget *w : m_widgets) { if (w->acquire()) { Notification notification = m_queue.takeFirst(); w->display(notification); @@ -86,7 +86,7 @@ void SnoreNotifier::slotNotify(Snore::Notification notification) } } else { if (m_queue.isEmpty()) { - for(NotifyWidget * w : m_widgets) { + for (NotifyWidget *w : m_widgets) { if (w->acquire()) { display(w, notification); return; diff --git a/src/plugins/backends/snoretoast/snoretoast.cpp b/src/plugins/backends/snoretoast/snoretoast.cpp index f41a7de..10d372a 100644 --- a/src/plugins/backends/snoretoast/snoretoast.cpp +++ b/src/plugins/backends/snoretoast/snoretoast.cpp @@ -16,7 +16,7 @@ using namespace Snore; bool SnoreToast::initialize() { - if(!SnoreBackend::initialize()) { + if (!SnoreBackend::initialize()) { return false; } if (QSysInfo::windowsVersion() < QSysInfo::WV_WINDOWS8) { diff --git a/src/plugins/backends/trayicon/trayiconnotifer.cpp b/src/plugins/backends/trayicon/trayiconnotifer.cpp index 24e4653..3ccfce5 100644 --- a/src/plugins/backends/trayicon/trayiconnotifer.cpp +++ b/src/plugins/backends/trayicon/trayiconnotifer.cpp @@ -6,7 +6,6 @@ #include using namespace Snore; - bool TrayIconNotifer::deinitialize() { if (SnoreBackend::deinitialize()) { diff --git a/src/plugins/frontends/freedesktop/freedesktopnotificationfrontend.cpp b/src/plugins/frontends/freedesktop/freedesktopnotificationfrontend.cpp index 2770b44..d0a8d89 100644 --- a/src/plugins/frontends/freedesktop/freedesktopnotificationfrontend.cpp +++ b/src/plugins/frontends/freedesktop/freedesktopnotificationfrontend.cpp @@ -32,7 +32,7 @@ using namespace Snore; bool FreedesktopFrontend::initialize() { - if(!SnoreFrontend::initialize()) { + if (!SnoreFrontend::initialize()) { return false; } m_adaptor = new NotificationsAdaptor(this); @@ -99,7 +99,7 @@ uint FreedesktopFrontend::Notify(const QString &app_name, uint replaces_id, qDebug() << QIcon::themeSearchPaths(); QIcon qicon = QIcon::fromTheme(app_icon, QIcon(QLatin1String(":/root/snore.png"))); QSize max; - foreach(const QSize & s, qicon.availableSizes()) { + foreach (const QSize &s, qicon.availableSizes()) { if (s.width()*s.height() > max.width()*max.height()) { max = s; } diff --git a/src/plugins/frontends/pushover/pushover_frontend.cpp b/src/plugins/frontends/pushover/pushover_frontend.cpp index 0e2f70b..eea0072 100644 --- a/src/plugins/frontends/pushover/pushover_frontend.cpp +++ b/src/plugins/frontends/pushover/pushover_frontend.cpp @@ -23,7 +23,6 @@ #include "libsnore/version.h" #include "libsnore/notification/notification_p.h" - #include #include #include @@ -32,7 +31,6 @@ #include #include - using namespace Snore; // TODO: use qtkeychain to encrypt credentials? @@ -40,11 +38,11 @@ using namespace Snore; PushoverFrontend::PushoverFrontend() { - connect(this, &PushoverFrontend::loggedInChanged, [this](bool state){ - m_loggedIn = state; + connect(this, &PushoverFrontend::loggedInChanged, [this](bool state) { + m_loggedIn = state; }); - connect(this, &PushoverFrontend::error, [this](QString error){ - m_errorMessage = error; + connect(this, &PushoverFrontend::error, [this](QString error) { + m_errorMessage = error; }); } @@ -53,7 +51,7 @@ bool PushoverFrontend::initialize() setDefaultSettingsValue(QLatin1String("Secret"), QString(), LOCAL_SETTING); setDefaultSettingsValue(QLatin1String("DeviceID"), QString(), LOCAL_SETTING); - if(!SnoreFrontend::initialize()) { + if (!SnoreFrontend::initialize()) { return false; } @@ -65,7 +63,7 @@ bool PushoverFrontend::initialize() bool PushoverFrontend::deinitialize() { if (SnoreFrontend::deinitialize()) { - if(m_socket) { + if (m_socket) { m_socket->close(); m_socket->deleteLater(); } @@ -88,20 +86,17 @@ void PushoverFrontend::login(const QString &email, const QString &password, cons request.setHeader(QNetworkRequest::ContentTypeHeader, QVariant(QLatin1String("application/x-www-form-urlencoded"))); QNetworkReply *reply = m_manager.post(request, QString(QLatin1String("email=%1&password=%2")).arg(email, password).toUtf8().constData()); - connect(reply, &QNetworkReply::finished, [reply, deviceName, this]() { snoreDebug(SNORE_DEBUG) << reply->error(); QByteArray input = reply->readAll(); reply->close(); reply->deleteLater(); - QJsonObject message = QJsonDocument::fromJson(input).object(); - if(message.value(QLatin1String("status")).toInt() == 1) - { + if (message.value(QLatin1String("status")).toInt() == 1) { registerDevice(message.value(QLatin1String("secret")).toString(), deviceName); - }else { + } else { snoreDebug(SNORE_WARNING) << "An error occure" << input; emit loggedInChanged(false); } @@ -129,7 +124,7 @@ QString PushoverFrontend::errorMessage() void PushoverFrontend::slotActionInvoked(Notification notification) { - if(notification.priority() == Notification::EMERGENCY){ + if (notification.priority() == Notification::EMERGENCY) { snoreDebug(SNORE_WARNING) << "emergeency notification" << notification; acknowledgeNotification(notification); } @@ -147,16 +142,15 @@ QString PushoverFrontend::device() void PushoverFrontend::connectToService() { - if(secret().isEmpty() || device().isEmpty()) - { + if (secret().isEmpty() || device().isEmpty()) { snoreDebug(SNORE_WARNING) << "not logged in"; return; } m_socket = new QWebSocket(QString(), QWebSocketProtocol::VersionLatest, this); - connect(m_socket, &QWebSocket::binaryMessageReceived, [&](const QByteArray &msg){ + connect(m_socket, &QWebSocket::binaryMessageReceived, [&](const QByteArray & msg) { char c = msg.at(0); - switch(c){ + switch (c) { case '#': snoreDebug(SNORE_DEBUG) << "still alive"; break; @@ -180,14 +174,14 @@ void PushoverFrontend::connectToService() snoreDebug(SNORE_WARNING) << "unknown message recieved" << msg; } }); - connect(m_socket, &QWebSocket::disconnected, [](){ + connect(m_socket, &QWebSocket::disconnected, []() { snoreDebug(SNORE_DEBUG) << "disconnected"; }); - connect(m_socket, static_cast(&QWebSocket::error), [&](QAbstractSocket::SocketError error){ + connect(m_socket, static_cast(&QWebSocket::error), [&](QAbstractSocket::SocketError error) { snoreDebug(SNORE_WARNING) << error << m_socket->errorString(); emit loggedInChanged(false); }); - connect(m_socket, &QWebSocket::connected, [&](){ + connect(m_socket, &QWebSocket::connected, [&]() { snoreDebug(SNORE_DEBUG) << "connecting"; m_socket->sendBinaryMessage((QLatin1String("login:") + device() + QLatin1Char(':') + secret() + QLatin1Char('\n')).toUtf8().constData()); emit loggedInChanged(true); @@ -203,14 +197,13 @@ void PushoverFrontend::registerDevice(const QString &secret, const QString &devi request.setHeader(QNetworkRequest::ContentTypeHeader, QVariant(QLatin1String("application/x-www-form-urlencoded"))); QNetworkReply *reply = m_manager.post(request, (QLatin1String("os=O&secret=") + secret + QLatin1String("&name=") + deviceName).toUtf8().constData()); - connect(reply, &QNetworkReply::finished, [reply, secret, this]() { snoreDebug(SNORE_DEBUG) << reply->error(); QByteArray input = reply->readAll(); reply->close(); reply->deleteLater(); QJsonObject message = QJsonDocument::fromJson(input).object(); - if(message.value(QLatin1String("status")).toInt() == 1) { + if (message.value(QLatin1String("status")).toInt() == 1) { setSettingsValue(QLatin1String("Secret"), secret, LOCAL_SETTING); setSettingsValue(QLatin1String("DeviceID"), message.value(QLatin1String("id")).toString(), LOCAL_SETTING);; connectToService(); @@ -222,17 +215,15 @@ void PushoverFrontend::registerDevice(const QString &secret, const QString &devi }); - } void PushoverFrontend::getMessages() { QNetworkRequest request(QUrl::fromEncoded((QLatin1String("https://api.pushover.net/1/messages.json?" - "secret=") + secret() + QLatin1String("&device_id=") + device()).toUtf8().constData())); + "secret=") + secret() + QLatin1String("&device_id=") + device()).toUtf8().constData())); QNetworkReply *reply = m_manager.get(request); - - connect(reply, &QNetworkReply::finished, [reply,this]() { + connect(reply, &QNetworkReply::finished, [reply, this]() { snoreDebug(SNORE_DEBUG) << reply->error(); QByteArray input = reply->readAll(); reply->close(); @@ -243,9 +234,9 @@ void PushoverFrontend::getMessages() QJsonObject message = QJsonDocument::fromJson(input).object(); int latestID = -1; - if(message.value(QLatin1String("status")).toInt() == 1){ + if (message.value(QLatin1String("status")).toInt() == 1) { QJsonArray notifications = message.value(QLatin1String("messages")).toArray(); - for( const QJsonValue &v : notifications) { + for (const QJsonValue &v : notifications) { QJsonObject notification = v.toObject(); latestID = qMax(latestID, notification.value(QLatin1String("id")).toInt()); @@ -253,29 +244,28 @@ void PushoverFrontend::getMessages() QString appName = notification.value(QLatin1String("app")).toString(); Application app = SnoreCore::instance().aplications().value(appName); - if (!app.isValid()){ + if (!app.isValid()) { Icon icon(QLatin1String("https://api.pushover.net/icons/") + - notification.value(QLatin1String("icon")).toString() + - QLatin1String(".png")); + notification.value(QLatin1String("icon")).toString() + + QLatin1String(".png")); app = Application(appName, icon); SnoreCore::instance().registerApplication(app); } - Notification n(app, app.defaultAlert(), notification.value(QLatin1String("title")).toString(), notification.value(QLatin1String("message")).toString(), app.icon(), Notification::defaultTimeout(), static_cast(notification.value(QLatin1String("priority")).toInt())); - if(n.priority() == Notification::EMERGENCY){ + if (n.priority() == Notification::EMERGENCY) { n.hints().setValue("receipt", notification.value(QLatin1String("receipt")).toString()); n.hints().setValue("acked", notification.value(QLatin1String("acked")).toInt()); } - if(notification.value(QLatin1String("html")).toInt() == 1) { + if (notification.value(QLatin1String("html")).toInt() == 1) { n.hints().setValue("use-markup", true) ; } SnoreCore::instance().broadcastNotification(n); } - if(latestID != -1){ + if (latestID != -1) { deleteMessages(latestID); } } else { @@ -290,12 +280,11 @@ void PushoverFrontend::deleteMessages(int latestMessageId) { QNetworkRequest request(QUrl::fromEncoded((QLatin1String("https://api.pushover.net/1/devices/") + - device() + QLatin1String("/update_highest_message.json")).toUtf8().constData())); + device() + QLatin1String("/update_highest_message.json")).toUtf8().constData())); request.setHeader(QNetworkRequest::ContentTypeHeader, QVariant(QLatin1String("application/x-www-form-urlencoded"))); QNetworkReply *reply = m_manager.post(request, (QLatin1String("secret=") + secret() + QLatin1String("&message=") + QString::number(latestMessageId)).toUtf8().constData()); - connect(reply, &QNetworkReply::finished, [reply]() { snoreDebug(SNORE_DEBUG) << reply->error(); snoreDebug(SNORE_DEBUG) << reply->readAll(); @@ -306,19 +295,18 @@ void PushoverFrontend::deleteMessages(int latestMessageId) void PushoverFrontend::acknowledgeNotification(Notification notification) { - if(notification.constHints().value("acked").toInt() == 1){ + if (notification.constHints().value("acked").toInt() == 1) { return; } snoreDebug(SNORE_DEBUG) << notification.constHints().value("acked").toInt(); QString receipt = notification.constHints().value("receipt").toString(); QNetworkRequest request(QUrl::fromEncoded((QLatin1String("https://api.pushover.net/1/receipts/") + - receipt + QLatin1String("/acknowledge.json")).toUtf8().constData())); + receipt + QLatin1String("/acknowledge.json")).toUtf8().constData())); snoreDebug(SNORE_WARNING) << request.url(); request.setHeader(QNetworkRequest::ContentTypeHeader, QVariant(QLatin1String("application/x-www-form-urlencoded"))); QNetworkReply *reply = m_manager.post(request, (QLatin1String("secret=") + secret()).toUtf8().constData()); - connect(reply, &QNetworkReply::finished, [reply]() { snoreDebug(SNORE_DEBUG) << reply->error(); snoreDebug(SNORE_DEBUG) << reply->readAll(); @@ -328,4 +316,3 @@ void PushoverFrontend::acknowledgeNotification(Notification notification) }); } - diff --git a/src/plugins/frontends/pushover/pushover_frontend.h b/src/plugins/frontends/pushover/pushover_frontend.h index 7f0bbec..6b2e8ff 100644 --- a/src/plugins/frontends/pushover/pushover_frontend.h +++ b/src/plugins/frontends/pushover/pushover_frontend.h @@ -25,7 +25,6 @@ #include #include - class PushoverFrontend : public Snore::SnoreFrontend { Q_OBJECT @@ -39,7 +38,7 @@ public: Snore::PluginSettingsWidget *settingsWidget() override; - void login(const QString &email, const QString &password, const QString& deviceName); + void login(const QString &email, const QString &password, const QString &deviceName); void logOut(); bool isLoggedIn() const; @@ -68,9 +67,6 @@ private: void deleteMessages(int latestMessageId); void acknowledgeNotification(Snore::Notification notification); - - - }; #endif//PUSHOVER_FRONTEND_H diff --git a/src/plugins/frontends/pushover/pushoversettings.cpp b/src/plugins/frontends/pushover/pushoversettings.cpp index 8d7e9de..e7a6920 100644 --- a/src/plugins/frontends/pushover/pushoversettings.cpp +++ b/src/plugins/frontends/pushover/pushoversettings.cpp @@ -39,28 +39,28 @@ PushoverSettings::PushoverSettings(Snore::SnorePlugin *plugin, QWidget *parent) addRow(QString(), m_registerButton); addRow(tr("Status"), m_errorMessageLabel); addRow(QString(), new QLabel(this)); - addRow(QString(), new QLabel(tr("If you don't have an accout yet please register at Pushover.net"),this)); + addRow(QString(), new QLabel(tr("If you don't have an accout yet please register at Pushover.net"), this)); m_emailLineEdit->setEnabled(false); m_passwordLineEdit->setEnabled(false); m_deviceLineEdit->setEnabled(false); m_registerButton->setEnabled(false); - PushoverFrontend *pushover = dynamic_cast(plugin); + PushoverFrontend *pushover = dynamic_cast(plugin); m_errorMessageLabel->setText(pushover->errorMessage()); connect(pushover, &PushoverFrontend::loggedInChanged, this, &PushoverSettings::slotUpdateLoginState); - connect(pushover, &PushoverFrontend::error, [this](QString message){ + connect(pushover, &PushoverFrontend::error, [this](QString message) { m_errorMessageLabel->setText(message); }); slotUpdateLoginState(pushover->isLoggedIn()); - connect(m_registerButton, &QPushButton::clicked, [pushover, this] () { + connect(m_registerButton, &QPushButton::clicked, [pushover, this]() { m_registerButton->setEnabled(false); - if(!pushover->isLoggedIn()) { + if (!pushover->isLoggedIn()) { pushover->login(m_emailLineEdit->text(), m_passwordLineEdit->text(), m_deviceLineEdit->text()); - }else{ + } else { pushover->logOut(); } }); diff --git a/src/plugins/frontends/pushover/pushoversettings.h b/src/plugins/frontends/pushover/pushoversettings.h index df2e1d1..3252035 100644 --- a/src/plugins/frontends/pushover/pushoversettings.h +++ b/src/plugins/frontends/pushover/pushoversettings.h @@ -44,7 +44,6 @@ private: private Q_SLOTS: void slotUpdateLoginState(bool state); - }; #endif // PUSHOVERSETTINGS_H diff --git a/src/plugins/frontends/snarlnetwork/parser.cpp b/src/plugins/frontends/snarlnetwork/parser.cpp index 9c8ead3..1d18776 100644 --- a/src/plugins/frontends/snarlnetwork/parser.cpp +++ b/src/plugins/frontends/snarlnetwork/parser.cpp @@ -64,7 +64,7 @@ void Parser::parse(Notification &sNotification, const QString &msg, QTcpSocket * QByteArray key; QString value; - foreach(QString s, splitted) { + foreach (QString s, splitted) { key = s.mid(0, s.indexOf(QLatin1String("="))).toLower().toLatin1(); value = s.mid(s.indexOf(QLatin1String("=")) + 1); switch (getSnpType.value(key)) { diff --git a/src/plugins/frontends/snarlnetwork/snarlnetwork.cpp b/src/plugins/frontends/snarlnetwork/snarlnetwork.cpp index b5f4122..e921520 100644 --- a/src/plugins/frontends/snarlnetwork/snarlnetwork.cpp +++ b/src/plugins/frontends/snarlnetwork/snarlnetwork.cpp @@ -29,7 +29,7 @@ using namespace Snore; bool SnarlNetworkFrontend::initialize() { - if(!SnoreFrontend::initialize()) { + if (!SnoreFrontend::initialize()) { return false; } parser = new Parser(this); @@ -99,7 +99,7 @@ void SnarlNetworkFrontend::handleMessages() QTcpSocket *client = qobject_cast(sender()); QStringList messages(QString::fromLatin1(client->readAll()).trimmed().split(QLatin1String("\r\n"))); - foreach(const QString & s, messages) { + foreach (const QString &s, messages) { if (s.isEmpty()) { continue; } @@ -119,7 +119,7 @@ void SnarlNetworkFrontend::callback(Notification &sn, const QString msg) { if (sn.hints().containsPrivateValue(this, "clientSocket")) { QTcpSocket *client = sn.hints().privateValue(this, "clientSocket").value>(); - if(client){ + if (client) { write(client, QString(QLatin1String("%1%2\r\n")).arg(msg, QString::number(sn.id()))); } } diff --git a/src/plugins/secondary_backends/nma/nma.cpp b/src/plugins/secondary_backends/nma/nma.cpp index 8bd4a77..2d56deb 100644 --- a/src/plugins/secondary_backends/nma/nma.cpp +++ b/src/plugins/secondary_backends/nma/nma.cpp @@ -36,22 +36,20 @@ void NotifyMyAndroid::slotNotify(Notification notification) QNetworkRequest request(QUrl::fromEncoded("https://www.notifymyandroid.com/publicapi/notify")); request.setHeader(QNetworkRequest::ContentTypeHeader, QVariant(QLatin1String("application/x-www-form-urlencoded"))); - QString data = QLatin1String("apikey=") + key - + QLatin1String("&application=") + notification.application().name() - + QLatin1String("&event=") + notification.title() - + QLatin1String("&priority=") + QString::number(notification.priority()) - + QLatin1String("&description="); + + QLatin1String("&application=") + notification.application().name() + + QLatin1String("&event=") + notification.title() + + QLatin1String("&priority=") + QString::number(notification.priority()) + + QLatin1String("&description="); - if(notification.constHints().value("supports-markup").toBool()){ + if (notification.constHints().value("supports-markup").toBool()) { data += notification.text(Utils::HREF | Utils::BOLD | Utils::BREAK | Utils::UNDERLINE | Utils::FONT | Utils::ITALIC) + QLatin1String("&content-type=text/html"); - }else{ + } else { data += notification.text(); } - QNetworkReply *reply = m_manager.post(request, data.toUtf8().constData()); connect(reply, &QNetworkReply::finished, [reply]() { snoreDebug(SNORE_DEBUG) << reply->error(); diff --git a/src/plugins/secondary_backends/pushover/pushover.cpp b/src/plugins/secondary_backends/pushover/pushover.cpp index c6b57aa..8f55bea 100644 --- a/src/plugins/secondary_backends/pushover/pushover.cpp +++ b/src/plugins/secondary_backends/pushover/pushover.cpp @@ -43,7 +43,7 @@ void Pushover::slotNotify(Notification notification) mp->append(title); QString textString; - if(notification.constHints().value("use-markup").toBool()){ + if (notification.constHints().value("use-markup").toBool()) { textString = notification.text(Utils::HREF | Utils::BOLD | Utils::UNDERLINE | Utils::FONT | Utils::ITALIC); QHttpPart html; @@ -65,7 +65,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\""))); diff --git a/src/settings/main.cpp b/src/settings/main.cpp index 9cf20cb..117b33b 100644 --- a/src/settings/main.cpp +++ b/src/settings/main.cpp @@ -25,7 +25,7 @@ bool setSetting(const QString &appName, SettingsType type, const QString &_key, return false; } settings.setValue(key, value); - cout <<"Set: " << qPrintable(key) << " to " << qPrintable(settings.value(key).toString()) << endl; + cout << "Set: " << qPrintable(key) << " to " << qPrintable(settings.value(key).toString()) << endl; return true; } @@ -46,7 +46,7 @@ void listSettings(SettingsType type, const QString &application) cout << qPrintable(application) << endl; for (const QString &key : Utils::allSettingsKeysWithPrefix( Utils::normalizeSettingsKey(QLatin1String(""), type, application), settings, getAllKeys)) { - cout <<" " << qPrintable(key) << ": " << qPrintable(settings.value(Utils::normalizeSettingsKey(key, type, application)).toString()) << endl; + cout << " " << qPrintable(key) << ": " << qPrintable(settings.value(Utils::normalizeSettingsKey(key, type, application)).toString()) << endl; } } @@ -78,7 +78,7 @@ int main(int argc, char *argv[]) QCommandLineOption appNameCommand({QLatin1String("a"), QLatin1String("appName")} , QLatin1String("Set the Name of the app ."), QLatin1String("app"), QLatin1String("GlobalSettings")); parser.addOption(appNameCommand); - QCommandLineOption typeCommand({QLatin1String("t"),QLatin1String("type")} ,QLatin1String("Type of the setting [global|local]."),QLatin1String("type")); + QCommandLineOption typeCommand({QLatin1String("t"), QLatin1String("type")} , QLatin1String("Type of the setting [global|local]."), QLatin1String("type")); parser.addOption(typeCommand); parser.addPositionalArgument(QLatin1String("key"), QLatin1String("The settings Key."));