Analyzer: Have one status label per tool.

It does not make sense for all the analyzers to share a single status
label, as they are unrelated to each other.

Change-Id: I9cf885263853251f841ef96836860455905677ac
Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
Christian Kandeler
2015-07-01 12:31:27 +02:00
parent 7706a35b4a
commit 19253ded5e
5 changed files with 25 additions and 16 deletions

View File

@@ -173,10 +173,11 @@ public:
ActionContainer *m_menu;
QComboBox *m_toolBox;
QStackedWidget *m_controlsStackWidget;
StatusLabel *m_statusLabel;
QStackedWidget *m_statusLabelsStackWidget;
typedef QMap<Id, FancyMainWindowSettings> MainWindowSettingsMap;
QHash<Id, QList<QDockWidget *> > m_toolWidgets;
QHash<Id, QWidget *> m_controlsWidgetFromTool;
QHash<Id, StatusLabel *> m_statusLabelsPerTool;
MainWindowSettingsMap m_defaultSettings;
// list of dock widgets to prevent memory leak
@@ -198,7 +199,7 @@ AnalyzerManagerPrivate::AnalyzerManagerPrivate(AnalyzerManager *qq):
m_menu(0),
m_toolBox(new QComboBox),
m_controlsStackWidget(new QStackedWidget),
m_statusLabel(new StatusLabel)
m_statusLabelsStackWidget(new QStackedWidget)
{
m_toolBox->setObjectName(QLatin1String("AnalyzerManagerToolBox"));
connect(m_toolBox, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated),
@@ -352,7 +353,7 @@ void AnalyzerManagerPrivate::createModeMainWindow()
analyzeToolBarLayout->addWidget(new StyledSeparator);
analyzeToolBarLayout->addWidget(m_toolBox);
analyzeToolBarLayout->addWidget(m_controlsStackWidget);
analyzeToolBarLayout->addWidget(m_statusLabel);
analyzeToolBarLayout->addWidget(m_statusLabelsStackWidget);
analyzeToolBarLayout->addStretch();
auto dock = new QDockWidget(tr("Analyzer Toolbar"));
@@ -493,6 +494,9 @@ void AnalyzerManagerPrivate::selectAction(AnalyzerAction *action)
QTC_CHECK(!m_controlsWidgetFromTool.contains(toolId));
m_controlsWidgetFromTool[toolId] = widget;
m_controlsStackWidget->addWidget(widget);
StatusLabel * const toolStatusLabel = new StatusLabel;
m_statusLabelsPerTool[toolId] = toolStatusLabel;
m_statusLabelsStackWidget->addWidget(toolStatusLabel);
}
foreach (QDockWidget *widget, m_toolWidgets.value(toolId))
activateDock(Qt::DockWidgetArea(widget->property(INITIAL_DOCK_AREA).toInt()), widget);
@@ -501,6 +505,7 @@ void AnalyzerManagerPrivate::selectAction(AnalyzerAction *action)
QTC_CHECK(m_controlsWidgetFromTool.contains(toolId));
m_controlsStackWidget->setCurrentWidget(m_controlsWidgetFromTool.value(toolId));
m_statusLabelsStackWidget->setCurrentWidget(m_statusLabelsPerTool.value(toolId));
m_toolBox->setCurrentIndex(toolboxIndex);
updateRunActions();
@@ -669,14 +674,16 @@ void AnalyzerManagerPrivate::resetLayout()
m_mainWindow->restoreSettings(m_defaultSettings.value(m_currentAction->toolId()));
}
void AnalyzerManager::showStatusMessage(const QString &message, int timeoutMS)
void AnalyzerManager::showStatusMessage(Id toolId, const QString &message, int timeoutMS)
{
d->m_statusLabel->showStatusMessage(message, timeoutMS);
StatusLabel * const statusLabel = d->m_statusLabelsPerTool.value(toolId);
QTC_ASSERT(statusLabel, return);
statusLabel->showStatusMessage(message, timeoutMS);
}
void AnalyzerManager::showPermanentStatusMessage(const QString &message)
void AnalyzerManager::showPermanentStatusMessage(Id toolId, const QString &message)
{
showStatusMessage(message, -1);
showStatusMessage(toolId, message, -1);
}
void AnalyzerManager::showMode()