From 47ed2f48d4a118876263f37b9fe2ab8911c2a8fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sun, 3 Nov 2019 23:48:12 +0100 Subject: NOISSUE put legacy FTB support in a namespace, fix its base URL --- application/pages/modplatform/FTBPage.cpp | 364 -------------------- application/pages/modplatform/FTBPage.h | 114 ------- application/pages/modplatform/FTBPage.ui | 126 ------- application/pages/modplatform/FtbListModel.cpp | 256 -------------- application/pages/modplatform/FtbListModel.h | 74 ----- .../pages/modplatform/legacy_ftb/ListModel.cpp | 260 +++++++++++++++ .../pages/modplatform/legacy_ftb/ListModel.h | 78 +++++ application/pages/modplatform/legacy_ftb/Page.cpp | 368 +++++++++++++++++++++ application/pages/modplatform/legacy_ftb/Page.h | 119 +++++++ application/pages/modplatform/legacy_ftb/Page.ui | 126 +++++++ 10 files changed, 951 insertions(+), 934 deletions(-) delete mode 100644 application/pages/modplatform/FTBPage.cpp delete mode 100644 application/pages/modplatform/FTBPage.h delete mode 100644 application/pages/modplatform/FTBPage.ui delete mode 100644 application/pages/modplatform/FtbListModel.cpp delete mode 100644 application/pages/modplatform/FtbListModel.h create mode 100644 application/pages/modplatform/legacy_ftb/ListModel.cpp create mode 100644 application/pages/modplatform/legacy_ftb/ListModel.h create mode 100644 application/pages/modplatform/legacy_ftb/Page.cpp create mode 100644 application/pages/modplatform/legacy_ftb/Page.h create mode 100644 application/pages/modplatform/legacy_ftb/Page.ui (limited to 'application/pages') diff --git a/application/pages/modplatform/FTBPage.cpp b/application/pages/modplatform/FTBPage.cpp deleted file mode 100644 index dca86efd..00000000 --- a/application/pages/modplatform/FTBPage.cpp +++ /dev/null @@ -1,364 +0,0 @@ -#include "FTBPage.h" -#include "ui_FTBPage.h" - -#include - -#include "MultiMC.h" -#include "dialogs/CustomMessageBox.h" -#include "dialogs/NewInstanceDialog.h" -#include "modplatform/ftb/FtbPackFetchTask.h" -#include "modplatform/ftb/FtbPackInstallTask.h" -#include "modplatform/ftb/FtbPrivatePackManager.h" -#include "FtbListModel.h" - -FTBPage::FTBPage(NewInstanceDialog* dialog, QWidget *parent) - : QWidget(parent), dialog(dialog), ui(new Ui::FTBPage) -{ - ftbFetchTask.reset(new FtbPackFetchTask()); - ftbPrivatePacks.reset(new FtbPrivatePackManager()); - - ui->setupUi(this); - - { - publicFilterModel = new FtbFilterModel(this); - publicListModel = new FtbListModel(this); - publicFilterModel->setSourceModel(publicListModel); - - ui->publicPackList->setModel(publicFilterModel); - ui->publicPackList->setSortingEnabled(true); - ui->publicPackList->header()->hide(); - ui->publicPackList->setIndentation(0); - ui->publicPackList->setIconSize(QSize(42, 42)); - - for(int i = 0; i < publicFilterModel->getAvailableSortings().size(); i++) - { - ui->sortByBox->addItem(publicFilterModel->getAvailableSortings().keys().at(i)); - } - - ui->sortByBox->setCurrentText(publicFilterModel->translateCurrentSorting()); - } - - { - thirdPartyFilterModel = new FtbFilterModel(this); - thirdPartyModel = new FtbListModel(this); - thirdPartyFilterModel->setSourceModel(thirdPartyModel); - - ui->thirdPartyPackList->setModel(thirdPartyFilterModel); - ui->thirdPartyPackList->setSortingEnabled(true); - ui->thirdPartyPackList->header()->hide(); - ui->thirdPartyPackList->setIndentation(0); - ui->thirdPartyPackList->setIconSize(QSize(42, 42)); - - thirdPartyFilterModel->setSorting(publicFilterModel->getCurrentSorting()); - } - - { - privateFilterModel = new FtbFilterModel(this); - privateListModel = new FtbListModel(this); - privateFilterModel->setSourceModel(privateListModel); - - ui->privatePackList->setModel(privateFilterModel); - ui->privatePackList->setSortingEnabled(true); - ui->privatePackList->header()->hide(); - ui->privatePackList->setIndentation(0); - ui->privatePackList->setIconSize(QSize(42, 42)); - - privateFilterModel->setSorting(publicFilterModel->getCurrentSorting()); - } - - ui->versionSelectionBox->view()->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); - ui->versionSelectionBox->view()->parentWidget()->setMaximumHeight(300); - - connect(ui->sortByBox, &QComboBox::currentTextChanged, this, &FTBPage::onSortingSelectionChanged); - connect(ui->versionSelectionBox, &QComboBox::currentTextChanged, this, &FTBPage::onVersionSelectionItemChanged); - - connect(ui->publicPackList->selectionModel(), &QItemSelectionModel::currentChanged, this, &FTBPage::onPublicPackSelectionChanged); - connect(ui->thirdPartyPackList->selectionModel(), &QItemSelectionModel::currentChanged, this, &FTBPage::onThirdPartyPackSelectionChanged); - connect(ui->privatePackList->selectionModel(), &QItemSelectionModel::currentChanged, this, &FTBPage::onPrivatePackSelectionChanged); - - connect(ui->addPackBtn, &QPushButton::pressed, this, &FTBPage::onAddPackClicked); - connect(ui->removePackBtn, &QPushButton::pressed, this, &FTBPage::onRemovePackClicked); - - connect(ui->tabWidget, &QTabWidget::currentChanged, this, &FTBPage::onTabChanged); - - // ui->modpackInfo->setOpenExternalLinks(true); - - ui->publicPackList->selectionModel()->reset(); - ui->thirdPartyPackList->selectionModel()->reset(); - ui->privatePackList->selectionModel()->reset(); - - onTabChanged(ui->tabWidget->currentIndex()); -} - -FTBPage::~FTBPage() -{ - delete ui; -} - -bool FTBPage::shouldDisplay() const -{ - return true; -} - -void FTBPage::openedImpl() -{ - if(!initialized) - { - connect(ftbFetchTask.get(), &FtbPackFetchTask::finished, this, &FTBPage::ftbPackDataDownloadSuccessfully); - connect(ftbFetchTask.get(), &FtbPackFetchTask::failed, this, &FTBPage::ftbPackDataDownloadFailed); - - connect(ftbFetchTask.get(), &FtbPackFetchTask::privateFileDownloadFinished, this, &FTBPage::ftbPrivatePackDataDownloadSuccessfully); - connect(ftbFetchTask.get(), &FtbPackFetchTask::privateFileDownloadFailed, this, &FTBPage::ftbPrivatePackDataDownloadFailed); - - ftbFetchTask->fetch(); - ftbPrivatePacks->load(); - ftbFetchTask->fetchPrivate(ftbPrivatePacks->getCurrentPackCodes().toList()); - initialized = true; - } - suggestCurrent(); -} - -void FTBPage::suggestCurrent() -{ - if(isOpened) - { - if(!selected.broken) - { - dialog->setSuggestedPack(selected.name, new FtbPackInstallTask(selected, selectedVersion)); - QString editedLogoName; - if(selected.logo.toLower().startsWith("ftb")) - { - editedLogoName = selected.logo; - } - else - { - editedLogoName = "ftb_" + selected.logo; - } - - editedLogoName = editedLogoName.left(editedLogoName.lastIndexOf(".png")); - - if(selected.type == FtbPackType::Public) - { - publicListModel->getLogo(selected.logo, [this, editedLogoName](QString logo) - { - dialog->setSuggestedIconFromFile(logo, editedLogoName); - }); - } - else if (selected.type == FtbPackType::ThirdParty) - { - thirdPartyModel->getLogo(selected.logo, [this, editedLogoName](QString logo) - { - dialog->setSuggestedIconFromFile(logo, editedLogoName); - }); - } - else if (selected.type == FtbPackType::Private) - { - privateListModel->getLogo(selected.logo, [this, editedLogoName](QString logo) - { - dialog->setSuggestedIconFromFile(logo, editedLogoName); - }); - } - } - else - { - dialog->setSuggestedPack(); - } - } -} - -void FTBPage::ftbPackDataDownloadSuccessfully(FtbModpackList publicPacks, FtbModpackList thirdPartyPacks) -{ - publicListModel->fill(publicPacks); - thirdPartyModel->fill(thirdPartyPacks); -} - -void FTBPage::ftbPackDataDownloadFailed(QString reason) -{ - //TODO: Display the error -} - -void FTBPage::ftbPrivatePackDataDownloadSuccessfully(FtbModpack pack) -{ - privateListModel->addPack(pack); -} - -void FTBPage::ftbPrivatePackDataDownloadFailed(QString reason, QString packCode) -{ - auto reply = QMessageBox::question( - this, - tr("FTB private packs"), - tr("Failed to download pack information for code %1.\nShould it be removed now?").arg(packCode) - ); - if(reply == QMessageBox::Yes) - { - ftbPrivatePacks->remove(packCode); - } -} - -void FTBPage::onPublicPackSelectionChanged(QModelIndex now, QModelIndex prev) -{ - if(!now.isValid()) - { - onPackSelectionChanged(); - return; - } - FtbModpack selectedPack = publicFilterModel->data(now, Qt::UserRole).value(); - onPackSelectionChanged(&selectedPack); -} - -void FTBPage::onThirdPartyPackSelectionChanged(QModelIndex now, QModelIndex prev) -{ - if(!now.isValid()) - { - onPackSelectionChanged(); - return; - } - FtbModpack selectedPack = thirdPartyFilterModel->data(now, Qt::UserRole).value(); - onPackSelectionChanged(&selectedPack); -} - -void FTBPage::onPrivatePackSelectionChanged(QModelIndex now, QModelIndex prev) -{ - if(!now.isValid()) - { - onPackSelectionChanged(); - return; - } - FtbModpack selectedPack = privateFilterModel->data(now, Qt::UserRole).value(); - onPackSelectionChanged(&selectedPack); -} - -void FTBPage::onPackSelectionChanged(FtbModpack* pack) -{ - ui->versionSelectionBox->clear(); - if(pack) - { - currentModpackInfo->setHtml("Pack by " + pack->author + "" + - "
Minecraft " + pack->mcVersion + "
" + "
" + pack->description + "
  • " + pack->mods.replace(";", "
  • ") - + "
