summaryrefslogtreecommitdiffstats
path: root/libraries/ganalytics/src/sys_apple.cpp
blob: f221a52792cc57b004c71849879152fcf1df22ae (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#include "sys.h"

// FIXME: replace with our version...
QString Sys::getSystemInfo()
{
	QSysInfo::MacVersion version = QSysInfo::macVersion();
	QString os;
	switch (version)
	{
	case QSysInfo::MV_9:
		os = "Macintosh; Mac OS 9";
		break;
	case QSysInfo::MV_10_0:
		os = "Macintosh; Mac OS 10.0";
		break;
	case QSysInfo::MV_10_1:
		os = "Macintosh; Mac OS 10.1";
		break;
	case QSysInfo::MV_10_2:
		os = "Macintosh; Mac OS 10.2";
		break;
	case QSysInfo::MV_10_3:
		os = "Macintosh; Mac OS 10.3";
		break;
	case QSysInfo::MV_10_4:
		os = "Macintosh; Mac OS 10.4";
		break;
	case QSysInfo::MV_10_5:
		os = "Macintosh; Mac OS 10.5";
		break;
	case QSysInfo::MV_10_6:
		os = "Macintosh; Mac OS 10.6";
		break;
	case QSysInfo::MV_10_7:
		os = "Macintosh; Mac OS 10.7";
		break;
	case QSysInfo::MV_10_8:
		os = "Macintosh; Mac OS 10.8";
		break;
	case QSysInfo::MV_10_9:
		os = "Macintosh; Mac OS 10.9";
		break;
	case QSysInfo::MV_10_10:
		os = "Macintosh; Mac OS 10.10";
		break;
#if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0))
	case QSysInfo::MV_10_11:
		os = "Macintosh; Mac OS 10.11";
		break;
#endif
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
	case QSysInfo::MV_10_12:
		os = "Macintosh; Mac OS 10.12";
		break;
#endif
	case QSysInfo::MV_Unknown:
		os = "Macintosh; Mac OS unknown";
		break;
	case QSysInfo::MV_IOS_5_0:
		os = "iPhone; iOS 5.0";
		break;
	case QSysInfo::MV_IOS_5_1:
		os = "iPhone; iOS 5.1";
		break;
	case QSysInfo::MV_IOS_6_0:
		os = "iPhone; iOS 6.0";
		break;
	case QSysInfo::MV_IOS_6_1:
		os = "iPhone; iOS 6.1";
		break;
	case QSysInfo::MV_IOS_7_0:
		os = "iPhone; iOS 7.0";
		break;
	case QSysInfo::MV_IOS_7_1:
		os = "iPhone; iOS 7.1";
		break;
	case QSysInfo::MV_IOS_8_0:
		os = "iPhone; iOS 8.0";
		break;
#if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0))
	case QSysInfo::MV_IOS_8_1:
		os = "iPhone; iOS 8.1";
		break;
	case QSysInfo::MV_IOS_8_2:
		os = "iPhone; iOS 8.2";
		break;
	case QSysInfo::MV_IOS_8_3:
		os = "iPhone; iOS 8.3";
		break;
	case QSysInfo::MV_IOS_8_4:
		os = "iPhone; iOS 8.4";
		break;
	case QSysInfo::MV_IOS_9_0:
		os = "iPhone; iOS 9.0";
		break;
#endif
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
	case QSysInfo::MV_IOS_9_1:
		os = "iPhone; iOS 9.1";
		break;
	case QSysInfo::MV_IOS_9_2:
		os = "iPhone; iOS 9.2";
		break;
	case QSysInfo::MV_IOS_9_3:
		os = "iPhone; iOS 9.3";
		break;
	case QSysInfo::MV_IOS_10_0:
		os = "iPhone; iOS 10.0";
		break;
#endif
	case QSysInfo::MV_IOS:
		os = "iPhone; iOS unknown";
		break;
	default:
		os = "Macintosh";
		break;
	}
	return os;
}

#include <sys/sysctl.h>

uint64_t Sys::getSystemRam()
{
	uint64_t memsize;
	size_t memsizesize = sizeof(memsize);
	if(!sysctlbyname("hw.memsize", &memsize, &memsizesize, NULL, 0))
	{
		return memsize;
	}
	else
	{
		return 0;
	}
}

bool Sys::isCPU64bit()
{
	// not even going to pretend I'm going to support anything else
	return true;
}

bool Sys::isSystem64bit()
{
	// yep. maybe when we have 128bit CPUs on consumer devices.
	return true;
}