forked from qt-creator/qt-creator
Analyzer: Remove some explicit uses of Analyzer::StartMode
Change-Id: I6d28a533d4ee2e93e4b3407e7fdd670c45886708 Reviewed-by: Aurindam Jana <aurindam.jana@digia.com>
This commit is contained in:
@@ -81,6 +81,7 @@ namespace Analyzer {
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
const char LAST_ACTIVE_TOOL[] = "Analyzer.Plugin.LastActiveTool";
|
const char LAST_ACTIVE_TOOL[] = "Analyzer.Plugin.LastActiveTool";
|
||||||
|
const char LAST_ACTIVE_MODE[] = "Analyzer.Plugin.LastActiveMode";
|
||||||
const char INITIAL_DOCK_AREA[] = "initial_dock_area";
|
const char INITIAL_DOCK_AREA[] = "initial_dock_area";
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@@ -470,12 +471,11 @@ void AnalyzerManagerPrivate::selectSavedTool()
|
|||||||
const QSettings *settings = ICore::settings();
|
const QSettings *settings = ICore::settings();
|
||||||
|
|
||||||
if (settings->contains(QLatin1String(LAST_ACTIVE_TOOL))) {
|
if (settings->contains(QLatin1String(LAST_ACTIVE_TOOL))) {
|
||||||
const Id lastActiveAction = Id::fromSetting(settings->value(QLatin1String(LAST_ACTIVE_TOOL)));
|
const Id lastTool = Id::fromSetting(settings->value(QLatin1String(LAST_ACTIVE_TOOL)));
|
||||||
foreach (QAction *action, m_actions) {
|
const StartMode lastMode = StartMode(settings->value(QLatin1String(LAST_ACTIVE_MODE)).toInt());
|
||||||
IAnalyzerTool *tool = m_toolFromAction.value(action);
|
foreach (IAnalyzerTool *tool, m_tools) {
|
||||||
StartMode mode = m_modeFromAction.value(action);
|
if (tool->id() == lastTool) {
|
||||||
if (tool->actionId(mode) == lastActiveAction) {
|
selectTool(tool, lastMode);
|
||||||
selectTool(tool, mode);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -554,9 +554,13 @@ void AnalyzerManagerPrivate::addTool(IAnalyzerTool *tool, const StartModes &mode
|
|||||||
|
|
||||||
const bool blocked = m_toolBox->blockSignals(true); // Do not make current.
|
const bool blocked = m_toolBox->blockSignals(true); // Do not make current.
|
||||||
foreach (StartMode mode, modes) {
|
foreach (StartMode mode, modes) {
|
||||||
QString actionName = tool->actionName(mode);
|
QString actionName = tool->displayName();
|
||||||
Id menuGroup = tool->menuGroup(mode);
|
Id menuGroup = Constants::G_ANALYZER_TOOLS;
|
||||||
Id actionId = tool->actionId(mode);
|
if (mode == StartRemote) {
|
||||||
|
actionName += IAnalyzerTool::tr(" (External)");
|
||||||
|
menuGroup = Constants::G_ANALYZER_REMOTE_TOOLS;
|
||||||
|
}
|
||||||
|
Id actionId = tool->id().withSuffix(mode);
|
||||||
QAction *action = new QAction(actionName, this);
|
QAction *action = new QAction(actionName, this);
|
||||||
Command *command = Core::ActionManager::registerAction(action, actionId, Context(C_GLOBAL));
|
Command *command = Core::ActionManager::registerAction(action, actionId, Context(C_GLOBAL));
|
||||||
m_menu->addAction(command, menuGroup);
|
m_menu->addAction(command, menuGroup);
|
||||||
@@ -610,7 +614,8 @@ void AnalyzerManagerPrivate::saveToolSettings(IAnalyzerTool *tool, StartMode mod
|
|||||||
m_mainWindow->saveSettings(settings);
|
m_mainWindow->saveSettings(settings);
|
||||||
settings->setValue(QLatin1String("ToolSettingsSaved"), true);
|
settings->setValue(QLatin1String("ToolSettingsSaved"), true);
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
settings->setValue(QLatin1String(LAST_ACTIVE_TOOL), tool->actionId(mode).toString());
|
settings->setValue(QLatin1String(LAST_ACTIVE_TOOL), tool->id().toString());
|
||||||
|
settings->setValue(QLatin1String(LAST_ACTIVE_MODE), int(mode));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnalyzerManagerPrivate::updateRunActions()
|
void AnalyzerManagerPrivate::updateRunActions()
|
||||||
|
@@ -60,21 +60,6 @@ IAnalyzerTool::IAnalyzerTool(QObject *parent)
|
|||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
Id IAnalyzerTool::menuGroup(StartMode mode) const
|
|
||||||
{
|
|
||||||
if (mode == StartRemote)
|
|
||||||
return Constants::G_ANALYZER_REMOTE_TOOLS;
|
|
||||||
return Constants::G_ANALYZER_TOOLS;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString IAnalyzerTool::actionName(StartMode mode) const
|
|
||||||
{
|
|
||||||
QString base = displayName();
|
|
||||||
if (mode == StartRemote)
|
|
||||||
return base + tr(" (External)");
|
|
||||||
return base;
|
|
||||||
}
|
|
||||||
|
|
||||||
AbstractAnalyzerSubConfig *IAnalyzerTool::createGlobalSettings()
|
AbstractAnalyzerSubConfig *IAnalyzerTool::createGlobalSettings()
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -78,12 +78,6 @@ public:
|
|||||||
virtual QString displayName() const = 0;
|
virtual QString displayName() const = 0;
|
||||||
/// Returns a user readable description name for this tool.
|
/// Returns a user readable description name for this tool.
|
||||||
virtual QString description() const = 0;
|
virtual QString description() const = 0;
|
||||||
/// Returns an id for the start action.
|
|
||||||
virtual Core::Id actionId(StartMode mode) const = 0;
|
|
||||||
/// Returns the menu group the start action should go to.
|
|
||||||
virtual Core::Id menuGroup(StartMode mode) const;
|
|
||||||
/// Returns a short user readable action name for this tool.
|
|
||||||
virtual QString actionName(StartMode mode) const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The mode in which this tool should preferably be run
|
* The mode in which this tool should preferably be run
|
||||||
|
@@ -213,11 +213,6 @@ QString QmlProfilerTool::description() const
|
|||||||
"applications using QML.");
|
"applications using QML.");
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::Id QmlProfilerTool::actionId(StartMode mode) const
|
|
||||||
{
|
|
||||||
return mode == StartLocal ? "Analyzer.QmlProfiler.Local" : "Analyzer.QmlProfiler.Remote";
|
|
||||||
}
|
|
||||||
|
|
||||||
IAnalyzerTool::ToolMode QmlProfilerTool::toolMode() const
|
IAnalyzerTool::ToolMode QmlProfilerTool::toolMode() const
|
||||||
{
|
{
|
||||||
return AnyMode;
|
return AnyMode;
|
||||||
|
@@ -52,7 +52,6 @@ public:
|
|||||||
ProjectExplorer::RunMode runMode() const;
|
ProjectExplorer::RunMode runMode() const;
|
||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
QString description() const;
|
QString description() const;
|
||||||
Core::Id actionId(Analyzer::StartMode mode) const;
|
|
||||||
ToolMode toolMode() const;
|
ToolMode toolMode() const;
|
||||||
|
|
||||||
void extensionsInitialized() {}
|
void extensionsInitialized() {}
|
||||||
|
@@ -535,11 +535,6 @@ QString CallgrindTool::description() const
|
|||||||
"record function calls when a program runs.");
|
"record function calls when a program runs.");
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::Id CallgrindTool::actionId(StartMode mode) const
|
|
||||||
{
|
|
||||||
return mode == StartLocal ? "Analyzer.Callgrind.Local" : "Analyzer.Callgrind.Remote";
|
|
||||||
}
|
|
||||||
|
|
||||||
IAnalyzerTool::ToolMode CallgrindTool::toolMode() const
|
IAnalyzerTool::ToolMode CallgrindTool::toolMode() const
|
||||||
{
|
{
|
||||||
return ReleaseMode;
|
return ReleaseMode;
|
||||||
|
@@ -49,7 +49,6 @@ public:
|
|||||||
ProjectExplorer::RunMode runMode() const;
|
ProjectExplorer::RunMode runMode() const;
|
||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
QString description() const;
|
QString description() const;
|
||||||
Core::Id actionId(Analyzer::StartMode mode) const;
|
|
||||||
ToolMode toolMode() const;
|
ToolMode toolMode() const;
|
||||||
|
|
||||||
void extensionsInitialized();
|
void extensionsInitialized();
|
||||||
|
@@ -297,11 +297,6 @@ QString MemcheckTool::description() const
|
|||||||
"memory leaks");
|
"memory leaks");
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::Id MemcheckTool::actionId(StartMode mode) const
|
|
||||||
{
|
|
||||||
return mode == StartLocal ? "Analyzer.Memcheck.Local" : "Analyzer.Memcheck.Remote";
|
|
||||||
}
|
|
||||||
|
|
||||||
AbstractAnalyzerSubConfig *MemcheckTool::createGlobalSettings()
|
AbstractAnalyzerSubConfig *MemcheckTool::createGlobalSettings()
|
||||||
{
|
{
|
||||||
return new ValgrindGlobalSettings();
|
return new ValgrindGlobalSettings();
|
||||||
|
@@ -88,7 +88,6 @@ public:
|
|||||||
ProjectExplorer::RunMode runMode() const;
|
ProjectExplorer::RunMode runMode() const;
|
||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
QString description() const;
|
QString description() const;
|
||||||
Core::Id actionId(Analyzer::StartMode mode) const;
|
|
||||||
|
|
||||||
// Create the valgrind settings (for all valgrind tools)
|
// Create the valgrind settings (for all valgrind tools)
|
||||||
Analyzer::AbstractAnalyzerSubConfig *createGlobalSettings();
|
Analyzer::AbstractAnalyzerSubConfig *createGlobalSettings();
|
||||||
|
Reference in New Issue
Block a user