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
|
||||
pages/BasePage.h
|
||||
pages/BasePageContainer.h
|
||||
pages/VersionPage.cpp
|
||||
pages/VersionPage.h
|
||||
pages/TexturePackPage.h
|
||||
|
@ -495,6 +495,9 @@ void MultiMC::initGlobalSettings(bool test_mode)
|
||||
m_settings->registerSetting("SettingsGeometry", "");
|
||||
|
||||
m_settings->registerSetting("PagedGeometry", "");
|
||||
|
||||
// Jar mod nag dialog in version page
|
||||
m_settings->registerSetting("JarModNagSeen", false);
|
||||
}
|
||||
|
||||
std::shared_ptr<LWJGLVersionList> MultiMC::lwjgllist()
|
||||
|
@ -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>
|
||||
|
@ -68,6 +68,7 @@ PageContainer::PageContainer(BasePageProviderPtr pageProvider, QString defaultId
|
||||
{
|
||||
page->stackIndex = m_pageStack->addWidget(dynamic_cast<QWidget *>(page));
|
||||
page->listIndex = counter;
|
||||
page->setParentContainer(this);
|
||||
counter++;
|
||||
if (firstIndex == -1)
|
||||
{
|
||||
@ -87,8 +88,13 @@ PageContainer::PageContainer(BasePageProviderPtr pageProvider, QString defaultId
|
||||
this, SLOT(currentChanged(QModelIndex)));
|
||||
m_pageStack->setStackingMode(QStackedLayout::StackOne);
|
||||
m_pageList->setFocus();
|
||||
selectPage(defaultId);
|
||||
}
|
||||
|
||||
bool PageContainer::selectPage(QString pageId)
|
||||
{
|
||||
// now find what we want to have selected...
|
||||
auto page = m_model->findPageEntryById(defaultId);
|
||||
auto page = m_model->findPageEntryById(pageId);
|
||||
QModelIndex index;
|
||||
if (page)
|
||||
{
|
||||
@ -99,7 +105,11 @@ PageContainer::PageContainer(BasePageProviderPtr pageProvider, QString defaultId
|
||||
index = m_proxyModel->index(0, 0);
|
||||
}
|
||||
if (index.isValid())
|
||||
{
|
||||
m_pageList->setCurrentIndex(index);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void PageContainer::createUI()
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <QModelIndex>
|
||||
|
||||
#include "pages/BasePageProvider.h"
|
||||
#include "pages/BasePageContainer.h"
|
||||
|
||||
class QLayout;
|
||||
class IconLabel;
|
||||
@ -30,7 +31,7 @@ class QLineEdit;
|
||||
class QStackedLayout;
|
||||
class QGridLayout;
|
||||
|
||||
class PageContainer : public QWidget
|
||||
class PageContainer : public QWidget, public BasePageContainer
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@ -42,6 +43,8 @@ public:
|
||||
void addButtons(QLayout * buttons);
|
||||
bool requestClose(QCloseEvent *event);
|
||||
|
||||
virtual bool selectPage(QString pageId) override;
|
||||
|
||||
private:
|
||||
void createUI();
|
||||
private
|
||||
|
Loading…
Reference in New Issue
Block a user