mirror of
https://github.com/huderlem/porymap.git
synced 2026-09-08 08:55:37 -05:00
Finish new layout dialog redesign
This commit is contained in:
@@ -21,6 +21,7 @@ class Layout : public QObject {
|
||||
public:
|
||||
Layout() {}
|
||||
|
||||
static QString layoutNameFromMapName(const QString &mapName);
|
||||
static QString layoutConstantFromName(QString mapName);
|
||||
|
||||
bool loaded = false;
|
||||
@@ -83,10 +84,10 @@ public:
|
||||
QString primaryTilesetLabel;
|
||||
QString secondaryTilesetLabel;
|
||||
};
|
||||
Settings settings() const;
|
||||
|
||||
public:
|
||||
Layout *copy();
|
||||
void copyFrom(Layout *other);
|
||||
Layout *copy() const;
|
||||
void copyFrom(const Layout *other);
|
||||
|
||||
int getWidth() const { return width; }
|
||||
int getHeight() const { return height; }
|
||||
|
||||
@@ -22,8 +22,6 @@
|
||||
#include "mapimageexporter.h"
|
||||
#include "filterchildrenproxymodel.h"
|
||||
#include "maplistmodels.h"
|
||||
#include "newmapdialog.h"
|
||||
#include "newlayoutdialog.h"
|
||||
#include "newtilesetdialog.h"
|
||||
#include "shortcutseditor.h"
|
||||
#include "preferenceeditor.h"
|
||||
@@ -188,8 +186,6 @@ private slots:
|
||||
void onLayoutChanged(Layout *layout);
|
||||
void onOpenConnectedMap(MapConnection*);
|
||||
void onTilesetsSaved(QString, QString);
|
||||
void openNewMapDialog();
|
||||
void openNewLayoutDialog();
|
||||
void onNewMapCreated(Map *newMap, const QString &groupName);
|
||||
void onNewMapGroupCreated(const QString &groupName);
|
||||
void onNewLayoutCreated(Layout *layout);
|
||||
@@ -199,7 +195,6 @@ private slots:
|
||||
void markMapEdited();
|
||||
void markSpecificMapEdited(Map*);
|
||||
|
||||
void on_action_NewMap_triggered();
|
||||
void on_actionNew_Tileset_triggered();
|
||||
void on_action_Save_triggered();
|
||||
void on_action_Exit_triggered();
|
||||
@@ -306,8 +301,6 @@ private:
|
||||
QPointer<RegionMapEditor> regionMapEditor = nullptr;
|
||||
QPointer<ShortcutsEditor> shortcutsEditor = nullptr;
|
||||
QPointer<MapImageExporter> mapImageExporter = nullptr;
|
||||
QPointer<NewMapDialog> newMapDialog = nullptr;
|
||||
QPointer<NewLayoutDialog> newLayoutDialog = nullptr;
|
||||
QPointer<PreferenceEditor> preferenceEditor = nullptr;
|
||||
QPointer<ProjectSettingsEditor> projectSettingsEditor = nullptr;
|
||||
QPointer<GridSettingsDialog> gridSettingsDialog = nullptr;
|
||||
@@ -353,6 +346,8 @@ private:
|
||||
bool setProjectUI();
|
||||
void clearProjectUI();
|
||||
|
||||
void openNewMapDialog();
|
||||
void openNewLayoutDialog();
|
||||
void openSubWindow(QWidget * window);
|
||||
void scrollMapList(MapTree *list, QString itemName);
|
||||
void scrollMapListToCurrentMap(MapTree *list);
|
||||
@@ -371,7 +366,6 @@ private:
|
||||
|
||||
void updateMapList();
|
||||
void mapListAddGroup();
|
||||
void mapListAddLayout();
|
||||
void mapListAddArea();
|
||||
void openMapListItem(const QModelIndex &index);
|
||||
void saveMapListTab(int index);
|
||||
|
||||
@@ -82,8 +82,8 @@ public:
|
||||
bool saveEmptyMapsec;
|
||||
|
||||
struct NewMapSettings {
|
||||
QString mapName;
|
||||
QString mapId;
|
||||
QString name;
|
||||
QString id;
|
||||
QString group;
|
||||
bool canFlyTo;
|
||||
Layout::Settings layout;
|
||||
@@ -133,9 +133,9 @@ public:
|
||||
void addNewMap(Map* newMap, const QString &groupName);
|
||||
void addNewMapGroup(const QString &groupName);
|
||||
void addNewLayout(Layout* newLayout);
|
||||
QString getNewMapName();
|
||||
QString getNewLayoutName();
|
||||
bool isLayoutNameUnique(const QString &name);
|
||||
NewMapSettings getNewMapSettings() const;
|
||||
Layout::Settings getNewLayoutSettings() const;
|
||||
bool isIdentifierUnique(const QString &identifier) const;
|
||||
QString getProjectTitle();
|
||||
|
||||
bool readWildMonData();
|
||||
@@ -159,7 +159,7 @@ public:
|
||||
bool loadMapData(Map*);
|
||||
bool readMapLayouts();
|
||||
Layout *loadLayout(QString layoutId);
|
||||
Layout *createNewLayout(const Layout::Settings &layoutSettings);
|
||||
Layout *createNewLayout(const Layout::Settings &layoutSettings, const Layout* toDuplicate = nullptr);
|
||||
bool loadLayout(Layout *);
|
||||
bool loadMapLayout(Map*);
|
||||
bool loadLayoutTilesets(Layout *);
|
||||
@@ -234,8 +234,6 @@ public:
|
||||
|
||||
static QString getExistingFilepath(QString filepath);
|
||||
void applyParsedLimits();
|
||||
void initNewMapSettings();
|
||||
void initNewLayoutSettings();
|
||||
|
||||
static QString getDynamicMapDefineName();
|
||||
static QString getDynamicMapName();
|
||||
|
||||
@@ -32,11 +32,13 @@ public:
|
||||
MapHeader headerData() const;
|
||||
|
||||
void setLocations(QStringList locations);
|
||||
void setLocationsDisabled(bool disabled);
|
||||
void setLocationDisabled(bool disabled);
|
||||
bool isLocationDisabled() const { return m_locationDisabled; }
|
||||
|
||||
private:
|
||||
Ui::MapHeaderForm *ui;
|
||||
QPointer<MapHeader> m_header = nullptr;
|
||||
bool m_locationDisabled = false;
|
||||
|
||||
void updateUi();
|
||||
void updateSong();
|
||||
|
||||
@@ -18,10 +18,11 @@ class NewLayoutDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit NewLayoutDialog(QWidget *parent = nullptr, Project *project = nullptr);
|
||||
explicit NewLayoutDialog(Project *project, QWidget *parent = nullptr);
|
||||
explicit NewLayoutDialog(Project *project, const Layout *layoutToCopy, QWidget *parent = nullptr);
|
||||
~NewLayoutDialog();
|
||||
void copyFrom(const Layout &);
|
||||
void accept() override;
|
||||
|
||||
virtual void accept() override;
|
||||
|
||||
signals:
|
||||
void applied(const QString &newLayoutId);
|
||||
@@ -30,18 +31,21 @@ private:
|
||||
Ui::NewLayoutDialog *ui;
|
||||
Project *project;
|
||||
Layout *importedLayout = nullptr;
|
||||
Layout::Settings *settings = nullptr;
|
||||
|
||||
static Layout::Settings settings;
|
||||
static bool initializedSettings;
|
||||
|
||||
// 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 validateLayoutID(bool allowEmpty = false);
|
||||
bool validateName(bool allowEmpty = false);
|
||||
|
||||
void refresh();
|
||||
|
||||
void saveSettings();
|
||||
bool isExistingLayout() const;
|
||||
|
||||
private slots:
|
||||
//void on_comboBox_Layout_currentTextChanged(const QString &text);//TODO
|
||||
void dialogButtonClicked(QAbstractButton *button);
|
||||
void on_lineEdit_Name_textChanged(const QString &);
|
||||
void on_lineEdit_LayoutID_textChanged(const QString &);
|
||||
|
||||
@@ -18,12 +18,12 @@ class NewMapDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit NewMapDialog(QWidget *parent = nullptr, Project *project = nullptr);
|
||||
explicit NewMapDialog(Project *project, 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();
|
||||
void init();
|
||||
void init(int tabIndex, QString data);
|
||||
void init(Layout *);
|
||||
void accept() override;
|
||||
|
||||
virtual void accept() override;
|
||||
|
||||
signals:
|
||||
void applied(const QString &newMapName);
|
||||
@@ -33,25 +33,29 @@ private:
|
||||
Project *project;
|
||||
CollapsibleSection *headerSection;
|
||||
MapHeaderForm *headerForm;
|
||||
Layout *importedLayout = nullptr;
|
||||
Project::NewMapSettings *settings = nullptr;
|
||||
Map *importedMap = nullptr;
|
||||
|
||||
static Project::NewMapSettings settings;
|
||||
static bool initializedSettings;
|
||||
|
||||
// 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 refresh();
|
||||
|
||||
void saveSettings();
|
||||
bool isExistingLayout() const;
|
||||
void useLayoutSettings(const Layout *mapLayout);
|
||||
void useLayoutIdSettings(const QString &layoutId);
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
#endif // NEWMAPDIALOG_H
|
||||
|
||||
Reference in New Issue
Block a user