2015-02-07 09:43:09 +00:00
|
|
|
#pragma once
|
2015-10-05 00:47:27 +01:00
|
|
|
#include <FileSystem.h>
|
2023-08-02 17:35:35 +01:00
|
|
|
#include "minecraft/MinecraftInstance.h"
|
2021-11-22 02:55:16 +00:00
|
|
|
#include "ui/pages/BasePage.h"
|
|
|
|
#include "ui/pages/BasePageProvider.h"
|
2023-08-02 17:35:35 +01:00
|
|
|
#include "ui/pages/instance/InstanceSettingsPage.h"
|
2021-11-22 02:55:16 +00:00
|
|
|
#include "ui/pages/instance/LogPage.h"
|
2022-10-14 18:38:42 +01:00
|
|
|
#include "ui/pages/instance/ManagedPackPage.h"
|
2021-11-22 02:55:16 +00:00
|
|
|
#include "ui/pages/instance/ModFolderPage.h"
|
|
|
|
#include "ui/pages/instance/NotesPage.h"
|
|
|
|
#include "ui/pages/instance/OtherLogsPage.h"
|
2023-08-02 17:35:35 +01:00
|
|
|
#include "ui/pages/instance/ResourcePackPage.h"
|
|
|
|
#include "ui/pages/instance/ScreenshotsPage.h"
|
2021-11-22 02:55:16 +00:00
|
|
|
#include "ui/pages/instance/ServersPage.h"
|
2023-08-02 17:35:35 +01:00
|
|
|
#include "ui/pages/instance/ShaderPackPage.h"
|
|
|
|
#include "ui/pages/instance/TexturePackPage.h"
|
|
|
|
#include "ui/pages/instance/VersionPage.h"
|
|
|
|
#include "ui/pages/instance/WorldListPage.h"
|
2015-02-07 09:43:09 +00:00
|
|
|
|
2023-08-02 17:35:35 +01:00
|
|
|
class InstancePageProvider : protected QObject, public BasePageProvider {
|
2018-07-15 13:51:05 +01:00
|
|
|
Q_OBJECT
|
2023-08-02 17:35:35 +01:00
|
|
|
public:
|
|
|
|
explicit InstancePageProvider(InstancePtr parent) { inst = parent; }
|
2015-02-07 09:43:09 +00:00
|
|
|
|
2023-08-02 17:35:35 +01:00
|
|
|
virtual ~InstancePageProvider(){};
|
|
|
|
virtual QList<BasePage*> getPages() override
|
2018-07-15 13:51:05 +01:00
|
|
|
{
|
2023-08-02 17:35:35 +01:00
|
|
|
QList<BasePage*> values;
|
2018-07-15 13:51:05 +01:00
|
|
|
values.append(new LogPage(inst));
|
|
|
|
std::shared_ptr<MinecraftInstance> onesix = std::dynamic_pointer_cast<MinecraftInstance>(inst);
|
2022-02-21 21:30:44 +00:00
|
|
|
values.append(new VersionPage(onesix.get()));
|
2022-10-14 18:38:42 +01:00
|
|
|
values.append(ManagedPackPage::createPage(onesix.get()));
|
refactor: Create a more clear hierarchy for some instance pages
Previously, the Shaders, Texture packs and Resource packs tabs had as
parent the ModFolderPage, making it so that making changes only to the
Mods page would require checking the id of the page for the correct one.
This was hackish and error-prone.
Now, those pages all inherit from a single class, ExternalResourcesPage,
that handles the basic behaviour of all of them, while allowing for
individual modification in code.
This is still not a clear separation, since internally, all those
resources are derived from Mods, so for now there's still some awkward
common code :/
2022-03-11 21:03:21 +00:00
|
|
|
auto modsPage = new ModFolderPage(onesix.get(), onesix->loaderModList());
|
2023-02-11 22:35:08 +00:00
|
|
|
modsPage->setFilter("%1 (*.zip *.jar *.litemod *.nilmod)");
|
2022-02-21 21:30:44 +00:00
|
|
|
values.append(modsPage);
|
refactor: Create a more clear hierarchy for some instance pages
Previously, the Shaders, Texture packs and Resource packs tabs had as
parent the ModFolderPage, making it so that making changes only to the
Mods page would require checking the id of the page for the correct one.
This was hackish and error-prone.
Now, those pages all inherit from a single class, ExternalResourcesPage,
that handles the basic behaviour of all of them, while allowing for
individual modification in code.
This is still not a clear separation, since internally, all those
resources are derived from Mods, so for now there's still some awkward
common code :/
2022-03-11 21:03:21 +00:00
|
|
|
values.append(new CoreModFolderPage(onesix.get(), onesix->coreModList()));
|
2023-02-11 22:36:06 +00:00
|
|
|
values.append(new NilModFolderPage(onesix.get(), onesix->nilModList()));
|
2022-08-10 18:48:34 +01:00
|
|
|
values.append(new ResourcePackPage(onesix.get(), onesix->resourcePackList()));
|
|
|
|
values.append(new TexturePackPage(onesix.get(), onesix->texturePackList()));
|
|
|
|
values.append(new ShaderPackPage(onesix.get(), onesix->shaderPackList()));
|
2022-02-21 21:30:44 +00:00
|
|
|
values.append(new NotesPage(onesix.get()));
|
|
|
|
values.append(new WorldListPage(onesix.get(), onesix->worldList()));
|
|
|
|
values.append(new ServersPage(onesix));
|
|
|
|
// values.append(new GameOptionsPage(onesix.get()));
|
|
|
|
values.append(new ScreenshotsPage(FS::PathCombine(onesix->gameRoot(), "screenshots")));
|
|
|
|
values.append(new InstanceSettingsPage(onesix.get()));
|
2018-07-15 13:51:05 +01:00
|
|
|
auto logMatcher = inst->getLogFileMatcher();
|
2023-08-02 17:35:35 +01:00
|
|
|
if (logMatcher) {
|
2018-07-15 13:51:05 +01:00
|
|
|
values.append(new OtherLogsPage(inst->getLogFileRoot(), logMatcher));
|
|
|
|
}
|
|
|
|
return values;
|
|
|
|
}
|
2015-02-07 09:43:09 +00:00
|
|
|
|
2023-08-02 17:35:35 +01:00
|
|
|
virtual QString dialogTitle() override { return tr("Edit Instance (%1)").arg(inst->name()); }
|
|
|
|
|
|
|
|
protected:
|
2018-07-15 13:51:05 +01:00
|
|
|
InstancePtr inst;
|
2015-02-07 09:43:09 +00:00
|
|
|
};
|