From 2e64d0308c96b18532918d36794368eb1deb24cd Mon Sep 17 00:00:00 2001 From: Jan Dalheimer Date: Sun, 16 Feb 2014 11:56:02 +0100 Subject: Use a combobox instead of a file dialog --- logic/MCEditTool.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/logic/MCEditTool.cpp b/logic/MCEditTool.cpp index 14dc1b96..5694f654 100644 --- a/logic/MCEditTool.cpp +++ b/logic/MCEditTool.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include "settingsobject.h" #include "logic/BaseInstance.h" @@ -16,10 +17,12 @@ MCEditTool::MCEditTool(BaseInstance *instance, QObject *parent) void MCEditTool::runImpl() { const QString mceditPath = MMC->settings()->get("MCEditPath").toString(); - const QString save = QFileDialog::getExistingDirectory( - MMC->activeWindow(), tr("MCEdit"), - QDir(m_instance->minecraftRoot()).absoluteFilePath("saves")); - if (save.isEmpty()) + const QDir saves = QDir(m_instance->minecraftRoot() + "/saves"); + bool ok = true; + const QString save = QInputDialog::getItem( + MMC->activeWindow(), tr("MCEdit"), tr("Choose which world to open:"), + saves.entryList(QDir::Dirs | QDir::NoDotAndDotDot), 0, false, &ok); + if (save.isEmpty() || !ok) { return; } @@ -33,7 +36,7 @@ void MCEditTool::runImpl() { program = mceditDir.absoluteFilePath("mcedit.exe"); } - QProcess::startDetached(program, QStringList() << save, mceditPath); + QProcess::startDetached(program, QStringList() << saves.absoluteFilePath(save), mceditPath); } void MCEditFactory::registerSettings(SettingsObject *settings) -- cgit v1.2.3