Fix map duplication

This commit is contained in:
GriffinR
2024-11-26 15:33:56 -05:00
parent ff04a41db2
commit f1a4b78ca9
9 changed files with 272 additions and 292 deletions

View File

@@ -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;

View File

@@ -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);
};