forked from qt-creator/qt-creator
Analyzer: Separate "integrated" and "external" variants in tool box.
Having the external tool flavors mixed in among the normal ones makes the tool box look cluttered and is bound to confuse users. So we now group the tools, with the mainstream use case coming first. Change-Id: I200b45550d7b1d1f2a565c2e37979fc195f5a12f Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
@@ -180,6 +180,9 @@ public:
|
||||
// list of dock widgets to prevent memory leak
|
||||
typedef QPointer<QDockWidget> DockPtr;
|
||||
QList<DockPtr> m_dockWidgets;
|
||||
|
||||
private:
|
||||
void rebuildToolBox();
|
||||
};
|
||||
|
||||
AnalyzerManagerPrivate::AnalyzerManagerPrivate(AnalyzerManager *qq):
|
||||
@@ -500,12 +503,30 @@ void AnalyzerManagerPrivate::selectAction(AnalyzerAction *action)
|
||||
updateRunActions();
|
||||
}
|
||||
|
||||
void AnalyzerManagerPrivate::rebuildToolBox()
|
||||
{
|
||||
const bool blocked = m_toolBox->blockSignals(true); // Do not make current.
|
||||
QStringList integratedTools;
|
||||
QStringList externalTools;
|
||||
foreach (AnalyzerAction * const action, m_actions) {
|
||||
if (action->menuGroup() == Constants::G_ANALYZER_TOOLS)
|
||||
integratedTools << action->text();
|
||||
else
|
||||
externalTools << action->text();
|
||||
}
|
||||
m_toolBox->clear();
|
||||
m_toolBox->addItems(integratedTools);
|
||||
m_toolBox->addItems(externalTools);
|
||||
if (!integratedTools.isEmpty() && !externalTools.isEmpty())
|
||||
m_toolBox->insertSeparator(integratedTools.count());
|
||||
m_toolBox->blockSignals(blocked);
|
||||
m_toolBox->setEnabled(true);
|
||||
}
|
||||
|
||||
void AnalyzerManagerPrivate::addAction(AnalyzerAction *action)
|
||||
{
|
||||
delayedInit(); // Make sure that there is a valid IMode instance.
|
||||
|
||||
const bool blocked = m_toolBox->blockSignals(true); // Do not make current.
|
||||
|
||||
Id menuGroup = action->menuGroup();
|
||||
if (menuGroup.isValid()) {
|
||||
Command *command = ActionManager::registerAction(action, action->actionId(), Context(C_GLOBAL));
|
||||
@@ -513,16 +534,13 @@ void AnalyzerManagerPrivate::addAction(AnalyzerAction *action)
|
||||
}
|
||||
|
||||
m_actions.append(action);
|
||||
m_toolBox->addItem(action->text());
|
||||
m_toolBox->blockSignals(blocked);
|
||||
rebuildToolBox();
|
||||
|
||||
connect(action, &QAction::triggered, this, [this, action] {
|
||||
AnalyzerManager::showMode();
|
||||
selectAction(action);
|
||||
startTool();
|
||||
});
|
||||
|
||||
m_toolBox->setEnabled(true);
|
||||
}
|
||||
|
||||
void AnalyzerManagerPrivate::handleToolStarted()
|
||||
|
Reference in New Issue
Block a user