forked from qt-creator/qt-creator
Axivion: Allow disabling of inline issues
Enables the user to disable fetching inline issues for opened documents and removes all existing issue markers when disabling. Change-Id: I93f1982b0ca4a1f3efdd38befc378fcef5188591 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <coreplugin/ioutputpane.h>
|
||||
|
||||
#include <projectexplorer/projectexplorericons.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectmanager.h>
|
||||
|
||||
@@ -56,7 +57,7 @@ namespace Axivion::Internal {
|
||||
|
||||
static QPixmap trendIcon(qint64 added, qint64 removed)
|
||||
{
|
||||
static const QPixmap unchanged = Icons::NEXT.pixmap();
|
||||
static const QPixmap unchanged = Utils::Icons::NEXT.pixmap();
|
||||
static const QPixmap increased = Icon(
|
||||
{ {":/utils/images/arrowup.png", Theme::IconsErrorColor} }).pixmap();
|
||||
static const QPixmap decreased = Icon(
|
||||
@@ -677,6 +678,13 @@ public:
|
||||
pal.setColor(QPalette::Window, creatorColor(Theme::Color::BackgroundColorNormal));
|
||||
m_outputWidget->setPalette(pal);
|
||||
|
||||
m_disableInlineIssues = new QToolButton(m_outputWidget);
|
||||
m_disableInlineIssues->setIcon(ProjectExplorer::Icons::BUILDSTEP_DISABLE.icon());
|
||||
m_disableInlineIssues->setToolTip(Tr::tr("Disable inline issues"));
|
||||
m_disableInlineIssues->setCheckable(true);
|
||||
m_disableInlineIssues->setChecked(false);
|
||||
connect(m_disableInlineIssues, &QToolButton::toggled,
|
||||
this, [](bool checked) { disableInlineIssues(checked); });
|
||||
m_toggleIssues = new QToolButton(m_outputWidget);
|
||||
m_toggleIssues->setIcon(Utils::Icons::WARNING_TOOLBAR.icon());
|
||||
m_toggleIssues->setToolTip(Tr::tr("Show issue annotations inline"));
|
||||
@@ -707,7 +715,7 @@ public:
|
||||
|
||||
QList<QWidget *> toolBarWidgets() const final
|
||||
{
|
||||
return {m_toggleIssues};
|
||||
return {m_disableInlineIssues, m_toggleIssues};
|
||||
}
|
||||
|
||||
void clearContents() final {}
|
||||
@@ -773,6 +781,7 @@ public:
|
||||
private:
|
||||
QStackedWidget *m_outputWidget = nullptr;
|
||||
QToolButton *m_toggleIssues = nullptr;
|
||||
QToolButton *m_disableInlineIssues = nullptr;
|
||||
};
|
||||
|
||||
|
||||
|
@@ -221,6 +221,7 @@ public:
|
||||
void clearAllMarks();
|
||||
void updateExistingMarks();
|
||||
void handleIssuesForFile(const Dto::FileViewDto &fileView);
|
||||
void disableInlineIssues(bool disable);
|
||||
void fetchIssueInfo(const QString &id);
|
||||
void setIssueDetails(const QString &issueDetailsHtml);
|
||||
void handleAnchorClicked(const QUrl &url);
|
||||
@@ -248,6 +249,7 @@ public:
|
||||
FileInProjectFinder m_fileFinder; // FIXME maybe obsolete when path mapping is implemented
|
||||
QMetaObject::Connection m_fileFinderConnection;
|
||||
QHash<FilePath, QSet<TextMark *>> m_allMarks;
|
||||
bool m_inlineIssuesEnabled = true;
|
||||
};
|
||||
|
||||
static AxivionPluginPrivate *dd = nullptr;
|
||||
@@ -952,6 +954,8 @@ void AxivionPluginPrivate::updateExistingMarks() // update whether highlight mar
|
||||
|
||||
void AxivionPluginPrivate::onDocumentOpened(IDocument *doc)
|
||||
{
|
||||
if (!m_inlineIssuesEnabled)
|
||||
return;
|
||||
if (!doc || !m_currentProjectInfo || !m_project || !m_project->isKnownFile(doc->filePath()))
|
||||
return;
|
||||
|
||||
@@ -1012,6 +1016,18 @@ void AxivionPluginPrivate::handleIssuesForFile(const Dto::FileViewDto &fileView)
|
||||
}
|
||||
}
|
||||
|
||||
void AxivionPluginPrivate::disableInlineIssues(bool disable)
|
||||
{
|
||||
if (m_inlineIssuesEnabled != disable)
|
||||
return;
|
||||
m_inlineIssuesEnabled = !disable;
|
||||
|
||||
if (disable)
|
||||
clearAllMarks();
|
||||
else
|
||||
handleOpenedDocs();
|
||||
}
|
||||
|
||||
void AxivionPluginPrivate::handleAnchorClicked(const QUrl &url)
|
||||
{
|
||||
QTC_ASSERT(dd, return);
|
||||
@@ -1137,6 +1153,12 @@ void setAnalysisVersion(const QString &version)
|
||||
dd->handleOpenedDocs();
|
||||
}
|
||||
|
||||
void disableInlineIssues(bool disable)
|
||||
{
|
||||
QTC_ASSERT(dd, return);
|
||||
dd->disableInlineIssues(disable);
|
||||
}
|
||||
|
||||
Utils::FilePath findFileForIssuePath(const Utils::FilePath &issuePath)
|
||||
{
|
||||
QTC_ASSERT(dd, return {});
|
||||
|
@@ -89,6 +89,7 @@ void fetchIssueInfo(const QString &id);
|
||||
void switchActiveDashboardId(const Utils::Id &toDashboardId);
|
||||
const std::optional<DashboardInfo> currentDashboardInfo();
|
||||
void setAnalysisVersion(const QString &version);
|
||||
void disableInlineIssues(bool disable);
|
||||
|
||||
Utils::FilePath findFileForIssuePath(const Utils::FilePath &issuePath);
|
||||
|
||||
|
Reference in New Issue
Block a user