forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/4.5'
Conflicts: qbs/modules/qtc/qtc.qbs qtcreator.pri Change-Id: I29979e76cb01bc94ddcd7868ca1cbc34afb14c5d
This commit is contained in:
@@ -51,7 +51,11 @@ class BaseTreeViewPrivate : public QObject
|
|||||||
public:
|
public:
|
||||||
explicit BaseTreeViewPrivate(BaseTreeView *parent)
|
explicit BaseTreeViewPrivate(BaseTreeView *parent)
|
||||||
: q(parent), m_settings(0), m_expectUserChanges(false), m_progressIndicator(0)
|
: q(parent), m_settings(0), m_expectUserChanges(false), m_progressIndicator(0)
|
||||||
{}
|
{
|
||||||
|
m_settingsTimer.setSingleShot(true);
|
||||||
|
connect(&m_settingsTimer, &QTimer::timeout,
|
||||||
|
this, &BaseTreeViewPrivate::doSaveState);
|
||||||
|
}
|
||||||
|
|
||||||
bool eventFilter(QObject *, QEvent *event)
|
bool eventFilter(QObject *, QEvent *event)
|
||||||
{
|
{
|
||||||
@@ -102,6 +106,12 @@ public:
|
|||||||
|
|
||||||
void saveState()
|
void saveState()
|
||||||
{
|
{
|
||||||
|
m_settingsTimer.start(2000); // Once per 2 secs should be enough.
|
||||||
|
}
|
||||||
|
|
||||||
|
void doSaveState()
|
||||||
|
{
|
||||||
|
m_settingsTimer.stop();
|
||||||
if (m_settings && !m_settingsKey.isEmpty()) {
|
if (m_settings && !m_settingsKey.isEmpty()) {
|
||||||
m_settings->beginGroup(m_settingsKey);
|
m_settings->beginGroup(m_settingsKey);
|
||||||
QVariantList l;
|
QVariantList l;
|
||||||
@@ -210,6 +220,7 @@ public:
|
|||||||
BaseTreeView *q;
|
BaseTreeView *q;
|
||||||
QMap<int, int> m_userHandled; // column -> width, "not present" means "automatic"
|
QMap<int, int> m_userHandled; // column -> width, "not present" means "automatic"
|
||||||
QSettings *m_settings;
|
QSettings *m_settings;
|
||||||
|
QTimer m_settingsTimer;
|
||||||
QString m_settingsKey;
|
QString m_settingsKey;
|
||||||
bool m_expectUserChanges;
|
bool m_expectUserChanges;
|
||||||
ProgressIndicator *m_progressIndicator;
|
ProgressIndicator *m_progressIndicator;
|
||||||
|
@@ -1347,6 +1347,22 @@ void DiffEditor::Internal::DiffEditorPlugin::testReadPatch_data()
|
|||||||
QTest::newRow("Binary files") << patch
|
QTest::newRow("Binary files") << patch
|
||||||
<< fileDataList8;
|
<< fileDataList8;
|
||||||
|
|
||||||
|
//////////////
|
||||||
|
patch = _("diff --git a/script.sh b/script.sh\n"
|
||||||
|
"old mode 100644\n"
|
||||||
|
"new mode 100755\n"
|
||||||
|
);
|
||||||
|
|
||||||
|
fileData1 = FileData();
|
||||||
|
fileData1.leftFileInfo = DiffFileInfo("script.sh");
|
||||||
|
fileData1.rightFileInfo = DiffFileInfo("script.sh");
|
||||||
|
fileData1.fileOperation = FileData::ChangeMode;
|
||||||
|
|
||||||
|
QList<FileData> fileDataList9;
|
||||||
|
fileDataList9 << fileData1;
|
||||||
|
|
||||||
|
QTest::newRow("Mode change") << patch << fileDataList9;
|
||||||
|
|
||||||
//////////////
|
//////////////
|
||||||
|
|
||||||
// Subversion New
|
// Subversion New
|
||||||
@@ -1362,10 +1378,10 @@ void DiffEditor::Internal::DiffEditorPlugin::testReadPatch_data()
|
|||||||
chunkData1.leftStartingLineNumber = -1;
|
chunkData1.leftStartingLineNumber = -1;
|
||||||
chunkData1.rightStartingLineNumber = 124;
|
chunkData1.rightStartingLineNumber = 124;
|
||||||
fileData1.chunks << chunkData1;
|
fileData1.chunks << chunkData1;
|
||||||
QList<FileData> fileDataList9;
|
QList<FileData> fileDataList21;
|
||||||
fileDataList9 << fileData1;
|
fileDataList21 << fileData1;
|
||||||
QTest::newRow("Subversion New") << patch
|
QTest::newRow("Subversion New") << patch
|
||||||
<< fileDataList9;
|
<< fileDataList21;
|
||||||
|
|
||||||
//////////////
|
//////////////
|
||||||
|
|
||||||
@@ -1382,10 +1398,10 @@ void DiffEditor::Internal::DiffEditorPlugin::testReadPatch_data()
|
|||||||
chunkData1.leftStartingLineNumber = 0;
|
chunkData1.leftStartingLineNumber = 0;
|
||||||
chunkData1.rightStartingLineNumber = -1;
|
chunkData1.rightStartingLineNumber = -1;
|
||||||
fileData1.chunks << chunkData1;
|
fileData1.chunks << chunkData1;
|
||||||
QList<FileData> fileDataList10;
|
QList<FileData> fileDataList22;
|
||||||
fileDataList10 << fileData1;
|
fileDataList22 << fileData1;
|
||||||
QTest::newRow("Subversion Deleted") << patch
|
QTest::newRow("Subversion Deleted") << patch
|
||||||
<< fileDataList10;
|
<< fileDataList22;
|
||||||
|
|
||||||
//////////////
|
//////////////
|
||||||
|
|
||||||
@@ -1402,10 +1418,10 @@ void DiffEditor::Internal::DiffEditorPlugin::testReadPatch_data()
|
|||||||
chunkData1.leftStartingLineNumber = 119;
|
chunkData1.leftStartingLineNumber = 119;
|
||||||
chunkData1.rightStartingLineNumber = 119;
|
chunkData1.rightStartingLineNumber = 119;
|
||||||
fileData1.chunks << chunkData1;
|
fileData1.chunks << chunkData1;
|
||||||
QList<FileData> fileDataList11;
|
QList<FileData> fileDataList23;
|
||||||
fileDataList11 << fileData1;
|
fileDataList23 << fileData1;
|
||||||
QTest::newRow("Subversion Normal") << patch
|
QTest::newRow("Subversion Normal") << patch
|
||||||
<< fileDataList11;
|
<< fileDataList23;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiffEditor::Internal::DiffEditorPlugin::testReadPatch()
|
void DiffEditor::Internal::DiffEditorPlugin::testReadPatch()
|
||||||
|
@@ -1025,10 +1025,16 @@ static bool detectIndexAndBinary(QStringRef patch,
|
|||||||
bool hasNewLine;
|
bool hasNewLine;
|
||||||
*remainingPatch = patch;
|
*remainingPatch = patch;
|
||||||
|
|
||||||
if (remainingPatch->isEmpty() && (fileData->fileOperation == FileData::CopyFile
|
if (remainingPatch->isEmpty()) {
|
||||||
|| fileData->fileOperation == FileData::RenameFile)) {
|
switch (fileData->fileOperation) {
|
||||||
// in case of 100% similarity we don't have more lines in the patch
|
case FileData::CopyFile:
|
||||||
return true;
|
case FileData::RenameFile:
|
||||||
|
case FileData::ChangeMode:
|
||||||
|
// in case of 100% similarity we don't have more lines in the patch
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringRef afterNextLine;
|
QStringRef afterNextLine;
|
||||||
@@ -1151,8 +1157,6 @@ static bool detectFileData(QStringRef patch,
|
|||||||
|
|
||||||
QStringRef afterSecondLine;
|
QStringRef afterSecondLine;
|
||||||
const QStringRef secondLine = readLine(afterDiffGit, &afterSecondLine, &hasNewLine);
|
const QStringRef secondLine = readLine(afterDiffGit, &afterSecondLine, &hasNewLine);
|
||||||
if (!hasNewLine)
|
|
||||||
return false; // we need to have at least one more line
|
|
||||||
|
|
||||||
if (secondLine.startsWith(QStringLiteral("new file mode "))) {
|
if (secondLine.startsWith(QStringLiteral("new file mode "))) {
|
||||||
fileData->fileOperation = FileData::NewFile;
|
fileData->fileOperation = FileData::NewFile;
|
||||||
@@ -1165,7 +1169,7 @@ static bool detectFileData(QStringRef patch,
|
|||||||
// new mode
|
// new mode
|
||||||
readLine(afterSecondLine, &afterThirdLine, &hasNewLine);
|
readLine(afterSecondLine, &afterThirdLine, &hasNewLine);
|
||||||
if (!hasNewLine)
|
if (!hasNewLine)
|
||||||
return false; // we need to have at least one more line
|
fileData->fileOperation = FileData::ChangeMode;
|
||||||
|
|
||||||
// TODO: validate new mode line
|
// TODO: validate new mode line
|
||||||
*remainingPatch = afterThirdLine;
|
*remainingPatch = afterThirdLine;
|
||||||
|
@@ -104,6 +104,7 @@ class DIFFEDITOR_EXPORT FileData {
|
|||||||
public:
|
public:
|
||||||
enum FileOperation {
|
enum FileOperation {
|
||||||
ChangeFile,
|
ChangeFile,
|
||||||
|
ChangeMode,
|
||||||
NewFile,
|
NewFile,
|
||||||
DeleteFile,
|
DeleteFile,
|
||||||
CopyFile,
|
CopyFile,
|
||||||
|
@@ -1089,9 +1089,12 @@ QmakeProFile::QmakeProFile(QmakeProject *project, const FileName &filePath) :
|
|||||||
QmakeProFile::~QmakeProFile()
|
QmakeProFile::~QmakeProFile()
|
||||||
{
|
{
|
||||||
qDeleteAll(m_extraCompilers);
|
qDeleteAll(m_extraCompilers);
|
||||||
|
m_parseFutureWatcher.cancel();
|
||||||
m_parseFutureWatcher.waitForFinished();
|
m_parseFutureWatcher.waitForFinished();
|
||||||
if (m_readerExact)
|
if (m_readerExact)
|
||||||
applyAsyncEvaluate();
|
applyAsyncEvaluate();
|
||||||
|
|
||||||
|
cleanupProFileReaders();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QmakeProFile::isParent(QmakeProFile *node)
|
bool QmakeProFile::isParent(QmakeProFile *node)
|
||||||
@@ -1491,7 +1494,8 @@ void QmakeProFile::asyncEvaluate(QFutureInterface<QmakeEvalResult *> &fi, QmakeE
|
|||||||
|
|
||||||
void QmakeProFile::applyAsyncEvaluate()
|
void QmakeProFile::applyAsyncEvaluate()
|
||||||
{
|
{
|
||||||
applyEvaluate(m_parseFutureWatcher.result());
|
if (m_parseFutureWatcher.isFinished())
|
||||||
|
applyEvaluate(m_parseFutureWatcher.result());
|
||||||
m_project->decrementPendingEvaluateFutures();
|
m_project->decrementPendingEvaluateFutures();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1627,8 +1631,10 @@ void QmakeProFile::applyEvaluate(QmakeEvalResult *evalResult)
|
|||||||
|
|
||||||
void QmakeProFile::cleanupProFileReaders()
|
void QmakeProFile::cleanupProFileReaders()
|
||||||
{
|
{
|
||||||
m_project->destroyProFileReader(m_readerExact);
|
if (m_readerExact)
|
||||||
m_project->destroyProFileReader(m_readerCumulative);
|
m_project->destroyProFileReader(m_readerExact);
|
||||||
|
if (m_readerCumulative)
|
||||||
|
m_project->destroyProFileReader(m_readerCumulative);
|
||||||
|
|
||||||
m_readerExact = nullptr;
|
m_readerExact = nullptr;
|
||||||
m_readerCumulative = nullptr;
|
m_readerCumulative = nullptr;
|
||||||
|
@@ -202,6 +202,12 @@ QmakeProject::~QmakeProject()
|
|||||||
m_cancelEvaluate = true;
|
m_cancelEvaluate = true;
|
||||||
Q_ASSERT(m_qmakeGlobalsRefCnt == 0);
|
Q_ASSERT(m_qmakeGlobalsRefCnt == 0);
|
||||||
delete m_qmakeVfs;
|
delete m_qmakeVfs;
|
||||||
|
|
||||||
|
if (m_asyncUpdateFutureInterface) {
|
||||||
|
m_asyncUpdateFutureInterface->reportCanceled();
|
||||||
|
m_asyncUpdateFutureInterface->reportFinished();
|
||||||
|
delete m_asyncUpdateFutureInterface;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QmakeProFile *QmakeProject::rootProFile() const
|
QmakeProFile *QmakeProject::rootProFile() const
|
||||||
@@ -508,6 +514,9 @@ void QmakeProject::decrementPendingEvaluateFutures()
|
|||||||
{
|
{
|
||||||
--m_pendingEvaluateFuturesCount;
|
--m_pendingEvaluateFuturesCount;
|
||||||
|
|
||||||
|
if (!rootProFile())
|
||||||
|
return; // We are closing the project!
|
||||||
|
|
||||||
m_asyncUpdateFutureInterface->setProgressValue(m_asyncUpdateFutureInterface->progressValue() + 1);
|
m_asyncUpdateFutureInterface->setProgressValue(m_asyncUpdateFutureInterface->progressValue() + 1);
|
||||||
if (m_pendingEvaluateFuturesCount == 0) {
|
if (m_pendingEvaluateFuturesCount == 0) {
|
||||||
// We are done!
|
// We are done!
|
||||||
@@ -640,7 +649,7 @@ void QmakeProject::proFileParseError(const QString &errorMessage)
|
|||||||
QtSupport::ProFileReader *QmakeProject::createProFileReader(const QmakeProFile *qmakeProFile)
|
QtSupport::ProFileReader *QmakeProject::createProFileReader(const QmakeProFile *qmakeProFile)
|
||||||
{
|
{
|
||||||
if (!m_qmakeGlobals) {
|
if (!m_qmakeGlobals) {
|
||||||
m_qmakeGlobals = new QMakeGlobals;
|
m_qmakeGlobals = std::make_unique<QMakeGlobals>();
|
||||||
m_qmakeGlobalsRefCnt = 0;
|
m_qmakeGlobalsRefCnt = 0;
|
||||||
|
|
||||||
Kit *k = KitManager::defaultKit();
|
Kit *k = KitManager::defaultKit();
|
||||||
@@ -664,7 +673,7 @@ QtSupport::ProFileReader *QmakeProject::createProFileReader(const QmakeProFile *
|
|||||||
|
|
||||||
if (qtVersion && qtVersion->isValid()) {
|
if (qtVersion && qtVersion->isValid()) {
|
||||||
m_qmakeGlobals->qmake_abslocation = QDir::cleanPath(qtVersion->qmakeCommand().toString());
|
m_qmakeGlobals->qmake_abslocation = QDir::cleanPath(qtVersion->qmakeCommand().toString());
|
||||||
qtVersion->applyProperties(m_qmakeGlobals);
|
qtVersion->applyProperties(m_qmakeGlobals.get());
|
||||||
}
|
}
|
||||||
m_qmakeGlobals->setDirectories(rootProFile()->sourceDir().toString(),
|
m_qmakeGlobals->setDirectories(rootProFile()->sourceDir().toString(),
|
||||||
rootProFile()->buildDir().toString());
|
rootProFile()->buildDir().toString());
|
||||||
@@ -693,7 +702,7 @@ QtSupport::ProFileReader *QmakeProject::createProFileReader(const QmakeProFile *
|
|||||||
}
|
}
|
||||||
++m_qmakeGlobalsRefCnt;
|
++m_qmakeGlobalsRefCnt;
|
||||||
|
|
||||||
auto reader = new QtSupport::ProFileReader(m_qmakeGlobals, m_qmakeVfs);
|
auto reader = new QtSupport::ProFileReader(m_qmakeGlobals.get(), m_qmakeVfs);
|
||||||
|
|
||||||
reader->setOutputDir(qmakeProFile->buildDir().toString());
|
reader->setOutputDir(qmakeProFile->buildDir().toString());
|
||||||
|
|
||||||
@@ -702,7 +711,7 @@ QtSupport::ProFileReader *QmakeProject::createProFileReader(const QmakeProFile *
|
|||||||
|
|
||||||
QMakeGlobals *QmakeProject::qmakeGlobals()
|
QMakeGlobals *QmakeProject::qmakeGlobals()
|
||||||
{
|
{
|
||||||
return m_qmakeGlobals;
|
return m_qmakeGlobals.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
QMakeVfs *QmakeProject::qmakeVfs()
|
QMakeVfs *QmakeProject::qmakeVfs()
|
||||||
@@ -725,8 +734,7 @@ void QmakeProject::destroyProFileReader(QtSupport::ProFileReader *reader)
|
|||||||
QtSupport::ProFileCacheManager::instance()->discardFiles(dir);
|
QtSupport::ProFileCacheManager::instance()->discardFiles(dir);
|
||||||
QtSupport::ProFileCacheManager::instance()->decRefCount();
|
QtSupport::ProFileCacheManager::instance()->decRefCount();
|
||||||
|
|
||||||
delete m_qmakeGlobals;
|
m_qmakeGlobals.reset();
|
||||||
m_qmakeGlobals = nullptr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -179,7 +179,7 @@ private:
|
|||||||
QMakeVfs *m_qmakeVfs = nullptr;
|
QMakeVfs *m_qmakeVfs = nullptr;
|
||||||
|
|
||||||
// cached data during project rescan
|
// cached data during project rescan
|
||||||
QMakeGlobals *m_qmakeGlobals = nullptr;
|
std::unique_ptr<QMakeGlobals> m_qmakeGlobals;
|
||||||
int m_qmakeGlobalsRefCnt = 0;
|
int m_qmakeGlobalsRefCnt = 0;
|
||||||
|
|
||||||
QString m_qmakeSysroot;
|
QString m_qmakeSysroot;
|
||||||
|
Submodule src/shared/qbs updated: acf142851a...08ce978733
Reference in New Issue
Block a user