src: various fixes
* fixed crash when hovering GraphNode while expanding/collapsing it * fixed clang warnings * fixed GraphNodeExpandToggle to show empty circle * fixed Searchbar showing empty block when nothing was parsed * made template related edges in GraphView red
This commit is contained in:
@@ -100,6 +100,16 @@ void QtGraphView::switchToNewGraphData()
|
||||
{
|
||||
m_oldGraph = m_graph;
|
||||
|
||||
for (const std::shared_ptr<QtGraphNode>& node : m_oldNodes)
|
||||
{
|
||||
node->hide();
|
||||
}
|
||||
|
||||
for (const std::shared_ptr<QtGraphEdge>& edge : m_oldEdges)
|
||||
{
|
||||
edge->hide();
|
||||
}
|
||||
|
||||
m_oldNodes = m_nodes;
|
||||
m_oldEdges = m_edges;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "qt/view/graphElements/QtGraphNodeExpandToggle.h"
|
||||
|
||||
#include "utility/logging/logging.h"
|
||||
#include "utility/messaging/type/MessageGraphNodeExpand.h"
|
||||
|
||||
#include "qt/graphics/QtRoundedRectItem.h"
|
||||
@@ -8,31 +9,29 @@
|
||||
QtGraphNodeExpandToggle::QtGraphNodeExpandToggle(bool expanded, int invisibleSubNodeCount)
|
||||
: m_allVisible(invisibleSubNodeCount == 0)
|
||||
{
|
||||
if (!expanded && !invisibleSubNodeCount)
|
||||
{
|
||||
LOG_ERROR("ExpandToggle shouldn't be visible");
|
||||
return;
|
||||
}
|
||||
|
||||
const int iconHeight = 4;
|
||||
m_icon = new QGraphicsPixmapItem(this);
|
||||
|
||||
if (!expanded && !invisibleSubNodeCount)
|
||||
QtDeviceScaledPixmap pixmap("data/gui/graph_view/images/arrow.png");
|
||||
pixmap.scaleToHeight(iconHeight);
|
||||
|
||||
if (invisibleSubNodeCount)
|
||||
{
|
||||
this->hide();
|
||||
return;
|
||||
QString numberStr = QString::number(invisibleSubNodeCount);
|
||||
m_text->setText(numberStr);
|
||||
}
|
||||
else
|
||||
{
|
||||
QtDeviceScaledPixmap pixmap("data/gui/graph_view/images/arrow.png");
|
||||
pixmap.scaleToHeight(iconHeight);
|
||||
|
||||
if (invisibleSubNodeCount)
|
||||
{
|
||||
QString numberStr = QString::number(invisibleSubNodeCount);
|
||||
m_text->setText(numberStr);
|
||||
}
|
||||
else
|
||||
{
|
||||
pixmap.mirror();
|
||||
}
|
||||
|
||||
m_icon->setPixmap(pixmap.pixmap());
|
||||
pixmap.mirror();
|
||||
}
|
||||
|
||||
m_icon->setPixmap(pixmap.pixmap());
|
||||
}
|
||||
|
||||
QtGraphNodeExpandToggle::~QtGraphNodeExpandToggle()
|
||||
|
||||
@@ -99,12 +99,15 @@ void Application::handleMessage(MessageFinishedParsing* message)
|
||||
|
||||
Id mainId = m_storageAccessProxy->getIdForNodeWithName("main");
|
||||
|
||||
if (!mainId)
|
||||
if (!mainId && m_storageAccessProxy->getNameForNodeWithId(1).size() > 0)
|
||||
{
|
||||
mainId = 1;
|
||||
}
|
||||
|
||||
MessageActivateTokens(mainId).dispatch();
|
||||
if (mainId)
|
||||
{
|
||||
MessageActivateTokens(mainId).dispatch();
|
||||
}
|
||||
}
|
||||
|
||||
void Application::handleMessage(MessageLoadProject* message)
|
||||
|
||||
@@ -523,7 +523,10 @@ void GraphController::addExpandToggleNode(DummyNode& node) const
|
||||
}
|
||||
}
|
||||
|
||||
node.subNodes.push_back(expandNode);
|
||||
if (expandNode.isExpanded() || expandNode.invisibleSubNodeCount)
|
||||
{
|
||||
node.subNodes.push_back(expandNode);
|
||||
}
|
||||
}
|
||||
|
||||
void GraphController::layoutToGrid(DummyNode& node) const
|
||||
|
||||
@@ -13,7 +13,6 @@ SearchController::~SearchController()
|
||||
{
|
||||
}
|
||||
|
||||
#include <iostream>
|
||||
void SearchController::handleMessage(MessageActivateTokens* message)
|
||||
{
|
||||
if (!m_ignoreNextMessageActivateTokens && message->tokenIds.size())
|
||||
|
||||
@@ -407,7 +407,12 @@ GraphViewStyle::EdgeStyle GraphViewStyle::getStyleForEdgeType(Edge::EdgeType typ
|
||||
case Edge::EDGE_INCLUDE:
|
||||
style.color = "#87BA50";
|
||||
break;
|
||||
|
||||
case Edge::EDGE_TEMPLATE_PARAMETER_OF:
|
||||
case Edge::EDGE_TEMPLATE_ARGUMENT_OF:
|
||||
case Edge::EDGE_TEMPLATE_DEFAULT_ARGUMENT_OF:
|
||||
case Edge::EDGE_TEMPLATE_SPECIALIZATION_OF:
|
||||
style.color = "#DD0000";
|
||||
break;
|
||||
default:
|
||||
style.color = "#878787";
|
||||
break;
|
||||
|
||||
@@ -547,12 +547,10 @@ Id Storage::onTemplateArgumentTypeParsed(
|
||||
|
||||
Node* argumentNode = addNodeHierarchy(Node::NODE_UNDEFINED_TYPE, argumentNameHierarchy);
|
||||
Node* templateNode = addNodeHierarchy(Node::NODE_UNDEFINED_TYPE, templateNameHierarchy);
|
||||
m_graph.createEdge(Edge::EDGE_TEMPLATE_ARGUMENT_OF, argumentNode, templateNode);
|
||||
Edge* argumentOfEdge = m_graph.createEdge(Edge::EDGE_TEMPLATE_ARGUMENT_OF, argumentNode, templateNode);
|
||||
|
||||
if (location.isValid())
|
||||
{
|
||||
addTokenLocation(argumentNode, location);
|
||||
}
|
||||
addTokenLocation(argumentNode, location);
|
||||
addTokenLocation(argumentOfEdge, location);
|
||||
|
||||
return argumentNode->getId();
|
||||
}
|
||||
@@ -1060,14 +1058,9 @@ std::shared_ptr<TokenLocationFile> Storage::getTokenLocationOfParentScope(const
|
||||
const TokenLocation* parent = child;
|
||||
const FilePath filePath = child->getFilePath();
|
||||
const TokenLocationFile* locationFile = m_locationCollection.findTokenLocationFileByPath(child->getFilePath());
|
||||
locationFile->forEachTokenLocation(
|
||||
locationFile->forEachStartTokenLocation(
|
||||
[&](TokenLocation* tokenLocation) -> void
|
||||
{
|
||||
if (tokenLocation->isStartTokenLocation())
|
||||
{
|
||||
TokenLocation::LocationType lt = tokenLocation->getType();
|
||||
int sln = tokenLocation->getLineNumber();
|
||||
int eln = tokenLocation->getEndTokenLocation()->getLineNumber();
|
||||
if (tokenLocation->getType() == TokenLocation::LOCATION_SCOPE &&
|
||||
tokenLocation->isStartTokenLocation() &&
|
||||
(*tokenLocation) < *(child->getStartTokenLocation()) &&
|
||||
@@ -1077,17 +1070,15 @@ std::shared_ptr<TokenLocationFile> Storage::getTokenLocationOfParentScope(const
|
||||
{
|
||||
parent = tokenLocation;
|
||||
}
|
||||
else
|
||||
// since tokenLocation is a start location the > location indicates the scope that is closer to the child.
|
||||
else if ((*tokenLocation) > *parent)
|
||||
{
|
||||
if ((*tokenLocation) > *parent) // since tokenLocation is a start location the > location indiceates the scope that is closer to the child.
|
||||
{
|
||||
parent = tokenLocation;
|
||||
}
|
||||
parent = tokenLocation;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
std::shared_ptr<TokenLocationFile> file = std::make_shared<TokenLocationFile>(filePath);
|
||||
if (parent != child)
|
||||
{
|
||||
|
||||
@@ -918,26 +918,5 @@ ParseFunction ASTVisitor::getParseFunction(const clang::FunctionDecl* declaratio
|
||||
|
||||
ParseFunction ASTVisitor::getParseFunction(const clang::FunctionTemplateDecl* declaration) const
|
||||
{
|
||||
bool isStatic = false;
|
||||
bool isConst = false;
|
||||
|
||||
const clang::FunctionDecl* templatedDecl = declaration->getTemplatedDecl();
|
||||
if (clang::isa<clang::CXXMethodDecl>(templatedDecl))
|
||||
{
|
||||
const clang::CXXMethodDecl* methodDecl = clang::dyn_cast<const clang::CXXMethodDecl>(templatedDecl);
|
||||
isStatic = methodDecl->isStatic();
|
||||
isConst = methodDecl->isConst();
|
||||
}
|
||||
else
|
||||
{
|
||||
isStatic = templatedDecl->getStorageClass() == clang::SC_Static;
|
||||
}
|
||||
|
||||
return ParseFunction(
|
||||
getParseTypeUsageOfReturnType(templatedDecl),
|
||||
utility::getDeclNameHierarchy(declaration),
|
||||
getParameters(templatedDecl),
|
||||
isStatic,
|
||||
isConst
|
||||
);
|
||||
return getParseFunction(declaration->getTemplatedDecl());
|
||||
}
|
||||
|
||||
@@ -2437,22 +2437,21 @@ public:
|
||||
TS_ASSERT_EQUALS(client->errors[0], "use of undeclared identifier \'b\' <1:9 1:9>");
|
||||
}
|
||||
|
||||
|
||||
void ___test_TEST()
|
||||
{
|
||||
std::shared_ptr<TestParserClient> client = parseCode(
|
||||
"template <template<template<typename> class> class T>\n"
|
||||
"class A {\n"
|
||||
"T<>\n"
|
||||
"};\n"
|
||||
"template <template<typename> class T>\n"
|
||||
"class B {};\n"
|
||||
"template <typename T>\n"
|
||||
"class C {};\n"
|
||||
"A<B> a;\n"
|
||||
);
|
||||
int ofo = 0;
|
||||
}
|
||||
// void ___test_TEST()
|
||||
// {
|
||||
// std::shared_ptr<TestParserClient> client = parseCode(
|
||||
// "template <template<template<typename> class> class T>\n"
|
||||
// "class A {\n"
|
||||
// "T<>\n"
|
||||
// "};\n"
|
||||
// "template <template<typename> class T>\n"
|
||||
// "class B {};\n"
|
||||
// "template <typename T>\n"
|
||||
// "class C {};\n"
|
||||
// "A<B> a;\n"
|
||||
// );
|
||||
// int ofo = 0;
|
||||
// }
|
||||
|
||||
private:
|
||||
class TestParserClient: public ParserClient
|
||||
|
||||
Reference in New Issue
Block a user