porymap/include/ui/newmapdialog.h

58 lines
1.6 KiB
C
Raw Normal View History

2024-11-12 18:23:15 +00:00
#ifndef NEWMAPDIALOG_H
#define NEWMAPDIALOG_H
2024-11-12 18:23:15 +00:00
#include <QDialog>
#include <QString>
#include "editor.h"
#include "project.h"
#include "map.h"
#include "mapheaderform.h"
#include "newlayoutform.h"
#include "lib/collapsiblesection.h"
namespace Ui {
2024-11-12 18:23:15 +00:00
class NewMapDialog;
}
2024-11-12 18:23:15 +00:00
class NewMapDialog : public QDialog
{
Q_OBJECT
public:
2024-11-12 18:23:15 +00:00
explicit NewMapDialog(QWidget *parent = nullptr, Project *project = nullptr);
~NewMapDialog();
void init();
2024-10-30 02:18:16 +00:00
void init(int tabIndex, QString data);
void init(Layout *);
2024-11-14 21:01:54 +00:00
void accept() override;
signals:
2024-11-14 21:01:54 +00:00
void applied(const QString &newMapName);
private:
2024-11-12 18:23:15 +00:00
Ui::NewMapDialog *ui;
Project *project;
CollapsibleSection *headerSection;
MapHeaderForm *headerForm;
2024-11-14 21:01:54 +00:00
Layout *importedLayout = nullptr;
2024-11-19 19:52:47 +00:00
Project::NewMapSettings *settings = nullptr;
2024-11-12 18:44:04 +00:00
2024-11-14 21:01:54 +00:00
// 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.
2024-11-19 19:52:47 +00:00
bool validateMapID(bool allowEmpty = false);
2024-11-14 21:01:54 +00:00
bool validateName(bool allowEmpty = false);
bool validateGroup(bool allowEmpty = false);
2024-11-12 18:44:04 +00:00
void saveSettings();
2024-11-14 21:01:54 +00:00
bool isExistingLayout() const;
2024-11-19 19:52:47 +00:00
void useLayoutSettings(const Layout *mapLayout);
void useLayoutIdSettings(const QString &layoutId);
private slots:
2024-11-14 21:01:54 +00:00
void dialogButtonClicked(QAbstractButton *button);
2024-11-12 18:44:04 +00:00
void on_lineEdit_Name_textChanged(const QString &);
void on_lineEdit_MapID_textChanged(const QString &);
2024-11-14 21:01:54 +00:00
void on_comboBox_Group_currentTextChanged(const QString &text);
};
2024-11-12 18:23:15 +00:00
#endif // NEWMAPDIALOG_H