mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 21:26:25 +02:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
a84c1c9e21
3 changed files with 77 additions and 23 deletions
|
@ -237,6 +237,31 @@ Application::Application(int& argc, char** argv, timeval &startup_time) :
|
||||||
NodeList::getInstance()->getNodeSocket()->setBlocking(false);
|
NodeList::getInstance()->getNodeSocket()->setBlocking(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// setup QSettings
|
||||||
|
#ifdef Q_WS_MAC
|
||||||
|
QString resourcesPath = QCoreApplication::applicationDirPath() + "/../Resources";
|
||||||
|
#else
|
||||||
|
QString resourcesPath = QCoreApplication::applicationDirPath() + "/resources";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// read the ApplicationInfo.ini file for Name/Version/Domain information
|
||||||
|
QSettings applicationInfo(resourcesPath + "/info/ApplicationInfo.ini", QSettings::IniFormat);
|
||||||
|
|
||||||
|
// set the associated application properties
|
||||||
|
applicationInfo.beginGroup("INFO");
|
||||||
|
|
||||||
|
setApplicationName(applicationInfo.value("name").toString());
|
||||||
|
setApplicationVersion(applicationInfo.value("version").toString());
|
||||||
|
setOrganizationName(applicationInfo.value("organizationName").toString());
|
||||||
|
setOrganizationDomain(applicationInfo.value("organizationDomain").toString());
|
||||||
|
|
||||||
|
_settings = new QSettings(this);
|
||||||
|
|
||||||
|
// check if there is a saved domain server hostname
|
||||||
|
// this must be done now instead of with the other setting checks to allow manual override with
|
||||||
|
// --domain or --local options
|
||||||
|
NodeList::getInstance()->loadData(_settings);
|
||||||
|
|
||||||
const char* domainIP = getCmdOption(argc, constArgv, "--domain");
|
const char* domainIP = getCmdOption(argc, constArgv, "--domain");
|
||||||
if (domainIP) {
|
if (domainIP) {
|
||||||
NodeList::getInstance()->setDomainIP(domainIP);
|
NodeList::getInstance()->setDomainIP(domainIP);
|
||||||
|
@ -270,23 +295,6 @@ Application::Application(int& argc, char** argv, timeval &startup_time) :
|
||||||
|
|
||||||
_window->setCentralWidget(_glWidget);
|
_window->setCentralWidget(_glWidget);
|
||||||
|
|
||||||
#ifdef Q_WS_MAC
|
|
||||||
QString resourcesPath = QCoreApplication::applicationDirPath() + "/../Resources";
|
|
||||||
#else
|
|
||||||
QString resourcesPath = QCoreApplication::applicationDirPath() + "/resources";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// read the ApplicationInfo.ini file for Name/Version/Domain information
|
|
||||||
QSettings applicationInfo(resourcesPath + "/info/ApplicationInfo.ini", QSettings::IniFormat);
|
|
||||||
|
|
||||||
// set the associated application properties
|
|
||||||
applicationInfo.beginGroup("INFO");
|
|
||||||
|
|
||||||
setApplicationName(applicationInfo.value("name").toString());
|
|
||||||
setApplicationVersion(applicationInfo.value("version").toString());
|
|
||||||
setOrganizationName(applicationInfo.value("organizationName").toString());
|
|
||||||
setOrganizationDomain(applicationInfo.value("organizationDomain").toString());
|
|
||||||
|
|
||||||
#if defined(Q_WS_MAC) && defined(QT_NO_DEBUG)
|
#if defined(Q_WS_MAC) && defined(QT_NO_DEBUG)
|
||||||
// if this is a release OS X build use fervor to check for an update
|
// if this is a release OS X build use fervor to check for an update
|
||||||
FvUpdater::sharedUpdater()->SetFeedURL("https://s3-us-west-1.amazonaws.com/highfidelity/appcast.xml");
|
FvUpdater::sharedUpdater()->SetFeedURL("https://s3-us-west-1.amazonaws.com/highfidelity/appcast.xml");
|
||||||
|
@ -1145,11 +1153,18 @@ void Application::editPreferences() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
char newHostname[MAX_HOSTNAME_BYTES] = {};
|
QByteArray newHostname;
|
||||||
memcpy(newHostname, domainServerHostname->text().toAscii().data(), domainServerHostname->text().size());
|
|
||||||
|
if (domainServerHostname->text().size() > 0) {
|
||||||
|
// the user input a new hostname, use that
|
||||||
|
newHostname = domainServerHostname->text().toAscii();
|
||||||
|
} else {
|
||||||
|
// the user left the field blank, use the default hostname
|
||||||
|
newHostname = QByteArray(DEFAULT_DOMAIN_HOSTNAME);
|
||||||
|
}
|
||||||
|
|
||||||
// check if the domain server hostname is new
|
// check if the domain server hostname is new
|
||||||
if (memcmp(NodeList::getInstance()->getDomainHostname(), newHostname, strlen(newHostname)) != 0) {
|
if (memcmp(NodeList::getInstance()->getDomainHostname(), newHostname.constData(), newHostname.size()) != 0) {
|
||||||
|
|
||||||
NodeList::getInstance()->clear();
|
NodeList::getInstance()->clear();
|
||||||
|
|
||||||
|
@ -1159,7 +1174,8 @@ void Application::editPreferences() {
|
||||||
// reset the environment to default
|
// reset the environment to default
|
||||||
_environment.resetToDefault();
|
_environment.resetToDefault();
|
||||||
|
|
||||||
NodeList::getInstance()->setDomainHostname(newHostname);
|
// set the new hostname
|
||||||
|
NodeList::getInstance()->setDomainHostname(newHostname.constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
QUrl url(avatarURL->text());
|
QUrl url(avatarURL->text());
|
||||||
|
@ -1785,7 +1801,6 @@ void Application::initMenu() {
|
||||||
settingsMenu->addAction("Export settings", this, SLOT(exportSettings()));
|
settingsMenu->addAction("Export settings", this, SLOT(exportSettings()));
|
||||||
|
|
||||||
_networkAccessManager = new QNetworkAccessManager(this);
|
_networkAccessManager = new QNetworkAccessManager(this);
|
||||||
_settings = new QSettings(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::updateFrustumRenderModeAction() {
|
void Application::updateFrustumRenderModeAction() {
|
||||||
|
@ -3469,7 +3484,7 @@ void Application::saveSettings(QSettings* settings) {
|
||||||
if (!settings) {
|
if (!settings) {
|
||||||
settings = getSettings();
|
settings = getSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
settings->setValue("headCameraPitchYawScale", _headCameraPitchYawScale);
|
settings->setValue("headCameraPitchYawScale", _headCameraPitchYawScale);
|
||||||
settings->setValue("audioJitterBufferSamples", _audioJitterBufferSamples);
|
settings->setValue("audioJitterBufferSamples", _audioJitterBufferSamples);
|
||||||
settings->setValue("horizontalFieldOfView", _horizontalFieldOfView);
|
settings->setValue("horizontalFieldOfView", _horizontalFieldOfView);
|
||||||
|
@ -3484,6 +3499,9 @@ void Application::saveSettings(QSettings* settings) {
|
||||||
scanMenuBar(&Application::saveAction, settings);
|
scanMenuBar(&Application::saveAction, settings);
|
||||||
getAvatar()->saveData(settings);
|
getAvatar()->saveData(settings);
|
||||||
_swatch.saveData(settings);
|
_swatch.saveData(settings);
|
||||||
|
|
||||||
|
// ask the NodeList to save its data
|
||||||
|
NodeList::getInstance()->saveData(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::importSettings() {
|
void Application::importSettings() {
|
||||||
|
|
|
@ -499,6 +499,37 @@ void NodeList::startSilentNodeRemovalThread() {
|
||||||
void NodeList::stopSilentNodeRemovalThread() {
|
void NodeList::stopSilentNodeRemovalThread() {
|
||||||
silentNodeThreadStopFlag = true;
|
silentNodeThreadStopFlag = true;
|
||||||
pthread_join(removeSilentNodesThread, NULL);
|
pthread_join(removeSilentNodesThread, NULL);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString QSETTINGS_GROUP_NAME = "NodeList";
|
||||||
|
const QString DOMAIN_SERVER_SETTING_KEY = "domainServerHostname";
|
||||||
|
|
||||||
|
void NodeList::loadData(QSettings *settings) {
|
||||||
|
settings->beginGroup(DOMAIN_SERVER_SETTING_KEY);
|
||||||
|
|
||||||
|
QString domainServerHostname = settings->value(DOMAIN_SERVER_SETTING_KEY).toString();
|
||||||
|
|
||||||
|
if (domainServerHostname.size() > 0) {
|
||||||
|
memset(_domainHostname, 0, MAX_HOSTNAME_BYTES);
|
||||||
|
memcpy(_domainHostname, domainServerHostname.toAscii().constData(), domainServerHostname.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
settings->endGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
void NodeList::saveData(QSettings* settings) {
|
||||||
|
settings->beginGroup(DOMAIN_SERVER_SETTING_KEY);
|
||||||
|
|
||||||
|
if (memcmp(_domainHostname, DEFAULT_DOMAIN_HOSTNAME, strlen(DEFAULT_DOMAIN_HOSTNAME)) != 0) {
|
||||||
|
// the user is using a different hostname, store it
|
||||||
|
settings->setValue(DOMAIN_SERVER_SETTING_KEY, QVariant(_domainHostname));
|
||||||
|
} else {
|
||||||
|
// the user has switched back to default, remove the current setting
|
||||||
|
settings->remove(DOMAIN_SERVER_SETTING_KEY);
|
||||||
|
}
|
||||||
|
|
||||||
|
settings->endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeList::iterator NodeList::begin() const {
|
NodeList::iterator NodeList::begin() const {
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <QSettings>
|
||||||
|
|
||||||
#include "Node.h"
|
#include "Node.h"
|
||||||
#include "UDPSocket.h"
|
#include "UDPSocket.h"
|
||||||
|
|
||||||
|
@ -99,6 +101,9 @@ public:
|
||||||
void startSilentNodeRemovalThread();
|
void startSilentNodeRemovalThread();
|
||||||
void stopSilentNodeRemovalThread();
|
void stopSilentNodeRemovalThread();
|
||||||
|
|
||||||
|
void loadData(QSettings* settings);
|
||||||
|
void saveData(QSettings* settings);
|
||||||
|
|
||||||
friend class NodeListIterator;
|
friend class NodeListIterator;
|
||||||
private:
|
private:
|
||||||
static NodeList* _sharedInstance;
|
static NodeList* _sharedInstance;
|
||||||
|
|
Loading…
Reference in a new issue