s/emit/Q_EMIT

This commit is contained in:
Carl Schwan
2020-11-03 12:03:06 +01:00
parent 4af7c14110
commit ce69506cf6
15 changed files with 59 additions and 59 deletions

View File

@@ -47,7 +47,7 @@ void AccountListModel::setController(Controller *value)
m_connections.erase(it); m_connections.erase(it);
endRemoveRows(); endRemoveRows();
}); });
emit controllerChanged(); Q_EMIT controllerChanged();
} }
QVariant AccountListModel::data(const QModelIndex &index, int role) const QVariant AccountListModel::data(const QModelIndex &index, int role) const

View File

@@ -99,10 +99,10 @@ void Controller::loginWithCredentials(QString serverAddr, QString user, QString
setConnection(conn); setConnection(conn);
}); });
connect(conn, &Connection::networkError, [=](QString error, QString, int, int) { connect(conn, &Connection::networkError, [=](QString error, QString, int, int) {
emit errorOccured("Network Error", error); Q_EMIT errorOccured("Network Error", error);
}); });
connect(conn, &Connection::loginError, [=](QString error, QString) { connect(conn, &Connection::loginError, [=](QString error, QString) {
emit errorOccured("Login Failed", error); Q_EMIT errorOccured("Login Failed", error);
}); });
} }
@@ -133,7 +133,7 @@ void Controller::loginWithAccessToken(QString serverAddr, QString user, QString
setConnection(conn); setConnection(conn);
}); });
connect(conn, &Connection::networkError, [=](QString error, QString, int, int) { connect(conn, &Connection::networkError, [=](QString error, QString, int, int) {
emit errorOccured("Network Error", error); Q_EMIT errorOccured("Network Error", error);
}); });
conn->connectWithToken(user, token, deviceName); conn->connectWithToken(user, token, deviceName);
} }
@@ -159,13 +159,13 @@ void Controller::logout(Connection *conn)
auto logoutJob = conn->callApi<LogoutJob>(); auto logoutJob = conn->callApi<LogoutJob>();
connect(logoutJob, &LogoutJob::finished, conn, [=] { connect(logoutJob, &LogoutJob::finished, conn, [=] {
conn->stopSync(); conn->stopSync();
emit conn->stateChanged(); Q_EMIT conn->stateChanged();
emit conn->loggedOut(); Q_EMIT conn->loggedOut();
if (!m_connections.isEmpty()) if (!m_connections.isEmpty())
setConnection(m_connections[0]); setConnection(m_connections[0]);
}); });
connect(logoutJob, &LogoutJob::failure, this, [=] { connect(logoutJob, &LogoutJob::failure, this, [=] {
emit errorOccured("Server-side Logout Failed", logoutJob->errorString()); Q_EMIT errorOccured("Server-side Logout Failed", logoutJob->errorString());
}); });
} }
@@ -180,7 +180,7 @@ void Controller::addConnection(Connection *c)
connect(c, &Connection::syncDone, this, [=] { connect(c, &Connection::syncDone, this, [=] {
setBusy(false); setBusy(false);
emit syncDone(); Q_EMIT syncDone();
c->sync(30000); c->sync(30000);
c->saveState(); c->saveState();
@@ -203,7 +203,7 @@ void Controller::addConnection(Connection *c)
c->sync(); c->sync();
emit connectionAdded(c); Q_EMIT connectionAdded(c);
} }
void Controller::dropConnection(Connection *c) void Controller::dropConnection(Connection *c)
@@ -211,7 +211,7 @@ void Controller::dropConnection(Connection *c)
Q_ASSERT_X(c, __FUNCTION__, "Attempt to drop a null connection"); Q_ASSERT_X(c, __FUNCTION__, "Attempt to drop a null connection");
m_connections.removeOne(c); m_connections.removeOne(c);
emit connectionDropped(c); Q_EMIT connectionDropped(c);
c->deleteLater(); c->deleteLater();
} }
@@ -231,11 +231,11 @@ void Controller::invokeLogin()
addConnection(c); addConnection(c);
}); });
connect(c, &Connection::loginError, [=](QString error, QString) { connect(c, &Connection::loginError, [=](QString error, QString) {
emit errorOccured("Login Failed", error); Q_EMIT errorOccured("Login Failed", error);
logout(c); logout(c);
}); });
connect(c, &Connection::networkError, [=](QString error, QString, int, int) { connect(c, &Connection::networkError, [=](QString error, QString, int, int) {
emit errorOccured("Network Error", error); Q_EMIT errorOccured("Network Error", error);
}); });
c->connectWithToken(account.userId(), accessToken, account.deviceId()); c->connectWithToken(account.userId(), accessToken, account.deviceId());
} }
@@ -245,7 +245,7 @@ void Controller::invokeLogin()
setConnection(m_connections[0]); setConnection(m_connections[0]);
} }
emit initiated(); Q_EMIT initiated();
} }
QByteArray Controller::loadAccessTokenFromFile(const AccountSettings &account) QByteArray Controller::loadAccessTokenFromFile(const AccountSettings &account)
@@ -307,7 +307,7 @@ bool Controller::saveAccessTokenToFile(const AccountSettings &account, const QBy
auto fileDir = QFileInfo(accountTokenFile).dir(); auto fileDir = QFileInfo(accountTokenFile).dir();
if (!((fileDir.exists() || fileDir.mkpath(".")) && accountTokenFile.open(QFile::WriteOnly))) { if (!((fileDir.exists() || fileDir.mkpath(".")) && accountTokenFile.open(QFile::WriteOnly))) {
emit errorOccured("I/O Denied", "Cannot save access token."); Q_EMIT errorOccured("I/O Denied", "Cannot save access token.");
} else { } else {
accountTokenFile.write(accessToken); accountTokenFile.write(accessToken);
return true; return true;
@@ -343,7 +343,7 @@ 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, [=] { joinRoomJob->connect(joinRoomJob, &JoinRoomJob::failure, [=] {
emit errorOccured("Join Room Failed", joinRoomJob->errorString()); Q_EMIT errorOccured("Join Room Failed", joinRoomJob->errorString());
}); });
} }
@@ -351,7 +351,7 @@ void Controller::createRoom(Connection *c, const QString &name, const QString &t
{ {
auto createRoomJob = c->createRoom(Connection::PublishRoom, "", name, topic, QStringList()); auto createRoomJob = c->createRoom(Connection::PublishRoom, "", name, topic, QStringList());
createRoomJob->connect(createRoomJob, &CreateRoomJob::failure, [=] { createRoomJob->connect(createRoomJob, &CreateRoomJob::failure, [=] {
emit errorOccured("Create Room Failed", createRoomJob->errorString()); Q_EMIT errorOccured("Create Room Failed", createRoomJob->errorString());
}); });
} }
@@ -359,7 +359,7 @@ void Controller::createDirectChat(Connection *c, const QString &userID)
{ {
auto createRoomJob = c->createDirectChat(userID); auto createRoomJob = c->createDirectChat(userID);
createRoomJob->connect(createRoomJob, &CreateRoomJob::failure, [=] { createRoomJob->connect(createRoomJob, &CreateRoomJob::failure, [=] {
emit errorOccured("Create Direct Chat Failed", createRoomJob->errorString()); Q_EMIT errorOccured("Create Direct Chat Failed", createRoomJob->errorString());
}); });
} }

View File

@@ -61,7 +61,7 @@ public:
if (quitOnLastWindowClosed() != value) { if (quitOnLastWindowClosed() != value) {
QApplication::setQuitOnLastWindowClosed(value); QApplication::setQuitOnLastWindowClosed(value);
emit quitOnLastWindowClosedChanged(); Q_EMIT quitOnLastWindowClosedChanged();
} }
} }
@@ -80,7 +80,7 @@ public:
return; return;
} }
m_busy = busy; m_busy = busy;
emit busyChanged(); Q_EMIT busyChanged();
} }
Connection *connection() const Connection *connection() const
@@ -96,7 +96,7 @@ public:
if (conn == m_connection) if (conn == m_connection)
return; return;
m_connection = conn; m_connection = conn;
emit connectionChanged(); Q_EMIT connectionChanged();
} }
private: private:

