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:
parent
a98e1df10c
commit
b7f8241968
@ -162,6 +162,7 @@ SET(MULTIMC_SOURCES
|
|||||||
|
|
||||||
# GUI - page dialog pages
|
# GUI - page dialog pages
|
||||||
pages/BasePage.h
|
pages/BasePage.h
|
||||||
|
pages/BasePageContainer.h
|
||||||
pages/VersionPage.cpp
|
pages/VersionPage.cpp
|
||||||
pages/VersionPage.h
|
pages/VersionPage.h
|
||||||
pages/TexturePackPage.h
|
pages/TexturePackPage.h
|
||||||
|
@ -495,6 +495,9 @@ void MultiMC::initGlobalSettings(bool test_mode)
|
|||||||
m_settings->registerSetting("SettingsGeometry", "");
|
m_settings->registerSetting("SettingsGeometry", "");
|
||||||
|
|
||||||
m_settings->registerSetting("PagedGeometry", "");
|
m_settings->registerSetting("PagedGeometry", "");
|
||||||
|
|
||||||
|
// Jar mod nag dialog in version page
|
||||||
|
m_settings->registerSetting("JarModNagSeen", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<LWJGLVersionList> MultiMC::lwjgllist()
|
std::shared_ptr<LWJGLVersionList> MultiMC::lwjgllist()
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#include "BasePageContainer.h"
|
||||||
|
|
||||||
class BasePage
|
class BasePage
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -31,6 +33,9 @@ public:
|
|||||||
virtual QString helpPage() const { return QString(); }
|
virtual QString helpPage() const { return QString(); }
|
||||||
virtual void opened() {}
|
virtual void opened() {}
|
||||||
virtual void closed() {}
|
virtual void closed() {}
|
||||||
|
virtual void setParentContainer(BasePageContainer *) {};
|
||||||
|
|
||||||
|
public:
|
||||||
int stackIndex = -1;
|
int stackIndex = -1;
|
||||||
int listIndex = -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();
|
return !m_inst->isRunning();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VersionPage::setParentContainer(BasePageContainer * container)
|
||||||
|
{
|
||||||
|
m_container = container;
|
||||||
|
}
|
||||||
|
|
||||||
VersionPage::VersionPage(OneSixInstance *inst, QWidget *parent)
|
VersionPage::VersionPage(OneSixInstance *inst, QWidget *parent)
|
||||||
: QWidget(parent), ui(new Ui::VersionPage), m_inst(inst)
|
: QWidget(parent), ui(new Ui::VersionPage), m_inst(inst)
|
||||||
{
|
{
|
||||||
@ -145,12 +150,45 @@ void VersionPage::on_removeBtn_clicked()
|
|||||||
updateButtons();
|
updateButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VersionPage::on_modBtn_clicked()
|
||||||
|
{
|
||||||
|
if(m_container)
|
||||||
|
{
|
||||||
|
m_container->selectPage("mods");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void VersionPage::on_jarmodBtn_clicked()
|
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());
|
auto list = GuiUtil::BrowseForMods("jarmod", tr("Select jar mods"), tr("Minecraft.jar mods (*.zip *.jar)"), this->parentWidget());
|
||||||
if(!list.empty())
|
if(!list.empty())
|
||||||
{
|
{
|
||||||
m_version->installJarMods(list);
|
m_version->installJarMods(list);
|
||||||
|
if(nagShown)
|
||||||
|
{
|
||||||
|
MMC->settings()->set("JarModNagSeen", QVariant(true));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
updateButtons();
|
updateButtons();
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,8 @@ public:
|
|||||||
}
|
}
|
||||||
virtual bool shouldDisplay() const;
|
virtual bool shouldDisplay() const;
|
||||||
|
|
||||||
|
virtual void setParentContainer(BasePageContainer *);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_forgeBtn_clicked();
|
void on_forgeBtn_clicked();
|
||||||
void on_liteloaderBtn_clicked();
|
void on_liteloaderBtn_clicked();
|
||||||
@ -58,6 +60,7 @@ private slots:
|
|||||||
void on_jarmodBtn_clicked();
|
void on_jarmodBtn_clicked();
|
||||||
void on_revertBtn_clicked();
|
void on_revertBtn_clicked();
|
||||||
void on_editBtn_clicked();
|
void on_editBtn_clicked();
|
||||||
|
void on_modBtn_clicked();
|
||||||
void on_customizeBtn_clicked();
|
void on_customizeBtn_clicked();
|
||||||
|
|
||||||
void updateVersionControls();
|
void updateVersionControls();
|
||||||
@ -80,6 +83,7 @@ private:
|
|||||||
std::shared_ptr<MinecraftProfile> m_version;
|
std::shared_ptr<MinecraftProfile> m_version;
|
||||||
OneSixInstance *m_inst;
|
OneSixInstance *m_inst;
|
||||||
int currentIdx = 0;
|
int currentIdx = 0;
|
||||||
|
BasePageContainer * m_container = nullptr;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void versionCurrent(const QModelIndex ¤t, const QModelIndex &previous);
|
void versionCurrent(const QModelIndex ¤t, const QModelIndex &previous);
|
||||||
|
@ -181,12 +181,12 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="jarmodBtn">
|
<widget class="QPushButton" name="modBtn">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Add a mod into the Minecraft jar file.</string>
|
<string>Install normal mods.</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Add jar mod</string>
|
<string>Install mods</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -196,13 +196,23 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_5">
|
<widget class="QLabel" name="label_5">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>List</string>
|
<string>Advanced</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignCenter</set>
|
<set>Qt::AlignCenter</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
<item>
|
||||||
<widget class="QPushButton" name="resetOrderBtn">
|
<widget class="QPushButton" name="resetOrderBtn">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
@ -230,8 +240,8 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>20</width>
|
<width>111</width>
|
||||||
<height>40</height>
|
<height>13</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
@ -269,6 +279,7 @@
|
|||||||
<tabstop>revertBtn</tabstop>
|
<tabstop>revertBtn</tabstop>
|
||||||
<tabstop>forgeBtn</tabstop>
|
<tabstop>forgeBtn</tabstop>
|
||||||
<tabstop>liteloaderBtn</tabstop>
|
<tabstop>liteloaderBtn</tabstop>
|
||||||
|
<tabstop>modBtn</tabstop>
|
||||||
<tabstop>jarmodBtn</tabstop>
|
<tabstop>jarmodBtn</tabstop>
|
||||||
<tabstop>resetOrderBtn</tabstop>
|
<tabstop>resetOrderBtn</tabstop>
|
||||||
<tabstop>reloadBtn</tabstop>
|
<tabstop>reloadBtn</tabstop>
|
||||||
|
@ -68,6 +68,7 @@ PageContainer::PageContainer(BasePageProviderPtr pageProvider, QString defaultId
|
|||||||
{
|
{
|
||||||
page->stackIndex = m_pageStack->addWidget(dynamic_cast<QWidget *>(page));
|
page->stackIndex = m_pageStack->addWidget(dynamic_cast<QWidget *>(page));
|
||||||
page->listIndex = counter;
|
page->listIndex = counter;
|
||||||
|
page->setParentContainer(this);
|
||||||
counter++;
|
counter++;
|
||||||
if (firstIndex == -1)
|
if (firstIndex == -1)
|
||||||
{
|
{
|
||||||
@ -87,8 +88,13 @@ PageContainer::PageContainer(BasePageProviderPtr pageProvider, QString defaultId
|
|||||||
this, SLOT(currentChanged(QModelIndex)));
|
this, SLOT(currentChanged(QModelIndex)));
|
||||||
m_pageStack->setStackingMode(QStackedLayout::StackOne);
|
m_pageStack->setStackingMode(QStackedLayout::StackOne);
|
||||||
m_pageList->setFocus();
|
m_pageList->setFocus();
|
||||||
|
selectPage(defaultId);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PageContainer::selectPage(QString pageId)
|
||||||
|
{
|
||||||
// now find what we want to have selected...
|
// now find what we want to have selected...
|
||||||
auto page = m_model->findPageEntryById(defaultId);
|
auto page = m_model->findPageEntryById(pageId);
|
||||||
QModelIndex index;
|
QModelIndex index;
|
||||||
if (page)
|
if (page)
|
||||||
{
|
{
|
||||||
@ -99,7 +105,11 @@ PageContainer::PageContainer(BasePageProviderPtr pageProvider, QString defaultId
|
|||||||
index = m_proxyModel->index(0, 0);
|
index = m_proxyModel->index(0, 0);
|
||||||
}
|
}
|
||||||
if (index.isValid())
|
if (index.isValid())
|
||||||
|
{
|
||||||
m_pageList->setCurrentIndex(index);
|
m_pageList->setCurrentIndex(index);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PageContainer::createUI()
|
void PageContainer::createUI()
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include <QModelIndex>
|
#include <QModelIndex>
|
||||||
|
|
||||||
#include "pages/BasePageProvider.h"
|
#include "pages/BasePageProvider.h"
|
||||||
|
#include "pages/BasePageContainer.h"
|
||||||
|
|
||||||
class QLayout;
|
class QLayout;
|
||||||
class IconLabel;
|
class IconLabel;
|
||||||
@ -30,7 +31,7 @@ class QLineEdit;
|
|||||||
class QStackedLayout;
|
class QStackedLayout;
|
||||||
class QGridLayout;
|
class QGridLayout;
|
||||||
|
|
||||||
class PageContainer : public QWidget
|
class PageContainer : public QWidget, public BasePageContainer
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
@ -42,6 +43,8 @@ public:
|
|||||||
void addButtons(QLayout * buttons);
|
void addButtons(QLayout * buttons);
|
||||||
bool requestClose(QCloseEvent *event);
|
bool requestClose(QCloseEvent *event);
|
||||||
|
|
||||||
|
virtual bool selectPage(QString pageId) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void createUI();
|
void createUI();
|
||||||
private
|
private
|
||||||
|
Loading…
Reference in New Issue
Block a user