do a full reformat according to our current .clang-format

This commit is contained in:
Rasmus Karlsson 2019-05-10 23:31:10 +02:00
parent fa6c9f2fba
commit 1a7a5409ab
14 changed files with 54 additions and 51 deletions

View file

@ -103,9 +103,11 @@ void NotificationController::playSound()
static auto player = new QMediaPlayer; static auto player = new QMediaPlayer;
static QUrl currentPlayerUrl; static QUrl currentPlayerUrl;
QUrl highlightSoundUrl = getSettings()->notificationCustomSound QUrl highlightSoundUrl =
? QUrl::fromLocalFile(getSettings()->notificationPathSound.getValue()) getSettings()->notificationCustomSound
: QUrl("qrc:/sounds/ping2.wav"); ? QUrl::fromLocalFile(
getSettings()->notificationPathSound.getValue())
: QUrl("qrc:/sounds/ping2.wav");
if (currentPlayerUrl != highlightSoundUrl) if (currentPlayerUrl != highlightSoundUrl)
{ {

View file

@ -235,12 +235,11 @@ MessageBuilder::MessageBuilder(const UnbanAction &action)
this->message().timeoutUser = action.target.name; this->message().timeoutUser = action.target.name;
QString text = QString("%1 %2 %3.") QString text =
.arg(action.source.name) QString("%1 %2 %3.")
.arg(QString(action.wasBan() .arg(action.source.name)
? "unbanned" .arg(QString(action.wasBan() ? "unbanned" : "untimedout"))
: "untimedout")) .arg(action.target.name);
.arg(action.target.name);
this->emplace<TextElement>(text, MessageElementFlag::Text, this->emplace<TextElement>(text, MessageElementFlag::Text,
MessageColor::System); MessageColor::System);

View file

@ -123,7 +123,7 @@ void MessageLayout::actuallyLayout(int width, MessageElementFlags flags)
} }
if (getSettings()->hideModerationActions && if (getSettings()->hideModerationActions &&
this->message_->flags.has(MessageFlag::Timeout)) this->message_->flags.has(MessageFlag::Timeout))
{ {
continue; continue;
} }

View file

@ -12,7 +12,8 @@ namespace chatterino {
void LinkResolver::getLinkInfo( void LinkResolver::getLinkInfo(
const QString url, std::function<void(QString, Link)> successCallback) const QString url, std::function<void(QString, Link)> successCallback)
{ {
if (!getSettings()->linkInfoTooltip) { if (!getSettings()->linkInfoTooltip)
{
successCallback("No link info loaded", Link(Link::Url, url)); successCallback("No link info loaded", Link(Link::Url, url));
return; return;
} }

View file

@ -782,9 +782,10 @@ void TwitchMessageBuilder::parseHighlights(bool isPastMsg)
} }
// update the media player url if necessary // update the media player url if necessary
QUrl highlightSoundUrl = getSettings()->customHighlightSound QUrl highlightSoundUrl =
? QUrl::fromLocalFile(getSettings()->pathHighlightSound.getValue()) getSettings()->customHighlightSound
: QUrl("qrc:/sounds/ping2.wav"); ? QUrl::fromLocalFile(getSettings()->pathHighlightSound.getValue())
: QUrl("qrc:/sounds/ping2.wav");
if (currentPlayerUrl != highlightSoundUrl) if (currentPlayerUrl != highlightSoundUrl)
{ {

View file

@ -40,8 +40,7 @@ void Theme::actuallyUpdate(double hue, double multiplier)
this->splits.resizeHandleBackground = QColor(0, 148, 255, 0x50); this->splits.resizeHandleBackground = QColor(0, 148, 255, 0x50);
// Highlighted Messages: theme support quick-fix // Highlighted Messages: theme support quick-fix
this->messages.backgrounds.highlighted = this->messages.backgrounds.highlighted = QColor("#BD8489");
QColor("#BD8489");
} }
else else
{ {
@ -52,9 +51,7 @@ void Theme::actuallyUpdate(double hue, double multiplier)
this->splits.resizeHandleBackground = QColor(0, 148, 255, 0x20); this->splits.resizeHandleBackground = QColor(0, 148, 255, 0x20);
// Highlighted Messages: theme support quick-fix // Highlighted Messages: theme support quick-fix
this->messages.backgrounds.highlighted = this->messages.backgrounds.highlighted = QColor("#4B282C");
QColor("#4B282C");
} }
this->splits.header.background = getColor(0, sat, flat ? 1 : 0.9); 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() + ";" + // ";" + "color:" + this->messages.textColors.regular.name() + ";" + //
"selection-background-color:" + "selection-background-color:" +
(isLight ? "#68B1FF" (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; 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); this->splits.dropPreviewBorder = QColor(0, 148, 255, 0xff);
// Highlighted Messages // Highlighted Messages
// hidden setting from PR #744 - if set it will overwrite theme color (for now!) // hidden setting from PR #744 - if set it will overwrite theme color
//TODO: implement full theme support // TODO: implement full theme support
if (getSettings()->highlightColor != "") { if (getSettings()->highlightColor != "")
{
this->messages.backgrounds.highlighted = this->messages.backgrounds.highlighted =
QColor(getSettings()->highlightColor); QColor(getSettings()->highlightColor);
} }
} }
void Theme::normalizeColor(QColor &color) void Theme::normalizeColor(QColor &color)

