This commit is contained in:
Aria 2025-03-21 22:23:30 +11:00
commit 9c94d113d3
Signed by untrusted user who does not match committer: aria
GPG key ID: 19AB7AA462B8AB3B
10260 changed files with 1237388 additions and 0 deletions

View file

@ -0,0 +1,56 @@
#ifndef EDITOR_GUI_HPP
#define EDITOR_GUI_HPP
#include <QErrorMessage>
#include <QLabel>
#include <QLineEdit>
#include <QMainWindow>
#include <QScrollBar>
#include <QTextEdit>
#include "json_tool.hpp"
namespace Star {
class JsonEditor : public QMainWindow {
Q_OBJECT
public:
explicit JsonEditor(JsonPath::PathPtr const& path, Options const& options, List<String> const& files);
private slots:
void next();
void back();
void updatePreview(QString const& valueStr);
private:
// Returns false if the change can't be made or the edit is invalid Json
bool saveChanges();
void displayCurrentFile();
void updateValueEditor();
void updateImagePreview();
QLabel* m_statusLabel;
QLabel* m_pathLabel;
QLabel* m_imageLabel;
QTextEdit* m_jsonPreview;
QTextDocument* m_jsonDocument;
QLineEdit* m_valueEditor;
QErrorMessage* m_errorDialog;
QPushButton* m_backButton;
QPushButton* m_nextButton;
JsonPath::PathPtr m_path;
JsonInputFormatPtr m_editFormat;
Options m_options;
List<String> m_files;
size_t m_fileIndex;
FormattedJson m_currentJson;
};
int edit(int argc, char* argv[], JsonPath::PathPtr const& path, Options const& options, List<Input> const& inputs);
}
#endif