Merge branch 'master' of github.com:highfidelity/hifi into feat/content-settings

This commit is contained in:
Stephen Birarda 2018-02-16 17:41:14 -08:00
commit 769d5677b1
9 changed files with 945 additions and 456 deletions

View file

@ -48,7 +48,7 @@ Rectangle {
// The letterbox used for popup messages
LetterboxMessage {
id: letterboxMessage;
z: 999; // Force the popup on top of everything else
z: 998; // Force the popup on top of everything else
}
Connections {
target: GlobalServices
@ -60,7 +60,7 @@ Rectangle {
// The ComboDialog used for setting availability
ComboDialog {
id: comboDialog;
z: 999; // Force the ComboDialog on top of everything else
z: 998; // Force the ComboDialog on top of everything else
dialogWidth: parent.width - 50;
dialogHeight: parent.height - 100;
}
@ -1013,7 +1013,7 @@ Rectangle {
}
MouseArea {
anchors.fill: parent;
enabled: myData.userName !== "Unknown user";
enabled: myData.userName !== "Unknown user" && !userInfoViewer.visible;
hoverEnabled: true;
onClicked: {
popupComboDialog("Set your availability:",
@ -1044,6 +1044,7 @@ Rectangle {
HifiControls.TabletWebView {
id: userInfoViewer;
z: 999;
anchors {
top: parent.top;
bottom: parent.bottom;

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

@ -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) {

View 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;
}

View file

@ -27,15 +27,44 @@ template <class JC> class JobT;
template <class JC> class TaskT;
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 {
public:
JobContext(const QLoggingCategory& category) : profileCategory(category) {
assert(&category);
}
virtual ~JobContext() {}
JobContext(const QLoggingCategory& category);
virtual ~JobContext();
std::shared_ptr<JobConfig> jobConfig { nullptr };
const QLoggingCategory& profileCategory;
// Task flow control
TaskFlow taskFlow{};
protected:
};
using JobContextPointer = std::shared_ptr<JobContext>;
@ -308,6 +337,10 @@ public:
if (config->alwaysEnabled || config->enabled) {
for (auto job : TaskConcept::_jobs) {
job.run(jobContext);
if (jobContext->taskFlow.doAbortTask()) {
jobContext->taskFlow.reset();
return;
}
}
}
}

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);

File diff suppressed because it is too large Load diff

View file

@ -8,7 +8,7 @@
""
],
"devDependencies": {
"electron-packager": "^6.0.2",
"electron-packager": "^11.0.0",
"electron-prebuilt": "0.37.5"
},
"repository": {
@ -27,7 +27,7 @@
"cheerio": "^0.19.0",
"extend": "^3.0.0",
"fs-extra": "^0.26.4",
"node-notifier": "^4.4.0",
"node-notifier": "^5.2.1",
"os-homedir": "^1.0.1",
"request": "^2.67.0",
"request-progress": "1.0.2",