Use a combobox instead of a file dialog
This commit is contained in:
parent
c88c639b8e
commit
2e64d0308c
@ -3,6 +3,7 @@
|
|||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
#include <QInputDialog>
|
||||||
|
|
||||||
#include "settingsobject.h"
|
#include "settingsobject.h"
|
||||||
#include "logic/BaseInstance.h"
|
#include "logic/BaseInstance.h"
|
||||||
@ -16,10 +17,12 @@ MCEditTool::MCEditTool(BaseInstance *instance, QObject *parent)
|
|||||||
void MCEditTool::runImpl()
|
void MCEditTool::runImpl()
|
||||||
{
|
{
|
||||||
const QString mceditPath = MMC->settings()->get("MCEditPath").toString();
|
const QString mceditPath = MMC->settings()->get("MCEditPath").toString();
|
||||||
const QString save = QFileDialog::getExistingDirectory(
|
const QDir saves = QDir(m_instance->minecraftRoot() + "/saves");
|
||||||
MMC->activeWindow(), tr("MCEdit"),
|
bool ok = true;
|
||||||
QDir(m_instance->minecraftRoot()).absoluteFilePath("saves"));
|
const QString save = QInputDialog::getItem(
|
||||||
if (save.isEmpty())
|
MMC->activeWindow(), tr("MCEdit"), tr("Choose which world to open:"),
|
||||||
|
saves.entryList(QDir::Dirs | QDir::NoDotAndDotDot), 0, false, &ok);
|
||||||
|
if (save.isEmpty() || !ok)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -33,7 +36,7 @@ void MCEditTool::runImpl()
|
|||||||
{
|
{
|
||||||
program = mceditDir.absoluteFilePath("mcedit.exe");
|
program = mceditDir.absoluteFilePath("mcedit.exe");
|
||||||
}
|
}
|
||||||
QProcess::startDetached(program, QStringList() << save, mceditPath);
|
QProcess::startDetached(program, QStringList() << saves.absoluteFilePath(save), mceditPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCEditFactory::registerSettings(SettingsObject *settings)
|
void MCEditFactory::registerSettings(SettingsObject *settings)
|
||||||
|
Loading…
Reference in New Issue
Block a user