change: use ModStatus as a simple member instead of a pointer

Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
flow 2022-07-06 13:21:06 -03:00
parent 47bdcb6050
commit 650af5eb64
No known key found for this signature in database
GPG Key ID: 8D0F221F0A59F469
2 changed files with 4 additions and 7 deletions

View File

@ -147,10 +147,7 @@ void Mod::setStatus(ModStatus status)
if (m_localDetails) {
m_localDetails->status = status;
} else {
if (!m_temp_status.get())
m_temp_status.reset(new ModStatus());
*m_temp_status = status;
m_temp_status = status;
}
}
void Mod::setMetadata(const Metadata::ModStruct& metadata)
@ -222,7 +219,7 @@ auto Mod::authors() const -> QStringList
auto Mod::status() const -> ModStatus
{
if (!m_localDetails)
return m_temp_status ? *m_temp_status : ModStatus::NoMetadata;
return m_temp_status;
return details().status;
}
@ -246,7 +243,7 @@ void Mod::finishResolvingWithDetails(std::shared_ptr<ModDetails> details)
m_resolved = true;
m_localDetails = details;
setStatus(m_temp_status ? *m_temp_status : ModStatus::NoMetadata);
setStatus(m_temp_status);
if (m_localDetails && m_temp_metadata && m_temp_metadata->isValid()) {
setMetadata(*m_temp_metadata);

View File

@ -115,7 +115,7 @@ protected:
std::shared_ptr<Metadata::ModStruct> m_temp_metadata;
/* Set the mod status while it doesn't have local details just yet */
std::shared_ptr<ModStatus> m_temp_status;
ModStatus m_temp_status = ModStatus::NoMetadata;
std::shared_ptr<ModDetails> m_localDetails;