ui: removed namespace nodes from graph
Nodes within namespaces are display their full name including the namespace.
This commit is contained in:
@@ -272,7 +272,7 @@ std::shared_ptr<QtGraphNode> QtGraphView::createNodeRecursive(
|
|||||||
std::shared_ptr<QtGraphNode> newNode;
|
std::shared_ptr<QtGraphNode> newNode;
|
||||||
if (node.isGraphNode())
|
if (node.isGraphNode())
|
||||||
{
|
{
|
||||||
newNode = std::make_shared<QtGraphNodeData>(node.data, node.childVisible);
|
newNode = std::make_shared<QtGraphNodeData>(node.data, node.hasNamespace, node.childVisible);
|
||||||
}
|
}
|
||||||
else if (node.isAccessNode())
|
else if (node.isAccessNode())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,13 +5,20 @@
|
|||||||
#include "utility/messaging/type/MessageFocusOut.h"
|
#include "utility/messaging/type/MessageFocusOut.h"
|
||||||
#include "utility/messaging/type/MessageGraphNodeMove.h"
|
#include "utility/messaging/type/MessageGraphNodeMove.h"
|
||||||
|
|
||||||
QtGraphNodeData::QtGraphNodeData(const Node* data, bool childVisible)
|
QtGraphNodeData::QtGraphNodeData(const Node* data, bool hasNamespace, bool childVisible)
|
||||||
: m_data(data)
|
: m_data(data)
|
||||||
, m_childVisible(childVisible)
|
, m_childVisible(childVisible)
|
||||||
{
|
{
|
||||||
this->setAcceptHoverEvents(true);
|
this->setAcceptHoverEvents(true);
|
||||||
|
|
||||||
this->setName(data->getName());
|
if (hasNamespace)
|
||||||
|
{
|
||||||
|
this->setName(data->getFullName());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->setName(data->getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QtGraphNodeData::~QtGraphNodeData()
|
QtGraphNodeData::~QtGraphNodeData()
|
||||||
@@ -35,10 +42,7 @@ Id QtGraphNodeData::getTokenId() const
|
|||||||
|
|
||||||
void QtGraphNodeData::onClick()
|
void QtGraphNodeData::onClick()
|
||||||
{
|
{
|
||||||
if (!m_data->isType(Node::NODE_UNDEFINED | Node::NODE_NAMESPACE))
|
MessageActivateNode(m_data->getId(), m_data->getType(), m_data->getFullName()).dispatch();
|
||||||
{
|
|
||||||
MessageActivateNode(m_data->getId(), m_data->getType(), m_data->getFullName()).dispatch();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtGraphNodeData::moved(const Vec2i& oldPosition)
|
void QtGraphNodeData::moved(const Vec2i& oldPosition)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ class QtGraphNodeData
|
|||||||
: public QtGraphNode
|
: public QtGraphNode
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QtGraphNodeData(const Node* data, bool childVisible);
|
QtGraphNodeData(const Node* data, bool hasNamespace, bool childVisible);
|
||||||
virtual ~QtGraphNodeData();
|
virtual ~QtGraphNodeData();
|
||||||
|
|
||||||
const Node* getData() const;
|
const Node* getData() const;
|
||||||
|
|||||||
@@ -168,6 +168,8 @@ void GraphController::createDummyGraphForTokenIds(const std::vector<Id>& tokenId
|
|||||||
autoExpandActiveNode(tokenIds);
|
autoExpandActiveNode(tokenIds);
|
||||||
setActiveAndVisibility(tokenIds);
|
setActiveAndVisibility(tokenIds);
|
||||||
|
|
||||||
|
splitNamespaceNodes();
|
||||||
|
|
||||||
bundleNodes();
|
bundleNodes();
|
||||||
|
|
||||||
layoutNesting();
|
layoutNesting();
|
||||||
@@ -270,6 +272,45 @@ DummyNode GraphController::createDummyNodeTopDown(Node* node)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GraphController::splitNamespaceNodes()
|
||||||
|
{
|
||||||
|
std::vector<DummyNode> nodes;
|
||||||
|
|
||||||
|
for (const DummyNode& node : m_dummyNodes)
|
||||||
|
{
|
||||||
|
std::vector<DummyNode> newNodes = splitNamespaceNodesRecursive(node, false, true);
|
||||||
|
nodes.insert(nodes.end(), newNodes.begin(), newNodes.end());
|
||||||
|
}
|
||||||
|
|
||||||
|
m_dummyNodes = nodes;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<DummyNode> GraphController::splitNamespaceNodesRecursive(const DummyNode& node, bool active, bool topLevel)
|
||||||
|
{
|
||||||
|
std::vector<DummyNode> nodes;
|
||||||
|
active |= node.active;
|
||||||
|
|
||||||
|
if (node.isGraphNode() && node.data->isType(Node::NODE_UNDEFINED | Node::NODE_NAMESPACE))
|
||||||
|
{
|
||||||
|
for (const DummyNode& subNode : node.subNodes)
|
||||||
|
{
|
||||||
|
std::vector<DummyNode> newNodes = splitNamespaceNodesRecursive(subNode, active, false);
|
||||||
|
for (DummyNode& newNode : newNodes)
|
||||||
|
{
|
||||||
|
newNode.hasNamespace = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
nodes.insert(nodes.end(), newNodes.begin(), newNodes.end());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (topLevel || active || node.connected)
|
||||||
|
{
|
||||||
|
nodes.push_back(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
return nodes;
|
||||||
|
}
|
||||||
|
|
||||||
void GraphController::autoExpandActiveNode(const std::vector<Id>& activeTokenIds)
|
void GraphController::autoExpandActiveNode(const std::vector<Id>& activeTokenIds)
|
||||||
{
|
{
|
||||||
DummyNode* node = nullptr;
|
DummyNode* node = nullptr;
|
||||||
@@ -409,7 +450,7 @@ void GraphController::setNodeVisibilityRecursiveTopDown(DummyNode& node, bool pa
|
|||||||
if ((node.isGraphNode() && node.isExpanded()) ||
|
if ((node.isGraphNode() && node.isExpanded()) ||
|
||||||
(node.isAccessNode() && parentExpanded) ||
|
(node.isAccessNode() && parentExpanded) ||
|
||||||
(node.isGraphNode() && node.data->isType(Node::NODE_ENUM)) ||
|
(node.isGraphNode() && node.data->isType(Node::NODE_ENUM)) ||
|
||||||
(node.isGraphNode() && node.active && node.data->isType(Node::NODE_NAMESPACE | Node::NODE_UNDEFINED)))
|
(node.isGraphNode() && node.data->isType(Node::NODE_NAMESPACE | Node::NODE_UNDEFINED)))
|
||||||
{
|
{
|
||||||
for (DummyNode& subNode : node.subNodes)
|
for (DummyNode& subNode : node.subNodes)
|
||||||
{
|
{
|
||||||
@@ -492,7 +533,7 @@ void GraphController::bundleNodesMatching(std::function<bool(const DummyNode&)>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (matchCount < count)
|
if (matchCount < count || matchCount == m_dummyNodes.size())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -674,7 +715,14 @@ void GraphController::layoutNestingRecursive(DummyNode& node) const
|
|||||||
|
|
||||||
if (node.isGraphNode())
|
if (node.isGraphNode())
|
||||||
{
|
{
|
||||||
width = margins.charWidth * node.data->getName().size();
|
if (node.hasNamespace)
|
||||||
|
{
|
||||||
|
width = margins.charWidth * node.data->getFullName().size();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
width = margins.charWidth * node.data->getName().size();
|
||||||
|
}
|
||||||
|
|
||||||
if (node.data->isType(Node::NODE_CLASS | Node::NODE_STRUCT) && node.subNodes.size())
|
if (node.data->isType(Node::NODE_CLASS | Node::NODE_STRUCT) && node.subNodes.size())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -59,6 +59,9 @@ private:
|
|||||||
bool setNodeVisibilityRecursiveBottomUp(DummyNode& node, bool aggregated) const;
|
bool setNodeVisibilityRecursiveBottomUp(DummyNode& node, bool aggregated) const;
|
||||||
void setNodeVisibilityRecursiveTopDown(DummyNode& node, bool parentExpanded) const;
|
void setNodeVisibilityRecursiveTopDown(DummyNode& node, bool parentExpanded) const;
|
||||||
|
|
||||||
|
void splitNamespaceNodes();
|
||||||
|
std::vector<DummyNode> splitNamespaceNodesRecursive(const DummyNode& node, bool active, bool topLevel);
|
||||||
|
|
||||||
void bundleNodes();
|
void bundleNodes();
|
||||||
void bundleNodesMatching(std::function<bool(const DummyNode&)> matcher, size_t count, const std::string& name);
|
void bundleNodesMatching(std::function<bool(const DummyNode&)> matcher, size_t count, const std::string& name);
|
||||||
bool isTypeNodeWithSingleAggregation(const DummyNode& node, TokenComponentAggregation::Direction direction) const;
|
bool isTypeNodeWithSingleAggregation(const DummyNode& node, TokenComponentAggregation::Direction direction) const;
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ public:
|
|||||||
, connected(false)
|
, connected(false)
|
||||||
, aggregated(false)
|
, aggregated(false)
|
||||||
, expanded(false)
|
, expanded(false)
|
||||||
|
, hasNamespace(false)
|
||||||
, accessType(TokenComponentAccess::ACCESS_NONE)
|
, accessType(TokenComponentAccess::ACCESS_NONE)
|
||||||
, invisibleSubNodeCount(0)
|
, invisibleSubNodeCount(0)
|
||||||
{
|
{
|
||||||
@@ -118,6 +119,7 @@ public:
|
|||||||
bool connected;
|
bool connected;
|
||||||
bool aggregated;
|
bool aggregated;
|
||||||
bool expanded;
|
bool expanded;
|
||||||
|
bool hasNamespace;
|
||||||
|
|
||||||
// AccessNode
|
// AccessNode
|
||||||
TokenComponentAccess::AccessType accessType;
|
TokenComponentAccess::AccessType accessType;
|
||||||
|
|||||||
Reference in New Issue
Block a user