diff --git a/forms/newlayoutdialog.ui b/forms/newlayoutdialog.ui
index 42c7733c..980b5351 100644
--- a/forms/newlayoutdialog.ui
+++ b/forms/newlayoutdialog.ui
@@ -68,6 +68,9 @@
<html><head/><body><p>The constant that will be used to refer to this layout. It cannot be the same as any other existing layout.</p></body></html>
+
+ LAYOUT_MY_NEW_LAYOUT
+
true
@@ -92,6 +95,9 @@
<html><head/><body><p>The name of the new layout. The name cannot be the same as any other existing layout.</p></body></html>
+
+ MyNewLayout
+
true
diff --git a/forms/newmapdialog.ui b/forms/newmapdialog.ui
index 6b32810a..604800f8 100644
--- a/forms/newmapdialog.ui
+++ b/forms/newmapdialog.ui
@@ -185,6 +185,9 @@
<html><head/><body><p>The name of the new map. The name cannot be the same as any other existing map.</p></body></html>
+
+ MyNewMap
+
true
diff --git a/include/project.h b/include/project.h
index c29a11b4..9fb4e2ed 100644
--- a/include/project.h
+++ b/include/project.h
@@ -133,8 +133,6 @@ public:
NewMapSettings newMapSettings;
Layout::Settings newLayoutSettings;
- QString getNewMapName() const;
- QString getNewLayoutName() const;
void initNewMapSettings();
void initNewLayoutSettings();
diff --git a/src/core/maplayout.cpp b/src/core/maplayout.cpp
index 26d4cb89..e2549897 100644
--- a/src/core/maplayout.cpp
+++ b/src/core/maplayout.cpp
@@ -32,6 +32,7 @@ void Layout::copyFrom(const Layout *other) {
this->border = other->border;
}
+// When we create a layout automatically for a new map we add this suffix to differentiate the layout name from the map name.
QString Layout::defaultSuffix() {
return "_Layout";
}
diff --git a/src/project.cpp b/src/project.cpp
index 9fff8710..f8ccd768 100644
--- a/src/project.cpp
+++ b/src/project.cpp
@@ -1995,28 +1995,8 @@ QString Project::toUniqueIdentifier(const QString &identifier) const {
return uniqueIdentifier;
}
-QString Project::getNewMapName() const {
- // Ensure default name/ID doesn't already exist.
- int suffix = 1;
- QString newMapName;
- do {
- newMapName = QString("NewMap%1").arg(suffix++);
- } while (!isIdentifierUnique(newMapName) || !isIdentifierUnique(Map::mapConstantFromName(newMapName)));
- return newMapName;
-}
-
-QString Project::getNewLayoutName() const {
- // Ensure default name/ID doesn't already exist.
- int suffix = 1;
- QString newLayoutName;
- do {
- newLayoutName = QString("NewLayout%1").arg(suffix++);
- } while (!isIdentifierUnique(newLayoutName) || !isIdentifierUnique(Layout::layoutConstantFromName(newLayoutName)));
- return newLayoutName;
-}
-
void Project::initNewMapSettings() {
- this->newMapSettings.name = getNewMapName();
+ this->newMapSettings.name = QString();
this->newMapSettings.group = this->groupNames.at(0);
this->newMapSettings.canFlyTo = false;
@@ -2044,7 +2024,7 @@ void Project::initNewMapSettings() {
}
void Project::initNewLayoutSettings() {
- this->newLayoutSettings.name = getNewLayoutName();
+ this->newLayoutSettings.name = QString();
this->newLayoutSettings.id = Layout::layoutConstantFromName(this->newLayoutSettings.name);
this->newLayoutSettings.width = getDefaultMapDimension();
this->newLayoutSettings.height = getDefaultMapDimension();
diff --git a/src/ui/newlayoutdialog.cpp b/src/ui/newlayoutdialog.cpp
index 226df897..537a3092 100644
--- a/src/ui/newlayoutdialog.cpp
+++ b/src/ui/newlayoutdialog.cpp
@@ -28,7 +28,7 @@ NewLayoutDialog::NewLayoutDialog(Project *project, const Layout *layoutToCopy, Q
if (this->layoutToCopy && !this->layoutToCopy->name.isEmpty()) {
settings->name = project->toUniqueIdentifier(this->layoutToCopy->name);
} else {
- settings->name = project->getNewLayoutName();
+ settings->name = QString();
}
// Generate a unique Layout constant
settings->id = project->toUniqueIdentifier(Layout::layoutConstantFromName(settings->name));
diff --git a/src/ui/newmapdialog.cpp b/src/ui/newmapdialog.cpp
index fda3d59a..3ce36869 100644
--- a/src/ui/newmapdialog.cpp
+++ b/src/ui/newmapdialog.cpp
@@ -35,9 +35,8 @@ NewMapDialog::NewMapDialog(Project *project, const Map *mapToCopy, QWidget *pare
settings->name = project->toUniqueIdentifier(this->mapToCopy->name());
} else {
- // Not duplicating a map, get a generic new map name.
- // The rest of the settings are preserved in the project between sessions.
- settings->name = project->getNewMapName();
+ // Clear the previously-used map name. The rest of the settings are preserved between sessions.
+ settings->name = QString();
}
// Generate a unique Layout constant
settings->layout.id = project->toUniqueIdentifier(Layout::layoutConstantFromName(settings->name));