summaryrefslogtreecommitdiffstats
path: root/application/pages
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2018-03-19 02:36:12 +0100
committerPetr Mrázek <peterix@gmail.com>2018-03-27 09:25:36 +0200
commit8e44ab2338f4ca63d58de4b3329c384df9d6c053 (patch)
tree60b915ec620221656d1c3a42f40124b15e9e69f0 /application/pages
parent4c7ea0f99a23f73fd3cae87f7dfaab89922a2311 (diff)
downloadMultiMC-8e44ab2338f4ca63d58de4b3329c384df9d6c053.tar
MultiMC-8e44ab2338f4ca63d58de4b3329c384df9d6c053.tar.gz
MultiMC-8e44ab2338f4ca63d58de4b3329c384df9d6c053.tar.lz
MultiMC-8e44ab2338f4ca63d58de4b3329c384df9d6c053.tar.xz
MultiMC-8e44ab2338f4ca63d58de4b3329c384df9d6c053.zip
NOISSUE redo new instance dialog
Diffstat (limited to 'application/pages')
-rw-r--r--application/pages/BasePage.h15
-rw-r--r--application/pages/BasePageProvider.h4
-rw-r--r--application/pages/global/PackagesPage.cpp2
-rw-r--r--application/pages/global/PackagesPage.h2
-rw-r--r--application/pages/instance/InstanceSettingsPage.cpp (renamed from application/pages/InstanceSettingsPage.cpp)0
-rw-r--r--application/pages/instance/InstanceSettingsPage.h (renamed from application/pages/InstanceSettingsPage.h)2
-rw-r--r--application/pages/instance/InstanceSettingsPage.ui (renamed from application/pages/InstanceSettingsPage.ui)0
-rw-r--r--application/pages/instance/LegacyUpgradePage.cpp (renamed from application/pages/LegacyUpgradePage.cpp)7
-rw-r--r--application/pages/instance/LegacyUpgradePage.h (renamed from application/pages/LegacyUpgradePage.h)0
-rw-r--r--application/pages/instance/LegacyUpgradePage.ui (renamed from application/pages/LegacyUpgradePage.ui)0
-rw-r--r--application/pages/instance/LogPage.cpp (renamed from application/pages/LogPage.cpp)0
-rw-r--r--application/pages/instance/LogPage.h (renamed from application/pages/LogPage.h)2
-rw-r--r--application/pages/instance/LogPage.ui (renamed from application/pages/LogPage.ui)0
-rw-r--r--application/pages/instance/ModFolderPage.cpp (renamed from application/pages/ModFolderPage.cpp)4
-rw-r--r--application/pages/instance/ModFolderPage.h (renamed from application/pages/ModFolderPage.h)6
-rw-r--r--application/pages/instance/ModFolderPage.ui (renamed from application/pages/ModFolderPage.ui)0
-rw-r--r--application/pages/instance/NotesPage.cpp (renamed from application/pages/NotesPage.cpp)0
-rw-r--r--application/pages/instance/NotesPage.h (renamed from application/pages/NotesPage.h)2
-rw-r--r--application/pages/instance/NotesPage.ui (renamed from application/pages/NotesPage.ui)0
-rw-r--r--application/pages/instance/OtherLogsPage.cpp (renamed from application/pages/OtherLogsPage.cpp)4
-rw-r--r--application/pages/instance/OtherLogsPage.h (renamed from application/pages/OtherLogsPage.h)6
-rw-r--r--application/pages/instance/OtherLogsPage.ui (renamed from application/pages/OtherLogsPage.ui)0
-rw-r--r--application/pages/instance/ResourcePackPage.h (renamed from application/pages/ResourcePackPage.h)0
-rw-r--r--application/pages/instance/ScreenshotsPage.cpp (renamed from application/pages/ScreenshotsPage.cpp)2
-rw-r--r--application/pages/instance/ScreenshotsPage.h (renamed from application/pages/ScreenshotsPage.h)4
-rw-r--r--application/pages/instance/ScreenshotsPage.ui (renamed from application/pages/ScreenshotsPage.ui)0
-rw-r--r--application/pages/instance/TexturePackPage.h (renamed from application/pages/TexturePackPage.h)0
-rw-r--r--application/pages/instance/VersionPage.cpp (renamed from application/pages/VersionPage.cpp)0
-rw-r--r--application/pages/instance/VersionPage.h (renamed from application/pages/VersionPage.h)2
-rw-r--r--application/pages/instance/VersionPage.ui (renamed from application/pages/VersionPage.ui)0
-rw-r--r--application/pages/instance/WorldListPage.cpp (renamed from application/pages/WorldListPage.cpp)4
-rw-r--r--application/pages/instance/WorldListPage.h (renamed from application/pages/WorldListPage.h)6
-rw-r--r--application/pages/instance/WorldListPage.ui (renamed from application/pages/WorldListPage.ui)0
-rw-r--r--application/pages/modplatform/FTBPage.cpp152
-rw-r--r--application/pages/modplatform/FTBPage.h86
-rw-r--r--application/pages/modplatform/FTBPage.ui61
-rw-r--r--application/pages/modplatform/ImportPage.cpp125
-rw-r--r--application/pages/modplatform/ImportPage.h70
-rw-r--r--application/pages/modplatform/ImportPage.ui52
-rw-r--r--application/pages/modplatform/TechnicPage.cpp29
-rw-r--r--application/pages/modplatform/TechnicPage.h61
-rw-r--r--application/pages/modplatform/TechnicPage.ui48
-rw-r--r--application/pages/modplatform/TwitchPage.cpp29
-rw-r--r--application/pages/modplatform/TwitchPage.h61
-rw-r--r--application/pages/modplatform/TwitchPage.ui48
-rw-r--r--application/pages/modplatform/VanillaPage.cpp114
-rw-r--r--application/pages/modplatform/VanillaPage.h75
-rw-r--r--application/pages/modplatform/VanillaPage.ui149
48 files changed, 1204 insertions, 30 deletions
diff --git a/application/pages/BasePage.h b/application/pages/BasePage.h
index 63a26239..d4547770 100644
--- a/application/pages/BasePage.h
+++ b/application/pages/BasePage.h
@@ -31,8 +31,18 @@ public:
virtual bool apply() { return true; }
virtual bool shouldDisplay() const { return true; }
virtual QString helpPage() const { return QString(); }
- virtual void opened() {}
- virtual void closed() {}
+ void opened()
+ {
+ isOpened = true;
+ openedImpl();
+ }
+ void closed()
+ {
+ isOpened = false;
+ closedImpl();
+ }
+ virtual void openedImpl() {}
+ virtual void closedImpl() {}
virtual void setParentContainer(BasePageContainer * container)
{
m_container = container;
@@ -42,6 +52,7 @@ public:
int listIndex = -1;
protected:
BasePageContainer * m_container = nullptr;
+ bool isOpened = false;
};
typedef std::shared_ptr<BasePage> BasePagePtr;
diff --git a/application/pages/BasePageProvider.h b/application/pages/BasePageProvider.h
index 0ebcff7a..1cc7458a 100644
--- a/application/pages/BasePageProvider.h
+++ b/application/pages/BasePageProvider.h
@@ -15,7 +15,7 @@
#pragma once
-#include "BasePage.h"
+#include "pages/BasePage.h"
#include <memory>
#include <functional>
@@ -65,5 +65,3 @@ private:
QList<PageCreator> m_creators;
QString m_dialogTitle;
};
-
-typedef std::shared_ptr<BasePageProvider> BasePageProviderPtr;
diff --git a/application/pages/global/PackagesPage.cpp b/application/pages/global/PackagesPage.cpp
index 5fd4934c..7cf1e3f5 100644
--- a/application/pages/global/PackagesPage.cpp
+++ b/application/pages/global/PackagesPage.cpp
@@ -218,7 +218,7 @@ void PackagesPage::updateVersion()
}
}
-void PackagesPage::opened()
+void PackagesPage::openedImpl()
{
ENV.metadataIndex()->load(Net::Mode::Offline);
}
diff --git a/application/pages/global/PackagesPage.h b/application/pages/global/PackagesPage.h
index 2afbcf8e..ad155d9e 100644
--- a/application/pages/global/PackagesPage.h
+++ b/application/pages/global/PackagesPage.h
@@ -36,7 +36,7 @@ public:
QString id() const override { return "packages-global"; }
QString displayName() const override { return tr("Packages"); }
QIcon icon() const override;
- void opened() override;
+ void openedImpl() override;
private slots:
void on_refreshIndexBtn_clicked();
diff --git a/application/pages/InstanceSettingsPage.cpp b/application/pages/instance/InstanceSettingsPage.cpp
index 71e90a32..71e90a32 100644
--- a/application/pages/InstanceSettingsPage.cpp
+++ b/application/pages/instance/InstanceSettingsPage.cpp
diff --git a/application/pages/InstanceSettingsPage.h b/application/pages/instance/InstanceSettingsPage.h
index 4959bdbe..c5d7d3b6 100644
--- a/application/pages/InstanceSettingsPage.h
+++ b/application/pages/instance/InstanceSettingsPage.h
@@ -20,7 +20,7 @@
#include "java/JavaChecker.h"
#include "BaseInstance.h"
#include <QObjectPtr.h>
-#include "BasePage.h"
+#include "pages/BasePage.h"
#include "JavaCommon.h"
#include "MultiMC.h"
diff --git a/application/pages/InstanceSettingsPage.ui b/application/pages/instance/InstanceSettingsPage.ui
index 0c180df3..0c180df3 100644
--- a/application/pages/InstanceSettingsPage.ui
+++ b/application/pages/instance/InstanceSettingsPage.ui
diff --git a/application/pages/LegacyUpgradePage.cpp b/application/pages/instance/LegacyUpgradePage.cpp
index a8f4a08c..f808ab88 100644
--- a/application/pages/LegacyUpgradePage.cpp
+++ b/application/pages/instance/LegacyUpgradePage.cpp
@@ -35,7 +35,12 @@ void LegacyUpgradePage::runModalTask(Task *task)
void LegacyUpgradePage::on_upgradeButton_clicked()
{
- std::unique_ptr<Task> task(MMC->folderProvider()->legacyUpgradeTask(m_inst));
+ QString newName = tr("%1 (Migrated)").arg(m_inst->name());
+ auto upgradeTask = new LegacyUpgradeTask(m_inst);
+ upgradeTask->setName(newName);
+ upgradeTask->setGroup(m_inst->group());
+ upgradeTask->setIcon(m_inst->iconKey());
+ std::unique_ptr<Task> task(MMC->folderProvider()->wrapInstanceTask(upgradeTask));
runModalTask(task.get());
}
diff --git a/application/pages/LegacyUpgradePage.h b/application/pages/instance/LegacyUpgradePage.h
index 3e1abe93..3e1abe93 100644
--- a/application/pages/LegacyUpgradePage.h
+++ b/application/pages/instance/LegacyUpgradePage.h
diff --git a/application/pages/LegacyUpgradePage.ui b/application/pages/instance/LegacyUpgradePage.ui
index a94ee039..a94ee039 100644
--- a/application/pages/LegacyUpgradePage.ui
+++ b/application/pages/instance/LegacyUpgradePage.ui
diff --git a/application/pages/LogPage.cpp b/application/pages/instance/LogPage.cpp
index 0fa1ee67..0fa1ee67 100644
--- a/application/pages/LogPage.cpp
+++ b/application/pages/instance/LogPage.cpp
diff --git a/application/pages/LogPage.h b/application/pages/instance/LogPage.h
index b830118e..2229418d 100644
--- a/application/pages/LogPage.h
+++ b/application/pages/instance/LogPage.h
@@ -19,7 +19,7 @@
#include "BaseInstance.h"
#include "launch/LaunchTask.h"
-#include "BasePage.h"
+#include "pages/BasePage.h"
#include <MultiMC.h>
namespace Ui
diff --git a/application/pages/LogPage.ui b/application/pages/instance/LogPage.ui
index 4843d7c3..4843d7c3 100644
--- a/application/pages/LogPage.ui
+++ b/application/pages/instance/LogPage.ui
diff --git a/application/pages/ModFolderPage.cpp b/application/pages/instance/ModFolderPage.cpp
index 2b3f4416..90155df3 100644
--- a/application/pages/ModFolderPage.cpp
+++ b/application/pages/instance/ModFolderPage.cpp
@@ -59,12 +59,12 @@ ModFolderPage::ModFolderPage(BaseInstance *inst, std::shared_ptr<ModList> mods,
connect(ui->filterEdit, &QLineEdit::textChanged, this, &ModFolderPage::on_filterTextChanged );
}
-void ModFolderPage::opened()
+void ModFolderPage::openedImpl()
{
m_mods->startWatching();
}
-void ModFolderPage::closed()
+void ModFolderPage::closedImpl()
{
m_mods->stopWatching();
}
diff --git a/application/pages/ModFolderPage.h b/application/pages/instance/ModFolderPage.h
index 02282c41..15e728cb 100644
--- a/application/pages/ModFolderPage.h
+++ b/application/pages/instance/ModFolderPage.h
@@ -18,7 +18,7 @@
#include <QWidget>
#include "minecraft/MinecraftInstance.h"
-#include "BasePage.h"
+#include "pages/BasePage.h"
#include <MultiMC.h>
class ModList;
@@ -60,8 +60,8 @@ public:
}
virtual bool shouldDisplay() const override;
- virtual void opened() override;
- virtual void closed() override;
+ virtual void openedImpl() override;
+ virtual void closedImpl() override;
protected:
bool eventFilter(QObject *obj, QEvent *ev) override;
bool modListFilter(QKeyEvent *ev);
diff --git a/application/pages/ModFolderPage.ui b/application/pages/instance/ModFolderPage.ui
index b5597bdc..b5597bdc 100644
--- a/application/pages/ModFolderPage.ui
+++ b/application/pages/instance/ModFolderPage.ui
diff --git a/application/pages/NotesPage.cpp b/application/pages/instance/NotesPage.cpp
index 48bb468c..48bb468c 100644
--- a/application/pages/NotesPage.cpp
+++ b/application/pages/instance/NotesPage.cpp
diff --git a/application/pages/NotesPage.h b/application/pages/instance/NotesPage.h
index eab446ad..4a25f9b1 100644
--- a/application/pages/NotesPage.h
+++ b/application/pages/instance/NotesPage.h
@@ -18,7 +18,7 @@
#include <QWidget>
#include "BaseInstance.h"
-#include "BasePage.h"
+#include "pages/BasePage.h"
#include <MultiMC.h>
namespace Ui
diff --git a/application/pages/NotesPage.ui b/application/pages/instance/NotesPage.ui
index 88cca92f..88cca92f 100644
--- a/application/pages/NotesPage.ui
+++ b/application/pages/instance/NotesPage.ui
diff --git a/application/pages/OtherLogsPage.cpp b/application/pages/instance/OtherLogsPage.cpp
index 2141e0cc..10cb1145 100644
--- a/application/pages/OtherLogsPage.cpp
+++ b/application/pages/instance/OtherLogsPage.cpp
@@ -54,11 +54,11 @@ OtherLogsPage::~OtherLogsPage()
delete ui;
}
-void OtherLogsPage::opened()
+void OtherLogsPage::openedImpl()
{
m_watcher->enable();
}
-void OtherLogsPage::closed()
+void OtherLogsPage::closedImpl()
{
m_watcher->disable();
}
diff --git a/application/pages/OtherLogsPage.h b/application/pages/instance/OtherLogsPage.h
index 157f5e9d..ac01ef0a 100644
--- a/application/pages/OtherLogsPage.h
+++ b/application/pages/instance/OtherLogsPage.h
@@ -17,7 +17,7 @@
#include <QWidget>
-#include "BasePage.h"
+#include "pages/BasePage.h"
#include <MultiMC.h>
#include <pathmatcher/IPathMatcher.h>
@@ -52,8 +52,8 @@ public:
{
return "Minecraft-Logs";
}
- void opened() override;
- void closed() override;
+ void openedImpl() override;
+ void closedImpl() override;
private slots:
void populateSelectLogBox();
diff --git a/application/pages/OtherLogsPage.ui b/application/pages/instance/OtherLogsPage.ui
index 56ff3b62..56ff3b62 100644
--- a/application/pages/OtherLogsPage.ui
+++ b/application/pages/instance/OtherLogsPage.ui
diff --git a/application/pages/ResourcePackPage.h b/application/pages/instance/ResourcePackPage.h
index 19dc78da..19dc78da 100644
--- a/application/pages/ResourcePackPage.h
+++ b/application/pages/instance/ResourcePackPage.h
diff --git a/application/pages/ScreenshotsPage.cpp b/application/pages/instance/ScreenshotsPage.cpp
index 7d32576a..71458386 100644
--- a/application/pages/ScreenshotsPage.cpp
+++ b/application/pages/instance/ScreenshotsPage.cpp
@@ -347,7 +347,7 @@ void ScreenshotsPage::on_renameBtn_clicked()
// TODO: mass renaming
}
-void ScreenshotsPage::opened()
+void ScreenshotsPage::openedImpl()
{
if(!m_valid)
{
diff --git a/application/pages/ScreenshotsPage.h b/application/pages/instance/ScreenshotsPage.h
index c3ccbdee..e31fb8b4 100644
--- a/application/pages/ScreenshotsPage.h
+++ b/application/pages/instance/ScreenshotsPage.h
@@ -17,7 +17,7 @@
#include <QWidget>
-#include "BasePage.h"
+#include "pages/BasePage.h"
#include <MultiMC.h>
class QFileSystemModel;
@@ -39,7 +39,7 @@ public:
explicit ScreenshotsPage(QString path, QWidget *parent = 0);
virtual ~ScreenshotsPage();
- virtual void opened() override;
+ virtual void openedImpl() override;
enum
{
diff --git a/application/pages/ScreenshotsPage.ui b/application/pages/instance/ScreenshotsPage.ui
index d05c4384..d05c4384 100644
--- a/application/pages/ScreenshotsPage.ui
+++ b/application/pages/instance/ScreenshotsPage.ui
diff --git a/application/pages/TexturePackPage.h b/application/pages/instance/TexturePackPage.h
index b03614f0..b03614f0 100644
--- a/application/pages/TexturePackPage.h
+++ b/application/pages/instance/TexturePackPage.h
diff --git a/application/pages/VersionPage.cpp b/application/pages/instance/VersionPage.cpp
index 00ae0a7e..00ae0a7e 100644
--- a/application/pages/VersionPage.cpp
+++ b/application/pages/instance/VersionPage.cpp
diff --git a/application/pages/VersionPage.h b/application/pages/instance/VersionPage.h
index 49620c56..85304ea5 100644
--- a/application/pages/VersionPage.h
+++ b/application/pages/instance/VersionPage.h
@@ -19,7 +19,7 @@
#include "minecraft/MinecraftInstance.h"
#include "minecraft/ComponentList.h"
-#include "BasePage.h"
+#include "pages/BasePage.h"
namespace Ui
{
diff --git a/application/pages/VersionPage.ui b/application/pages/instance/VersionPage.ui
index d54dd840..d54dd840 100644
--- a/application/pages/VersionPage.ui
+++ b/application/pages/instance/VersionPage.ui
diff --git a/application/pages/WorldListPage.cpp b/application/pages/instance/WorldListPage.cpp
index 56a7e791..539d26a0 100644
--- a/application/pages/WorldListPage.cpp
+++ b/application/pages/instance/WorldListPage.cpp
@@ -55,12 +55,12 @@ WorldListPage::WorldListPage(BaseInstance *inst, std::shared_ptr<WorldList> worl
worldChanged(QModelIndex(), QModelIndex());
}
-void WorldListPage::opened()
+void WorldListPage::openedImpl()
{
m_worlds->startWatching();
}
-void WorldListPage::closed()
+void WorldListPage::closedImpl()
{
m_worlds->stopWatching();
}
diff --git a/application/pages/WorldListPage.h b/application/pages/instance/WorldListPage.h
index d0aa6150..71b87bda 100644
--- a/application/pages/WorldListPage.h
+++ b/application/pages/instance/WorldListPage.h
@@ -18,7 +18,7 @@
#include <QWidget>
#include "minecraft/MinecraftInstance.h"
-#include "BasePage.h"
+#include "pages/BasePage.h"
#include <MultiMC.h>
#include <LoggedProcess.h>
@@ -56,8 +56,8 @@ public:
}
virtual bool shouldDisplay() const override;
- virtual void opened() override;
- virtual void closed() override;
+ virtual void openedImpl() override;
+ virtual void closedImpl() override;
protected:
bool eventFilter(QObject *obj, QEvent *ev) override;
diff --git a/application/pages/WorldListPage.ui b/application/pages/instance/WorldListPage.ui
index 0018ddf3..0018ddf3 100644
--- a/application/pages/WorldListPage.ui
+++ b/application/pages/instance/WorldListPage.ui
diff --git a/application/pages/modplatform/FTBPage.cpp b/application/pages/modplatform/FTBPage.cpp
new file mode 100644
index 00000000..a8ec6577
--- /dev/null
+++ b/application/pages/modplatform/FTBPage.cpp
@@ -0,0 +1,152 @@
+#include "FTBPage.h"
+#include "ui_FTBPage.h"
+
+#include "MultiMC.h"
+#include "FolderInstanceProvider.h"
+#include "dialogs/CustomMessageBox.h"
+#include "dialogs/NewInstanceDialog.h"
+#include "modplatform/ftb/FtbPackDownloader.h"
+#include "modplatform/ftb/FtbPackInstallTask.h"
+#include <FtbListModel.h>
+
+FTBPage::FTBPage(NewInstanceDialog* dialog, QWidget *parent)
+ : QWidget(parent), dialog(dialog), ui(new Ui::FTBPage)
+{
+ ui->setupUi(this);
+ ftbPackDownloader = new FtbPackDownloader();
+
+ connect(ftbPackDownloader, &FtbPackDownloader::ready, this, &FTBPage::ftbPackDataDownloadSuccessfully);
+ connect(ftbPackDownloader, &FtbPackDownloader::packFetchFailed, this, &FTBPage::ftbPackDataDownloadFailed);
+
+ filterModel = new FtbFilterModel(this);
+ listModel = new FtbListModel(this);
+ filterModel->setSourceModel(listModel);
+
+ ui->packList->setModel(filterModel);
+ ui->packList->setSortingEnabled(true);
+ ui->packList->header()->hide();
+ ui->packList->setIndentation(0);
+
+ filterModel->setSorting(FtbFilterModel::Sorting::ByName);
+
+ for(int i = 0; i < filterModel->getAvailableSortings().size(); i++)
+ {
+ ui->sortByBox->addItem(filterModel->getAvailableSortings().keys().at(i));
+ }
+
+ ui->sortByBox->setCurrentText(filterModel->getAvailableSortings().key(filterModel->getCurrentSorting()));
+
+ connect(ui->sortByBox, &QComboBox::currentTextChanged, this, &FTBPage::onSortingSelectionChanged);
+ connect(ui->packVersionSelection, &QComboBox::currentTextChanged, this, &FTBPage::onVersionSelectionItemChanged);
+ connect(ui->packList->selectionModel(), &QItemSelectionModel::currentChanged, this, &FTBPage::onPackSelectionChanged);
+
+ ui->modpackInfo->setOpenExternalLinks(true);
+}
+
+FTBPage::~FTBPage()
+{
+ delete ui;
+ if(ftbPackDownloader)
+ {
+ ftbPackDownloader->deleteLater();
+ }
+}
+
+bool FTBPage::shouldDisplay() const
+{
+ return true;
+}
+
+void FTBPage::openedImpl()
+{
+ if(!initialized)
+ {
+ ftbPackDownloader->fetchModpacks(false);
+ initialized = true;
+ }
+ suggestCurrent();
+}
+
+void FTBPage::suggestCurrent()
+{
+ if(isOpened)
+ {
+ if(!selected.broken)
+ {
+ dialog->setSuggestedPack(selected.name, new FtbPackInstallTask(selected, selectedVersion));
+ }
+ else
+ {
+ dialog->setSuggestedPack();
+ }
+ }
+}
+
+FtbPackDownloader *FTBPage::getFtbPackDownloader()
+{
+ return ftbPackDownloader;
+}
+
+void FTBPage::ftbPackDataDownloadSuccessfully()
+{
+ listModel->fill(ftbPackDownloader->getModpacks());
+}
+
+void FTBPage::ftbPackDataDownloadFailed()
+{
+ qDebug() << "Stuff went missing while grabbing FTB pack list or something...";
+}
+
+void FTBPage::onPackSelectionChanged(QModelIndex now, QModelIndex prev)
+{
+ ui->packVersionSelection->clear();
+ FtbModpack selectedPack = filterModel->data(now, Qt::UserRole).value<FtbModpack>();
+
+ ui->modpackInfo->setHtml("Pack by <b>" + selectedPack.author + "</b>" + "<br>Minecraft " + selectedPack.mcVersion + "<br>"
+ "<br>" + selectedPack.description + "<ul><li>" + selectedPack.mods.replace(";", "</li><li>") + "</li></ul>");
+
+ bool currentAdded = false;
+
+ for(int i = 0; i < selectedPack.oldVersions.size(); i++)
+ {
+ if(selectedPack.currentVersion == selectedPack.oldVersions.at(i))
+ {
+ currentAdded = true;
+ }
+ ui->packVersionSelection->addItem(selectedPack.oldVersions.at(i));
+ }
+
+ if(!currentAdded)
+ {
+ ui->packVersionSelection->addItem(selectedPack.currentVersion);
+ }
+
+ selected = selectedPack;
+ suggestCurrent();
+}
+
+void FTBPage::onVersionSelectionItemChanged(QString data)
+{
+ if(data.isNull() || data.isEmpty())
+ {
+ selectedVersion = "";
+ return;
+ }
+
+ selectedVersion = data;
+}
+
+FtbModpack FTBPage::getSelectedModpack()
+{
+ return selected;
+}
+
+QString FTBPage::getSelectedVersion()
+{
+ return selectedVersion;
+}
+
+void FTBPage::onSortingSelectionChanged(QString data)
+{
+ filterModel->setSorting(filterModel->getAvailableSortings().value(data));
+}
diff --git a/application/pages/modplatform/FTBPage.h b/application/pages/modplatform/FTBPage.h
new file mode 100644
index 00000000..f7d6ca8b
--- /dev/null
+++ b/application/pages/modplatform/FTBPage.h
@@ -0,0 +1,86 @@
+/* Copyright 2013-2018 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 <QWidget>
+
+#include "pages/BasePage.h"
+#include <MultiMC.h>
+#include "tasks/Task.h"
+#include "modplatform/ftb/PackHelpers.h"
+
+namespace Ui
+{
+class FTBPage;
+}
+
+class FtbListModel;
+class FtbFilterModel;
+class FtbPackDownloader;
+class NewInstanceDialog;
+
+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;
+
+ FtbPackDownloader* getFtbPackDownloader();
+ FtbModpack getSelectedModpack();
+ QString getSelectedVersion();
+
+private:
+ void suggestCurrent();
+
+private slots:
+ void ftbPackDataDownloadSuccessfully();
+ void ftbPackDataDownloadFailed();
+ void onSortingSelectionChanged(QString data);
+ void onVersionSelectionItemChanged(QString data);
+ void onPackSelectionChanged(QModelIndex first, QModelIndex second);
+
+private:
+ bool initialized = false;
+ FtbPackDownloader* ftbPackDownloader = nullptr;
+ FtbModpack selectedPack;
+ FtbModpack selected;
+ QString selectedVersion;
+ FtbListModel* listModel = nullptr;
+ FtbFilterModel* filterModel = nullptr;
+ NewInstanceDialog* dialog = nullptr;
+
+ Ui::FTBPage *ui = nullptr;
+};
diff --git a/application/pages/modplatform/FTBPage.ui b/application/pages/modplatform/FTBPage.ui
new file mode 100644
index 00000000..c54fc392
--- /dev/null
+++ b/application/pages/modplatform/FTBPage.ui
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>FTBPage</class>
+ <widget class="QWidget" name="FTBPage">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>801</width>
+ <height>674</height>
+ </rect>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QTreeView" name="packList">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" colspan="3">
+ <widget class="QTextBrowser" name="modpackInfo"/>
+ </item>
+ <item row="1" column="0">
+ <widget class="QComboBox" name="sortByBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLabel" name="selectedVersionLabel">
+ <property name="text">
+ <string>Version selected:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2" colspan="2">
+ <widget class="QComboBox" name="packVersionSelection">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/application/pages/modplatform/ImportPage.cpp b/application/pages/modplatform/ImportPage.cpp
new file mode 100644
index 00000000..545ca38d
--- /dev/null
+++ b/application/pages/modplatform/ImportPage.cpp
@@ -0,0 +1,125 @@
+#include "ImportPage.h"
+#include "ui_ImportPage.h"
+
+#include "MultiMC.h"
+#include "FolderInstanceProvider.h"
+#include "dialogs/CustomMessageBox.h"
+#include "dialogs/ProgressDialog.h"
+#include "dialogs/NewInstanceDialog.h"
+#include <QFileDialog>
+#include <InstanceImportTask.h>
+
+class UrlValidator : public QValidator
+{
+public:
+ using QValidator::QValidator;
+
+ State validate(QString &in, int &pos) const
+ {
+ const QUrl url(in);
+ if (url.isValid() && !url.isRelative() && !url.isEmpty())
+ {
+ return Acceptable;
+ }
+ else if (QFile::exists(in))
+ {
+ return Acceptable;
+ }
+ else
+ {
+ return Intermediate;
+ }
+ }
+};
+
+ImportPage::ImportPage(NewInstanceDialog* dialog, QWidget *parent)
+ : QWidget(parent), ui(new Ui::ImportPage), dialog(dialog)
+{
+ ui->setupUi(this);
+ ui->modpackEdit->setValidator(new UrlValidator(ui->modpackEdit));
+ connect(ui->modpackEdit, &QLineEdit::textChanged, this, &ImportPage::updateState);
+}
+
+ImportPage::~ImportPage()
+{
+ delete ui;
+}
+
+bool ImportPage::shouldDisplay() const
+{
+ return true;
+}
+
+void ImportPage::openedImpl()
+{
+ updateState();
+}
+
+void ImportPage::updateState()
+{
+ if(!isOpened)
+ {
+ return;
+ }
+ if(ui->modpackEdit->hasAcceptableInput())
+ {
+ QString input = ui->modpackEdit->text();
+ auto url = QUrl::fromUserInput(input);
+ if(url.isLocalFile())
+ {
+ // FIXME: actually do some validation of what's inside here... this is fake AF
+ QFileInfo fi(input);
+ if(fi.exists() && fi.suffix() == "zip")
+ {
+ QFileInfo fi(url.fileName());
+ dialog->setSuggestedPack(fi.completeBaseName(), new InstanceImportTask(url));
+ }
+ }
+ else
+ {
+ // hook, line and sinker.
+ QFileInfo fi(url.fileName());
+ dialog->setSuggestedPack(fi.completeBaseName(), new InstanceImportTask(url));
+ }
+ }
+ else
+ {
+ dialog->setSuggestedPack();
+ }
+}
+
+void ImportPage::setUrl(const QString& url)
+{
+ ui->modpackEdit->setText(url);
+ updateState();
+}
+
+void ImportPage::on_modpackBtn_clicked()
+{
+ const QUrl url = QFileDialog::getOpenFileUrl(this, tr("Choose modpack"), modpackUrl(), tr("Zip (*.zip)"));
+ if (url.isValid())
+ {
+ if (url.isLocalFile())
+ {
+ ui->modpackEdit->setText(url.toLocalFile());
+ }
+ else
+ {
+ ui->modpackEdit->setText(url.toString());
+ }
+ }
+}
+
+
+QUrl ImportPage::modpackUrl() const
+{
+ const QUrl url(ui->modpackEdit->text());
+ if (url.isValid() && !url.isRelative() && !url.host().isEmpty())
+ {
+ return url;
+ }
+ else
+ {
+ return QUrl::fromLocalFile(ui->modpackEdit->text());
+ }
+}
diff --git a/application/pages/modplatform/ImportPage.h b/application/pages/modplatform/ImportPage.h
new file mode 100644
index 00000000..8f62e6b1
--- /dev/null
+++ b/application/pages/modplatform/ImportPage.h
@@ -0,0 +1,70 @@
+/* Copyright 2013-2018 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 <QWidget>
+
+#include "pages/BasePage.h"
+#include <MultiMC.h>
+#include "tasks/Task.h"
+
+namespace Ui
+{
+class ImportPage;
+}
+
+class NewInstanceDialog;
+
+class ImportPage : public QWidget, public BasePage
+{
+ Q_OBJECT
+
+public:
+ explicit ImportPage(NewInstanceDialog* dialog, QWidget *parent = 0);
+ virtual ~ImportPage();
+ virtual QString displayName() const override
+ {
+ return tr("Import from zip");
+ }
+ virtual QIcon icon() const override
+ {
+ return MMC->getThemedIcon("viewfolder");
+ }
+ virtual QString id() const override
+ {
+ return "import";
+ }
+ virtual QString helpPage() const override
+ {
+ return "Zip-import";
+ }
+ virtual bool shouldDisplay() const override;
+
+ void setUrl(const QString & url);
+ void openedImpl() override;
+
+private slots:
+ void on_modpackBtn_clicked();
+ void updateState();
+
+private:
+ QUrl modpackUrl() const;
+
+private:
+ Ui::ImportPage *ui = nullptr;
+ NewInstanceDialog* dialog = nullptr;
+};
+
diff --git a/application/pages/modplatform/ImportPage.ui b/application/pages/modplatform/ImportPage.ui
new file mode 100644
index 00000000..eb63cbe9
--- /dev/null
+++ b/application/pages/modplatform/ImportPage.ui
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ImportPage</class>
+ <widget class="QWidget" name="ImportPage">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>546</width>
+ <height>405</height>
+ </rect>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="1" column="1">
+ <widget class="QPushButton" name="modpackBtn">
+ <property name="text">
+ <string>Browse</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLineEdit" name="modpackEdit">
+ <property name="placeholderText">
+ <string notr="true">http://</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0" colspan="2">
+ <widget class="QLabel" name="modpackLabel">
+ <property name="text">
+ <string>Local file or link to a direct download:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="2">
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/application/pages/modplatform/TechnicPage.cpp b/application/pages/modplatform/TechnicPage.cpp
new file mode 100644
index 00000000..c0f4faa5
--- /dev/null
+++ b/application/pages/modplatform/TechnicPage.cpp
@@ -0,0 +1,29 @@
+#include "TechnicPage.h"
+#include "ui_TechnicPage.h"
+
+#include "MultiMC.h"
+#include "FolderInstanceProvider.h"
+#include "dialogs/CustomMessageBox.h"
+#include "dialogs/ProgressDialog.h"
+#include "dialogs/NewInstanceDialog.h"
+
+TechnicPage::TechnicPage(NewInstanceDialog* dialog, QWidget *parent)
+ : QWidget(parent), ui(new Ui::TechnicPage), dialog(dialog)
+{
+ ui->setupUi(this);
+}
+
+TechnicPage::~TechnicPage()
+{
+ delete ui;
+}
+
+bool TechnicPage::shouldDisplay() const
+{
+ return true;
+}
+
+void TechnicPage::openedImpl()
+{
+ dialog->setSuggestedPack();
+}
diff --git a/application/pages/modplatform/TechnicPage.h b/application/pages/modplatform/TechnicPage.h
new file mode 100644
index 00000000..5b0f16a6
--- /dev/null
+++ b/application/pages/modplatform/TechnicPage.h
@@ -0,0 +1,61 @@
+/* Copyright 2013-2018 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 <QWidget>
+
+#include "pages/BasePage.h"
+#include <MultiMC.h>
+#include "tasks/Task.h"
+
+namespace Ui
+{
+class TechnicPage;
+}
+
+class NewInstanceDialog;
+
+class TechnicPage : public QWidget, public BasePage
+{
+ Q_OBJECT
+
+public:
+ explicit TechnicPage(NewInstanceDialog* dialog, QWidget *parent = 0);
+ virtual ~TechnicPage();
+ virtual QString displayName() const override
+ {
+ return tr("Technic");
+ }
+ virtual QIcon icon() const override
+ {
+ return MMC->getThemedIcon("technic");
+ }
+ virtual QString id() const override
+ {
+ return "technic";
+ }
+ virtual QString helpPage() const override
+ {
+ return "Technic-platform";
+ }
+ virtual bool shouldDisplay() const override;
+
+ void openedImpl() override;
+
+private:
+ Ui::TechnicPage *ui = nullptr;
+ NewInstanceDialog* dialog = nullptr;
+};
diff --git a/application/pages/modplatform/TechnicPage.ui b/application/pages/modplatform/TechnicPage.ui
new file mode 100644
index 00000000..6bb6e9e0
--- /dev/null
+++ b/application/pages/modplatform/TechnicPage.ui
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>TechnicPage</class>
+ <widget class="QWidget" name="TechnicPage">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>546</width>
+ <height>405</height>
+ </rect>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_5">
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="font">
+ <font>
+ <pointsize>40</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string notr="true">¯\_(ツ)_/¯ </string>
+ </property>
+ <property name="textFormat">
+ <enum>Qt::PlainText</enum>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/application/pages/modplatform/TwitchPage.cpp b/application/pages/modplatform/TwitchPage.cpp
new file mode 100644
index 00000000..a264c2f7
--- /dev/null
+++ b/application/pages/modplatform/TwitchPage.cpp
@@ -0,0 +1,29 @@
+#include "TwitchPage.h"
+#include "ui_TwitchPage.h"
+
+#include "MultiMC.h"
+#include "FolderInstanceProvider.h"
+#include "dialogs/CustomMessageBox.h"
+#include "dialogs/ProgressDialog.h"
+#include "dialogs/NewInstanceDialog.h"
+
+TwitchPage::TwitchPage(NewInstanceDialog* dialog, QWidget *parent)
+ : QWidget(parent), ui(new Ui::TwitchPage), dialog(dialog)
+{
+ ui->setupUi(this);
+}
+
+TwitchPage::~TwitchPage()
+{
+ delete ui;
+}
+
+bool TwitchPage::shouldDisplay() const
+{
+ return true;
+}
+
+void TwitchPage::openedImpl()
+{
+ dialog->setSuggestedPack();
+}
diff --git a/application/pages/modplatform/TwitchPage.h b/application/pages/modplatform/TwitchPage.h
new file mode 100644
index 00000000..8e072917
--- /dev/null
+++ b/application/pages/modplatform/TwitchPage.h
@@ -0,0 +1,61 @@
+/* Copyright 2013-2018 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 <QWidget>
+
+#include "pages/BasePage.h"
+#include <MultiMC.h>
+#include "tasks/Task.h"
+
+namespace Ui
+{
+class TwitchPage;
+}
+
+class NewInstanceDialog;
+
+class TwitchPage : public QWidget, public BasePage
+{
+ Q_OBJECT
+
+public:
+ explicit TwitchPage(NewInstanceDialog* dialog, QWidget *parent = 0);
+ virtual ~TwitchPage();
+ virtual QString displayName() const override
+ {
+ return tr("Twitch");
+ }
+ virtual QIcon icon() const override
+ {
+ return MMC->getThemedIcon("twitch");
+ }
+ virtual QString id() const override
+ {
+ return "twitch";
+ }
+ virtual QString helpPage() const override
+ {
+ return "Twitch-platform";
+ }
+ virtual bool shouldDisplay() const override;
+
+ void openedImpl() override;
+
+private:
+ Ui::TwitchPage *ui = nullptr;
+ NewInstanceDialog* dialog = nullptr;
+};
diff --git a/application/pages/modplatform/TwitchPage.ui b/application/pages/modplatform/TwitchPage.ui
new file mode 100644
index 00000000..19178505
--- /dev/null
+++ b/application/pages/modplatform/TwitchPage.ui
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>TwitchPage</class>
+ <widget class="QWidget" name="TwitchPage">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>546</width>
+ <height>405</height>
+ </rect>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_5">
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="font">
+ <font>
+ <pointsize>40</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string notr="true">¯\_(ツ)_/¯ </string>
+ </property>
+ <property name="textFormat">
+ <enum>Qt::PlainText</enum>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/application/pages/modplatform/VanillaPage.cpp b/application/pages/modplatform/VanillaPage.cpp
new file mode 100644
index 00000000..013ca426
--- /dev/null
+++ b/application/pages/modplatform/VanillaPage.cpp
@@ -0,0 +1,114 @@
+#include "VanillaPage.h"
+#include "ui_VanillaPage.h"
+
+#include "MultiMC.h"
+#include "FolderInstanceProvider.h"
+#include "dialogs/CustomMessageBox.h"
+#include "dialogs/ProgressDialog.h"
+
+#include <meta/Index.h>
+#include <meta/VersionList.h>
+#include <dialogs/NewInstanceDialog.h>
+#include <Filter.h>
+#include <Env.h>
+#include <InstanceCreationTask.h>
+
+VanillaPage::VanillaPage(NewInstanceDialog *dialog, QWidget *parent)
+ : QWidget(parent), dialog(dialog), ui(new Ui::VanillaPage)
+{
+ ui->setupUi(this);
+ ui->tabWidget->tabBar()->hide();
+ connect(ui->versionList, &VersionSelectWidget::selectedVersionChanged, this, &VanillaPage::setSelectedVersion);
+ filterChanged();
+ connect(ui->alphaFilter, &QCheckBox::stateChanged, this, &VanillaPage::filterChanged);
+ connect(ui->betaFilter, &QCheckBox::stateChanged, this, &VanillaPage::filterChanged);
+ connect(ui->snapshotFilter, &QCheckBox::stateChanged, this, &VanillaPage::filterChanged);
+ connect(ui->oldSnapshotFilter, &QCheckBox::stateChanged, this, &VanillaPage::filterChanged);
+ connect(ui->releaseFilter, &QCheckBox::stateChanged, this, &VanillaPage::filterChanged);
+}
+
+void VanillaPage::openedImpl()
+{
+ if(!initialized)
+ {
+ auto vlist = ENV.metadataIndex()->get("net.minecraft");
+ ui->versionList->initialize(vlist.get());
+ if(vlist->isLoaded())
+ {
+ setSelectedVersion(vlist->getRecommended());
+ }
+ else
+ {
+ vlist->load(Net::Mode::Online);
+ auto task = vlist->getLoadTask();
+ if(vlist->isLoaded())
+ {
+ setSelectedVersion(vlist->getRecommended());
+ }
+ if(task)
+ {
+ connect(task.get(), &Task::succeeded, this, &VanillaPage::versionListUpdated);
+ }
+ }
+ initialized = true;
+ }
+ else
+ {
+ suggestCurrent();
+ }
+}
+
+void VanillaPage::filterChanged()
+{
+ QStringList out;
+ if(ui->alphaFilter->isChecked())
+ out << "(old_alpha)";
+ if(ui->betaFilter->isChecked())
+ out << "(old_beta)";
+ if(ui->snapshotFilter->isChecked())
+ out << "(snapshot)";
+ if(ui->oldSnapshotFilter->isChecked())
+ out << "(old_snapshot)";
+ if(ui->releaseFilter->isChecked())
+ out << "(release)";
+ auto regexp = out.join('|');
+ ui->versionList->setFilter(BaseVersionList::TypeRole, new RegexpFilter(regexp, false));
+}
+
+VanillaPage::~VanillaPage()
+{
+ delete ui;
+}
+
+bool VanillaPage::shouldDisplay() const
+{
+ return true;
+}
+
+BaseVersionPtr VanillaPage::selectedVersion() const
+{
+ return m_selectedVersion;
+}
+
+void VanillaPage::versionListUpdated()
+{
+ if(!m_versionSetByUser)
+ {
+ auto vlist = ENV.metadataIndex()->get("net.minecraft");
+ setSelectedVersion(vlist->getRecommended());
+ }
+}
+
+void VanillaPage::suggestCurrent()
+{
+ if(m_selectedVersion && isOpened)
+ {
+ dialog->setSuggestedPack(m_selectedVersion->descriptor(), new InstanceCreationTask(m_selectedVersion));
+ }
+}
+
+void VanillaPage::setSelectedVersion(BaseVersionPtr version)
+{
+ m_selectedVersion = version;
+ suggestCurrent();
+}
diff --git a/application/pages/modplatform/VanillaPage.h b/application/pages/modplatform/VanillaPage.h
new file mode 100644
index 00000000..3f9d20ec
--- /dev/null
+++ b/application/pages/modplatform/VanillaPage.h
@@ -0,0 +1,75 @@
+/* Copyright 2013-2018 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 <QWidget>
+
+#include "pages/BasePage.h"
+#include <MultiMC.h>
+#include "tasks/Task.h"
+
+namespace Ui
+{
+class VanillaPage;
+}
+
+class NewInstanceDialog;
+
+class VanillaPage : public QWidget, public BasePage
+{
+ Q_OBJECT
+
+public:
+ explicit VanillaPage(NewInstanceDialog *dialog, QWidget *parent = 0);
+ virtual ~VanillaPage();
+ virtual QString displayName() const override
+ {
+ return tr("Vanilla");
+ }
+ virtual QIcon icon() const override
+ {
+ return MMC->getThemedIcon("minecraft");
+ }
+ virtual QString id() const override
+ {
+ return "vanilla";
+ }
+ virtual QString helpPage() const override
+ {
+ return "Vanilla-platform";
+ }
+ virtual bool shouldDisplay() const override;
+ void openedImpl() override;
+
+ BaseVersionPtr selectedVersion() const;
+
+public slots:
+ void setSelectedVersion(BaseVersionPtr version);
+
+private slots:
+ void versionListUpdated();
+ void filterChanged();
+
+private:
+ void suggestCurrent();
+
+private:
+ bool initialized = false;
+ NewInstanceDialog *dialog = nullptr;
+ Ui::VanillaPage *ui = nullptr;
+ bool m_versionSetByUser = false;
+ BaseVersionPtr m_selectedVersion;
+};
diff --git a/application/pages/modplatform/VanillaPage.ui b/application/pages/modplatform/VanillaPage.ui
new file mode 100644
index 00000000..713d04a0
--- /dev/null
+++ b/application/pages/modplatform/VanillaPage.ui
@@ -0,0 +1,149 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>VanillaPage</class>
+ <widget class="QWidget" name="VanillaPage">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>815</width>
+ <height>607</height>
+ </rect>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_5">
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QTabWidget" name="tabWidget">
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="tab">
+ <attribute name="title">
+ <string notr="true">Tab 1</string>
+ </attribute>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="0" column="1">
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Filter</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="releaseFilter">
+ <property name="text">
+ <string>Releases</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="snapshotFilter">
+ <property name="text">
+ <string>Snapshots</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="oldSnapshotFilter">
+ <property name="text">
+ <string>Old Snapshots</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="betaFilter">
+ <property name="text">
+ <string>Betas</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="alphaFilter">
+ <property name="text">
+ <string>Alphas</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="refreshBtn">
+ <property name="text">
+ <string>Refresh</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="0" column="0">
+ <widget class="VersionSelectWidget" name="versionList" native="true">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>VersionSelectWidget</class>
+ <extends>QWidget</extends>
+ <header>widgets/VersionSelectWidget.h</header>
+ <container>1</container>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>