Merge branch 'master' of github.com:highfidelity/hifi into serverless-domains

This commit is contained in:
Seth Alves 2018-02-16 12:58:56 -08:00
commit afa059d331
4 changed files with 21 additions and 15 deletions

View file

@ -1196,8 +1196,8 @@ bool DomainServerSettingsManager::handleAuthenticatedHTTPRequest(HTTPConnection
}
bool DomainServerSettingsManager::restoreSettingsFromObject(QJsonObject settingsToRestore, SettingsType settingsType) {
QJsonArray& filteredDescriptionArray = settingsType == DomainSettings
? _domainSettingsDescription : _contentSettingsDescription;
QJsonArray* filteredDescriptionArray = settingsType == DomainSettings
? &_domainSettingsDescription : &_contentSettingsDescription;
// grab a copy of the current config before restore, so that we can back out if something bad happens during
QVariantMap preRestoreConfig = _configMap.getConfig();
@ -1206,7 +1206,7 @@ bool DomainServerSettingsManager::restoreSettingsFromObject(QJsonObject settings
// enumerate through the settings in the description
// if we have one in the restore then use it, otherwise clear it from current settings
foreach(const QJsonValue& descriptionGroupValue, filteredDescriptionArray) {
foreach(const QJsonValue& descriptionGroupValue, *filteredDescriptionArray) {
QJsonObject descriptionGroupObject = descriptionGroupValue.toObject();
QString groupKey = descriptionGroupObject[DESCRIPTION_NAME_KEY].toString();
QJsonArray descriptionGroupSettings = descriptionGroupObject[DESCRIPTION_SETTINGS_KEY].toArray();
@ -1328,15 +1328,15 @@ QJsonObject DomainServerSettingsManager::settingsResponseObjectForType(const QSt
const QString AFFECTED_TYPES_JSON_KEY = "assignment-types";
// only enumerate the requested settings type (domain setting or content setting)
QJsonArray& filteredDescriptionArray = _descriptionArray;
QJsonArray* filteredDescriptionArray = &_descriptionArray;
if (includeDomainSettings && !includeContentSettings) {
filteredDescriptionArray = _domainSettingsDescription;
filteredDescriptionArray = &_domainSettingsDescription;
} else if (includeContentSettings && !includeDomainSettings) {
filteredDescriptionArray = _contentSettingsDescription;
filteredDescriptionArray = &_contentSettingsDescription;
}
// enumerate the groups in the potentially filtered object to find which settings to pass
foreach(const QJsonValue& groupValue, filteredDescriptionArray) {
foreach(const QJsonValue& groupValue, *filteredDescriptionArray) {
QJsonObject groupObject = groupValue.toObject();
QString groupKey = groupObject[DESCRIPTION_NAME_KEY].toString();
QJsonArray groupSettingsArray = groupObject[DESCRIPTION_SETTINGS_KEY].toArray();

View file

@ -120,16 +120,19 @@ QScriptValue WindowScriptingInterface::confirm(const QString& message) {
/// \param const QString& defaultText default text in the text box
/// \return QScriptValue string text value in text box if the dialog was accepted, `null` otherwise.
QScriptValue WindowScriptingInterface::prompt(const QString& message, const QString& defaultText) {
bool ok = false;
QString result = OffscreenUi::getText(nullptr, "", message, QLineEdit::Normal, defaultText, &ok);
return ok ? QScriptValue(result) : QScriptValue::NullValue;
QString result = OffscreenUi::getText(nullptr, "", message, QLineEdit::Normal, defaultText);
if (QScriptValue(result).equals("")) {
return QScriptValue::NullValue;
}
return QScriptValue(result);
}
/// Display a prompt with a text box
/// \param const QString& message message to display
/// \param const QString& defaultText default text in the text box
void WindowScriptingInterface::promptAsync(const QString& message, const QString& defaultText) {
ModalDialogListener* dlg = OffscreenUi::getTextAsync(nullptr, "", message, QLineEdit::Normal, defaultText);
bool ok = false;
ModalDialogListener* dlg = OffscreenUi::getTextAsync(nullptr, "", message, QLineEdit::Normal, defaultText, &ok);
connect(dlg, &ModalDialogListener::response, this, [=] (QVariant result) {
disconnect(dlg, &ModalDialogListener::response, this, nullptr);
emit promptTextChanged(result.toString());

View file

@ -219,7 +219,7 @@ void Avatar::updateAvatarEntities() {
return;
}
if (getID() == QUuid()) {
if (getID() == QUuid() || getID() == AVATAR_SELF_ID) {
return; // wait until MyAvatar gets an ID before doing this.
}

View file

@ -340,10 +340,11 @@ class InputDialogListener : public ModalDialogListener {
return;
}
connect(_dialog, SIGNAL(selected(QVariant)), this, SLOT(onSelected(const QVariant&)));
connect(_dialog, SIGNAL(canceled()), this, SLOT(onSelected()));
}
private slots:
void onSelected(const QVariant& result) {
void onSelected(const QVariant& result = "") {
_result = result;
auto offscreenUi = DependencyManager::get<OffscreenUi>();
emit response(_result);
@ -698,10 +699,11 @@ class FileDialogListener : public ModalDialogListener {
return;
}
connect(_dialog, SIGNAL(selectedFile(QVariant)), this, SLOT(onSelectedFile(QVariant)));
connect(_dialog, SIGNAL(canceled()), this, SLOT(onSelectedFile()));
}
private slots:
void onSelectedFile(QVariant file) {
void onSelectedFile(QVariant file = "") {
_result = file.toUrl().toLocalFile();
_finished = true;
auto offscreenUi = DependencyManager::get<OffscreenUi>();
@ -947,10 +949,11 @@ class AssetDialogListener : public ModalDialogListener {
return;
}
connect(_dialog, SIGNAL(selectedAsset(QVariant)), this, SLOT(onSelectedAsset(QVariant)));
connect(_dialog, SIGNAL(canceled()), this, SLOT(onSelectedAsset()));
}
private slots:
void onSelectedAsset(QVariant asset) {
void onSelectedAsset(QVariant asset = "") {
_result = asset;
auto offscreenUi = DependencyManager::get<OffscreenUi>();
emit response(_result);