logic: use wstring in symbol and bookmark names

* use wstring in symbol and bookmark names
* fixed setting apppath in windows includes
* regard utf8 encoding in shared indexer commands
* regard utf8 encoding in shared indexer status
This commit is contained in:
mlangkabel
2018-02-05 17:17:33 +01:00
parent c99e79364f
commit 9e041c1f0a
155 changed files with 1955 additions and 1864 deletions
+3 -3
View File
@@ -113,7 +113,7 @@ void QtBookmarkView::setCreateButtonState(const CreateButtonState& state)
}
void QtBookmarkView::displayBookmarkCreator(
const std::vector<std::string>& names, const std::vector<BookmarkCategory>& categories, Id nodeId
const std::vector<std::wstring>& names, const std::vector<BookmarkCategory>& categories, Id nodeId
){
m_onQtThread(
[=]()
@@ -124,7 +124,7 @@ void QtBookmarkView::displayBookmarkCreator(
);
bookmarkCreator->setupBookmarkCreator();
std::string displayName = "";
std::wstring displayName = L"";
for (unsigned int i = 0; i < names.size(); i++)
{
@@ -132,7 +132,7 @@ void QtBookmarkView::displayBookmarkCreator(
if (i < names.size() - 1)
{
displayName += "; ";
displayName += L"; ";
}
}
+1 -1
View File
@@ -29,7 +29,7 @@ public:
virtual void setCreateButtonState(const CreateButtonState& state);
virtual void displayBookmarkCreator(
const std::vector<std::string>& names, const std::vector<BookmarkCategory>& categories, Id nodeId);
const std::vector<std::wstring>& names, const std::vector<BookmarkCategory>& categories, Id nodeId);
virtual void displayBookmarkEditor(
std::shared_ptr<Bookmark> bookmark, const std::vector<BookmarkCategory>& categories);
+1 -1
View File
@@ -197,7 +197,7 @@ void QtDialogView::startIndexingDialog(
}
void QtDialogView::updateIndexingDialog(
size_t startedFileCount, size_t finishedFileCount, size_t totalFileCount, std::string sourcePath)
size_t startedFileCount, size_t finishedFileCount, size_t totalFileCount, const FilePath& sourcePath)
{
m_onQtThread(
[=]()
+1 -1
View File
@@ -38,7 +38,7 @@ public:
virtual void startIndexingDialog(
Project* project, const std::vector<RefreshMode>& enabledModes, const RefreshInfo& info) override;
virtual void updateIndexingDialog(
size_t startedFileCount, size_t finishedFileCount, size_t totalFileCount, std::string sourcePath) override;
size_t startedFileCount, size_t finishedFileCount, size_t totalFileCount, const FilePath& sourcePath) override;
virtual void finishedIndexingDialog(
size_t indexedFileCount, size_t totalIndexedFileCount, size_t completedFileCount, size_t totalFileCount,
float time, ErrorCountInfo errorInfo, bool interrupted) override;
+3 -3
View File
@@ -330,10 +330,10 @@ void QtErrorView::addErrorToTable(const ErrorInfo& error)
}
m_model->item(rowNumber, COLUMN::TYPE)->setIcon(s_errorIcon);
m_model->setItem(rowNumber, COLUMN::MESSAGE, new QStandardItem(error.message.c_str()));
m_model->setItem(rowNumber, COLUMN::MESSAGE, new QStandardItem(QString::fromStdWString(error.message)));
m_model->setItem(rowNumber, COLUMN::FILE, new QStandardItem(error.filePath.str().c_str()));
m_model->item(rowNumber, COLUMN::FILE)->setToolTip(error.filePath.str().c_str());
m_model->setItem(rowNumber, COLUMN::FILE, new QStandardItem(QString::fromStdWString(error.filePath)));
m_model->item(rowNumber, COLUMN::FILE)->setToolTip(QString::fromStdWString(error.filePath));
m_model->setItem(rowNumber, COLUMN::LINE, new QStandardItem(QString::number(error.lineNumber)));
@@ -302,7 +302,7 @@ void QtGraphEdge::focusIn()
Edge::EdgeType type = (getData() ? getData()->getType() : Edge::EDGE_AGGREGATION);
TooltipInfo info;
info.title = Edge::getReadableTypeString(type);
info.title = utility::encodeToUtf8(Edge::getReadableTypeString(type));
if (type == Edge::EDGE_AGGREGATION && m_direction == TokenComponentAggregation::DIRECTION_NONE)
{
@@ -182,14 +182,14 @@ void QtGraphNode::setMultipleActive(bool multipleActive)
m_multipleActive = multipleActive;
}
std::string QtGraphNode::getName() const
std::wstring QtGraphNode::getName() const
{
return m_text->text().toStdString();
return m_text->text().toStdWString();
}
void QtGraphNode::setName(const std::string& name)
void QtGraphNode::setName(const std::wstring& name)
{
m_text->setText(QString::fromStdString(name));
m_text->setText(QString::fromStdWString(name));
}
void QtGraphNode::addComponent(const std::shared_ptr<QtGraphNodeComponent>& component)
@@ -458,7 +458,7 @@ void QtGraphNode::notifyEdgesAfterMove()
void QtGraphNode::matchName(const std::string& query, std::vector<QtGraphNode*>* matchedNodes)
{
m_isActiveMatch = false;
std::string name = getName();
std::string name = utility::encodeToUtf8(getName());
size_t pos = utility::toLowerCase(name).find(query);
if (pos != std::string::npos)
@@ -64,8 +64,8 @@ public:
void setIsActive(bool isActive);
void setMultipleActive(bool multipleActive);
std::string getName() const;
void setName(const std::string& name);
std::wstring getName() const;
void setName(const std::wstring& name);
void addComponent(const std::shared_ptr<QtGraphNodeComponent>& component);
@@ -17,28 +17,28 @@ QtGraphNodeAccess::QtGraphNodeAccess(AccessKind accessKind)
, m_accessIcon(nullptr)
, m_accessIconSize(16)
{
std::string accessString = TokenComponentAccess::getAccessString(m_accessKind);
std::wstring accessString = TokenComponentAccess::getAccessString(m_accessKind);
this->setName(accessString);
m_text->hide();
std::string iconFileName;
std::wstring iconFileName;
switch (m_accessKind)
{
case ACCESS_PUBLIC:
iconFileName = "public";
iconFileName = L"public";
break;
case ACCESS_PROTECTED:
iconFileName = "protected";
iconFileName = L"protected";
break;
case ACCESS_PRIVATE:
iconFileName = "private";
iconFileName = L"private";
break;
case ACCESS_DEFAULT:
iconFileName = "default";
iconFileName = L"default";
break;
case ACCESS_TEMPLATE_PARAMETER:
case ACCESS_TYPE_PARAMETER:
iconFileName = "template";
iconFileName = L"template";
break;
default:
break;
@@ -47,7 +47,7 @@ QtGraphNodeAccess::QtGraphNodeAccess(AccessKind accessKind)
if (iconFileName.size() > 0)
{
QtDeviceScaledPixmap pixmap(
QString::fromStdString(ResourcePaths::getGuiPath().str() + "graph_view/images/" + iconFileName + ".png"));
QString::fromStdWString(ResourcePaths::getGuiPath().concatenate(L"graph_view/images/" + iconFileName + L".png").wstr()));
pixmap.scaleToHeight(m_accessIconSize);
m_accessIcon = new QGraphicsPixmapItem(pixmap.pixmap(), this);
@@ -9,7 +9,7 @@
#include "component/view/GraphViewStyle.h"
#include "qt/graphics/QtCountCircleItem.h"
QtGraphNodeBundle::QtGraphNodeBundle(Id tokenId, size_t nodeCount, NodeType type, std::string name)
QtGraphNodeBundle::QtGraphNodeBundle(Id tokenId, size_t nodeCount, NodeType type, std::wstring name)
: QtGraphNode()
, m_tokenId(tokenId)
, m_type(type)
@@ -42,7 +42,7 @@ void QtGraphNodeBundle::onClick()
{
MessageGraphNodeBundleSplit(
m_tokenId,
!m_type.isUnknownSymbol() && getName() != "Anonymous Namespaces",
!m_type.isUnknownSymbol() && getName() != L"Anonymous Namespaces", // TODO: move to language package
!m_type.isUnknownSymbol()
).dispatch();
}
@@ -11,7 +11,7 @@ class QtGraphNodeBundle
{
Q_OBJECT
public:
QtGraphNodeBundle(Id tokenId, size_t nodeCount, NodeType type, std::string name);
QtGraphNodeBundle(Id tokenId, size_t nodeCount, NodeType type, std::wstring name);
virtual ~QtGraphNodeBundle();
// QtGraphNode implementation
@@ -9,7 +9,7 @@
#include "data/graph/token_component/TokenComponentFilePath.h"
QtGraphNodeData::QtGraphNodeData(const Node* data, const std::string& name, bool hasParent, bool childVisible, bool hasQualifier)
QtGraphNodeData::QtGraphNodeData(const Node* data, const std::wstring& name, bool hasParent, bool childVisible, bool hasQualifier)
: m_data(data)
, m_childVisible(childVisible)
, m_hasQualifier(hasQualifier)
@@ -59,7 +59,7 @@ void QtGraphNodeData::onClick()
FilePath path = getFilePath();
MessageActivateNodes message;
message.addNode(m_data->getId(), path.empty() ? m_data->getNameHierarchy() : NameHierarchy(path.str(), NAME_DELIMITER_FILE));
message.addNode(m_data->getId(), path.empty() ? m_data->getNameHierarchy() : NameHierarchy(path.wstr(), NAME_DELIMITER_FILE));
message.dispatch();
}
@@ -10,7 +10,7 @@ class QtGraphNodeData
{
Q_OBJECT
public:
QtGraphNodeData(const Node* data, const std::string& name, bool hasParent, bool childVisible, bool hasQualifier);
QtGraphNodeData(const Node* data, const std::wstring& name, bool hasParent, bool childVisible, bool hasQualifier);
virtual ~QtGraphNodeData();
const Node* getData() const;
@@ -27,7 +27,7 @@ QtGraphNodeQualifier::QtGraphNodeQualifier(const NameHierarchy& name)
m_name = new QGraphicsSimpleTextItem(this);
m_name->setFont(font);
m_name->setText(QString::fromStdString(name.getQualifiedName()));
m_name->setText(QString::fromStdWString(name.getQualifiedName()));
}
QtGraphNodeQualifier::~QtGraphNodeQualifier()
@@ -1,6 +1,6 @@
#include "qt/view/graphElements/QtGraphNodeText.h"
QtGraphNodeText::QtGraphNodeText(const std::string& name)
QtGraphNodeText::QtGraphNodeText(const std::wstring& name)
{
setName(name);
}
@@ -8,7 +8,7 @@ class QtGraphNodeText
{
Q_OBJECT
public:
QtGraphNodeText(const std::string& name);
QtGraphNodeText(const std::wstring& name);
virtual ~QtGraphNodeText();
// QtGraphNode implementation