aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/viewerinfo.cpp
blob: 176209661ff0d854f1d39d658f79f4ee541e8c64 (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
148
/**
 * @file viewerinfo.cpp
 * @brief Functions for querying the viewer name, version, and other info.
 * @author Jacek Antonelli
 *
 * Copyright (c) 2010-2011, Jacek Antonelli
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation;
 * version 2.1 of the License only.

 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301  USA
 */

#include "llviewerprecompiledheaders.h"

#include "viewerinfo.h"

namespace ViewerInfo
{

	// These are intentionally defined here instead of in the header,
	// because they should NOT be read directly. Use the functions.
	const std::string NAME  = "meta-impy";
	const std::string VARNT = "";
	const S32         MAJOR = 1;
	const S32         MINOR = 4;
	const S32         PATCH = 0;
	const S32         RLEAS = 3; // increment for each beta/RC/release
	const std::string EXTRA = "beta 2";

	// Mac OS X bundle identifier. Should match the one in Info.plist.
	const std::string BUNDLE_ID = "org.imprudenceviewer.viewer";


	const std::string& viewerName()
	{
		return NAME;
	}

	const std::string& viewerVariant()
	{
		return VARNT;
	}

	const std::string& nameWithVariant()
	{
		static std::string s;
		if (!s.empty())
		{
			return s;
		}

		if (VARNT.empty())
		{
			s = NAME;
		}
		else
		{
			s = NAME + " " + VARNT;
		}

		return s;
	}

	S32 versionMajor()
	{
		return MAJOR;
	}

	S32 versionMinor()
	{
		return MINOR;
	}

	S32 versionPatch()
	{
		return PATCH;
	}

	S32 versionRelease()
	{
		return RLEAS;
	}

	const std::string& versionExtra()
	{
		return EXTRA;
	}

	const std::string& versionNumbers3()
	{
		static std::string s = llformat("%d.%d.%d", MAJOR, MINOR, PATCH);
		return s;
	}

	const std::string& versionNumbers4()
	{
		static std::string s = llformat("%d.%d.%d.%d",
		                                MAJOR, MINOR, PATCH, RLEAS);
		return s;
	}

	const std::string& prettyVersion()
	{
		static std::string s;
		if (s.length() > 0)
		{
			return s;
		}

		s = versionNumbers3();

		if (EXTRA.length() > 0)
		{
			s += " " + EXTRA;
		}

		return s;
	}

	const std::string& prettyInfo()
	{
		static std::string s = nameWithVariant() + " " + prettyVersion();
		return s;
	}

	const std::string& terseInfo()
	{
		static std::string s = nameWithVariant() + " " + versionNumbers4();
		return s;
	}

	const std::string& bundleID()
	{
		return BUNDLE_ID;
	}

}