mirror of
https://github.com/huderlem/porymap.git
synced 2026-08-20 07:36:31 -05:00
Merge pull request #787 from GriffinRichards/config-json
Replace old config format
This commit is contained in:
@@ -1,56 +0,0 @@
|
||||
#ifndef CITYMAPPIXMAPITEM_H
|
||||
#define CITYMAPPIXMAPITEM_H
|
||||
|
||||
#include "tilemaptileselector.h"
|
||||
|
||||
#include <QGraphicsPixmapItem>
|
||||
#include <QByteArray>
|
||||
#include <QVector>
|
||||
|
||||
class CityMapPixmapItem : public QObject, public QGraphicsPixmapItem {
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
using QGraphicsPixmapItem::paint;
|
||||
|
||||
public:
|
||||
CityMapPixmapItem(QString fname, TilemapTileSelector *tile_selector) {
|
||||
this->file = fname;
|
||||
this->tile_selector = tile_selector;
|
||||
setAcceptHoverEvents(true);
|
||||
init();
|
||||
}
|
||||
TilemapTileSelector *tile_selector;
|
||||
|
||||
QString file;
|
||||
|
||||
QByteArray data;
|
||||
|
||||
void init();
|
||||
void save();
|
||||
void create(QString);
|
||||
virtual void paint(QGraphicsSceneMouseEvent *);
|
||||
virtual void draw();
|
||||
int getIndexAt(int, int);
|
||||
int width();
|
||||
int height();
|
||||
|
||||
QVector<uint8_t> getTiles();
|
||||
void setTiles(QVector<uint8_t>);
|
||||
|
||||
private:
|
||||
int width_;
|
||||
int height_;
|
||||
|
||||
signals:
|
||||
void mouseEvent(QGraphicsSceneMouseEvent *, CityMapPixmapItem *);
|
||||
void hoveredRegionMapTileChanged(int x, int y);
|
||||
void hoveredRegionMapTileCleared();
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent*);
|
||||
void mouseMoveEvent(QGraphicsSceneMouseEvent*);
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent*);
|
||||
};
|
||||
|
||||
#endif // CITYMAPPIXMAPITEM_H
|
||||
@@ -33,7 +33,7 @@ private:
|
||||
bool hasUnsavedChanges = false;
|
||||
const QString baseDir;
|
||||
|
||||
void displayScript(const QString &filepath, bool enabled);
|
||||
void displayScript(const ScriptSettings &settings);
|
||||
void displayNewScript(QString filepath);
|
||||
QString chooseScript(QString dir);
|
||||
void removeScript(QListWidgetItem * item);
|
||||
@@ -46,7 +46,6 @@ private:
|
||||
int prompt(const QString &text, QMessageBox::StandardButton defaultButton);
|
||||
void save();
|
||||
void closeEvent(QCloseEvent*);
|
||||
void restoreWindowState();
|
||||
void initShortcuts();
|
||||
QObjectList shortcutableObjects() const;
|
||||
void openManual();
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define CUSTOMSCRIPTSLISTITEM_H
|
||||
|
||||
#include <QFrame>
|
||||
#include "scriptsettings.h"
|
||||
|
||||
namespace Ui {
|
||||
class CustomScriptsListItem;
|
||||
@@ -13,9 +14,26 @@ class CustomScriptsListItem : public QFrame
|
||||
|
||||
public:
|
||||
explicit CustomScriptsListItem(QWidget *parent = nullptr);
|
||||
explicit CustomScriptsListItem(const ScriptSettings& settings, QWidget *parent = nullptr);
|
||||
~CustomScriptsListItem();
|
||||
|
||||
public:
|
||||
void setSettings(const ScriptSettings& settings);
|
||||
ScriptSettings getSettings() const;
|
||||
|
||||
void setPath(const QString& text);
|
||||
QString path() const;
|
||||
|
||||
void setScriptEnabled(bool enabled);
|
||||
bool scriptEnabled() const;
|
||||
|
||||
signals:
|
||||
void clickedChooseScript();
|
||||
void clickedEditScript();
|
||||
void clickedDeleteScript();
|
||||
void toggledEnable(bool checked);
|
||||
void pathEdited(const QString& text);
|
||||
|
||||
private:
|
||||
Ui::CustomScriptsListItem *ui;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <QObject>
|
||||
#include <QEvent>
|
||||
#include <QSet>
|
||||
|
||||
|
||||
/// Ctrl+Wheel = zoom
|
||||
@@ -16,7 +17,6 @@ public slots:
|
||||
};
|
||||
|
||||
|
||||
|
||||
/// Emits a signal when a window gets activated / regains focus
|
||||
class ActiveWindowFilter : public QObject {
|
||||
Q_OBJECT
|
||||
@@ -27,3 +27,15 @@ public:
|
||||
signals:
|
||||
void activated();
|
||||
};
|
||||
|
||||
|
||||
class GeometrySaver : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
GeometrySaver(QObject *parent, bool enableLogging = true)
|
||||
: QObject(parent), m_loggingEnabled(enableLogging) {}
|
||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||
private:
|
||||
bool m_loggingEnabled = true;
|
||||
QSet<QObject*> m_shown;
|
||||
};
|
||||
|
||||
@@ -3,10 +3,12 @@
|
||||
|
||||
#include <QDialog>
|
||||
#include <QAbstractButton>
|
||||
#include <QJsonObject>
|
||||
#include "metatile.h"
|
||||
|
||||
class GridSettings {
|
||||
public:
|
||||
explicit GridSettings() {};
|
||||
constexpr GridSettings() {};
|
||||
~GridSettings() {};
|
||||
|
||||
enum Style {
|
||||
@@ -17,15 +19,18 @@ public:
|
||||
Dots,
|
||||
};
|
||||
|
||||
uint width = 16;
|
||||
uint height = 16;
|
||||
uint width = Metatile::pixelWidth();
|
||||
uint height = Metatile::pixelHeight();
|
||||
int offsetX = 0;
|
||||
int offsetY = 0;
|
||||
Style style = Style::Solid;
|
||||
QColor color = Qt::black;
|
||||
QColor color = QColorConstants::Black;
|
||||
QVector<qreal> getHorizontalDashPattern() const { return this->getDashPattern(this->width); }
|
||||
QVector<qreal> getVerticalDashPattern() const { return this->getDashPattern(this->height); }
|
||||
|
||||
QJsonObject toJson() const;
|
||||
static GridSettings fromJson(const QJsonObject &obj);
|
||||
|
||||
static QString getStyleName(Style style);
|
||||
static GridSettings::Style getStyleFromName(const QString &name);
|
||||
private:
|
||||
|
||||
@@ -84,7 +84,12 @@ private:
|
||||
QImage m_previewImage;
|
||||
bool m_previewUpdateQueued = false;
|
||||
QList<int> m_layerOrder;
|
||||
ProjectConfig m_savedConfig;
|
||||
struct SavedConfigSettings {
|
||||
QColor transparencyColor;
|
||||
uint16_t unusedTileNormal = 0;
|
||||
uint16_t unusedTileCovered = 0;
|
||||
uint16_t unusedTileSplit = 0;
|
||||
} m_savedConfig;
|
||||
QList<QRadioButton*> m_transparencyButtons;
|
||||
|
||||
void populate(const Settings &settings);
|
||||
|
||||
@@ -54,7 +54,6 @@ private:
|
||||
void commitEditHistory();
|
||||
void commitEditHistory(int paletteId);
|
||||
void updateEditHistoryActions();
|
||||
void restoreWindowState();
|
||||
void invalidateCache();
|
||||
void closeEvent(QCloseEvent*);
|
||||
void setColorInputTitles(bool show);
|
||||
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
void addPrefab(MetatileSelection selection, Layout *layout, QString name);
|
||||
void updatePrefabUi(QPointer<Layout> layout);
|
||||
void clearPrefabUi();
|
||||
bool tryImportDefaultPrefabs(QWidget * parent, BaseGameVersion version, QString filepath = "");
|
||||
bool tryImportDefaultPrefabs(QWidget * parent, BaseGame::Version version, QString filepath = "");
|
||||
|
||||
private:
|
||||
QPointer<MetatileSelector> selector;
|
||||
|
||||
@@ -40,7 +40,6 @@ private:
|
||||
|
||||
void initUi();
|
||||
void connectSignals();
|
||||
void restoreWindowState();
|
||||
void save();
|
||||
void refresh();
|
||||
void closeEvent(QCloseEvent*);
|
||||
@@ -72,6 +71,7 @@ private:
|
||||
void addNewGlobalConstant();
|
||||
void addGlobalConstant(const QString &name, const QString &expression);
|
||||
QMap<QString,QString> getGlobalConstants();
|
||||
BaseGame::Version getBaseGameVersion() const;
|
||||
|
||||
private slots:
|
||||
void dialogButtonClicked(QAbstractButton *button);
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#define REGIONMAPEDITOR_H
|
||||
|
||||
#include "regionmappixmapitem.h"
|
||||
#include "citymappixmapitem.h"
|
||||
#include "regionmaplayoutpixmapitem.h"
|
||||
#include "regionmapentriespixmapitem.h"
|
||||
#include "regionmap.h"
|
||||
@@ -118,7 +117,6 @@ private:
|
||||
void setRegionMap(RegionMap *map);
|
||||
void setLocations(const QStringList &locations);
|
||||
|
||||
void restoreWindowState();
|
||||
void closeEvent(QCloseEvent* event);
|
||||
|
||||
void setTileHFlip(bool enabled);
|
||||
|
||||
@@ -114,7 +114,6 @@ private:
|
||||
void initMetatileLayersItem();
|
||||
void initShortcuts();
|
||||
void initExtraShortcuts();
|
||||
void restoreWindowState();
|
||||
void initMetatileHistory();
|
||||
void setTilesets(QString primaryTilesetLabel, QString secondaryTilesetLabel);
|
||||
void reset();
|
||||
|
||||
@@ -19,8 +19,6 @@ public:
|
||||
explicit WildMonChart(QWidget *parent, const EncounterTableModel *table);
|
||||
~WildMonChart();
|
||||
|
||||
virtual void closeEvent(QCloseEvent *event) override;
|
||||
|
||||
public slots:
|
||||
void setTable(const EncounterTableModel *table);
|
||||
void clearTable();
|
||||
|
||||
Reference in New Issue
Block a user