2022-03-20 19:01:08 +00:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
/*
|
2023-08-04 18:41:47 +01:00
|
|
|
* Prism Launcher - Minecraft Launcher
|
2022-03-20 19:01:08 +00:00
|
|
|
* Copyright (c) 2022 Jamie Mansfield <jmansfield@cadixdev.org>
|
2018-03-19 01:36:12 +00:00
|
|
|
*
|
2022-03-20 19:01:08 +00:00
|
|
|
* 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.
|
2018-03-19 01:36:12 +00:00
|
|
|
*
|
2022-03-20 19:01:08 +00:00
|
|
|
* 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.
|
2018-03-19 01:36:12 +00:00
|
|
|
*
|
2022-03-20 19:01:08 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following copyright and
|
|
|
|
* permission notice:
|
|
|
|
*
|
|
|
|
* Copyright 2013-2021 MultiMC Contributors
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
2018-03-19 01:36:12 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2018-08-01 23:52:31 +01:00
|
|
|
#include <QTextBrowser>
|
2023-08-14 17:16:53 +01:00
|
|
|
#include <QTreeView>
|
|
|
|
#include <QWidget>
|
2018-03-19 01:36:12 +00:00
|
|
|
|
2021-11-20 15:22:22 +00:00
|
|
|
#include <Application.h>
|
2018-08-01 23:52:31 +01:00
|
|
|
#include "QObjectPtr.h"
|
2023-08-14 17:16:53 +01:00
|
|
|
#include "modplatform/legacy_ftb/PackFetchTask.h"
|
|
|
|
#include "modplatform/legacy_ftb/PackHelpers.h"
|
|
|
|
#include "tasks/Task.h"
|
|
|
|
#include "ui/pages/BasePage.h"
|
2018-03-19 01:36:12 +00:00
|
|
|
|
2019-11-03 22:48:12 +00:00
|
|
|
class NewInstanceDialog;
|
|
|
|
|
|
|
|
namespace LegacyFTB {
|
|
|
|
|
2023-08-14 17:16:53 +01:00
|
|
|
namespace Ui {
|
2019-11-03 22:48:12 +00:00
|
|
|
class Page;
|
2018-03-19 01:36:12 +00:00
|
|
|
}
|
|
|
|
|
2019-11-03 22:48:12 +00:00
|
|
|
class ListModel;
|
|
|
|
class FilterModel;
|
|
|
|
class PrivatePackListModel;
|
|
|
|
class PrivatePackFilterModel;
|
|
|
|
class PrivatePackManager;
|
2018-03-19 01:36:12 +00:00
|
|
|
|
2023-08-14 17:16:53 +01:00
|
|
|
class Page : public QWidget, public BasePage {
|
2018-03-19 01:36:12 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
2023-08-14 17:16:53 +01:00
|
|
|
public:
|
|
|
|
explicit Page(NewInstanceDialog* dialog, QWidget* parent = 0);
|
2019-11-03 22:48:12 +00:00
|
|
|
virtual ~Page();
|
2023-08-14 17:16:53 +01:00
|
|
|
QString displayName() const override { return "FTB Legacy"; }
|
|
|
|
QIcon icon() const override { return APPLICATION->getThemedIcon("ftb_logo"); }
|
|
|
|
QString id() const override { return "legacy_ftb"; }
|
|
|
|
QString helpPage() const override { return "FTB-platform"; }
|
2018-03-19 01:36:12 +00:00
|
|
|
bool shouldDisplay() const override;
|
|
|
|
void openedImpl() override;
|
2022-02-22 18:23:53 +00:00
|
|
|
void retranslate() override;
|
2018-03-19 01:36:12 +00:00
|
|
|
|
2023-08-14 17:16:53 +01:00
|
|
|
private:
|
2018-03-19 01:36:12 +00:00
|
|
|
void suggestCurrent();
|
2023-08-14 17:16:53 +01:00
|
|
|
void onPackSelectionChanged(Modpack* pack = nullptr);
|
2018-03-19 01:36:12 +00:00
|
|
|
|
2023-08-14 17:16:53 +01:00
|
|
|
private slots:
|
2019-11-03 22:48:12 +00:00
|
|
|
void ftbPackDataDownloadSuccessfully(ModpackList publicPacks, ModpackList thirdPartyPacks);
|
2018-04-01 19:24:28 +01:00
|
|
|
void ftbPackDataDownloadFailed(QString reason);
|
2022-07-28 19:58:04 +01:00
|
|
|
void ftbPackDataDownloadAborted();
|
2018-04-01 19:24:28 +01:00
|
|
|
|
2019-11-03 22:48:12 +00:00
|
|
|
void ftbPrivatePackDataDownloadSuccessfully(Modpack pack);
|
2018-08-01 23:52:31 +01:00
|
|
|
void ftbPrivatePackDataDownloadFailed(QString reason, QString packCode);
|
|
|
|
|
2018-03-19 01:36:12 +00:00
|
|
|
void onSortingSelectionChanged(QString data);
|
|
|
|
void onVersionSelectionItemChanged(QString data);
|
2018-04-01 19:24:28 +01:00
|
|
|
|
|
|
|
void onPublicPackSelectionChanged(QModelIndex first, QModelIndex second);
|
|
|
|
void onThirdPartyPackSelectionChanged(QModelIndex first, QModelIndex second);
|
2018-08-01 23:52:31 +01:00
|
|
|
void onPrivatePackSelectionChanged(QModelIndex first, QModelIndex second);
|
2018-03-19 01:36:12 +00:00
|
|
|
|
2018-04-05 18:33:31 +01:00
|
|
|
void onTabChanged(int tab);
|
|
|
|
|
2018-08-01 23:52:31 +01:00
|
|
|
void onAddPackClicked();
|
|
|
|
void onRemovePackClicked();
|
|
|
|
|
2023-08-14 17:16:53 +01:00
|
|
|
private:
|
2019-11-03 22:48:12 +00:00
|
|
|
FilterModel* currentModel = nullptr;
|
2018-08-01 23:52:31 +01:00
|
|
|
QTreeView* currentList = nullptr;
|
|
|
|
QTextBrowser* currentModpackInfo = nullptr;
|
|
|
|
|
2018-03-19 01:36:12 +00:00
|
|
|
bool initialized = false;
|
2019-11-03 22:48:12 +00:00
|
|
|
Modpack selected;
|
2018-03-19 01:36:12 +00:00
|
|
|
QString selectedVersion;
|
2018-04-01 19:24:28 +01:00
|
|
|
|
2019-11-03 22:48:12 +00:00
|
|
|
ListModel* publicListModel = nullptr;
|
|
|
|
FilterModel* publicFilterModel = nullptr;
|
2018-04-01 19:24:28 +01:00
|
|
|
|
2023-08-14 17:16:53 +01:00
|
|
|
ListModel* thirdPartyModel = nullptr;
|
|
|
|
FilterModel* thirdPartyFilterModel = nullptr;
|
2018-04-01 19:24:28 +01:00
|
|
|
|
2023-08-14 17:16:53 +01:00
|
|
|
ListModel* privateListModel = nullptr;
|
|
|
|
FilterModel* privateFilterModel = nullptr;
|
2018-08-01 23:52:31 +01:00
|
|
|
|
2019-11-03 22:48:12 +00:00
|
|
|
unique_qobject_ptr<PackFetchTask> ftbFetchTask;
|
|
|
|
std::unique_ptr<PrivatePackManager> ftbPrivatePacks;
|
2018-08-01 23:52:31 +01:00
|
|
|
|
2018-03-19 01:36:12 +00:00
|
|
|
NewInstanceDialog* dialog = nullptr;
|
|
|
|
|
2023-08-14 17:16:53 +01:00
|
|
|
Ui::Page* ui = nullptr;
|
2018-03-19 01:36:12 +00:00
|
|
|
};
|
2019-11-03 22:48:12 +00:00
|
|
|
|
2023-08-14 17:16:53 +01:00
|
|
|
} // namespace LegacyFTB
|