ui: scope names in snippet titles
* added title for snippets * title displays name of parent scope. * when new TokenLocationFiles are created in the storage they are now returned as shared_ptr to ensure correct linking in the contained data. * Storage::getTokenLocationsForLinesInFile() now always returns pairs of start and end locations. * Adjusted code snippet view to regard the change described above.
This commit is contained in:
@@ -36,10 +36,11 @@ QSize QtCodeFileList::sizeHint() const
|
||||
|
||||
void QtCodeFileList::addCodeSnippet(
|
||||
uint startLineNumber,
|
||||
const std::string& title,
|
||||
const std::string& code,
|
||||
const TokenLocationFile& locationFile
|
||||
std::shared_ptr<TokenLocationFile> locationFile
|
||||
){
|
||||
FilePath filePath = locationFile.getFilePath();
|
||||
FilePath filePath = locationFile->getFilePath();
|
||||
QtCodeFile* file = nullptr;
|
||||
|
||||
for (std::shared_ptr<QtCodeFile> filePtr : m_files)
|
||||
@@ -53,14 +54,14 @@ void QtCodeFileList::addCodeSnippet(
|
||||
|
||||
if (!file)
|
||||
{
|
||||
std::shared_ptr<QtCodeFile> filePtr = std::make_shared<QtCodeFile>(locationFile.getFilePath(), this);
|
||||
std::shared_ptr<QtCodeFile> filePtr = std::make_shared<QtCodeFile>(locationFile->getFilePath(), this);
|
||||
m_files.push_back(filePtr);
|
||||
|
||||
file = filePtr.get();
|
||||
m_frame->layout()->addWidget(file);
|
||||
}
|
||||
|
||||
file->addCodeSnippet(startLineNumber, code, locationFile);
|
||||
file->addCodeSnippet(startLineNumber, title, code, locationFile);
|
||||
}
|
||||
|
||||
void QtCodeFileList::clearCodeSnippets()
|
||||
|
||||
Reference in New Issue
Block a user