From 1f4ec394a73c35f8a5075a9d3c1f18532c741bb3 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Wed, 28 Aug 2024 10:02:15 +0200 Subject: [PATCH] Axivion: Remove dashboard It had been part of the start of the work on the plugin to show some progress and add some structure to the process flow. Change-Id: I2e189c4ebe3179a805e528c99e97719e5d27722f Reviewed-by: Jarek Kobus Reviewed-by: Mohammad Mehdi Salem Naraghi Reviewed-by: Leena Miettinen --- .../images/qtcreator-axivion-view.webp | Bin 4184 -> 0 bytes .../src/analyze/creator-axivion.qdoc | 15 +- src/plugins/axivion/axivionoutputpane.cpp | 208 +----------------- src/plugins/axivion/axivionplugin.cpp | 3 +- 4 files changed, 12 insertions(+), 214 deletions(-) delete mode 100644 doc/qtcreator/images/qtcreator-axivion-view.webp diff --git a/doc/qtcreator/images/qtcreator-axivion-view.webp b/doc/qtcreator/images/qtcreator-axivion-view.webp deleted file mode 100644 index 0d1614b4eba94d5ae0713819d125d208c3fd9962..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4184 zcmWIYbaM+3U|PlmAmT9^%XU>$2gEHJ( z7p-}sbZ)-xm-%8j(TT6qtV6rCx3af$MDKGKuc-gD?X9`;^WYoXa;3NC-rkmb+iY{` z^#4z_eGM$FR|jvuIWO3JrD1rMnyImB%dKsp+P}5my?gg@{u|%ytbS(n>%7CHC2GYoY3DuK*!KiF{{He~W5#T` z{M;MT8|GYbEZ!R9;%RZNWdqx4RTDPr-?LIq@gIHs{Ydhc^g}x07CyX=C0i7Ch~0N% zSC;$l@L{^W{GXjaY!5Cr7tXQ_2t4V)v;69WeO~r13@xJP%uIreOs|!#X<%5YQy(2u zSG=^9ZNB!C|Hs+pZjaJiP$H}nS{tae!LzjaKtROI)~|=`woK?PRQi58C-IN&jYF!x zkB2SGXPahrjH|;VQ@Al>lZ%~DeXLIL9v9!kfikJflpGiQ*~6gZn!_yRqAtDk?g}O2 z)hi6P`~0?GT&GqfurSwkvd<0yr}eY5wD%n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yze/creator-axivion.qdoc b/doc/qtcreator/src/analyze/creator-axivion.qdoc index 8f0a00e01ca..2ac7967c39d 100644 --- a/doc/qtcreator/src/analyze/creator-axivion.qdoc +++ b/doc/qtcreator/src/analyze/creator-axivion.qdoc @@ -29,14 +29,9 @@ \image qtcreator-axivion-view-rule.webp {Axivion sidebar view} - \section1 View issue counts + \section1 View issues - To view the issue counts, select \inlineimage icons/home.png - (\uicontrol {Show Dashboard}) in the \uicontrol Axivion dashboard. - - \image qtcreator-axivion-view.webp {Axivion dashboard} - - The \uicontrol Axivion dashboard lists the numbers of the following types of + The \uicontrol Axivion dashboard displays the following types of issues that Axivion found in the linked project: \table @@ -73,12 +68,6 @@ or coding conventions. \endtable - To clear the view, select \inlineimage icons/clean_pane_small.png - (\uicontrol Clear). - - To view issues, select \inlineimage icons/zoom.png - (\uicontrol {Search for Issues}). - \section1 Filter issues \image qtcreator-axivion-issue-search.webp {Issues in Axivion view} diff --git a/src/plugins/axivion/axivionoutputpane.cpp b/src/plugins/axivion/axivionoutputpane.cpp index 9b0a773ae9f..255e69f4ec2 100644 --- a/src/plugins/axivion/axivionoutputpane.cpp +++ b/src/plugins/axivion/axivionoutputpane.cpp @@ -33,9 +33,8 @@ #include #include #include -#include -#include #include +#include #include #include #include @@ -55,48 +54,6 @@ using namespace Utils; namespace Axivion::Internal { -void showIssuesFromDashboard(const QString &kind); // impl at bottom - -class DashboardWidget : public QScrollArea -{ -public: - explicit DashboardWidget(QWidget *parent = nullptr); - void updateUi(); - bool hasProject() const { return !m_project->text().isEmpty(); } -private: - QLabel *m_project = nullptr; - QLabel *m_loc = nullptr; - QLabel *m_timestamp = nullptr; - QGridLayout *m_gridLayout = nullptr; -}; - -DashboardWidget::DashboardWidget(QWidget *parent) - : QScrollArea(parent) -{ - QWidget *widget = new QWidget(this); - m_project = new QLabel(this); - m_loc = new QLabel(this); - m_timestamp = new QLabel(this); - - m_gridLayout = new QGridLayout; - - using namespace Layouting; - Column { - Form { - Tr::tr("Project:"), m_project, br, - Tr::tr("Lines of code:"), m_loc, br, - Tr::tr("Analysis timestamp:"), m_timestamp - }, - Space(10), - Row { m_gridLayout, st }, - st - }.attachTo(widget); - - setWidget(widget); - setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); - setWidgetResizable(true); -} - static QPixmap trendIcon(qint64 added, qint64 removed) { static const QPixmap unchanged = Icons::NEXT.pixmap(); @@ -109,112 +66,6 @@ static QPixmap trendIcon(qint64 added, qint64 removed) return added < removed ? decreased : increased; } -static qint64 extract_value(const std::map &map, const QString &key) -{ - const auto search = map.find(key); - if (search == map.end()) - return 0; - const Dto::Any &value = search->second; - if (!value.isDouble()) - return 0; - return static_cast(value.getDouble()); -} - -void DashboardWidget::updateUi() -{ - m_project->setText({}); - m_loc->setText({}); - m_timestamp->setText({}); - QLayoutItem *child; - while ((child = m_gridLayout->takeAt(0)) != nullptr) { - delete child->widget(); - delete child; - } - std::optional projectInfo = Internal::projectInfo(); - if (!projectInfo) - return; - const Dto::ProjectInfoDto &info = *projectInfo; - m_project->setText(info.name); - if (info.versions.empty()) - return; - - const Dto::AnalysisVersionDto &last = info.versions.back(); - setAnalysisVersion(last.date); - if (last.linesOfCode.has_value()) - m_loc->setText(QString::number(last.linesOfCode.value())); - const QDateTime timeStamp = QDateTime::fromString(last.date, Qt::ISODate); - m_timestamp->setText(timeStamp.isValid() ? timeStamp.toString("yyyy-MM-dd HH:mm:ss t") - : Tr::tr("unknown")); - - const std::vector &issueKinds = info.issueKinds; - auto toolTip = [issueKinds](const QString &prefix){ - for (const Dto::IssueKindInfoDto &kind : issueKinds) { - if (kind.prefix == prefix) - return kind.nicePluralName; - } - return prefix; - }; - auto linked = [](const QString &text, const QString &href, bool link) { - return link ? QString("%2").arg(href).arg(text) - : text; - }; - auto addValuesWidgets = [this, &toolTip, &linked](const QString &issueKind, qint64 total, - qint64 added, qint64 removed, int row, bool link) { - const QString currentToolTip = toolTip(issueKind); - QLabel *label = new QLabel(issueKind, this); - label->setToolTip(currentToolTip); - m_gridLayout->addWidget(label, row, 0); - label = new QLabel(linked(QString::number(total), issueKind, link), this); - label->setToolTip(currentToolTip); - label->setAlignment(Qt::AlignRight); - if (link) { - connect(label, &QLabel::linkActivated, this, [](const QString &issueKind) { - showIssuesFromDashboard(issueKind); - }); - } - m_gridLayout->addWidget(label, row, 1); - label = new QLabel(this); - label->setPixmap(trendIcon(added, removed)); - label->setToolTip(currentToolTip); - m_gridLayout->addWidget(label, row, 2); - label = new QLabel('+' + QString::number(added)); - label->setAlignment(Qt::AlignRight); - label->setToolTip(currentToolTip); - m_gridLayout->addWidget(label, row, 3); - label = new QLabel("/"); - label->setToolTip(currentToolTip); - m_gridLayout->addWidget(label, row, 4); - label = new QLabel('-' + QString::number(removed)); - label->setAlignment(Qt::AlignRight); - label->setToolTip(currentToolTip); - m_gridLayout->addWidget(label, row, 5); - }; - qint64 allTotal = 0; - qint64 allAdded = 0; - qint64 allRemoved = 0; - qint64 row = 0; - // This code is overly complex because of a heedlessness in the - // Axivion Dashboard API definition. Other Axivion IDE plugins do - // not use the issue counts, thus the QtCreator Axivion Plugin - // is going to stop using them, too. - if (last.issueCounts.isMap()) { - for (const Dto::Any::MapEntry &issueCount : last.issueCounts.getMap()) { - if (issueCount.second.isMap()) { - const Dto::Any::Map &counts = issueCount.second.getMap(); - qint64 total = extract_value(counts, QStringLiteral("Total")); - allTotal += total; - qint64 added = extract_value(counts, QStringLiteral("Added")); - allAdded += added; - qint64 removed = extract_value(counts, QStringLiteral("Removed")); - allRemoved += removed; - addValuesWidgets(issueCount.first, total, added, removed, row, true); - ++row; - } - } - } - addValuesWidgets(Tr::tr("Total:"), allTotal, allAdded, allRemoved, row, false); -} - struct LinkWithColumns { Link link; @@ -616,6 +467,7 @@ void IssuesWidget::updateBasicProjectInfo(const std::optionalclear(); @@ -818,8 +670,6 @@ public: setPriorityInStatusBar(-50); m_outputWidget = new QStackedWidget; - DashboardWidget *dashboardWidget = new DashboardWidget(m_outputWidget); - m_outputWidget->addWidget(dashboardWidget); IssuesWidget *issuesWidget = new IssuesWidget(m_outputWidget); m_outputWidget->addWidget(issuesWidget); @@ -827,31 +677,6 @@ public: pal.setColor(QPalette::Window, creatorColor(Theme::Color::BackgroundColorNormal)); m_outputWidget->setPalette(pal); - m_showDashboard = new QToolButton(m_outputWidget); - m_showDashboard->setIcon(Icons::HOME_TOOLBAR.icon()); - m_showDashboard->setToolTip(Tr::tr("Show dashboard")); - m_showDashboard->setCheckable(true); - m_showDashboard->setChecked(true); - connect(m_showDashboard, &QToolButton::clicked, this, [this] { - QTC_ASSERT(m_outputWidget, return); - m_outputWidget->setCurrentIndex(0); - }); - - m_showIssues = new QToolButton(m_outputWidget); - m_showIssues->setIcon(Icons::ZOOM_TOOLBAR.icon()); - m_showIssues->setToolTip(Tr::tr("Search for issues")); - m_showIssues->setCheckable(true); - connect(m_showIssues, &QToolButton::clicked, this, [this] { handleShowIssues({}); }); - auto *butonGroup = new QButtonGroup(this); - butonGroup->addButton(m_showDashboard); - butonGroup->addButton(m_showIssues); - butonGroup->setExclusive(true); - - connect(m_outputWidget, &QStackedWidget::currentChanged, this, [this](int idx) { - m_showDashboard->setChecked(idx == 0); - m_showIssues->setChecked(idx == 1); - }); - m_toggleIssues = new QToolButton(m_outputWidget); m_toggleIssues->setIcon(Utils::Icons::WARNING_TOOLBAR.icon()); m_toggleIssues->setToolTip(Tr::tr("Show issue annotations inline")); @@ -882,7 +707,7 @@ public: QList toolBarWidgets() const final { - return {m_showDashboard, m_showIssues, m_toggleIssues}; + return {m_toggleIssues}; } void clearContents() final {} @@ -898,24 +723,14 @@ public: void handleShowIssues(const QString &kind) { QTC_ASSERT(m_outputWidget, return); - m_outputWidget->setCurrentIndex(1); - if (auto issues = static_cast(m_outputWidget->widget(1))) + m_outputWidget->setCurrentIndex(0); + if (auto issues = static_cast(m_outputWidget->widget(0))) issues->updateUi(kind); } - void updateDashboard() - { - if (auto dashboard = static_cast(m_outputWidget->widget(0))) { - dashboard->updateUi(); - m_outputWidget->setCurrentIndex(0); - if (dashboard->hasProject()) - flash(); - } - } - bool handleContextMenu(const QString &issue, const ItemViewEvent &e) { - auto issues = static_cast(m_outputWidget->widget(1)); + auto issues = static_cast(m_outputWidget->widget(0)); std::optional tableInfoOpt = issues ? issues->currentTableInfo() : std::nullopt; if (!tableInfoOpt) @@ -957,8 +772,6 @@ public: private: QStackedWidget *m_outputWidget = nullptr; - QToolButton *m_showDashboard = nullptr; - QToolButton *m_showIssues = nullptr; QToolButton *m_toggleIssues = nullptr; }; @@ -973,7 +786,8 @@ void setupAxivionOutputPane(QObject *guard) void updateDashboard() { QTC_ASSERT(theAxivionOutputPane, return); - theAxivionOutputPane->updateDashboard(); + theAxivionOutputPane->handleShowIssues({}); + theAxivionOutputPane->flash(); } static bool issueListContextMenuEvent(const ItemViewEvent &ev) @@ -987,10 +801,4 @@ static bool issueListContextMenuEvent(const ItemViewEvent &ev) return theAxivionOutputPane->handleContextMenu(issue, ev); } -void showIssuesFromDashboard(const QString &kind) -{ - QTC_ASSERT(theAxivionOutputPane, return); - theAxivionOutputPane->handleShowIssues(kind); -} - } // Axivion::Internal diff --git a/src/plugins/axivion/axivionplugin.cpp b/src/plugins/axivion/axivionplugin.cpp index 6b26ddeee1c..8bf33b72d79 100644 --- a/src/plugins/axivion/axivionplugin.cpp +++ b/src/plugins/axivion/axivionplugin.cpp @@ -873,8 +873,9 @@ void AxivionPluginPrivate::fetchProjectInfo(const QString &projectName) const auto handler = [this](const Dto::ProjectInfoDto &data) { m_currentProjectInfo = data; + if (!m_currentProjectInfo->versions.empty()) + setAnalysisVersion(m_currentProjectInfo->versions.back().date); updateDashboard(); - handleOpenedDocs(); }; taskTree.setRecipe(