View File

@@ -85,7 +85,7 @@ void EmojiModel::emojiUsed(QVariant modelData)
list.push_front(modelData); list.push_front(modelData);
m_settings->setValue("Editor/emojis", list); m_settings->setValue("Editor/emojis", list);
emit historyChanged(); Q_EMIT historyChanged();
} }
const QVariantList EmojiModel::people = { const QVariantList EmojiModel::people = {

View File

@@ -23,12 +23,12 @@ ThumbnailResponse::ThumbnailResponse(Quotient::Connection *c, QString id, const
{ {
if (requestedSize.isEmpty()) { if (requestedSize.isEmpty()) {
errorStr.clear(); errorStr.clear();
emit finished(); Q_EMIT finished();
return; return;
} }
if (mediaId.count('/') != 1) { if (mediaId.count('/') != 1) {
errorStr = tr("Media id '%1' doesn't follow server/mediaId pattern").arg(mediaId); errorStr = tr("Media id '%1' doesn't follow server/mediaId pattern").arg(mediaId);
emit finished(); Q_EMIT finished();
return; return;
} }
@@ -36,7 +36,7 @@ ThumbnailResponse::ThumbnailResponse(Quotient::Connection *c, QString id, const
if (cachedImage.load(localFile)) { if (cachedImage.load(localFile)) {
image = cachedImage; image = cachedImage;
errorStr.clear(); errorStr.clear();
emit finished(); Q_EMIT finished();
return; return;
} }
@@ -86,7 +86,7 @@ void ThumbnailResponse::prepareResult()
} }
job = nullptr; job = nullptr;
} }
emit finished(); Q_EMIT finished();
} }
void ThumbnailResponse::doCancel() void ThumbnailResponse::doCancel()

