-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscripteditor.h
88 lines (72 loc) · 2.9 KB
/
scripteditor.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*
* This file is part of the PrismaticOutpost project.
* Copyright 2024. Isaac Raway. All rights reserved.
* This file is licensed under the terms of the AGPL-3.0,
* which you can find a copy of in the LICENSE.md file
* https://www.gnu.org/licenses/agpl-3.0.md.
* IMPORTANT: This license ALSO applies to all scripts
* and databases packaged with this distribution of
* PrismaticOutpost. If you wish to distribute proprietary
* scripts or databases, then they MUST NOT be packaged
* with this distribution or any binary distribution built
* from this distribution or any derivative of this
* distribution.
*/
// scripteditor.h
#ifndef SCRIPTEDITOR_H
#define SCRIPTEDITOR_H
#include "toolwindow.h"
#include <QWidget>
#include <QPlainTextEdit>
#include <QComboBox>
#include <QPushButton>
#include <QMdiSubWindow>
#include <QFileSystemWatcher>
class ScriptEditor : public QWidget
{
Q_OBJECT
//******************************************//
//****************** Setup *****************//
//******************************************//
public: explicit ScriptEditor(ToolWindow &toolWindow, const QString &itemName, const QString &scriptPath, const QString &dbDir, QWidget *parent = nullptr);
private: void setupUI();
//******************************************//
//********** MDI / Window Handling *********//
//******************************************//
private: QMdiSubWindow* getMdiParent();
private slots: void closeEditor();
private: void updateWindowTitle();
//******************************************//
//************* Script Handling ************//
//******************************************//
private slots: void refreshScriptList();
private: void loadScripts();
private: void loadScript(const QString &path);
private: bool maybeSave();
private slots: void saveScript();
private slots: void revertScript();
private slots: void scriptChanged(const QString &path);
//******************************************//
//********** Symbol List Handling **********//
//******************************************//
private slots: void updateSymbolList();
private slots: void jumpToSymbolByIndex(int index);
private slots: void jumpToSymbol(const QString &symbol);
//******************************************//
//***************** Fields *****************//
//******************************************//
private:
ToolWindow &toolWindow;
QString itemName;
QString currentScriptPath;
QString dbDir;
QComboBox *scriptNameCombo;
QComboBox *symbolCombo;
QPlainTextEdit *scriptEdit;
QPushButton *saveButton;
QPushButton *revertButton;
QPushButton *closeButton;
QFileSystemWatcher fileWatcher;
bool isDirty;
};
#endif // SCRIPTEDITOR_H