summaryrefslogtreecommitdiffstats
path: root/logic/forge/ForgeVersion.cpp
blob: b859a28cd1c250506181f4cf7da57128c71275d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include "ForgeVersion.h"
#include "minecraft/VersionFilterData.h"
#include <QObject>

QString ForgeVersion::name()
{
	return "Forge " + jobbuildver;
}

QString ForgeVersion::descriptor()
{
	return universal_filename;
}

QString ForgeVersion::typeString() const
{
	if (is_recommended)
		return QObject::tr("Recommended");
	return QString();
}

bool ForgeVersion::operator<(BaseVersion &a)
{
	ForgeVersion *pa = dynamic_cast<ForgeVersion *>(&a);
	if (!pa)
		return true;
	return m_buildnr < pa->m_buildnr;
}

bool ForgeVersion::operator>(BaseVersion &a)
{
	ForgeVersion *pa = dynamic_cast<ForgeVersion *>(&a);
	if (!pa)
		return false;
	return m_buildnr > pa->m_buildnr;
}

bool ForgeVersion::usesInstaller()
{
	if(installer_url.isEmpty())
		return false;
	if(g_VersionFilterData.forgeInstallerBlacklist.contains(mcver))
		return false;
	return true;
}

QString ForgeVersion::filename()
{
	return usesInstaller() ? installer_filename : universal_filename;
}

QString ForgeVersion::url()
{
	return usesInstaller() ? installer_url : universal_url;
}