diff options
author | Jacek Antonelli | 2009-09-23 02:59:42 -0500 |
---|---|---|
committer | Jacek Antonelli | 2009-09-25 04:00:56 -0500 |
commit | 18ba06a4dd8473f66c5a196d9de085d84c8a06dd (patch) | |
tree | 866d8f9e409e61800c75ebaedb214d40c6529768 /linden/indra/newview | |
parent | Merge branch 'next' into login-manager (diff) | |
parent | Fixed unhandled exception in llinventorymodel.cpp (diff) | |
download | meta-impy-18ba06a4dd8473f66c5a196d9de085d84c8a06dd.zip meta-impy-18ba06a4dd8473f66c5a196d9de085d84c8a06dd.tar.gz meta-impy-18ba06a4dd8473f66c5a196d9de085d84c8a06dd.tar.bz2 meta-impy-18ba06a4dd8473f66c5a196d9de085d84c8a06dd.tar.xz |
Merge remote branch 'armin/armin-1.2.0-next' into login-manager
Conflicts:
linden/indra/newview/llinventorymodel.cpp
Diffstat (limited to 'linden/indra/newview')
-rw-r--r-- | linden/indra/newview/hippoGridManager.h | 340 |
1 files changed, 170 insertions, 170 deletions
diff --git a/linden/indra/newview/hippoGridManager.h b/linden/indra/newview/hippoGridManager.h index 9925495..cd90ac1 100644 --- a/linden/indra/newview/hippoGridManager.h +++ b/linden/indra/newview/hippoGridManager.h | |||
@@ -1,175 +1,175 @@ | |||
1 | #ifndef __HIPPO_GRID_MANAGER_H__ | 1 | #ifndef __HIPPO_GRID_MANAGER_H__ |
2 | #define __HIPPO_GRID_MANAGER_H__ | 2 | #define __HIPPO_GRID_MANAGER_H__ |
3 | 3 | ||
4 | 4 | ||
5 | #include <map> | 5 | #include <map> |
6 | #include <string> | 6 | #include <string> |
7 | 7 | ||
8 | #ifndef XML_STATIC | 8 | #ifndef XML_STATIC |
9 | #define XML_STATIC | 9 | #define XML_STATIC |
10 | #endif | 10 | #endif |
11 | 11 | ||
12 | #ifdef LL_STANDALONE | 12 | #ifdef LL_STANDALONE |
13 | #include <expat.h> | 13 | #include <expat.h> |
14 | #else | 14 | #else |
15 | #include "expat/expat.h" | 15 | #include "expat/expat.h" |
16 | #endif | 16 | #endif |
17 | 17 | ||
18 | class LLSD; | 18 | class LLSD; |
19 | 19 | ||
20 | 20 | ||
21 | class HippoGridInfo | 21 | class HippoGridInfo |
22 | { | 22 | { |
23 | public: | 23 | public: |
24 | enum Platform { | 24 | enum Platform { |
25 | PLATFORM_OTHER = 0, | 25 | PLATFORM_OTHER = 0, |
26 | PLATFORM_OPENSIM, | 26 | PLATFORM_OPENSIM, |
27 | PLATFORM_SECONDLIFE, | 27 | PLATFORM_SECONDLIFE, |
28 | PLATFORM_LAST | 28 | PLATFORM_LAST |
29 | }; | 29 | }; |
30 | enum SearchType { | 30 | enum SearchType { |
31 | SEARCH_ALL_EMPTY, | 31 | SEARCH_ALL_EMPTY, |
32 | SEARCH_ALL_QUERY, | 32 | SEARCH_ALL_QUERY, |
33 | SEARCH_ALL_TEMPLATE | 33 | SEARCH_ALL_TEMPLATE |
34 | }; | 34 | }; |
35 | 35 | ||
36 | explicit HippoGridInfo(const std::string &gridNick); | 36 | explicit HippoGridInfo(const std::string &gridNick); |
37 | 37 | ||
38 | Platform getPlatform() const { return mPlatform; } | 38 | Platform getPlatform() const { return mPlatform; } |
39 | const std::string &getGridNick() const { return mGridNick; } | 39 | const std::string &getGridNick() const { return mGridNick; } |
40 | const std::string &getGridName() const { return mGridName; } | 40 | const std::string &getGridName() const { return mGridName; } |
41 | const std::string &getLoginUri() const { return mLoginUri; } | 41 | const std::string &getLoginUri() const { return mLoginUri; } |
42 | const std::string &getLoginPage() const { return mLoginPage; } | 42 | const std::string &getLoginPage() const { return mLoginPage; } |
43 | const std::string &getHelperUri() const { return mHelperUri; } | 43 | const std::string &getHelperUri() const { return mHelperUri; } |
44 | const std::string &getWebSite() const { return mWebSite; } | 44 | const std::string &getWebSite() const { return mWebSite; } |
45 | const std::string &getSupportUrl() const { return mSupportUrl; } | 45 | const std::string &getSupportUrl() const { return mSupportUrl; } |
46 | const std::string &getRegisterUrl() const { return mRegisterUrl; } | 46 | const std::string &getRegisterUrl() const { return mRegisterUrl; } |
47 | const std::string &getPasswordUrl() const { return mPasswordUrl; } | 47 | const std::string &getPasswordUrl() const { return mPasswordUrl; } |
48 | const std::string &getSearchUrl() const { return mSearchUrl; } | 48 | const std::string &getSearchUrl() const { return mSearchUrl; } |
49 | const std::string &getFirstName() const { return mFirstName; } | 49 | const std::string &getFirstName() const { return mFirstName; } |
50 | const std::string &getLastName() const { return mLastName; } | 50 | const std::string &getLastName() const { return mLastName; } |
51 | const std::string &getAvatarPassword() const { return mAvatarPassword; } | 51 | const std::string &getAvatarPassword() const { return mAvatarPassword; } |
52 | std::string getSearchUrl(SearchType ty) const; | 52 | std::string getSearchUrl(SearchType ty) const; |
53 | bool isRenderCompat() const { return mRenderCompat; } | 53 | bool isRenderCompat() const { return mRenderCompat; } |
54 | 54 | ||
55 | const std::string &getCurrencySymbol() const { return mCurrencySymbol; } | 55 | const std::string &getCurrencySymbol() const { return mCurrencySymbol; } |
56 | const std::string &getRealCurrencySymbol() const { return mRealCurrencySymbol; } | 56 | const std::string &getRealCurrencySymbol() const { return mRealCurrencySymbol; } |
57 | std::string getUploadFee() const; | 57 | std::string getUploadFee() const; |
58 | std::string getGroupCreationFee() const; | 58 | std::string getGroupCreationFee() const; |
59 | std::string getDirectoryFee() const; | 59 | std::string getDirectoryFee() const; |
60 | 60 | ||
61 | bool isOpenSimulator() const { return (mPlatform == PLATFORM_OPENSIM ); } | 61 | bool isOpenSimulator() const { return (mPlatform == PLATFORM_OPENSIM ); } |
62 | bool isSecondLife() const { return (mPlatform == PLATFORM_SECONDLIFE); } | 62 | bool isSecondLife() const { return (mPlatform == PLATFORM_SECONDLIFE); } |
63 | 63 | ||
64 | void setPlatform (const std::string &platform); | 64 | void setPlatform (const std::string &platform); |
65 | void setPlatform (Platform platform); | 65 | void setPlatform (Platform platform); |
66 | void setGridName (const std::string &gridName) { mGridName = gridName; } | 66 | void setGridName (const std::string &gridName) { mGridName = gridName; } |
67 | void setLoginUri (const std::string &loginUri) { mLoginUri = loginUri; cleanUpUri(mLoginUri); } | 67 | void setLoginUri (const std::string &loginUri) { mLoginUri = loginUri; cleanUpUri(mLoginUri); } |
68 | void setLoginPage(const std::string &loginPage) { mLoginPage = loginPage; } | 68 | void setLoginPage(const std::string &loginPage) { mLoginPage = loginPage; } |
69 | void setHelperUri(const std::string &helperUri) { mHelperUri = helperUri; cleanUpUri(mHelperUri); } | 69 | void setHelperUri(const std::string &helperUri) { mHelperUri = helperUri; cleanUpUri(mHelperUri); } |
70 | void setWebSite (const std::string &website) { mWebSite = website; } | 70 | void setWebSite (const std::string &website) { mWebSite = website; } |
71 | void setSupportUrl(const std::string &url) { mSupportUrl = url; } | 71 | void setSupportUrl(const std::string &url) { mSupportUrl = url; } |
72 | void setRegisterUrl(const std::string &url) { mRegisterUrl = url; } | 72 | void setRegisterUrl(const std::string &url) { mRegisterUrl = url; } |
73 | void setPasswordUrl(const std::string &url) { mPasswordUrl = url; } | 73 | void setPasswordUrl(const std::string &url) { mPasswordUrl = url; } |
74 | void setSearchUrl(const std::string &url) { mSearchUrl = url; } | 74 | void setSearchUrl(const std::string &url) { mSearchUrl = url; } |
75 | void setRenderCompat(bool compat) { mRenderCompat = compat; } | 75 | void setRenderCompat(bool compat) { mRenderCompat = compat; } |
76 | void setFirstName(const std::string &firstName) { mFirstName = firstName; } //aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 76 | void setFirstName(const std::string &firstName) { mFirstName = firstName; } //aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
77 | void setLastName(const std::string &lastName) { mLastName = lastName; } | 77 | void setLastName(const std::string &lastName) { mLastName = lastName; } |
78 | void setAvatarPassword(const std::string &avatarPassword) { mAvatarPassword = avatarPassword; } | 78 | void setAvatarPassword(const std::string &avatarPassword) { mAvatarPassword = avatarPassword; } |
79 | 79 | ||
80 | void setCurrencySymbol(const std::string &sym) { mCurrencySymbol = sym.substr(0, 3); } | 80 | void setCurrencySymbol(const std::string &sym) { mCurrencySymbol = sym.substr(0, 3); } |
81 | void setRealCurrencySymbol(const std::string &sym) { mRealCurrencySymbol = sym.substr(0, 3); } | 81 | void setRealCurrencySymbol(const std::string &sym) { mRealCurrencySymbol = sym.substr(0, 3); } |
82 | void setDirectoryFee(int fee) { mDirectoryFee = fee; } | 82 | void setDirectoryFee(int fee) { mDirectoryFee = fee; } |
83 | 83 | ||
84 | bool retrieveGridInfo(); | 84 | bool retrieveGridInfo(); |
85 | 85 | ||
86 | static const char *getPlatformString(Platform platform); | 86 | static const char *getPlatformString(Platform platform); |
87 | static void cleanUpGridNick(std::string &gridnick); | 87 | static void cleanUpGridNick(std::string &gridnick); |
88 | 88 | ||
89 | static HippoGridInfo FALLBACK_GRIDINFO; | 89 | static HippoGridInfo FALLBACK_GRIDINFO; |
90 | static void initFallback(); | 90 | static void initFallback(); |
91 | 91 | ||
92 | private: | 92 | private: |
93 | Platform mPlatform; | 93 | Platform mPlatform; |
94 | std::string mGridNick; | 94 | std::string mGridNick; |
95 | std::string mGridName; | 95 | std::string mGridName; |
96 | std::string mLoginUri; | 96 | std::string mLoginUri; |
97 | std::string mLoginPage; | 97 | std::string mLoginPage; |
98 | std::string mHelperUri; | 98 | std::string mHelperUri; |
99 | std::string mWebSite; | 99 | std::string mWebSite; |
100 | std::string mSupportUrl; | 100 | std::string mSupportUrl; |
101 | std::string mRegisterUrl; | 101 | std::string mRegisterUrl; |
102 | std::string mPasswordUrl; | 102 | std::string mPasswordUrl; |
103 | std::string mSearchUrl; | 103 | std::string mSearchUrl; |
104 | std::string mFirstName; | 104 | std::string mFirstName; |
105 | std::string mLastName; | 105 | std::string mLastName; |
106 | std::string mAvatarPassword; | 106 | std::string mAvatarPassword; |
107 | bool mRenderCompat; | 107 | bool mRenderCompat; |
108 | 108 | ||
109 | std::string mCurrencySymbol; | 109 | std::string mCurrencySymbol; |
110 | std::string mRealCurrencySymbol; | 110 | std::string mRealCurrencySymbol; |
111 | int mDirectoryFee; | 111 | int mDirectoryFee; |
112 | 112 | ||
113 | // for parsing grid info XML | 113 | // for parsing grid info XML |
114 | enum XmlState { | 114 | enum XmlState { |
115 | XML_VOID, XML_GRIDNICK, XML_PLATFORM, XML_GRIDNAME, | 115 | XML_VOID, XML_GRIDNICK, XML_PLATFORM, XML_GRIDNAME, |
116 | XML_LOGINURI, XML_LOGINPAGE, XML_HELPERURI, | 116 | XML_LOGINURI, XML_LOGINPAGE, XML_HELPERURI, |
117 | XML_WEBSITE, XML_SUPPORT, XML_REGISTER, XML_PASSWORD, XML_SEARCH | 117 | XML_WEBSITE, XML_SUPPORT, XML_REGISTER, XML_PASSWORD, XML_SEARCH |
118 | }; | 118 | }; |
119 | XmlState mXmlState; | 119 | XmlState mXmlState; |
120 | 120 | ||
121 | static void cleanUpUri(std::string &uri); | 121 | static void cleanUpUri(std::string &uri); |
122 | void formatFee(std::string &fee, int cost, bool showFree) const; | 122 | void formatFee(std::string &fee, int cost, bool showFree) const; |
123 | 123 | ||
124 | static void onXmlElementStart(void *userData, const XML_Char *name, const XML_Char **atts); | 124 | static void onXmlElementStart(void *userData, const XML_Char *name, const XML_Char **atts); |
125 | static void onXmlElementEnd(void *userData, const XML_Char *name); | 125 | static void onXmlElementEnd(void *userData, const XML_Char *name); |
126 | static void onXmlCharacterData(void *userData, const XML_Char *s, int len); | 126 | static void onXmlCharacterData(void *userData, const XML_Char *s, int len); |
127 | }; | 127 | }; |
128 | 128 | ||
129 | 129 | ||
130 | class HippoGridManager | 130 | class HippoGridManager |
131 | { | 131 | { |
132 | public: | 132 | public: |
133 | HippoGridManager(); | 133 | HippoGridManager(); |
134 | ~HippoGridManager(); | 134 | ~HippoGridManager(); |
135 | 135 | ||
136 | void init(); | 136 | void init(); |
137 | void saveFile(); | 137 | void saveFile(); |
138 | void discardAndReload(); | 138 | void discardAndReload(); |
139 | 139 | ||
140 | HippoGridInfo *getGrid(const std::string &grid) const; | 140 | HippoGridInfo *getGrid(const std::string &grid) const; |
141 | HippoGridInfo *getConnectedGrid() const { return (mConnectedGrid)? mConnectedGrid: getCurrentGrid(); } | 141 | HippoGridInfo *getConnectedGrid() const { return (mConnectedGrid)? mConnectedGrid: getCurrentGrid(); } |
142 | HippoGridInfo *getCurrentGrid() const; | 142 | HippoGridInfo *getCurrentGrid() const; |
143 | const std::string &getDefaultGridNick() const { return mDefaultGrid; } | 143 | const std::string &getDefaultGridNick() const { return mDefaultGrid; } |
144 | const std::string &getCurrentGridNick() const { return mCurrentGrid; } | 144 | const std::string &getCurrentGridNick() const { return mCurrentGrid; } |
145 | 145 | ||
146 | void setDefaultGrid(const std::string &grid); | 146 | void setDefaultGrid(const std::string &grid); |
147 | void setCurrentGrid(const std::string &grid); | 147 | void setCurrentGrid(const std::string &grid); |
148 | void setCurrentGridAsConnected() { mConnectedGrid = getCurrentGrid(); } | 148 | void setCurrentGridAsConnected() { mConnectedGrid = getCurrentGrid(); } |
149 | 149 | ||
150 | void addGrid(HippoGridInfo *grid); | 150 | void addGrid(HippoGridInfo *grid); |
151 | void deleteGrid(const std::string &grid); | 151 | void deleteGrid(const std::string &grid); |
152 | 152 | ||
153 | typedef std::map<std::string, HippoGridInfo*>::iterator GridIterator; | 153 | typedef std::map<std::string, HippoGridInfo*>::iterator GridIterator; |
154 | GridIterator beginGrid() { return mGridInfo.begin(); } | 154 | GridIterator beginGrid() { return mGridInfo.begin(); } |
155 | GridIterator endGrid() { return mGridInfo.end(); } | 155 | GridIterator endGrid() { return mGridInfo.end(); } |
156 | 156 | ||
157 | private: | 157 | private: |
158 | std::map<std::string, HippoGridInfo*> mGridInfo; | 158 | std::map<std::string, HippoGridInfo*> mGridInfo; |
159 | std::string mDefaultGrid; | 159 | std::string mDefaultGrid; |
160 | std::string mCurrentGrid; | 160 | std::string mCurrentGrid; |
161 | HippoGridInfo *mConnectedGrid; | 161 | HippoGridInfo *mConnectedGrid; |
162 | int mDefaultGridsVersion; | 162 | int mDefaultGridsVersion; |
163 | 163 | ||
164 | void cleanup(); | 164 | void cleanup(); |
165 | void loadFromFile(); | 165 | void loadFromFile(); |
166 | void parseFile(const std::string &fileName, bool mergeIfNewer); | 166 | void parseFile(const std::string &fileName, bool mergeIfNewer); |
167 | void parseUrl(const char *url, bool mergeIfNewer); | 167 | void parseUrl(const char *url, bool mergeIfNewer); |
168 | void parseData(LLSD &gridInfo, bool mergeIfNewer); | 168 | void parseData(LLSD &gridInfo, bool mergeIfNewer); |
169 | }; | 169 | }; |
170 | 170 | ||
171 | 171 | ||
172 | extern HippoGridManager *gHippoGridManager; | 172 | extern HippoGridManager *gHippoGridManager; |
173 | 173 | ||
174 | 174 | ||
175 | #endif | 175 | #endif |