nilmods instance page
mostly copied from the coremod page impl Signed-off-by: kumquat-ir <66188216+kumquat-ir@users.noreply.github.com>
This commit is contained in:
parent
f5f2d33f93
commit
7896dd19c1
@ -39,6 +39,7 @@ public:
|
||||
modsPage->setFilter("%1 (*.zip *.jar *.litemod *.nilmod)");
|
||||
values.append(modsPage);
|
||||
values.append(new CoreModFolderPage(onesix.get(), onesix->coreModList()));
|
||||
values.append(new NilModFolderPage(onesix.get(), onesix->nilModList()));
|
||||
values.append(new ResourcePackPage(onesix.get(), onesix->resourcePackList()));
|
||||
values.append(new TexturePackPage(onesix.get(), onesix->texturePackList()));
|
||||
values.append(new ShaderPackPage(onesix.get(), onesix->shaderPackList()));
|
||||
|
@ -290,6 +290,11 @@ QString MinecraftInstance::coreModsDir() const
|
||||
return FS::PathCombine(gameRoot(), "coremods");
|
||||
}
|
||||
|
||||
QString MinecraftInstance::nilModsDir() const
|
||||
{
|
||||
return FS::PathCombine(gameRoot(), "nilmods");
|
||||
}
|
||||
|
||||
QString MinecraftInstance::resourcePacksDir() const
|
||||
{
|
||||
return FS::PathCombine(gameRoot(), "resourcepacks");
|
||||
@ -1125,6 +1130,18 @@ std::shared_ptr<ModFolderModel> MinecraftInstance::coreModList() const
|
||||
return m_core_mod_list;
|
||||
}
|
||||
|
||||
std::shared_ptr<ModFolderModel> MinecraftInstance::nilModList() const
|
||||
{
|
||||
if (!m_nil_mod_list)
|
||||
{
|
||||
bool is_indexed = !APPLICATION->settings()->get("ModMetadataDisabled").toBool();
|
||||
m_nil_mod_list.reset(new ModFolderModel(nilModsDir(), is_indexed));
|
||||
m_nil_mod_list->disableInteraction(isRunning());
|
||||
connect(this, &BaseInstance::runningStatusChanged, m_nil_mod_list.get(), &ModFolderModel::disableInteraction);
|
||||
}
|
||||
return m_nil_mod_list;
|
||||
}
|
||||
|
||||
std::shared_ptr<ResourcePackFolderModel> MinecraftInstance::resourcePackList() const
|
||||
{
|
||||
if (!m_resource_pack_list)
|
||||
|
@ -84,6 +84,7 @@ public:
|
||||
QString shaderPacksDir() const;
|
||||
QString modsRoot() const override;
|
||||
QString coreModsDir() const;
|
||||
QString nilModsDir() const;
|
||||
QString modsCacheLocation() const;
|
||||
QString libDir() const;
|
||||
QString worldDir() const;
|
||||
@ -116,6 +117,7 @@ public:
|
||||
////// Mod Lists //////
|
||||
std::shared_ptr<ModFolderModel> loaderModList() const;
|
||||
std::shared_ptr<ModFolderModel> coreModList() const;
|
||||
std::shared_ptr<ModFolderModel> nilModList() const;
|
||||
std::shared_ptr<ResourcePackFolderModel> resourcePackList() const;
|
||||
std::shared_ptr<TexturePackFolderModel> texturePackList() const;
|
||||
std::shared_ptr<ShaderPackFolderModel> shaderPackList() const;
|
||||
@ -170,6 +172,7 @@ protected: // data
|
||||
std::shared_ptr<PackProfile> m_components;
|
||||
mutable std::shared_ptr<ModFolderModel> m_loader_mod_list;
|
||||
mutable std::shared_ptr<ModFolderModel> m_core_mod_list;
|
||||
mutable std::shared_ptr<ModFolderModel> m_nil_mod_list;
|
||||
mutable std::shared_ptr<ResourcePackFolderModel> m_resource_pack_list;
|
||||
mutable std::shared_ptr<ShaderPackFolderModel> m_shader_pack_list;
|
||||
mutable std::shared_ptr<TexturePackFolderModel> m_texture_pack_list;
|
||||
|
@ -55,6 +55,12 @@ void ScanModFolders::executeTask()
|
||||
if(!cores->update()) {
|
||||
m_coreModsDone = true;
|
||||
}
|
||||
|
||||
auto nils = m_inst->nilModList();
|
||||
connect(nils.get(), &ModFolderModel::updateFinished, this, &ScanModFolders::nilModsDone);
|
||||
if(!nils->update()) {
|
||||
m_nilModsDone = true;
|
||||
}
|
||||
checkDone();
|
||||
}
|
||||
|
||||
@ -70,9 +76,15 @@ void ScanModFolders::coreModsDone()
|
||||
checkDone();
|
||||
}
|
||||
|
||||
void ScanModFolders::nilModsDone()
|
||||
{
|
||||
m_nilModsDone = true;
|
||||
checkDone();
|
||||
}
|
||||
|
||||
void ScanModFolders::checkDone()
|
||||
{
|
||||
if(m_modsDone && m_coreModsDone) {
|
||||
if(m_modsDone && m_coreModsDone && m_nilModsDone) {
|
||||
emitSucceeded();
|
||||
}
|
||||
}
|
||||
|
@ -33,10 +33,12 @@ public:
|
||||
private slots:
|
||||
void coreModsDone();
|
||||
void modsDone();
|
||||
void nilModsDone();
|
||||
private:
|
||||
void checkDone();
|
||||
|
||||
private: // DATA
|
||||
bool m_modsDone = false;
|
||||
bool m_nilModsDone = false;
|
||||
bool m_coreModsDone = false;
|
||||
};
|
||||
|
@ -273,3 +273,12 @@ bool CoreModFolderPage::shouldDisplay() const
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
NilModFolderPage::NilModFolderPage(BaseInstance* inst, std::shared_ptr<ModFolderModel> mods, QWidget* parent)
|
||||
: ModFolderPage(inst, mods, parent)
|
||||
{}
|
||||
|
||||
bool NilModFolderPage::shouldDisplay() const
|
||||
{
|
||||
return !m_model->dir().isEmpty();
|
||||
}
|
||||
|
@ -81,3 +81,16 @@ class CoreModFolderPage : public ModFolderPage {
|
||||
|
||||
virtual bool shouldDisplay() const override;
|
||||
};
|
||||
|
||||
class NilModFolderPage : public ModFolderPage {
|
||||
public:
|
||||
explicit NilModFolderPage(BaseInstance* inst, std::shared_ptr<ModFolderModel> mods, QWidget* parent = 0);
|
||||
virtual ~NilModFolderPage() = default;
|
||||
|
||||
virtual QString displayName() const override { return tr("Nilmods"); }
|
||||
virtual QIcon icon() const override { return APPLICATION->getThemedIcon("coremods"); }
|
||||
virtual QString id() const override { return "nilmods"; }
|
||||
virtual QString helpPage() const override { return "Nil-mods"; }
|
||||
|
||||
virtual bool shouldDisplay() const override;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user