logic: fixes all over the place
* fixed refreshing to send another ui refresh message after parsing * keepContent field for MessageBase so that views won't update * fixed searchmatching to only weigh uppercase letters next to lowercase ones * fixed file not jumping back to snippets when activating edge * clicking into empty space deselects active edge * clear file manager files on every fetch * added db transaction for file clearing * use zooming instead of changing font size
This commit is contained in:
@@ -223,11 +223,21 @@ QWidget* QtCodeFile::findFirstActiveSnippet() const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
for (std::shared_ptr<QtCodeSnippet> snippet : m_snippets)
|
||||
if (m_maximizeButton->isEnabled())
|
||||
{
|
||||
if (snippet->isActive())
|
||||
for (std::shared_ptr<QtCodeSnippet> snippet : m_snippets)
|
||||
{
|
||||
return snippet.get();
|
||||
if (snippet->isActive())
|
||||
{
|
||||
return snippet.get();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_fileSnippet->isActive())
|
||||
{
|
||||
return m_fileSnippet.get();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <QBoxLayout>
|
||||
#include <QFrame>
|
||||
#include <QGraphicsScene>
|
||||
#include <QGraphicsView>
|
||||
#include <QMouseEvent>
|
||||
#include <QPropertyAnimation>
|
||||
#include <QParallelAnimationGroup>
|
||||
#include <QScrollBar>
|
||||
@@ -12,6 +12,8 @@
|
||||
#include "component/controller/helper/DummyEdge.h"
|
||||
#include "component/controller/helper/DummyNode.h"
|
||||
#include "component/controller/helper/GraphPostprocessor.h"
|
||||
#include "component/view/GraphViewStyle.h"
|
||||
#include "utility/messaging/type/MessageDeactivateEdge.h"
|
||||
|
||||
#include "qt/utility/utilityQt.h"
|
||||
|
||||
@@ -25,6 +27,32 @@
|
||||
#include "qt/view/graphElements/QtGraphNodeExpandToggle.h"
|
||||
#include "settings/ColorScheme.h"
|
||||
|
||||
QtGraphicsView::QtGraphicsView(QWidget* parent)
|
||||
: QGraphicsView(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void QtGraphicsView::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton && !itemAt(event->pos()))
|
||||
{
|
||||
m_last = event->pos();
|
||||
}
|
||||
|
||||
QGraphicsView::mousePressEvent(event);
|
||||
}
|
||||
|
||||
void QtGraphicsView::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton && !itemAt(event->pos()) && event->pos() == m_last)
|
||||
{
|
||||
emit emptySpaceClicked();
|
||||
}
|
||||
|
||||
QGraphicsView::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
|
||||
QtGraphView::QtGraphView(ViewLayout* viewLayout)
|
||||
: GraphView(viewLayout)
|
||||
, m_rebuildGraphFunctor(
|
||||
@@ -56,13 +84,15 @@ void QtGraphView::initView()
|
||||
widget->setLayout(layout);
|
||||
|
||||
QGraphicsScene* scene = new QGraphicsScene(widget);
|
||||
QGraphicsView* view = new QGraphicsView(widget);
|
||||
QGraphicsView* view = new QtGraphicsView(widget);
|
||||
view->setScene(scene);
|
||||
view->setDragMode(QGraphicsView::ScrollHandDrag);
|
||||
view->setRenderHints(QPainter::Antialiasing);
|
||||
|
||||
widget->layout()->addWidget(view);
|
||||
|
||||
connect(view, SIGNAL(emptySpaceClicked()), this, SLOT(clickedInEmptySpace()));
|
||||
|
||||
doRefreshView();
|
||||
}
|
||||
|
||||
@@ -114,6 +144,23 @@ void QtGraphView::finishedTransition()
|
||||
switchToNewGraphData();
|
||||
}
|
||||
|
||||
void QtGraphView::clickedInEmptySpace()
|
||||
{
|
||||
size_t activeEdgeCount = 0;
|
||||
for (std::shared_ptr<QtGraphEdge> edge : m_oldEdges)
|
||||
{
|
||||
if (edge->getIsActive())
|
||||
{
|
||||
activeEdgeCount++;
|
||||
}
|
||||
}
|
||||
|
||||
if (activeEdgeCount == 1)
|
||||
{
|
||||
MessageDeactivateEdge().dispatch();
|
||||
}
|
||||
}
|
||||
|
||||
void QtGraphView::switchToNewGraphData()
|
||||
{
|
||||
m_oldGraph = m_graph;
|
||||
@@ -239,6 +286,9 @@ void QtGraphView::doRefreshView()
|
||||
|
||||
std::string css = utility::getStyleSheet("data/gui/graph_view/graph_view.css");
|
||||
getView()->setStyleSheet(css.c_str());
|
||||
|
||||
float zoomFactor = GraphViewStyle::getZoomFactor();
|
||||
getView()->setTransform(QTransform(zoomFactor, 0, 0, zoomFactor, 0, 0));
|
||||
}
|
||||
|
||||
std::shared_ptr<QtGraphNode> QtGraphView::findNodeRecursive(const std::list<std::shared_ptr<QtGraphNode>>& nodes, Id tokenId)
|
||||
|
||||
@@ -1,21 +1,38 @@
|
||||
#ifndef QT_GRAPH_VIEW_H
|
||||
#define QT_GRAPH_VIEW_H
|
||||
|
||||
#include <QGraphicsView>
|
||||
#include <QPointF>
|
||||
|
||||
#include "utility/types.h"
|
||||
|
||||
#include "qt/utility/QtThreadedFunctor.h"
|
||||
|
||||
#include "component/view/GraphView.h"
|
||||
#include "qt/utility/QtThreadedFunctor.h"
|
||||
#include "utility/types.h"
|
||||
|
||||
struct DummyEdge;
|
||||
struct DummyNode;
|
||||
class QGraphicsView;
|
||||
class QMouseEvent;
|
||||
class QSequentialAnimationGroup;
|
||||
class QtGraphEdge;
|
||||
class QtGraphNode;
|
||||
|
||||
class QtGraphicsView
|
||||
: public QGraphicsView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtGraphicsView(QWidget* parent);
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
|
||||
signals:
|
||||
void emptySpaceClicked();
|
||||
|
||||
private:
|
||||
QPoint m_last;
|
||||
};
|
||||
|
||||
|
||||
class QtGraphView
|
||||
: public QObject
|
||||
, public GraphView
|
||||
@@ -44,6 +61,7 @@ public:
|
||||
private slots:
|
||||
void centerScrollBars();
|
||||
void finishedTransition();
|
||||
void clickedInEmptySpace();
|
||||
|
||||
private:
|
||||
void switchToNewGraphData();
|
||||
|
||||
@@ -70,7 +70,7 @@ void QtGraphNodeExpandToggle::updateStyle()
|
||||
|
||||
m_icon->setPos(
|
||||
(m_rect->rect().width() - m_icon->pixmap().width() / QtDeviceScaledPixmap::devicePixelRatio()) / 2,
|
||||
(m_invisibleSubNodeCount == 0 ? m_rect->rect().height() / 2 - 2 : m_rect->rect().height() - 8)
|
||||
(m_invisibleSubNodeCount == 0 ? m_rect->rect().height() / 2 - 2 : m_rect->rect().height() - 7)
|
||||
);
|
||||
|
||||
m_icon->setPixmap(utility::colorizePixmap(m_icon->pixmap(), style.iconColor.c_str()));
|
||||
|
||||
+2
-25
@@ -53,7 +53,6 @@ void Application::loadSettings()
|
||||
}
|
||||
|
||||
Application::Application()
|
||||
: m_isInitialParse(true)
|
||||
{
|
||||
TaskScheduler::getInstance()->startSchedulerLoopThreaded();
|
||||
MessageQueue::getInstance()->setSendMessagesAsTasks(true);
|
||||
@@ -106,36 +105,14 @@ void Application::handleMessage(MessageFinishedParsing* message)
|
||||
{
|
||||
m_project->logStats();
|
||||
|
||||
if (!m_isInitialParse || message->errorCount > 0)
|
||||
if (message->errorCount == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_isInitialParse = false;
|
||||
|
||||
Id nodeId = m_storageCache->getIdForNodeWithNameHierarchy(NameHierarchy("main"));
|
||||
|
||||
if (!nodeId)
|
||||
{
|
||||
nodeId = m_storageCache->getIdForFirstNode();
|
||||
}
|
||||
|
||||
if (nodeId)
|
||||
{
|
||||
MessageActivateNodes message;
|
||||
message.addNode(
|
||||
nodeId,
|
||||
m_storageCache->getNodeTypeForNodeWithId(nodeId),
|
||||
m_storageCache->getNameHierarchyForNodeWithId(nodeId)
|
||||
);
|
||||
message.isFromSystem = true;
|
||||
message.dispatch();
|
||||
MessageRefresh().refreshUiOnly().dispatch();
|
||||
}
|
||||
}
|
||||
|
||||
void Application::handleMessage(MessageLoadProject* message)
|
||||
{
|
||||
m_isInitialParse = true;
|
||||
loadProject(message->projectSettingsFilePath);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,8 +46,6 @@ private:
|
||||
|
||||
std::shared_ptr<MainView> m_mainView;
|
||||
std::shared_ptr<ComponentManager> m_componentManager;
|
||||
|
||||
bool m_isInitialParse;
|
||||
};
|
||||
|
||||
#endif // APPLICATION_H
|
||||
|
||||
@@ -239,6 +239,7 @@ add_files(
|
||||
utility/messaging/type/MessageActivateTokenLocations.h
|
||||
utility/messaging/type/MessageActivateTokens.h
|
||||
utility/messaging/type/MessageAutoRefreshChanged.h
|
||||
utility/messaging/type/MessageDeactivateEdge.h
|
||||
utility/messaging/type/MessageFind.h
|
||||
utility/messaging/type/MessageFinishedParsing.h
|
||||
utility/messaging/type/MessageFlushUpdates.h
|
||||
|
||||
+3
-8
@@ -29,8 +29,6 @@ bool Project::loadProjectSettings(const FilePath& projectSettingsFile)
|
||||
if (success)
|
||||
{
|
||||
setProjectSettingsFilePath(projectSettingsFile);
|
||||
|
||||
m_fileManager.clear();
|
||||
updateFileManager();
|
||||
}
|
||||
return success;
|
||||
@@ -66,8 +64,6 @@ void Project::reloadProjectSettings()
|
||||
|
||||
void Project::clearStorage()
|
||||
{
|
||||
m_fileManager.clear();
|
||||
|
||||
if (m_storage)
|
||||
{
|
||||
m_storage->clear();
|
||||
@@ -158,12 +154,11 @@ void Project::updateFileManager()
|
||||
std::shared_ptr<ProjectSettings> projSettings = ProjectSettings::getInstance();
|
||||
|
||||
std::vector<FilePath> sourcePaths(projSettings->getSourcePaths());
|
||||
std::vector<FilePath> includePaths(sourcePaths);
|
||||
|
||||
std::vector<std::string> sourceExtensions = projSettings->getSourceExtensions();
|
||||
std::vector<std::string> includeExtensions = projSettings->getHeaderExtensions();
|
||||
|
||||
m_fileManager.setPaths(sourcePaths, includePaths, sourceExtensions, includeExtensions);
|
||||
m_fileManager.setPaths(sourcePaths, sourceExtensions, includeExtensions);
|
||||
}
|
||||
|
||||
Parser::Arguments Project::getParserArguments() const
|
||||
@@ -176,8 +171,8 @@ Parser::Arguments Project::getParserArguments() const
|
||||
utility::append(args.compilerFlags, projSettings->getCompilerFlags());
|
||||
utility::append(args.compilerFlags, appSettings->getCompilerFlags());
|
||||
|
||||
// Add the include paths as HeaderSearchPaths as well, so clang will also look here when searching include files.
|
||||
utility::append(args.systemHeaderSearchPaths, m_fileManager.getIncludePaths());
|
||||
// Add the source paths as HeaderSearchPaths as well, so clang will also look here when searching include files.
|
||||
utility::append(args.systemHeaderSearchPaths, m_fileManager.getSourcePaths());
|
||||
|
||||
// std::vector<FilePath> headerSearchSubPaths;
|
||||
// for(FilePath p : projSettings->getHeaderSearchPaths())
|
||||
|
||||
@@ -77,7 +77,7 @@ std::shared_ptr<Component> ComponentFactory::createSearchComponent(ViewLayout* v
|
||||
std::shared_ptr<Component> ComponentFactory::createUndoRedoComponent(ViewLayout* viewLayout)
|
||||
{
|
||||
std::shared_ptr<UndoRedoView> view = m_viewFactory->createUndoRedoView(viewLayout);
|
||||
std::shared_ptr<UndoRedoController> controller = std::make_shared<UndoRedoController>();
|
||||
std::shared_ptr<UndoRedoController> controller = std::make_shared<UndoRedoController>(m_storageAccess);
|
||||
|
||||
return std::make_shared<Component>(view, controller);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ const uint CodeController::s_lineRadius = 2;
|
||||
|
||||
void CodeController::handleMessage(MessageActivateTokens* message)
|
||||
{
|
||||
if (message->isEdge && message->isIgnorable())
|
||||
if (message->keepContent() && message->isIgnorable())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -47,6 +47,10 @@ void CodeController::handleMessage(MessageActivateTokens* message)
|
||||
if (message->isEdge)
|
||||
{
|
||||
view->showFirstActiveSnippet();
|
||||
}
|
||||
|
||||
if (message->keepContent())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,10 +41,11 @@ void FeatureController::handleMessage(MessageActivateEdge* message)
|
||||
return;
|
||||
}
|
||||
|
||||
MessageActivateTokens msg(std::vector<Id>(1, edgeId));
|
||||
msg.isEdge = true;
|
||||
msg.undoRedoType = message->undoRedoType;
|
||||
msg.dispatchImmediately();
|
||||
MessageActivateTokens m(std::vector<Id>(1, edgeId));
|
||||
m.isEdge = true;
|
||||
m.undoRedoType = message->undoRedoType;
|
||||
m.setKeepContent(message->keepContent());
|
||||
m.dispatchImmediately();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +53,7 @@ void FeatureController::handleMessage(MessageActivateFile* message)
|
||||
{
|
||||
MessageActivateTokens m(std::vector<Id>(1, m_storageAccess->getTokenIdForFileNode(message->filePath)));
|
||||
m.undoRedoType = message->undoRedoType;
|
||||
m.setKeepContent(message->keepContent());
|
||||
m.dispatchImmediately();
|
||||
}
|
||||
|
||||
@@ -80,6 +82,7 @@ void FeatureController::handleMessage(MessageActivateNodes* message)
|
||||
MessageActivateTokens m(nodeIds);
|
||||
m.isFromSystem = message->isFromSystem;
|
||||
m.undoRedoType = message->undoRedoType;
|
||||
m.setKeepContent(message->keepContent());
|
||||
m.dispatchImmediately();
|
||||
}
|
||||
|
||||
@@ -88,16 +91,16 @@ void FeatureController::handleMessage(MessageActivateTokenLocations* message)
|
||||
std::vector<Id> nodeIds = m_storageAccess->getNodeIdsForLocationIds(message->locationIds);
|
||||
nodeIds = m_storageAccess->getActiveTokenIdsForTokenIds(nodeIds);
|
||||
|
||||
MessageActivateNodes msg;
|
||||
MessageActivateNodes m;
|
||||
for (Id nodeId : nodeIds)
|
||||
{
|
||||
msg.addNode(
|
||||
m.addNode(
|
||||
nodeId,
|
||||
m_storageAccess->getNodeTypeForNodeWithId(nodeId),
|
||||
m_storageAccess->getNameHierarchyForNodeWithId(nodeId)
|
||||
);
|
||||
}
|
||||
msg.dispatchImmediately();
|
||||
m.dispatchImmediately();
|
||||
}
|
||||
|
||||
void FeatureController::handleMessage(MessageSearch* message)
|
||||
@@ -107,6 +110,7 @@ void FeatureController::handleMessage(MessageSearch* message)
|
||||
|
||||
MessageActivateTokens m(tokenIds);
|
||||
m.undoRedoType = message->undoRedoType;
|
||||
m.setKeepContent(message->keepContent());
|
||||
m.dispatchImmediately();
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ GraphController::~GraphController()
|
||||
|
||||
void GraphController::handleMessage(MessageActivateTokens* message)
|
||||
{
|
||||
if (message->isEdge && message->tokenIds.size() == 1)
|
||||
if (message->isEdge || message->keepContent())
|
||||
{
|
||||
m_activeEdgeIds = message->tokenIds;
|
||||
setActiveAndVisibility(utility::concat(m_activeNodeIds, m_activeEdgeIds));
|
||||
|
||||
@@ -14,7 +14,7 @@ SearchController::~SearchController()
|
||||
|
||||
void SearchController::handleMessage(MessageActivateTokens* message)
|
||||
{
|
||||
if (!message->isEdge)
|
||||
if (!message->keepContent())
|
||||
{
|
||||
getView()->setMatches(m_storageAccess->getSearchMatchesForTokenIds(message->tokenIds));
|
||||
}
|
||||
|
||||
@@ -4,9 +4,11 @@
|
||||
#include "utility/messaging/type/MessageFlushUpdates.h"
|
||||
|
||||
#include "component/view/UndoRedoView.h"
|
||||
#include "data/access/StorageAccess.h"
|
||||
|
||||
UndoRedoController::UndoRedoController()
|
||||
: m_lastCommand(nullptr, 0)
|
||||
UndoRedoController::UndoRedoController(StorageAccess* storageAccess)
|
||||
: m_storageAccess(storageAccess)
|
||||
, m_lastCommand(nullptr, 0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -63,6 +65,34 @@ void UndoRedoController::handleMessage(MessageActivateNodes* message)
|
||||
processCommand(command);
|
||||
}
|
||||
|
||||
void UndoRedoController::handleMessage(MessageDeactivateEdge* message)
|
||||
{
|
||||
MessageBase* m = nullptr;
|
||||
|
||||
if (m_lastCommand.message && m_lastCommand.order == 0)
|
||||
{
|
||||
m = m_lastCommand.message.get();
|
||||
}
|
||||
else if (m_undo.size())
|
||||
{
|
||||
int i = m_undo.size() - 1;
|
||||
while (i >= 0 && m_undo[i].order > 0)
|
||||
{
|
||||
i--;
|
||||
}
|
||||
m = m_undo[i].message.get();
|
||||
}
|
||||
|
||||
if (m)
|
||||
{
|
||||
bool keepContent = m->keepContent();
|
||||
m->undoRedoType = MessageBase::UNDOTYPE_NORMAL;
|
||||
m->setKeepContent(true);
|
||||
m->dispatch();
|
||||
m->setKeepContent(keepContent);
|
||||
}
|
||||
}
|
||||
|
||||
void UndoRedoController::handleMessage(MessageGraphNodeBundleSplit* message)
|
||||
{
|
||||
Command command(std::make_shared<MessageGraphNodeBundleSplit>(*message), 1);
|
||||
@@ -101,8 +131,31 @@ void UndoRedoController::handleMessage(MessageRedo* message)
|
||||
|
||||
void UndoRedoController::handleMessage(MessageRefresh* message)
|
||||
{
|
||||
if (!message->uiOnly)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_lastCommand.message)
|
||||
{
|
||||
Id nodeId = m_storageAccess->getIdForNodeWithNameHierarchy(NameHierarchy("main"));
|
||||
if (!nodeId)
|
||||
{
|
||||
nodeId = m_storageAccess->getIdForFirstNode();
|
||||
}
|
||||
|
||||
if (nodeId)
|
||||
{
|
||||
MessageActivateNodes m;
|
||||
m.addNode(
|
||||
nodeId,
|
||||
m_storageAccess->getNodeTypeForNodeWithId(nodeId),
|
||||
m_storageAccess->getNameHierarchyForNodeWithId(nodeId)
|
||||
);
|
||||
m.isFromSystem = true;
|
||||
m.dispatch();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "utility/messaging/type/MessageActivateEdge.h"
|
||||
#include "utility/messaging/type/MessageActivateFile.h"
|
||||
#include "utility/messaging/type/MessageActivateNodes.h"
|
||||
#include "utility/messaging/type/MessageDeactivateEdge.h"
|
||||
#include "utility/messaging/type/MessageGraphNodeBundleSplit.h"
|
||||
#include "utility/messaging/type/MessageGraphNodeExpand.h"
|
||||
#include "utility/messaging/type/MessageGraphNodeMove.h"
|
||||
@@ -21,6 +22,7 @@
|
||||
|
||||
#include "component/controller/Controller.h"
|
||||
|
||||
class StorageAccess;
|
||||
class UndoRedoView;
|
||||
|
||||
class UndoRedoController
|
||||
@@ -28,6 +30,7 @@ class UndoRedoController
|
||||
, public MessageListener<MessageActivateEdge>
|
||||
, public MessageListener<MessageActivateFile>
|
||||
, public MessageListener<MessageActivateNodes>
|
||||
, public MessageListener<MessageDeactivateEdge>
|
||||
, public MessageListener<MessageGraphNodeBundleSplit>
|
||||
, public MessageListener<MessageGraphNodeExpand>
|
||||
, public MessageListener<MessageGraphNodeMove>
|
||||
@@ -40,7 +43,7 @@ class UndoRedoController
|
||||
, public MessageListener<MessageUndo>
|
||||
{
|
||||
public:
|
||||
UndoRedoController();
|
||||
UndoRedoController(StorageAccess* storageAccess);
|
||||
virtual ~UndoRedoController();
|
||||
|
||||
UndoRedoView* getView();
|
||||
@@ -57,6 +60,7 @@ private:
|
||||
virtual void handleMessage(MessageActivateEdge* message);
|
||||
virtual void handleMessage(MessageActivateFile* message);
|
||||
virtual void handleMessage(MessageActivateNodes* message);
|
||||
virtual void handleMessage(MessageDeactivateEdge* message);
|
||||
virtual void handleMessage(MessageGraphNodeBundleSplit* message);
|
||||
virtual void handleMessage(MessageGraphNodeExpand* message);
|
||||
virtual void handleMessage(MessageGraphNodeMove* message);
|
||||
@@ -77,6 +81,8 @@ private:
|
||||
|
||||
void clear();
|
||||
|
||||
StorageAccess* m_storageAccess;
|
||||
|
||||
Command m_lastCommand;
|
||||
|
||||
std::deque<Command> m_undo;
|
||||
|
||||
@@ -60,9 +60,11 @@ void GraphViewStyle::setImpl(std::shared_ptr<GraphViewStyleImpl> impl)
|
||||
|
||||
void GraphViewStyle::loadStyleSettings()
|
||||
{
|
||||
s_fontSize = ApplicationSettings::getInstance()->getFontSize();
|
||||
s_fontSize = 14;
|
||||
s_fontName = ApplicationSettings::getInstance()->getFontName();
|
||||
|
||||
s_zoomFactor = ApplicationSettings::getInstance()->getFontSize() / float(s_fontSize);
|
||||
|
||||
s_charWidths.clear();
|
||||
s_charHeights.clear();
|
||||
}
|
||||
@@ -132,7 +134,7 @@ size_t GraphViewStyle::getFontSizeOfAccessNode()
|
||||
|
||||
size_t GraphViewStyle::getFontSizeOfExpandToggleNode()
|
||||
{
|
||||
return s_fontSize - 5;
|
||||
return s_fontSize - 3;
|
||||
}
|
||||
|
||||
size_t GraphViewStyle::getFontSizeOfCountCircle()
|
||||
@@ -243,7 +245,7 @@ GraphViewStyle::NodeMargins GraphViewStyle::getMarginsOfExpandToggleNode()
|
||||
{
|
||||
NodeMargins margins;
|
||||
|
||||
margins.left = margins.right = margins.top = margins.bottom = 7;
|
||||
margins.left = margins.right = margins.top = margins.bottom = 6;
|
||||
margins.minWidth = margins.charHeight = getFontSizeOfExpandToggleNode();
|
||||
|
||||
return margins;
|
||||
@@ -513,6 +515,11 @@ int GraphViewStyle::toGridGap(int x)
|
||||
return s_gridCellPadding + toGridOffset(x - s_gridCellPadding);
|
||||
}
|
||||
|
||||
float GraphViewStyle::getZoomFactor()
|
||||
{
|
||||
return s_zoomFactor;
|
||||
}
|
||||
|
||||
void GraphViewStyle::addIcon(Node::NodeType type, bool hasChildren, NodeStyle* style)
|
||||
{
|
||||
switch (type)
|
||||
@@ -560,3 +567,4 @@ std::shared_ptr<GraphViewStyleImpl> GraphViewStyle::s_impl;
|
||||
|
||||
int GraphViewStyle::s_fontSize;
|
||||
std::string GraphViewStyle::s_fontName;
|
||||
float GraphViewStyle::s_zoomFactor;
|
||||
|
||||
@@ -116,6 +116,8 @@ public:
|
||||
static int toGridSize(int x);
|
||||
static int toGridGap(int x);
|
||||
|
||||
static float getZoomFactor();
|
||||
|
||||
static int s_gridCellSize;
|
||||
static int s_gridCellPadding;
|
||||
|
||||
@@ -129,6 +131,7 @@ private:
|
||||
|
||||
static int s_fontSize;
|
||||
static std::string s_fontName;
|
||||
static float s_zoomFactor;
|
||||
};
|
||||
|
||||
#endif // GRAPH_VIEW_STYLE_H
|
||||
|
||||
@@ -81,8 +81,10 @@ void Storage::clearFileElement(const FilePath& filePath)
|
||||
Id fileId = getFileNodeId(filePath);
|
||||
if (fileId != 0)
|
||||
{
|
||||
m_sqliteStorage.beginTransaction();
|
||||
m_sqliteStorage.removeElementsWithLocationInFile(fileId);
|
||||
m_sqliteStorage.removeFile(fileId);
|
||||
m_sqliteStorage.commitTransaction();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,11 +48,15 @@ Task::TaskState TaskCleanStorage::update()
|
||||
|
||||
void TaskCleanStorage::exit()
|
||||
{
|
||||
// std::cout << "clean duration: " << utility::duration(m_start) << std::endl;
|
||||
std::stringstream ss;
|
||||
ss << "clearing files done, ";
|
||||
ss << std::setprecision(2) << std::fixed << utility::duration(m_start) << " seconds";
|
||||
MessageStatus(ss.str()).dispatch();
|
||||
}
|
||||
|
||||
void TaskCleanStorage::interrupt()
|
||||
{
|
||||
MessageStatus("Clearing file interrupted", false, true).dispatch();
|
||||
}
|
||||
|
||||
void TaskCleanStorage::revert()
|
||||
|
||||
@@ -316,10 +316,8 @@ std::pair<size_t, size_t> SearchNode::fuzzyMatch(
|
||||
size_t pos = start;
|
||||
size_t weight = 0;
|
||||
size_t matchCount = 0;
|
||||
char lastChar = '\0';
|
||||
|
||||
size_t ql = query.size();
|
||||
size_t ml = m_name.size();
|
||||
|
||||
if (!query.size())
|
||||
{
|
||||
@@ -344,20 +342,37 @@ std::pair<size_t, size_t> SearchNode::fuzzyMatch(
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < ml; i++)
|
||||
char last = '\0';
|
||||
size_t nl = m_name.size();
|
||||
for (size_t i = 0; i < nl; i++)
|
||||
{
|
||||
char c = m_name[i];
|
||||
char next = (i + 1 == nl ? '\0' : m_name[i + 1]);
|
||||
|
||||
if (tolower(query[pos]) == tolower(c))
|
||||
{
|
||||
weight += std::max<size_t>(100 / sqrt(size + i + 1), 1);
|
||||
|
||||
if (matchCount)
|
||||
{
|
||||
weight += matchCount * matchCount * 10;
|
||||
}
|
||||
else if (i == 0 || lastChar == '_' || tolower(c) != c)
|
||||
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
weight += 20;
|
||||
}
|
||||
|
||||
if (last == '_' || next == '_')
|
||||
{
|
||||
weight += 20;
|
||||
}
|
||||
else if ((tolower(c) != c && tolower(next) == next) || (tolower(c) == c && tolower(next) != next))
|
||||
{
|
||||
weight += 20;
|
||||
}
|
||||
|
||||
matchCount++;
|
||||
|
||||
pos++;
|
||||
@@ -376,7 +391,7 @@ std::pair<size_t, size_t> SearchNode::fuzzyMatch(
|
||||
matchCount = 0;
|
||||
}
|
||||
|
||||
lastChar = c;
|
||||
last = c;
|
||||
}
|
||||
|
||||
return std::pair<size_t, size_t>(pos, weight);
|
||||
|
||||
@@ -20,36 +20,22 @@ const std::vector<FilePath>& FileManager::getSourcePaths() const
|
||||
return m_sourcePaths;
|
||||
}
|
||||
|
||||
const std::vector<FilePath>& FileManager::getIncludePaths() const
|
||||
{
|
||||
return m_includePaths;
|
||||
}
|
||||
|
||||
void FileManager::setPaths(
|
||||
std::vector<FilePath> sourcePaths,
|
||||
std::vector<FilePath> includePaths,
|
||||
std::vector<std::string> sourceExtensions,
|
||||
std::vector<std::string> includeExtensions
|
||||
){
|
||||
m_sourcePaths = sourcePaths;
|
||||
m_includePaths = includePaths;
|
||||
m_sourceExtensions = sourceExtensions;
|
||||
m_includeExtensions = includeExtensions;
|
||||
}
|
||||
|
||||
void FileManager::clear()
|
||||
{
|
||||
m_files.clear();
|
||||
m_addedFiles.clear();
|
||||
m_updatedFiles.clear();
|
||||
m_removedFiles.clear();
|
||||
}
|
||||
|
||||
void FileManager::fetchFilePaths(const std::vector<FileInfo>& oldFileInfos)
|
||||
{
|
||||
m_files.clear();
|
||||
for (FileInfo oldFileInfo: oldFileInfos)
|
||||
{
|
||||
m_files[oldFileInfo.path] = oldFileInfo;
|
||||
m_files.emplace(oldFileInfo.path, oldFileInfo);
|
||||
}
|
||||
|
||||
m_addedFiles.clear();
|
||||
@@ -135,7 +121,7 @@ std::vector<FileInfo> FileManager::getFileInfosInProject() const
|
||||
std::vector<FileInfo> fileInfos;
|
||||
|
||||
std::vector<std::pair<std::vector<FilePath>, std::vector<std::string>>> pathsExtensionsPairs;
|
||||
pathsExtensionsPairs.push_back(std::make_pair(m_includePaths, m_includeExtensions));
|
||||
pathsExtensionsPairs.push_back(std::make_pair(m_sourcePaths, m_includeExtensions));
|
||||
pathsExtensionsPairs.push_back(std::make_pair(m_sourcePaths, m_sourceExtensions));
|
||||
|
||||
for (size_t i = 0; i < pathsExtensionsPairs.size(); i++)
|
||||
|
||||
@@ -14,11 +14,9 @@ public:
|
||||
virtual ~FileManager();
|
||||
|
||||
const std::vector<FilePath>& getSourcePaths() const;
|
||||
const std::vector<FilePath>& getIncludePaths() const;
|
||||
|
||||
void setPaths(
|
||||
std::vector<FilePath> sourcePaths,
|
||||
std::vector<FilePath> includePaths,
|
||||
std::vector<std::string> sourceExtensions,
|
||||
std::vector<std::string> includeExtensions
|
||||
);
|
||||
@@ -42,7 +40,6 @@ private:
|
||||
std::map<FilePath, FileInfo> m_files;
|
||||
|
||||
std::vector<FilePath> m_sourcePaths;
|
||||
std::vector<FilePath> m_includePaths;
|
||||
std::vector<std::string> m_sourceExtensions;
|
||||
std::vector<std::string> m_includeExtensions;
|
||||
|
||||
|
||||
@@ -63,7 +63,6 @@ FileInfo FileSystem::getFileInfoForPath(FilePath filePath)
|
||||
return FileInfo();
|
||||
}
|
||||
|
||||
|
||||
std::vector<FileInfo> FileSystem::getFileInfosFromPaths(
|
||||
const std::vector<FilePath>& paths, const std::vector<std::string>& fileExtensions
|
||||
){
|
||||
|
||||
@@ -17,6 +17,7 @@ public:
|
||||
MessageBase()
|
||||
: undoRedoType(UNDOTYPE_NORMAL)
|
||||
, m_sendAsTask(true)
|
||||
, m_keepContent(false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -47,10 +48,21 @@ public:
|
||||
return (undoRedoType == UNDOTYPE_IGNORE);
|
||||
}
|
||||
|
||||
void setKeepContent(bool keepContent)
|
||||
{
|
||||
m_keepContent = keepContent;
|
||||
}
|
||||
|
||||
bool keepContent() const
|
||||
{
|
||||
return m_keepContent;
|
||||
}
|
||||
|
||||
UndoType undoRedoType;
|
||||
|
||||
private:
|
||||
bool m_sendAsTask;
|
||||
bool m_keepContent;
|
||||
};
|
||||
|
||||
#endif // MESSAGE_BASE_H
|
||||
|
||||
@@ -17,6 +17,7 @@ public:
|
||||
, fromNameHierarchy(fromName)
|
||||
, toNameHierarchy(toName)
|
||||
{
|
||||
setKeepContent(true);
|
||||
}
|
||||
|
||||
static const std::string getStaticType()
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef MESSAGE_DEACTIVATE_EDGE_H
|
||||
#define MESSAGE_DEACTIVATE_EDGE_H
|
||||
|
||||
#include "utility/messaging/Message.h"
|
||||
|
||||
class MessageDeactivateEdge
|
||||
: public Message<MessageDeactivateEdge>
|
||||
{
|
||||
public:
|
||||
MessageDeactivateEdge()
|
||||
{
|
||||
}
|
||||
|
||||
static const std::string getStaticType()
|
||||
{
|
||||
return "MessageDeactivateEdge";
|
||||
}
|
||||
};
|
||||
|
||||
#endif // MESSAGE_DEACTIVATE_EDGE_H
|
||||
Reference in New Issue
Block a user