View file

@ -115,8 +115,10 @@ public:
void toastActivated() const void toastActivated() const
{ {
QString link; QString link;
switch (static_cast<ToastReaction>( auto toastReaction =
getSettings()->openFromToast.getValue())) static_cast<ToastReaction>(getSettings()->openFromToast.getValue());
switch (toastReaction)
{ {
case ToastReaction::OpenInBrowser: case ToastReaction::OpenInBrowser:
if (platform_ == Platform::Twitch) if (platform_ == Platform::Twitch)

View file

@ -34,9 +34,8 @@ LoggingChannel::LoggingChannel(const QString &_channelName)
this->subDirectory = "Twitch/" + this->subDirectory; this->subDirectory = "Twitch/" + this->subDirectory;
getSettings()->logPath.connect([this](const QString &logPath, auto) { getSettings()->logPath.connect([this](const QString &logPath, auto) {
this->baseDirectory = logPath.isEmpty() this->baseDirectory =
? getPaths()->messageLogDirectory logPath.isEmpty() ? getPaths()->messageLogDirectory : logPath;
: logPath;
this->openLogFile(); this->openLogFile();
}); });
} }

View file

@ -6,11 +6,11 @@
#include "singletons/Theme.hpp" #include "singletons/Theme.hpp"
#include "singletons/WindowManager.hpp" #include "singletons/WindowManager.hpp"
#include "util/InitUpdateButton.hpp" #include "util/InitUpdateButton.hpp"
#include "util/Shortcut.hpp"
#include "widgets/Window.hpp" #include "widgets/Window.hpp"
#include "widgets/dialogs/SettingsDialog.hpp" #include "widgets/dialogs/SettingsDialog.hpp"
#include "widgets/helper/NotebookButton.hpp" #include "widgets/helper/NotebookButton.hpp"
#include "widgets/helper/NotebookTab.hpp" #include "widgets/helper/NotebookTab.hpp"
#include "util/Shortcut.hpp"
#include "widgets/splits/Split.hpp" #include "widgets/splits/Split.hpp"
#include "widgets/splits/SplitContainer.hpp" #include "widgets/splits/SplitContainer.hpp"

View file

@ -128,8 +128,8 @@ UserInfoPopup::UserInfoPopup()
this->userName_, Qt::CaseInsensitive) == 0; this->userName_, Qt::CaseInsensitive) == 0;
visibilityMod = twitchChannel->isBroadcaster() && !isMyself; visibilityMod = twitchChannel->isBroadcaster() && !isMyself;
visibilityUnmod = visibilityMod || visibilityUnmod =
(twitchChannel->isMod() && isMyself); visibilityMod || (twitchChannel->isMod() && isMyself);
} }
mod->setVisible(visibilityMod); mod->setVisible(visibilityMod);
unmod->setVisible(visibilityUnmod); unmod->setVisible(visibilityUnmod);
@ -147,8 +147,8 @@ UserInfoPopup::UserInfoPopup()
TwitchChannel *twitchChannel = TwitchChannel *twitchChannel =
dynamic_cast<TwitchChannel *>(this->channel_.get()); dynamic_cast<TwitchChannel *>(this->channel_.get());
bool hasModRights = twitchChannel ? twitchChannel->hasModRights() bool hasModRights =
: false; twitchChannel ? twitchChannel->hasModRights() : false;
lineMod->setVisible(hasModRights); lineMod->setVisible(hasModRights);
timeout->setVisible(hasModRights); timeout->setVisible(hasModRights);
}); });

