Chore: Proper Lambda Formatting (#2167)

Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
Leon Richardt
2020-11-08 12:02:19 +01:00
committed by GitHub
parent fbd5df53d8
commit 0eed45ae67
71 changed files with 712 additions and 415 deletions
+30 -20
View File
@@ -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()