From e757a6504b69bed90e846c85422a701de6001acb Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Tue, 3 Jul 2018 15:19:49 +0000 Subject: [PATCH] Run clang-format-all.sh --- .../commands/CommandController.cpp | 8 +++--- src/providers/bttv/BttvEmotes.cpp | 25 ++++++++----------- src/providers/emoji/Emojis.cpp | 4 +-- src/providers/twitch/IrcMessageHandler.cpp | 19 ++++++++++---- src/providers/twitch/TwitchServer.cpp | 6 ++--- src/singletons/Paths.cpp | 1 - src/widgets/TooltipWidget.cpp | 3 +-- src/widgets/dialogs/UserInfoPopup.cpp | 21 ++++++++++------ src/widgets/helper/NotebookTab.cpp | 4 +-- src/widgets/helper/ResizingTextEdit.cpp | 3 +-- src/widgets/settingspages/AppearancePage.cpp | 7 ++---- src/widgets/splits/SplitContainer.cpp | 6 ++--- 12 files changed, 55 insertions(+), 52 deletions(-) diff --git a/src/controllers/commands/CommandController.cpp b/src/controllers/commands/CommandController.cpp index e6f12c52e..0421d763f 100644 --- a/src/controllers/commands/CommandController.cpp +++ b/src/controllers/commands/CommandController.cpp @@ -171,8 +171,8 @@ QString CommandController::execCommand(const QString &text, ChannelPtr channel, auto target = words.at(1); if (user->isAnon()) { - channel->addMessage(Message::createSystemMessage( - "You must be logged in to ignore someone")); + channel->addMessage( + Message::createSystemMessage("You must be logged in to ignore someone")); return ""; } @@ -188,8 +188,8 @@ QString CommandController::execCommand(const QString &text, ChannelPtr channel, auto target = words.at(1); if (user->isAnon()) { - channel->addMessage(Message::createSystemMessage( - "You must be logged in to ignore someone")); + channel->addMessage( + Message::createSystemMessage("You must be logged in to ignore someone")); return ""; } diff --git a/src/providers/bttv/BttvEmotes.cpp b/src/providers/bttv/BttvEmotes.cpp index ba44459b7..5780da47a 100644 --- a/src/providers/bttv/BttvEmotes.cpp +++ b/src/providers/bttv/BttvEmotes.cpp @@ -37,11 +37,11 @@ void BTTVEmotes::loadGlobalEmotes() EmoteData emoteData; emoteData.image1x = new Image(getEmoteLink(urlTemplate, id, "1x"), 1, code, - code + "
Global BTTV Emote"); - emoteData.image2x = new Image(getEmoteLink(urlTemplate, id, "2x"), 0.5, - code, code + "
Global BTTV Emote"); - emoteData.image3x = new Image(getEmoteLink(urlTemplate, id, "3x"), 0.25, - code, code + "
Global BTTV Emote"); + code + "
Global BTTV Emote"); + emoteData.image2x = new Image(getEmoteLink(urlTemplate, id, "2x"), 0.5, code, + code + "
Global BTTV Emote"); + emoteData.image3x = new Image(getEmoteLink(urlTemplate, id, "3x"), 0.25, code, + code + "
Global BTTV Emote"); emoteData.pageLink = "https://manage.betterttv.net/emotes/" + id; this->globalEmotes.insert(code, emoteData); @@ -89,19 +89,16 @@ void BTTVEmotes::loadChannelEmotes(const QString &channelName, std::weak_ptrChannel BTTV Emote"); + emoteData.image1x = new Image(link.replace("{{id}}", id).replace("{{image}}", "1x"), + 1, code, code + "
Channel BTTV Emote"); link = linkTemplate; link.detach(); - emoteData.image2x = - new Image(link.replace("{{id}}", id).replace("{{image}}", "2x"), - 0.5, code, code + "
Channel BTTV Emote"); + emoteData.image2x = new Image(link.replace("{{id}}", id).replace("{{image}}", "2x"), + 0.5, code, code + "
Channel BTTV Emote"); link = linkTemplate; link.detach(); - emoteData.image3x = - new Image(link.replace("{{id}}", id).replace("{{image}}", "3x"), - 0.25, code, code + "
Channel BTTV Emote"); + emoteData.image3x = new Image(link.replace("{{id}}", id).replace("{{image}}", "3x"), + 0.25, code, code + "
Channel BTTV Emote"); emoteData.pageLink = "https://manage.betterttv.net/emotes/" + id; return emoteData; diff --git a/src/providers/emoji/Emojis.cpp b/src/providers/emoji/Emojis.cpp index 1e57cd60b..277ba614c 100644 --- a/src/providers/emoji/Emojis.cpp +++ b/src/providers/emoji/Emojis.cpp @@ -260,8 +260,8 @@ void Emojis::loadEmojiSet() urlPrefix = it->second; } QString url = urlPrefix + code + ".png"; - emoji->emoteData.image1x = new Image( - url, 0.35, emoji->value, ":" + emoji->shortCodes[0] + ":
Emoji"); + emoji->emoteData.image1x = + new Image(url, 0.35, emoji->value, ":" + emoji->shortCodes[0] + ":
Emoji"); }); }); } diff --git a/src/providers/twitch/IrcMessageHandler.cpp b/src/providers/twitch/IrcMessageHandler.cpp index 9d1ea0d5e..904c772c8 100644 --- a/src/providers/twitch/IrcMessageHandler.cpp +++ b/src/providers/twitch/IrcMessageHandler.cpp @@ -253,8 +253,7 @@ void IrcMessageHandler::handleUserNoticeMessage(Communi::IrcMessage *message, Tw auto it = tags.find("system-msg"); if (it != tags.end()) { - auto newMessage = - Message::createSystemMessage(parseTagString(it.value().toString())); + auto newMessage = Message::createSystemMessage(parseTagString(it.value().toString())); newMessage->flags |= Message::Subscription; @@ -322,12 +321,22 @@ void IrcMessageHandler::handleNoticeMessage(Communi::IrcNoticeMessage *message) void IrcMessageHandler::handleWriteConnectionNoticeMessage(Communi::IrcNoticeMessage *message) { static std::unordered_set readConnectionOnlyIDs{ - "host_on", "host_off", "host_target_went_offline", "emote_only_on", "emote_only_off", - "slow_on", "slow_off", "subs_on", "subs_off", "r9k_on", "r9k_off", + "host_on", + "host_off", + "host_target_went_offline", + "emote_only_on", + "emote_only_off", + "slow_on", + "slow_off", + "subs_on", + "subs_off", + "r9k_on", + "r9k_off", // Display for user who times someone out. This implies you're a moderator, at which point // you will be connected to PubSub and receive a better message from there - "timeout_success", "ban_success", + "timeout_success", + "ban_success", }; QVariant v = message->tag("msg-id"); diff --git a/src/providers/twitch/TwitchServer.cpp b/src/providers/twitch/TwitchServer.cpp index e16c7760c..986981648 100644 --- a/src/providers/twitch/TwitchServer.cpp +++ b/src/providers/twitch/TwitchServer.cpp @@ -194,8 +194,7 @@ void TwitchServer::onMessageSendRequested(TwitchChannel *channel, const QString // check if you are sending messages too fast if (!lastMessage.empty() && lastMessage.back() + minMessageOffset > now) { if (this->lastErrorTimeSpeed_ + 30s < now) { - auto errorMessage = - Message::createSystemMessage("sending messages too fast"); + auto errorMessage = Message::createSystemMessage("sending messages too fast"); channel->addMessage(errorMessage); @@ -212,8 +211,7 @@ void TwitchServer::onMessageSendRequested(TwitchChannel *channel, const QString // check if you are sending too many messages if (lastMessage.size() >= maxMessageCount) { if (this->lastErrorTimeAmount_ + 30s < now) { - auto errorMessage = - Message::createSystemMessage("sending too many messages"); + auto errorMessage = Message::createSystemMessage("sending too many messages"); channel->addMessage(errorMessage); diff --git a/src/singletons/Paths.cpp b/src/singletons/Paths.cpp index 8df1bd4f6..4fee851b6 100644 --- a/src/singletons/Paths.cpp +++ b/src/singletons/Paths.cpp @@ -98,7 +98,6 @@ void Paths::initSubDirectories() // create settings subdirectories and validate that they are created properly auto makePath = [&](const std::string &name) -> QString { - auto path = combinePath(this->rootAppDataDirectory, QString::fromStdString(name)); if (!QDir().mkpath(path)) { diff --git a/src/widgets/TooltipWidget.cpp b/src/widgets/TooltipWidget.cpp index a371f25bd..310eccc11 100644 --- a/src/widgets/TooltipWidget.cpp +++ b/src/widgets/TooltipWidget.cpp @@ -76,8 +76,7 @@ void TooltipWidget::updateFont() { auto app = getApp(); - this->setFont( - app->fonts->getFont(Fonts::Type::ChatMediumSmall, this->getScale())); + this->setFont(app->fonts->getFont(Fonts::Type::ChatMediumSmall, this->getScale())); } void TooltipWidget::setText(QString text) diff --git a/src/widgets/dialogs/UserInfoPopup.cpp b/src/widgets/dialogs/UserInfoPopup.cpp index 1165f3f17..b626d0012 100644 --- a/src/widgets/dialogs/UserInfoPopup.cpp +++ b/src/widgets/dialogs/UserInfoPopup.cpp @@ -364,9 +364,11 @@ UserInfoPopup::TimeoutWidget::TimeoutWidget() } a->setBorderColor(color1); - QObject::connect(a.getElement(), &RippleEffectLabel2::clicked, [ - this, timeout = std::get<1>(item) - ] { this->buttonClicked.invoke(std::make_pair(Action::Timeout, timeout)); }); + QObject::connect( + a.getElement(), &RippleEffectLabel2::clicked, + [this, timeout = std::get<1>(item)] { + this->buttonClicked.invoke(std::make_pair(Action::Timeout, timeout)); + }); } } }; @@ -375,16 +377,21 @@ UserInfoPopup::TimeoutWidget::TimeoutWidget() addTimeouts("sec", {{"1", 1}}); addTimeouts("min", { - {"1", 1 * 60}, {"5", 5 * 60}, {"10", 10 * 60}, + {"1", 1 * 60}, + {"5", 5 * 60}, + {"10", 10 * 60}, }); addTimeouts("hour", { - {"1", 1 * 60 * 60}, {"4", 4 * 60 * 60}, + {"1", 1 * 60 * 60}, + {"4", 4 * 60 * 60}, }); addTimeouts("days", { - {"1", 1 * 60 * 60 * 24}, {"3", 3 * 60 * 60 * 24}, + {"1", 1 * 60 * 60 * 24}, + {"3", 3 * 60 * 60 * 24}, }); addTimeouts("weeks", { - {"1", 1 * 60 * 60 * 24 * 7}, {"2", 2 * 60 * 60 * 24 * 7}, + {"1", 1 * 60 * 60 * 24 * 7}, + {"2", 2 * 60 * 60 * 24 * 7}, }); addButton(Ban, "ban", getApp()->resources->buttons.ban); diff --git a/src/widgets/helper/NotebookTab.cpp b/src/widgets/helper/NotebookTab.cpp index d14da7ae4..9efb54e60 100644 --- a/src/widgets/helper/NotebookTab.cpp +++ b/src/widgets/helper/NotebookTab.cpp @@ -238,8 +238,8 @@ void NotebookTab::paintEvent(QPaintEvent *) // || SettingsDialog::getHandle() == QApplication::activeWindow(); QBrush tabBackground = /*this->mouseOver_ ? colors.backgrounds.hover - :*/ (windowFocused ? colors.backgrounds.regular - : colors.backgrounds.unfocused); + :*/ + (windowFocused ? colors.backgrounds.regular : colors.backgrounds.unfocused); // painter.fillRect(rect(), this->mouseOver_ ? regular.backgrounds.hover // : (windowFocused ? regular.backgrounds.regular diff --git a/src/widgets/helper/ResizingTextEdit.cpp b/src/widgets/helper/ResizingTextEdit.cpp index 07544c72b..2bfc7ff04 100644 --- a/src/widgets/helper/ResizingTextEdit.cpp +++ b/src/widgets/helper/ResizingTextEdit.cpp @@ -93,8 +93,7 @@ void ResizingTextEdit::keyPressEvent(QKeyEvent *event) return; } - auto *completionModel = - static_cast(this->completer->model()); + auto *completionModel = static_cast(this->completer->model()); if (!this->completionInProgress) { // First type pressing tab after modifying a message, we refresh our completion model diff --git a/src/widgets/settingspages/AppearancePage.cpp b/src/widgets/settingspages/AppearancePage.cpp index e31401d05..7965b717e 100644 --- a/src/widgets/settingspages/AppearancePage.cpp +++ b/src/widgets/settingspages/AppearancePage.cpp @@ -252,8 +252,7 @@ QLayout *AppearancePage::createUiScaleSlider() slider->setMinimum(WindowManager::uiScaleMin); slider->setMaximum(WindowManager::uiScaleMax); - slider->setValue( - WindowManager::clampUiScale(getApp()->settings->uiScale.getValue())); + slider->setValue(WindowManager::clampUiScale(getApp()->settings->uiScale.getValue())); label->setMinimumWidth(100); @@ -261,9 +260,7 @@ QLayout *AppearancePage::createUiScaleSlider() [](auto value) { getApp()->settings->uiScale.setValue(value); }); getApp()->settings->uiScale.connect( - [label](auto, auto) { - label->setText(QString::number(WindowManager::getUiScaleValue())); - }, + [label](auto, auto) { label->setText(QString::number(WindowManager::getUiScaleValue())); }, this->connections_); return layout; diff --git a/src/widgets/splits/SplitContainer.cpp b/src/widgets/splits/SplitContainer.cpp index ceef09ee0..6a250204d 100644 --- a/src/widgets/splits/SplitContainer.cpp +++ b/src/widgets/splits/SplitContainer.cpp @@ -581,8 +581,7 @@ void SplitContainer::decodeNodeRecusively(QJsonObject &obj, Node *node) auto _type = _obj.value("type"); if (_type == "split") { auto *split = new Split(this); - split->setChannel( - WindowManager::decodeChannel(_obj.value("data").toObject())); + split->setChannel(WindowManager::decodeChannel(_obj.value("data").toObject())); Node *_node = new Node(); _node->parent = node; @@ -605,8 +604,7 @@ void SplitContainer::decodeNodeRecusively(QJsonObject &obj, Node *node) for (int i = 0; i < 2; i++) { if (node->getChildren().size() < 2) { auto *split = new Split(this); - split->setChannel( - WindowManager::decodeChannel(obj.value("data").toObject())); + split->setChannel(WindowManager::decodeChannel(obj.value("data").toObject())); this->insertSplit(split, direction, node); }