Commit 75a37282 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Friedemann Kleint
Browse files

QmlJSTools: Compile with QT_NO_CAST_FROM_ASCII



Change-Id: I370075ce75682ea11790a8f91339a01fb3c247f9
Reviewed-by: default avatarFriedemann Kleint <Friedemann.Kleint@digia.com>
parent cdf5a10d
......@@ -198,12 +198,12 @@ void QmlJSCodeStyleSettingsPage::apply()
if (originalTabPreferences->tabSettings() != m_pageTabPreferences->tabSettings()) {
originalTabPreferences->setTabSettings(m_pageTabPreferences->tabSettings());
if (s)
originalTabPreferences->toSettings(QmlJSTools::Constants::QML_JS_SETTINGS_ID, s);
originalTabPreferences->toSettings(QLatin1String(QmlJSTools::Constants::QML_JS_SETTINGS_ID), s);
}
if (originalTabPreferences->currentDelegate() != m_pageTabPreferences->currentDelegate()) {
originalTabPreferences->setCurrentDelegate(m_pageTabPreferences->currentDelegate());
if (s)
originalTabPreferences->toSettings(QmlJSTools::Constants::QML_JS_SETTINGS_ID, s);
originalTabPreferences->toSettings(QLatin1String(QmlJSTools::Constants::QML_JS_SETTINGS_ID), s);
}
}
}
......
......@@ -282,7 +282,7 @@ protected:
// and the expression
const Token begin = translationUnit()->tokenAt(typeId->firstToken());
const Token last = translationUnit()->tokenAt(typeId->lastToken() - 1);
exportedType.typeExpression = _doc->utf8Source().mid(begin.begin(), last.end() - begin.begin());
exportedType.typeExpression = QString::fromUtf8(_doc->utf8Source().mid(begin.begin(), last.end() - begin.begin()));
_exportedTypes += exportedType;
......@@ -410,12 +410,12 @@ private:
{
const Token firstToken = translationUnit()->tokenAt(first);
const Token lastToken = translationUnit()->tokenAt(last);
return _doc->utf8Source().mid(firstToken.begin(), lastToken.end() - firstToken.begin());
return QString::fromUtf8(_doc->utf8Source().mid(firstToken.begin(), lastToken.end() - firstToken.begin()));
}
QString stringOf(const Token &token)
{
return _doc->utf8Source().mid(token.begin(), token.length());
return QString::fromUtf8(_doc->utf8Source().mid(token.begin(), token.length()));
}
ExpressionAST *skipStringCall(ExpressionAST *exp)
......
......@@ -70,7 +70,7 @@ QList<Locator::FilterEntry> FunctionFilter::matchesFor(QFutureInterface<Locator:
QRegExp regexp(asterisk + entry+ asterisk, Qt::CaseInsensitive, QRegExp::Wildcard);
if (!regexp.isValid())
return goodEntries;
bool hasWildcard = (entry.contains(asterisk) || entry.contains('?'));
bool hasWildcard = (entry.contains(asterisk) || entry.contains(QLatin1Char('?')));
QHashIterator<QString, QList<LocatorData::Entry> > it(m_data->entries());
while (it.hasNext()) {
......
......@@ -82,7 +82,7 @@ public:
protected:
QString contextString(const QString &extra)
{
return QString("%1, %2").arg(extra, m_documentContext);
return QString::fromLatin1("%1, %2").arg(extra, m_documentContext);
}
LocatorData::Entry basicEntry(SourceLocation loc)
......@@ -130,7 +130,7 @@ protected:
m_entries += entry;
accept(ast->body, contextString(QString("function %1").arg(entry.displayName)));
accept(ast->body, contextString(QString::fromLatin1("function %1").arg(entry.displayName)));
return false;
}
......@@ -159,7 +159,7 @@ protected:
QString context = toString(ast->qualifiedTypeNameId);
const QString id = idOfObject(ast);
if (!id.isEmpty())
context = QString("%1 (%2)").arg(id, context);
context = QString::fromLatin1("%1 (%2)").arg(id, context);
accept(ast->initializer, contextString(context));
return false;
}
......@@ -172,7 +172,7 @@ protected:
QString context = toString(ast->qualifiedTypeNameId);
const QString id = idOfObject(ast);
if (!id.isEmpty())
context = QString("%1 (%2)").arg(id, context);
context = QString::fromLatin1("%1 (%2)").arg(id, context);
accept(ast->initializer, contextString(context));
return false;
}
......
......@@ -72,17 +72,17 @@ static QStringList environmentImportPaths();
QmlJS::Document::Language QmlJSTools::languageOfFile(const QString &fileName)
{
QStringList jsSuffixes("js");
QStringList qmlSuffixes("qml");
QStringList jsonSuffixes("json");
QStringList jsSuffixes(QLatin1String("js"));
QStringList qmlSuffixes(QLatin1String("qml"));
QStringList jsonSuffixes(QLatin1String("json"));
if (Core::ICore::instance()) {
Core::MimeDatabase *db = Core::ICore::mimeDatabase();
Core::MimeType jsSourceTy = db->findByType(Constants::JS_MIMETYPE);
Core::MimeType jsSourceTy = db->findByType(QLatin1String(Constants::JS_MIMETYPE));
jsSuffixes = jsSourceTy.suffixes();
Core::MimeType qmlSourceTy = db->findByType(Constants::QML_MIMETYPE);
Core::MimeType qmlSourceTy = db->findByType(QLatin1String(Constants::QML_MIMETYPE));
qmlSuffixes = qmlSourceTy.suffixes();
Core::MimeType jsonSourceTy = db->findByType(Constants::JSON_MIMETYPE);
Core::MimeType jsonSourceTy = db->findByType(QLatin1String(Constants::JSON_MIMETYPE));
jsonSuffixes = jsonSourceTy.suffixes();
}
......@@ -102,8 +102,8 @@ QStringList QmlJSTools::qmlAndJsGlobPatterns()
QStringList pattern;
if (Core::ICore::instance()) {
Core::MimeDatabase *db = Core::ICore::mimeDatabase();
Core::MimeType jsSourceTy = db->findByType(Constants::JS_MIMETYPE);
Core::MimeType qmlSourceTy = db->findByType(Constants::QML_MIMETYPE);
Core::MimeType jsSourceTy = db->findByType(QLatin1String(Constants::JS_MIMETYPE));
Core::MimeType qmlSourceTy = db->findByType(QLatin1String(Constants::QML_MIMETYPE));
QStringList pattern;
foreach (const Core::MimeGlobPattern &glob, jsSourceTy.globPatterns())
......@@ -111,7 +111,7 @@ QStringList QmlJSTools::qmlAndJsGlobPatterns()
foreach (const Core::MimeGlobPattern &glob, qmlSourceTy.globPatterns())
pattern << glob.regExp().pattern();
} else {
pattern << "*.qml" << "*.js";
pattern << QLatin1String("*.qml") << QLatin1String("*.js");
}
return pattern;
}
......@@ -268,7 +268,7 @@ QFuture<void> ModelManager::refreshSourceFiles(const QStringList &sourceFiles,
if (sourceFiles.count() > 1) {
Core::ICore::progressManager()->addTask(result, tr("Indexing"),
Constants::TASK_INDEX);
QLatin1String(Constants::TASK_INDEX));
}
return result;
......@@ -504,7 +504,7 @@ static void findNewQmlLibrary(
QSet<QString> *scannedPaths,
QSet<QString> *newLibraries)
{
QString libraryPath = QString("%1.%2.%3").arg(
QString libraryPath = QString::fromLatin1("%1.%2.%3").arg(
path,
QString::number(version.majorVersion()),
QString::number(version.minorVersion()));
......@@ -512,7 +512,7 @@ static void findNewQmlLibrary(
libraryPath, snapshot, modelManager,
importedFiles, scannedPaths, newLibraries);
libraryPath = QString("%1.%2").arg(
libraryPath = QString::fromLatin1("%1.%2").arg(
path,
QString::number(version.majorVersion()));
findNewQmlLibraryInPath(
......
......@@ -135,7 +135,7 @@ static QString makeAbsolute(const QString &path, const QString &base)
{
if (QFileInfo(path).isAbsolute())
return path;
return QString("%1%2%3").arg(base, QDir::separator(), path);
return QString::fromLatin1("%1%2%3").arg(base, QDir::separator(), path);
}
void PluginDumper::onLoadPluginTypes(const QString &libraryPath, const QString &importPath, const QString &importUri, const QString &importVersion)
......@@ -269,7 +269,7 @@ void PluginDumper::qmlPluginTypeDumpDone(int exitCode)
if (exitCode != 0) {
Core::MessageManager *messageManager = Core::MessageManager::instance();
const QString errorMessages = process->readAllStandardError();
const QString errorMessages = QString::fromLocal8Bit(process->readAllStandardError());
messageManager->printToOutputPane(qmldumpErrorMessage(libraryPath, errorMessages));
libraryInfo.setPluginTypeInfoStatus(LibraryInfo::DumpError, qmldumpFailedMessage(libraryPath, errorMessages));
}
......@@ -309,7 +309,7 @@ void PluginDumper::qmlPluginTypeDumpError(QProcess::ProcessError)
return;
Core::MessageManager *messageManager = Core::MessageManager::instance();
const QString errorMessages = process->readAllStandardError();
const QString errorMessages = QString::fromLocal8Bit(process->readAllStandardError());
messageManager->printToOutputPane(qmldumpErrorMessage(libraryPath, errorMessages));
if (!libraryPath.isEmpty()) {
......
......@@ -160,14 +160,14 @@ QmlJS::AST::Node *SemanticInfo::declaringMemberNoProperties(int cursorPosition)
QList<AST::Node *> path = rangePath(cursorPosition);
if (path.size() > 1)
return path.at(path.size() - 2);
} else if (name.contains("GradientStop")) {
} else if (name.contains(QLatin1String("GradientStop"))) {
QList<AST::Node *> path = rangePath(cursorPosition);
if (path.size() > 2)
return path.at(path.size() - 3);
}
} else if (UiObjectBinding *objectBinding = cast<UiObjectBinding*>(node)) {
const QString &name = objectBinding->qualifiedTypeNameId->name.toString();
if (name.contains("Gradient")) {
if (name.contains(QLatin1String("Gradient"))) {
QList<AST::Node *> path = rangePath(cursorPosition);
if (path.size() > 1)
return path.at(path.size() - 2);
......
......@@ -3,8 +3,7 @@ TARGET = QmlJSTools
include(../../qtcreatorplugin.pri)
include(qmljstools_dependencies.pri)
# DEFINES += QT_NO_CAST_FROM_ASCII
DEFINES += QT_NO_CAST_TO_ASCII
DEFINES += QT_NO_CAST_FROM_ASCII
DEFINES += QMLJSTOOLS_LIBRARY
!dll {
......
......@@ -18,7 +18,7 @@ QtcPlugin {
Depends { name: "QtSupport" }
Depends { name: "cpp" }
cpp.defines: base.concat(["QT_NO_CAST_TO_ASCII"])
cpp.defines: base.concat(["QT_NO_CAST_FROM_ASCII"])
cpp.includePaths: base.concat("../../libs/3rdparty")
files: [
......
......@@ -132,14 +132,14 @@ ExtensionSystem::IPlugin::ShutdownFlag QmlJSToolsPlugin::aboutToShutdown()
void QmlJSToolsPlugin::onTaskStarted(const QString &type)
{
if (type == QmlJSTools::Constants::TASK_INDEX) {
if (type == QLatin1String(QmlJSTools::Constants::TASK_INDEX)) {
m_resetCodeModelAction->setEnabled(false);
}
}
void QmlJSToolsPlugin::onAllTasksFinished(const QString &type)
{
if (type == QmlJSTools::Constants::TASK_INDEX) {
if (type == QLatin1String(QmlJSTools::Constants::TASK_INDEX)) {
m_resetCodeModelAction->setEnabled(true);
}
}
......
......@@ -69,7 +69,7 @@ QmlJSToolsSettings::QmlJSToolsSettings(QObject *parent)
m_globalCodeStyle = new SimpleCodeStylePreferences(this);
m_globalCodeStyle->setDelegatingPool(pool);
m_globalCodeStyle->setDisplayName(tr("Global", "Settings"));
m_globalCodeStyle->setId(idKey);
m_globalCodeStyle->setId(QLatin1String(idKey));
pool->addCodeStyle(m_globalCodeStyle);
textEditorSettings->registerCodeStyle(QmlJSTools::Constants::QML_JS_SETTINGS_ID, m_globalCodeStyle);
......@@ -94,7 +94,7 @@ QmlJSToolsSettings::QmlJSToolsSettings(QObject *parent)
// load global settings (after built-in settings are added to the pool)
QSettings *s = Core::ICore::settings();
m_globalCodeStyle->fromSettings(QmlJSTools::Constants::QML_JS_SETTINGS_ID, s);
m_globalCodeStyle->fromSettings(QLatin1String(QmlJSTools::Constants::QML_JS_SETTINGS_ID), s);
// legacy handling start (Qt Creator Version < 2.4)
const bool legacyTransformed =
......@@ -129,7 +129,7 @@ QmlJSToolsSettings::QmlJSToolsSettings(QObject *parent)
// change the current delegate and save
m_globalCodeStyle->setCurrentDelegate(oldCreator);
m_globalCodeStyle->toSettings(QmlJSTools::Constants::QML_JS_SETTINGS_ID, s);
m_globalCodeStyle->toSettings(QLatin1String(QmlJSTools::Constants::QML_JS_SETTINGS_ID), s);
}
// mark old settings as transformed
s->setValue(QLatin1String("QmlJSTabPreferences/LegacyTransformed"), true);
......
Supports Markdown
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