2013-05-03 19:41:37 +00:00
|
|
|
/* Copyright 2013 Andrew Okin
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
2013-11-04 01:53:05 +00:00
|
|
|
*
|
2013-05-03 19:41:37 +00:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2013-07-28 22:59:35 +00:00
|
|
|
#pragma once
|
2013-05-03 19:41:37 +00:00
|
|
|
|
2013-09-15 22:54:39 +00:00
|
|
|
#include "BaseVersion.h"
|
2013-08-11 16:58:24 +00:00
|
|
|
#include <QStringList>
|
2013-05-03 19:41:37 +00:00
|
|
|
|
2013-09-15 22:54:39 +00:00
|
|
|
struct MinecraftVersion : public BaseVersion
|
2013-05-03 19:41:37 +00:00
|
|
|
{
|
2013-09-15 22:54:39 +00:00
|
|
|
/*!
|
|
|
|
* Gets the version's timestamp.
|
|
|
|
* This is primarily used for sorting versions in a list.
|
|
|
|
*/
|
|
|
|
qint64 timestamp;
|
2013-11-04 01:53:05 +00:00
|
|
|
|
2013-08-11 16:58:24 +00:00
|
|
|
/// The URL that this version will be downloaded from. maybe.
|
|
|
|
QString download_url;
|
2013-11-04 01:53:05 +00:00
|
|
|
|
2013-08-11 16:58:24 +00:00
|
|
|
/// This version's type. Used internally to identify what kind of version this is.
|
2013-05-03 19:41:37 +00:00
|
|
|
enum VersionType
|
|
|
|
{
|
2014-01-24 17:12:02 +00:00
|
|
|
OneSix,
|
2013-08-11 16:58:24 +00:00
|
|
|
Legacy,
|
2013-08-06 23:38:18 +00:00
|
|
|
Nostalgia
|
2013-08-11 16:58:24 +00:00
|
|
|
} type;
|
2013-11-04 01:53:05 +00:00
|
|
|
|
2013-08-11 16:58:24 +00:00
|
|
|
/// is this the latest version?
|
|
|
|
bool is_latest = false;
|
2013-11-04 01:53:05 +00:00
|
|
|
|
2013-08-11 16:58:24 +00:00
|
|
|
/// is this a snapshot?
|
|
|
|
bool is_snapshot = false;
|
2013-11-04 01:53:05 +00:00
|
|
|
|
2013-09-15 22:54:39 +00:00
|
|
|
QString m_name;
|
2013-11-04 01:53:05 +00:00
|
|
|
|
2013-09-15 22:54:39 +00:00
|
|
|
QString m_descriptor;
|
2013-11-04 01:53:05 +00:00
|
|
|
|
|
|
|
virtual QString descriptor()
|
2013-09-15 22:54:39 +00:00
|
|
|
{
|
|
|
|
return m_descriptor;
|
|
|
|
}
|
2013-11-04 01:53:05 +00:00
|
|
|
|
|
|
|
virtual QString name()
|
2013-09-15 22:54:39 +00:00
|
|
|
{
|
|
|
|
return m_name;
|
|
|
|
}
|
2013-11-04 01:53:05 +00:00
|
|
|
|
2013-08-11 16:58:24 +00:00
|
|
|
virtual QString typeString() const
|
|
|
|
{
|
|
|
|
QStringList pre_final;
|
2013-11-04 01:53:05 +00:00
|
|
|
if (is_latest == true)
|
2013-08-11 16:58:24 +00:00
|
|
|
{
|
|
|
|
pre_final.append("Latest");
|
|
|
|
}
|
|
|
|
switch (type)
|
|
|
|
{
|
2014-01-24 17:12:02 +00:00
|
|
|
case OneSix:
|
|
|
|
pre_final.append("OneSix");
|
2013-08-11 16:58:24 +00:00
|
|
|
break;
|
|
|
|
case Legacy:
|
|
|
|
pre_final.append("Legacy");
|
|
|
|
break;
|
|
|
|
case Nostalgia:
|
|
|
|
pre_final.append("Nostalgia");
|
|
|
|
break;
|
2013-11-04 01:53:05 +00:00
|
|
|
|
2013-08-11 16:58:24 +00:00
|
|
|
default:
|
|
|
|
pre_final.append(QString("Type(%1)").arg(type));
|
|
|
|
break;
|
|
|
|
}
|
2013-11-04 01:53:05 +00:00
|
|
|
if (is_snapshot == true)
|
2013-08-11 16:58:24 +00:00
|
|
|
{
|
|
|
|
pre_final.append("Snapshot");
|
|
|
|
}
|
|
|
|
return pre_final.join(' ');
|
|
|
|
}
|
2013-05-03 19:41:37 +00:00
|
|
|
};
|