forked from qt-creator/qt-creator
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:
committed by
Erik Verbruggen
parent
c29552260c
commit
743b5b7431
@@ -79,7 +79,7 @@ static QString getSource(const QString &fileName,
|
||||
return workingCopy.source(fileName);
|
||||
} else {
|
||||
Utils::FileReader reader;
|
||||
if (!reader.fetch(fileName)) // ### FIXME error reporting
|
||||
if (!reader.fetch(fileName, QFile::Text)) // ### FIXME error reporting
|
||||
return QString();
|
||||
|
||||
return QString::fromLocal8Bit(reader.data()); // ### FIXME encoding
|
||||
|
@@ -68,7 +68,7 @@ void UiCodeModelSupport::init() const
|
||||
QDateTime uiHeaderTime = uiHeaderFileInfo.exists() ? uiHeaderFileInfo.lastModified() : QDateTime();
|
||||
if (uiHeaderTime.isValid() && (uiHeaderTime > sourceTime)) {
|
||||
QFile file(m_fileName);
|
||||
if (file.open(QFile::ReadOnly)) {
|
||||
if (file.open(QFile::ReadOnly | QFile::Text)) {
|
||||
if (debug)
|
||||
qDebug()<<"ui*h file is more recent then source file, using information from ui*h file"<<m_fileName;
|
||||
QTextStream stream(&file);
|
||||
@@ -81,7 +81,7 @@ void UiCodeModelSupport::init() const
|
||||
if (debug)
|
||||
qDebug()<<"ui*h file not found, or not recent enough, trying to create it on the fly";
|
||||
QFile file(m_sourceName);
|
||||
if (file.open(QFile::ReadOnly)) {
|
||||
if (file.open(QFile::ReadOnly | QFile::Text)) {
|
||||
QTextStream stream(&file);
|
||||
const QString contents = stream.readAll();
|
||||
if (runUic(contents)) {
|
||||
@@ -189,7 +189,7 @@ void UiCodeModelSupport::updateFromBuild()
|
||||
qDebug()<<"found ui*h updating from it";
|
||||
|
||||
QFile file(m_fileName);
|
||||
if (file.open(QFile::ReadOnly)) {
|
||||
if (file.open(QFile::ReadOnly | QFile::Text)) {
|
||||
QTextStream stream(&file);
|
||||
m_contents = stream.readAll().toUtf8();
|
||||
m_cacheTime = uiHeaderTime;
|
||||
|
Reference in New Issue
Block a user