diff options
author | Mark Janes <mark.a.janes@intel.com> | 2017-11-22 14:20:05 -0800 |
---|---|---|
committer | Mark Janes <mark.a.janes@intel.com> | 2017-11-27 14:25:50 -0800 |
commit | 63c528de8b0bdbc8322c07edf4e5c5f3ecd8fb0f (patch) | |
tree | 17b8ae22b44d0da877356302724d61761e160c2f | |
parent | d0a6ff896e48e77f27a2375d74ec547b13376b23 (diff) |
State: Drop unnecessary "group" designation
Original intent of the "group" of a state item was to locate it within
a tab. Paths are more flexible than static groups. Additionally, a
search window provides accessibility that is not possible with a
tabbed interface.
-rw-r--r-- | retrace/daemon/glframe_retrace_interface.hpp | 12 | ||||
-rw-r--r-- | retrace/daemon/glframe_retrace_skeleton.cpp | 5 | ||||
-rw-r--r-- | retrace/daemon/glframe_retrace_stub.cpp | 3 | ||||
-rw-r--r-- | retrace/daemon/glframe_state_override.cpp | 42 | ||||
-rw-r--r-- | retrace/daemon/playback.proto | 1 | ||||
-rw-r--r-- | retrace/daemon/ui/glframe_state_model.cpp | 15 | ||||
-rw-r--r-- | retrace/daemon/ui/glframe_state_model.hpp | 8 | ||||
-rw-r--r-- | retrace/daemon/ui/qml/StateControl.qml | 18 |
8 files changed, 39 insertions, 65 deletions
diff --git a/retrace/daemon/glframe_retrace_interface.hpp b/retrace/daemon/glframe_retrace_interface.hpp index e6950de3..b42bef59 100644 --- a/retrace/daemon/glframe_retrace_interface.hpp +++ b/retrace/daemon/glframe_retrace_interface.hpp @@ -260,25 +260,19 @@ enum UniformDimension { }; struct StateKey { - std::string group; std::string path; std::string name; StateKey() {} - StateKey(const std::string _group, - const std::string _path, + StateKey(const std::string _path, const std::string _name) - : group(_group), path(_path), name(_name) {} + : path(_path), name(_name) {} bool operator<(const StateKey &o) const { if (path < o.path) return true; if (path > o.path) return false; - if (name < o.name) - return true; - if (name > o.name) - return false; - return group < o.group; + return (name < o.name); } }; diff --git a/retrace/daemon/glframe_retrace_skeleton.cpp b/retrace/daemon/glframe_retrace_skeleton.cpp index 3e21044a..68f8b0bc 100644 --- a/retrace/daemon/glframe_retrace_skeleton.cpp +++ b/retrace/daemon/glframe_retrace_skeleton.cpp @@ -402,7 +402,6 @@ FrameRetraceSkeleton::Run() { state_resp->set_experiment_count(-1); state_resp->add_value(""); auto r_item = state_resp->mutable_item(); - r_item->set_group(""); r_item->set_path(""); r_item->set_name(""); writeResponse(m_socket, proto_response, &m_buf); @@ -415,8 +414,7 @@ FrameRetraceSkeleton::Run() { RenderSelection selection; makeRenderSelection(state.selection(), &selection); auto &item = state.item(); - glretrace::StateKey k(item.group(), - item.path(), + glretrace::StateKey k(item.path(), item.name()); m_frame->setState(selection, k, state.offset(), state.value()); break; @@ -651,7 +649,6 @@ FrameRetraceSkeleton::onState(SelectionId selectionCount, response->set_selection_count(selectionCount()); response->set_experiment_count(experimentCount.count()); auto r_item = response->mutable_item(); - r_item->set_group(item.group); r_item->set_path(item.path); r_item->set_name(item.name); for (auto i : value) diff --git a/retrace/daemon/glframe_retrace_stub.cpp b/retrace/daemon/glframe_retrace_stub.cpp index 243c94d6..8dd5ee66 100644 --- a/retrace/daemon/glframe_retrace_stub.cpp +++ b/retrace/daemon/glframe_retrace_stub.cpp @@ -1000,7 +1000,7 @@ class StateRequest : public IRetraceRequest { } const RenderId rid(state_response.render_id()); auto &item = state_response.item(); - glretrace::StateKey k(item.group(), item.path(), item.name()); + glretrace::StateKey k(item.path(), item.name()); std::vector<std::string> value; for (auto v : state_response.value()) value.push_back(v); @@ -1032,7 +1032,6 @@ class SetStateRequest : public IRetraceRequest { msg.set_requesttype(ApiTrace::SET_STATE_REQUEST); auto req = msg.mutable_set_state(); auto item = req->mutable_item(); - item->set_group(m_item.group); item->set_path(m_item.path); item->set_name(m_item.name); auto selection = req->mutable_selection(); diff --git a/retrace/daemon/glframe_state_override.cpp b/retrace/daemon/glframe_state_override.cpp index f2ff624d..7459200a 100644 --- a/retrace/daemon/glframe_state_override.cpp +++ b/retrace/daemon/glframe_state_override.cpp @@ -386,132 +386,132 @@ StateOverride::onState(SelectionId selId, // man page: // https://www.khronos.org/registry/OpenGL-Refpages/es3.1/html/glGet.xhtml { - StateKey k("Rendering", "Cull State", "GL_CULL_FACE"); + StateKey k("Cull State", "GL_CULL_FACE"); getState(k, &data); callback->onState(selId, experimentCount, renderId, k, {data[0] ? "true" : "false"}); } { - StateKey k("Rendering", "Cull State", "GL_CULL_FACE_MODE"); + StateKey k("Cull State", "GL_CULL_FACE_MODE"); getState(k, &data); callback->onState(selId, experimentCount, renderId, k, {state_enum_to_name(data[0])}); } { - StateKey k("Rendering", "Blend State", "GL_BLEND"); + StateKey k("Blend State", "GL_BLEND"); getState(k, &data); callback->onState(selId, experimentCount, renderId, k, {data[0] ? "true" : "false"}); } { - StateKey k("Rendering", "Blend State", "GL_BLEND_SRC"); + StateKey k("Blend State", "GL_BLEND_SRC"); getState(k, &data); callback->onState(selId, experimentCount, renderId, k, {state_enum_to_name(data[0])}); } { - StateKey k("Rendering", "Blend State", "GL_BLEND_SRC_ALPHA"); + StateKey k("Blend State", "GL_BLEND_SRC_ALPHA"); getState(k, &data); callback->onState(selId, experimentCount, renderId, k, {state_enum_to_name(data[0])}); } { - StateKey k("Rendering", "Blend State", "GL_BLEND_SRC_RGB"); + StateKey k("Blend State", "GL_BLEND_SRC_RGB"); getState(k, &data); callback->onState(selId, experimentCount, renderId, k, {state_enum_to_name(data[0])}); } { - StateKey k("Rendering", "Blend State", "GL_BLEND_DST"); + StateKey k("Blend State", "GL_BLEND_DST"); getState(k, &data); callback->onState(selId, experimentCount, renderId, k, {state_enum_to_name(data[0])}); } { - StateKey k("Rendering", "Blend State", "GL_BLEND_DST_ALPHA"); + StateKey k("Blend State", "GL_BLEND_DST_ALPHA"); getState(k, &data); callback->onState(selId, experimentCount, renderId, k, {state_enum_to_name(data[0])}); } { - StateKey k("Rendering", "Blend State", "GL_BLEND_DST_RGB"); + StateKey k("Blend State", "GL_BLEND_DST_RGB"); getState(k, &data); callback->onState(selId, experimentCount, renderId, k, {state_enum_to_name(data[0])}); } { - StateKey k("Rendering", "Blend State", "GL_BLEND_COLOR"); + StateKey k("Blend State", "GL_BLEND_COLOR"); getState(k, &data); std::vector<std::string> color; floatStrings(data, &color); callback->onState(selId, experimentCount, renderId, k, color); } { - StateKey k("Rendering", "Line State", "GL_LINE_WIDTH"); + StateKey k("Line State", "GL_LINE_WIDTH"); getState(k, &data); std::string value; floatString(data[0], &value); callback->onState(selId, experimentCount, renderId, k, {value}); } { - StateKey k("Rendering", "Line State", "GL_LINE_SMOOTH"); + StateKey k("Line State", "GL_LINE_SMOOTH"); getState(k, &data); callback->onState(selId, experimentCount, renderId, k, {data[0] ? "true" : "false"}); } { - StateKey k("Rendering", "Blend State", "GL_BLEND_EQUATION_RGB"); + StateKey k("Blend State", "GL_BLEND_EQUATION_RGB"); getState(k, &data); callback->onState(selId, experimentCount, renderId, k, {state_enum_to_name(data[0])}); } { - StateKey k("Rendering", "Blend State", "GL_BLEND_EQUATION_ALPHA"); + StateKey k("Blend State", "GL_BLEND_EQUATION_ALPHA"); getState(k, &data); callback->onState(selId, experimentCount, renderId, k, {state_enum_to_name(data[0])}); } { - StateKey k("Rendering", "Clear State", "GL_COLOR_CLEAR_VALUE"); + StateKey k("Clear State", "GL_COLOR_CLEAR_VALUE"); getState(k, &data); std::vector<std::string> color; floatStrings(data, &color); callback->onState(selId, experimentCount, renderId, k, color); } { - StateKey k("Rendering", "FrameBuffer State/Red Enabled", + StateKey k("FrameBuffer State/Red Enabled", "GL_COLOR_WRITEMASK"); getState(k, &data); callback->onState(selId, experimentCount, renderId, k, {data[0] ? "true" : "false"}); { - StateKey k("Rendering", "FrameBuffer State/Green Enabled", + StateKey k("FrameBuffer State/Green Enabled", "GL_COLOR_WRITEMASK"); callback->onState(selId, experimentCount, renderId, k, {data[1] ? "true" : "false"}); } { - StateKey k("Rendering", "FrameBuffer State/Blue Enabled", + StateKey k("FrameBuffer State/Blue Enabled", "GL_COLOR_WRITEMASK"); callback->onState(selId, experimentCount, renderId, k, {data[2] ? "true" : "false"}); } { - StateKey k("Rendering", "FrameBuffer State/Alpha Enabled", + StateKey k("FrameBuffer State/Alpha Enabled", "GL_COLOR_WRITEMASK"); callback->onState(selId, experimentCount, renderId, k, {data[3] ? "true" : "false"}); } } { - StateKey k("Rendering", "Depth State", "GL_DEPTH_CLEAR_VALUE"); + StateKey k("Depth State", "GL_DEPTH_CLEAR_VALUE"); getState(k, &data); std::string value; floatString(data[0], &value); callback->onState(selId, experimentCount, renderId, k, {value}); } { - StateKey k("Rendering", "Depth State", "GL_DEPTH_FUNC"); + StateKey k("Depth State", "GL_DEPTH_FUNC"); getState(k, &data); callback->onState(selId, experimentCount, renderId, k, {state_enum_to_name(data[0])}); diff --git a/retrace/daemon/playback.proto b/retrace/daemon/playback.proto index 64ffc241..758cd618 100644 --- a/retrace/daemon/playback.proto +++ b/retrace/daemon/playback.proto @@ -232,7 +232,6 @@ message StateRequest { } message StateKey { - required string group = 1; required string path = 2; required string name = 3; } diff --git a/retrace/daemon/ui/glframe_state_model.cpp b/retrace/daemon/ui/glframe_state_model.cpp index cfb32e19..cdc7d496 100644 --- a/retrace/daemon/ui/glframe_state_model.cpp +++ b/retrace/daemon/ui/glframe_state_model.cpp @@ -49,12 +49,10 @@ QStateValue::QStateValue(QObject *parent) { } QStateValue::QStateValue(QObject *parent, - const std::string &_group, const std::string &_path, const std::string &_name, const std::vector<std::string> &_choices) - : m_group(_group.c_str()), - m_path(_path.c_str()), + : m_path(_path.c_str()), m_name(_name.c_str()), m_value(kUninitializedValue), m_visible(true), @@ -205,11 +203,10 @@ void QStateModel::onState(SelectionId selectionCount, if (known == m_known_paths.end()) { // create an empty item to serve as the directory QStateValue *i = new QStateValue(this, - item.group, path_comp, "", - std::vector<std::string>()); - StateKey k(item.group, path_comp, ""); + {}); + StateKey k(path_comp, ""); m_state_by_name[k] = i; m_known_paths[path_comp] = true; } else { @@ -222,7 +219,6 @@ void QStateModel::onState(SelectionId selectionCount, auto state_value = m_state_by_name.find(item); if (state_value == m_state_by_name.end()) { QStateValue *i = new QStateValue(this, - item.group, item.path, name, state_name_to_choices(name)); @@ -243,8 +239,7 @@ void QStateModel::onState(SelectionId selectionCount, } void -QStateModel::setState(const QString &group, - const QString &path, +QStateModel::setState(const QString &path, const QString &name, int offset, const QString &value) { @@ -261,7 +256,7 @@ QStateModel::setState(const QString &group, ++r; } - StateKey key(group.toStdString(), path.toStdString(), name.toStdString()); + StateKey key(path.toStdString(), name.toStdString()); m_retrace->setState(sel, key, offset, value.toStdString()); emit stateExperiment(); } diff --git a/retrace/daemon/ui/glframe_state_model.hpp b/retrace/daemon/ui/glframe_state_model.hpp index 358dc9f2..deb3a7b9 100644 --- a/retrace/daemon/ui/glframe_state_model.hpp +++ b/retrace/daemon/ui/glframe_state_model.hpp @@ -47,7 +47,6 @@ namespace glretrace { class QStateValue : public QObject, NoCopy, NoAssign, NoMove { Q_OBJECT - Q_PROPERTY(QString group READ group CONSTANT) Q_PROPERTY(QString path READ path CONSTANT) Q_PROPERTY(QString name READ name CONSTANT) Q_PROPERTY(QVariant value READ value CONSTANT) @@ -70,7 +69,6 @@ class QStateValue : public QObject, NoCopy, NoAssign, NoMove { explicit QStateValue(QObject *parent = 0); QStateValue(QObject *parent, - const std::string &_group, const std::string &_path, const std::string &_name, const std::vector<std::string> &_choices); @@ -78,7 +76,6 @@ class QStateValue : public QObject, NoCopy, NoAssign, NoMove { void insert(const std::string &red, const std::string &blue, const std::string &green, const std::string &alpha); - QString group() const { return m_group; } QString path() const { return m_path; } QString name() const { return m_name; } QStateType valueType() const { return m_type; } @@ -92,7 +89,7 @@ class QStateValue : public QObject, NoCopy, NoAssign, NoMove { void visibleChanged(); private: - QString m_group, m_path, m_name; + QString m_path, m_name; QVariant m_value, m_indent, m_visible; QStateType m_type; QList<QVariant> m_choices; @@ -114,8 +111,7 @@ class QStateModel : public QObject, StateKey item, const std::vector<std::string> &value); void clear(); - Q_INVOKABLE void setState(const QString &group, - const QString &path, + Q_INVOKABLE void setState(const QString &path, const QString &name, int offset, const QString &value); diff --git a/retrace/daemon/ui/qml/StateControl.qml b/retrace/daemon/ui/qml/StateControl.qml index 1280ab97..a1a94b02 100644 --- a/retrace/daemon/ui/qml/StateControl.qml +++ b/retrace/daemon/ui/qml/StateControl.qml @@ -107,8 +107,7 @@ Item { text = modelData.value; return; } - stateModel.setState(modelData.group, - modelData.path, + stateModel.setState(modelData.path, modelData.name, 0, text); @@ -130,8 +129,7 @@ Item { text = modelData.value[0]; return; } - stateModel.setState(modelData.group, - modelData.path, + stateModel.setState(modelData.path, modelData.name, 0, text); @@ -149,8 +147,7 @@ Item { text = modelData.value[1]; return; } - stateModel.setState(modelData.group, - modelData.path, + stateModel.setState(modelData.path, modelData.name, 1, text); @@ -168,8 +165,7 @@ Item { text = modelData.value[2]; return; } - stateModel.setState(modelData.group, - modelData.path, + stateModel.setState(modelData.path, modelData.name, 2, text); @@ -187,8 +183,7 @@ Item { text = modelData.value[3]; return; } - stateModel.setState(modelData.group, - modelData.path, + stateModel.setState(modelData.path, modelData.name, 3, text); @@ -202,8 +197,7 @@ Item { currentIndex: (modelData.valueType == QStateValue.KglEnum ? modelData.value : 0) visible: (modelData.valueType == QStateValue.KglEnum) onActivated: { - stateModel.setState(modelData.group, - modelData.path, + stateModel.setState(modelData.path, modelData.name, 0, modelData.choices[currentIndex]); |