Commit c722efb0 authored by hjk's avatar hjk

Use Core::Id::withSuffix when appropriate

Change-Id: I919b9b5d8c3e2554cea6d0f5c1db85ed305a8015
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent c15b1d88
......@@ -809,11 +809,11 @@ void ExternalToolManager::setToolsByCategory(const QMap<QString, QList<Internal:
}
qDeleteAll(m_tools);
QMapIterator<QString, QAction *> remainingActions(m_actions);
const QString externalToolsPrefix = QLatin1String("Tools.External.");
const Id externalToolsPrefix = Id("Tools.External.");
while (remainingActions.hasNext()) {
remainingActions.next();
ActionManager::unregisterAction(remainingActions.value(),
Id::fromString(externalToolsPrefix + remainingActions.key()));
externalToolsPrefix.withSuffix(remainingActions.key()));
delete remainingActions.value();
}
m_actions.clear();
......@@ -835,7 +835,7 @@ void ExternalToolManager::setToolsByCategory(const QMap<QString, QList<Internal:
if (m_containers.contains(containerName))
container = m_containers.take(containerName); // remove to avoid deletion below
else
container = ActionManager::createMenu(Id::fromString(QLatin1String("Tools.External.Category.") + containerName));
container = ActionManager::createMenu(Id("Tools.External.Category.").withSuffix(containerName));
newContainers.insert(containerName, container);
mexternaltools->addMenu(container, Constants::G_DEFAULT_ONE);
container->menu()->setTitle(containerName);
......@@ -847,13 +847,13 @@ void ExternalToolManager::setToolsByCategory(const QMap<QString, QList<Internal:
Command *command = 0;
if (m_actions.contains(toolId)) {
action = m_actions.value(toolId);
command = ActionManager::command(Id::fromString(externalToolsPrefix + toolId));
command = ActionManager::command(externalToolsPrefix.withSuffix(toolId));
} else {
action = new QAction(tool->displayName(), this);
action->setData(toolId);
m_actions.insert(toolId, action);
connect(action, SIGNAL(triggered()), this, SLOT(menuActivated()));
command = ActionManager::registerAction(action, Id::fromString(externalToolsPrefix + toolId), Context(Constants::C_GLOBAL));
command = ActionManager::registerAction(action, externalToolsPrefix.withSuffix(toolId), Context(Constants::C_GLOBAL));
command->setAttribute(Command::CA_UpdateText);
}
action->setText(tool->displayName());
......
......@@ -246,6 +246,7 @@ void OutputPaneManager::init()
const int n = m_panes.size();
int shortcutNumber = 1;
const Id baseId = Id("QtCreator.Pane.");
for (int i = 0; i != n; ++i) {
IOutputPane *outPane = m_panes.at(i);
const int idx = m_outputWidgetPane->addWidget(outPane->outputWidget(this));
......@@ -271,9 +272,9 @@ void OutputPaneManager::init()
minTitleWidth = qMax(minTitleWidth, titleFm.width(outPane->displayName()));
QString actionId = QLatin1String("QtCreator.Pane.") + outPane->displayName().simplified();
actionId.remove(QLatin1Char(' '));
Id id = Id::fromString(actionId);
QString suffix = outPane->displayName().simplified();
suffix.remove(QLatin1Char(' '));
const Id id = baseId.withSuffix(suffix);
QAction *action = new QAction(outPane->displayName(), this);
Command *cmd = ActionManager::registerAction(action, id, globalContext);
......
......@@ -227,6 +227,7 @@ void FindPlugin::setupFilterMenuItems()
Core::ActionContainer *mfindadvanced = Core::ActionManager::actionContainer(Constants::M_FIND_ADVANCED);
d->m_filterActions.clear();
bool haveEnabledFilters = false;
const Core::Id base("FindFilter.");
foreach (IFindFilter *filter, findInterfaces) {
QAction *action = new QAction(QLatin1String(" ") + filter->displayName(), this);
bool isEnabled = filter->isEnabled();
......@@ -235,7 +236,7 @@ void FindPlugin::setupFilterMenuItems()
action->setEnabled(isEnabled);
action->setData(qVariantFromValue(filter));
cmd = Core::ActionManager::registerAction(action,
Core::Id::fromString(QLatin1String("FindFilter.")+filter->id()), globalcontext);
base.withSuffix(filter->id()), globalcontext);
cmd->setDefaultKeySequence(filter->defaultShortcut());
mfindadvanced->addAction(cmd);
d->m_filterActions.insert(filter, action);
......
......@@ -157,7 +157,7 @@ void MacroManager::MacroManagerPrivate::initialize()
static Core::Id makeId(const QString &name)
{
return Core::Id::fromString(QLatin1String(Constants::PREFIX_MACRO) + name);
return Core::Id(Constants::PREFIX_MACRO).withSuffix(name);
}
void MacroManager::MacroManagerPrivate::addMacro(Macro *macro)
......
......@@ -99,6 +99,7 @@ void MacroOptionsWidget::initialize()
void MacroOptionsWidget::createTable()
{
QDir dir(MacroManager::instance()->macrosDirectory());
const Core::Id base = Core::Id(Constants::PREFIX_MACRO);
QMapIterator<QString, Macro *> it(MacroManager::instance()->macros());
while (it.hasNext()) {
it.next();
......@@ -111,8 +112,7 @@ void MacroOptionsWidget::createTable()
macroItem->setData(0, WRITE_ROLE, it.value()->isWritable());
Core::Command *command =
Core::ActionManager::command(Core::Id::fromString(QLatin1String(Constants::PREFIX_MACRO)
+ it.value()->displayName()));
Core::ActionManager::command(base.withSuffix(it.value()->displayName()));
if (command && command->shortcut())
macroItem->setText(2, command->shortcut()->key().toString());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment