ui: redesigned graph overview and use new list layouting within overview bundles

* overview bundles imitate style of bundled node type
* removed bundle for built-in types
* show contents of overview bundle in vertical list layouted with new ListLayouter
* nodes starting with the same letter are grouped with the letter displayed above
* pressing the letter key will scroll to the group
* also use this list layouting for namespace & package contents
* renamed BucketGrid to BucketLayouter
* moved used functions of GraphPostProcessor to GraphViewStyle and removed GraphPostProcessor

fortune cookie message = Don't be afraid to take that big step
This commit is contained in:
Eberhard Graether
2017-02-02 13:29:40 +01:00
parent 993d66727d
commit 52b0cd2017
34 changed files with 577 additions and 578 deletions
@@ -5,15 +5,12 @@
#include <QGraphicsSceneEvent>
#include <QPen>
#include "utility/ResourcePaths.h"
#include "component/controller/helper/GraphPostprocessor.h"
#include "qt/graphics/QtRoundedRectItem.h"
#include "qt/utility/QtDeviceScaledPixmap.h"
#include "qt/utility/utilityQt.h"
#include "qt/view/graphElements/nodeComponents/QtGraphNodeComponent.h"
#include "qt/view/graphElements/QtGraphEdge.h"
#include "utility/ResourcePaths.h"
void QtGraphNode::blendIn()
{
@@ -250,6 +247,11 @@ bool QtGraphNode::isQualifierNode() const
return false;
}
bool QtGraphNode::isTextNode() const
{
return false;
}
Id QtGraphNode::getTokenId() const
{
return 0;
@@ -277,7 +279,7 @@ void QtGraphNode::addSubNode(const std::shared_ptr<QtGraphNode>& node)
void QtGraphNode::moved(const Vec2i& oldPosition)
{
setPosition(GraphPostprocessor::alignOnRaster(getPosition()));
setPosition(GraphViewStyle::alignOnRaster(getPosition()));
}
void QtGraphNode::onClick()
@@ -77,6 +77,7 @@ public:
virtual bool isExpandToggleNode() const;
virtual bool isBundleNode() const;
virtual bool isQualifierNode() const;
virtual bool isTextNode() const;
virtual Id getTokenId() const;
@@ -8,9 +8,10 @@
#include "component/view/GraphViewStyle.h"
#include "qt/graphics/QtCountCircleItem.h"
QtGraphNodeBundle::QtGraphNodeBundle(Id tokenId, size_t nodeCount, std::string name)
QtGraphNodeBundle::QtGraphNodeBundle(Id tokenId, size_t nodeCount, Node::NodeType type, std::string name)
: QtGraphNode()
, m_tokenId(tokenId)
, m_type(type)
{
this->setName(name);
@@ -38,12 +39,24 @@ Id QtGraphNodeBundle::getTokenId() const
void QtGraphNodeBundle::onClick()
{
MessageGraphNodeBundleSplit(m_tokenId).dispatch();
MessageGraphNodeBundleSplit(
m_tokenId,
m_type != Node::NODE_UNDEFINED && getName() != "Anonymous Namespaces",
m_type != Node::NODE_UNDEFINED
).dispatch();
}
void QtGraphNodeBundle::updateStyle()
{
GraphViewStyle::NodeStyle style = GraphViewStyle::getStyleOfBundleNode(m_isHovering);
GraphViewStyle::NodeStyle style;
if (m_type != Node::NODE_UNDEFINED)
{
style = GraphViewStyle::getStyleForNodeType(m_type, true, false, m_isHovering, false, false);
}
else
{
style = GraphViewStyle::getStyleOfBundleNode(m_isHovering);
}
setStyle(style);
m_circle->setPosition(Vec2f(m_rect->rect().right() - 3, m_rect->rect().top() + 3));
@@ -1,6 +1,7 @@
#ifndef QT_GRAPH_NODE_BUNDLE_H
#define QT_GRAPH_NODE_BUNDLE_H
#include "data/graph/Node.h"
#include "qt/view/graphElements/QtGraphNode.h"
class QtCountCircleItem;
@@ -9,7 +10,7 @@ class QtGraphNodeBundle
: public QtGraphNode
{
public:
QtGraphNodeBundle(Id tokenId, size_t nodeCount, std::string name);
QtGraphNodeBundle(Id tokenId, size_t nodeCount, Node::NodeType type, std::string name);
virtual ~QtGraphNodeBundle();
// QtGraphNode implementation
@@ -27,6 +28,7 @@ protected:
private:
QtCountCircleItem* m_circle;
Id m_tokenId;
Node::NodeType m_type;
};
#endif // QT_GRAPH_NODE_BUNDLE_H
@@ -0,0 +1,20 @@
#include "qt/view/graphElements/QtGraphNodeText.h"
QtGraphNodeText::QtGraphNodeText(const std::string& name)
{
setName(name);
}
QtGraphNodeText::~QtGraphNodeText()
{
}
bool QtGraphNodeText::isTextNode() const
{
return true;
}
void QtGraphNodeText::updateStyle()
{
setStyle(GraphViewStyle::getStyleOfTextNode());
}
@@ -0,0 +1,19 @@
#ifndef QT_GRAPH_NODE_TEXT_H
#define QT_GRAPH_NODE_TEXT_H
#include "qt/view/graphElements/QtGraphNode.h"
class QtGraphNodeText
: public QtGraphNode
{
public:
QtGraphNodeText(const std::string& name);
virtual ~QtGraphNodeText();
// QtGraphNode implementation
virtual bool isTextNode() const;
virtual void updateStyle();
};
#endif // QT_GRAPH_NODE_TEXT_H