diff --git a/mainwindow.cpp b/mainwindow.cpp index e8afd711..d7edf674 100755 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -15,8 +15,12 @@ #include #include #include +#include #include #include +#include +#include +#include MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), @@ -549,6 +553,12 @@ void MainWindow::redo() { editor->redo(); } +// Open current map scripts in system default editor for .inc files +void MainWindow::openInTextEditor() { + QString path = QDir::cleanPath("file://" + editor->project->root + QDir::separator() + "data/maps/" + editor->map->name + "/scripts.inc"); + QDesktopServices::openUrl(QUrl(path)); +} + void MainWindow::on_action_Save_triggered() { editor->save(); updateMapList(); @@ -881,6 +891,11 @@ void MainWindow::on_toolButton_deleteObject_clicked() } } +void MainWindow::on_toolButton_Open_Scripts_clicked() +{ + openInTextEditor(); +} + void MainWindow::on_toolButton_Paint_clicked() { editor->map_edit_mode = "paint"; diff --git a/mainwindow.h b/mainwindow.h index b8a12f8b..be782842 100755 --- a/mainwindow.h +++ b/mainwindow.h @@ -37,6 +37,8 @@ private slots: void undo(); void redo(); + void openInTextEditor(); + void onLoadMapRequested(QString, QString); void onMapChanged(Map *map); void onMapNeedsRedrawing(Map *map); @@ -59,6 +61,7 @@ private slots: void on_actionRedo_triggered(); void on_toolButton_deleteObject_clicked(); + void on_toolButton_Open_Scripts_clicked(); void addNewEvent(QString); void updateSelectedObjects(); diff --git a/mainwindow.ui b/mainwindow.ui index f3f19222..d24583d2 100755 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -334,8 +334,8 @@ 0 0 - 429 - 620 + 462 + 599 @@ -708,7 +708,7 @@ 0 0 - 315 + 252 86 @@ -812,10 +812,10 @@ - 0 + 8 0 - 365 - 405 + 323 + 368 @@ -1050,8 +1050,8 @@ 0 0 - 381 - 657 + 371 + 643 @@ -1216,8 +1216,8 @@ 0 0 - 420 - 584 + 410 + 560 @@ -1330,6 +1330,29 @@ + + + + Open Map Scripts + + + false + + + + + + + Qt::Horizontal + + + + 20 + 20 + + + + @@ -1849,8 +1872,8 @@ 0 0 - 826 - 557 + 818 + 539 @@ -2022,7 +2045,7 @@ 0 0 1117 - 21 + 22