summaryrefslogtreecommitdiff
path: root/archived/projt-launcher/launcher/InstancePageProvider.h
blob: 18808f1c13dad1ad4596082fdc9d6335f8607b6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// SPDX-License-Identifier: GPL-3.0-only
// SPDX-FileCopyrightText: 2026 Project Tick
// SPDX-FileContributor: Project Tick Team
/*
 *  ProjT Launcher - Minecraft Launcher
 *  Copyright (C) 2026 Project Tick
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, version 3.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, write to the Free Software Foundation,
 *  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */
#pragma once
#include <FileSystem.h>
#include <ui/pages/instance/DataPackPage.h>
#include "minecraft/MinecraftInstance.h"
#include "ui/pages/BasePage.h"
#include "ui/pages/BasePageProvider.h"
#include "ui/pages/instance/BackupPage.h"
#include "ui/pages/instance/InstanceSettingsPage.h"
#include "ui/pages/instance/LogPage.h"
#include "ui/pages/instance/ManagedPackPage.h"
#include "ui/pages/instance/ModFolderPage.h"
#include "ui/pages/instance/NotesPage.h"
#include "ui/pages/instance/OtherLogsPage.h"
#include "ui/pages/instance/ResourcePackPage.h"
#include "ui/pages/instance/ScreenshotsPage.h"
#include "ui/pages/instance/ServersPage.h"
#include "ui/pages/instance/ShaderPackPage.h"
#include "ui/pages/instance/TexturePackPage.h"
#include "ui/pages/instance/VersionPage.h"
#include "ui/pages/instance/WorldListPage.h"

class InstancePageProvider : protected QObject, public BasePageProvider
{
	Q_OBJECT
  public:
	explicit InstancePageProvider(InstancePtr parent)
	{
		inst = parent;
	}

	virtual ~InstancePageProvider() = default;
	virtual QList<BasePage*> getPages() override
	{
		QList<BasePage*> values;
		values.append(new LogPage(inst));
		std::shared_ptr<MinecraftInstance> onesix = std::dynamic_pointer_cast<MinecraftInstance>(inst);
		values.append(new VersionPage(onesix.get()));
		values.append(ManagedPackPage::createPage(onesix.get()));
		auto modsPage = new ModFolderPage(onesix.get(), onesix->loaderModList());
		modsPage->setFilter("%1 (*.zip *.jar *.litemod *.nilmod)");
		values.append(modsPage);
		values.append(new CoreModFolderPage(onesix.get(), onesix->coreModList()));
		values.append(new NilModFolderPage(onesix.get(), onesix->nilModList()));
		values.append(new ResourcePackPage(onesix.get(), onesix->resourcePackList()));
		values.append(new GlobalDataPackPage(onesix.get()));
		values.append(new TexturePackPage(onesix.get(), onesix->texturePackList()));
		values.append(new ShaderPackPage(onesix.get(), onesix->shaderPackList()));
		values.append(new NotesPage(onesix.get()));
		values.append(new WorldListPage(onesix, onesix->worldList()));
		values.append(new ServersPage(onesix));
		values.append(new ScreenshotsPage(FS::PathCombine(onesix->gameRoot(), "screenshots")));
		values.append(new BackupPage(onesix.get()));
		values.append(new InstanceSettingsPage(onesix));
		values.append(new OtherLogsPage("logs", tr("Other Logs"), "Other-Logs", inst));
		return values;
	}

	virtual QString dialogTitle() override
	{
		return tr("Edit Instance (%1)").arg(inst->name());
	}

  protected:
	InstancePtr inst;
};