mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-26 04:58:49 +03:00
Be explicit about the captured parameters in lambdas
This commit is contained in:
parent
127c52e39a
commit
f95998a64b
24 changed files with 142 additions and 133 deletions
|
@ -173,7 +173,7 @@ TimelineItem::setupLocalWidgetLayout(Widget *widget,
|
|||
headerLayout_->addLayout(widgetLayout);
|
||||
messageLayout_->addLayout(headerLayout_, 1);
|
||||
|
||||
AvatarProvider::resolve(userid, [=](const QImage &img) { setUserAvatar(img); });
|
||||
AvatarProvider::resolve(userid, [this](const QImage &img) { setUserAvatar(img); });
|
||||
} else {
|
||||
setupSimpleLayout();
|
||||
|
||||
|
@ -224,7 +224,7 @@ TimelineItem::setupWidgetLayout(Widget *widget,
|
|||
headerLayout_->addLayout(widgetLayout);
|
||||
messageLayout_->addLayout(headerLayout_, 1);
|
||||
|
||||
AvatarProvider::resolve(sender, [=](const QImage &img) { setUserAvatar(img); });
|
||||
AvatarProvider::resolve(sender, [this](const QImage &img) { setUserAvatar(img); });
|
||||
} else {
|
||||
setupSimpleLayout();
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ private:
|
|||
{
|
||||
item->hide();
|
||||
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.
|
||||
|
|
122
src/ChatPage.cc
122
src/ChatPage.cc
|
@ -141,21 +141,21 @@ ChatPage::ChatPage(QSharedPointer<MatrixClient> client,
|
|||
typingRefresher_ = new QTimer(this);
|
||||
typingRefresher_->setInterval(TYPING_REFRESH_TIMEOUT);
|
||||
|
||||
connect(user_info_widget_, &UserInfoWidget::logout, this, [=]() {
|
||||
connect(user_info_widget_, &UserInfoWidget::logout, this, [this]() {
|
||||
client_->logout();
|
||||
emit showOverlayProgressBar();
|
||||
});
|
||||
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) {
|
||||
QTimer::singleShot(ii * 1000, this, [=]() {
|
||||
QTimer::singleShot(ii * 1000, this, [this, &ii, &users]() {
|
||||
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;
|
||||
|
||||
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::declineInvite, client_.data(), &MatrixClient::leaveRoom);
|
||||
|
||||
connect(text_input_, &TextInputWidget::startedTyping, this, [=]() {
|
||||
connect(text_input_, &TextInputWidget::startedTyping, this, [this]() {
|
||||
if (!userSettings_->isTypingNotificationsEnabled())
|
||||
return;
|
||||
|
||||
|
@ -186,7 +186,7 @@ ChatPage::ChatPage(QSharedPointer<MatrixClient> client,
|
|||
client_->sendTypingNotification(current_room_);
|
||||
});
|
||||
|
||||
connect(text_input_, &TextInputWidget::stoppedTyping, this, [=]() {
|
||||
connect(text_input_, &TextInputWidget::stoppedTyping, this, [this]() {
|
||||
if (!userSettings_->isTypingNotificationsEnabled())
|
||||
return;
|
||||
|
||||
|
@ -194,7 +194,7 @@ ChatPage::ChatPage(QSharedPointer<MatrixClient> client,
|
|||
client_->removeTypingNotification(current_room_);
|
||||
});
|
||||
|
||||
connect(typingRefresher_, &QTimer::timeout, this, [=]() {
|
||||
connect(typingRefresher_, &QTimer::timeout, this, [this]() {
|
||||
if (!userSettings_->isTypingNotificationsEnabled())
|
||||
return;
|
||||
|
||||
|
@ -229,65 +229,69 @@ ChatPage::ChatPage(QSharedPointer<MatrixClient> client,
|
|||
connect(text_input_,
|
||||
&TextInputWidget::uploadImage,
|
||||
this,
|
||||
[=](QSharedPointer<QIODevice> data, const QString &fn) {
|
||||
[this](QSharedPointer<QIODevice> data, const QString &fn) {
|
||||
client_->uploadImage(current_room_, fn, data);
|
||||
});
|
||||
|
||||
connect(text_input_,
|
||||
&TextInputWidget::uploadFile,
|
||||
this,
|
||||
[=](QSharedPointer<QIODevice> data, const QString &fn) {
|
||||
[this](QSharedPointer<QIODevice> data, const QString &fn) {
|
||||
client_->uploadFile(current_room_, fn, data);
|
||||
});
|
||||
|
||||
connect(text_input_,
|
||||
&TextInputWidget::uploadAudio,
|
||||
this,
|
||||
[=](QSharedPointer<QIODevice> data, const QString &fn) {
|
||||
[this](QSharedPointer<QIODevice> data, const QString &fn) {
|
||||
client_->uploadAudio(current_room_, fn, data);
|
||||
});
|
||||
connect(text_input_,
|
||||
&TextInputWidget::uploadVideo,
|
||||
this,
|
||||
[=](QSharedPointer<QIODevice> data, const QString &fn) {
|
||||
[this](QSharedPointer<QIODevice> data, const QString &fn) {
|
||||
client_->uploadVideo(current_room_, fn, data);
|
||||
});
|
||||
|
||||
connect(
|
||||
client_.data(), &MatrixClient::roomCreationFailed, 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();
|
||||
emit showNotification(msg);
|
||||
});
|
||||
connect(client_.data(),
|
||||
&MatrixClient::imageUploaded,
|
||||
this,
|
||||
[=](QString roomid, QString filename, QString url, QString mime, uint64_t dsize) {
|
||||
text_input_->hideUploadSpinner();
|
||||
view_manager_->queueImageMessage(roomid, filename, url, mime, dsize);
|
||||
});
|
||||
connect(client_.data(),
|
||||
&MatrixClient::fileUploaded,
|
||||
this,
|
||||
[=](QString roomid, QString filename, QString url, QString mime, uint64_t dsize) {
|
||||
text_input_->hideUploadSpinner();
|
||||
view_manager_->queueFileMessage(roomid, filename, url, mime, dsize);
|
||||
});
|
||||
connect(client_.data(),
|
||||
&MatrixClient::audioUploaded,
|
||||
this,
|
||||
[=](QString roomid, QString filename, QString url, QString mime, uint64_t dsize) {
|
||||
text_input_->hideUploadSpinner();
|
||||
view_manager_->queueAudioMessage(roomid, filename, url, mime, dsize);
|
||||
});
|
||||
connect(client_.data(),
|
||||
&MatrixClient::videoUploaded,
|
||||
this,
|
||||
[=](QString roomid, QString filename, QString url, QString mime, uint64_t dsize) {
|
||||
text_input_->hideUploadSpinner();
|
||||
view_manager_->queueVideoMessage(roomid, filename, url, mime, dsize);
|
||||
});
|
||||
connect(
|
||||
client_.data(),
|
||||
&MatrixClient::imageUploaded,
|
||||
this,
|
||||
[this](QString roomid, QString filename, QString url, QString mime, uint64_t dsize) {
|
||||
text_input_->hideUploadSpinner();
|
||||
view_manager_->queueImageMessage(roomid, filename, url, mime, dsize);
|
||||
});
|
||||
connect(
|
||||
client_.data(),
|
||||
&MatrixClient::fileUploaded,
|
||||
this,
|
||||
[this](QString roomid, QString filename, QString url, QString mime, uint64_t dsize) {
|
||||
text_input_->hideUploadSpinner();
|
||||
view_manager_->queueFileMessage(roomid, filename, url, mime, dsize);
|
||||
});
|
||||
connect(
|
||||
client_.data(),
|
||||
&MatrixClient::audioUploaded,
|
||||
this,
|
||||
[this](QString roomid, QString filename, QString url, QString mime, uint64_t dsize) {
|
||||
text_input_->hideUploadSpinner();
|
||||
view_manager_->queueAudioMessage(roomid, filename, url, mime, dsize);
|
||||
});
|
||||
connect(
|
||||
client_.data(),
|
||||
&MatrixClient::videoUploaded,
|
||||
this,
|
||||
[this](QString roomid, QString filename, QString url, QString mime, uint64_t dsize) {
|
||||
text_input_->hideUploadSpinner();
|
||||
view_manager_->queueVideoMessage(roomid, filename, url, mime, dsize);
|
||||
});
|
||||
|
||||
connect(room_list_, &RoomList::roomAvatarChanged, this, &ChatPage::updateTopBarAvatar);
|
||||
|
||||
|
@ -309,13 +313,13 @@ ChatPage::ChatPage(QSharedPointer<MatrixClient> client,
|
|||
connect(client_.data(),
|
||||
&MatrixClient::communityProfileRetrieved,
|
||||
this,
|
||||
[=](QString communityId, QJsonObject profile) {
|
||||
[this](QString communityId, QJsonObject profile) {
|
||||
communities_[communityId]->parseProfile(profile);
|
||||
});
|
||||
connect(client_.data(),
|
||||
&MatrixClient::communityRoomsRetrieved,
|
||||
this,
|
||||
[=](QString communityId, QJsonObject rooms) {
|
||||
[this](QString communityId, QJsonObject rooms) {
|
||||
communities_[communityId]->parseRooms(rooms);
|
||||
|
||||
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.");
|
||||
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));
|
||||
});
|
||||
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));
|
||||
});
|
||||
connect(client_.data(), &MatrixClient::leftRoom, this, &ChatPage::removeRoom);
|
||||
|
||||
showContentTimer_ = new QTimer(this);
|
||||
showContentTimer_->setSingleShot(true);
|
||||
connect(showContentTimer_, &QTimer::timeout, this, [=]() {
|
||||
connect(showContentTimer_, &QTimer::timeout, this, [this]() {
|
||||
consensusTimer_->stop();
|
||||
emit contentLoaded();
|
||||
});
|
||||
|
||||
consensusTimer_ = new QTimer(this);
|
||||
connect(consensusTimer_, &QTimer::timeout, this, [=]() {
|
||||
connect(consensusTimer_, &QTimer::timeout, this, [this]() {
|
||||
if (view_manager_->hasLoaded()) {
|
||||
// Remove the spinner overlay.
|
||||
emit contentLoaded();
|
||||
|
@ -361,7 +365,7 @@ ChatPage::ChatPage(QSharedPointer<MatrixClient> client,
|
|||
connect(initialSyncTimer_, &QTimer::timeout, this, &ChatPage::retryInitialSync);
|
||||
|
||||
syncTimeoutTimer_ = new QTimer(this);
|
||||
connect(syncTimeoutTimer_, &QTimer::timeout, this, [=]() {
|
||||
connect(syncTimeoutTimer_, &QTimer::timeout, this, [this]() {
|
||||
if (client_->getHomeServer().isEmpty()) {
|
||||
syncTimeoutTimer_->stop();
|
||||
return;
|
||||
|
@ -374,7 +378,7 @@ ChatPage::ChatPage(QSharedPointer<MatrixClient> client,
|
|||
connect(communitiesList_,
|
||||
&CommunitiesList::communityChanged,
|
||||
this,
|
||||
[=](const QString &communityId) {
|
||||
[this](const QString &communityId) {
|
||||
current_community_ = communityId;
|
||||
|
||||
if (communityId == "world")
|
||||
|
@ -577,8 +581,8 @@ ChatPage::updateOwnProfileInfo(const QUrl &avatar_url, const QString &display_na
|
|||
if (avatar_url.isValid())
|
||||
client_->fetchUserAvatar(
|
||||
avatar_url,
|
||||
[=](QImage img) { user_info_widget_->setAvatar(img); },
|
||||
[=](QString error) { qWarning() << error << ": failed to fetch own avatar"; });
|
||||
[this](QImage img) { user_info_widget_->setAvatar(img); },
|
||||
[](QString error) { qWarning() << error << ": failed to fetch own avatar"; });
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -691,24 +695,24 @@ ChatPage::showQuickSwitcher()
|
|||
if (quickSwitcher_.isNull()) {
|
||||
quickSwitcher_ = QSharedPointer<QuickSwitcher>(
|
||||
new QuickSwitcher(this),
|
||||
[=](QuickSwitcher *switcher) { switcher->deleteLater(); });
|
||||
[](QuickSwitcher *switcher) { switcher->deleteLater(); });
|
||||
|
||||
connect(quickSwitcher_.data(),
|
||||
&QuickSwitcher::roomSelected,
|
||||
room_list_,
|
||||
&RoomList::highlightSelectedRoom);
|
||||
|
||||
connect(quickSwitcher_.data(), &QuickSwitcher::closing, this, [=]() {
|
||||
if (!this->quickSwitcherModal_.isNull())
|
||||
this->quickSwitcherModal_->hide();
|
||||
this->text_input_->setFocus(Qt::FocusReason::PopupFocusReason);
|
||||
connect(quickSwitcher_.data(), &QuickSwitcher::closing, this, [this]() {
|
||||
if (!quickSwitcherModal_.isNull())
|
||||
quickSwitcherModal_->hide();
|
||||
text_input_->setFocus(Qt::FocusReason::PopupFocusReason);
|
||||
});
|
||||
}
|
||||
|
||||
if (quickSwitcherModal_.isNull()) {
|
||||
quickSwitcherModal_ = QSharedPointer<OverlayModal>(
|
||||
new OverlayModal(MainWindow::instance(), quickSwitcher_.data()),
|
||||
[=](OverlayModal *modal) { modal->deleteLater(); });
|
||||
[](OverlayModal *modal) { modal->deleteLater(); });
|
||||
quickSwitcherModal_->setColor(QColor(30, 30, 30, 170));
|
||||
}
|
||||
|
||||
|
@ -934,13 +938,13 @@ ChatPage::showReadReceipts(const QString &event_id)
|
|||
if (receiptsDialog_.isNull()) {
|
||||
receiptsDialog_ = QSharedPointer<dialogs::ReadReceipts>(
|
||||
new dialogs::ReadReceipts(this),
|
||||
[=](dialogs::ReadReceipts *dialog) { dialog->deleteLater(); });
|
||||
[](dialogs::ReadReceipts *dialog) { dialog->deleteLater(); });
|
||||
}
|
||||
|
||||
if (receiptsModal_.isNull()) {
|
||||
receiptsModal_ = QSharedPointer<OverlayModal>(
|
||||
new OverlayModal(MainWindow::instance(), receiptsDialog_.data()),
|
||||
[=](OverlayModal *modal) { modal->deleteLater(); });
|
||||
[](OverlayModal *modal) { modal->deleteLater(); });
|
||||
receiptsModal_->setColor(QColor(30, 30, 30, 170));
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ CommunitiesList::CommunitiesList(QSharedPointer<MatrixClient> client, QWidget *p
|
|||
connect(client_.data(),
|
||||
&MatrixClient::communityProfileRetrieved,
|
||||
this,
|
||||
[=](QString communityId, QJsonObject profile) {
|
||||
[this](QString communityId, QJsonObject profile) {
|
||||
client_->fetchCommunityAvatar(communityId,
|
||||
QUrl(profile["avatar_url"].toString()));
|
||||
});
|
||||
|
|
|
@ -77,7 +77,8 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
|
||||
connect(login_page_, SIGNAL(backButtonClicked()), this, SLOT(showWelcomePage()));
|
||||
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(chat_page_, SIGNAL(close()), this, SLOT(showWelcomePage()));
|
||||
|
@ -86,12 +87,12 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
connect(
|
||||
chat_page_, SIGNAL(changeWindowTitle(QString)), this, SLOT(setWindowTitle(QString)));
|
||||
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);
|
||||
showLoginPage();
|
||||
});
|
||||
|
||||
connect(userSettingsPage_, &UserSettingsPage::moveBack, this, [=]() {
|
||||
connect(userSettingsPage_, &UserSettingsPage::moveBack, this, [this]() {
|
||||
pageStack_->setCurrentWidget(chat_page_);
|
||||
});
|
||||
|
||||
|
@ -116,7 +117,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
connect(quitShortcut, &QShortcut::activated, this, QApplication::quit);
|
||||
|
||||
QShortcut *quickSwitchShortcut = new QShortcut(QKeySequence("Ctrl+K"), this);
|
||||
connect(quickSwitchShortcut, &QShortcut::activated, this, [=]() {
|
||||
connect(quickSwitchShortcut, &QShortcut::activated, this, [this]() {
|
||||
chat_page_->showQuickSwitcher();
|
||||
});
|
||||
|
||||
|
@ -162,7 +163,7 @@ MainWindow::removeOverlayProgressBar()
|
|||
QTimer *timer = new QTimer(this);
|
||||
timer->setSingleShot(true);
|
||||
|
||||
connect(timer, &QTimer::timeout, [=]() {
|
||||
connect(timer, &QTimer::timeout, [this, timer]() {
|
||||
timer->deleteLater();
|
||||
|
||||
if (!progressModal_.isNull())
|
||||
|
@ -176,7 +177,7 @@ MainWindow::removeOverlayProgressBar()
|
|||
});
|
||||
|
||||
// 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));
|
||||
connect(chat_page_,
|
||||
&ChatPage::showNotification,
|
||||
|
@ -197,7 +198,7 @@ MainWindow::showChatPage(QString userid, QString homeserver, QString token)
|
|||
|
||||
showOverlayProgressBar();
|
||||
|
||||
QTimer::singleShot(100, this, [=]() { pageStack_->setCurrentWidget(chat_page_); });
|
||||
QTimer::singleShot(100, this, [this]() { pageStack_->setCurrentWidget(chat_page_); });
|
||||
|
||||
login_page_->reset();
|
||||
chat_page_->bootstrap(userid, homeserver, token);
|
||||
|
@ -250,12 +251,15 @@ MainWindow::openLeaveRoomDialog(const QString &room_id)
|
|||
|
||||
leaveRoomDialog_ = QSharedPointer<dialogs::LeaveRoom>(new dialogs::LeaveRoom(this));
|
||||
|
||||
connect(leaveRoomDialog_.data(), &dialogs::LeaveRoom::closing, this, [=](bool leaving) {
|
||||
leaveRoomModal_->hide();
|
||||
connect(leaveRoomDialog_.data(),
|
||||
&dialogs::LeaveRoom::closing,
|
||||
this,
|
||||
[this, &roomToLeave](bool leaving) {
|
||||
leaveRoomModal_->hide();
|
||||
|
||||
if (leaving)
|
||||
client_->leaveRoom(roomToLeave);
|
||||
});
|
||||
if (leaving)
|
||||
client_->leaveRoom(roomToLeave);
|
||||
});
|
||||
|
||||
leaveRoomModal_ =
|
||||
QSharedPointer<OverlayModal>(new OverlayModal(this, leaveRoomDialog_.data()));
|
||||
|
@ -270,7 +274,7 @@ MainWindow::showOverlayProgressBar()
|
|||
if (spinner_.isNull()) {
|
||||
spinner_ = QSharedPointer<LoadingIndicator>(
|
||||
new LoadingIndicator(this),
|
||||
[=](LoadingIndicator *indicator) { indicator->deleteLater(); });
|
||||
[](LoadingIndicator *indicator) { indicator->deleteLater(); });
|
||||
spinner_->setFixedHeight(100);
|
||||
spinner_->setFixedWidth(100);
|
||||
spinner_->setObjectName("ChatPageLoadSpinner");
|
||||
|
@ -280,7 +284,7 @@ MainWindow::showOverlayProgressBar()
|
|||
if (progressModal_.isNull()) {
|
||||
progressModal_ =
|
||||
QSharedPointer<OverlayModal>(new OverlayModal(this, spinner_.data()),
|
||||
[=](OverlayModal *modal) { modal->deleteLater(); });
|
||||
[](OverlayModal *modal) { modal->deleteLater(); });
|
||||
progressModal_->setDismissible(false);
|
||||
progressModal_->show();
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ MatrixClient::MatrixClient(QString server, QObject *parent)
|
|||
connect(this,
|
||||
&QNetworkAccessManager::networkAccessibleChanged,
|
||||
this,
|
||||
[=](NetworkAccessibility status) {
|
||||
[this](NetworkAccessibility status) {
|
||||
if (status != NetworkAccessibility::Accessible)
|
||||
setNetworkAccessible(NetworkAccessibility::Accessible);
|
||||
});
|
||||
|
|
|
@ -23,7 +23,8 @@
|
|||
|
||||
RoomSearchInput::RoomSearchInput(QWidget *parent)
|
||||
: TextField(parent)
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
RoomSearchInput::focusNextPrevChild(bool next)
|
||||
|
@ -78,7 +79,7 @@ QuickSwitcher::QuickSwitcher(QWidget *parent)
|
|||
topLayout_->addWidget(roomSearch_);
|
||||
|
||||
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()) {
|
||||
completer_->popup()->hide();
|
||||
selection_ = -1;
|
||||
|
@ -96,7 +97,7 @@ QuickSwitcher::QuickSwitcher(QWidget *parent)
|
|||
completer_->complete();
|
||||
});
|
||||
|
||||
connect(roomSearch_, &RoomSearchInput::selectNextCompletion, this, [=]() {
|
||||
connect(roomSearch_, &RoomSearchInput::selectNextCompletion, this, [this]() {
|
||||
selection_ += 1;
|
||||
|
||||
if (!completer_->setCurrentRow(selection_)) {
|
||||
|
@ -107,7 +108,7 @@ QuickSwitcher::QuickSwitcher(QWidget *parent)
|
|||
completer_->popup()->setCurrentIndex(completer_->currentIndex());
|
||||
});
|
||||
|
||||
connect(roomSearch_, &RoomSearchInput::selectPreviousCompletion, this, [=]() {
|
||||
connect(roomSearch_, &RoomSearchInput::selectPreviousCompletion, this, [this]() {
|
||||
selection_ -= 1;
|
||||
|
||||
if (!completer_->setCurrentRow(selection_)) {
|
||||
|
@ -119,8 +120,8 @@ QuickSwitcher::QuickSwitcher(QWidget *parent)
|
|||
});
|
||||
|
||||
connect(
|
||||
roomSearch_, &RoomSearchInput::hiding, this, [=]() { completer_->popup()->hide(); });
|
||||
connect(roomSearch_, &QLineEdit::returnPressed, this, [=]() {
|
||||
roomSearch_, &RoomSearchInput::hiding, this, [this]() { completer_->popup()->hide(); });
|
||||
connect(roomSearch_, &QLineEdit::returnPressed, this, [this]() {
|
||||
emit closing();
|
||||
|
||||
QString text("");
|
||||
|
|
|
@ -84,12 +84,12 @@ RoomInfoListItem::RoomInfoListItem(QSharedPointer<RoomSettings> settings,
|
|||
menu_ = new Menu(this);
|
||||
|
||||
toggleNotifications_ = new QAction(notificationText(), this);
|
||||
connect(toggleNotifications_, &QAction::triggered, this, [=]() {
|
||||
connect(toggleNotifications_, &QAction::triggered, this, [this]() {
|
||||
roomSettings_->toggleNotifications();
|
||||
});
|
||||
|
||||
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(leaveRoom_);
|
||||
|
|
|
@ -62,10 +62,10 @@ RoomList::RoomList(QSharedPointer<MatrixClient> client,
|
|||
connect(client_.data(),
|
||||
&MatrixClient::roomAvatarRetrieved,
|
||||
this,
|
||||
[=](const QString &room_id,
|
||||
const QPixmap &img,
|
||||
const QString &url,
|
||||
const QByteArray &data) {
|
||||
[this](const QString &room_id,
|
||||
const QPixmap &img,
|
||||
const QString &url,
|
||||
const QByteArray &data) {
|
||||
if (!cache_.isNull())
|
||||
cache_->saveImage(url, data);
|
||||
|
||||
|
@ -86,7 +86,7 @@ RoomList::addRoom(const QSharedPointer<RoomSettings> &settings,
|
|||
{
|
||||
auto room_item = new RoomInfoListItem(settings, state, room_id, scrollArea_);
|
||||
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);
|
||||
});
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ SideBarActions::SideBarActions(QWidget *parent)
|
|||
createRoomAction_ = new QAction(tr("Create new room"), this);
|
||||
joinRoomAction_ = new QAction(tr("Join a room"), this);
|
||||
|
||||
connect(joinRoomAction_, &QAction::triggered, this, [=]() {
|
||||
connect(joinRoomAction_, &QAction::triggered, this, [this]() {
|
||||
if (joinRoomDialog_.isNull()) {
|
||||
joinRoomDialog_ =
|
||||
QSharedPointer<dialogs::JoinRoom>(new dialogs::JoinRoom(this));
|
||||
|
@ -42,7 +42,7 @@ SideBarActions::SideBarActions(QWidget *parent)
|
|||
connect(joinRoomDialog_.data(),
|
||||
&dialogs::JoinRoom::closing,
|
||||
this,
|
||||
[=](bool isJoining, const QString &room) {
|
||||
[this](bool isJoining, const QString &room) {
|
||||
joinRoomModal_->hide();
|
||||
|
||||
if (isJoining && !room.isEmpty())
|
||||
|
@ -59,7 +59,7 @@ SideBarActions::SideBarActions(QWidget *parent)
|
|||
joinRoomModal_->show();
|
||||
});
|
||||
|
||||
connect(createRoomAction_, &QAction::triggered, this, [=]() {
|
||||
connect(createRoomAction_, &QAction::triggered, this, [this]() {
|
||||
if (createRoomDialog_.isNull()) {
|
||||
createRoomDialog_ =
|
||||
QSharedPointer<dialogs::CreateRoom>(new dialogs::CreateRoom(this));
|
||||
|
@ -67,7 +67,7 @@ SideBarActions::SideBarActions(QWidget *parent)
|
|||
connect(createRoomDialog_.data(),
|
||||
&dialogs::CreateRoom::closing,
|
||||
this,
|
||||
[=](bool isCreating, const mtx::requests::CreateRoom &request) {
|
||||
[this](bool isCreating, const mtx::requests::CreateRoom &request) {
|
||||
createRoomModal_->hide();
|
||||
|
||||
if (isCreating)
|
||||
|
@ -93,7 +93,7 @@ SideBarActions::SideBarActions(QWidget *parent)
|
|||
createRoomBtn_->setIconSize(
|
||||
QSize(conf::sidebarActions::iconSize, conf::sidebarActions::iconSize));
|
||||
|
||||
connect(createRoomBtn_, &QPushButton::clicked, this, [=]() {
|
||||
connect(createRoomBtn_, &QPushButton::clicked, this, [this]() {
|
||||
auto pos = mapToGlobal(createRoomBtn_->pos());
|
||||
auto padding = conf::sidebarActions::iconSize / 2;
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ FilteredTextEdit::FilteredTextEdit(QWidget *parent)
|
|||
connect(document()->documentLayout(),
|
||||
&QAbstractTextDocumentLayout::documentSizeChanged,
|
||||
this,
|
||||
[=]() { emit heightChanged(document()->size().toSize().height()); });
|
||||
[this]() { emit heightChanged(document()->size().toSize().height()); });
|
||||
working_history_.push_back("");
|
||||
connect(this, &QTextEdit::textChanged, this, &FilteredTextEdit::textChanged);
|
||||
setAcceptRichText(false);
|
||||
|
@ -330,7 +330,7 @@ TextInputWidget::TextInputWidget(QWidget *parent)
|
|||
input_->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
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 widgetHeight =
|
||||
std::min(MAX_TEXTINPUT_HEIGHT, std::max(height, conf::textInput::height));
|
||||
|
|
|
@ -62,7 +62,7 @@ TopRoomBar::TopRoomBar(QWidget *parent)
|
|||
topicLabel_->setTextFormat(Qt::RichText);
|
||||
topicLabel_->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
||||
topicLabel_->setOpenExternalLinks(true);
|
||||
connect(topicLabel_, &Label::clicked, [=](QMouseEvent *e) {
|
||||
connect(topicLabel_, &Label::clicked, [this](QMouseEvent *e) {
|
||||
if (e->button() == Qt::LeftButton && !topicLabel_->hasSelectedText())
|
||||
topicLabel_->setWordWrap(!topicLabel_->wordWrap());
|
||||
});
|
||||
|
@ -86,12 +86,12 @@ TopRoomBar::TopRoomBar(QWidget *parent)
|
|||
menu_ = new Menu(this);
|
||||
|
||||
toggleNotifications_ = new QAction(tr("Disable notifications"), this);
|
||||
connect(toggleNotifications_, &QAction::triggered, this, [=]() {
|
||||
connect(toggleNotifications_, &QAction::triggered, this, [this]() {
|
||||
roomSettings_->toggleNotifications();
|
||||
});
|
||||
|
||||
inviteUsers_ = new QAction(tr("Invite users"), this);
|
||||
connect(inviteUsers_, &QAction::triggered, this, [=]() {
|
||||
connect(inviteUsers_, &QAction::triggered, this, [this]() {
|
||||
if (inviteUsersDialog_.isNull()) {
|
||||
inviteUsersDialog_ =
|
||||
QSharedPointer<dialogs::InviteUsers>(new dialogs::InviteUsers(this));
|
||||
|
@ -99,7 +99,7 @@ TopRoomBar::TopRoomBar(QWidget *parent)
|
|||
connect(inviteUsersDialog_.data(),
|
||||
&dialogs::InviteUsers::closing,
|
||||
this,
|
||||
[=](bool isSending, QStringList invitees) {
|
||||
[this](bool isSending, QStringList invitees) {
|
||||
inviteUsersModal_->hide();
|
||||
|
||||
if (isSending && !invitees.isEmpty())
|
||||
|
@ -117,7 +117,7 @@ TopRoomBar::TopRoomBar(QWidget *parent)
|
|||
});
|
||||
|
||||
leaveRoom_ = new QAction(tr("Leave room"), this);
|
||||
connect(leaveRoom_, &QAction::triggered, this, [=]() {
|
||||
connect(leaveRoom_, &QAction::triggered, this, []() {
|
||||
MainWindow::instance()->openLeaveRoomDialog();
|
||||
});
|
||||
|
||||
|
@ -125,7 +125,7 @@ TopRoomBar::TopRoomBar(QWidget *parent)
|
|||
menu_->addAction(inviteUsers_);
|
||||
menu_->addAction(leaveRoom_);
|
||||
|
||||
connect(settingsBtn_, &QPushButton::clicked, this, [=]() {
|
||||
connect(settingsBtn_, &QPushButton::clicked, this, [this]() {
|
||||
if (roomSettings_.isNull())
|
||||
return;
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ UserInfoWidget::UserInfoWidget(QWidget *parent)
|
|||
topLayout_->addLayout(buttonLayout_);
|
||||
|
||||
// Show the confirmation dialog.
|
||||
connect(logoutButton_, &QPushButton::clicked, this, [=]() {
|
||||
connect(logoutButton_, &QPushButton::clicked, this, [this]() {
|
||||
if (logoutDialog_.isNull()) {
|
||||
logoutDialog_ = QSharedPointer<dialogs::Logout>(new dialogs::Logout(this));
|
||||
connect(logoutDialog_.data(),
|
||||
|
|
|
@ -204,26 +204,26 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
|
|||
|
||||
connect(themeCombo_,
|
||||
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);
|
||||
emit trayOptionChanged(!isDisabled);
|
||||
});
|
||||
|
||||
connect(roomOrderToggle_, &Toggle::toggled, this, [=](bool isDisabled) {
|
||||
connect(roomOrderToggle_, &Toggle::toggled, this, [this](bool isDisabled) {
|
||||
settings_->setRoomOrdering(!isDisabled);
|
||||
});
|
||||
|
||||
connect(groupViewToggle_, &Toggle::toggled, this, [=](bool isDisabled) {
|
||||
connect(groupViewToggle_, &Toggle::toggled, this, [this](bool isDisabled) {
|
||||
settings_->setGroupView(!isDisabled);
|
||||
});
|
||||
|
||||
connect(typingNotifications_, &Toggle::toggled, this, [=](bool isDisabled) {
|
||||
connect(typingNotifications_, &Toggle::toggled, this, [this](bool isDisabled) {
|
||||
settings_->setTypingNotifications(!isDisabled);
|
||||
});
|
||||
|
||||
connect(backBtn_, &QPushButton::clicked, this, [=]() {
|
||||
connect(backBtn_, &QPushButton::clicked, this, [this]() {
|
||||
settings_->save();
|
||||
emit moveBack();
|
||||
});
|
||||
|
|
|
@ -93,7 +93,7 @@ CreateRoom::CreateRoom(QWidget *parent)
|
|||
layout->addLayout(directLayout);
|
||||
layout->addLayout(buttonLayout);
|
||||
|
||||
connect(confirmBtn_, &QPushButton::clicked, this, [=]() {
|
||||
connect(confirmBtn_, &QPushButton::clicked, this, [this]() {
|
||||
request_.name = nameInput_->text().toStdString();
|
||||
request_.topic = topicInput_->text().toStdString();
|
||||
request_.room_alias_name = aliasInput_->text().toStdString();
|
||||
|
@ -103,7 +103,7 @@ CreateRoom::CreateRoom(QWidget *parent)
|
|||
clearFields();
|
||||
});
|
||||
|
||||
connect(cancelBtn_, &QPushButton::clicked, this, [=]() {
|
||||
connect(cancelBtn_, &QPushButton::clicked, this, [this]() {
|
||||
emit closing(false, request_);
|
||||
|
||||
clearFields();
|
||||
|
@ -111,7 +111,7 @@ CreateRoom::CreateRoom(QWidget *parent)
|
|||
|
||||
connect(visibilityCombo_,
|
||||
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated),
|
||||
[=](const QString &text) {
|
||||
[this](const QString &text) {
|
||||
if (text == "Private") {
|
||||
request_.visibility = mtx::requests::Visibility::Private;
|
||||
} else {
|
||||
|
@ -121,7 +121,7 @@ CreateRoom::CreateRoom(QWidget *parent)
|
|||
|
||||
connect(presetCombo_,
|
||||
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated),
|
||||
[=](const QString &text) {
|
||||
[this](const QString &text) {
|
||||
if (text == "Private Chat") {
|
||||
request_.preset = mtx::requests::Preset::PrivateChat;
|
||||
} 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;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ InviteUsers::InviteUsers(QWidget *parent)
|
|||
layout->addLayout(buttonLayout);
|
||||
|
||||
connect(inviteeInput_, &TextField::returnPressed, this, &InviteUsers::addUser);
|
||||
connect(confirmBtn_, &QPushButton::clicked, [=]() {
|
||||
connect(confirmBtn_, &QPushButton::clicked, [this]() {
|
||||
emit closing(true, invitedUsers());
|
||||
|
||||
inviteeInput_->clear();
|
||||
|
@ -71,7 +71,7 @@ InviteUsers::InviteUsers(QWidget *parent)
|
|||
errorLabel_->hide();
|
||||
});
|
||||
|
||||
connect(cancelBtn_, &QPushButton::clicked, [=]() {
|
||||
connect(cancelBtn_, &QPushButton::clicked, [this]() {
|
||||
QStringList emptyList;
|
||||
emit closing(false, emptyList);
|
||||
|
||||
|
|
|
@ -44,11 +44,11 @@ JoinRoom::JoinRoom(QWidget *parent)
|
|||
layout->addLayout(buttonLayout);
|
||||
|
||||
// TODO: input validation with error messages.
|
||||
connect(confirmBtn_, &QPushButton::clicked, [=]() {
|
||||
connect(confirmBtn_, &QPushButton::clicked, [this]() {
|
||||
emit closing(true, roomInput_->text());
|
||||
roomInput_->clear();
|
||||
});
|
||||
connect(cancelBtn_, &QPushButton::clicked, [=]() { emit closing(false, ""); });
|
||||
connect(cancelBtn_, &QPushButton::clicked, [this]() { emit closing(false, ""); });
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -42,8 +42,8 @@ LeaveRoom::LeaveRoom(QWidget *parent)
|
|||
layout->addWidget(label);
|
||||
layout->addLayout(buttonLayout);
|
||||
|
||||
connect(confirmBtn_, &QPushButton::clicked, [=]() { emit closing(true); });
|
||||
connect(cancelBtn_, &QPushButton::clicked, [=]() { emit closing(false); });
|
||||
connect(confirmBtn_, &QPushButton::clicked, [this]() { emit closing(true); });
|
||||
connect(cancelBtn_, &QPushButton::clicked, [this]() { emit closing(false); });
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -60,8 +60,8 @@ Logout::Logout(QWidget *parent)
|
|||
layout->addWidget(label);
|
||||
layout->addLayout(buttonLayout);
|
||||
|
||||
connect(confirmBtn_, &QPushButton::clicked, [=]() { emit closing(true); });
|
||||
connect(cancelBtn_, &QPushButton::clicked, [=]() { emit closing(false); });
|
||||
connect(confirmBtn_, &QPushButton::clicked, [this]() { emit closing(true); });
|
||||
connect(cancelBtn_, &QPushButton::clicked, [this]() { emit closing(false); });
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -51,7 +51,7 @@ PreviewUploadOverlay::PreviewUploadOverlay(QWidget *parent)
|
|||
vlayout->addWidget(&fileName_);
|
||||
vlayout->addLayout(hlayout);
|
||||
|
||||
connect(&upload_, &QPushButton::clicked, [&]() {
|
||||
connect(&upload_, &QPushButton::clicked, [this]() {
|
||||
emit confirmUpload(data_, mediaType_, fileName_.text());
|
||||
close();
|
||||
});
|
||||
|
|
|
@ -51,7 +51,7 @@ ReceiptItem::ReceiptItem(QWidget *parent, const QString &user_id, uint64_t times
|
|||
topLayout_->addWidget(avatar_);
|
||||
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
|
||||
|
|
|
@ -47,7 +47,7 @@ TimelineItem::init()
|
|||
receiptsMenu_ = new QMenu(this);
|
||||
showReadReceipts_ = new QAction("Read receipts", this);
|
||||
receiptsMenu_->addAction(showReadReceipts_);
|
||||
connect(showReadReceipts_, &QAction::triggered, this, [=]() {
|
||||
connect(showReadReceipts_, &QAction::triggered, this, [this]() {
|
||||
if (!event_id_.isEmpty())
|
||||
ChatPage::instance()->showReadReceipts(event_id_);
|
||||
});
|
||||
|
@ -111,7 +111,7 @@ TimelineItem::TimelineItem(mtx::events::MessageType ty,
|
|||
|
||||
messageLayout_->addLayout(headerLayout_, 1);
|
||||
|
||||
AvatarProvider::resolve(userid, [=](const QImage &img) { setUserAvatar(img); });
|
||||
AvatarProvider::resolve(userid, [this](const QImage &img) { setUserAvatar(img); });
|
||||
} else {
|
||||
generateBody(body);
|
||||
setupSimpleLayout();
|
||||
|
@ -243,7 +243,7 @@ TimelineItem::TimelineItem(const mtx::events::RoomEvent<mtx::events::msg::Notice
|
|||
|
||||
messageLayout_->addLayout(headerLayout_, 1);
|
||||
|
||||
AvatarProvider::resolve(sender, [=](const QImage &img) { setUserAvatar(img); });
|
||||
AvatarProvider::resolve(sender, [this](const QImage &img) { setUserAvatar(img); });
|
||||
} else {
|
||||
generateBody(body);
|
||||
setupSimpleLayout();
|
||||
|
@ -290,7 +290,7 @@ TimelineItem::TimelineItem(const mtx::events::RoomEvent<mtx::events::msg::Emote>
|
|||
|
||||
messageLayout_->addLayout(headerLayout_, 1);
|
||||
|
||||
AvatarProvider::resolve(sender, [=](const QImage &img) { setUserAvatar(img); });
|
||||
AvatarProvider::resolve(sender, [this](const QImage &img) { setUserAvatar(img); });
|
||||
} else {
|
||||
generateBody(emoteMsg);
|
||||
setupSimpleLayout();
|
||||
|
@ -342,7 +342,7 @@ TimelineItem::TimelineItem(const mtx::events::RoomEvent<mtx::events::msg::Text>
|
|||
|
||||
messageLayout_->addLayout(headerLayout_, 1);
|
||||
|
||||
AvatarProvider::resolve(sender, [=](const QImage &img) { setUserAvatar(img); });
|
||||
AvatarProvider::resolve(sender, [this](const QImage &img) { setUserAvatar(img); });
|
||||
} else {
|
||||
generateBody(body);
|
||||
setupSimpleLayout();
|
||||
|
|
|
@ -369,7 +369,7 @@ TimelineView::init()
|
|||
scrollDownBtn_->setForegroundColor(QColor("black"));
|
||||
scrollDownBtn_->hide();
|
||||
|
||||
connect(scrollDownBtn_, &QPushButton::clicked, this, [=]() {
|
||||
connect(scrollDownBtn_, &QPushButton::clicked, this, [this]() {
|
||||
const int max = scroll_area_->verticalScrollBar()->maximum();
|
||||
scroll_area_->verticalScrollBar()->setValue(max);
|
||||
});
|
||||
|
|
|
@ -65,7 +65,7 @@ AudioItem::init()
|
|||
player_->setNotifyInterval(1000);
|
||||
|
||||
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) {
|
||||
state_ = AudioState::Play;
|
||||
player_->setMedia(QUrl(url_));
|
||||
|
|
Loading…
Reference in a new issue