fix: don't indent inner namespaces (#6235)

This commit is contained in:
pajlada
2025-05-25 12:28:14 +02:00
committed by GitHub
parent 84c0b39fde
commit 8acca1c241
39 changed files with 934 additions and 951 deletions
+16 -16
View File
@@ -13,23 +13,23 @@ namespace chatterino {
namespace {
#ifdef Q_OS_LINUX
FlagsEnum<BaseWindow::Flags> popupFlags{
BaseWindow::Dialog,
BaseWindow::EnableCustomFrame,
};
FlagsEnum<BaseWindow::Flags> popupFlagsCloseAutomatically{
BaseWindow::Dialog,
BaseWindow::EnableCustomFrame,
};
FlagsEnum<BaseWindow::Flags> popupFlags{
BaseWindow::Dialog,
BaseWindow::EnableCustomFrame,
};
FlagsEnum<BaseWindow::Flags> popupFlagsCloseAutomatically{
BaseWindow::Dialog,
BaseWindow::EnableCustomFrame,
};
#else
FlagsEnum<BaseWindow::Flags> popupFlags{
BaseWindow::EnableCustomFrame,
};
FlagsEnum<BaseWindow::Flags> popupFlagsCloseAutomatically{
BaseWindow::EnableCustomFrame,
BaseWindow::Frameless,
BaseWindow::FramelessDraggable,
};
FlagsEnum<BaseWindow::Flags> popupFlags{
BaseWindow::EnableCustomFrame,
};
FlagsEnum<BaseWindow::Flags> popupFlagsCloseAutomatically{
BaseWindow::EnableCustomFrame,
BaseWindow::Frameless,
BaseWindow::FramelessDraggable,
};
#endif
} // namespace
@@ -8,14 +8,13 @@
namespace chatterino {
namespace {
const QStringList friendlyBinaryOps = {
"and", "or", "+", "-", "*", "/",
"%", "equals", "not equals", "<", ">", "<=",
">=", "contains", "starts with", "ends with", "(nothing)"};
const QStringList realBinaryOps = {
"&&", "||", "+", "-", "*", "/",
"%", "==", "!=", "<", ">", "<=",
">=", "contains", "startswith", "endswith", ""};
const QStringList friendlyBinaryOps = {
"and", "or", "+", "-", "*", "/",
"%", "equals", "not equals", "<", ">", "<=",
">=", "contains", "starts with", "ends with", "(nothing)"};
const QStringList realBinaryOps = {
"&&", "||", "+", "-", "*", "/", "%", "==", "!=",
"<", ">", "<=", ">=", "contains", "startswith", "endswith", ""};
} // namespace
ChannelFilterEditorDialog::ChannelFilterEditorDialog(QWidget *parent)
+43 -45
View File
@@ -25,53 +25,51 @@ namespace chatterino {
namespace {
bool logInWithCredentials(QWidget *parent, const QString &userID,
const QString &username, const QString &clientID,
const QString &oauthToken)
bool logInWithCredentials(QWidget *parent, const QString &userID,
const QString &username, const QString &clientID,
const QString &oauthToken)
{
QStringList errors;
if (userID.isEmpty())
{
QStringList errors;
if (userID.isEmpty())
{
errors.append("Missing user ID");
}
if (username.isEmpty())
{
errors.append("Missing username");
}
if (clientID.isEmpty())
{
errors.append("Missing Client ID");
}
if (oauthToken.isEmpty())
{
errors.append("Missing OAuth Token");
}
if (errors.length() > 0)
{
QMessageBox messageBox(parent);
messageBox.setWindowTitle("Invalid account credentials");
messageBox.setIcon(QMessageBox::Critical);
messageBox.setText(errors.join("<br>"));
messageBox.exec();
return false;
}
std::string basePath = "/accounts/uid" + userID.toStdString();
pajlada::Settings::Setting<QString>::set(basePath + "/username",
username);
pajlada::Settings::Setting<QString>::set(basePath + "/userID", userID);
pajlada::Settings::Setting<QString>::set(basePath + "/clientID",
clientID);
pajlada::Settings::Setting<QString>::set(basePath + "/oauthToken",
oauthToken);
getApp()->getAccounts()->twitch.reloadUsers();
getApp()->getAccounts()->twitch.currentUsername = username;
getSettings()->requestSave();
return true;
errors.append("Missing user ID");
}
if (username.isEmpty())
{
errors.append("Missing username");
}
if (clientID.isEmpty())
{
errors.append("Missing Client ID");
}
if (oauthToken.isEmpty())
{
errors.append("Missing OAuth Token");
}
if (errors.length() > 0)
{
QMessageBox messageBox(parent);
messageBox.setWindowTitle("Invalid account credentials");
messageBox.setIcon(QMessageBox::Critical);
messageBox.setText(errors.join("<br>"));
messageBox.exec();
return false;
}
std::string basePath = "/accounts/uid" + userID.toStdString();
pajlada::Settings::Setting<QString>::set(basePath + "/username", username);
pajlada::Settings::Setting<QString>::set(basePath + "/userID", userID);
pajlada::Settings::Setting<QString>::set(basePath + "/clientID", clientID);
pajlada::Settings::Setting<QString>::set(basePath + "/oauthToken",
oauthToken);
getApp()->getAccounts()->twitch.reloadUsers();
getApp()->getAccounts()->twitch.currentUsername = username;
getSettings()->requestSave();
return true;
}
} // namespace
+38 -38
View File
@@ -33,52 +33,52 @@
namespace chatterino {
namespace {
// Translates the given rectangle by an amount in the direction to appear like the tab is selected.
// For example, if location is Top, the rectangle will be translated in the negative Y direction,
// or "up" on the screen, by amount.
void translateRectForLocation(QRect &rect, NotebookTabLocation location,
int amount)
// Translates the given rectangle by an amount in the direction to appear like the tab is selected.
// For example, if location is Top, the rectangle will be translated in the negative Y direction,
// or "up" on the screen, by amount.
void translateRectForLocation(QRect &rect, NotebookTabLocation location,
int amount)
{
switch (location)
{
switch (location)
{
case NotebookTabLocation::Top:
rect.translate(0, -amount);
break;
case NotebookTabLocation::Left:
rect.translate(-amount, 0);
break;
case NotebookTabLocation::Right:
rect.translate(amount, 0);
break;
case NotebookTabLocation::Bottom:
rect.translate(0, amount);
break;
}
case NotebookTabLocation::Top:
rect.translate(0, -amount);
break;
case NotebookTabLocation::Left:
rect.translate(-amount, 0);
break;
case NotebookTabLocation::Right:
rect.translate(amount, 0);
break;
case NotebookTabLocation::Bottom:
rect.translate(0, amount);
break;
}
}
float getCompactDivider(TabStyle tabStyle)
float getCompactDivider(TabStyle tabStyle)
{
switch (tabStyle)
{
switch (tabStyle)
{
case TabStyle::Compact:
return 1.5;
case TabStyle::Normal:
default:
return 1.0;
}
case TabStyle::Compact:
return 1.5;
case TabStyle::Normal:
default:
return 1.0;
}
}
float getCompactReducer(TabStyle tabStyle)
float getCompactReducer(TabStyle tabStyle)
{
switch (tabStyle)
{
switch (tabStyle)
{
case TabStyle::Compact:
return 4.0;
case TabStyle::Normal:
default:
return 0.0;
}
case TabStyle::Compact:
return 4.0;
case TabStyle::Normal:
default:
return 0.0;
}
}
} // namespace
NotebookTab::NotebookTab(Notebook *notebook)
+13 -13
View File
@@ -27,19 +27,19 @@
namespace chatterino {
namespace {
// Add additional badges for highlights here
QList<DisplayBadge> availableBadges = {
{"Broadcaster", "broadcaster"},
{"Admin", "admin"},
{"Staff", "staff"},
{"Moderator", "moderator"},
{"Verified", "partner"},
{"VIP", "vip"},
{"Founder", "founder"},
{"Subscriber", "subscriber"},
{"Predicted Blue", "predictions/blue-1,predictions/blue-2"},
{"Predicted Pink", "predictions/pink-2,predictions/pink-1"},
};
// Add additional badges for highlights here
QList<DisplayBadge> availableBadges = {
{"Broadcaster", "broadcaster"},
{"Admin", "admin"},
{"Staff", "staff"},
{"Moderator", "moderator"},
{"Verified", "partner"},
{"VIP", "vip"},
{"Founder", "founder"},
{"Subscriber", "subscriber"},
{"Predicted Blue", "predictions/blue-1,predictions/blue-2"},
{"Predicted Pink", "predictions/pink-2,predictions/pink-1"},
};
} // namespace
HighlightingPage::HighlightingPage()
+22 -22
View File
@@ -183,28 +183,28 @@ QString formatChattersError(HelixGetChattersError error, const QString &message)
namespace chatterino {
namespace {
void showTutorialVideo(QWidget *parent, const QString &source,
const QString &title, const QString &description)
{
auto *window = new BasePopup(
{
BaseWindow::EnableCustomFrame,
BaseWindow::BoundsCheckOnShow,
},
parent);
window->setWindowTitle("Chatterino - " + title);
window->setAttribute(Qt::WA_DeleteOnClose);
auto *layout = new QVBoxLayout();
layout->addWidget(new QLabel(description));
auto *label = new QLabel(window);
layout->addWidget(label);
auto *movie = new QMovie(label);
movie->setFileName(source);
label->setMovie(movie);
movie->start();
window->getLayoutContainer()->setLayout(layout);
window->show();
}
void showTutorialVideo(QWidget *parent, const QString &source,
const QString &title, const QString &description)
{
auto *window = new BasePopup(
{
BaseWindow::EnableCustomFrame,
BaseWindow::BoundsCheckOnShow,
},
parent);
window->setWindowTitle("Chatterino - " + title);
window->setAttribute(Qt::WA_DeleteOnClose);
auto *layout = new QVBoxLayout();
layout->addWidget(new QLabel(description));
auto *label = new QLabel(window);
layout->addWidget(label);
auto *movie = new QMovie(label);
movie->setFileName(source);
label->setMovie(movie);
movie->start();
window->getLayoutContainer()->setLayout(layout);
window->show();
}
} // namespace
pajlada::Signals::Signal<Qt::KeyboardModifiers> Split::modifierStatusChanged;