src: converted NodeType to a class

NodeType internally still uses the Type enum
This commit is contained in:
mlangkabel
2017-11-23 17:05:15 +01:00
parent c512992e2c
commit 90e17c5868
52 changed files with 779 additions and 656 deletions
@@ -34,9 +34,9 @@ void QtGraphNode::hideNode()
this->hide();
}
QFont QtGraphNode::getFontForNodeType(Node::NodeType type)
QFont QtGraphNode::getFontForNodeType(NodeType type)
{
QFont font(GraphViewStyle::getFontNameForNodeType(type).c_str());
QFont font(GraphViewStyle::getFontNameForDataNode().c_str());
font.setPixelSize(GraphViewStyle::getFontSizeForNodeType(type));
return font;
}
@@ -31,7 +31,7 @@ public slots:
void hideNode();
public:
static QFont getFontForNodeType(Node::NodeType type);
static QFont getFontForNodeType(NodeType type);
QtGraphNode();
virtual ~QtGraphNode();
@@ -9,7 +9,7 @@
#include "component/view/GraphViewStyle.h"
#include "qt/graphics/QtCountCircleItem.h"
QtGraphNodeBundle::QtGraphNodeBundle(Id tokenId, size_t nodeCount, Node::NodeType type, std::string name)
QtGraphNodeBundle::QtGraphNodeBundle(Id tokenId, size_t nodeCount, NodeType type, std::string name)
: QtGraphNode()
, m_tokenId(tokenId)
, m_type(type)
@@ -42,8 +42,8 @@ void QtGraphNodeBundle::onClick()
{
MessageGraphNodeBundleSplit(
m_tokenId,
m_type != Node::NODE_NON_INDEXED && getName() != "Anonymous Namespaces",
m_type != Node::NODE_NON_INDEXED
m_type.getType() != NodeType::NODE_NON_INDEXED && getName() != "Anonymous Namespaces",
m_type.getType() != NodeType::NODE_NON_INDEXED
).dispatch();
}
@@ -57,7 +57,7 @@ void QtGraphNodeBundle::moved(const Vec2i& oldPosition)
void QtGraphNodeBundle::updateStyle()
{
GraphViewStyle::NodeStyle style;
if (m_type != Node::NODE_NON_INDEXED)
if (m_type.getType() != NodeType::NODE_NON_INDEXED)
{
style = GraphViewStyle::getStyleForNodeType(m_type, true, false, m_isHovering, false, false);
}
@@ -11,7 +11,7 @@ class QtGraphNodeBundle
{
Q_OBJECT
public:
QtGraphNodeBundle(Id tokenId, size_t nodeCount, Node::NodeType type, std::string name);
QtGraphNodeBundle(Id tokenId, size_t nodeCount, NodeType type, std::string name);
virtual ~QtGraphNodeBundle();
// QtGraphNode implementation
@@ -29,7 +29,7 @@ protected:
private:
QtCountCircleItem* m_circle;
Id m_tokenId;
Node::NodeType m_type;
NodeType m_type;
};
#endif // QT_GRAPH_NODE_BUNDLE_H
@@ -30,7 +30,7 @@ const Node* QtGraphNodeData::getData() const
FilePath QtGraphNodeData::getFilePath() const
{
if (m_data->isType(Node::NODE_FILE))
if (m_data->getType().isFile())
{
return m_data->getComponent<TokenComponentFilePath>()->getFilePath();
}
@@ -21,7 +21,7 @@ QtGraphNodeQualifier::QtGraphNodeQualifier(const NameHierarchy& name)
m_rightArrowSmall = new QGraphicsPolygonItem(this);
QFont font;
font.setFamily(GraphViewStyle::getFontNameForNodeType(Node::NODE_NON_INDEXED).c_str());
font.setFamily(GraphViewStyle::getFontNameForDataNode().c_str());
font.setPixelSize(GraphViewStyle::getFontSizeOfQualifier());
font.setWeight(QFont::Normal);