mirror of
https://github.com/huderlem/porymap.git
synced 2026-08-16 21:58:24 -05:00
Fix map duplication
This commit is contained in:
@@ -74,7 +74,6 @@ public:
|
||||
QUndoStack editHistory;
|
||||
|
||||
// to simplify new layout settings transfer between functions
|
||||
// TODO: Make this the equivalent of struct MapHeader
|
||||
struct Settings {
|
||||
QString id;
|
||||
QString name;
|
||||
|
||||
@@ -81,16 +81,6 @@ public:
|
||||
bool wildEncountersLoaded;
|
||||
bool saveEmptyMapsec;
|
||||
|
||||
struct NewMapSettings {
|
||||
QString name;
|
||||
QString id;
|
||||
QString group;
|
||||
bool canFlyTo;
|
||||
Layout::Settings layout;
|
||||
MapHeader header;
|
||||
};
|
||||
NewMapSettings newMapSettings;
|
||||
|
||||
void set_root(QString);
|
||||
|
||||
void clearMapCache();
|
||||
@@ -132,10 +122,23 @@ public:
|
||||
bool readMapGroups();
|
||||
void addNewMapGroup(const QString &groupName);
|
||||
|
||||
struct NewMapSettings {
|
||||
QString name;
|
||||
QString group;
|
||||
bool canFlyTo;
|
||||
Layout::Settings layout;
|
||||
MapHeader header;
|
||||
};
|
||||
NewMapSettings newMapSettings;
|
||||
Layout::Settings newLayoutSettings;
|
||||
|
||||
QString getNewMapName() const;
|
||||
QString getNewLayoutName() const;
|
||||
void initNewMapSettings();
|
||||
void initNewLayoutSettings();
|
||||
|
||||
Map *createNewMap(const Project::NewMapSettings &mapSettings, const Map* toDuplicate = nullptr);
|
||||
Layout *createNewLayout(const Layout::Settings &layoutSettings, const Layout* toDuplicate = nullptr);
|
||||
NewMapSettings getNewMapSettings() const;
|
||||
Layout::Settings getNewLayoutSettings() const;
|
||||
bool isIdentifierUnique(const QString &identifier) const;
|
||||
QString getProjectTitle();
|
||||
|
||||
|
||||
@@ -30,10 +30,7 @@ signals:
|
||||
private:
|
||||
Ui::NewLayoutDialog *ui;
|
||||
Project *project;
|
||||
Layout *importedLayout = nullptr;
|
||||
|
||||
static Layout::Settings settings;
|
||||
static bool initializedSettings;
|
||||
const Layout *layoutToCopy;
|
||||
|
||||
// Each of these validation functions will allow empty names up until `OK` is selected,
|
||||
// because clearing the text during editing is common and we don't want to flash errors for this.
|
||||
@@ -41,7 +38,6 @@ private:
|
||||
bool validateName(bool allowEmpty = false);
|
||||
|
||||
void refresh();
|
||||
|
||||
void saveSettings();
|
||||
bool isExistingLayout() const;
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@ class NewMapDialog : public QDialog
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit NewMapDialog(Project *project, QWidget *parent = nullptr);
|
||||
explicit NewMapDialog(Project *project, const Map *mapToCopy = nullptr, QWidget *parent = nullptr);
|
||||
explicit NewMapDialog(Project *project, int mapListTab, const QString &mapListItem, QWidget *parent = nullptr);
|
||||
explicit NewMapDialog(Project *project, const Map *mapToCopy, QWidget *parent = nullptr);
|
||||
~NewMapDialog();
|
||||
|
||||
virtual void accept() override;
|
||||
@@ -30,26 +30,21 @@ private:
|
||||
Project *project;
|
||||
CollapsibleSection *headerSection;
|
||||
MapHeaderForm *headerForm;
|
||||
Map *importedMap = nullptr;
|
||||
|
||||
static Project::NewMapSettings settings;
|
||||
static bool initializedSettings;
|
||||
const Map *mapToCopy;
|
||||
|
||||
// Each of these validation functions will allow empty names up until `OK` is selected,
|
||||
// because clearing the text during editing is common and we don't want to flash errors for this.
|
||||
bool validateMapID(bool allowEmpty = false);
|
||||
bool validateName(bool allowEmpty = false);
|
||||
bool validateGroup(bool allowEmpty = false);
|
||||
bool validateLayoutID(bool allowEmpty = false);
|
||||
|
||||
void setUI(const Project::NewMapSettings &settings);
|
||||
void refresh();
|
||||
void saveSettings();
|
||||
void setLayout(const Layout *mapLayout);
|
||||
|
||||
private slots:
|
||||
void dialogButtonClicked(QAbstractButton *button);
|
||||
void on_lineEdit_Name_textChanged(const QString &);
|
||||
void on_lineEdit_MapID_textChanged(const QString &);
|
||||
void on_comboBox_Group_currentTextChanged(const QString &text);
|
||||
void on_comboBox_LayoutID_currentTextChanged(const QString &text);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user