ui: use wstring in gui relates places

* loading icons
* loading fonts
* context menu action for copy path to clipboard
* context menu action for open containing folder
This commit is contained in:
mlangkabel
2018-02-19 12:45:47 +01:00
parent ed386fdbdf
commit fc92cb1ad9
23 changed files with 75 additions and 63 deletions
+2 -2
View File
@@ -10,14 +10,14 @@ void IndexerCommandList::addCommand(std::shared_ptr<IndexerCommand> command)
{
std::lock_guard<std::mutex> lock(m_commandsMutex);
std::string commandHash = command->getSourceFilePath().str() + std::to_string(command->getByteSize(1));
std::wstring commandHash = command->getSourceFilePath().wstr() + std::to_wstring(command->getByteSize(1));
if (m_commandIndex.insert(commandHash).second == true) // Don't add duplicate indexer commands
{
m_commands.push_back(command);
}
else
{
LOG_WARNING_STREAM(<< "Duplicate indexer command was ignored: " << commandHash);
LOG_WARNING(L"Duplicate indexer command was ignored: " + commandHash);
}
}
+1 -1
View File
@@ -24,7 +24,7 @@ private:
std::deque<std::shared_ptr<IndexerCommand>> m_commands;
std::mutex m_commandsMutex;
std::set<std::string> m_commandIndex;
std::set<std::wstring> m_commandIndex;
};
#endif // INDEXER_COMMAND_LIST_H
+1 -1
View File
@@ -146,7 +146,7 @@ void TaskBuildIndex::doExit(std::shared_ptr<Blackboard> blackboard)
"conforms to the specified language standard and all necessary options are defined within your project "
"setup.", path.wstr(), 1, 1, true, true
));
LOG_INFO_STREAM(<< "crashed translation unit: " << path.str());
LOG_INFO(L"crashed translation unit: " + path.wstr());
}
m_storageProvider->insert(is);
}
+7 -7
View File
@@ -180,26 +180,26 @@ bool SourceLocation::isFullTextSearchMatch() const
return m_type == LOCATION_FULLTEXT_SEARCH;
}
std::ostream& operator<<(std::ostream& ostream, const SourceLocation& location)
std::wostream& operator<<(std::wostream& ostream, const SourceLocation& location)
{
if (location.isStartLocation())
{
ostream << '<';
ostream << L'<';
}
ostream << location.getColumnNumber() << ":[ ";
ostream << location.getColumnNumber() << L":[ ";
for (Id tokenId : location.getTokenIds())
{
ostream << '\b' << tokenId << ' ';
ostream << L'\b' << tokenId << L' ';
}
ostream << "\b]";
ostream << L"\b]";
if (location.isEndLocation())
{
ostream << '>';
ostream << L'>';
}
ostream << ' ';
ostream << L' ';
return ostream;
}
+1 -1
View File
@@ -61,6 +61,6 @@ private:
const bool m_isStart;
};
std::ostream& operator<<(std::ostream& ostream, const SourceLocation& location);
std::wostream& operator<<(std::wostream& ostream, const SourceLocation& location);
#endif // SOURCE_LOCATION_H
@@ -118,9 +118,9 @@ SourceLocationFile* SourceLocationCollection::createSourceLocationFile(const Fil
return filePtr.get();
}
std::ostream& operator<<(std::ostream& ostream, const SourceLocationCollection& base)
std::wostream& operator<<(std::wostream& ostream, const SourceLocationCollection& base)
{
ostream << "Locations:\n";
ostream << L"Locations:\n";
base.forEachSourceLocationFile([&ostream](std::shared_ptr<SourceLocationFile> f)
{
ostream << *(f.get());
@@ -45,6 +45,6 @@ private:
std::map<FilePath, std::shared_ptr<SourceLocationFile>> m_files;
};
std::ostream& operator<<(std::ostream& ostream, const SourceLocationCollection& base);
std::wostream& operator<<(std::wostream& ostream, const SourceLocationCollection& base);
#endif // SOURCE_LOCATION_COLLECTION_H
+5 -5
View File
@@ -187,9 +187,9 @@ std::shared_ptr<SourceLocationFile> SourceLocationFile::getFilteredByType(Locati
return ret;
}
std::ostream& operator<<(std::ostream& ostream, const SourceLocationFile& file)
std::wostream& operator<<(std::wostream& ostream, const SourceLocationFile& file)
{
ostream << "file \"" << file.getFilePath().str() << "\"";
ostream << L"file \"" << file.getFilePath().wstr() << L"\"";
size_t line = 0;
file.forEachSourceLocation(
@@ -208,16 +208,16 @@ std::ostream& operator<<(std::ostream& ostream, const SourceLocationFile& file)
line++;
}
ostream << '\n' << line;
ostream << L'\n' << line;
}
ostream << ": ";
ostream << L": ";
}
ostream << *location;
}
);
ostream << '\n';
ostream << L'\n';
return ostream;
}
+1 -1
View File
@@ -63,6 +63,6 @@ private:
std::map<Id, SourceLocation*> m_locationIndex;
};
std::ostream& operator<<(std::ostream& ostream, const SourceLocationFile& base);
std::wostream& operator<<(std::wostream& ostream, const SourceLocationFile& base);
#endif // SOURCE_LOCATION_FILE_H
+5
View File
@@ -381,6 +381,11 @@ std::string FilePath::getBackslashedString() const
return utility::replace(str(), "/", "\\");
}
std::wstring FilePath::getBackslashedWString() const
{
return utility::replace(wstr(), L"/", L"\\");
}
std::wstring FilePath::fileName() const
{
return m_path->filename().generic_wstring();
+1
View File
@@ -51,6 +51,7 @@ public:
std::string str() const;
std::wstring wstr() const;
std::string getBackslashedString() const;
std::wstring getBackslashedWString() const;
std::wstring fileName() const;
std::wstring extension() const;