From 1a7a5409ab11e2810fa0441a6a137290bbc5cd96 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Fri, 10 May 2019 23:31:10 +0200 Subject: [PATCH] do a full reformat according to our current .clang-format --- .../notifications/NotificationController.cpp | 8 +++--- src/messages/MessageBuilder.cpp | 11 ++++---- src/messages/layouts/MessageLayout.cpp | 2 +- src/providers/LinkResolver.cpp | 3 ++- src/providers/twitch/TwitchMessageBuilder.cpp | 7 ++--- src/singletons/Theme.cpp | 17 +++++------- src/singletons/Toasts.cpp | 6 +++-- src/singletons/helper/LoggingChannel.cpp | 5 ++-- src/widgets/Notebook.cpp | 2 +- src/widgets/dialogs/UserInfoPopup.cpp | 8 +++--- src/widgets/helper/SearchPopup.cpp | 3 ++- src/widgets/settingspages/GeneralPage.cpp | 3 ++- .../settingspages/KeyboardSettingsPage.cpp | 3 ++- src/widgets/settingspages/ModerationPage.cpp | 27 +++++++++---------- 14 files changed, 54 insertions(+), 51 deletions(-) diff --git a/src/controllers/notifications/NotificationController.cpp b/src/controllers/notifications/NotificationController.cpp index 435fb8fa1..081084fba 100644 --- a/src/controllers/notifications/NotificationController.cpp +++ b/src/controllers/notifications/NotificationController.cpp @@ -103,9 +103,11 @@ void NotificationController::playSound() static auto player = new QMediaPlayer; static QUrl currentPlayerUrl; - QUrl highlightSoundUrl = getSettings()->notificationCustomSound - ? QUrl::fromLocalFile(getSettings()->notificationPathSound.getValue()) - : QUrl("qrc:/sounds/ping2.wav"); + QUrl highlightSoundUrl = + getSettings()->notificationCustomSound + ? QUrl::fromLocalFile( + getSettings()->notificationPathSound.getValue()) + : QUrl("qrc:/sounds/ping2.wav"); if (currentPlayerUrl != highlightSoundUrl) { diff --git a/src/messages/MessageBuilder.cpp b/src/messages/MessageBuilder.cpp index 3fe89ccf6..d8ca5c444 100644 --- a/src/messages/MessageBuilder.cpp +++ b/src/messages/MessageBuilder.cpp @@ -235,12 +235,11 @@ MessageBuilder::MessageBuilder(const UnbanAction &action) this->message().timeoutUser = action.target.name; - QString text = QString("%1 %2 %3.") - .arg(action.source.name) - .arg(QString(action.wasBan() - ? "unbanned" - : "untimedout")) - .arg(action.target.name); + QString text = + QString("%1 %2 %3.") + .arg(action.source.name) + .arg(QString(action.wasBan() ? "unbanned" : "untimedout")) + .arg(action.target.name); this->emplace(text, MessageElementFlag::Text, MessageColor::System); diff --git a/src/messages/layouts/MessageLayout.cpp b/src/messages/layouts/MessageLayout.cpp index 831b04135..f1725f080 100644 --- a/src/messages/layouts/MessageLayout.cpp +++ b/src/messages/layouts/MessageLayout.cpp @@ -123,7 +123,7 @@ void MessageLayout::actuallyLayout(int width, MessageElementFlags flags) } if (getSettings()->hideModerationActions && - this->message_->flags.has(MessageFlag::Timeout)) + this->message_->flags.has(MessageFlag::Timeout)) { continue; } diff --git a/src/providers/LinkResolver.cpp b/src/providers/LinkResolver.cpp index 33848e019..7446af98d 100644 --- a/src/providers/LinkResolver.cpp +++ b/src/providers/LinkResolver.cpp @@ -12,7 +12,8 @@ namespace chatterino { void LinkResolver::getLinkInfo( const QString url, std::function successCallback) { - if (!getSettings()->linkInfoTooltip) { + if (!getSettings()->linkInfoTooltip) + { successCallback("No link info loaded", Link(Link::Url, url)); return; } diff --git a/src/providers/twitch/TwitchMessageBuilder.cpp b/src/providers/twitch/TwitchMessageBuilder.cpp index c386d2c8d..a694ad36d 100644 --- a/src/providers/twitch/TwitchMessageBuilder.cpp +++ b/src/providers/twitch/TwitchMessageBuilder.cpp @@ -782,9 +782,10 @@ void TwitchMessageBuilder::parseHighlights(bool isPastMsg) } // update the media player url if necessary - QUrl highlightSoundUrl = getSettings()->customHighlightSound - ? QUrl::fromLocalFile(getSettings()->pathHighlightSound.getValue()) - : QUrl("qrc:/sounds/ping2.wav"); + QUrl highlightSoundUrl = + getSettings()->customHighlightSound + ? QUrl::fromLocalFile(getSettings()->pathHighlightSound.getValue()) + : QUrl("qrc:/sounds/ping2.wav"); if (currentPlayerUrl != highlightSoundUrl) { diff --git a/src/singletons/Theme.cpp b/src/singletons/Theme.cpp index 6fb31e352..b99b42a5d 100644 --- a/src/singletons/Theme.cpp +++ b/src/singletons/Theme.cpp @@ -40,8 +40,7 @@ void Theme::actuallyUpdate(double hue, double multiplier) this->splits.resizeHandleBackground = QColor(0, 148, 255, 0x50); // Highlighted Messages: theme support quick-fix - this->messages.backgrounds.highlighted = - QColor("#BD8489"); + this->messages.backgrounds.highlighted = QColor("#BD8489"); } else { @@ -52,9 +51,7 @@ void Theme::actuallyUpdate(double hue, double multiplier) this->splits.resizeHandleBackground = QColor(0, 148, 255, 0x20); // Highlighted Messages: theme support quick-fix - this->messages.backgrounds.highlighted = - QColor("#4B282C"); - + this->messages.backgrounds.highlighted = QColor("#4B282C"); } this->splits.header.background = getColor(0, sat, flat ? 1 : 0.9); @@ -72,7 +69,7 @@ void Theme::actuallyUpdate(double hue, double multiplier) ";" + "color:" + this->messages.textColors.regular.name() + ";" + // "selection-background-color:" + (isLight ? "#68B1FF" - : this->tabs.selected.backgrounds.regular.color().name()); + : this->tabs.selected.backgrounds.regular.color().name()); this->splits.input.focusedLine = this->tabs.highlighted.line.regular; @@ -83,13 +80,13 @@ void Theme::actuallyUpdate(double hue, double multiplier) this->splits.dropPreviewBorder = QColor(0, 148, 255, 0xff); // Highlighted Messages - // hidden setting from PR #744 - if set it will overwrite theme color (for now!) - //TODO: implement full theme support - if (getSettings()->highlightColor != "") { + // hidden setting from PR #744 - if set it will overwrite theme color + // TODO: implement full theme support + if (getSettings()->highlightColor != "") + { this->messages.backgrounds.highlighted = QColor(getSettings()->highlightColor); } - } void Theme::normalizeColor(QColor &color) diff --git a/src/singletons/Toasts.cpp b/src/singletons/Toasts.cpp index a9dccc614..6b5ba9636 100644 --- a/src/singletons/Toasts.cpp +++ b/src/singletons/Toasts.cpp @@ -115,8 +115,10 @@ public: void toastActivated() const { QString link; - switch (static_cast( - getSettings()->openFromToast.getValue())) + auto toastReaction = + static_cast(getSettings()->openFromToast.getValue()); + + switch (toastReaction) { case ToastReaction::OpenInBrowser: if (platform_ == Platform::Twitch) diff --git a/src/singletons/helper/LoggingChannel.cpp b/src/singletons/helper/LoggingChannel.cpp index c4f7f59c6..82230edcc 100644 --- a/src/singletons/helper/LoggingChannel.cpp +++ b/src/singletons/helper/LoggingChannel.cpp @@ -34,9 +34,8 @@ LoggingChannel::LoggingChannel(const QString &_channelName) this->subDirectory = "Twitch/" + this->subDirectory; getSettings()->logPath.connect([this](const QString &logPath, auto) { - this->baseDirectory = logPath.isEmpty() - ? getPaths()->messageLogDirectory - : logPath; + this->baseDirectory = + logPath.isEmpty() ? getPaths()->messageLogDirectory : logPath; this->openLogFile(); }); } diff --git a/src/widgets/Notebook.cpp b/src/widgets/Notebook.cpp index 88a165afb..416834f70 100644 --- a/src/widgets/Notebook.cpp +++ b/src/widgets/Notebook.cpp @@ -6,11 +6,11 @@ #include "singletons/Theme.hpp" #include "singletons/WindowManager.hpp" #include "util/InitUpdateButton.hpp" +#include "util/Shortcut.hpp" #include "widgets/Window.hpp" #include "widgets/dialogs/SettingsDialog.hpp" #include "widgets/helper/NotebookButton.hpp" #include "widgets/helper/NotebookTab.hpp" -#include "util/Shortcut.hpp" #include "widgets/splits/Split.hpp" #include "widgets/splits/SplitContainer.hpp" diff --git a/src/widgets/dialogs/UserInfoPopup.cpp b/src/widgets/dialogs/UserInfoPopup.cpp index 10ad52fc8..939b85271 100644 --- a/src/widgets/dialogs/UserInfoPopup.cpp +++ b/src/widgets/dialogs/UserInfoPopup.cpp @@ -128,8 +128,8 @@ UserInfoPopup::UserInfoPopup() this->userName_, Qt::CaseInsensitive) == 0; visibilityMod = twitchChannel->isBroadcaster() && !isMyself; - visibilityUnmod = visibilityMod || - (twitchChannel->isMod() && isMyself); + visibilityUnmod = + visibilityMod || (twitchChannel->isMod() && isMyself); } mod->setVisible(visibilityMod); unmod->setVisible(visibilityUnmod); @@ -147,8 +147,8 @@ UserInfoPopup::UserInfoPopup() TwitchChannel *twitchChannel = dynamic_cast(this->channel_.get()); - bool hasModRights = twitchChannel ? twitchChannel->hasModRights() - : false; + bool hasModRights = + twitchChannel ? twitchChannel->hasModRights() : false; lineMod->setVisible(hasModRights); timeout->setVisible(hasModRights); }); diff --git a/src/widgets/helper/SearchPopup.cpp b/src/widgets/helper/SearchPopup.cpp index a1bfdafed..b70afc7b8 100644 --- a/src/widgets/helper/SearchPopup.cpp +++ b/src/widgets/helper/SearchPopup.cpp @@ -27,7 +27,8 @@ void SearchPopup::setChannel(ChannelPtr channel) void SearchPopup::keyPressEvent(QKeyEvent *e) { - if (e->key() == Qt::Key_Escape) { + if (e->key() == Qt::Key_Escape) + { this->close(); return; } diff --git a/src/widgets/settingspages/GeneralPage.cpp b/src/widgets/settingspages/GeneralPage.cpp index 76e0deaec..2767bda8d 100644 --- a/src/widgets/settingspages/GeneralPage.cpp +++ b/src/widgets/settingspages/GeneralPage.cpp @@ -258,7 +258,8 @@ void GeneralPage::initLayout(SettingsLayout &layout) layout.addCheckbox("Lowercase domains", s.lowercaseDomains); layout.addCheckbox("Bold @usernames", s.boldUsernames); layout.addDropdown( - "Username font weight", {"0", "25", "Default", "75", "100"}, s.boldScale, + "Username font weight", {"0", "25", "Default", "75", "100"}, + s.boldScale, [](auto val) { if (val == 50) return QString("Default"); diff --git a/src/widgets/settingspages/KeyboardSettingsPage.cpp b/src/widgets/settingspages/KeyboardSettingsPage.cpp index f8512d23b..580848b34 100644 --- a/src/widgets/settingspages/KeyboardSettingsPage.cpp +++ b/src/widgets/settingspages/KeyboardSettingsPage.cpp @@ -43,7 +43,8 @@ KeyboardSettingsPage::KeyboardSettingsPage() new QLabel("Search in current channel")); form->addRow(new QLabel("Ctrl + E"), new QLabel("Open Emote menu")); form->addRow(new QLabel("Ctrl + P"), new QLabel("Open Settings menu")); - form->addRow(new QLabel("F5"), new QLabel("Reload subscriber and channel emotes")); + form->addRow(new QLabel("F5"), + new QLabel("Reload subscriber and channel emotes")); } } // namespace chatterino diff --git a/src/widgets/settingspages/ModerationPage.cpp b/src/widgets/settingspages/ModerationPage.cpp index 02580ebeb..38f0944c1 100644 --- a/src/widgets/settingspages/ModerationPage.cpp +++ b/src/widgets/settingspages/ModerationPage.cpp @@ -62,8 +62,8 @@ QString formatSize(qint64 size) QString fetchLogDirectorySize() { QString logPathDirectory = getSettings()->logPath.getValue().isEmpty() - ? getPaths()->messageLogDirectory - : getSettings()->logPath; + ? getPaths()->messageLogDirectory + : getSettings()->logPath; qint64 logsSize = dirSize(logPathDirectory); QString logsSizeLabel = "Your logs currently take up "; @@ -91,20 +91,19 @@ ModerationPage::ModerationPage() QtConcurrent::run([] { return fetchLogDirectorySize(); })); // Logs (copied from LoggingMananger) - getSettings()->logPath.connect( - [logsPathLabel](const QString &logPath, auto) mutable { - QString pathOriginal = logPath.isEmpty() - ? getPaths()->messageLogDirectory - : logPath; + getSettings()->logPath.connect([logsPathLabel](const QString &logPath, + auto) mutable { + QString pathOriginal = + logPath.isEmpty() ? getPaths()->messageLogDirectory : logPath; - QString pathShortened = - "Logs are saved at " + - shortenString(pathOriginal, 50) + ""; + QString pathShortened = + "Logs are saved at " + + shortenString(pathOriginal, 50) + ""; - logsPathLabel->setText(pathShortened); - logsPathLabel->setToolTip(pathOriginal); - }); + logsPathLabel->setText(pathShortened); + logsPathLabel->setToolTip(pathOriginal); + }); logsPathLabel->setTextFormat(Qt::RichText); logsPathLabel->setTextInteractionFlags(Qt::TextBrowserInteraction |