Apply clang-format to rest of cpp
This commit is contained in:
@@ -6,12 +6,12 @@
|
|||||||
#include "clipboard.h"
|
#include "clipboard.h"
|
||||||
|
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
#include <QMimeData>
|
|
||||||
#include <QRegularExpression>
|
|
||||||
#include <QImage>
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
|
#include <QImage>
|
||||||
|
#include <QMimeData>
|
||||||
|
#include <QRegularExpression>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
Clipboard::Clipboard(QObject *parent)
|
Clipboard::Clipboard(QObject *parent)
|
||||||
|
|||||||
@@ -38,9 +38,9 @@
|
|||||||
#include "csapi/registration.h"
|
#include "csapi/registration.h"
|
||||||
#include "events/eventcontent.h"
|
#include "events/eventcontent.h"
|
||||||
#include "events/roommessageevent.h"
|
#include "events/roommessageevent.h"
|
||||||
#include "settings.h"
|
|
||||||
#include "neochatroom.h"
|
#include "neochatroom.h"
|
||||||
#include "neochatuser.h"
|
#include "neochatuser.h"
|
||||||
|
#include "settings.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
Controller::Controller(QObject *parent)
|
Controller::Controller(QObject *parent)
|
||||||
@@ -53,7 +53,9 @@ Controller::Controller(QObject *parent)
|
|||||||
|
|
||||||
connect(&m_ncm, &QNetworkConfigurationManager::onlineStateChanged, this, &Controller::isOnlineChanged);
|
connect(&m_ncm, &QNetworkConfigurationManager::onlineStateChanged, this, &Controller::isOnlineChanged);
|
||||||
|
|
||||||
QTimer::singleShot(0, this, [=] { invokeLogin(); });
|
QTimer::singleShot(0, this, [=] {
|
||||||
|
invokeLogin();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller::~Controller()
|
Controller::~Controller()
|
||||||
@@ -108,8 +110,12 @@ void Controller::loginWithCredentials(QString serverAddr, QString user, QString
|
|||||||
addConnection(conn);
|
addConnection(conn);
|
||||||
setConnection(conn);
|
setConnection(conn);
|
||||||
});
|
});
|
||||||
connect(conn, &Connection::networkError, [=](QString error, QString, int, int) { Q_EMIT errorOccured("Network Error", error); });
|
connect(conn, &Connection::networkError, [=](QString error, QString, int, int) {
|
||||||
connect(conn, &Connection::loginError, [=](QString error, QString) { Q_EMIT errorOccured("Login Failed", error); });
|
Q_EMIT errorOccured("Network Error", error);
|
||||||
|
});
|
||||||
|
connect(conn, &Connection::loginError, [=](QString error, QString) {
|
||||||
|
Q_EMIT errorOccured("Login Failed", error);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::loginWithAccessToken(QString serverAddr, QString user, QString token, QString deviceName)
|
void Controller::loginWithAccessToken(QString serverAddr, QString user, QString token, QString deviceName)
|
||||||
@@ -138,7 +144,9 @@ void Controller::loginWithAccessToken(QString serverAddr, QString user, QString
|
|||||||
addConnection(conn);
|
addConnection(conn);
|
||||||
setConnection(conn);
|
setConnection(conn);
|
||||||
});
|
});
|
||||||
connect(conn, &Connection::networkError, this, [=](QString error, QString, int, int) { Q_EMIT errorOccured("Network Error", error); });
|
connect(conn, &Connection::networkError, this, [=](QString error, QString, int, int) {
|
||||||
|
Q_EMIT errorOccured("Network Error", error);
|
||||||
|
});
|
||||||
conn->connectWithToken(user, token, deviceName);
|
conn->connectWithToken(user, token, deviceName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,7 +184,9 @@ void Controller::logout(Connection *conn)
|
|||||||
else
|
else
|
||||||
setConnection(nullptr);
|
setConnection(nullptr);
|
||||||
});
|
});
|
||||||
connect(logoutJob, &LogoutJob::failure, this, [=] { Q_EMIT errorOccured("Server-side Logout Failed", logoutJob->errorString()); });
|
connect(logoutJob, &LogoutJob::failure, this, [=] {
|
||||||
|
Q_EMIT errorOccured("Server-side Logout Failed", logoutJob->errorString());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::addConnection(Connection *c)
|
void Controller::addConnection(Connection *c)
|
||||||
@@ -195,7 +205,9 @@ void Controller::addConnection(Connection *c)
|
|||||||
c->sync(30000);
|
c->sync(30000);
|
||||||
c->saveState();
|
c->saveState();
|
||||||
});
|
});
|
||||||
connect(c, &Connection::loggedOut, this, [=] { dropConnection(c); });
|
connect(c, &Connection::loggedOut, this, [=] {
|
||||||
|
dropConnection(c);
|
||||||
|
});
|
||||||
connect(&m_ncm, &QNetworkConfigurationManager::onlineStateChanged, [=](bool status) {
|
connect(&m_ncm, &QNetworkConfigurationManager::onlineStateChanged, [=](bool status) {
|
||||||
if (!status) {
|
if (!status) {
|
||||||
return;
|
return;
|
||||||
@@ -238,7 +250,9 @@ void Controller::invokeLogin()
|
|||||||
Q_EMIT errorOccured("Login Failed", error);
|
Q_EMIT errorOccured("Login Failed", error);
|
||||||
logout(c);
|
logout(c);
|
||||||
});
|
});
|
||||||
connect(c, &Connection::networkError, this, [=](QString error, QString, int, int) { Q_EMIT errorOccured("Network Error", error); });
|
connect(c, &Connection::networkError, this, [=](QString error, QString, int, int) {
|
||||||
|
Q_EMIT errorOccured("Network Error", error);
|
||||||
|
});
|
||||||
c->connectWithToken(account.userId(), accessToken, account.deviceId());
|
c->connectWithToken(account.userId(), accessToken, account.deviceId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -358,19 +372,25 @@ void Controller::joinRoom(Connection *c, const QString &alias)
|
|||||||
|
|
||||||
auto knownServer = alias.mid(alias.indexOf(":") + 1);
|
auto knownServer = alias.mid(alias.indexOf(":") + 1);
|
||||||
auto joinRoomJob = c->joinRoom(alias, QStringList {knownServer});
|
auto joinRoomJob = c->joinRoom(alias, QStringList {knownServer});
|
||||||
joinRoomJob->connect(joinRoomJob, &JoinRoomJob::failure, [=] { Q_EMIT errorOccured("Join Room Failed", joinRoomJob->errorString()); });
|
joinRoomJob->connect(joinRoomJob, &JoinRoomJob::failure, [=] {
|
||||||
|
Q_EMIT errorOccured("Join Room Failed", joinRoomJob->errorString());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::createRoom(Connection *c, const QString &name, const QString &topic)
|
void Controller::createRoom(Connection *c, const QString &name, const QString &topic)
|
||||||
{
|
{
|
||||||
auto createRoomJob = c->createRoom(Connection::PublishRoom, "", name, topic, QStringList());
|
auto createRoomJob = c->createRoom(Connection::PublishRoom, "", name, topic, QStringList());
|
||||||
createRoomJob->connect(createRoomJob, &CreateRoomJob::failure, [=] { Q_EMIT errorOccured("Create Room Failed", createRoomJob->errorString()); });
|
createRoomJob->connect(createRoomJob, &CreateRoomJob::failure, [=] {
|
||||||
|
Q_EMIT errorOccured("Create Room Failed", createRoomJob->errorString());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::createDirectChat(Connection *c, const QString &userID)
|
void Controller::createDirectChat(Connection *c, const QString &userID)
|
||||||
{
|
{
|
||||||
auto createRoomJob = c->createDirectChat(userID);
|
auto createRoomJob = c->createDirectChat(userID);
|
||||||
createRoomJob->connect(createRoomJob, &CreateRoomJob::failure, [=] { Q_EMIT errorOccured("Create Direct Chat Failed", createRoomJob->errorString()); });
|
createRoomJob->connect(createRoomJob, &CreateRoomJob::failure, [=] {
|
||||||
|
Q_EMIT errorOccured("Create Direct Chat Failed", createRoomJob->errorString());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::playAudio(QUrl localFile)
|
void Controller::playAudio(QUrl localFile)
|
||||||
@@ -378,14 +398,18 @@ void Controller::playAudio(QUrl localFile)
|
|||||||
auto player = new QMediaPlayer;
|
auto player = new QMediaPlayer;
|
||||||
player->setMedia(localFile);
|
player->setMedia(localFile);
|
||||||
player->play();
|
player->play();
|
||||||
connect(player, &QMediaPlayer::stateChanged, [=] { player->deleteLater(); });
|
connect(player, &QMediaPlayer::stateChanged, [=] {
|
||||||
|
player->deleteLater();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::changeAvatar(Connection *conn, QUrl localFile)
|
void Controller::changeAvatar(Connection *conn, QUrl localFile)
|
||||||
{
|
{
|
||||||
auto job = conn->uploadFile(localFile.toLocalFile());
|
auto job = conn->uploadFile(localFile.toLocalFile());
|
||||||
if (isJobRunning(job)) {
|
if (isJobRunning(job)) {
|
||||||
connect(job, &BaseJob::success, this, [conn, job] { conn->callApi<SetAvatarUrlJob>(conn->userId(), job->contentUri()); });
|
connect(job, &BaseJob::success, this, [conn, job] {
|
||||||
|
conn->callApi<SetAvatarUrlJob>(conn->userId(), job->contentUri());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -422,7 +446,9 @@ void Controller::changePassword(Connection *connection, const QString ¤tPa
|
|||||||
QJsonObject identifier = {{"type", "m.id.user"}, {"user", connection->user()->id()}};
|
QJsonObject identifier = {{"type", "m.id.user"}, {"user", connection->user()->id()}};
|
||||||
authData["identifier"] = identifier;
|
authData["identifier"] = identifier;
|
||||||
NeochatChangePasswordJob *innerJob = connection->callApi<NeochatChangePasswordJob>(newPassword, false, authData);
|
NeochatChangePasswordJob *innerJob = connection->callApi<NeochatChangePasswordJob>(newPassword, false, authData);
|
||||||
connect(innerJob, &BaseJob::success, this, [this]() { Q_EMIT passwordStatus(PasswordStatus::Success); });
|
connect(innerJob, &BaseJob::success, this, [this]() {
|
||||||
|
Q_EMIT passwordStatus(PasswordStatus::Success);
|
||||||
|
});
|
||||||
connect(innerJob, &BaseJob::failure, this, [innerJob, this]() {
|
connect(innerJob, &BaseJob::failure, this, [innerJob, this]() {
|
||||||
if (innerJob->jsonData()["errcode"] == "M_FORBIDDEN") {
|
if (innerJob->jsonData()["errcode"] == "M_FORBIDDEN") {
|
||||||
Q_EMIT passwordStatus(PasswordStatus::Wrong);
|
Q_EMIT passwordStatus(PasswordStatus::Wrong);
|
||||||
|
|||||||
@@ -19,20 +19,20 @@
|
|||||||
#include "neochat-version.h"
|
#include "neochat-version.h"
|
||||||
|
|
||||||
#include "accountlistmodel.h"
|
#include "accountlistmodel.h"
|
||||||
|
#include "clipboard.h"
|
||||||
#include "controller.h"
|
#include "controller.h"
|
||||||
#include "csapi/joining.h"
|
#include "csapi/joining.h"
|
||||||
#include "csapi/leaving.h"
|
#include "csapi/leaving.h"
|
||||||
#include "emojimodel.h"
|
#include "emojimodel.h"
|
||||||
#include "clipboard.h"
|
|
||||||
#include "matriximageprovider.h"
|
#include "matriximageprovider.h"
|
||||||
#include "messageeventmodel.h"
|
#include "messageeventmodel.h"
|
||||||
|
#include "neochatroom.h"
|
||||||
|
#include "neochatuser.h"
|
||||||
#include "notificationsmanager.h"
|
#include "notificationsmanager.h"
|
||||||
#include "publicroomlistmodel.h"
|
#include "publicroomlistmodel.h"
|
||||||
#include "room.h"
|
#include "room.h"
|
||||||
#include "roomlistmodel.h"
|
#include "roomlistmodel.h"
|
||||||
#include "sortfilterroomlistmodel.h"
|
#include "sortfilterroomlistmodel.h"
|
||||||
#include "neochatroom.h"
|
|
||||||
#include "neochatuser.h"
|
|
||||||
#include "trayicon.h"
|
#include "trayicon.h"
|
||||||
#include "userdirectorylistmodel.h"
|
#include "userdirectorylistmodel.h"
|
||||||
#include "userlistmodel.h"
|
#include "userlistmodel.h"
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
#include <QAbstractListModel>
|
#include <QAbstractListModel>
|
||||||
|
|
||||||
#include "room.h"
|
|
||||||
#include "neochatroom.h"
|
#include "neochatroom.h"
|
||||||
|
#include "room.h"
|
||||||
|
|
||||||
class MessageEventModel : public QAbstractListModel
|
class MessageEventModel : public QAbstractListModel
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
#include "room.h"
|
|
||||||
#include "neochatuser.h"
|
#include "neochatuser.h"
|
||||||
|
#include "room.h"
|
||||||
|
|
||||||
using namespace Quotient;
|
using namespace Quotient;
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ QColor NeoChatUser::color()
|
|||||||
{
|
{
|
||||||
return QColor::fromHslF(hueF(), 0.7, 0.5, 1);
|
return QColor::fromHslF(hueF(), 0.7, 0.5, 1);
|
||||||
}
|
}
|
||||||
//TODO libQuotient 0.7: remove default name
|
// TODO libQuotient 0.7: remove default name
|
||||||
void NeoChatUser::setDefaultName(QString defaultName)
|
void NeoChatUser::setDefaultName(QString defaultName)
|
||||||
{
|
{
|
||||||
rename(defaultName);
|
rename(defaultName);
|
||||||
@@ -24,10 +24,10 @@ void NeoChatUser::setDefaultName(QString defaultName)
|
|||||||
|
|
||||||
QString NeoChatUser::defaultName()
|
QString NeoChatUser::defaultName()
|
||||||
{
|
{
|
||||||
if(m_defaultName.isEmpty()) {
|
if (m_defaultName.isEmpty()) {
|
||||||
GetDisplayNameJob *job = connection()->callApi<GetDisplayNameJob>(id());
|
GetDisplayNameJob *job = connection()->callApi<GetDisplayNameJob>(id());
|
||||||
connect(job, &BaseJob::success, this, [this, job] {
|
connect(job, &BaseJob::success, this, [this, job] {
|
||||||
if(job->displayname().isEmpty())
|
if (job->displayname().isEmpty())
|
||||||
m_defaultName = id();
|
m_defaultName = id();
|
||||||
else
|
else
|
||||||
m_defaultName = job->displayname();
|
m_defaultName = job->displayname();
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public:
|
|||||||
|
|
||||||
QColor color();
|
QColor color();
|
||||||
|
|
||||||
//TODO libQuotient 0.7: remove
|
// TODO libQuotient 0.7: remove
|
||||||
void setDefaultName(QString defaultName);
|
void setDefaultName(QString defaultName);
|
||||||
QString defaultName();
|
QString defaultName();
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
#include "connection.h"
|
#include "connection.h"
|
||||||
#include "events/roomevent.h"
|
#include "events/roomevent.h"
|
||||||
#include "room.h"
|
|
||||||
#include "neochatroom.h"
|
#include "neochatroom.h"
|
||||||
|
#include "room.h"
|
||||||
|
|
||||||
#include <QAbstractListModel>
|
#include <QAbstractListModel>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user