mirror of
https://github.com/status-im/snorenotify.git
synced 2025-02-16 18:36:45 +00:00
style fixes, kde-dev-scripts/astyle-kdelibs
This commit is contained in:
parent
1dbc3e4710
commit
09620f66f0
@ -11,15 +11,15 @@
|
||||
|
||||
using namespace Snore;
|
||||
|
||||
|
||||
class SnoreBenchmark : public QObject{
|
||||
class SnoreBenchmark : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SnoreBenchmark(){
|
||||
SnoreBenchmark()
|
||||
{
|
||||
SnoreCore::instance();
|
||||
}
|
||||
|
||||
|
||||
QString htmlTestString = QLatin1String("<i>Italic A</i><br>"
|
||||
"<i>Italic B</i><br>"
|
||||
"<b>Bold</b><br>"
|
||||
@ -34,9 +34,8 @@ void benchmarkUtilsToPlain();
|
||||
|
||||
};
|
||||
|
||||
|
||||
void SnoreBenchmark::benchmarkUtilsToHtml(){
|
||||
|
||||
void SnoreBenchmark::benchmarkUtilsToHtml()
|
||||
{
|
||||
|
||||
QCOMPARE(Utils::normalizeMarkup(htmlTestString, Utils::NO_MARKUP), QLatin1String("Italic A\n"
|
||||
"Italic B\n"
|
||||
|
@ -50,14 +50,12 @@ public:
|
||||
*/
|
||||
void setValue(const QByteArray &key, const QVariant &value);
|
||||
|
||||
|
||||
/**
|
||||
* The associated value of the key.
|
||||
* @param key the key
|
||||
*/
|
||||
QVariant value(const QByteArray &key) const;
|
||||
|
||||
|
||||
/**
|
||||
* The associated value of the key.
|
||||
* @param key the key
|
||||
|
@ -53,7 +53,6 @@ public:
|
||||
SnorePlugin();
|
||||
virtual ~SnorePlugin();
|
||||
|
||||
|
||||
// TODO: remove need of recursive calling of parent methode....
|
||||
virtual bool initialize();
|
||||
virtual bool deinitialize();
|
||||
|
@ -57,7 +57,6 @@ protected Q_SLOTS:
|
||||
protected:
|
||||
void closeNotification(Snore::Notification, Snore::Notification::CloseReasons);
|
||||
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -235,7 +235,6 @@ Notification SnoreCore::getActiveNotificationByID(uint id) const
|
||||
return d->m_activeNotifications.value(id);
|
||||
}
|
||||
|
||||
|
||||
void SnoreCore::displayExapleNotification()
|
||||
{
|
||||
Application app = SnoreCorePrivate::instance()->defaultApplication();
|
||||
|
@ -262,11 +262,11 @@ static void registerMetaTypes()
|
||||
qRegisterMetaTypeStreamOperators<SnorePlugin::PluginTypes>();
|
||||
}
|
||||
|
||||
static void snoreStartup(){
|
||||
static void snoreStartup()
|
||||
{
|
||||
loadTranslator();
|
||||
registerMetaTypes();
|
||||
}
|
||||
|
||||
Q_COREAPP_STARTUP_FUNCTION(snoreStartup)
|
||||
|
||||
|
||||
|
@ -71,13 +71,11 @@ void Utils::raiseWindowToFront(qlonglong wid)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#define HTML_REPLACE(STRING, PATTERN){\
|
||||
static QRegExp regexp(QLatin1String(PATTERN));\
|
||||
STRING = STRING.replace(regexp, QLatin1String("\\1"));\
|
||||
}\
|
||||
|
||||
|
||||
QString Utils::normalizeMarkup(QString string, MARKUP_FLAGS tags)
|
||||
{
|
||||
static QMutex mutex;
|
||||
|
@ -23,7 +23,6 @@
|
||||
|
||||
int FreedesktopImageHint::imageHintID = qDBusRegisterMetaType<FreedesktopImageHint>();
|
||||
|
||||
|
||||
FreedesktopImageHint::FreedesktopImageHint(const QImage &img)
|
||||
{
|
||||
QImage image(img.convertToFormat(QImage::Format_ARGB32));
|
||||
|
@ -29,7 +29,6 @@ using namespace Snore;
|
||||
|
||||
GrowlBackend *GrowlBackend::s_instance = nullptr;
|
||||
|
||||
|
||||
bool GrowlBackend::initialize()
|
||||
{
|
||||
setDefaultSettingsValue(QLatin1String("Host"), QLatin1String("localhost"));
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include <QSystemTrayIcon>
|
||||
using namespace Snore;
|
||||
|
||||
|
||||
bool TrayIconNotifer::deinitialize()
|
||||
{
|
||||
if (SnoreBackend::deinitialize()) {
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "libsnore/version.h"
|
||||
#include "libsnore/notification/notification_p.h"
|
||||
|
||||
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QHttpMultiPart>
|
||||
#include <QNetworkReply>
|
||||
@ -32,7 +31,6 @@
|
||||
#include <QJsonArray>
|
||||
#include <QtWebSockets/QWebSocket>
|
||||
|
||||
|
||||
using namespace Snore;
|
||||
|
||||
// TODO: use qtkeychain to encrypt credentials?
|
||||
@ -88,18 +86,15 @@ 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 {
|
||||
snoreDebug(SNORE_WARNING) << "An error occure" << input;
|
||||
@ -147,8 +142,7 @@ QString PushoverFrontend::device()
|
||||
|
||||
void PushoverFrontend::connectToService()
|
||||
{
|
||||
if(secret().isEmpty() || device().isEmpty())
|
||||
{
|
||||
if (secret().isEmpty() || device().isEmpty()) {
|
||||
snoreDebug(SNORE_WARNING) << "not logged in";
|
||||
return;
|
||||
}
|
||||
@ -203,7 +197,6 @@ 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();
|
||||
@ -222,7 +215,6 @@ void PushoverFrontend::registerDevice(const QString &secret, const QString &devi
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
void PushoverFrontend::getMessages()
|
||||
@ -231,7 +223,6 @@ void PushoverFrontend::getMessages()
|
||||
"secret=") + secret() + QLatin1String("&device_id=") + device()).toUtf8().constData()));
|
||||
QNetworkReply *reply = m_manager.get(request);
|
||||
|
||||
|
||||
connect(reply, &QNetworkReply::finished, [reply, this]() {
|
||||
snoreDebug(SNORE_DEBUG) << reply->error();
|
||||
QByteArray input = reply->readAll();
|
||||
@ -261,7 +252,6 @@ void PushoverFrontend::getMessages()
|
||||
SnoreCore::instance().registerApplication(app);
|
||||
}
|
||||
|
||||
|
||||
Notification n(app, app.defaultAlert(), notification.value(QLatin1String("title")).toString(),
|
||||
notification.value(QLatin1String("message")).toString(),
|
||||
app.icon(), Notification::defaultTimeout(),
|
||||
@ -295,7 +285,6 @@ void PushoverFrontend::deleteMessages(int latestMessageId)
|
||||
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();
|
||||
@ -318,7 +307,6 @@ void PushoverFrontend::acknowledgeNotification(Notification notification)
|
||||
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)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include <QPointer>
|
||||
#include <QtWebSockets/QWebSocket>
|
||||
|
||||
|
||||
class PushoverFrontend : public Snore::SnoreFrontend
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -68,9 +67,6 @@ private:
|
||||
void deleteMessages(int latestMessageId);
|
||||
void acknowledgeNotification(Snore::Notification notification);
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif//PUSHOVER_FRONTEND_H
|
||||
|
@ -44,7 +44,6 @@ private:
|
||||
private Q_SLOTS:
|
||||
void slotUpdateLoginState(bool state);
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // PUSHOVERSETTINGS_H
|
||||
|
@ -36,7 +36,6 @@ 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()
|
||||
@ -51,7 +50,6 @@ void NotifyMyAndroid::slotNotify(Notification notification)
|
||||
data += notification.text();
|
||||
}
|
||||
|
||||
|
||||
QNetworkReply *reply = m_manager.post(request, data.toUtf8().constData());
|
||||
connect(reply, &QNetworkReply::finished, [reply]() {
|
||||
snoreDebug(SNORE_DEBUG) << reply->error();
|
||||
|
Loading…
x
Reference in New Issue
Block a user