"); - bool currentAdded = false; - - for(int i = 0; i < pack->oldVersions.size(); i++) - { - if(pack->currentVersion == pack->oldVersions.at(i)) - { - currentAdded = true; - } - ui->versionSelectionBox->addItem(pack->oldVersions.at(i)); - } - - if(!currentAdded) - { - ui->versionSelectionBox->addItem(pack->currentVersion); - } - selected = *pack; - } - else - { - currentModpackInfo->setHtml(""); - ui->versionSelectionBox->clear(); - if(isOpened) - { - dialog->setSuggestedPack(); - } - return; - } - suggestCurrent(); -} - -void FTBPage::onVersionSelectionItemChanged(QString data) -{ - if(data.isNull() || data.isEmpty()) - { - selectedVersion = ""; - return; - } - - selectedVersion = data; - suggestCurrent(); -} - -void FTBPage::onSortingSelectionChanged(QString data) -{ - FtbFilterModel::Sorting toSet = publicFilterModel->getAvailableSortings().value(data); - publicFilterModel->setSorting(toSet); - thirdPartyFilterModel->setSorting(toSet); - privateFilterModel->setSorting(toSet); -} - -void FTBPage::onTabChanged(int tab) -{ - if(tab == 1) - { - currentModel = thirdPartyFilterModel; - currentList = ui->thirdPartyPackList; - currentModpackInfo = ui->thirdPartyPackDescription; - } - else if(tab == 2) - { - currentModel = privateFilterModel; - currentList = ui->privatePackList; - currentModpackInfo = ui->privatePackDescription; - } - else - { - currentModel = publicFilterModel; - currentList = ui->publicPackList; - currentModpackInfo = ui->publicPackDescription; - } - - currentList->selectionModel()->reset(); - QModelIndex idx = currentList->currentIndex(); - if(idx.isValid()) - { - auto pack = currentModel->data(idx, Qt::UserRole).value(); - onPackSelectionChanged(&pack); - } - else - { - onPackSelectionChanged(); - } -} - -void FTBPage::onAddPackClicked() -{ - bool ok; - QString text = QInputDialog::getText( - this, - tr("Add FTB pack"), - tr("Enter pack code:"), - QLineEdit::Normal, - QString(), - &ok - ); - if(ok && !text.isEmpty()) - { - ftbPrivatePacks->add(text); - ftbFetchTask->fetchPrivate({text}); - } -} - -void FTBPage::onRemovePackClicked() -{ - auto index = ui->privatePackList->currentIndex(); - if(!index.isValid()) - { - return; - } - auto row = index.row(); - FtbModpack pack = privateListModel->at(row); - auto answer = QMessageBox::question( - this, - tr("Remove pack"), - tr("Are you sure you want to remove pack %1?").arg(pack.name), - QMessageBox::Yes | QMessageBox::No - ); - if(answer != QMessageBox::Yes) - { - return; - } - - ftbPrivatePacks->remove(pack.packCode); - privateListModel->remove(row); - onPackSelectionChanged(); -} diff --git a/application/pages/modplatform/FTBPage.h b/application/pages/modplatform/FTBPage.h deleted file mode 100644 index 215252ee..00000000 --- a/application/pages/modplatform/FTBPage.h +++ /dev/null @@ -1,114 +0,0 @@ -/* Copyright 2013-2019 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. - */ - -#pragma once - -#include -#include -#include - -#include "pages/BasePage.h" -#include -#include "tasks/Task.h" -#include "modplatform/ftb/PackHelpers.h" -#include "modplatform/ftb/FtbPackFetchTask.h" -#include "QObjectPtr.h" - -namespace Ui -{ -class FTBPage; -} - -class FtbListModel; -class FtbFilterModel; -class NewInstanceDialog; -class FtbPrivatePackListModel; -class FtbPrivatePackFilterModel; -class FtbPrivatePackManager; - -class FTBPage : public QWidget, public BasePage -{ - Q_OBJECT - -public: - explicit FTBPage(NewInstanceDialog * dialog, QWidget *parent = 0); - virtual ~FTBPage(); - QString displayName() const override - { - return tr("FTB Legacy"); - } - QIcon icon() const override - { - return MMC->getThemedIcon("ftb_logo"); - } - QString id() const override - { - return "ftb"; - } - QString helpPage() const override - { - return "FTB-platform"; - } - bool shouldDisplay() const override; - void openedImpl() override; - -private: - void suggestCurrent(); - void onPackSelectionChanged(FtbModpack *pack = nullptr); - -private slots: - void ftbPackDataDownloadSuccessfully(FtbModpackList publicPacks, FtbModpackList thirdPartyPacks); - void ftbPackDataDownloadFailed(QString reason); - - void ftbPrivatePackDataDownloadSuccessfully(FtbModpack pack); - void ftbPrivatePackDataDownloadFailed(QString reason, QString packCode); - - void onSortingSelectionChanged(QString data); - void onVersionSelectionItemChanged(QString data); - - void onPublicPackSelectionChanged(QModelIndex first, QModelIndex second); - void onThirdPartyPackSelectionChanged(QModelIndex first, QModelIndex second); - void onPrivatePackSelectionChanged(QModelIndex first, QModelIndex second); - - void onTabChanged(int tab); - - void onAddPackClicked(); - void onRemovePackClicked(); - -private: - FtbFilterModel* currentModel = nullptr; - QTreeView* currentList = nullptr; - QTextBrowser* currentModpackInfo = nullptr; - - bool initialized = false; - FtbModpack selected; - QString selectedVersion; - - FtbListModel* publicListModel = nullptr; - FtbFilterModel* publicFilterModel = nullptr; - - FtbListModel *thirdPartyModel = nullptr; - FtbFilterModel *thirdPartyFilterModel = nullptr; - - FtbListModel *privateListModel = nullptr; - FtbFilterModel *privateFilterModel = nullptr; - - unique_qobject_ptr ftbFetchTask; - std::unique_ptr ftbPrivatePacks; - - NewInstanceDialog* dialog = nullptr; - - Ui::FTBPage *ui = nullptr; -}; diff --git a/application/pages/modplatform/FTBPage.ui b/application/pages/modplatform/FTBPage.ui deleted file mode 100644 index e5ed78cb..00000000 --- a/application/pages/modplatform/FTBPage.ui +++ /dev/null @@ -1,126 +0,0 @@ - - - FTBPage - - - - 0 - 0 - 709 - 602 - - - - - - - 0 - - - - Public - - - - - - - 250 - 16777215 - - - - - - - - - - - - 3rd Party - - - - - - - - - - 250 - 16777215 - - - - - - - - - Private - - - - - - - 250 - 16777215 - - - - - - - - Add pack - - - - - - - Remove selected pack - - - - - - - - - - - - - - - - Version selected: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - 265 - 0 - - - - - - - - - - - diff --git a/application/pages/modplatform/FtbListModel.cpp b/application/pages/modplatform/FtbListModel.cpp deleted file mode 100644 index 51aec890..00000000 --- a/application/pages/modplatform/FtbListModel.cpp +++ /dev/null @@ -1,256 +0,0 @@ -#include "FtbListModel.h" -#include "MultiMC.h" - -#include -#include - -#include -#include - -#include -#include - -#include "net/URLConstants.h" - -FtbFilterModel::FtbFilterModel(QObject *parent) : QSortFilterProxyModel(parent) -{ - currentSorting = Sorting::ByGameVersion; - sortings.insert(tr("Sort by name"), Sorting::ByName); - sortings.insert(tr("Sort by game version"), Sorting::ByGameVersion); -} - -bool FtbFilterModel::lessThan(const QModelIndex &left, const QModelIndex &right) const -{ - FtbModpack leftPack = sourceModel()->data(left, Qt::UserRole).value(); - FtbModpack rightPack = sourceModel()->data(right, Qt::UserRole).value(); - - if(currentSorting == Sorting::ByGameVersion) { - Version lv(leftPack.mcVersion); - Version rv(rightPack.mcVersion); - return lv < rv; - - } else if(currentSorting == Sorting::ByName) { - return Strings::naturalCompare(leftPack.name, rightPack.name, Qt::CaseSensitive) >= 0; - } - - //UHM, some inavlid value set?! - qWarning() << "Invalid sorting set!"; - return true; -} - -bool FtbFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const -{ - return true; -} - -const QMap FtbFilterModel::getAvailableSortings() -{ - return sortings; -} - -QString FtbFilterModel::translateCurrentSorting() -{ - return sortings.key(currentSorting); -} - -void FtbFilterModel::setSorting(Sorting s) -{ - currentSorting = s; - invalidate(); -} - -FtbFilterModel::Sorting FtbFilterModel::getCurrentSorting() -{ - return currentSorting; -} - -FtbListModel::FtbListModel(QObject *parent) : QAbstractListModel(parent) -{ -} - -FtbListModel::~FtbListModel() -{ -} - -QString FtbListModel::translatePackType(FtbPackType type) const -{ - switch(type) - { - case FtbPackType::Public: - return tr("Public Modpack"); - case FtbPackType::ThirdParty: - return tr("Third Party Modpack"); - case FtbPackType::Private: - return tr("Private Modpack"); - } - qWarning() << "Unknown FTB modpack type:" << int(type); - return QString(); -} - -int FtbListModel::rowCount(const QModelIndex &parent) const -{ - return modpacks.size(); -} - -int FtbListModel::columnCount(const QModelIndex &parent) const -{ - return 1; -} - -QVariant FtbListModel::data(const QModelIndex &index, int role) const -{ - int pos = index.row(); - if(pos >= modpacks.size() || pos < 0 || !index.isValid()) - { - return QString("INVALID INDEX %1").arg(pos); - } - - FtbModpack pack = modpacks.at(pos); - if(role == Qt::DisplayRole) - { - return pack.name + "\n" + translatePackType(pack.type); - } - else if (role == Qt::ToolTipRole) - { - if(pack.description.length() > 100) - { - //some magic to prevent to long tooltips and replace html linebreaks - QString edit = pack.description.left(97); - edit = edit.left(edit.lastIndexOf("
")).left(edit.lastIndexOf(" ")).append("..."); - return edit; - - } - return pack.description; - } - else if(role == Qt::DecorationRole) - { - if(m_logoMap.contains(pack.logo)) - { - return (m_logoMap.value(pack.logo)); - } - QIcon icon = MMC->getThemedIcon("screenshot-placeholder"); - ((FtbListModel *)this)->requestLogo(pack.logo); - return icon; - } - else if(role == Qt::TextColorRole) - { - if(pack.broken) - { - //FIXME: Hardcoded color - return QColor(255, 0, 50); - } - else if(pack.bugged) - { - //FIXME: Hardcoded color - //bugged pack, currently only indicates bugged xml - return QColor(244, 229, 66); - } - } - else if(role == Qt::UserRole) - { - QVariant v; - v.setValue(pack); - return v; - } - - return QVariant(); -} - -void FtbListModel::fill(FtbModpackList modpacks) -{ - beginResetModel(); - this->modpacks = modpacks; - endResetModel(); -} - -void FtbListModel::addPack(FtbModpack modpack) -{ - beginResetModel(); - this->modpacks.append(modpack); - endResetModel(); -} - -void FtbListModel::clear() -{ - beginResetModel(); - modpacks.clear(); - endResetModel(); -} - -FtbModpack FtbListModel::at(int row) -{ - return modpacks.at(row); -} - -void FtbListModel::remove(int row) -{ - if(row < 0 || row >= modpacks.size()) - { - qWarning() << "Attempt to remove FTB modpacks with invalid row" << row; - return; - } - beginRemoveRows(QModelIndex(), row, row); - modpacks.removeAt(row); - endRemoveRows(); -} - -void FtbListModel::logoLoaded(QString logo, QIcon out) -{ - m_loadingLogos.removeAll(logo); - m_logoMap.insert(logo, out); - emit dataChanged(createIndex(0, 0), createIndex(1, 0)); -} - -void FtbListModel::logoFailed(QString logo) -{ - m_failedLogos.append(logo); - m_loadingLogos.removeAll(logo); -} - -void FtbListModel::requestLogo(QString file) -{ - if(m_loadingLogos.contains(file) || m_failedLogos.contains(file)) - { - return; - } - - MetaEntryPtr entry = ENV.metacache()->resolveEntry("FTBPacks", QString("logos/%1").arg(file.section(".", 0, 0))); - NetJob *job = new NetJob(QString("FTB Icon Download for %1").arg(file)); - job->addNetAction(Net::Download::makeCached(QUrl(QString(URLConstants::FTB_CDN_BASE_URL + "static/%1").arg(file)), entry)); - - auto fullPath = entry->getFullPath(); - QObject::connect(job, &NetJob::finished, this, [this, file, fullPath] - { - emit logoLoaded(file, QIcon(fullPath)); - if(waitingCallbacks.contains(file)) - { - waitingCallbacks.value(file)(fullPath); - } - }); - - QObject::connect(job, &NetJob::failed, this, [this, file] - { - emit logoFailed(file); - }); - - job->start(); - - m_loadingLogos.append(file); -} - -void FtbListModel::getLogo(const QString &logo, LogoCallback callback) -{ - if(m_logoMap.contains(logo)) - { - callback(ENV.metacache()->resolveEntry("FTBPacks", QString("logos/%1").arg(logo.section(".", 0, 0)))->getFullPath()); - } - else - { - requestLogo(logo); - } -} - -Qt::ItemFlags FtbListModel::flags(const QModelIndex &index) const -{ - return QAbstractListModel::flags(index); -} diff --git a/application/pages/modplatform/FtbListModel.h b/application/pages/modplatform/FtbListModel.h deleted file mode 100644 index 34749b24..00000000 --- a/application/pages/modplatform/FtbListModel.h +++ /dev/null @@ -1,74 +0,0 @@ -#pragma once - -#include -#include - -#include -#include -#include -#include -#include - -#include - -typedef QMap FtbLogoMap; -typedef std::function LogoCallback; - -class FtbFilterModel : public QSortFilterProxyModel -{ - Q_OBJECT -public: - FtbFilterModel(QObject* parent = Q_NULLPTR); - enum Sorting { - ByName, - ByGameVersion - }; - const QMap getAvailableSortings(); - QString translateCurrentSorting(); - void setSorting(Sorting sorting); - Sorting getCurrentSorting(); - -protected: - bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override; - bool lessThan(const QModelIndex &left, const QModelIndex &right) const override; - -private: - QMap sortings; - Sorting currentSorting; - -}; - -class FtbListModel : public QAbstractListModel -{ - Q_OBJECT -private: - FtbModpackList modpacks; - QStringList m_failedLogos; - QStringList m_loadingLogos; - FtbLogoMap m_logoMap; - QMap waitingCallbacks; - - void requestLogo(QString file); - QString translatePackType(FtbPackType type) const; - - -private slots: - void logoFailed(QString logo); - void logoLoaded(QString logo, QIcon out); - -public: - FtbListModel(QObject *parent); - ~FtbListModel(); - int rowCount(const QModelIndex &parent) const override; - int columnCount(const QModelIndex &parent) const override; - QVariant data(const QModelIndex &index, int role) const override; - Qt::ItemFlags flags(const QModelIndex &index) const override; - - void fill(FtbModpackList modpacks); - void addPack(FtbModpack modpack); - void clear(); - void remove(int row); - - FtbModpack at(int row); - void getLogo(const QString &logo, LogoCallback callback); -}; diff --git a/application/pages/modplatform/legacy_ftb/ListModel.cpp b/application/pages/modplatform/legacy_ftb/ListModel.cpp new file mode 100644 index 00000000..105db25a --- /dev/null +++ b/application/pages/modplatform/legacy_ftb/ListModel.cpp @@ -0,0 +1,260 @@ +#include "ListModel.h" +#include "MultiMC.h" + +#include +#include + +#include +#include + +#include +#include + +#include "net/URLConstants.h" + +namespace LegacyFTB { + +FilterModel::FilterModel(QObject *parent) : QSortFilterProxyModel(parent) +{ + currentSorting = Sorting::ByGameVersion; + sortings.insert(tr("Sort by name"), Sorting::ByName); + sortings.insert(tr("Sort by game version"), Sorting::ByGameVersion); +} + +bool FilterModel::lessThan(const QModelIndex &left, const QModelIndex &right) const +{ + Modpack leftPack = sourceModel()->data(left, Qt::UserRole).value(); + Modpack rightPack = sourceModel()->data(right, Qt::UserRole).value(); + + if(currentSorting == Sorting::ByGameVersion) { + Version lv(leftPack.mcVersion); + Version rv(rightPack.mcVersion); + return lv < rv; + + } else if(currentSorting == Sorting::ByName) { + return Strings::naturalCompare(leftPack.name, rightPack.name, Qt::CaseSensitive) >= 0; + } + + //UHM, some inavlid value set?! + qWarning() << "Invalid sorting set!"; + return true; +} + +bool FilterModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const +{ + return true; +} + +const QMap FilterModel::getAvailableSortings() +{ + return sortings; +} + +QString FilterModel::translateCurrentSorting() +{ + return sortings.key(currentSorting); +} + +void FilterModel::setSorting(Sorting s) +{ + currentSorting = s; + invalidate(); +} + +FilterModel::Sorting FilterModel::getCurrentSorting() +{ + return currentSorting; +} + +ListModel::ListModel(QObject *parent) : QAbstractListModel(parent) +{ +} + +ListModel::~ListModel() +{ +} + +QString ListModel::translatePackType(PackType type) const +{ + switch(type) + { + case PackType::Public: + return tr("Public Modpack"); + case PackType::ThirdParty: + return tr("Third Party Modpack"); + case PackType::Private: + return tr("Private Modpack"); + } + qWarning() << "Unknown FTB modpack type:" << int(type); + return QString(); +} + +int ListModel::rowCount(const QModelIndex &parent) const +{ + return modpacks.size(); +} + +int ListModel::columnCount(const QModelIndex &parent) const +{ + return 1; +} + +QVariant ListModel::data(const QModelIndex &index, int role) const +{ + int pos = index.row(); + if(pos >= modpacks.size() || pos < 0 || !index.isValid()) + { + return QString("INVALID INDEX %1").arg(pos); + } + + Modpack pack = modpacks.at(pos); + if(role == Qt::DisplayRole) + { + return pack.name + "\n" + translatePackType(pack.type); + } + else if (role == Qt::ToolTipRole) + { + if(pack.description.length() > 100) + { + //some magic to prevent to long tooltips and replace html linebreaks + QString edit = pack.description.left(97); + edit = edit.left(edit.lastIndexOf("
")).left(edit.lastIndexOf(" ")).append("..."); + return edit; + + } + return pack.description; + } + else if(role == Qt::DecorationRole) + { + if(m_logoMap.contains(pack.logo)) + { + return (m_logoMap.value(pack.logo)); + } + QIcon icon = MMC->getThemedIcon("screenshot-placeholder"); + ((ListModel *)this)->requestLogo(pack.logo); + return icon; + } + else if(role == Qt::TextColorRole) + { + if(pack.broken) + { + //FIXME: Hardcoded color + return QColor(255, 0, 50); + } + else if(pack.bugged) + { + //FIXME: Hardcoded color + //bugged pack, currently only indicates bugged xml + return QColor(244, 229, 66); + } + } + else if(role == Qt::UserRole) + { + QVariant v; + v.setValue(pack); + return v; + } + + return QVariant(); +} + +void ListModel::fill(ModpackList modpacks) +{ + beginResetModel(); + this->modpacks = modpacks; + endResetModel(); +} + +void ListModel::addPack(Modpack modpack) +{ + beginResetModel(); + this->modpacks.append(modpack); + endResetModel(); +} + +void ListModel::clear() +{ + beginResetModel(); + modpacks.clear(); + endResetModel(); +} + +Modpack ListModel::at(int row) +{ + return modpacks.at(row); +} + +void ListModel::remove(int row) +{ + if(row < 0 || row >= modpacks.size()) + { + qWarning() << "Attempt to remove FTB modpacks with invalid row" << row; + return; + } + beginRemoveRows(QModelIndex(), row, row); + modpacks.removeAt(row); + endRemoveRows(); +} + +void ListModel::logoLoaded(QString logo, QIcon out) +{ + m_loadingLogos.removeAll(logo); + m_logoMap.insert(logo, out); + emit dataChanged(createIndex(0, 0), createIndex(1, 0)); +} + +void ListModel::logoFailed(QString logo) +{ + m_failedLogos.append(logo); + m_loadingLogos.removeAll(logo); +} + +void ListModel::requestLogo(QString file) +{ + if(m_loadingLogos.contains(file) || m_failedLogos.contains(file)) + { + return; + } + + MetaEntryPtr entry = ENV.metacache()->resolveEntry("FTBPacks", QString("logos/%1").arg(file.section(".", 0, 0))); + NetJob *job = new NetJob(QString("FTB Icon Download for %1").arg(file)); + job->addNetAction(Net::Download::makeCached(QUrl(QString(URLConstants::LEGACY_FTB_CDN_BASE_URL + "static/%1").arg(file)), entry)); + + auto fullPath = entry->getFullPath(); + QObject::connect(job, &NetJob::finished, this, [this, file, fullPath] + { + emit logoLoaded(file, QIcon(fullPath)); + if(waitingCallbacks.contains(file)) + { + waitingCallbacks.value(file)(fullPath); + } + }); + + QObject::connect(job, &NetJob::failed, this, [this, file] + { + emit logoFailed(file); + }); + + job->start(); + + m_loadingLogos.append(file); +} + +void ListModel::getLogo(const QString &logo, LogoCallback callback) +{ + if(m_logoMap.contains(logo)) + { + callback(ENV.metacache()->resolveEntry("FTBPacks", QString("logos/%1").arg(logo.section(".", 0, 0)))->getFullPath()); + } + else + { + requestLogo(logo); + } +} + +Qt::ItemFlags ListModel::flags(const QModelIndex &index) const +{ + return QAbstractListModel::flags(index); +} + +} diff --git a/application/pages/modplatform/legacy_ftb/ListModel.h b/application/pages/modplatform/legacy_ftb/ListModel.h new file mode 100644 index 00000000..c55df000 --- /dev/null +++ b/application/pages/modplatform/legacy_ftb/ListModel.h @@ -0,0 +1,78 @@ +#pragma once + +#include +#include + +#include +#include +#include +#include +#include + +#include + +namespace LegacyFTB { + +typedef QMap FTBLogoMap; +typedef std::function LogoCallback; + +class FilterModel : public QSortFilterProxyModel +{ + Q_OBJECT +public: + FilterModel(QObject* parent = Q_NULLPTR); + enum Sorting { + ByName, + ByGameVersion + }; + const QMap getAvailableSortings(); + QString translateCurrentSorting(); + void setSorting(Sorting sorting); + Sorting getCurrentSorting(); + +protected: + bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override; + bool lessThan(const QModelIndex &left, const QModelIndex &right) const override; + +private: + QMap sortings; + Sorting currentSorting; + +}; + +class ListModel : public QAbstractListModel +{ + Q_OBJECT +private: + ModpackList modpacks; + QStringList m_failedLogos; + QStringList m_loadingLogos; + FTBLogoMap m_logoMap; + QMap waitingCallbacks; + + void requestLogo(QString file); + QString translatePackType(PackType type) const; + + +private slots: + void logoFailed(QString logo); + void logoLoaded(QString logo, QIcon out); + +public: + ListModel(QObject *parent); + ~ListModel(); + int rowCount(const QModelIndex &parent) const override; + int columnCount(const QModelIndex &parent) const override; + QVariant data(const QModelIndex &index, int role) const override; + Qt::ItemFlags flags(const QModelIndex &index) const override; + + void fill(ModpackList modpacks); + void addPack(Modpack modpack); + void clear(); + void remove(int row); + + Modpack at(int row); + void getLogo(const QString &logo, LogoCallback callback); +}; + +} diff --git a/application/pages/modplatform/legacy_ftb/Page.cpp b/application/pages/modplatform/legacy_ftb/Page.cpp new file mode 100644 index 00000000..8e40ba9e --- /dev/null +++ b/application/pages/modplatform/legacy_ftb/Page.cpp @@ -0,0 +1,368 @@ +#include "Page.h" +#include "ui_Page.h" + +#include + +#include "MultiMC.h" +#include "dialogs/CustomMessageBox.h" +#include "dialogs/NewInstanceDialog.h" +#include "modplatform/legacy_ftb/PackFetchTask.h" +#include "modplatform/legacy_ftb/PackInstallTask.h" +#include "modplatform/legacy_ftb/PrivatePackManager.h" +#include "ListModel.h" + +namespace LegacyFTB { + +Page::Page(NewInstanceDialog* dialog, QWidget *parent) + : QWidget(parent), dialog(dialog), ui(new Ui::Page) +{ + ftbFetchTask.reset(new PackFetchTask()); + ftbPrivatePacks.reset(new PrivatePackManager()); + + ui->setupUi(this); + + { + publicFilterModel = new FilterModel(this); + publicListModel = new ListModel(this); + publicFilterModel->setSourceModel(publicListModel); + + ui->publicPackList->setModel(publicFilterModel); + ui->publicPackList->setSortingEnabled(true); + ui->publicPackList->header()->hide(); + ui->publicPackList->setIndentation(0); + ui->publicPackList->setIconSize(QSize(42, 42)); + + for(int i = 0; i < publicFilterModel->getAvailableSortings().size(); i++) + { + ui->sortByBox->addItem(publicFilterModel->getAvailableSortings().keys().at(i)); + } + + ui->sortByBox->setCurrentText(publicFilterModel->translateCurrentSorting()); + } + + { + thirdPartyFilterModel = new FilterModel(this); + thirdPartyModel = new ListModel(this); + thirdPartyFilterModel->setSourceModel(thirdPartyModel); + + ui->thirdPartyPackList->setModel(thirdPartyFilterModel); + ui->thirdPartyPackList->setSortingEnabled(true); + ui->thirdPartyPackList->header()->hide(); + ui->thirdPartyPackList->setIndentation(0); + ui->thirdPartyPackList->setIconSize(QSize(42, 42)); + + thirdPartyFilterModel->setSorting(publicFilterModel->getCurrentSorting()); + } + + { + privateFilterModel = new FilterModel(this); + privateListModel = new ListModel(this); + privateFilterModel->setSourceModel(privateListModel); + + ui->privatePackList->setModel(privateFilterModel); + ui->privatePackList->setSortingEnabled(true); + ui->privatePackList->header()->hide(); + ui->privatePackList->setIndentation(0); + ui->privatePackList->setIconSize(QSize(42, 42)); + + privateFilterModel->setSorting(publicFilterModel->getCurrentSorting()); + } + + ui->versionSelectionBox->view()->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); + ui->versionSelectionBox->view()->parentWidget()->setMaximumHeight(300); + + connect(ui->sortByBox, &QComboBox::currentTextChanged, this, &Page::onSortingSelectionChanged); + connect(ui->versionSelectionBox, &QComboBox::currentTextChanged, this, &Page::onVersionSelectionItemChanged); + + connect(ui->publicPackList->selectionModel(), &QItemSelectionModel::currentChanged, this, &Page::onPublicPackSelectionChanged); + connect(ui->thirdPartyPackList->selectionModel(), &QItemSelectionModel::currentChanged, this, &Page::onThirdPartyPackSelectionChanged); + connect(ui->privatePackList->selectionModel(), &QItemSelectionModel::currentChanged, this, &Page::onPrivatePackSelectionChanged); + + connect(ui->addPackBtn, &QPushButton::pressed, this, &Page::onAddPackClicked); + connect(ui->removePackBtn, &QPushButton::pressed, this, &Page::onRemovePackClicked); + + connect(ui->tabWidget, &QTabWidget::currentChanged, this, &Page::onTabChanged); + + // ui->modpackInfo->setOpenExternalLinks(true); + + ui->publicPackList->selectionModel()->reset(); + ui->thirdPartyPackList->selectionModel()->reset(); + ui->privatePackList->selectionModel()->reset(); + + onTabChanged(ui->tabWidget->currentIndex()); +} + +Page::~Page() +{ + delete ui; +} + +bool Page::shouldDisplay() const +{ + return true; +} + +void Page::openedImpl() +{ + if(!initialized) + { + connect(ftbFetchTask.get(), &PackFetchTask::finished, this, &Page::ftbPackDataDownloadSuccessfully); + connect(ftbFetchTask.get(), &PackFetchTask::failed, this, &Page::ftbPackDataDownloadFailed); + + connect(ftbFetchTask.get(), &PackFetchTask::privateFileDownloadFinished, this, &Page::ftbPrivatePackDataDownloadSuccessfully); + connect(ftbFetchTask.get(), &PackFetchTask::privateFileDownloadFailed, this, &Page::ftbPrivatePackDataDownloadFailed); + + ftbFetchTask->fetch(); + ftbPrivatePacks->load(); + ftbFetchTask->fetchPrivate(ftbPrivatePacks->getCurrentPackCodes().toList()); + initialized = true; + } + suggestCurrent(); +} + +void Page::suggestCurrent() +{ + if(isOpened) + { + if(!selected.broken) + { + dialog->setSuggestedPack(selected.name, new PackInstallTask(selected, selectedVersion)); + QString editedLogoName; + if(selected.logo.toLower().startsWith("ftb")) + { + editedLogoName = selected.logo; + } + else + { + editedLogoName = "ftb_" + selected.logo; + } + + editedLogoName = editedLogoName.left(editedLogoName.lastIndexOf(".png")); + + if(selected.type == PackType::Public) + { + publicListModel->getLogo(selected.logo, [this, editedLogoName](QString logo) + { + dialog->setSuggestedIconFromFile(logo, editedLogoName); + }); + } + else if (selected.type == PackType::ThirdParty) + { + thirdPartyModel->getLogo(selected.logo, [this, editedLogoName](QString logo) + { + dialog->setSuggestedIconFromFile(logo, editedLogoName); + }); + } + else if (selected.type == PackType::Private) + { + privateListModel->getLogo(selected.logo, [this, editedLogoName](QString logo) + { + dialog->setSuggestedIconFromFile(logo, editedLogoName); + }); + } + } + else + { + dialog->setSuggestedPack(); + } + } +} + +void Page::ftbPackDataDownloadSuccessfully(ModpackList publicPacks, ModpackList thirdPartyPacks) +{ + publicListModel->fill(publicPacks); + thirdPartyModel->fill(thirdPartyPacks); +} + +void Page::ftbPackDataDownloadFailed(QString reason) +{ + //TODO: Display the error +} + +void Page::ftbPrivatePackDataDownloadSuccessfully(Modpack pack) +{ + privateListModel->addPack(pack); +} + +void Page::ftbPrivatePackDataDownloadFailed(QString reason, QString packCode) +{ + auto reply = QMessageBox::question( + this, + tr("FTB private packs"), + tr("Failed to download pack information for code %1.\nShould it be removed now?").arg(packCode) + ); + if(reply == QMessageBox::Yes) + { + ftbPrivatePacks->remove(packCode); + } +} + +void Page::onPublicPackSelectionChanged(QModelIndex now, QModelIndex prev) +{ + if(!now.isValid()) + { + onPackSelectionChanged(); + return; + } + Modpack selectedPack = publicFilterModel->data(now, Qt::UserRole).value(); + onPackSelectionChanged(&selectedPack); +} + +void Page::onThirdPartyPackSelectionChanged(QModelIndex now, QModelIndex prev) +{ + if(!now.isValid()) + { + onPackSelectionChanged(); + return; + } + Modpack selectedPack = thirdPartyFilterModel->data(now, Qt::UserRole).value(); + onPackSelectionChanged(&selectedPack); +} + +void Page::onPrivatePackSelectionChanged(QModelIndex now, QModelIndex prev) +{ + if(!now.isValid()) + { + onPackSelectionChanged(); + return; + } + Modpack selectedPack = privateFilterModel->data(now, Qt::UserRole).value(); + onPackSelectionChanged(&selectedPack); +} + +void Page::onPackSelectionChanged(Modpack* pack) +{ + ui->versionSelectionBox->clear(); + if(pack) + { + currentModpackInfo->setHtml("Pack by " + pack->author + "" + + "
Minecraft " + pack->mcVersion + "
" + "
" + pack->description + "
  • " + pack->mods.replace(";", "
  • ") + + "
