History

Merge remote-tracking branch 'upstream/master'

Mark Peng committed 13 years ago

Commit a84c1c92 parents 927aea8 e6c50e33 files · +77 −23Browse files

Showing the changes to interface/src/Application.cpp (1 of 3 files). Show all

Unified · Split

interface/src/Application.cpp+41−23
@@ -237,6 +237,31 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 236 unmodified lines
237 NodeList::getInstance()->getNodeSocket()->setBlocking(false);237 NodeList::getInstance()->getNodeSocket()->setBlocking(false);
238 }238 }
239 239
240 // setup QSettings
241#ifdef Q_WS_MAC
242 QString resourcesPath = QCoreApplication::applicationDirPath() + "/../Resources";
243#else
244 QString resourcesPath = QCoreApplication::applicationDirPath() + "/resources";
245#endif
246
247 // read the ApplicationInfo.ini file for Name/Version/Domain information
248 QSettings applicationInfo(resourcesPath + "/info/ApplicationInfo.ini", QSettings::IniFormat);
249
250 // set the associated application properties
251 applicationInfo.beginGroup("INFO");
252
253 setApplicationName(applicationInfo.value("name").toString());
254 setApplicationVersion(applicationInfo.value("version").toString());
255 setOrganizationName(applicationInfo.value("organizationName").toString());
256 setOrganizationDomain(applicationInfo.value("organizationDomain").toString());
257
258 _settings = new QSettings(this);
259
260 // check if there is a saved domain server hostname
261 // this must be done now instead of with the other setting checks to allow manual override with
262 // --domain or --local options
263 NodeList::getInstance()->loadData(_settings);
264
240 const char* domainIP = getCmdOption(argc, constArgv, "--domain");265 const char* domainIP = getCmdOption(argc, constArgv, "--domain");
241 if (domainIP) {266 if (domainIP) {
242 NodeList::getInstance()->setDomainIP(domainIP);267 NodeList::getInstance()->setDomainIP(domainIP);
@@ -270,23 +295,6 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 27 unmodified lines
270 295
271 _window->setCentralWidget(_glWidget);296 _window->setCentralWidget(_glWidget);
272 297
273#ifdef Q_WS_MAC
274 QString resourcesPath = QCoreApplication::applicationDirPath() + "/../Resources";
275#else
276 QString resourcesPath = QCoreApplication::applicationDirPath() + "/resources";
277#endif
278
279 // read the ApplicationInfo.ini file for Name/Version/Domain information
280 QSettings applicationInfo(resourcesPath + "/info/ApplicationInfo.ini", QSettings::IniFormat);
281
282 // set the associated application properties
283 applicationInfo.beginGroup("INFO");
284
285 setApplicationName(applicationInfo.value("name").toString());
286 setApplicationVersion(applicationInfo.value("version").toString());
287 setOrganizationName(applicationInfo.value("organizationName").toString());
288 setOrganizationDomain(applicationInfo.value("organizationDomain").toString());
289
290#if defined(Q_WS_MAC) && defined(QT_NO_DEBUG)298#if defined(Q_WS_MAC) && defined(QT_NO_DEBUG)
291 // if this is a release OS X build use fervor to check for an update 299 // if this is a release OS X build use fervor to check for an update
292 FvUpdater::sharedUpdater()->SetFeedURL("https://s3-us-west-1.amazonaws.com/highfidelity/appcast.xml");300 FvUpdater::sharedUpdater()->SetFeedURL("https://s3-us-west-1.amazonaws.com/highfidelity/appcast.xml");
@@ -1145,11 +1153,18 @@ void Application::editPreferences() { · 852 unmodified lines
1145 return;1153 return;
1146 }1154 }
1147 1155
1148 char newHostname[MAX_HOSTNAME_BYTES] = {};1156 QByteArray newHostname;
1149 memcpy(newHostname, domainServerHostname->text().toAscii().data(), domainServerHostname->text().size());1157
1158 if (domainServerHostname->text().size() > 0) {
1159 // the user input a new hostname, use that
1160 newHostname = domainServerHostname->text().toAscii();
1161 } else {
1162 // the user left the field blank, use the default hostname
1163 newHostname = QByteArray(DEFAULT_DOMAIN_HOSTNAME);
1164 }
1150 1165
1151 // check if the domain server hostname is new 1166 // check if the domain server hostname is new
1152 if (memcmp(NodeList::getInstance()->getDomainHostname(), newHostname, strlen(newHostname)) != 0) {1167 if (memcmp(NodeList::getInstance()->getDomainHostname(), newHostname.constData(), newHostname.size()) != 0) {
1153 1168
1154 NodeList::getInstance()->clear();1169 NodeList::getInstance()->clear();
1155 1170
@@ -1159,7 +1174,8 @@ void Application::editPreferences() { · 3 unmodified lines
1159 // reset the environment to default1174 // reset the environment to default
1160 _environment.resetToDefault();1175 _environment.resetToDefault();
1161 1176
1162 NodeList::getInstance()->setDomainHostname(newHostname);1177 // set the new hostname
1178 NodeList::getInstance()->setDomainHostname(newHostname.constData());
1163 }1179 }
1164 1180
1165 QUrl url(avatarURL->text());1181 QUrl url(avatarURL->text());
@@ -1785,7 +1801,6 @@ void Application::initMenu() { · 619 unmodified lines
1785 settingsMenu->addAction("Export settings", this, SLOT(exportSettings()));1801 settingsMenu->addAction("Export settings", this, SLOT(exportSettings()));
1786 1802
1787 _networkAccessManager = new QNetworkAccessManager(this);1803 _networkAccessManager = new QNetworkAccessManager(this);
1788 _settings = new QSettings(this);
1789}1804}
1790 1805
1791void Application::updateFrustumRenderModeAction() {1806void Application::updateFrustumRenderModeAction() {
@@ -3469,7 +3484,7 @@ void Application::saveSettings(QSettings* settings) { · 1677 unmodified lines
3469 if (!settings) { 3484 if (!settings) {
3470 settings = getSettings();3485 settings = getSettings();
3471 }3486 }
3472 3487
3473 settings->setValue("headCameraPitchYawScale", _headCameraPitchYawScale);3488 settings->setValue("headCameraPitchYawScale", _headCameraPitchYawScale);
3474 settings->setValue("audioJitterBufferSamples", _audioJitterBufferSamples);3489 settings->setValue("audioJitterBufferSamples", _audioJitterBufferSamples);
3475 settings->setValue("horizontalFieldOfView", _horizontalFieldOfView);3490 settings->setValue("horizontalFieldOfView", _horizontalFieldOfView);
@@ -3484,6 +3499,9 @@ void Application::saveSettings(QSettings* settings) { · 8 unmodified lines
3484 scanMenuBar(&Application::saveAction, settings);3499 scanMenuBar(&Application::saveAction, settings);
3485 getAvatar()->saveData(settings);3500 getAvatar()->saveData(settings);
3486 _swatch.saveData(settings);3501 _swatch.saveData(settings);
3502
3503 // ask the NodeList to save its data
3504 NodeList::getInstance()->saveData(settings);
3487}3505}
3488 3506
3489void Application::importSettings() {3507void Application::importSettings() {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t