forked from qt-creator/qt-creator
Axivion: Allow None item for dashboard
This allows to explicitly disable the accesses of possibly configured dashboards. The old approach with the hard linking is gone and if the user now accesses the Axivion perspective intentional or not the session is tied to the dashboard until this is changed to a different one. That also means accessing any file inside the session may try to request information about the file from the current dashboard server. Make it possible to undo the loose linking by introducing a None item which in turn disables accessing the dashboard. Change-Id: I04a960baad102663c4d97e652d44c86a04563416 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -244,8 +244,15 @@ IssuesWidget::IssuesWidget(QWidget *parent)
|
|||||||
if (data.isValid()) {
|
if (data.isValid()) {
|
||||||
const AxivionServer server = data.value<AxivionServer>();
|
const AxivionServer server = data.value<AxivionServer>();
|
||||||
switchActiveDashboardId(server.id);
|
switchActiveDashboardId(server.id);
|
||||||
}
|
|
||||||
reinitProjectList(m_dashboardProjects->currentText());
|
reinitProjectList(m_dashboardProjects->currentText());
|
||||||
|
} else {
|
||||||
|
switchActiveDashboardId({});
|
||||||
|
{
|
||||||
|
GuardLocker lock(m_signalBlocker);
|
||||||
|
m_dashboardProjects->clear();
|
||||||
|
}
|
||||||
|
updateBasicProjectInfo(std::nullopt);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
m_dashboardProjects = new QComboBox(this);
|
m_dashboardProjects = new QComboBox(this);
|
||||||
@@ -411,28 +418,34 @@ void IssuesWidget::initDashboardList(const QString &preferredProject)
|
|||||||
: preferredProject;
|
: preferredProject;
|
||||||
resetDashboard();
|
resetDashboard();
|
||||||
m_dashboardListUninitialized = false;
|
m_dashboardListUninitialized = false;
|
||||||
GuardLocker lock(m_signalBlocker);
|
|
||||||
const QList<AxivionServer> servers = settings().allAvailableServers();
|
const QList<AxivionServer> servers = settings().allAvailableServers();
|
||||||
if (servers.isEmpty()) {
|
if (servers.isEmpty()) {
|
||||||
switchActiveDashboardId({});
|
switchActiveDashboardId({});
|
||||||
|
{
|
||||||
|
GuardLocker lock(m_signalBlocker);
|
||||||
|
m_dashboardProjects->clear();
|
||||||
|
}
|
||||||
|
updateBasicProjectInfo(std::nullopt);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GuardLocker lock(m_signalBlocker);
|
||||||
|
m_dashboards->addItem(Tr::tr("None"));
|
||||||
for (const AxivionServer &server : servers)
|
for (const AxivionServer &server : servers)
|
||||||
m_dashboards->addItem(server.displayString(), QVariant::fromValue(server));
|
m_dashboards->addItem(server.displayString(), QVariant::fromValue(server));
|
||||||
|
|
||||||
Id activeId = activeDashboardId();
|
Id activeId = activeDashboardId();
|
||||||
if (!activeId.isValid())
|
|
||||||
activeId = settings().defaultDashboardId();
|
|
||||||
if (activeId.isValid()) {
|
if (activeId.isValid()) {
|
||||||
int index = Utils::indexOf(servers, Utils::equal(&AxivionServer::id, activeId));
|
int index = Utils::indexOf(servers, Utils::equal(&AxivionServer::id, activeId));
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
activeId = settings().defaultDashboardId();
|
activeId = settings().defaultDashboardId();
|
||||||
index = Utils::indexOf(servers, Utils::equal(&AxivionServer::id, activeId));
|
index = Utils::indexOf(servers, Utils::equal(&AxivionServer::id, activeId));
|
||||||
}
|
}
|
||||||
m_dashboards->setCurrentIndex(index);
|
m_dashboards->setCurrentIndex(index + 1);
|
||||||
}
|
|
||||||
switchActiveDashboardId(activeId);
|
|
||||||
reinitProjectList(currentProject);
|
reinitProjectList(currentProject);
|
||||||
|
} else {
|
||||||
|
m_dashboards->setCurrentIndex(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IssuesWidget::reinitProjectList(const QString ¤tProject)
|
void IssuesWidget::reinitProjectList(const QString ¤tProject)
|
||||||
|
@@ -1026,13 +1026,9 @@ void AxivionPluginPrivate::onSessionLoaded(const QString &sessionName)
|
|||||||
|
|
||||||
const QString projectName = SessionManager::sessionValue(SV_PROJECTNAME).toString();
|
const QString projectName = SessionManager::sessionValue(SV_PROJECTNAME).toString();
|
||||||
const Id dashboardId = Id::fromSetting(SessionManager::sessionValue(SV_DASHBOARDID));
|
const Id dashboardId = Id::fromSetting(SessionManager::sessionValue(SV_DASHBOARDID));
|
||||||
if (!dashboardId.isValid()) {
|
if (!dashboardId.isValid())
|
||||||
switchActiveDashboardId({});
|
switchActiveDashboardId({});
|
||||||
resetDashboard();
|
else if (activeDashboardId() != dashboardId)
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (activeDashboardId() != dashboardId)
|
|
||||||
switchActiveDashboardId(dashboardId);
|
switchActiveDashboardId(dashboardId);
|
||||||
reinitDashboard(projectName);
|
reinitDashboard(projectName);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user