forked from qt-creator/qt-creator
Axivion: Merge fetchDashboardInfo() with fetchProjectInfo()
Introduce fetchDashboardAndProjectInfo() instead. Allow dashboard info handler be empty handler. Change-Id: I4f9877a91498fb5c5acd77f25ee12aacc9a5895f Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -200,7 +200,7 @@ IssuesWidget::IssuesWidget(QWidget *parent)
|
|||||||
m_currentPrefix.clear();
|
m_currentPrefix.clear();
|
||||||
m_currentProject.clear();
|
m_currentProject.clear();
|
||||||
m_issuesModel->clear();
|
m_issuesModel->clear();
|
||||||
fetchProjectInfo(m_dashboardProjects->currentText());
|
fetchDashboardAndProjectInfo({}, m_dashboardProjects->currentText());
|
||||||
});
|
});
|
||||||
// row with issue types (-> depending on choice, tables below change)
|
// row with issue types (-> depending on choice, tables below change)
|
||||||
// and a selectable range (start version, end version)
|
// and a selectable range (start version, end version)
|
||||||
@@ -388,10 +388,8 @@ void IssuesWidget::reinitProjectList(const QString ¤tProject)
|
|||||||
m_dashboardProjects->addItems(info->projects);
|
m_dashboardProjects->addItems(info->projects);
|
||||||
if (!currentProject.isEmpty() && info->projects.contains(currentProject))
|
if (!currentProject.isEmpty() && info->projects.contains(currentProject))
|
||||||
m_dashboardProjects->setCurrentText(currentProject);
|
m_dashboardProjects->setCurrentText(currentProject);
|
||||||
// FIXME ugly.. any better solution?
|
|
||||||
QTimer::singleShot(0, this, [this]() { fetchProjectInfo(m_dashboardProjects->currentText()); });
|
|
||||||
};
|
};
|
||||||
fetchDashboardInfo(onDashboardInfoFetched);
|
fetchDashboardAndProjectInfo(onDashboardInfoFetched, currentProject);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Qt::Alignment alignmentFromString(const QString &str)
|
static Qt::Alignment alignmentFromString(const QString &str)
|
||||||
|
@@ -214,8 +214,8 @@ public:
|
|||||||
AxivionPluginPrivate();
|
AxivionPluginPrivate();
|
||||||
void handleSslErrors(QNetworkReply *reply, const QList<QSslError> &errors);
|
void handleSslErrors(QNetworkReply *reply, const QList<QSslError> &errors);
|
||||||
void onStartupProjectChanged(Project *project);
|
void onStartupProjectChanged(Project *project);
|
||||||
void fetchDashboardInfo(const DashboardInfoHandler &handler);
|
void fetchDashboardAndProjectInfo(const DashboardInfoHandler &handler,
|
||||||
void fetchProjectInfo(const QString &projectName);
|
const QString &projectName);
|
||||||
void handleOpenedDocs();
|
void handleOpenedDocs();
|
||||||
void onDocumentOpened(IDocument *doc);
|
void onDocumentOpened(IDocument *doc);
|
||||||
void onDocumentClosed(IDocument * doc);
|
void onDocumentClosed(IDocument * doc);
|
||||||
@@ -283,16 +283,10 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void fetchDashboardInfo(const DashboardInfoHandler &handler)
|
void fetchDashboardAndProjectInfo(const DashboardInfoHandler &handler, const QString &projectName)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(dd, return);
|
QTC_ASSERT(dd, return);
|
||||||
dd->fetchDashboardInfo(handler);
|
dd->fetchDashboardAndProjectInfo(handler, projectName);
|
||||||
}
|
|
||||||
|
|
||||||
void fetchProjectInfo(const QString &projectName)
|
|
||||||
{
|
|
||||||
QTC_ASSERT(dd, return);
|
|
||||||
dd->fetchProjectInfo(projectName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<Dto::ProjectInfoDto> projectInfo()
|
std::optional<Dto::ProjectInfoDto> projectInfo()
|
||||||
@@ -798,6 +792,7 @@ Group dashboardInfoRecipe(const DashboardInfoHandler &handler)
|
|||||||
{
|
{
|
||||||
const auto onSetup = [handler] {
|
const auto onSetup = [handler] {
|
||||||
if (dd->m_dashboardInfo) {
|
if (dd->m_dashboardInfo) {
|
||||||
|
if (handler)
|
||||||
handler(*dd->m_dashboardInfo);
|
handler(*dd->m_dashboardInfo);
|
||||||
return SetupResult::StopWithSuccess;
|
return SetupResult::StopWithSuccess;
|
||||||
}
|
}
|
||||||
@@ -813,7 +808,7 @@ Group dashboardInfoRecipe(const DashboardInfoHandler &handler)
|
|||||||
const Group root {
|
const Group root {
|
||||||
onGroupSetup(onSetup), // Stops if cache exists.
|
onGroupSetup(onSetup), // Stops if cache exists.
|
||||||
authorizationRecipe(),
|
authorizationRecipe(),
|
||||||
onGroupDone(onDone)
|
handler ? onGroupDone(onDone) : nullItem
|
||||||
};
|
};
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
@@ -824,11 +819,6 @@ Group projectInfoRecipe(const QString &projectName)
|
|||||||
dd->clearAllMarks();
|
dd->clearAllMarks();
|
||||||
dd->m_currentProjectInfo = {};
|
dd->m_currentProjectInfo = {};
|
||||||
dd->m_analysisVersion = {};
|
dd->m_analysisVersion = {};
|
||||||
if (!projectName.isEmpty())
|
|
||||||
return SetupResult::Continue;
|
|
||||||
|
|
||||||
updateDashboard();
|
|
||||||
return SetupResult::StopWithSuccess;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto onTaskTreeSetup = [projectName](TaskTree &taskTree) {
|
const auto onTaskTreeSetup = [projectName](TaskTree &taskTree) {
|
||||||
@@ -838,10 +828,19 @@ Group projectInfoRecipe(const QString &projectName)
|
|||||||
return SetupResult::StopWithError;
|
return SetupResult::StopWithError;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto it = dd->m_dashboardInfo->projectUrls.constFind(projectName);
|
const QString targetProjectName
|
||||||
|
= (projectName.isEmpty() && !dd->m_dashboardInfo->projects.isEmpty())
|
||||||
|
? dd->m_dashboardInfo->projects.first() : projectName;
|
||||||
|
|
||||||
|
if (targetProjectName.isEmpty()) {
|
||||||
|
updateDashboard();
|
||||||
|
return SetupResult::StopWithSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto it = dd->m_dashboardInfo->projectUrls.constFind(targetProjectName);
|
||||||
if (it == dd->m_dashboardInfo->projectUrls.constEnd()) {
|
if (it == dd->m_dashboardInfo->projectUrls.constEnd()) {
|
||||||
MessageManager::writeDisrupting(QString("Axivion: %1")
|
MessageManager::writeDisrupting(QString("Axivion: %1")
|
||||||
.arg(Tr::tr("The DashboardInfo doesn't contain project \"%1\".").arg(projectName)));
|
.arg(Tr::tr("The DashboardInfo doesn't contain project \"%1\".").arg(targetProjectName)));
|
||||||
return SetupResult::StopWithError;
|
return SetupResult::StopWithError;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -859,7 +858,6 @@ Group projectInfoRecipe(const QString &projectName)
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
onGroupSetup(onSetup),
|
onGroupSetup(onSetup),
|
||||||
authorizationRecipe(),
|
|
||||||
TaskTreeTask(onTaskTreeSetup)
|
TaskTreeTask(onTaskTreeSetup)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -912,14 +910,10 @@ Group issueHtmlRecipe(const QString &issueId, const HtmlHandler &handler)
|
|||||||
return fetchHtmlRecipe(url, handler);
|
return fetchHtmlRecipe(url, handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AxivionPluginPrivate::fetchDashboardInfo(const DashboardInfoHandler &handler)
|
void AxivionPluginPrivate::fetchDashboardAndProjectInfo(const DashboardInfoHandler &handler,
|
||||||
|
const QString &projectName)
|
||||||
{
|
{
|
||||||
m_taskTreeRunner.start(dashboardInfoRecipe(handler));
|
m_taskTreeRunner.start({dashboardInfoRecipe(handler), projectInfoRecipe(projectName)});
|
||||||
}
|
|
||||||
|
|
||||||
void AxivionPluginPrivate::fetchProjectInfo(const QString &projectName)
|
|
||||||
{
|
|
||||||
m_taskTreeRunner.start(projectInfoRecipe(projectName));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Group tableInfoRecipe(const QString &prefix, const TableInfoHandler &handler)
|
Group tableInfoRecipe(const QString &prefix, const TableInfoHandler &handler)
|
||||||
|
@@ -80,8 +80,7 @@ Tasking::Group lineMarkerRecipe(const Utils::FilePath &filePath, const LineMarke
|
|||||||
using HtmlHandler = std::function<void(const QByteArray &)>;
|
using HtmlHandler = std::function<void(const QByteArray &)>;
|
||||||
Tasking::Group issueHtmlRecipe(const QString &issueId, const HtmlHandler &handler);
|
Tasking::Group issueHtmlRecipe(const QString &issueId, const HtmlHandler &handler);
|
||||||
|
|
||||||
void fetchDashboardInfo(const DashboardInfoHandler &handler);
|
void fetchDashboardAndProjectInfo(const DashboardInfoHandler &handler, const QString &projectName);
|
||||||
void fetchProjectInfo(const QString &projectName);
|
|
||||||
std::optional<Dto::ProjectInfoDto> projectInfo();
|
std::optional<Dto::ProjectInfoDto> projectInfo();
|
||||||
bool handleCertificateIssue();
|
bool handleCertificateIssue();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user