summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2012-11-26 21:17:34 +0200
committerFawzi Mohamed <fawzi.mohamed@digia.com>2012-12-03 13:40:51 +0100
commit9bf654743e55fd09e1f61872aa6524bfd84e5bef (patch)
tree0975f1180c093e43c3a5463060de3c847bab5e68 /src
parentf5064d064f3813513ef82efac8bddacc981fccca (diff)
downloadqt-creator-9bf654743e55fd09e1f61872aa6524bfd84e5bef.tar.gz
QmlJSEditor: Compile with QT_NO_CAST_FROM_ASCII
Change-Id: I899c26e028efe355d4673b55ac9718e103c7d7ec Reviewed-by: Kai Koehne <kai.koehne@digia.com> Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/qmljseditor/qmljscompletionassist.cpp8
-rw-r--r--src/plugins/qmljseditor/qmljseditor.cpp6
-rw-r--r--src/plugins/qmljseditor/qmljseditor.pro3
-rw-r--r--src/plugins/qmljseditor/qmljseditor.qbs2
-rw-r--r--src/plugins/qmljseditor/qmljseditorplugin.cpp4
-rw-r--r--src/plugins/qmljseditor/qmljsfindreferences.cpp2
-rw-r--r--src/plugins/qmljseditor/qmljshighlighter.cpp16
-rw-r--r--src/plugins/qmljseditor/qmljsoutline.cpp5
-rw-r--r--src/plugins/qmljseditor/qmljspreviewrunner.cpp2
-rw-r--r--src/plugins/qmljseditor/qmljsquickfixes.cpp2
-rw-r--r--src/plugins/qmljseditor/qmljswrapinloader.cpp20
-rw-r--r--src/plugins/qmljseditor/qmloutlinemodel.cpp20
-rw-r--r--src/plugins/qmljseditor/quicktoolbar.cpp24
13 files changed, 58 insertions, 56 deletions
diff --git a/src/plugins/qmljseditor/qmljscompletionassist.cpp b/src/plugins/qmljseditor/qmljscompletionassist.cpp
index adc47fc2a5..cfdf401d48 100644
--- a/src/plugins/qmljseditor/qmljscompletionassist.cpp
+++ b/src/plugins/qmljseditor/qmljscompletionassist.cpp
@@ -138,7 +138,7 @@ public:
if (const FunctionValue *func = value->asFunctionValue()) {
// constructors usually also have other interesting members,
// don't consider them pure functions and complete the '()'
- if (!func->lookupMember("prototype", 0, 0, false)) {
+ if (!func->lookupMember(QLatin1String("prototype"), 0, 0, false)) {
data = QVariant::fromValue(CompleteFunctionCall(func->namedArgumentCount() || func->isVariadic()));
}
}
@@ -498,7 +498,7 @@ IAssistProcessor *QmlJSCompletionAssistProvider::createProcessor() const
// ------------------------------
QmlJSCompletionAssistProcessor::QmlJSCompletionAssistProcessor()
: m_startPosition(0)
- , m_snippetCollector(Constants::QML_SNIPPETS_GROUP_ID, iconForColor(Qt::red), SnippetOrder)
+ , m_snippetCollector(QLatin1String(Constants::QML_SNIPPETS_GROUP_ID), iconForColor(Qt::red), SnippetOrder)
{}
QmlJSCompletionAssistProcessor::~QmlJSCompletionAssistProcessor()
@@ -753,9 +753,9 @@ IAssistProposal *QmlJSCompletionAssistProcessor::perform(const IAssistInterface
foreach (const QString &key, enumValue->keys()) {
QString completion;
if (name.isEmpty())
- completion = QString("\"%1\"").arg(key);
+ completion = QString::fromLatin1("\"%1\"").arg(key);
else
- completion = QString("%1.%2").arg(name, key);
+ completion = QString::fromLatin1("%1.%2").arg(name, key);
addCompletion(&m_completions, key, m_interface->symbolIcon(),
EnumValueOrder, completion);
}
diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp
index 4bceab8222..c7ee1025c7 100644
--- a/src/plugins/qmljseditor/qmljseditor.cpp
+++ b/src/plugins/qmljseditor/qmljseditor.cpp
@@ -1128,7 +1128,7 @@ TextEditor::BaseTextEditorWidget::Link QmlJSTextEditorWidget::findLinkAt(const Q
link.fileName = text;
return link;
}
- const QString relative = QString("%1/%2").arg(
+ const QString relative = QString::fromLatin1("%1/%2").arg(
semanticInfo.document->path(),
text);
if (semanticInfo.snapshot.document(relative)) {
@@ -1243,9 +1243,9 @@ void QmlJSTextEditorWidget::contextMenuEvent(QContextMenuEvent *e)
QMenu *contextMenu = mcontext->menu();
foreach (QAction *action, contextMenu->actions()) {
menu->addAction(action);
- if (action->objectName() == QmlJSEditor::Constants::M_REFACTORING_MENU_INSERTION_POINT)
+ if (action->objectName() == QLatin1String(QmlJSEditor::Constants::M_REFACTORING_MENU_INSERTION_POINT))
menu->addMenu(refactoringMenu);
- if (action->objectName() == QmlJSEditor::Constants::SHOW_QT_QUICK_HELPER) {
+ if (action->objectName() == QLatin1String(QmlJSEditor::Constants::SHOW_QT_QUICK_HELPER)) {
bool enabled = m_contextPane->isAvailable(editor(), semanticInfo().document, m_semanticInfo.declaringMemberNoProperties(position()));
action->setEnabled(enabled);
}
diff --git a/src/plugins/qmljseditor/qmljseditor.pro b/src/plugins/qmljseditor/qmljseditor.pro
index 2227e1e560..c533732521 100644
--- a/src/plugins/qmljseditor/qmljseditor.pro
+++ b/src/plugins/qmljseditor/qmljseditor.pro
@@ -6,7 +6,8 @@ QT += script
DEFINES += \
QMLJSEDITOR_LIBRARY \
- QT_CREATOR
+ QT_CREATOR \
+ QT_NO_CAST_FROM_ASCII
HEADERS += \
qmljseditor.h \
diff --git a/src/plugins/qmljseditor/qmljseditor.qbs b/src/plugins/qmljseditor/qmljseditor.qbs
index 9e81ca3ca3..5954d2117f 100644
--- a/src/plugins/qmljseditor/qmljseditor.qbs
+++ b/src/plugins/qmljseditor/qmljseditor.qbs
@@ -17,7 +17,7 @@ QtcPlugin {
Depends { name: "CPlusPlus" }
Depends { name: "cpp" }
- cpp.defines: base.concat(["QT_CREATOR"])
+ cpp.defines: base.concat(["QT_CREATOR", "QT_NO_CAST_FROM_ASCII"])
files: [
"QmlJSEditor.mimetypes.xml",
diff --git a/src/plugins/qmljseditor/qmljseditorplugin.cpp b/src/plugins/qmljseditor/qmljseditorplugin.cpp
index ab5f760e30..c8cd60f54d 100644
--- a/src/plugins/qmljseditor/qmljseditorplugin.cpp
+++ b/src/plugins/qmljseditor/qmljseditorplugin.cpp
@@ -217,7 +217,7 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e
// Insert marker for "Refactoring" menu:
Core::Command *sep = contextMenu->addSeparator(globalContext);
- sep->action()->setObjectName(Constants::M_REFACTORING_MENU_INSERTION_POINT);
+ sep->action()->setObjectName(QLatin1String(Constants::M_REFACTORING_MENU_INSERTION_POINT));
contextMenu->addSeparator(globalContext);
cmd = Core::ActionManager::command(TextEditor::Constants::AUTO_INDENT_SELECTION);
@@ -235,7 +235,7 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e
errorMessage->clear();
Core::FileIconProvider *iconProvider = Core::FileIconProvider::instance();
- iconProvider->registerIconOverlayForSuffix(QIcon(QLatin1String(":/qmljseditor/images/qmlfile.png")), "qml");
+ iconProvider->registerIconOverlayForSuffix(QIcon(QLatin1String(":/qmljseditor/images/qmlfile.png")), QLatin1String("qml"));
registerQuickFixes(this);
diff --git a/src/plugins/qmljseditor/qmljsfindreferences.cpp b/src/plugins/qmljseditor/qmljsfindreferences.cpp
index 046bb6dbc6..48bd7b6c18 100644
--- a/src/plugins/qmljseditor/qmljsfindreferences.cpp
+++ b/src/plugins/qmljseditor/qmljsfindreferences.cpp
@@ -945,7 +945,7 @@ void FindReferences::displayResults(int first, int last)
Core::ProgressManager *progressManager = Core::ICore::progressManager();
Core::FutureProgress *progress = progressManager->addTask(
m_watcher.future(), tr("Searching"),
- QmlJSEditor::Constants::TASK_SEARCH);
+ QLatin1String(QmlJSEditor::Constants::TASK_SEARCH));
connect(progress, SIGNAL(clicked()), m_currentSearch, SLOT(popup()));
++first;
diff --git a/src/plugins/qmljseditor/qmljshighlighter.cpp b/src/plugins/qmljseditor/qmljshighlighter.cpp
index 659dae1d1c..836f2447c4 100644
--- a/src/plugins/qmljseditor/qmljshighlighter.cpp
+++ b/src/plugins/qmljseditor/qmljshighlighter.cpp
@@ -87,12 +87,12 @@ void Highlighter::highlightBlock(const QString &text)
case Token::Comment:
if (m_inMultilineComment && text.midRef(token.end() - 2, 2) == QLatin1String("*/")) {
- onClosingParenthesis('-', token.end() - 1, index == tokens.size()-1);
+ onClosingParenthesis(QLatin1Char('-'), token.end() - 1, index == tokens.size()-1);
m_inMultilineComment = false;
} else if (!m_inMultilineComment
&& (m_scanner.state() & Scanner::MultiLineMask) == Scanner::MultiLineComment
&& index == tokens.size() - 1) {
- onOpeningParenthesis('+', token.offset, index == 0);
+ onOpeningParenthesis(QLatin1Char('+'), token.offset, index == 0);
m_inMultilineComment = true;
}
setFormat(token.offset, token.length, m_formats[CommentFormat]);
@@ -103,27 +103,27 @@ void Highlighter::highlightBlock(const QString &text)
break;
case Token::LeftParenthesis:
- onOpeningParenthesis('(', token.offset, index == 0);
+ onOpeningParenthesis(QLatin1Char('('), token.offset, index == 0);
break;
case Token::RightParenthesis:
- onClosingParenthesis(')', token.offset, index == tokens.size()-1);
+ onClosingParenthesis(QLatin1Char(')'), token.offset, index == tokens.size()-1);
break;
case Token::LeftBrace:
- onOpeningParenthesis('{', token.offset, index == 0);
+ onOpeningParenthesis(QLatin1Char('{'), token.offset, index == 0);
break;
case Token::RightBrace:
- onClosingParenthesis('}', token.offset, index == tokens.size()-1);
+ onClosingParenthesis(QLatin1Char('}'), token.offset, index == tokens.size()-1);
break;
case Token::LeftBracket:
- onOpeningParenthesis('[', token.offset, index == 0);
+ onOpeningParenthesis(QLatin1Char('['), token.offset, index == 0);
break;
case Token::RightBracket:
- onClosingParenthesis(']', token.offset, index == tokens.size()-1);
+ onClosingParenthesis(QLatin1Char(']'), token.offset, index == tokens.size()-1);
break;
case Token::Identifier: {
diff --git a/src/plugins/qmljseditor/qmljsoutline.cpp b/src/plugins/qmljseditor/qmljsoutline.cpp
index 484105bd4b..8b2eb096f5 100644
--- a/src/plugins/qmljseditor/qmljsoutline.cpp
+++ b/src/plugins/qmljseditor/qmljsoutline.cpp
@@ -157,14 +157,15 @@ void QmlJSOutlineWidget::setCursorSynchronization(bool syncWithCursor)
void QmlJSOutlineWidget::restoreSettings(int position)
{
QSettings *settings = Core::ICore::settings();
- bool showBindings = settings->value("QmlJSOutline."+QString::number(position)+".ShowBindings", true).toBool();
+ bool showBindings = settings->value(
+ QString::fromLatin1("QmlJSOutline.%1.ShowBindings").arg(position), true).toBool();
m_showBindingsAction->setChecked(showBindings);
}
void QmlJSOutlineWidget::saveSettings(int position)
{
QSettings *settings = Core::ICore::settings();
- settings->setValue("QmlJSOutline."+QString::number(position)+".ShowBindings",
+ settings->setValue(QString::fromLatin1("QmlJSOutline.%1.ShowBindings").arg(position),
m_showBindingsAction->isChecked());
}
diff --git a/src/plugins/qmljseditor/qmljspreviewrunner.cpp b/src/plugins/qmljseditor/qmljspreviewrunner.cpp
index 54b84b1ce1..26a4c759de 100644
--- a/src/plugins/qmljseditor/qmljspreviewrunner.cpp
+++ b/src/plugins/qmljseditor/qmljspreviewrunner.cpp
@@ -48,7 +48,7 @@ QmlJSPreviewRunner::QmlJSPreviewRunner(QObject *parent) :
// prepend creator/bin dir to search path (only useful for special creator-qml package)
const QString searchPath = QCoreApplication::applicationDirPath()
+ Utils::HostOsInfo::pathListSeparator()
- + QString(qgetenv("PATH"));
+ + QString::fromLocal8Bit(qgetenv("PATH"));
m_qmlViewerDefaultPath = Utils::SynchronousProcess::locateBinary(searchPath, QLatin1String("qmlviewer"));
Utils::Environment environment = Utils::Environment::systemEnvironment();
diff --git a/src/plugins/qmljseditor/qmljsquickfixes.cpp b/src/plugins/qmljseditor/qmljsquickfixes.cpp
index 9583331be7..edd9933187 100644
--- a/src/plugins/qmljseditor/qmljsquickfixes.cpp
+++ b/src/plugins/qmljseditor/qmljsquickfixes.cpp
@@ -162,7 +162,7 @@ private:
{
Utils::ChangeSet changes;
const int insertLoc = _message.location.begin() - _message.location.startColumn + 1;
- changes.insert(insertLoc, QString("// %1\n").arg(_message.suppressionString()));
+ changes.insert(insertLoc, QString::fromLatin1("// %1\n").arg(_message.suppressionString()));
currentFile->setChangeSet(changes);
currentFile->appendIndentRange(Range(insertLoc, insertLoc + 1));
currentFile->apply();
diff --git a/src/plugins/qmljseditor/qmljswrapinloader.cpp b/src/plugins/qmljseditor/qmljswrapinloader.cpp
index 87b2f003a9..1d1263192a 100644
--- a/src/plugins/qmljseditor/qmljswrapinloader.cpp
+++ b/src/plugins/qmljseditor/qmljswrapinloader.cpp
@@ -144,8 +144,8 @@ public:
const QString innerId = it.key();
comment += tr("// Rename all outer uses of the id '%1' to '%2.item.%1'.\n").arg(
innerId, loaderId);
- changes.replace(it.value().begin(), it.value().end(), QString("inner_%1").arg(innerId));
- innerIdForwarders += QString("\nproperty alias %1: inner_%1").arg(innerId);
+ changes.replace(it.value().begin(), it.value().end(), QString::fromLatin1("inner_%1").arg(innerId));
+ innerIdForwarders += QString::fromLatin1("\nproperty alias %1: inner_%1").arg(innerId);
}
if (!innerIdForwarders.isEmpty()) {
innerIdForwarders.append(QLatin1Char('\n'));
@@ -156,14 +156,14 @@ public:
const int objDefStart = m_objDef->firstSourceLocation().begin();
const int objDefEnd = m_objDef->lastSourceLocation().end();
changes.insert(objDefStart, comment +
- QString("Component {\n"
- " id: %1\n").arg(componentId));
- changes.insert(objDefEnd, QString("\n"
- "}\n"
- "Loader {\n"
- " id: %2\n"
- " sourceComponent: %1\n"
- "}\n").arg(componentId, loaderId));
+ QString::fromLatin1("Component {\n"
+ " id: %1\n").arg(componentId));
+ changes.insert(objDefEnd, QString::fromLatin1("\n"
+ "}\n"
+ "Loader {\n"
+ " id: %2\n"
+ " sourceComponent: %1\n"
+ "}\n").arg(componentId, loaderId));
currentFile->setChangeSet(changes);
currentFile->appendIndentRange(Range(objDefStart, objDefEnd));
currentFile->apply();
diff --git a/src/plugins/qmljseditor/qmloutlinemodel.cpp b/src/plugins/qmljseditor/qmloutlinemodel.cpp
index 2a8049d81d..eca23c7e4f 100644
--- a/src/plugins/qmljseditor/qmloutlinemodel.cpp
+++ b/src/plugins/qmljseditor/qmloutlinemodel.cpp
@@ -308,7 +308,7 @@ QmlOutlineModel::QmlOutlineModel(QmlJSTextEditorWidget *editor) :
{
m_icons = Icons::instance();
const QString resourcePath = Core::ICore::resourcePath();
- Icons::instance()->setIconFilesPath(resourcePath + "/qmlicons");
+ Icons::instance()->setIconFilesPath(resourcePath + QLatin1String("/qmlicons"));
// TODO: Maybe add a Copy Action?
setSupportedDragActions(Qt::MoveAction);
@@ -588,7 +588,7 @@ QModelIndex QmlOutlineModel::enterTestCase(AST::ObjectLiteral *objectLiteral)
{
QMap<int, QVariant> objectData;
- objectData.insert(Qt::DisplayRole, "testcase");
+ objectData.insert(Qt::DisplayRole, QLatin1String("testcase"));
objectData.insert(ItemTypeRole, ElementBindingType);
QmlOutlineItem *item = enterNode(objectData, objectLiteral, 0, m_icons->objectDefinitionIcon());
@@ -940,9 +940,9 @@ QIcon QmlOutlineModel::getIcon(AST::UiQualifiedId *qualifiedId) {
name = name.split(QLatin1Char('.')).last();
// TODO: get rid of namespace prefixes.
- icon = m_icons->icon("Qt", name);
+ icon = m_icons->icon(QLatin1String("Qt"), name);
if (icon.isNull())
- icon = m_icons->icon("QtWebkit", name);
+ icon = m_icons->icon(QLatin1String("QtWebkit"), name);
}
return icon;
}
@@ -950,14 +950,14 @@ QIcon QmlOutlineModel::getIcon(AST::UiQualifiedId *qualifiedId) {
QString QmlOutlineModel::getAnnotation(AST::UiObjectInitializer *objectInitializer) {
const QHash<QString,QString> bindings = getScriptBindings(objectInitializer);
- if (bindings.contains("id"))
- return bindings.value("id");
+ if (bindings.contains(QLatin1String("id")))
+ return bindings.value(QLatin1String("id"));
- if (bindings.contains("name"))
- return bindings.value("name");
+ if (bindings.contains(QLatin1String("name")))
+ return bindings.value(QLatin1String("name"));
- if (bindings.contains("target"))
- return bindings.value("target");
+ if (bindings.contains(QLatin1String("target")))
+ return bindings.value(QLatin1String("target"));
return QString();
}
diff --git a/src/plugins/qmljseditor/quicktoolbar.cpp b/src/plugins/qmljseditor/quicktoolbar.cpp
index 0b06993582..dfcff6417c 100644
--- a/src/plugins/qmljseditor/quicktoolbar.cpp
+++ b/src/plugins/qmljseditor/quicktoolbar.cpp
@@ -151,7 +151,7 @@ void QuickToolBar::apply(TextEditor::BaseTextEditor *editor, Document::Ptr docum
m_prototypes.append(object->className());
}
- if (m_prototypes.contains("PropertyChanges")) {
+ if (m_prototypes.contains(QLatin1String("PropertyChanges"))) {
isPropertyChanges = true;
const ObjectValue *targetObject = getPropertyChangesTarget(node, *scopeChain);
m_prototypes.clear();
@@ -277,15 +277,15 @@ bool QuickToolBar::isAvailable(TextEditor::BaseTextEditor *, Document::Ptr docum
QStringList prototypes;
prototypes.append(name);
- if (prototypes.contains("Rectangle") ||
- prototypes.contains("Image") ||
- prototypes.contains("BorderImage") ||
- prototypes.contains("TextEdit") ||
- prototypes.contains("TextInput") ||
- prototypes.contains("PropertyAnimation") ||
- prototypes.contains("NumberAnimation") ||
- prototypes.contains("Text") ||
- prototypes.contains("PropertyChanges"))
+ if (prototypes.contains(QLatin1String("Rectangle")) ||
+ prototypes.contains(QLatin1String("Image")) ||
+ prototypes.contains(QLatin1String("BorderImage")) ||
+ prototypes.contains(QLatin1String("TextEdit")) ||
+ prototypes.contains(QLatin1String("TextInput")) ||
+ prototypes.contains(QLatin1String("PropertyAnimation")) ||
+ prototypes.contains(QLatin1String("NumberAnimation")) ||
+ prototypes.contains(QLatin1String("Text")) ||
+ prototypes.contains(QLatin1String("PropertyChanges")))
return true;
return false;
@@ -296,7 +296,7 @@ void QuickToolBar::setProperty(const QString &propertyName, const QVariant &valu
QString stringValue = value.toString();
if (value.type() == QVariant::Color)
- stringValue = QChar('\"') + value.toString() + QChar('\"');
+ stringValue = QLatin1Char('\"') + value.toString() + QLatin1Char('\"');
if (cast<UiObjectDefinition*>(m_node) || cast<UiObjectBinding*>(m_node)) {
UiObjectDefinition *objectDefinition = cast<UiObjectDefinition*>(m_node);
@@ -316,7 +316,7 @@ void QuickToolBar::setProperty(const QString &propertyName, const QVariant &valu
Rewriter::BindingType bindingType = Rewriter::ScriptBinding;
- if (stringValue.contains("{") && stringValue.contains("}"))
+ if (stringValue.contains(QLatin1Char('{')) && stringValue.contains(QLatin1Char('}')))
bindingType = Rewriter::ObjectBinding;
PropertyReader propertyReader(m_doc, initializer);