mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-15 11:46:39 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into shadowControlsOffZvork
This commit is contained in:
commit
a2cc78b200
7 changed files with 97 additions and 19 deletions
|
@ -1196,8 +1196,8 @@ bool DomainServerSettingsManager::handleAuthenticatedHTTPRequest(HTTPConnection
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DomainServerSettingsManager::restoreSettingsFromObject(QJsonObject settingsToRestore, SettingsType settingsType) {
|
bool DomainServerSettingsManager::restoreSettingsFromObject(QJsonObject settingsToRestore, SettingsType settingsType) {
|
||||||
QJsonArray& filteredDescriptionArray = settingsType == DomainSettings
|
QJsonArray* filteredDescriptionArray = settingsType == DomainSettings
|
||||||
? _domainSettingsDescription : _contentSettingsDescription;
|
? &_domainSettingsDescription : &_contentSettingsDescription;
|
||||||
|
|
||||||
// grab a copy of the current config before restore, so that we can back out if something bad happens during
|
// grab a copy of the current config before restore, so that we can back out if something bad happens during
|
||||||
QVariantMap preRestoreConfig = _configMap.getConfig();
|
QVariantMap preRestoreConfig = _configMap.getConfig();
|
||||||
|
@ -1206,7 +1206,7 @@ bool DomainServerSettingsManager::restoreSettingsFromObject(QJsonObject settings
|
||||||
|
|
||||||
// enumerate through the settings in the description
|
// enumerate through the settings in the description
|
||||||
// if we have one in the restore then use it, otherwise clear it from current settings
|
// 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();
|
QJsonObject descriptionGroupObject = descriptionGroupValue.toObject();
|
||||||
QString groupKey = descriptionGroupObject[DESCRIPTION_NAME_KEY].toString();
|
QString groupKey = descriptionGroupObject[DESCRIPTION_NAME_KEY].toString();
|
||||||
QJsonArray descriptionGroupSettings = descriptionGroupObject[DESCRIPTION_SETTINGS_KEY].toArray();
|
QJsonArray descriptionGroupSettings = descriptionGroupObject[DESCRIPTION_SETTINGS_KEY].toArray();
|
||||||
|
@ -1328,15 +1328,15 @@ QJsonObject DomainServerSettingsManager::settingsResponseObjectForType(const QSt
|
||||||
const QString AFFECTED_TYPES_JSON_KEY = "assignment-types";
|
const QString AFFECTED_TYPES_JSON_KEY = "assignment-types";
|
||||||
|
|
||||||
// only enumerate the requested settings type (domain setting or content setting)
|
// only enumerate the requested settings type (domain setting or content setting)
|
||||||
QJsonArray& filteredDescriptionArray = _descriptionArray;
|
QJsonArray* filteredDescriptionArray = &_descriptionArray;
|
||||||
if (includeDomainSettings && !includeContentSettings) {
|
if (includeDomainSettings && !includeContentSettings) {
|
||||||
filteredDescriptionArray = _domainSettingsDescription;
|
filteredDescriptionArray = &_domainSettingsDescription;
|
||||||
} else if (includeContentSettings && !includeDomainSettings) {
|
} else if (includeContentSettings && !includeDomainSettings) {
|
||||||
filteredDescriptionArray = _contentSettingsDescription;
|
filteredDescriptionArray = &_contentSettingsDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
// enumerate the groups in the potentially filtered object to find which settings to pass
|
// 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();
|
QJsonObject groupObject = groupValue.toObject();
|
||||||
QString groupKey = groupObject[DESCRIPTION_NAME_KEY].toString();
|
QString groupKey = groupObject[DESCRIPTION_NAME_KEY].toString();
|
||||||
QJsonArray groupSettingsArray = groupObject[DESCRIPTION_SETTINGS_KEY].toArray();
|
QJsonArray groupSettingsArray = groupObject[DESCRIPTION_SETTINGS_KEY].toArray();
|
||||||
|
|
|
@ -120,16 +120,19 @@ QScriptValue WindowScriptingInterface::confirm(const QString& message) {
|
||||||
/// \param const QString& defaultText default text in the text box
|
/// \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.
|
/// \return QScriptValue string text value in text box if the dialog was accepted, `null` otherwise.
|
||||||
QScriptValue WindowScriptingInterface::prompt(const QString& message, const QString& defaultText) {
|
QScriptValue WindowScriptingInterface::prompt(const QString& message, const QString& defaultText) {
|
||||||
bool ok = false;
|
QString result = OffscreenUi::getText(nullptr, "", message, QLineEdit::Normal, defaultText);
|
||||||
QString result = OffscreenUi::getText(nullptr, "", message, QLineEdit::Normal, defaultText, &ok);
|
if (QScriptValue(result).equals("")) {
|
||||||
return ok ? QScriptValue(result) : QScriptValue::NullValue;
|
return QScriptValue::NullValue;
|
||||||
|
}
|
||||||
|
return QScriptValue(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Display a prompt with a text box
|
/// Display a prompt with a text box
|
||||||
/// \param const QString& message message to display
|
/// \param const QString& message message to display
|
||||||
/// \param const QString& defaultText default text in the text box
|
/// \param const QString& defaultText default text in the text box
|
||||||
void WindowScriptingInterface::promptAsync(const QString& message, const QString& defaultText) {
|
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) {
|
connect(dlg, &ModalDialogListener::response, this, [=] (QVariant result) {
|
||||||
disconnect(dlg, &ModalDialogListener::response, this, nullptr);
|
disconnect(dlg, &ModalDialogListener::response, this, nullptr);
|
||||||
emit promptTextChanged(result.toString());
|
emit promptTextChanged(result.toString());
|
||||||
|
|
|
@ -219,7 +219,7 @@ void Avatar::updateAvatarEntities() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getID() == QUuid()) {
|
if (getID() == QUuid() || getID() == AVATAR_SELF_ID) {
|
||||||
return; // wait until MyAvatar gets an ID before doing this.
|
return; // wait until MyAvatar gets an ID before doing this.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -453,6 +453,10 @@ void SelectionToHighlight::run(const render::RenderContextPointer& renderContext
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (numLayers == 0) {
|
||||||
|
renderContext->taskFlow.abortTask();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExtractSelectionName::run(const render::RenderContextPointer& renderContext, const Inputs& inputs, Outputs& outputs) {
|
void ExtractSelectionName::run(const render::RenderContextPointer& renderContext, const Inputs& inputs, Outputs& outputs) {
|
||||||
|
|
35
libraries/task/src/task/Task.cpp
Normal file
35
libraries/task/src/task/Task.cpp
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
//
|
||||||
|
// Task.cpp
|
||||||
|
// task/src/task
|
||||||
|
//
|
||||||
|
// Created by Sam Gateau on 2/14/2018.
|
||||||
|
// Copyright 2018 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
#include "Task.h"
|
||||||
|
|
||||||
|
using namespace task;
|
||||||
|
|
||||||
|
JobContext::JobContext(const QLoggingCategory& category) :
|
||||||
|
profileCategory(category) {
|
||||||
|
assert(&category);
|
||||||
|
}
|
||||||
|
|
||||||
|
JobContext::~JobContext() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void TaskFlow::reset() {
|
||||||
|
_doAbortTask = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TaskFlow::abortTask() {
|
||||||
|
_doAbortTask = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TaskFlow::doAbortTask() const {
|
||||||
|
return _doAbortTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,15 +27,44 @@ template <class JC> class JobT;
|
||||||
template <class JC> class TaskT;
|
template <class JC> class TaskT;
|
||||||
class JobNoIO {};
|
class JobNoIO {};
|
||||||
|
|
||||||
|
// Task Flow control class is a simple per value object used to communicate flow control commands trhough the graph of tasks.
|
||||||
|
// From within the Job::Run function, you can access it from the JobCOntext and issue commands which will be picked up by the Task calling for the Job run.
|
||||||
|
// This is first introduced to provide a way to abort all the work from within a task job. see the "abortTask" call
|
||||||
|
class TaskFlow {
|
||||||
|
public:
|
||||||
|
// A job that wants to abort the rest of the other jobs execution in a task would issue that call "abortTask" and let the task early exit for this run.
|
||||||
|
// All the varyings produced by the aborted branch of jobs are left unmodified.
|
||||||
|
void abortTask();
|
||||||
|
|
||||||
|
// called by the task::run to perform flow control
|
||||||
|
// This should be considered private but still need to be accessible from the Task<T> class
|
||||||
|
TaskFlow() = default;
|
||||||
|
~TaskFlow() = default;
|
||||||
|
void reset();
|
||||||
|
bool doAbortTask() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool _doAbortTask{ false };
|
||||||
|
};
|
||||||
|
|
||||||
|
// JobContext class is the base calss for the context object which is passed through all the Job::run calls thoughout the graph of jobs
|
||||||
|
// It is used to communicate to the job::run its context and various state information the job relies on.
|
||||||
|
// It specifically provide access to:
|
||||||
|
// - The taskFlow object allowing for messaging control flow commands from within a Job::run
|
||||||
|
// - The current Config object attached to the Job::run currently called.
|
||||||
|
// The JobContext can be derived to add more global state to it that Jobs can access
|
||||||
class JobContext {
|
class JobContext {
|
||||||
public:
|
public:
|
||||||
JobContext(const QLoggingCategory& category) : profileCategory(category) {
|
JobContext(const QLoggingCategory& category);
|
||||||
assert(&category);
|
virtual ~JobContext();
|
||||||
}
|
|
||||||
virtual ~JobContext() {}
|
|
||||||
|
|
||||||
std::shared_ptr<JobConfig> jobConfig { nullptr };
|
std::shared_ptr<JobConfig> jobConfig { nullptr };
|
||||||
const QLoggingCategory& profileCategory;
|
const QLoggingCategory& profileCategory;
|
||||||
|
|
||||||
|
// Task flow control
|
||||||
|
TaskFlow taskFlow{};
|
||||||
|
|
||||||
|
protected:
|
||||||
};
|
};
|
||||||
using JobContextPointer = std::shared_ptr<JobContext>;
|
using JobContextPointer = std::shared_ptr<JobContext>;
|
||||||
|
|
||||||
|
@ -308,6 +337,10 @@ public:
|
||||||
if (config->alwaysEnabled || config->enabled) {
|
if (config->alwaysEnabled || config->enabled) {
|
||||||
for (auto job : TaskConcept::_jobs) {
|
for (auto job : TaskConcept::_jobs) {
|
||||||
job.run(jobContext);
|
job.run(jobContext);
|
||||||
|
if (jobContext->taskFlow.doAbortTask()) {
|
||||||
|
jobContext->taskFlow.reset();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -340,10 +340,11 @@ class InputDialogListener : public ModalDialogListener {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
connect(_dialog, SIGNAL(selected(QVariant)), this, SLOT(onSelected(const QVariant&)));
|
connect(_dialog, SIGNAL(selected(QVariant)), this, SLOT(onSelected(const QVariant&)));
|
||||||
|
connect(_dialog, SIGNAL(canceled()), this, SLOT(onSelected()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onSelected(const QVariant& result) {
|
void onSelected(const QVariant& result = "") {
|
||||||
_result = result;
|
_result = result;
|
||||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||||
emit response(_result);
|
emit response(_result);
|
||||||
|
@ -698,10 +699,11 @@ class FileDialogListener : public ModalDialogListener {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
connect(_dialog, SIGNAL(selectedFile(QVariant)), this, SLOT(onSelectedFile(QVariant)));
|
connect(_dialog, SIGNAL(selectedFile(QVariant)), this, SLOT(onSelectedFile(QVariant)));
|
||||||
|
connect(_dialog, SIGNAL(canceled()), this, SLOT(onSelectedFile()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onSelectedFile(QVariant file) {
|
void onSelectedFile(QVariant file = "") {
|
||||||
_result = file.toUrl().toLocalFile();
|
_result = file.toUrl().toLocalFile();
|
||||||
_finished = true;
|
_finished = true;
|
||||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||||
|
@ -947,10 +949,11 @@ class AssetDialogListener : public ModalDialogListener {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
connect(_dialog, SIGNAL(selectedAsset(QVariant)), this, SLOT(onSelectedAsset(QVariant)));
|
connect(_dialog, SIGNAL(selectedAsset(QVariant)), this, SLOT(onSelectedAsset(QVariant)));
|
||||||
|
connect(_dialog, SIGNAL(canceled()), this, SLOT(onSelectedAsset()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onSelectedAsset(QVariant asset) {
|
void onSelectedAsset(QVariant asset = "") {
|
||||||
_result = asset;
|
_result = asset;
|
||||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||||
emit response(_result);
|
emit response(_result);
|
||||||
|
|
Loading…
Reference in a new issue