Fix whitespace

This commit is contained in:
Hannah von Reth 2015-09-29 13:28:27 +02:00
parent 85da7744ce
commit a2950d0592
10 changed files with 63 additions and 64 deletions

View File

@ -55,7 +55,7 @@ void SnoreBenchmark::benchmarkUtilsToHtml()
"<a href=\"https://github.com/Snorenotify/Snorenotify\">Website</a>\n"));
QCOMPARE(Utils::normalizeMarkup(htmlTestString, Utils::HREF | Utils::BOLD | Utils::BREAK |
Utils::UNDERLINE | Utils::FONT | Utils::ITALIC), htmlTestString);
QBENCHMARK{
QBENCHMARK {
Utils::normalizeMarkup(htmlTestString, Utils::HREF);
}
}
@ -64,14 +64,14 @@ void SnoreBenchmark::benchmarkUtilsToHtmlAllMarkup()
{
QCOMPARE(Utils::normalizeMarkup(htmlTestString, Utils::ALL_MARKUP), htmlTestString);
QBENCHMARK{
QBENCHMARK {
Utils::normalizeMarkup(htmlTestString, Utils::ALL_MARKUP);
}
}
void SnoreBenchmark::benchmarkUtilsToPlain()
{
QBENCHMARK{
QBENCHMARK {
Utils::normalizeMarkup(htmlTestString, Utils::NO_MARKUP);
}
}

View File

@ -102,7 +102,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 << ")" ;

View File

@ -90,15 +90,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();

View File

@ -77,59 +77,59 @@ void Utils::raiseWindowToFront(qlonglong wid)
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();
}
QMutexLocker lock(&mutex);
if (~tags & Utils::BREAK) {
static QRegExp br(QLatin1String("<br>"));
string = string.replace(br, QLatin1String("\n"));
}
if (~tags & Utils::HREF) {
HTML_REPLACE(string, "<a href=.*>([^<]*)</a>");
}
if (~tags & Utils::ITALIC) {
HTML_REPLACE(string, "<i>([^<]*)</i>");
}
if (~tags & Utils::BOLD) {
HTML_REPLACE(string, "<b>([^<]*)</b>");
}
if (~tags & Utils::UNDERLINE) {
HTML_REPLACE(string, "<u>([^<]*)</u>");
}
if (~tags & Utils::FONT) {
HTML_REPLACE(string, "<font.*>([^<]*)</font>");
}
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();
}
QByteArray Utils::dataFromImage(const QImage &image)
{
QByteArray data;
QBuffer buffer(&data);
buffer.open(QBuffer::WriteOnly);
image.save(&buffer, "PNG");
return data;
QMutexLocker lock(&mutex);
if (~tags & Utils::BREAK) {
static QRegExp br(QLatin1String("<br>"));
string = string.replace(br, QLatin1String("\n"));
}
if (~tags & Utils::HREF) {
HTML_REPLACE(string, "<a href=.*>([^<]*)</a>");
}
if (~tags & Utils::ITALIC) {
HTML_REPLACE(string, "<i>([^<]*)</i>");
}
if (~tags & Utils::BOLD) {
HTML_REPLACE(string, "<b>([^<]*)</b>");
}
if (~tags & Utils::UNDERLINE) {
HTML_REPLACE(string, "<u>([^<]*)</u>");
}
if (~tags & Utils::FONT) {
HTML_REPLACE(string, "<font.*>([^<]*)</font>");
}
return string;
}
QByteArray Utils::dataFromImage(const QImage &image)
{
QByteArray data;
QBuffer buffer(&data);
buffer.open(QBuffer::WriteOnly);
image.save(&buffer, "PNG");
return data;
}
#ifdef Q_OS_WIN
int Utils::attatchToActiveProcess()
{
int idActive = GetWindowThreadProcessId(GetForegroundWindow(), NULL);
return AttachThreadInput(GetCurrentThreadId(), idActive, TRUE) ? idActive : -1;
}
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);
}
void Utils::detatchActiveProcess(int idActive)
{
if (idActive != -1) {
AttachThreadInput(GetCurrentThreadId(), idActive, FALSE);
}
}
#endif

View File

@ -50,7 +50,7 @@ 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;

View File

@ -76,7 +76,7 @@ void GrowlBackend::slotRegisterApplication(const Application &application)
{
snoreDebug(SNORE_DEBUG) << application.name();
std::vector<std::string> 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());
}

View File

@ -179,7 +179,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(QSize(128, 128)).toUtf8().constData());
@ -228,7 +228,7 @@ void SnarlBackend::slotNotify(Notification notification)
Utils::dataFromImage(notification.icon().pixmap(QSize(128, 128)).toImage()).toBase64().constData(),
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;

View File

@ -19,7 +19,6 @@ Window {
}
}
NumberAnimation{
id: animation
properties: "x"
@ -32,6 +31,8 @@ Window {
Rectangle{
id: root
// don't anchor as we need he xChanged signal
// a drag event directly on the window is not supported
height: window.height
width: window.width
color: window.color
@ -55,8 +56,6 @@ Window {
}
}
MouseArea {
id: mouseAreaAccept
anchors.fill: parent

View File

@ -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)) {

View File

@ -90,7 +90,7 @@ void SnarlNetworkFrontend::handleMessages()
QTcpSocket *client = qobject_cast<QTcpSocket *>(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;
}