porymap/include/ui/customscriptseditor.h

60 lines
1.5 KiB
C
Raw Normal View History

2023-09-01 19:00:09 +01:00
#ifndef CUSTOMSCRIPTSEDITOR_H
#define CUSTOMSCRIPTSEDITOR_H
#include <QMainWindow>
#include <QListWidget>
#include <QAbstractButton>
#include <QMessageBox>
#include "customscriptslistitem.h"
namespace Ui {
class CustomScriptsEditor;
}
class CustomScriptsEditor : public QMainWindow
{
Q_OBJECT
public:
explicit CustomScriptsEditor(QWidget *parent = nullptr);
~CustomScriptsEditor();
signals:
void reloadScriptEngine();
private:
Ui::CustomScriptsEditor *ui;
bool hasUnsavedChanges = false;
QString importDir;
const QString baseDir;
void displayScript(const QString &filepath, bool enabled);
2023-09-01 19:00:09 +01:00
QString chooseScript(QString dir);
void removeScript(QListWidgetItem * item);
void replaceScript(QListWidgetItem * item);
void openScript(QListWidgetItem * item);
QString getScriptFilepath(QListWidgetItem * item, bool absolutePath = true) const;
void setScriptFilepath(QListWidgetItem * item, QString filepath) const;
bool getScriptEnabled(QListWidgetItem * item) const;
void markEdited();
2023-09-01 19:00:09 +01:00
int prompt(const QString &text, QMessageBox::StandardButton defaultButton);
void save();
void closeEvent(QCloseEvent*);
2023-09-06 19:45:46 +01:00
void restoreWindowState();
2023-09-01 19:00:09 +01:00
void initShortcuts();
QObjectList shortcutableObjects() const;
void applyUserShortcuts();
private slots:
void dialogButtonClicked(QAbstractButton *button);
void addNewScript();
void reloadScripts();
void removeSelectedScripts();
void openSelectedScripts();
};
#endif // CUSTOMSCRIPTSEDITOR_H