mirror of
https://github.com/huderlem/porymap.git
synced 2026-08-19 23:25:09 -05:00
Separate layout/header features of new map dialog
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
#ifndef MAPHEADERFORM_H
|
||||
#define MAPHEADERFORM_H
|
||||
|
||||
#include "project.h"
|
||||
#include "map.h"
|
||||
#include "ui_mapheaderform.h"
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
/*
|
||||
This is the UI class used to edit the fields in a map's header.
|
||||
It's intended to be used anywhere the UI needs to present an editor for a map's header,
|
||||
e.g. for the current map in the main editor or in the new map dialog.
|
||||
*/
|
||||
|
||||
#include <QWidget>
|
||||
#include <QPointer>
|
||||
#include "mapheader.h"
|
||||
|
||||
class Project;
|
||||
|
||||
namespace Ui {
|
||||
class MapHeaderForm;
|
||||
}
|
||||
@@ -25,32 +25,43 @@ public:
|
||||
explicit MapHeaderForm(QWidget *parent = nullptr);
|
||||
~MapHeaderForm();
|
||||
|
||||
void setProject(Project * project);
|
||||
void setMap(Map * map);
|
||||
|
||||
void clearDisplay();
|
||||
void init(const Project * project);
|
||||
void clear();
|
||||
|
||||
void refreshLocationsComboBox();
|
||||
void setHeader(MapHeader *header);
|
||||
MapHeader headerData() const;
|
||||
|
||||
Ui::MapHeaderForm *ui;
|
||||
void setLocations(QStringList locations);
|
||||
void setLocationsDisabled(bool disabled);
|
||||
|
||||
private:
|
||||
QPointer<Map> map = nullptr;
|
||||
QPointer<Project> project = nullptr;
|
||||
Ui::MapHeaderForm *ui;
|
||||
QPointer<MapHeader> m_header = nullptr;
|
||||
|
||||
private slots:
|
||||
void on_comboBox_Song_currentTextChanged(const QString &);
|
||||
void on_comboBox_Location_currentTextChanged(const QString &);
|
||||
void on_comboBox_Weather_currentTextChanged(const QString &);
|
||||
void on_comboBox_Type_currentTextChanged(const QString &);
|
||||
void on_comboBox_BattleScene_currentTextChanged(const QString &);
|
||||
void on_checkBox_RequiresFlash_stateChanged(int);
|
||||
void on_checkBox_ShowLocationName_stateChanged(int);
|
||||
void on_checkBox_AllowRunning_stateChanged(int);
|
||||
void on_checkBox_AllowBiking_stateChanged(int);
|
||||
void on_checkBox_AllowEscaping_stateChanged(int);
|
||||
void on_spinBox_FloorNumber_valueChanged(int);
|
||||
void updateUi();
|
||||
void updateSong();
|
||||
void updateLocation();
|
||||
void updateRequiresFlash();
|
||||
void updateWeather();
|
||||
void updateType();
|
||||
void updateBattleScene();
|
||||
void updateShowsLocationName();
|
||||
void updateAllowsRunning();
|
||||
void updateAllowsBiking();
|
||||
void updateAllowsEscaping();
|
||||
void updateFloorNumber();
|
||||
|
||||
void onSongUpdated(const QString &song);
|
||||
void onLocationChanged(const QString &location);
|
||||
void onWeatherChanged(const QString &weather);
|
||||
void onTypeChanged(const QString &type);
|
||||
void onBattleSceneChanged(const QString &battleScene);
|
||||
void onRequiresFlashChanged(int selected);
|
||||
void onShowLocationNameChanged(int selected);
|
||||
void onAllowRunningChanged(int selected);
|
||||
void onAllowBikingChanged(int selected);
|
||||
void onAllowEscapingChanged(int selected);
|
||||
void onFloorNumberChanged(int offset);
|
||||
};
|
||||
|
||||
#endif // MAPHEADERFORM_H
|
||||
|
||||
46
include/ui/newlayoutform.h
Normal file
46
include/ui/newlayoutform.h
Normal file
@@ -0,0 +1,46 @@
|
||||
#ifndef NEWLAYOUTFORM_H
|
||||
#define NEWLAYOUTFORM_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class Project;
|
||||
|
||||
namespace Ui {
|
||||
class NewLayoutForm;
|
||||
}
|
||||
|
||||
class NewLayoutForm : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit NewLayoutForm(QWidget *parent = nullptr);
|
||||
~NewLayoutForm();
|
||||
|
||||
void initUi(Project *project);
|
||||
|
||||
struct Settings {
|
||||
int width;
|
||||
int height;
|
||||
int borderWidth;
|
||||
int borderHeight;
|
||||
QString primaryTilesetLabel;
|
||||
QString secondaryTilesetLabel;
|
||||
};
|
||||
|
||||
void setSettings(const Settings &settings);
|
||||
NewLayoutForm::Settings settings() const;
|
||||
|
||||
void setDisabled(bool disabled);
|
||||
|
||||
bool validate();
|
||||
|
||||
private:
|
||||
Ui::NewLayoutForm *ui;
|
||||
Project *m_project;
|
||||
|
||||
bool validateMapDimensions();
|
||||
bool validateTilesets();
|
||||
};
|
||||
|
||||
#endif // NEWLAYOUTFORM_H
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "project.h"
|
||||
#include "map.h"
|
||||
#include "mapheaderform.h"
|
||||
#include "newlayoutform.h"
|
||||
#include "lib/collapsiblesection.h"
|
||||
|
||||
namespace Ui {
|
||||
@@ -25,7 +26,6 @@ public:
|
||||
bool importedMap;
|
||||
QString layoutId;
|
||||
void init();
|
||||
//void initUi();//TODO
|
||||
void init(int tabIndex, QString data);
|
||||
void init(Layout *);
|
||||
static void setDefaultSettings(Project *project);
|
||||
@@ -37,11 +37,9 @@ private:
|
||||
Ui::NewMapDialog *ui;
|
||||
Project *project;
|
||||
CollapsibleSection *headerSection;
|
||||
MapHeaderForm *headerData;
|
||||
MapHeaderForm *headerForm;
|
||||
|
||||
bool validateMapDimensions();
|
||||
bool validateMapGroup();
|
||||
bool validateTilesets();
|
||||
bool validateID();
|
||||
bool validateName();
|
||||
|
||||
@@ -51,33 +49,18 @@ private:
|
||||
|
||||
struct Settings {
|
||||
QString group;
|
||||
int width;
|
||||
int height;
|
||||
int borderWidth;
|
||||
int borderHeight;
|
||||
QString primaryTilesetLabel;
|
||||
QString secondaryTilesetLabel;
|
||||
QString song;
|
||||
QString location;
|
||||
bool requiresFlash;
|
||||
QString weather;
|
||||
QString type;
|
||||
QString battleScene;
|
||||
bool showLocationName;
|
||||
bool allowRunning;
|
||||
bool allowBiking;
|
||||
bool allowEscaping;
|
||||
int floorNumber;
|
||||
bool canFlyTo;
|
||||
NewLayoutForm::Settings layout;
|
||||
MapHeader header;
|
||||
};
|
||||
static struct Settings settings;
|
||||
|
||||
private slots:
|
||||
//void on_checkBox_UseExistingLayout_stateChanged(int state);
|
||||
//void on_checkBox_UseExistingLayout_stateChanged(int state); //TODO
|
||||
//void on_comboBox_Layout_currentTextChanged(const QString &text);
|
||||
void on_pushButton_Accept_clicked();
|
||||
void on_lineEdit_Name_textChanged(const QString &);
|
||||
void on_lineEdit_ID_textChanged(const QString &);
|
||||
void on_lineEdit_MapID_textChanged(const QString &);
|
||||
};
|
||||
|
||||
#endif // NEWMAPDIALOG_H
|
||||
|
||||
Reference in New Issue
Block a user