move resolution into update actions in task.

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
This commit is contained in:
Rachel Powers
2024-06-27 15:42:25 -07:00
parent 474effe7c7
commit a85d6cb1f2
6 changed files with 231 additions and 82 deletions

View File

@ -38,6 +38,7 @@
#include <meta/VersionList.h>
#include <QSaveFile>
#include <optional>
#include "Application.h"
#include "FileSystem.h"
@ -235,7 +236,8 @@ ProblemSeverity Component::getProblemSeverity() const
{
auto file = getVersionFile();
if (file) {
return file->getProblemSeverity();
auto severity = file->getProblemSeverity();
return m_componentProblemSeverity > severity ? m_componentProblemSeverity : severity;
}
return ProblemSeverity::Error;
}
@ -244,11 +246,27 @@ const QList<PatchProblem> Component::getProblems() const
{
auto file = getVersionFile();
if (file) {
return file->getProblems();
auto problems = file->getProblems();
problems.append(m_componentProblems);
return problems;
}
return { { ProblemSeverity::Error, QObject::tr("Patch is not loaded yet.") } };
}
void Component::addComponentProblem(ProblemSeverity severity, const QString& description)
{
if (severity > m_componentProblemSeverity) {
m_componentProblemSeverity = severity;
}
m_componentProblems.append({ severity, description });
}
void Component::resetComponentProblems()
{
m_componentProblems.clear();
m_componentProblemSeverity = ProblemSeverity::None;
}
void Component::setVersion(const QString& version)
{
if (version == m_version) {
@ -415,6 +433,21 @@ void Component::waitLoadMeta()
}
}
void Component::setUpdateAction(UpdateAction action)
{
m_updateAction = action;
}
std::optional<UpdateAction> Component::getUpdateAction()
{
return m_updateAction;
}
void Component::clearUpdateAction()
{
m_updateAction.reset();
}
QDebug operator<<(QDebug d, const Component& comp)
{
d << "Component(" << comp.m_uid << " : " << comp.m_cachedVersion << ")";