Commit 9bf65474 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Fawzi Mohamed

QmlJSEditor: Compile with QT_NO_CAST_FROM_ASCII

Change-Id: I899c26e028efe355d4673b55ac9718e103c7d7ec
Reviewed-by: default avatarKai Koehne <kai.koehne@digia.com>
Reviewed-by: default avatarFawzi Mohamed <fawzi.mohamed@digia.com>
parent f5064d06
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -6,7 +6,8 @@ QT += script
DEFINES += \
QMLJSEDITOR_LIBRARY \
QT_CREATOR
QT_CREATOR \
QT_NO_CAST_FROM_ASCII
HEADERS += \
qmljseditor.h \
......
......@@ -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",
......
......@@ -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);
......
......@@ -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;
......
......@@ -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: {
......
......@@ -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());
}
......
......@@ -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();
......
......@@ -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();
......
......@@ -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();
......
......@@ -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();
}
......
......@@ -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);
......
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