refactor: fix clang-tidy auto*, const&, and curly braces (#5083)
This commit is contained in:
@@ -7,7 +7,7 @@ namespace chatterino {
|
||||
|
||||
void crossPlatformCopy(const QString &text)
|
||||
{
|
||||
auto clipboard = QApplication::clipboard();
|
||||
auto *clipboard = QApplication::clipboard();
|
||||
|
||||
clipboard->setText(text);
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ void initUpdateButton(Button &button,
|
||||
|
||||
// show update prompt when clicking the button
|
||||
QObject::connect(&button, &Button::leftClicked, [&button] {
|
||||
auto dialog = new UpdateDialog();
|
||||
auto *dialog = new UpdateDialog();
|
||||
dialog->setActionOnFocusLoss(BaseWindow::Delete);
|
||||
|
||||
auto globalPoint = button.mapToGlobal(
|
||||
@@ -54,9 +54,9 @@ void initUpdateButton(Button &button,
|
||||
auto updateChange = [&button](auto) {
|
||||
button.setVisible(Updates::instance().shouldShowUpdateButton());
|
||||
|
||||
auto imageUrl = Updates::instance().isError()
|
||||
? ":/buttons/updateError.png"
|
||||
: ":/buttons/update.png";
|
||||
const auto *imageUrl = Updates::instance().isError()
|
||||
? ":/buttons/updateError.png"
|
||||
: ":/buttons/update.png";
|
||||
button.setPixmap(QPixmap(imageUrl));
|
||||
};
|
||||
|
||||
|
||||
@@ -7,14 +7,14 @@ namespace chatterino {
|
||||
|
||||
QWidget *wrapLayout(QLayout *layout)
|
||||
{
|
||||
auto widget = new QWidget;
|
||||
auto *widget = new QWidget;
|
||||
widget->setLayout(layout);
|
||||
return widget;
|
||||
}
|
||||
|
||||
QScrollArea *makeScrollArea(WidgetOrLayout item)
|
||||
{
|
||||
auto area = new QScrollArea();
|
||||
auto *area = new QScrollArea();
|
||||
|
||||
switch (item.which())
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@ T *makeLayout(std::initializer_list<LayoutItem> items)
|
||||
{
|
||||
auto t = new T;
|
||||
|
||||
for (auto &item : items)
|
||||
for (const auto &item : items)
|
||||
{
|
||||
switch (item.which())
|
||||
{
|
||||
|
||||
@@ -13,7 +13,9 @@ inline void persist(SignalVector<T> &vec, const std::string &name)
|
||||
auto setting = std::make_unique<ChatterinoSetting<std::vector<T>>>(name);
|
||||
|
||||
for (auto &&item : setting->getValue())
|
||||
{
|
||||
vec.append(item);
|
||||
}
|
||||
|
||||
vec.delayedItemsChanged.connect([setting = setting.get(), vec = &vec] {
|
||||
setting->setValue(vec->raw());
|
||||
|
||||
@@ -70,7 +70,9 @@ QStringList chatterino::splitCommand(QStringView command)
|
||||
if (quoteCount)
|
||||
{
|
||||
if (quoteCount == 1)
|
||||
{
|
||||
inQuote = !inQuote;
|
||||
}
|
||||
quoteCount = 0;
|
||||
}
|
||||
if (!inQuote && command.at(i).isSpace())
|
||||
@@ -87,7 +89,9 @@ QStringList chatterino::splitCommand(QStringView command)
|
||||
}
|
||||
}
|
||||
if (!tmp.isEmpty())
|
||||
{
|
||||
args += tmp;
|
||||
}
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user