Add project settings window

This commit is contained in:
GriffinR
2023-08-23 02:32:32 -04:00
parent 0148580bd2
commit 4d8f5ef150
14 changed files with 810 additions and 48 deletions

View File

@@ -225,6 +225,7 @@ public:
this->filePaths.clear();
this->readKeys.clear();
}
static const QStringList baseGameVersions;
void setBaseGameVersion(BaseGameVersion baseGameVersion);
BaseGameVersion getBaseGameVersion();
QString getBaseGameVersionString();
@@ -256,10 +257,12 @@ public:
int getNumTilesInMetatile();
void setNewMapMetatileId(int metatileId);
int getNewMapMetatileId();
QString getNewMapMetatileIdString();
void setNewMapElevation(int elevation);
int getNewMapElevation();
void setNewMapBorderMetatileIds(QList<int> metatileIds);
QList<int> getNewMapBorderMetatileIds();
QString getNewMapBorderMetatileIdsString();
QString getDefaultPrimaryTileset();
QString getDefaultSecondaryTileset();
void setFilePath(ProjectFilePath pathId, QString path);
@@ -277,6 +280,7 @@ public:
uint32_t getMetatileTerrainTypeMask();
uint32_t getMetatileEncounterTypeMask();
uint32_t getMetatileLayerTypeMask();
static QString getMaskString(uint32_t mask);
bool getMapAllowFlagsEnabled();
protected:
virtual QString getConfigFilepath() override;

View File

@@ -25,6 +25,7 @@
#include "newtilesetdialog.h"
#include "shortcutseditor.h"
#include "preferenceeditor.h"
#include "projectsettingseditor.h"
@@ -286,6 +287,7 @@ private slots:
void on_actionRegion_Map_Editor_triggered();
void on_actionEdit_Preferences_triggered();
void togglePreferenceSpecificUi();
void on_actionEdit_Project_Settings_triggered();
public:
Ui::MainWindow *ui;
@@ -299,6 +301,7 @@ private:
QPointer<MapImageExporter> mapImageExporter = nullptr;
QPointer<NewMapPopup> newMapPrompt = nullptr;
QPointer<PreferenceEditor> preferenceEditor = nullptr;
QPointer<ProjectSettingsEditor> projectSettingsEditor = nullptr;
FilterChildrenProxyModel *mapListProxyModel;
QStandardItemModel *mapListModel;
QList<QStandardItem*> *mapGroupItemsList;

View File

@@ -11,8 +11,10 @@ public:
explicit NoScrollComboBox(QWidget *parent = nullptr);
void wheelEvent(QWheelEvent *event);
void setTextItem(const QString &text);
void setNumberItem(int value);
private:
void setItem(int index, const QString &text);
};
#endif // NOSCROLLCOMBOBOX_H

View File

@@ -0,0 +1,41 @@
#ifndef PROJECTSETTINGSEDITOR_H
#define PROJECTSETTINGSEDITOR_H
#include <QMainWindow>
#include "project.h"
class NoScrollComboBox;
class QAbstractButton;
namespace Ui {
class ProjectSettingsEditor;
}
class ProjectSettingsEditor : public QMainWindow
{
Q_OBJECT
public:
explicit ProjectSettingsEditor(QWidget *parent = nullptr, Project *project = nullptr);
~ProjectSettingsEditor();
signals:
void saved();
private:
Ui::ProjectSettingsEditor *ui;
Project *project;
NoScrollComboBox *combo_defaultPrimaryTileset;
NoScrollComboBox *combo_defaultSecondaryTileset;
NoScrollComboBox *combo_baseGameVersion;
NoScrollComboBox *combo_attributesSize;
void initUi();
void saveFields();
private slots:
void dialogButtonClicked(QAbstractButton *button);
};
#endif // PROJECTSETTINGSEDITOR_H

View File

@@ -138,7 +138,6 @@ private:
void copyMetatile(bool cut);
void pasteMetatile(const Metatile * toPaste, QString label);
bool replaceMetatile(uint16_t metatileId, const Metatile * src, QString label);
void setComboValue(QComboBox * combo, int value);
void commitMetatileChange(Metatile * prevMetatile);
void commitMetatileAndLabelChange(Metatile * prevMetatile, QString prevLabel);