Merge branch 'develop' of https://github.com/PrismLauncher/PrismLauncher into release_order
This commit is contained in:
commit
ac38585a2a
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "ShaderPack.h"
|
#include "ShaderPack.h"
|
||||||
|
|
||||||
#include "minecraft/mod/tasks/LocalShaderPackParseTask.h"
|
#include <QRegularExpression>
|
||||||
|
|
||||||
void ShaderPack::setPackFormat(ShaderPackFormat new_format)
|
void ShaderPack::setPackFormat(ShaderPackFormat new_format)
|
||||||
{
|
{
|
||||||
@ -35,3 +35,8 @@ bool ShaderPack::valid() const
|
|||||||
{
|
{
|
||||||
return m_pack_format != ShaderPackFormat::INVALID;
|
return m_pack_format != ShaderPackFormat::INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ShaderPack::applyFilter(QRegularExpression filter) const
|
||||||
|
{
|
||||||
|
return valid() && Resource::applyFilter(filter);
|
||||||
|
}
|
||||||
|
@ -54,6 +54,7 @@ class ShaderPack : public Resource {
|
|||||||
void setPackFormat(ShaderPackFormat new_format);
|
void setPackFormat(ShaderPackFormat new_format);
|
||||||
|
|
||||||
bool valid() const override;
|
bool valid() const override;
|
||||||
|
[[nodiscard]] bool applyFilter(QRegularExpression filter) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
mutable QMutex m_data_lock;
|
mutable QMutex m_data_lock;
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ResourceFolderModel.h"
|
#include "ResourceFolderModel.h"
|
||||||
|
#include "minecraft/mod/ShaderPack.h"
|
||||||
|
#include "minecraft/mod/tasks/BasicFolderLoadTask.h"
|
||||||
|
#include "minecraft/mod/tasks/LocalShaderPackParseTask.h"
|
||||||
|
|
||||||
class ShaderPackFolderModel : public ResourceFolderModel {
|
class ShaderPackFolderModel : public ResourceFolderModel {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -9,4 +12,14 @@ class ShaderPackFolderModel : public ResourceFolderModel {
|
|||||||
explicit ShaderPackFolderModel(const QString& dir, BaseInstance* instance) : ResourceFolderModel(QDir(dir), instance) {}
|
explicit ShaderPackFolderModel(const QString& dir, BaseInstance* instance) : ResourceFolderModel(QDir(dir), instance) {}
|
||||||
|
|
||||||
virtual QString id() const override { return "shaderpacks"; }
|
virtual QString id() const override { return "shaderpacks"; }
|
||||||
|
|
||||||
|
[[nodiscard]] Task* createUpdateTask() override
|
||||||
|
{
|
||||||
|
return new BasicFolderLoadTask(m_dir, [](QFileInfo const& entry) { return makeShared<ShaderPack>(entry); });
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] Task* createParseTask(Resource& resource) override
|
||||||
|
{
|
||||||
|
return new LocalShaderPackParseTask(m_next_resolution_ticket, static_cast<ShaderPack&>(resource));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
@ -363,7 +363,7 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWi
|
|||||||
// Shouldn't have to use lambdas here like this, but if I don't, the compiler throws a fit.
|
// Shouldn't have to use lambdas here like this, but if I don't, the compiler throws a fit.
|
||||||
// Template hell sucks...
|
// Template hell sucks...
|
||||||
connect(APPLICATION->accounts().get(), &AccountList::defaultAccountChanged, [this] { defaultAccountChanged(); });
|
connect(APPLICATION->accounts().get(), &AccountList::defaultAccountChanged, [this] { defaultAccountChanged(); });
|
||||||
connect(APPLICATION->accounts().get(), &AccountList::listChanged, [this] { repopulateAccountsMenu(); });
|
connect(APPLICATION->accounts().get(), &AccountList::listChanged, [this] { defaultAccountChanged(); });
|
||||||
|
|
||||||
// Show initial account
|
// Show initial account
|
||||||
defaultAccountChanged();
|
defaultAccountChanged();
|
||||||
|
@ -206,6 +206,14 @@ void ModFolderPage::installMods()
|
|||||||
|
|
||||||
void ModFolderPage::updateMods()
|
void ModFolderPage::updateMods()
|
||||||
{
|
{
|
||||||
|
if (m_instance->typeName() != "Minecraft")
|
||||||
|
return; // this is a null instance or a legacy instance
|
||||||
|
|
||||||
|
auto profile = static_cast<MinecraftInstance*>(m_instance)->getPackProfile();
|
||||||
|
if (!profile->getModLoaders().has_value()) {
|
||||||
|
QMessageBox::critical(this, tr("Error"), tr("Please install a mod loader first!"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
auto selection = m_filterModel->mapSelectionToSource(ui->treeView->selectionModel()->selection()).indexes();
|
auto selection = m_filterModel->mapSelectionToSource(ui->treeView->selectionModel()->selection()).indexes();
|
||||||
|
|
||||||
auto mods_list = m_model->selectedMods(selection);
|
auto mods_list = m_model->selectedMods(selection);
|
||||||
|
Loading…
Reference in New Issue
Block a user