summaryrefslogtreecommitdiffstats
path: root/application/pages
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2015-05-29 02:22:02 +0200
committerPetr Mrázek <peterix@gmail.com>2015-05-29 02:22:02 +0200
commitb7f8241968b4cf684c31c575a6159d577faab76a (patch)
treed88807c22e41d4676f66c193eced467074ac7d55 /application/pages
parenta98e1df10cef774672e919497c43373e86c77f97 (diff)
downloadMultiMC-b7f8241968b4cf684c31c575a6159d577faab76a.tar
MultiMC-b7f8241968b4cf684c31c575a6159d577faab76a.tar.gz
MultiMC-b7f8241968b4cf684c31c575a6159d577faab76a.tar.lz
MultiMC-b7f8241968b4cf684c31c575a6159d577faab76a.tar.xz
MultiMC-b7f8241968b4cf684c31c575a6159d577faab76a.zip
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
Diffstat (limited to 'application/pages')
-rw-r--r--application/pages/BasePage.h5
-rw-r--r--application/pages/BasePageContainer.h8
-rw-r--r--application/pages/VersionPage.cpp38
-rw-r--r--application/pages/VersionPage.h4
-rw-r--r--application/pages/VersionPage.ui23
5 files changed, 72 insertions, 6 deletions
diff --git a/application/pages/BasePage.h b/application/pages/BasePage.h
index ecf0692c..8b90358c 100644
--- a/application/pages/BasePage.h
+++ b/application/pages/BasePage.h
@@ -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;
};
diff --git a/application/pages/BasePageContainer.h b/application/pages/BasePageContainer.h
new file mode 100644
index 00000000..5982ad76
--- /dev/null
+++ b/application/pages/BasePageContainer.h
@@ -0,0 +1,8 @@
+#pragma once
+
+class BasePageContainer
+{
+public:
+ virtual ~BasePageContainer(){};
+ virtual bool selectPage(QString pageId) = 0;
+};
diff --git a/application/pages/VersionPage.cpp b/application/pages/VersionPage.cpp
index 831408f6..cbb5c107 100644
--- a/application/pages/VersionPage.cpp
+++ b/application/pages/VersionPage.cpp
@@ -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();
}
diff --git a/application/pages/VersionPage.h b/application/pages/VersionPage.h
index 49837f80..bd22e140 100644
--- a/application/pages/VersionPage.h
+++ b/application/pages/VersionPage.h
@@ -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 &current, const QModelIndex &previous);
diff --git a/application/pages/VersionPage.ui b/application/pages/VersionPage.ui
index 1216229f..e1c23197 100644
--- a/application/pages/VersionPage.ui
+++ b/application/pages/VersionPage.ui
@@ -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,7 +196,7 @@
<item>
<widget class="QLabel" name="label_5">
<property name="text">
- <string>List</string>
+ <string>Advanced</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
@@ -204,6 +204,16 @@
</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">
<string>Reset apply order of packages.</string>
@@ -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>