Header tab and new map dialog share UI setup

This commit is contained in:
GriffinR
2024-11-12 14:27:35 -05:00
parent 9e1ef2c741
commit 205bb48c65
14 changed files with 789 additions and 835 deletions

View File

@@ -62,7 +62,7 @@ public:
void setRequiresFlash(bool requiresFlash);
void setWeather(const QString &weather);
void setType(const QString &type);
void setShowsLocation(bool showsLocation);
void setShowsLocationName(bool showsLocationName);
void setAllowsRunning(bool allowsRunning);
void setAllowsBiking(bool allowsBiking);
void setAllowsEscaping(bool allowsEscaping);
@@ -74,7 +74,7 @@ public:
bool requiresFlash() const { return m_requiresFlash; }
QString weather() const { return m_weather; }
QString type() const { return m_type; }
bool showsLocation() const { return m_showsLocation; }
bool showsLocationName() const { return m_showsLocationName; }
bool allowsRunning() const { return m_allowsRunning; }
bool allowsBiking() const { return m_allowsBiking; }
bool allowsEscaping() const { return m_allowsEscaping; }
@@ -136,7 +136,7 @@ private:
bool m_requiresFlash;
QString m_weather;
QString m_type;
bool m_showsLocation;
bool m_showsLocationName;
bool m_allowsRunning;
bool m_allowsBiking;
bool m_allowsEscaping;

View File

@@ -32,6 +32,7 @@
#include "wildmonchart.h"
#include "updatepromoter.h"
#include "aboutporymap.h"
#include "mapheaderform.h"
@@ -199,17 +200,7 @@ private slots:
void on_actionNew_Tileset_triggered();
void on_action_Save_triggered();
void on_action_Exit_triggered();
void on_comboBox_Song_currentTextChanged(const QString &arg1);
void on_comboBox_Location_currentTextChanged(const QString &arg1);
void on_comboBox_Weather_currentTextChanged(const QString &arg1);
void on_comboBox_Type_currentTextChanged(const QString &arg1);
void on_comboBox_BattleScene_currentTextChanged(const QString &arg1);
void on_comboBox_LayoutSelector_currentTextChanged(const QString &arg1);
void on_checkBox_ShowLocation_stateChanged(int selected);
void on_checkBox_AllowRunning_stateChanged(int selected);
void on_checkBox_AllowBiking_stateChanged(int selected);
void on_checkBox_AllowEscaping_stateChanged(int selected);
void on_spinBox_FloorNumber_valueChanged(int offset);
void on_comboBox_LayoutSelector_currentTextChanged(const QString &text);
void on_actionShortcuts_triggered();
void on_actionZoom_In_triggered();
@@ -254,7 +245,6 @@ private slots:
void on_comboBox_SecondaryTileset_currentTextChanged(const QString &arg1);
void on_pushButton_ChangeDimensions_clicked();
void on_checkBox_smartPaths_stateChanged(int selected);
void on_checkBox_Visibility_stateChanged(int selected);
void on_checkBox_ToggleBorder_stateChanged(int selected);
void resetMapViewScale();
@@ -337,6 +327,8 @@ private:
QAction *copyAction = nullptr;
QAction *pasteAction = nullptr;
MapHeaderForm *mapHeader = nullptr;
QMap<Event::Group, DraggablePixmapItem*> lastSelectedEvent;
bool isProgrammaticEventTabChange;

View File

@@ -0,0 +1,56 @@
#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.
*/
namespace Ui {
class MapHeaderForm;
}
class MapHeaderForm : public QWidget
{
Q_OBJECT
public:
explicit MapHeaderForm(QWidget *parent = nullptr);
~MapHeaderForm();
void setProject(Project * project);
void setMap(Map * map);
void clearDisplay();
void clear();
void refreshLocationsComboBox();
Ui::MapHeaderForm *ui;
private:
QPointer<Map> map = nullptr;
QPointer<Project> project = 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);
};
#endif // MAPHEADERFORM_H

View File

@@ -6,6 +6,7 @@
#include "editor.h"
#include "project.h"
#include "map.h"
#include "mapheaderform.h"
namespace Ui {
class NewMapDialog;
@@ -34,6 +35,7 @@ signals:
private:
Ui::NewMapDialog *ui;
Project *project;
MapHeaderForm *headerData;
bool validateMapDimensions();
bool validateMapGroup();