ProParser: Use the "Default Codec" when reading qmake files

This change adds a QTextCodec* member to QMakeVfs. It is used to decode
the qmake file contents in QMakeVfs::readFile. The QMakeProjectManager
sets it to the current "Default Codec".

This is necessary only in Qt Creator, where the parser would actually
use Local8Bit (unlike qmake's Latin1), which would sometimes lead to
misinterpreted multi-byte chars in comments swallowing newlines and thus
falsifying the actual code.

Bootstrapped qmake is not affected by this addition.

Task-number: QTCREATORBUG-17309
Change-Id: I34b42bd19e0de973deb2291e91f306d1ca7c630e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
Alessandro Portale
2016-11-30 18:26:44 +01:00
parent a228ad7e49
commit 15148d8e44
3 changed files with 34 additions and 1 deletions

View File

@@ -35,6 +35,7 @@
#include "findqmakeprofiles.h"
#include <utils/algorithm.h>
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/icontext.h>
#include <coreplugin/icore.h>
#include <coreplugin/progressmanager/progressmanager.h>
@@ -263,6 +264,9 @@ QmakeProject::QmakeProject(QmakeManager *manager, const QString &fileName) :
setProjectLanguages(Core::Context(ProjectExplorer::Constants::LANG_CXX));
setRequiredKitMatcher(QtSupport::QtKitInformation::qtVersionMatcher());
const QTextCodec *codec = Core::EditorManager::defaultTextCodec();
m_qmakeVfs->setTextCodec(codec);
m_asyncUpdateTimer.setSingleShot(true);
m_asyncUpdateTimer.setInterval(3000);
connect(&m_asyncUpdateTimer, &QTimer::timeout, this, &QmakeProject::asyncUpdate);