forked from qt-creator/qt-creator
Analyzer: Simplify IAnalyzerTool interface
Change-Id: I11924daf71c0072b9f0ade15a33350a4e56ee781 Reviewed-by: Aurindam Jana <aurindam.jana@digia.com>
This commit is contained in:
@@ -38,16 +38,9 @@ IAnalyzerTool::IAnalyzerTool(QObject *parent)
|
||||
: QObject(parent)
|
||||
{}
|
||||
|
||||
Id IAnalyzerTool::defaultMenuGroup(StartMode mode)
|
||||
Id IAnalyzerTool::actionId(StartMode mode) const
|
||||
{
|
||||
if (mode == StartRemote)
|
||||
return Id(Constants::G_ANALYZER_REMOTE_TOOLS);
|
||||
return Id(Constants::G_ANALYZER_TOOLS);
|
||||
}
|
||||
|
||||
Id IAnalyzerTool::defaultActionId(const IAnalyzerTool *tool, StartMode mode)
|
||||
{
|
||||
Id id = Id("Analyzer").withSuffix(tool->id().toString());
|
||||
Id id = Id("Analyzer").withSuffix(this->id().toString());
|
||||
switch (mode) {
|
||||
case StartLocal:
|
||||
return id.withSuffix(".Local");
|
||||
@@ -60,9 +53,16 @@ Id IAnalyzerTool::defaultActionId(const IAnalyzerTool *tool, StartMode mode)
|
||||
return Id();
|
||||
}
|
||||
|
||||
QString IAnalyzerTool::defaultActionName(const IAnalyzerTool *tool, StartMode mode)
|
||||
Id IAnalyzerTool::menuGroup(StartMode mode) const
|
||||
{
|
||||
QString base = tool->displayName();
|
||||
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;
|
||||
|
@@ -79,14 +79,11 @@ public:
|
||||
/// Returns a user readable description name for this tool.
|
||||
virtual QString description() const = 0;
|
||||
/// Returns an id for the start action.
|
||||
virtual Core::Id actionId(StartMode mode) const
|
||||
{ return defaultActionId(this, mode); }
|
||||
virtual Core::Id actionId(StartMode mode) const;
|
||||
/// Returns the menu group the start action should go to.
|
||||
virtual Core::Id menuGroup(StartMode mode) const
|
||||
{ return defaultMenuGroup(mode); }
|
||||
virtual Core::Id menuGroup(StartMode mode) const;
|
||||
/// Returns a short user readable action name for this tool.
|
||||
virtual QString actionName(StartMode mode) const
|
||||
{ return defaultActionName(this, mode); }
|
||||
virtual QString actionName(StartMode mode) const;
|
||||
|
||||
/**
|
||||
* The mode in which this tool should preferably be run
|
||||
@@ -102,11 +99,6 @@ public:
|
||||
};
|
||||
virtual ToolMode toolMode() const = 0;
|
||||
|
||||
/// Convenience implementation.
|
||||
static Core::Id defaultMenuGroup(StartMode mode);
|
||||
static Core::Id defaultActionId(const IAnalyzerTool *tool, StartMode mode);
|
||||
static QString defaultActionName(const IAnalyzerTool *tool, StartMode mode);
|
||||
|
||||
/// This gets called after all analyzation tools where initialized.
|
||||
virtual void extensionsInitialized() = 0;
|
||||
|
||||
|
Reference in New Issue
Block a user