diff --git a/images/sources.txt b/images/sources.txt index 512668e..18af90b 100644 --- a/images/sources.txt +++ b/images/sources.txt @@ -1,2 +1,4 @@ text.svg: - Open Icon Libary GPL v2 \ No newline at end of file + Open Icon Libary GPL v2 +terminal.svg: + Open Icon Libary / nuvola / LGPL-2.1 \ No newline at end of file diff --git a/images/terminal.svg b/images/terminal.svg new file mode 100644 index 0000000..d5bf3c1 --- /dev/null +++ b/images/terminal.svg @@ -0,0 +1,92 @@ + + + + + + + + + + unsorted + + + + + Open Clip Art Library, Source: GNOME-Colors, Source: GNOME-Colors, Source: GNOME-Colors, Source: GNOME-Colors, Source: GNOME-Colors + + + + + + + + + + + + + + image/svg+xml + + + en + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mainwindow.cpp b/mainwindow.cpp index 57ff13c..9e5c80d 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1116,3 +1116,22 @@ void MainWindow::on_figureSelect_currentIndexChanged(int index) << "drawmaptext"; ui->figureInformation->scrollToAnchor(anchors.at(index)); } + +void MainWindow::on_actionOpen_Terminal_triggered() +{ + QUrl mtmapperenv; +#if defined Q_OS_LINUX + mtmapperenv = QUrl::fromLocalFile("mtmapperenv.sh"); +#elif defined Q_OS_WIN + mtmapperenv = QUrl::fromLocalFile("mtmapperenv.bat"); +#elif defined Q_OS_MACOS + mtmapperenv = QUrl::fromLocalFile("mtmapperenv.sh"); // The sh might also work on OSX +#else + mtmapperenv = QUrl(); +#endif + if (!QDesktopServices::openUrl(mtmapperenv)) { + QMessageBox::critical(this, + tr("Could not open Terminal"), + tr("Error: Could not open scriptfile (%1) for Terminal").arg(mtmapperenv.toDisplayString())); + } +} diff --git a/mainwindow.h b/mainwindow.h index b7d1b3e..5177c15 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -115,6 +115,8 @@ private slots: void switchTranslator(QTranslator *translator, const QString &prefix, const QLocale &locale); + void on_actionOpen_Terminal_triggered(); + private: bool portable; Ui::MainWindow *ui; diff --git a/mainwindow.ui b/mainwindow.ui index 730d2b0..bcc5ee1 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -2496,6 +2496,7 @@ Nodes higher than this level will not be drawn. This can be used to avoid floati + @@ -2811,6 +2812,15 @@ p, li { white-space: pre-wrap; } Start colors.txt assistant + + + + :/images/terminal.svg:/images/terminal.svg + + + Open &Terminal + + diff --git a/minetestmappergui.qrc b/minetestmappergui.qrc index da8d4cb..9b65430 100644 --- a/minetestmappergui.qrc +++ b/minetestmappergui.qrc @@ -57,5 +57,6 @@ doc/images/tiles-16-centered.png doc/images/tiles-16.png doc/images/tiles-20-centered.png + images/terminal.svg diff --git a/mtmapperenv.bat b/mtmapperenv.bat new file mode 100644 index 0000000..bc5fc94 --- /dev/null +++ b/mtmapperenv.bat @@ -0,0 +1,3 @@ +@echo off +set PATH=%~dp0;%PATH% +cmd /k echo Ready. Type 'minetestmapper --help' for usage information \ No newline at end of file diff --git a/mtmapperenv.sh b/mtmapperenv.sh new file mode 100644 index 0000000..9c11b65 --- /dev/null +++ b/mtmapperenv.sh @@ -0,0 +1,4 @@ +PATH=$PATH:"$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +export PATH +echo "Ready. Type 'minetestmapper --help' for usage information" +exec $SHELL