Chore: Proper Lambda Formatting (#2167)
Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -31,8 +31,7 @@ AccountSwitchPopup::AccountSwitchPopup(QWidget *parent)
|
||||
vbox->addLayout(hbox);
|
||||
|
||||
connect(manageAccountsButton, &QPushButton::clicked, [this]() {
|
||||
SettingsDialog::showDialog(this,
|
||||
SettingsDialogPreference::Accounts); //
|
||||
SettingsDialog::showDialog(this, SettingsDialogPreference::Accounts);
|
||||
});
|
||||
|
||||
this->getLayoutContainer()->setLayout(vbox);
|
||||
|
||||
@@ -137,7 +137,9 @@ void BaseWidget::childEvent(QChildEvent *event)
|
||||
{
|
||||
// find element to be removed
|
||||
auto it = std::find_if(this->widgets_.begin(), this->widgets_.end(),
|
||||
[&](auto &&x) { return x == event->child(); });
|
||||
[&](auto &&x) {
|
||||
return x == event->child();
|
||||
});
|
||||
|
||||
// remove if found
|
||||
if (it != this->widgets_.end())
|
||||
|
||||
+25
-16
@@ -83,15 +83,17 @@ BaseWindow::BaseWindow(FlagsEnum<Flags> _flags, QWidget *parent)
|
||||
|
||||
this->updateScale();
|
||||
|
||||
createWindowShortcut(this, "CTRL+0",
|
||||
[] { getSettings()->uiScale.setValue(1); });
|
||||
createWindowShortcut(this, "CTRL+0", [] {
|
||||
getSettings()->uiScale.setValue(1);
|
||||
});
|
||||
|
||||
this->resize(300, 150);
|
||||
|
||||
#ifdef USEWINSDK
|
||||
this->useNextBounds_.setSingleShot(true);
|
||||
QObject::connect(&this->useNextBounds_, &QTimer::timeout, this,
|
||||
[this]() { this->currentBounds_ = this->nextBounds_; });
|
||||
QObject::connect(&this->useNextBounds_, &QTimer::timeout, this, [this]() {
|
||||
this->currentBounds_ = this->nextBounds_;
|
||||
});
|
||||
#endif
|
||||
|
||||
this->themeChangedEvent();
|
||||
@@ -154,9 +156,10 @@ void BaseWindow::init()
|
||||
|
||||
// title
|
||||
Label *title = new Label;
|
||||
QObject::connect(
|
||||
this, &QWidget::windowTitleChanged,
|
||||
[title](const QString &text) { title->setText(text); });
|
||||
QObject::connect(this, &QWidget::windowTitleChanged,
|
||||
[title](const QString &text) {
|
||||
title->setText(text);
|
||||
});
|
||||
|
||||
QSizePolicy policy(QSizePolicy::Ignored,
|
||||
QSizePolicy::Preferred);
|
||||
@@ -187,7 +190,9 @@ void BaseWindow::init()
|
||||
: Qt::WindowMaximized);
|
||||
});
|
||||
QObject::connect(_exitButton, &TitleBarButton::leftClicked,
|
||||
this, [this] { this->close(); });
|
||||
this, [this] {
|
||||
this->close();
|
||||
});
|
||||
|
||||
this->ui_.minButton = _minButton;
|
||||
this->ui_.maxButton = _maxButton;
|
||||
@@ -460,8 +465,9 @@ TitleBarButton *BaseWindow::addTitleBarButton(const TitleBarButtonStyle &style,
|
||||
this->ui_.titlebarBox->insertWidget(1, button);
|
||||
button->setButtonStyle(style);
|
||||
|
||||
QObject::connect(button, &TitleBarButton::leftClicked, this,
|
||||
[onClicked] { onClicked(); });
|
||||
QObject::connect(button, &TitleBarButton::leftClicked, this, [onClicked] {
|
||||
onClicked();
|
||||
});
|
||||
|
||||
return button;
|
||||
}
|
||||
@@ -474,8 +480,9 @@ EffectLabel *BaseWindow::addTitleBarLabel(std::function<void()> onClicked)
|
||||
this->ui_.buttons.push_back(button);
|
||||
this->ui_.titlebarBox->insertWidget(1, button);
|
||||
|
||||
QObject::connect(button, &EffectLabel::leftClicked, this,
|
||||
[onClicked] { onClicked(); });
|
||||
QObject::connect(button, &EffectLabel::leftClicked, this, [onClicked] {
|
||||
onClicked();
|
||||
});
|
||||
|
||||
return button;
|
||||
}
|
||||
@@ -550,8 +557,9 @@ void BaseWindow::resizeEvent(QResizeEvent *)
|
||||
::SetWindowPos((HWND)this->winId(), nullptr, 0, 0,
|
||||
rect.right - rect.left, rect.bottom - rect.top,
|
||||
SWP_NOMOVE | SWP_NOZORDER);
|
||||
QTimer::singleShot(10, this,
|
||||
[this] { this->isResizeFixing_ = false; });
|
||||
QTimer::singleShot(10, this, [this] {
|
||||
this->isResizeFixing_ = false;
|
||||
});
|
||||
});
|
||||
}
|
||||
#endif
|
||||
@@ -579,8 +587,9 @@ void BaseWindow::showEvent(QShowEvent *)
|
||||
this->moveIntoDesktopRect(this, this->pos());
|
||||
if (this->frameless_)
|
||||
{
|
||||
QTimer::singleShot(
|
||||
30, this, [this] { this->moveIntoDesktopRect(this, this->pos()); });
|
||||
QTimer::singleShot(30, this, [this] {
|
||||
this->moveIntoDesktopRect(this, this->pos());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,8 +14,9 @@ Label::Label(BaseWidget *parent, QString text, FontStyle style)
|
||||
, text_(text)
|
||||
, fontStyle_(style)
|
||||
{
|
||||
this->connections_.managedConnect(getFonts()->fontChanged,
|
||||
[this] { this->updateSize(); });
|
||||
this->connections_.managedConnect(getFonts()->fontChanged, [this] {
|
||||
this->updateSize();
|
||||
});
|
||||
}
|
||||
|
||||
const QString &Label::getText() const
|
||||
|
||||
@@ -181,14 +181,17 @@ void Notebook::select(QWidget *page)
|
||||
bool Notebook::containsPage(QWidget *page)
|
||||
{
|
||||
return std::any_of(this->items_.begin(), this->items_.end(),
|
||||
[page](const auto &item) { return item.page == page; });
|
||||
[page](const auto &item) {
|
||||
return item.page == page;
|
||||
});
|
||||
}
|
||||
|
||||
Notebook::Item &Notebook::findItem(QWidget *page)
|
||||
{
|
||||
auto it =
|
||||
std::find_if(this->items_.begin(), this->items_.end(),
|
||||
[page](const auto &item) { return page == item.page; });
|
||||
auto it = std::find_if(this->items_.begin(), this->items_.end(),
|
||||
[page](const auto &item) {
|
||||
return page == item.page;
|
||||
});
|
||||
assert(it != this->items_.end());
|
||||
return *it;
|
||||
}
|
||||
@@ -617,7 +620,9 @@ SplitNotebook::SplitNotebook(Window *parent)
|
||||
: Notebook(parent)
|
||||
{
|
||||
this->connect(this->getAddButton(), &NotebookButton::leftClicked, [this]() {
|
||||
QTimer::singleShot(80, this, [this] { this->addPage(true); });
|
||||
QTimer::singleShot(80, this, [this] {
|
||||
this->addPage(true);
|
||||
});
|
||||
});
|
||||
|
||||
// add custom buttons if they are not in the parent window frame
|
||||
@@ -646,19 +651,24 @@ void SplitNotebook::addCustomButtons()
|
||||
settingsBtn->setVisible(!getSettings()->hidePreferencesButton.getValue());
|
||||
|
||||
getSettings()->hidePreferencesButton.connect(
|
||||
[settingsBtn](bool hide, auto) { settingsBtn->setVisible(!hide); },
|
||||
[settingsBtn](bool hide, auto) {
|
||||
settingsBtn->setVisible(!hide);
|
||||
},
|
||||
this->connections_);
|
||||
|
||||
settingsBtn->setIcon(NotebookButton::Settings);
|
||||
|
||||
QObject::connect(settingsBtn, &NotebookButton::leftClicked,
|
||||
[this] { getApp()->windows->showSettingsDialog(this); });
|
||||
QObject::connect(settingsBtn, &NotebookButton::leftClicked, [this] {
|
||||
getApp()->windows->showSettingsDialog(this);
|
||||
});
|
||||
|
||||
// account
|
||||
auto userBtn = this->addCustomButton();
|
||||
userBtn->setVisible(!getSettings()->hideUserButton.getValue());
|
||||
getSettings()->hideUserButton.connect(
|
||||
[userBtn](bool hide, auto) { userBtn->setVisible(!hide); },
|
||||
[userBtn](bool hide, auto) {
|
||||
userBtn->setVisible(!hide);
|
||||
},
|
||||
this->connections_);
|
||||
|
||||
userBtn->setIcon(NotebookButton::User);
|
||||
|
||||
@@ -43,8 +43,9 @@ TooltipWidget::TooltipWidget(BaseWidget *parent)
|
||||
layout->addWidget(displayText_);
|
||||
this->setLayout(layout);
|
||||
|
||||
this->fontChangedConnection_ =
|
||||
getFonts()->fontChanged.connect([this] { this->updateFont(); });
|
||||
this->fontChangedConnection_ = getFonts()->fontChanged.connect([this] {
|
||||
this->updateFont();
|
||||
});
|
||||
}
|
||||
|
||||
TooltipWidget::~TooltipWidget()
|
||||
|
||||
+30
-20
@@ -58,8 +58,9 @@ Window::Window(WindowType type)
|
||||
#endif
|
||||
|
||||
this->signalHolder_.managedConnect(
|
||||
getApp()->accounts->twitch.currentUserChanged,
|
||||
[this] { this->onAccountSelected(); });
|
||||
getApp()->accounts->twitch.currentUserChanged, [this] {
|
||||
this->onAccountSelected();
|
||||
});
|
||||
this->onAccountSelected();
|
||||
|
||||
if (type == WindowType::Main)
|
||||
@@ -159,7 +160,7 @@ void Window::addCustomTitlebarButtons()
|
||||
|
||||
// settings
|
||||
this->addTitleBarButton(TitleBarButtonStyle::Settings, [this] {
|
||||
getApp()->windows->showSettingsDialog(this); //
|
||||
getApp()->windows->showSettingsDialog(this);
|
||||
});
|
||||
|
||||
// updates
|
||||
@@ -293,7 +294,7 @@ void Window::addShortcuts()
|
||||
/// Initialize program-wide hotkeys
|
||||
// Open settings
|
||||
createWindowShortcut(this, "CTRL+P", [this] {
|
||||
SettingsDialog::showDialog(this); //
|
||||
SettingsDialog::showDialog(this);
|
||||
});
|
||||
|
||||
// Switch tab
|
||||
@@ -306,17 +307,22 @@ void Window::addShortcuts()
|
||||
{
|
||||
char hotkey[7];
|
||||
std::sprintf(hotkey, "CTRL+%d", i + 1);
|
||||
const auto openTab = [this, i] { this->notebook_->selectIndex(i); };
|
||||
const auto openTab = [this, i] {
|
||||
this->notebook_->selectIndex(i);
|
||||
};
|
||||
createWindowShortcut(this, hotkey, openTab);
|
||||
}
|
||||
|
||||
createWindowShortcut(this, "CTRL+9",
|
||||
[this] { this->notebook_->selectLastTab(); });
|
||||
createWindowShortcut(this, "CTRL+9", [this] {
|
||||
this->notebook_->selectLastTab();
|
||||
});
|
||||
|
||||
createWindowShortcut(this, "CTRL+TAB",
|
||||
[this] { this->notebook_->selectNextTab(); });
|
||||
createWindowShortcut(this, "CTRL+SHIFT+TAB",
|
||||
[this] { this->notebook_->selectPreviousTab(); });
|
||||
createWindowShortcut(this, "CTRL+TAB", [this] {
|
||||
this->notebook_->selectNextTab();
|
||||
});
|
||||
createWindowShortcut(this, "CTRL+SHIFT+TAB", [this] {
|
||||
this->notebook_->selectPreviousTab();
|
||||
});
|
||||
|
||||
createWindowShortcut(this, "CTRL+N", [this] {
|
||||
if (auto page = dynamic_cast<SplitContainer *>(
|
||||
@@ -350,12 +356,14 @@ void Window::addShortcuts()
|
||||
}
|
||||
|
||||
// New tab
|
||||
createWindowShortcut(this, "CTRL+SHIFT+T",
|
||||
[this] { this->notebook_->addPage(true); });
|
||||
createWindowShortcut(this, "CTRL+SHIFT+T", [this] {
|
||||
this->notebook_->addPage(true);
|
||||
});
|
||||
|
||||
// Close tab
|
||||
createWindowShortcut(this, "CTRL+SHIFT+W",
|
||||
[this] { this->notebook_->removeCurrentPage(); });
|
||||
createWindowShortcut(this, "CTRL+SHIFT+W", [this] {
|
||||
this->notebook_->removeCurrentPage();
|
||||
});
|
||||
|
||||
// Reopen last closed split
|
||||
createWindowShortcut(this, "CTRL+G", [this] {
|
||||
@@ -402,7 +410,7 @@ void Window::addMenuBar()
|
||||
QAction *prefs = menu->addAction(QString());
|
||||
prefs->setMenuRole(QAction::PreferencesRole);
|
||||
connect(prefs, &QAction::triggered, this, [this] {
|
||||
SettingsDialog::showDialog(this); //
|
||||
SettingsDialog::showDialog(this);
|
||||
});
|
||||
|
||||
// Window menu.
|
||||
@@ -410,13 +418,15 @@ void Window::addMenuBar()
|
||||
|
||||
QAction *nextTab = windowMenu->addAction(QString("Select next tab"));
|
||||
nextTab->setShortcuts({QKeySequence("Meta+Tab")});
|
||||
connect(nextTab, &QAction::triggered, this,
|
||||
[=] { this->notebook_->selectNextTab(); });
|
||||
connect(nextTab, &QAction::triggered, this, [=] {
|
||||
this->notebook_->selectNextTab();
|
||||
});
|
||||
|
||||
QAction *prevTab = windowMenu->addAction(QString("Select previous tab"));
|
||||
prevTab->setShortcuts({QKeySequence("Meta+Shift+Tab")});
|
||||
connect(prevTab, &QAction::triggered, this,
|
||||
[=] { this->notebook_->selectPreviousTab(); });
|
||||
connect(prevTab, &QAction::triggered, this, [=] {
|
||||
this->notebook_->selectPreviousTab();
|
||||
});
|
||||
}
|
||||
|
||||
void Window::onAccountSelected()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -119,8 +119,9 @@ void Button::setMenu(std::unique_ptr<QMenu> menu)
|
||||
new FunctionEventFilter(this, [this](QObject *, QEvent *event) {
|
||||
if (event->type() == QEvent::Hide)
|
||||
{
|
||||
QTimer::singleShot(20, this,
|
||||
[this] { this->menuVisible_ = false; });
|
||||
QTimer::singleShot(20, this, [this] {
|
||||
this->menuVisible_ = false;
|
||||
});
|
||||
}
|
||||
return false;
|
||||
}));
|
||||
@@ -243,7 +244,9 @@ void Button::mousePressEvent(QMouseEvent *event)
|
||||
|
||||
if (this->menu_ && !this->menuVisible_)
|
||||
{
|
||||
QTimer::singleShot(80, this, [this] { this->showMenu(); });
|
||||
QTimer::singleShot(80, this, [this] {
|
||||
this->showMenu();
|
||||
});
|
||||
this->mouseDown_ = false;
|
||||
this->mouseOver_ = false;
|
||||
}
|
||||
|
||||
@@ -71,9 +71,10 @@ namespace {
|
||||
auto addImageLink = [&](const ImagePtr &image, char scale) {
|
||||
if (!image->isEmpty())
|
||||
{
|
||||
copyMenu->addAction(
|
||||
QString(scale) + "x link",
|
||||
[url = image->url()] { crossPlatformCopy(url.string); });
|
||||
copyMenu->addAction(QString(scale) + "x link",
|
||||
[url = image->url()] {
|
||||
crossPlatformCopy(url.string);
|
||||
});
|
||||
openMenu->addAction(
|
||||
QString(scale) + "x link", [url = image->url()] {
|
||||
QDesktopServices::openUrl(QUrl(url.string));
|
||||
@@ -90,13 +91,14 @@ namespace {
|
||||
copyMenu->addSeparator();
|
||||
openMenu->addSeparator();
|
||||
|
||||
copyMenu->addAction(
|
||||
"Copy " + name + " emote link",
|
||||
[url = emote.homePage] { crossPlatformCopy(url.string); });
|
||||
openMenu->addAction(
|
||||
"Open " + name + " emote link", [url = emote.homePage] {
|
||||
QDesktopServices::openUrl(QUrl(url.string)); //
|
||||
});
|
||||
copyMenu->addAction("Copy " + name + " emote link",
|
||||
[url = emote.homePage] {
|
||||
crossPlatformCopy(url.string);
|
||||
});
|
||||
openMenu->addAction("Open " + name + " emote link",
|
||||
[url = emote.homePage] {
|
||||
QDesktopServices::openUrl(QUrl(url.string));
|
||||
});
|
||||
};
|
||||
|
||||
if (creatorFlags.has(MessageElementFlag::BttvEmote))
|
||||
@@ -134,8 +136,9 @@ ChannelView::ChannelView(BaseWidget *parent)
|
||||
});
|
||||
|
||||
auto shortcut = new QShortcut(QKeySequence::StandardKey::Copy, this);
|
||||
QObject::connect(shortcut, &QShortcut::activated,
|
||||
[this] { crossPlatformCopy(this->getSelectedText()); });
|
||||
QObject::connect(shortcut, &QShortcut::activated, [this] {
|
||||
crossPlatformCopy(this->getSelectedText());
|
||||
});
|
||||
|
||||
this->clickTimer_ = new QTimer(this);
|
||||
this->clickTimer_->setSingleShot(true);
|
||||
@@ -181,10 +184,14 @@ void ChannelView::initializeSignals()
|
||||
}));
|
||||
|
||||
getSettings()->showLastMessageIndicator.connect(
|
||||
[this](auto, auto) { this->update(); }, this->connections_);
|
||||
[this](auto, auto) {
|
||||
this->update();
|
||||
},
|
||||
this->connections_);
|
||||
|
||||
connections_.push_back(getApp()->windows->gifRepaintRequested.connect(
|
||||
[&] { this->queueUpdate(); }));
|
||||
connections_.push_back(getApp()->windows->gifRepaintRequested.connect([&] {
|
||||
this->queueUpdate();
|
||||
}));
|
||||
|
||||
connections_.push_back(
|
||||
getApp()->windows->layoutRequested.connect([&](Channel *channel) {
|
||||
@@ -195,8 +202,9 @@ void ChannelView::initializeSignals()
|
||||
}
|
||||
}));
|
||||
|
||||
connections_.push_back(
|
||||
getApp()->fonts->fontChanged.connect([this] { this->queueLayout(); }));
|
||||
connections_.push_back(getApp()->fonts->fontChanged.connect([this] {
|
||||
this->queueLayout();
|
||||
}));
|
||||
}
|
||||
|
||||
bool ChannelView::pausable() const
|
||||
@@ -272,7 +280,9 @@ void ChannelView::updatePauses()
|
||||
this->queueLayout();
|
||||
}
|
||||
else if (std::any_of(this->pauses_.begin(), this->pauses_.end(),
|
||||
[](auto &&value) { return !value.second; }))
|
||||
[](auto &&value) {
|
||||
return !value.second;
|
||||
}))
|
||||
{
|
||||
/// Some of the pauses are infinite
|
||||
this->pauseEnd_ = boost::none;
|
||||
@@ -282,9 +292,10 @@ void ChannelView::updatePauses()
|
||||
{
|
||||
/// Get the maximum pause
|
||||
auto pauseEnd =
|
||||
std::max_element(
|
||||
this->pauses_.begin(), this->pauses_.end(),
|
||||
[](auto &&a, auto &&b) { return a.second > b.second; })
|
||||
std::max_element(this->pauses_.begin(), this->pauses_.end(),
|
||||
[](auto &&a, auto &&b) {
|
||||
return a.second > b.second;
|
||||
})
|
||||
->second.get();
|
||||
|
||||
if (pauseEnd != this->pauseEnd_)
|
||||
@@ -605,11 +616,11 @@ void ChannelView::setChannel(ChannelPtr underlyingChannel)
|
||||
underlyingChannel->messagesAddedAtStart.connect(
|
||||
[this](std::vector<MessagePtr> &messages) {
|
||||
std::vector<MessagePtr> filtered;
|
||||
std::copy_if( //
|
||||
messages.begin(), messages.end(),
|
||||
std::back_inserter(filtered), [this](MessagePtr msg) {
|
||||
return this->shouldIncludeMessage(msg);
|
||||
});
|
||||
std::copy_if(messages.begin(), messages.end(),
|
||||
std::back_inserter(filtered),
|
||||
[this](MessagePtr msg) {
|
||||
return this->shouldIncludeMessage(msg);
|
||||
});
|
||||
|
||||
if (!filtered.empty())
|
||||
this->channel_->addMessagesAtStart(filtered);
|
||||
@@ -689,7 +700,7 @@ void ChannelView::setChannel(ChannelPtr underlyingChannel)
|
||||
if (auto tc = dynamic_cast<TwitchChannel *>(underlyingChannel.get()))
|
||||
{
|
||||
this->connections_.push_back(tc->liveStatusChanged.connect([this]() {
|
||||
this->liveStatusChanged.invoke(); //
|
||||
this->liveStatusChanged.invoke();
|
||||
}));
|
||||
}
|
||||
}
|
||||
@@ -1813,15 +1824,19 @@ void ChannelView::addContextMenuItems(
|
||||
QString url = hoveredElement->getLink().value;
|
||||
|
||||
// open link
|
||||
menu->addAction("Open link",
|
||||
[url] { QDesktopServices::openUrl(QUrl(url)); });
|
||||
menu->addAction("Open link", [url] {
|
||||
QDesktopServices::openUrl(QUrl(url));
|
||||
});
|
||||
// open link default
|
||||
if (supportsIncognitoLinks())
|
||||
{
|
||||
menu->addAction("Open link incognito",
|
||||
[url] { openLinkIncognito(url); });
|
||||
menu->addAction("Open link incognito", [url] {
|
||||
openLinkIncognito(url);
|
||||
});
|
||||
}
|
||||
menu->addAction("Copy link", [url] { crossPlatformCopy(url); });
|
||||
menu->addAction("Copy link", [url] {
|
||||
crossPlatformCopy(url);
|
||||
});
|
||||
|
||||
menu->addSeparator();
|
||||
}
|
||||
@@ -1829,8 +1844,9 @@ void ChannelView::addContextMenuItems(
|
||||
// Copy actions
|
||||
if (!this->selection_.isEmpty())
|
||||
{
|
||||
menu->addAction("Copy selection",
|
||||
[this] { crossPlatformCopy(this->getSelectedText()); });
|
||||
menu->addAction("Copy selection", [this] {
|
||||
crossPlatformCopy(this->getSelectedText());
|
||||
});
|
||||
}
|
||||
|
||||
menu->addAction("Copy message", [layout] {
|
||||
|
||||
@@ -16,8 +16,9 @@ DebugPopup::DebugPopup()
|
||||
auto *timer = new QTimer(this);
|
||||
|
||||
timer->setInterval(300);
|
||||
QObject::connect(timer, &QTimer::timeout,
|
||||
[text] { text->setText(DebugCount::getDebugText()); });
|
||||
QObject::connect(timer, &QTimer::timeout, [text] {
|
||||
text->setText(DebugCount::getDebugText());
|
||||
});
|
||||
timer->start();
|
||||
|
||||
text->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
|
||||
|
||||
@@ -36,8 +36,9 @@ EditableModelView::EditableModelView(QAbstractTableModel *model, bool movable)
|
||||
// add
|
||||
QPushButton *add = new QPushButton("Add");
|
||||
buttons->addWidget(add);
|
||||
QObject::connect(add, &QPushButton::clicked,
|
||||
[this] { this->addButtonPressed.invoke(); });
|
||||
QObject::connect(add, &QPushButton::clicked, [this] {
|
||||
this->addButtonPressed.invoke();
|
||||
});
|
||||
|
||||
// remove
|
||||
QPushButton *remove = new QPushButton("Remove");
|
||||
@@ -61,22 +62,25 @@ EditableModelView::EditableModelView(QAbstractTableModel *model, bool movable)
|
||||
// move up
|
||||
QPushButton *moveUp = new QPushButton("Move up");
|
||||
buttons->addWidget(moveUp);
|
||||
QObject::connect(moveUp, &QPushButton::clicked, this,
|
||||
[this] { this->moveRow(-1); });
|
||||
QObject::connect(moveUp, &QPushButton::clicked, this, [this] {
|
||||
this->moveRow(-1);
|
||||
});
|
||||
|
||||
// move down
|
||||
QPushButton *moveDown = new QPushButton("Move down");
|
||||
buttons->addWidget(moveDown);
|
||||
QObject::connect(moveDown, &QPushButton::clicked, this,
|
||||
[this] { this->moveRow(1); });
|
||||
QObject::connect(moveDown, &QPushButton::clicked, this, [this] {
|
||||
this->moveRow(1);
|
||||
});
|
||||
}
|
||||
|
||||
buttons->addStretch();
|
||||
|
||||
QObject::connect(this->model_, &QAbstractTableModel::rowsMoved, this,
|
||||
[this](const QModelIndex &parent, int start, int end,
|
||||
const QModelIndex &destination,
|
||||
int row) { this->selectRow(row); });
|
||||
const QModelIndex &destination, int row) {
|
||||
this->selectRow(row);
|
||||
});
|
||||
|
||||
// add tableview
|
||||
vbox->addWidget(this->tableView_);
|
||||
|
||||
@@ -46,23 +46,30 @@ NotebookTab::NotebookTab(Notebook *notebook)
|
||||
getSettings()->showTabCloseButton.connectSimple(
|
||||
boost::bind(&NotebookTab::hideTabXChanged, this),
|
||||
this->managedConnections_);
|
||||
getSettings()->showTabLive.connect([this](auto, auto) { this->update(); },
|
||||
this->managedConnections_);
|
||||
getSettings()->showTabLive.connect(
|
||||
[this](auto, auto) {
|
||||
this->update();
|
||||
},
|
||||
this->managedConnections_);
|
||||
|
||||
this->setMouseTracking(true);
|
||||
|
||||
this->menu_.addAction("Rename", [this]() { this->showRenameDialog(); });
|
||||
this->menu_.addAction("Rename", [this]() {
|
||||
this->showRenameDialog();
|
||||
});
|
||||
|
||||
this->menu_.addAction("Close",
|
||||
[=]() { this->notebook_->removePage(this->page); });
|
||||
this->menu_.addAction("Close", [=]() {
|
||||
this->notebook_->removePage(this->page);
|
||||
});
|
||||
|
||||
highlightNewMessagesAction_ =
|
||||
new QAction("Enable highlights on new messages", &this->menu_);
|
||||
highlightNewMessagesAction_->setCheckable(true);
|
||||
highlightNewMessagesAction_->setChecked(highlightEnabled_);
|
||||
QObject::connect(
|
||||
highlightNewMessagesAction_, &QAction::triggered,
|
||||
[this](bool checked) { this->highlightEnabled_ = checked; });
|
||||
QObject::connect(highlightNewMessagesAction_, &QAction::triggered,
|
||||
[this](bool checked) {
|
||||
this->highlightEnabled_ = checked;
|
||||
});
|
||||
this->menu_.addAction(highlightNewMessagesAction_);
|
||||
}
|
||||
|
||||
@@ -559,7 +566,7 @@ void NotebookTab::dragEnterEvent(QDragEnterEvent *event)
|
||||
void NotebookTab::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
if (getSettings()->showTabCloseButton &&
|
||||
this->notebook_->getAllowUserTabManagement()) //
|
||||
this->notebook_->getAllowUserTabManagement())
|
||||
{
|
||||
bool overX = this->getXRect().contains(event->pos());
|
||||
|
||||
@@ -575,7 +582,7 @@ void NotebookTab::mouseMoveEvent(QMouseEvent *event)
|
||||
QPoint relPoint = this->mapToParent(event->pos());
|
||||
|
||||
if (this->mouseDown_ && !this->getDesiredRect().contains(relPoint) &&
|
||||
this->notebook_->getAllowUserTabManagement()) //
|
||||
this->notebook_->getAllowUserTabManagement())
|
||||
{
|
||||
int index;
|
||||
QWidget *clickedPage =
|
||||
|
||||
@@ -21,8 +21,9 @@ ResizingTextEdit::ResizingTextEdit()
|
||||
|
||||
// Whenever the setting for emote completion changes, force a
|
||||
// refresh on the completion model the next time "Tab" is pressed
|
||||
getSettings()->prefixOnlyEmoteCompletion.connect(
|
||||
[this] { this->completionInProgress_ = false; });
|
||||
getSettings()->prefixOnlyEmoteCompletion.connect([this] {
|
||||
this->completionInProgress_ = false;
|
||||
});
|
||||
|
||||
this->setFocusPolicy(Qt::ClickFocus);
|
||||
}
|
||||
|
||||
@@ -109,7 +109,9 @@ void SearchPopup::initLayout()
|
||||
this->searchInput_ = new QLineEdit(this);
|
||||
layout2->addWidget(this->searchInput_);
|
||||
QObject::connect(this->searchInput_, &QLineEdit::returnPressed,
|
||||
[this] { this->search(); });
|
||||
[this] {
|
||||
this->search();
|
||||
});
|
||||
}
|
||||
|
||||
// SEARCH BUTTON
|
||||
@@ -117,8 +119,9 @@ void SearchPopup::initLayout()
|
||||
QPushButton *searchButton = new QPushButton(this);
|
||||
searchButton->setText("Search");
|
||||
layout2->addWidget(searchButton);
|
||||
QObject::connect(searchButton, &QPushButton::clicked,
|
||||
[this] { this->search(); });
|
||||
QObject::connect(searchButton, &QPushButton::clicked, [this] {
|
||||
this->search();
|
||||
});
|
||||
}
|
||||
|
||||
layout1->addLayout(layout2);
|
||||
|
||||
@@ -71,7 +71,7 @@ ExternalToolsPage::ExternalToolsPage()
|
||||
|
||||
getSettings()->streamlinkUseCustomPath.connect(
|
||||
[=](const auto &value, auto) {
|
||||
customPath->setEnabled(value); //
|
||||
customPath->setEnabled(value);
|
||||
},
|
||||
this->managedConnections_);
|
||||
}
|
||||
|
||||
@@ -110,13 +110,22 @@ void GeneralPage::initLayout(GeneralPageView &layout)
|
||||
getApp()->themes->themeName);
|
||||
layout.addDropdown<QString>(
|
||||
"Font", {"Segoe UI", "Arial", "Choose..."},
|
||||
getApp()->fonts->chatFontFamily, [](auto val) { return val; },
|
||||
[this](auto args) { return this->getFont(args); });
|
||||
getApp()->fonts->chatFontFamily,
|
||||
[](auto val) {
|
||||
return val;
|
||||
},
|
||||
[this](auto args) {
|
||||
return this->getFont(args);
|
||||
});
|
||||
layout.addDropdown<int>(
|
||||
"Font size", {"9pt", "10pt", "12pt", "14pt", "16pt", "20pt"},
|
||||
getApp()->fonts->chatFontSize,
|
||||
[](auto val) { return QString::number(val) + "pt"; },
|
||||
[](auto args) { return fuzzyToInt(args.value, 10); });
|
||||
[](auto val) {
|
||||
return QString::number(val) + "pt";
|
||||
},
|
||||
[](auto args) {
|
||||
return fuzzyToInt(args.value, 10);
|
||||
});
|
||||
layout.addDropdown<float>(
|
||||
"Zoom",
|
||||
{"0.5x", "0.6x", "0.7x", "0.8x", "0.9x", "Default", "1.2x", "1.4x",
|
||||
@@ -128,7 +137,9 @@ void GeneralPage::initLayout(GeneralPageView &layout)
|
||||
else
|
||||
return QString::number(val) + "x";
|
||||
},
|
||||
[](auto args) { return fuzzyToFloat(args.value, 1.f); });
|
||||
[](auto args) {
|
||||
return fuzzyToFloat(args.value, 1.f);
|
||||
});
|
||||
layout.addDropdown<int>(
|
||||
"Tab layout", {"Horizontal", "Vertical"}, s.tabDirection,
|
||||
[](auto val) {
|
||||
@@ -201,7 +212,9 @@ void GeneralPage::initLayout(GeneralPageView &layout)
|
||||
else
|
||||
return QString::number(val) + "x";
|
||||
},
|
||||
[](auto args) { return fuzzyToFloat(args.value, 1.f); });
|
||||
[](auto args) {
|
||||
return fuzzyToFloat(args.value, 1.f);
|
||||
});
|
||||
layout.addCheckbox("Smooth scrolling", s.enableSmoothScrolling);
|
||||
layout.addCheckbox("Smooth scrolling on new messages",
|
||||
s.enableSmoothScrollingNewMessages);
|
||||
@@ -266,7 +279,9 @@ void GeneralPage::initLayout(GeneralPageView &layout)
|
||||
[](auto val) {
|
||||
return val ? QString::number(val) + " lines" : QString("Never");
|
||||
},
|
||||
[](auto args) { return fuzzyToInt(args.value, 0); });
|
||||
[](auto args) {
|
||||
return fuzzyToInt(args.value, 0);
|
||||
});
|
||||
|
||||
layout.addTitle("Emotes");
|
||||
layout.addCheckbox("Enable", s.enableEmoteImages);
|
||||
@@ -284,12 +299,20 @@ void GeneralPage::initLayout(GeneralPageView &layout)
|
||||
else
|
||||
return QString::number(val) + "x";
|
||||
},
|
||||
[](auto args) { return fuzzyToFloat(args.value, 1.f); });
|
||||
[](auto args) {
|
||||
return fuzzyToFloat(args.value, 1.f);
|
||||
});
|
||||
|
||||
layout.addDropdown<int>(
|
||||
"Show info on hover", {"Don't show", "Always show", "Hold shift"},
|
||||
s.emotesTooltipPreview, [](int index) { return index; },
|
||||
[](auto args) { return args.index; }, false);
|
||||
s.emotesTooltipPreview,
|
||||
[](int index) {
|
||||
return index;
|
||||
},
|
||||
[](auto args) {
|
||||
return args.index;
|
||||
},
|
||||
false);
|
||||
layout.addDropdown("Emoji style",
|
||||
{"EmojiOne 2", "EmojiOne 3", "Twitter", "Facebook",
|
||||
"Apple", "Google", "Messenger"},
|
||||
@@ -304,7 +327,10 @@ void GeneralPage::initLayout(GeneralPageView &layout)
|
||||
ComboBox *dankDropdown =
|
||||
layout.addDropdown<std::underlying_type<StreamerModeSetting>::type>(
|
||||
"Enable Streamer Mode", {"No", "Yes", "Detect OBS (Windows only)"},
|
||||
s.enableStreamerMode, [](int value) { return value; },
|
||||
s.enableStreamerMode,
|
||||
[](int value) {
|
||||
return value;
|
||||
},
|
||||
[](DropdownArgs args) {
|
||||
return static_cast<StreamerModeSetting>(args.index);
|
||||
},
|
||||
@@ -445,8 +471,9 @@ void GeneralPage::initLayout(GeneralPageView &layout)
|
||||
box->addWidget(layout.makeButton("Choose cache path", [this]() {
|
||||
getSettings()->cachePath = QFileDialog::getExistingDirectory(this);
|
||||
}));
|
||||
box->addWidget(layout.makeButton(
|
||||
"Reset", []() { getSettings()->cachePath = ""; }));
|
||||
box->addWidget(layout.makeButton("Reset", []() {
|
||||
getSettings()->cachePath = "";
|
||||
}));
|
||||
box->addStretch(1);
|
||||
|
||||
layout.addLayout(box);
|
||||
@@ -471,21 +498,36 @@ void GeneralPage::initLayout(GeneralPageView &layout)
|
||||
layout.addCheckbox("Receive notification sounds from hidden messages",
|
||||
s.shownSimilarTriggerHighlights);
|
||||
s.hideSimilar.connect(
|
||||
[]() { getApp()->windows->forceLayoutChannelViews(); }, false);
|
||||
[]() {
|
||||
getApp()->windows->forceLayoutChannelViews();
|
||||
},
|
||||
false);
|
||||
layout.addDropdown<float>(
|
||||
"Similarity threshold", {"0.5", "0.75", "0.9"}, s.similarityPercentage,
|
||||
[](auto val) { return QString::number(val); },
|
||||
[](auto args) { return fuzzyToFloat(args.value, 0.9f); });
|
||||
[](auto val) {
|
||||
return QString::number(val);
|
||||
},
|
||||
[](auto args) {
|
||||
return fuzzyToFloat(args.value, 0.9f);
|
||||
});
|
||||
layout.addDropdown<int>(
|
||||
"Maximum delay between messages",
|
||||
{"5s", "10s", "15s", "30s", "60s", "120s"}, s.hideSimilarMaxDelay,
|
||||
[](auto val) { return QString::number(val) + "s"; },
|
||||
[](auto args) { return fuzzyToInt(args.value, 5); });
|
||||
[](auto val) {
|
||||
return QString::number(val) + "s";
|
||||
},
|
||||
[](auto args) {
|
||||
return fuzzyToInt(args.value, 5);
|
||||
});
|
||||
layout.addDropdown<int>(
|
||||
"Amount of previous messages to check", {"1", "2", "3", "4", "5"},
|
||||
s.hideSimilarMaxMessagesToCheck,
|
||||
[](auto val) { return QString::number(val); },
|
||||
[](auto args) { return fuzzyToInt(args.value, 3); });
|
||||
[](auto val) {
|
||||
return QString::number(val);
|
||||
},
|
||||
[](auto args) {
|
||||
return fuzzyToInt(args.value, 3);
|
||||
});
|
||||
|
||||
layout.addSubtitle("Visible badges");
|
||||
layout.addCheckbox("Authority (staff, admin)",
|
||||
@@ -540,7 +582,9 @@ void GeneralPage::initLayout(GeneralPageView &layout)
|
||||
else
|
||||
return QString::number(val);
|
||||
},
|
||||
[](auto args) { return fuzzyToFloat(args.value, 63.f); });
|
||||
[](auto args) {
|
||||
return fuzzyToFloat(args.value, 63.f);
|
||||
});
|
||||
layout.addCheckbox("Double click to open links and other elements in chat",
|
||||
s.linksDoubleClickOnly);
|
||||
layout.addCheckbox("Unshorten links", s.unshortLinks);
|
||||
@@ -563,8 +607,14 @@ void GeneralPage::initLayout(GeneralPageView &layout)
|
||||
s.showUnhandledIrcMessages);
|
||||
layout.addDropdown<int>(
|
||||
"Stack timeouts", {"Stack", "Stack until timeout", "Don't stack"},
|
||||
s.timeoutStackStyle, [](int index) { return index; },
|
||||
[](auto args) { return args.index; }, false);
|
||||
s.timeoutStackStyle,
|
||||
[](int index) {
|
||||
return index;
|
||||
},
|
||||
[](auto args) {
|
||||
return args.index;
|
||||
},
|
||||
false);
|
||||
layout.addCheckbox("Combine multiple bit tips into one", s.stackBits);
|
||||
layout.addCheckbox("Ask for confirmation when uploading an image",
|
||||
s.askOnImageUpload);
|
||||
|
||||
@@ -27,7 +27,9 @@ GeneralPageView::GeneralPageView(QWidget *parent)
|
||||
{scrollArea, new QSpacerItem(16, 1), navigation}));
|
||||
|
||||
QObject::connect(scrollArea->verticalScrollBar(), &QScrollBar::valueChanged,
|
||||
this, [=] { this->updateNavigationHighlighting(); });
|
||||
this, [=] {
|
||||
this->updateNavigationHighlighting();
|
||||
});
|
||||
}
|
||||
|
||||
void GeneralPageView::addWidget(QWidget *widget)
|
||||
@@ -96,9 +98,10 @@ QCheckBox *GeneralPageView::addCheckbox(const QString &text,
|
||||
this->managedConnections_);
|
||||
|
||||
// update setting on toggle
|
||||
QObject::connect(
|
||||
check, &QCheckBox::toggled, this,
|
||||
[&setting, inverse](bool state) { setting = inverse ^ state; });
|
||||
QObject::connect(check, &QCheckBox::toggled, this,
|
||||
[&setting, inverse](bool state) {
|
||||
setting = inverse ^ state;
|
||||
});
|
||||
|
||||
this->addWidget(check);
|
||||
|
||||
@@ -141,7 +144,9 @@ ComboBox *GeneralPageView::addDropdown(
|
||||
|
||||
// update when setting changes
|
||||
setting.connect(
|
||||
[combo](const QString &value, auto) { combo->setCurrentText(value); },
|
||||
[combo](const QString &value, auto) {
|
||||
combo->setCurrentText(value);
|
||||
},
|
||||
this->managedConnections_);
|
||||
|
||||
QObject::connect(combo, &QComboBox::currentTextChanged,
|
||||
|
||||
@@ -86,8 +86,9 @@ void addUsersTab(IgnoresPage &page, LayoutCreator<QVBoxLayout> users,
|
||||
|
||||
auto &setting = getSettings()->showIgnoredUsersMessages;
|
||||
|
||||
setting.connect(
|
||||
[combo](const int value) { combo->setCurrentIndex(value); });
|
||||
setting.connect([combo](const int value) {
|
||||
combo->setCurrentIndex(value);
|
||||
});
|
||||
|
||||
QObject::connect(combo,
|
||||
QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
|
||||
@@ -120,21 +120,23 @@ ModerationPage::ModerationPage()
|
||||
|
||||
// Show how big (size-wise) the logs are
|
||||
auto logsPathSizeLabel = logs.emplace<QLabel>();
|
||||
logsPathSizeLabel->setText(
|
||||
QtConcurrent::run([] { return fetchLogDirectorySize(); }));
|
||||
logsPathSizeLabel->setText(QtConcurrent::run([] {
|
||||
return fetchLogDirectorySize();
|
||||
}));
|
||||
|
||||
// Select event
|
||||
QObject::connect(
|
||||
selectDir.getElement(), &QPushButton::clicked, this,
|
||||
[this, logsPathSizeLabel]() mutable {
|
||||
auto dirName = QFileDialog::getExistingDirectory(this);
|
||||
QObject::connect(selectDir.getElement(), &QPushButton::clicked, this,
|
||||
[this, logsPathSizeLabel]() mutable {
|
||||
auto dirName =
|
||||
QFileDialog::getExistingDirectory(this);
|
||||
|
||||
getSettings()->logPath = dirName;
|
||||
getSettings()->logPath = dirName;
|
||||
|
||||
// Refresh: Show how big (size-wise) the logs are
|
||||
logsPathSizeLabel->setText(
|
||||
QtConcurrent::run([] { return fetchLogDirectorySize(); }));
|
||||
});
|
||||
// Refresh: Show how big (size-wise) the logs are
|
||||
logsPathSizeLabel->setText(QtConcurrent::run([] {
|
||||
return fetchLogDirectorySize();
|
||||
}));
|
||||
});
|
||||
|
||||
buttons->addSpacing(16);
|
||||
|
||||
@@ -144,8 +146,9 @@ ModerationPage::ModerationPage()
|
||||
getSettings()->logPath = "";
|
||||
|
||||
// Refresh: Show how big (size-wise) the logs are
|
||||
logsPathSizeLabel->setText(QtConcurrent::run(
|
||||
[] { return fetchLogDirectorySize(); }));
|
||||
logsPathSizeLabel->setText(QtConcurrent::run([] {
|
||||
return fetchLogDirectorySize();
|
||||
}));
|
||||
});
|
||||
|
||||
} // logs end
|
||||
|
||||
@@ -96,7 +96,7 @@ QCheckBox *SettingsPage::createCheckBox(
|
||||
// update when setting changes
|
||||
setting.connect(
|
||||
[checkbox](const bool &value, auto) {
|
||||
checkbox->setChecked(value); //
|
||||
checkbox->setChecked(value);
|
||||
},
|
||||
this->managedConnections_);
|
||||
|
||||
@@ -120,12 +120,15 @@ QComboBox *SettingsPage::createComboBox(
|
||||
|
||||
// update when setting changes
|
||||
setting.connect(
|
||||
[combo](const QString &value, auto) { combo->setCurrentText(value); },
|
||||
[combo](const QString &value, auto) {
|
||||
combo->setCurrentText(value);
|
||||
},
|
||||
this->managedConnections_);
|
||||
|
||||
QObject::connect(
|
||||
combo, &QComboBox::currentTextChanged,
|
||||
[&setting](const QString &newValue) { setting = newValue; });
|
||||
QObject::connect(combo, &QComboBox::currentTextChanged,
|
||||
[&setting](const QString &newValue) {
|
||||
setting = newValue;
|
||||
});
|
||||
|
||||
return combo;
|
||||
}
|
||||
@@ -138,9 +141,10 @@ QLineEdit *SettingsPage::createLineEdit(
|
||||
edit->setText(setting);
|
||||
|
||||
// update when setting changes
|
||||
QObject::connect(
|
||||
edit, &QLineEdit::textChanged,
|
||||
[&setting](const QString &newValue) { setting = newValue; });
|
||||
QObject::connect(edit, &QLineEdit::textChanged,
|
||||
[&setting](const QString &newValue) {
|
||||
setting = newValue;
|
||||
});
|
||||
|
||||
return edit;
|
||||
}
|
||||
@@ -153,9 +157,13 @@ QSpinBox *SettingsPage::createSpinBox(pajlada::Settings::Setting<int> &setting,
|
||||
w->setMinimum(min);
|
||||
w->setMaximum(max);
|
||||
|
||||
setting.connect([w](const int &value, auto) { w->setValue(value); });
|
||||
setting.connect([w](const int &value, auto) {
|
||||
w->setValue(value);
|
||||
});
|
||||
QObject::connect(w, QOverload<int>::of(&QSpinBox::valueChanged),
|
||||
[&setting](int value) { setting.setValue(value); });
|
||||
[&setting](int value) {
|
||||
setting.setValue(value);
|
||||
});
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
@@ -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