From a5d68e6660194a82a504eeaef6a6163356d23876 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Wed, 21 May 2025 16:11:01 -0400 Subject: [PATCH] Add warning to Configure JSON for encounters --- src/editor.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/editor.cpp b/src/editor.cpp index 620c625a..6de4895f 100644 --- a/src/editor.cpp +++ b/src/editor.cpp @@ -569,6 +569,11 @@ void Editor::configureEncounterJSON(QWidget *window) { dialog.setWindowTitle("Configure Wild Encounter Fields"); dialog.setWindowModality(Qt::NonModal); + enum GridRow { + NoteLabel, + Header, + TableStart + }; QGridLayout grid; QDialogButtonBox buttonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, &dialog); @@ -600,8 +605,9 @@ void Editor::configureEncounterJSON(QWidget *window) { index = tempFields.size() - 1; } EncounterField ¤tField = tempFields[index]; + const int numSlotColumns = 4; for (int i = 0; i < currentField.encounterRates.size(); i++) { - grid.addWidget(createNewSlot(i, currentField), i / 4 + 1, i % 4); + grid.addWidget(createNewSlot(i, currentField), (i / numSlotColumns) + GridRow::TableStart, i % numSlotColumns); } updateTotal(currentField); @@ -669,6 +675,9 @@ void Editor::configureEncounterJSON(QWidget *window) { }); // TODO: method for editing groups? + auto noteLabel = new QLabel(QStringLiteral("Note: This affects all maps, not just the current map.")); + grid.addWidget(noteLabel, GridRow::NoteLabel, 0, 1, -1, Qt::AlignCenter); + QFrame firstRow; QHBoxLayout firstRowLayout; firstRowLayout.addWidget(fieldChoiceLabel); @@ -678,7 +687,7 @@ void Editor::configureEncounterJSON(QWidget *window) { firstRowLayout.addWidget(removeSlotButton); firstRowLayout.addWidget(addSlotButton); firstRow.setLayout(&firstRowLayout); - grid.addWidget(&firstRow, 0, 0, 1, 4, Qt::AlignLeft); + grid.addWidget(&firstRow, GridRow::Header, 0, 1, -1, Qt::AlignLeft); QHBoxLayout lastRow; lastRow.addWidget(totalLabel);