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
237237 NodeList::getInstance()->getNodeSocket()->setBlocking(false);
238238 }
239239
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+
240265 const char* domainIP = getCmdOption(argc, constArgv, "--domain");
241266 if (domainIP) {
242267 NodeList::getInstance()->setDomainIP(domainIP);
@@ -270,23 +295,6 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 27 unmodified lines
270295
271296 _window->setCentralWidget(_glWidget);
272297
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−
290298 #if defined(Q_WS_MAC) && defined(QT_NO_DEBUG)
291299 // if this is a release OS X build use fervor to check for an update
292300 FvUpdater::sharedUpdater()->SetFeedURL("https://s3-us-west-1.amazonaws.com/highfidelity/appcast.xml");
@@ -1145,11 +1153,18 @@ void Application::editPreferences() { · 852 unmodified lines
11451153 return;
11461154 }
11471155
1148− char newHostname[MAX_HOSTNAME_BYTES] = {};
1149− memcpy(newHostname, domainServerHostname->text().toAscii().data(), domainServerHostname->text().size());
1156+ QByteArray newHostname;
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+ }
11501165
11511166 // 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) {
11531168
11541169 NodeList::getInstance()->clear();
11551170
@@ -1159,7 +1174,8 @@ void Application::editPreferences() { · 3 unmodified lines
11591174 // reset the environment to default
11601175 _environment.resetToDefault();
11611176
1162− NodeList::getInstance()->setDomainHostname(newHostname);
1177+ // set the new hostname
1178+ NodeList::getInstance()->setDomainHostname(newHostname.constData());
11631179 }
11641180
11651181 QUrl url(avatarURL->text());
@@ -1785,7 +1801,6 @@ void Application::initMenu() { · 619 unmodified lines
17851801 settingsMenu->addAction("Export settings", this, SLOT(exportSettings()));
17861802
17871803 _networkAccessManager = new QNetworkAccessManager(this);
1788− _settings = new QSettings(this);
17891804 }
17901805
17911806 void Application::updateFrustumRenderModeAction() {
@@ -3469,7 +3484,7 @@ void Application::saveSettings(QSettings* settings) { · 1677 unmodified lines
34693484 if (!settings) {
34703485 settings = getSettings();
34713486 }
3472−
3487+
34733488 settings->setValue("headCameraPitchYawScale", _headCameraPitchYawScale);
34743489 settings->setValue("audioJitterBufferSamples", _audioJitterBufferSamples);
34753490 settings->setValue("horizontalFieldOfView", _horizontalFieldOfView);
@@ -3484,6 +3499,9 @@ void Application::saveSettings(QSettings* settings) { · 8 unmodified lines
34843499 scanMenuBar(&Application::saveAction, settings);
34853500 getAvatar()->saveData(settings);
34863501 _swatch.saveData(settings);
3502+
3503+ // ask the NodeList to save its data
3504+ NodeList::getInstance()->saveData(settings);
34873505 }
34883506
34893507 void 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