Showing the changes to interface/src/Application.cpp (1 of 3 files). Show all
Unified · Split
| @@ -237,6 +237,31 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 236 unmodified lines | ||
| 237 | 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 | 265 | const char* domainIP = getCmdOption(argc, constArgv, "--domain"); |
| 241 | 266 | if (domainIP) { |
| 242 | 267 | NodeList::getInstance()->setDomainIP(domainIP); |
| @@ -270,23 +295,6 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 27 unmodified lines | ||
| 270 | 295 | |
| 271 | 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 | 298 | #if defined(Q_WS_MAC) && defined(QT_NO_DEBUG) |
| 291 | 299 | // if this is a release OS X build use fervor to check for an update |
| 292 | 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 | 1153 | return; |
| 1146 | 1154 | } |
| 1147 | 1155 | |
| 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 | + } | |
| 1150 | 1165 | |
| 1151 | 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 | 1169 | NodeList::getInstance()->clear(); |
| 1155 | 1170 | |
| @@ -1159,7 +1174,8 @@ void Application::editPreferences() { · 3 unmodified lines | ||
| 1159 | 1174 | // reset the environment to default |
| 1160 | 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 | 1181 | QUrl url(avatarURL->text()); |
| @@ -1785,7 +1801,6 @@ void Application::initMenu() { · 619 unmodified lines | ||
| 1785 | 1801 | settingsMenu->addAction("Export settings", this, SLOT(exportSettings())); |
| 1786 | 1802 | |
| 1787 | 1803 | _networkAccessManager = new QNetworkAccessManager(this); |
| 1788 | − _settings = new QSettings(this); | |
| 1789 | 1804 | } |
| 1790 | 1805 | |
| 1791 | 1806 | void Application::updateFrustumRenderModeAction() { |
| @@ -3469,7 +3484,7 @@ void Application::saveSettings(QSettings* settings) { · 1677 unmodified lines | ||
| 3469 | 3484 | if (!settings) { |
| 3470 | 3485 | settings = getSettings(); |
| 3471 | 3486 | } |
| 3472 | − | |
| 3487 | + | |
| 3473 | 3488 | settings->setValue("headCameraPitchYawScale", _headCameraPitchYawScale); |
| 3474 | 3489 | settings->setValue("audioJitterBufferSamples", _audioJitterBufferSamples); |
| 3475 | 3490 | settings->setValue("horizontalFieldOfView", _horizontalFieldOfView); |
| @@ -3484,6 +3499,9 @@ void Application::saveSettings(QSettings* settings) { · 8 unmodified lines | ||
| 3484 | 3499 | scanMenuBar(&Application::saveAction, settings); |
| 3485 | 3500 | getAvatar()->saveData(settings); |
| 3486 | 3501 | _swatch.saveData(settings); |
| 3502 | + | |
| 3503 | + // ask the NodeList to save its data | |
| 3504 | + NodeList::getInstance()->saveData(settings); | |
| 3487 | 3505 | } |
| 3488 | 3506 | |
| 3489 | 3507 | void Application::importSettings() { |