Restore last settings for new map popup
This commit is contained in:
parent
d451aaa8c0
commit
c50b8d0668
4 changed files with 164 additions and 173 deletions
|
@ -176,8 +176,7 @@ private slots:
|
||||||
void onMapNeedsRedrawing();
|
void onMapNeedsRedrawing();
|
||||||
void onTilesetsSaved(QString, QString);
|
void onTilesetsSaved(QString, QString);
|
||||||
void onWildMonDataChanged();
|
void onWildMonDataChanged();
|
||||||
void openNewMapPopupWindow(MapSortOrder, QVariant);
|
void openNewMapPopupWindow();
|
||||||
void openNewMapPopupWindowImportMap(MapLayout *);
|
|
||||||
void onNewMapCreated();
|
void onNewMapCreated();
|
||||||
void onMapCacheCleared();
|
void onMapCacheCleared();
|
||||||
void importMapFromAdvanceMap1_92();
|
void importMapFromAdvanceMap1_92();
|
||||||
|
|
|
@ -22,10 +22,10 @@ public:
|
||||||
bool existingLayout;
|
bool existingLayout;
|
||||||
bool importedMap;
|
bool importedMap;
|
||||||
QString layoutId;
|
QString layoutId;
|
||||||
|
void init();
|
||||||
void init(MapSortOrder type, QVariant data);
|
void init(MapSortOrder type, QVariant data);
|
||||||
void initImportMap(MapLayout *);
|
void init(MapLayout *);
|
||||||
void connectSignals();
|
static void setDefaultSettings(Project *project);
|
||||||
static void initSettings(Project *project);
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void applied();
|
void applied();
|
||||||
|
@ -33,12 +33,11 @@ signals:
|
||||||
private:
|
private:
|
||||||
Ui::NewMapPopup *ui;
|
Ui::NewMapPopup *ui;
|
||||||
Project *project;
|
Project *project;
|
||||||
void setDefaultValues(int, QString);
|
|
||||||
void setDefaultValuesImportMap(MapLayout *);
|
|
||||||
void setDefaultValuesProjectConfig();
|
|
||||||
bool checkNewMapDimensions();
|
bool checkNewMapDimensions();
|
||||||
bool checkNewMapGroup();
|
bool checkNewMapGroup();
|
||||||
void populateComboBoxes();
|
void saveSettings();
|
||||||
|
void useLayout(QString layoutId);
|
||||||
|
void useLayoutSettings(MapLayout *mapLayout);
|
||||||
|
|
||||||
struct Settings {
|
struct Settings {
|
||||||
QString group;
|
QString group;
|
||||||
|
@ -46,8 +45,8 @@ private:
|
||||||
int height;
|
int height;
|
||||||
int borderWidth;
|
int borderWidth;
|
||||||
int borderHeight;
|
int borderHeight;
|
||||||
QString primaryTileset;
|
QString primaryTilesetLabel;
|
||||||
QString secondaryTileset;
|
QString secondaryTilesetLabel;
|
||||||
QString type;
|
QString type;
|
||||||
QString location;
|
QString location;
|
||||||
QString song;
|
QString song;
|
||||||
|
|
|
@ -1141,20 +1141,20 @@ void MainWindow::onOpenMapListContextMenu(const QPoint &point)
|
||||||
|
|
||||||
void MainWindow::onAddNewMapToGroupClick(QAction* triggeredAction)
|
void MainWindow::onAddNewMapToGroupClick(QAction* triggeredAction)
|
||||||
{
|
{
|
||||||
int groupNum = triggeredAction->data().toInt();
|
openNewMapPopupWindow();
|
||||||
openNewMapPopupWindow(MapSortOrder::Group, groupNum);
|
this->newMapPrompt->init(MapSortOrder::Group, triggeredAction->data());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onAddNewMapToAreaClick(QAction* triggeredAction)
|
void MainWindow::onAddNewMapToAreaClick(QAction* triggeredAction)
|
||||||
{
|
{
|
||||||
QString secName = triggeredAction->data().toString();
|
openNewMapPopupWindow();
|
||||||
openNewMapPopupWindow(MapSortOrder::Area, secName);
|
this->newMapPrompt->init(MapSortOrder::Area, triggeredAction->data());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onAddNewMapToLayoutClick(QAction* triggeredAction)
|
void MainWindow::onAddNewMapToLayoutClick(QAction* triggeredAction)
|
||||||
{
|
{
|
||||||
QString layoutId = triggeredAction->data().toString();
|
openNewMapPopupWindow();
|
||||||
openNewMapPopupWindow(MapSortOrder::Layout, layoutId);
|
this->newMapPrompt->init(MapSortOrder::Layout, triggeredAction->data());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onNewMapCreated() {
|
void MainWindow::onNewMapCreated() {
|
||||||
|
@ -1191,9 +1191,10 @@ void MainWindow::onNewMapCreated() {
|
||||||
delete newMap;
|
delete newMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::openNewMapPopupWindow(MapSortOrder type, QVariant data) {
|
void MainWindow::openNewMapPopupWindow() {
|
||||||
if (!openedNewMapDialog) {
|
if (!openedNewMapDialog) {
|
||||||
NewMapPopup::initSettings(this->editor->project);
|
NewMapPopup::setDefaultSettings(this->editor->project);
|
||||||
|
openedNewMapDialog = true;
|
||||||
}
|
}
|
||||||
if (!this->newMapPrompt) {
|
if (!this->newMapPrompt) {
|
||||||
this->newMapPrompt = new NewMapPopup(this, this->editor->project);
|
this->newMapPrompt = new NewMapPopup(this, this->editor->project);
|
||||||
|
@ -1204,31 +1205,13 @@ void MainWindow::openNewMapPopupWindow(MapSortOrder type, QVariant data) {
|
||||||
this->newMapPrompt->raise();
|
this->newMapPrompt->raise();
|
||||||
this->newMapPrompt->activateWindow();
|
this->newMapPrompt->activateWindow();
|
||||||
}
|
}
|
||||||
this->newMapPrompt->init(type, data);
|
|
||||||
connect(this->newMapPrompt, &NewMapPopup::applied, this, &MainWindow::onNewMapCreated);
|
connect(this->newMapPrompt, &NewMapPopup::applied, this, &MainWindow::onNewMapCreated);
|
||||||
this->newMapPrompt->setAttribute(Qt::WA_DeleteOnClose);
|
this->newMapPrompt->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::openNewMapPopupWindowImportMap(MapLayout *mapLayout) {
|
|
||||||
if (!this->newMapPrompt) {
|
|
||||||
this->newMapPrompt = new NewMapPopup(this, this->editor->project);
|
|
||||||
}
|
|
||||||
if (!this->newMapPrompt->isVisible()) {
|
|
||||||
this->newMapPrompt->show();
|
|
||||||
} else {
|
|
||||||
this->newMapPrompt->raise();
|
|
||||||
this->newMapPrompt->activateWindow();
|
|
||||||
}
|
|
||||||
|
|
||||||
this->newMapPrompt->initImportMap(mapLayout);
|
|
||||||
|
|
||||||
connect(this->newMapPrompt, SIGNAL(applied()), this, SLOT(onNewMapCreated()));
|
|
||||||
connect(this->newMapPrompt, &QObject::destroyed, [=](QObject *) { this->newMapPrompt = nullptr; });
|
|
||||||
this->newMapPrompt->setAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::on_action_NewMap_triggered() {
|
void MainWindow::on_action_NewMap_triggered() {
|
||||||
openNewMapPopupWindow(MapSortOrder::Group, 0);
|
openNewMapPopupWindow();
|
||||||
|
this->newMapPrompt->init();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert label for newly-created tileset into sorted list of existing labels
|
// Insert label for newly-created tileset into sorted list of existing labels
|
||||||
|
@ -2466,7 +2449,8 @@ void MainWindow::importMapFromAdvanceMap1_92()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
openNewMapPopupWindowImportMap(mapLayout);
|
openNewMapPopupWindow();
|
||||||
|
this->newMapPrompt->init(mapLayout);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::showExportMapImageWindow(ImageExporterMode mode) {
|
void MainWindow::showExportMapImageWindow(ImageExporterMode mode) {
|
||||||
|
|
|
@ -23,67 +23,104 @@ NewMapPopup::NewMapPopup(QWidget *parent, Project *project) :
|
||||||
|
|
||||||
NewMapPopup::~NewMapPopup()
|
NewMapPopup::~NewMapPopup()
|
||||||
{
|
{
|
||||||
|
saveSettings();
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewMapPopup::initSettings(Project *project) {
|
void NewMapPopup::init() {
|
||||||
settings.group = project->groupNames.at(0);
|
// Populate combo boxes
|
||||||
settings.width = project->getDefaultMapSize();
|
|
||||||
settings.height = project->getDefaultMapSize();
|
|
||||||
settings.borderWidth = DEFAULT_BORDER_WIDTH;
|
|
||||||
settings.borderHeight = DEFAULT_BORDER_HEIGHT;
|
|
||||||
settings.primaryTileset = project->getDefaultPrimaryTilesetLabel();
|
|
||||||
settings.secondaryTileset = project->getDefaultSecondaryTilesetLabel();
|
|
||||||
settings.type = project->mapTypes.at(0);
|
|
||||||
settings.location = project->mapSectionValueToName.values().at(0);
|
|
||||||
settings.song = project->songNames.at(0);
|
|
||||||
settings.canFlyTo = false;
|
|
||||||
settings.showLocationName = true;
|
|
||||||
settings.allowRunning = false;
|
|
||||||
settings.allowBiking = false;
|
|
||||||
settings.allowEscaping = false;
|
|
||||||
settings.floorNumber = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void NewMapPopup::init(MapSortOrder type, QVariant data) {
|
|
||||||
int groupNum = 0;
|
|
||||||
QString mapSec = QString();
|
|
||||||
|
|
||||||
switch (type)
|
|
||||||
{
|
|
||||||
case MapSortOrder::Group:
|
|
||||||
groupNum = data.toInt();
|
|
||||||
break;
|
|
||||||
case MapSortOrder::Area:
|
|
||||||
mapSec = data.toString();
|
|
||||||
break;
|
|
||||||
case MapSortOrder::Layout:
|
|
||||||
this->existingLayout = true;
|
|
||||||
this->layoutId = data.toString();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
populateComboBoxes();
|
|
||||||
setDefaultValues(groupNum, mapSec);
|
|
||||||
setDefaultValuesProjectConfig();
|
|
||||||
connectSignals();
|
|
||||||
}
|
|
||||||
|
|
||||||
void NewMapPopup::initImportMap(MapLayout *mapLayout) {
|
|
||||||
this->importedMap = true;
|
|
||||||
populateComboBoxes();
|
|
||||||
setDefaultValuesImportMap(mapLayout);
|
|
||||||
setDefaultValuesProjectConfig();
|
|
||||||
connectSignals();
|
|
||||||
}
|
|
||||||
|
|
||||||
void NewMapPopup::populateComboBoxes() {
|
|
||||||
ui->comboBox_NewMap_Primary_Tileset->addItems(project->primaryTilesetLabels);
|
ui->comboBox_NewMap_Primary_Tileset->addItems(project->primaryTilesetLabels);
|
||||||
ui->comboBox_NewMap_Secondary_Tileset->addItems(project->secondaryTilesetLabels);
|
ui->comboBox_NewMap_Secondary_Tileset->addItems(project->secondaryTilesetLabels);
|
||||||
ui->comboBox_NewMap_Group->addItems(project->groupNames);
|
ui->comboBox_NewMap_Group->addItems(project->groupNames);
|
||||||
ui->comboBox_NewMap_Song->addItems(project->songNames);
|
ui->comboBox_NewMap_Song->addItems(project->songNames);
|
||||||
ui->comboBox_NewMap_Type->addItems(project->mapTypes);
|
ui->comboBox_NewMap_Type->addItems(project->mapTypes);
|
||||||
ui->comboBox_NewMap_Location->addItems(project->mapSectionValueToName.values());
|
ui->comboBox_NewMap_Location->addItems(project->mapSectionValueToName.values());
|
||||||
|
|
||||||
|
// Set spin box limits
|
||||||
|
ui->spinBox_NewMap_Width->setMinimum(1);
|
||||||
|
ui->spinBox_NewMap_Height->setMinimum(1);
|
||||||
|
ui->spinBox_NewMap_Width->setMaximum(project->getMaxMapWidth());
|
||||||
|
ui->spinBox_NewMap_Height->setMaximum(project->getMaxMapHeight());
|
||||||
|
ui->spinBox_NewMap_BorderWidth->setMinimum(1);
|
||||||
|
ui->spinBox_NewMap_BorderHeight->setMinimum(1);
|
||||||
|
ui->spinBox_NewMap_Floor_Number->setMinimum(-128);
|
||||||
|
ui->spinBox_NewMap_Floor_Number->setMaximum(127);
|
||||||
|
|
||||||
|
// Hide config specific ui elements
|
||||||
|
bool hasFlags = (projectConfig.getBaseGameVersion() != BaseGameVersion::pokeruby);
|
||||||
|
ui->checkBox_NewMap_Allow_Running->setVisible(hasFlags);
|
||||||
|
ui->checkBox_NewMap_Allow_Biking->setVisible(hasFlags);
|
||||||
|
ui->checkBox_NewMap_Allow_Escape_Rope->setVisible(hasFlags);
|
||||||
|
ui->label_NewMap_Allow_Running->setVisible(hasFlags);
|
||||||
|
ui->label_NewMap_Allow_Biking->setVisible(hasFlags);
|
||||||
|
ui->label_NewMap_Allow_Escape_Rope->setVisible(hasFlags);
|
||||||
|
|
||||||
|
bool hasCustomBorders = projectConfig.getUseCustomBorderSize();
|
||||||
|
ui->spinBox_NewMap_BorderWidth->setVisible(hasCustomBorders);
|
||||||
|
ui->spinBox_NewMap_BorderHeight->setVisible(hasCustomBorders);
|
||||||
|
ui->label_NewMap_BorderWidth->setVisible(hasCustomBorders);
|
||||||
|
ui->label_NewMap_BorderHeight->setVisible(hasCustomBorders);
|
||||||
|
|
||||||
|
bool hasFloorNumber = projectConfig.getFloorNumberEnabled();
|
||||||
|
ui->spinBox_NewMap_Floor_Number->setVisible(hasFloorNumber);
|
||||||
|
ui->label_NewMap_Floor_Number->setVisible(hasFloorNumber);
|
||||||
|
|
||||||
|
// Restore previous settings
|
||||||
|
ui->lineEdit_NewMap_Name->setText(project->getNewMapName());
|
||||||
|
ui->comboBox_NewMap_Group->setTextItem(settings.group);
|
||||||
|
ui->spinBox_NewMap_Width->setValue(settings.width);
|
||||||
|
ui->spinBox_NewMap_Height->setValue(settings.height);
|
||||||
|
ui->spinBox_NewMap_BorderWidth->setValue(settings.borderWidth);
|
||||||
|
ui->spinBox_NewMap_BorderHeight->setValue(settings.borderHeight);
|
||||||
|
ui->comboBox_NewMap_Primary_Tileset->setTextItem(settings.primaryTilesetLabel);
|
||||||
|
ui->comboBox_NewMap_Secondary_Tileset->setTextItem(settings.secondaryTilesetLabel);
|
||||||
|
ui->comboBox_NewMap_Type->setTextItem(settings.type);
|
||||||
|
ui->comboBox_NewMap_Location->setTextItem(settings.location);
|
||||||
|
ui->comboBox_NewMap_Song->setTextItem(settings.song);
|
||||||
|
ui->checkBox_NewMap_Flyable->setChecked(settings.canFlyTo);
|
||||||
|
ui->checkBox_NewMap_Show_Location->setChecked(settings.showLocationName);
|
||||||
|
ui->checkBox_NewMap_Allow_Running->setChecked(settings.allowRunning);
|
||||||
|
ui->checkBox_NewMap_Allow_Biking->setChecked(settings.allowBiking);
|
||||||
|
ui->checkBox_NewMap_Allow_Escape_Rope->setChecked(settings.allowEscaping);
|
||||||
|
ui->spinBox_NewMap_Floor_Number->setValue(settings.floorNumber);
|
||||||
|
|
||||||
|
// Connect signals
|
||||||
|
connect(ui->spinBox_NewMap_Width, QOverload<int>::of(&QSpinBox::valueChanged), [=](int){checkNewMapDimensions();});
|
||||||
|
connect(ui->spinBox_NewMap_Height, QOverload<int>::of(&QSpinBox::valueChanged), [=](int){checkNewMapDimensions();});
|
||||||
|
|
||||||
|
ui->frame_NewMap_Options->setEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Creating new map by right-clicking in the map list
|
||||||
|
void NewMapPopup::init(MapSortOrder type, QVariant data) {
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case MapSortOrder::Group:
|
||||||
|
settings.group = project->groupNames.at(data.toInt());
|
||||||
|
break;
|
||||||
|
case MapSortOrder::Area:
|
||||||
|
settings.location = data.toString();
|
||||||
|
break;
|
||||||
|
case MapSortOrder::Layout:
|
||||||
|
useLayout(data.toString());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Creating new map from AdvanceMap import
|
||||||
|
void NewMapPopup::init(MapLayout *mapLayout) {
|
||||||
|
this->importedMap = true;
|
||||||
|
useLayoutSettings(mapLayout);
|
||||||
|
|
||||||
|
this->map = new Map();
|
||||||
|
this->map->layout = new MapLayout();
|
||||||
|
this->map->layout->blockdata = mapLayout->blockdata;
|
||||||
|
|
||||||
|
if (!mapLayout->border.isEmpty()) {
|
||||||
|
this->map->layout->border = mapLayout->border;
|
||||||
|
}
|
||||||
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NewMapPopup::checkNewMapDimensions() {
|
bool NewMapPopup::checkNewMapDimensions() {
|
||||||
|
@ -127,94 +164,66 @@ bool NewMapPopup::checkNewMapGroup() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewMapPopup::connectSignals() {
|
void NewMapPopup::setDefaultSettings(Project *project) {
|
||||||
ui->spinBox_NewMap_Width->setMinimum(1);
|
settings.group = project->groupNames.at(0);
|
||||||
ui->spinBox_NewMap_Height->setMinimum(1);
|
settings.width = project->getDefaultMapSize();
|
||||||
ui->spinBox_NewMap_Width->setMaximum(project->getMaxMapWidth());
|
settings.height = project->getDefaultMapSize();
|
||||||
ui->spinBox_NewMap_Height->setMaximum(project->getMaxMapHeight());
|
settings.borderWidth = DEFAULT_BORDER_WIDTH;
|
||||||
|
settings.borderHeight = DEFAULT_BORDER_HEIGHT;
|
||||||
connect(ui->spinBox_NewMap_Width, QOverload<int>::of(&QSpinBox::valueChanged), [=](int){checkNewMapDimensions();});
|
settings.primaryTilesetLabel = project->getDefaultPrimaryTilesetLabel();
|
||||||
connect(ui->spinBox_NewMap_Height, QOverload<int>::of(&QSpinBox::valueChanged), [=](int){checkNewMapDimensions();});
|
settings.secondaryTilesetLabel = project->getDefaultSecondaryTilesetLabel();
|
||||||
|
settings.type = project->mapTypes.at(0);
|
||||||
|
settings.location = project->mapSectionValueToName.values().at(0);
|
||||||
|
settings.song = project->songNames.at(0);
|
||||||
|
settings.canFlyTo = false;
|
||||||
|
settings.showLocationName = true;
|
||||||
|
settings.allowRunning = false;
|
||||||
|
settings.allowBiking = false;
|
||||||
|
settings.allowEscaping = false;
|
||||||
|
settings.floorNumber = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewMapPopup::setDefaultValues(int groupNum, QString mapSec) {
|
void NewMapPopup::saveSettings() {
|
||||||
ui->lineEdit_NewMap_Name->setText(project->getNewMapName());
|
settings.group = ui->comboBox_NewMap_Group->currentText();
|
||||||
|
settings.width = ui->spinBox_NewMap_Width->value();
|
||||||
|
settings.height = ui->spinBox_NewMap_Height->value();
|
||||||
|
settings.borderWidth = ui->spinBox_NewMap_BorderWidth->value();
|
||||||
|
settings.borderHeight = ui->spinBox_NewMap_BorderHeight->value();
|
||||||
|
settings.primaryTilesetLabel = ui->comboBox_NewMap_Primary_Tileset->currentText();
|
||||||
|
settings.secondaryTilesetLabel = ui->comboBox_NewMap_Secondary_Tileset->currentText();
|
||||||
|
settings.type = ui->comboBox_NewMap_Type->currentText();
|
||||||
|
settings.location = ui->comboBox_NewMap_Location->currentText();
|
||||||
|
settings.song = ui->comboBox_NewMap_Song->currentText();
|
||||||
|
settings.canFlyTo = ui->checkBox_NewMap_Flyable->isChecked();
|
||||||
|
settings.showLocationName = ui->checkBox_NewMap_Show_Location->isChecked();
|
||||||
|
settings.allowRunning = ui->checkBox_NewMap_Allow_Running->isChecked();
|
||||||
|
settings.allowBiking = ui->checkBox_NewMap_Allow_Biking->isChecked();
|
||||||
|
settings.allowEscaping = ui->checkBox_NewMap_Allow_Escape_Rope->isChecked();
|
||||||
|
settings.floorNumber = ui->spinBox_NewMap_Floor_Number->value();
|
||||||
|
}
|
||||||
|
|
||||||
ui->comboBox_NewMap_Group->setTextItem(project->groupNames.at(groupNum));
|
void NewMapPopup::useLayoutSettings(MapLayout *layout) {
|
||||||
|
if (!layout) return;
|
||||||
|
settings.width = layout->width;
|
||||||
|
settings.height = layout->height;
|
||||||
|
settings.borderWidth = layout->border_width;
|
||||||
|
settings.borderHeight = layout->border_height;
|
||||||
|
settings.primaryTilesetLabel = layout->tileset_primary_label;
|
||||||
|
settings.secondaryTilesetLabel = layout->tileset_secondary_label;
|
||||||
|
}
|
||||||
|
|
||||||
if (this->existingLayout) {
|
void NewMapPopup::useLayout(QString layoutId) {
|
||||||
MapLayout * layout = project->mapLayouts.value(layoutId);
|
this->existingLayout = true;
|
||||||
ui->spinBox_NewMap_Width->setValue(layout->width);
|
this->layoutId = layoutId;
|
||||||
ui->spinBox_NewMap_Height->setValue(layout->height);
|
useLayoutSettings(project->mapLayouts.value(this->layoutId));
|
||||||
ui->spinBox_NewMap_BorderWidth->setValue(layout->border_width);
|
|
||||||
ui->spinBox_NewMap_BorderHeight->setValue(layout->border_height);
|
// Dimensions and tilesets can't be changed for new maps using an existing layout
|
||||||
ui->comboBox_NewMap_Primary_Tileset->setTextItem(layout->tileset_primary_label);
|
|
||||||
ui->comboBox_NewMap_Secondary_Tileset->setTextItem(layout->tileset_secondary_label);
|
|
||||||
ui->spinBox_NewMap_Width->setDisabled(true);
|
ui->spinBox_NewMap_Width->setDisabled(true);
|
||||||
ui->spinBox_NewMap_Height->setDisabled(true);
|
ui->spinBox_NewMap_Height->setDisabled(true);
|
||||||
ui->spinBox_NewMap_BorderWidth->setDisabled(true);
|
ui->spinBox_NewMap_BorderWidth->setDisabled(true);
|
||||||
ui->spinBox_NewMap_BorderHeight->setDisabled(true);
|
ui->spinBox_NewMap_BorderHeight->setDisabled(true);
|
||||||
ui->comboBox_NewMap_Primary_Tileset->setDisabled(true);
|
ui->comboBox_NewMap_Primary_Tileset->setDisabled(true);
|
||||||
ui->comboBox_NewMap_Secondary_Tileset->setDisabled(true);
|
ui->comboBox_NewMap_Secondary_Tileset->setDisabled(true);
|
||||||
} else {
|
|
||||||
ui->spinBox_NewMap_Width->setValue(project->getDefaultMapSize());
|
|
||||||
ui->spinBox_NewMap_Height->setValue(project->getDefaultMapSize());
|
|
||||||
ui->spinBox_NewMap_BorderWidth->setValue(DEFAULT_BORDER_WIDTH);
|
|
||||||
ui->spinBox_NewMap_BorderHeight->setValue(DEFAULT_BORDER_HEIGHT);
|
|
||||||
ui->comboBox_NewMap_Primary_Tileset->setTextItem(project->getDefaultPrimaryTilesetLabel());
|
|
||||||
ui->comboBox_NewMap_Secondary_Tileset->setTextItem(project->getDefaultSecondaryTilesetLabel());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!mapSec.isEmpty()) ui->comboBox_NewMap_Location->setTextItem(mapSec);
|
|
||||||
ui->checkBox_NewMap_Show_Location->setChecked(true);
|
|
||||||
|
|
||||||
ui->frame_NewMap_Options->setEnabled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void NewMapPopup::setDefaultValuesImportMap(MapLayout *mapLayout) {
|
|
||||||
ui->lineEdit_NewMap_Name->setText(project->getNewMapName());
|
|
||||||
|
|
||||||
ui->comboBox_NewMap_Group->setTextItem(project->groupNames.at(0));
|
|
||||||
|
|
||||||
ui->spinBox_NewMap_Width->setValue(mapLayout->width);
|
|
||||||
ui->spinBox_NewMap_Height->setValue(mapLayout->height);
|
|
||||||
ui->spinBox_NewMap_BorderWidth->setValue(mapLayout->border_width);
|
|
||||||
ui->spinBox_NewMap_BorderHeight->setValue(mapLayout->border_height);
|
|
||||||
|
|
||||||
ui->comboBox_NewMap_Primary_Tileset->setTextItem(mapLayout->tileset_primary_label);
|
|
||||||
ui->comboBox_NewMap_Secondary_Tileset->setTextItem(mapLayout->tileset_secondary_label);
|
|
||||||
|
|
||||||
ui->checkBox_NewMap_Show_Location->setChecked(true);
|
|
||||||
|
|
||||||
ui->frame_NewMap_Options->setEnabled(true);
|
|
||||||
|
|
||||||
this->map = new Map();
|
|
||||||
this->map->layout = new MapLayout();
|
|
||||||
this->map->layout->blockdata = mapLayout->blockdata;
|
|
||||||
|
|
||||||
if (!mapLayout->border.isEmpty()) {
|
|
||||||
this->map->layout->border = mapLayout->border;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void NewMapPopup::setDefaultValuesProjectConfig() {
|
|
||||||
bool hasFlags = (projectConfig.getBaseGameVersion() != BaseGameVersion::pokeruby);
|
|
||||||
ui->checkBox_NewMap_Allow_Running->setVisible(hasFlags);
|
|
||||||
ui->checkBox_NewMap_Allow_Biking->setVisible(hasFlags);
|
|
||||||
ui->checkBox_NewMap_Allow_Escape_Rope->setVisible(hasFlags);
|
|
||||||
ui->label_NewMap_Allow_Running->setVisible(hasFlags);
|
|
||||||
ui->label_NewMap_Allow_Biking->setVisible(hasFlags);
|
|
||||||
ui->label_NewMap_Allow_Escape_Rope->setVisible(hasFlags);
|
|
||||||
|
|
||||||
bool hasCustomBorders = projectConfig.getUseCustomBorderSize();
|
|
||||||
ui->spinBox_NewMap_BorderWidth->setVisible(hasCustomBorders);
|
|
||||||
ui->spinBox_NewMap_BorderHeight->setVisible(hasCustomBorders);
|
|
||||||
ui->label_NewMap_BorderWidth->setVisible(hasCustomBorders);
|
|
||||||
ui->label_NewMap_BorderHeight->setVisible(hasCustomBorders);
|
|
||||||
|
|
||||||
bool hasFloorNumber = projectConfig.getFloorNumberEnabled();
|
|
||||||
ui->spinBox_NewMap_Floor_Number->setVisible(hasFloorNumber);
|
|
||||||
ui->label_NewMap_Floor_Number->setVisible(hasFloorNumber);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewMapPopup::on_lineEdit_NewMap_Name_textChanged(const QString &text) {
|
void NewMapPopup::on_lineEdit_NewMap_Name_textChanged(const QString &text) {
|
||||||
|
|
Loading…
Reference in a new issue