porymap/include/ui/newmapdialog.h

52 lines
1.5 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-21 20:04:42 +00:00
explicit NewMapDialog(Project *project, QWidget *parent = nullptr);
2024-11-26 20:33:56 +00:00
explicit NewMapDialog(Project *project, const Map *mapToCopy = nullptr, QWidget *parent = nullptr);
2024-11-21 20:04:42 +00:00
explicit NewMapDialog(Project *project, int mapListTab, const QString &mapListItem, QWidget *parent = nullptr);
2024-11-12 18:23:15 +00:00
~NewMapDialog();
2024-11-21 20:04:42 +00:00
virtual void accept() override;
private:
2024-11-12 18:23:15 +00:00
Ui::NewMapDialog *ui;
Project *project;
CollapsibleSection *headerSection;
MapHeaderForm *headerForm;
2024-11-26 20:33:56 +00:00
const Map *mapToCopy;
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.
bool validateName(bool allowEmpty = false);
bool validateGroup(bool allowEmpty = false);
2024-11-21 20:04:42 +00:00
bool validateLayoutID(bool allowEmpty = false);
2024-11-26 20:33:56 +00:00
void refresh();
void saveSettings();
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 &);
2024-11-14 21:01:54 +00:00
void on_comboBox_Group_currentTextChanged(const QString &text);
2024-11-21 20:04:42 +00:00
void on_comboBox_LayoutID_currentTextChanged(const QString &text);
};
2024-11-12 18:23:15 +00:00
#endif // NEWMAPDIALOG_H