mirror of
https://github.com/huderlem/porymap.git
synced 2026-04-22 09:37:41 -05:00
Remove old layout suffix function
This commit is contained in:
parent
07e4d24b98
commit
a00636260c
|
|
@ -32,11 +32,6 @@ 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";
|
||||
}
|
||||
|
||||
QString Layout::layoutConstantFromName(QString mapName) {
|
||||
// Transform map names of the form 'GraniteCave_B1F` into layout constants like 'LAYOUT_GRANITE_CAVE_B1F'.
|
||||
static const QRegularExpression caseChange("([a-z])([A-Z])");
|
||||
|
|
|
|||
|
|
@ -2001,7 +2001,7 @@ void Project::initNewMapSettings() {
|
|||
this->newMapSettings.canFlyTo = false;
|
||||
|
||||
this->newMapSettings.layout.folderName = this->newMapSettings.name;
|
||||
this->newMapSettings.layout.name = QString("%1%2").arg(this->newMapSettings.name).arg(Layout::defaultSuffix());
|
||||
this->newMapSettings.layout.name = QString();
|
||||
this->newMapSettings.layout.id = Layout::layoutConstantFromName(this->newMapSettings.name);
|
||||
this->newMapSettings.layout.width = getDefaultMapDimension();
|
||||
this->newMapSettings.layout.height = getDefaultMapDimension();
|
||||
|
|
|
|||
|
|
@ -124,12 +124,13 @@ void NewMapDialog::saveSettings() {
|
|||
settings->header = this->headerForm->headerData();
|
||||
|
||||
// This dialog doesn't give users the option to give new layouts a name, we generate one using the map name.
|
||||
// We instead add a "_Layout" suffix to differentiate the layout name from the map name.
|
||||
// (an older iteration of this dialog gave users an option to name new layouts, but it's extra clutter for
|
||||
// something the majority of users creating a map won't need. If they want to give a specific name to a layout
|
||||
// they can create the layout first, then create a new map that uses that layout.)
|
||||
const Layout *layout = this->project->mapLayouts.value(settings->layout.id);
|
||||
if (!layout) {
|
||||
const QString newLayoutName = QString("%1%2").arg(settings->name).arg(Layout::defaultSuffix());
|
||||
const QString newLayoutName = settings->name + QStringLiteral("_Layout");
|
||||
settings->layout.name = this->project->toUniqueIdentifier(newLayoutName);
|
||||
} else {
|
||||
// Pre-existing layout. The layout name won't be read, but we'll make sure it's correct anyway.
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user