View File

@@ -65,7 +65,7 @@ public:
void setConnection(Quotient::Connection *connection) void setConnection(Quotient::Connection *connection)
{ {
m_connection.storeRelaxed(connection); m_connection.storeRelaxed(connection);
emit connectionChanged(); Q_EMIT connectionChanged();
} }
signals: signals:

View File

@@ -164,7 +164,7 @@ int MessageEventModel::timelineBaseIndex() const
void MessageEventModel::refreshEventRoles(int row, const QVector<int> &roles) void MessageEventModel::refreshEventRoles(int row, const QVector<int> &roles)
{ {
const auto idx = index(row); const auto idx = index(row);
emit dataChanged(idx, idx, roles); Q_EMIT dataChanged(idx, idx, roles);
} }
int MessageEventModel::refreshEventRoles(const QString &id, const QVector<int> &roles) int MessageEventModel::refreshEventRoles(const QString &id, const QVector<int> &roles)
@@ -241,7 +241,7 @@ void MessageEventModel::refreshLastUserEvents(int baseTimelineRow)
for (auto it = timelineBottom + std::max(baseTimelineRow - 10, 0); it != limit; ++it) { for (auto it = timelineBottom + std::max(baseTimelineRow - 10, 0); it != limit; ++it) {
if ((*it)->senderId() == lastSender) { if ((*it)->senderId() == lastSender) {
auto idx = index(it - timelineBottom); auto idx = index(it - timelineBottom);
emit dataChanged(idx, idx); Q_EMIT dataChanged(idx, idx);
} }
} }
} }

View File

@@ -34,9 +34,9 @@ void PublicRoomListModel::setConnection(Connection *conn)
next(); next();
} }
emit connectionChanged(); Q_EMIT connectionChanged();
emit serverChanged(); Q_EMIT serverChanged();
emit hasMoreChanged(); Q_EMIT hasMoreChanged();
} }
void PublicRoomListModel::setServer(const QString &value) void PublicRoomListModel::setServer(const QString &value)
@@ -63,8 +63,8 @@ void PublicRoomListModel::setServer(const QString &value)
next(); next();
} }
emit serverChanged(); Q_EMIT serverChanged();
emit hasMoreChanged(); Q_EMIT hasMoreChanged();
} }
void PublicRoomListModel::setKeyword(const QString &value) void PublicRoomListModel::setKeyword(const QString &value)
@@ -91,8 +91,8 @@ void PublicRoomListModel::setKeyword(const QString &value)
next(); next();
} }
emit keywordChanged(); Q_EMIT keywordChanged();
emit hasMoreChanged(); Q_EMIT hasMoreChanged();
} }
void PublicRoomListModel::next(int count) void PublicRoomListModel::next(int count)
@@ -122,7 +122,7 @@ void PublicRoomListModel::next(int count)
this->endInsertRows(); this->endInsertRows();
if (job->nextBatch().isEmpty()) { if (job->nextBatch().isEmpty()) {
emit hasMoreChanged(); Q_EMIT hasMoreChanged();
} }
} }

View File

