XPlor/app/mainwindow.h

102 lines
2.5 KiB
C
Raw Normal View History

#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QFrame>
#include "typeregistry.h"
#include "treebuilder.h"
#include "settings.h"
struct DefinitionLoadResult {
QString filePath;
QString fileName;
bool success;
QString errorMessage;
};
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(); // For reparse
void setTypeRegistry(TypeRegistry&& registry, const QVector<DefinitionLoadResult>& results);
void LoadTreeCategories();
void Reset();
const QVector<DefinitionLoadResult>& definitionResults() const { return mDefinitionResults; }
const TypeRegistry& typeRegistry() const { return mTypeRegistry; }
TreeBuilder& treeBuilder() { return mTreeBuilder; }
private slots:
void HandleLogEntry(const QString &entry);
void HandleStatusUpdate(const QString &message, int timeout);
void HandleProgressUpdate(const QString &message, int progress, int max);
void applyTheme(const Theme &theme);
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;
QFrame *mRibbon;
TypeRegistry mTypeRegistry;
TreeBuilder mTreeBuilder;
QStringList mOpenedFilePaths; // Track opened files for reparsing
QVector<DefinitionLoadResult> mDefinitionResults;
// 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;
QAction *actionViewDefinitions;
// Actions - Help menu
QAction *actionAbout;
QAction *actionCheckForUpdates;
QAction *actionReportIssue;
// Actions - Toolbar
QAction *actionReparse;
};
#endif // MAINWINDOW_H