diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-06-20 14:33:09 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-06-20 14:33:09 +1000 |
commit | 6352e8e3196f78388b6c771073f9e03eaa612673 (patch) | |
tree | e23772f79a7fbc41bc9108951e9e136857484bf4 /source/json_tool/editor_gui.hpp | |
parent | 6741a057e5639280d85d0f88ba26f000baa58f61 (diff) |
everything everywhere
all at once
Diffstat (limited to 'source/json_tool/editor_gui.hpp')
-rw-r--r-- | source/json_tool/editor_gui.hpp | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/source/json_tool/editor_gui.hpp b/source/json_tool/editor_gui.hpp new file mode 100644 index 0000000..d24c029 --- /dev/null +++ b/source/json_tool/editor_gui.hpp @@ -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 |