change: use ModStatus as a simple member instead of a pointer
Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
parent
47bdcb6050
commit
650af5eb64
@ -147,10 +147,7 @@ void Mod::setStatus(ModStatus status)
|
|||||||
if (m_localDetails) {
|
if (m_localDetails) {
|
||||||
m_localDetails->status = status;
|
m_localDetails->status = status;
|
||||||
} else {
|
} else {
|
||||||
if (!m_temp_status.get())
|
m_temp_status = status;
|
||||||
m_temp_status.reset(new ModStatus());
|
|
||||||
|
|
||||||
*m_temp_status = status;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void Mod::setMetadata(const Metadata::ModStruct& metadata)
|
void Mod::setMetadata(const Metadata::ModStruct& metadata)
|
||||||
@ -222,7 +219,7 @@ auto Mod::authors() const -> QStringList
|
|||||||
auto Mod::status() const -> ModStatus
|
auto Mod::status() const -> ModStatus
|
||||||
{
|
{
|
||||||
if (!m_localDetails)
|
if (!m_localDetails)
|
||||||
return m_temp_status ? *m_temp_status : ModStatus::NoMetadata;
|
return m_temp_status;
|
||||||
return details().status;
|
return details().status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,7 +243,7 @@ void Mod::finishResolvingWithDetails(std::shared_ptr<ModDetails> details)
|
|||||||
m_resolved = true;
|
m_resolved = true;
|
||||||
m_localDetails = details;
|
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()) {
|
if (m_localDetails && m_temp_metadata && m_temp_metadata->isValid()) {
|
||||||
setMetadata(*m_temp_metadata);
|
setMetadata(*m_temp_metadata);
|
||||||
|
@ -115,7 +115,7 @@ protected:
|
|||||||
std::shared_ptr<Metadata::ModStruct> m_temp_metadata;
|
std::shared_ptr<Metadata::ModStruct> m_temp_metadata;
|
||||||
|
|
||||||
/* Set the mod status while it doesn't have local details just yet */
|
/* 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;
|
std::shared_ptr<ModDetails> m_localDetails;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user