Cleaning up the isENabled interface andthe qml

This commit is contained in:
Sam Gateau 2018-07-11 11:57:18 +02:00
parent 07299291fc
commit 66199e9aab
12 changed files with 49 additions and 31 deletions

View file

@ -333,7 +333,8 @@ void Bloom::configure(const Config& config) {
for (auto i = 0; i < BLOOM_BLUR_LEVEL_COUNT; i++) {
blurName.back() = '0' + i;
auto blurConfig = config.getConfig<render::BlurGaussian>(blurName);
blurConfig->setProperty("filterScale", 1.0f);
blurConfig->filterScale = 1.0f;
//blurConfig->setProperty("filterScale", 1.0f);
}
}

View file

@ -282,7 +282,7 @@ void RenderShadowTask::build(JobModel& task, const render::Varying& input, rende
}
void RenderShadowTask::configure(const Config& configuration) {
DependencyManager::get<DeferredLightingEffect>()->setShadowMapEnabled(configuration.enabled);
DependencyManager::get<DeferredLightingEffect>()->setShadowMapEnabled(configuration.isEnabled());
// This is a task, so must still propogate configure() to its Jobs
// Task::configure(configuration);
}

View file

@ -20,7 +20,6 @@
namespace render {
class DrawSceneOctreeConfig : public Job::Config {
Q_OBJECT
Q_PROPERTY(bool enabled MEMBER enabled NOTIFY dirty())
Q_PROPERTY(bool showVisibleCells READ getShowVisibleCells WRITE setShowVisibleCells NOTIFY dirty())
Q_PROPERTY(bool showEmptyCells READ getShowEmptyCells WRITE setShowEmptyCells NOTIFY dirty())
Q_PROPERTY(int numAllocatedCells READ getNumAllocatedCells)
@ -82,7 +81,6 @@ namespace render {
class DrawItemSelectionConfig : public Job::Config {
Q_OBJECT
Q_PROPERTY(bool enabled MEMBER enabled NOTIFY dirty())
Q_PROPERTY(bool showInsideItems READ getShowInsideItems WRITE setShowInsideItems NOTIFY dirty())
Q_PROPERTY(bool showInsideSubcellItems READ getShowInsideSubcellItems WRITE setShowInsideSubcellItems NOTIFY dirty())
Q_PROPERTY(bool showPartialItems READ getShowPartialItems WRITE setShowPartialItems NOTIFY dirty())

View file

@ -29,7 +29,7 @@
using namespace render;
void DrawStatusConfig::dirtyHelper() {
enabled = showNetwork || showDisplay;
_isEnabled = showNetwork || showDisplay;
emit dirty();
}

View file

@ -18,6 +18,17 @@
using namespace task;
JobConfig::~JobConfig() {
}
void JobConfig::setEnabled(bool enable) {
if (_isEnabled != enable) {
_isEnabled = enable;
emit dirtyEnabled();
}
}
void JobConfig::setPresetList(const QJsonObject& object) {
for (auto it = object.begin(); it != object.end(); it++) {
JobConfig* child = findChild<JobConfig*>(it.key(), Qt::FindDirectChildrenOnly);
@ -30,6 +41,7 @@ void JobConfig::setPresetList(const QJsonObject& object) {
void TaskConfig::connectChildConfig(QConfigPointer childConfig, const std::string& name) {
childConfig->setParent(this);
childConfig->setObjectName(name.c_str());
// childConfig->propagateParentEnabled((_isParentEnabled ? _isEnabled : false));
// Connect loaded->refresh
QObject::connect(childConfig.get(), SIGNAL(loaded()), this, SLOT(refresh()));
@ -57,6 +69,8 @@ void TaskConfig::transferChildrenConfigs(QConfigPointer source) {
QObject::connect(child, SIGNAL(dirtyEnabled()), this, SLOT(refresh()));
}
}
// propagateParentEnabledToSubs();
}
void TaskConfig::refresh() {

View file

@ -50,12 +50,10 @@ public:
_default = toJsonValue(*this).toObject().toVariantMap();
_presets.unite(list.toVariantMap());
if (C::enabled) {
if (C::isEnabled()) {
_presets.insert(DEFAULT, _default);
}
if (false) { //!C::alwaysEnabled) {
_presets.insert(NONE, QVariantMap{{ "enabled", false }});
}
_presets.insert(NONE, QVariantMap{{ "enabled", false }});
auto preset = _preset.get();
if (preset != _preset.getDefault() && _presets.contains(preset)) {
@ -92,16 +90,21 @@ class JobConfig : public QObject {
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY dirtyEnabled())
double _msCPURunTime{ 0.0 };
protected:
friend class TaskConfig;
bool _isEnabled{ true };
public:
using Persistent = PersistentConfig<JobConfig>;
JobConfig() = default;
JobConfig(bool enabled): enabled{ enabled } {}
JobConfig(bool enabled): _isEnabled{ enabled } {}
~JobConfig();
bool isEnabled() { return /*alwaysEnabled ||*/ enabled; }
void setEnabled(bool enable) { enabled = /*alwaysEnabled ||*/ enable; emit dirtyEnabled(); }
bool enabled{ true };
bool isEnabled() const { return _isEnabled; }
void setEnabled(bool enable);
virtual void setPresetList(const QJsonObject& object);
@ -199,6 +202,7 @@ public:
*/
class TaskConfig : public JobConfig {
Q_OBJECT
public:
using Persistent = PersistentConfig<TaskConfig>;

View file

@ -339,7 +339,7 @@ public:
void run(const ContextPointer& jobContext) override {
auto config = std::static_pointer_cast<C>(Concept::_config);
if (config->enabled) {
if (config->isEnabled()) {
for (auto job : TaskConcept::_jobs) {
job.run(jobContext);
if (jobContext->taskFlow.doAbortTask()) {

View file

@ -19,7 +19,7 @@ import "../jet.js" as Jet
Rectangle {
HifiConstants { id: hifi;}
// color: hifi.colors.baseGray;
color: Qt.rgba(hifi.colors.baseGray.r, hifi.colors.baseGray.g, hifi.colors.baseGray.b, 0.8);
id: root;
property var rootConfig : Workload
@ -82,8 +82,8 @@ Rectangle {
id: objCheck
property var config: root.rootConfig.getConfig(model.path + "." + model.name);
text: " "
checked: config.enabled
onCheckedChanged: { config.enabled = checked }
checked: root.rootConfig.getConfig(model.path + "." + model.name).enabled
onCheckedChanged: { root.rootConfig.getConfig(model.path + "." + model.name).enabled = checked }
}
MouseArea {
@ -95,12 +95,12 @@ Rectangle {
HifiControls.Label {
id: objLabel
colorScheme: hifi.colorSchemes.dark
// property var config: root.rootConfig.getConfig(model.path + "." + model.name);
colorScheme: (root.rootConfig.getConfig(model.path + "." + model.name) ? hifi.colorSchemes.dark : hifi.colorSchemes.light)
text: (objRecursiveColumn.children.length > 2 ?
objRecursiveColumn.children[1].visible ?
qsTr("- ") : qsTr("+ ") : qsTr(" ")) + model.name
+ " ms=" + root.rootConfig.getConfig(model.path + "." + model.name).cpuRunTime.toFixed(3)
// + " ms=" + config.cpuRunTime.toFixed(3)
+ " id=" + model.id
}
}

View file

@ -19,7 +19,7 @@ import "../jet.js" as Jet
Rectangle {
HifiConstants { id: hifi;}
// color: hifi.colors.baseGray;
color: Qt.rgba(hifi.colors.baseGray.r, hifi.colors.baseGray.g, hifi.colors.baseGray.b, 0.8);
id: root;
property var rootConfig : Workload
@ -59,7 +59,8 @@ Rectangle {
function pullFreshValues() {
for (var j = 0; j <jobsArray.length; j++) {
jobsArray[j].cpuT = root.rootConfig.getConfig(jobsArray[j].fullpath).cpuRunTime
jobsArray[j].cpuT = Render.getConfig(jobsArray[j].fullpath).cpuRunTime
// jobsArray[j].cpuT = root.rootConfig.getConfig(jobsArray[j].fullpath).cpuRunTime
}
mycanvas.requestPaint()
}

View file

@ -13,10 +13,10 @@
openEngineTaskView();*/
(function() {
var TABLET_BUTTON_NAME = "Render Engine";
var TABLET_BUTTON_NAME = "Inspector";
var QMLAPP_URL = Script.resolvePath("./engineInspector.qml");
var ICON_URL = Script.resolvePath("../../../system/assets/images/lod-i.svg");
var ACTIVE_ICON_URL = Script.resolvePath("../../../system/assets/images/lod-a.svg");
var ICON_URL = Script.resolvePath("../../../system/assets/images/luci-i.svg");
var ACTIVE_ICON_URL = Script.resolvePath("../../../system/assets/images/luci-a.svg");
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var button = tablet.addButton({
@ -49,8 +49,8 @@
window = new OverlayWindow({
title: 'Render Engine Inspector',
source: qml,
width: 500,
height: 100
width: 250,
height: 500
});
window.setPosition(200, 50);
window.closed.connect(killWindow);

View file

@ -21,7 +21,7 @@ Item {
id: root;
anchors.fill: parent
property var rootConfig: Render.getConfig("RenderMainView")
property var rootConfig: Render.getConfig("")
Jet.TaskListView {
rootConfig: root.rootConfig

View file

@ -1,10 +1,10 @@
(function() {
var TABLET_BUTTON_NAME = "Render Engine Profiler";
var TABLET_BUTTON_NAME = "Profiler";
var QMLAPP_URL = Script.resolvePath("./engineProfiler.qml");
var ICON_URL = Script.resolvePath("../../../system/assets/images/lod-i.svg");
var ACTIVE_ICON_URL = Script.resolvePath("../../../system/assets/images/lod-a.svg");
var ICON_URL = Script.resolvePath("../../../system/assets/images/luci-i.svg");
var ACTIVE_ICON_URL = Script.resolvePath("../../../system/assets/images/luci-a.svg");
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var button = tablet.addButton({