TaskList: Compile with QT_NO_CAST_FROM_ASCII

Change-Id: I63b440e0c59bb7bfa2c4fec5877dc873c09344ab
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
Orgad Shaneh
2012-11-26 20:44:02 +02:00
committed by Tobias Hunger
parent 5df4732f35
commit ac229fd317
3 changed files with 14 additions and 10 deletions

View File

@@ -5,6 +5,8 @@ include(../../qtcreatorplugin.pri)
include(../../plugins/coreplugin/coreplugin.pri) include(../../plugins/coreplugin/coreplugin.pri)
include(../../plugins/projectexplorer/projectexplorer.pri) include(../../plugins/projectexplorer/projectexplorer.pri)
DEFINES += QT_NO_CAST_FROM_ASCII
HEADERS += tasklistplugin.h \ HEADERS += tasklistplugin.h \
tasklist_export.h \ tasklist_export.h \
tasklistconstants.h \ tasklistconstants.h \

View File

@@ -5,12 +5,14 @@ import "../QtcPlugin.qbs" as QtcPlugin
QtcPlugin { QtcPlugin {
name: "TaskList" name: "TaskList"
Depends { name: "cpp" }
Depends { name: "Qt.widgets" } Depends { name: "Qt.widgets" }
Depends { name: "Core" } Depends { name: "Core" }
Depends { name: "ProjectExplorer" } Depends { name: "ProjectExplorer" }
Depends { name: "Find" } Depends { name: "Find" }
Depends { name: "Locator" } Depends { name: "Locator" }
Depends { name: "TextEditor" } Depends { name: "TextEditor" }
cpp.defines: base.concat(["QT_NO_CAST_FROM_ASCII"])
files: [ files: [
"TaskList.mimetypes.xml", "TaskList.mimetypes.xml",

View File

@@ -112,7 +112,7 @@ public:
file = QDir::fromNativeSeparators(file); file = QDir::fromNativeSeparators(file);
QFileInfo fi(file); QFileInfo fi(file);
if (fi.isRelative() && context) { if (fi.isRelative() && context) {
QString fullPath = context->projectDirectory() + '/' + file; QString fullPath = context->projectDirectory() + QLatin1Char('/') + file;
fi.setFile(fullPath); fi.setFile(fullPath);
file = fi.absoluteFilePath(); file = fi.absoluteFilePath();
} }
@@ -130,29 +130,29 @@ public:
{ {
QStringList result; QStringList result;
QString line = QString::fromUtf8(raw.constData()); QString line = QString::fromUtf8(raw.constData());
if (line.startsWith(QChar('#'))) if (line.startsWith(QLatin1Char('#')))
return result; return result;
return line.split(QChar('\t')); return line.split(QLatin1Char('\t'));
} }
QString unescape(const QString &input) const QString unescape(const QString &input) const
{ {
QString result; QString result;
for (int i = 0; i < input.count(); ++i) { for (int i = 0; i < input.count(); ++i) {
if (input.at(i) == QChar('\\')) { if (input.at(i) == QLatin1Char('\\')) {
if (i == input.count() - 1) if (i == input.count() - 1)
continue; continue;
if (input.at(i + 1) == QChar('n')) { if (input.at(i + 1) == QLatin1Char('n')) {
result.append(QChar('\n')); result.append(QLatin1Char('\n'));
++i; ++i;
continue; continue;
} else if (input.at(i + 1) == QChar('t')) { } else if (input.at(i + 1) == QLatin1Char('t')) {
result.append(QChar('\t')); result.append(QLatin1Char('\t'));
++i; ++i;
continue; continue;
} else if (input.at(i + 1) == QChar('\\')) { } else if (input.at(i + 1) == QLatin1Char('\\')) {
result.append(QChar('\\')); result.append(QLatin1Char('\\'));
++i; ++i;
continue; continue;
} }