forked from qt-creator/qt-creator
Use Id::fromString instead of the constructor.
Change-Id: Ie18714ac2872a085e8c20d445472901cc9f6b6c5 Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
This commit is contained in:
@@ -836,7 +836,7 @@ void SplitterOrView::restoreState(const QByteArray &state)
|
|||||||
stream >> fileName >> id >> editorState;
|
stream >> fileName >> id >> editorState;
|
||||||
if (!QFile::exists(fileName))
|
if (!QFile::exists(fileName))
|
||||||
return;
|
return;
|
||||||
IEditor *e = em->openEditor(view(), fileName, Id(id), Core::EditorManager::IgnoreNavigationHistory
|
IEditor *e = em->openEditor(view(), fileName, Id::fromString(id), Core::EditorManager::IgnoreNavigationHistory
|
||||||
| Core::EditorManager::NoActivate);
|
| Core::EditorManager::NoActivate);
|
||||||
|
|
||||||
if (!e) {
|
if (!e) {
|
||||||
|
@@ -814,7 +814,8 @@ void ExternalToolManager::setToolsByCategory(const QMap<QString, QList<Internal:
|
|||||||
const QString externalToolsPrefix = QLatin1String("Tools.External.");
|
const QString externalToolsPrefix = QLatin1String("Tools.External.");
|
||||||
while (remainingActions.hasNext()) {
|
while (remainingActions.hasNext()) {
|
||||||
remainingActions.next();
|
remainingActions.next();
|
||||||
ActionManager::unregisterAction(remainingActions.value(), Id(externalToolsPrefix + remainingActions.key()));
|
ActionManager::unregisterAction(remainingActions.value(),
|
||||||
|
Id::fromString(externalToolsPrefix + remainingActions.key()));
|
||||||
delete remainingActions.value();
|
delete remainingActions.value();
|
||||||
}
|
}
|
||||||
m_actions.clear();
|
m_actions.clear();
|
||||||
@@ -836,7 +837,7 @@ void ExternalToolManager::setToolsByCategory(const QMap<QString, QList<Internal:
|
|||||||
if (m_containers.contains(containerName))
|
if (m_containers.contains(containerName))
|
||||||
container = m_containers.take(containerName); // remove to avoid deletion below
|
container = m_containers.take(containerName); // remove to avoid deletion below
|
||||||
else
|
else
|
||||||
container = ActionManager::createMenu(Id(QLatin1String("Tools.External.Category.") + containerName));
|
container = ActionManager::createMenu(Id::fromString(QLatin1String("Tools.External.Category.") + containerName));
|
||||||
newContainers.insert(containerName, container);
|
newContainers.insert(containerName, container);
|
||||||
mexternaltools->addMenu(container, Constants::G_DEFAULT_ONE);
|
mexternaltools->addMenu(container, Constants::G_DEFAULT_ONE);
|
||||||
container->menu()->setTitle(containerName);
|
container->menu()->setTitle(containerName);
|
||||||
@@ -848,13 +849,13 @@ void ExternalToolManager::setToolsByCategory(const QMap<QString, QList<Internal:
|
|||||||
Command *command = 0;
|
Command *command = 0;
|
||||||
if (m_actions.contains(toolId)) {
|
if (m_actions.contains(toolId)) {
|
||||||
action = m_actions.value(toolId);
|
action = m_actions.value(toolId);
|
||||||
command = ActionManager::command(Id(externalToolsPrefix + toolId));
|
command = ActionManager::command(Id::fromString(externalToolsPrefix + toolId));
|
||||||
} else {
|
} else {
|
||||||
action = new QAction(tool->displayName(), this);
|
action = new QAction(tool->displayName(), this);
|
||||||
action->setData(toolId);
|
action->setData(toolId);
|
||||||
m_actions.insert(toolId, action);
|
m_actions.insert(toolId, action);
|
||||||
connect(action, SIGNAL(triggered()), this, SLOT(menuActivated()));
|
connect(action, SIGNAL(triggered()), this, SLOT(menuActivated()));
|
||||||
command = ActionManager::registerAction(action, Id(externalToolsPrefix + toolId), Context(Constants::C_GLOBAL));
|
command = ActionManager::registerAction(action, Id::fromString(externalToolsPrefix + toolId), Context(Constants::C_GLOBAL));
|
||||||
command->setAttribute(Command::CA_UpdateText);
|
command->setAttribute(Command::CA_UpdateText);
|
||||||
}
|
}
|
||||||
action->setText(tool->displayName());
|
action->setText(tool->displayName());
|
||||||
|
@@ -174,7 +174,7 @@ void NavigationSubWidget::restoreSettings()
|
|||||||
Core::Command *NavigationSubWidget::command(const QString &title) const
|
Core::Command *NavigationSubWidget::command(const QString &title) const
|
||||||
{
|
{
|
||||||
const QHash<Id, Command *> commandMap = m_parentWidget->commandMap();
|
const QHash<Id, Command *> commandMap = m_parentWidget->commandMap();
|
||||||
QHash<Id, Command *>::const_iterator r = commandMap.find(Id(title));
|
QHash<Id, Command *>::const_iterator r = commandMap.find(Id::fromString(title));
|
||||||
if (r != commandMap.end())
|
if (r != commandMap.end())
|
||||||
return r.value();
|
return r.value();
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -339,7 +339,7 @@ void NavigationWidget::restoreSettings(QSettings *settings)
|
|||||||
|
|
||||||
int position = 0;
|
int position = 0;
|
||||||
foreach (const QString &id, viewIds) {
|
foreach (const QString &id, viewIds) {
|
||||||
int index = factoryIndex(Id(id));
|
int index = factoryIndex(Id::fromString(id));
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
// Only add if the id was actually found!
|
// Only add if the id was actually found!
|
||||||
insertSubItem(position, index);
|
insertSubItem(position, index);
|
||||||
|
@@ -275,7 +275,7 @@ void OutputPaneManager::init()
|
|||||||
|
|
||||||
QString actionId = QLatin1String("QtCreator.Pane.") + outPane->displayName().simplified();
|
QString actionId = QLatin1String("QtCreator.Pane.") + outPane->displayName().simplified();
|
||||||
actionId.remove(QLatin1Char(' '));
|
actionId.remove(QLatin1Char(' '));
|
||||||
Id id(actionId);
|
Id id = Id::fromString(actionId);
|
||||||
QAction *action = new QAction(outPane->displayName(), this);
|
QAction *action = new QAction(outPane->displayName(), this);
|
||||||
Command *cmd = ActionManager::registerAction(action, id, globalContext);
|
Command *cmd = ActionManager::registerAction(action, id, globalContext);
|
||||||
|
|
||||||
|
@@ -169,7 +169,7 @@ bool Protocol::showConfigurationError(const Protocol *p,
|
|||||||
bool rc = false;
|
bool rc = false;
|
||||||
if (mb.clickedButton() == settingsButton)
|
if (mb.clickedButton() == settingsButton)
|
||||||
rc = Core::ICore::showOptionsDialog(Core::Id(p->settingsPage()->category()),
|
rc = Core::ICore::showOptionsDialog(Core::Id(p->settingsPage()->category()),
|
||||||
Core::Id(p->settingsPage()->id()),
|
Core::Id::fromString(p->settingsPage()->id()),
|
||||||
parent);
|
parent);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@@ -234,7 +234,8 @@ void FindPlugin::setupFilterMenuItems()
|
|||||||
haveEnabledFilters = true;
|
haveEnabledFilters = true;
|
||||||
action->setEnabled(isEnabled);
|
action->setEnabled(isEnabled);
|
||||||
action->setData(qVariantFromValue(filter));
|
action->setData(qVariantFromValue(filter));
|
||||||
cmd = Core::ActionManager::registerAction(action, Core::Id(QLatin1String("FindFilter.")+filter->id()), globalcontext);
|
cmd = Core::ActionManager::registerAction(action,
|
||||||
|
Core::Id::fromString(QLatin1String("FindFilter.")+filter->id()), globalcontext);
|
||||||
cmd->setDefaultKeySequence(filter->defaultShortcut());
|
cmd->setDefaultKeySequence(filter->defaultShortcut());
|
||||||
mfindadvanced->addAction(cmd);
|
mfindadvanced->addAction(cmd);
|
||||||
d->m_filterActions.insert(filter, action);
|
d->m_filterActions.insert(filter, action);
|
||||||
|
@@ -323,7 +323,7 @@ void LocatorWidget::updateFilterList()
|
|||||||
foreach (ILocatorFilter *filter, m_locatorPlugin->filters()) {
|
foreach (ILocatorFilter *filter, m_locatorPlugin->filters()) {
|
||||||
if (filter->shortcutString().isEmpty() || filter->isHidden())
|
if (filter->shortcutString().isEmpty() || filter->isHidden())
|
||||||
continue;
|
continue;
|
||||||
Core::Id locatorId = Core::Id(QLatin1String("Locator.") + filter->id());
|
Core::Id locatorId = Core::Id::fromString(QLatin1String("Locator.") + filter->id());
|
||||||
QAction *action = 0;
|
QAction *action = 0;
|
||||||
Core::Command *cmd = 0;
|
Core::Command *cmd = 0;
|
||||||
if (!actionCopy.contains(filter->id())) {
|
if (!actionCopy.contains(filter->id())) {
|
||||||
@@ -345,7 +345,8 @@ void LocatorWidget::updateFilterList()
|
|||||||
|
|
||||||
// unregister actions that are deleted now
|
// unregister actions that are deleted now
|
||||||
foreach (const QString &id, actionCopy.keys()) {
|
foreach (const QString &id, actionCopy.keys()) {
|
||||||
Core::ActionManager::unregisterAction(actionCopy.value(id), Core::Id(QLatin1String("Locator.") + id));
|
Core::ActionManager::unregisterAction(actionCopy.value(id),
|
||||||
|
Core::Id::fromString(QLatin1String("Locator.") + id));
|
||||||
}
|
}
|
||||||
qDeleteAll(actionCopy);
|
qDeleteAll(actionCopy);
|
||||||
|
|
||||||
|
@@ -155,14 +155,18 @@ void MacroManager::MacroManagerPrivate::initialize()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Core::Id makeId(const QString &name)
|
||||||
|
{
|
||||||
|
return Core::Id::fromString(QLatin1String(Constants::PREFIX_MACRO) + name);
|
||||||
|
}
|
||||||
|
|
||||||
void MacroManager::MacroManagerPrivate::addMacro(Macro *macro)
|
void MacroManager::MacroManagerPrivate::addMacro(Macro *macro)
|
||||||
{
|
{
|
||||||
// Add sortcut
|
// Add sortcut
|
||||||
Core::Context context(TextEditor::Constants::C_TEXTEDITOR);
|
Core::Context context(TextEditor::Constants::C_TEXTEDITOR);
|
||||||
QShortcut *shortcut = new QShortcut(Core::ICore::mainWindow());
|
QShortcut *shortcut = new QShortcut(Core::ICore::mainWindow());
|
||||||
shortcut->setWhatsThis(macro->description());
|
shortcut->setWhatsThis(macro->description());
|
||||||
const Core::Id macroId(QLatin1String(Constants::PREFIX_MACRO) + macro->displayName());
|
Core::ActionManager::registerShortcut(shortcut, makeId(macro->displayName()), context);
|
||||||
Core::ActionManager::registerShortcut(shortcut, macroId, context);
|
|
||||||
connect(shortcut, SIGNAL(activated()), mapper, SLOT(map()));
|
connect(shortcut, SIGNAL(activated()), mapper, SLOT(map()));
|
||||||
mapper->setMapping(shortcut, macro->displayName());
|
mapper->setMapping(shortcut, macro->displayName());
|
||||||
|
|
||||||
@@ -175,7 +179,7 @@ void MacroManager::MacroManagerPrivate::removeMacro(const QString &name)
|
|||||||
if (!macros.contains(name))
|
if (!macros.contains(name))
|
||||||
return;
|
return;
|
||||||
// Remove shortcut
|
// Remove shortcut
|
||||||
Core::ActionManager::unregisterShortcut(Core::Id(QLatin1String(Constants::PREFIX_MACRO) + name));
|
Core::ActionManager::unregisterShortcut(makeId(name));
|
||||||
|
|
||||||
// Remove macro from the map
|
// Remove macro from the map
|
||||||
Macro *macro = macros.take(name);
|
Macro *macro = macros.take(name);
|
||||||
@@ -190,8 +194,7 @@ void MacroManager::MacroManagerPrivate::changeMacroDescription(Macro *macro, con
|
|||||||
macro->save(macro->fileName(), Core::ICore::mainWindow());
|
macro->save(macro->fileName(), Core::ICore::mainWindow());
|
||||||
|
|
||||||
// Change shortcut what's this
|
// Change shortcut what's this
|
||||||
Core::Command *command = Core::ActionManager::command(
|
Core::Command *command = Core::ActionManager::command(makeId(macro->displayName()));
|
||||||
Core::Id(QLatin1String(Constants::PREFIX_MACRO)+macro->displayName()));
|
|
||||||
if (command && command->shortcut())
|
if (command && command->shortcut())
|
||||||
command->shortcut()->setWhatsThis(description);
|
command->shortcut()->setWhatsThis(description);
|
||||||
}
|
}
|
||||||
|
@@ -111,7 +111,7 @@ void MacroOptionsWidget::createTable()
|
|||||||
macroItem->setData(0, WRITE_ROLE, it.value()->isWritable());
|
macroItem->setData(0, WRITE_ROLE, it.value()->isWritable());
|
||||||
|
|
||||||
Core::Command *command =
|
Core::Command *command =
|
||||||
Core::ActionManager::command(Core::Id(QLatin1String(Constants::PREFIX_MACRO)
|
Core::ActionManager::command(Core::Id::fromString(QLatin1String(Constants::PREFIX_MACRO)
|
||||||
+ it.value()->displayName()));
|
+ it.value()->displayName()));
|
||||||
if (command && command->shortcut())
|
if (command && command->shortcut())
|
||||||
macroItem->setText(2, command->shortcut()->key().toString());
|
macroItem->setText(2, command->shortcut()->key().toString());
|
||||||
|
Reference in New Issue
Block a user