formatted all files with clang 9

This commit is contained in:
fourtf
2019-09-26 00:51:05 +02:00
parent e47a043a27
commit 9874bd779a
27 changed files with 102 additions and 185 deletions
+2 -4
View File
@@ -297,15 +297,13 @@ void Scrollbar::paintEvent(QPaintEvent *)
switch (highlight.getStyle())
{
case ScrollbarHighlight::Default:
{
case ScrollbarHighlight::Default: {
painter.fillRect(w / 8 * 3, int(y), w / 4, highlightHeight,
color);
}
break;
case ScrollbarHighlight::Line:
{
case ScrollbarHighlight::Line: {
painter.fillRect(0, int(y), w, 1, color);
}
break;
+1 -2
View File
@@ -85,8 +85,7 @@ bool Window::event(QEvent *event)
case QEvent::WindowActivate:
break;
case QEvent::WindowDeactivate:
{
case QEvent::WindowDeactivate: {
auto page = this->notebook_->getOrAddSelectedPage();
if (page != nullptr)
+1 -2
View File
@@ -35,8 +35,7 @@ void NotificationPopup::updatePosition()
switch (location)
{
case BottomRight:
{
case BottomRight: {
this->move(rect.right() - this->width(),
rect.bottom() - this->height());
}
+8 -16
View File
@@ -258,33 +258,28 @@ void SelectChannelDialog::setSelectedChannel(IndirectChannel _channel)
switch (_channel.getType())
{
case Channel::Type::Twitch:
{
case Channel::Type::Twitch: {
this->ui_.notebook->selectIndex(TAB_TWITCH);
this->ui_.twitch.channel->setFocus();
this->ui_.twitch.channelName->setText(channel->getName());
}
break;
case Channel::Type::TwitchWatching:
{
case Channel::Type::TwitchWatching: {
this->ui_.notebook->selectIndex(TAB_TWITCH);
this->ui_.twitch.watching->setFocus();
}
break;
case Channel::Type::TwitchMentions:
{
case Channel::Type::TwitchMentions: {
this->ui_.notebook->selectIndex(TAB_TWITCH);
this->ui_.twitch.mentions->setFocus();
}
break;
case Channel::Type::TwitchWhispers:
{
case Channel::Type::TwitchWhispers: {
this->ui_.notebook->selectIndex(TAB_TWITCH);
this->ui_.twitch.whispers->setFocus();
}
break;
case Channel::Type::Irc:
{
case Channel::Type::Irc: {
this->ui_.notebook->selectIndex(TAB_IRC);
this->ui_.irc.channel->setText(_channel.get()->getName());
@@ -309,8 +304,7 @@ void SelectChannelDialog::setSelectedChannel(IndirectChannel _channel)
this->ui_.irc.channel->setFocus();
}
break;
default:
{
default: {
this->ui_.notebook->selectIndex(TAB_TWITCH);
this->ui_.twitch.channel->setFocus();
}
@@ -330,8 +324,7 @@ IndirectChannel SelectChannelDialog::getSelectedChannel() const
switch (this->ui_.notebook->getSelectedIndex())
{
case TAB_TWITCH:
{
case TAB_TWITCH: {
if (this->ui_.twitch.channel->isChecked())
{
return app->twitch.server->getOrAddChannel(
@@ -351,8 +344,7 @@ IndirectChannel SelectChannelDialog::getSelectedChannel() const
}
}
break;
case TAB_IRC:
{
case TAB_IRC: {
int row = this->ui_.irc.servers->getTableView()
->selectionModel()
->currentIndex()
+5 -10
View File
@@ -48,8 +48,7 @@ void UpdateDialog::updateStatusChanged(Updates::Status status)
switch (status)
{
case Updates::UpdateAvailable:
{
case Updates::UpdateAvailable: {
this->ui_.label->setText(
QString("An update (%1) is available.\n\nDo you want to "
"download and install it?")
@@ -58,28 +57,24 @@ void UpdateDialog::updateStatusChanged(Updates::Status status)
}
break;
case Updates::SearchFailed:
{
case Updates::SearchFailed: {
this->ui_.label->setText("Failed to load version information.");
}
break;
case Updates::Downloading:
{
case Updates::Downloading: {
this->ui_.label->setText(
"Downloading updates.\n\nChatterino will restart "
"automatically when the download is done.");
}
break;
case Updates::DownloadFailed:
{
case Updates::DownloadFailed: {
this->ui_.label->setText("Failed to download the update.");
}
break;
case Updates::WriteFileFailed:
{
case Updates::WriteFileFailed: {
this->ui_.label->setText("Failed to save the update to disk.");
}
break;
+3 -6
View File
@@ -191,16 +191,14 @@ UserInfoPopup::UserInfoPopup()
switch (action)
{
case TimeoutWidget::Ban:
{
case TimeoutWidget::Ban: {
if (this->channel_)
{
this->channel_->sendMessage("/ban " + this->userName_);
}
}
break;
case TimeoutWidget::Unban:
{
case TimeoutWidget::Unban: {
if (this->channel_)
{
this->channel_->sendMessage("/unban " +
@@ -208,8 +206,7 @@ UserInfoPopup::UserInfoPopup()
}
}
break;
case TimeoutWidget::Timeout:
{
case TimeoutWidget::Timeout: {
if (this->channel_)
{
this->channel_->sendMessage("/timeout " +
+9 -18
View File
@@ -1335,8 +1335,7 @@ void ChannelView::mousePressEvent(QMouseEvent *event)
// check if message is collapsed
switch (event->button())
{
case Qt::LeftButton:
{
case Qt::LeftButton: {
this->lastPressPosition_ = event->screenPos();
this->isMouseDown_ = true;
@@ -1354,8 +1353,7 @@ void ChannelView::mousePressEvent(QMouseEvent *event)
}
break;
case Qt::RightButton:
{
case Qt::RightButton: {
this->lastRightPressPosition_ = event->screenPos();
this->isRightMouseDown_ = true;
}
@@ -1473,8 +1471,7 @@ void ChannelView::handleMouseClick(QMouseEvent *event,
{
switch (event->button())
{
case Qt::LeftButton:
{
case Qt::LeftButton: {
if (this->selecting_)
{
// this->pausedBySelection = false;
@@ -1498,8 +1495,7 @@ void ChannelView::handleMouseClick(QMouseEvent *event,
}
}
break;
case Qt::RightButton:
{
case Qt::RightButton: {
auto insertText = [=](QString text) {
if (auto split = dynamic_cast<Split *>(this->parentWidget()))
{
@@ -1714,16 +1710,14 @@ void ChannelView::handleLinkClick(QMouseEvent *event, const Link &link,
switch (link.type)
{
case Link::UserWhisper:
case Link::UserInfo:
{
case Link::UserInfo: {
auto user = link.value;
this->showUserInfoPopup(user);
qDebug() << "Clicked " << user << "s message";
}
break;
case Link::Url:
{
case Link::Url: {
if (getSettings()->openLinksIncognito && supportsIncognitoLinks())
openLinkIncognito(link.value);
else
@@ -1731,8 +1725,7 @@ void ChannelView::handleLinkClick(QMouseEvent *event, const Link &link,
}
break;
case Link::UserAction:
{
case Link::UserAction: {
QString value = link.value;
value.replace("{user}", layout->getMessage()->loginName)
@@ -1744,14 +1737,12 @@ void ChannelView::handleLinkClick(QMouseEvent *event, const Link &link,
}
break;
case Link::AutoModAllow:
{
case Link::AutoModAllow: {
getApp()->accounts->twitch.getCurrent()->autoModAllow(link.value);
}
break;
case Link::AutoModDeny:
{
case Link::AutoModDeny: {
getApp()->accounts->twitch.getCurrent()->autoModDeny(link.value);
}
+3 -6
View File
@@ -62,8 +62,7 @@ void NotebookButton::paintEvent(QPaintEvent *event)
switch (icon_)
{
case Plus:
{
case Plus: {
painter.setPen([&] {
QColor tmp = foreground;
if (SplitContainer::isDraggingSplit)
@@ -90,8 +89,7 @@ void NotebookButton::paintEvent(QPaintEvent *event)
}
break;
case User:
{
case User: {
painter.setRenderHint(QPainter::Antialiasing);
painter.setRenderHint(QPainter::HighQualityAntialiasing);
@@ -111,8 +109,7 @@ void NotebookButton::paintEvent(QPaintEvent *event)
}
break;
case Settings:
{
case Settings: {
painter.setRenderHint(QPainter::Antialiasing);
painter.setRenderHint(QPainter::HighQualityAntialiasing);
+1 -2
View File
@@ -432,8 +432,7 @@ void NotebookTab::mousePressEvent(QMouseEvent *event)
{
switch (event->button())
{
case Qt::RightButton:
{
case Qt::RightButton: {
this->menu_.popup(event->globalPos());
}
break;
+3 -1
View File
@@ -83,7 +83,9 @@ AboutPage::AboutPage()
"chatterino2/commit/" +
version.getCommitHash() + "\">" +
version.getCommitHash() + "</a>")
.arg(Modes::getInstance().isNightly ? ", " + version.getDateOfBuild() : "");
.arg(Modes::getInstance().isNightly
? ", " + version.getDateOfBuild()
: "");
auto versionLabel = versionInfo.emplace<QLabel>(text);
versionLabel->setOpenExternalLinks(true);
+1 -1
View File
@@ -6,8 +6,8 @@
#include "debug/Log.hpp"
#include "providers/twitch/EmoteValue.hpp"
#include "providers/twitch/TwitchChannel.hpp"
#include "providers/twitch/TwitchMessageBuilder.hpp"
#include "providers/twitch/TwitchIrcServer.hpp"
#include "providers/twitch/TwitchMessageBuilder.hpp"
#include "singletons/Settings.hpp"
#include "singletons/Theme.hpp"
#include "singletons/WindowManager.hpp"
+8 -16
View File
@@ -339,15 +339,13 @@ void SplitContainer::focusSplitRecursive(Node *node, Direction direction)
{
switch (node->type_)
{
case Node::_Split:
{
case Node::_Split: {
node->split_->giveFocus(Qt::OtherFocusReason);
}
break;
case Node::HorizontalContainer:
case Node::VerticalContainer:
{
case Node::VerticalContainer: {
auto &children = node->children_;
auto it = std::find_if(
@@ -898,23 +896,19 @@ void SplitContainer::Node::insertSplitRelative(Split *_split,
{
switch (this->type_)
{
case Node::EmptyRoot:
{
case Node::EmptyRoot: {
this->setSplit(_split);
}
break;
case Node::_Split:
{
case Node::_Split: {
this->nestSplitIntoCollection(_split, _direction);
}
break;
case Node::HorizontalContainer:
{
case Node::HorizontalContainer: {
this->nestSplitIntoCollection(_split, _direction);
}
break;
case Node::VerticalContainer:
{
case Node::VerticalContainer: {
this->nestSplitIntoCollection(_split, _direction);
}
break;
@@ -1110,16 +1104,14 @@ void SplitContainer::Node::layout(bool addSpacing, float _scale,
switch (this->type_)
{
case Node::_Split:
{
case Node::_Split: {
QRect rect = this->geometry_.toRect();
this->split_->setGeometry(
rect.marginsRemoved(QMargins(1, 1, 0, 0)));
}
break;
case Node::VerticalContainer:
case Node::HorizontalContainer:
{
case Node::HorizontalContainer: {
bool isVertical = this->type_ == Node::VerticalContainer;
// vars
+3 -7
View File
@@ -301,7 +301,6 @@ std::unique_ptr<QMenu> SplitHeader::createMainMenu()
// sub menu
auto moreMenu = new QMenu("More", this);
moreMenu->addAction("Toggle moderation mode", this->split_, [this]() {
this->split_->setModerationMode(!this->split_->getModerationMode());
});
@@ -591,16 +590,14 @@ void SplitHeader::mousePressEvent(QMouseEvent *event)
{
switch (event->button())
{
case Qt::LeftButton:
{
case Qt::LeftButton: {
this->dragging_ = true;
this->dragStart_ = event->pos();
}
break;
case Qt::RightButton:
{
case Qt::RightButton: {
this->mainMenu_->popup(this->mapToGlobal(event->pos()));
}
break;
@@ -718,8 +715,7 @@ void SplitHeader::themeChangedEvent()
}
else
{
this->dropdownButton_->setPixmap(
getResources().buttons.menuLight);
this->dropdownButton_->setPixmap(getResources().buttons.menuLight);
this->addButton_->setPixmap(getResources().buttons.addSplitDark);
}
}
+9 -18
View File
@@ -35,8 +35,7 @@ SplitOverlay::SplitOverlay(Split *parent)
new QPushButton(getResources().split.left, QString());
auto *right = this->right_ =
new QPushButton(getResources().split.right, QString());
auto *up = this->up_ =
new QPushButton(getResources().split.up, QString());
auto *up = this->up_ = new QPushButton(getResources().split.up, QString());
auto *down = this->down_ =
new QPushButton(getResources().split.down, QString());
@@ -107,27 +106,23 @@ void SplitOverlay::paintEvent(QPaintEvent *)
QRect rect;
switch (this->hoveredElement_)
{
case SplitLeft:
{
case SplitLeft: {
rect = QRect(0, 0, this->width() / 2, this->height());
}
break;
case SplitRight:
{
case SplitRight: {
rect =
QRect(this->width() / 2, 0, this->width() / 2, this->height());
}
break;
case SplitUp:
{
case SplitUp: {
rect = QRect(0, 0, this->width(), this->height() / 2);
}
break;
case SplitDown:
{
case SplitDown: {
rect =
QRect(0, this->height() / 2, this->width(), this->height() / 2);
}
@@ -184,8 +179,7 @@ bool SplitOverlay::ButtonEventFilter::eventFilter(QObject *watched,
{
switch (event->type())
{
case QEvent::Enter:
{
case QEvent::Enter: {
QGraphicsOpacityEffect *effect =
dynamic_cast<QGraphicsOpacityEffect *>(
((QWidget *)watched)->graphicsEffect());
@@ -199,8 +193,7 @@ bool SplitOverlay::ButtonEventFilter::eventFilter(QObject *watched,
this->parent->update();
}
break;
case QEvent::Leave:
{
case QEvent::Leave: {
QGraphicsOpacityEffect *effect =
dynamic_cast<QGraphicsOpacityEffect *>(
((QWidget *)watched)->graphicsEffect());
@@ -214,8 +207,7 @@ bool SplitOverlay::ButtonEventFilter::eventFilter(QObject *watched,
this->parent->update();
}
break;
case QEvent::MouseButtonPress:
{
case QEvent::MouseButtonPress: {
if (this->hoveredElement == HoveredElement::SplitMove)
{
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
@@ -227,8 +219,7 @@ bool SplitOverlay::ButtonEventFilter::eventFilter(QObject *watched,
}
}
break;
case QEvent::MouseButtonRelease:
{
case QEvent::MouseButtonRelease: {
if (this->hoveredElement != HoveredElement::SplitMove)
{
SplitContainer *container =