Use UIntSpinBox for metatile attribute settings
This commit is contained in:
parent
603df4defa
commit
30a01b7061
3 changed files with 27 additions and 5 deletions
|
@ -331,6 +331,9 @@
|
||||||
<property name="displayIntegerBase">
|
<property name="displayIntegerBase">
|
||||||
<number>16</number>
|
<number>16</number>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="hasPadding">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="2" column="0">
|
||||||
|
@ -388,6 +391,9 @@
|
||||||
<property name="displayIntegerBase">
|
<property name="displayIntegerBase">
|
||||||
<number>16</number>
|
<number>16</number>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="hasPadding">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="10" column="0">
|
<item row="10" column="0">
|
||||||
|
@ -421,6 +427,9 @@
|
||||||
<property name="displayIntegerBase">
|
<property name="displayIntegerBase">
|
||||||
<number>16</number>
|
<number>16</number>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="hasPadding">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0">
|
<item row="5" column="0">
|
||||||
|
@ -448,6 +457,9 @@
|
||||||
<property name="displayIntegerBase">
|
<property name="displayIntegerBase">
|
||||||
<number>16</number>
|
<number>16</number>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="hasPadding">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|
|
@ -49,6 +49,7 @@ private slots:
|
||||||
void dialogButtonClicked(QAbstractButton *button);
|
void dialogButtonClicked(QAbstractButton *button);
|
||||||
void choosePrefabsFileClicked(bool);
|
void choosePrefabsFileClicked(bool);
|
||||||
void importDefaultPrefabsClicked(bool);
|
void importDefaultPrefabsClicked(bool);
|
||||||
|
void updateAttributeLimits(const QString &attrSize);
|
||||||
void markEdited();
|
void markEdited();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ void ProjectSettingsEditor::connectSignals() {
|
||||||
connect(ui->button_ChoosePrefabs, &QAbstractButton::clicked, this, &ProjectSettingsEditor::choosePrefabsFileClicked);
|
connect(ui->button_ChoosePrefabs, &QAbstractButton::clicked, this, &ProjectSettingsEditor::choosePrefabsFileClicked);
|
||||||
connect(ui->button_ImportDefaultPrefabs, &QAbstractButton::clicked, this, &ProjectSettingsEditor::importDefaultPrefabsClicked);
|
connect(ui->button_ImportDefaultPrefabs, &QAbstractButton::clicked, this, &ProjectSettingsEditor::importDefaultPrefabsClicked);
|
||||||
connect(ui->comboBox_BaseGameVersion, &QComboBox::currentTextChanged, this, &ProjectSettingsEditor::promptRestoreDefaults);
|
connect(ui->comboBox_BaseGameVersion, &QComboBox::currentTextChanged, this, &ProjectSettingsEditor::promptRestoreDefaults);
|
||||||
|
connect(ui->comboBox_AttributesSize, &QComboBox::currentTextChanged, this, &ProjectSettingsEditor::updateAttributeLimits);
|
||||||
|
|
||||||
// Record that there are unsaved changes if any of the settings are modified
|
// Record that there are unsaved changes if any of the settings are modified
|
||||||
for (auto combo : ui->centralwidget->findChildren<NoScrollComboBox *>())
|
for (auto combo : ui->centralwidget->findChildren<NoScrollComboBox *>())
|
||||||
|
@ -71,12 +72,19 @@ void ProjectSettingsEditor::initUi() {
|
||||||
|
|
||||||
ui->spinBox_Elevation->setMaximum(15);
|
ui->spinBox_Elevation->setMaximum(15);
|
||||||
ui->spinBox_FillMetatile->setMaximum(Project::getNumMetatilesTotal() - 1);
|
ui->spinBox_FillMetatile->setMaximum(Project::getNumMetatilesTotal() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: These need to be subclassed (or changed to line edits) to handle larger values
|
void ProjectSettingsEditor::updateAttributeLimits(const QString &attrSize) {
|
||||||
ui->spinBox_BehaviorMask->setMaximum(UINT_MAX);
|
QMap<QString, uint32_t> limits {
|
||||||
ui->spinBox_EncounterTypeMask->setMaximum(UINT_MAX);
|
{"1", 0xFF},
|
||||||
ui->spinBox_LayerTypeMask->setMaximum(UINT_MAX);
|
{"2", 0xFFFF},
|
||||||
ui->spinBox_TerrainTypeMask->setMaximum(UINT_MAX);
|
{"4", 0xFFFFFFFF},
|
||||||
|
};
|
||||||
|
uint32_t max = limits.value(attrSize, UINT_MAX);
|
||||||
|
ui->spinBox_BehaviorMask->setMaximum(max);
|
||||||
|
ui->spinBox_EncounterTypeMask->setMaximum(max);
|
||||||
|
ui->spinBox_LayerTypeMask->setMaximum(max);
|
||||||
|
ui->spinBox_TerrainTypeMask->setMaximum(max);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectSettingsEditor::createProjectPathsTable() {
|
void ProjectSettingsEditor::createProjectPathsTable() {
|
||||||
|
@ -151,6 +159,7 @@ void ProjectSettingsEditor::refresh() {
|
||||||
ui->comboBox_DefaultSecondaryTileset->setTextItem(projectConfig.getDefaultSecondaryTileset());
|
ui->comboBox_DefaultSecondaryTileset->setTextItem(projectConfig.getDefaultSecondaryTileset());
|
||||||
ui->comboBox_BaseGameVersion->setTextItem(projectConfig.getBaseGameVersionString());
|
ui->comboBox_BaseGameVersion->setTextItem(projectConfig.getBaseGameVersionString());
|
||||||
ui->comboBox_AttributesSize->setTextItem(QString::number(projectConfig.getMetatileAttributesSize()));
|
ui->comboBox_AttributesSize->setTextItem(QString::number(projectConfig.getMetatileAttributesSize()));
|
||||||
|
this->updateAttributeLimits(ui->comboBox_AttributesSize->currentText());
|
||||||
|
|
||||||
// Set check box states
|
// Set check box states
|
||||||
ui->checkBox_UsePoryscript->setChecked(projectConfig.getUsePoryScript());
|
ui->checkBox_UsePoryscript->setChecked(projectConfig.getUsePoryScript());
|
||||||
|
|
Loading…
Reference in a new issue