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_currentProject.clear();
|
||||
m_issuesModel->clear();
|
||||
fetchProjectInfo(m_dashboardProjects->currentText());
|
||||
fetchDashboardAndProjectInfo({}, m_dashboardProjects->currentText());
|
||||
});
|
||||
// row with issue types (-> depending on choice, tables below change)
|
||||
// and a selectable range (start version, end version)
|
||||
@@ -388,10 +388,8 @@ void IssuesWidget::reinitProjectList(const QString ¤tProject)
|
||||
m_dashboardProjects->addItems(info->projects);
|
||||
if (!currentProject.isEmpty() && info->projects.contains(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)
|
||||
|
@@ -214,8 +214,8 @@ public:
|
||||
AxivionPluginPrivate();
|
||||
void handleSslErrors(QNetworkReply *reply, const QList<QSslError> &errors);
|
||||
void onStartupProjectChanged(Project *project);
|
||||
void fetchDashboardInfo(const DashboardInfoHandler &handler);
|
||||
void fetchProjectInfo(const QString &projectName);
|
||||
void fetchDashboardAndProjectInfo(const DashboardInfoHandler &handler,
|
||||
const QString &projectName);
|
||||
void handleOpenedDocs();
|
||||
void onDocumentOpened(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);
|
||||
dd->fetchDashboardInfo(handler);
|
||||
}
|
||||
|
||||
void fetchProjectInfo(const QString &projectName)
|
||||
{
|
||||
QTC_ASSERT(dd, return);
|
||||
dd->fetchProjectInfo(projectName);
|
||||
dd->fetchDashboardAndProjectInfo(handler, projectName);
|
||||
}
|
||||
|
||||
std::optional<Dto::ProjectInfoDto> projectInfo()
|
||||
@@ -798,7 +792,8 @@ Group dashboardInfoRecipe(const DashboardInfoHandler &handler)
|
||||
{
|
||||
const auto onSetup = [handler] {
|
||||
if (dd->m_dashboardInfo) {
|
||||
handler(*dd->m_dashboardInfo);
|
||||
if (handler)
|
||||
handler(*dd->m_dashboardInfo);
|
||||
return SetupResult::StopWithSuccess;
|
||||
}
|
||||
return SetupResult::Continue;
|
||||
@@ -813,7 +808,7 @@ Group dashboardInfoRecipe(const DashboardInfoHandler &handler)
|
||||
const Group root {
|
||||
onGroupSetup(onSetup), // Stops if cache exists.
|
||||
authorizationRecipe(),
|
||||
onGroupDone(onDone)
|
||||
handler ? onGroupDone(onDone) : nullItem
|
||||
};
|
||||
return root;
|
||||
}
|
||||
@@ -824,11 +819,6 @@ Group projectInfoRecipe(const QString &projectName)
|
||||
dd->clearAllMarks();
|
||||
dd->m_currentProjectInfo = {};
|
||||
dd->m_analysisVersion = {};
|
||||
if (!projectName.isEmpty())
|
||||
return SetupResult::Continue;
|
||||
|
||||
updateDashboard();
|
||||
return SetupResult::StopWithSuccess;
|
||||
};
|
||||
|
||||
const auto onTaskTreeSetup = [projectName](TaskTree &taskTree) {
|
||||
@@ -838,10 +828,19 @@ Group projectInfoRecipe(const QString &projectName)
|
||||
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()) {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -859,7 +858,6 @@ Group projectInfoRecipe(const QString &projectName)
|
||||
|
||||
return {
|
||||
onGroupSetup(onSetup),
|
||||
authorizationRecipe(),
|
||||
TaskTreeTask(onTaskTreeSetup)
|
||||
};
|
||||
}
|
||||
@@ -912,14 +910,10 @@ Group issueHtmlRecipe(const QString &issueId, const HtmlHandler &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));
|
||||
}
|
||||
|
||||
void AxivionPluginPrivate::fetchProjectInfo(const QString &projectName)
|
||||
{
|
||||
m_taskTreeRunner.start(projectInfoRecipe(projectName));
|
||||
m_taskTreeRunner.start({dashboardInfoRecipe(handler), projectInfoRecipe(projectName)});
|
||||
}
|
||||
|
||||
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 &)>;
|
||||
Tasking::Group issueHtmlRecipe(const QString &issueId, const HtmlHandler &handler);
|
||||
|
||||
void fetchDashboardInfo(const DashboardInfoHandler &handler);
|
||||
void fetchProjectInfo(const QString &projectName);
|
||||
void fetchDashboardAndProjectInfo(const DashboardInfoHandler &handler, const QString &projectName);
|
||||
std::optional<Dto::ProjectInfoDto> projectInfo();
|
||||
bool handleCertificateIssue();
|
||||
|
||||
|
Reference in New Issue
Block a user