diff --git a/autotest/snorebenchmark.cpp b/autotest/snorebenchmark.cpp
index 889f028..b65bc70 100644
--- a/autotest/snorebenchmark.cpp
+++ b/autotest/snorebenchmark.cpp
@@ -20,8 +20,6 @@ public:
instance.setSettingsValue(QLatin1String("Timeout"), 1, LOCAL_SETTING);
}
-
-
QString htmlTestString = QLatin1String("Italic A
"
"Italic B
"
"Bold
"
@@ -43,19 +41,19 @@ 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{
@@ -83,23 +81,21 @@ void SnoreBenchmark::benchmarkNotifications()
{
SnoreCore &instance = SnoreCore::instance();
int closed = 0;
- connect(&instance, SnoreCore::notificationClosed, [&closed](Notification)
- {
+ connect(&instance, SnoreCore::notificationClosed, [&closed](Notification) {
closed++;
});
Application app = SnoreCorePrivate::instance()->defaultApplication();
- // QBENCHMARK_ONCE{
- for( int i=0; i<100; ++i)
- {
- QString number = QString::number(i);
- Notification n(app, app.defaultAlert(), QLatin1String("Test ") + number, QLatin1String("Message ") + number, app.icon() );
- instance.broadcastNotification(n);
- }
- // }
- while(closed < 100){
- QTest::qWait(100);
- }
+// QBENCHMARK_ONCE{
+ for (int i = 0; i < 100; ++i) {
+ QString number = QString::number(i);
+ Notification n(app, app.defaultAlert(), QLatin1String("Test ") + number, QLatin1String("Message ") + number, app.icon());
+ instance.broadcastNotification(n);
+ }
+ // }
+ while (closed < 100) {
+ QTest::qWait(100);
+ }
}
diff --git a/src/libsnore/snore.cpp b/src/libsnore/snore.cpp
index 4f05bb6..7d6baed 100644
--- a/src/libsnore/snore.cpp
+++ b/src/libsnore/snore.cpp
@@ -109,8 +109,7 @@ void SnoreCore::loadPlugins(SnorePlugin::PluginTypes types)
void SnoreCore::broadcastNotification(Notification notification)
{
Q_D(SnoreCore);
- if(d->m_activeNotifications.size() > d->maxNumberOfActiveNotifications())
- {
+ if (d->m_activeNotifications.size() > d->maxNumberOfActiveNotifications()) {
snoreDebug(SNORE_DEBUG) << "queue size:" << d->m_notificationQue.size() << "active size:" << d->m_activeNotifications.size();
d->m_notificationQue.append(notification);
return;
@@ -124,8 +123,7 @@ void SnoreCore::broadcastNotification(Notification notification)
}
notification.data()->setBroadcasted();
notification.addActiveIn(this);
- if(!d->m_notificationBackend)
- {
+ if (!d->m_notificationBackend) {
d->startNotificationTimeoutTimer(notification);
}
emit d->notify(notification);
diff --git a/src/libsnore/snore_p.cpp b/src/libsnore/snore_p.cpp
index 6fc6f84..08d09f4 100644
--- a/src/libsnore/snore_p.cpp
+++ b/src/libsnore/snore_p.cpp
@@ -35,8 +35,7 @@ using namespace Snore;
SnoreCorePrivate::SnoreCorePrivate():
m_localSettingsPrefix(qApp->applicationName().isEmpty() ? QLatin1String("SnoreNotify") : qApp->applicationName())
{
- if(!qgetenv("LIBSNORE_SETTINGS_FILE").isNull())
- {
+ if (!qgetenv("LIBSNORE_SETTINGS_FILE").isNull()) {
m_settings = new QSettings(QString::fromUtf8(qgetenv("LIBSNORE_SETTINGS_FILE")), QSettings::IniFormat);
} else {
m_settings = new QSettings(QLatin1String("Snorenotify"), QLatin1String("libsnore"), this);
@@ -226,12 +225,10 @@ void SnoreCorePrivate::slotNotificationClosed(Notification n)
{
Q_Q(SnoreCore);
emit q->notificationClosed(n);
- if(!n.removeActiveIn(q))
- {
+ if (!n.removeActiveIn(q)) {
snoreDebug(SNORE_WARNING) << n << "was already closed";
}
- if(!m_notificationQue.isEmpty() && m_activeNotifications.size() < maxNumberOfActiveNotifications())
- {
+ if (!m_notificationQue.isEmpty() && m_activeNotifications.size() < maxNumberOfActiveNotifications()) {
snoreDebug(SNORE_DEBUG) << "Broadcast from queue" << m_notificationQue.size();
q->broadcastNotification(m_notificationQue.takeFirst());
}
diff --git a/src/settings/main.cpp b/src/settings/main.cpp
index 071f0f7..faa2fd9 100644
--- a/src/settings/main.cpp
+++ b/src/settings/main.cpp
@@ -59,7 +59,7 @@ void listSettings(SettingsType type, const QString &application)
};
QString prefix = application;
- if(application == QLatin1String("global")) {
+ if (application == QLatin1String("global")) {
prefix = QString();
}
cout << qPrintable(application) << endl;
@@ -79,7 +79,6 @@ int main(int argc, char *argv[])
app.setOrganizationName(QLatin1String("SnoreNotify"));
app.setApplicationVersion(Snore::Version::version());
-
Snore::SnoreCore::instance().loadPlugins(Snore::SnorePlugin::ALL);
Snore::SnoreCorePrivate::instance()->defaultApplication().hints().setValue("use-markup", QVariant::fromValue(true));
@@ -103,11 +102,10 @@ int main(int argc, char *argv[])
parser.process(app);
-
QString appName = parser.value(appNameCommand);
SettingsType type = GLOBAL_SETTING;
- if(appName != QLatin1String("global")){
+ if (appName != QLatin1String("global")) {
type = LOCAL_SETTING;
}
diff --git a/src/snoresend/main.cpp b/src/snoresend/main.cpp
index 2483d94..7f4132d 100644
--- a/src/snoresend/main.cpp
+++ b/src/snoresend/main.cpp
@@ -37,7 +37,6 @@
using namespace Snore;
using namespace std;
-
void bringToFront(QString pid)
{
snoreDebug(SNORE_DEBUG) << pid;
@@ -45,7 +44,7 @@ void bringToFront(QString pid)
auto findWindowForPid = [](ulong pid) {
// based on http://stackoverflow.com/a/21767578
pair data = make_pair(pid, (HWND)0);
- ::EnumWindows((WNDENUMPROC)static_cast([](HWND handle, LPARAM lParam) -> BOOL {
+ ::EnumWindows((WNDENUMPROC)static_cast([](HWND handle, LPARAM lParam) -> BOOL {
auto isMainWindow = [](HWND handle)
{
return ::GetWindow(handle, GW_OWNER) == (HWND)0 && IsWindowVisible(handle);
@@ -124,15 +123,14 @@ int main(int argc, char *argv[])
Alert alert(parser.value(alertName), icon);
application.addAlert(alert);
- if(parser.value(markup).toInt() == 1)
- {
+ if (parser.value(markup).toInt() == 1) {
application.hints().setValue("use-markup", true);
}
core.registerApplication(application);
int prio = parser.value(priority).toInt();
- if(prio < -2 || prio > 2){
+ if (prio < -2 || prio > 2) {
parser.showHelp(-1);
}
Notification n(application, alert, parser.value(title), parser.value(message), icon, Notification::defaultTimeout(), static_cast(prio));
@@ -151,7 +149,7 @@ int main(int argc, char *argv[])
if (parser.isSet(_bringProcessToFront)) {
bringToFront(parser.value(_bringProcessToFront));
} else if (parser.isSet(_bringWindowToFront)) {
- Utils::bringWindowToFront((WId)parser.value(_bringWindowToFront).toULongLong(),true);
+ Utils::bringWindowToFront((WId)parser.value(_bringWindowToFront).toULongLong(), true);
}
}
returnCode = noti.closeReason();