Skip to content
Snippets Groups Projects
Commit 743b5b74 authored by Leandro Melo's avatar Leandro Melo Committed by Erik Verbruggen
Browse files

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: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@nokia.com>
parent c2955226
Branches
Tags
No related merge requests found
...@@ -79,7 +79,7 @@ static QString getSource(const QString &fileName, ...@@ -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
......
...@@ -68,7 +68,7 @@ void UiCodeModelSupport::init() const ...@@ -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 ...@@ -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() ...@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment