diff --git a/src/.clang-format b/src/.clang-format index 0ef59b1fe..f34c1465b 100644 --- a/src/.clang-format +++ b/src/.clang-format @@ -4,6 +4,7 @@ AccessModifierOffset: -4 AlignEscapedNewlinesLeft: true AllowShortFunctionsOnASingleLine: false AllowShortIfStatementsOnASingleLine: false +AllowShortLambdasOnASingleLine: Empty AllowShortLoopsOnASingleLine: false AlwaysBreakAfterDefinitionReturnType: false AlwaysBreakBeforeMultilineStrings: false diff --git a/src/Application.cpp b/src/Application.cpp index a44cbd056..2b6277946 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -61,8 +61,9 @@ Application::Application(Settings &_settings, Paths &_paths) { this->instance = this; - this->fonts->fontChanged.connect( - [this]() { this->windows->layoutChannelViews(); }); + this->fonts->fontChanged.connect([this]() { + this->windows->layoutChannelViews(); + }); this->twitch.server = this->twitch2; this->twitch.pubsub = this->twitch2->pubsub; @@ -137,14 +138,20 @@ int Application::run(QApplication &qtApp) this->windows->getMainWindow().show(); getSettings()->betaUpdates.connect( - [] { Updates::instance().checkForUpdates(); }, false); - getSettings()->moderationActions.delayedItemsChanged.connect( - [this] { this->windows->forceLayoutChannelViews(); }); + [] { + Updates::instance().checkForUpdates(); + }, + false); + getSettings()->moderationActions.delayedItemsChanged.connect([this] { + this->windows->forceLayoutChannelViews(); + }); - getSettings()->highlightedMessages.delayedItemsChanged.connect( - [this] { this->windows->forceLayoutChannelViews(); }); - getSettings()->highlightedUsers.delayedItemsChanged.connect( - [this] { this->windows->forceLayoutChannelViews(); }); + getSettings()->highlightedMessages.delayedItemsChanged.connect([this] { + this->windows->forceLayoutChannelViews(); + }); + getSettings()->highlightedUsers.delayedItemsChanged.connect([this] { + this->windows->forceLayoutChannelViews(); + }); return qtApp.exec(); } @@ -184,7 +191,9 @@ void Application::initPubsub() QString("%1 cleared the chat").arg(action.source.name); auto msg = makeSystemMessage(text); - postToThread([chan, msg] { chan->addMessage(msg); }); + postToThread([chan, msg] { + chan->addMessage(msg); + }); }); this->twitch.pubsub->signals_.moderation.modeChanged.connect( @@ -197,7 +206,7 @@ void Application::initPubsub() } QString text = - QString("%1 turned %2 %3 mode") // + QString("%1 turned %2 %3 mode") .arg(action.source.name) .arg(action.state == ModeChangedAction::State::On ? "on" : "off") @@ -210,7 +219,9 @@ void Application::initPubsub() } auto msg = makeSystemMessage(text); - postToThread([chan, msg] { chan->addMessage(msg); }); + postToThread([chan, msg] { + chan->addMessage(msg); + }); }); this->twitch.pubsub->signals_.moderation.moderationStateChanged.connect( @@ -236,7 +247,9 @@ void Application::initPubsub() } auto msg = makeSystemMessage(text); - postToThread([chan, msg] { chan->addMessage(msg); }); + postToThread([chan, msg] { + chan->addMessage(msg); + }); }); this->twitch.pubsub->signals_.moderation.userBanned.connect( @@ -269,7 +282,9 @@ void Application::initPubsub() auto msg = MessageBuilder(action).release(); - postToThread([chan, msg] { chan->addMessage(msg); }); + postToThread([chan, msg] { + chan->addMessage(msg); + }); }); this->twitch.pubsub->signals_.moderation.automodMessage.connect( @@ -301,7 +316,9 @@ void Application::initPubsub() auto msg = MessageBuilder(action).release(); - postToThread([chan, msg] { chan->addMessage(msg); }); + postToThread([chan, msg] { + chan->addMessage(msg); + }); chan->deleteMessage(msg->id); }); @@ -334,7 +351,7 @@ void Application::initPubsub() // moderation topics this->twitch.pubsub->UnlistenAllAuthedTopics(); this->twitch.server->pubsub->listenToWhispers( - this->accounts->twitch.getCurrent()); // + this->accounts->twitch.getCurrent()); }; this->accounts->twitch.currentUserChanged.connect(RequestModerationActions); diff --git a/src/RunGui.cpp b/src/RunGui.cpp index b1e842d48..21dcb15e9 100644 --- a/src/RunGui.cpp +++ b/src/RunGui.cpp @@ -164,8 +164,9 @@ void runGui(QApplication &a, Paths &paths, Settings &settings) initResources(); initSignalHandler(); - settings.restartOnCrash.connect( - [](const bool &value) { restartOnSignal = value; }); + settings.restartOnCrash.connect([](const bool &value) { + restartOnSignal = value; + }); auto thread = std::thread([dir = paths.miscDirectory] { { @@ -186,7 +187,9 @@ void runGui(QApplication &a, Paths &paths, Settings &settings) // Clear the cache 1 minute after start. QTimer::singleShot(60 * 1000, [cachePath = paths.cacheDirectory()] { - QtConcurrent::run([cachePath]() { clearCache(cachePath); }); + QtConcurrent::run([cachePath]() { + clearCache(cachePath); + }); }); chatterino::NetworkManager::init(); diff --git a/src/common/Channel.cpp b/src/common/Channel.cpp index 8118e2e29..455f0b705 100644 --- a/src/common/Channel.cpp +++ b/src/common/Channel.cpp @@ -130,17 +130,17 @@ void Channel::addOrReplaceTimeout(MessagePtr message) } if (s->flags.has(MessageFlag::Timeout) && - s->timeoutUser == message->timeoutUser) // + s->timeoutUser == message->timeoutUser) { if (message->flags.has(MessageFlag::PubSub) && - !s->flags.has(MessageFlag::PubSub)) // + !s->flags.has(MessageFlag::PubSub)) { this->replaceMessage(s, message); addMessage = false; break; } if (!message->flags.has(MessageFlag::PubSub) && - s->flags.has(MessageFlag::PubSub)) // + s->flags.has(MessageFlag::PubSub)) { addMessage = timeoutStackStyle == TimeoutStackStyle::DontStack; break; diff --git a/src/common/Credentials.cpp b/src/common/Credentials.cpp index 0812fb039..9bf3266e0 100644 --- a/src/common/Credentials.cpp +++ b/src/common/Credentials.cpp @@ -113,7 +113,9 @@ namespace { job->setKey(set.name); job->setTextData(set.credential); QObject::connect(job, &QKeychain::Job::finished, qApp, - [](auto) { runNextJob(); }); + [](auto) { + runNextJob(); + }); job->start(); } else // erase job @@ -123,7 +125,9 @@ namespace { job->setAutoDelete(true); job->setKey(erase.name); QObject::connect(job, &QKeychain::Job::finished, qApp, - [](auto) { runNextJob(); }); + [](auto) { + runNextJob(); + }); job->start(); } diff --git a/src/common/NetworkPrivate.cpp b/src/common/NetworkPrivate.cpp index e130dd8c1..3e98be924 100644 --- a/src/common/NetworkPrivate.cpp +++ b/src/common/NetworkPrivate.cpp @@ -180,9 +180,10 @@ void loadUncached(const std::shared_ptr &data) if (data->onSuccess_) { if (data->executeConcurrently_) - QtConcurrent::run( - [onSuccess = std::move(data->onSuccess_), - result = std::move(result)] { onSuccess(result); }); + QtConcurrent::run([onSuccess = std::move(data->onSuccess_), + result = std::move(result)] { + onSuccess(result); + }); else data->onSuccess_(result); } diff --git a/src/common/SignalVector.hpp b/src/common/SignalVector.hpp index 93f1f322e..96dfbe1c0 100644 --- a/src/common/SignalVector.hpp +++ b/src/common/SignalVector.hpp @@ -28,8 +28,9 @@ public: SignalVector() : readOnly_(new std::vector()) { - QObject::connect(&this->itemsChangedTimer_, &QTimer::timeout, - [this] { this->delayedItemsChanged.invoke(); }); + QObject::connect(&this->itemsChangedTimer_, &QTimer::timeout, [this] { + this->delayedItemsChanged.invoke(); + }); this->itemsChangedTimer_.setInterval(100); this->itemsChangedTimer_.setSingleShot(true); } diff --git a/src/controllers/commands/CommandController.cpp b/src/controllers/commands/CommandController.cpp index 124d01a9a..b4832d920 100644 --- a/src/controllers/commands/CommandController.cpp +++ b/src/controllers/commands/CommandController.cpp @@ -115,8 +115,11 @@ bool appendWhisperMessageWordsLocally(const QStringList &words) } } } visitor; - boost::apply_visitor([&b](auto &&arg) { visitor(arg, b); }, - variant); + boost::apply_visitor( + [&b](auto &&arg) { + visitor(arg, b); + }, + variant); } // emoji/text } } @@ -211,7 +214,7 @@ void CommandController::initialize(Settings &, Paths &paths) // Update the setting when the vector of commands has been updated (most // likely from the settings dialog) - this->items_.delayedItemsChanged.connect([this] { // + this->items_.delayedItemsChanged.connect([this] { this->commandsSetting_->setValue(this->items_.raw()); }); diff --git a/src/controllers/filters/FilterSet.hpp b/src/controllers/filters/FilterSet.hpp index 2e4b2da9f..52a953e54 100644 --- a/src/controllers/filters/FilterSet.hpp +++ b/src/controllers/filters/FilterSet.hpp @@ -11,8 +11,9 @@ public: FilterSet() { this->listener_ = - getCSettings().filterRecords.delayedItemsChanged.connect( - [this] { this->reloadFilters(); }); + getCSettings().filterRecords.delayedItemsChanged.connect([this] { + this->reloadFilters(); + }); } FilterSet(const QList &filterIds) @@ -25,8 +26,9 @@ public: } this->listener_ = - getCSettings().filterRecords.delayedItemsChanged.connect( - [this] { this->reloadFilters(); }); + getCSettings().filterRecords.delayedItemsChanged.connect([this] { + this->reloadFilters(); + }); } ~FilterSet() diff --git a/src/controllers/notifications/NotificationController.cpp b/src/controllers/notifications/NotificationController.cpp index 2578558df..fb07b3dee 100644 --- a/src/controllers/notifications/NotificationController.cpp +++ b/src/controllers/notifications/NotificationController.cpp @@ -29,7 +29,7 @@ void NotificationController::initialize(Settings &settings, Paths &paths) this->channelMap[Platform::Twitch].append(channelName); } - this->channelMap[Platform::Twitch].delayedItemsChanged.connect([this] { // + this->channelMap[Platform::Twitch].delayedItemsChanged.connect([this] { this->twitchSetting_.setValue(this->channelMap[Platform::Twitch].raw()); }); /* @@ -37,7 +37,7 @@ void NotificationController::initialize(Settings &settings, Paths &paths) this->channelMap[Platform::Mixer].appendItem(channelName); } - this->channelMap[Platform::Mixer].delayedItemsChanged.connect([this] { // + this->channelMap[Platform::Mixer].delayedItemsChanged.connect([this] { this->mixerSetting_.setValue( this->channelMap[Platform::Mixer]); });*/ @@ -46,8 +46,9 @@ void NotificationController::initialize(Settings &settings, Paths &paths) this->fetchFakeChannels(); - QObject::connect(this->liveStatusTimer_, &QTimer::timeout, - [=] { this->fetchFakeChannels(); }); + QObject::connect(this->liveStatusTimer_, &QTimer::timeout, [=] { + this->fetchFakeChannels(); + }); this->liveStatusTimer_->start(60 * 1000); } diff --git a/src/messages/Image.cpp b/src/messages/Image.cpp index 37a8a644b..41a0c21aa 100644 --- a/src/messages/Image.cpp +++ b/src/messages/Image.cpp @@ -38,13 +38,16 @@ namespace detail { DebugCount::increase("animated images"); this->gifTimerConnection_ = - getApp()->emotes->gifTimer.signal.connect( - [this] { this->advance(); }); + getApp()->emotes->gifTimer.signal.connect([this] { + this->advance(); + }); } - auto totalLength = std::accumulate( - this->items_.begin(), this->items_.end(), 0UL, - [](auto init, auto &&frame) { return init + frame.duration; }); + auto totalLength = + std::accumulate(this->items_.begin(), this->items_.end(), 0UL, + [](auto init, auto &&frame) { + return init + frame.duration; + }); if (totalLength == 0) { @@ -222,7 +225,9 @@ Image::~Image() // run destructor of Frames in gui thread if (!isGuiThread()) { - postToThread([frames = this->frames_.release()]() { delete frames; }); + postToThread([frames = this->frames_.release()]() { + delete frames; + }); } } diff --git a/src/messages/MessageElement.cpp b/src/messages/MessageElement.cpp index 9c499a325..fbf6342c0 100644 --- a/src/messages/MessageElement.cpp +++ b/src/messages/MessageElement.cpp @@ -352,7 +352,7 @@ void TextElement::addToContainer(MessageLayoutContainer &container, // QChar::isHighSurrogate(text[0].unicode()) ? 2 : 1 - for (int i = 0; i < textLength; i++) // + for (int i = 0; i < textLength; i++) { auto isSurrogate = text.size() > i + 1 && QChar::isHighSurrogate(text[i].unicode()); @@ -360,7 +360,7 @@ void TextElement::addToContainer(MessageLayoutContainer &container, auto charWidth = isSurrogate ? metrics.width(text.mid(i, 2)) : metrics.width(text[i]); - if (!container.fitsInLine(width + charWidth)) // + if (!container.fitsInLine(width + charWidth)) { container.addElementNoLineBreak(getTextLayoutElement( text.mid(wordStart, i - wordStart), width, false)); @@ -621,7 +621,7 @@ void IrcTextElement::addToContainer(MessageLayoutContainer &container, // QChar::isHighSurrogate(text[0].unicode()) ? 2 : 1 // XXX(pajlada): NOT TESTED - for (int i = 0; i < textLength; i++) // + for (int i = 0; i < textLength; i++) { auto isSurrogate = text.size() > i + 1 && QChar::isHighSurrogate(text[i].unicode()); diff --git a/src/messages/SharedMessageBuilder.cpp b/src/messages/SharedMessageBuilder.cpp index 10ac74e21..244a2682b 100644 --- a/src/messages/SharedMessageBuilder.cpp +++ b/src/messages/SharedMessageBuilder.cpp @@ -356,7 +356,7 @@ void SharedMessageBuilder::appendChannelName() Link link(Link::Url, this->channel->getName() + "\n" + this->message().id); this->emplace(channelName, MessageElementFlag::ChannelName, - MessageColor::System) // + MessageColor::System) ->setLink(link); } diff --git a/src/messages/layouts/MessageLayout.cpp b/src/messages/layouts/MessageLayout.cpp index 9961e6c3d..eb2b8b988 100644 --- a/src/messages/layouts/MessageLayout.cpp +++ b/src/messages/layouts/MessageLayout.cpp @@ -119,7 +119,7 @@ void MessageLayout::actuallyLayout(int width, MessageElementFlags flags) if (this->flags.has(MessageLayoutFlag::Expanded) || (flags.has(MessageElementFlag::ModeratorTools) && - !this->message_->flags.has(MessageFlag::Disabled))) // + !this->message_->flags.has(MessageFlag::Disabled))) { messageFlags.unset(MessageFlag::Collapsed); } diff --git a/src/messages/layouts/MessageLayoutContainer.cpp b/src/messages/layouts/MessageLayoutContainer.cpp index 8f3503b21..2a69431cd 100644 --- a/src/messages/layouts/MessageLayoutContainer.cpp +++ b/src/messages/layouts/MessageLayoutContainer.cpp @@ -390,7 +390,7 @@ void MessageLayoutContainer::paintSelection(QPainter &painter, int messageIndex, // ends in same line if (selection.selectionMax.messageIndex == messageIndex && line.endCharIndex > - /*=*/selection.selectionMax.charIndex) // + /*=*/selection.selectionMax.charIndex) { returnAfter = true; index = line.startCharIndex; diff --git a/src/messages/layouts/MessageLayoutElement.cpp b/src/messages/layouts/MessageLayoutElement.cpp index 49edde0ef..dbcfe78aa 100644 --- a/src/messages/layouts/MessageLayoutElement.cpp +++ b/src/messages/layouts/MessageLayoutElement.cpp @@ -217,7 +217,7 @@ void TextLayoutElement::listenToLinkChanges() .linkChanged.connect([this]() { // log("Old link: {}", this->getCreator().getLink().value); // log("This link: {}", this->getLink().value); - this->setLink(this->getCreator().getLink()); // + this->setLink(this->getCreator().getLink()); })); } diff --git a/src/providers/irc/AbstractIrcServer.cpp b/src/providers/irc/AbstractIrcServer.cpp index 2618465a5..5ebea7da1 100644 --- a/src/providers/irc/AbstractIrcServer.cpp +++ b/src/providers/irc/AbstractIrcServer.cpp @@ -22,36 +22,47 @@ AbstractIrcServer::AbstractIrcServer() this->writeConnection_->moveToThread( QCoreApplication::instance()->thread()); - QObject::connect( - this->writeConnection_.get(), &Communi::IrcConnection::messageReceived, - this, [this](auto msg) { this->writeConnectionMessageReceived(msg); }); - QObject::connect( - this->writeConnection_.get(), &Communi::IrcConnection::connected, this, - [this] { this->onWriteConnected(this->writeConnection_.get()); }); + QObject::connect(this->writeConnection_.get(), + &Communi::IrcConnection::messageReceived, this, + [this](auto msg) { + this->writeConnectionMessageReceived(msg); + }); + QObject::connect(this->writeConnection_.get(), + &Communi::IrcConnection::connected, this, [this] { + this->onWriteConnected(this->writeConnection_.get()); + }); // Listen to read connection message signals this->readConnection_.reset(new IrcConnection); this->readConnection_->moveToThread(QCoreApplication::instance()->thread()); - QObject::connect( - this->readConnection_.get(), &Communi::IrcConnection::messageReceived, - this, [this](auto msg) { this->readConnectionMessageReceived(msg); }); + QObject::connect(this->readConnection_.get(), + &Communi::IrcConnection::messageReceived, this, + [this](auto msg) { + this->readConnectionMessageReceived(msg); + }); QObject::connect(this->readConnection_.get(), &Communi::IrcConnection::privateMessageReceived, this, - [this](auto msg) { this->privateMessageReceived(msg); }); - QObject::connect( - this->readConnection_.get(), &Communi::IrcConnection::connected, this, - [this] { this->onReadConnected(this->readConnection_.get()); }); + [this](auto msg) { + this->privateMessageReceived(msg); + }); QObject::connect(this->readConnection_.get(), - &Communi::IrcConnection::disconnected, this, - [this] { this->onDisconnected(); }); + &Communi::IrcConnection::connected, this, [this] { + this->onReadConnected(this->readConnection_.get()); + }); QObject::connect(this->readConnection_.get(), - &Communi::IrcConnection::socketError, this, - [this] { this->onSocketError(); }); + &Communi::IrcConnection::disconnected, this, [this] { + this->onDisconnected(); + }); + QObject::connect(this->readConnection_.get(), + &Communi::IrcConnection::socketError, this, [this] { + this->onSocketError(); + }); // listen to reconnect request - this->readConnection_->reconnectRequested.connect( - [this] { this->connect(); }); + this->readConnection_->reconnectRequested.connect([this] { + this->connect(); + }); // this->writeConnection->reconnectRequested.connect([this] { // this->connect(); }); this->reconnectTimer_.setInterval(RECONNECT_BASE_INTERVAL); diff --git a/src/providers/irc/Irc2.cpp b/src/providers/irc/Irc2.cpp index 1876c383a..1b1dfcf46 100644 --- a/src/providers/irc/Irc2.cpp +++ b/src/providers/irc/Irc2.cpp @@ -137,7 +137,9 @@ Irc::Irc() } }); - this->connections.delayedItemsChanged.connect([this] { this->save(); }); + this->connections.delayedItemsChanged.connect([this] { + this->save(); + }); } QAbstractTableModel *Irc::newConnectionModel(QObject *parent) diff --git a/src/providers/irc/IrcCommands.cpp b/src/providers/irc/IrcCommands.cpp index a423f9189..4fbaeb59d 100644 --- a/src/providers/irc/IrcCommands.cpp +++ b/src/providers/irc/IrcCommands.cpp @@ -33,9 +33,13 @@ Outcome invokeIrcCommand(const QString &commandName, const QString &allParams, // CUSTOM COMMANDS auto params = allParams.split(' '); - auto paramsAfter = [&](int i) { return params.mid(i + 1).join(' '); }; + auto paramsAfter = [&](int i) { + return params.mid(i + 1).join(' '); + }; - auto sendRaw = [&](QString str) { channel.server()->sendRawMessage(str); }; + auto sendRaw = [&](QString str) { + channel.server()->sendRawMessage(str); + }; if (cmd == "msg") { diff --git a/src/providers/irc/IrcConnection2.cpp b/src/providers/irc/IrcConnection2.cpp index ed100149d..ee0876090 100644 --- a/src/providers/irc/IrcConnection2.cpp +++ b/src/providers/irc/IrcConnection2.cpp @@ -45,8 +45,9 @@ IrcConnection::IrcConnection(QObject *parent) } }); - QObject::connect(this, &Communi::IrcConnection::connected, this, - [this] { this->waitingForPong_ = false; }); + QObject::connect(this, &Communi::IrcConnection::connected, this, [this] { + this->waitingForPong_ = false; + }); QObject::connect(this, &Communi::IrcConnection::pongMessageReceived, [this](Communi::IrcPongMessage *message) { diff --git a/src/providers/twitch/IrcMessageHandler.cpp b/src/providers/twitch/IrcMessageHandler.cpp index bb16005c6..bac05f24b 100644 --- a/src/providers/twitch/IrcMessageHandler.cpp +++ b/src/providers/twitch/IrcMessageHandler.cpp @@ -702,7 +702,7 @@ void IrcMessageHandler::handleNoticeMessage(Communi::IrcNoticeMessage *message) // channels app->twitch.server->forEachChannelAndSpecialChannels( [msg](const auto &c) { - c->addMessage(msg); // + c->addMessage(msg); }); return; diff --git a/src/providers/twitch/PubsubClient.cpp b/src/providers/twitch/PubsubClient.cpp index 71a309d5c..ff60b7781 100644 --- a/src/providers/twitch/PubsubClient.cpp +++ b/src/providers/twitch/PubsubClient.cpp @@ -166,7 +166,7 @@ namespace detail { return; } - self->ping(); // + self->ping(); }); } diff --git a/src/providers/twitch/TwitchAccount.cpp b/src/providers/twitch/TwitchAccount.cpp index 9ece767ae..1270d14b1 100644 --- a/src/providers/twitch/TwitchAccount.cpp +++ b/src/providers/twitch/TwitchAccount.cpp @@ -153,7 +153,7 @@ void TwitchAccount::ignore( { const auto onUserFetched = [this, targetName, onFinished](const auto &user) { - this->ignoreByID(user.id, targetName, onFinished); // + this->ignoreByID(user.id, targetName, onFinished); }; const auto onUserFetchFailed = [] {}; @@ -230,7 +230,7 @@ void TwitchAccount::unignore( { const auto onUserFetched = [this, targetName, onFinished](const auto &user) { - this->unignoreByID(user.id, targetName, onFinished); // + this->unignoreByID(user.id, targetName, onFinished); }; const auto onUserFetchFailed = [] {}; diff --git a/src/providers/twitch/TwitchAccountManager.cpp b/src/providers/twitch/TwitchAccountManager.cpp index 3813e9822..1b8374e0b 100644 --- a/src/providers/twitch/TwitchAccountManager.cpp +++ b/src/providers/twitch/TwitchAccountManager.cpp @@ -17,7 +17,7 @@ TwitchAccountManager::TwitchAccountManager() currentUser->loadIgnores(); }); - this->accounts.itemRemoved.connect([this](const auto &acc) { // + this->accounts.itemRemoved.connect([this](const auto &acc) { this->removeUser(acc.item.get()); }); } diff --git a/src/providers/twitch/TwitchChannel.cpp b/src/providers/twitch/TwitchChannel.cpp index f8becd25a..128cfbb4a 100644 --- a/src/providers/twitch/TwitchChannel.cpp +++ b/src/providers/twitch/TwitchChannel.cpp @@ -156,14 +156,18 @@ TwitchChannel::TwitchChannel(const QString &name, } }); - this->managedConnect(getApp()->accounts->twitch.currentUserChanged, - [=] { this->setMod(false); }); + this->managedConnect(getApp()->accounts->twitch.currentUserChanged, [=] { + this->setMod(false); + }); // pubsub - this->managedConnect(getApp()->accounts->twitch.currentUserChanged, - [=] { this->refreshPubsub(); }); + this->managedConnect(getApp()->accounts->twitch.currentUserChanged, [=] { + this->refreshPubsub(); + }); this->refreshPubsub(); - this->userStateChanged.connect([this] { this->refreshPubsub(); }); + this->userStateChanged.connect([this] { + this->refreshPubsub(); + }); // room id loaded -> refresh live status this->roomIdChanged.connect([this]() { @@ -177,12 +181,14 @@ TwitchChannel::TwitchChannel(const QString &name, }); // timers - QObject::connect(&this->chattersListTimer_, &QTimer::timeout, - [=] { this->refreshChatters(); }); + QObject::connect(&this->chattersListTimer_, &QTimer::timeout, [=] { + this->refreshChatters(); + }); this->chattersListTimer_.start(5 * 60 * 1000); - QObject::connect(&this->liveStatusTimer_, &QTimer::timeout, - [=] { this->refreshLiveStatus(); }); + QObject::connect(&this->liveStatusTimer_, &QTimer::timeout, [=] { + this->refreshLiveStatus(); + }); this->liveStatusTimer_.start(60 * 1000); // debugging diff --git a/src/providers/twitch/TwitchIrcServer.cpp b/src/providers/twitch/TwitchIrcServer.cpp index d31e844fa..29c1c87e1 100644 --- a/src/providers/twitch/TwitchIrcServer.cpp +++ b/src/providers/twitch/TwitchIrcServer.cpp @@ -38,8 +38,11 @@ TwitchIrcServer::TwitchIrcServer() void TwitchIrcServer::initialize(Settings &settings, Paths &paths) { - getApp()->accounts->twitch.currentUserChanged.connect( - [this]() { postToThread([this] { this->connect(); }); }); + getApp()->accounts->twitch.currentUserChanged.connect([this]() { + postToThread([this] { + this->connect(); + }); + }); this->twitchBadges.loadTwitchBadges(); this->bttv.loadEmotes(); diff --git a/src/providers/twitch/TwitchMessageBuilder.cpp b/src/providers/twitch/TwitchMessageBuilder.cpp index ea66ca536..98d1de23c 100644 --- a/src/providers/twitch/TwitchMessageBuilder.cpp +++ b/src/providers/twitch/TwitchMessageBuilder.cpp @@ -295,7 +295,7 @@ MessagePtr TwitchMessageBuilder::build() std::sort(twitchEmotes.begin(), twitchEmotes.end(), [](const auto &a, const auto &b) { - return a.start < b.start; // + return a.start < b.start; }); twitchEmotes.erase(std::unique(twitchEmotes.begin(), twitchEmotes.end(), [](const auto &first, const auto &second) { @@ -399,7 +399,10 @@ void TwitchMessageBuilder::addWords( for (auto &variant : getApp()->emotes->emojis.parse(preText)) { boost::apply_visitor( - [&](auto &&arg) { this->addTextOrEmoji(arg); }, variant); + [&](auto &&arg) { + this->addTextOrEmoji(arg); + }, + variant); } cursor += preText.size(); @@ -415,8 +418,11 @@ void TwitchMessageBuilder::addWords( // split words for (auto &variant : getApp()->emotes->emojis.parse(word)) { - boost::apply_visitor([&](auto &&arg) { this->addTextOrEmoji(arg); }, - variant); + boost::apply_visitor( + [&](auto &&arg) { + this->addTextOrEmoji(arg); + }, + variant); } cursor += word.size() + 1; diff --git a/src/singletons/Emotes.cpp b/src/singletons/Emotes.cpp index 9916d2046..2f211856f 100644 --- a/src/singletons/Emotes.cpp +++ b/src/singletons/Emotes.cpp @@ -11,8 +11,9 @@ Emotes::Emotes() void Emotes::initialize(Settings &settings, Paths &paths) { - getApp()->accounts->twitch.currentUserChanged.connect( - [] { getApp()->accounts->twitch.getCurrent()->loadEmotes(); }); + getApp()->accounts->twitch.currentUserChanged.connect([] { + getApp()->accounts->twitch.getCurrent()->loadEmotes(); + }); this->emojis.load(); diff --git a/src/singletons/Paths.cpp b/src/singletons/Paths.cpp index efbe5a996..06c3caab6 100644 --- a/src/singletons/Paths.cpp +++ b/src/singletons/Paths.cpp @@ -44,7 +44,7 @@ QString Paths::cacheDirectory() QStringSetting cachePathSetting("/cache/path"); cachePathSetting.connect([](const auto &newPath, auto) { - QDir().mkpath(newPath); // + QDir().mkpath(newPath); }); return cachePathSetting; diff --git a/src/singletons/Settings.cpp b/src/singletons/Settings.cpp index f860e06a0..71c152732 100644 --- a/src/singletons/Settings.cpp +++ b/src/singletons/Settings.cpp @@ -125,7 +125,10 @@ Settings::Settings(const QString &settingsDirectory) #ifdef USEWINSDK this->autorun = isRegisteredForStartup(); this->autorun.connect( - [](bool autorun) { setRegisteredForStartup(autorun); }, false); + [](bool autorun) { + setRegisteredForStartup(autorun); + }, + false); #endif } diff --git a/src/singletons/Theme.cpp b/src/singletons/Theme.cpp index 0411e860e..13e01bf87 100644 --- a/src/singletons/Theme.cpp +++ b/src/singletons/Theme.cpp @@ -13,8 +13,16 @@ Theme::Theme() { this->update(); - this->themeName.connectSimple([this](auto) { this->update(); }, false); - this->themeHue.connectSimple([this](auto) { this->update(); }, false); + this->themeName.connectSimple( + [this](auto) { + this->update(); + }, + false); + this->themeHue.connectSimple( + [this](auto) { + this->update(); + }, + false); } // hue: theme color (0 - 1) @@ -60,7 +68,7 @@ void Theme::actuallyUpdate(double hue, double multiplier) this->splits.input.styleSheet = "background:" + this->splits.input.background.name() + ";" + "border:" + this->tabs.selected.backgrounds.regular.color().name() + - ";" + "color:" + this->messages.textColors.regular.name() + ";" + // + ";" + "color:" + this->messages.textColors.regular.name() + ";" + "selection-background-color:" + (isLight ? "#68B1FF" : this->tabs.selected.backgrounds.regular.color().name()); diff --git a/src/singletons/Updates.cpp b/src/singletons/Updates.cpp index b1546cecb..c7026436c 100644 --- a/src/singletons/Updates.cpp +++ b/src/singletons/Updates.cpp @@ -362,7 +362,9 @@ void Updates::setStatus_(Status status) if (this->status_ != status) { this->status_ = status; - postToThread([this, status] { this->statusUpdated.invoke(status); }); + postToThread([this, status] { + this->statusUpdated.invoke(status); + }); } } diff --git a/src/singletons/WindowManager.cpp b/src/singletons/WindowManager.cpp index 168df28c9..cb69e5abe 100644 --- a/src/singletons/WindowManager.cpp +++ b/src/singletons/WindowManager.cpp @@ -100,7 +100,7 @@ WindowManager::WindowManager() this->wordFlagsListener_.addSetting(settings->boldUsernames); this->wordFlagsListener_.addSetting(settings->lowercaseDomains); this->wordFlagsListener_.setCB([this] { - this->updateWordTypeMask(); // + this->updateWordTypeMask(); }); this->saveTimer = new QTimer; @@ -108,13 +108,13 @@ WindowManager::WindowManager() this->saveTimer->setSingleShot(true); QObject::connect(this->saveTimer, &QTimer::timeout, [] { - getApp()->windows->save(); // + getApp()->windows->save(); }); this->miscUpdateTimer_.start(100); QObject::connect(&this->miscUpdateTimer_, &QTimer::timeout, [this] { - this->miscUpdate.invoke(); // + this->miscUpdate.invoke(); }); } @@ -289,8 +289,9 @@ void WindowManager::initialize(Settings &settings, Paths &paths) { assertInGuiThread(); - getApp()->themes->repaintVisibleChatWidgets_.connect( - [this] { this->repaintVisibleChatWidgets(); }); + getApp()->themes->repaintVisibleChatWidgets_.connect([this] { + this->repaintVisibleChatWidgets(); + }); assert(!this->initialized_); @@ -309,22 +310,29 @@ void WindowManager::initialize(Settings &settings, Paths &paths) mainWindow_->getNotebook().addPage(true); } - settings.timestampFormat.connect( - [this](auto, auto) { this->layoutChannelViews(); }); + settings.timestampFormat.connect([this](auto, auto) { + this->layoutChannelViews(); + }); - settings.emoteScale.connect( - [this](auto, auto) { this->forceLayoutChannelViews(); }); + settings.emoteScale.connect([this](auto, auto) { + this->forceLayoutChannelViews(); + }); - settings.timestampFormat.connect( - [this](auto, auto) { this->forceLayoutChannelViews(); }); - settings.alternateMessages.connect( - [this](auto, auto) { this->forceLayoutChannelViews(); }); - settings.separateMessages.connect( - [this](auto, auto) { this->forceLayoutChannelViews(); }); - settings.collpseMessagesMinLines.connect( - [this](auto, auto) { this->forceLayoutChannelViews(); }); - settings.enableRedeemedHighlight.connect( - [this](auto, auto) { this->forceLayoutChannelViews(); }); + settings.timestampFormat.connect([this](auto, auto) { + this->forceLayoutChannelViews(); + }); + settings.alternateMessages.connect([this](auto, auto) { + this->forceLayoutChannelViews(); + }); + settings.separateMessages.connect([this](auto, auto) { + this->forceLayoutChannelViews(); + }); + settings.collpseMessagesMinLines.connect([this](auto, auto) { + this->forceLayoutChannelViews(); + }); + settings.enableRedeemedHighlight.connect([this](auto, auto) { + this->forceLayoutChannelViews(); + }); this->initialized_ = true; } diff --git a/src/util/InitUpdateButton.cpp b/src/util/InitUpdateButton.cpp index 4c1de6b89..a8ff6bc64 100644 --- a/src/util/InitUpdateButton.cpp +++ b/src/util/InitUpdateButton.cpp @@ -58,9 +58,10 @@ void initUpdateButton(Button &button, updateChange(Updates::instance().getStatus()); - signalHolder.managedConnect( - Updates::instance().statusUpdated, - [updateChange](auto status) { updateChange(status); }); + signalHolder.managedConnect(Updates::instance().statusUpdated, + [updateChange](auto status) { + updateChange(status); + }); } } // namespace chatterino diff --git a/src/util/QObjectRef.hpp b/src/util/QObjectRef.hpp index 939f9b7bf..f3a985eea 100644 --- a/src/util/QObjectRef.hpp +++ b/src/util/QObjectRef.hpp @@ -69,7 +69,9 @@ private: // the cast here should absolutely not be necessary, but gcc still requires it this->conn_ = QObject::connect((QObject *)other, &QObject::destroyed, qApp, - [this](QObject *) { this->set(nullptr); }, + [this](QObject *) { + this->set(nullptr); + }, Qt::DirectConnection); } diff --git a/src/util/StreamLink.cpp b/src/util/StreamLink.cpp index 8475dd88f..df582442f 100644 --- a/src/util/StreamLink.cpp +++ b/src/util/StreamLink.cpp @@ -101,7 +101,7 @@ namespace { QObject::connect( p, static_cast(&QProcess::finished), [=](int res) { - p->deleteLater(); // + p->deleteLater(); }); return p; diff --git a/src/widgets/AccountSwitchPopup.cpp b/src/widgets/AccountSwitchPopup.cpp index a836e32ee..e940ef5d3 100644 --- a/src/widgets/AccountSwitchPopup.cpp +++ b/src/widgets/AccountSwitchPopup.cpp @@ -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); diff --git a/src/widgets/BaseWidget.cpp b/src/widgets/BaseWidget.cpp index 871c80f40..cd650afcd 100644 --- a/src/widgets/BaseWidget.cpp +++ b/src/widgets/BaseWidget.cpp @@ -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()) diff --git a/src/widgets/BaseWindow.cpp b/src/widgets/BaseWindow.cpp index 607ef3a0e..4ec3cae43 100644 --- a/src/widgets/BaseWindow.cpp +++ b/src/widgets/BaseWindow.cpp @@ -83,15 +83,17 @@ BaseWindow::BaseWindow(FlagsEnum _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 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()); + }); } } diff --git a/src/widgets/Label.cpp b/src/widgets/Label.cpp index e1a839e03..5b2ab1891 100644 --- a/src/widgets/Label.cpp +++ b/src/widgets/Label.cpp @@ -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 diff --git a/src/widgets/Notebook.cpp b/src/widgets/Notebook.cpp index bfc65d3d2..8c1caa0f7 100644 --- a/src/widgets/Notebook.cpp +++ b/src/widgets/Notebook.cpp @@ -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); diff --git a/src/widgets/TooltipWidget.cpp b/src/widgets/TooltipWidget.cpp index 8f6511092..68c5b31d4 100644 --- a/src/widgets/TooltipWidget.cpp +++ b/src/widgets/TooltipWidget.cpp @@ -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() diff --git a/src/widgets/Window.cpp b/src/widgets/Window.cpp index 511464563..eda642140 100644 --- a/src/widgets/Window.cpp +++ b/src/widgets/Window.cpp @@ -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( @@ -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() diff --git a/src/widgets/dialogs/ChannelFilterEditorDialog.cpp b/src/widgets/dialogs/ChannelFilterEditorDialog.cpp index e0562316a..73b13e813 100644 --- a/src/widgets/dialogs/ChannelFilterEditorDialog.cpp +++ b/src/widgets/dialogs/ChannelFilterEditorDialog.cpp @@ -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::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::of(&QComboBox::currentIndexChanged), [this](int index) { // disable if set to "(nothing)" diff --git a/src/widgets/dialogs/ColorPickerDialog.cpp b/src/widgets/dialogs/ColorPickerDialog.cpp index 6b4a77c7d..89fd7b2e1 100644 --- a/src/widgets/dialogs/ColorPickerDialog.cpp +++ b/src/widgets/dialogs/ColorPickerDialog.cpp @@ -90,11 +90,13 @@ ColorPickerDialog::ColorPickerDialog(const QColor &initial, QWidget *parent) layout.emplace().emplace(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 &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 &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; diff --git a/src/widgets/dialogs/EmotePopup.cpp b/src/widgets/dialogs/EmotePopup.cpp index ca4564d8a..3621eb7c4 100644 --- a/src/widgets/dialogs/EmotePopup.cpp +++ b/src/widgets/dialogs/EmotePopup.cpp @@ -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) diff --git a/src/widgets/dialogs/LastRunCrashDialog.cpp b/src/widgets/dialogs/LastRunCrashDialog.cpp index 1233116f5..0fa5a2f8d 100644 --- a/src/widgets/dialogs/LastRunCrashDialog.cpp +++ b/src/widgets/dialogs/LastRunCrashDialog.cpp @@ -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 { diff --git a/src/widgets/dialogs/LoginDialog.cpp b/src/widgets/dialogs/LoginDialog.cpp index ccd68444c..82737d8a6 100644 --- a/src/widgets/dialogs/LoginDialog.cpp +++ b/src/widgets/dialogs/LoginDialog.cpp @@ -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); diff --git a/src/widgets/dialogs/SelectChannelDialog.cpp b/src/widgets/dialogs/SelectChannelDialog.cpp index f84f33550..4021721cc 100644 --- a/src/widgets/dialogs/SelectChannelDialog.cpp +++ b/src/widgets/dialogs/SelectChannelDialog.cpp @@ -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("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("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().emplace(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(); }); } diff --git a/src/widgets/dialogs/UpdateDialog.cpp b/src/widgets/dialogs/UpdateDialog.cpp index ba40bdaab..872d4b5b5 100644 --- a/src/widgets/dialogs/UpdateDialog.cpp +++ b/src/widgets/dialogs/UpdateDialog.cpp @@ -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); diff --git a/src/widgets/dialogs/UserInfoPopup.cpp b/src/widgets/dialogs/UserInfoPopup.cpp index d9de1ed86..4b39bdd68 100644 --- a/src/widgets/dialogs/UserInfoPopup.cpp +++ b/src/widgets/dialogs/UserInfoPopup.cpp @@ -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(this->getLayoutContainer()) .setLayoutType(); @@ -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> &items) { diff --git a/src/widgets/dialogs/switcher/QuickSwitcherPopup.cpp b/src/widgets/dialogs/switcher/QuickSwitcherPopup.cpp index 9d8c15610..a149a5a0e 100644 --- a/src/widgets/dialogs/switcher/QuickSwitcherPopup.cpp +++ b/src/widgets/dialogs/switcher/QuickSwitcherPopup.cpp @@ -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() diff --git a/src/widgets/helper/Button.cpp b/src/widgets/helper/Button.cpp index 36748417e..12cada4b2 100644 --- a/src/widgets/helper/Button.cpp +++ b/src/widgets/helper/Button.cpp @@ -119,8 +119,9 @@ void Button::setMenu(std::unique_ptr 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; } diff --git a/src/widgets/helper/ChannelView.cpp b/src/widgets/helper/ChannelView.cpp index d65a6c725..686175cef 100644 --- a/src/widgets/helper/ChannelView.cpp +++ b/src/widgets/helper/ChannelView.cpp @@ -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 &messages) { std::vector 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(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] { diff --git a/src/widgets/helper/DebugPopup.cpp b/src/widgets/helper/DebugPopup.cpp index 96adfb795..4eebce0b8 100644 --- a/src/widgets/helper/DebugPopup.cpp +++ b/src/widgets/helper/DebugPopup.cpp @@ -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)); diff --git a/src/widgets/helper/EditableModelView.cpp b/src/widgets/helper/EditableModelView.cpp index 6ffd1bafd..31e376692 100644 --- a/src/widgets/helper/EditableModelView.cpp +++ b/src/widgets/helper/EditableModelView.cpp @@ -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_); diff --git a/src/widgets/helper/NotebookTab.cpp b/src/widgets/helper/NotebookTab.cpp index 282eb2841..43efb3d9b 100644 --- a/src/widgets/helper/NotebookTab.cpp +++ b/src/widgets/helper/NotebookTab.cpp @@ -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 = diff --git a/src/widgets/helper/ResizingTextEdit.cpp b/src/widgets/helper/ResizingTextEdit.cpp index 7d4aad4e9..b89a45f43 100644 --- a/src/widgets/helper/ResizingTextEdit.cpp +++ b/src/widgets/helper/ResizingTextEdit.cpp @@ -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); } diff --git a/src/widgets/helper/SearchPopup.cpp b/src/widgets/helper/SearchPopup.cpp index 8b2a06be8..10fece45a 100644 --- a/src/widgets/helper/SearchPopup.cpp +++ b/src/widgets/helper/SearchPopup.cpp @@ -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); diff --git a/src/widgets/settingspages/ExternalToolsPage.cpp b/src/widgets/settingspages/ExternalToolsPage.cpp index fb6290a1a..3496d906f 100644 --- a/src/widgets/settingspages/ExternalToolsPage.cpp +++ b/src/widgets/settingspages/ExternalToolsPage.cpp @@ -71,7 +71,7 @@ ExternalToolsPage::ExternalToolsPage() getSettings()->streamlinkUseCustomPath.connect( [=](const auto &value, auto) { - customPath->setEnabled(value); // + customPath->setEnabled(value); }, this->managedConnections_); } diff --git a/src/widgets/settingspages/GeneralPage.cpp b/src/widgets/settingspages/GeneralPage.cpp index 8c90609ad..2f22be690 100644 --- a/src/widgets/settingspages/GeneralPage.cpp +++ b/src/widgets/settingspages/GeneralPage.cpp @@ -110,13 +110,22 @@ void GeneralPage::initLayout(GeneralPageView &layout) getApp()->themes->themeName); layout.addDropdown( "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( "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( "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( "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( "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::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(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( "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( "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( "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( "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); diff --git a/src/widgets/settingspages/GeneralPageView.cpp b/src/widgets/settingspages/GeneralPageView.cpp index 6d8439c53..c4eba84b4 100644 --- a/src/widgets/settingspages/GeneralPageView.cpp +++ b/src/widgets/settingspages/GeneralPageView.cpp @@ -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, diff --git a/src/widgets/settingspages/IgnoresPage.cpp b/src/widgets/settingspages/IgnoresPage.cpp index 0e3fe2ad8..d35884980 100644 --- a/src/widgets/settingspages/IgnoresPage.cpp +++ b/src/widgets/settingspages/IgnoresPage.cpp @@ -86,8 +86,9 @@ void addUsersTab(IgnoresPage &page, LayoutCreator 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::of(&QComboBox::currentIndexChanged), diff --git a/src/widgets/settingspages/ModerationPage.cpp b/src/widgets/settingspages/ModerationPage.cpp index 90b8dffe1..56d877ebf 100644 --- a/src/widgets/settingspages/ModerationPage.cpp +++ b/src/widgets/settingspages/ModerationPage.cpp @@ -120,21 +120,23 @@ ModerationPage::ModerationPage() // Show how big (size-wise) the logs are auto logsPathSizeLabel = logs.emplace(); - 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 diff --git a/src/widgets/settingspages/SettingsPage.cpp b/src/widgets/settingspages/SettingsPage.cpp index 78b9d9387..82cf8f89b 100644 --- a/src/widgets/settingspages/SettingsPage.cpp +++ b/src/widgets/settingspages/SettingsPage.cpp @@ -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 &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::of(&QSpinBox::valueChanged), - [&setting](int value) { setting.setValue(value); }); + [&setting](int value) { + setting.setValue(value); + }); return w; } diff --git a/src/widgets/splits/ClosedSplits.cpp b/src/widgets/splits/ClosedSplits.cpp index 79f62c226..6aadb092f 100644 --- a/src/widgets/splits/ClosedSplits.cpp +++ b/src/widgets/splits/ClosedSplits.cpp @@ -8,9 +8,11 @@ std::vector ClosedSplits::closedSplits_; void ClosedSplits::invalidateTab(NotebookTab *const tab) { std::lock_guard 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; diff --git a/src/widgets/splits/EmoteInputPopup.cpp b/src/widgets/splits/EmoteInputPopup.cpp index 7a596e048..2291afe6a 100644 --- a/src/widgets/splits/EmoteInputPopup.cpp +++ b/src/widgets/splits/EmoteInputPopup.cpp @@ -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) diff --git a/src/widgets/splits/Split.cpp b/src/widgets/splits/Split.cpp index 2fc2eb012..e40885e0d 100644 --- a/src/widgets/splits/Split.cpp +++ b/src/widgets/splits/Split.cpp @@ -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()) diff --git a/src/widgets/splits/SplitContainer.cpp b/src/widgets/splits/SplitContainer.cpp index 68e5c7c6f..7305298c9 100644 --- a/src/widgets/splits/SplitContainer.cpp +++ b/src/widgets/splits/SplitContainer.cpp @@ -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; diff --git a/src/widgets/splits/SplitHeader.cpp b/src/widgets/splits/SplitHeader.cpp index b9fe90235..f9bdaa6b5 100644 --- a/src/widgets/splits/SplitHeader.cpp +++ b/src/widgets/splits/SplitHeader.cpp @@ -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({ // space - makeWidget( - [](auto w) { w->setScaleIndependantSize(8, 4); }), + makeWidget([](auto w) { + w->setScaleIndependantSize(8, 4); + }), // title this->titleLabel_ = makeWidget