C++ editor: Normalize line endings for find usages

Find usages and related rely on functions that assume \n as line
ending. This is true for the preprocessed files, but not for the
original sources.

Change-Id: I61b7e05c0116504d11c7df4b1aa10d519b705336
Reviewed-on: http://codereview.qt.nokia.com/260
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@nokia.com>
This commit is contained in:
Leandro Melo
2011-05-31 10:58:23 +02:00
committed by Erik Verbruggen
parent c29552260c
commit 743b5b7431
2 changed files with 4 additions and 4 deletions

View File

@@ -79,7 +79,7 @@ static QString getSource(const QString &fileName,
return workingCopy.source(fileName); return workingCopy.source(fileName);
} else { } else {
Utils::FileReader reader; Utils::FileReader reader;
if (!reader.fetch(fileName)) // ### FIXME error reporting if (!reader.fetch(fileName, QFile::Text)) // ### FIXME error reporting
return QString(); return QString();
return QString::fromLocal8Bit(reader.data()); // ### FIXME encoding return QString::fromLocal8Bit(reader.data()); // ### FIXME encoding

View File

@@ -68,7 +68,7 @@ void UiCodeModelSupport::init() const
QDateTime uiHeaderTime = uiHeaderFileInfo.exists() ? uiHeaderFileInfo.lastModified() : QDateTime(); QDateTime uiHeaderTime = uiHeaderFileInfo.exists() ? uiHeaderFileInfo.lastModified() : QDateTime();
if (uiHeaderTime.isValid() && (uiHeaderTime > sourceTime)) { if (uiHeaderTime.isValid() && (uiHeaderTime > sourceTime)) {
QFile file(m_fileName); QFile file(m_fileName);
if (file.open(QFile::ReadOnly)) { if (file.open(QFile::ReadOnly | QFile::Text)) {
if (debug) if (debug)
qDebug()<<"ui*h file is more recent then source file, using information from ui*h file"<<m_fileName; qDebug()<<"ui*h file is more recent then source file, using information from ui*h file"<<m_fileName;
QTextStream stream(&file); QTextStream stream(&file);
@@ -81,7 +81,7 @@ void UiCodeModelSupport::init() const
if (debug) if (debug)
qDebug()<<"ui*h file not found, or not recent enough, trying to create it on the fly"; qDebug()<<"ui*h file not found, or not recent enough, trying to create it on the fly";
QFile file(m_sourceName); QFile file(m_sourceName);
if (file.open(QFile::ReadOnly)) { if (file.open(QFile::ReadOnly | QFile::Text)) {
QTextStream stream(&file); QTextStream stream(&file);
const QString contents = stream.readAll(); const QString contents = stream.readAll();
if (runUic(contents)) { if (runUic(contents)) {
@@ -189,7 +189,7 @@ void UiCodeModelSupport::updateFromBuild()
qDebug()<<"found ui*h updating from it"; qDebug()<<"found ui*h updating from it";
QFile file(m_fileName); QFile file(m_fileName);
if (file.open(QFile::ReadOnly)) { if (file.open(QFile::ReadOnly | QFile::Text)) {
QTextStream stream(&file); QTextStream stream(&file);
m_contents = stream.readAll().toUtf8(); m_contents = stream.readAll().toUtf8();
m_cacheTime = uiHeaderTime; m_cacheTime = uiHeaderTime;