Implement script engine reload
This commit is contained in:
parent
40e8824eca
commit
2aa18da255
3 changed files with 14 additions and 1 deletions
|
@ -288,6 +288,7 @@ private slots:
|
||||||
void togglePreferenceSpecificUi();
|
void togglePreferenceSpecificUi();
|
||||||
void on_actionEdit_Project_Settings_triggered();
|
void on_actionEdit_Project_Settings_triggered();
|
||||||
void on_actionCustom_Scripts_triggered();
|
void on_actionCustom_Scripts_triggered();
|
||||||
|
void reloadScriptEngine();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
|
|
|
@ -2736,11 +2736,23 @@ void MainWindow::on_actionEdit_Project_Settings_triggered() {
|
||||||
void MainWindow::on_actionCustom_Scripts_triggered() {
|
void MainWindow::on_actionCustom_Scripts_triggered() {
|
||||||
if (!this->customScriptsEditor) {
|
if (!this->customScriptsEditor) {
|
||||||
this->customScriptsEditor = new CustomScriptsEditor(this);
|
this->customScriptsEditor = new CustomScriptsEditor(this);
|
||||||
|
connect(this->customScriptsEditor, &CustomScriptsEditor::reloadScriptEngine,
|
||||||
|
this, &MainWindow::reloadScriptEngine);
|
||||||
}
|
}
|
||||||
|
|
||||||
openSubWindow(this->customScriptsEditor);
|
openSubWindow(this->customScriptsEditor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::reloadScriptEngine() {
|
||||||
|
Scripting::init(this);
|
||||||
|
this->ui->graphicsView_Map->clearOverlayMap();
|
||||||
|
Scripting::populateGlobalObject(this);
|
||||||
|
// Lying to the scripts here, simulating a project reload
|
||||||
|
Scripting::cb_ProjectOpened(projectConfig.getProjectDir());
|
||||||
|
if (editor && editor->map)
|
||||||
|
Scripting::cb_MapOpened(editor->map->name);
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::on_pushButton_AddCustomHeaderField_clicked()
|
void MainWindow::on_pushButton_AddCustomHeaderField_clicked()
|
||||||
{
|
{
|
||||||
bool ok;
|
bool ok;
|
||||||
|
|
|
@ -198,7 +198,7 @@ void CustomScriptsEditor::reloadScripts() {
|
||||||
return;
|
return;
|
||||||
this->save();
|
this->save();
|
||||||
}
|
}
|
||||||
emit reloadScriptEngine(); // TODO: Catch this signal
|
emit reloadScriptEngine();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomScriptsEditor::save() {
|
void CustomScriptsEditor::save() {
|
||||||
|
|
Loading…
Reference in a new issue