Add new World Selector
parent
5f78b1d649
commit
fd180c9590
|
@ -125,6 +125,15 @@ MainWindow::MainWindow(Translator *translator, QWidget *parent) :
|
|||
spacerWidget->setVisible(true);
|
||||
ui->mainToolBar->insertWidget(ui->actionOutputLog, spacerWidget);
|
||||
|
||||
minetestWorldsModel->setFilter(QDir::NoDotAndDotDot | QDir::AllDirs);
|
||||
ui->treeView->setItemsExpandable(false);
|
||||
ui->treeView->setModel(minetestWorldsModel);
|
||||
QString worldsPath = ui->path_minetestWorlds->text();
|
||||
|
||||
minetestWorldsModel->setRootPath(worldsPath);
|
||||
auto index = minetestWorldsModel->index(worldsPath);
|
||||
ui->treeView->setRootIndex(index);
|
||||
|
||||
minetestMapper->init();
|
||||
}
|
||||
|
||||
|
@ -607,6 +616,7 @@ void MainWindow::writeProfile()
|
|||
profile->beginGroup("common");//tab1 common
|
||||
profile->setValue("path_OutputImage", ui->path_OutputImage->text());
|
||||
profile->setValue("path_World", ui->path_World->text());
|
||||
profile->setValue("path_minetestWorlds", ui->path_minetestWorlds->text());
|
||||
profile->setValue("backend",ui->backend->currentIndex());
|
||||
profile->endGroup();
|
||||
|
||||
|
@ -703,6 +713,14 @@ void MainWindow::readProfile()
|
|||
|
||||
profile->beginGroup("common"); //tab1 Common
|
||||
ui->path_World->setText(profile->value("path_World",QDir::homePath()).toString());
|
||||
// TODO: Create a static class where all standard paths are set.
|
||||
#ifdef Q_OS_WIN
|
||||
QString standard = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/../../Minetest/worlds";
|
||||
standard = QDir(standard).absolutePath();
|
||||
#else
|
||||
QString standard = "/home/.minetest/worlds";
|
||||
#endif
|
||||
ui->path_minetestWorlds->setText(profile->value("path_minetestWorlds", standard).toString());
|
||||
ui->path_OutputImage->setText(profile->value("path_OutputImage",QDir::homePath().append("/map.png")).toString());
|
||||
//ui->backend->setCurrentIndex(profile->value("backend",0).toInt()); //loading the backend here is useless, because the backends are initialized later
|
||||
profile->endGroup();
|
||||
|
@ -1080,3 +1098,34 @@ void MainWindow::on_actionOpen_Terminal_triggered()
|
|||
tr("Error: Could not open scriptfile (%1) for Terminal").arg(mtmapperenv.toDisplayString()));
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_treeView_activated(const QModelIndex &index)
|
||||
{
|
||||
ui->path_World->setText(minetestWorldsModel->filePath(index));
|
||||
}
|
||||
|
||||
void MainWindow::on_path_minetestWorlds_editingFinished()
|
||||
{
|
||||
minetestWorldsModel->setRootPath(ui->path_minetestWorlds->text());
|
||||
auto index = minetestWorldsModel->index(ui->path_minetestWorlds->text());
|
||||
ui->treeView->setRootIndex(index);
|
||||
}
|
||||
|
||||
void MainWindow::on_treeView_clicked(const QModelIndex &index)
|
||||
{
|
||||
ui->path_World->setText(minetestWorldsModel->filePath(index));
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_browseWorldsDir_clicked()
|
||||
{
|
||||
QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"),
|
||||
ui->path_minetestWorlds->text(),
|
||||
QFileDialog::ShowDirsOnly
|
||||
| QFileDialog::DontResolveSymlinks);
|
||||
if(!dir.isEmpty())
|
||||
{
|
||||
ui->path_minetestWorlds->setText(dir);
|
||||
on_path_minetestWorlds_editingFinished();
|
||||
}
|
||||
}
|
||||
|
|
10
mainwindow.h
10
mainwindow.h
|
@ -13,6 +13,7 @@
|
|||
#include <QProgressBar>
|
||||
#include <QSettings>
|
||||
#include <QStringListModel>
|
||||
#include <QFileSystemModel>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#include <QWinTaskbarButton>
|
||||
|
@ -129,6 +130,14 @@ private slots:
|
|||
|
||||
void on_actionOpen_Terminal_triggered();
|
||||
|
||||
void on_treeView_activated(const QModelIndex &index);
|
||||
|
||||
void on_path_minetestWorlds_editingFinished();
|
||||
|
||||
void on_treeView_clicked(const QModelIndex &index);
|
||||
|
||||
void on_browseWorldsDir_clicked();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
QProgressBar *progressBar;
|
||||
|
@ -157,6 +166,7 @@ private:
|
|||
QDataWidgetMapper *drawMapFigureTableMapper;
|
||||
MinetestMapperExe *minetestMapper;
|
||||
QStringListModel *backends = new QStringListModel();
|
||||
QFileSystemModel *minetestWorldsModel = new QFileSystemModel();
|
||||
|
||||
};
|
||||
|
||||
|
|
164
mainwindow.ui
164
mainwindow.ui
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1061</width>
|
||||
<height>754</height>
|
||||
<height>794</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -35,26 +35,29 @@
|
|||
<string>General</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="3" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<item row="1" column="1">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Database backend</string>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QComboBox" name="backend">
|
||||
<property name="statusTip">
|
||||
<string>Set or override the database backend to use. If you are not shure, select 'auto'</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Select World dir</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLineEdit" name="path_World">
|
||||
<property name="statusTip">
|
||||
<string>Select the world directory, wich contains the world Database</string>
|
||||
|
@ -64,7 +67,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="browseWorld">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
|
@ -84,46 +87,26 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Database backend</string>
|
||||
<item row="4" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QComboBox" name="backend">
|
||||
<property name="statusTip">
|
||||
<string>Set or override the database backend to use. If you are not shure, select 'auto'</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox_4">
|
||||
<property name="title">
|
||||
<string>Output Image</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="saveImage">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>157</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save as</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="minetestmappergui.qrc">
|
||||
<normaloff>:/save</normaloff>:/save</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLineEdit" name="path_OutputImage">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body>
|
||||
|
@ -145,14 +128,24 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_preview">
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="saveImage">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>157</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Preview: </string>
|
||||
<string>Save as</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="minetestmappergui.qrc">
|
||||
<normaloff>:/save</normaloff>:/save</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_20">
|
||||
<property name="text">
|
||||
<string><html><head/><body>
|
||||
|
@ -165,6 +158,59 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_preview">
|
||||
<property name="text">
|
||||
<string>Preview: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox_15">
|
||||
<property name="title">
|
||||
<string>Minetest Worlds</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_17">
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="path_minetestWorlds"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_22">
|
||||
<property name="text">
|
||||
<string>Minetest worlds dir:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="browseWorldsDir">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>157</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="minetestmappergui.qrc">
|
||||
<normaloff>:/open</normaloff>:/open</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QTreeView" name="treeView"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_23">
|
||||
<property name="text">
|
||||
<string>Worlds:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -871,8 +917,8 @@ Nodes higher than this level will not be drawn. This can be used to avoid floati
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>503</width>
|
||||
<height>427</height>
|
||||
<width>524</width>
|
||||
<height>448</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
|
@ -1933,7 +1979,7 @@ Nodes higher than this level will not be drawn. This can be used to avoid floati
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>513</width>
|
||||
<height>374</height>
|
||||
<height>437</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
|
@ -3466,10 +3512,10 @@ p, li { white-space: pre-wrap; }
|
|||
</connection>
|
||||
</connections>
|
||||
<buttongroups>
|
||||
<buttongroup name="group_tiles_arrange_at"/>
|
||||
<buttongroup name="group_tiles_tiles"/>
|
||||
<buttongroup name="group_tiles_arrange"/>
|
||||
<buttongroup name="geometrymode_size_group"/>
|
||||
<buttongroup name="geometrymode_granularity_group"/>
|
||||
<buttongroup name="group_tiles_arrange"/>
|
||||
<buttongroup name="group_tiles_tiles"/>
|
||||
<buttongroup name="group_tiles_arrange_at"/>
|
||||
<buttongroup name="geometrymode_size_group"/>
|
||||
</buttongroups>
|
||||
</ui>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue