89 lines
2.5 KiB
C++
89 lines
2.5 KiB
C++
#ifndef MAINWINDOW_H
|
|
#define MAINWINDOW_H
|
|
|
|
#include <QMainWindow>
|
|
|
|
#include "typeregistry.h"
|
|
|
|
class XTreeWidget;
|
|
class XTreeWidgetItem;
|
|
class QPlainTextEdit;
|
|
class QProgressBar;
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
namespace Ui {
|
|
class MainWindow;
|
|
}
|
|
QT_END_NAMESPACE
|
|
|
|
class MainWindow : public QMainWindow
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
MainWindow(QWidget *parent = nullptr);
|
|
~MainWindow();
|
|
|
|
void LoadDefinitions();
|
|
void LoadTreeCategories();
|
|
void Reset();
|
|
|
|
QString pluralizeType(const QString &typeName);
|
|
XTreeWidgetItem *ensureTypeCategoryRoot(const QString &typeName);
|
|
XTreeWidgetItem *ensureSubcategory(XTreeWidgetItem *instanceNode, const QString &childTypeName);
|
|
void routeNestedObjects(XTreeWidgetItem *ownerInstanceNode, const QVariantMap &vars);
|
|
XTreeWidgetItem *addInstanceNode(XTreeWidgetItem *parent, const QString &displayName, const QString &typeName, const QVariantMap &vars);
|
|
static QString instanceDisplayFor(const QVariantMap &obj, const QString &fallbackType, const QString &fallbackKey = {}, std::optional<int> index = std::nullopt);
|
|
private slots:
|
|
void HandleLogEntry(const QString &entry);
|
|
void HandleStatusUpdate(const QString &message, int timeout);
|
|
void HandleProgressUpdate(const QString &message, int progress, int max);
|
|
|
|
protected:
|
|
void dragEnterEvent(QDragEnterEvent *event) override;
|
|
void dragMoveEvent(QDragMoveEvent *event) override;
|
|
void dragLeaveEvent(QDragLeaveEvent *event) override;
|
|
void dropEvent(QDropEvent *event) override;
|
|
|
|
private:
|
|
Ui::MainWindow *ui;
|
|
XTreeWidget *mTreeWidget;
|
|
QPlainTextEdit *mLogWidget;
|
|
QProgressBar *mProgressBar;
|
|
|
|
QHash<QString, XTreeWidgetItem*> mTypeCategoryRoots;
|
|
TypeRegistry mTypeRegistry;
|
|
QStringList mOpenedFilePaths; // Track opened files for reparsing
|
|
|
|
// Actions - File menu
|
|
QAction *actionNew;
|
|
QAction *actionOpen;
|
|
QAction *actionOpenFolder;
|
|
QAction *actionSave;
|
|
QAction *actionSaveAs;
|
|
|
|
// Actions - Edit menu
|
|
QAction *actionUndo;
|
|
QAction *actionRedo;
|
|
QAction *actionCut;
|
|
QAction *actionCopy;
|
|
QAction *actionPaste;
|
|
QAction *actionRename;
|
|
QAction *actionDelete;
|
|
QAction *actionFind;
|
|
QAction *actionClearUndoHistory;
|
|
QAction *actionPreferences;
|
|
|
|
// Actions - Tools menu
|
|
QAction *actionRunTests;
|
|
|
|
// Actions - Help menu
|
|
QAction *actionAbout;
|
|
QAction *actionCheckForUpdates;
|
|
QAction *actionReportIssue;
|
|
|
|
// Actions - Toolbar
|
|
QAction *actionReparse;
|
|
};
|
|
#endif // MAINWINDOW_H
|