diff options
author | hjk <hjk@qt.io> | 2023-02-07 18:14:53 +0100 |
---|---|---|
committer | hjk <hjk@qt.io> | 2023-02-08 13:48:30 +0000 |
commit | 3f8240a7de9be6df01b5f56ce57d2750bcbbf187 (patch) | |
tree | 99bf029466141218828281fbd7ec7e5bbc63e610 /src/plugins/texteditor | |
parent | a7bf65c2888f179a8697912be521ebe1b33d0efd (diff) |
TextEditor: Some fileName -> filePath renaming
Change-Id: Id0751f936666fa658226d62a1906b82e3bac1660
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Diffstat (limited to 'src/plugins/texteditor')
-rw-r--r-- | src/plugins/texteditor/textmark.cpp | 22 | ||||
-rw-r--r-- | src/plugins/texteditor/textmark.h | 8 |
2 files changed, 14 insertions, 16 deletions
diff --git a/src/plugins/texteditor/textmark.cpp b/src/plugins/texteditor/textmark.cpp index cf391fa1060..19ab3d1d346 100644 --- a/src/plugins/texteditor/textmark.cpp +++ b/src/plugins/texteditor/textmark.cpp @@ -63,8 +63,8 @@ private: TextMarkRegistry *m_instance = nullptr; -TextMark::TextMark(const FilePath &fileName, int lineNumber, TextMarkCategory category) - : m_fileName(fileName) +TextMark::TextMark(const FilePath &filePath, int lineNumber, TextMarkCategory category) + : m_fileName(filePath) , m_lineNumber(lineNumber) , m_visible(true) , m_category(category) @@ -82,18 +82,18 @@ TextMark::~TextMark() m_baseTextDocument = nullptr; } -FilePath TextMark::fileName() const +FilePath TextMark::filePath() const { return m_fileName; } -void TextMark::updateFileName(const FilePath &fileName) +void TextMark::updateFilePath(const FilePath &filePath) { - if (fileName == m_fileName) + if (filePath == m_fileName) return; if (!m_fileName.isEmpty()) TextMarkRegistry::remove(this); - m_fileName = fileName; + m_fileName = filePath; if (!m_fileName.isEmpty()) TextMarkRegistry::add(this); } @@ -451,14 +451,14 @@ TextMarkRegistry::TextMarkRegistry(QObject *parent) void TextMarkRegistry::add(TextMark *mark) { - instance()->m_marks[mark->fileName()].insert(mark); - if (TextDocument *document = TextDocument::textDocumentForFilePath(mark->fileName())) + instance()->m_marks[mark->filePath()].insert(mark); + if (TextDocument *document = TextDocument::textDocumentForFilePath(mark->filePath())) document->addMark(mark); } bool TextMarkRegistry::remove(TextMark *mark) { - return instance()->m_marks[mark->fileName()].remove(mark); + return instance()->m_marks[mark->filePath()].remove(mark); } TextMarkRegistry *TextMarkRegistry::instance() @@ -500,7 +500,7 @@ void TextMarkRegistry::documentRenamed(IDocument *document, m_marks[newPath].unite(toBeMoved); for (TextMark *mark : std::as_const(toBeMoved)) - mark->updateFileName(newPath); + mark->updateFilePath(newPath); } void TextMarkRegistry::allDocumentsRenamed(const FilePath &oldPath, const FilePath &newPath) @@ -514,7 +514,7 @@ void TextMarkRegistry::allDocumentsRenamed(const FilePath &oldPath, const FilePa m_marks[oldPath].clear(); for (TextMark *mark : oldFileNameMarks) - mark->updateFileName(newPath); + mark->updateFilePath(newPath); } QHash<AnnotationColors::SourceColors, AnnotationColors> AnnotationColors::m_colorCache; diff --git a/src/plugins/texteditor/textmark.h b/src/plugins/texteditor/textmark.h index 0a34139ec55..72712557058 100644 --- a/src/plugins/texteditor/textmark.h +++ b/src/plugins/texteditor/textmark.h @@ -38,10 +38,8 @@ public: class TEXTEDITOR_EXPORT TextMark { public: - TextMark(const Utils::FilePath &fileName, - int lineNumber, - TextMarkCategory category); TextMark() = delete; + TextMark(const Utils::FilePath &filePath, int lineNumber, TextMarkCategory category); virtual ~TextMark(); // determine order on markers on the same line. @@ -52,7 +50,7 @@ public: HighPriority // shown on top. }; - Utils::FilePath fileName() const; + Utils::FilePath filePath() const; int lineNumber() const; virtual void paintIcon(QPainter *painter, const QRect &rect) const; @@ -74,7 +72,7 @@ public: AnnotationRects annotationRects(const QRectF &boundingRect, const QFontMetrics &fm, const qreal fadeInOffset, const qreal fadeOutOffset) const; /// called if the filename of the document changed - virtual void updateFileName(const Utils::FilePath &fileName); + virtual void updateFilePath(const Utils::FilePath &filePath); virtual void updateLineNumber(int lineNumber); virtual void updateBlock(const QTextBlock &block); virtual void move(int line); |