NOISSUE gate new mods page behind cheat code

This commit is contained in:
Petr Mrázek 2018-08-01 20:05:18 +02:00
parent 9cc93ae81d
commit 6cee50eac6
4 changed files with 49 additions and 8 deletions

View File

@ -20,6 +20,7 @@ struct Env::Private
std::shared_ptr<IIconList> m_iconlist; std::shared_ptr<IIconList> m_iconlist;
shared_qobject_ptr<Meta::Index> m_metadataIndex; shared_qobject_ptr<Meta::Index> m_metadataIndex;
QString m_jarsPath; QString m_jarsPath;
QSet<QString> m_features;
}; };
static Env * instance; static Env * instance;
@ -179,3 +180,30 @@ void Env::setJarsPath(const QString& path)
{ {
d->m_jarsPath = path; d->m_jarsPath = path;
} }
void Env::enableFeature(const QString& featureName, bool state)
{
if(state)
{
d->m_features.insert(featureName);
}
else
{
d->m_features.remove(featureName);
}
}
bool Env::isFeatureEnabled(const QString& featureName) const
{
return d->m_features.contains(featureName);
}
void Env::getEnabledFeatures(QSet<QString>& features) const
{
features = d->m_features;
}
void Env::setEnabledFeatures(const QSet<QString>& features) const
{
d->m_features = features;
}

View File

@ -54,6 +54,12 @@ public:
QString getJarsPath(); QString getJarsPath();
void setJarsPath(const QString & path); void setJarsPath(const QString & path);
bool isFeatureEnabled(const QString & featureName) const;
void enableFeature(const QString & featureName, bool state = true);
void getEnabledFeatures(QSet<QString> & features) const;
void setEnabledFeatures(const QSet<QString> & features) const;
protected: protected:
Private * d; Private * d;
}; };

View File

@ -18,6 +18,7 @@
#include "pages/instance/WorldListPage.h" #include "pages/instance/WorldListPage.h"
#include "pages/instance/ServersPage.h" #include "pages/instance/ServersPage.h"
#include "Env.h"
class InstancePageProvider : public QObject, public BasePageProvider class InstancePageProvider : public QObject, public BasePageProvider
{ {
@ -37,14 +38,19 @@ public:
if(onesix) if(onesix)
{ {
values.append(new VersionPage(onesix.get())); values.append(new VersionPage(onesix.get()));
if(ENV.isFeatureEnabled("NewModsPage"))
{
auto modsPage = new NewModFolderPage(onesix.get(), onesix->modsModel(), "mods", "loadermods", tr("Mods"), "Mods-page");
modsPage->setFilter("%1 (*.zip *.jar *.litemod)");
values.append(modsPage);
}
else
{
auto modsPage = new ModFolderPage(onesix.get(), onesix->loaderModList(), "mods", "loadermods", tr("Loader mods"), "Loader-mods"); auto modsPage = new ModFolderPage(onesix.get(), onesix->loaderModList(), "mods", "loadermods", tr("Loader mods"), "Loader-mods");
modsPage->setFilter("%1 (*.zip *.jar *.litemod)"); modsPage->setFilter("%1 (*.zip *.jar *.litemod)");
values.append(modsPage); values.append(modsPage);
/* }
auto modsPage2 = new NewModFolderPage(onesix.get(), onesix->modsModel(), "mods", "mods", tr("Mods"), "Mods");
modsPage2->setFilter("%1 (*.zip *.jar *.litemod)");
values.append(modsPage2);
*/
values.append(new CoreModFolderPage(onesix.get(), onesix->coreModList(), "coremods", "coremods", tr("Core mods"), "Core-mods")); values.append(new CoreModFolderPage(onesix.get(), onesix->coreModList(), "coremods", "coremods", tr("Core mods"), "Core-mods"));
values.append(new ResourcePackPage(onesix.get())); values.append(new ResourcePackPage(onesix.get()));
values.append(new TexturePackPage(onesix.get())); values.append(new TexturePackPage(onesix.get()));

View File

@ -823,6 +823,7 @@ MainWindow::~MainWindow()
void MainWindow::konamiTriggered() void MainWindow::konamiTriggered()
{ {
ENV.enableFeature("NewModsPage");
qDebug() << "Super Secret Mode ACTIVATED!"; qDebug() << "Super Secret Mode ACTIVATED!";
} }