Revert 80c5f74368
and validate map group
This commit is contained in:
parent
a4fc2bcb30
commit
f166652ccc
3 changed files with 23 additions and 6 deletions
|
@ -69,7 +69,7 @@
|
||||||
<string><html><head/><body><p>New map group.</p></body></html></string>
|
<string><html><head/><body><p>New map group.</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="editable">
|
<property name="editable">
|
||||||
<bool>false</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -33,6 +33,7 @@ private:
|
||||||
Project *project;
|
Project *project;
|
||||||
void setDefaultValues(int, QString);
|
void setDefaultValues(int, QString);
|
||||||
bool checkNewMapDimensions();
|
bool checkNewMapDimensions();
|
||||||
|
bool checkNewMapGroup();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_pushButton_NewMap_Accept_clicked();
|
void on_pushButton_NewMap_Accept_clicked();
|
||||||
|
|
|
@ -64,7 +64,24 @@ bool NewMapPopup::checkNewMapDimensions() {
|
||||||
ui->label_NewMap_WarningMessage->clear();
|
ui->label_NewMap_WarningMessage->clear();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
|
bool NewMapPopup::checkNewMapGroup() {
|
||||||
|
group = project->groupNames.indexOf(this->ui->comboBox_NewMap_Group->currentText());
|
||||||
|
|
||||||
|
if (group < 0) {
|
||||||
|
ui->frame_NewMap_Warning->setVisible(true);
|
||||||
|
QString errorText = QString("Error: The specified map group '%1' does not exist.")
|
||||||
|
.arg(ui->comboBox_NewMap_Group->currentText());
|
||||||
|
ui->label_NewMap_WarningMessage->setText(errorText);
|
||||||
|
ui->label_NewMap_WarningMessage->setWordWrap(true);
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
ui->frame_NewMap_Warning->setVisible(false);
|
||||||
|
ui->label_NewMap_WarningMessage->clear();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void NewMapPopup::connectSignals() {
|
void NewMapPopup::connectSignals() {
|
||||||
ui->spinBox_NewMap_Width->setMinimum(1);
|
ui->spinBox_NewMap_Width->setMinimum(1);
|
||||||
|
@ -177,8 +194,8 @@ void NewMapPopup::on_lineEdit_NewMap_Name_textChanged(const QString &text) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewMapPopup::on_pushButton_NewMap_Accept_clicked() {
|
void NewMapPopup::on_pushButton_NewMap_Accept_clicked() {
|
||||||
if (!checkNewMapDimensions()) {
|
if (!checkNewMapDimensions() || !checkNewMapGroup()) {
|
||||||
// ignore when map dimensions are invalid
|
// ignore when map dimensions or map group are invalid
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Map *newMap = new Map;
|
Map *newMap = new Map;
|
||||||
|
@ -236,7 +253,6 @@ void NewMapPopup::on_pushButton_NewMap_Accept_clicked() {
|
||||||
newMap->floorNumber = this->ui->spinBox_NewMap_Floor_Number->value();
|
newMap->floorNumber = this->ui->spinBox_NewMap_Floor_Number->value();
|
||||||
}
|
}
|
||||||
|
|
||||||
group = project->groupNames.indexOf(this->ui->comboBox_NewMap_Group->currentText());
|
|
||||||
newMap->layout = layout;
|
newMap->layout = layout;
|
||||||
newMap->layoutId = layout->id;
|
newMap->layoutId = layout->id;
|
||||||
if (this->existingLayout) {
|
if (this->existingLayout) {
|
||||||
|
|
Loading…
Reference in a new issue