diff options
author | dt <[email protected]> | 2011-03-31 17:43:48 +0200 |
---|---|---|
committer | dt <[email protected]> | 2011-03-31 18:26:51 +0200 |
commit | fcbb38988bd8ba8f8e29b5051179ac6bf25904f6 (patch) | |
tree | a40b87827c4a79cf9b08b1b1c99d6cd395842e6a /src/plugins/cmakeprojectmanager/cmakeproject.cpp | |
parent | 12fd1dbb703b141f70860d47db5cb34e7f79c9e7 (diff) |
CMakeProjectManager: Change editing cmake files to not pop up a dialog
Stop watching the cmake files for changes, instead watch the cbp file
for changes. Warn the user that changes in the CMakeLists.txt via a
infobar.
Fixes or obsolets a few bug reports:
Task-Nr: QTCREATORBUG-3123
Task-Nr: QTCREATORBUG-3353
Task-Nr: QTCREATORBUG-2487
Diffstat (limited to 'src/plugins/cmakeprojectmanager/cmakeproject.cpp')
-rw-r--r-- | src/plugins/cmakeprojectmanager/cmakeproject.cpp | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp index 399e83f0c23..a882e5ebf93 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp @@ -97,7 +97,6 @@ CMakeProject::CMakeProject(CMakeManager *manager, const QString &fileName) : m_manager(manager), m_fileName(fileName), m_rootNode(new CMakeProjectNode(m_fileName)), - m_insideFileChanged(false), m_lastEditor(0) { m_file = new CMakeFile(this, fileName); @@ -126,15 +125,8 @@ CMakeProject::~CMakeProject() void CMakeProject::fileChanged(const QString &fileName) { Q_UNUSED(fileName) - if (!activeTarget() || - !activeTarget()->activeBuildConfiguration()) - return; - if (m_insideFileChanged) - return; - m_insideFileChanged = true; - changeActiveBuildConfiguration(activeTarget()->activeBuildConfiguration()); - m_insideFileChanged = false; + parseCMakeLists(); } void CMakeProject::changeActiveBuildConfiguration(ProjectExplorer::BuildConfiguration *bc) @@ -201,6 +193,8 @@ bool CMakeProject::parseCMakeLists() !activeTarget()->activeBuildConfiguration()) return false; + Core::EditorManager::instance()->hideEditorInfoBar("CMakeEditor.RunCMake"); + // Find cbp file CMakeBuildConfiguration *activeBC = activeTarget()->activeBuildConfiguration(); QString cbpFile = CMakeManager::findCbpFile(activeBC->buildDirectory()); @@ -212,12 +206,17 @@ bool CMakeProject::parseCMakeLists() //qDebug()<<"Parsing file "<<cbpFile; if (!cbpparser.parseCbpFile(cbpFile)) { // TODO report error - qDebug()<<"Parsing failed"; - // activeBC->updateToolChain(QString::null); emit buildTargetsChanged(); return false; } + foreach (const QString &file, m_watcher->files()) + if (file != cbpFile) + m_watcher->removePath(file); + + // how can we ensure that it is completly written? + m_watcher->addPath(cbpFile); + // ToolChain // activeBC->updateToolChain(cbpparser.compilerName()); m_projectName = cbpparser.projectName(); @@ -238,12 +237,6 @@ bool CMakeProject::parseCMakeLists() projectFiles.insert(cmakeListTxt); } - QSet<QString> added = projectFiles; - added.subtract(m_watchedFiles); - foreach(const QString &add, added) - m_watcher->addFile(add); - foreach(const QString &remove, m_watchedFiles.subtract(projectFiles)) - m_watcher->removeFile(remove); m_watchedFiles = projectFiles; m_files.clear(); @@ -279,7 +272,6 @@ bool CMakeProject::parseCMakeLists() } cmakeCache.close(); - //qDebug()<<"Updating CodeModel"; createUiCodeModelSupport(); if (!activeBC->toolChain()) @@ -317,12 +309,16 @@ bool CMakeProject::parseCMakeLists() m_codeModelFuture = modelmanager->updateSourceFiles(pinfo.sourceFiles); } } - emit buildTargetsChanged(); emit fileListChanged(); return true; } +bool CMakeProject::isProjectFile(const QString &fileName) +{ + return m_watchedFiles.contains(fileName); +} + QList<CMakeBuildTarget> CMakeProject::buildTargets() const { return m_buildTargets; @@ -562,7 +558,7 @@ bool CMakeProject::fromMap(const QVariantMap &map) } } - m_watcher = new ProjectExplorer::FileWatcher(this); + m_watcher = new QFileSystemWatcher(this); connect(m_watcher, SIGNAL(fileChanged(QString)), this, SLOT(fileChanged(QString))); if (!parseCMakeLists()) // Gets the directory from the active buildconfiguration |