2015-02-07 09:43:09 +00:00
|
|
|
#pragma once
|
2017-07-24 08:01:37 +01:00
|
|
|
#include "minecraft/MinecraftInstance.h"
|
2017-09-16 22:09:05 +01:00
|
|
|
#include "minecraft/legacy/LegacyInstance.h"
|
2015-10-05 00:47:27 +01:00
|
|
|
#include <FileSystem.h>
|
2015-02-07 09:43:09 +00:00
|
|
|
#include "pages/BasePage.h"
|
2016-08-06 14:39:29 +01:00
|
|
|
#include "pages/LogPage.h"
|
2015-02-07 09:43:09 +00:00
|
|
|
#include "pages/VersionPage.h"
|
|
|
|
#include "pages/ModFolderPage.h"
|
|
|
|
#include "pages/ResourcePackPage.h"
|
|
|
|
#include "pages/TexturePackPage.h"
|
|
|
|
#include "pages/NotesPage.h"
|
|
|
|
#include "pages/ScreenshotsPage.h"
|
|
|
|
#include "pages/InstanceSettingsPage.h"
|
|
|
|
#include "pages/OtherLogsPage.h"
|
|
|
|
#include "pages/BasePageProvider.h"
|
2017-09-16 22:09:05 +01:00
|
|
|
#include "pages/LegacyUpgradePage.h"
|
2015-08-19 00:10:17 +01:00
|
|
|
#include "pages/WorldListPage.h"
|
2015-02-07 09:43:09 +00:00
|
|
|
|
2015-04-05 21:00:32 +01:00
|
|
|
|
2015-02-07 09:43:09 +00:00
|
|
|
class InstancePageProvider : public QObject, public BasePageProvider
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit InstancePageProvider(InstancePtr parent)
|
|
|
|
{
|
|
|
|
inst = parent;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual ~InstancePageProvider() {};
|
|
|
|
virtual QList<BasePage *> getPages() override
|
|
|
|
{
|
|
|
|
QList<BasePage *> values;
|
2016-08-06 14:39:29 +01:00
|
|
|
values.append(new LogPage(inst));
|
2017-07-24 08:01:37 +01:00
|
|
|
std::shared_ptr<MinecraftInstance> onesix = std::dynamic_pointer_cast<MinecraftInstance>(inst);
|
2015-02-07 09:43:09 +00:00
|
|
|
if(onesix)
|
|
|
|
{
|
|
|
|
values.append(new VersionPage(onesix.get()));
|
2015-05-12 22:43:11 +01:00
|
|
|
auto modsPage = new ModFolderPage(onesix.get(), onesix->loaderModList(), "mods", "loadermods", tr("Loader mods"), "Loader-mods");
|
2016-03-22 22:28:47 +00:00
|
|
|
modsPage->setFilter("%1 (*.zip *.jar *.litemod)");
|
2015-05-12 22:43:11 +01:00
|
|
|
values.append(modsPage);
|
|
|
|
values.append(new CoreModFolderPage(onesix.get(), onesix->coreModList(), "coremods", "coremods", tr("Core mods"), "Core-mods"));
|
2015-02-07 09:43:09 +00:00
|
|
|
values.append(new ResourcePackPage(onesix.get()));
|
|
|
|
values.append(new TexturePackPage(onesix.get()));
|
|
|
|
values.append(new NotesPage(onesix.get()));
|
2015-08-19 00:10:17 +01:00
|
|
|
values.append(new WorldListPage(onesix.get(), onesix->worldList(), "worlds", "worlds", tr("Worlds"), "Worlds"));
|
2015-10-05 00:47:27 +01:00
|
|
|
values.append(new ScreenshotsPage(FS::PathCombine(onesix->minecraftRoot(), "screenshots")));
|
2015-02-07 09:43:09 +00:00
|
|
|
values.append(new InstanceSettingsPage(onesix.get()));
|
|
|
|
}
|
2017-09-16 22:09:05 +01:00
|
|
|
std::shared_ptr<LegacyInstance> legacy = std::dynamic_pointer_cast<LegacyInstance>(inst);
|
|
|
|
if(legacy)
|
|
|
|
{
|
|
|
|
values.append(new LegacyUpgradePage(legacy.get()));
|
2017-09-20 22:38:31 +01:00
|
|
|
values.append(new NotesPage(legacy.get()));
|
|
|
|
values.append(new WorldListPage(legacy.get(), legacy->worldList(), "worlds", "worlds", tr("Worlds"), "Worlds"));
|
|
|
|
values.append(new ScreenshotsPage(FS::PathCombine(legacy->minecraftRoot(), "screenshots")));
|
2017-09-16 22:09:05 +01:00
|
|
|
}
|
2015-08-18 01:25:24 +01:00
|
|
|
auto logMatcher = inst->getLogFileMatcher();
|
|
|
|
if(logMatcher)
|
|
|
|
{
|
2015-08-19 01:04:56 +01:00
|
|
|
values.append(new OtherLogsPage(inst->getLogFileRoot(), logMatcher));
|
2015-04-05 21:00:32 +01:00
|
|
|
}
|
2015-02-07 09:43:09 +00:00
|
|
|
return values;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual QString dialogTitle() override
|
|
|
|
{
|
|
|
|
return tr("Edit Instance (%1)").arg(inst->name());
|
|
|
|
}
|
|
|
|
protected:
|
|
|
|
InstancePtr inst;
|
|
|
|
};
|