forked from qt-creator/qt-creator
Axivion: Fix changing highlighting of issues
So far we are only fetching line markers for newly opened documents. So, only re-opening a file updates the appearance of text marks stored for a document. This patch allows to remove an already set color of the mark which in turn is responsible for highlighting the marks on the scrollbar. Toggling the respective setting now updates existing marks. Change-Id: I95f65b8c48cb1f125740b88e7f744398b72ee92b Reviewed-by: Mohammad Mehdi Salem Naraghi <mehdi.salem@qt.io> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -219,6 +219,7 @@ public:
|
|||||||
void onDocumentOpened(IDocument *doc);
|
void onDocumentOpened(IDocument *doc);
|
||||||
void onDocumentClosed(IDocument * doc);
|
void onDocumentClosed(IDocument * doc);
|
||||||
void clearAllMarks();
|
void clearAllMarks();
|
||||||
|
void updateExistingMarks();
|
||||||
void handleIssuesForFile(const Dto::FileViewDto &fileView);
|
void handleIssuesForFile(const Dto::FileViewDto &fileView);
|
||||||
void fetchIssueInfo(const QString &id);
|
void fetchIssueInfo(const QString &id);
|
||||||
void setIssueDetails(const QString &issueDetailsHtml);
|
void setIssueDetails(const QString &issueDetailsHtml);
|
||||||
@@ -313,6 +314,8 @@ AxivionPluginPrivate::AxivionPluginPrivate()
|
|||||||
connect(&m_networkAccessManager, &QNetworkAccessManager::sslErrors,
|
connect(&m_networkAccessManager, &QNetworkAccessManager::sslErrors,
|
||||||
this, &AxivionPluginPrivate::handleSslErrors);
|
this, &AxivionPluginPrivate::handleSslErrors);
|
||||||
#endif // ssl
|
#endif // ssl
|
||||||
|
connect(&settings().highlightMarks, &BoolAspect::changed,
|
||||||
|
this, &AxivionPluginPrivate::updateExistingMarks);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AxivionPluginPrivate::handleSslErrors(QNetworkReply *reply, const QList<QSslError> &errors)
|
void AxivionPluginPrivate::handleSslErrors(QNetworkReply *reply, const QList<QSslError> &errors)
|
||||||
@@ -930,6 +933,27 @@ void AxivionPluginPrivate::clearAllMarks()
|
|||||||
onDocumentClosed(doc);
|
onDocumentClosed(doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AxivionPluginPrivate::updateExistingMarks() // update whether highlight marks or not
|
||||||
|
{
|
||||||
|
static Theme::Color color = Theme::Color(Theme::Bookmarks_TextMarkColor); // FIXME!
|
||||||
|
const bool colored = settings().highlightMarks();
|
||||||
|
|
||||||
|
const QList<IDocument *> openDocuments = DocumentModel::openedDocuments();
|
||||||
|
for (IDocument *doc : openDocuments) {
|
||||||
|
if (auto textDoc = qobject_cast<TextEditor::TextDocument *>(doc)) {
|
||||||
|
const TextMarks textMarks = textDoc->marks();
|
||||||
|
for (TextEditor::TextMark *mark : textMarks) {
|
||||||
|
if (mark->category().id != s_axivionTextMarkId)
|
||||||
|
continue;
|
||||||
|
if (colored)
|
||||||
|
mark->setColor(color);
|
||||||
|
else
|
||||||
|
mark->unsetColor();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AxivionPluginPrivate::onDocumentOpened(IDocument *doc)
|
void AxivionPluginPrivate::onDocumentOpened(IDocument *doc)
|
||||||
{
|
{
|
||||||
if (!doc || !m_currentProjectInfo || !m_project || !m_project->isKnownFile(doc->filePath()))
|
if (!doc || !m_currentProjectInfo || !m_project || !m_project->isKnownFile(doc->filePath()))
|
||||||
|
@@ -406,6 +406,12 @@ void TextMark::setColor(const Theme::Color &color)
|
|||||||
updateMarker();
|
updateMarker();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TextMark::unsetColor()
|
||||||
|
{
|
||||||
|
m_color.reset();
|
||||||
|
updateMarker();
|
||||||
|
}
|
||||||
|
|
||||||
void TextMark::setLineAnnotation(const QString &lineAnnotation)
|
void TextMark::setLineAnnotation(const QString &lineAnnotation)
|
||||||
{
|
{
|
||||||
m_lineAnnotation = lineAnnotation;
|
m_lineAnnotation = lineAnnotation;
|
||||||
|
@@ -99,6 +99,7 @@ public:
|
|||||||
|
|
||||||
std::optional<Utils::Theme::Color> color() const;
|
std::optional<Utils::Theme::Color> color() const;
|
||||||
void setColor(const Utils::Theme::Color &color);
|
void setColor(const Utils::Theme::Color &color);
|
||||||
|
void unsetColor();
|
||||||
|
|
||||||
QString defaultToolTip() const { return m_defaultToolTip; }
|
QString defaultToolTip() const { return m_defaultToolTip; }
|
||||||
void setDefaultToolTip(const QString &toolTip) { m_defaultToolTip = toolTip; }
|
void setDefaultToolTip(const QString &toolTip) { m_defaultToolTip = toolTip; }
|
||||||
|
Reference in New Issue
Block a user