diff --git a/src/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp b/src/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp index 22d66ae6f77..93a18a1d3ff 100644 --- a/src/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp +++ b/src/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp @@ -291,7 +291,7 @@ void ClangStaticAnalyzerTool::handleStateUpdate() message += tr("%n issues found (%1 suppressed).", 0, issuesFound) .arg(issuesFound - issuesVisible); } - AnalyzerManager::showPermanentStatusMessage(ClangStaticAnalyzerPerspectiveId, message); + AnalyzerManager::showPermanentStatusMessage(message); } } // namespace Internal diff --git a/src/plugins/debugger/analyzer/analyzermanager.cpp b/src/plugins/debugger/analyzer/analyzermanager.cpp index afa5860c8aa..78db052eb3f 100644 --- a/src/plugins/debugger/analyzer/analyzermanager.cpp +++ b/src/plugins/debugger/analyzer/analyzermanager.cpp @@ -115,7 +115,7 @@ void ActionDescription::startTool() const AnalyzerManager::showMode(); TaskHub::clearTasks(Constants::ANALYZERTASK_ID); - AnalyzerManager::showPermanentStatusMessage(perspectiveId(), QString()); + AnalyzerManager::showPermanentStatusMessage(QString()); if (m_toolPreparer && !m_toolPreparer()) return; @@ -438,7 +438,7 @@ void AnalyzerManagerPrivate::createModeMainWindow() analyzeToolBarLayout->addWidget(new StyledSeparator); analyzeToolBarLayout->addWidget(m_mainWindow->toolBox()); analyzeToolBarLayout->addWidget(m_mainWindow->controlsStack()); - analyzeToolBarLayout->addWidget(m_mainWindow->statusLabelsStack()); + analyzeToolBarLayout->addWidget(m_mainWindow->statusLabel()); analyzeToolBarLayout->addStretch(); auto dock = new QDockWidget(tr("Analyzer Toolbar")); @@ -680,14 +680,14 @@ void AnalyzerManager::enableMainWindow(bool on) d->m_mainWindow->setEnabled(on); } -void AnalyzerManager::showStatusMessage(Id perspective, const QString &message, int timeoutMS) +void AnalyzerManager::showStatusMessage(const QString &message, int timeoutMS) { - d->m_mainWindow->showStatusMessage(perspective, message, timeoutMS); + d->m_mainWindow->showStatusMessage(message, timeoutMS); } -void AnalyzerManager::showPermanentStatusMessage(Id perspective, const QString &message) +void AnalyzerManager::showPermanentStatusMessage(const QString &message) { - d->m_mainWindow->showStatusMessage(perspective, message, -1); + d->m_mainWindow->showStatusMessage(message, -1); } void AnalyzerManager::showMode() diff --git a/src/plugins/debugger/analyzer/analyzermanager.h b/src/plugins/debugger/analyzer/analyzermanager.h index 90dfc483ead..d4bfd35ab53 100644 --- a/src/plugins/debugger/analyzer/analyzermanager.h +++ b/src/plugins/debugger/analyzer/analyzermanager.h @@ -152,8 +152,8 @@ public: static void stopTool(); // Convenience functions. - static void showStatusMessage(Core::Id perspective, const QString &message, int timeoutMS = 10000); - static void showPermanentStatusMessage(Core::Id perspective, const QString &message); + static void showStatusMessage(const QString &message, int timeoutMS = 10000); + static void showPermanentStatusMessage(const QString &message); static void handleToolStarted(); static void handleToolFinished(); diff --git a/src/plugins/debugger/debuggermainwindow.cpp b/src/plugins/debugger/debuggermainwindow.cpp index 26f1b96dd97..7773921122a 100644 --- a/src/plugins/debugger/debuggermainwindow.cpp +++ b/src/plugins/debugger/debuggermainwindow.cpp @@ -43,7 +43,7 @@ namespace Internal { MainWindowBase::MainWindowBase() { m_controlsStackWidget = new QStackedWidget; - m_statusLabelsStackWidget = new QStackedWidget; + m_statusLabel = new Utils::StatusLabel; m_toolBox = new QComboBox; setDockNestingEnabled(true); @@ -72,18 +72,12 @@ void MainWindowBase::registerPerspective(Id perspectiveId, const Perspective &pe void MainWindowBase::registerToolbar(Id perspectiveId, QWidget *widget) { m_toolbarForPerspectiveId.insert(perspectiveId, widget); - m_controlsStackWidget->addWidget(widget); - StatusLabel * const toolStatusLabel = new StatusLabel; - m_statusLabelForPerspectiveId[perspectiveId] = toolStatusLabel; - m_statusLabelsStackWidget->addWidget(toolStatusLabel); } -void MainWindowBase::showStatusMessage(Id perspective, const QString &message, int timeoutMS) +void MainWindowBase::showStatusMessage(const QString &message, int timeoutMS) { - StatusLabel *statusLabel = m_statusLabelForPerspectiveId.value(perspective); - QTC_ASSERT(statusLabel, return); - statusLabel->showStatusMessage(message, timeoutMS); + m_statusLabel->showStatusMessage(message, timeoutMS); } void MainWindowBase::resetCurrentPerspective() @@ -143,7 +137,6 @@ void MainWindowBase::loadPerspectiveHelper(Id perspectiveId, bool fromStoredSett QTC_CHECK(m_toolbarForPerspectiveId.contains(perspectiveId)); m_controlsStackWidget->setCurrentWidget(m_toolbarForPerspectiveId.value(perspectiveId)); - m_statusLabelsStackWidget->setCurrentWidget(m_statusLabelForPerspectiveId.value(perspectiveId)); } void MainWindowBase::closeCurrentPerspective() diff --git a/src/plugins/debugger/debuggermainwindow.h b/src/plugins/debugger/debuggermainwindow.h index 1800f693c2e..0791e0600c0 100644 --- a/src/plugins/debugger/debuggermainwindow.h +++ b/src/plugins/debugger/debuggermainwindow.h @@ -109,7 +109,7 @@ public: QComboBox *toolBox() const { return m_toolBox; } QStackedWidget *controlsStack() const { return m_controlsStackWidget; } - QStackedWidget *statusLabelsStack() const { return m_statusLabelsStackWidget; } + Utils::StatusLabel *statusLabel() const { return m_statusLabel; } void registerPerspective(Core::Id perspectiveId, const Analyzer::Perspective &perspective); void registerToolbar(Core::Id perspectiveId, QWidget *widget); @@ -120,7 +120,7 @@ public: void resetCurrentPerspective(); void restorePerspective(Core::Id perspectiveId); - void showStatusMessage(Core::Id perspective, const QString &message, int timeoutMS); + void showStatusMessage(const QString &message, int timeoutMS); QString lastSettingsName() const; void setLastSettingsName(const QString &lastSettingsName); @@ -134,11 +134,10 @@ private: QString m_lastSettingsName; QComboBox *m_toolBox; QStackedWidget *m_controlsStackWidget; - QStackedWidget *m_statusLabelsStackWidget; + Utils::StatusLabel *m_statusLabel; QHash m_dockForDockId; QHash m_toolbarForPerspectiveId; QHash m_perspectiveForPerspectiveId; - QHash m_statusLabelForPerspectiveId; // list of dock widgets to prevent memory leak typedef QPointer DockPtr; diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 53b067a9d30..78d24374b1d 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -2212,7 +2212,7 @@ void DebuggerPluginPrivate::showStatusMessage(const QString &msg0, int timeout) showMessage(msg0, LogStatus); QString msg = msg0; msg.replace(QChar::LineFeed, QLatin1String("; ")); - m_mainWindow->showStatusMessage(m_mainWindow->currentPerspectiveId(), msg, timeout); + m_mainWindow->showStatusMessage(msg, timeout); } void DebuggerPluginPrivate::coreShutdown() @@ -3442,7 +3442,7 @@ QWidget *DebuggerPluginPrivate::createContents(IMode *mode) debugToolBarLayout->setSpacing(0); // debugToolBarLayout->addWidget(m_mainWindow->toolBox()); debugToolBarLayout->addWidget(m_mainWindow->controlsStack()); - debugToolBarLayout->addWidget(m_mainWindow->statusLabelsStack()); + debugToolBarLayout->addWidget(m_mainWindow->statusLabel()); debugToolBarLayout->addWidget(new Utils::StyledSeparator); debugToolBarLayout->addStretch(); debugToolBarLayout->addWidget(viewButton); diff --git a/src/plugins/valgrind/callgrindengine.cpp b/src/plugins/valgrind/callgrindengine.cpp index d1f450fe9f6..b3a9a183c0b 100644 --- a/src/plugins/valgrind/callgrindengine.cpp +++ b/src/plugins/valgrind/callgrindengine.cpp @@ -48,12 +48,7 @@ CallgrindRunControl::CallgrindRunControl(ProjectExplorer::RunConfiguration *runC connect(m_runner.parser(), &Callgrind::Parser::parserDataReady, this, &CallgrindRunControl::slotFinished); connect(&m_runner, &Callgrind::CallgrindRunner::statusMessage, - this, &CallgrindRunControl::showStatusMessage); -} - -void CallgrindRunControl::showStatusMessage(const QString &msg) -{ - AnalyzerManager::showPermanentStatusMessage(CallgrindPerspectiveId, msg); + this, &AnalyzerManager::showPermanentStatusMessage); } QStringList CallgrindRunControl::toolArguments() const diff --git a/src/plugins/valgrind/callgrindengine.h b/src/plugins/valgrind/callgrindengine.h index 706774335db..87da36fd146 100644 --- a/src/plugins/valgrind/callgrindengine.h +++ b/src/plugins/valgrind/callgrindengine.h @@ -68,11 +68,9 @@ protected: signals: void parserDataReady(CallgrindRunControl *engine); -private slots: - void slotFinished(); - void showStatusMessage(const QString &msg); - private: + void slotFinished(); + Valgrind::Callgrind::CallgrindRunner m_runner; bool m_markAsPaused; diff --git a/src/plugins/valgrind/callgrindtool.cpp b/src/plugins/valgrind/callgrindtool.cpp index 26065fee713..fb416135ed4 100644 --- a/src/plugins/valgrind/callgrindtool.cpp +++ b/src/plugins/valgrind/callgrindtool.cpp @@ -822,7 +822,7 @@ void CallgrindTool::engineFinished() if (data) showParserResults(data); else - AnalyzerManager::showPermanentStatusMessage(CallgrindPerspectiveId, tr("Profiling aborted.")); + AnalyzerManager::showPermanentStatusMessage(tr("Profiling aborted.")); setBusyCursor(false); } @@ -841,7 +841,7 @@ void CallgrindTool::showParserResults(const ParseData *data) } else { msg = tr("Parsing failed."); } - AnalyzerManager::showPermanentStatusMessage(CallgrindPerspectiveId, msg); + AnalyzerManager::showPermanentStatusMessage(msg); } void CallgrindTool::editorOpened(IEditor *editor) @@ -906,7 +906,7 @@ void CallgrindTool::loadExternalLogFile() return; } - AnalyzerManager::showPermanentStatusMessage(CallgrindPerspectiveId, tr("Parsing Profile Data...")); + AnalyzerManager::showPermanentStatusMessage(tr("Parsing Profile Data...")); QCoreApplication::processEvents(); Parser parser; diff --git a/src/plugins/valgrind/memchecktool.cpp b/src/plugins/valgrind/memchecktool.cpp index 7ac4de1ffa2..ab5a2897cdd 100644 --- a/src/plugins/valgrind/memchecktool.cpp +++ b/src/plugins/valgrind/memchecktool.cpp @@ -674,7 +674,7 @@ int MemcheckTool::updateUiAfterFinishedHelper() void MemcheckTool::engineFinished() { const int issuesFound = updateUiAfterFinishedHelper(); - AnalyzerManager::showPermanentStatusMessage(MemcheckPerspectiveId, issuesFound > 0 + AnalyzerManager::showPermanentStatusMessage(issuesFound > 0 ? AnalyzerManager::tr("Memory Analyzer Tool finished, %n issues were found.", 0, issuesFound) : AnalyzerManager::tr("Memory Analyzer Tool finished, no issues were found.")); } @@ -682,7 +682,7 @@ void MemcheckTool::engineFinished() void MemcheckTool::loadingExternalXmlLogFileFinished() { const int issuesFound = updateUiAfterFinishedHelper(); - AnalyzerManager::showPermanentStatusMessage(MemcheckPerspectiveId, issuesFound > 0 + AnalyzerManager::showPermanentStatusMessage(issuesFound > 0 ? AnalyzerManager::tr("Log file processed, %n issues were found.", 0, issuesFound) : AnalyzerManager::tr("Log file processed, no issues were found.")); }