Fix whitespace
This commit is contained in:
parent
85da7744ce
commit
a2950d0592
|
@ -55,7 +55,7 @@ void SnoreBenchmark::benchmarkUtilsToHtml()
|
||||||
"<a href=\"https://github.com/Snorenotify/Snorenotify\">Website</a>\n"));
|
"<a href=\"https://github.com/Snorenotify/Snorenotify\">Website</a>\n"));
|
||||||
QCOMPARE(Utils::normalizeMarkup(htmlTestString, Utils::HREF | Utils::BOLD | Utils::BREAK |
|
QCOMPARE(Utils::normalizeMarkup(htmlTestString, Utils::HREF | Utils::BOLD | Utils::BREAK |
|
||||||
Utils::UNDERLINE | Utils::FONT | Utils::ITALIC), htmlTestString);
|
Utils::UNDERLINE | Utils::FONT | Utils::ITALIC), htmlTestString);
|
||||||
QBENCHMARK{
|
QBENCHMARK {
|
||||||
Utils::normalizeMarkup(htmlTestString, Utils::HREF);
|
Utils::normalizeMarkup(htmlTestString, Utils::HREF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,14 +64,14 @@ void SnoreBenchmark::benchmarkUtilsToHtmlAllMarkup()
|
||||||
{
|
{
|
||||||
QCOMPARE(Utils::normalizeMarkup(htmlTestString, Utils::ALL_MARKUP), htmlTestString);
|
QCOMPARE(Utils::normalizeMarkup(htmlTestString, Utils::ALL_MARKUP), htmlTestString);
|
||||||
|
|
||||||
QBENCHMARK{
|
QBENCHMARK {
|
||||||
Utils::normalizeMarkup(htmlTestString, Utils::ALL_MARKUP);
|
Utils::normalizeMarkup(htmlTestString, Utils::ALL_MARKUP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SnoreBenchmark::benchmarkUtilsToPlain()
|
void SnoreBenchmark::benchmarkUtilsToPlain()
|
||||||
{
|
{
|
||||||
QBENCHMARK{
|
QBENCHMARK {
|
||||||
Utils::normalizeMarkup(htmlTestString, Utils::NO_MARKUP);
|
Utils::normalizeMarkup(htmlTestString, Utils::NO_MARKUP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,7 +102,7 @@ QDebug operator<< (QDebug debug, const Snore::Application &app)
|
||||||
{
|
{
|
||||||
if (app.isValid()) {
|
if (app.isValid()) {
|
||||||
debug << "Snore::Application(" << app.name() << ", ";
|
debug << "Snore::Application(" << app.name() << ", ";
|
||||||
foreach (const Alert &a, app.alerts()) {
|
foreach(const Alert & a, app.alerts()) {
|
||||||
debug << a << ", ";
|
debug << a << ", ";
|
||||||
}
|
}
|
||||||
debug << ")" ;
|
debug << ")" ;
|
||||||
|
|
|
@ -90,14 +90,14 @@ void PluginContainer::updatePluginCache()
|
||||||
{
|
{
|
||||||
snoreDebug(SNORE_DEBUG) << "Updating plugin cache";
|
snoreDebug(SNORE_DEBUG) << "Updating plugin cache";
|
||||||
for (auto list : s_pluginCache) {
|
for (auto list : s_pluginCache) {
|
||||||
foreach (PluginContainer *p, list.values()) {
|
foreach(PluginContainer * p, list.values()) {
|
||||||
delete p;
|
delete p;
|
||||||
}
|
}
|
||||||
list.clear();
|
list.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (const SnorePlugin::PluginTypes type, SnorePlugin::types()) {
|
foreach(const SnorePlugin::PluginTypes type, SnorePlugin::types()) {
|
||||||
foreach (const QFileInfo &file, pluginDir().entryInfoList(
|
foreach(const QFileInfo & file, pluginDir().entryInfoList(
|
||||||
QStringList(pluginFileFilters(type)), QDir::Files)) {
|
QStringList(pluginFileFilters(type)), QDir::Files)) {
|
||||||
snoreDebug(SNORE_DEBUG) << "adding" << file.absoluteFilePath();
|
snoreDebug(SNORE_DEBUG) << "adding" << file.absoluteFilePath();
|
||||||
QPluginLoader loader(file.absoluteFilePath());
|
QPluginLoader loader(file.absoluteFilePath());
|
||||||
|
|
|
@ -77,8 +77,8 @@ void Utils::raiseWindowToFront(qlonglong wid)
|
||||||
STRING = STRING.replace(regexp, QLatin1String("\\1"));\
|
STRING = STRING.replace(regexp, QLatin1String("\\1"));\
|
||||||
}\
|
}\
|
||||||
|
|
||||||
QString Utils::normalizeMarkup(QString string, MARKUP_FLAGS tags)
|
QString Utils::normalizeMarkup(QString string, MARKUP_FLAGS tags)
|
||||||
{
|
{
|
||||||
static QMutex mutex;
|
static QMutex mutex;
|
||||||
if (tags == ALL_MARKUP) {
|
if (tags == ALL_MARKUP) {
|
||||||
return string;
|
return string;
|
||||||
|
@ -107,29 +107,29 @@ void Utils::raiseWindowToFront(qlonglong wid)
|
||||||
HTML_REPLACE(string, "<font.*>([^<]*)</font>");
|
HTML_REPLACE(string, "<font.*>([^<]*)</font>");
|
||||||
}
|
}
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray Utils::dataFromImage(const QImage &image)
|
QByteArray Utils::dataFromImage(const QImage &image)
|
||||||
{
|
{
|
||||||
QByteArray data;
|
QByteArray data;
|
||||||
QBuffer buffer(&data);
|
QBuffer buffer(&data);
|
||||||
buffer.open(QBuffer::WriteOnly);
|
buffer.open(QBuffer::WriteOnly);
|
||||||
image.save(&buffer, "PNG");
|
image.save(&buffer, "PNG");
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
int Utils::attatchToActiveProcess()
|
int Utils::attatchToActiveProcess()
|
||||||
{
|
{
|
||||||
int idActive = GetWindowThreadProcessId(GetForegroundWindow(), NULL);
|
int idActive = GetWindowThreadProcessId(GetForegroundWindow(), NULL);
|
||||||
return AttachThreadInput(GetCurrentThreadId(), idActive, TRUE) ? idActive : -1;
|
return AttachThreadInput(GetCurrentThreadId(), idActive, TRUE) ? idActive : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Utils::detatchActiveProcess(int idActive)
|
void Utils::detatchActiveProcess(int idActive)
|
||||||
{
|
{
|
||||||
if (idActive != -1) {
|
if (idActive != -1) {
|
||||||
AttachThreadInput(GetCurrentThreadId(), idActive, FALSE);
|
AttachThreadInput(GetCurrentThreadId(), idActive, FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -50,7 +50,7 @@ void FreedesktopBackend::slotNotify(Notification noti)
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList actions;
|
QStringList actions;
|
||||||
foreach (int k, noti.actions().keys()) {
|
foreach(int k, noti.actions().keys()) {
|
||||||
actions << QString::number(k) << noti.actions()[k].name();
|
actions << QString::number(k) << noti.actions()[k].name();
|
||||||
}
|
}
|
||||||
QVariantMap hints;
|
QVariantMap hints;
|
||||||
|
|
|
@ -76,7 +76,7 @@ void GrowlBackend::slotRegisterApplication(const Application &application)
|
||||||
{
|
{
|
||||||
snoreDebug(SNORE_DEBUG) << application.name();
|
snoreDebug(SNORE_DEBUG) << application.name();
|
||||||
std::vector<std::string> alerts;
|
std::vector<std::string> alerts;
|
||||||
foreach (const Alert &a, application.alerts()) {
|
foreach(const Alert & a, application.alerts()) {
|
||||||
snoreDebug(SNORE_DEBUG) << a.name();
|
snoreDebug(SNORE_DEBUG) << a.name();
|
||||||
alerts.push_back(a.name().toUtf8().constData());
|
alerts.push_back(a.name().toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,7 +179,7 @@ void SnarlBackend::slotRegisterApplication(const Application &application)
|
||||||
(HWND)m_eventLoop->winId(), SNORENOTIFIER_MESSAGE_ID);
|
(HWND)m_eventLoop->winId(), SNORENOTIFIER_MESSAGE_ID);
|
||||||
snoreDebug(SNORE_DEBUG) << result;
|
snoreDebug(SNORE_DEBUG) << result;
|
||||||
|
|
||||||
foreach (const Alert &alert, application.alerts()) {
|
foreach(const Alert & alert, application.alerts()) {
|
||||||
snarlInterface->AddClass(alert.name().toUtf8().constData(),
|
snarlInterface->AddClass(alert.name().toUtf8().constData(),
|
||||||
alert.name().toUtf8().constData(),
|
alert.name().toUtf8().constData(),
|
||||||
0, 0, alert.icon().localUrl(QSize(128, 128)).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(),
|
Utils::dataFromImage(notification.icon().pixmap(QSize(128, 128)).toImage()).toBase64().constData(),
|
||||||
priority);
|
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());
|
snarlInterface->AddAction(id, a.name().toUtf8().constData(), (QLatin1Char('@') + QString::number(a.id())).toUtf8().constData());
|
||||||
}
|
}
|
||||||
m_idMap[id] = notification;
|
m_idMap[id] = notification;
|
||||||
|
|
|
@ -19,7 +19,6 @@ Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
id: animation
|
id: animation
|
||||||
properties: "x"
|
properties: "x"
|
||||||
|
@ -32,6 +31,8 @@ Window {
|
||||||
Rectangle{
|
Rectangle{
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
// don't anchor as we need he xChanged signal
|
||||||
|
// a drag event directly on the window is not supported
|
||||||
height: window.height
|
height: window.height
|
||||||
width: window.width
|
width: window.width
|
||||||
color: window.color
|
color: window.color
|
||||||
|
@ -55,8 +56,6 @@ Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: mouseAreaAccept
|
id: mouseAreaAccept
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
|
@ -64,7 +64,7 @@ void Parser::parse(Notification &sNotification, const QString &msg, QTcpSocket *
|
||||||
QByteArray key;
|
QByteArray key;
|
||||||
QString value;
|
QString value;
|
||||||
|
|
||||||
foreach (QString s, splitted) {
|
foreach(QString s, splitted) {
|
||||||
key = s.mid(0, s.indexOf(QLatin1String("="))).toLower().toLatin1();
|
key = s.mid(0, s.indexOf(QLatin1String("="))).toLower().toLatin1();
|
||||||
value = s.mid(s.indexOf(QLatin1String("=")) + 1);
|
value = s.mid(s.indexOf(QLatin1String("=")) + 1);
|
||||||
switch (getSnpType.value(key)) {
|
switch (getSnpType.value(key)) {
|
||||||
|
|
|
@ -90,7 +90,7 @@ void SnarlNetworkFrontend::handleMessages()
|
||||||
QTcpSocket *client = qobject_cast<QTcpSocket *>(sender());
|
QTcpSocket *client = qobject_cast<QTcpSocket *>(sender());
|
||||||
|
|
||||||
QStringList messages(QString::fromLatin1(client->readAll()).trimmed().split(QLatin1String("\r\n")));
|
QStringList messages(QString::fromLatin1(client->readAll()).trimmed().split(QLatin1String("\r\n")));
|
||||||
foreach (const QString &s, messages) {
|
foreach(const QString & s, messages) {
|
||||||
if (s.isEmpty()) {
|
if (s.isEmpty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue