forked from qt-creator/qt-creator
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:
@@ -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()
|
||||
|
||||
@@ -78,8 +78,8 @@ public:
|
||||
static void stopTool();
|
||||
|
||||
// Convenience functions.
|
||||
static void showStatusMessage(const QString &message, int timeoutMS = 10000);
|
||||
static void showPermanentStatusMessage(const QString &message);
|
||||
static void showStatusMessage(Core::Id toolId, const QString &message, int timeoutMS = 10000);
|
||||
static void showPermanentStatusMessage(Core::Id toolId, const QString &message);
|
||||
|
||||
static void handleToolStarted();
|
||||
static void handleToolFinished();
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
|
||||
#include "callgrindengine.h"
|
||||
|
||||
#include "callgrindtool.h"
|
||||
#include "valgrindsettings.h"
|
||||
|
||||
#include <valgrind/callgrind/callgrindcontroller.h>
|
||||
@@ -58,7 +59,7 @@ CallgrindRunControl::CallgrindRunControl(const AnalyzerStartParameters &sp,
|
||||
|
||||
void CallgrindRunControl::showStatusMessage(const QString &msg)
|
||||
{
|
||||
AnalyzerManager::showStatusMessage(msg);
|
||||
AnalyzerManager::showStatusMessage(CallgrindToolId, msg);
|
||||
}
|
||||
|
||||
QStringList CallgrindRunControl::toolArguments() const
|
||||
|
||||
@@ -834,7 +834,7 @@ void CallgrindToolPrivate::engineFinished()
|
||||
if (data)
|
||||
showParserResults(data);
|
||||
else
|
||||
AnalyzerManager::showStatusMessage(tr("Profiling aborted."));
|
||||
AnalyzerManager::showStatusMessage(CallgrindToolId, tr("Profiling aborted."));
|
||||
|
||||
setBusyCursor(false);
|
||||
}
|
||||
@@ -853,7 +853,7 @@ void CallgrindToolPrivate::showParserResults(const ParseData *data)
|
||||
} else {
|
||||
msg = tr("Parsing failed.");
|
||||
}
|
||||
AnalyzerManager::showStatusMessage(msg);
|
||||
AnalyzerManager::showStatusMessage(CallgrindToolId, msg);
|
||||
}
|
||||
|
||||
void CallgrindToolPrivate::editorOpened(IEditor *editor)
|
||||
@@ -918,7 +918,7 @@ void CallgrindToolPrivate::loadExternalLogFile()
|
||||
return;
|
||||
}
|
||||
|
||||
AnalyzerManager::showStatusMessage(tr("Parsing Profile Data..."));
|
||||
AnalyzerManager::showStatusMessage(CallgrindToolId, tr("Parsing Profile Data..."));
|
||||
QCoreApplication::processEvents();
|
||||
|
||||
Parser parser;
|
||||
|
||||
@@ -94,6 +94,7 @@ using namespace Valgrind::XmlProtocol;
|
||||
|
||||
namespace Valgrind {
|
||||
namespace Internal {
|
||||
const Core::Id MemcheckToolId = "Memcheck";
|
||||
|
||||
// ---------------------------- MemcheckErrorFilterProxyModel
|
||||
MemcheckErrorFilterProxyModel::MemcheckErrorFilterProxyModel(QObject *parent)
|
||||
@@ -355,7 +356,7 @@ QWidget *MemcheckTool::createWidgets()
|
||||
m_errorView->setObjectName(QLatin1String("Valgrind.MemcheckTool.ErrorView"));
|
||||
m_errorView->setWindowTitle(tr("Memory Issues"));
|
||||
|
||||
QDockWidget *errorDock = AnalyzerManager::createDockWidget("Memcheck", m_errorView);
|
||||
QDockWidget *errorDock = AnalyzerManager::createDockWidget(MemcheckToolId, m_errorView);
|
||||
errorDock->show();
|
||||
mw->splitDockWidget(mw->toolBarDockWidget(), errorDock, Qt::Vertical);
|
||||
|
||||
@@ -575,7 +576,7 @@ MemcheckRunControl *MemcheckTool::createMemcheckRunControl(const AnalyzerStartPa
|
||||
void MemcheckTool::engineFinished()
|
||||
{
|
||||
const int issuesFound = updateUiAfterFinishedHelper();
|
||||
AnalyzerManager::showStatusMessage(issuesFound > 0
|
||||
AnalyzerManager::showStatusMessage(MemcheckToolId, issuesFound > 0
|
||||
? AnalyzerManager::tr("Memory Analyzer Tool finished, %n issues were found.", 0, issuesFound)
|
||||
: AnalyzerManager::tr("Memory Analyzer Tool finished, no issues were found."));
|
||||
}
|
||||
@@ -583,7 +584,7 @@ void MemcheckTool::engineFinished()
|
||||
void MemcheckTool::loadingExternalXmlLogFileFinished()
|
||||
{
|
||||
const int issuesFound = updateUiAfterFinishedHelper();
|
||||
AnalyzerManager::showStatusMessage(issuesFound > 0
|
||||
AnalyzerManager::showStatusMessage(MemcheckToolId, issuesFound > 0
|
||||
? AnalyzerManager::tr("Log file processed, %n issues were found.", 0, issuesFound)
|
||||
: AnalyzerManager::tr("Log file processed, no issues were found."));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user