Commit 2892f13b authored by Friedemann Kleint's avatar Friedemann Kleint

CorePlugin: Compile with QT_NO_CAST_FROM_ASCII.

- Wrap literals in QLatin1String()/QLatin1Char().
- Extract some string constants avoiding repeated
  QString construction.
- Fix repeated invocation of Container.end() in loops.

Change-Id: If737735507aaf82e53063adda53f54c46418f42f
Reviewed-by: default avatarTobias Hunger <tobias.hunger@nokia.com>
parent 0d72da2f
......@@ -405,7 +405,11 @@ bool MenuActionContainer::updateInternal()
if (ActionContainerPrivate *container = qobject_cast<ActionContainerPrivate*>(item)) {
actions.removeAll(container->menu()->menuAction());
if (container == this) {
qWarning() << Q_FUNC_INFO << "container" << (this->menu() ? this->menu()->title() : "") << "contains itself as subcontainer";
QByteArray warning = Q_FUNC_INFO + QByteArray(" container '");
if (this->menu())
warning += this->menu()->title().toLocal8Bit();
warning += "' contains itself as subcontainer";
qWarning("%s", warning.constData());
continue;
}
if (container->updateInternal()) {
......
......@@ -311,7 +311,7 @@ ActionContainer *ActionManagerPrivate::createMenu(const Id &id)
return it.value();
QMenu *m = new QMenu(m_mainWnd);
m->setObjectName(id.name());
m->setObjectName(QLatin1String(id.name()));
MenuActionContainer *mc = new MenuActionContainer(id);
mc->setMenu(m);
......
......@@ -151,7 +151,7 @@ void CommandMappings::finish()
void CommandMappings::commandChanged(QTreeWidgetItem *current)
{
if (!current || !current->data(0, Qt::UserRole).isValid()) {
m_page->targetEdit->setText("");
m_page->targetEdit->setText(QString());
m_page->targetEditGroup->setEnabled(false);
return;
}
......
......@@ -182,7 +182,7 @@ QString CoreImpl::userResourcePath() const
{
// Create qtcreator dir if it doesn't yet exist
const QString configDir = QFileInfo(settings(QSettings::UserScope)->fileName()).path();
const QString urp = configDir + "/qtcreator";
const QString urp = configDir + QLatin1String("/qtcreator");
QFileInfo fi(urp + QLatin1Char('/'));
if (!fi.exists()) {
......
......@@ -130,8 +130,8 @@ DesignMode::DesignMode()
setDisplayName(tr("Design"));
setIcon(QIcon(QLatin1String(":/fancyactionbar/images/mode_Design.png")));
setPriority(Constants::P_MODE_DESIGN);
setId(Constants::MODE_DESIGN);
setType(Constants::MODE_DESIGN_TYPE);
setId(QLatin1String(Constants::MODE_DESIGN));
setType(QLatin1String(Constants::MODE_DESIGN_TYPE));
ExtensionSystem::PluginManager::instance()->addObject(d->m_coreListener);
......@@ -237,7 +237,7 @@ void DesignMode::currentEditorChanged(Core::IEditor *editor)
if (!mimeEditorAvailable) {
setActiveContext(Context());
if (ModeManager::instance()->currentMode() == this)
ModeManager::instance()->activateMode(Core::Constants::MODE_EDIT);
ModeManager::instance()->activateMode(QLatin1String(Core::Constants::MODE_EDIT));
setEnabled(false);
d->m_currentEditor = QWeakPointer<Core::IEditor>();
emit actionsUpdated(d->m_currentEditor.data());
......
......@@ -339,12 +339,14 @@ QModelIndex ExternalToolModel::addTool(const QModelIndex &atIndex)
tool->setDisplayCategory(category);
tool->setDisplayName(tr("New Tool"));
tool->setDescription(tr("This tool prints a line of useful text"));
//: Sample external tool text
const QString text = tr("Useful text");
#ifdef Q_OS_WIN
tool->setExecutables(QStringList() << "cmd");
tool->setArguments(tr("/c echo Useful text"));
tool->setExecutables(QStringList(QLatin1String("cmd")));
tool->setArguments(QLatin1String("/c echo ") + text);
#else
tool->setExecutables(QStringList() << "echo");
tool->setArguments(tr("Useful text"));
tool->setExecutables(QStringList(QLatin1String("echo")));
tool->setArguments(text);
#endif
int pos;
......@@ -463,8 +465,8 @@ void ExternalToolConfig::setTools(const QMap<QString, QList<ExternalTool *> > &t
itemCopy.append(new ExternalTool(tool));
toolsCopy.insert(it.key(), itemCopy);
}
if (!toolsCopy.contains(QString("")))
toolsCopy.insert(QString(""), QList<ExternalTool *>());
if (!toolsCopy.contains(QString()))
toolsCopy.insert(QString(), QList<ExternalTool *>());
m_model->setTools(toolsCopy);
ui->toolTree->expandAll();
}
......
......@@ -219,7 +219,7 @@ void ShortcutSettings::removeTargetIdentifier()
void ShortcutSettings::importAction()
{
QString fileName = QFileDialog::getOpenFileName(0, tr("Import Keyboard Mapping Scheme"),
ICore::instance()->resourcePath() + "/schemes/",
ICore::instance()->resourcePath() + QLatin1String("/schemes/"),
tr("Keyboard Mapping Scheme (*.kms)"));
if (!fileName.isEmpty()) {
......@@ -268,7 +268,7 @@ void ShortcutSettings::exportAction()
{
QString fileName = FileManager::instance()->getSaveFileNameWithExtension(
tr("Export Keyboard Mapping Scheme"),
ICore::instance()->resourcePath() + "/schemes/",
ICore::instance()->resourcePath() + QLatin1String("/schemes/"),
tr("Keyboard Mapping Scheme (*.kms)"));
if (!fileName.isEmpty()) {
CommandsFile cf(fileName);
......@@ -325,7 +325,7 @@ void ShortcutSettings::initialize()
if (c->action()) {
QString text = c->hasAttribute(Command::CA_UpdateText) && !c->defaultText().isNull() ? c->defaultText() : c->action()->text();
text.remove(QRegExp("&(?!&)"));
text.remove(QRegExp(QLatin1String("&(?!&)")));
s->m_key = c->action()->shortcut();
item->setText(1, text);
} else {
......
......@@ -1270,10 +1270,10 @@ int extractLineNumber(QString *fileName)
}
if (i == -1)
return -1;
if (fileName->at(i) == ':' || fileName->at(i) == '+') {
int result = fileName->mid(i+1).toInt();
if (result) {
*fileName = fileName->left(i);
const QChar c = fileName->at(i);
if (c == QLatin1Char(':') || c == QLatin1Char('+')) {
if (const int result = fileName->mid(i + 1).toInt()) {
fileName->truncate(i);
return result;
}
}
......@@ -1386,7 +1386,7 @@ void EditorManager::switchToPreferedMode()
preferedMode = d->m_currentEditor->preferredModeType();
if (preferedMode.isEmpty())
preferedMode = Constants::MODE_EDIT_TYPE;
preferedMode = QLatin1String(Constants::MODE_EDIT_TYPE);
ModeManager::instance()->activateModeType(preferedMode);
}
......@@ -1672,14 +1672,15 @@ void EditorManager::vcsOpenCurrentEditor()
void EditorManager::updateWindowTitle()
{
QString windowTitle = tr("Qt Creator");
const QString dashSep = QLatin1String(" - ");
if (!d->m_titleAddition.isEmpty()) {
windowTitle.prepend(d->m_titleAddition + " - ");
windowTitle.prepend(d->m_titleAddition + dashSep);
}
IEditor *curEditor = currentEditor();
if (curEditor) {
QString editorName = curEditor->displayName();
if (!editorName.isEmpty())
windowTitle.prepend(editorName + " - ");
windowTitle.prepend(editorName + dashSep);
QString filePath = QFileInfo(curEditor->file()->fileName()).absoluteFilePath();
if (!filePath.isEmpty())
d->m_core->mainWindow()->setWindowFilePath(filePath);
......@@ -1771,7 +1772,7 @@ void EditorManager::updateActions()
QString quotedName;
if (!fName.isEmpty())
quotedName = '"' + fName + '"';
quotedName = QLatin1Char('"') + fName + QLatin1Char('"');
d->m_saveAsAction->setText(tr("Save %1 &As...").arg(quotedName));
d->m_saveAction->setText(tr("&Save %1").arg(quotedName));
......
......@@ -100,7 +100,7 @@ OpenEditorsWidget::OpenEditorsWidget()
{
m_ui.setupUi(this);
setWindowTitle(tr("Open Documents"));
setWindowIcon(QIcon(Constants::ICON_DIR));
setWindowIcon(QIcon(QLatin1String(Constants::ICON_DIR)));
setFocusProxy(m_ui.editorList);
m_ui.editorList->viewport()->setAttribute(Qt::WA_Hover);
m_ui.editorList->setItemDelegate((m_delegate = new OpenEditorsDelegate(this)));
......
......@@ -823,9 +823,10 @@ void ExternalToolManager::setToolsByCategory(const QMap<QString, QList<Internal:
}
qDeleteAll(m_tools);
QMapIterator<QString, QAction *> remainingActions(m_actions);
const QString externalToolsPrefix = QLatin1String("Tools.External.");
while (remainingActions.hasNext()) {
remainingActions.next();
am->unregisterAction(remainingActions.value(), Id("Tools.External." + remainingActions.key()));
am->unregisterAction(remainingActions.value(), Id(externalToolsPrefix + remainingActions.key()));
delete remainingActions.value();
}
m_actions.clear();
......@@ -847,7 +848,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 = am->createMenu(Id("Tools.External.Category." + containerName));
container = am->createMenu(Id(QLatin1String("Tools.External.Category.") + containerName));
}
newContainers.insert(containerName, container);
mexternaltools->addMenu(container, Constants::G_DEFAULT_ONE);
......@@ -860,13 +861,13 @@ void ExternalToolManager::setToolsByCategory(const QMap<QString, QList<Internal:
Command *command = 0;
if (m_actions.contains(toolId)) {
action = m_actions.value(toolId);
command = am->command(Id("Tools.External." + toolId));
command = am->command(Id(externalToolsPrefix + toolId));
} else {
action = new QAction(tool->displayName(), this);
action->setData(toolId);
m_actions.insert(toolId, action);
connect(action, SIGNAL(triggered()), this, SLOT(menuActivated()));
command = am->registerAction(action, Id("Tools.External." + toolId), Context(Constants::C_GLOBAL));
command = am->registerAction(action, Id(externalToolsPrefix + toolId), Context(Constants::C_GLOBAL));
command->setAttribute(Command::CA_UpdateText);
}
action->setText(tool->displayName());
......
......@@ -682,11 +682,11 @@ QString FileManager::getSaveFileName(const QString &title, const QString &pathIn
if (selectedFilter && *selectedFilter != QCoreApplication::translate(
"Core", Constants::ALL_FILES_FILTER)) {
// Mime database creates filter strings like this: Anything here (*.foo *.bar)
QRegExp regExp(".*\\s+\\((.*)\\)$");
QRegExp regExp(QLatin1String(".*\\s+\\((.*)\\)$"));
const int index = regExp.lastIndexIn(*selectedFilter);
bool suffixOk = false;
if (index != -1) {
const QStringList &suffixes = regExp.cap(1).remove('*').split(' ');
const QStringList &suffixes = regExp.cap(1).remove(QLatin1Char('*')).split(QLatin1Char(' '));
foreach (const QString &suffix, suffixes)
if (fileName.endsWith(suffix)) {
suffixOk = true;
......
......@@ -90,7 +90,8 @@ static bool hasQmFilesForLocale(const QString &locale, const QString &creatorTrP
static const QString qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
const QString trFile = QLatin1String("qt_") + locale + QLatin1String(".qm");
return QFile::exists(qtTrPath+'/'+trFile) || QFile::exists(creatorTrPath+'/'+trFile);
return QFile::exists(qtTrPath + QLatin1Char('/') + trFile)
|| QFile::exists(creatorTrPath + QLatin1Char('/') + trFile);
}
void GeneralSettings::fillLanguageBox() const
......
......@@ -447,7 +447,7 @@ QStringList HelpManagerPrivate::documentationFromInstaller()
documentationFiles << pathInfo.absoluteFilePath();
} else if (pathInfo.isDir()) {
QDir dir(path);
foreach (const QFileInfo &fileInfo, dir.entryInfoList(QStringList() << "*.qch",
foreach (const QFileInfo &fileInfo, dir.entryInfoList(QStringList(QLatin1String("*.qch")),
QDir::Files | QDir::Readable)) {
documentationFiles << fileInfo.absoluteFilePath();
}
......
......@@ -87,7 +87,7 @@ QString Id::toString() const
Context::Context(const char *id, int offset)
{
d.append(Id(QString(id) + QString::number(offset)).uniqueIdentifier());
d.append(Id(QLatin1String(id) + QString::number(offset)).uniqueIdentifier());
}
void Context::add(const char *id)
......
......@@ -560,7 +560,7 @@ void MainWindow::registerDefaultActions()
mfile->addAction(cmd, Constants::G_FILE_SAVE);
cmd = createSeparator(am, this, Id("QtCreator.File.Sep.Print"), globalContext);
QIcon icon = QIcon::fromTheme(QLatin1String("edit-cut"), QIcon(Constants::ICON_CUT));
QIcon icon = QIcon::fromTheme(QLatin1String("edit-cut"), QIcon(QLatin1String(Constants::ICON_CUT)));
mfile->addAction(cmd, Constants::G_FILE_PRINT);
cmd = createSeparator(am, this, Id("QtCreator.File.Sep.Close"), globalContext);
......@@ -590,7 +590,7 @@ void MainWindow::registerDefaultActions()
connect(m_focusToEditor, SIGNAL(activated()), this, SLOT(setFocusToEditor()));
// New File Action
icon = QIcon::fromTheme(QLatin1String("document-new"), QIcon(Constants::ICON_NEWFILE));
icon = QIcon::fromTheme(QLatin1String("document-new"), QIcon(QLatin1String(Constants::ICON_NEWFILE)));
m_newAction = new QAction(icon, tr("&New File or Project..."), this);
cmd = am->registerAction(m_newAction, Constants::NEW, globalContext);
cmd->setDefaultKeySequence(QKeySequence::New);
......@@ -598,7 +598,7 @@ void MainWindow::registerDefaultActions()
connect(m_newAction, SIGNAL(triggered()), this, SLOT(newFile()));
// Open Action
icon = QIcon::fromTheme(QLatin1String("document-open"), QIcon(Constants::ICON_OPENFILE));
icon = QIcon::fromTheme(QLatin1String("document-open"), QIcon(QLatin1String(Constants::ICON_OPENFILE)));
m_openAction = new QAction(icon, tr("&Open File or Project..."), this);
cmd = am->registerAction(m_openAction, Constants::OPEN, globalContext);
cmd->setDefaultKeySequence(QKeySequence::Open);
......@@ -618,7 +618,7 @@ void MainWindow::registerDefaultActions()
ac->setOnAllDisabledBehavior(ActionContainer::Show);
// Save Action
icon = QIcon::fromTheme(QLatin1String("document-save"), QIcon(Constants::ICON_SAVEFILE));
icon = QIcon::fromTheme(QLatin1String("document-save"), QIcon(QLatin1String(Constants::ICON_SAVEFILE)));
QAction *tmpaction = new QAction(icon, tr("&Save"), this);
tmpaction->setEnabled(false);
cmd = am->registerAction(tmpaction, Constants::SAVE, globalContext);
......@@ -665,7 +665,7 @@ void MainWindow::registerDefaultActions()
connect(m_exitAction, SIGNAL(triggered()), this, SLOT(exit()));
// Undo Action
icon = QIcon::fromTheme(QLatin1String("edit-undo"), QIcon(Constants::ICON_UNDO));
icon = QIcon::fromTheme(QLatin1String("edit-undo"), QIcon(QLatin1String(Constants::ICON_UNDO)));
tmpaction = new QAction(icon, tr("&Undo"), this);
cmd = am->registerAction(tmpaction, Constants::UNDO, globalContext);
cmd->setDefaultKeySequence(QKeySequence::Undo);
......@@ -675,7 +675,7 @@ void MainWindow::registerDefaultActions()
tmpaction->setEnabled(false);
// Redo Action
icon = QIcon::fromTheme(QLatin1String("edit-redo"), QIcon(Constants::ICON_REDO));
icon = QIcon::fromTheme(QLatin1String("edit-redo"), QIcon(QLatin1String(Constants::ICON_REDO)));
tmpaction = new QAction(icon, tr("&Redo"), this);
cmd = am->registerAction(tmpaction, Constants::REDO, globalContext);
cmd->setDefaultKeySequence(QKeySequence::Redo);
......@@ -685,7 +685,7 @@ void MainWindow::registerDefaultActions()
tmpaction->setEnabled(false);
// Cut Action
icon = QIcon::fromTheme(QLatin1String("edit-cut"), QIcon(Constants::ICON_CUT));
icon = QIcon::fromTheme(QLatin1String("edit-cut"), QIcon(QLatin1String(Constants::ICON_CUT)));
tmpaction = new QAction(icon, tr("Cu&t"), this);
cmd = am->registerAction(tmpaction, Constants::CUT, globalContext);
cmd->setDefaultKeySequence(QKeySequence::Cut);
......@@ -693,7 +693,7 @@ void MainWindow::registerDefaultActions()
tmpaction->setEnabled(false);
// Copy Action
icon = QIcon::fromTheme(QLatin1String("edit-copy"), QIcon(Constants::ICON_COPY));
icon = QIcon::fromTheme(QLatin1String("edit-copy"), QIcon(QLatin1String(Constants::ICON_COPY)));
tmpaction = new QAction(icon, tr("&Copy"), this);
cmd = am->registerAction(tmpaction, Constants::COPY, globalContext);
cmd->setDefaultKeySequence(QKeySequence::Copy);
......@@ -701,7 +701,7 @@ void MainWindow::registerDefaultActions()
tmpaction->setEnabled(false);
// Paste Action
icon = QIcon::fromTheme(QLatin1String("edit-paste"), QIcon(Constants::ICON_PASTE));
icon = QIcon::fromTheme(QLatin1String("edit-paste"), QIcon(QLatin1String(Constants::ICON_PASTE)));
tmpaction = new QAction(icon, tr("&Paste"), this);
cmd = am->registerAction(tmpaction, Constants::PASTE, globalContext);
cmd->setDefaultKeySequence(QKeySequence::Paste);
......@@ -731,7 +731,7 @@ void MainWindow::registerDefaultActions()
m_optionsAction = new QAction(tr("&Options..."), this);
cmd = am->registerAction(m_optionsAction, Constants::OPTIONS, globalContext);
#ifdef Q_WS_MAC
cmd->setDefaultKeySequence(QKeySequence("Ctrl+,"));
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+,")));
cmd->action()->setMenuRole(QAction::PreferencesRole);
#endif
mtools->addAction(cmd, Constants::G_TOOLS_OPTIONS);
......@@ -741,7 +741,7 @@ void MainWindow::registerDefaultActions()
// Minimize Action
m_minimizeAction = new QAction(tr("Minimize"), this);
cmd = am->registerAction(m_minimizeAction, Constants::MINIMIZE_WINDOW, globalContext);
cmd->setDefaultKeySequence(QKeySequence("Ctrl+M"));
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+M")));
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
connect(m_minimizeAction, SIGNAL(triggered()), this, SLOT(showMinimized()));
......@@ -757,15 +757,15 @@ void MainWindow::registerDefaultActions()
#endif
// Show Sidebar Action
m_toggleSideBarAction = new QAction(QIcon(Constants::ICON_TOGGLE_SIDEBAR),
m_toggleSideBarAction = new QAction(QIcon(QLatin1String(Constants::ICON_TOGGLE_SIDEBAR)),
tr("Show Sidebar"), this);
m_toggleSideBarAction->setCheckable(true);
cmd = am->registerAction(m_toggleSideBarAction, Constants::TOGGLE_SIDEBAR, globalContext);
cmd->setAttribute(Command::CA_UpdateText);
#ifdef Q_WS_MAC
cmd->setDefaultKeySequence(QKeySequence("Ctrl+0"));
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+0")));
#else
cmd->setDefaultKeySequence(QKeySequence("Alt+0"));
cmd->setDefaultKeySequence(QKeySequence(tr("Alt+0")));
#endif
connect(m_toggleSideBarAction, SIGNAL(triggered(bool)), this, SLOT(setSidebarVisible(bool)));
m_toggleSideBarButton->setDefaultAction(cmd->action());
......@@ -777,7 +777,7 @@ void MainWindow::registerDefaultActions()
m_toggleFullScreenAction = new QAction(tr("Full Screen"), this);
m_toggleFullScreenAction->setCheckable(true);
cmd = am->registerAction(m_toggleFullScreenAction, Constants::TOGGLE_FULLSCREEN, globalContext);
cmd->setDefaultKeySequence(QKeySequence("Ctrl+Shift+F11"));
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F11")));
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
connect(m_toggleFullScreenAction, SIGNAL(triggered(bool)), this, SLOT(setFullScreen(bool)));
#endif
......@@ -875,7 +875,7 @@ void MainWindow::openFiles(const QStringList &fileNames, ICore::OpenFilesFlags f
if (!file && (flags & ICore::StopOnLoadFail))
return;
if (file && (flags & ICore::SwitchMode))
Core::ModeManager::instance()->activateMode(Core::Constants::MODE_EDIT);
Core::ModeManager::instance()->activateMode(QLatin1String(Core::Constants::MODE_EDIT));
} else {
QFlags<EditorManager::OpenEditorFlag> emFlags;
if (flags & ICore::SwitchMode)
......
......@@ -293,7 +293,7 @@ QPair<int, int> MagicRule::fromOffset(const QString &offset)
\sa Core::Internal::BaseMimeTypeParser, Core::Internal::MimeTypeParser
*/
const QString MagicStringRule::kMatchType("string");
const QString MagicStringRule::kMatchType(QLatin1String("string"));
MagicStringRule::MagicStringRule(const QString &s, int startPos, int endPos) :
MagicRule(startPos, endPos), m_pattern(s.toUtf8())
......@@ -311,7 +311,7 @@ QString MagicStringRule::matchType() const
QString MagicStringRule::matchValue() const
{
return m_pattern;
return QLatin1String(m_pattern);
}
bool MagicStringRule::matches(const QByteArray &data) const
......@@ -1664,20 +1664,26 @@ QList<MimeType> MimeDatabasePrivate::readUserModifiedMimeTypes()
QHash<int, MagicRuleList> rules;
QXmlStreamReader reader(&file);
QXmlStreamAttributes atts;
const QString mimeTypeAttribute = QLatin1String(mimeTypeAttributeC);
const QString patternAttribute = QLatin1String(patternAttributeC);
const QString matchValueAttribute = QLatin1String(matchValueAttributeC);
const QString matchTypeAttribute = QLatin1String(matchTypeAttributeC);
const QString matchOffsetAttribute = QLatin1String(matchOffsetAttributeC);
const QString priorityAttribute = QLatin1String(priorityAttributeC);
while (!reader.atEnd()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement:
atts = reader.attributes();
if (reader.name() == mimeTypeTagC) {
mimeType.setType(atts.value(mimeTypeAttributeC).toString());
const QString &patterns = atts.value(patternAttributeC).toString();
mimeType.setType(atts.value(mimeTypeAttribute).toString());
const QString &patterns = atts.value(patternAttribute).toString();
mimeType.setGlobPatterns(toGlobPatterns(patterns.split(kSemiColon)));
} else if (reader.name() == matchTagC) {
const QString &value = atts.value(matchValueAttributeC).toString();
const QString &type = atts.value(matchTypeAttributeC).toString();
const QString &offset = atts.value(matchOffsetAttributeC).toString();
const QString &value = atts.value(matchValueAttribute).toString();
const QString &type = atts.value(matchTypeAttribute).toString();
const QString &offset = atts.value(matchOffsetAttribute).toString();
QPair<int, int> range = MagicRule::fromOffset(offset);
const int priority = atts.value(priorityAttributeC).toString().toInt();
const int priority = atts.value(priorityAttribute).toString().toInt();
MagicRule *magicRule;
if (type == MagicStringRule::kMatchType)
......@@ -1729,10 +1735,19 @@ void MimeDatabasePrivate::writeUserModifiedMimeTypes(const QList<MimeType> &mime
writer.setAutoFormatting(true);
writer.writeStartDocument();
writer.writeStartElement(QLatin1String(mimeInfoTagC));
const QString mimeTypeTag = QLatin1String(mimeTypeTagC);
const QString matchTag = QLatin1String(matchTagC);
const QString mimeTypeAttribute = QLatin1String(mimeTypeAttributeC);
const QString patternAttribute = QLatin1String(patternAttributeC);
const QString matchValueAttribute = QLatin1String(matchValueAttributeC);
const QString matchTypeAttribute = QLatin1String(matchTypeAttributeC);
const QString matchOffsetAttribute = QLatin1String(matchOffsetAttributeC);
const QString priorityAttribute = QLatin1String(priorityAttributeC);
foreach (const MimeType &mimeType, allModifiedMimeTypes) {
writer.writeStartElement(mimeTypeTagC);
writer.writeAttribute(mimeTypeAttributeC, mimeType.type());
writer.writeAttribute(patternAttributeC,
writer.writeStartElement(mimeTypeTag);
writer.writeAttribute(mimeTypeAttribute, mimeType.type());
writer.writeAttribute(patternAttribute,
fromGlobPatterns(mimeType.globPatterns()).join(kSemiColon));
const QList<QSharedPointer<IMagicMatcher> > &matchers = mimeType.magicMatchers();
foreach (const QSharedPointer<IMagicMatcher> &matcher, matchers) {
......@@ -1741,13 +1756,13 @@ void MimeDatabasePrivate::writeUserModifiedMimeTypes(const QList<MimeType> &mime
dynamic_cast<MagicRuleMatcher *>(matcher.data())) {
const MagicRuleMatcher::MagicRuleList &rules = ruleMatcher->magicRules();
foreach (const MagicRuleMatcher::MagicRuleSharedPointer &rule, rules) {
writer.writeStartElement(matchTagC);
writer.writeAttribute(matchValueAttributeC, rule->matchValue());
writer.writeAttribute(matchTypeAttributeC, rule->matchType());
writer.writeAttribute(matchOffsetAttributeC,
writer.writeStartElement(matchTag);
writer.writeAttribute(matchValueAttribute, rule->matchValue());
writer.writeAttribute(matchTypeAttribute, rule->matchType());
writer.writeAttribute(matchOffsetAttribute,
MagicRule::toOffset(
qMakePair(rule->startPos(), rule->endPos())));
writer.writeAttribute(priorityAttributeC,
writer.writeAttribute(priorityAttribute,
QString::number(ruleMatcher->priority()));
writer.writeEndElement();
}
......
......@@ -218,9 +218,9 @@ void ModeManager::objectAdded(QObject *obj)
bool currentlyHasDefaultSequence = (currentCmd->keySequence()
== currentCmd->defaultKeySequence());
#ifdef Q_WS_MAC
currentCmd->setDefaultKeySequence(QKeySequence(QString("Meta+%1").arg(i+1)));
currentCmd->setDefaultKeySequence(QKeySequence(QString::fromLatin1("Meta+%1").arg(i+1)));
#else
currentCmd->setDefaultKeySequence(QKeySequence(QString("Ctrl+%1").arg(i+1)));
currentCmd->setDefaultKeySequence(QKeySequence(QString::fromLatin1("Ctrl+%1").arg(i+1)));
#endif
if (currentlyHasDefaultSequence)
currentCmd->setKeySequence(currentCmd->defaultKeySequence());
......
......@@ -200,7 +200,7 @@ void NavigationWidget::setFactories(const QList<INavigationWidgetFactory *> fact
d->m_shortcutMap.insert(shortcut, id);
Command *cmd = am->registerShortcut(shortcut,
Id(QLatin1String("QtCreator.Sidebar.") + id.name()), navicontext);
Id(QLatin1String("QtCreator.Sidebar.") + QLatin1String(id.name())), navicontext);
cmd->setDefaultKeySequence(factory->activationSequence());
d->m_commandMap.insert(id, cmd);
......@@ -331,7 +331,7 @@ void NavigationWidget::restoreSettings(QSettings *settings)
int version = settings->value(QLatin1String("Navigation/Version"), 1).toInt();
QStringList viewIds = settings->value(QLatin1String("Navigation/Views"),
QStringList("Projects")).toStringList();
QStringList(QLatin1String("Projects"))).toStringList();
bool restoreSplitterState = true;
if (version == 1) {
......
......@@ -114,8 +114,8 @@ OutputPaneManager::OutputPaneManager(QWidget *parent) :
m_lastIndex(-1),
m_outputWidgetPane(new QStackedWidget),
m_opToolBarWidgets(new QStackedWidget),
m_minimizeIcon(":/core/images/arrowdown.png"),
m_maximizeIcon(":/core/images/arrowup.png"),
m_minimizeIcon(QLatin1String(":/core/images/arrowdown.png")),
m_maximizeIcon(QLatin1String(":/core/images/arrowup.png")),
m_maximised(false)
{
setWindowTitle(tr("Output"));
......@@ -212,20 +212,20 @@ void OutputPaneManager::init()
mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup");
cmd = am->registerAction(m_prevAction, "Coreplugin.OutputPane.previtem", globalcontext);
cmd->setDefaultKeySequence(QKeySequence("Shift+F6"));
cmd->setDefaultKeySequence(QKeySequence(tr("Shift+F6")));
m_prevToolButton->setDefaultAction(cmd->action());
mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup");
cmd = am->registerAction(m_nextAction, "Coreplugin.OutputPane.nextitem", globalcontext);
m_nextToolButton->setDefaultAction(cmd->action());
cmd->setDefaultKeySequence(QKeySequence("F6"));
cmd->setDefaultKeySequence(QKeySequence(tr("F6")));
mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup");
cmd = am->registerAction(m_minMaxAction, "Coreplugin.OutputPane.minmax", globalcontext);
#ifdef Q_WS_MAC
cmd->setDefaultKeySequence(QKeySequence("Ctrl+9"));
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+9")));
#else
cmd->setDefaultKeySequence(QKeySequence("Alt+9"));
cmd->setDefaultKeySequence(QKeySequence(tr("Alt+9")));
#endif
cmd->setAttribute(Command::CA_UpdateText);
cmd->setAttribute(Command::CA_UpdateIcon);
......@@ -270,7 +270,7 @@ void OutputPaneManager::init()
m_opToolBarWidgets->addWidget(toolButtonsContainer);
QString actionId = QString("QtCreator.Pane.%1").arg(outPane->displayName().simplified());
QString actionId = QLatin1String("QtCreator.Pane.") + outPane->displayName().simplified();
actionId.remove(QLatin1Char(' '));
QAction *action = new QAction(outPane->displayName(), this);
......@@ -450,7 +450,7 @@ void OutputPaneManager::showPage(int idx, bool focus)
if (!OutputPanePlaceHolder::getCurrent()) {
// In t