diff options
Diffstat (limited to 'linden/indra/newview/viewerinfo.cpp')
-rw-r--r-- | linden/indra/newview/viewerinfo.cpp | 148 |
1 files changed, 148 insertions, 0 deletions
diff --git a/linden/indra/newview/viewerinfo.cpp b/linden/indra/newview/viewerinfo.cpp new file mode 100644 index 0000000..59e35d4 --- /dev/null +++ b/linden/indra/newview/viewerinfo.cpp | |||
@@ -0,0 +1,148 @@ | |||
1 | /** | ||
2 | * @file viewerinfo.cpp | ||
3 | * @brief Functions for querying the viewer name, version, and other info. | ||
4 | * @author Jacek Antonelli | ||
5 | * | ||
6 | * Copyright (c) 2010-2011, Jacek Antonelli | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU Lesser General Public | ||
10 | * License as published by the Free Software Foundation; | ||
11 | * version 2.1 of the License only. | ||
12 | |||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
16 | * Lesser General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU Lesser General Public | ||
19 | * License along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
21 | * Boston, MA 02110-1301 USA | ||
22 | */ | ||
23 | |||
24 | #include "llviewerprecompiledheaders.h" | ||
25 | |||
26 | #include "viewerinfo.h" | ||
27 | |||
28 | namespace ViewerInfo | ||
29 | { | ||
30 | |||
31 | // These are intentionally defined here instead of in the header, | ||
32 | // because they should NOT be read directly. Use the functions. | ||
33 | const std::string NAME = "meta-impy"; | ||
34 | const std::string VARNT = ""; | ||
35 | const S32 MAJOR = 1; | ||
36 | const S32 MINOR = 4; | ||
37 | const S32 PATCH = 1; | ||
38 | const S32 RLEAS = 1; // increment for each beta/RC/release | ||
39 | const std::string EXTRA = "beta 1"; | ||
40 | |||
41 | // Mac OS X bundle identifier. Should match the one in Info.plist. | ||
42 | const std::string BUNDLE_ID = "org.imprudenceviewer.viewer"; | ||
43 | |||
44 | |||
45 | const std::string& viewerName() | ||
46 | { | ||
47 | return NAME; | ||
48 | } | ||
49 | |||
50 | const std::string& viewerVariant() | ||
51 | { | ||
52 | return VARNT; | ||
53 | } | ||
54 | |||
55 | const std::string& nameWithVariant() | ||
56 | { | ||
57 | static std::string s; | ||
58 | if (!s.empty()) | ||
59 | { | ||
60 | return s; | ||
61 | } | ||
62 | |||
63 | if (VARNT.empty()) | ||
64 | { | ||
65 | s = NAME; | ||
66 | } | ||
67 | else | ||
68 | { | ||
69 | s = NAME + " " + VARNT; | ||
70 | } | ||
71 | |||
72 | return s; | ||
73 | } | ||
74 | |||
75 | S32 versionMajor() | ||
76 | { | ||
77 | return MAJOR; | ||
78 | } | ||
79 | |||
80 | S32 versionMinor() | ||
81 | { | ||
82 | return MINOR; | ||
83 | } | ||
84 | |||
85 | S32 versionPatch() | ||
86 | { | ||
87 | return PATCH; | ||
88 | } | ||
89 | |||
90 | S32 versionRelease() | ||
91 | { | ||
92 | return RLEAS; | ||
93 | } | ||
94 | |||
95 | const std::string& versionExtra() | ||
96 | { | ||
97 | return EXTRA; | ||
98 | } | ||
99 | |||
100 | const std::string& versionNumbers3() | ||
101 | { | ||
102 | static std::string s = llformat("%d.%d.%d", MAJOR, MINOR, PATCH); | ||
103 | return s; | ||
104 | } | ||
105 | |||
106 | const std::string& versionNumbers4() | ||
107 | { | ||
108 | static std::string s = llformat("%d.%d.%d.%d", | ||
109 | MAJOR, MINOR, PATCH, RLEAS); | ||
110 | return s; | ||
111 | } | ||
112 | |||
113 | const std::string& prettyVersion() | ||
114 | { | ||
115 | static std::string s; | ||
116 | if (s.length() > 0) | ||
117 | { | ||
118 | return s; | ||
119 | } | ||
120 | |||
121 | s = versionNumbers3(); | ||
122 | |||
123 | if (EXTRA.length() > 0) | ||
124 | { | ||
125 | s += " " + EXTRA; | ||
126 | } | ||
127 | |||
128 | return s; | ||
129 | } | ||
130 | |||
131 | const std::string& prettyInfo() | ||
132 | { | ||
133 | static std::string s = nameWithVariant() + " " + prettyVersion(); | ||
134 | return s; | ||
135 | } | ||
136 | |||
137 | const std::string& terseInfo() | ||
138 | { | ||
139 | static std::string s = nameWithVariant() + " " + versionNumbers4(); | ||
140 | return s; | ||
141 | } | ||
142 | |||
143 | const std::string& bundleID() | ||
144 | { | ||
145 | return BUNDLE_ID; | ||
146 | } | ||
147 | |||
148 | } | ||