NOISSUE Refactors and moving of things
This commit is contained in:
@ -4,9 +4,12 @@
|
||||
#include <QProcess>
|
||||
#include <QDesktopServices>
|
||||
#include <QUrl>
|
||||
// FIXME: mixing logic and UI!!!!
|
||||
#include <QInputDialog>
|
||||
|
||||
#include "logic/settings/SettingsObject.h"
|
||||
#include "logic/BaseInstance.h"
|
||||
#include "logic/minecraft/MinecraftInstance.h"
|
||||
#include "MultiMC.h"
|
||||
|
||||
MCEditTool::MCEditTool(InstancePtr instance, QObject *parent)
|
||||
@ -14,6 +17,36 @@ MCEditTool::MCEditTool(InstancePtr instance, QObject *parent)
|
||||
{
|
||||
}
|
||||
|
||||
QString MCEditTool::getSave() const
|
||||
{
|
||||
// FIXME: mixing logic and UI!!!!
|
||||
auto mcInstance = std::dynamic_pointer_cast<MinecraftInstance>(m_instance);
|
||||
if(!mcInstance)
|
||||
{
|
||||
return QString();
|
||||
}
|
||||
QDir saves(mcInstance->minecraftRoot() + "/saves");
|
||||
QStringList worlds = saves.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
|
||||
QMutableListIterator<QString> it(worlds);
|
||||
while (it.hasNext())
|
||||
{
|
||||
it.next();
|
||||
if (!QDir(saves.absoluteFilePath(it.value())).exists("level.dat"))
|
||||
{
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
bool ok = true;
|
||||
const QString save = QInputDialog::getItem(
|
||||
MMC->activeWindow(), tr("MCEdit"), tr("Choose which world to open:"),
|
||||
worlds, 0, false, &ok);
|
||||
if (ok)
|
||||
{
|
||||
return saves.absoluteFilePath(save);
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
void MCEditTool::runImpl()
|
||||
{
|
||||
const QString mceditPath = MMC->settings()->get("MCEditPath").toString();
|
||||
|
Reference in New Issue
Block a user