View file

@ -27,7 +27,8 @@ void SearchPopup::setChannel(ChannelPtr channel)
void SearchPopup::keyPressEvent(QKeyEvent *e) void SearchPopup::keyPressEvent(QKeyEvent *e)
{ {
if (e->key() == Qt::Key_Escape) { if (e->key() == Qt::Key_Escape)
{
this->close(); this->close();
return; return;
} }

View file

@ -258,7 +258,8 @@ void GeneralPage::initLayout(SettingsLayout &layout)
layout.addCheckbox("Lowercase domains", s.lowercaseDomains); layout.addCheckbox("Lowercase domains", s.lowercaseDomains);
layout.addCheckbox("Bold @usernames", s.boldUsernames); layout.addCheckbox("Bold @usernames", s.boldUsernames);
layout.addDropdown<float>( layout.addDropdown<float>(
"Username font weight", {"0", "25", "Default", "75", "100"}, s.boldScale, "Username font weight", {"0", "25", "Default", "75", "100"},
s.boldScale,
[](auto val) { [](auto val) {
if (val == 50) if (val == 50)
return QString("Default"); return QString("Default");

View file

@ -43,7 +43,8 @@ KeyboardSettingsPage::KeyboardSettingsPage()
new QLabel("Search in current channel")); new QLabel("Search in current channel"));
form->addRow(new QLabel("Ctrl + E"), new QLabel("Open Emote menu")); 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("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 } // namespace chatterino

View file

@ -62,8 +62,8 @@ QString formatSize(qint64 size)
QString fetchLogDirectorySize() QString fetchLogDirectorySize()
{ {
QString logPathDirectory = getSettings()->logPath.getValue().isEmpty() QString logPathDirectory = getSettings()->logPath.getValue().isEmpty()
? getPaths()->messageLogDirectory ? getPaths()->messageLogDirectory
: getSettings()->logPath; : getSettings()->logPath;
qint64 logsSize = dirSize(logPathDirectory); qint64 logsSize = dirSize(logPathDirectory);
QString logsSizeLabel = "Your logs currently take up "; QString logsSizeLabel = "Your logs currently take up ";
@ -91,20 +91,19 @@ ModerationPage::ModerationPage()
QtConcurrent::run([] { return fetchLogDirectorySize(); })); QtConcurrent::run([] { return fetchLogDirectorySize(); }));
// Logs (copied from LoggingMananger) // Logs (copied from LoggingMananger)
getSettings()->logPath.connect( getSettings()->logPath.connect([logsPathLabel](const QString &logPath,
[logsPathLabel](const QString &logPath, auto) mutable { auto) mutable {
QString pathOriginal = logPath.isEmpty() QString pathOriginal =
? getPaths()->messageLogDirectory logPath.isEmpty() ? getPaths()->messageLogDirectory : logPath;
: logPath;
QString pathShortened = QString pathShortened =
"Logs are saved at <a href=\"file:///" + pathOriginal + "Logs are saved at <a href=\"file:///" + pathOriginal +
"\"><span style=\"color: white;\">" + "\"><span style=\"color: white;\">" +
shortenString(pathOriginal, 50) + "</span></a>"; shortenString(pathOriginal, 50) + "</span></a>";
logsPathLabel->setText(pathShortened); logsPathLabel->setText(pathShortened);
logsPathLabel->setToolTip(pathOriginal); logsPathLabel->setToolTip(pathOriginal);
}); });
logsPathLabel->setTextFormat(Qt::RichText); logsPathLabel->setTextFormat(Qt::RichText);
logsPathLabel->setTextInteractionFlags(Qt::TextBrowserInteraction | logsPathLabel->setTextInteractionFlags(Qt::TextBrowserInteraction |