mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 05:37:17 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into metavoxels
This commit is contained in:
commit
3c1f3b77a7
20 changed files with 390 additions and 236 deletions
|
@ -116,7 +116,7 @@
|
||||||
"advanced": true
|
"advanced": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "I-print-stream-stats",
|
"name": "print-stream-stats",
|
||||||
"type": "checkbox",
|
"type": "checkbox",
|
||||||
"label": "Print Stream Stats:",
|
"label": "Print Stream Stats:",
|
||||||
"help": "audio upstream and downstream stats of each agent printed to audio-mixer stdout",
|
"help": "audio upstream and downstream stats of each agent printed to audio-mixer stdout",
|
||||||
|
|
|
@ -52,6 +52,10 @@ span.port {
|
||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.locked {
|
||||||
|
color: blue;
|
||||||
|
}
|
||||||
|
|
||||||
.advanced-setting {
|
.advanced-setting {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,11 @@ var Settings = {
|
||||||
};
|
};
|
||||||
|
|
||||||
var viewHelpers = {
|
var viewHelpers = {
|
||||||
getFormGroup: function(groupName, setting, values, isAdvanced) {
|
getFormGroup: function(groupName, setting, values, isAdvanced, isLocked) {
|
||||||
setting_id = groupName + "_" + setting.name
|
setting_id = groupName + "_" + setting.name
|
||||||
|
|
||||||
|
console.log(setting.name + " in " + groupName + " is " + isLocked)
|
||||||
|
|
||||||
form_group = "<div class='form-group" + (isAdvanced ? " advanced-setting" : "") + "'>"
|
form_group = "<div class='form-group" + (isAdvanced ? " advanced-setting" : "") + "'>"
|
||||||
|
|
||||||
if (_.has(values, groupName) && _.has(values[groupName], setting.name)) {
|
if (_.has(values, groupName) && _.has(values[groupName], setting.name)) {
|
||||||
|
@ -16,20 +18,26 @@ var viewHelpers = {
|
||||||
setting_value = ""
|
setting_value = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
label_class = 'control-label'
|
||||||
|
if (isLocked) {
|
||||||
|
label_class += ' locked'
|
||||||
|
}
|
||||||
|
|
||||||
if (setting.type === 'checkbox') {
|
if (setting.type === 'checkbox') {
|
||||||
form_group += "<label class='control-label'>" + setting.label + "</label>"
|
form_group += "<label class='" + label_class + "'>" + setting.label + "</label>"
|
||||||
form_group += "<div class='checkbox'>"
|
form_group += "<div class='checkbox" + (isLocked ? " disabled" : "") + "'>"
|
||||||
form_group += "<label for='" + setting_id + "'>"
|
form_group += "<label for='" + setting_id + "'>"
|
||||||
form_group += "<input type='checkbox' id='" + setting_id + "' " + (setting_value ? "checked" : "") + "/>"
|
form_group += "<input type='checkbox' id='" + setting_id + "' " +
|
||||||
|
(setting_value ? "checked" : "") + (isLocked ? " disabled" : "") + "/>"
|
||||||
form_group += " " + setting.help + "</label>";
|
form_group += " " + setting.help + "</label>";
|
||||||
form_group += "</div>"
|
form_group += "</div>"
|
||||||
} else {
|
} else {
|
||||||
input_type = _.has(setting, 'type') ? setting.type : "text"
|
input_type = _.has(setting, 'type') ? setting.type : "text"
|
||||||
|
|
||||||
form_group += "<label for='" + setting_id + "' class='control-label'>" + setting.label + "</label>";
|
form_group += "<label for='" + setting_id + "' class='" + label_class + "'>" + setting.label + "</label>";
|
||||||
form_group += "<input type='" + input_type + "' class='form-control' id='" + setting_id +
|
form_group += "<input type='" + input_type + "' class='form-control' id='" + setting_id +
|
||||||
"' placeholder='" + (_.has(setting, 'placeholder') ? setting.placeholder : "") +
|
"' placeholder='" + (_.has(setting, 'placeholder') ? setting.placeholder : "") +
|
||||||
"' value='" + setting_value + "'/>"
|
"' value='" + setting_value + "'" + (isLocked ? " disabled" : "") + "/>"
|
||||||
form_group += "<span class='help-block'>" + setting.help + "</span>"
|
form_group += "<span class='help-block'>" + setting.help + "</span>"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,6 +109,12 @@ function reloadSettings() {
|
||||||
$('#panels').html(Settings.panelsTemplate(data))
|
$('#panels').html(Settings.panelsTemplate(data))
|
||||||
|
|
||||||
Settings.initialValues = form2js('settings-form', "_", false, cleanupFormValues, true);
|
Settings.initialValues = form2js('settings-form', "_", false, cleanupFormValues, true);
|
||||||
|
|
||||||
|
// add tooltip to locked settings
|
||||||
|
$('label.locked').tooltip({
|
||||||
|
placement: 'right',
|
||||||
|
title: 'This setting is in the master config file and cannot be changed'
|
||||||
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,10 +38,12 @@
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<% split_settings = _.partition(group.settings, function(value, index) { return !value.advanced }) %>
|
<% split_settings = _.partition(group.settings, function(value, index) { return !value.advanced }) %>
|
||||||
<% _.each(split_settings[0], function(setting) { %>
|
<% _.each(split_settings[0], function(setting) { %>
|
||||||
<%= getFormGroup(group.name, setting, values, false) %>
|
<%= getFormGroup(group.name, setting, values, false,
|
||||||
|
(_.has(locked, group.name) && _.has(locked[group.name], setting.name))) %>
|
||||||
<% }); %>
|
<% }); %>
|
||||||
<% _.each(split_settings[1], function(setting) { %>
|
<% _.each(split_settings[1], function(setting) { %>
|
||||||
<%= getFormGroup(group.name, setting, values, true) %>
|
<%= getFormGroup(group.name, setting, values, true,
|
||||||
|
(_.has(locked, group.name) && _.has(locked[group.name], setting.name))) %>
|
||||||
<% }); %>
|
<% }); %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -57,7 +57,7 @@ DomainServer::DomainServer(int argc, char* argv[]) :
|
||||||
setApplicationName("domain-server");
|
setApplicationName("domain-server");
|
||||||
QSettings::setDefaultFormat(QSettings::IniFormat);
|
QSettings::setDefaultFormat(QSettings::IniFormat);
|
||||||
|
|
||||||
_settingsManager.loadSettingsMap(arguments());
|
_settingsManager.setupConfigMap(arguments());
|
||||||
|
|
||||||
installNativeEventFilter(&_shutdownEventListener);
|
installNativeEventFilter(&_shutdownEventListener);
|
||||||
connect(&_shutdownEventListener, SIGNAL(receivedCloseEvent()), SLOT(quit()));
|
connect(&_shutdownEventListener, SIGNAL(receivedCloseEvent()), SLOT(quit()));
|
||||||
|
|
|
@ -28,7 +28,7 @@ const QString SETTINGS_DESCRIPTION_RELATIVE_PATH = "/resources/describe-settings
|
||||||
|
|
||||||
DomainServerSettingsManager::DomainServerSettingsManager() :
|
DomainServerSettingsManager::DomainServerSettingsManager() :
|
||||||
_descriptionArray(),
|
_descriptionArray(),
|
||||||
_settingsMap()
|
_configMap()
|
||||||
{
|
{
|
||||||
// load the description object from the settings description
|
// load the description object from the settings description
|
||||||
QFile descriptionFile(QCoreApplication::applicationDirPath() + SETTINGS_DESCRIPTION_RELATIVE_PATH);
|
QFile descriptionFile(QCoreApplication::applicationDirPath() + SETTINGS_DESCRIPTION_RELATIVE_PATH);
|
||||||
|
@ -37,11 +37,8 @@ DomainServerSettingsManager::DomainServerSettingsManager() :
|
||||||
_descriptionArray = QJsonDocument::fromJson(descriptionFile.readAll()).array();
|
_descriptionArray = QJsonDocument::fromJson(descriptionFile.readAll()).array();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DomainServerSettingsManager::loadSettingsMap(const QStringList& argumentList) {
|
void DomainServerSettingsManager::setupConfigMap(const QStringList& argumentList) {
|
||||||
_settingsMap = HifiConfigVariantMap::mergeMasterConfigWithUserConfig(argumentList);
|
_configMap.loadMasterAndUserConfig(argumentList);
|
||||||
|
|
||||||
// figure out where we are supposed to persist our settings to
|
|
||||||
_settingsFilepath = HifiConfigVariantMap::userConfigFilepath(argumentList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString SETTINGS_PATH = "/settings.json";
|
const QString SETTINGS_PATH = "/settings.json";
|
||||||
|
@ -76,7 +73,7 @@ bool DomainServerSettingsManager::handleAuthenticatedHTTPRequest(HTTPConnection
|
||||||
QJsonObject postedObject = postedDocument.object();
|
QJsonObject postedObject = postedDocument.object();
|
||||||
|
|
||||||
// we recurse one level deep below each group for the appropriate setting
|
// we recurse one level deep below each group for the appropriate setting
|
||||||
recurseJSONObjectAndOverwriteSettings(postedObject, _settingsMap, _descriptionArray);
|
recurseJSONObjectAndOverwriteSettings(postedObject, _configMap.getUserConfig(), _descriptionArray);
|
||||||
|
|
||||||
// store whatever the current _settingsMap is to file
|
// store whatever the current _settingsMap is to file
|
||||||
persistToFile();
|
persistToFile();
|
||||||
|
@ -94,10 +91,13 @@ bool DomainServerSettingsManager::handleAuthenticatedHTTPRequest(HTTPConnection
|
||||||
// setup a JSON Object with descriptions and non-omitted settings
|
// setup a JSON Object with descriptions and non-omitted settings
|
||||||
const QString SETTINGS_RESPONSE_DESCRIPTION_KEY = "descriptions";
|
const QString SETTINGS_RESPONSE_DESCRIPTION_KEY = "descriptions";
|
||||||
const QString SETTINGS_RESPONSE_VALUE_KEY = "values";
|
const QString SETTINGS_RESPONSE_VALUE_KEY = "values";
|
||||||
|
const QString SETTINGS_RESPONSE_LOCKED_VALUES_KEY = "locked";
|
||||||
|
|
||||||
QJsonObject rootObject;
|
QJsonObject rootObject;
|
||||||
rootObject[SETTINGS_RESPONSE_DESCRIPTION_KEY] = _descriptionArray;
|
rootObject[SETTINGS_RESPONSE_DESCRIPTION_KEY] = _descriptionArray;
|
||||||
rootObject[SETTINGS_RESPONSE_VALUE_KEY] = responseObjectForType("", true);
|
rootObject[SETTINGS_RESPONSE_VALUE_KEY] = responseObjectForType("", true);
|
||||||
|
rootObject[SETTINGS_RESPONSE_LOCKED_VALUES_KEY] = QJsonDocument::fromVariant(_configMap.getMasterConfig()).object();
|
||||||
|
|
||||||
|
|
||||||
connection->respond(HTTPConnection::StatusCode200, QJsonDocument(rootObject).toJson(), "application/json");
|
connection->respond(HTTPConnection::StatusCode200, QJsonDocument(rootObject).toJson(), "application/json");
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,8 @@ QJsonObject DomainServerSettingsManager::responseObjectForType(const QString& ty
|
||||||
|
|
||||||
// we need to check if the settings map has a value for this setting
|
// we need to check if the settings map has a value for this setting
|
||||||
QVariant variantValue;
|
QVariant variantValue;
|
||||||
QVariant settingsMapGroupValue = _settingsMap.value(groupObject[DESCRIPTION_NAME_KEY].toString());
|
QVariant settingsMapGroupValue = _configMap.getMergedConfig()
|
||||||
|
.value(groupObject[DESCRIPTION_NAME_KEY].toString());
|
||||||
|
|
||||||
if (!settingsMapGroupValue.isNull()) {
|
if (!settingsMapGroupValue.isNull()) {
|
||||||
variantValue = settingsMapGroupValue.toMap().value(settingName);
|
variantValue = settingsMapGroupValue.toMap().value(settingName);
|
||||||
|
@ -239,23 +240,19 @@ void DomainServerSettingsManager::recurseJSONObjectAndOverwriteSettings(const QJ
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray DomainServerSettingsManager::getJSONSettingsMap() const {
|
|
||||||
return QJsonDocument::fromVariant(_settingsMap).toJson();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DomainServerSettingsManager::persistToFile() {
|
void DomainServerSettingsManager::persistToFile() {
|
||||||
|
|
||||||
// make sure we have the dir the settings file is supposed to live in
|
// make sure we have the dir the settings file is supposed to live in
|
||||||
QFileInfo settingsFileInfo(_settingsFilepath);
|
QFileInfo settingsFileInfo(_configMap.getUserConfigFilename());
|
||||||
|
|
||||||
if (!settingsFileInfo.dir().exists()) {
|
if (!settingsFileInfo.dir().exists()) {
|
||||||
settingsFileInfo.dir().mkpath(".");
|
settingsFileInfo.dir().mkpath(".");
|
||||||
}
|
}
|
||||||
|
|
||||||
QFile settingsFile(_settingsFilepath);
|
QFile settingsFile(_configMap.getUserConfigFilename());
|
||||||
|
|
||||||
if (settingsFile.open(QIODevice::WriteOnly)) {
|
if (settingsFile.open(QIODevice::WriteOnly)) {
|
||||||
settingsFile.write(getJSONSettingsMap());
|
settingsFile.write(QJsonDocument::fromVariant(_configMap.getUserConfig()).toJson());
|
||||||
} else {
|
} else {
|
||||||
qCritical("Could not write to JSON settings file. Unable to persist settings.");
|
qCritical("Could not write to JSON settings file. Unable to persist settings.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include <QtCore/QJsonArray>
|
#include <QtCore/QJsonArray>
|
||||||
#include <QtCore/QJsonDocument>
|
#include <QtCore/QJsonDocument>
|
||||||
|
|
||||||
|
#include <HifiConfigVariantMap.h>
|
||||||
#include <HTTPManager.h>
|
#include <HTTPManager.h>
|
||||||
|
|
||||||
class DomainServerSettingsManager : public QObject {
|
class DomainServerSettingsManager : public QObject {
|
||||||
|
@ -24,10 +25,9 @@ public:
|
||||||
bool handlePublicHTTPRequest(HTTPConnection* connection, const QUrl& url);
|
bool handlePublicHTTPRequest(HTTPConnection* connection, const QUrl& url);
|
||||||
bool handleAuthenticatedHTTPRequest(HTTPConnection* connection, const QUrl& url);
|
bool handleAuthenticatedHTTPRequest(HTTPConnection* connection, const QUrl& url);
|
||||||
|
|
||||||
void loadSettingsMap(const QStringList& argumentList);
|
void setupConfigMap(const QStringList& argumentList);
|
||||||
|
|
||||||
QByteArray getJSONSettingsMap() const;
|
QVariantMap& getSettingsMap() { return _configMap.getMergedConfig(); }
|
||||||
QVariantMap& getSettingsMap() { return _settingsMap; }
|
|
||||||
private:
|
private:
|
||||||
QJsonObject responseObjectForType(const QString& typeValue, bool isAuthenticated = false);
|
QJsonObject responseObjectForType(const QString& typeValue, bool isAuthenticated = false);
|
||||||
void recurseJSONObjectAndOverwriteSettings(const QJsonObject& postedObject, QVariantMap& settingsVariant,
|
void recurseJSONObjectAndOverwriteSettings(const QJsonObject& postedObject, QVariantMap& settingsVariant,
|
||||||
|
@ -35,8 +35,7 @@ private:
|
||||||
void persistToFile();
|
void persistToFile();
|
||||||
|
|
||||||
QJsonArray _descriptionArray;
|
QJsonArray _descriptionArray;
|
||||||
QVariantMap _settingsMap;
|
HifiConfigVariantMap _configMap;
|
||||||
QString _settingsFilepath;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_DomainServerSettingsManager_h
|
#endif // hifi_DomainServerSettingsManager_h
|
|
@ -137,8 +137,9 @@ foreach(EXTERNAL ${OPTIONAL_EXTERNALS})
|
||||||
set(${${EXTERNAL}_UPPERCASE}_LIBRARIES ${${${EXTERNAL}_UPPERCASE}_LIBRARY})
|
set(${${EXTERNAL}_UPPERCASE}_LIBRARIES ${${${EXTERNAL}_UPPERCASE}_LIBRARY})
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
if (NOT APPLE OR NOT ${${EXTERNAL}_UPPERCASE} MATCHES "SIXENSE")
|
||||||
target_link_libraries(${TARGET_NAME} ${${${EXTERNAL}_UPPERCASE}_LIBRARIES})
|
target_link_libraries(${TARGET_NAME} ${${${EXTERNAL}_UPPERCASE}_LIBRARIES})
|
||||||
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
|
|
@ -182,7 +182,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
_lastNackTime(usecTimestampNow()),
|
_lastNackTime(usecTimestampNow()),
|
||||||
_lastSendDownstreamAudioStats(usecTimestampNow())
|
_lastSendDownstreamAudioStats(usecTimestampNow())
|
||||||
{
|
{
|
||||||
|
|
||||||
// read the ApplicationInfo.ini file for Name/Version/Domain information
|
// read the ApplicationInfo.ini file for Name/Version/Domain information
|
||||||
QSettings applicationInfo(Application::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat);
|
QSettings applicationInfo(Application::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat);
|
||||||
|
|
||||||
|
@ -304,9 +303,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
connect(&addressManager, &AddressManager::possibleDomainChangeRequired,
|
connect(&addressManager, &AddressManager::possibleDomainChangeRequired,
|
||||||
this, &Application::changeDomainHostname);
|
this, &Application::changeDomainHostname);
|
||||||
|
|
||||||
// when -url in command line, teleport to location
|
|
||||||
addressManager.handleLookupString(getCmdOption(argc, constArgv, "-url"));
|
|
||||||
|
|
||||||
_settings = new QSettings(this);
|
_settings = new QSettings(this);
|
||||||
_numChangedSettings = 0;
|
_numChangedSettings = 0;
|
||||||
|
|
||||||
|
@ -381,12 +377,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
_particleEditSender.setPacketsPerSecond(3000); // super high!!
|
_particleEditSender.setPacketsPerSecond(3000); // super high!!
|
||||||
_entityEditSender.setPacketsPerSecond(3000); // super high!!
|
_entityEditSender.setPacketsPerSecond(3000); // super high!!
|
||||||
|
|
||||||
// Set the sixense filtering
|
|
||||||
_sixenseManager.setFilter(Menu::getInstance()->isOptionChecked(MenuOption::FilterSixense));
|
|
||||||
|
|
||||||
// Set hand controller velocity filtering
|
|
||||||
_sixenseManager.setLowVelocityFilter(Menu::getInstance()->isOptionChecked(MenuOption::LowVelocityFilter));
|
|
||||||
|
|
||||||
checkVersion();
|
checkVersion();
|
||||||
|
|
||||||
_overlays.init(_glWidget); // do this before scripts load
|
_overlays.init(_glWidget); // do this before scripts load
|
||||||
|
@ -1484,7 +1474,7 @@ void Application::setRenderVoxels(bool voxelRender) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::setLowVelocityFilter(bool lowVelocityFilter) {
|
void Application::setLowVelocityFilter(bool lowVelocityFilter) {
|
||||||
getSixenseManager()->setLowVelocityFilter(lowVelocityFilter);
|
SixenseManager::getInstance().setLowVelocityFilter(lowVelocityFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::doKillLocalVoxels() {
|
void Application::doKillLocalVoxels() {
|
||||||
|
@ -1797,7 +1787,25 @@ void Application::init() {
|
||||||
Menu::getInstance()->loadSettings();
|
Menu::getInstance()->loadSettings();
|
||||||
_audio.setReceivedAudioStreamSettings(Menu::getInstance()->getReceivedAudioStreamSettings());
|
_audio.setReceivedAudioStreamSettings(Menu::getInstance()->getReceivedAudioStreamSettings());
|
||||||
|
|
||||||
qDebug("Loaded settings");
|
qDebug() << "Loaded settings";
|
||||||
|
|
||||||
|
// when --url in command line, teleport to location
|
||||||
|
const QString HIFI_URL_COMMAND_LINE_KEY = "--url";
|
||||||
|
int urlIndex = arguments().indexOf(HIFI_URL_COMMAND_LINE_KEY);
|
||||||
|
if (urlIndex != -1) {
|
||||||
|
AddressManager::getInstance().handleLookupString(arguments().value(urlIndex + 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
if (Menu::getInstance()->isOptionChecked(MenuOption::SixenseEnabled)) {
|
||||||
|
// on OS X we only setup sixense if the user wants it on - this allows running without the hid_init crash
|
||||||
|
// if hydra support is temporarily not required
|
||||||
|
Menu::getInstance()->toggleSixense(true);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
// setup sixense
|
||||||
|
Menu::getInstance()->toggleSixense(true);
|
||||||
|
#endif
|
||||||
|
|
||||||
// initialize our face trackers after loading the menu settings
|
// initialize our face trackers after loading the menu settings
|
||||||
_faceshift.init();
|
_faceshift.init();
|
||||||
|
@ -2174,7 +2182,7 @@ void Application::update(float deltaTime) {
|
||||||
DeviceTracker::updateAll();
|
DeviceTracker::updateAll();
|
||||||
updateFaceshift();
|
updateFaceshift();
|
||||||
updateVisage();
|
updateVisage();
|
||||||
_sixenseManager.update(deltaTime);
|
SixenseManager::getInstance().update(deltaTime);
|
||||||
JoystickScriptingInterface::getInstance().update();
|
JoystickScriptingInterface::getInstance().update();
|
||||||
_prioVR.update(deltaTime);
|
_prioVR.update(deltaTime);
|
||||||
|
|
||||||
|
|
|
@ -219,7 +219,6 @@ public:
|
||||||
DdeFaceTracker* getDDE() { return &_dde; }
|
DdeFaceTracker* getDDE() { return &_dde; }
|
||||||
CaraFaceTracker* getCara() { return &_cara; }
|
CaraFaceTracker* getCara() { return &_cara; }
|
||||||
FaceTracker* getActiveFaceTracker();
|
FaceTracker* getActiveFaceTracker();
|
||||||
SixenseManager* getSixenseManager() { return &_sixenseManager; }
|
|
||||||
PrioVR* getPrioVR() { return &_prioVR; }
|
PrioVR* getPrioVR() { return &_prioVR; }
|
||||||
BandwidthMeter* getBandwidthMeter() { return &_bandwidthMeter; }
|
BandwidthMeter* getBandwidthMeter() { return &_bandwidthMeter; }
|
||||||
QUndoStack* getUndoStack() { return &_undoStack; }
|
QUndoStack* getUndoStack() { return &_undoStack; }
|
||||||
|
@ -510,7 +509,6 @@ private:
|
||||||
CaraFaceTracker _cara;
|
CaraFaceTracker _cara;
|
||||||
DdeFaceTracker _dde;
|
DdeFaceTracker _dde;
|
||||||
|
|
||||||
SixenseManager _sixenseManager;
|
|
||||||
PrioVR _prioVR;
|
PrioVR _prioVR;
|
||||||
|
|
||||||
Camera _myCamera; // My view onto the world
|
Camera _myCamera; // My view onto the world
|
||||||
|
|
|
@ -431,11 +431,18 @@ Menu::Menu() :
|
||||||
addCheckableActionToQMenuAndActionHash(handOptionsMenu, MenuOption::ShowIKConstraints, 0, false);
|
addCheckableActionToQMenuAndActionHash(handOptionsMenu, MenuOption::ShowIKConstraints, 0, false);
|
||||||
|
|
||||||
QMenu* sixenseOptionsMenu = handOptionsMenu->addMenu("Sixense");
|
QMenu* sixenseOptionsMenu = handOptionsMenu->addMenu("Sixense");
|
||||||
|
#ifdef __APPLE__
|
||||||
|
addCheckableActionToQMenuAndActionHash(sixenseOptionsMenu,
|
||||||
|
MenuOption::SixenseEnabled,
|
||||||
|
0, false,
|
||||||
|
this,
|
||||||
|
SLOT(toggleSixense(bool)));
|
||||||
|
#endif
|
||||||
addCheckableActionToQMenuAndActionHash(sixenseOptionsMenu,
|
addCheckableActionToQMenuAndActionHash(sixenseOptionsMenu,
|
||||||
MenuOption::FilterSixense,
|
MenuOption::FilterSixense,
|
||||||
0,
|
0,
|
||||||
true,
|
true,
|
||||||
appInstance->getSixenseManager(),
|
&SixenseManager::getInstance(),
|
||||||
SLOT(setFilter(bool)));
|
SLOT(setFilter(bool)));
|
||||||
addCheckableActionToQMenuAndActionHash(sixenseOptionsMenu,
|
addCheckableActionToQMenuAndActionHash(sixenseOptionsMenu,
|
||||||
MenuOption::LowVelocityFilter,
|
MenuOption::LowVelocityFilter,
|
||||||
|
@ -1134,6 +1141,18 @@ void Menu::editAnimations() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Menu::toggleSixense(bool shouldEnable) {
|
||||||
|
SixenseManager& sixenseManager = SixenseManager::getInstance();
|
||||||
|
|
||||||
|
if (shouldEnable && !sixenseManager.isInitialized()) {
|
||||||
|
sixenseManager.initialize();
|
||||||
|
sixenseManager.setFilter(isOptionChecked(MenuOption::FilterSixense));
|
||||||
|
sixenseManager.setLowVelocityFilter(isOptionChecked(MenuOption::LowVelocityFilter));
|
||||||
|
}
|
||||||
|
|
||||||
|
sixenseManager.setIsEnabled(shouldEnable);
|
||||||
|
}
|
||||||
|
|
||||||
void Menu::changePrivateKey() {
|
void Menu::changePrivateKey() {
|
||||||
// setup the dialog
|
// setup the dialog
|
||||||
QInputDialog privateKeyDialog(Application::getInstance()->getWindow());
|
QInputDialog privateKeyDialog(Application::getInstance()->getWindow());
|
||||||
|
|
|
@ -186,6 +186,7 @@ public slots:
|
||||||
void pasteToVoxel();
|
void pasteToVoxel();
|
||||||
|
|
||||||
void toggleLoginMenuItem();
|
void toggleLoginMenuItem();
|
||||||
|
void toggleSixense(bool shouldEnable);
|
||||||
|
|
||||||
QMenu* addMenu(const QString& menuName);
|
QMenu* addMenu(const QString& menuName);
|
||||||
void removeMenu(const QString& menuName);
|
void removeMenu(const QString& menuName);
|
||||||
|
@ -448,6 +449,7 @@ namespace MenuOption {
|
||||||
const QString ShowBordersVoxelNodes = "Show Voxel Nodes";
|
const QString ShowBordersVoxelNodes = "Show Voxel Nodes";
|
||||||
const QString ShowIKConstraints = "Show IK Constraints";
|
const QString ShowIKConstraints = "Show IK Constraints";
|
||||||
const QString SimpleShadows = "Simple";
|
const QString SimpleShadows = "Simple";
|
||||||
|
const QString SixenseEnabled = "Enable Hydra Support";
|
||||||
const QString SixenseMouseInput = "Enable Sixense Mouse Input";
|
const QString SixenseMouseInput = "Enable Sixense Mouse Input";
|
||||||
const QString SixenseLasers = "Enable Sixense UI Lasers";
|
const QString SixenseLasers = "Enable Sixense UI Lasers";
|
||||||
const QString StandOnNearbyFloors = "Stand on nearby floors";
|
const QString StandOnNearbyFloors = "Stand on nearby floors";
|
||||||
|
|
|
@ -1204,7 +1204,8 @@ int PointAugmentVisitor::visit(MetavoxelInfo& info) {
|
||||||
_points.swap(swapPoints);
|
_points.swap(swapPoints);
|
||||||
buffer = new PointBuffer(swapPoints);
|
buffer = new PointBuffer(swapPoints);
|
||||||
}
|
}
|
||||||
info.outputValues[0] = AttributeValue(_outputs.at(0), encodeInline(BufferDataPointer(buffer)));
|
BufferDataPointer pointer(buffer);
|
||||||
|
info.outputValues[0] = AttributeValue(_outputs.at(0), encodeInline(pointer));
|
||||||
}
|
}
|
||||||
return STOP_RECURSION;
|
return STOP_RECURSION;
|
||||||
}
|
}
|
||||||
|
@ -1219,7 +1220,8 @@ bool PointAugmentVisitor::postVisit(MetavoxelInfo& info) {
|
||||||
_points.swap(swapPoints);
|
_points.swap(swapPoints);
|
||||||
buffer = new PointBuffer(swapPoints);
|
buffer = new PointBuffer(swapPoints);
|
||||||
}
|
}
|
||||||
info.outputValues[0] = AttributeValue(_outputs.at(0), encodeInline(BufferDataPointer(buffer)));
|
BufferDataPointer pointer(buffer);
|
||||||
|
info.outputValues[0] = AttributeValue(_outputs.at(0), encodeInline(pointer));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1446,7 +1448,8 @@ int HeightfieldRegionVisitor::visit(MetavoxelInfo& info) {
|
||||||
_data->guide(_fetchVisitor);
|
_data->guide(_fetchVisitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
info.outputValues[0] = AttributeValue(_outputs.at(0), encodeInline(BufferDataPointer(buffer)));
|
BufferDataPointer pointer(buffer);
|
||||||
|
info.outputValues[0] = AttributeValue(_outputs.at(0), encodeInline(pointer));
|
||||||
return STOP_RECURSION;
|
return STOP_RECURSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1505,7 +1508,8 @@ int HeightfieldUpdateVisitor::visit(MetavoxelInfo& info) {
|
||||||
buffer->getHeight(), buffer->getColor(), buffer->getMaterial(), buffer->getMaterials());
|
buffer->getHeight(), buffer->getColor(), buffer->getMaterial(), buffer->getMaterials());
|
||||||
_fetchVisitor.init(newBuffer);
|
_fetchVisitor.init(newBuffer);
|
||||||
_data->guide(_fetchVisitor);
|
_data->guide(_fetchVisitor);
|
||||||
info.outputValues[0] = AttributeValue(_outputs.at(0), encodeInline(BufferDataPointer(newBuffer)));
|
BufferDataPointer pointer(newBuffer);
|
||||||
|
info.outputValues[0] = AttributeValue(_outputs.at(0), encodeInline(pointer));
|
||||||
return STOP_RECURSION;
|
return STOP_RECURSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2006,7 +2010,8 @@ int VoxelAugmentVisitor::visit(MetavoxelInfo& info) {
|
||||||
|
|
||||||
buffer = new VoxelBuffer(vertices, indices, material->getMaterials());
|
buffer = new VoxelBuffer(vertices, indices, material->getMaterials());
|
||||||
}
|
}
|
||||||
info.outputValues[0] = AttributeValue(_outputs.at(0), encodeInline(BufferDataPointer(buffer)));
|
BufferDataPointer pointer(buffer);
|
||||||
|
info.outputValues[0] = AttributeValue(_outputs.at(0), encodeInline(pointer));
|
||||||
return STOP_RECURSION;
|
return STOP_RECURSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,23 +30,28 @@ const int CALIBRATION_STATE_COMPLETE = 4;
|
||||||
const float NECK_X = 0.25f; // meters
|
const float NECK_X = 0.25f; // meters
|
||||||
const float NECK_Y = 0.3f; // meters
|
const float NECK_Y = 0.3f; // meters
|
||||||
const float NECK_Z = 0.3f; // meters
|
const float NECK_Z = 0.3f; // meters
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
typedef int (*SixenseBaseFunction)();
|
||||||
|
typedef int (*SixenseTakeIntFunction)(int);
|
||||||
|
typedef int (*SixenseTakeIntAndSixenseControllerData)(int, sixenseControllerData*);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SixenseManager::SixenseManager() {
|
|
||||||
#ifdef HAVE_SIXENSE
|
|
||||||
_lastMovement = 0;
|
|
||||||
_amountMoved = glm::vec3(0.0f);
|
|
||||||
_lowVelocityFilter = false;
|
|
||||||
|
|
||||||
_calibrationState = CALIBRATION_STATE_IDLE;
|
|
||||||
// By default we assume the _neckBase (in orb frame) is as high above the orb
|
|
||||||
// as the "torso" is below it.
|
|
||||||
_neckBase = glm::vec3(NECK_X, -NECK_Y, NECK_Z);
|
|
||||||
|
|
||||||
sixenseInit();
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
_hydrasConnected = false;
|
|
||||||
|
SixenseManager& SixenseManager::getInstance() {
|
||||||
|
static SixenseManager sharedInstance;
|
||||||
|
return sharedInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
SixenseManager::SixenseManager() :
|
||||||
|
#ifdef __APPLE__
|
||||||
|
_sixenseLibrary(NULL),
|
||||||
|
#endif
|
||||||
|
_isInitialized(false),
|
||||||
|
_isEnabled(true),
|
||||||
|
_hydrasConnected(false)
|
||||||
|
{
|
||||||
_triggerPressed[0] = false;
|
_triggerPressed[0] = false;
|
||||||
_bumperPressed[0] = false;
|
_bumperPressed[0] = false;
|
||||||
_oldX[0] = -1;
|
_oldX[0] = -1;
|
||||||
|
@ -58,23 +63,77 @@ SixenseManager::SixenseManager() {
|
||||||
}
|
}
|
||||||
|
|
||||||
SixenseManager::~SixenseManager() {
|
SixenseManager::~SixenseManager() {
|
||||||
#ifdef HAVE_SIXENSE
|
#ifdef HAVE_SIXENSE_
|
||||||
|
|
||||||
|
if (_isInitialized) {
|
||||||
|
#ifdef __APPLE__
|
||||||
|
SixenseBaseFunction sixenseExit = (SixenseBaseFunction) _sixenseLibrary->resolve("sixenseExit");
|
||||||
|
#endif
|
||||||
|
|
||||||
sixenseExit();
|
sixenseExit();
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
delete _sixenseLibrary;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void SixenseManager::initialize() {
|
||||||
|
#ifdef HAVE_SIXENSE
|
||||||
|
|
||||||
|
if (!_isInitialized) {
|
||||||
|
_lastMovement = 0;
|
||||||
|
_amountMoved = glm::vec3(0.0f);
|
||||||
|
_lowVelocityFilter = false;
|
||||||
|
|
||||||
|
_calibrationState = CALIBRATION_STATE_IDLE;
|
||||||
|
// By default we assume the _neckBase (in orb frame) is as high above the orb
|
||||||
|
// as the "torso" is below it.
|
||||||
|
_neckBase = glm::vec3(NECK_X, -NECK_Y, NECK_Z);
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
|
||||||
|
if (!_sixenseLibrary) {
|
||||||
|
const QString SIXENSE_LIBRARY_NAME = "libsixense_x64.dylib";
|
||||||
|
_sixenseLibrary = new QLibrary(SIXENSE_LIBRARY_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
qDebug() << "Initializing sixense library for hydra support - libsixense_x64.dylib load state is"
|
||||||
|
<< _sixenseLibrary->isLoaded();
|
||||||
|
SixenseBaseFunction sixenseInit = (SixenseBaseFunction) _sixenseLibrary->resolve("sixenseInit");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
sixenseInit();
|
||||||
|
|
||||||
|
_isInitialized = true;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void SixenseManager::setFilter(bool filter) {
|
void SixenseManager::setFilter(bool filter) {
|
||||||
#ifdef HAVE_SIXENSE
|
#ifdef HAVE_SIXENSE
|
||||||
|
|
||||||
|
if (_isInitialized) {
|
||||||
|
#ifdef __APPLE__
|
||||||
|
SixenseTakeIntFunction sixenseSetFilterEnabled = (SixenseTakeIntFunction) _sixenseLibrary->resolve("sixenseSetFilterEnabled");
|
||||||
|
#endif
|
||||||
|
|
||||||
if (filter) {
|
if (filter) {
|
||||||
sixenseSetFilterEnabled(1);
|
sixenseSetFilterEnabled(1);
|
||||||
} else {
|
} else {
|
||||||
sixenseSetFilterEnabled(0);
|
sixenseSetFilterEnabled(0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void SixenseManager::update(float deltaTime) {
|
void SixenseManager::update(float deltaTime) {
|
||||||
#ifdef HAVE_SIXENSE
|
#ifdef HAVE_SIXENSE
|
||||||
|
if (_isInitialized && _isEnabled) {
|
||||||
// if the controllers haven't been moved in a while, disable
|
// if the controllers haven't been moved in a while, disable
|
||||||
const unsigned int MOVEMENT_DISABLE_SECONDS = 3;
|
const unsigned int MOVEMENT_DISABLE_SECONDS = 3;
|
||||||
if (usecTimestampNow() - _lastMovement > (MOVEMENT_DISABLE_SECONDS * USECS_PER_SECOND)) {
|
if (usecTimestampNow() - _lastMovement > (MOVEMENT_DISABLE_SECONDS * USECS_PER_SECOND)) {
|
||||||
|
@ -85,6 +144,11 @@ void SixenseManager::update(float deltaTime) {
|
||||||
_lastMovement = usecTimestampNow();
|
_lastMovement = usecTimestampNow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
SixenseBaseFunction sixenseGetNumActiveControllers =
|
||||||
|
(SixenseBaseFunction) _sixenseLibrary->resolve("sixenseGetNumActiveControllers");
|
||||||
|
#endif
|
||||||
|
|
||||||
if (sixenseGetNumActiveControllers() == 0) {
|
if (sixenseGetNumActiveControllers() == 0) {
|
||||||
_hydrasConnected = false;
|
_hydrasConnected = false;
|
||||||
return;
|
return;
|
||||||
|
@ -98,11 +162,24 @@ void SixenseManager::update(float deltaTime) {
|
||||||
MyAvatar* avatar = Application::getInstance()->getAvatar();
|
MyAvatar* avatar = Application::getInstance()->getAvatar();
|
||||||
Hand* hand = avatar->getHand();
|
Hand* hand = avatar->getHand();
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
SixenseBaseFunction sixenseGetMaxControllers =
|
||||||
|
(SixenseBaseFunction) _sixenseLibrary->resolve("sixenseGetMaxControllers");
|
||||||
|
#endif
|
||||||
|
|
||||||
int maxControllers = sixenseGetMaxControllers();
|
int maxControllers = sixenseGetMaxControllers();
|
||||||
|
|
||||||
// we only support two controllers
|
// we only support two controllers
|
||||||
sixenseControllerData controllers[2];
|
sixenseControllerData controllers[2];
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
SixenseTakeIntFunction sixenseIsControllerEnabled =
|
||||||
|
(SixenseTakeIntFunction) _sixenseLibrary->resolve("sixenseIsControllerEnabled");
|
||||||
|
|
||||||
|
SixenseTakeIntAndSixenseControllerData sixenseGetNewestData =
|
||||||
|
(SixenseTakeIntAndSixenseControllerData) _sixenseLibrary->resolve("sixenseGetNewestData");
|
||||||
|
#endif
|
||||||
|
|
||||||
int numActiveControllers = 0;
|
int numActiveControllers = 0;
|
||||||
for (int i = 0; i < maxControllers && numActiveControllers < 2; i++) {
|
for (int i = 0; i < maxControllers && numActiveControllers < 2; i++) {
|
||||||
if (!sixenseIsControllerEnabled(i)) {
|
if (!sixenseIsControllerEnabled(i)) {
|
||||||
|
@ -208,6 +285,8 @@ void SixenseManager::update(float deltaTime) {
|
||||||
if (numActiveControllers == 2) {
|
if (numActiveControllers == 2) {
|
||||||
updateCalibration(controllers);
|
updateCalibration(controllers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
#endif // HAVE_SIXENSE
|
#endif // HAVE_SIXENSE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,11 @@
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
#include <glm/gtc/quaternion.hpp>
|
#include <glm/gtc/quaternion.hpp>
|
||||||
#include "sixense.h"
|
#include "sixense.h"
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
#include <qlibrary.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const unsigned int BUTTON_0 = 1U << 0; // the skinny button between 1 and 2
|
const unsigned int BUTTON_0 = 1U << 0; // the skinny button between 1 and 2
|
||||||
|
@ -38,9 +43,12 @@ const bool DEFAULT_INVERT_SIXENSE_MOUSE_BUTTONS = false;
|
||||||
class SixenseManager : public QObject {
|
class SixenseManager : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
static SixenseManager& getInstance();
|
||||||
|
|
||||||
SixenseManager();
|
void initialize();
|
||||||
~SixenseManager();
|
bool isInitialized() const { return _isInitialized; }
|
||||||
|
|
||||||
|
void setIsEnabled(bool isEnabled) { _isEnabled = isEnabled; }
|
||||||
|
|
||||||
void update(float deltaTime);
|
void update(float deltaTime);
|
||||||
float getCursorPixelRangeMult() const;
|
float getCursorPixelRangeMult() const;
|
||||||
|
@ -51,6 +59,9 @@ public slots:
|
||||||
void setLowVelocityFilter(bool lowVelocityFilter) { _lowVelocityFilter = lowVelocityFilter; };
|
void setLowVelocityFilter(bool lowVelocityFilter) { _lowVelocityFilter = lowVelocityFilter; };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
SixenseManager();
|
||||||
|
~SixenseManager();
|
||||||
|
|
||||||
#ifdef HAVE_SIXENSE
|
#ifdef HAVE_SIXENSE
|
||||||
void updateCalibration(const sixenseControllerData* controllers);
|
void updateCalibration(const sixenseControllerData* controllers);
|
||||||
void emulateMouse(PalmData* palm, int index);
|
void emulateMouse(PalmData* palm, int index);
|
||||||
|
@ -72,7 +83,13 @@ private:
|
||||||
glm::vec3 _reachForward;
|
glm::vec3 _reachForward;
|
||||||
float _lastDistance;
|
float _lastDistance;
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
QLibrary* _sixenseLibrary;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
bool _isInitialized;
|
||||||
|
bool _isEnabled;
|
||||||
bool _hydrasConnected;
|
bool _hydrasConnected;
|
||||||
quint64 _lastMovement;
|
quint64 _lastMovement;
|
||||||
glm::vec3 _amountMoved;
|
glm::vec3 _amountMoved;
|
||||||
|
|
|
@ -1335,11 +1335,7 @@ void Model::renderMeshes(RenderMode mode, bool translucent, float alphaThreshold
|
||||||
} else {
|
} else {
|
||||||
glm::vec4 diffuse = glm::vec4(part.diffuseColor, part.opacity);
|
glm::vec4 diffuse = glm::vec4(part.diffuseColor, part.opacity);
|
||||||
if (!(translucent && alphaThreshold == 0.0f)) {
|
if (!(translucent && alphaThreshold == 0.0f)) {
|
||||||
float emissive = (part.emissiveColor.r + part.emissiveColor.g + part.emissiveColor.b) / 3.0f;
|
glAlphaFunc(GL_EQUAL, diffuse.a = Application::getInstance()->getGlowEffect()->getIntensity());
|
||||||
diffuse.a = qMax(Application::getInstance()->getGlowEffect()->getIntensity(), emissive);
|
|
||||||
glAlphaFunc(GL_EQUAL, diffuse.a);
|
|
||||||
diffuse = glm::vec4(qMax(diffuse.r, part.emissiveColor.r), qMax(diffuse.g, part.emissiveColor.g),
|
|
||||||
qMax(diffuse.b, part.emissiveColor.b), diffuse.a);
|
|
||||||
}
|
}
|
||||||
glm::vec4 specular = glm::vec4(part.specularColor, 1.0f);
|
glm::vec4 specular = glm::vec4(part.specularColor, 1.0f);
|
||||||
glMaterialfv(GL_FRONT, GL_AMBIENT, (const float*)&diffuse);
|
glMaterialfv(GL_FRONT, GL_AMBIENT, (const float*)&diffuse);
|
||||||
|
|
|
@ -671,7 +671,7 @@ void ApplicationOverlay::renderControllerPointers() {
|
||||||
float yAngle = 0.5f - ((atan2(direction.z, direction.y) + M_PI_2));
|
float yAngle = 0.5f - ((atan2(direction.z, direction.y) + M_PI_2));
|
||||||
|
|
||||||
// Get the pixel range over which the xAngle and yAngle are scaled
|
// Get the pixel range over which the xAngle and yAngle are scaled
|
||||||
float cursorRange = glWidget->width() * application->getSixenseManager()->getCursorPixelRangeMult();
|
float cursorRange = glWidget->width() * SixenseManager::getInstance().getCursorPixelRangeMult();
|
||||||
|
|
||||||
mouseX = (glWidget->width() / 2.0f + cursorRange * xAngle);
|
mouseX = (glWidget->width() / 2.0f + cursorRange * xAngle);
|
||||||
mouseY = (glWidget->height() / 2.0f + cursorRange * yAngle);
|
mouseY = (glWidget->height() / 2.0f + cursorRange * yAngle);
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
#include "LoginDialog.h"
|
#include "LoginDialog.h"
|
||||||
|
|
||||||
const QString FORGOT_PASSWORD_URL = "https://data.highfidelity.io/password/new";
|
const QString FORGOT_PASSWORD_URL = "https://data.highfidelity.io/users/password/new";
|
||||||
|
|
||||||
LoginDialog::LoginDialog(QWidget* parent) :
|
LoginDialog::LoginDialog(QWidget* parent) :
|
||||||
FramelessDialog(parent, 0, FramelessDialog::POSITION_TOP),
|
FramelessDialog(parent, 0, FramelessDialog::POSITION_TOP),
|
||||||
|
|
|
@ -87,43 +87,48 @@ QVariantMap HifiConfigVariantMap::mergeCLParametersWithJSONConfig(const QStringL
|
||||||
return mergedMap;
|
return mergedMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantMap HifiConfigVariantMap::mergeMasterConfigWithUserConfig(const QStringList& argumentList) {
|
HifiConfigVariantMap::HifiConfigVariantMap() :
|
||||||
|
_userConfigFilename(),
|
||||||
|
_masterConfig(),
|
||||||
|
_userConfig(),
|
||||||
|
_mergedConfig()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void HifiConfigVariantMap::loadMasterAndUserConfig(const QStringList& argumentList) {
|
||||||
// check if there is a master config file
|
// check if there is a master config file
|
||||||
const QString MASTER_CONFIG_FILE_OPTION = "--master-config";
|
const QString MASTER_CONFIG_FILE_OPTION = "--master-config";
|
||||||
|
|
||||||
QVariantMap configVariantMap;
|
|
||||||
|
|
||||||
int masterConfigIndex = argumentList.indexOf(MASTER_CONFIG_FILE_OPTION);
|
int masterConfigIndex = argumentList.indexOf(MASTER_CONFIG_FILE_OPTION);
|
||||||
if (masterConfigIndex != -1) {
|
if (masterConfigIndex != -1) {
|
||||||
QString masterConfigFilepath = argumentList[masterConfigIndex + 1];
|
QString masterConfigFilepath = argumentList[masterConfigIndex + 1];
|
||||||
|
|
||||||
mergeMapWithJSONFile(configVariantMap, masterConfigFilepath);
|
loadMapFromJSONFile(_masterConfig, masterConfigFilepath);
|
||||||
}
|
}
|
||||||
|
|
||||||
// merge the existing configVariantMap with the user config file
|
// load the user config
|
||||||
mergeMapWithJSONFile(configVariantMap, userConfigFilepath(argumentList));
|
|
||||||
|
|
||||||
return configVariantMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString HifiConfigVariantMap::userConfigFilepath(const QStringList& argumentList) {
|
|
||||||
// we've loaded up the master config file, now fill in anything it didn't have with the user config file
|
|
||||||
const QString USER_CONFIG_FILE_OPTION = "--user-config";
|
const QString USER_CONFIG_FILE_OPTION = "--user-config";
|
||||||
|
|
||||||
int userConfigIndex = argumentList.indexOf(USER_CONFIG_FILE_OPTION);
|
int userConfigIndex = argumentList.indexOf(USER_CONFIG_FILE_OPTION);
|
||||||
QString userConfigFilepath;
|
|
||||||
if (userConfigIndex != -1) {
|
if (userConfigIndex != -1) {
|
||||||
userConfigFilepath = argumentList[userConfigIndex + 1];
|
_userConfigFilename = argumentList[userConfigIndex + 1];
|
||||||
} else {
|
} else {
|
||||||
userConfigFilepath = QString("%1/%2/%3/config.json").arg(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation),
|
_userConfigFilename = QString("%1/%2/%3/config.json").arg(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation),
|
||||||
QCoreApplication::organizationName(),
|
QCoreApplication::organizationName(),
|
||||||
QCoreApplication::applicationName());
|
QCoreApplication::applicationName());
|
||||||
}
|
}
|
||||||
|
|
||||||
return userConfigFilepath;
|
loadMapFromJSONFile(_userConfig, _userConfigFilename);
|
||||||
|
|
||||||
|
// the merged config is initially matched to the master config
|
||||||
|
_mergedConfig = _masterConfig;
|
||||||
|
|
||||||
|
// then we merge in anything missing from the user config
|
||||||
|
addMissingValuesToExistingMap(_mergedConfig, _userConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HifiConfigVariantMap::mergeMapWithJSONFile(QVariantMap& existingMap, const QString& filename) {
|
void HifiConfigVariantMap::loadMapFromJSONFile(QVariantMap& existingMap, const QString& filename) {
|
||||||
QFile configFile(filename);
|
QFile configFile(filename);
|
||||||
|
|
||||||
if (configFile.exists()) {
|
if (configFile.exists()) {
|
||||||
|
@ -131,12 +136,7 @@ void HifiConfigVariantMap::mergeMapWithJSONFile(QVariantMap& existingMap, const
|
||||||
configFile.open(QIODevice::ReadOnly);
|
configFile.open(QIODevice::ReadOnly);
|
||||||
|
|
||||||
QJsonDocument configDocument = QJsonDocument::fromJson(configFile.readAll());
|
QJsonDocument configDocument = QJsonDocument::fromJson(configFile.readAll());
|
||||||
|
|
||||||
if (existingMap.isEmpty()) {
|
|
||||||
existingMap = configDocument.toVariant().toMap();
|
existingMap = configDocument.toVariant().toMap();
|
||||||
} else {
|
|
||||||
addMissingValuesToExistingMap(existingMap, configDocument.toVariant().toMap());
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "Could not find JSON config file at" << filename;
|
qDebug() << "Could not find JSON config file at" << filename;
|
||||||
|
|
|
@ -17,11 +17,24 @@
|
||||||
class HifiConfigVariantMap {
|
class HifiConfigVariantMap {
|
||||||
public:
|
public:
|
||||||
static QVariantMap mergeCLParametersWithJSONConfig(const QStringList& argumentList);
|
static QVariantMap mergeCLParametersWithJSONConfig(const QStringList& argumentList);
|
||||||
static QVariantMap mergeMasterConfigWithUserConfig(const QStringList& argumentList);
|
|
||||||
static QString userConfigFilepath(const QStringList& argumentList);
|
HifiConfigVariantMap();
|
||||||
|
void loadMasterAndUserConfig(const QStringList& argumentList);
|
||||||
|
|
||||||
|
const QVariantMap& getMasterConfig() const { return _masterConfig; }
|
||||||
|
QVariantMap& getUserConfig() { return _userConfig; }
|
||||||
|
QVariantMap& getMergedConfig() { return _mergedConfig; }
|
||||||
|
|
||||||
|
const QString& getUserConfigFilename() const { return _userConfigFilename; }
|
||||||
private:
|
private:
|
||||||
static void mergeMapWithJSONFile(QVariantMap& existingMap, const QString& filename);
|
QString _userConfigFilename;
|
||||||
static void addMissingValuesToExistingMap(QVariantMap& existingMap, const QVariantMap& newMap);
|
|
||||||
|
QVariantMap _masterConfig;
|
||||||
|
QVariantMap _userConfig;
|
||||||
|
QVariantMap _mergedConfig;
|
||||||
|
|
||||||
|
void loadMapFromJSONFile(QVariantMap& existingMap, const QString& filename);
|
||||||
|
void addMissingValuesToExistingMap(QVariantMap& existingMap, const QVariantMap& newMap);
|
||||||
};
|
};
|
||||||
|
|
||||||
const QVariant* valueForKeyPath(QVariantMap& variantMap, const QString& keyPath);
|
const QVariant* valueForKeyPath(QVariantMap& variantMap, const QString& keyPath);
|
||||||
|
|
Loading…
Reference in a new issue