s/emit/Q_EMIT
This commit is contained in:
@@ -47,7 +47,7 @@ void AccountListModel::setController(Controller *value)
|
||||
m_connections.erase(it);
|
||||
endRemoveRows();
|
||||
});
|
||||
emit controllerChanged();
|
||||
Q_EMIT controllerChanged();
|
||||
}
|
||||
|
||||
QVariant AccountListModel::data(const QModelIndex &index, int role) const
|
||||
|
||||
@@ -99,10 +99,10 @@ void Controller::loginWithCredentials(QString serverAddr, QString user, QString
|
||||
setConnection(conn);
|
||||
});
|
||||
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) {
|
||||
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);
|
||||
});
|
||||
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);
|
||||
}
|
||||
@@ -159,13 +159,13 @@ void Controller::logout(Connection *conn)
|
||||
auto logoutJob = conn->callApi<LogoutJob>();
|
||||
connect(logoutJob, &LogoutJob::finished, conn, [=] {
|
||||
conn->stopSync();
|
||||
emit conn->stateChanged();
|
||||
emit conn->loggedOut();
|
||||
Q_EMIT conn->stateChanged();
|
||||
Q_EMIT conn->loggedOut();
|
||||
if (!m_connections.isEmpty())
|
||||
setConnection(m_connections[0]);
|
||||
});
|
||||
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, [=] {
|
||||
setBusy(false);
|
||||
|
||||
emit syncDone();
|
||||
Q_EMIT syncDone();
|
||||
|
||||
c->sync(30000);
|
||||
c->saveState();
|
||||
@@ -203,7 +203,7 @@ void Controller::addConnection(Connection *c)
|
||||
|
||||
c->sync();
|
||||
|
||||
emit connectionAdded(c);
|
||||
Q_EMIT connectionAdded(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");
|
||||
m_connections.removeOne(c);
|
||||
|
||||
emit connectionDropped(c);
|
||||
Q_EMIT connectionDropped(c);
|
||||
c->deleteLater();
|
||||
}
|
||||
|
||||
@@ -231,11 +231,11 @@ void Controller::invokeLogin()
|
||||
addConnection(c);
|
||||
});
|
||||
connect(c, &Connection::loginError, [=](QString error, QString) {
|
||||
emit errorOccured("Login Failed", error);
|
||||
Q_EMIT errorOccured("Login Failed", error);
|
||||
logout(c);
|
||||
});
|
||||
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());
|
||||
}
|
||||
@@ -245,7 +245,7 @@ void Controller::invokeLogin()
|
||||
setConnection(m_connections[0]);
|
||||
}
|
||||
|
||||
emit initiated();
|
||||
Q_EMIT initiated();
|
||||
}
|
||||
|
||||
QByteArray Controller::loadAccessTokenFromFile(const AccountSettings &account)
|
||||
@@ -307,7 +307,7 @@ bool Controller::saveAccessTokenToFile(const AccountSettings &account, const QBy
|
||||
|
||||
auto fileDir = QFileInfo(accountTokenFile).dir();
|
||||
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 {
|
||||
accountTokenFile.write(accessToken);
|
||||
return true;
|
||||
@@ -343,7 +343,7 @@ void Controller::joinRoom(Connection *c, const QString &alias)
|
||||
auto knownServer = alias.mid(alias.indexOf(":") + 1);
|
||||
auto joinRoomJob = c->joinRoom(alias, QStringList {knownServer});
|
||||
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());
|
||||
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);
|
||||
createRoomJob->connect(createRoomJob, &CreateRoomJob::failure, [=] {
|
||||
emit errorOccured("Create Direct Chat Failed", createRoomJob->errorString());
|
||||
Q_EMIT errorOccured("Create Direct Chat Failed", createRoomJob->errorString());
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
if (quitOnLastWindowClosed() != value) {
|
||||
QApplication::setQuitOnLastWindowClosed(value);
|
||||
|
||||
emit quitOnLastWindowClosedChanged();
|
||||
Q_EMIT quitOnLastWindowClosedChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ public:
|
||||
return;
|
||||
}
|
||||
m_busy = busy;
|
||||
emit busyChanged();
|
||||
Q_EMIT busyChanged();
|
||||
}
|
||||
|
||||
Connection *connection() const
|
||||
@@ -96,7 +96,7 @@ public:
|
||||
if (conn == m_connection)
|
||||
return;
|
||||
m_connection = conn;
|
||||
emit connectionChanged();
|
||||
Q_EMIT connectionChanged();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -85,7 +85,7 @@ void EmojiModel::emojiUsed(QVariant modelData)
|
||||
list.push_front(modelData);
|
||||
m_settings->setValue("Editor/emojis", list);
|
||||
|
||||
emit historyChanged();
|
||||
Q_EMIT historyChanged();
|
||||
}
|
||||
|
||||
const QVariantList EmojiModel::people = {
|
||||
|
||||
@@ -23,12 +23,12 @@ ThumbnailResponse::ThumbnailResponse(Quotient::Connection *c, QString id, const
|
||||
{
|
||||
if (requestedSize.isEmpty()) {
|
||||
errorStr.clear();
|
||||
emit finished();
|
||||
Q_EMIT finished();
|
||||
return;
|
||||
}
|
||||
if (mediaId.count('/') != 1) {
|
||||
errorStr = tr("Media id '%1' doesn't follow server/mediaId pattern").arg(mediaId);
|
||||
emit finished();
|
||||
Q_EMIT finished();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ ThumbnailResponse::ThumbnailResponse(Quotient::Connection *c, QString id, const
|
||||
if (cachedImage.load(localFile)) {
|
||||
image = cachedImage;
|
||||
errorStr.clear();
|
||||
emit finished();
|
||||
Q_EMIT finished();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ void ThumbnailResponse::prepareResult()
|
||||
}
|
||||
job = nullptr;
|
||||
}
|
||||
emit finished();
|
||||
Q_EMIT finished();
|
||||
}
|
||||
|
||||
void ThumbnailResponse::doCancel()
|
||||
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
void setConnection(Quotient::Connection *connection)
|
||||
{
|
||||
m_connection.storeRelaxed(connection);
|
||||
emit connectionChanged();
|
||||
Q_EMIT connectionChanged();
|
||||
}
|
||||
|
||||
signals:
|
||||
|
||||
@@ -164,7 +164,7 @@ int MessageEventModel::timelineBaseIndex() const
|
||||
void MessageEventModel::refreshEventRoles(int row, const QVector<int> &roles)
|
||||
{
|
||||
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)
|
||||
@@ -241,7 +241,7 @@ void MessageEventModel::refreshLastUserEvents(int baseTimelineRow)
|
||||
for (auto it = timelineBottom + std::max(baseTimelineRow - 10, 0); it != limit; ++it) {
|
||||
if ((*it)->senderId() == lastSender) {
|
||||
auto idx = index(it - timelineBottom);
|
||||
emit dataChanged(idx, idx);
|
||||
Q_EMIT dataChanged(idx, idx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,9 +34,9 @@ void PublicRoomListModel::setConnection(Connection *conn)
|
||||
next();
|
||||
}
|
||||
|
||||
emit connectionChanged();
|
||||
emit serverChanged();
|
||||
emit hasMoreChanged();
|
||||
Q_EMIT connectionChanged();
|
||||
Q_EMIT serverChanged();
|
||||
Q_EMIT hasMoreChanged();
|
||||
}
|
||||
|
||||
void PublicRoomListModel::setServer(const QString &value)
|
||||
@@ -63,8 +63,8 @@ void PublicRoomListModel::setServer(const QString &value)
|
||||
next();
|
||||
}
|
||||
|
||||
emit serverChanged();
|
||||
emit hasMoreChanged();
|
||||
Q_EMIT serverChanged();
|
||||
Q_EMIT hasMoreChanged();
|
||||
}
|
||||
|
||||
void PublicRoomListModel::setKeyword(const QString &value)
|
||||
@@ -91,8 +91,8 @@ void PublicRoomListModel::setKeyword(const QString &value)
|
||||
next();
|
||||
}
|
||||
|
||||
emit keywordChanged();
|
||||
emit hasMoreChanged();
|
||||
Q_EMIT keywordChanged();
|
||||
Q_EMIT hasMoreChanged();
|
||||
}
|
||||
|
||||
void PublicRoomListModel::next(int count)
|
||||
@@ -122,7 +122,7 @@ void PublicRoomListModel::next(int count)
|
||||
this->endInsertRows();
|
||||
|
||||
if (job->nextBatch().isEmpty()) {
|
||||
emit hasMoreChanged();
|
||||
Q_EMIT hasMoreChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ void RoomListModel::doAddRoom(Room *r)
|
||||
if (auto room = static_cast<SpectralRoom *>(r)) {
|
||||
m_rooms.append(room);
|
||||
connectRoomSignals(room);
|
||||
emit roomAdded(room);
|
||||
Q_EMIT roomAdded(room);
|
||||
} else {
|
||||
qCritical() << "Attempt to add nullptr to the room list";
|
||||
Q_ASSERT(false);
|
||||
@@ -118,7 +118,7 @@ void RoomListModel::connectRoomSignals(SpectralRoom *room)
|
||||
User *sender = room->user(lastEvent->senderId());
|
||||
if (sender == room->localUser())
|
||||
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, [=] {
|
||||
if (room->highlightCount() == 0)
|
||||
@@ -131,7 +131,7 @@ void RoomListModel::connectRoomSignals(SpectralRoom *room)
|
||||
User *sender = room->user(lastEvent->senderId());
|
||||
if (sender == room->localUser())
|
||||
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);
|
||||
}
|
||||
@@ -143,7 +143,7 @@ void RoomListModel::refreshNotificationCount()
|
||||
count += room->notificationCount();
|
||||
}
|
||||
m_notificationCount = count;
|
||||
emit notificationCountChanged();
|
||||
Q_EMIT notificationCountChanged();
|
||||
}
|
||||
|
||||
void RoomListModel::updateRoom(Room *room, Room *prev)
|
||||
@@ -174,7 +174,7 @@ void RoomListModel::updateRoom(Room *room, Room *prev)
|
||||
m_rooms.replace(row, newRoom);
|
||||
connectRoomSignals(newRoom);
|
||||
}
|
||||
emit dataChanged(index(row), index(row));
|
||||
Q_EMIT dataChanged(index(row), index(row));
|
||||
} else {
|
||||
beginInsertRows(QModelIndex(), m_rooms.count(), m_rooms.count());
|
||||
doAddRoom(newRoom);
|
||||
@@ -257,7 +257,7 @@ void RoomListModel::refresh(SpectralRoom *room, const QVector<int> &roles)
|
||||
return;
|
||||
}
|
||||
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
|
||||
|
||||
@@ -153,7 +153,7 @@ void SpectralRoom::onRedaction(const RoomEvent &prevEvent, const RoomEvent & /*a
|
||||
{
|
||||
if (const auto &e = eventCast<const ReactionEvent>(&prevEvent)) {
|
||||
if (auto relatedEventId = e->relation().eventId; !relatedEventId.isEmpty()) {
|
||||
emit updatedEvent(relatedEventId);
|
||||
Q_EMIT updatedEvent(relatedEventId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
return;
|
||||
}
|
||||
m_hasFileUploading = value;
|
||||
emit hasFileUploadingChanged();
|
||||
Q_EMIT hasFileUploadingChanged();
|
||||
}
|
||||
|
||||
int fileUploadingProgress() const
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
return;
|
||||
}
|
||||
m_fileUploadingProgress = value;
|
||||
emit fileUploadingProgressChanged();
|
||||
Q_EMIT fileUploadingProgressChanged();
|
||||
}
|
||||
|
||||
Q_INVOKABLE int savedTopVisibleIndex() const;
|
||||
|
||||
@@ -125,7 +125,7 @@ void TrayIcon::setNotificationCount(int count)
|
||||
|
||||
icon_ = tmp;
|
||||
#endif
|
||||
emit notificationCountChanged();
|
||||
Q_EMIT notificationCountChanged();
|
||||
}
|
||||
|
||||
void TrayIcon::setIsOnline(bool online)
|
||||
@@ -161,7 +161,7 @@ void TrayIcon::setIsOnline(bool online)
|
||||
|
||||
icon_ = tmp;
|
||||
#endif
|
||||
emit isOnlineChanged();
|
||||
Q_EMIT isOnlineChanged();
|
||||
}
|
||||
|
||||
void TrayIcon::setIconSource(const QString &source)
|
||||
@@ -175,5 +175,5 @@ void TrayIcon::setIconSource(const QString &source)
|
||||
icon_->isOnline = m_isOnline;
|
||||
icon_->msgCount = m_notificationCount;
|
||||
#endif
|
||||
emit iconSourceChanged();
|
||||
Q_EMIT iconSourceChanged();
|
||||
}
|
||||
|
||||
@@ -15,10 +15,10 @@ class MsgCountComposedIcon : public QIconEngine
|
||||
public:
|
||||
MsgCountComposedIcon(const QString &filename);
|
||||
|
||||
virtual void paint(QPainter *p, const QRect &rect, QIcon::Mode mode, QIcon::State state);
|
||||
virtual QIconEngine *clone() const;
|
||||
virtual QList<QSize> availableSizes(QIcon::Mode mode, QIcon::State state) const;
|
||||
virtual QPixmap pixmap(const QSize &size, 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 override;
|
||||
virtual QList<QSize> availableSizes(QIcon::Mode mode, QIcon::State state) const override;
|
||||
virtual QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) override;
|
||||
|
||||
int msgCount = 0;
|
||||
bool isOnline = true; // Default to false?
|
||||
|
||||
@@ -29,8 +29,8 @@ void UserDirectoryListModel::setConnection(Connection *conn)
|
||||
job = nullptr;
|
||||
}
|
||||
|
||||
emit connectionChanged();
|
||||
emit limitedChanged();
|
||||
Q_EMIT connectionChanged();
|
||||
Q_EMIT limitedChanged();
|
||||
}
|
||||
|
||||
void UserDirectoryListModel::setKeyword(const QString &value)
|
||||
@@ -48,8 +48,8 @@ void UserDirectoryListModel::setKeyword(const QString &value)
|
||||
job = nullptr;
|
||||
}
|
||||
|
||||
emit keywordChanged();
|
||||
emit limitedChanged();
|
||||
Q_EMIT keywordChanged();
|
||||
Q_EMIT limitedChanged();
|
||||
}
|
||||
|
||||
void UserDirectoryListModel::search(int count)
|
||||
@@ -84,7 +84,7 @@ void UserDirectoryListModel::search(int count)
|
||||
|
||||
this->job = nullptr;
|
||||
|
||||
emit limitedChanged();
|
||||
Q_EMIT limitedChanged();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ void UserListModel::setRoom(Quotient::Room *room)
|
||||
qDebug() << m_users.count() << "user(s) in the room";
|
||||
}
|
||||
endResetModel();
|
||||
emit roomChanged();
|
||||
Q_EMIT roomChanged();
|
||||
}
|
||||
|
||||
Quotient::User *UserListModel::userAt(QModelIndex index) const
|
||||
@@ -162,7 +162,7 @@ void UserListModel::refresh(Quotient::User *user, QVector<int> roles)
|
||||
{
|
||||
auto pos = findUserPos(user);
|
||||
if (pos != m_users.size())
|
||||
emit dataChanged(index(pos), index(pos), roles);
|
||||
Q_EMIT dataChanged(index(pos), index(pos), roles);
|
||||
else
|
||||
qWarning() << "Trying to access a room member not in the user list";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user