"); + bool currentAdded = false; + + for(int i = 0; i < pack->oldVersions.size(); i++) + { + if(pack->currentVersion == pack->oldVersions.at(i)) + { + currentAdded = true; + } + ui->versionSelectionBox->addItem(pack->oldVersions.at(i)); + } + + if(!currentAdded) + { + ui->versionSelectionBox->addItem(pack->currentVersion); + } + selected = *pack; + } + else + { + currentModpackInfo->setHtml(""); + ui->versionSelectionBox->clear(); + if(isOpened) + { + dialog->setSuggestedPack(); + } + return; + } + suggestCurrent(); +} + +void Page::onVersionSelectionItemChanged(QString data) +{ + if(data.isNull() || data.isEmpty()) + { + selectedVersion = ""; + return; + } + + selectedVersion = data; + suggestCurrent(); +} + +void Page::onSortingSelectionChanged(QString data) +{ + FilterModel::Sorting toSet = publicFilterModel->getAvailableSortings().value(data); + publicFilterModel->setSorting(toSet); + thirdPartyFilterModel->setSorting(toSet); + privateFilterModel->setSorting(toSet); +} + +void Page::onTabChanged(int tab) +{ + if(tab == 1) + { + currentModel = thirdPartyFilterModel; + currentList = ui->thirdPartyPackList; + currentModpackInfo = ui->thirdPartyPackDescription; + } + else if(tab == 2) + { + currentModel = privateFilterModel; + currentList = ui->privatePackList; + currentModpackInfo = ui->privatePackDescription; + } + else + { + currentModel = publicFilterModel; + currentList = ui->publicPackList; + currentModpackInfo = ui->publicPackDescription; + } + + currentList->selectionModel()->reset(); + QModelIndex idx = currentList->currentIndex(); + if(idx.isValid()) + { + auto pack = currentModel->data(idx, Qt::UserRole).value(); + onPackSelectionChanged(&pack); + } + else + { + onPackSelectionChanged(); + } +} + +void Page::onAddPackClicked() +{ + bool ok; + QString text = QInputDialog::getText( + this, + tr("Add FTB pack"), + tr("Enter pack code:"), + QLineEdit::Normal, + QString(), + &ok + ); + if(ok && !text.isEmpty()) + { + ftbPrivatePacks->add(text); + ftbFetchTask->fetchPrivate({text}); + } +} + +void Page::onRemovePackClicked() +{ + auto index = ui->privatePackList->currentIndex(); + if(!index.isValid()) + { + return; + } + auto row = index.row(); + Modpack pack = privateListModel->at(row); + auto answer = QMessageBox::question( + this, + tr("Remove pack"), + tr("Are you sure you want to remove pack %1?").arg(pack.name), + QMessageBox::Yes | QMessageBox::No + ); + if(answer != QMessageBox::Yes) + { + return; + } + + ftbPrivatePacks->remove(pack.packCode); + privateListModel->remove(row); + onPackSelectionChanged(); +} + +} diff --git a/application/pages/modplatform/legacy_ftb/Page.h b/application/pages/modplatform/legacy_ftb/Page.h new file mode 100644 index 00000000..ed6d1657 --- /dev/null +++ b/application/pages/modplatform/legacy_ftb/Page.h @@ -0,0 +1,119 @@ +/* Copyright 2013-2019 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. + */ + +#pragma once + +#include +#include +#include + +#include "pages/BasePage.h" +#include +#include "tasks/Task.h" +#include "modplatform/legacy_ftb/PackHelpers.h" +#include "modplatform/legacy_ftb/PackFetchTask.h" +#include "QObjectPtr.h" + +class NewInstanceDialog; + +namespace LegacyFTB { + +namespace Ui +{ +class Page; +} + +class ListModel; +class FilterModel; +class PrivatePackListModel; +class PrivatePackFilterModel; +class PrivatePackManager; + +class Page : public QWidget, public BasePage +{ + Q_OBJECT + +public: + explicit Page(NewInstanceDialog * dialog, QWidget *parent = 0); + virtual ~Page(); + QString displayName() const override + { + return tr("FTB Legacy"); + } + QIcon icon() const override + { + return MMC->getThemedIcon("ftb_logo"); + } + QString id() const override + { + return "legacy_ftb"; + } + QString helpPage() const override + { + return "FTB-platform"; + } + bool shouldDisplay() const override; + void openedImpl() override; + +private: + void suggestCurrent(); + void onPackSelectionChanged(Modpack *pack = nullptr); + +private slots: + void ftbPackDataDownloadSuccessfully(ModpackList publicPacks, ModpackList thirdPartyPacks); + void ftbPackDataDownloadFailed(QString reason); + + void ftbPrivatePackDataDownloadSuccessfully(Modpack pack); + void ftbPrivatePackDataDownloadFailed(QString reason, QString packCode); + + void onSortingSelectionChanged(QString data); + void onVersionSelectionItemChanged(QString data); + + void onPublicPackSelectionChanged(QModelIndex first, QModelIndex second); + void onThirdPartyPackSelectionChanged(QModelIndex first, QModelIndex second); + void onPrivatePackSelectionChanged(QModelIndex first, QModelIndex second); + + void onTabChanged(int tab); + + void onAddPackClicked(); + void onRemovePackClicked(); + +private: + FilterModel* currentModel = nullptr; + QTreeView* currentList = nullptr; + QTextBrowser* currentModpackInfo = nullptr; + + bool initialized = false; + Modpack selected; + QString selectedVersion; + + ListModel* publicListModel = nullptr; + FilterModel* publicFilterModel = nullptr; + + ListModel *thirdPartyModel = nullptr; + FilterModel *thirdPartyFilterModel = nullptr; + + ListModel *privateListModel = nullptr; + FilterModel *privateFilterModel = nullptr; + + unique_qobject_ptr ftbFetchTask; + std::unique_ptr ftbPrivatePacks; + + NewInstanceDialog* dialog = nullptr; + + Ui::Page *ui = nullptr; +}; + +} diff --git a/application/pages/modplatform/legacy_ftb/Page.ui b/application/pages/modplatform/legacy_ftb/Page.ui new file mode 100644 index 00000000..36fb2359 --- /dev/null +++ b/application/pages/modplatform/legacy_ftb/Page.ui @@ -0,0 +1,126 @@ + + + LegacyFTB::Page + + + + 0 + 0 + 709 + 602 + + + + + + + 0 + + + + Public + + + + + + + 250 + 16777215 + + + + + + + + + + + + 3rd Party + + + + + + + + + + 250 + 16777215 + + + + + + + + + Private + + + + + + + 250 + 16777215 + + + + + + + + Add pack + + + + + + + Remove selected pack + + + + + + + + + + + + + + + + Version selected: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + 265 + 0 + + + + + + + + + + + -- cgit v1.2.3