mirror of
https://github.com/huderlem/porymap.git
synced 2026-08-20 07:36:31 -05:00
Disallow invalid text in tileset selectors
This commit is contained in:
@@ -47,6 +47,7 @@ and this project somewhat adheres to [Semantic Versioning](https://semver.org/sp
|
||||
- Fix `Ctrl+Shift+Z` not being set as a default shortcut for Redo in the Palette Editor like it is for other windows.
|
||||
- Fix the Tileset Editor's status bar not updating while selecting tiles in the metatile layer view.
|
||||
- Fix the Region Map Editor incorrectly displaying whether a `MAPSEC` has region map data.
|
||||
- Fix the Primary/Secondary Tileset selectors allowing invalid text, and considering a map unsaved if changed to invalid text then back again.
|
||||
- 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.
|
||||
|
||||
@@ -119,8 +119,8 @@ public:
|
||||
Q_INVOKABLE int getNumSecondaryTilesetTiles();
|
||||
Q_INVOKABLE QString getPrimaryTileset();
|
||||
Q_INVOKABLE QString getSecondaryTileset();
|
||||
Q_INVOKABLE void setPrimaryTileset(QString tileset);
|
||||
Q_INVOKABLE void setSecondaryTileset(QString tileset);
|
||||
Q_INVOKABLE void setPrimaryTileset(const QString &tileset);
|
||||
Q_INVOKABLE void setSecondaryTileset(const QString &tileset);
|
||||
void saveMetatilesByMetatileId(int metatileId);
|
||||
void saveMetatileAttributesByMetatileId(int metatileId);
|
||||
Metatile * getMetatile(int metatileId);
|
||||
@@ -251,8 +251,6 @@ private slots:
|
||||
void on_pushButton_AddConnection_clicked();
|
||||
void on_button_OpenDiveMap_clicked();
|
||||
void on_button_OpenEmergeMap_clicked();
|
||||
void on_comboBox_PrimaryTileset_currentTextChanged(const QString &arg1);
|
||||
void on_comboBox_SecondaryTileset_currentTextChanged(const QString &arg1);
|
||||
void on_pushButton_ChangeDimensions_clicked();
|
||||
|
||||
void resetMapViewScale();
|
||||
|
||||
@@ -320,10 +320,12 @@ void MainWindow::initExtraSignals() {
|
||||
connect(ui->action_NewMap, &QAction::triggered, this, &MainWindow::openNewMapDialog);
|
||||
connect(ui->action_NewLayout, &QAction::triggered, this, &MainWindow::openNewLayoutDialog);
|
||||
connect(ui->actionDuplicate_Current_Map_Layout, &QAction::triggered, this, &MainWindow::openDuplicateMapOrLayoutDialog);
|
||||
connect(ui->comboBox_LayoutSelector->lineEdit(), &QLineEdit::editingFinished, this, &MainWindow::onLayoutSelectorEditingFinished);
|
||||
connect(ui->comboBox_LayoutSelector, &NoScrollComboBox::editingFinished, this, &MainWindow::onLayoutSelectorEditingFinished);
|
||||
connect(ui->checkBox_smartPaths, &QCheckBox::toggled, this, &MainWindow::setSmartPathsEnabled);
|
||||
connect(ui->checkBox_ToggleBorder, &QCheckBox::toggled, this, &MainWindow::setBorderVisibility);
|
||||
connect(ui->checkBox_MirrorConnections, &QCheckBox::toggled, this, &MainWindow::setMirrorConnectionsEnabled);
|
||||
connect(ui->comboBox_PrimaryTileset, &NoScrollComboBox::editingFinished, [this] { setPrimaryTileset(ui->comboBox_PrimaryTileset->currentText()); });
|
||||
connect(ui->comboBox_SecondaryTileset, &NoScrollComboBox::editingFinished, [this] { setSecondaryTileset(ui->comboBox_SecondaryTileset->currentText()); });
|
||||
}
|
||||
|
||||
void MainWindow::on_actionCheck_for_Updates_triggered() {
|
||||
@@ -2761,26 +2763,38 @@ void MainWindow::on_button_OpenEmergeMap_clicked() {
|
||||
userSetMap(ui->comboBox_EmergeMap->currentText());
|
||||
}
|
||||
|
||||
void MainWindow::on_comboBox_PrimaryTileset_currentTextChanged(const QString &tilesetLabel)
|
||||
{
|
||||
if (editor->project->primaryTilesetLabels.contains(tilesetLabel) && editor->layout) {
|
||||
void MainWindow::setPrimaryTileset(const QString &tilesetLabel) {
|
||||
if (!this->editor->layout || this->editor->layout->tileset_primary_label == tilesetLabel)
|
||||
return;
|
||||
|
||||
if (editor->project->primaryTilesetLabels.contains(tilesetLabel)) {
|
||||
editor->updatePrimaryTileset(tilesetLabel);
|
||||
redrawMapScene();
|
||||
updateTilesetEditor();
|
||||
prefab.updatePrefabUi(editor->layout);
|
||||
markLayoutEdited();
|
||||
}
|
||||
|
||||
// Restore valid text if input was invalid, or sync combo box with new valid setting.
|
||||
const QSignalBlocker b(ui->comboBox_PrimaryTileset);
|
||||
ui->comboBox_PrimaryTileset->setTextItem(this->editor->layout->tileset_primary_label);
|
||||
}
|
||||
|
||||
void MainWindow::on_comboBox_SecondaryTileset_currentTextChanged(const QString &tilesetLabel)
|
||||
{
|
||||
if (editor->project->secondaryTilesetLabels.contains(tilesetLabel) && editor->layout) {
|
||||
void MainWindow::setSecondaryTileset(const QString &tilesetLabel) {
|
||||
if (!this->editor->layout || this->editor->layout->tileset_secondary_label == tilesetLabel)
|
||||
return;
|
||||
|
||||
if (editor->project->secondaryTilesetLabels.contains(tilesetLabel)) {
|
||||
editor->updateSecondaryTileset(tilesetLabel);
|
||||
redrawMapScene();
|
||||
updateTilesetEditor();
|
||||
prefab.updatePrefabUi(editor->layout);
|
||||
markLayoutEdited();
|
||||
}
|
||||
|
||||
// Restore valid text if input was invalid, or sync combo box with new valid setting.
|
||||
const QSignalBlocker b(ui->comboBox_SecondaryTileset);
|
||||
ui->comboBox_SecondaryTileset->setTextItem(this->editor->layout->tileset_secondary_label);
|
||||
}
|
||||
|
||||
void MainWindow::on_pushButton_ChangeDimensions_clicked() {
|
||||
|
||||
@@ -566,14 +566,6 @@ QString MainWindow::getSecondaryTileset() {
|
||||
return this->editor->layout->tileset_secondary->name;
|
||||
}
|
||||
|
||||
void MainWindow::setPrimaryTileset(QString tileset) {
|
||||
this->on_comboBox_PrimaryTileset_currentTextChanged(tileset);
|
||||
}
|
||||
|
||||
void MainWindow::setSecondaryTileset(QString tileset) {
|
||||
this->on_comboBox_SecondaryTileset_currentTextChanged(tileset);
|
||||
}
|
||||
|
||||
void MainWindow::saveMetatilesByMetatileId(int metatileId) {
|
||||
Tileset * tileset = Tileset::getMetatileTileset(metatileId, this->editor->layout->tileset_primary, this->editor->layout->tileset_secondary);
|
||||
if (tileset)
|
||||
|
||||
Reference in New Issue
Block a user