Run formatter on all our files (#6942)

This commit is contained in:
RickyRister 2026-05-26 15:11:38 -07:00 committed by GitHub
parent b3c89167c5
commit 1d5d3f2d38
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 153 additions and 81 deletions

View file

@ -61,24 +61,30 @@ inline QString expandPattern(const QString &pattern,
QString result = pattern;
auto replaceIfPresent = [&](const QString &token, const QString &value) -> bool {
if (!result.contains(token))
if (!result.contains(token)) {
return true;
}
if (value.isEmpty())
if (value.isEmpty()) {
return false;
}
result.replace(token, value);
return true;
};
if (!replaceIfPresent("{name}", name))
if (!replaceIfPresent("{name}", name)) {
return {};
if (!replaceIfPresent("{set}", set))
}
if (!replaceIfPresent("{set}", set)) {
return {};
if (!replaceIfPresent("{collector}", collector))
}
if (!replaceIfPresent("{collector}", collector)) {
return {};
if (!replaceIfPresent("{providerId}", providerId))
}
if (!replaceIfPresent("{providerId}", providerId)) {
return {};
}
return result;
}
@ -96,8 +102,9 @@ generateImportVariants(const QString &name, const QString &set, const QString &c
pattern.replace("_", sep);
QString v = expandPattern(pattern, name, set, collector, providerId);
if (!v.isEmpty())
if (!v.isEmpty()) {
variants << v;
}
}
}

View file

@ -28,8 +28,9 @@ CardPictureLoaderWorker::CardPictureLoaderWorker()
static_cast<qint64>(SettingsCache::instance().getNetworkCacheSizeInMB()));
connect(&SettingsCache::instance(), &SettingsCache::networkCacheSizeChanged, cache, [this](int newSizeInMB) {
if (cache)
if (cache) {
cache->setMaximumCacheSize(1024L * 1024L * static_cast<qint64>(newSizeInMB));
}
});
networkManager->setCache(cache);

View file

@ -70,8 +70,9 @@ bool FlowLayout::hasHeightForWidth() const
*/
int FlowLayout::heightForWidth(const int width) const
{
if (flowDirection != Qt::Horizontal)
if (flowDirection != Qt::Horizontal) {
return -1;
}
int totalHeight = 0;
int rowUsedWidth = 0;
@ -181,8 +182,9 @@ int FlowLayout::layoutAllRows(const int originX, const int originY, const int av
*/
void FlowLayout::layoutSingleRow(const QVector<QLayoutItem *> &rowItems, int x, const int y, const int availableWidth)
{
if (rowItems.isEmpty())
if (rowItems.isEmpty()) {
return;
}
// ── Pass 1: measure fixed width and count expanding items ────────────────
int fixedWidth = 0;
@ -211,12 +213,14 @@ void FlowLayout::layoutSingleRow(const QVector<QLayoutItem *> &rowItems, int x,
// ── Pass 2: place items ──────────────────────────────────────────────────
for (QLayoutItem *item : rowItems) {
if (!item || item->isEmpty())
if (!item || item->isEmpty()) {
continue;
}
QWidget *widget = item->widget();
if (!widget)
if (!widget) {
continue;
}
const QSizePolicy::Policy hPolicy = widget->sizePolicy().horizontalPolicy();
const QSize maxSize = widget->maximumSize();

View file

@ -108,8 +108,9 @@ void FlowWidget::clearLayout()
if (flowLayout) {
QLayoutItem *item;
while ((item = flowLayout->takeAt(0))) {
if (item->widget())
if (item->widget()) {
item->widget()->deleteLater();
}
delete item;
}
} else {

View file

@ -24,7 +24,7 @@ public:
QJsonObject getOracleCard() const
{
return oracleCard;
};
}
QString getCollectorNumber() const
{

View file

@ -33,7 +33,7 @@ public:
ArchidektApiResponseCard getCard() const
{
return card;
};
}
QList<Category> getCategories() const
{

View file

@ -27,7 +27,7 @@ public:
QVector<ArchidektApiResponseCardEntry> getCards() const
{
return cards;
};
}
QVector<ArchidektApiResponseDeckCategory> getCategories() const
{
@ -37,7 +37,7 @@ public:
QString getDeckName() const
{
return name;
};
}
int getDeckFormat() const
{

View file

@ -174,7 +174,8 @@ void VisualDatabaseDisplayFilterToolbarWidget::updateCompactMode(int availableWi
};
for (auto *btn : filterButtons) {
if (btn->isCompact() != compact) // only act on transitions
if (btn->isCompact() != compact) { // only act on transitions
btn->setCompact(compact);
}
}
}