diff --git a/include/config.h b/include/config.h index 083fea78..926e93c6 100644 --- a/include/config.h +++ b/include/config.h @@ -137,6 +137,8 @@ public: QVersionNumber lastUpdateCheckVersion; QMap rateLimitTimes; QByteArray wildMonChartGeometry; + QByteArray newMapDialogGeometry; + QByteArray newLayoutDialogGeometry; protected: virtual QString getConfigFilepath() override; diff --git a/src/config.cpp b/src/config.cpp index c25eb239..ce78d8b9 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -349,6 +349,10 @@ void PorymapConfig::parseConfigKeyValue(QString key, QString value) { this->customScriptsEditorState = bytesFromString(value); } else if (key == "wild_mon_chart_geometry") { this->wildMonChartGeometry = bytesFromString(value); + } else if (key == "new_map_dialog_geometry") { + this->newMapDialogGeometry = bytesFromString(value); + } else if (key == "new_layout_dialog_geometry") { + this->newLayoutDialogGeometry = bytesFromString(value); } else if (key == "metatiles_zoom") { this->metatilesZoom = getConfigInteger(key, value, 10, 100, 30); } else if (key == "collision_zoom") { @@ -441,6 +445,8 @@ QMap PorymapConfig::getKeyValueMap() { map.insert("custom_scripts_editor_geometry", stringFromByteArray(this->customScriptsEditorGeometry)); map.insert("custom_scripts_editor_state", stringFromByteArray(this->customScriptsEditorState)); map.insert("wild_mon_chart_geometry", stringFromByteArray(this->wildMonChartGeometry)); + map.insert("new_map_dialog_geometry", stringFromByteArray(this->newMapDialogGeometry)); + map.insert("new_layout_dialog_geometry", stringFromByteArray(this->newLayoutDialogGeometry)); map.insert("mirror_connecting_maps", this->mirrorConnectingMaps ? "1" : "0"); map.insert("show_dive_emerge_maps", this->showDiveEmergeMaps ? "1" : "0"); map.insert("dive_emerge_map_opacity", QString::number(this->diveEmergeMapOpacity)); diff --git a/src/ui/maplistmodels.cpp b/src/ui/maplistmodels.cpp index e74d0a93..d08bb2cf 100644 --- a/src/ui/maplistmodels.cpp +++ b/src/ui/maplistmodels.cpp @@ -104,7 +104,6 @@ QStandardItem *MapListModel::createMapItem(const QString &mapName, QStandardItem map->setData(mapName, MapListUserRoles::NameRole); map->setData("map_name", MapListUserRoles::TypeRole); map->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled | Qt::ItemNeverHasChildren); - map->setEditable(this->editable); // Will override flags if necessary map->setToolTip(this->project->mapNamesToMapConstants.value(mapName)); this->mapItems.insert(mapName, map); return map; diff --git a/src/ui/newlayoutdialog.cpp b/src/ui/newlayoutdialog.cpp index 537a3092..779a4694 100644 --- a/src/ui/newlayoutdialog.cpp +++ b/src/ui/newlayoutdialog.cpp @@ -42,11 +42,18 @@ NewLayoutDialog::NewLayoutDialog(Project *project, const Layout *layoutToCopy, Q connect(ui->buttonBox, &QDialogButtonBox::clicked, this, &NewLayoutDialog::dialogButtonClicked); refresh(); - adjustSize(); + + if (porymapConfig.newLayoutDialogGeometry.isEmpty()){ + // On first display resize to fit contents a little better + adjustSize(); + } else { + restoreGeometry(porymapConfig.newLayoutDialogGeometry); + } } NewLayoutDialog::~NewLayoutDialog() { + porymapConfig.newLayoutDialogGeometry = saveGeometry(); saveSettings(); delete ui; } diff --git a/src/ui/newmapdialog.cpp b/src/ui/newmapdialog.cpp index 3ce36869..521878c5 100644 --- a/src/ui/newmapdialog.cpp +++ b/src/ui/newmapdialog.cpp @@ -63,6 +63,7 @@ NewMapDialog::NewMapDialog(Project *project, const Map *mapToCopy, QWidget *pare connect(ui->buttonBox, &QDialogButtonBox::clicked, this, &NewMapDialog::dialogButtonClicked); refresh(); + restoreGeometry(porymapConfig.newMapDialogGeometry); } // Adding new map to an existing map list folder. Initialize settings accordingly. @@ -91,6 +92,7 @@ NewMapDialog::NewMapDialog(Project *project, int mapListTab, const QString &mapL NewMapDialog::~NewMapDialog() { + porymapConfig.newMapDialogGeometry = saveGeometry(); saveSettings(); delete ui; }