Don't capture 'this' implicitely

This commit is contained in:
Tobias Fella
2021-11-13 14:16:39 +01:00
parent 0f7461bd66
commit 9027db264a
10 changed files with 48 additions and 48 deletions

View File

@@ -72,7 +72,7 @@ Controller::Controller(QObject *parent)
connect(trayIcon, &TrayIcon::showWindow, this, &Controller::showWindow); connect(trayIcon, &TrayIcon::showWindow, this, &Controller::showWindow);
QGuiApplication::setQuitOnLastWindowClosed(false); QGuiApplication::setQuitOnLastWindowClosed(false);
} }
connect(NeoChatConfig::self(), &NeoChatConfig::SystemTrayChanged, this, [=]() { connect(NeoChatConfig::self(), &NeoChatConfig::SystemTrayChanged, this, [this, trayIcon]() {
if (NeoChatConfig::self()->systemTray()) { if (NeoChatConfig::self()->systemTray()) {
trayIcon->show(); trayIcon->show();
connect(trayIcon, &TrayIcon::showWindow, this, &Controller::showWindow); connect(trayIcon, &TrayIcon::showWindow, this, &Controller::showWindow);
@@ -84,7 +84,7 @@ Controller::Controller(QObject *parent)
}); });
#endif #endif
QTimer::singleShot(0, this, [=] { QTimer::singleShot(0, this, [this] {
invokeLogin(); invokeLogin();
}); });
@@ -152,7 +152,7 @@ void Controller::loginWithAccessToken(const QString &serverAddr, const QString &
conn->setHomeserver(serverUrl); conn->setHomeserver(serverUrl);
} }
connect(conn, &Connection::connected, this, [=] { connect(conn, &Connection::connected, this, [this, conn, deviceName] {
AccountSettings account(conn->userId()); AccountSettings account(conn->userId());
account.setKeepLoggedIn(true); account.setKeepLoggedIn(true);
account.setHomeserver(conn->homeserver()); account.setHomeserver(conn->homeserver());
@@ -165,7 +165,7 @@ void Controller::loginWithAccessToken(const QString &serverAddr, const QString &
addConnection(conn); addConnection(conn);
setActiveConnection(conn); setActiveConnection(conn);
}); });
connect(conn, &Connection::networkError, this, [=](QString error, const QString &, int, int) { connect(conn, &Connection::networkError, this, [this](QString error, const QString &, int, int) {
Q_EMIT errorOccured(i18n("Network Error: %1", error)); Q_EMIT errorOccured(i18n("Network Error: %1", error));
}); });
conn->assumeIdentity(user, token, deviceName); conn->assumeIdentity(user, token, deviceName);
@@ -210,7 +210,7 @@ void Controller::addConnection(Connection *c)
c->setLazyLoading(true); c->setLazyLoading(true);
connect(c, &Connection::syncDone, this, [=] { connect(c, &Connection::syncDone, this, [this, c] {
setBusy(false); setBusy(false);
Q_EMIT syncDone(); Q_EMIT syncDone();
@@ -218,11 +218,11 @@ void Controller::addConnection(Connection *c)
c->sync(30000); c->sync(30000);
c->saveState(); c->saveState();
}); });
connect(c, &Connection::loggedOut, this, [=] { connect(c, &Connection::loggedOut, this, [this, c] {
dropConnection(c); dropConnection(c);
}); });
connect(c, &Connection::requestFailed, this, [=](BaseJob *job) { connect(c, &Connection::requestFailed, this, [this](BaseJob *job) {
if (job->error() == BaseJob::UserConsentRequiredError) { if (job->error() == BaseJob::UserConsentRequiredError) {
Q_EMIT userConsentRequired(job->errorUrl()); Q_EMIT userConsentRequired(job->errorUrl());
} }
@@ -265,7 +265,7 @@ void Controller::invokeLogin()
auto accessToken = loadAccessTokenFromKeyChain(account); auto accessToken = loadAccessTokenFromKeyChain(account);
auto connection = new Connection(account.homeserver()); auto connection = new Connection(account.homeserver());
connect(connection, &Connection::connected, this, [=] { connect(connection, &Connection::connected, this, [this, connection, id] {
connection->loadState(); connection->loadState();
addConnection(connection); addConnection(connection);
if (connection->userId() == id) { if (connection->userId() == id) {
@@ -273,7 +273,7 @@ void Controller::invokeLogin()
connectSingleShot(connection, &Connection::syncDone, this, &Controller::initiated); connectSingleShot(connection, &Connection::syncDone, this, &Controller::initiated);
} }
}); });
connect(connection, &Connection::loginError, this, [=](const QString &error, const QString &) { connect(connection, &Connection::loginError, this, [this, connection](const QString &error, const QString &) {
if (error == "Unrecognised access token") { if (error == "Unrecognised access token") {
Q_EMIT errorOccured(i18n("Login Failed: Access Token invalid or revoked")); Q_EMIT errorOccured(i18n("Login Failed: Access Token invalid or revoked"));
logout(connection, false); logout(connection, false);
@@ -283,7 +283,7 @@ void Controller::invokeLogin()
} }
Q_EMIT initiated(); Q_EMIT initiated();
}); });
connect(connection, &Connection::networkError, this, [=](const QString &error, const QString &, int, int) { connect(connection, &Connection::networkError, this, [this](const QString &error, const QString &, int, int) {
Q_EMIT errorOccured(i18n("Network Error: %1", error)); Q_EMIT errorOccured(i18n("Network Error: %1", error));
}); });
connection->assumeIdentity(account.userId(), accessToken, account.deviceId()); connection->assumeIdentity(account.userId(), accessToken, account.deviceId());
@@ -386,7 +386,7 @@ void Controller::playAudio(const QUrl &localFile)
auto player = new QMediaPlayer; auto player = new QMediaPlayer;
player->setMedia(localFile); player->setMedia(localFile);
player->play(); player->play();
connect(player, &QMediaPlayer::stateChanged, [=] { connect(player, &QMediaPlayer::stateChanged, [player] {
player->deleteLater(); player->deleteLater();
}); });
} }
@@ -574,7 +574,7 @@ NeochatDeleteDeviceJob::NeochatDeleteDeviceJob(const QString &deviceId, const Om
void Controller::createRoom(const QString &name, const QString &topic) void Controller::createRoom(const QString &name, const QString &topic)
{ {
auto createRoomJob = m_connection->createRoom(Connection::PublishRoom, "", name, topic, QStringList()); auto createRoomJob = m_connection->createRoom(Connection::PublishRoom, "", name, topic, QStringList());
Quotient::CreateRoomJob::connect(createRoomJob, &CreateRoomJob::failure, [=] { Quotient::CreateRoomJob::connect(createRoomJob, &CreateRoomJob::failure, [this, createRoomJob] {
Q_EMIT errorOccured(i18n("Room creation failed: \"%1\"", createRoomJob->errorString())); Q_EMIT errorOccured(i18n("Room creation failed: \"%1\"", createRoomJob->errorString()));
}); });
} }

View File

@@ -88,7 +88,7 @@ void DevicesModel::setName(int index, const QString &name)
beginResetModel(); beginResetModel();
m_devices[index].displayName = name; m_devices[index].displayName = name;
endResetModel(); endResetModel();
connect(job, &BaseJob::failure, this, [=]() { connect(job, &BaseJob::failure, this, [this, index, oldName]() {
beginResetModel(); beginResetModel();
m_devices[index].displayName = oldName; m_devices[index].displayName = oldName;
endResetModel(); endResetModel();

View File

@@ -27,7 +27,7 @@ void Login::init()
m_supportsPassword = false; m_supportsPassword = false;
m_ssoUrl = QUrl(); m_ssoUrl = QUrl();
connect(this, &Login::matrixIdChanged, this, [=]() { connect(this, &Login::matrixIdChanged, this, [this]() {
setHomeserverReachable(false); setHomeserverReachable(false);
if (m_matrixId == "@") { if (m_matrixId == "@") {
@@ -40,7 +40,7 @@ void Login::init()
m_connection = new Connection(); m_connection = new Connection();
} }
m_connection->resolveServer(m_matrixId); m_connection->resolveServer(m_matrixId);
connectSingleShot(m_connection, &Connection::loginFlowsChanged, this, [=]() { connectSingleShot(m_connection, &Connection::loginFlowsChanged, this, [this]() {
setHomeserverReachable(true); setHomeserverReachable(true);
m_testing = false; m_testing = false;
Q_EMIT testingChanged(); Q_EMIT testingChanged();
@@ -49,7 +49,7 @@ void Login::init()
Q_EMIT loginFlowsChanged(); Q_EMIT loginFlowsChanged();
}); });
}); });
connect(m_connection, &Connection::connected, this, [=] { connect(m_connection, &Connection::connected, this, [this] {
Q_EMIT connected(); Q_EMIT connected();
m_isLoggingIn = false; m_isLoggingIn = false;
Q_EMIT isLoggingInChanged(); Q_EMIT isLoggingInChanged();
@@ -67,22 +67,22 @@ void Login::init()
Controller::instance().setActiveConnection(m_connection); Controller::instance().setActiveConnection(m_connection);
m_connection = nullptr; m_connection = nullptr;
}); });
connect(m_connection, &Connection::networkError, this, [=](QString error, const QString &, int, int) { connect(m_connection, &Connection::networkError, this, [this](QString error, const QString &, int, int) {
Q_EMIT Controller::instance().globalErrorOccured(i18n("Network Error"), std::move(error)); Q_EMIT Controller::instance().globalErrorOccured(i18n("Network Error"), std::move(error));
m_isLoggingIn = false; m_isLoggingIn = false;
Q_EMIT isLoggingInChanged(); Q_EMIT isLoggingInChanged();
}); });
connect(m_connection, &Connection::loginError, this, [=](QString error, const QString &) { connect(m_connection, &Connection::loginError, this, [this](QString error, const QString &) {
Q_EMIT errorOccured(i18n("Login Failed: %1", error)); Q_EMIT errorOccured(i18n("Login Failed: %1", error));
m_isLoggingIn = false; m_isLoggingIn = false;
Q_EMIT isLoggingInChanged(); Q_EMIT isLoggingInChanged();
}); });
connect(m_connection, &Connection::resolveError, this, [=](QString error) { connect(m_connection, &Connection::resolveError, this, [](QString error) {
Q_EMIT Controller::instance().globalErrorOccured(i18n("Network Error"), std::move(error)); Q_EMIT Controller::instance().globalErrorOccured(i18n("Network Error"), std::move(error));
}); });
connectSingleShot(m_connection, &Connection::syncDone, this, [=]() { connectSingleShot(m_connection, &Connection::syncDone, this, [this]() {
Q_EMIT Controller::instance().initiated(); Q_EMIT Controller::instance().initiated();
}); });
} }
@@ -160,7 +160,7 @@ QUrl Login::ssoUrl() const
void Login::loginWithSso() void Login::loginWithSso()
{ {
m_connection->resolveServer(m_matrixId); m_connection->resolveServer(m_matrixId);
connectSingleShot(m_connection, &Connection::loginFlowsChanged, this, [=]() { connectSingleShot(m_connection, &Connection::loginFlowsChanged, this, [this]() {
SsoSession *session = m_connection->prepareForSso(m_deviceName); SsoSession *session = m_connection->prepareForSso(m_deviceName);
m_ssoUrl = session->ssoUrl(); m_ssoUrl = session->ssoUrl();
}); });

View File

@@ -58,12 +58,12 @@ MessageEventModel::MessageEventModel(QObject *parent)
qmlRegisterAnonymousType<FileTransferInfo>("org.kde.neochat", 1); qmlRegisterAnonymousType<FileTransferInfo>("org.kde.neochat", 1);
qRegisterMetaType<FileTransferInfo>(); qRegisterMetaType<FileTransferInfo>();
QTimer::singleShot(0, this, [=]() { QTimer::singleShot(0, this, [this]() {
if (!m_currentRoom) { if (!m_currentRoom) {
return; return;
} }
m_currentRoom->getPreviousContent(50); m_currentRoom->getPreviousContent(50);
connect(this, &QAbstractListModel::rowsInserted, this, [=]() { connect(this, &QAbstractListModel::rowsInserted, this, [this]() {
if (m_currentRoom->readMarkerEventId().isEmpty()) { if (m_currentRoom->readMarkerEventId().isEmpty()) {
return; return;
} }
@@ -98,7 +98,7 @@ void MessageEventModel::setRoom(NeoChatRoom *room)
lastReadEventId = room->readMarkerEventId(); lastReadEventId = room->readMarkerEventId();
using namespace Quotient; using namespace Quotient;
connect(m_currentRoom, &Room::aboutToAddNewMessages, this, [=](RoomEventsRange events) { connect(m_currentRoom, &Room::aboutToAddNewMessages, this, [this](RoomEventsRange events) {
if (NeoChatConfig::self()->showFancyEffects()) { if (NeoChatConfig::self()->showFancyEffects()) {
for (auto &event : events) { for (auto &event : events) {
RoomMessageEvent *message = dynamic_cast<RoomMessageEvent *>(event.get()); RoomMessageEvent *message = dynamic_cast<RoomMessageEvent *>(event.get());
@@ -134,13 +134,13 @@ void MessageEventModel::setRoom(NeoChatRoom *room)
} }
beginInsertRows({}, timelineBaseIndex(), timelineBaseIndex() + int(events.size()) - 1); beginInsertRows({}, timelineBaseIndex(), timelineBaseIndex() + int(events.size()) - 1);
}); });
connect(m_currentRoom, &Room::aboutToAddHistoricalMessages, this, [=](RoomEventsRange events) { connect(m_currentRoom, &Room::aboutToAddHistoricalMessages, this, [this](RoomEventsRange events) {
if (rowCount() > 0) { if (rowCount() > 0) {
rowBelowInserted = rowCount() - 1; // See #312 rowBelowInserted = rowCount() - 1; // See #312
} }
beginInsertRows({}, rowCount(), rowCount() + int(events.size()) - 1); beginInsertRows({}, rowCount(), rowCount() + int(events.size()) - 1);
}); });
connect(m_currentRoom, &Room::addedMessages, this, [=](int lowest, int biggest) { connect(m_currentRoom, &Room::addedMessages, this, [this](int lowest, int biggest) {
endInsertRows(); endInsertRows();
if (!m_lastReadEventIndex.isValid()) { if (!m_lastReadEventIndex.isValid()) {
// no read marker, so see if we need to create one. // no read marker, so see if we need to create one.
@@ -184,7 +184,7 @@ void MessageEventModel::setRoom(NeoChatRoom *room)
beginRemoveRows({}, i, i); beginRemoveRows({}, i, i);
}); });
connect(m_currentRoom, &Room::pendingEventDiscarded, this, &MessageEventModel::endRemoveRows); connect(m_currentRoom, &Room::pendingEventDiscarded, this, &MessageEventModel::endRemoveRows);
connect(m_currentRoom, &Room::readMarkerMoved, this, [=](const QString &fromEventId, const QString &toEventId) { connect(m_currentRoom, &Room::readMarkerMoved, this, [this](const QString &fromEventId, const QString &toEventId) {
Q_UNUSED(fromEventId); Q_UNUSED(fromEventId);
moveReadMarker(toEventId); moveReadMarker(toEventId);
}); });
@@ -203,7 +203,7 @@ void MessageEventModel::setRoom(NeoChatRoom *room)
#ifndef QUOTIENT_07 #ifndef QUOTIENT_07
connect(m_currentRoom, &Room::fileTransferCancelled, this, &MessageEventModel::refreshEvent); connect(m_currentRoom, &Room::fileTransferCancelled, this, &MessageEventModel::refreshEvent);
#endif #endif
connect(m_currentRoom->connection(), &Connection::ignoredUsersListChanged, this, [=] { connect(m_currentRoom->connection(), &Connection::ignoredUsersListChanged, this, [this] {
beginResetModel(); beginResetModel();
endResetModel(); endResetModel();
}); });

View File

@@ -43,7 +43,7 @@ NeoChatRoom::NeoChatRoom(Connection *connection, QString roomId, JoinState joinS
{ {
connect(this, &NeoChatRoom::notificationCountChanged, this, &NeoChatRoom::countChanged); connect(this, &NeoChatRoom::notificationCountChanged, this, &NeoChatRoom::countChanged);
connect(this, &NeoChatRoom::highlightCountChanged, this, &NeoChatRoom::countChanged); connect(this, &NeoChatRoom::highlightCountChanged, this, &NeoChatRoom::countChanged);
connect(this, &Room::fileTransferCompleted, this, [=] { connect(this, &Room::fileTransferCompleted, this, [this] {
setFileUploadingProgress(0); setFileUploadingProgress(0);
setHasFileUploading(false); setHasFileUploading(false);
}); });
@@ -52,7 +52,7 @@ NeoChatRoom::NeoChatRoom(Connection *connection, QString roomId, JoinState joinS
connect(this, &Quotient::Room::eventsHistoryJobChanged, this, &NeoChatRoom::lastActiveTimeChanged); connect(this, &Quotient::Room::eventsHistoryJobChanged, this, &NeoChatRoom::lastActiveTimeChanged);
connect(this, &Room::joinStateChanged, this, [=](JoinState oldState, JoinState newState) { connect(this, &Room::joinStateChanged, this, [this](JoinState oldState, JoinState newState) {
if (oldState == JoinState::Invite && newState != JoinState::Invite) { if (oldState == JoinState::Invite && newState != JoinState::Invite) {
Q_EMIT isInviteChanged(); Q_EMIT isInviteChanged();
} }
@@ -68,19 +68,19 @@ void NeoChatRoom::uploadFile(const QUrl &url, const QString &body)
QString txnId = postFile(body.isEmpty() ? url.fileName() : body, url, false); QString txnId = postFile(body.isEmpty() ? url.fileName() : body, url, false);
setHasFileUploading(true); setHasFileUploading(true);
connect(this, &Room::fileTransferCompleted, [=](const QString &id, const QUrl & /*localFile*/, const QUrl & /*mxcUrl*/) { connect(this, &Room::fileTransferCompleted, [this, txnId](const QString &id, const QUrl & /*localFile*/, const QUrl & /*mxcUrl*/) {
if (id == txnId) { if (id == txnId) {
setFileUploadingProgress(0); setFileUploadingProgress(0);
setHasFileUploading(false); setHasFileUploading(false);
} }
}); });
connect(this, &Room::fileTransferFailed, [=](const QString &id, const QString & /*error*/) { connect(this, &Room::fileTransferFailed, [this, txnId](const QString &id, const QString & /*error*/) {
if (id == txnId) { if (id == txnId) {
setFileUploadingProgress(0); setFileUploadingProgress(0);
setHasFileUploading(false); setHasFileUploading(false);
} }
}); });
connect(this, &Room::fileTransferProgress, [=](const QString &id, qint64 progress, qint64 total) { connect(this, &Room::fileTransferProgress, [this, txnId](const QString &id, qint64 progress, qint64 total) {
if (id == txnId) { if (id == txnId) {
setFileUploadingProgress(int(float(progress) / float(total) * 100)); setFileUploadingProgress(int(float(progress) / float(total) * 100));
} }

View File

@@ -115,7 +115,7 @@ void PublicRoomListModel::next(int count)
job = m_connection->callApi<QueryPublicRoomsJob>(m_server, count, nextBatch, QueryPublicRoomsJob::Filter{m_keyword}); job = m_connection->callApi<QueryPublicRoomsJob>(m_server, count, nextBatch, QueryPublicRoomsJob::Filter{m_keyword});
connect(job, &BaseJob::finished, this, [=] { connect(job, &BaseJob::finished, this, [this] {
attempted = true; attempted = true;
if (job->status() == BaseJob::Success) { if (job->status() == BaseJob::Success) {

View File

@@ -101,7 +101,7 @@ void RoomListModel::setConnection(Connection *connection)
connect(connection, &Connection::joinedRoom, this, &RoomListModel::updateRoom); connect(connection, &Connection::joinedRoom, this, &RoomListModel::updateRoom);
connect(connection, &Connection::leftRoom, this, &RoomListModel::updateRoom); connect(connection, &Connection::leftRoom, this, &RoomListModel::updateRoom);
connect(connection, &Connection::aboutToDeleteRoom, this, &RoomListModel::deleteRoom); connect(connection, &Connection::aboutToDeleteRoom, this, &RoomListModel::deleteRoom);
connect(connection, &Connection::directChatsListChanged, this, [=](Quotient::DirectChatsMap additions, Quotient::DirectChatsMap removals) { connect(connection, &Connection::directChatsListChanged, this, [this, connection](Quotient::DirectChatsMap additions, Quotient::DirectChatsMap removals) {
auto refreshRooms = [this, &connection](Quotient::DirectChatsMap rooms) { auto refreshRooms = [this, &connection](Quotient::DirectChatsMap rooms) {
for (const QString &roomID : qAsConst(rooms)) { for (const QString &roomID : qAsConst(rooms)) {
auto room = connection->room(roomID); auto room = connection->room(roomID);
@@ -152,29 +152,29 @@ void RoomListModel::doAddRoom(Room *r)
void RoomListModel::connectRoomSignals(NeoChatRoom *room) void RoomListModel::connectRoomSignals(NeoChatRoom *room)
{ {
connect(room, &Room::displaynameChanged, this, [=] { connect(room, &Room::displaynameChanged, this, [this, room] {
refresh(room); refresh(room);
}); });
connect(room, &Room::unreadMessagesChanged, this, [=] { connect(room, &Room::unreadMessagesChanged, this, [this, room] {
refresh(room); refresh(room);
}); });
connect(room, &Room::notificationCountChanged, this, [=] { connect(room, &Room::notificationCountChanged, this, [this, room] {
refresh(room); refresh(room);
}); });
connect(room, &Room::avatarChanged, this, [this, room] { connect(room, &Room::avatarChanged, this, [this, room] {
refresh(room, {AvatarRole}); refresh(room, {AvatarRole});
}); });
connect(room, &Room::tagsChanged, this, [=] { connect(room, &Room::tagsChanged, this, [this, room] {
refresh(room); refresh(room);
}); });
connect(room, &Room::joinStateChanged, this, [=] { connect(room, &Room::joinStateChanged, this, [this, room] {
refresh(room); refresh(room);
}); });
connect(room, &Room::addedMessages, this, [=] { connect(room, &Room::addedMessages, this, [this, room] {
refresh(room, {LastEventRole}); refresh(room, {LastEventRole});
}); });
connect(room, &Room::notificationCountChanged, this, &RoomListModel::handleNotifications); connect(room, &Room::notificationCountChanged, this, &RoomListModel::handleNotifications);
connect(room, &Room::highlightCountChanged, this, [=] { connect(room, &Room::highlightCountChanged, this, [this, room] {
if (room->highlightCount() == 0) { if (room->highlightCount() == 0) {
return; return;
} }
@@ -205,7 +205,7 @@ void RoomListModel::handleNotifications()
static QStringList oldNotifications; static QStringList oldNotifications;
auto job = m_connection->callApi<GetNotificationsJob>(); auto job = m_connection->callApi<GetNotificationsJob>();
connect(job, &BaseJob::success, this, [=]() { connect(job, &BaseJob::success, this, [this, job]() {
const auto notifications = job->jsonData()["notifications"].toArray(); const auto notifications = job->jsonData()["notifications"].toArray();
if (initial) { if (initial) {
initial = false; initial = false;

View File

@@ -186,7 +186,7 @@ void RoomManager::visitRoom(Room *room, const QString &eventId)
void RoomManager::joinRoom(Quotient::Connection *account, const QString &roomAliasOrId, const QStringList &viaServers) void RoomManager::joinRoom(Quotient::Connection *account, const QString &roomAliasOrId, const QStringList &viaServers)
{ {
account->joinRoom(QUrl::toPercentEncoding(roomAliasOrId), viaServers); account->joinRoom(QUrl::toPercentEncoding(roomAliasOrId), viaServers);
connectSingleShot(account, &Quotient::Connection::newRoom, this, [=](Quotient::Room *room) { connectSingleShot(account, &Quotient::Connection::newRoom, this, [this](Quotient::Room *room) {
enterRoom(dynamic_cast<NeoChatRoom *>(room)); enterRoom(dynamic_cast<NeoChatRoom *>(room));
}); });
} }

View File

@@ -75,7 +75,7 @@ void UserDirectoryListModel::search(int count)
job = m_connection->callApi<SearchUserDirectoryJob>(m_keyword, count); job = m_connection->callApi<SearchUserDirectoryJob>(m_keyword, count);
connect(job, &BaseJob::finished, this, [=] { connect(job, &BaseJob::finished, this, [this] {
attempted = true; attempted = true;
if (job->status() == BaseJob::Success) { if (job->status() == BaseJob::Success) {

View File

@@ -49,14 +49,14 @@ void UserListModel::setRoom(Quotient::Room *room)
} }
for (User *user : qAsConst(m_users)) { for (User *user : qAsConst(m_users)) {
#ifdef QUOTIENT_07 #ifdef QUOTIENT_07
connect(user, &User::defaultAvatarChanged, this, [=]() { connect(user, &User::defaultAvatarChanged, this, [this, user]() {
avatarChanged(user, m_currentRoom); avatarChanged(user, m_currentRoom);
}); });
#else #else
connect(user, &User::avatarChanged, this, &UserListModel::avatarChanged); connect(user, &User::avatarChanged, this, &UserListModel::avatarChanged);
#endif #endif
} }
connect(m_currentRoom->connection(), &Connection::loggedOut, this, [=] { connect(m_currentRoom->connection(), &Connection::loggedOut, this, [this] {
setRoom(nullptr); setRoom(nullptr);
}); });
qDebug() << m_users.count() << "user(s) in the room"; qDebug() << m_users.count() << "user(s) in the room";
@@ -154,7 +154,7 @@ void UserListModel::userAdded(Quotient::User *user)
m_users.insert(pos, user); m_users.insert(pos, user);
endInsertRows(); endInsertRows();
#ifdef QUOTIENT_07 #ifdef QUOTIENT_07
connect(user, &User::defaultAvatarChanged, this, [=]() { connect(user, &User::defaultAvatarChanged, this, [this, user]() {
avatarChanged(user, m_currentRoom); avatarChanged(user, m_currentRoom);
}); });
#else #else