GH-994 hopefully fix issue with people still using jar mods
Added an 'add mods' button to the version page Add jar mods now has a very angry nag dialog until it's used successfully Buttons on version page are rearranged to deemphasize jar mods
This commit is contained in:
@ -19,6 +19,8 @@
|
||||
#include <QIcon>
|
||||
#include <memory>
|
||||
|
||||
#include "BasePageContainer.h"
|
||||
|
||||
class BasePage
|
||||
{
|
||||
public:
|
||||
@ -31,6 +33,9 @@ public:
|
||||
virtual QString helpPage() const { return QString(); }
|
||||
virtual void opened() {}
|
||||
virtual void closed() {}
|
||||
virtual void setParentContainer(BasePageContainer *) {};
|
||||
|
||||
public:
|
||||
int stackIndex = -1;
|
||||
int listIndex = -1;
|
||||
};
|
||||
|
8
application/pages/BasePageContainer.h
Normal file
8
application/pages/BasePageContainer.h
Normal file
@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
class BasePageContainer
|
||||
{
|
||||
public:
|
||||
virtual ~BasePageContainer(){};
|
||||
virtual bool selectPage(QString pageId) = 0;
|
||||
};
|
@ -58,6 +58,11 @@ bool VersionPage::shouldDisplay() const
|
||||
return !m_inst->isRunning();
|
||||
}
|
||||
|
||||
void VersionPage::setParentContainer(BasePageContainer * container)
|
||||
{
|
||||
m_container = container;
|
||||
}
|
||||
|
||||
VersionPage::VersionPage(OneSixInstance *inst, QWidget *parent)
|
||||
: QWidget(parent), ui(new Ui::VersionPage), m_inst(inst)
|
||||
{
|
||||
@ -145,12 +150,45 @@ void VersionPage::on_removeBtn_clicked()
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
void VersionPage::on_modBtn_clicked()
|
||||
{
|
||||
if(m_container)
|
||||
{
|
||||
m_container->selectPage("mods");
|
||||
}
|
||||
}
|
||||
|
||||
void VersionPage::on_jarmodBtn_clicked()
|
||||
{
|
||||
bool nagShown = false;
|
||||
auto traits = m_version->traits;
|
||||
if (!traits.contains("legacyLaunch") && !traits.contains("alphaLaunch"))
|
||||
{
|
||||
// not legacy launch... nag
|
||||
auto seenNag = MMC->settings()->get("JarModNagSeen").toBool();
|
||||
if(!seenNag)
|
||||
{
|
||||
auto result = QMessageBox::question(this,
|
||||
tr("Are you sure?"),
|
||||
tr("This will add mods directly to the Minecraft jar.\n"
|
||||
"Unless you KNOW that this is what NEEDS to be done, you should just use the mods folder (Loader mods).\n"
|
||||
"\n"
|
||||
"Do you want to continue?"),
|
||||
tr("I understand, continue."), tr("Cancel"), QString(), 1, 1
|
||||
);
|
||||
if(result != 0)
|
||||
return;
|
||||
nagShown = true;
|
||||
}
|
||||
}
|
||||
auto list = GuiUtil::BrowseForMods("jarmod", tr("Select jar mods"), tr("Minecraft.jar mods (*.zip *.jar)"), this->parentWidget());
|
||||
if(!list.empty())
|
||||
{
|
||||
m_version->installJarMods(list);
|
||||
if(nagShown)
|
||||
{
|
||||
MMC->settings()->set("JarModNagSeen", QVariant(true));
|
||||
}
|
||||
}
|
||||
updateButtons();
|
||||
}
|
||||
|
@ -47,6 +47,8 @@ public:
|
||||
}
|
||||
virtual bool shouldDisplay() const;
|
||||
|
||||
virtual void setParentContainer(BasePageContainer *);
|
||||
|
||||
private slots:
|
||||
void on_forgeBtn_clicked();
|
||||
void on_liteloaderBtn_clicked();
|
||||
@ -58,6 +60,7 @@ private slots:
|
||||
void on_jarmodBtn_clicked();
|
||||
void on_revertBtn_clicked();
|
||||
void on_editBtn_clicked();
|
||||
void on_modBtn_clicked();
|
||||
void on_customizeBtn_clicked();
|
||||
|
||||
void updateVersionControls();
|
||||
@ -80,6 +83,7 @@ private:
|
||||
std::shared_ptr<MinecraftProfile> m_version;
|
||||
OneSixInstance *m_inst;
|
||||
int currentIdx = 0;
|
||||
BasePageContainer * m_container = nullptr;
|
||||
|
||||
public slots:
|
||||
void versionCurrent(const QModelIndex ¤t, const QModelIndex &previous);
|
||||
|
@ -181,12 +181,12 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="jarmodBtn">
|
||||
<widget class="QPushButton" name="modBtn">
|
||||
<property name="toolTip">
|
||||
<string>Add a mod into the Minecraft jar file.</string>
|
||||
<string>Install normal mods.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add jar mod</string>
|
||||
<string>Install mods</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -196,13 +196,23 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>List</string>
|
||||
<string>Advanced</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="jarmodBtn">
|
||||
<property name="toolTip">
|
||||
<string>Add a mod into the Minecraft jar file.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add jar mod</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="resetOrderBtn">
|
||||
<property name="toolTip">
|
||||
@ -230,8 +240,8 @@
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
<width>111</width>
|
||||
<height>13</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
@ -269,6 +279,7 @@
|
||||
<tabstop>revertBtn</tabstop>
|
||||
<tabstop>forgeBtn</tabstop>
|
||||
<tabstop>liteloaderBtn</tabstop>
|
||||
<tabstop>modBtn</tabstop>
|
||||
<tabstop>jarmodBtn</tabstop>
|
||||
<tabstop>resetOrderBtn</tabstop>
|
||||
<tabstop>reloadBtn</tabstop>
|
||||
|
Reference in New Issue
Block a user