Implement some bits and pieces, disable dead buttons.

This commit is contained in:
Petr Mrázek
2013-06-23 22:10:32 +02:00
parent d9195bff3a
commit 27b1de0d6d
10 changed files with 127 additions and 119 deletions

View File

@@ -23,29 +23,9 @@ MinecraftVersion::MinecraftVersion(QString descriptor,
InstVersionList *parent) :
InstVersion(descriptor, name, timestamp, parent), m_dlUrl(dlUrl), m_etag(etag)
{
m_linkedVersion = NULL;
m_isNewLauncherVersion = false;
}
MinecraftVersion::MinecraftVersion(const MinecraftVersion *linkedVersion) :
InstVersion(linkedVersion->descriptor(), linkedVersion->name(), linkedVersion->timestamp(),
linkedVersion->versionList())
{
m_linkedVersion = (MinecraftVersion *)linkedVersion;
}
MinecraftVersion::MinecraftVersion(const MinecraftVersion &other, QObject *parent) :
InstVersion(other, parent)
{
if (other.m_linkedVersion)
m_linkedVersion = other.m_linkedVersion;
else
{
m_dlUrl = other.downloadURL();
m_etag = other.etag();
}
}
QString MinecraftVersion::descriptor() const
{
return m_descriptor;
@@ -58,9 +38,6 @@ QString MinecraftVersion::name() const
QString MinecraftVersion::typeName() const
{
if (m_linkedVersion)
return m_linkedVersion->typeName();
switch (versionType())
{
case OldSnapshot:
@@ -78,17 +55,6 @@ QString MinecraftVersion::typeName() const
case MCNostalgia:
return "MCNostalgia";
case MetaCustom:
// Not really sure what this does, but it was in the code for v4,
// so it must be important... Right?
return "Custom Meta Version";
case MetaLatestSnapshot:
return "Latest Snapshot";
case MetaLatestStable:
return "Latest Stable";
default:
return QString("Unknown Type %1").arg(versionType());
}
@@ -99,16 +65,6 @@ qint64 MinecraftVersion::timestamp() const
return m_timestamp;
}
bool MinecraftVersion::isForNewLauncher() const
{
return m_isNewLauncherVersion;
}
void MinecraftVersion::setIsForNewLauncher(bool val)
{
m_isNewLauncherVersion = val;
}
MinecraftVersion::VersionType MinecraftVersion::versionType() const
{
return m_type;
@@ -129,26 +85,21 @@ QString MinecraftVersion::etag() const
return m_etag;
}
bool MinecraftVersion::isMeta() const
MinecraftVersion::LauncherVersion MinecraftVersion::launcherVersion() const
{
return versionType() == MetaCustom ||
versionType() == MetaLatestSnapshot ||
versionType() == MetaLatestStable;
return m_launcherVersion;
};
void MinecraftVersion::setLauncherVersion(LauncherVersion launcherVersion)
{
m_launcherVersion = launcherVersion;
}
InstVersion *MinecraftVersion::copyVersion(InstVersionList *newParent) const
{
if (isMeta())
{
MinecraftVersion *version = new MinecraftVersion((MinecraftVersion *)m_linkedVersion);
return version;
}
else
{
MinecraftVersion *version = new MinecraftVersion(
descriptor(), name(), timestamp(), downloadURL(), etag(), newParent);
version->setVersionType(versionType());
version->setIsForNewLauncher(isForNewLauncher());
return version;
}
MinecraftVersion *version = new MinecraftVersion(
descriptor(), name(), timestamp(), downloadURL(), etag(), newParent);
version->setVersionType(versionType());
version->setLauncherVersion(launcherVersion());
return version;
}