Fix some issues with the new layout dialog

This commit is contained in:
GriffinR 2025-08-01 02:47:59 -04:00
parent 5584a2d47b
commit b66bfd0fd5
5 changed files with 21 additions and 14 deletions

View File

@ -33,6 +33,8 @@ and this project somewhat adheres to [Semantic Versioning](https://semver.org/sp
- Fix the shortcut for duplicating events working while on the Connections tab. - Fix the shortcut for duplicating events working while on the Connections tab.
- Fix Undo/Redo ignoring the automatic resizing that occurs if a layout/border was an unexpected size. - Fix Undo/Redo ignoring the automatic resizing that occurs if a layout/border was an unexpected size.
- Fix the Region Map Editor incorrectly displaying whether a `MAPSEC` has region map data. - Fix the Region Map Editor incorrectly displaying whether a `MAPSEC` has region map data.
- Fix broken error message for the primary tileset on the new map/layout dialogs.
- Fix the dialog for duplicating/importing a map layout not allowing the tilesets to be changed.
- Fix warning not appearing when the log file exceeds maximum size. - Fix warning not appearing when the log file exceeds maximum size.
- Fix possible lag while using the Tileset Editor's tile selector. - Fix possible lag while using the Tileset Editor's tile selector.
- Fix unnecessary resources being used to watch files. - Fix unnecessary resources being used to watch files.

View File

@ -24,7 +24,7 @@ public:
void setSettings(const Layout::Settings &settings); void setSettings(const Layout::Settings &settings);
Layout::Settings settings() const; Layout::Settings settings() const;
void setDisabled(bool disabled); void setDimensionsDisabled(bool disabled);
bool validate(); bool validate();

View File

@ -73,15 +73,21 @@ Layout *AdvanceMapParser::parseLayout(const QString &filepath, bool *error, cons
const QList<QString> tilesets = project->tilesetLabelsOrdered; const QList<QString> tilesets = project->tilesetLabelsOrdered;
if (mapPrimaryTilesetNum > tilesets.size()) const QString defaultPrimaryTileset = project->getDefaultPrimaryTilesetLabel();
mapLayout->tileset_primary_label = project->getDefaultPrimaryTilesetLabel(); QString primaryTilesetLabel = tilesets.value(mapPrimaryTilesetNum, defaultPrimaryTileset);
else if (!project->primaryTilesetLabels.contains(primaryTilesetLabel)) {
mapLayout->tileset_primary_label = tilesets.at(mapPrimaryTilesetNum); // AdvanceMap's primary tileset value points to a secondary tileset. Ignore it.
primaryTilesetLabel = defaultPrimaryTileset;
}
const QString defaultSecondaryTileset = project->getDefaultSecondaryTilesetLabel();
QString secondaryTilesetLabel = tilesets.value(mapSecondaryTilesetNum, defaultSecondaryTileset);
if (!project->secondaryTilesetLabels.contains(secondaryTilesetLabel)) {
// AdvanceMap's secondary tileset value points to a primary tileset. Ignore it.
secondaryTilesetLabel = defaultSecondaryTileset;
}
if (mapSecondaryTilesetNum > tilesets.size()) mapLayout->tileset_primary_label = primaryTilesetLabel;
mapLayout->tileset_secondary_label = project->getDefaultSecondaryTilesetLabel(); mapLayout->tileset_secondary_label = secondaryTilesetLabel;
else
mapLayout->tileset_secondary_label = tilesets.at(mapSecondaryTilesetNum);
mapLayout->blockdata = blockdata; mapLayout->blockdata = blockdata;

View File

@ -62,10 +62,10 @@ void NewLayoutDialog::refresh() {
if (this->layoutToCopy) { if (this->layoutToCopy) {
// If we're importing a layout then some settings will be enforced. // If we're importing a layout then some settings will be enforced.
ui->newLayoutForm->setSettings(this->layoutToCopy->settings()); ui->newLayoutForm->setSettings(this->layoutToCopy->settings());
ui->newLayoutForm->setDisabled(true); ui->newLayoutForm->setDimensionsDisabled(true);
} else { } else {
ui->newLayoutForm->setSettings(*settings); ui->newLayoutForm->setSettings(*settings);
ui->newLayoutForm->setDisabled(false); ui->newLayoutForm->setDimensionsDisabled(false);
} }
ui->lineEdit_Name->setText(settings->name); ui->lineEdit_Name->setText(settings->name);

View File

@ -40,10 +40,9 @@ void NewLayoutForm::initUi(Project *project) {
} }
} }
void NewLayoutForm::setDisabled(bool disabled) { void NewLayoutForm::setDimensionsDisabled(bool disabled) {
ui->groupBox_MapDimensions->setDisabled(disabled); ui->groupBox_MapDimensions->setDisabled(disabled);
ui->groupBox_BorderDimensions->setDisabled(disabled); ui->groupBox_BorderDimensions->setDisabled(disabled);
ui->groupBox_Tilesets->setDisabled(disabled);
} }
void NewLayoutForm::setSettings(const Layout::Settings &settings) { void NewLayoutForm::setSettings(const Layout::Settings &settings) {
@ -111,7 +110,7 @@ bool NewLayoutForm::validatePrimaryTileset(bool allowEmpty) {
if (name.isEmpty()) { if (name.isEmpty()) {
if (!allowEmpty) errorText = QString("The Primary Tileset cannot be empty."); if (!allowEmpty) errorText = QString("The Primary Tileset cannot be empty.");
} else if (ui->comboBox_PrimaryTileset->findText(name) < 0) { } else if (ui->comboBox_PrimaryTileset->findText(name) < 0) {
errorText = QString("The Primary Tileset '%1' does not exist.").arg(ui->label_PrimaryTileset->text()).arg(name); errorText = QString("The Primary Tileset '%1' does not exist.").arg(name);
} }
bool isValid = errorText.isEmpty(); bool isValid = errorText.isEmpty();