ui: Refactored context menu API, added file path actions in graph and code

* Add 'copy full path' and 'show containing folder' actions to graph view, code view
* Added file path to file node tooltip

bug id = 320
This commit is contained in:
Eberhard Graether
2017-01-26 21:54:57 +01:00
parent 4fc0785002
commit 2aa8c4c22c
11 changed files with 185 additions and 94 deletions
@@ -6,6 +6,7 @@
#include "utility/messaging/type/MessageFocusOut.h"
#include "utility/messaging/type/MessageGraphNodeMove.h"
#include "data/graph/token_component/TokenComponentFilePath.h"
#include "data/graph/token_component/TokenComponentSignature.h"
QtGraphNodeData::QtGraphNodeData(const Node* data, const std::string& name, bool hasParent, bool childVisible, bool hasQualifier)
@@ -35,6 +36,14 @@ QtGraphNodeData::QtGraphNodeData(const Node* data, const std::string& name, bool
toolTip += ": " + sig->getSignature();
}
}
else
{
FilePath path = getFilePath();
if (!path.empty())
{
toolTip += ": " + path.str();
}
}
this->setToolTip(QString::fromStdString(toolTip));
}
@@ -48,6 +57,16 @@ const Node* QtGraphNodeData::getData() const
return m_data;
}
FilePath QtGraphNodeData::getFilePath() const
{
if (m_data->isType(Node::NODE_FILE))
{
return m_data->getComponent<TokenComponentFilePath>()->getFilePath();
}
return FilePath();
}
bool QtGraphNodeData::isDataNode() const
{
return true;
@@ -1,6 +1,8 @@
#ifndef QT_GRAPH_NODE_DATA_H
#define QT_GRAPH_NODE_DATA_H
#include "utility/file/FilePath.h"
#include "qt/view/graphElements/QtGraphNode.h"
class QtGraphNodeData
@@ -11,6 +13,7 @@ public:
virtual ~QtGraphNodeData();
const Node* getData() const;
FilePath getFilePath() const;
// QtGraphNode implementation
virtual bool isDataNode() const;