use a more descriptive warning message for the new map dimensions

This commit is contained in:
garakmon 2020-05-17 21:10:31 -04:00 committed by huderlem
parent 482d3cd8fb
commit 9f5b13c287
2 changed files with 13 additions and 2 deletions

View file

@ -314,7 +314,7 @@
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QToolButton" name="toolButton">
<widget class="QToolButton" name="toolButton_NewMap_DimensionWarning">
<property name="enabled">
<bool>false</bool>
</property>

View file

@ -47,7 +47,16 @@ bool NewMapPopup::checkNewMapDimensions() {
if (numMetatiles > maxMetatiles) {
ui->frame_NewMap_Warning->setVisible(true);
ui->label_NewMap_WarningMessage->setText("WARNING: The specified map dimensions are too large.");
//ui->label_NewMap_WarningMessage->setText("WARNING: The specified map dimensions are too large.");
QString errorText = QString("Error: The specified width and height are too large.\n"
"The maximum map width and height is the following: (width + 15) * (height + 14) <= %1\n"
"The specified map width and height was: (%2 + 15) * (%3 + 14) = %4")
.arg(maxMetatiles)
.arg(ui->spinBox_NewMap_Width->value())
.arg(ui->spinBox_NewMap_Height->value())
.arg(numMetatiles);
ui->label_NewMap_WarningMessage->setText(errorText);
ui->label_NewMap_WarningMessage->setWordWrap(true);
return false;
}
else {
@ -63,6 +72,8 @@ void NewMapPopup::connectSignals() {
ui->spinBox_NewMap_Width->setMaximum(project->getMaxMapWidth());
ui->spinBox_NewMap_Height->setMaximum(project->getMaxMapHeight());
ui->toolButton_NewMap_DimensionWarning->setIcon();
//ui->icon_NewMap_WarningIcon->setPixmap();
connect(ui->spinBox_NewMap_Width, QOverload<int>::of(&QSpinBox::valueChanged), [=](int){checkNewMapDimensions();});
connect(ui->spinBox_NewMap_Height, QOverload<int>::of(&QSpinBox::valueChanged), [=](int){checkNewMapDimensions();});