@@ -77,7 +77,7 @@ void RoomListModel::doAddRoom(Room *r)
if (auto room = static_cast<SpectralRoom *>(r)) { if (auto room = static_cast<SpectralRoom *>(r)) {
m_rooms.append(room); m_rooms.append(room);
connectRoomSignals(room); connectRoomSignals(room);
emit roomAdded(room); Q_EMIT roomAdded(room);
} else { } else {
qCritical() << "Attempt to add nullptr to the room list"; qCritical() << "Attempt to add nullptr to the room list";
Q_ASSERT(false); Q_ASSERT(false);
@@ -118,7 +118,7 @@ void RoomListModel::connectRoomSignals(SpectralRoom *room)
User *sender = room->user(lastEvent->senderId()); User *sender = room->user(lastEvent->senderId());
if (sender == room->localUser()) if (sender == room->localUser())
return; return;
emit newMessage(room->id(), lastEvent->id(), room->displayName(), sender->displayname(), room->eventToString(*lastEvent), room->avatar(128)); Q_EMIT newMessage(room->id(), lastEvent->id(), room->displayName(), sender->displayname(), room->eventToString(*lastEvent), room->avatar(128));
}); });
connect(room, &Room::highlightCountChanged, this, [=] { connect(room, &Room::highlightCountChanged, this, [=] {
if (room->highlightCount() == 0) if (room->highlightCount() == 0)
@@ -131,7 +131,7 @@ void RoomListModel::connectRoomSignals(SpectralRoom *room)
User *sender = room->user(lastEvent->senderId()); User *sender = room->user(lastEvent->senderId());
if (sender == room->localUser()) if (sender == room->localUser())
return; return;
emit newHighlight(room->id(), lastEvent->id(), room->displayName(), sender->displayname(), room->eventToString(*lastEvent), room->avatar(128)); Q_EMIT newHighlight(room->id(), lastEvent->id(), room->displayName(), sender->displayname(), room->eventToString(*lastEvent), room->avatar(128));
}); });
connect(room, &Room::notificationCountChanged, this, &RoomListModel::refreshNotificationCount); connect(room, &Room::notificationCountChanged, this, &RoomListModel::refreshNotificationCount);
} }
@@ -143,7 +143,7 @@ void RoomListModel::refreshNotificationCount()
count += room->notificationCount(); count += room->notificationCount();
} }
m_notificationCount = count; m_notificationCount = count;
emit notificationCountChanged(); Q_EMIT notificationCountChanged();
} }
void RoomListModel::updateRoom(Room *room, Room *prev) void RoomListModel::updateRoom(Room *room, Room *prev)
@@ -174,7 +174,7 @@ void RoomListModel::updateRoom(Room *room, Room *prev)
m_rooms.replace(row, newRoom); m_rooms.replace(row, newRoom);
connectRoomSignals(newRoom); connectRoomSignals(newRoom);
} }
emit dataChanged(index(row), index(row)); Q_EMIT dataChanged(index(row), index(row));
} else { } else {
beginInsertRows(QModelIndex(), m_rooms.count(), m_rooms.count()); beginInsertRows(QModelIndex(), m_rooms.count(), m_rooms.count());
doAddRoom(newRoom); doAddRoom(newRoom);
@@ -257,7 +257,7 @@ void RoomListModel::refresh(SpectralRoom *room, const QVector<int> &roles)
return; return;
} }
const auto idx = index(it - m_rooms.begin()); const auto idx = index(it - m_rooms.begin());
emit dataChanged(idx, idx, roles); Q_EMIT dataChanged(idx, idx, roles);
} }
QHash<int, QByteArray> RoomListModel::roleNames() const QHash<int, QByteArray> RoomListModel::roleNames() const

View File

