logic: reduce access to filesystem while indexing

* use canonical filepath cache in cxx indexer
* made constructors of FilePath explicit
* use FilePath at more places instead of string
* forward declares FilePath wherever possible
This commit is contained in:
malte_langkabel
2017-05-04 10:55:16 +02:00
parent 55d3f9c189
commit 054b8fab17
156 changed files with 656 additions and 444 deletions
+5 -5
View File
@@ -88,7 +88,7 @@ void QtBookmarkView::setCreateButtonState(const CreateButtonState& state)
m_createButtonState = state;
m_createBookmarkButton->setIcon(utility::createButtonIcon(
ResourcePaths::getGuiPath() + "bookmark_view/images/edit_bookmark_icon.png",
ResourcePaths::getGuiPath().str() + "bookmark_view/images/edit_bookmark_icon.png",
"search/button"
));
@@ -105,7 +105,7 @@ void QtBookmarkView::setCreateButtonState(const CreateButtonState& state)
m_createBookmarkButton->setEnabled(true);
m_createBookmarkButton->setIcon(utility::createButtonIcon(
ResourcePaths::getGuiPath() + "bookmark_view/images/bookmark_active.png",
ResourcePaths::getGuiPath().str() + "bookmark_view/images/bookmark_active.png",
"search/button"
));
}
@@ -240,7 +240,7 @@ void QtBookmarkView::displayBookmarkEditor(std::shared_ptr<Bookmark> bookmark, c
void QtBookmarkView::setStyleSheet()
{
m_widget->setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath() + "bookmark_view/bookmark_view.css").c_str());
m_widget->setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("bookmark_view/bookmark_view.css"))).c_str());
}
void QtBookmarkView::refreshStyle()
@@ -251,12 +251,12 @@ void QtBookmarkView::refreshStyle()
m_showBookmarksButton->setFixedHeight(height);
m_createBookmarkButton->setIcon(utility::createButtonIcon(
ResourcePaths::getGuiPath() + "bookmark_view/images/edit_bookmark_icon.png",
ResourcePaths::getGuiPath().str() + "bookmark_view/images/edit_bookmark_icon.png",
"search/button"
));
m_showBookmarksButton->setIcon(utility::createButtonIcon(
ResourcePaths::getGuiPath() + "bookmark_view/images/bookmark_list_icon.png",
ResourcePaths::getGuiPath().str() + "bookmark_view/images/bookmark_list_icon.png",
"search/button"
));
}
+1 -1
View File
@@ -267,7 +267,7 @@ void QtCodeView::setStyleSheet() const
{
utility::setWidgetBackgroundColor(m_widget, ColorScheme::getInstance()->getColor("code/background"));
std::string styleSheet = utility::getStyleSheet(ResourcePaths::getGuiPath() + "code_view/code_view.css");
std::string styleSheet = utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("code_view/code_view.css")));
m_widget->setStyleSheet(styleSheet.c_str());
}
+1 -1
View File
@@ -50,7 +50,7 @@ QtErrorView::QtErrorView(ViewLayout* viewLayout)
, m_setErrorIdFunctor(std::bind(&QtErrorView::doSetErrorId, this, std::placeholders::_1))
, m_ignoreRowSelection(false)
{
s_errorIcon = QIcon(QString((ResourcePaths::getGuiPath() + "/indexing_dialog/error.png").c_str()));
s_errorIcon = QIcon(QString((ResourcePaths::getGuiPath().str() + "/indexing_dialog/error.png").c_str()));
}
QtErrorView::~QtErrorView()
+5 -5
View File
@@ -441,12 +441,12 @@ void QtGraphView::updateTrailButtons()
}
m_backwardTrailButton->setIcon(utility::createButtonIcon(
ResourcePaths::getGuiPath() + "graph_view/images/" + backwardImagePath,
ResourcePaths::getGuiPath().str() + "graph_view/images/" + backwardImagePath,
"search/button"
));
m_forwardTrailButton->setIcon(utility::createButtonIcon(
ResourcePaths::getGuiPath() + "graph_view/images/" + forwardImagePath,
ResourcePaths::getGuiPath().str() + "graph_view/images/" + forwardImagePath,
"search/button"
));
}
@@ -646,19 +646,19 @@ void QtGraphView::doRefreshView()
QtGraphicsView* view = getView();
std::string css = utility::getStyleSheet(ResourcePaths::getGuiPath() + "graph_view/graph_view.css");
std::string css = utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("graph_view/graph_view.css")));
view->setStyleSheet(css.c_str());
view->setAppZoomFactor(GraphViewStyle::getZoomFactor());
m_trailWidget->setStyleSheet(css.c_str());
m_expandButton->setIcon(utility::createButtonIcon(
ResourcePaths::getGuiPath() + "graph_view/images/graph.png",
ResourcePaths::getGuiPath().str() + "graph_view/images/graph.png",
"search/button"
));
m_collapseButton->setIcon(utility::createButtonIcon(
ResourcePaths::getGuiPath() + "graph_view/images/graph_arrow.png",
ResourcePaths::getGuiPath().str() + "graph_view/images/graph_arrow.png",
"search/button"
));
+1 -1
View File
@@ -216,7 +216,7 @@ void QtLogView::setStyleSheet() const
//m_showNonIndexedFatals->setPalette(palette);
widget->setStyleSheet(
utility::getStyleSheet(ResourcePaths::getGuiPath() + "error_view/error_view.css").c_str()
utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("error_view/error_view.css"))).c_str()
);
m_table->updateRows();
+1 -1
View File
@@ -41,5 +41,5 @@ void QtRefreshView::doRefreshView()
void QtRefreshView::setStyleSheet()
{
m_widget->setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath() + "refresh_view/refresh_view.css").c_str());
m_widget->setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("refresh_view/refresh_view.css"))).c_str());
}
+1 -1
View File
@@ -93,7 +93,7 @@ void QtSearchView::doSetAutocompletionList(const std::vector<SearchMatch>& autoc
void QtSearchView::setStyleSheet()
{
std::string css = utility::getStyleSheet(ResourcePaths::getGuiPath() + "search_view/search_view.css");
std::string css = utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("search_view/search_view.css")));
m_widget->setStyleSheet(css.c_str());
+1 -1
View File
@@ -68,6 +68,6 @@ void QtTabbedView::setStyleSheet()
utility::setWidgetBackgroundColor(QtViewWidgetWrapper::getWidgetOfView(this), ColorScheme::getInstance()->getColor("tab/background"));
m_widget->setStyleSheet(
utility::getStyleSheet(ResourcePaths::getGuiPath() + "tabbed_view/tabbed_view.css").c_str()
utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("tabbed_view/tabbed_view.css"))).c_str()
);
}
+1 -1
View File
@@ -37,7 +37,7 @@ void QtUndoRedoView::refreshView()
void QtUndoRedoView::setStyleSheet()
{
m_widget->setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath() + "undoredo_view/undoredo_view.css").c_str());
m_widget->setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("undoredo_view/undoredo_view.css"))).c_str());
}
void QtUndoRedoView::doRefreshView()
@@ -428,7 +428,7 @@ void QtGraphNode::setStyle(const GraphViewStyle::NodeStyle& style)
if (style.hasHatching)
{
QtDeviceScaledPixmap pattern((ResourcePaths::getGuiPath() + "graph_view/images/pattern.png").c_str());
QtDeviceScaledPixmap pattern((ResourcePaths::getGuiPath().str() + "graph_view/images/pattern.png").c_str());
pattern.scaleToHeight(12);
QPixmap pixmap = utility::colorizePixmap(pattern.pixmap(), style.color.hatching.c_str());
@@ -47,7 +47,7 @@ QtGraphNodeAccess::QtGraphNodeAccess(AccessKind accessKind)
if (iconFileName.size() > 0)
{
QtDeviceScaledPixmap pixmap(
QString::fromStdString(ResourcePaths::getGuiPath() + "graph_view/images/" + iconFileName + ".png"));
QString::fromStdString(ResourcePaths::getGuiPath().str() + "graph_view/images/" + iconFileName + ".png"));
pixmap.scaleToHeight(m_accessIconSize);
m_accessIcon = new QGraphicsPixmapItem(pixmap.pixmap(), this);
@@ -1,5 +1,6 @@
#include "qt/view/graphElements/QtGraphNodeData.h"
#include "utility/file/FilePath.h"
#include "utility/messaging/type/MessageActivateNodes.h"
#include "utility/messaging/type/MessageDeactivateEdge.h"
#include "utility/messaging/type/MessageFocusIn.h"
@@ -1,10 +1,10 @@
#ifndef QT_GRAPH_NODE_DATA_H
#define QT_GRAPH_NODE_DATA_H
#include "utility/file/FilePath.h"
#include "qt/view/graphElements/QtGraphNode.h"
class FilePath;
class QtGraphNodeData
: public QtGraphNode
{
@@ -26,7 +26,7 @@ QtGraphNodeExpandToggle::QtGraphNodeExpandToggle(bool expanded, int invisibleSub
m_icon->setTransformationMode(Qt::SmoothTransformation);
m_icon->setShapeMode(QGraphicsPixmapItem::BoundingRectShape);
QtDeviceScaledPixmap pixmap((ResourcePaths::getGuiPath() + "graph_view/images/arrow.png").c_str());
QtDeviceScaledPixmap pixmap((ResourcePaths::getGuiPath().str() + "graph_view/images/arrow.png").c_str());
pixmap.scaleToHeight(iconHeight);
if (invisibleSubNodeCount)