From 282f51da8728945d338cb6886dc0b92d2fe735d4 Mon Sep 17 00:00:00 2001 From: Patrick von Reth Date: Sat, 18 Apr 2015 15:11:04 +0200 Subject: [PATCH] code style --- src/libsnore/log.cpp | 3 ++- src/libsnore/plugins/plugins.cpp | 4 ++-- src/libsnore/snore_p.h | 1 - src/libsnore/utils.cpp | 4 ++-- src/libsnore/utils.h | 10 ++++++---- src/plugins/secondary_backends/nma/nma.cpp | 10 +++++----- src/plugins/secondary_backends/sound/sound.cpp | 8 ++++---- src/plugins/secondary_backends/sound/soundsettings.cpp | 2 +- 8 files changed, 22 insertions(+), 20 deletions(-) diff --git a/src/libsnore/log.cpp b/src/libsnore/log.cpp index 7d67293..de06884 100644 --- a/src/libsnore/log.cpp +++ b/src/libsnore/log.cpp @@ -31,7 +31,8 @@ static int debugLevel = 0; static std::unique_ptr logFile = std::unique_ptr(); static std::unique_ptr file = std::unique_ptr(); -static void init(){ +static void init() +{ debugLevel = qgetenv("LIBSNORE_DEBUG_LVL").toInt(); if (qgetenv("LIBSNORE_LOG_TO_FILE").toInt() == 1) { diff --git a/src/libsnore/plugins/plugins.cpp b/src/libsnore/plugins/plugins.cpp index 34f4c09..1c4929d 100644 --- a/src/libsnore/plugins/plugins.cpp +++ b/src/libsnore/plugins/plugins.cpp @@ -32,9 +32,9 @@ using namespace Snore; SnorePlugin::SnorePlugin(const QString &name) : m_name(name) { - Q_ASSERT_X(thread() != qApp->thread(),Q_FUNC_INFO,"Plugin initialized in wrong thread"); + Q_ASSERT_X(thread() != qApp->thread(), Q_FUNC_INFO, "Plugin initialized in wrong thread"); if (thread() != qApp->thread()) { - snoreDebug(SNORE_WARNING) << "Plugin initialized in wrong thread."; + snoreDebug(SNORE_WARNING) << "Plugin initialized in wrong thread."; } setDefaultValue("Enabled", false, LOCAL_SETTING); } diff --git a/src/libsnore/snore_p.h b/src/libsnore/snore_p.h index e32c49a..beec1c1 100644 --- a/src/libsnore/snore_p.h +++ b/src/libsnore/snore_p.h @@ -112,5 +112,4 @@ private: }; } - #endif // SNORECOREPRIVATE_H diff --git a/src/libsnore/utils.cpp b/src/libsnore/utils.cpp index 9e7a43f..bc36a18 100644 --- a/src/libsnore/utils.cpp +++ b/src/libsnore/utils.cpp @@ -59,7 +59,7 @@ void Utils::raiseWindowToFront(qlonglong wid) // Looks like qt is handling it on linux. #ifdef Q_OS_WIN int active = attatchToActiveProcess(); - SetWindowPos((HWND)wid, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE); + SetWindowPos((HWND)wid, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); detatchActiveProcess(active); #else Q_UNUSED(wid); @@ -75,7 +75,7 @@ int Utils::attatchToActiveProcess() void Utils::detatchActiveProcess(int idActive) { - if (idActive!= -1) { + if (idActive != -1) { AttachThreadInput(GetCurrentThreadId(), idActive, FALSE); } } diff --git a/src/libsnore/utils.h b/src/libsnore/utils.h index ce0d64c..7448ce6 100644 --- a/src/libsnore/utils.h +++ b/src/libsnore/utils.h @@ -25,8 +25,10 @@ #include #include -namespace Snore { -class SNORE_EXPORT Utils : public QObject { +namespace Snore +{ +class SNORE_EXPORT Utils : public QObject +{ Q_OBJECT public: Utils(QObject *parent = nullptr); @@ -83,8 +85,8 @@ public: private: #ifdef Q_OS_WIN -static int attatchToActiveProcess(); -static void detatchActiveProcess(int idActive); + static int attatchToActiveProcess(); + static void detatchActiveProcess(int idActive); #endif }; diff --git a/src/plugins/secondary_backends/nma/nma.cpp b/src/plugins/secondary_backends/nma/nma.cpp index 3ca807a..4b8cc6a 100644 --- a/src/plugins/secondary_backends/nma/nma.cpp +++ b/src/plugins/secondary_backends/nma/nma.cpp @@ -49,12 +49,12 @@ void NotifyMyAndroid::slotNotify(Notification notification) // TODO: use toHTML? QString data(QString("apikey=%1&application=%2&event=%3&description=%4&content-type=text/html") - .arg(key, - notification.application().name(), - Utils::toPlainText(notification.title()), - Utils::toPlainText(notification.text()))); + .arg(key, + notification.application().name(), + Utils::toPlainText(notification.title()), + Utils::toPlainText(notification.text()))); - QNetworkReply *reply = m_manager.post(request,data.toUtf8().constData()); + QNetworkReply *reply = m_manager.post(request, data.toUtf8().constData()); connect(reply, &QNetworkReply::finished, [reply]() { snoreDebug(SNORE_DEBUG) << reply->error(); snoreDebug(SNORE_DEBUG) << reply->readAll(); diff --git a/src/plugins/secondary_backends/sound/sound.cpp b/src/plugins/secondary_backends/sound/sound.cpp index d0a5bd7..a9047e2 100644 --- a/src/plugins/secondary_backends/sound/sound.cpp +++ b/src/plugins/secondary_backends/sound/sound.cpp @@ -27,7 +27,7 @@ Sound::Sound(): SnoreSecondaryBackend("Sound", false), m_player(new QMediaPlayer(this)) { - setDefaultValue("Volume",50); + setDefaultValue("Volume", 50); m_player->setVolume(value("Volume").toInt()); // connect(m_player,QMediaPlayer::positionChanged,[](qint64 pos){ // snoreDebug(SNORE_DEBUG) << "Player: " << pos; @@ -65,9 +65,9 @@ void Sound::slotNotify(Snore::Notification notification) QTimer *timeout = new QTimer(this); timeout->setSingleShot(true); timeout->setInterval(notification.timeout() * 1000); - connect(timeout, &QTimer::timeout, [this,timeout]{ - m_player->stop(); - timeout->deleteLater(); + connect(timeout, &QTimer::timeout, [this, timeout] { + m_player->stop(); + timeout->deleteLater(); }); } } diff --git a/src/plugins/secondary_backends/sound/soundsettings.cpp b/src/plugins/secondary_backends/sound/soundsettings.cpp index dd0ab58..927b9d1 100644 --- a/src/plugins/secondary_backends/sound/soundsettings.cpp +++ b/src/plugins/secondary_backends/sound/soundsettings.cpp @@ -30,7 +30,7 @@ SoundSettings::SoundSettings(SnorePlugin *snorePlugin, QWidget *parent) : m_lineEditFileName(new QLineEdit), m_spinBoxVolume(new QSpinBox) { - m_spinBoxVolume->setRange(0,100); + m_spinBoxVolume->setRange(0, 100); addRow(tr("Volume:"), m_spinBoxVolume); addRow(tr("Audio file:"), m_lineEditFileName);