Chore: Proper Lambda Formatting (#2167)
Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -103,7 +103,7 @@ ChannelFilterEditorDialog::ValueSpecifier::ValueSpecifier()
|
||||
this->layout_->addWidget(this->valueInput_, 1);
|
||||
this->layout_->setContentsMargins(5, 5, 5, 5);
|
||||
|
||||
QObject::connect( //
|
||||
QObject::connect(
|
||||
this->typeCombo_, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
[this](int index) {
|
||||
const auto isNumber = (index == 1);
|
||||
@@ -183,7 +183,7 @@ ChannelFilterEditorDialog::BinaryOperationSpecifier::BinaryOperationSpecifier(
|
||||
this->layout_->addLayout(this->right_->layout());
|
||||
this->layout_->setContentsMargins(5, 5, 5, 5);
|
||||
|
||||
QObject::connect( //
|
||||
QObject::connect(
|
||||
this->opCombo_, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
[this](int index) {
|
||||
// disable if set to "(nothing)"
|
||||
|
||||
@@ -90,11 +90,13 @@ ColorPickerDialog::ColorPickerDialog(const QColor &initial, QWidget *parent)
|
||||
layout.emplace<QHBoxLayout>().emplace<QDialogButtonBox>(this);
|
||||
{
|
||||
auto *button_ok = buttons->addButton(QDialogButtonBox::Ok);
|
||||
QObject::connect(button_ok, &QPushButton::clicked,
|
||||
[=](bool) { this->ok(); });
|
||||
QObject::connect(button_ok, &QPushButton::clicked, [=](bool) {
|
||||
this->ok();
|
||||
});
|
||||
auto *button_cancel = buttons->addButton(QDialogButtonBox::Cancel);
|
||||
QObject::connect(button_cancel, &QAbstractButton::clicked,
|
||||
[=](bool) { this->close(); });
|
||||
QObject::connect(button_cancel, &QAbstractButton::clicked, [=](bool) {
|
||||
this->close();
|
||||
});
|
||||
}
|
||||
|
||||
this->themeChangedEvent();
|
||||
@@ -216,8 +218,9 @@ void ColorPickerDialog::initRecentColors(LayoutCreator<QWidget> &creator)
|
||||
|
||||
grid->addWidget(button, rowInd, columnInd);
|
||||
|
||||
QObject::connect(button, &QPushButton::clicked,
|
||||
[=] { this->selectColor(button->color(), false); });
|
||||
QObject::connect(button, &QPushButton::clicked, [=] {
|
||||
this->selectColor(button->color(), false);
|
||||
});
|
||||
|
||||
++it;
|
||||
++ind;
|
||||
@@ -249,8 +252,9 @@ void ColorPickerDialog::initDefaultColors(LayoutCreator<QWidget> &creator)
|
||||
|
||||
grid->addWidget(button, rowInd, columnInd);
|
||||
|
||||
QObject::connect(button, &QPushButton::clicked,
|
||||
[=] { this->selectColor(button->color(), false); });
|
||||
QObject::connect(button, &QPushButton::clicked, [=] {
|
||||
this->selectColor(button->color(), false);
|
||||
});
|
||||
|
||||
++it;
|
||||
++ind;
|
||||
|
||||
@@ -132,7 +132,9 @@ EmotePopup::EmotePopup(QWidget *parent)
|
||||
layout->addWidget(notebook);
|
||||
layout->setMargin(0);
|
||||
|
||||
auto clicked = [this](const Link &link) { this->linkClicked.invoke(link); };
|
||||
auto clicked = [this](const Link &link) {
|
||||
this->linkClicked.invoke(link);
|
||||
};
|
||||
|
||||
auto makeView = [&](QString tabTitle) {
|
||||
auto view = new ChannelView();
|
||||
@@ -154,9 +156,12 @@ EmotePopup::EmotePopup(QWidget *parent)
|
||||
|
||||
this->loadEmojis();
|
||||
|
||||
createWindowShortcut(this, "CTRL+Tab", [=] { notebook->selectNextTab(); });
|
||||
createWindowShortcut(this, "CTRL+Shift+Tab",
|
||||
[=] { notebook->selectPreviousTab(); });
|
||||
createWindowShortcut(this, "CTRL+Tab", [=] {
|
||||
notebook->selectNextTab();
|
||||
});
|
||||
createWindowShortcut(this, "CTRL+Shift+Tab", [=] {
|
||||
notebook->selectPreviousTab();
|
||||
});
|
||||
}
|
||||
|
||||
void EmotePopup::loadChannel(ChannelPtr _channel)
|
||||
|
||||
@@ -40,8 +40,9 @@ LastRunCrashDialog::LastRunCrashDialog()
|
||||
|
||||
auto *okButton =
|
||||
buttons->addButton("Ignore", QDialogButtonBox::ButtonRole::NoRole);
|
||||
QObject::connect(okButton, &QPushButton::clicked,
|
||||
[this] { this->accept(); });
|
||||
QObject::connect(okButton, &QPushButton::clicked, [this] {
|
||||
this->accept();
|
||||
});
|
||||
|
||||
// Updates
|
||||
// auto updateUpdateLabel = [update]() mutable {
|
||||
|
||||
@@ -187,14 +187,18 @@ AdvancedLoginWidget::AdvancedLoginWidget()
|
||||
|
||||
this->ui_.oauthTokenInput.setEchoMode(QLineEdit::Password);
|
||||
|
||||
connect(&this->ui_.userIDInput, &QLineEdit::textChanged,
|
||||
[=]() { this->refreshButtons(); });
|
||||
connect(&this->ui_.usernameInput, &QLineEdit::textChanged,
|
||||
[=]() { this->refreshButtons(); });
|
||||
connect(&this->ui_.clientIDInput, &QLineEdit::textChanged,
|
||||
[=]() { this->refreshButtons(); });
|
||||
connect(&this->ui_.oauthTokenInput, &QLineEdit::textChanged,
|
||||
[=]() { this->refreshButtons(); });
|
||||
connect(&this->ui_.userIDInput, &QLineEdit::textChanged, [=]() {
|
||||
this->refreshButtons();
|
||||
});
|
||||
connect(&this->ui_.usernameInput, &QLineEdit::textChanged, [=]() {
|
||||
this->refreshButtons();
|
||||
});
|
||||
connect(&this->ui_.clientIDInput, &QLineEdit::textChanged, [=]() {
|
||||
this->refreshButtons();
|
||||
});
|
||||
connect(&this->ui_.oauthTokenInput, &QLineEdit::textChanged, [=]() {
|
||||
this->refreshButtons();
|
||||
});
|
||||
|
||||
/// Upper button row
|
||||
|
||||
@@ -259,7 +263,7 @@ LoginWidget::LoginWidget()
|
||||
|
||||
QObject::connect(&this->ui_.buttonBox, &QDialogButtonBox::rejected,
|
||||
[this]() {
|
||||
this->close(); //
|
||||
this->close();
|
||||
});
|
||||
|
||||
this->ui_.mainLayout.addWidget(&this->ui_.buttonBox);
|
||||
|
||||
@@ -80,9 +80,10 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
|
||||
whispers_lbl->setWordWrap(true);
|
||||
whispers_btn->installEventFilter(&this->tabFilter_);
|
||||
|
||||
QObject::connect(
|
||||
whispers_btn.getElement(), &QRadioButton::toggled,
|
||||
[=](bool enabled) mutable { whispers_lbl->setVisible(enabled); });
|
||||
QObject::connect(whispers_btn.getElement(), &QRadioButton::toggled,
|
||||
[=](bool enabled) mutable {
|
||||
whispers_lbl->setVisible(enabled);
|
||||
});
|
||||
|
||||
// mentions_btn
|
||||
auto mentions_btn = vbox.emplace<QRadioButton>("Mentions")
|
||||
@@ -95,9 +96,10 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
|
||||
mentions_lbl->setWordWrap(true);
|
||||
mentions_btn->installEventFilter(&this->tabFilter_);
|
||||
|
||||
QObject::connect(
|
||||
mentions_btn.getElement(), &QRadioButton::toggled,
|
||||
[=](bool enabled) mutable { mentions_lbl->setVisible(enabled); });
|
||||
QObject::connect(mentions_btn.getElement(), &QRadioButton::toggled,
|
||||
[=](bool enabled) mutable {
|
||||
mentions_lbl->setVisible(enabled);
|
||||
});
|
||||
|
||||
// watching_btn
|
||||
auto watching_btn = vbox.emplace<QRadioButton>("Watching")
|
||||
@@ -109,9 +111,10 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
|
||||
watching_lbl->setWordWrap(true);
|
||||
watching_btn->installEventFilter(&this->tabFilter_);
|
||||
|
||||
QObject::connect(
|
||||
watching_btn.getElement(), &QRadioButton::toggled,
|
||||
[=](bool enabled) mutable { watching_lbl->setVisible(enabled); });
|
||||
QObject::connect(watching_btn.getElement(), &QRadioButton::toggled,
|
||||
[=](bool enabled) mutable {
|
||||
watching_lbl->setVisible(enabled);
|
||||
});
|
||||
|
||||
vbox->addStretch(1);
|
||||
|
||||
@@ -204,11 +207,13 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
|
||||
layout.emplace<QHBoxLayout>().emplace<QDialogButtonBox>(this);
|
||||
{
|
||||
auto *button_ok = buttons->addButton(QDialogButtonBox::Ok);
|
||||
QObject::connect(button_ok, &QPushButton::clicked,
|
||||
[=](bool) { this->ok(); });
|
||||
QObject::connect(button_ok, &QPushButton::clicked, [=](bool) {
|
||||
this->ok();
|
||||
});
|
||||
auto *button_cancel = buttons->addButton(QDialogButtonBox::Cancel);
|
||||
QObject::connect(button_cancel, &QAbstractButton::clicked,
|
||||
[=](bool) { this->close(); });
|
||||
QObject::connect(button_cancel, &QAbstractButton::clicked, [=](bool) {
|
||||
this->close();
|
||||
});
|
||||
}
|
||||
|
||||
this->setMinimumSize(300, 310);
|
||||
@@ -217,10 +222,10 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
|
||||
|
||||
// Shortcuts
|
||||
createWindowShortcut(this, "Return", [=] {
|
||||
this->ok(); //
|
||||
this->ok();
|
||||
});
|
||||
createWindowShortcut(this, "Esc", [=] {
|
||||
this->close(); //
|
||||
this->close();
|
||||
});
|
||||
|
||||
// restore ui state
|
||||
@@ -229,10 +234,10 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
|
||||
{
|
||||
this->ui_.notebook->selectIndex(getSettings()->lastSelectChannelTab);
|
||||
createWindowShortcut(this, "Ctrl+Tab", [=] {
|
||||
this->ui_.notebook->selectNextTab(); //
|
||||
this->ui_.notebook->selectNextTab();
|
||||
});
|
||||
createWindowShortcut(this, "CTRL+Shift+Tab", [=] {
|
||||
this->ui_.notebook->selectPreviousTab(); //
|
||||
this->ui_.notebook->selectPreviousTab();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -35,9 +35,10 @@ UpdateDialog::UpdateDialog()
|
||||
});
|
||||
|
||||
this->updateStatusChanged(Updates::instance().getStatus());
|
||||
this->connections_.managedConnect(
|
||||
Updates::instance().statusUpdated,
|
||||
[this](auto status) { this->updateStatusChanged(status); });
|
||||
this->connections_.managedConnect(Updates::instance().statusUpdated,
|
||||
[this](auto status) {
|
||||
this->updateStatusChanged(status);
|
||||
});
|
||||
|
||||
this->setScaleIndependantHeight(150);
|
||||
this->setScaleIndependantWidth(500);
|
||||
|
||||
@@ -131,7 +131,9 @@ UserInfoPopup::UserInfoPopup(bool closeAutomatically, QWidget *parent)
|
||||
this->setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
// Close the popup when Escape is pressed
|
||||
createWindowShortcut(this, "Escape", [this] { this->deleteLater(); });
|
||||
createWindowShortcut(this, "Escape", [this] {
|
||||
this->deleteLater();
|
||||
});
|
||||
|
||||
auto layout = LayoutCreator<QWidget>(this->getLayoutContainer())
|
||||
.setLayoutType<QVBoxLayout>();
|
||||
@@ -213,8 +215,9 @@ UserInfoPopup::UserInfoPopup(bool closeAutomatically, QWidget *parent)
|
||||
"/viewercard/" + this->userName_);
|
||||
});
|
||||
|
||||
QObject::connect(refresh.getElement(), &Button::leftClicked,
|
||||
[this] { this->updateLatestMessages(); });
|
||||
QObject::connect(refresh.getElement(), &Button::leftClicked, [this] {
|
||||
this->updateLatestMessages();
|
||||
});
|
||||
QObject::connect(mod.getElement(), &Button::leftClicked, [this] {
|
||||
this->channel_->sendMessage("/mod " + this->userName_);
|
||||
});
|
||||
@@ -367,7 +370,7 @@ void UserInfoPopup::installEvents()
|
||||
auto currentUser = getApp()->accounts->twitch.getCurrent();
|
||||
|
||||
const auto reenableFollowCheckbox = [this] {
|
||||
this->ui_.follow->setEnabled(true); //
|
||||
this->ui_.follow->setEnabled(true);
|
||||
};
|
||||
|
||||
if (!this->ui_.follow->isEnabled())
|
||||
@@ -502,7 +505,9 @@ void UserInfoPopup::setData(const QString &name, const ChannelPtr &channel)
|
||||
this->userStateChanged_.invoke();
|
||||
|
||||
this->updateLatestMessages();
|
||||
QTimer::singleShot(1, this, [this] { this->setStayInScreenRect(true); });
|
||||
QTimer::singleShot(1, this, [this] {
|
||||
this->setStayInScreenRect(true);
|
||||
});
|
||||
}
|
||||
|
||||
void UserInfoPopup::updateLatestMessages()
|
||||
@@ -825,9 +830,10 @@ UserInfoPopup::TimeoutWidget::TimeoutWidget()
|
||||
const auto pair =
|
||||
std::make_pair(Action::Timeout, calculateTimeoutDuration(item));
|
||||
|
||||
QObject::connect(
|
||||
a.getElement(), &EffectLabel2::leftClicked,
|
||||
[this, pair] { this->buttonClicked.invoke(pair); });
|
||||
QObject::connect(a.getElement(), &EffectLabel2::leftClicked,
|
||||
[this, pair] {
|
||||
this->buttonClicked.invoke(pair);
|
||||
});
|
||||
|
||||
//auto addTimeouts = [&](const QString &title_,
|
||||
// const std::vector<std::pair<QString, int>> &items) {
|
||||
|
||||
@@ -72,8 +72,9 @@ void QuickSwitcherPopup::initWidgets()
|
||||
listView->setModel(&this->switcherModel_);
|
||||
|
||||
QObject::connect(listView.getElement(),
|
||||
&GenericListView::closeRequested, this,
|
||||
[this] { this->close(); });
|
||||
&GenericListView::closeRequested, this, [this] {
|
||||
this->close();
|
||||
});
|
||||
|
||||
this->ui_.searchEdit->installEventFilter(listView.getElement());
|
||||
}
|
||||
@@ -128,7 +129,9 @@ void QuickSwitcherPopup::updateSuggestions(const QString &text)
|
||||
* Timeout interval 0 means the call will be delayed until all window events
|
||||
* have been processed (cf. https://doc.qt.io/qt-5/qtimer.html#interval-prop).
|
||||
*/
|
||||
QTimer::singleShot(0, [this] { this->adjustSize(); });
|
||||
QTimer::singleShot(0, [this] {
|
||||
this->adjustSize();
|
||||
});
|
||||
}
|
||||
|
||||
void QuickSwitcherPopup::themeChangedEvent()
|
||||
|
||||
Reference in New Issue
Block a user