Add 'Open in JSON' actions

This commit is contained in:
GriffinR
2025-05-08 20:43:52 -04:00
parent 56722f7359
commit 96b90dc5e1
9 changed files with 65 additions and 19 deletions

View File

@@ -82,9 +82,12 @@ public:
bool hasEvent(Event *) const;
QStringList getScriptLabels(Event::Group group = Event::Group::None);
QString getScriptsFilePath() const;
QString getScriptsFilepath() const;
void openScript(const QString &label);
static QString getJsonFilepath(const QString &mapName);
QString getJsonFilepath() const { return getJsonFilepath(m_name); }
void deleteConnections();
QList<MapConnection*> getConnections() const { return m_connections; }
MapConnection* getConnection(const QString &direction) const;

View File

@@ -73,6 +73,8 @@ public:
bool tryParseJsonFile(QJsonDocument *out, const QString &filepath, QString *error = nullptr);
bool tryParseOrderedJsonFile(poryjson::Json::object *out, const QString &filepath, QString *error = nullptr);
static int getJsonLineNumber(const QString &filepath, const QString &searchText);
// Returns the 1-indexed line number for the definition of scriptLabel in the scripts file at filePath.
// Returns 0 if a definition for scriptLabel cannot be found.
static int getScriptLineNumber(const QString &filePath, const QString &scriptLabel);

View File

@@ -184,6 +184,8 @@ public:
void shouldReselectEvents();
void scaleMapView(int);
static void openInTextEditor(const QString &path, int lineNum = 0);
void openMapJson(const QString &mapName) const;
void openLayoutJson(const QString &layoutId) const;
void setCollisionGraphics();
enum ZValue {

View File

@@ -218,7 +218,7 @@ public:
static QString getScriptFileExtension(bool usePoryScript);
QString getScriptDefaultString(bool usePoryScript, QString mapName) const;
QStringList getEventScriptsFilePaths() const;
QStringList getEventScriptsFilepaths() const;
void insertGlobalScriptLabels(QStringList &scriptLabels) const;
QString getDefaultPrimaryTilesetLabel() const;