Chore: Proper Lambda Formatting (#2167)
Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -8,9 +8,11 @@ std::vector<ClosedSplits::SplitInfo> ClosedSplits::closedSplits_;
|
||||
void ClosedSplits::invalidateTab(NotebookTab *const tab)
|
||||
{
|
||||
std::lock_guard<std::mutex> lk(ClosedSplits::m_);
|
||||
auto it = std::find_if(
|
||||
ClosedSplits::closedSplits_.begin(), ClosedSplits::closedSplits_.end(),
|
||||
[tab](const auto &item) -> bool { return item.tab == tab; });
|
||||
auto it = std::find_if(ClosedSplits::closedSplits_.begin(),
|
||||
ClosedSplits::closedSplits_.end(),
|
||||
[tab](const auto &item) -> bool {
|
||||
return item.tab == tab;
|
||||
});
|
||||
if (it == ClosedSplits::closedSplits_.end())
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -66,7 +66,9 @@ void EmoteInputPopup::initLayout()
|
||||
|
||||
listView->setModel(&this->model_);
|
||||
QObject::connect(listView.getElement(), &GenericListView::closeRequested,
|
||||
this, [this] { this->close(); });
|
||||
this, [this] {
|
||||
this->close();
|
||||
});
|
||||
}
|
||||
|
||||
void EmoteInputPopup::updateEmotes(const QString &text, ChannelPtr channel)
|
||||
|
||||
@@ -134,11 +134,12 @@ Split::Split(QWidget *parent)
|
||||
this->input_->ui_.textEdit->installEventFilter(parent);
|
||||
|
||||
this->signalHolder_.managedConnect(
|
||||
getApp()->accounts->twitch.currentUserChanged,
|
||||
[this] { this->onAccountSelected(); });
|
||||
getApp()->accounts->twitch.currentUserChanged, [this] {
|
||||
this->onAccountSelected();
|
||||
});
|
||||
this->onAccountSelected();
|
||||
|
||||
this->view_->mouseDown.connect([this](QMouseEvent *) { //
|
||||
this->view_->mouseDown.connect([this](QMouseEvent *) {
|
||||
this->giveFocus(Qt::MouseFocusReason);
|
||||
});
|
||||
this->view_->selectionChanged.connect([this]() {
|
||||
@@ -212,10 +213,12 @@ Split::Split(QWidget *parent)
|
||||
}
|
||||
});
|
||||
|
||||
this->input_->ui_.textEdit->focused.connect(
|
||||
[this] { this->focused.invoke(); });
|
||||
this->input_->ui_.textEdit->focusLost.connect(
|
||||
[this] { this->focusLost.invoke(); });
|
||||
this->input_->ui_.textEdit->focused.connect([this] {
|
||||
this->focused.invoke();
|
||||
});
|
||||
this->input_->ui_.textEdit->focusLost.connect([this] {
|
||||
this->focusLost.invoke();
|
||||
});
|
||||
this->input_->ui_.textEdit->imagePasted.connect(
|
||||
[this](const QMimeData *source) {
|
||||
if (!getSettings()->imageUploaderEnabled)
|
||||
@@ -249,7 +252,9 @@ Split::Split(QWidget *parent)
|
||||
});
|
||||
|
||||
getSettings()->imageUploaderEnabled.connect(
|
||||
[this](const bool &val) { this->setAcceptDrops(val); },
|
||||
[this](const bool &val) {
|
||||
this->setAcceptDrops(val);
|
||||
},
|
||||
this->managedConnections_);
|
||||
}
|
||||
|
||||
@@ -306,7 +311,7 @@ void Split::onAccountSelected()
|
||||
|
||||
this->updateTooltipColor();
|
||||
this->signalHolder_.managedConnect(this->theme->updated, [this]() {
|
||||
this->updateTooltipColor(); //
|
||||
this->updateTooltipColor();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -347,13 +352,16 @@ void Split::setChannel(IndirectChannel newChannel)
|
||||
this->header_->updateRoomModes();
|
||||
});
|
||||
|
||||
this->roomModeChangedConnection_ = tc->roomModesChanged.connect(
|
||||
[this] { this->header_->updateRoomModes(); });
|
||||
this->roomModeChangedConnection_ = tc->roomModesChanged.connect([this] {
|
||||
this->header_->updateRoomModes();
|
||||
});
|
||||
}
|
||||
|
||||
this->indirectChannelChangedConnection_ =
|
||||
newChannel.getChannelChanged().connect([this] { //
|
||||
QTimer::singleShot(0, [this] { this->setChannel(this->channel_); });
|
||||
newChannel.getChannelChanged().connect([this] {
|
||||
QTimer::singleShot(0, [this] {
|
||||
this->setChannel(this->channel_);
|
||||
});
|
||||
});
|
||||
|
||||
this->header_->updateModerationModeIcon();
|
||||
@@ -544,8 +552,9 @@ void Split::deleteFromContainer()
|
||||
{
|
||||
this->container_->deleteSplit(this);
|
||||
auto *tab = this->getContainer()->getTab();
|
||||
tab->connect(tab, &QWidget::destroyed,
|
||||
[tab]() mutable { ClosedSplits::invalidateTab(tab); });
|
||||
tab->connect(tab, &QWidget::destroyed, [tab]() mutable {
|
||||
ClosedSplits::invalidateTab(tab);
|
||||
});
|
||||
ClosedSplits::push({this->getChannel()->getName(), tab});
|
||||
}
|
||||
}
|
||||
@@ -747,8 +756,9 @@ void Split::showViewerList()
|
||||
}
|
||||
});
|
||||
|
||||
QObject::connect(viewerDock, &QDockWidget::topLevelChanged, this,
|
||||
[=]() { viewerDock->setMinimumWidth(300); });
|
||||
QObject::connect(viewerDock, &QDockWidget::topLevelChanged, this, [=]() {
|
||||
viewerDock->setMinimumWidth(300);
|
||||
});
|
||||
|
||||
auto listDoubleClick = [=](QString userName) {
|
||||
if (!labels.contains(userName) && !userName.isEmpty())
|
||||
|
||||
@@ -220,10 +220,12 @@ void SplitContainer::addSplit(Split *split)
|
||||
});
|
||||
|
||||
split->getChannelView().liveStatusChanged.connect([this]() {
|
||||
this->refreshTabLiveStatus(); //
|
||||
this->refreshTabLiveStatus();
|
||||
});
|
||||
|
||||
split->focused.connect([this, split] { this->setSelected(split); });
|
||||
split->focused.connect([this, split] {
|
||||
this->setSelected(split);
|
||||
});
|
||||
|
||||
this->layout();
|
||||
}
|
||||
@@ -318,9 +320,10 @@ void SplitContainer::selectSplitRecursive(Node *node, Direction direction)
|
||||
{
|
||||
auto &siblings = node->parent_->children_;
|
||||
|
||||
auto it = std::find_if(
|
||||
siblings.begin(), siblings.end(),
|
||||
[node](const auto &other) { return other.get() == node; });
|
||||
auto it = std::find_if(siblings.begin(), siblings.end(),
|
||||
[node](const auto &other) {
|
||||
return other.get() == node;
|
||||
});
|
||||
assert(it != siblings.end());
|
||||
|
||||
if (direction == Direction::Left || direction == Direction::Above)
|
||||
@@ -993,8 +996,10 @@ void SplitContainer::Node::insertNextToThis(Split *_split, Direction _direction)
|
||||
this->geometry_ = QRect(0, 0, int(width), int(height));
|
||||
}
|
||||
|
||||
auto it = std::find_if(siblings.begin(), siblings.end(),
|
||||
[this](auto &node) { return this == node.get(); });
|
||||
auto it =
|
||||
std::find_if(siblings.begin(), siblings.end(), [this](auto &node) {
|
||||
return this == node.get();
|
||||
});
|
||||
|
||||
assert(it != siblings.end());
|
||||
if (_direction == Direction::Right || _direction == Direction::Below)
|
||||
@@ -1035,8 +1040,9 @@ SplitContainer::Position SplitContainer::Node::releaseSplit()
|
||||
auto &siblings = this->parent_->children_;
|
||||
|
||||
auto it =
|
||||
std::find_if(begin(siblings), end(siblings),
|
||||
[this](auto &node) { return this == node.get(); });
|
||||
std::find_if(begin(siblings), end(siblings), [this](auto &node) {
|
||||
return this == node.get();
|
||||
});
|
||||
assert(it != siblings.end());
|
||||
|
||||
Position position;
|
||||
|
||||
@@ -191,15 +191,23 @@ SplitHeader::SplitHeader(Split *_split)
|
||||
this->handleChannelChanged();
|
||||
this->updateModerationModeIcon();
|
||||
|
||||
this->split_->focused.connect([this]() { this->themeChangedEvent(); });
|
||||
this->split_->focusLost.connect([this]() { this->themeChangedEvent(); });
|
||||
this->split_->channelChanged.connect(
|
||||
[this]() { this->handleChannelChanged(); });
|
||||
this->split_->focused.connect([this]() {
|
||||
this->themeChangedEvent();
|
||||
});
|
||||
this->split_->focusLost.connect([this]() {
|
||||
this->themeChangedEvent();
|
||||
});
|
||||
this->split_->channelChanged.connect([this]() {
|
||||
this->handleChannelChanged();
|
||||
});
|
||||
|
||||
this->managedConnect(getApp()->accounts->twitch.currentUserChanged,
|
||||
[this] { this->updateModerationModeIcon(); });
|
||||
this->managedConnect(getApp()->accounts->twitch.currentUserChanged, [this] {
|
||||
this->updateModerationModeIcon();
|
||||
});
|
||||
|
||||
auto _ = [this](const auto &, const auto &) { this->updateChannelText(); };
|
||||
auto _ = [this](const auto &, const auto &) {
|
||||
this->updateChannelText();
|
||||
};
|
||||
getSettings()->headerViewerCount.connect(_, this->managedConnections_);
|
||||
getSettings()->headerStreamTitle.connect(_, this->managedConnections_);
|
||||
getSettings()->headerGame.connect(_, this->managedConnections_);
|
||||
@@ -210,8 +218,9 @@ void SplitHeader::initializeLayout()
|
||||
{
|
||||
auto layout = makeLayout<QHBoxLayout>({
|
||||
// space
|
||||
makeWidget<BaseWidget>(
|
||||
[](auto w) { w->setScaleIndependantSize(8, 4); }),
|
||||
makeWidget<BaseWidget>([](auto w) {
|
||||
w->setScaleIndependantSize(8, 4);
|
||||
}),
|
||||
// title
|
||||
this->titleLabel_ = makeWidget<Label>([](auto w) {
|
||||
w->setSizePolicy(QSizePolicy::MinimumExpanding,
|
||||
@@ -220,8 +229,9 @@ void SplitHeader::initializeLayout()
|
||||
w->setHasOffset(false);
|
||||
}),
|
||||
// space
|
||||
makeWidget<BaseWidget>(
|
||||
[](auto w) { w->setScaleIndependantSize(8, 4); }),
|
||||
makeWidget<BaseWidget>([](auto w) {
|
||||
w->setScaleIndependantSize(8, 4);
|
||||
}),
|
||||
// mode
|
||||
this->modeButton_ = makeWidget<EffectLabel>([&](auto w) {
|
||||
w->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
|
||||
@@ -266,8 +276,9 @@ void SplitHeader::initializeLayout()
|
||||
}),
|
||||
// viewer list
|
||||
this->viewersButton_ = makeWidget<Button>([&](auto w) {
|
||||
QObject::connect(w, &Button::leftClicked, this,
|
||||
[this]() { this->split_->showViewerList(); });
|
||||
QObject::connect(w, &Button::leftClicked, this, [this]() {
|
||||
this->split_->showViewerList();
|
||||
});
|
||||
}),
|
||||
// dropdown
|
||||
this->dropdownButton_ = makeWidget<Button>([&](auto w) {
|
||||
@@ -281,8 +292,9 @@ void SplitHeader::initializeLayout()
|
||||
w->setPixmap(getResources().buttons.addSplitDark);
|
||||
w->setEnableMargin(false);
|
||||
|
||||
QObject::connect(w, &Button::leftClicked, this,
|
||||
[this]() { this->split_->addSibling(); });
|
||||
QObject::connect(w, &Button::leftClicked, this, [this]() {
|
||||
this->split_->addSibling();
|
||||
});
|
||||
}),
|
||||
});
|
||||
|
||||
@@ -476,7 +488,7 @@ std::unique_ptr<QMenu> SplitHeader::createChatModeMenu()
|
||||
menu->addAction(setR9k);
|
||||
menu->addAction(setFollowers);
|
||||
|
||||
this->managedConnections_.push_back(this->modeUpdateRequested_.connect( //
|
||||
this->managedConnections_.push_back(this->modeUpdateRequested_.connect(
|
||||
[this, setSub, setEmote, setSlow, setR9k, setFollowers]() {
|
||||
auto twitchChannel =
|
||||
dynamic_cast<TwitchChannel *>(this->split_->getChannel().get());
|
||||
@@ -501,13 +513,15 @@ std::unique_ptr<QMenu> SplitHeader::createChatModeMenu()
|
||||
action->setChecked(!action->isChecked());
|
||||
};
|
||||
|
||||
QObject::connect(
|
||||
setSub, &QAction::triggered, this,
|
||||
[setSub, toggle]() mutable { toggle("/subscribers", setSub); });
|
||||
QObject::connect(setSub, &QAction::triggered, this,
|
||||
[setSub, toggle]() mutable {
|
||||
toggle("/subscribers", setSub);
|
||||
});
|
||||
|
||||
QObject::connect(
|
||||
setEmote, &QAction::triggered, this,
|
||||
[setEmote, toggle]() mutable { toggle("/emoteonly", setEmote); });
|
||||
QObject::connect(setEmote, &QAction::triggered, this,
|
||||
[setEmote, toggle]() mutable {
|
||||
toggle("/emoteonly", setEmote);
|
||||
});
|
||||
|
||||
QObject::connect(setSlow, &QAction::triggered, this, [setSlow, this]() {
|
||||
if (!setSlow->isChecked())
|
||||
@@ -554,9 +568,10 @@ std::unique_ptr<QMenu> SplitHeader::createChatModeMenu()
|
||||
}
|
||||
});
|
||||
|
||||
QObject::connect(
|
||||
setR9k, &QAction::triggered, this,
|
||||
[setR9k, toggle]() mutable { toggle("/r9kbeta", setR9k); });
|
||||
QObject::connect(setR9k, &QAction::triggered, this,
|
||||
[setR9k, toggle]() mutable {
|
||||
toggle("/r9kbeta", setR9k);
|
||||
});
|
||||
|
||||
return menu;
|
||||
}
|
||||
@@ -569,8 +584,8 @@ void SplitHeader::updateRoomModes()
|
||||
void SplitHeader::initializeModeSignals(EffectLabel &label)
|
||||
{
|
||||
this->modeUpdateRequested_.connect([this, &label] {
|
||||
if (auto twitchChannel = dynamic_cast<TwitchChannel *>(
|
||||
this->split_->getChannel().get())) //
|
||||
if (auto twitchChannel =
|
||||
dynamic_cast<TwitchChannel *>(this->split_->getChannel().get()))
|
||||
{
|
||||
label.setEnable(twitchChannel->hasModRights());
|
||||
|
||||
@@ -608,7 +623,7 @@ void SplitHeader::handleChannelChanged()
|
||||
{
|
||||
this->channelConnections_.emplace_back(
|
||||
twitchChannel->liveStatusChanged.connect([this]() {
|
||||
this->updateChannelText(); //
|
||||
this->updateChannelText();
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,9 @@ SplitInput::SplitInput(Split *_chatWidget)
|
||||
|
||||
// misc
|
||||
this->installKeyPressedEvent();
|
||||
this->ui_.textEdit->focusLost.connect([this] { this->hideColonMenu(); });
|
||||
this->ui_.textEdit->focusLost.connect([this] {
|
||||
this->hideColonMenu();
|
||||
});
|
||||
this->scaleChangedEvent(this->scale());
|
||||
}
|
||||
|
||||
@@ -90,8 +92,9 @@ void SplitInput::initLayout()
|
||||
}));
|
||||
|
||||
// open emote popup
|
||||
QObject::connect(this->ui_.emoteButton, &EffectLabel::leftClicked,
|
||||
[=] { this->openEmotePopup(); });
|
||||
QObject::connect(this->ui_.emoteButton, &EffectLabel::leftClicked, [=] {
|
||||
this->openEmotePopup();
|
||||
});
|
||||
|
||||
// clear channelview selection when selecting in the input
|
||||
QObject::connect(this->ui_.textEdit, &QTextEdit::copyAvailable,
|
||||
@@ -599,7 +602,7 @@ void SplitInput::editTextChanged()
|
||||
QString text = this->ui_.textEdit->toPlainText();
|
||||
|
||||
if (text.startsWith("/r ", Qt::CaseInsensitive) &&
|
||||
this->split_->getChannel()->isTwitchChannel()) //
|
||||
this->split_->getChannel()->isTwitchChannel())
|
||||
{
|
||||
QString lastUser = app->twitch.server->lastUserThatWhisperedMe.get();
|
||||
if (!lastUser.isEmpty())
|
||||
|
||||
Reference in New Issue
Block a user