@@ -153,7 +153,7 @@ void SpectralRoom::onRedaction(const RoomEvent &prevEvent, const RoomEvent & /*a
{ {
if (const auto &e = eventCast<const ReactionEvent>(&prevEvent)) { if (const auto &e = eventCast<const ReactionEvent>(&prevEvent)) {
if (auto relatedEventId = e->relation().eventId; !relatedEventId.isEmpty()) { if (auto relatedEventId = e->relation().eventId; !relatedEventId.isEmpty()) {
emit updatedEvent(relatedEventId); Q_EMIT updatedEvent(relatedEventId);
} }
} }
} }

View File

@@ -47,7 +47,7 @@ public:
return; return;
} }
m_hasFileUploading = value; m_hasFileUploading = value;
emit hasFileUploadingChanged(); Q_EMIT hasFileUploadingChanged();
} }
int fileUploadingProgress() const int fileUploadingProgress() const
@@ -60,7 +60,7 @@ public:
return; return;
} }
m_fileUploadingProgress = value; m_fileUploadingProgress = value;
emit fileUploadingProgressChanged(); Q_EMIT fileUploadingProgressChanged();
} }
Q_INVOKABLE int savedTopVisibleIndex() const; Q_INVOKABLE int savedTopVisibleIndex() const;

View File

@@ -125,7 +125,7 @@ void TrayIcon::setNotificationCount(int count)
icon_ = tmp; icon_ = tmp;
#endif #endif
emit notificationCountChanged(); Q_EMIT notificationCountChanged();
} }
void TrayIcon::setIsOnline(bool online) void TrayIcon::setIsOnline(bool online)
@@ -161,7 +161,7 @@ void TrayIcon::setIsOnline(bool online)
icon_ = tmp; icon_ = tmp;
#endif #endif
emit isOnlineChanged(); Q_EMIT isOnlineChanged();
} }
void TrayIcon::setIconSource(const QString &source) void TrayIcon::setIconSource(const QString &source)
@@ -175,5 +175,5 @@ void TrayIcon::setIconSource(const QString &source)
icon_->isOnline = m_isOnline; icon_->isOnline = m_isOnline;
icon_->msgCount = m_notificationCount; icon_->msgCount = m_notificationCount;
#endif #endif
emit iconSourceChanged(); Q_EMIT iconSourceChanged();
} }

View File

@@ -15,10 +15,10 @@ class MsgCountComposedIcon : public QIconEngine
public: public:
MsgCountComposedIcon(const QString &filename); MsgCountComposedIcon(const QString &filename);
virtual void paint(QPainter *p, const QRect &rect, QIcon::Mode mode, QIcon::State state); virtual void paint(QPainter *p, const QRect &rect, QIcon::Mode mode, QIcon::State state) override;
virtual QIconEngine *clone() const; virtual QIconEngine *clone() const override;
virtual QList<QSize> availableSizes(QIcon::Mode mode, QIcon::State state) const; virtual QList<QSize> availableSizes(QIcon::Mode mode, QIcon::State state) const override;
virtual QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state); virtual QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) override;
int msgCount = 0; int msgCount = 0;
bool isOnline = true; // Default to false? bool isOnline = true; // Default to false?

View File

@@ -29,8 +29,8 @@ void UserDirectoryListModel::setConnection(Connection *conn)
job = nullptr; job = nullptr;
} }
emit connectionChanged(); Q_EMIT connectionChanged();
emit limitedChanged(); Q_EMIT limitedChanged();
} }
void UserDirectoryListModel::setKeyword(const QString &value) void UserDirectoryListModel::setKeyword(const QString &value)
@@ -48,8 +48,8 @@ void UserDirectoryListModel::setKeyword(const QString &value)
job = nullptr; job = nullptr;
} }
emit keywordChanged(); Q_EMIT keywordChanged();
emit limitedChanged(); Q_EMIT limitedChanged();
} }
void UserDirectoryListModel::search(int count) void UserDirectoryListModel::search(int count)
@@ -84,7 +84,7 @@ void UserDirectoryListModel::search(int count)
this->job = nullptr; this->job = nullptr;
emit limitedChanged(); Q_EMIT limitedChanged();
}); });
} }

View File

@@ -53,7 +53,7 @@ void UserListModel::setRoom(Quotient::Room *room)
qDebug() << m_users.count() << "user(s) in the room"; qDebug() << m_users.count() << "user(s) in the room";
} }
endResetModel(); endResetModel();
emit roomChanged(); Q_EMIT roomChanged();
} }
Quotient::User *UserListModel::userAt(QModelIndex index) const Quotient::User *UserListModel::userAt(QModelIndex index) const
@@ -162,7 +162,7 @@ void UserListModel::refresh(Quotient::User *user, QVector<int> roles)
{ {
auto pos = findUserPos(user); auto pos = findUserPos(user);
if (pos != m_users.size()) if (pos != m_users.size())
emit dataChanged(index(pos), index(pos), roles); Q_EMIT dataChanged(index(pos), index(pos), roles);
else else
qWarning() << "Trying to access a room member not in the user list"; qWarning() << "Trying to access a room member not in the user list";
} }