Merge remote-tracking branch 'origin/4.0'

Change-Id: Ic82bea5abc6f9539044873b9872c70b3d66a642e
This commit is contained in:
Eike Ziller
2016-04-25 16:23:09 +02:00
6 changed files with 46 additions and 11 deletions

View File

@@ -70,6 +70,11 @@ const char ADD_RUNCONFIGURATION_ARGUMENT_KEY[] = "CMakeProjectManager.MakeStep.A
const char ADD_RUNCONFIGURATION_TEXT[] = "Current executable"; const char ADD_RUNCONFIGURATION_TEXT[] = "Current executable";
} }
static bool isCurrentExecutableTarget(const QString &target)
{
return target == QLatin1String(ADD_RUNCONFIGURATION_TEXT);
}
CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl) : AbstractProcessStep(bsl, Core::Id(MS_ID)) CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl) : AbstractProcessStep(bsl, Core::Id(MS_ID))
{ {
ctor(bsl); ctor(bsl);
@@ -124,9 +129,9 @@ CMakeRunConfiguration *CMakeBuildStep::targetsActiveRunConfiguration() const
void CMakeBuildStep::handleBuildTargetChanges() void CMakeBuildStep::handleBuildTargetChanges()
{ {
if (static_cast<CMakeProject *>(project())->buildTargetTitles().contains(m_buildTarget)) if (isCurrentExecutableTarget(m_buildTarget))
setBuildTarget(m_buildTarget); return; // Do not change just because a different set of build targets is there...
else if (!static_cast<CMakeProject *>(project())->buildTargetTitles().contains(m_buildTarget))
setBuildTarget(CMakeBuildStep::allTarget()); setBuildTarget(CMakeBuildStep::allTarget());
emit buildTargetsChanged(); emit buildTargetsChanged();
} }
@@ -180,7 +185,7 @@ bool CMakeBuildStep::init(QList<const BuildStep *> &earlierSteps)
} }
CMakeRunConfiguration *rc = targetsActiveRunConfiguration(); CMakeRunConfiguration *rc = targetsActiveRunConfiguration();
if ((m_buildTarget == QLatin1String(ADD_RUNCONFIGURATION_TEXT)) && (!rc || rc->title().isEmpty())) { if (isCurrentExecutableTarget(m_buildTarget) && (!rc || rc->title().isEmpty())) {
emit addTask(Task(Task::Error, emit addTask(Task(Task::Error,
QCoreApplication::translate("ProjectExplorer::Task", QCoreApplication::translate("ProjectExplorer::Task",
"You asked to build the current Run Configuration's build target only, " "You asked to build the current Run Configuration's build target only, "
@@ -332,7 +337,7 @@ QString CMakeBuildStep::allArguments(const CMakeRunConfiguration *rc) const
QString target; QString target;
if (m_buildTarget == QLatin1String(ADD_RUNCONFIGURATION_TEXT)) { if (isCurrentExecutableTarget(m_buildTarget)) {
if (rc) if (rc)
target = rc->title(); target = rc->title();
else else

View File

@@ -56,6 +56,7 @@
#include <QCoreApplication> #include <QCoreApplication>
#include <QDebug> #include <QDebug>
#include <QDir> #include <QDir>
#include <QFutureWatcher>
#include <QMutexLocker> #include <QMutexLocker>
#include <QTextBlock> #include <QTextBlock>
#include <QThreadPool> #include <QThreadPool>
@@ -131,6 +132,7 @@ public:
// Project integration // Project integration
mutable QMutex m_projectMutex; mutable QMutex m_projectMutex;
QMap<ProjectExplorer::Project *, ProjectInfo> m_projectToProjectsInfo; QMap<ProjectExplorer::Project *, ProjectInfo> m_projectToProjectsInfo;
QHash<ProjectExplorer::Project *, bool> m_projectToIndexerCanceled;
QMap<Utils::FileName, QList<ProjectPart::Ptr> > m_fileToProjectParts; QMap<Utils::FileName, QList<ProjectPart::Ptr> > m_fileToProjectParts;
QMap<QString, ProjectPart::Ptr> m_projectPartIdToProjectProjectPart; QMap<QString, ProjectPart::Ptr> m_projectPartIdToProjectProjectPart;
// The members below are cached/(re)calculated from the projects and/or their project parts // The members below are cached/(re)calculated from the projects and/or their project parts
@@ -759,6 +761,25 @@ void CppModelManager::recalculateProjectPartMappings()
d->m_symbolFinder.clearCache(); d->m_symbolFinder.clearCache();
} }
void CppModelManager::watchForCanceledProjectIndexer(QFuture<void> future,
ProjectExplorer::Project *project)
{
d->m_projectToIndexerCanceled.insert(project, false);
if (future.isCanceled() || future.isFinished())
return;
QFutureWatcher<void> *watcher = new QFutureWatcher<void>();
connect(watcher, &QFutureWatcher<void>::canceled, this, [this, project]() {
if (d->m_projectToIndexerCanceled.contains(project)) // Project not yet removed
d->m_projectToIndexerCanceled.insert(project, true);
});
connect(watcher, &QFutureWatcher<void>::finished, this, [watcher]() {
watcher->deleteLater();
});
watcher->setFuture(future);
}
void CppModelManager::updateCppEditorDocuments() const void CppModelManager::updateCppEditorDocuments() const
{ {
// Refresh visible documents // Refresh visible documents
@@ -792,16 +813,17 @@ QFuture<void> CppModelManager::updateProjectInfo(const ProjectInfo &newProjectIn
QSet<QString> filesToReindex; QSet<QString> filesToReindex;
QStringList removedProjectParts; QStringList removedProjectParts;
bool filesRemoved = false; bool filesRemoved = false;
ProjectExplorer::Project *project = newProjectInfo.project().data();
{ // Only hold the mutex for a limited scope, so the dumping afterwards does not deadlock. { // Only hold the mutex for a limited scope, so the dumping afterwards does not deadlock.
QMutexLocker projectLocker(&d->m_projectMutex); QMutexLocker projectLocker(&d->m_projectMutex);
ProjectExplorer::Project *project = newProjectInfo.project().data();
const QSet<QString> newSourceFiles = newProjectInfo.sourceFiles(); const QSet<QString> newSourceFiles = newProjectInfo.sourceFiles();
// Check if we can avoid a full reindexing // Check if we can avoid a full reindexing
ProjectInfo oldProjectInfo = d->m_projectToProjectsInfo.value(project); ProjectInfo oldProjectInfo = d->m_projectToProjectsInfo.value(project);
if (oldProjectInfo.isValid()) { const bool previousIndexerCanceled = d->m_projectToIndexerCanceled.value(project, false);
if (!previousIndexerCanceled && oldProjectInfo.isValid()) {
ProjectInfoComparer comparer(oldProjectInfo, newProjectInfo); ProjectInfoComparer comparer(oldProjectInfo, newProjectInfo);
if (comparer.configurationOrFilesChanged()) { if (comparer.configurationOrFilesChanged()) {
@@ -872,7 +894,10 @@ QFuture<void> CppModelManager::updateProjectInfo(const ProjectInfo &newProjectIn
updateCppEditorDocuments(); updateCppEditorDocuments();
// Trigger reindexing // Trigger reindexing
return updateSourceFiles(filesToReindex, ForcedProgressNotification); QFuture<void> indexerFuture = updateSourceFiles(filesToReindex, ForcedProgressNotification);
watchForCanceledProjectIndexer(indexerFuture, project);
return indexerFuture;
} }
ProjectPart::Ptr CppModelManager::projectPartForId(const QString &projectPartId) const ProjectPart::Ptr CppModelManager::projectPartForId(const QString &projectPartId) const
@@ -970,6 +995,8 @@ void CppModelManager::onAboutToRemoveProject(ProjectExplorer::Project *project)
{ {
QStringList projectPartIds; QStringList projectPartIds;
d->m_projectToIndexerCanceled.remove(project);
{ {
QMutexLocker locker(&d->m_projectMutex); QMutexLocker locker(&d->m_projectMutex);
d->m_dirty = true; d->m_dirty = true;

View File

@@ -205,6 +205,7 @@ private:
void initializeBuiltinModelManagerSupport(); void initializeBuiltinModelManagerSupport();
void delayedGC(); void delayedGC();
void recalculateProjectPartMappings(); void recalculateProjectPartMappings();
void watchForCanceledProjectIndexer(QFuture<void> future, ProjectExplorer::Project *project);
void replaceSnapshot(const CPlusPlus::Snapshot &newSnapshot); void replaceSnapshot(const CPlusPlus::Snapshot &newSnapshot);
void removeFilesFromSnapshot(const QSet<QString> &removedFiles); void removeFilesFromSnapshot(const QSet<QString> &removedFiles);

View File

@@ -48,7 +48,9 @@ using namespace Utils;
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
static const char* qtBuildPaths[] = { static const char* qtBuildPaths[] = {
"Q:/qt5_workdir/w/s", "Q:/qt5_workdir/w/s",
"C:/work/build/qt5_workdir/w/s"}; "C:/work/build/qt5_workdir/w/s",
"c:/users/qt/work/qt"
};
#elif defined(Q_OS_MAC) #elif defined(Q_OS_MAC)
static const char* qtBuildPaths[] = {}; static const char* qtBuildPaths[] = {};
#else #else

View File

@@ -46,7 +46,7 @@ public:
QPixmapButton(QWidget *parent, const QPixmap &first, const QPixmap &second) QPixmapButton(QWidget *parent, const QPixmap &first, const QPixmap &second)
: QPushButton(parent), m_showFirst(true), m_first(first), m_second(second) : QPushButton(parent), m_showFirst(true), m_first(first), m_second(second)
{ {
setFixedSize(m_first.size()); setFixedSize(m_first.size()/m_first.devicePixelRatio());
} }
void paintEvent(QPaintEvent *) void paintEvent(QPaintEvent *)

View File

@@ -983,7 +983,7 @@ bool CommandSession::startService(const QString &serviceName, ServiceSocket &fd)
if (!connectDevice()) if (!connectDevice())
return false; return false;
CFStringRef cfsService = serviceName.toCFString(); CFStringRef cfsService = serviceName.toCFString();
if (am_res_t error = lib()->deviceStartService(device, cfsService, 0, &fd)) { if (am_res_t error = lib()->deviceStartService(device, cfsService, &fd, 0)) {
addError(QString::fromLatin1("Starting service \"%1\" on device %2 failed, AMDeviceStartService returned %3 (0x%4)") addError(QString::fromLatin1("Starting service \"%1\" on device %2 failed, AMDeviceStartService returned %3 (0x%4)")
.arg(serviceName).arg(deviceId).arg(mobileDeviceErrorString(error)).arg(QString::number(error, 16))); .arg(serviceName).arg(deviceId).arg(mobileDeviceErrorString(error)).arg(QString::number(error, 16)));
failure = true; failure = true;