refactor: fix clang-tidy auto*, const&, and curly braces (#5083)
This commit is contained in:
@@ -19,9 +19,13 @@ void InputCompletionItem::action()
|
||||
if (this->action_)
|
||||
{
|
||||
if (this->emote_)
|
||||
{
|
||||
this->action_(this->emote_->name.string);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->action_(this->text_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -199,11 +199,11 @@ namespace {
|
||||
parent);
|
||||
window->setWindowTitle("Chatterino - " + title);
|
||||
window->setAttribute(Qt::WA_DeleteOnClose);
|
||||
auto layout = new QVBoxLayout();
|
||||
auto *layout = new QVBoxLayout();
|
||||
layout->addWidget(new QLabel(description));
|
||||
auto label = new QLabel(window);
|
||||
auto *label = new QLabel(window);
|
||||
layout->addWidget(label);
|
||||
auto movie = new QMovie(label);
|
||||
auto *movie = new QMovie(label);
|
||||
movie->setFileName(source);
|
||||
label->setMovie(movie);
|
||||
movie->start();
|
||||
@@ -805,7 +805,7 @@ void Split::refreshModerationMode()
|
||||
|
||||
void Split::openChannelInBrowserPlayer(ChannelPtr channel)
|
||||
{
|
||||
if (auto twitchChannel = dynamic_cast<TwitchChannel *>(channel.get()))
|
||||
if (auto *twitchChannel = dynamic_cast<TwitchChannel *>(channel.get()))
|
||||
{
|
||||
QDesktopServices::openUrl(
|
||||
"https://player.twitch.tv/?parent=twitch.tv&channel=" +
|
||||
@@ -918,7 +918,7 @@ void Split::showChangeChannelPopup(const char *dialogTitle, bool empty,
|
||||
return;
|
||||
}
|
||||
|
||||
auto dialog = new SelectChannelDialog(this);
|
||||
auto *dialog = new SelectChannelDialog(this);
|
||||
if (!empty)
|
||||
{
|
||||
dialog->setSelectedChannel(this->getIndirectChannel());
|
||||
@@ -1065,7 +1065,7 @@ void Split::explainSplitting()
|
||||
|
||||
void Split::popup()
|
||||
{
|
||||
auto app = getApp();
|
||||
auto *app = getApp();
|
||||
Window &window = app->windows->createWindow(WindowType::Popup);
|
||||
|
||||
Split *split = new Split(static_cast<SplitContainer *>(
|
||||
@@ -1088,7 +1088,7 @@ void Split::openInBrowser()
|
||||
{
|
||||
auto channel = this->getChannel();
|
||||
|
||||
if (auto twitchChannel = dynamic_cast<TwitchChannel *>(channel.get()))
|
||||
if (auto *twitchChannel = dynamic_cast<TwitchChannel *>(channel.get()))
|
||||
{
|
||||
QDesktopServices::openUrl("https://twitch.tv/" +
|
||||
twitchChannel->getName());
|
||||
@@ -1111,7 +1111,7 @@ void Split::openModViewInBrowser()
|
||||
{
|
||||
auto channel = this->getChannel();
|
||||
|
||||
if (auto twitchChannel = dynamic_cast<TwitchChannel *>(channel.get()))
|
||||
if (auto *twitchChannel = dynamic_cast<TwitchChannel *>(channel.get()))
|
||||
{
|
||||
QDesktopServices::openUrl("https://twitch.tv/moderator/" +
|
||||
twitchChannel->getName());
|
||||
@@ -1131,9 +1131,9 @@ void Split::openWithCustomScheme()
|
||||
return;
|
||||
}
|
||||
|
||||
const auto channel = this->getChannel().get();
|
||||
auto *const channel = this->getChannel().get();
|
||||
|
||||
if (const auto twitchChannel = dynamic_cast<TwitchChannel *>(channel))
|
||||
if (auto *const twitchChannel = dynamic_cast<TwitchChannel *>(channel))
|
||||
{
|
||||
QDesktopServices::openUrl(QString("%1https://twitch.tv/%2")
|
||||
.arg(scheme)
|
||||
@@ -1422,7 +1422,7 @@ void Split::openSubPage()
|
||||
{
|
||||
ChannelPtr channel = this->getChannel();
|
||||
|
||||
if (auto twitchChannel = dynamic_cast<TwitchChannel *>(channel.get()))
|
||||
if (auto *twitchChannel = dynamic_cast<TwitchChannel *>(channel.get()))
|
||||
{
|
||||
QDesktopServices::openUrl(twitchChannel->subscriptionUrl());
|
||||
}
|
||||
@@ -1466,8 +1466,8 @@ void Split::showSearch(bool singleChannel)
|
||||
auto ¬ebook = getApp()->windows->getMainWindow().getNotebook();
|
||||
for (int i = 0; i < notebook.getPageCount(); ++i)
|
||||
{
|
||||
auto container = dynamic_cast<SplitContainer *>(notebook.getPageAt(i));
|
||||
for (auto split : container->getSplits())
|
||||
auto *container = dynamic_cast<SplitContainer *>(notebook.getPageAt(i));
|
||||
for (auto *split : container->getSplits())
|
||||
{
|
||||
if (split->channel_.getType() != Channel::Type::TwitchAutomod)
|
||||
{
|
||||
@@ -1484,7 +1484,7 @@ void Split::reloadChannelAndSubscriberEmotes()
|
||||
auto channel = this->getChannel();
|
||||
getApp()->accounts->twitch.getCurrent()->loadEmotes(channel);
|
||||
|
||||
if (auto twitchChannel = dynamic_cast<TwitchChannel *>(channel.get()))
|
||||
if (auto *twitchChannel = dynamic_cast<TwitchChannel *>(channel.get()))
|
||||
{
|
||||
twitchChannel->refreshBTTVChannelEmotes(true);
|
||||
twitchChannel->refreshFFZChannelEmotes(true);
|
||||
@@ -1551,8 +1551,8 @@ void Split::drag()
|
||||
startDraggingSplit();
|
||||
|
||||
auto originalLocation = container->releaseSplit(this);
|
||||
auto drag = new QDrag(this);
|
||||
auto mimeData = new QMimeData;
|
||||
auto *drag = new QDrag(this);
|
||||
auto *mimeData = new QMimeData;
|
||||
|
||||
mimeData->setData("chatterino/split", "xD");
|
||||
drag->setMimeData(mimeData);
|
||||
|
||||
@@ -50,13 +50,13 @@ SplitInput::SplitInput(QWidget *parent, Split *_chatWidget,
|
||||
this->installEventFilter(this);
|
||||
this->initLayout();
|
||||
|
||||
auto completer =
|
||||
auto *completer =
|
||||
new QCompleter(&this->split_->getChannel()->completionModel);
|
||||
this->ui_.textEdit->setCompleter(completer);
|
||||
|
||||
this->signalHolder_.managedConnect(this->split_->channelChanged, [this] {
|
||||
auto channel = this->split_->getChannel();
|
||||
auto completer = new QCompleter(&channel->completionModel);
|
||||
auto *completer = new QCompleter(&channel->completionModel);
|
||||
this->ui_.textEdit->setCompleter(completer);
|
||||
});
|
||||
|
||||
@@ -78,7 +78,7 @@ SplitInput::SplitInput(QWidget *parent, Split *_chatWidget,
|
||||
|
||||
void SplitInput::initLayout()
|
||||
{
|
||||
auto app = getApp();
|
||||
auto *app = getApp();
|
||||
LayoutCreator<SplitInput> layoutCreator(this);
|
||||
|
||||
auto layout =
|
||||
@@ -202,7 +202,7 @@ void SplitInput::initLayout()
|
||||
|
||||
void SplitInput::scaleChangedEvent(float scale)
|
||||
{
|
||||
auto app = getApp();
|
||||
auto *app = getApp();
|
||||
// update the icon size of the buttons
|
||||
this->updateEmoteButton();
|
||||
this->updateCancelReplyButton();
|
||||
@@ -328,7 +328,9 @@ QString SplitInput::handleSendMessage(std::vector<QString> &arguments)
|
||||
{
|
||||
auto c = this->split_->getChannel();
|
||||
if (c == nullptr)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
if (!c->isTwitchChannel() || this->replyThread_ == nullptr)
|
||||
{
|
||||
@@ -347,7 +349,7 @@ QString SplitInput::handleSendMessage(std::vector<QString> &arguments)
|
||||
else
|
||||
{
|
||||
// Reply to message
|
||||
auto tc = dynamic_cast<TwitchChannel *>(c.get());
|
||||
auto *tc = dynamic_cast<TwitchChannel *>(c.get());
|
||||
if (!tc)
|
||||
{
|
||||
// this should not fail
|
||||
@@ -635,7 +637,7 @@ bool SplitInput::eventFilter(QObject *obj, QEvent *event)
|
||||
if (event->type() == QEvent::ShortcutOverride ||
|
||||
event->type() == QEvent::Shortcut)
|
||||
{
|
||||
if (auto popup = this->inputCompletionPopup_.data())
|
||||
if (auto *popup = this->inputCompletionPopup_.data())
|
||||
{
|
||||
if (popup->isVisible())
|
||||
{
|
||||
@@ -906,7 +908,7 @@ bool SplitInput::isHidden() const
|
||||
|
||||
void SplitInput::editTextChanged()
|
||||
{
|
||||
auto app = getApp();
|
||||
auto *app = getApp();
|
||||
|
||||
// set textLengthLabel value
|
||||
QString text = this->ui_.textEdit->toPlainText();
|
||||
|
||||
Reference in New Issue
Block a user