6131346e2f
While working on pack updating, instance naming always gets in the way, since we need both way of respecting the user's name choice, and a standarized way of getting the original pack name / version. This tries to circunvent such problems by abstracting away the naming schema into it's own struct, holding both the original name / version, and the user-defined name, so that everyone can be happy and world peace can be achieved! (at least that's what i'd hope :c). Signed-off-by: flow <flowlnlnln@gmail.com>
35 lines
748 B
C++
35 lines
748 B
C++
#include "InstanceTask.h"
|
|
|
|
QString InstanceName::name() const
|
|
{
|
|
if (!m_modified_name.isEmpty())
|
|
return modifiedName();
|
|
return QString("%1 %2").arg(m_original_name, m_original_version);
|
|
}
|
|
|
|
QString InstanceName::originalName() const
|
|
{
|
|
return m_original_name;
|
|
}
|
|
|
|
QString InstanceName::modifiedName() const
|
|
{
|
|
if (!m_modified_name.isEmpty())
|
|
return m_modified_name;
|
|
return m_original_name;
|
|
}
|
|
|
|
QString InstanceName::version() const
|
|
{
|
|
return m_original_version;
|
|
}
|
|
|
|
void InstanceName::setName(InstanceName& other)
|
|
{
|
|
m_original_name = other.m_original_name;
|
|
m_original_version = other.m_original_version;
|
|
m_modified_name = other.m_modified_name;
|
|
}
|
|
|
|
InstanceTask::InstanceTask() : Task(), InstanceName() {}
|