NOISSUE preview of LWJGL version changing

It still needs work - some LWJGL versions are exclusive to macOS.
This has to be encoded in the json.
This commit is contained in:
Petr Mrázek
2017-03-30 01:05:58 +02:00
parent 53188386b8
commit 2ac0edbbdb
10 changed files with 143 additions and 36 deletions

View File

@ -1,3 +1,6 @@
#include <meta/VersionList.h>
#include <meta/Index.h>
#include <Env.h>
#include "ProfilePatch.h"
#include "meta/Version.h"
@ -35,6 +38,15 @@ std::shared_ptr<class VersionFile> ProfilePatch::getVersionFile()
return m_file;
}
std::shared_ptr<class Meta::VersionList> ProfilePatch::getVersionList()
{
if(m_metaVersion)
{
return ENV.metadataIndex()->get(m_metaVersion->uid());
}
return nullptr;
}
int ProfilePatch::getOrder()
{
if(m_orderOverride)
@ -113,6 +125,15 @@ bool ProfilePatch::isMoveable()
}
bool ProfilePatch::isVersionChangeable()
{
auto list = getVersionList();
if(list)
{
if(!list->isLoaded())
{
list->load();
}
return list->count() != 0;
}
return false;
}
@ -132,3 +153,23 @@ void ProfilePatch::setMovable (bool state)
{
m_isMovable = state;
}
ProblemSeverity ProfilePatch::getProblemSeverity()
{
auto file = getVersionFile();
if(file)
{
return file->getProblemSeverity();
}
return ProblemSeverity::Error;
}
const QList<PatchProblem> ProfilePatch::getProblems()
{
auto file = getVersionFile();
if(file)
{
return file->getProblems();
}
return {PatchProblem(ProblemSeverity::Error, QObject::tr("Patch is not loaded yet."))};
}