Be explicit about the captured parameters in lambdas

This commit is contained in:
Konstantinos Sideris 2018-02-20 17:09:11 +02:00
parent 127c52e39a
commit f95998a64b
24 changed files with 142 additions and 133 deletions

View file

@ -173,7 +173,7 @@ TimelineItem::setupLocalWidgetLayout(Widget *widget,
headerLayout_->addLayout(widgetLayout); headerLayout_->addLayout(widgetLayout);
messageLayout_->addLayout(headerLayout_, 1); messageLayout_->addLayout(headerLayout_, 1);
AvatarProvider::resolve(userid, [=](const QImage &img) { setUserAvatar(img); }); AvatarProvider::resolve(userid, [this](const QImage &img) { setUserAvatar(img); });
} else { } else {
setupSimpleLayout(); setupSimpleLayout();
@ -224,7 +224,7 @@ TimelineItem::setupWidgetLayout(Widget *widget,
headerLayout_->addLayout(widgetLayout); headerLayout_->addLayout(widgetLayout);
messageLayout_->addLayout(headerLayout_, 1); messageLayout_->addLayout(headerLayout_, 1);
AvatarProvider::resolve(sender, [=](const QImage &img) { setUserAvatar(img); }); AvatarProvider::resolve(sender, [this](const QImage &img) { setUserAvatar(img); });
} else { } else {
setupSimpleLayout(); setupSimpleLayout();

View file

@ -134,7 +134,7 @@ private:
{ {
item->hide(); item->hide();
scroll_layout_->addWidget(item); scroll_layout_->addWidget(item);
QTimer::singleShot(0, this, [=]() { item->show(); }); QTimer::singleShot(0, this, [item]() { item->show(); });
}; };
//! Decides whether or not to show or hide the scroll down button. //! Decides whether or not to show or hide the scroll down button.

View file

@ -141,21 +141,21 @@ ChatPage::ChatPage(QSharedPointer<MatrixClient> client,
typingRefresher_ = new QTimer(this); typingRefresher_ = new QTimer(this);
typingRefresher_->setInterval(TYPING_REFRESH_TIMEOUT); typingRefresher_->setInterval(TYPING_REFRESH_TIMEOUT);
connect(user_info_widget_, &UserInfoWidget::logout, this, [=]() { connect(user_info_widget_, &UserInfoWidget::logout, this, [this]() {
client_->logout(); client_->logout();
emit showOverlayProgressBar(); emit showOverlayProgressBar();
}); });
connect(client_.data(), &MatrixClient::loggedOut, this, &ChatPage::logout); connect(client_.data(), &MatrixClient::loggedOut, this, &ChatPage::logout);
connect(top_bar_, &TopRoomBar::inviteUsers, this, [=](QStringList users) { connect(top_bar_, &TopRoomBar::inviteUsers, this, [this](QStringList users) {
for (int ii = 0; ii < users.size(); ++ii) { for (int ii = 0; ii < users.size(); ++ii) {
QTimer::singleShot(ii * 1000, this, [=]() { QTimer::singleShot(ii * 1000, this, [this, &ii, &users]() {
client_->inviteUser(current_room_, users.at(ii)); client_->inviteUser(current_room_, users.at(ii));
}); });
} }
}); });
connect(room_list_, &RoomList::roomChanged, this, [=](const QString &roomid) { connect(room_list_, &RoomList::roomChanged, this, [this](const QString &roomid) {
QStringList users; QStringList users;
if (!userSettings_->isTypingNotificationsEnabled()) { if (!userSettings_->isTypingNotificationsEnabled()) {
@ -178,7 +178,7 @@ ChatPage::ChatPage(QSharedPointer<MatrixClient> client,
connect(room_list_, &RoomList::acceptInvite, client_.data(), &MatrixClient::joinRoom); connect(room_list_, &RoomList::acceptInvite, client_.data(), &MatrixClient::joinRoom);
connect(room_list_, &RoomList::declineInvite, client_.data(), &MatrixClient::leaveRoom); connect(room_list_, &RoomList::declineInvite, client_.data(), &MatrixClient::leaveRoom);
connect(text_input_, &TextInputWidget::startedTyping, this, [=]() { connect(text_input_, &TextInputWidget::startedTyping, this, [this]() {
if (!userSettings_->isTypingNotificationsEnabled()) if (!userSettings_->isTypingNotificationsEnabled())
return; return;
@ -186,7 +186,7 @@ ChatPage::ChatPage(QSharedPointer<MatrixClient> client,
client_->sendTypingNotification(current_room_); client_->sendTypingNotification(current_room_);
}); });
connect(text_input_, &TextInputWidget::stoppedTyping, this, [=]() { connect(text_input_, &TextInputWidget::stoppedTyping, this, [this]() {
if (!userSettings_->isTypingNotificationsEnabled()) if (!userSettings_->isTypingNotificationsEnabled())
return; return;
@ -194,7 +194,7 @@ ChatPage::ChatPage(QSharedPointer<MatrixClient> client,
client_->removeTypingNotification(current_room_); client_->removeTypingNotification(current_room_);
}); });
connect(typingRefresher_, &QTimer::timeout, this, [=]() { connect(typingRefresher_, &QTimer::timeout, this, [this]() {
if (!userSettings_->isTypingNotificationsEnabled()) if (!userSettings_->isTypingNotificationsEnabled())
return; return;
@ -229,62 +229,66 @@ ChatPage::ChatPage(QSharedPointer<MatrixClient> client,
connect(text_input_, connect(text_input_,
&TextInputWidget::uploadImage, &TextInputWidget::uploadImage,
this, this,
[=](QSharedPointer<QIODevice> data, const QString &fn) { [this](QSharedPointer<QIODevice> data, const QString &fn) {
client_->uploadImage(current_room_, fn, data); client_->uploadImage(current_room_, fn, data);
}); });
connect(text_input_, connect(text_input_,
&TextInputWidget::uploadFile, &TextInputWidget::uploadFile,
this, this,
[=](QSharedPointer<QIODevice> data, const QString &fn) { [this](QSharedPointer<QIODevice> data, const QString &fn) {
client_->uploadFile(current_room_, fn, data); client_->uploadFile(current_room_, fn, data);
}); });
connect(text_input_, connect(text_input_,
&TextInputWidget::uploadAudio, &TextInputWidget::uploadAudio,
this, this,
[=](QSharedPointer<QIODevice> data, const QString &fn) { [this](QSharedPointer<QIODevice> data, const QString &fn) {
client_->uploadAudio(current_room_, fn, data); client_->uploadAudio(current_room_, fn, data);
}); });
connect(text_input_, connect(text_input_,
&TextInputWidget::uploadVideo, &TextInputWidget::uploadVideo,
this, this,
[=](QSharedPointer<QIODevice> data, const QString &fn) { [this](QSharedPointer<QIODevice> data, const QString &fn) {
client_->uploadVideo(current_room_, fn, data); client_->uploadVideo(current_room_, fn, data);
}); });
connect( connect(
client_.data(), &MatrixClient::roomCreationFailed, this, &ChatPage::showNotification); client_.data(), &MatrixClient::roomCreationFailed, this, &ChatPage::showNotification);
connect(client_.data(), &MatrixClient::joinFailed, this, &ChatPage::showNotification); connect(client_.data(), &MatrixClient::joinFailed, this, &ChatPage::showNotification);
connect(client_.data(), &MatrixClient::uploadFailed, this, [=](int, const QString &msg) { connect(client_.data(), &MatrixClient::uploadFailed, this, [this](int, const QString &msg) {
text_input_->hideUploadSpinner(); text_input_->hideUploadSpinner();
emit showNotification(msg); emit showNotification(msg);
}); });
connect(client_.data(), connect(
client_.data(),
&MatrixClient::imageUploaded, &MatrixClient::imageUploaded,
this, this,
[=](QString roomid, QString filename, QString url, QString mime, uint64_t dsize) { [this](QString roomid, QString filename, QString url, QString mime, uint64_t dsize) {
text_input_->hideUploadSpinner(); text_input_->hideUploadSpinner();
view_manager_->queueImageMessage(roomid, filename, url, mime, dsize); view_manager_->queueImageMessage(roomid, filename, url, mime, dsize);
}); });
connect(client_.data(), connect(
client_.data(),
&MatrixClient::fileUploaded, &MatrixClient::fileUploaded,
this, this,
[=](QString roomid, QString filename, QString url, QString mime, uint64_t dsize) { [this](QString roomid, QString filename, QString url, QString mime, uint64_t dsize) {
text_input_->hideUploadSpinner(); text_input_->hideUploadSpinner();
view_manager_->queueFileMessage(roomid, filename, url, mime, dsize); view_manager_->queueFileMessage(roomid, filename, url, mime, dsize);
}); });
connect(client_.data(), connect(
client_.data(),
&MatrixClient::audioUploaded, &MatrixClient::audioUploaded,
this, this,
[=](QString roomid, QString filename, QString url, QString mime, uint64_t dsize) { [this](QString roomid, QString filename, QString url, QString mime, uint64_t dsize) {
text_input_->hideUploadSpinner(); text_input_->hideUploadSpinner();
view_manager_->queueAudioMessage(roomid, filename, url, mime, dsize); view_manager_->queueAudioMessage(roomid, filename, url, mime, dsize);
}); });
connect(client_.data(), connect(
client_.data(),
&MatrixClient::videoUploaded, &MatrixClient::videoUploaded,
this, this,
[=](QString roomid, QString filename, QString url, QString mime, uint64_t dsize) { [this](QString roomid, QString filename, QString url, QString mime, uint64_t dsize) {
text_input_->hideUploadSpinner(); text_input_->hideUploadSpinner();
view_manager_->queueVideoMessage(roomid, filename, url, mime, dsize); view_manager_->queueVideoMessage(roomid, filename, url, mime, dsize);
}); });
@ -309,13 +313,13 @@ ChatPage::ChatPage(QSharedPointer<MatrixClient> client,
connect(client_.data(), connect(client_.data(),
&MatrixClient::communityProfileRetrieved, &MatrixClient::communityProfileRetrieved,
this, this,
[=](QString communityId, QJsonObject profile) { [this](QString communityId, QJsonObject profile) {
communities_[communityId]->parseProfile(profile); communities_[communityId]->parseProfile(profile);
}); });
connect(client_.data(), connect(client_.data(),
&MatrixClient::communityRoomsRetrieved, &MatrixClient::communityRoomsRetrieved,
this, this,
[=](QString communityId, QJsonObject rooms) { [this](QString communityId, QJsonObject rooms) {
communities_[communityId]->parseRooms(rooms); communities_[communityId]->parseRooms(rooms);
if (communityId == current_community_) { if (communityId == current_community_) {
@ -328,27 +332,27 @@ ChatPage::ChatPage(QSharedPointer<MatrixClient> client,
} }
}); });
connect(client_.data(), &MatrixClient::joinedRoom, this, [=](const QString &room_id) { connect(client_.data(), &MatrixClient::joinedRoom, this, [this](const QString &room_id) {
emit showNotification("You joined the room."); emit showNotification("You joined the room.");
removeInvite(room_id); removeInvite(room_id);
}); });
connect(client_.data(), &MatrixClient::invitedUser, this, [=](QString, QString user) { connect(client_.data(), &MatrixClient::invitedUser, this, [this](QString, QString user) {
emit showNotification(QString("Invited user %1").arg(user)); emit showNotification(QString("Invited user %1").arg(user));
}); });
connect(client_.data(), &MatrixClient::roomCreated, this, [=](QString room_id) { connect(client_.data(), &MatrixClient::roomCreated, this, [this](QString room_id) {
emit showNotification(QString("Room %1 created").arg(room_id)); emit showNotification(QString("Room %1 created").arg(room_id));
}); });
connect(client_.data(), &MatrixClient::leftRoom, this, &ChatPage::removeRoom); connect(client_.data(), &MatrixClient::leftRoom, this, &ChatPage::removeRoom);
showContentTimer_ = new QTimer(this); showContentTimer_ = new QTimer(this);
showContentTimer_->setSingleShot(true); showContentTimer_->setSingleShot(true);
connect(showContentTimer_, &QTimer::timeout, this, [=]() { connect(showContentTimer_, &QTimer::timeout, this, [this]() {
consensusTimer_->stop(); consensusTimer_->stop();
emit contentLoaded(); emit contentLoaded();
}); });
consensusTimer_ = new QTimer(this); consensusTimer_ = new QTimer(this);
connect(consensusTimer_, &QTimer::timeout, this, [=]() { connect(consensusTimer_, &QTimer::timeout, this, [this]() {
if (view_manager_->hasLoaded()) { if (view_manager_->hasLoaded()) {
// Remove the spinner overlay. // Remove the spinner overlay.
emit contentLoaded(); emit contentLoaded();
@ -361,7 +365,7 @@ ChatPage::ChatPage(QSharedPointer<MatrixClient> client,
connect(initialSyncTimer_, &QTimer::timeout, this, &ChatPage::retryInitialSync); connect(initialSyncTimer_, &QTimer::timeout, this, &ChatPage::retryInitialSync);
syncTimeoutTimer_ = new QTimer(this); syncTimeoutTimer_ = new QTimer(this);
connect(syncTimeoutTimer_, &QTimer::timeout, this, [=]() { connect(syncTimeoutTimer_, &QTimer::timeout, this, [this]() {
if (client_->getHomeServer().isEmpty()) { if (client_->getHomeServer().isEmpty()) {
syncTimeoutTimer_->stop(); syncTimeoutTimer_->stop();
return; return;
@ -374,7 +378,7 @@ ChatPage::ChatPage(QSharedPointer<MatrixClient> client,
connect(communitiesList_, connect(communitiesList_,
&CommunitiesList::communityChanged, &CommunitiesList::communityChanged,
this, this,
[=](const QString &communityId) { [this](const QString &communityId) {
current_community_ = communityId; current_community_ = communityId;
if (communityId == "world") if (communityId == "world")
@ -577,8 +581,8 @@ ChatPage::updateOwnProfileInfo(const QUrl &avatar_url, const QString &display_na
if (avatar_url.isValid()) if (avatar_url.isValid())
client_->fetchUserAvatar( client_->fetchUserAvatar(
avatar_url, avatar_url,
[=](QImage img) { user_info_widget_->setAvatar(img); }, [this](QImage img) { user_info_widget_->setAvatar(img); },
[=](QString error) { qWarning() << error << ": failed to fetch own avatar"; }); [](QString error) { qWarning() << error << ": failed to fetch own avatar"; });
} }
void void
@ -691,24 +695,24 @@ ChatPage::showQuickSwitcher()
if (quickSwitcher_.isNull()) { if (quickSwitcher_.isNull()) {
quickSwitcher_ = QSharedPointer<QuickSwitcher>( quickSwitcher_ = QSharedPointer<QuickSwitcher>(
new QuickSwitcher(this), new QuickSwitcher(this),
[=](QuickSwitcher *switcher) { switcher->deleteLater(); }); [](QuickSwitcher *switcher) { switcher->deleteLater(); });
connect(quickSwitcher_.data(), connect(quickSwitcher_.data(),
&QuickSwitcher::roomSelected, &QuickSwitcher::roomSelected,
room_list_, room_list_,
&RoomList::highlightSelectedRoom); &RoomList::highlightSelectedRoom);
connect(quickSwitcher_.data(), &QuickSwitcher::closing, this, [=]() { connect(quickSwitcher_.data(), &QuickSwitcher::closing, this, [this]() {
if (!this->quickSwitcherModal_.isNull()) if (!quickSwitcherModal_.isNull())
this->quickSwitcherModal_->hide(); quickSwitcherModal_->hide();
this->text_input_->setFocus(Qt::FocusReason::PopupFocusReason); text_input_->setFocus(Qt::FocusReason::PopupFocusReason);
}); });
} }
if (quickSwitcherModal_.isNull()) { if (quickSwitcherModal_.isNull()) {
quickSwitcherModal_ = QSharedPointer<OverlayModal>( quickSwitcherModal_ = QSharedPointer<OverlayModal>(
new OverlayModal(MainWindow::instance(), quickSwitcher_.data()), new OverlayModal(MainWindow::instance(), quickSwitcher_.data()),
[=](OverlayModal *modal) { modal->deleteLater(); }); [](OverlayModal *modal) { modal->deleteLater(); });
quickSwitcherModal_->setColor(QColor(30, 30, 30, 170)); quickSwitcherModal_->setColor(QColor(30, 30, 30, 170));
} }
@ -934,13 +938,13 @@ ChatPage::showReadReceipts(const QString &event_id)
if (receiptsDialog_.isNull()) { if (receiptsDialog_.isNull()) {
receiptsDialog_ = QSharedPointer<dialogs::ReadReceipts>( receiptsDialog_ = QSharedPointer<dialogs::ReadReceipts>(
new dialogs::ReadReceipts(this), new dialogs::ReadReceipts(this),
[=](dialogs::ReadReceipts *dialog) { dialog->deleteLater(); }); [](dialogs::ReadReceipts *dialog) { dialog->deleteLater(); });
} }
if (receiptsModal_.isNull()) { if (receiptsModal_.isNull()) {
receiptsModal_ = QSharedPointer<OverlayModal>( receiptsModal_ = QSharedPointer<OverlayModal>(
new OverlayModal(MainWindow::instance(), receiptsDialog_.data()), new OverlayModal(MainWindow::instance(), receiptsDialog_.data()),
[=](OverlayModal *modal) { modal->deleteLater(); }); [](OverlayModal *modal) { modal->deleteLater(); });
receiptsModal_->setColor(QColor(30, 30, 30, 170)); receiptsModal_->setColor(QColor(30, 30, 30, 170));
} }

View file

@ -47,7 +47,7 @@ CommunitiesList::CommunitiesList(QSharedPointer<MatrixClient> client, QWidget *p
connect(client_.data(), connect(client_.data(),
&MatrixClient::communityProfileRetrieved, &MatrixClient::communityProfileRetrieved,
this, this,
[=](QString communityId, QJsonObject profile) { [this](QString communityId, QJsonObject profile) {
client_->fetchCommunityAvatar(communityId, client_->fetchCommunityAvatar(communityId,
QUrl(profile["avatar_url"].toString())); QUrl(profile["avatar_url"].toString()));
}); });

View file

@ -77,7 +77,8 @@ MainWindow::MainWindow(QWidget *parent)
connect(login_page_, SIGNAL(backButtonClicked()), this, SLOT(showWelcomePage())); connect(login_page_, SIGNAL(backButtonClicked()), this, SLOT(showWelcomePage()));
connect(login_page_, &LoginPage::loggingIn, this, &MainWindow::showOverlayProgressBar); connect(login_page_, &LoginPage::loggingIn, this, &MainWindow::showOverlayProgressBar);
connect(login_page_, &LoginPage::errorOccured, this, [=]() { removeOverlayProgressBar(); }); connect(
login_page_, &LoginPage::errorOccured, this, [this]() { removeOverlayProgressBar(); });
connect(register_page_, SIGNAL(backButtonClicked()), this, SLOT(showWelcomePage())); connect(register_page_, SIGNAL(backButtonClicked()), this, SLOT(showWelcomePage()));
connect(chat_page_, SIGNAL(close()), this, SLOT(showWelcomePage())); connect(chat_page_, SIGNAL(close()), this, SLOT(showWelcomePage()));
@ -86,12 +87,12 @@ MainWindow::MainWindow(QWidget *parent)
connect( connect(
chat_page_, SIGNAL(changeWindowTitle(QString)), this, SLOT(setWindowTitle(QString))); chat_page_, SIGNAL(changeWindowTitle(QString)), this, SLOT(setWindowTitle(QString)));
connect(chat_page_, SIGNAL(unreadMessages(int)), trayIcon_, SLOT(setUnreadCount(int))); connect(chat_page_, SIGNAL(unreadMessages(int)), trayIcon_, SLOT(setUnreadCount(int)));
connect(chat_page_, &ChatPage::showLoginPage, this, [=](const QString &msg) { connect(chat_page_, &ChatPage::showLoginPage, this, [this](const QString &msg) {
login_page_->loginError(msg); login_page_->loginError(msg);
showLoginPage(); showLoginPage();
}); });
connect(userSettingsPage_, &UserSettingsPage::moveBack, this, [=]() { connect(userSettingsPage_, &UserSettingsPage::moveBack, this, [this]() {
pageStack_->setCurrentWidget(chat_page_); pageStack_->setCurrentWidget(chat_page_);
}); });
@ -116,7 +117,7 @@ MainWindow::MainWindow(QWidget *parent)
connect(quitShortcut, &QShortcut::activated, this, QApplication::quit); connect(quitShortcut, &QShortcut::activated, this, QApplication::quit);
QShortcut *quickSwitchShortcut = new QShortcut(QKeySequence("Ctrl+K"), this); QShortcut *quickSwitchShortcut = new QShortcut(QKeySequence("Ctrl+K"), this);
connect(quickSwitchShortcut, &QShortcut::activated, this, [=]() { connect(quickSwitchShortcut, &QShortcut::activated, this, [this]() {
chat_page_->showQuickSwitcher(); chat_page_->showQuickSwitcher();
}); });
@ -162,7 +163,7 @@ MainWindow::removeOverlayProgressBar()
QTimer *timer = new QTimer(this); QTimer *timer = new QTimer(this);
timer->setSingleShot(true); timer->setSingleShot(true);
connect(timer, &QTimer::timeout, [=]() { connect(timer, &QTimer::timeout, [this, timer]() {
timer->deleteLater(); timer->deleteLater();
if (!progressModal_.isNull()) if (!progressModal_.isNull())
@ -176,7 +177,7 @@ MainWindow::removeOverlayProgressBar()
}); });
// FIXME: Snackbar doesn't work if it's initialized in the constructor. // FIXME: Snackbar doesn't work if it's initialized in the constructor.
QTimer::singleShot(100, this, [=]() { QTimer::singleShot(100, this, [this]() {
snackBar_ = QSharedPointer<SnackBar>(new SnackBar(this)); snackBar_ = QSharedPointer<SnackBar>(new SnackBar(this));
connect(chat_page_, connect(chat_page_,
&ChatPage::showNotification, &ChatPage::showNotification,
@ -197,7 +198,7 @@ MainWindow::showChatPage(QString userid, QString homeserver, QString token)
showOverlayProgressBar(); showOverlayProgressBar();
QTimer::singleShot(100, this, [=]() { pageStack_->setCurrentWidget(chat_page_); }); QTimer::singleShot(100, this, [this]() { pageStack_->setCurrentWidget(chat_page_); });
login_page_->reset(); login_page_->reset();
chat_page_->bootstrap(userid, homeserver, token); chat_page_->bootstrap(userid, homeserver, token);
@ -250,7 +251,10 @@ MainWindow::openLeaveRoomDialog(const QString &room_id)
leaveRoomDialog_ = QSharedPointer<dialogs::LeaveRoom>(new dialogs::LeaveRoom(this)); leaveRoomDialog_ = QSharedPointer<dialogs::LeaveRoom>(new dialogs::LeaveRoom(this));
connect(leaveRoomDialog_.data(), &dialogs::LeaveRoom::closing, this, [=](bool leaving) { connect(leaveRoomDialog_.data(),
&dialogs::LeaveRoom::closing,
this,
[this, &roomToLeave](bool leaving) {
leaveRoomModal_->hide(); leaveRoomModal_->hide();
if (leaving) if (leaving)
@ -270,7 +274,7 @@ MainWindow::showOverlayProgressBar()
if (spinner_.isNull()) { if (spinner_.isNull()) {
spinner_ = QSharedPointer<LoadingIndicator>( spinner_ = QSharedPointer<LoadingIndicator>(
new LoadingIndicator(this), new LoadingIndicator(this),
[=](LoadingIndicator *indicator) { indicator->deleteLater(); }); [](LoadingIndicator *indicator) { indicator->deleteLater(); });
spinner_->setFixedHeight(100); spinner_->setFixedHeight(100);
spinner_->setFixedWidth(100); spinner_->setFixedWidth(100);
spinner_->setObjectName("ChatPageLoadSpinner"); spinner_->setObjectName("ChatPageLoadSpinner");
@ -280,7 +284,7 @@ MainWindow::showOverlayProgressBar()
if (progressModal_.isNull()) { if (progressModal_.isNull()) {
progressModal_ = progressModal_ =
QSharedPointer<OverlayModal>(new OverlayModal(this, spinner_.data()), QSharedPointer<OverlayModal>(new OverlayModal(this, spinner_.data()),
[=](OverlayModal *modal) { modal->deleteLater(); }); [](OverlayModal *modal) { modal->deleteLater(); });
progressModal_->setDismissible(false); progressModal_->setDismissible(false);
progressModal_->show(); progressModal_->show();
} }

View file

@ -76,7 +76,7 @@ MatrixClient::MatrixClient(QString server, QObject *parent)
connect(this, connect(this,
&QNetworkAccessManager::networkAccessibleChanged, &QNetworkAccessManager::networkAccessibleChanged,
this, this,
[=](NetworkAccessibility status) { [this](NetworkAccessibility status) {
if (status != NetworkAccessibility::Accessible) if (status != NetworkAccessibility::Accessible)
setNetworkAccessible(NetworkAccessibility::Accessible); setNetworkAccessible(NetworkAccessibility::Accessible);
}); });

View file

@ -23,7 +23,8 @@
RoomSearchInput::RoomSearchInput(QWidget *parent) RoomSearchInput::RoomSearchInput(QWidget *parent)
: TextField(parent) : TextField(parent)
{} {
}
bool bool
RoomSearchInput::focusNextPrevChild(bool next) RoomSearchInput::focusNextPrevChild(bool next)
@ -78,7 +79,7 @@ QuickSwitcher::QuickSwitcher(QWidget *parent)
topLayout_->addWidget(roomSearch_); topLayout_->addWidget(roomSearch_);
connect(completer_, SIGNAL(highlighted(QString)), roomSearch_, SLOT(setText(QString))); connect(completer_, SIGNAL(highlighted(QString)), roomSearch_, SLOT(setText(QString)));
connect(roomSearch_, &QLineEdit::textEdited, this, [=](const QString &prefix) { connect(roomSearch_, &QLineEdit::textEdited, this, [this](const QString &prefix) {
if (prefix.isEmpty()) { if (prefix.isEmpty()) {
completer_->popup()->hide(); completer_->popup()->hide();
selection_ = -1; selection_ = -1;
@ -96,7 +97,7 @@ QuickSwitcher::QuickSwitcher(QWidget *parent)
completer_->complete(); completer_->complete();
}); });
connect(roomSearch_, &RoomSearchInput::selectNextCompletion, this, [=]() { connect(roomSearch_, &RoomSearchInput::selectNextCompletion, this, [this]() {
selection_ += 1; selection_ += 1;
if (!completer_->setCurrentRow(selection_)) { if (!completer_->setCurrentRow(selection_)) {
@ -107,7 +108,7 @@ QuickSwitcher::QuickSwitcher(QWidget *parent)
completer_->popup()->setCurrentIndex(completer_->currentIndex()); completer_->popup()->setCurrentIndex(completer_->currentIndex());
}); });
connect(roomSearch_, &RoomSearchInput::selectPreviousCompletion, this, [=]() { connect(roomSearch_, &RoomSearchInput::selectPreviousCompletion, this, [this]() {
selection_ -= 1; selection_ -= 1;
if (!completer_->setCurrentRow(selection_)) { if (!completer_->setCurrentRow(selection_)) {
@ -119,8 +120,8 @@ QuickSwitcher::QuickSwitcher(QWidget *parent)
}); });
connect( connect(
roomSearch_, &RoomSearchInput::hiding, this, [=]() { completer_->popup()->hide(); }); roomSearch_, &RoomSearchInput::hiding, this, [this]() { completer_->popup()->hide(); });
connect(roomSearch_, &QLineEdit::returnPressed, this, [=]() { connect(roomSearch_, &QLineEdit::returnPressed, this, [this]() {
emit closing(); emit closing();
QString text(""); QString text("");

View file

@ -84,12 +84,12 @@ RoomInfoListItem::RoomInfoListItem(QSharedPointer<RoomSettings> settings,
menu_ = new Menu(this); menu_ = new Menu(this);
toggleNotifications_ = new QAction(notificationText(), this); toggleNotifications_ = new QAction(notificationText(), this);
connect(toggleNotifications_, &QAction::triggered, this, [=]() { connect(toggleNotifications_, &QAction::triggered, this, [this]() {
roomSettings_->toggleNotifications(); roomSettings_->toggleNotifications();
}); });
leaveRoom_ = new QAction(tr("Leave room"), this); leaveRoom_ = new QAction(tr("Leave room"), this);
connect(leaveRoom_, &QAction::triggered, this, [=]() { emit leaveRoom(room_id); }); connect(leaveRoom_, &QAction::triggered, this, [this]() { emit leaveRoom(roomId_); });
menu_->addAction(toggleNotifications_); menu_->addAction(toggleNotifications_);
menu_->addAction(leaveRoom_); menu_->addAction(leaveRoom_);

View file

@ -62,7 +62,7 @@ RoomList::RoomList(QSharedPointer<MatrixClient> client,
connect(client_.data(), connect(client_.data(),
&MatrixClient::roomAvatarRetrieved, &MatrixClient::roomAvatarRetrieved,
this, this,
[=](const QString &room_id, [this](const QString &room_id,
const QPixmap &img, const QPixmap &img,
const QString &url, const QString &url,
const QByteArray &data) { const QByteArray &data) {
@ -86,7 +86,7 @@ RoomList::addRoom(const QSharedPointer<RoomSettings> &settings,
{ {
auto room_item = new RoomInfoListItem(settings, state, room_id, scrollArea_); auto room_item = new RoomInfoListItem(settings, state, room_id, scrollArea_);
connect(room_item, &RoomInfoListItem::clicked, this, &RoomList::highlightSelectedRoom); connect(room_item, &RoomInfoListItem::clicked, this, &RoomList::highlightSelectedRoom);
connect(room_item, &RoomInfoListItem::leaveRoom, this, [=](const QString &room_id) { connect(room_item, &RoomInfoListItem::leaveRoom, this, [](const QString &room_id) {
MainWindow::instance()->openLeaveRoomDialog(room_id); MainWindow::instance()->openLeaveRoomDialog(room_id);
}); });

View file

@ -34,7 +34,7 @@ SideBarActions::SideBarActions(QWidget *parent)
createRoomAction_ = new QAction(tr("Create new room"), this); createRoomAction_ = new QAction(tr("Create new room"), this);
joinRoomAction_ = new QAction(tr("Join a room"), this); joinRoomAction_ = new QAction(tr("Join a room"), this);
connect(joinRoomAction_, &QAction::triggered, this, [=]() { connect(joinRoomAction_, &QAction::triggered, this, [this]() {
if (joinRoomDialog_.isNull()) { if (joinRoomDialog_.isNull()) {
joinRoomDialog_ = joinRoomDialog_ =
QSharedPointer<dialogs::JoinRoom>(new dialogs::JoinRoom(this)); QSharedPointer<dialogs::JoinRoom>(new dialogs::JoinRoom(this));
@ -42,7 +42,7 @@ SideBarActions::SideBarActions(QWidget *parent)
connect(joinRoomDialog_.data(), connect(joinRoomDialog_.data(),
&dialogs::JoinRoom::closing, &dialogs::JoinRoom::closing,
this, this,
[=](bool isJoining, const QString &room) { [this](bool isJoining, const QString &room) {
joinRoomModal_->hide(); joinRoomModal_->hide();
if (isJoining && !room.isEmpty()) if (isJoining && !room.isEmpty())
@ -59,7 +59,7 @@ SideBarActions::SideBarActions(QWidget *parent)
joinRoomModal_->show(); joinRoomModal_->show();
}); });
connect(createRoomAction_, &QAction::triggered, this, [=]() { connect(createRoomAction_, &QAction::triggered, this, [this]() {
if (createRoomDialog_.isNull()) { if (createRoomDialog_.isNull()) {
createRoomDialog_ = createRoomDialog_ =
QSharedPointer<dialogs::CreateRoom>(new dialogs::CreateRoom(this)); QSharedPointer<dialogs::CreateRoom>(new dialogs::CreateRoom(this));
@ -67,7 +67,7 @@ SideBarActions::SideBarActions(QWidget *parent)
connect(createRoomDialog_.data(), connect(createRoomDialog_.data(),
&dialogs::CreateRoom::closing, &dialogs::CreateRoom::closing,
this, this,
[=](bool isCreating, const mtx::requests::CreateRoom &request) { [this](bool isCreating, const mtx::requests::CreateRoom &request) {
createRoomModal_->hide(); createRoomModal_->hide();
if (isCreating) if (isCreating)
@ -93,7 +93,7 @@ SideBarActions::SideBarActions(QWidget *parent)
createRoomBtn_->setIconSize( createRoomBtn_->setIconSize(
QSize(conf::sidebarActions::iconSize, conf::sidebarActions::iconSize)); QSize(conf::sidebarActions::iconSize, conf::sidebarActions::iconSize));
connect(createRoomBtn_, &QPushButton::clicked, this, [=]() { connect(createRoomBtn_, &QPushButton::clicked, this, [this]() {
auto pos = mapToGlobal(createRoomBtn_->pos()); auto pos = mapToGlobal(createRoomBtn_->pos());
auto padding = conf::sidebarActions::iconSize / 2; auto padding = conf::sidebarActions::iconSize / 2;

View file

@ -47,7 +47,7 @@ FilteredTextEdit::FilteredTextEdit(QWidget *parent)
connect(document()->documentLayout(), connect(document()->documentLayout(),
&QAbstractTextDocumentLayout::documentSizeChanged, &QAbstractTextDocumentLayout::documentSizeChanged,
this, this,
[=]() { emit heightChanged(document()->size().toSize().height()); }); [this]() { emit heightChanged(document()->size().toSize().height()); });
working_history_.push_back(""); working_history_.push_back("");
connect(this, &QTextEdit::textChanged, this, &FilteredTextEdit::textChanged); connect(this, &QTextEdit::textChanged, this, &FilteredTextEdit::textChanged);
setAcceptRichText(false); setAcceptRichText(false);
@ -330,7 +330,7 @@ TextInputWidget::TextInputWidget(QWidget *parent)
input_->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); input_->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
input_->setPlaceholderText(tr("Write a message...")); input_->setPlaceholderText(tr("Write a message..."));
connect(input_, &FilteredTextEdit::heightChanged, this, [=](int height) { connect(input_, &FilteredTextEdit::heightChanged, this, [this](int height) {
int textInputHeight = std::min(MAX_TEXTINPUT_HEIGHT, std::max(height, 32)); int textInputHeight = std::min(MAX_TEXTINPUT_HEIGHT, std::max(height, 32));
int widgetHeight = int widgetHeight =
std::min(MAX_TEXTINPUT_HEIGHT, std::max(height, conf::textInput::height)); std::min(MAX_TEXTINPUT_HEIGHT, std::max(height, conf::textInput::height));

View file

@ -62,7 +62,7 @@ TopRoomBar::TopRoomBar(QWidget *parent)
topicLabel_->setTextFormat(Qt::RichText); topicLabel_->setTextFormat(Qt::RichText);
topicLabel_->setTextInteractionFlags(Qt::TextBrowserInteraction); topicLabel_->setTextInteractionFlags(Qt::TextBrowserInteraction);
topicLabel_->setOpenExternalLinks(true); topicLabel_->setOpenExternalLinks(true);
connect(topicLabel_, &Label::clicked, [=](QMouseEvent *e) { connect(topicLabel_, &Label::clicked, [this](QMouseEvent *e) {
if (e->button() == Qt::LeftButton && !topicLabel_->hasSelectedText()) if (e->button() == Qt::LeftButton && !topicLabel_->hasSelectedText())
topicLabel_->setWordWrap(!topicLabel_->wordWrap()); topicLabel_->setWordWrap(!topicLabel_->wordWrap());
}); });
@ -86,12 +86,12 @@ TopRoomBar::TopRoomBar(QWidget *parent)
menu_ = new Menu(this); menu_ = new Menu(this);
toggleNotifications_ = new QAction(tr("Disable notifications"), this); toggleNotifications_ = new QAction(tr("Disable notifications"), this);
connect(toggleNotifications_, &QAction::triggered, this, [=]() { connect(toggleNotifications_, &QAction::triggered, this, [this]() {
roomSettings_->toggleNotifications(); roomSettings_->toggleNotifications();
}); });
inviteUsers_ = new QAction(tr("Invite users"), this); inviteUsers_ = new QAction(tr("Invite users"), this);
connect(inviteUsers_, &QAction::triggered, this, [=]() { connect(inviteUsers_, &QAction::triggered, this, [this]() {
if (inviteUsersDialog_.isNull()) { if (inviteUsersDialog_.isNull()) {
inviteUsersDialog_ = inviteUsersDialog_ =
QSharedPointer<dialogs::InviteUsers>(new dialogs::InviteUsers(this)); QSharedPointer<dialogs::InviteUsers>(new dialogs::InviteUsers(this));
@ -99,7 +99,7 @@ TopRoomBar::TopRoomBar(QWidget *parent)
connect(inviteUsersDialog_.data(), connect(inviteUsersDialog_.data(),
&dialogs::InviteUsers::closing, &dialogs::InviteUsers::closing,
this, this,
[=](bool isSending, QStringList invitees) { [this](bool isSending, QStringList invitees) {
inviteUsersModal_->hide(); inviteUsersModal_->hide();
if (isSending && !invitees.isEmpty()) if (isSending && !invitees.isEmpty())
@ -117,7 +117,7 @@ TopRoomBar::TopRoomBar(QWidget *parent)
}); });
leaveRoom_ = new QAction(tr("Leave room"), this); leaveRoom_ = new QAction(tr("Leave room"), this);
connect(leaveRoom_, &QAction::triggered, this, [=]() { connect(leaveRoom_, &QAction::triggered, this, []() {
MainWindow::instance()->openLeaveRoomDialog(); MainWindow::instance()->openLeaveRoomDialog();
}); });
@ -125,7 +125,7 @@ TopRoomBar::TopRoomBar(QWidget *parent)
menu_->addAction(inviteUsers_); menu_->addAction(inviteUsers_);
menu_->addAction(leaveRoom_); menu_->addAction(leaveRoom_);
connect(settingsBtn_, &QPushButton::clicked, this, [=]() { connect(settingsBtn_, &QPushButton::clicked, this, [this]() {
if (roomSettings_.isNull()) if (roomSettings_.isNull())
return; return;

View file

@ -90,7 +90,7 @@ UserInfoWidget::UserInfoWidget(QWidget *parent)
topLayout_->addLayout(buttonLayout_); topLayout_->addLayout(buttonLayout_);
// Show the confirmation dialog. // Show the confirmation dialog.
connect(logoutButton_, &QPushButton::clicked, this, [=]() { connect(logoutButton_, &QPushButton::clicked, this, [this]() {
if (logoutDialog_.isNull()) { if (logoutDialog_.isNull()) {
logoutDialog_ = QSharedPointer<dialogs::Logout>(new dialogs::Logout(this)); logoutDialog_ = QSharedPointer<dialogs::Logout>(new dialogs::Logout(this));
connect(logoutDialog_.data(), connect(logoutDialog_.data(),

View file

@ -204,26 +204,26 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
connect(themeCombo_, connect(themeCombo_,
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated), static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated),
[=](const QString &text) { settings_->setTheme(text.toLower()); }); [this](const QString &text) { settings_->setTheme(text.toLower()); });
connect(trayToggle_, &Toggle::toggled, this, [=](bool isDisabled) { connect(trayToggle_, &Toggle::toggled, this, [this](bool isDisabled) {
settings_->setTray(!isDisabled); settings_->setTray(!isDisabled);
emit trayOptionChanged(!isDisabled); emit trayOptionChanged(!isDisabled);
}); });
connect(roomOrderToggle_, &Toggle::toggled, this, [=](bool isDisabled) { connect(roomOrderToggle_, &Toggle::toggled, this, [this](bool isDisabled) {
settings_->setRoomOrdering(!isDisabled); settings_->setRoomOrdering(!isDisabled);
}); });
connect(groupViewToggle_, &Toggle::toggled, this, [=](bool isDisabled) { connect(groupViewToggle_, &Toggle::toggled, this, [this](bool isDisabled) {
settings_->setGroupView(!isDisabled); settings_->setGroupView(!isDisabled);
}); });
connect(typingNotifications_, &Toggle::toggled, this, [=](bool isDisabled) { connect(typingNotifications_, &Toggle::toggled, this, [this](bool isDisabled) {
settings_->setTypingNotifications(!isDisabled); settings_->setTypingNotifications(!isDisabled);
}); });
connect(backBtn_, &QPushButton::clicked, this, [=]() { connect(backBtn_, &QPushButton::clicked, this, [this]() {
settings_->save(); settings_->save();
emit moveBack(); emit moveBack();
}); });

View file

@ -93,7 +93,7 @@ CreateRoom::CreateRoom(QWidget *parent)
layout->addLayout(directLayout); layout->addLayout(directLayout);
layout->addLayout(buttonLayout); layout->addLayout(buttonLayout);
connect(confirmBtn_, &QPushButton::clicked, this, [=]() { connect(confirmBtn_, &QPushButton::clicked, this, [this]() {
request_.name = nameInput_->text().toStdString(); request_.name = nameInput_->text().toStdString();
request_.topic = topicInput_->text().toStdString(); request_.topic = topicInput_->text().toStdString();
request_.room_alias_name = aliasInput_->text().toStdString(); request_.room_alias_name = aliasInput_->text().toStdString();
@ -103,7 +103,7 @@ CreateRoom::CreateRoom(QWidget *parent)
clearFields(); clearFields();
}); });
connect(cancelBtn_, &QPushButton::clicked, this, [=]() { connect(cancelBtn_, &QPushButton::clicked, this, [this]() {
emit closing(false, request_); emit closing(false, request_);
clearFields(); clearFields();
@ -111,7 +111,7 @@ CreateRoom::CreateRoom(QWidget *parent)
connect(visibilityCombo_, connect(visibilityCombo_,
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated), static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated),
[=](const QString &text) { [this](const QString &text) {
if (text == "Private") { if (text == "Private") {
request_.visibility = mtx::requests::Visibility::Private; request_.visibility = mtx::requests::Visibility::Private;
} else { } else {
@ -121,7 +121,7 @@ CreateRoom::CreateRoom(QWidget *parent)
connect(presetCombo_, connect(presetCombo_,
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated), static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated),
[=](const QString &text) { [this](const QString &text) {
if (text == "Private Chat") { if (text == "Private Chat") {
request_.preset = mtx::requests::Preset::PrivateChat; request_.preset = mtx::requests::Preset::PrivateChat;
} else if (text == "Public Chat") { } else if (text == "Public Chat") {
@ -131,7 +131,7 @@ CreateRoom::CreateRoom(QWidget *parent)
} }
}); });
connect(directToggle_, &Toggle::toggled, this, [=](bool isDisabled) { connect(directToggle_, &Toggle::toggled, this, [this](bool isDisabled) {
request_.is_direct = !isDisabled; request_.is_direct = !isDisabled;
}); });
} }

View file

@ -63,7 +63,7 @@ InviteUsers::InviteUsers(QWidget *parent)
layout->addLayout(buttonLayout); layout->addLayout(buttonLayout);
connect(inviteeInput_, &TextField::returnPressed, this, &InviteUsers::addUser); connect(inviteeInput_, &TextField::returnPressed, this, &InviteUsers::addUser);
connect(confirmBtn_, &QPushButton::clicked, [=]() { connect(confirmBtn_, &QPushButton::clicked, [this]() {
emit closing(true, invitedUsers()); emit closing(true, invitedUsers());
inviteeInput_->clear(); inviteeInput_->clear();
@ -71,7 +71,7 @@ InviteUsers::InviteUsers(QWidget *parent)
errorLabel_->hide(); errorLabel_->hide();
}); });
connect(cancelBtn_, &QPushButton::clicked, [=]() { connect(cancelBtn_, &QPushButton::clicked, [this]() {
QStringList emptyList; QStringList emptyList;
emit closing(false, emptyList); emit closing(false, emptyList);

View file

@ -44,11 +44,11 @@ JoinRoom::JoinRoom(QWidget *parent)
layout->addLayout(buttonLayout); layout->addLayout(buttonLayout);
// TODO: input validation with error messages. // TODO: input validation with error messages.
connect(confirmBtn_, &QPushButton::clicked, [=]() { connect(confirmBtn_, &QPushButton::clicked, [this]() {
emit closing(true, roomInput_->text()); emit closing(true, roomInput_->text());
roomInput_->clear(); roomInput_->clear();
}); });
connect(cancelBtn_, &QPushButton::clicked, [=]() { emit closing(false, ""); }); connect(cancelBtn_, &QPushButton::clicked, [this]() { emit closing(false, ""); });
} }
void void

View file

@ -42,8 +42,8 @@ LeaveRoom::LeaveRoom(QWidget *parent)
layout->addWidget(label); layout->addWidget(label);
layout->addLayout(buttonLayout); layout->addLayout(buttonLayout);
connect(confirmBtn_, &QPushButton::clicked, [=]() { emit closing(true); }); connect(confirmBtn_, &QPushButton::clicked, [this]() { emit closing(true); });
connect(cancelBtn_, &QPushButton::clicked, [=]() { emit closing(false); }); connect(cancelBtn_, &QPushButton::clicked, [this]() { emit closing(false); });
} }
void void

View file

@ -60,8 +60,8 @@ Logout::Logout(QWidget *parent)
layout->addWidget(label); layout->addWidget(label);
layout->addLayout(buttonLayout); layout->addLayout(buttonLayout);
connect(confirmBtn_, &QPushButton::clicked, [=]() { emit closing(true); }); connect(confirmBtn_, &QPushButton::clicked, [this]() { emit closing(true); });
connect(cancelBtn_, &QPushButton::clicked, [=]() { emit closing(false); }); connect(cancelBtn_, &QPushButton::clicked, [this]() { emit closing(false); });
} }
void void

View file

@ -51,7 +51,7 @@ PreviewUploadOverlay::PreviewUploadOverlay(QWidget *parent)
vlayout->addWidget(&fileName_); vlayout->addWidget(&fileName_);
vlayout->addLayout(hlayout); vlayout->addLayout(hlayout);
connect(&upload_, &QPushButton::clicked, [&]() { connect(&upload_, &QPushButton::clicked, [this]() {
emit confirmUpload(data_, mediaType_, fileName_.text()); emit confirmUpload(data_, mediaType_, fileName_.text());
close(); close();
}); });

View file

@ -51,7 +51,7 @@ ReceiptItem::ReceiptItem(QWidget *parent, const QString &user_id, uint64_t times
topLayout_->addWidget(avatar_); topLayout_->addWidget(avatar_);
topLayout_->addLayout(textLayout_, 1); topLayout_->addLayout(textLayout_, 1);
AvatarProvider::resolve(user_id, [=](const QImage &img) { avatar_->setImage(img); }); AvatarProvider::resolve(user_id, [this](const QImage &img) { avatar_->setImage(img); });
} }
QString QString

View file

@ -47,7 +47,7 @@ TimelineItem::init()
receiptsMenu_ = new QMenu(this); receiptsMenu_ = new QMenu(this);
showReadReceipts_ = new QAction("Read receipts", this); showReadReceipts_ = new QAction("Read receipts", this);
receiptsMenu_->addAction(showReadReceipts_); receiptsMenu_->addAction(showReadReceipts_);
connect(showReadReceipts_, &QAction::triggered, this, [=]() { connect(showReadReceipts_, &QAction::triggered, this, [this]() {
if (!event_id_.isEmpty()) if (!event_id_.isEmpty())
ChatPage::instance()->showReadReceipts(event_id_); ChatPage::instance()->showReadReceipts(event_id_);
}); });
@ -111,7 +111,7 @@ TimelineItem::TimelineItem(mtx::events::MessageType ty,
messageLayout_->addLayout(headerLayout_, 1); messageLayout_->addLayout(headerLayout_, 1);
AvatarProvider::resolve(userid, [=](const QImage &img) { setUserAvatar(img); }); AvatarProvider::resolve(userid, [this](const QImage &img) { setUserAvatar(img); });
} else { } else {
generateBody(body); generateBody(body);
setupSimpleLayout(); setupSimpleLayout();
@ -243,7 +243,7 @@ TimelineItem::TimelineItem(const mtx::events::RoomEvent<mtx::events::msg::Notice
messageLayout_->addLayout(headerLayout_, 1); messageLayout_->addLayout(headerLayout_, 1);
AvatarProvider::resolve(sender, [=](const QImage &img) { setUserAvatar(img); }); AvatarProvider::resolve(sender, [this](const QImage &img) { setUserAvatar(img); });
} else { } else {
generateBody(body); generateBody(body);
setupSimpleLayout(); setupSimpleLayout();
@ -290,7 +290,7 @@ TimelineItem::TimelineItem(const mtx::events::RoomEvent<mtx::events::msg::Emote>
messageLayout_->addLayout(headerLayout_, 1); messageLayout_->addLayout(headerLayout_, 1);
AvatarProvider::resolve(sender, [=](const QImage &img) { setUserAvatar(img); }); AvatarProvider::resolve(sender, [this](const QImage &img) { setUserAvatar(img); });
} else { } else {
generateBody(emoteMsg); generateBody(emoteMsg);
setupSimpleLayout(); setupSimpleLayout();
@ -342,7 +342,7 @@ TimelineItem::TimelineItem(const mtx::events::RoomEvent<mtx::events::msg::Text>
messageLayout_->addLayout(headerLayout_, 1); messageLayout_->addLayout(headerLayout_, 1);
AvatarProvider::resolve(sender, [=](const QImage &img) { setUserAvatar(img); }); AvatarProvider::resolve(sender, [this](const QImage &img) { setUserAvatar(img); });
} else { } else {
generateBody(body); generateBody(body);
setupSimpleLayout(); setupSimpleLayout();

View file

@ -369,7 +369,7 @@ TimelineView::init()
scrollDownBtn_->setForegroundColor(QColor("black")); scrollDownBtn_->setForegroundColor(QColor("black"));
scrollDownBtn_->hide(); scrollDownBtn_->hide();
connect(scrollDownBtn_, &QPushButton::clicked, this, [=]() { connect(scrollDownBtn_, &QPushButton::clicked, this, [this]() {
const int max = scroll_area_->verticalScrollBar()->maximum(); const int max = scroll_area_->verticalScrollBar()->maximum();
scroll_area_->verticalScrollBar()->setValue(max); scroll_area_->verticalScrollBar()->setValue(max);
}); });

View file

@ -65,7 +65,7 @@ AudioItem::init()
player_->setNotifyInterval(1000); player_->setNotifyInterval(1000);
connect(client_.data(), &MatrixClient::fileDownloaded, this, &AudioItem::fileDownloaded); connect(client_.data(), &MatrixClient::fileDownloaded, this, &AudioItem::fileDownloaded);
connect(player_, &QMediaPlayer::stateChanged, this, [=](QMediaPlayer::State state) { connect(player_, &QMediaPlayer::stateChanged, this, [this](QMediaPlayer::State state) {
if (state == QMediaPlayer::StoppedState) { if (state == QMediaPlayer::StoppedState) {
state_ = AudioState::Play; state_ = AudioState::Play;
player_->setMedia(QUrl(url_)); player_->setMedia(QUrl(url_));