Merge pull request #24 from garakmon/open-scripts
"Open Map Scripts" button
This commit is contained in:
commit
4313662200
3 changed files with 54 additions and 13 deletions
|
@ -15,8 +15,12 @@
|
||||||
#include <QSpacerItem>
|
#include <QSpacerItem>
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
|
#include <QPushButton>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
|
#include <QProcess>
|
||||||
|
#include <QSysInfo>
|
||||||
|
#include <QDesktopServices>
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent) :
|
MainWindow::MainWindow(QWidget *parent) :
|
||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
|
@ -549,6 +553,12 @@ void MainWindow::redo() {
|
||||||
editor->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() {
|
void MainWindow::on_action_Save_triggered() {
|
||||||
editor->save();
|
editor->save();
|
||||||
updateMapList();
|
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()
|
void MainWindow::on_toolButton_Paint_clicked()
|
||||||
{
|
{
|
||||||
editor->map_edit_mode = "paint";
|
editor->map_edit_mode = "paint";
|
||||||
|
|
|
@ -37,6 +37,8 @@ private slots:
|
||||||
void undo();
|
void undo();
|
||||||
void redo();
|
void redo();
|
||||||
|
|
||||||
|
void openInTextEditor();
|
||||||
|
|
||||||
void onLoadMapRequested(QString, QString);
|
void onLoadMapRequested(QString, QString);
|
||||||
void onMapChanged(Map *map);
|
void onMapChanged(Map *map);
|
||||||
void onMapNeedsRedrawing(Map *map);
|
void onMapNeedsRedrawing(Map *map);
|
||||||
|
@ -59,6 +61,7 @@ private slots:
|
||||||
void on_actionRedo_triggered();
|
void on_actionRedo_triggered();
|
||||||
|
|
||||||
void on_toolButton_deleteObject_clicked();
|
void on_toolButton_deleteObject_clicked();
|
||||||
|
void on_toolButton_Open_Scripts_clicked();
|
||||||
|
|
||||||
void addNewEvent(QString);
|
void addNewEvent(QString);
|
||||||
void updateSelectedObjects();
|
void updateSelectedObjects();
|
||||||
|
|
|
@ -334,8 +334,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>429</width>
|
<width>462</width>
|
||||||
<height>620</height>
|
<height>599</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_8">
|
<layout class="QGridLayout" name="gridLayout_8">
|
||||||
|
@ -708,7 +708,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>315</width>
|
<width>252</width>
|
||||||
<height>86</height>
|
<height>86</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -812,10 +812,10 @@
|
||||||
</property>
|
</property>
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>8</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>365</width>
|
<width>323</width>
|
||||||
<height>405</height>
|
<height>368</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -1050,8 +1050,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>381</width>
|
<width>371</width>
|
||||||
<height>657</height>
|
<height>643</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_7">
|
<layout class="QGridLayout" name="gridLayout_7">
|
||||||
|
@ -1216,8 +1216,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>420</width>
|
<width>410</width>
|
||||||
<height>584</height>
|
<height>560</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -1330,6 +1330,29 @@
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButton_Open_Scripts">
|
||||||
|
<property name="text">
|
||||||
|
<string>Open Map Scripts</string>
|
||||||
|
</property>
|
||||||
|
<property name="autoRaise">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_20">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -1849,8 +1872,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>826</width>
|
<width>818</width>
|
||||||
<height>557</height>
|
<height>539</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_14">
|
<layout class="QGridLayout" name="gridLayout_14">
|
||||||
|
@ -2022,7 +2045,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1117</width>
|
<width>1117</width>
|
||||||
<height>21</height>
|
<height>22</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menuFile">
|
<widget class="QMenu" name="menuFile">
|
||||||
|
|
Loading…
Reference in a new issue