mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-17 20:41:33 -07:00
style: Add braces to all control flow statements (#6887)
* style: Add braces to all control flow statements Standardize code style by adding explicit braces to all single-statement control flow blocks (if, else, for, while) across the entire codebase. Also documents the InsertBraces clang-format option (requires v15+) for future automated enforcement. * InsertBraces-check-enabled
This commit is contained in:
parent
7153f7d4c1
commit
aadee34238
173 changed files with 2725 additions and 1461 deletions
|
|
@ -57,8 +57,9 @@ void VisualDatabaseDisplayFilterSaveLoadWidget::retranslateUi()
|
|||
void VisualDatabaseDisplayFilterSaveLoadWidget::saveFilter()
|
||||
{
|
||||
QString filename = filenameInput->text().trimmed();
|
||||
if (filename.isEmpty())
|
||||
if (filename.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QString filePath = SettingsCache::instance().getFiltersPath() + QDir::separator() + filename + ".json";
|
||||
|
||||
|
|
@ -88,19 +89,22 @@ void VisualDatabaseDisplayFilterSaveLoadWidget::loadFilter(const QString &filena
|
|||
QString filePath = SettingsCache::instance().getFiltersPath() + QDir::separator() + filename;
|
||||
|
||||
QFile file(filePath);
|
||||
if (!file.open(QIODevice::ReadOnly))
|
||||
if (!file.open(QIODevice::ReadOnly)) {
|
||||
return;
|
||||
}
|
||||
|
||||
QByteArray jsonData = file.readAll();
|
||||
file.close();
|
||||
|
||||
QJsonDocument doc = QJsonDocument::fromJson(jsonData);
|
||||
if (!doc.isObject())
|
||||
if (!doc.isObject()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QJsonObject root = doc.object();
|
||||
if (!root.contains("filters") || !root["filters"].isArray())
|
||||
if (!root.contains("filters") || !root["filters"].isArray()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QJsonArray filtersArray = root["filters"].toArray();
|
||||
|
||||
|
|
|
|||
|
|
@ -64,8 +64,9 @@ void VisualDatabaseDisplayNameFilterWidget::actLoadFromDeck()
|
|||
{
|
||||
DeckListModel *deckListModel = deckEditor->deckStateManager->getModel();
|
||||
|
||||
if (!deckListModel)
|
||||
if (!deckListModel) {
|
||||
return;
|
||||
}
|
||||
|
||||
QList<QString> cardNames = deckListModel->getCardNames();
|
||||
for (auto cardName : cardNames) {
|
||||
|
|
@ -78,8 +79,9 @@ void VisualDatabaseDisplayNameFilterWidget::actLoadFromDeck()
|
|||
void VisualDatabaseDisplayNameFilterWidget::actLoadFromClipboard()
|
||||
{
|
||||
DlgLoadDeckFromClipboard dlg(this);
|
||||
if (!dlg.exec())
|
||||
if (!dlg.exec()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QStringList cardsInClipboard = dlg.getDeckList().getCardList();
|
||||
for (QString cardName : cardsInClipboard) {
|
||||
|
|
@ -91,8 +93,9 @@ void VisualDatabaseDisplayNameFilterWidget::actLoadFromClipboard()
|
|||
|
||||
void VisualDatabaseDisplayNameFilterWidget::createNameFilter(const QString &name)
|
||||
{
|
||||
if (activeFilters.contains(name))
|
||||
if (activeFilters.contains(name)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Create a button for the filter
|
||||
auto *button = new QPushButton(name, flowWidget);
|
||||
|
|
|
|||
|
|
@ -240,9 +240,10 @@ void VisualDatabaseDisplayWidget::updateSearch(const QString &search) const
|
|||
{
|
||||
databaseDisplayModel->setStringFilter(search);
|
||||
QModelIndexList sel = databaseView->selectionModel()->selectedRows();
|
||||
if (sel.isEmpty() && databaseDisplayModel->rowCount())
|
||||
if (sel.isEmpty() && databaseDisplayModel->rowCount()) {
|
||||
databaseView->selectionModel()->setCurrentIndex(databaseDisplayModel->index(0, 0),
|
||||
QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows);
|
||||
}
|
||||
}
|
||||
|
||||
bool VisualDatabaseDisplayWidget::isVisualDisplayMode() const
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue