summaryrefslogtreecommitdiffstats
path: root/application/pages
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2017-11-11 01:38:31 +0100
committerPetr Mrázek <peterix@gmail.com>2017-12-03 01:22:34 +0100
commit85ae710d407eb31527183d5f8bec0399eb209f33 (patch)
tree23647a83506ad3bd052720fb40068240e9768481 /application/pages
parent17c8f31a09da6bdfc4aa7f67b2ca86b791f2ba96 (diff)
downloadMultiMC-85ae710d407eb31527183d5f8bec0399eb209f33.tar
MultiMC-85ae710d407eb31527183d5f8bec0399eb209f33.tar.gz
MultiMC-85ae710d407eb31527183d5f8bec0399eb209f33.tar.lz
MultiMC-85ae710d407eb31527183d5f8bec0399eb209f33.tar.xz
MultiMC-85ae710d407eb31527183d5f8bec0399eb209f33.zip
GH-2026 implement changes necessary to support 1.13 snapshots
Diffstat (limited to 'application/pages')
-rw-r--r--application/pages/ModFolderPage.cpp6
-rw-r--r--application/pages/VersionPage.cpp89
-rw-r--r--application/pages/VersionPage.h3
-rw-r--r--application/pages/VersionPage.ui13
-rw-r--r--application/pages/global/PackagesPage.cpp23
5 files changed, 78 insertions, 56 deletions
diff --git a/application/pages/ModFolderPage.cpp b/application/pages/ModFolderPage.cpp
index be1c8289..4ef5d71c 100644
--- a/application/pages/ModFolderPage.cpp
+++ b/application/pages/ModFolderPage.cpp
@@ -106,15 +106,15 @@ bool CoreModFolderPage::shouldDisplay() const
auto version = inst->getComponentList();
if (!version)
return true;
- if(!version->versionPatch("net.minecraftforge"))
+ if(!version->getComponent("net.minecraftforge"))
{
return false;
}
- if(!version->versionPatch("net.minecraft"))
+ if(!version->getComponent("net.minecraft"))
{
return false;
}
- if(version->versionPatch("net.minecraft")->getReleaseDateTime() < g_VersionFilterData.legacyCutoffDate)
+ if(version->getComponent("net.minecraft")->getReleaseDateTime() < g_VersionFilterData.legacyCutoffDate)
{
return true;
}
diff --git a/application/pages/VersionPage.cpp b/application/pages/VersionPage.cpp
index d65d6bc7..c9f3453f 100644
--- a/application/pages/VersionPage.cpp
+++ b/application/pages/VersionPage.cpp
@@ -103,10 +103,10 @@ VersionPage::VersionPage(MinecraftInstance *inst, QWidget *parent)
{
ui->setupUi(this);
ui->tabWidget->tabBar()->hide();
+ m_profile = m_inst->getComponentList();
reloadComponentList();
- m_profile = m_inst->getComponentList();
if (m_profile)
{
auto proxy = new IconProxy(ui->packageView);
@@ -142,7 +142,7 @@ void VersionPage::packageCurrent(const QModelIndex &current, const QModelIndex &
return;
}
int row = current.row();
- auto patch = m_profile->versionPatch(row);
+ auto patch = m_profile->getComponent(row);
auto severity = patch->getProblemSeverity();
switch(severity)
{
@@ -196,7 +196,7 @@ bool VersionPage::reloadComponentList()
{
try
{
- m_inst->reloadProfile();
+ m_profile->reload(Net::Mode::Online);
return true;
}
catch (Exception &e)
@@ -262,19 +262,6 @@ void VersionPage::on_jarBtn_clicked()
updateButtons();
}
-void VersionPage::on_resetOrderBtn_clicked()
-{
- try
- {
- m_profile->resetOrder();
- }
- catch (Exception &e)
- {
- QMessageBox::critical(this, tr("Error"), e.cause());
- }
- updateButtons();
-}
-
void VersionPage::on_moveUpBtn_clicked()
{
try
@@ -308,7 +295,7 @@ void VersionPage::on_changeVersionBtn_clicked()
{
return;
}
- auto patch = m_profile->versionPatch(versionRow);
+ auto patch = m_profile->getComponent(versionRow);
auto name = patch->getName();
auto list = patch->getVersionList();
if(!list)
@@ -331,8 +318,10 @@ void VersionPage::on_changeVersionBtn_clicked()
}
qDebug() << "Change" << uid << "to" << vselect.selectedVersion()->descriptor();
+ bool important = false;
if(uid == "net.minecraft")
{
+ important = true;
if (!m_profile->isVanilla())
{
auto result = CustomMessageBox::selectable(
@@ -348,14 +337,14 @@ void VersionPage::on_changeVersionBtn_clicked()
reloadComponentList();
}
}
- m_inst->setComponentVersion(uid, vselect.selectedVersion()->descriptor());
+ m_profile->setComponentVersion(uid, vselect.selectedVersion()->descriptor(), important);
doUpdate();
m_container->refreshContainer();
}
int VersionPage::doUpdate()
{
- auto updateTask = m_inst->createUpdateTask();
+ auto updateTask = m_inst->createUpdateTask(Net::Mode::Online);
if (!updateTask)
{
return 1;
@@ -376,20 +365,58 @@ void VersionPage::on_forgeBtn_clicked()
return;
}
VersionSelectDialog vselect(vlist.get(), tr("Select Forge version"), this);
- vselect.setExactFilter(BaseVersionList::ParentVersionRole, m_inst->getComponentVersion("net.minecraft"));
- vselect.setEmptyString(tr("No Forge versions are currently available for Minecraft ") + m_inst->getComponentVersion("net.minecraft"));
+ vselect.setExactFilter(BaseVersionList::ParentVersionRole, m_profile->getComponentVersion("net.minecraft"));
+ vselect.setEmptyString(tr("No Forge versions are currently available for Minecraft ") + m_profile->getComponentVersion("net.minecraft"));
vselect.setEmptyErrorString(tr("Couldn't load or download the Forge version lists!"));
if (vselect.exec() && vselect.selectedVersion())
{
auto vsn = vselect.selectedVersion();
- m_inst->setComponentVersion("net.minecraftforge", vsn->descriptor());
- m_profile->reload();
+ m_profile->setComponentVersion("net.minecraftforge", vsn->descriptor());
+ m_profile->resolve(Net::Mode::Online);
// m_profile->installVersion();
preselect(m_profile->rowCount(QModelIndex())-1);
m_container->refreshContainer();
}
}
+// TODO: use something like this... except the final decision of what to show has to be deferred until the lists are known
+/*
+void VersionPage::on_liteloaderBtn_clicked()
+{
+ QString uid = "com.mumfrey.liteloader";
+ auto vlist = ENV.metadataIndex()->get(uid);
+ if(!vlist)
+ {
+ return;
+ }
+ VersionSelectDialog vselect(vlist.get(), tr("Select %1 version").arg(vlist->name()), this);
+ auto parentUid = vlist->parentUid();
+ if(!parentUid.isEmpty())
+ {
+ auto parentvlist = ENV.metadataIndex()->get(parentUid);
+ vselect.setExactFilter(BaseVersionList::ParentVersionRole, m_profile->getComponentVersion(parentUid));
+ vselect.setEmptyString(
+ tr("No %1 versions are currently available for %2 %3")
+ .arg(vlist->name())
+ .arg(parentvlist->name())
+ .arg(m_profile->getComponentVersion(parentUid)));
+ }
+ else
+ {
+ vselect.setEmptyString(tr("No %1 versions are currently available"));
+ }
+ vselect.setEmptyErrorString(tr("Couldn't load or download the %1 version lists!").arg(vlist->name()));
+ if (vselect.exec() && vselect.selectedVersion())
+ {
+ auto vsn = vselect.selectedVersion();
+ m_profile->setComponentVersion(uid, vsn->descriptor());
+ m_profile->resolve();
+ preselect(m_profile->rowCount(QModelIndex())-1);
+ m_container->refreshContainer();
+ }
+}
+*/
+
void VersionPage::on_liteloaderBtn_clicked()
{
auto vlist = ENV.metadataIndex()->get("com.mumfrey.liteloader");
@@ -398,14 +425,14 @@ void VersionPage::on_liteloaderBtn_clicked()
return;
}
VersionSelectDialog vselect(vlist.get(), tr("Select LiteLoader version"), this);
- vselect.setExactFilter(BaseVersionList::ParentVersionRole, m_inst->getComponentVersion("net.minecraft"));
- vselect.setEmptyString(tr("No LiteLoader versions are currently available for Minecraft ") + m_inst->getComponentVersion("net.minecraft"));
+ vselect.setExactFilter(BaseVersionList::ParentVersionRole, m_profile->getComponentVersion("net.minecraft"));
+ vselect.setEmptyString(tr("No LiteLoader versions are currently available for Minecraft ") + m_profile->getComponentVersion("net.minecraft"));
vselect.setEmptyErrorString(tr("Couldn't load or download the LiteLoader version lists!"));
if (vselect.exec() && vselect.selectedVersion())
{
auto vsn = vselect.selectedVersion();
- m_inst->setComponentVersion("com.mumfrey.liteloader", vsn->descriptor());
- m_profile->reload();
+ m_profile->setComponentVersion("com.mumfrey.liteloader", vsn->descriptor());
+ m_profile->resolve(Net::Mode::Online);
// m_profile->installVersion(vselect.selectedVersion());
preselect(m_profile->rowCount(QModelIndex())-1);
m_container->refreshContainer();
@@ -441,7 +468,7 @@ void VersionPage::updateButtons(int row)
{
if(row == -1)
row = currentRow();
- auto patch = m_profile->versionPatch(row);
+ auto patch = m_profile->getComponent(row);
if (!patch)
{
ui->removeBtn->setDisabled(true);
@@ -470,14 +497,14 @@ void VersionPage::onGameUpdateError(QString error)
QMessageBox::Warning)->show();
}
-ProfilePatchPtr VersionPage::current()
+ComponentPtr VersionPage::current()
{
auto row = currentRow();
if(row < 0)
{
return nullptr;
}
- return m_profile->versionPatch(row);
+ return m_profile->getComponent(row);
}
int VersionPage::currentRow()
@@ -496,7 +523,7 @@ void VersionPage::on_customizeBtn_clicked()
{
return;
}
- auto patch = m_profile->versionPatch(version);
+ auto patch = m_profile->getComponent(version);
if(!patch->getVersionFile())
{
// TODO: wait for the update task to finish here...
diff --git a/application/pages/VersionPage.h b/application/pages/VersionPage.h
index 0ac10a14..809b2c0c 100644
--- a/application/pages/VersionPage.h
+++ b/application/pages/VersionPage.h
@@ -53,7 +53,6 @@ private slots:
void on_liteloaderBtn_clicked();
void on_reloadBtn_clicked();
void on_removeBtn_clicked();
- void on_resetOrderBtn_clicked();
void on_moveUpBtn_clicked();
void on_moveDownBtn_clicked();
void on_jarmodBtn_clicked();
@@ -68,7 +67,7 @@ private slots:
void on_changeVersionBtn_clicked();
private:
- ProfilePatchPtr current();
+ ComponentPtr current();
int currentRow();
void updateButtons(int row = -1);
void preselect(int row = 0);
diff --git a/application/pages/VersionPage.ui b/application/pages/VersionPage.ui
index afb33164..b6da3294 100644
--- a/application/pages/VersionPage.ui
+++ b/application/pages/VersionPage.ui
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>693</width>
- <height>788</height>
+ <height>833</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
@@ -218,16 +218,6 @@
</widget>
</item>
<item>
- <widget class="QPushButton" name="resetOrderBtn">
- <property name="toolTip">
- <string>Reset apply order of packages.</string>
- </property>
- <property name="text">
- <string>Reset order</string>
- </property>
- </widget>
- </item>
- <item>
<widget class="QPushButton" name="reloadBtn">
<property name="toolTip">
<string>Reload all packages.</string>
@@ -300,7 +290,6 @@
<tabstop>liteloaderBtn</tabstop>
<tabstop>modBtn</tabstop>
<tabstop>jarmodBtn</tabstop>
- <tabstop>resetOrderBtn</tabstop>
<tabstop>reloadBtn</tabstop>
</tabstops>
<resources/>
diff --git a/application/pages/global/PackagesPage.cpp b/application/pages/global/PackagesPage.cpp
index e15ddbab..7b117d0b 100644
--- a/application/pages/global/PackagesPage.cpp
+++ b/application/pages/global/PackagesPage.cpp
@@ -38,10 +38,17 @@ static QString formatRequires(const VersionPtr &version)
auto iter = reqs.begin();
while (iter != reqs.end())
{
- auto &uid = iter.key();
- auto &version = iter.value();
+ auto &uid = iter->uid;
+ auto &version = iter->equalsVersion;
const QString readable = ENV.metadataIndex()->hasUid(uid) ? ENV.metadataIndex()->get(uid)->humanReadable() : uid;
- lines.append(QString("%1 (%2)").arg(readable, version));
+ if(!version.isEmpty())
+ {
+ lines.append(QString("%1 (%2)").arg(readable, version));
+ }
+ else
+ {
+ lines.append(QString("%1").arg(readable));
+ }
iter++;
}
return lines.join('\n');
@@ -95,7 +102,7 @@ QIcon PackagesPage::icon() const
void PackagesPage::on_refreshIndexBtn_clicked()
{
- ENV.metadataIndex()->load();
+ ENV.metadataIndex()->load(Net::Mode::Online);
}
void PackagesPage::on_refreshFileBtn_clicked()
{
@@ -104,7 +111,7 @@ void PackagesPage::on_refreshFileBtn_clicked()
{
return;
}
- list->load();
+ list->load(Net::Mode::Online);
}
void PackagesPage::on_refreshVersionBtn_clicked()
{
@@ -113,7 +120,7 @@ void PackagesPage::on_refreshVersionBtn_clicked()
{
return;
}
- version->load();
+ version->load(Net::Mode::Online);
}
void PackagesPage::on_fileSearchEdit_textChanged(const QString &search)
@@ -156,7 +163,7 @@ void PackagesPage::updateCurrentVersionList(const QModelIndex &index)
ui->fileName->setText(list->name());
m_versionProxy->setSourceModel(list.get());
ui->refreshFileBtn->setText(tr("Refresh %1").arg(list->humanReadable()));
- list->load();
+ list->load(Net::Mode::Offline);
}
else
{
@@ -213,5 +220,5 @@ void PackagesPage::updateVersion()
void PackagesPage::opened()
{
- ENV.metadataIndex()->load();
+ ENV.metadataIndex()->load(Net::Mode::Offline);
}