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