porymap/include/ui/customscriptseditor.h

64 lines
1.6 KiB
C
Raw Permalink 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();
public slots:
void applyUserShortcuts();
2023-09-01 19:00:09 +01:00
private:
Ui::CustomScriptsEditor *ui;
bool hasUnsavedChanges = false;
2023-11-03 06:40:03 +00:00
QString fileDialogDir;
2023-09-01 19:00:09 +01:00
const QString baseDir;
void displayScript(const QString &filepath, bool enabled);
2023-11-03 06:40:03 +00:00
void displayNewScript(QString filepath);
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;
private slots:
void dialogButtonClicked(QAbstractButton *button);
2023-11-03 06:40:03 +00:00
void createNewScript();
void loadScript();
void refreshScripts();
2023-09-01 19:00:09 +01:00
void removeSelectedScripts();
void openSelectedScripts();
};
#endif // CUSTOMSCRIPTSEDITOR_H