From 9033749198baffbe5ddf4449bf1059ee7a45aa44 Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 9 Nov 2009 11:47:05 +0100 Subject: [PATCH 01/34] actually use pixmap cache for toolbar drawing if requested to do so --- src/libs/utils/stylehelper.cpp | 145 ++++++++++++++++++--------------- 1 file changed, 81 insertions(+), 64 deletions(-) diff --git a/src/libs/utils/stylehelper.cpp b/src/libs/utils/stylehelper.cpp index 3087894c8db..3236d748216 100644 --- a/src/libs/utils/stylehelper.cpp +++ b/src/libs/utils/stylehelper.cpp @@ -132,105 +132,122 @@ void StyleHelper::setBaseColor(const QColor &color) } } -void StyleHelper::verticalGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect) +static void verticalGradientHelper(QPainter *p, const QRect &spanRect, const QRect &rect) { - QString key; - key.sprintf("mh_toolbar %d %d %d %d %d", spanRect.width(), spanRect.height(), clipRect.width(), - clipRect.height(), StyleHelper::baseColor().rgb());; - QPixmap pixmap; - QPainter *p = painter; - QRect rect = clipRect; - if (StyleHelper::usePixmapCache() && !QPixmapCache::find(key, pixmap)) { - pixmap = QPixmap(clipRect.size()); - p = new QPainter(&pixmap); - rect = QRect(0, 0, clipRect.width(), clipRect.height()); - } - QColor base = StyleHelper::baseColor(); QLinearGradient grad(spanRect.topRight(), spanRect.topLeft()); - grad.setColorAt(0, highlightColor()); + grad.setColorAt(0, StyleHelper::highlightColor()); grad.setColorAt(0.301, base); - grad.setColorAt(1, shadowColor()); + grad.setColorAt(1, StyleHelper::shadowColor()); p->fillRect(rect, grad); QColor light(255, 255, 255, 80); p->setPen(light); p->drawLine(rect.topRight() - QPoint(1, 0), rect.bottomRight() - QPoint(1, 0)); - - if (StyleHelper::usePixmapCache() && !QPixmapCache::find(key, pixmap)) { - painter->drawPixmap(clipRect.topLeft(), pixmap); - p->end(); - delete p; - QPixmapCache::insert(key, pixmap); - } - } -void StyleHelper::horizontalGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect) +void StyleHelper::verticalGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect) { - QString key; - key.sprintf("mh_toolbar %d %d %d %d %d", spanRect.width(), spanRect.height(), - clipRect.width(), clipRect.height(), StyleHelper::baseColor().rgb()); - QPixmap pixmap; - QPainter *p = painter; - QRect rect = clipRect; - if (StyleHelper::usePixmapCache() && !QPixmapCache::find(key, pixmap)) { - pixmap = QPixmap(clipRect.size()); - p = new QPainter(&pixmap); - rect = QRect(0, 0, clipRect.width(), clipRect.height()); - } + if (StyleHelper::usePixmapCache()) { + QString key; + key.sprintf("mh_vertical %d %d %d %d %d", + spanRect.width(), spanRect.height(), clipRect.width(), + clipRect.height(), StyleHelper::baseColor().rgb());; + QPixmap pixmap; + if (!QPixmapCache::find(key, pixmap)) { + pixmap = QPixmap(clipRect.size()); + QPainter p(&pixmap); + QRect rect(0, 0, clipRect.width(), clipRect.height()); + verticalGradientHelper(&p, spanRect, rect); + p.end(); + QPixmapCache::insert(key, pixmap); + } + + painter->drawPixmap(clipRect.topLeft(), pixmap); + } else { + verticalGradientHelper(painter, spanRect, clipRect); + } +} + +static void horizontalGradientHelper(QPainter *p, const QRect &spanRect, const +QRect &rect) +{ QColor base = StyleHelper::baseColor(); QLinearGradient grad(rect.topLeft(), rect.bottomLeft()); - grad.setColorAt(0, highlightColor().lighter(120)); - if (rect.height() == navigationWidgetHeight()) { - grad.setColorAt(0.4, highlightColor()); + grad.setColorAt(0, StyleHelper::highlightColor().lighter(120)); + if (rect.height() == StyleHelper::navigationWidgetHeight()) { + grad.setColorAt(0.4, StyleHelper::highlightColor()); grad.setColorAt(0.401, base); } - grad.setColorAt(1, shadowColor()); + grad.setColorAt(1, StyleHelper::shadowColor()); p->fillRect(rect, grad); QLinearGradient shadowGradient(spanRect.topLeft(), spanRect.topRight()); shadowGradient.setColorAt(0, QColor(0, 0, 0, 30)); - QColor highlight = highlightColor().lighter(130); + QColor highlight = StyleHelper::highlightColor().lighter(130); highlight.setAlpha(100); shadowGradient.setColorAt(0.7, highlight); shadowGradient.setColorAt(1, QColor(0, 0, 0, 40)); p->fillRect(rect, shadowGradient); - if (StyleHelper::usePixmapCache() && !QPixmapCache::find(key, pixmap)) { +} + +void StyleHelper::horizontalGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect) +{ + if (StyleHelper::usePixmapCache()) { + QString key; + key.sprintf("mh_horizontal %d %d %d %d %d", + spanRect.width(), spanRect.height(), clipRect.width(), + clipRect.height(), StyleHelper::baseColor().rgb()); + + QPixmap pixmap; + if (!QPixmapCache::find(key, pixmap)) { + pixmap = QPixmap(clipRect.size()); + QPainter p(&pixmap); + QRect rect = QRect(0, 0, clipRect.width(), clipRect.height()); + horizontalGradientHelper(&p, spanRect, rect); + p.end(); + QPixmapCache::insert(key, pixmap); + } + painter->drawPixmap(clipRect.topLeft(), pixmap); - p->end(); - delete p; - QPixmapCache::insert(key, pixmap); + + } else { + horizontalGradientHelper(painter, spanRect, clipRect); } } +static void menuGradientHelper(QPainter *p, const QRect &spanRect, const QRect &rect) +{ + QLinearGradient grad(spanRect.topLeft(), spanRect.bottomLeft()); + QColor menuColor = StyleHelper::mergedColors(StyleHelper::baseColor(), QColor(244, 244, 244), 25); + grad.setColorAt(0, menuColor.lighter(112)); + grad.setColorAt(1, menuColor); + p->fillRect(rect, grad); +} + void StyleHelper::menuGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect) { - QString key; - key.sprintf("mh_toolbar %d %d %d %d %d", spanRect.width(), spanRect.height(), clipRect.width(), - clipRect.height(), StyleHelper::baseColor().rgb());; - QPixmap pixmap; - QPainter *p = painter; - QRect rect = clipRect; - if (StyleHelper::usePixmapCache() && !QPixmapCache::find(key, pixmap)) { - pixmap = QPixmap(clipRect.size()); - p = new QPainter(&pixmap); - rect = QRect(0, 0, clipRect.width(), clipRect.height()); - } + if (StyleHelper::usePixmapCache()) { + QString key; + key.sprintf("mh_menu %d %d %d %d %d", + spanRect.width(), spanRect.height(), clipRect.width(), + clipRect.height(), StyleHelper::baseColor().rgb()); - QLinearGradient grad(spanRect.topLeft(), spanRect.bottomLeft()); - QColor menuColor = mergedColors(StyleHelper::baseColor(), QColor(244, 244, 244), 25); - grad.setColorAt(0, menuColor.lighter(112)); - grad.setColorAt(1, menuColor); - p->fillRect(rect, grad); + QPixmap pixmap; + if (!QPixmapCache::find(key, pixmap)) { + pixmap = QPixmap(clipRect.size()); + QPainter p(&pixmap); + QRect rect = QRect(0, 0, clipRect.width(), clipRect.height()); + menuGradientHelper(&p, spanRect, rect); + p.end(); + QPixmapCache::insert(key, pixmap); + } - if (StyleHelper::usePixmapCache() && !QPixmapCache::find(key, pixmap)) { painter->drawPixmap(clipRect.topLeft(), pixmap); - p->end(); - delete p; - QPixmapCache::insert(key, pixmap); + } else { + menuGradientHelper(painter, spanRect, clipRect); } } From 901239e1ea0b06c50f002d3f2d569a4367a0e4ec Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 9 Nov 2009 12:28:22 +0100 Subject: [PATCH 02/34] Library wizard: Create export symbol correctly. ...if the directory contains a '-'. Export a function to generate identifier correctly and use that. Reviewed-by: con Task-number: QTCREATORBUG-248 --- src/libs/utils/codegeneration.cpp | 6 +++--- src/libs/utils/codegeneration.h | 4 ++++ .../qt4projectmanager/wizards/qtprojectparameters.cpp | 3 ++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/libs/utils/codegeneration.cpp b/src/libs/utils/codegeneration.cpp index c0b1a64356a..f5975fe0fb6 100644 --- a/src/libs/utils/codegeneration.cpp +++ b/src/libs/utils/codegeneration.cpp @@ -35,7 +35,7 @@ namespace Utils { -static QString toAlphaNum(const QString &s) +QTCREATOR_UTILS_EXPORT QString fileNameToCppIdentifier(const QString &s) { QString rc; const int len = s.size(); @@ -55,9 +55,9 @@ static QString toAlphaNum(const QString &s) QTCREATOR_UTILS_EXPORT QString headerGuard(const QString &file) { const QFileInfo fi(file); - QString rc = toAlphaNum(fi.completeBaseName()).toUpper(); + QString rc = fileNameToCppIdentifier(fi.completeBaseName()).toUpper(); rc += QLatin1Char('_'); - rc += toAlphaNum(fi.suffix()).toUpper(); + rc += fileNameToCppIdentifier(fi.suffix()).toUpper(); return rc; } diff --git a/src/libs/utils/codegeneration.h b/src/libs/utils/codegeneration.h index 5c8fc746ce7..6f0ec6c7e1d 100644 --- a/src/libs/utils/codegeneration.h +++ b/src/libs/utils/codegeneration.h @@ -40,6 +40,10 @@ QT_END_NAMESPACE namespace Utils { +// Convert a file name to a Cpp identifier (stripping invalid characters +// or replacing them by an underscore). +QTCREATOR_UTILS_EXPORT QString fileNameToCppIdentifier(const QString &s); + QTCREATOR_UTILS_EXPORT QString headerGuard(const QString &file); QTCREATOR_UTILS_EXPORT diff --git a/src/plugins/qt4projectmanager/wizards/qtprojectparameters.cpp b/src/plugins/qt4projectmanager/wizards/qtprojectparameters.cpp index 0cfbb7dcaa2..a658a6bc223 100644 --- a/src/plugins/qt4projectmanager/wizards/qtprojectparameters.cpp +++ b/src/plugins/qt4projectmanager/wizards/qtprojectparameters.cpp @@ -28,6 +28,7 @@ **************************************************************************/ #include "qtprojectparameters.h" +#include #include #include @@ -108,7 +109,7 @@ QString createMacro(const QString &name, const QString &suffix) if (extensionPosition != -1) rc.truncate(extensionPosition); rc += suffix; - return rc; + return Utils::fileNameToCppIdentifier(rc); } QString QtProjectParameters::exportMacro(const QString &projectName) From 6320b06b7c6be78f67b2d4769d61f9a630f5008b Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Mon, 9 Nov 2009 13:04:28 +0100 Subject: [PATCH 03/34] Typo fix in German translation Reviewed-by: hjk --- share/qtcreator/translations/qtcreator_de.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/qtcreator/translations/qtcreator_de.ts b/share/qtcreator/translations/qtcreator_de.ts index 0c3ca291a07..82b05a47f0f 100644 --- a/share/qtcreator/translations/qtcreator_de.ts +++ b/share/qtcreator/translations/qtcreator_de.ts @@ -2537,7 +2537,7 @@ Sollen sie überschrieben werden? Methods in current Document - Methoden im aktuellenDokument + Methoden im aktuellen Dokument @@ -14355,7 +14355,7 @@ Die folgenden Encodings scheinen der Datei zu entsprechen: Line in current document - Zeile im aktuellenDokument + Zeile im aktuellen Dokument From d2bd092b47c8d4f81855228d158cc1b81ead8c00 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 9 Nov 2009 13:53:28 +0100 Subject: [PATCH 04/34] Code model: Fix Windows issues (duplicate matches). Ensure the code model receives file names with clean paths ('/') and fix paths in the relevant places of the code model. Pass on clean paths from Cpp reference find and display them correctly in the search window tooltip. Reviewed-by: Roberto Raggi --- src/libs/cplusplus/CppDocument.cpp | 10 ++++++++-- src/libs/cplusplus/CppDocument.h | 1 + src/libs/cplusplus/FindUsages.cpp | 3 +-- src/plugins/cpptools/cppfindreferences.cpp | 4 ---- src/plugins/cpptools/cppmodelmanager.cpp | 2 +- src/plugins/find/searchresulttreemodel.cpp | 6 +++++- 6 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/libs/cplusplus/CppDocument.cpp b/src/libs/cplusplus/CppDocument.cpp index b05525b8547..f0c6665a46c 100644 --- a/src/libs/cplusplus/CppDocument.cpp +++ b/src/libs/cplusplus/CppDocument.cpp @@ -42,6 +42,7 @@ #include #include +#include #include /*! @@ -108,7 +109,7 @@ private: Document::Document(const QString &fileName) - : _fileName(fileName), + : _fileName(QDir::cleanPath(fileName)), _globalNamespace(0), _revision(0) { @@ -173,7 +174,7 @@ QStringList Document::includedFiles() const void Document::addIncludeFile(const QString &fileName, unsigned line) { - _includes.append(Include(fileName, line)); + _includes.append(Include(QDir::cleanPath(fileName), line)); } void Document::appendMacro(const Macro ¯o) @@ -569,3 +570,8 @@ QStringList Snapshot::dependsOn(const QString &fileName) const return deps; } + +Document::Ptr Snapshot::value(const QString &fileName) const +{ + return QMap::value(QDir::cleanPath(fileName)); +} diff --git a/src/libs/cplusplus/CppDocument.h b/src/libs/cplusplus/CppDocument.h index 596bee794b3..0f879b872d2 100644 --- a/src/libs/cplusplus/CppDocument.h +++ b/src/libs/cplusplus/CppDocument.h @@ -341,6 +341,7 @@ public: QStringList dependsOn(const QString &fileName) const; void insert(Document::Ptr doc); + Document::Ptr value(const QString &fileName) const; using _Base::insert; diff --git a/src/libs/cplusplus/FindUsages.cpp b/src/libs/cplusplus/FindUsages.cpp index d6ecca8cbf9..b74e85995fc 100644 --- a/src/libs/cplusplus/FindUsages.cpp +++ b/src/libs/cplusplus/FindUsages.cpp @@ -121,8 +121,7 @@ void FindUsages::reportResult(unsigned tokenIndex) const int len = tk.f.length; if (_future) { - const QString path = QDir::toNativeSeparators(_doc->fileName()); - _future->reportResult(Usage(path, line, lineText, col, len)); + _future->reportResult(Usage(_doc->fileName(), line, lineText, col, len)); } _references.append(tokenIndex); diff --git a/src/plugins/cpptools/cppfindreferences.cpp b/src/plugins/cpptools/cppfindreferences.cpp index 72677abf6e2..6d1c527bacd 100644 --- a/src/plugins/cpptools/cppfindreferences.cpp +++ b/src/plugins/cpptools/cppfindreferences.cpp @@ -110,7 +110,6 @@ static void find_helper(QFutureInterface &future, Q_ASSERT(symbolId != 0); const QString sourceFile = QString::fromUtf8(symbol->fileName(), symbol->fileNameLength()); - QStringList files(sourceFile); if (symbol->isClass() || symbol->isForwardClassDeclaration()) { @@ -126,9 +125,7 @@ static void find_helper(QFutureInterface &future, } else { files += snapshot.dependsOn(sourceFile); } - files.removeDuplicates(); - //qDebug() << "done in:" << tm.elapsed() << "number of files to parse:" << files.size(); future.setProgressRange(0, files.size()); @@ -232,7 +229,6 @@ void CppFindReferences::findAll_helper(Symbol *symbol) const QMap wl = _modelManager->workingCopy(); Core::ProgressManager *progressManager = Core::ICore::instance()->progressManager(); - QFuture result = QtConcurrent::run(&find_helper, wl, snapshot, symbol); m_watcher.setFuture(result); diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp index 5adc395870e..5cae6bdeaf3 100644 --- a/src/plugins/cpptools/cppmodelmanager.cpp +++ b/src/plugins/cpptools/cppmodelmanager.cpp @@ -532,7 +532,7 @@ void CppPreprocessor::sourceNeeded(QString &fileName, IncludeType type, return; QString contents = tryIncludeFile(fileName, type); - + fileName = QDir::cleanPath(fileName); if (m_currentDoc) { m_currentDoc->addIncludeFile(fileName, line); diff --git a/src/plugins/find/searchresulttreemodel.cpp b/src/plugins/find/searchresulttreemodel.cpp index b711e8c1105..267022bb437 100644 --- a/src/plugins/find/searchresulttreemodel.cpp +++ b/src/plugins/find/searchresulttreemodel.cpp @@ -243,7 +243,7 @@ QVariant SearchResultTreeModel::data(const SearchResultFile *file, int role) con break; case ItemDataRoles::FileNameRole: case Qt::ToolTipRole: - result = file->fileName(); + result = QDir::toNativeSeparators(file->fileName()); break; case ItemDataRoles::ResultLinesCountRole: result = file->childrenCount(); @@ -270,6 +270,10 @@ QVariant SearchResultTreeModel::headerData(int section, Qt::Orientation orientat void SearchResultTreeModel::appendResultFile(const QString &fileName) { +#ifdef Q_OS_WIN + if (fileName.contains(QLatin1Char('\\'))) + qWarning("SearchResultTreeModel::appendResultFile: File name with native separators added %s.\n", qPrintable(fileName)); +#endif m_lastAppendedResultFile = new SearchResultFile(fileName, m_rootItem); if (m_showReplaceUI) { From d8b2598f4f01559792deccfc68b46784285045d8 Mon Sep 17 00:00:00 2001 From: con Date: Wed, 4 Nov 2009 19:14:17 +0100 Subject: [PATCH 05/34] Symbian SDK path should be editable for Qt in PATH. Reviewed-by: Robert Loehning --- src/plugins/qt4projectmanager/qtoptionspage.cpp | 4 +++- src/plugins/qt4projectmanager/qtversionmanager.cpp | 6 ------ src/plugins/qt4projectmanager/qtversionmanager.h | 6 ++---- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/plugins/qt4projectmanager/qtoptionspage.cpp b/src/plugins/qt4projectmanager/qtoptionspage.cpp index 297ee859627..50fe634a878 100644 --- a/src/plugins/qt4projectmanager/qtoptionspage.cpp +++ b/src/plugins/qt4projectmanager/qtoptionspage.cpp @@ -399,7 +399,9 @@ void QtOptionsPageWidget::updateState() m_ui->qmakePath->setEnabled(enabled && !isAutodetected); m_ui->mingwPath->setEnabled(enabled); m_ui->mwcPath->setEnabled(enabled); - m_ui->s60SDKPath->setEnabled(enabled && !isAutodetected); + bool s60SDKPathEnabled = enabled && + (isAutodetected ? version->s60SDKDirectory().isEmpty() : true); + m_ui->s60SDKPath->setEnabled(s60SDKPathEnabled); m_ui->gccePath->setEnabled(enabled); const bool hasLog = enabled && !m_ui->qtdirList->currentItem()->data(2, Qt::UserRole).toString().isEmpty(); diff --git a/src/plugins/qt4projectmanager/qtversionmanager.cpp b/src/plugins/qt4projectmanager/qtversionmanager.cpp index 26c556db760..b1fc6a0bd3f 100644 --- a/src/plugins/qt4projectmanager/qtversionmanager.cpp +++ b/src/plugins/qt4projectmanager/qtversionmanager.cpp @@ -125,11 +125,9 @@ QtVersionManager::QtVersionManager() autodetectionSource); version->setMingwDirectory(s->value("MingwDirectory").toString()); version->setMsvcVersion(s->value("msvcVersion").toString()); -#ifdef QTCREATOR_WITH_S60 version->setMwcDirectory(s->value("MwcDirectory").toString()); version->setS60SDKDirectory(s->value("S60SDKDirectory").toString()); version->setGcceDirectory(s->value("GcceDirectory").toString()); -#endif m_versions.append(version); } s->endArray(); @@ -263,11 +261,9 @@ void QtVersionManager::writeVersionsIntoSettings() s->setValue("isAutodetected", version->isAutodetected()); if (version->isAutodetected()) s->setValue("autodetectionSource", version->autodetectionSource()); -#ifdef QTCREATOR_WITH_S60 s->setValue("MwcDirectory", version->mwcDirectory()); s->setValue("S60SDKDirectory", version->s60SDKDirectory()); s->setValue("GcceDirectory", version->gcceDirectory()); -#endif } s->endArray(); } @@ -1218,7 +1214,6 @@ ProjectExplorer::ToolChain::ToolChainType QtVersion::defaultToolchainType() cons return possibleToolChainTypes().at(0); } -#ifdef QTCREATOR_WITH_S60 QString QtVersion::mwcDirectory() const { return m_mwcDirectory; @@ -1247,7 +1242,6 @@ void QtVersion::setGcceDirectory(const QString &directory) { m_gcceDirectory = directory; } -#endif QString QtVersion::mingwDirectory() const { diff --git a/src/plugins/qt4projectmanager/qtversionmanager.h b/src/plugins/qt4projectmanager/qtversionmanager.h index 328f73d805f..df9cf0fd366 100644 --- a/src/plugins/qt4projectmanager/qtversionmanager.h +++ b/src/plugins/qt4projectmanager/qtversionmanager.h @@ -83,14 +83,13 @@ public: // Returns the PREFIX, BINPREFIX, DOCPREFIX and similar information QHash versionInfo() const; -#ifdef QTCREATOR_WITH_S60 QString mwcDirectory() const; void setMwcDirectory(const QString &directory); QString s60SDKDirectory() const; void setS60SDKDirectory(const QString &directory); QString gcceDirectory() const; void setGcceDirectory(const QString &directory); -#endif + QString mingwDirectory() const; void setMingwDirectory(const QString &directory); QString msvcVersion() const; @@ -146,11 +145,10 @@ private: bool m_isAutodetected; QString m_autodetectionSource; bool m_hasDebuggingHelper; -#ifdef QTCREATOR_WITH_S60 + QString m_mwcDirectory; QString m_s60SDKDirectory; QString m_gcceDirectory; -#endif mutable bool m_mkspecUpToDate; mutable QString m_mkspec; // updated lazily From 19fb0311bade0ffee612d51d64d40b04a811b7c4 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 9 Nov 2009 14:44:47 +0100 Subject: [PATCH 06/34] Enable run configurations for projects that do not have a build step. Reviewed-by: dt --- src/plugins/projectexplorer/runconfiguration.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/projectexplorer/runconfiguration.cpp b/src/plugins/projectexplorer/runconfiguration.cpp index 6aa8ea34de8..d99907bea57 100644 --- a/src/plugins/projectexplorer/runconfiguration.cpp +++ b/src/plugins/projectexplorer/runconfiguration.cpp @@ -61,7 +61,8 @@ bool RunConfiguration::isEnabled() const { if (!m_project) return false; - if (!m_project->activeBuildConfiguration()) + if (m_project->hasBuildSettings() + && !m_project->activeBuildConfiguration()) return false; return isEnabled(m_project->activeBuildConfiguration()); } From 7aa24116935249a840e1350a6f8de73bc794fb09 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 9 Nov 2009 15:57:56 +0100 Subject: [PATCH 07/34] Code model: Update on changes from the versioning system. Add state logic to CppCodeModelManagerInterface, making it aware whether an indexer is running, protect the update methods from another invocation while running. Add changed signals to IVersionControl and VCSManager and wire them to the update methods. Add a menu action for manually updating. Reviewed-by: Roberto Raggi Reviewed-by: con --- src/plugins/coreplugin/iversioncontrol.h | 4 ++ src/plugins/coreplugin/mainwindow.cpp | 3 +- src/plugins/coreplugin/vcsmanager.cpp | 14 +++- src/plugins/coreplugin/vcsmanager.h | 12 +++- src/plugins/cppeditor/cppeditorconstants.h | 2 + src/plugins/cppeditor/cppplugin.cpp | 67 ++++++++++++------- src/plugins/cppeditor/cppplugin.h | 5 +- src/plugins/cpptools/cppmodelmanager.cpp | 41 +++++++++++- src/plugins/cpptools/cppmodelmanager.h | 7 ++ .../cpptools/cppmodelmanagerinterface.h | 6 ++ src/plugins/cpptools/cpptoolsplugin.cpp | 6 ++ src/plugins/cvs/cvscontrol.cpp | 11 +++ src/plugins/cvs/cvscontrol.h | 3 + src/plugins/cvs/cvsplugin.cpp | 9 ++- src/plugins/cvs/cvsplugin.h | 3 +- src/plugins/git/gitclient.cpp | 48 ++++++++++--- src/plugins/git/gitclient.h | 16 +++-- src/plugins/git/gitcommand.cpp | 2 + src/plugins/git/gitcommand.h | 1 + src/plugins/git/gitplugin.cpp | 14 ++-- src/plugins/git/gitplugin.h | 3 + src/plugins/git/gitversioncontrol.cpp | 5 ++ src/plugins/git/gitversioncontrol.h | 2 + src/plugins/perforce/perforceplugin.cpp | 7 +- .../perforce/perforceversioncontrol.cpp | 10 +++ src/plugins/perforce/perforceversioncontrol.h | 3 + src/plugins/subversion/subversioncontrol.cpp | 10 +++ src/plugins/subversion/subversioncontrol.h | 3 + src/plugins/subversion/subversionplugin.cpp | 6 +- src/plugins/subversion/subversionplugin.h | 3 +- 30 files changed, 265 insertions(+), 61 deletions(-) diff --git a/src/plugins/coreplugin/iversioncontrol.h b/src/plugins/coreplugin/iversioncontrol.h index 8cbd8240b36..edaab39fbdb 100644 --- a/src/plugins/coreplugin/iversioncontrol.h +++ b/src/plugins/coreplugin/iversioncontrol.h @@ -106,6 +106,10 @@ public: */ virtual bool vcsDelete(const QString &filename) = 0; +signals: + void repositoryChanged(const QString &repository); + void filesChanged(const QStringList &files); + // TODO: ADD A WAY TO DETECT WHETHER A FILE IS MANAGED, e.g // virtual bool sccManaged(const QString &filename) = 0; }; diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index 282b2bf6815..e7b8e7fa544 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -126,7 +126,7 @@ MainWindow::MainWindow() : m_progressManager(new ProgressManagerPrivate()), m_scriptManager(new ScriptManagerPrivate(this)), m_variableManager(new VariableManager(this)), - m_vcsManager(new VCSManager()), + m_vcsManager(new VCSManager), m_viewManager(0), m_modeManager(0), m_mimeDatabase(new MimeDatabase), @@ -346,6 +346,7 @@ void MainWindow::extensionsInitialized() OutputPaneManager::instance()->init(); m_actionManager->initialize(); + m_vcsManager->extensionsInitialized(); readSettings(); updateContext(); diff --git a/src/plugins/coreplugin/vcsmanager.cpp b/src/plugins/coreplugin/vcsmanager.cpp index 33c7e484a02..e07ba2ff12e 100644 --- a/src/plugins/coreplugin/vcsmanager.cpp +++ b/src/plugins/coreplugin/vcsmanager.cpp @@ -57,7 +57,8 @@ struct VCSManagerPrivate { QMap m_cachedMatches; }; -VCSManager::VCSManager() : +VCSManager::VCSManager(QObject *parent) : + QObject(parent), m_d(new VCSManagerPrivate) { } @@ -67,6 +68,17 @@ VCSManager::~VCSManager() delete m_d; } +void VCSManager::extensionsInitialized() +{ + // Change signal connections + foreach (IVersionControl *versionControl, allVersionControls()) { + connect(versionControl, SIGNAL(filesChanged(QStringList)), + this, SIGNAL(filesChanged(QStringList))); + connect(versionControl, SIGNAL(repositoryChanged(QString)), + this, SIGNAL(repositoryChanged(QString))); + } +} + void VCSManager::setVCSEnabled(const QString &directory) { if (debug) diff --git a/src/plugins/coreplugin/vcsmanager.h b/src/plugins/coreplugin/vcsmanager.h index fa94efc618c..772243dd957 100644 --- a/src/plugins/coreplugin/vcsmanager.h +++ b/src/plugins/coreplugin/vcsmanager.h @@ -33,6 +33,7 @@ #include "core_global.h" #include +#include namespace Core { @@ -49,13 +50,16 @@ class IVersionControl; // for the topmost directory it manages. This information is cached and // VCSManager thus knows pretty fast which IVersionControl * is responsible. -class CORE_EXPORT VCSManager +class CORE_EXPORT VCSManager : public QObject { + Q_OBJECT Q_DISABLE_COPY(VCSManager) public: - VCSManager(); + explicit VCSManager(QObject *parent = 0); virtual ~VCSManager(); + void extensionsInitialized(); + IVersionControl *findVersionControlForDirectory(const QString &directory); // Enable the VCS managing a certain directory only. This should @@ -69,6 +73,10 @@ public: // if a failure occurs bool showDeleteDialog(const QString &fileName); +signals: + void repositoryChanged(const QString &repository); + void filesChanged(const QStringList &files); + private: VCSManagerPrivate *m_d; }; diff --git a/src/plugins/cppeditor/cppeditorconstants.h b/src/plugins/cppeditor/cppeditorconstants.h index 356f711ba9e..85d02021251 100644 --- a/src/plugins/cppeditor/cppeditorconstants.h +++ b/src/plugins/cppeditor/cppeditorconstants.h @@ -41,8 +41,10 @@ const char * const SWITCH_DECLARATION_DEFINITION = "CppEditor.SwitchDeclarationD const char * const RENAME_SYMBOL_UNDER_CURSOR = "CppEditor.RenameSymbolUnderCursor"; const char * const FIND_USAGES = "CppEditor.FindUsages"; const char * const SEPARATOR = "CppEditor.Separator"; +const char * const SEPARATOR2 = "CppEditor.Separator2"; const char * const FIND_REFERENCES = "CppEditor.FindReferences"; const char * const JUMP_TO_DEFINITION = "CppEditor.JumpToDefinition"; +const char * const UPDATE_CODEMODEL = "CppEditor.UpdateCodeModel"; const char * const HEADER_FILE_TYPE = "CppHeaderFiles"; const char * const SOURCE_FILE_TYPE = "CppSourceFiles"; diff --git a/src/plugins/cppeditor/cppplugin.cpp b/src/plugins/cppeditor/cppplugin.cpp index f98fb680873..16d7ce4b914 100644 --- a/src/plugins/cppeditor/cppplugin.cpp +++ b/src/plugins/cppeditor/cppplugin.cpp @@ -43,7 +43,7 @@ #include #include #include -#include +#include #include #include #include @@ -112,7 +112,11 @@ CppPlugin *CppPlugin::m_instance = 0; CppPlugin::CppPlugin() : m_actionHandler(0), - m_sortedMethodOverview(false) + m_sortedMethodOverview(false), + m_renameSymbolUnderCursorAction(0), + m_findUsagesAction(0), + m_updateCodeModelAction(0) + { m_instance = this; } @@ -158,6 +162,17 @@ bool CppPlugin::sortedMethodOverview() const return m_sortedMethodOverview; } +static inline + Core::Command *createSeparator(Core::ActionManager *am, + QObject *parent, + const QList &context, + const char *id) +{ + QAction *separator = new QAction(parent); + separator->setSeparator(true); + return am->registerAction(separator, QLatin1String(id), context); +} + bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage) { Core::ICore *core = Core::ICore::instance(); @@ -192,6 +207,7 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess Core::ActionContainer *contextMenu= am->createMenu(CppEditor::Constants::M_CONTEXT); Core::Command *cmd; + Core::ActionContainer *cppToolsMenu = am->actionContainer(QLatin1String(CppTools::Constants::M_TOOLS_CPP)); QAction *jumpToDefinition = new QAction(tr("Follow Symbol under Cursor"), this); cmd = am->registerAction(jumpToDefinition, @@ -200,7 +216,7 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess connect(jumpToDefinition, SIGNAL(triggered()), this, SLOT(jumpToDefinition())); contextMenu->addAction(cmd); - am->actionContainer(CppTools::Constants::M_TOOLS_CPP)->addAction(cmd); + cppToolsMenu->addAction(cmd); QAction *switchDeclarationDefinition = new QAction(tr("Switch between Method Declaration/Definition"), this); cmd = am->registerAction(switchDeclarationDefinition, @@ -209,14 +225,14 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess connect(switchDeclarationDefinition, SIGNAL(triggered()), this, SLOT(switchDeclarationDefinition())); contextMenu->addAction(cmd); - am->actionContainer(CppTools::Constants::M_TOOLS_CPP)->addAction(cmd); + cppToolsMenu->addAction(cmd); m_findUsagesAction = new QAction(tr("Find Usages"), this); cmd = am->registerAction(m_findUsagesAction, Constants::FIND_USAGES, context); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+U"))); connect(m_findUsagesAction, SIGNAL(triggered()), this, SLOT(findUsages())); contextMenu->addAction(cmd); - am->actionContainer(CppTools::Constants::M_TOOLS_CPP)->addAction(cmd); + cppToolsMenu->addAction(cmd); m_renameSymbolUnderCursorAction = new QAction(tr("Rename Symbol under Cursor"), this); cmd = am->registerAction(m_renameSymbolUnderCursorAction, @@ -224,7 +240,17 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess cmd->setDefaultKeySequence(QKeySequence("CTRL+SHIFT+R")); connect(m_renameSymbolUnderCursorAction, SIGNAL(triggered()), this, SLOT(renameSymbolUnderCursor())); contextMenu->addAction(cmd); - am->actionContainer(CppTools::Constants::M_TOOLS_CPP)->addAction(cmd); + cppToolsMenu->addAction(cmd); + + // Update context in global context + QList globalContext; + globalContext.append(Core::Constants::C_GLOBAL_ID); + cppToolsMenu->addAction(createSeparator(am, this, globalContext, CppEditor::Constants::SEPARATOR2)); + m_updateCodeModelAction = new QAction(tr("Update code model"), this); + cmd = am->registerAction(m_updateCodeModelAction, QLatin1String(Constants::UPDATE_CODEMODEL), globalContext); + CppTools::CppModelManagerInterface *cppModelManager = CppTools::CppModelManagerInterface::instance(); + connect(m_updateCodeModelAction, SIGNAL(triggered()), cppModelManager, SLOT(updateModifiedSourceFiles())); + cppToolsMenu->addAction(cmd); m_actionHandler = new TextEditor::TextEditorActionHandler(CppEditor::Constants::C_CPPEDITOR, TextEditor::TextEditorActionHandler::Format @@ -233,10 +259,7 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess m_actionHandler->initializeActions(); - QAction *separator = new QAction(this); - separator->setSeparator(true); - cmd = am->registerAction(separator, CppEditor::Constants::SEPARATOR, context); - contextMenu->addAction(cmd); + contextMenu->addAction(createSeparator(am, this, context, CppEditor::Constants::SEPARATOR)); cmd = am->command(TextEditor::Constants::AUTO_INDENT_SELECTION); contextMenu->addAction(cmd); @@ -244,10 +267,8 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess cmd = am->command(TextEditor::Constants::UN_COMMENT_SELECTION); contextMenu->addAction(cmd); - connect(core->progressManager(), SIGNAL(taskStarted(QString)), - this, SLOT(onTaskStarted(QString))); - connect(core->progressManager(), SIGNAL(allTasksFinished(QString)), - this, SLOT(onAllTasksFinished(QString))); + connect(cppModelManager, SIGNAL(indexingStarted()), this, SLOT(onCppModelIndexingStarted())); + connect(cppModelManager, SIGNAL(indexingFinished()), this, SLOT(onCppModelIndexingFinished())); readSettings(); return true; } @@ -303,20 +324,18 @@ void CppPlugin::findUsages() editor->findUsages(); } -void CppPlugin::onTaskStarted(const QString &type) +void CppPlugin::onCppModelIndexingStarted() { - if (type == CppTools::Constants::TASK_INDEX) { - m_renameSymbolUnderCursorAction->setEnabled(false); - m_findUsagesAction->setEnabled(false); - } + m_renameSymbolUnderCursorAction->setEnabled(false); + m_findUsagesAction->setEnabled(false); + m_updateCodeModelAction->setEnabled(false); } -void CppPlugin::onAllTasksFinished(const QString &type) +void CppPlugin::onCppModelIndexingFinished() { - if (type == CppTools::Constants::TASK_INDEX) { - m_renameSymbolUnderCursorAction->setEnabled(true); - m_findUsagesAction->setEnabled(true); - } + m_renameSymbolUnderCursorAction->setEnabled(true); + m_findUsagesAction->setEnabled(true); + m_updateCodeModelAction->setEnabled(true); } Q_EXPORT_PLUGIN(CppPlugin) diff --git a/src/plugins/cppeditor/cppplugin.h b/src/plugins/cppeditor/cppplugin.h index 3456bd9baf2..e0ccc7ac64e 100644 --- a/src/plugins/cppeditor/cppplugin.h +++ b/src/plugins/cppeditor/cppplugin.h @@ -75,8 +75,8 @@ private slots: void switchDeclarationDefinition(); void jumpToDefinition(); void renameSymbolUnderCursor(); - void onTaskStarted(const QString &type); - void onAllTasksFinished(const QString &type); + void onCppModelIndexingStarted(); + void onCppModelIndexingFinished(); void findUsages(); private: @@ -90,6 +90,7 @@ private: bool m_sortedMethodOverview; QAction *m_renameSymbolUnderCursorAction; QAction *m_findUsagesAction; + QAction *m_updateCodeModelAction; }; class CppEditorFactory : public Core::IEditorFactory diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp index 5cae6bdeaf3..6a490518401 100644 --- a/src/plugins/cpptools/cppmodelmanager.cpp +++ b/src/plugins/cpptools/cppmodelmanager.cpp @@ -595,6 +595,8 @@ Document::Ptr CppPreprocessor::switchDocument(Document::Ptr doc) void CppTools::CppModelManagerInterface::updateModifiedSourceFiles() { + if (isIndexing()) + return; const Snapshot snapshot = this->snapshot(); QStringList sourceFiles; @@ -630,7 +632,8 @@ CppTools::CppModelManagerInterface *CppTools::CppModelManagerInterface::instance */ CppModelManager::CppModelManager(QObject *parent) - : CppModelManagerInterface(parent) + : CppModelManagerInterface(parent), + m_indexing(false) { m_findReferences = new CppFindReferences(this); @@ -675,6 +678,11 @@ CppModelManager::CppModelManager(QObject *parent) connect(m_core->editorManager(), SIGNAL(editorAboutToClose(Core::IEditor *)), this, SLOT(editorAboutToClose(Core::IEditor *))); + + connect(m_core->progressManager(), SIGNAL(taskStarted(QString)), + this, SLOT(onTaskStarted(QString))); + connect(m_core->progressManager(), SIGNAL(allTasksFinished(QString)), + this, SLOT(onAllTasksFinished(QString))); } CppModelManager::~CppModelManager() @@ -871,7 +879,7 @@ QStringList CppModelManager::includesInPath(const QString &path) const QFuture CppModelManager::refreshSourceFiles(const QStringList &sourceFiles) { - if (! sourceFiles.isEmpty() && qgetenv("QTCREATOR_NO_CODE_INDEXER").isNull()) { + if (!m_indexing && !sourceFiles.isEmpty() && qgetenv("QTCREATOR_NO_CODE_INDEXER").isNull()) { const QMap workingCopy = buildWorkingCopyList(); CppPreprocessor *preproc = new CppPreprocessor(this); @@ -897,7 +905,7 @@ QFuture CppModelManager::refreshSourceFiles(const QStringList &sourceFiles m_synchronizer.addFuture(result); - if (sourceFiles.count() > 1) { + if (sourceFiles.count() > 1) { m_core->progressManager()->addTask(result, tr("Indexing"), CppTools::Constants::TASK_INDEX, Core::ProgressManager::CloseOnSuccess); @@ -1391,4 +1399,31 @@ void CppModelManager::GC() protectSnapshot.unlock(); } +bool CppModelManager::isIndexing() const +{ + return m_indexing; +} +void CppModelManager::setIndexing(bool v) +{ + if (m_indexing == v) + return; + m_indexing = v; + if (v) { + emit indexingStarted(); + } else { + emit indexingFinished(); + } +} + +void CppModelManager::onTaskStarted(const QString &type) +{ + if (type == QLatin1String(CppTools::Constants::TASK_INDEX)) + setIndexing(true); +} + +void CppModelManager::onAllTasksFinished(const QString &type) +{ + if (type == QLatin1String(CppTools::Constants::TASK_INDEX)) + setIndexing(false); +} diff --git a/src/plugins/cpptools/cppmodelmanager.h b/src/plugins/cpptools/cppmodelmanager.h index 4222ccab6be..ca13b44a242 100644 --- a/src/plugins/cpptools/cppmodelmanager.h +++ b/src/plugins/cpptools/cppmodelmanager.h @@ -111,6 +111,8 @@ public: void setHeaderSuffixes(const QStringList &suffixes) { m_headerSuffixes = suffixes; } + virtual bool isIndexing() const; + Q_SIGNALS: void projectPathChanged(const QString &projectPath); @@ -129,6 +131,8 @@ private Q_SLOTS: void onProjectAdded(ProjectExplorer::Project *project); void postEditorUpdate(); void updateEditorSelections(); + void onTaskStarted(const QString &type); + void onAllTasksFinished(const QString &type); private: QMap buildWorkingCopyList(); @@ -175,10 +179,13 @@ private: CppPreprocessor *preproc, QStringList files); + void setIndexing(bool); + private: Core::ICore *m_core; CPlusPlus::Snapshot m_snapshot; + bool m_indexing; // cache bool m_dirty; QStringList m_projectFiles; diff --git a/src/plugins/cpptools/cppmodelmanagerinterface.h b/src/plugins/cpptools/cppmodelmanagerinterface.h index 1976df75eab..1ec38abe304 100644 --- a/src/plugins/cpptools/cppmodelmanagerinterface.h +++ b/src/plugins/cpptools/cppmodelmanagerinterface.h @@ -102,6 +102,12 @@ public: virtual void renameUsages(CPlusPlus::Symbol *symbol) = 0; virtual void findUsages(CPlusPlus::Symbol *symbol) = 0; + virtual bool isIndexing() const = 0; + +signals: + void indexingStarted(); + void indexingFinished(); + public Q_SLOTS: void updateModifiedSourceFiles(); virtual void updateSourceFiles(const QStringList &sourceFiles) = 0; diff --git a/src/plugins/cpptools/cpptoolsplugin.cpp b/src/plugins/cpptools/cpptoolsplugin.cpp index bbc894390c8..d321b7c39b3 100644 --- a/src/plugins/cpptools/cpptoolsplugin.cpp +++ b/src/plugins/cpptools/cpptoolsplugin.cpp @@ -47,6 +47,7 @@ #include #include #include +#include #include #include @@ -97,6 +98,11 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error) // Objects m_modelManager = new CppModelManager(this); + Core::VCSManager *vcsManager = core->vcsManager(); + connect(vcsManager, SIGNAL(repositoryChanged(QString)), + m_modelManager, SLOT(updateModifiedSourceFiles())); + connect(vcsManager, SIGNAL(filesChanged(QStringList)), + m_modelManager, SLOT(updateModifiedSourceFiles())); addAutoReleasedObject(m_modelManager); m_completion = new CppCodeCompletion(m_modelManager); diff --git a/src/plugins/cvs/cvscontrol.cpp b/src/plugins/cvs/cvscontrol.cpp index 51edeec5a69..1689f220527 100644 --- a/src/plugins/cvs/cvscontrol.cpp +++ b/src/plugins/cvs/cvscontrol.cpp @@ -96,3 +96,14 @@ QString CVSControl::findTopLevelForDirectory(const QString &directory) const { return m_plugin->findTopLevelForDirectory(directory); } + +void CVSControl::emitRepositoryChanged(const QString &s) +{ + emit repositoryChanged(s); +} + +void CVSControl::emitFilesChanged(const QStringList &l) +{ + emit filesChanged(l); +} + diff --git a/src/plugins/cvs/cvscontrol.h b/src/plugins/cvs/cvscontrol.h index 52067ad3702..c6adb7ffa9c 100644 --- a/src/plugins/cvs/cvscontrol.h +++ b/src/plugins/cvs/cvscontrol.h @@ -56,6 +56,9 @@ public: virtual bool vcsAdd(const QString &fileName); virtual bool vcsDelete(const QString &filename); + void emitRepositoryChanged(const QString &s); + void emitFilesChanged(const QStringList &l); + signals: void enabledChanged(bool); diff --git a/src/plugins/cvs/cvsplugin.cpp b/src/plugins/cvs/cvsplugin.cpp index 654fce42bb3..0fa8619e270 100644 --- a/src/plugins/cvs/cvsplugin.cpp +++ b/src/plugins/cvs/cvsplugin.cpp @@ -551,9 +551,11 @@ void CVSPlugin::revertCurrentFile() QStringList args(QLatin1String("update")); args.push_back(QLatin1String("-C")); - const CVSResponse revertResponse = runCVS(args, QStringList(file), cvsShortTimeOut, true); + const QStringList files = QStringList(file); + const CVSResponse revertResponse = runCVS(args, files, cvsShortTimeOut, true); if (revertResponse.result == CVSResponse::Ok) { fcb.setModifiedReload(true); + m_versionControl->emitFilesChanged(files); } } @@ -734,7 +736,10 @@ void CVSPlugin::updateProject() if (!topLevels.empty()) { QStringList args(QLatin1String("update")); args.push_back(QLatin1String("-dR")); - runCVS(args, topLevels, cvsLongTimeOut, true); + const CVSResponse response = runCVS(args, topLevels, cvsLongTimeOut, true); + if (response.result == CVSResponse::Ok) + foreach(const QString &topLevel, topLevels) + m_versionControl->emitRepositoryChanged(topLevel); } } diff --git a/src/plugins/cvs/cvsplugin.h b/src/plugins/cvs/cvsplugin.h index c0f63473b2b..a1515cfc931 100644 --- a/src/plugins/cvs/cvsplugin.h +++ b/src/plugins/cvs/cvsplugin.h @@ -59,6 +59,7 @@ namespace CVS { namespace Internal { class CVSSubmitEditor; +class CVSControl; struct CVSResponse { @@ -153,7 +154,7 @@ private: void cleanCommitMessageFile(); CVSSettings m_settings; - Core::IVersionControl *m_versionControl; + CVSControl *m_versionControl; QString m_commitMessageFileName; ProjectExplorer::ProjectExplorerPlugin *m_projectExplorer; diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 419784887f0..486196174af 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -34,6 +34,7 @@ #include "gitconstants.h" #include "gitplugin.h" #include "gitsubmiteditor.h" +#include "gitversioncontrol.h" #include #include @@ -43,6 +44,9 @@ #include #include #include +#include +#include + #include #include #include @@ -55,6 +59,7 @@ #include #include #include +#include #include // for msg box parent #include @@ -102,7 +107,8 @@ static QString formatCommand(const QString &binary, const QStringList &args) GitClient::GitClient(GitPlugin* plugin) : m_msgWait(tr("Waiting for data...")), m_plugin(plugin), - m_core(Core::ICore::instance()) + m_core(Core::ICore::instance()), + m_repositoryChangedSignalMapper(0) { if (QSettings *s = m_core->settings()) { m_settings.fromSettings(s); @@ -317,7 +323,8 @@ void GitClient::checkoutBranch(const QString &workingDirectory, const QString &b { QStringList arguments(QLatin1String("checkout")); arguments << branch; - executeGit(workingDirectory, arguments, 0, true); + GitCommand *cmd = executeGit(workingDirectory, arguments, 0, true); + connectRepositoryChanged(workingDirectory, cmd); } void GitClient::checkout(const QString &workingDirectory, const QString &fileName) @@ -341,7 +348,8 @@ void GitClient::hardReset(const QString &workingDirectory, const QString &commit if (!commit.isEmpty()) arguments << commit; - executeGit(workingDirectory, arguments, 0, true); + GitCommand *cmd = executeGit(workingDirectory, arguments, 0, true); + connectRepositoryChanged(workingDirectory, cmd); } void GitClient::addFile(const QString &workingDirectory, const QString &fileName) @@ -500,18 +508,19 @@ GitCommand *GitClient::createCommand(const QString &workingDirectory, } // Execute a single command -void GitClient::executeGit(const QString &workingDirectory, - const QStringList &arguments, - VCSBase::VCSBaseEditor* editor, - bool outputToWindow, - GitCommand::TerminationReportMode tm, - int editorLineNumber) +GitCommand *GitClient::executeGit(const QString &workingDirectory, + const QStringList &arguments, + VCSBase::VCSBaseEditor* editor, + bool outputToWindow, + GitCommand::TerminationReportMode tm, + int editorLineNumber) { VCSBase::VCSBaseOutputWindow::instance()->appendCommand(formatCommand(QLatin1String(Constants::GIT_BINARY), arguments)); GitCommand *command = createCommand(workingDirectory, editor, outputToWindow, editorLineNumber); command->addJob(arguments, m_settings.timeout); command->setTerminationReportMode(tm); command->execute(); + return command; } // Return fixed arguments required to run @@ -903,6 +912,8 @@ void GitClient::revert(const QStringList &files) QString errorMessage; switch (revertI(files, &isDirectory, &errorMessage)) { case RevertOk: + m_plugin->versionControl()->emitFilesChanged(files); + break; case RevertCanceled: break; case RevertUnchanged: { @@ -918,7 +929,8 @@ void GitClient::revert(const QStringList &files) void GitClient::pull(const QString &workingDirectory) { - executeGit(workingDirectory, QStringList(QLatin1String("pull")), 0, true, GitCommand::ReportStderr); + GitCommand *cmd = executeGit(workingDirectory, QStringList(QLatin1String("pull")), 0, true, GitCommand::ReportStderr); + connectRepositoryChanged(workingDirectory, cmd); } void GitClient::push(const QString &workingDirectory) @@ -952,7 +964,8 @@ void GitClient::stashPop(const QString &workingDirectory) { QStringList arguments(QLatin1String("stash")); arguments << QLatin1String("pop"); - executeGit(workingDirectory, arguments, 0, true); + GitCommand *cmd = executeGit(workingDirectory, arguments, 0, true); + connectRepositoryChanged(workingDirectory, cmd); } void GitClient::branchList(const QString &workingDirectory) @@ -1000,3 +1013,16 @@ void GitClient::setSettings(const GitSettings &s) m_binaryPath = m_settings.gitBinaryPath(); } } + +void GitClient::connectRepositoryChanged(const QString & repository, GitCommand *cmd) +{ + // Bind command success termination with repository to changed signal + if (!m_repositoryChangedSignalMapper) { + m_repositoryChangedSignalMapper = new QSignalMapper(this); + connect(m_repositoryChangedSignalMapper, SIGNAL(mapped(QString)), + m_plugin->versionControl(), SIGNAL(repositoryChanged(QString))); + } + m_repositoryChangedSignalMapper->setMapping(cmd, repository); + connect(cmd, SIGNAL(success()), m_repositoryChangedSignalMapper, SLOT(map()), + Qt::QueuedConnection); +} diff --git a/src/plugins/git/gitclient.h b/src/plugins/git/gitclient.h index 341e177f353..76da3120347 100644 --- a/src/plugins/git/gitclient.h +++ b/src/plugins/git/gitclient.h @@ -33,7 +33,6 @@ #include "gitsettings.h" #include "gitcommand.h" -#include #include #include @@ -41,6 +40,7 @@ QT_BEGIN_NAMESPACE class QErrorMessage; +class QSignalMapper; QT_END_NAMESPACE namespace Core { @@ -158,12 +158,12 @@ private: bool outputToWindow = false, int editorLineNumber = -1); - void executeGit(const QString &workingDirectory, - const QStringList &arguments, - VCSBase::VCSBaseEditor* editor = 0, - bool outputToWindow = false, - GitCommand::TerminationReportMode tm = GitCommand::NoReport, - int editorLineNumber = -1); + GitCommand *executeGit(const QString &workingDirectory, + const QStringList &arguments, + VCSBase::VCSBaseEditor* editor = 0, + bool outputToWindow = false, + GitCommand::TerminationReportMode tm = GitCommand::NoReport, + int editorLineNumber = -1); bool synchronousGit(const QString &workingDirectory, const QStringList &arguments, @@ -173,12 +173,14 @@ private: enum RevertResult { RevertOk, RevertUnchanged, RevertCanceled, RevertFailed }; RevertResult revertI(QStringList files, bool *isDirectory, QString *errorMessage); + void connectRepositoryChanged(const QString & repository, GitCommand *cmd); const QString m_msgWait; GitPlugin *m_plugin; Core::ICore *m_core; GitSettings m_settings; QString m_binaryPath; + QSignalMapper *m_repositoryChangedSignalMapper; }; diff --git a/src/plugins/git/gitcommand.cpp b/src/plugins/git/gitcommand.cpp index 3f7a97095e6..ea6c17dab13 100644 --- a/src/plugins/git/gitcommand.cpp +++ b/src/plugins/git/gitcommand.cpp @@ -177,6 +177,8 @@ void GitCommand::run() emit errorText(error); emit finished(ok, m_cookie); + if (ok) + emit success(); // As it is used asynchronously, we need to delete ourselves this->deleteLater(); } diff --git a/src/plugins/git/gitcommand.h b/src/plugins/git/gitcommand.h index 7acf167750f..8f1c5aad0ec 100644 --- a/src/plugins/git/gitcommand.h +++ b/src/plugins/git/gitcommand.h @@ -73,6 +73,7 @@ Q_SIGNALS: void outputData(const QByteArray&); void errorText(const QString&); void finished(bool ok, const QVariant &cookie); + void success(); private: struct Job { diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index 7b51b39fbf8..8ce1b1938d3 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -142,6 +142,7 @@ GitPlugin::GitPlugin() : m_stashListAction(0), m_branchListAction(0), m_gitClient(0), + m_versionControl(0), m_changeSelectionDialog(0), m_submitActionTriggered(false) { @@ -215,8 +216,8 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage) addAutoReleasedObject(new GitSubmitEditorFactory(&submitParameters)); - GitVersionControl *versionControl = new GitVersionControl(m_gitClient); - addAutoReleasedObject(versionControl); + m_versionControl = new GitVersionControl(m_gitClient); + addAutoReleasedObject(m_versionControl); addAutoReleasedObject(new CloneWizard); addAutoReleasedObject(new Gitorious::Internal::GitoriousCloneWizard); @@ -232,8 +233,8 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage) gitContainer->menu()->setTitle(tr("&Git")); toolsContainer->addMenu(gitContainer); if (QAction *ma = gitContainer->menu()->menuAction()) { - ma->setEnabled(versionControl->isEnabled()); - connect(versionControl, SIGNAL(enabledChanged(bool)), ma, SLOT(setVisible(bool))); + ma->setEnabled(m_versionControl->isEnabled()); + connect(m_versionControl, SIGNAL(enabledChanged(bool)), ma, SLOT(setVisible(bool))); } Core::Command *command; @@ -398,6 +399,11 @@ void GitPlugin::extensionsInitialized() { } +GitVersionControl *GitPlugin::versionControl() const +{ + return m_versionControl; +} + void GitPlugin::submitEditorDiff(const QStringList &unstaged, const QStringList &staged) { m_gitClient->diff(m_submitRepository, QStringList(), unstaged, staged); diff --git a/src/plugins/git/gitplugin.h b/src/plugins/git/gitplugin.h index 4f934a89393..0d6ad7fbdd5 100644 --- a/src/plugins/git/gitplugin.h +++ b/src/plugins/git/gitplugin.h @@ -59,6 +59,7 @@ namespace Git { namespace Internal { class GitPlugin; +class GitVersionControl; class GitClient; class ChangeSelectionDialog; class GitSubmitEditor; @@ -96,6 +97,7 @@ public: void setSettings(const GitSettings &s); GitClient *gitClient() const; + GitVersionControl *versionControl() const; public slots: void updateActions(); @@ -159,6 +161,7 @@ private: QAction *m_branchListAction; GitClient *m_gitClient; + GitVersionControl *m_versionControl; ChangeSelectionDialog *m_changeSelectionDialog; QString m_submitRepository; QStringList m_submitOrigCommitFiles; diff --git a/src/plugins/git/gitversioncontrol.cpp b/src/plugins/git/gitversioncontrol.cpp index 559d296220e..c64a683bea0 100644 --- a/src/plugins/git/gitversioncontrol.cpp +++ b/src/plugins/git/gitversioncontrol.cpp @@ -96,5 +96,10 @@ QString GitVersionControl::findTopLevelForDirectory(const QString &directory) co return GitClient::findRepositoryForDirectory(directory); } +void GitVersionControl::emitFilesChanged(const QStringList &l) +{ + emit filesChanged(l); +} + } // Internal } // Git diff --git a/src/plugins/git/gitversioncontrol.h b/src/plugins/git/gitversioncontrol.h index 72908b0da22..44598000638 100644 --- a/src/plugins/git/gitversioncontrol.h +++ b/src/plugins/git/gitversioncontrol.h @@ -57,6 +57,8 @@ public: virtual bool vcsAdd(const QString &fileName); virtual bool vcsDelete(const QString &filename); + void emitFilesChanged(const QStringList &); + signals: void enabledChanged(bool); diff --git a/src/plugins/perforce/perforceplugin.cpp b/src/plugins/perforce/perforceplugin.cpp index 7039798b094..a80d8f55973 100644 --- a/src/plugins/perforce/perforceplugin.cpp +++ b/src/plugins/perforce/perforceplugin.cpp @@ -454,6 +454,8 @@ void PerforcePlugin::revertCurrentFile() Core::FileChangeBlocker fcb(fileName); fcb.setModifiedReload(true); PerforceResponse result2 = runP4Cmd(QStringList() << QLatin1String("revert") << fileName, QStringList(), CommandToWindow|StdOutToWindow|StdErrToWindow|ErrorToWindow); + if (!result2.error) + m_versionControl->emitFilesChanged(QStringList(fileName)); } void PerforcePlugin::diffCurrentFile() @@ -514,7 +516,10 @@ void PerforcePlugin::updateCheckout(const QStringList &dirs) { QStringList args(QLatin1String("sync")); args.append(dirs); - runP4Cmd(args, QStringList(), CommandToWindow|StdOutToWindow|StdErrToWindow|ErrorToWindow); + const PerforceResponse resp = runP4Cmd(args, QStringList(), CommandToWindow|StdOutToWindow|StdErrToWindow|ErrorToWindow); + if (!dirs.empty()) + foreach(const QString &dir, dirs) + m_versionControl->emitRepositoryChanged(dir); } void PerforcePlugin::printOpenedFileList() diff --git a/src/plugins/perforce/perforceversioncontrol.cpp b/src/plugins/perforce/perforceversioncontrol.cpp index 040692428d8..ad915b2a208 100644 --- a/src/plugins/perforce/perforceversioncontrol.cpp +++ b/src/plugins/perforce/perforceversioncontrol.cpp @@ -94,5 +94,15 @@ QString PerforceVersionControl::findTopLevelForDirectory(const QString &director return m_plugin->findTopLevelForDirectory(directory); } +void PerforceVersionControl::emitRepositoryChanged(const QString &s) +{ + emit repositoryChanged(s); +} + +void PerforceVersionControl::emitFilesChanged(const QStringList &l) +{ + emit filesChanged(l); +} + } // Internal } // Perforce diff --git a/src/plugins/perforce/perforceversioncontrol.h b/src/plugins/perforce/perforceversioncontrol.h index 2992e5518be..dd385061cbc 100644 --- a/src/plugins/perforce/perforceversioncontrol.h +++ b/src/plugins/perforce/perforceversioncontrol.h @@ -56,6 +56,9 @@ public: virtual bool vcsAdd(const QString &fileName); virtual bool vcsDelete(const QString &filename); + void emitRepositoryChanged(const QString &s); + void emitFilesChanged(const QStringList &l); + signals: void enabledChanged(bool); diff --git a/src/plugins/subversion/subversioncontrol.cpp b/src/plugins/subversion/subversioncontrol.cpp index 32ef57e5ecc..ff0e0f1c81e 100644 --- a/src/plugins/subversion/subversioncontrol.cpp +++ b/src/plugins/subversion/subversioncontrol.cpp @@ -96,3 +96,13 @@ QString SubversionControl::findTopLevelForDirectory(const QString &directory) co { return m_plugin->findTopLevelForDirectory(directory); } + +void SubversionControl::emitRepositoryChanged(const QString &s) +{ + emit repositoryChanged(s); +} + +void SubversionControl::emitFilesChanged(const QStringList &l) +{ + emit filesChanged(l); +} diff --git a/src/plugins/subversion/subversioncontrol.h b/src/plugins/subversion/subversioncontrol.h index 42f64ab147e..325cfd10989 100644 --- a/src/plugins/subversion/subversioncontrol.h +++ b/src/plugins/subversion/subversioncontrol.h @@ -56,6 +56,9 @@ public: virtual bool vcsAdd(const QString &fileName); virtual bool vcsDelete(const QString &filename); + void emitRepositoryChanged(const QString &); + void emitFilesChanged(const QStringList &); + signals: void enabledChanged(bool); diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp index 676ffc2b8ad..0060e023953 100644 --- a/src/plugins/subversion/subversionplugin.cpp +++ b/src/plugins/subversion/subversionplugin.cpp @@ -574,6 +574,7 @@ void SubversionPlugin::revertCurrentFile() const SubversionResponse revertResponse = runSvn(args, subversionShortTimeOut, true); if (!revertResponse.error) { fcb.setModifiedReload(true); + m_versionControl->emitFilesChanged(QStringList(file)); } } @@ -750,7 +751,10 @@ void SubversionPlugin::updateProject() QStringList args(QLatin1String("update")); args.push_back(QLatin1String(nonInteractiveOptionC)); args.append(topLevels); - runSvn(args, subversionLongTimeOut, true); + const SubversionResponse response = runSvn(args, subversionLongTimeOut, true); + if (!response.error) + foreach(const QString &repo, topLevels) + m_versionControl->emitRepositoryChanged(repo); } void SubversionPlugin::annotateCurrentFile() diff --git a/src/plugins/subversion/subversionplugin.h b/src/plugins/subversion/subversionplugin.h index 1dcfce68032..6e3dab7e5d3 100644 --- a/src/plugins/subversion/subversionplugin.h +++ b/src/plugins/subversion/subversionplugin.h @@ -56,6 +56,7 @@ namespace Subversion { namespace Internal { class SubversionSubmitEditor; +class SubversionControl; struct SubversionResponse { @@ -131,7 +132,7 @@ private: const QStringList m_svnDirectories; SubversionSettings m_settings; - Core::IVersionControl *m_versionControl; + SubversionControl *m_versionControl; QString m_commitMessageFileName; ProjectExplorer::ProjectExplorerPlugin *m_projectExplorer; From 55dbc39ed01efdec6be8d3ad730dc923f922880c Mon Sep 17 00:00:00 2001 From: mae Date: Mon, 9 Nov 2009 15:55:47 +0100 Subject: [PATCH 08/34] Fix auto-indentation when pasting into a selection --- src/plugins/texteditor/basetexteditor.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index cd406907e03..2e1de346320 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -4654,6 +4654,7 @@ void BaseTextEditor::insertFromMimeData(const QMimeData *source) } cursor.beginEditBlock(); + cursor.removeSelectedText(); bool insertAtBeginningOfLine = ts.cursorIsAtBeginningOfLine(cursor); @@ -4664,8 +4665,6 @@ void BaseTextEditor::insertFromMimeData(const QMimeData *source) return; } - cursor.removeSelectedText(); - int reindentBlockStart = cursor.blockNumber() + (insertAtBeginningOfLine?0:1); bool hasFinalNewline = (text.endsWith(QLatin1Char('\n')) From 1e6a90bcb314550e3b0899aaa1905f7174b03abf Mon Sep 17 00:00:00 2001 From: mae Date: Mon, 9 Nov 2009 15:59:48 +0100 Subject: [PATCH 09/34] optimize extra area painting --- src/plugins/texteditor/basetexteditor.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index 2e1de346320..982ce7de3f3 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -2489,8 +2489,6 @@ void BaseTextEditor::extraAreaPaintEvent(QPaintEvent *e) int markWidth = 0; if (d->m_marksVisible) markWidth += fm.lineSpacing(); -// if (documentLayout->doubleMarkCount) -// markWidth += fm.lineSpacing() / 3; const int collapseColumnWidth = d->m_codeFoldingVisible ? collapseBoxWidth(fm): 0; const int extraAreaWidth = d->m_extraArea->width() - collapseColumnWidth; @@ -2519,6 +2517,12 @@ void BaseTextEditor::extraAreaPaintEvent(QPaintEvent *e) nextVisibleBlockNumber = nextVisibleBlock.blockNumber(); } + if (bottom < e->rect().top()) { + block = nextVisibleBlock; + blockNumber = nextVisibleBlockNumber; + continue; + } + painter.setPen(pal.color(QPalette::Dark)); if (d->m_codeFoldingVisible || d->m_marksVisible) { From b519a1132ab05b91226eea9ee1ccd3628fa1e4b0 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 9 Nov 2009 16:25:40 +0100 Subject: [PATCH 10/34] Debugger: Activate code model scope checking, environment var for Trk verbosity. Reviewed-by: hjk --- src/plugins/debugger/debuggeractions.cpp | 4 ++-- src/plugins/debugger/gdb/trkgdbadapter.cpp | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/plugins/debugger/debuggeractions.cpp b/src/plugins/debugger/debuggeractions.cpp index 4a0b0f783eb..52a483d9521 100644 --- a/src/plugins/debugger/debuggeractions.cpp +++ b/src/plugins/debugger/debuggeractions.cpp @@ -233,8 +233,8 @@ DebuggerSettings *DebuggerSettings::instance() item->setSettingsKey(debugModeGroup, QLatin1String("UseCodeModel")); item->setText(tr("Use code model")); item->setCheckable(true); - item->setDefaultValue(false); - item->setValue(false); + item->setDefaultValue(true); + item->setValue(true); instance->insertItem(UseCodeModel, item); item = new SavedAction(instance); diff --git a/src/plugins/debugger/gdb/trkgdbadapter.cpp b/src/plugins/debugger/gdb/trkgdbadapter.cpp index dcbe2851eea..3eab98ab2e7 100644 --- a/src/plugins/debugger/gdb/trkgdbadapter.cpp +++ b/src/plugins/debugger/gdb/trkgdbadapter.cpp @@ -197,9 +197,17 @@ TrkGdbAdapter::TrkGdbAdapter(GdbEngine *engine, const TrkOptionsPtr &options) : m_running(false), m_trkDevice(new trk::TrkDevice), m_gdbAckMode(true), - m_verbose(2), + m_verbose(0), m_bufferedMemoryRead(true) { + const QByteArray trkVerbose = qgetenv("QTC_TRK_VERBOSE"); + if (!trkVerbose.isEmpty()) { + bool ok; + m_verbose = trkVerbose.toInt(&ok); + if (!ok) + m_verbose = 1; + } + m_gdbServer = 0; m_gdbConnection = 0; #ifdef Q_OS_WIN From fa2a115aa37c1de5a7e79e4eb77255c641d2396f Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 9 Nov 2009 16:25:24 +0100 Subject: [PATCH 11/34] debugger: use 'set substitute-path' --- src/plugins/debugger/debuggermanager.h | 1 + src/plugins/debugger/debuggerrunner.cpp | 16 ++++++++++++++++ src/plugins/debugger/gdb/gdbengine.cpp | 15 +++++++++++++++ 3 files changed, 32 insertions(+) diff --git a/src/plugins/debugger/debuggermanager.h b/src/plugins/debugger/debuggermanager.h index 5e78170a1ec..05639618b2e 100644 --- a/src/plugins/debugger/debuggermanager.h +++ b/src/plugins/debugger/debuggermanager.h @@ -118,6 +118,7 @@ public: QString symbolFileName; QString serverStartScript; int toolChainType; + QString qtInstallPath; QString dumperLibrary; QStringList dumperLibraryLocations; diff --git a/src/plugins/debugger/debuggerrunner.cpp b/src/plugins/debugger/debuggerrunner.cpp index 17e11a1e095..64b9f310f87 100644 --- a/src/plugins/debugger/debuggerrunner.cpp +++ b/src/plugins/debugger/debuggerrunner.cpp @@ -31,6 +31,7 @@ #include "debuggermanager.h" +#include #include #include #include @@ -170,6 +171,21 @@ DebuggerRunControl::DebuggerRunControl(DebuggerManager *manager, runConfiguration->dumperLibrary(); m_startParameters->dumperLibraryLocations = runConfiguration->dumperLibraryLocations(); + + QString qmakePath = ProjectExplorer::DebuggingHelperLibrary::findSystemQt( + runConfiguration->environment()); + if (!qmakePath.isEmpty()) { + QProcess proc; + QStringList args; + args.append(QLatin1String("-query")); + args.append(QLatin1String("QT_INSTALL_HEADERS")); + proc.start(qmakePath, args); + proc.waitForFinished(); + QByteArray ba = proc.readAllStandardOutput().trimmed(); + QFileInfo fi(QString::fromLocal8Bit(ba) + "/.."); + m_startParameters->qtInstallPath = fi.absoluteFilePath(); + } + } void DebuggerRunControl::start() diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 4a7f5e9fac7..11e0860b11c 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -4427,6 +4427,21 @@ void GdbEngine::handleAdapterStarted() void GdbEngine::handleInferiorPrepared() { + const QString qtInstallPath = m_startParameters->qtInstallPath; + if (!qtInstallPath.isEmpty()) { + QString qtBuildPath = + #if defined(Q_OS_WIN) + _("C:/qt-greenhouse/Trolltech/Code_less_create_more/Trolltech/Code_less_create_more/Troll/4.6/qt"); + #elif defined(Q_OS_MAC) + QString(); + #else + _("/var/tmp/qt-x11-src-4.6.0"); + #endif + if (!qtBuildPath.isEmpty()) + postCommand(_("set substitute-path %1 %2") + .arg(qtBuildPath).arg(qtInstallPath)); + } + // Initial attempt to set breakpoints showStatusMessage(tr("Setting breakpoints...")); attemptBreakpointSynchronization(); From 8ee769a3bc5b15226e09a78537ad4548cfe7a5e7 Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Mon, 9 Nov 2009 16:03:32 +0100 Subject: [PATCH 12/34] Disabling "Undo Project Changes" when not working in a Git repository. Reviewed-by: Friedemann Kleint --- src/plugins/git/gitplugin.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index 8ce1b1938d3..6e442bec7f2 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -759,6 +759,7 @@ void GitPlugin::updateActions() m_statusProjectAction->setEnabled(false); m_logProjectAction->setParameter(repository); m_logProjectAction->setEnabled(false); + m_undoProjectAction->setEnabled(false); return; } @@ -778,6 +779,7 @@ void GitPlugin::updateActions() m_statusProjectAction->setParameter(project); m_logProjectAction->setEnabled(enabled); m_logProjectAction->setParameter(project); + m_undoProjectAction->setEnabled(enabled); } void GitPlugin::showCommit() From a0bb57f27adc761fab013196aa0354d039e3d306 Mon Sep 17 00:00:00 2001 From: mae Date: Mon, 9 Nov 2009 16:47:48 +0100 Subject: [PATCH 13/34] remove run action in the scripteditor the action is not needed and conflicts with Ctrl+R of the project manager. --- .../qt4projectmanager/qt4runconfiguration.cpp | 1 + src/plugins/qtscripteditor/qtscripteditor.cpp | 3 ++- .../qtscripteditor/qtscripteditoractionhandler.cpp | 7 +++---- .../qtscripteditor/qtscripteditoractionhandler.h | 3 --- .../qtscripteditor/qtscripteditorconstants.h | 2 -- .../qtscripteditor/qtscripteditorplugin.cpp | 14 ++------------ 6 files changed, 8 insertions(+), 22 deletions(-) diff --git a/src/plugins/qt4projectmanager/qt4runconfiguration.cpp b/src/plugins/qt4projectmanager/qt4runconfiguration.cpp index 413122224b1..586e894ba93 100644 --- a/src/plugins/qt4projectmanager/qt4runconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt4runconfiguration.cpp @@ -104,6 +104,7 @@ bool Qt4RunConfiguration::isEnabled(ProjectExplorer::BuildConfiguration *configu && type != ProjectExplorer::ToolChain::RVCT_ARMV5 && type != ProjectExplorer::ToolChain::RVCT_ARMV6; #else + Q_UNUSED(configuration); return true; #endif } diff --git a/src/plugins/qtscripteditor/qtscripteditor.cpp b/src/plugins/qtscripteditor/qtscripteditor.cpp index 403571b14cc..fbd91ab062b 100644 --- a/src/plugins/qtscripteditor/qtscripteditor.cpp +++ b/src/plugins/qtscripteditor/qtscripteditor.cpp @@ -395,7 +395,7 @@ void ScriptEditor::createToolBar(ScriptEditorEditable *editable) void ScriptEditor::contextMenuEvent(QContextMenuEvent *e) { - QMenu *menu = createStandardContextMenu(); + QMenu *menu = new QMenu(); if (Core::ActionContainer *mcontext = Core::ICore::instance()->actionManager()->actionContainer(QtScriptEditor::Constants::M_CONTEXT)) { QMenu *contextMenu = mcontext->menu(); @@ -403,6 +403,7 @@ void ScriptEditor::contextMenuEvent(QContextMenuEvent *e) menu->addAction(action); } + appendStandardContextMenuActions(menu); menu->exec(e->globalPos()); delete menu; } diff --git a/src/plugins/qtscripteditor/qtscripteditoractionhandler.cpp b/src/plugins/qtscripteditor/qtscripteditoractionhandler.cpp index b00ac381eba..3c48ea9b25e 100644 --- a/src/plugins/qtscripteditor/qtscripteditoractionhandler.cpp +++ b/src/plugins/qtscripteditor/qtscripteditoractionhandler.cpp @@ -40,6 +40,7 @@ #include #include +#if 0 static QAction *actionFromId(const QString &id) { Core::Command *cmd = Core::ICore::instance()->actionManager()->command(id); @@ -47,22 +48,20 @@ static QAction *actionFromId(const QString &id) return 0; return cmd->action(); } +#endif namespace QtScriptEditor { namespace Internal { QtScriptEditorActionHandler::QtScriptEditorActionHandler() : TextEditor::TextEditorActionHandler(QLatin1String(QtScriptEditor::Constants::C_QTSCRIPTEDITOR), - Format), - m_runAction(0) + Format) { } void QtScriptEditorActionHandler::createActions() { TextEditor::TextEditorActionHandler::createActions(); - m_runAction = actionFromId(QLatin1String(QtScriptEditor::Constants::RUN)); - connect(m_runAction, SIGNAL(triggered()), this, SLOT(run())); } diff --git a/src/plugins/qtscripteditor/qtscripteditoractionhandler.h b/src/plugins/qtscripteditor/qtscripteditoractionhandler.h index 3272a77c2f7..8e94c2a454d 100644 --- a/src/plugins/qtscripteditor/qtscripteditoractionhandler.h +++ b/src/plugins/qtscripteditor/qtscripteditoractionhandler.h @@ -47,9 +47,6 @@ private: private slots: void run(); - -private: - QAction *m_runAction; }; } // namespace Internal diff --git a/src/plugins/qtscripteditor/qtscripteditorconstants.h b/src/plugins/qtscripteditor/qtscripteditorconstants.h index 401697a8141..0c7704ba0de 100644 --- a/src/plugins/qtscripteditor/qtscripteditorconstants.h +++ b/src/plugins/qtscripteditor/qtscripteditorconstants.h @@ -34,8 +34,6 @@ namespace QtScriptEditor { namespace Constants { const char * const M_CONTEXT = "Qt Script Editor.ContextMenu"; -const char * const RUN = "QtScriptEditor.Run"; -const char * const RUN_SEP = "QtScriptEditor.Run.Separator"; const char * const C_QTSCRIPTEDITOR = "Qt Script Editor"; const char * const C_QTSCRIPTEDITOR_MIMETYPE = "application/javascript"; diff --git a/src/plugins/qtscripteditor/qtscripteditorplugin.cpp b/src/plugins/qtscripteditor/qtscripteditorplugin.cpp index c3c06b7280a..5ff65d9bc44 100644 --- a/src/plugins/qtscripteditor/qtscripteditorplugin.cpp +++ b/src/plugins/qtscripteditor/qtscripteditorplugin.cpp @@ -145,18 +145,8 @@ void QtScriptEditorPlugin::initializeEditor(QtScriptEditor::Internal::ScriptEdit void QtScriptEditorPlugin::registerActions() { - Core::ActionManager *am = Core::ICore::instance()->actionManager(); - Core::ActionContainer *mcontext = am->createMenu(QtScriptEditor::Constants::M_CONTEXT); - - QAction *action = new QAction(this); - action->setSeparator(true); - Core::Command *cmd = am->registerAction(action, QtScriptEditor::Constants::RUN_SEP, m_scriptcontext); - mcontext->addAction(cmd, Core::Constants::G_DEFAULT_THREE); - - action = new QAction(tr("Run"), this); - cmd = am->registerAction(action, QtScriptEditor::Constants::RUN, m_scriptcontext); - cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+R"))); - mcontext->addAction(cmd, Core::Constants::G_DEFAULT_THREE); +// Core::ActionManager *am = Core::ICore::instance()->actionManager(); +// Core::ActionContainer *mcontext = am->createMenu(QtScriptEditor::Constants::M_CONTEXT); } Q_EXPORT_PLUGIN(QtScriptEditorPlugin) From 3452b4214db2681ee9013bbc4a96a7372b2edd48 Mon Sep 17 00:00:00 2001 From: mae Date: Mon, 9 Nov 2009 17:35:20 +0100 Subject: [PATCH 14/34] implement the standard context menu also for the script editors In addition, clean up the text editor action handling in the qtscript plugin. Rev-by: con --- src/plugins/qmleditor/qmleditor.cpp | 4 +- src/plugins/qmleditor/qmleditorplugin.cpp | 7 ++ src/plugins/qtscripteditor/qtscripteditor.cpp | 6 ++ src/plugins/qtscripteditor/qtscripteditor.h | 2 + src/plugins/qtscripteditor/qtscripteditor.pro | 2 - .../qtscripteditoractionhandler.cpp | 99 ------------------- .../qtscripteditoractionhandler.h | 55 ----------- .../qtscripteditor/qtscripteditorfactory.cpp | 9 +- .../qtscripteditor/qtscripteditorfactory.h | 2 - .../qtscripteditor/qtscripteditorplugin.cpp | 18 ++-- 10 files changed, 35 insertions(+), 169 deletions(-) delete mode 100644 src/plugins/qtscripteditor/qtscripteditoractionhandler.cpp delete mode 100644 src/plugins/qtscripteditor/qtscripteditoractionhandler.h diff --git a/src/plugins/qmleditor/qmleditor.cpp b/src/plugins/qmleditor/qmleditor.cpp index 76d44b67773..3790a27c732 100644 --- a/src/plugins/qmleditor/qmleditor.cpp +++ b/src/plugins/qmleditor/qmleditor.cpp @@ -746,7 +746,7 @@ TextEditor::BaseTextEditor::Link ScriptEditor::findLinkAt(const QTextCursor &cur void ScriptEditor::contextMenuEvent(QContextMenuEvent *e) { - QMenu *menu = createStandardContextMenu(); + QMenu *menu = new QMenu(); if (Core::ActionContainer *mcontext = Core::ICore::instance()->actionManager()->actionContainer(QmlEditor::Constants::M_CONTEXT)) { QMenu *contextMenu = mcontext->menu(); @@ -762,6 +762,8 @@ void ScriptEditor::contextMenuEvent(QContextMenuEvent *e) connect(a, SIGNAL(triggered()), this, SLOT(renameIdUnderCursor())); } + appendStandardContextMenuActions(menu); + menu->exec(e->globalPos()); menu->deleteLater(); } diff --git a/src/plugins/qmleditor/qmleditorplugin.cpp b/src/plugins/qmleditor/qmleditorplugin.cpp index 47b71b9af18..5958ab469a1 100644 --- a/src/plugins/qmleditor/qmleditorplugin.cpp +++ b/src/plugins/qmleditor/qmleditorplugin.cpp @@ -114,6 +114,13 @@ bool QmlEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err | TextEditor::TextEditorActionHandler::UnCollapseAll); m_actionHandler->initializeActions(); + Core::ActionManager *am = core->actionManager(); + Core::ActionContainer *contextMenu= am->createMenu(QmlEditor::Constants::M_CONTEXT); + Core::Command *cmd = am->command(TextEditor::Constants::AUTO_INDENT_SELECTION); + contextMenu->addAction(cmd); + cmd = am->command(TextEditor::Constants::UN_COMMENT_SELECTION); + contextMenu->addAction(cmd); + m_completion = new QmlCodeCompletion(); addAutoReleasedObject(m_completion); diff --git a/src/plugins/qtscripteditor/qtscripteditor.cpp b/src/plugins/qtscripteditor/qtscripteditor.cpp index fbd91ab062b..d751a87d395 100644 --- a/src/plugins/qtscripteditor/qtscripteditor.cpp +++ b/src/plugins/qtscripteditor/qtscripteditor.cpp @@ -40,6 +40,7 @@ #include "parser/javascriptast_p.h" #include +#include #include #include @@ -408,5 +409,10 @@ void ScriptEditor::contextMenuEvent(QContextMenuEvent *e) delete menu; } +void ScriptEditor::unCommentSelection() +{ + Utils::unCommentSelection(this); +} + } // namespace Internal } // namespace QtScriptEditor diff --git a/src/plugins/qtscripteditor/qtscripteditor.h b/src/plugins/qtscripteditor/qtscripteditor.h index 06e72371bd1..6556176a350 100644 --- a/src/plugins/qtscripteditor/qtscripteditor.h +++ b/src/plugins/qtscripteditor/qtscripteditor.h @@ -95,6 +95,8 @@ public: QList declarations() const; QStringList words() const; + void unCommentSelection(); // from basetexteditor + public slots: virtual void setFontSettings(const TextEditor::FontSettings &); diff --git a/src/plugins/qtscripteditor/qtscripteditor.pro b/src/plugins/qtscripteditor/qtscripteditor.pro index 7fd3ff19c6d..2ff0c5699e7 100644 --- a/src/plugins/qtscripteditor/qtscripteditor.pro +++ b/src/plugins/qtscripteditor/qtscripteditor.pro @@ -13,14 +13,12 @@ HEADERS += qtscripteditor.h \ qtscripteditorfactory.h \ qtscripteditorplugin.h \ qtscripthighlighter.h \ -qtscripteditoractionhandler.h \ qtscriptcodecompletion.h SOURCES += qtscripteditor.cpp \ qtscripteditorfactory.cpp \ qtscripteditorplugin.cpp \ qtscripthighlighter.cpp \ -qtscripteditoractionhandler.cpp \ qtscriptcodecompletion.cpp RESOURCES += qtscripteditor.qrc diff --git a/src/plugins/qtscripteditor/qtscripteditoractionhandler.cpp b/src/plugins/qtscripteditor/qtscripteditoractionhandler.cpp deleted file mode 100644 index 3c48ea9b25e..00000000000 --- a/src/plugins/qtscripteditor/qtscripteditoractionhandler.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** Commercial Usage -** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** GNU Lesser General Public License Usage -** -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. -** -**************************************************************************/ - -#include "qtscripteditoractionhandler.h" -#include "qtscripteditorconstants.h" -#include "qtscripteditor.h" - -#include -#include -#include - -#include -#include -#include -#include - -#if 0 -static QAction *actionFromId(const QString &id) -{ - Core::Command *cmd = Core::ICore::instance()->actionManager()->command(id); - if (!cmd) - return 0; - return cmd->action(); -} -#endif - -namespace QtScriptEditor { -namespace Internal { - -QtScriptEditorActionHandler::QtScriptEditorActionHandler() - : TextEditor::TextEditorActionHandler(QLatin1String(QtScriptEditor::Constants::C_QTSCRIPTEDITOR), - Format) -{ -} - -void QtScriptEditorActionHandler::createActions() -{ - TextEditor::TextEditorActionHandler::createActions(); -} - - -void QtScriptEditorActionHandler::run() -{ - typedef Core::ScriptManager::Stack Stack; - if (!currentEditor()) - return; - - const QString script = currentEditor()->toPlainText(); - - // run - Stack errorStack; - QString errorMessage; - if (Core::ICore::instance()->scriptManager()->runScript(script, &errorMessage, &errorStack)) - return; - - // try to find a suitable error line in the stack - // ignoring 0 and other files (todo: open other files?) - int errorLineNumber = 0; - if (const int numFrames = errorStack.size()) { - for (int f = 0; f < numFrames; f++) { - if (errorStack[f].lineNumber && errorStack[f].fileName.isEmpty()) { - errorLineNumber = errorStack[f].lineNumber; - break; - } - } - } - if (errorLineNumber) - currentEditor()->gotoLine(errorLineNumber); - QMessageBox::critical(Core::ICore::instance()->mainWindow(), tr("Qt Script Error"), errorMessage); -} - -} // namespace Internal -} // namespace QtScriptEditor diff --git a/src/plugins/qtscripteditor/qtscripteditoractionhandler.h b/src/plugins/qtscripteditor/qtscripteditoractionhandler.h deleted file mode 100644 index 8e94c2a454d..00000000000 --- a/src/plugins/qtscripteditor/qtscripteditoractionhandler.h +++ /dev/null @@ -1,55 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** Commercial Usage -** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** GNU Lesser General Public License Usage -** -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. -** -**************************************************************************/ - -#ifndef QTSCRIPTDITORACTIONHANDLER_H -#define QTSCRIPTDITORACTIONHANDLER_H - -#include - -namespace QtScriptEditor { -namespace Internal { - -class QtScriptEditorActionHandler : public TextEditor::TextEditorActionHandler -{ - Q_OBJECT - -public: - QtScriptEditorActionHandler(); - -private: - virtual void createActions(); - -private slots: - void run(); -}; - -} // namespace Internal -} // namespace QtScriptEditor - -#endif // QTSCRIPTDITORACTIONHANDLER_H diff --git a/src/plugins/qtscripteditor/qtscripteditorfactory.cpp b/src/plugins/qtscripteditor/qtscripteditorfactory.cpp index 03cf1b98449..7e4ae5715b2 100644 --- a/src/plugins/qtscripteditor/qtscripteditorfactory.cpp +++ b/src/plugins/qtscripteditor/qtscripteditorfactory.cpp @@ -29,11 +29,14 @@ #include "qtscripteditorfactory.h" #include "qtscripteditor.h" -#include "qtscripteditoractionhandler.h" #include "qtscripteditorconstants.h" #include "qtscripteditorplugin.h" +#include #include +#include + +#include #include #include @@ -45,14 +48,12 @@ QtScriptEditorFactory::QtScriptEditorFactory(const Context &context, QObject *pa : Core::IEditorFactory(parent), m_kind(QLatin1String(C_QTSCRIPTEDITOR)), m_mimeTypes(QLatin1String(QtScriptEditor::Constants::C_QTSCRIPTEDITOR_MIMETYPE)), - m_context(context), - m_actionHandler(new QtScriptEditorActionHandler) + m_context(context) { } QtScriptEditorFactory::~QtScriptEditorFactory() { - delete m_actionHandler; } QString QtScriptEditorFactory::kind() const diff --git a/src/plugins/qtscripteditor/qtscripteditorfactory.h b/src/plugins/qtscripteditor/qtscripteditorfactory.h index 93c222daa98..0556f35f16c 100644 --- a/src/plugins/qtscripteditor/qtscripteditorfactory.h +++ b/src/plugins/qtscripteditor/qtscripteditorfactory.h @@ -63,8 +63,6 @@ private: const QString m_kind; const QStringList m_mimeTypes; const Context m_context; - - TextEditor::TextEditorActionHandler *m_actionHandler; }; } // namespace Internal diff --git a/src/plugins/qtscripteditor/qtscripteditorplugin.cpp b/src/plugins/qtscripteditor/qtscripteditorplugin.cpp index 5ff65d9bc44..266d2d48204 100644 --- a/src/plugins/qtscripteditor/qtscripteditorplugin.cpp +++ b/src/plugins/qtscripteditor/qtscripteditorplugin.cpp @@ -88,6 +88,11 @@ bool QtScriptEditorPlugin::initialize(const QStringList & /*arguments*/, QString m_context = m_scriptcontext; m_context << core->uniqueIDManager()->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR); + m_actionHandler = new TextEditor::TextEditorActionHandler(QtScriptEditor::Constants::C_QTSCRIPTEDITOR, + TextEditor::TextEditorActionHandler::Format + | TextEditor::TextEditorActionHandler::UnCommentSelection + | TextEditor::TextEditorActionHandler::UnCollapseAll); + registerActions(); m_editor = new QtScriptEditorFactory(m_context, this); @@ -104,10 +109,6 @@ bool QtScriptEditorPlugin::initialize(const QStringList & /*arguments*/, QString wizardParameters, this); addObject(m_wizard); - m_actionHandler = new TextEditor::TextEditorActionHandler(QtScriptEditor::Constants::C_QTSCRIPTEDITOR, - TextEditor::TextEditorActionHandler::Format - | TextEditor::TextEditorActionHandler::UnCommentSelection - | TextEditor::TextEditorActionHandler::UnCollapseAll); m_completion = new QtScriptCodeCompletion(); addAutoReleasedObject(m_completion); @@ -145,8 +146,13 @@ void QtScriptEditorPlugin::initializeEditor(QtScriptEditor::Internal::ScriptEdit void QtScriptEditorPlugin::registerActions() { -// Core::ActionManager *am = Core::ICore::instance()->actionManager(); -// Core::ActionContainer *mcontext = am->createMenu(QtScriptEditor::Constants::M_CONTEXT); + m_actionHandler->initializeActions(); + Core::ActionManager *am = Core::ICore::instance()->actionManager(); + Core::ActionContainer *contextMenu= am->createMenu(QtScriptEditor::Constants::M_CONTEXT); + Core::Command *cmd = am->command(TextEditor::Constants::AUTO_INDENT_SELECTION); + contextMenu->addAction(cmd); + cmd = am->command(TextEditor::Constants::UN_COMMENT_SELECTION); + contextMenu->addAction(cmd); } Q_EXPORT_PLUGIN(QtScriptEditorPlugin) From f257f19b03e009c239bbcd0463744cb28b21504d Mon Sep 17 00:00:00 2001 From: con Date: Mon, 9 Nov 2009 18:34:38 +0100 Subject: [PATCH 15/34] Some missing defines for Symbian tool chains. Reviewed-by: dt --- .../qt4projectmanager/qt-s60/gccetoolchain.cpp | 11 +++++++++++ src/plugins/qt4projectmanager/qt-s60/gccetoolchain.h | 1 + .../qt4projectmanager/qt-s60/rvcttoolchain.cpp | 5 +++-- .../qt4projectmanager/qt-s60/winscwtoolchain.cpp | 7 +++---- .../qt4projectmanager/qt-s60/winscwtoolchain.h | 1 - 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/plugins/qt4projectmanager/qt-s60/gccetoolchain.cpp b/src/plugins/qt4projectmanager/qt-s60/gccetoolchain.cpp index 3c467bb1cb8..ab4bb0df8df 100644 --- a/src/plugins/qt4projectmanager/qt-s60/gccetoolchain.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/gccetoolchain.cpp @@ -51,6 +51,17 @@ ToolChain::ToolChainType GCCEToolChain::type() const return ToolChain::GCCE; } +QByteArray GCCEToolChain::predefinedMacros() +{ + if (m_predefinedMacros.isEmpty()) { + ProjectExplorer::GccToolChain::predefinedMacros(); + m_predefinedMacros += "\n" + "#define __GCCE__\n" + "#define __SYMBIAN32__\n"; + } + return m_predefinedMacros; +} + QList GCCEToolChain::systemHeaderPaths() { if (m_systemHeaderPaths.isEmpty()) { diff --git a/src/plugins/qt4projectmanager/qt-s60/gccetoolchain.h b/src/plugins/qt4projectmanager/qt-s60/gccetoolchain.h index 53cd0515c59..84d30909dc2 100644 --- a/src/plugins/qt4projectmanager/qt-s60/gccetoolchain.h +++ b/src/plugins/qt4projectmanager/qt-s60/gccetoolchain.h @@ -41,6 +41,7 @@ class GCCEToolChain : public ProjectExplorer::GccToolChain { public: GCCEToolChain(S60Devices::Device device, const QString &gcceCommand); + QByteArray predefinedMacros(); QList systemHeaderPaths(); void addToEnvironment(ProjectExplorer::Environment &env); ProjectExplorer::ToolChain::ToolChainType type() const; diff --git a/src/plugins/qt4projectmanager/qt-s60/rvcttoolchain.cpp b/src/plugins/qt4projectmanager/qt-s60/rvcttoolchain.cpp index f12c509f828..46524f72d30 100644 --- a/src/plugins/qt4projectmanager/qt-s60/rvcttoolchain.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/rvcttoolchain.cpp @@ -77,7 +77,7 @@ QByteArray RVCTToolChain::predefinedMacros() { // see http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0205f/Babbacdb.html updateVersion(); - QByteArray ba = QString::fromLocal8Bit( + QByteArray ba = QString::fromLatin1( "#define __arm__arm__\n" "#define __ARMCC_VERSION %1%2%3%4\n" "#define __ARRAY_OPERATORS\n" @@ -93,10 +93,11 @@ QByteArray RVCTToolChain::predefinedMacros() "#define __TARGET_FEATURE_HALFWORD\n" "#define __TARGET_FEATURE_THUMB\n" "#define _WCHAR_T\n" + "#define __SYMBIAN32__\n" ).arg(m_major, 1, 10, QLatin1Char('0')) .arg(m_minor, 1, 10, QLatin1Char('0')) .arg("0") - .arg(m_build, 3, 10, QLatin1Char('0')).toLocal8Bit(); + .arg(m_build, 3, 10, QLatin1Char('0')).toLatin1(); return ba; } diff --git a/src/plugins/qt4projectmanager/qt-s60/winscwtoolchain.cpp b/src/plugins/qt4projectmanager/qt-s60/winscwtoolchain.cpp index 572f1c76fb0..0d9b27cf8a9 100644 --- a/src/plugins/qt4projectmanager/qt-s60/winscwtoolchain.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/winscwtoolchain.cpp @@ -29,6 +29,8 @@ #include "winscwtoolchain.h" +#include +#include #include using namespace ProjectExplorer; @@ -50,8 +52,7 @@ ToolChain::ToolChainType WINSCWToolChain::type() const QByteArray WINSCWToolChain::predefinedMacros() { - // TODO - return m_predefinedMacros; + return QByteArray("#define __SYMBIAN32__\n"); } QList WINSCWToolChain::systemHeaderPaths() @@ -67,10 +68,8 @@ QList WINSCWToolChain::systemHeaderPaths() QStringList WINSCWToolChain::systemIncludes() const { if (m_carbidePath.isEmpty()) { - qDebug() << "no carbide path set"; ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment(); QString symIncludesValue = env.value("MWCSYM2INCLUDES"); - qDebug() << "includes:" << symIncludesValue.split(";"); if (!symIncludesValue.isEmpty()) return symIncludesValue.split(";"); } else { diff --git a/src/plugins/qt4projectmanager/qt-s60/winscwtoolchain.h b/src/plugins/qt4projectmanager/qt-s60/winscwtoolchain.h index c37faaaf034..54f25cba484 100644 --- a/src/plugins/qt4projectmanager/qt-s60/winscwtoolchain.h +++ b/src/plugins/qt4projectmanager/qt-s60/winscwtoolchain.h @@ -57,7 +57,6 @@ private: QString m_deviceId; QString m_deviceName; QString m_deviceRoot; - QByteArray m_predefinedMacros; QList m_systemHeaderPaths; }; From 4ef2caca3afcfe5fc9231556b73a6d8aa61469e8 Mon Sep 17 00:00:00 2001 From: mae Date: Mon, 9 Nov 2009 18:53:59 +0100 Subject: [PATCH 16/34] Fix pasting of text that starts with a visually empty line Creator only indents the first line, and reindents subsequent lines relative to the indentation change of said first line. This fails when the first line contains no non-space characters. Solution in this change: skip (visually) empty lines. Reviewed-by: thorbjorn Task-number: QTCREATORBUG-227 --- src/plugins/texteditor/basetexteditor.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index 982ce7de3f3..278ea7f0f20 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -3415,6 +3415,16 @@ void BaseTextEditor::reindent(QTextDocument *doc, const QTextCursor &cursor) const QTextBlock end = doc->findBlock(cursor.selectionEnd()).next(); const TabSettings &ts = d->m_document->tabSettings(); + + // skip empty blocks + while (block.isValid() && block != end) { + QString bt = block.text(); + if (ts.firstNonSpace(bt) < bt.size()) + break; + indentBlock(doc, block, QChar::Null); + block = block.next(); + } + int previousIndentation = ts.indentationColumn(block.text()); indentBlock(doc, block, QChar::Null); int currentIndentation = ts.indentationColumn(block.text()); From 82c548285fe93a730707587a6d074341ec383bf4 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 10 Nov 2009 09:25:22 +0100 Subject: [PATCH 17/34] fakevim: fix writing of full file in stand-alone mode --- src/plugins/fakevim/fakevimhandler.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index 6606776f0ea..795d988b7e4 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -214,6 +214,12 @@ struct Range : beginPos(qMin(b, e)), endPos(qMax(b, e)), rangemode(m) {} + QString toString() const + { + return QString("%1-%2 (mode: %3)").arg(beginPos).arg(endPos) + .arg(rangemode); + } + int beginPos; int endPos; RangeMode rangemode; @@ -1947,7 +1953,7 @@ void FakeVimHandler::Private::handleExCommand(const QString &cmd0) firstPositionInLine(endLine), RangeLineMode); QString contents = text(range); m_tc = tc; - qDebug() << "LINES: " << beginLine << endLine; + //qDebug() << "LINES: " << beginLine << endLine; bool handled = false; emit q->writeFileRequested(&handled, fileName, contents); // nobody cared, so act ourselves @@ -2500,8 +2506,12 @@ QString FakeVimHandler::Private::text(const Range &range) const } if (range.rangemode == RangeLineMode) { QTextCursor tc = m_tc; - tc.setPosition(firstPositionInLine(lineForPosition(range.beginPos)), MoveAnchor); - tc.setPosition(firstPositionInLine(lineForPosition(range.endPos)+1), KeepAnchor); + int firstPos = firstPositionInLine(lineForPosition(range.beginPos)); + int lastLine = lineForPosition(range.endPos); + int lastPos = lastLine == m_tc.document()->lastBlock().blockNumber() + 1 + ? lastPositionInDocument() : firstPositionInLine(lastLine + 1); + tc.setPosition(firstPos, MoveAnchor); + tc.setPosition(lastPos, KeepAnchor); return tc.selection().toPlainText(); } // FIXME: Performance? From dcad2e249f009ddc12ce3d5a578783cc03b619a5 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 10 Nov 2009 10:07:36 +0100 Subject: [PATCH 18/34] fakevim: fix pasting in visual block mode --- src/plugins/fakevim/fakevimhandler.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index 795d988b7e4..c8cf6b90829 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -666,6 +666,7 @@ void FakeVimHandler::Private::restoreWidget() EventResult FakeVimHandler::Private::handleKey(int key, int unmodified, const QString &text) { + //qDebug() << " CURSOR POS: " << m_undoCursorPosition; m_undoCursorPosition[m_tc.document()->availableUndoSteps()] = m_tc.position(); //qDebug() << "KEY: " << key << text << "POS: " << m_tc.position(); if (m_mode == InsertMode) @@ -2601,7 +2602,7 @@ void FakeVimHandler::Private::removeText(const Range &range) beginEditBlock(); for (int i = beginLine; i <= endLine && block.isValid(); ++i) { int bCol = qMin(beginColumn, block.length() - 1); - int eCol = qMin(endColumn, block.length() - 1); + int eCol = qMin(endColumn + 1, block.length() - 1); tc.setPosition(block.position() + bCol, MoveAnchor); tc.setPosition(block.position() + eCol, KeepAnchor); fixMarks(block.position() + bCol, tc.selectionStart() - tc.selectionEnd()); @@ -2645,7 +2646,8 @@ void FakeVimHandler::Private::pasteText(bool afterCursor) case RangeBlockMode: { beginEditBlock(); QTextBlock block = m_tc.block(); - moveRight(); + if (afterCursor) + moveRight(); QTextCursor tc = m_tc; const int col = tc.position() - block.position(); //for (int i = lines.size(); --i >= 0; ) { @@ -2654,10 +2656,10 @@ void FakeVimHandler::Private::pasteText(bool afterCursor) tc.movePosition(StartOfLine, MoveAnchor); if (col >= block.length()) { tc.movePosition(EndOfLine, MoveAnchor); - fixMarks(position(), QString(col - line.size() + 1, QChar(' ')).length()); + fixMarks(position(), col - line.size() + 1); tc.insertText(QString(col - line.size() + 1, QChar(' '))); } else { - tc.movePosition(Right, MoveAnchor, col); + tc.movePosition(Right, MoveAnchor, col - 1 + afterCursor); } qDebug() << "INSERT " << line << " AT " << tc.position() << "COL: " << col; @@ -2666,12 +2668,13 @@ void FakeVimHandler::Private::pasteText(bool afterCursor) tc.movePosition(StartOfLine, MoveAnchor); tc.movePosition(Down, MoveAnchor, 1); if (tc.position() >= lastPositionInDocument() - 1) { - fixMarks(position(), QString(QChar('\n')).length()); + fixMarks(position(), 1); tc.insertText(QString(QChar('\n'))); tc.movePosition(Up, MoveAnchor, 1); } block = block.next(); } + moveLeft(); endEditBlock(); break; } @@ -2737,6 +2740,7 @@ QWidget *FakeVimHandler::Private::editor() const void FakeVimHandler::Private::undo() { + //qDebug() << " CURSOR POS: " << m_undoCursorPosition; int current = m_tc.document()->availableUndoSteps(); //endEditBlock(); EDITOR(undo()); From 5acac101a6cdbc9a304fe9eaf9a2eeb42d3a6201 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 10 Nov 2009 10:40:24 +0100 Subject: [PATCH 19/34] Cdb: Fix step out. Use debugger's 'gu' command instead of temporary breakpoint as a workaround until it is properly supported by the SetExecutionStatus() API. Reviewed-by: hjk Task-number: QTCREATORBUG-240 --- src/plugins/debugger/cdb/cdbdebugengine.cpp | 65 ++++++++------------- src/plugins/debugger/cdb/cdbdebugengine.h | 1 - 2 files changed, 23 insertions(+), 43 deletions(-) diff --git a/src/plugins/debugger/cdb/cdbdebugengine.cpp b/src/plugins/debugger/cdb/cdbdebugengine.cpp index 6c307af0c5a..08c552dab8b 100644 --- a/src/plugins/debugger/cdb/cdbdebugengine.cpp +++ b/src/plugins/debugger/cdb/cdbdebugengine.cpp @@ -1034,9 +1034,16 @@ static inline QString msgStepFailed(unsigned long executionStatus, int threadId, return QString::fromLatin1("Thread %1: Unable to step into: %2").arg(threadId).arg(why); } -// Step with DEBUG_STATUS_STEP_OVER ('p'-command) or +// Step out has to be done via executing 'gu'. TODO: Remove once it is +// accessible via normal API for SetExecutionStatus(). + +enum { CdbExtendedExecutionStatusStepOut = 7452347 }; + +// Step with DEBUG_STATUS_STEP_OVER ('p'-command), // DEBUG_STATUS_STEP_INTO ('t'-trace-command) or +// CdbExtendedExecutionStatusStepOut ("gu"-command) // its reverse equivalents in the case of single threads. + bool CdbDebugEngine::step(unsigned long executionStatus) { if (debugCDBExecution) @@ -1068,7 +1075,7 @@ bool CdbDebugEngine::step(unsigned long executionStatus) m_d->setCodeLevel(); // Step by instruction or source line setState(InferiorRunningRequested, Q_FUNC_INFO, __LINE__); bool success = false; - if (sameThread) { // Step event-triggering thread, use fast API + if (sameThread && executionStatus != CdbExtendedExecutionStatusStepOut) { // Step event-triggering thread, use fast API const HRESULT hr = m_d->m_cif.debugControl->SetExecutionStatus(executionStatus); success = SUCCEEDED(hr); if (!success) @@ -1077,8 +1084,18 @@ bool CdbDebugEngine::step(unsigned long executionStatus) // Need to use a command to explicitly specify the current thread QString command; QTextStream str(&command); - str << '~' << m_d->m_currentThreadId << ' ' - << (executionStatus == DEBUG_STATUS_STEP_OVER ? 'p' : 't'); + str << '~' << m_d->m_currentThreadId << ' '; + switch (executionStatus) { + case DEBUG_STATUS_STEP_OVER: + str << 'p'; + break; + case DEBUG_STATUS_STEP_INTO: + str << 't'; + break; + case CdbExtendedExecutionStatusStepOut: + str << "gu"; + break; + } manager()->showDebuggerOutput(tr("Stepping %1").arg(command)); const HRESULT hr = m_d->m_cif.debugControl->Execute(DEBUG_OUTCTL_THIS_CLIENT, command.toLatin1().constData(), DEBUG_EXECUTE_ECHO); success = SUCCEEDED(hr); @@ -1121,44 +1138,8 @@ void CdbDebugEngine::nextIExec() void CdbDebugEngine::stepOutExec() { - if (debugCDBExecution) - qDebug() << "stepOutExec"; - // emulate gdb 'exec-finish' (exec until return of current function) - // by running up to address of the above stack frame (mostly works). - const StackHandler* sh = manager()->stackHandler(); - const int idx = sh->currentIndex() + 1; - const QList stackframes = sh->frames(); - if (idx < 0 || idx >= stackframes.size()) { - warning(QString::fromLatin1("Cannot step out of stack frame %1.").arg(idx)); - return; - } - // Set a temporary breakpoint and continue - const StackFrame& frame = stackframes.at(idx); - bool success = false; - QString errorMessage; - do { - const ULONG64 address = frame.address.toULongLong(&success, 16); - if (!success) { - errorMessage = QLatin1String("Cannot obtain address from stack frame"); - break; - } - manager()->showDebuggerOutput(LogMisc, tr("Running to 0x%1...").arg(address, 0, 16)); - IDebugBreakpoint2* pBP; - HRESULT hr = m_d->m_cif.debugControl->AddBreakpoint2(DEBUG_BREAKPOINT_CODE, DEBUG_ANY_ID, &pBP); - if (FAILED(hr) || !pBP) { - errorMessage = QString::fromLatin1("Cannot create temporary breakpoint: %1").arg(msgDebugEngineComResult(hr)); - break; - } - - pBP->SetOffset(address); - pBP->AddFlags(DEBUG_BREAKPOINT_ENABLED); - pBP->AddFlags(DEBUG_BREAKPOINT_ONE_SHOT); - if (!m_d->continueInferior(&errorMessage)) - break; - success = true; - } while (false); - if (!success) - warning(msgFunctionFailed(Q_FUNC_INFO, errorMessage)); + if (!manager()->isReverseDebugging()) + step(CdbExtendedExecutionStatusStepOut); } void CdbDebugEngine::continueInferior() diff --git a/src/plugins/debugger/cdb/cdbdebugengine.h b/src/plugins/debugger/cdb/cdbdebugengine.h index c96a0205961..077faf4e14f 100644 --- a/src/plugins/debugger/cdb/cdbdebugengine.h +++ b/src/plugins/debugger/cdb/cdbdebugengine.h @@ -120,7 +120,6 @@ private: void startWatchTimer(); void killWatchTimer(); void processTerminated(unsigned long exitCode); - bool executeDebuggerCommand(const QString &command, QString *errorMessage); bool evaluateExpression(const QString &expression, QString *value, QString *type, QString *errorMessage); void evaluateWatcher(WatchData *wd); QString editorToolTip(const QString &exp, const QString &function); From 97618ec4932e5510ab064308017475297eae1aea Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 10 Nov 2009 12:48:07 +0100 Subject: [PATCH 20/34] L10n: Correct spelling in German translation Run through spell checker. Task-number: QTCREATORBUG-256 --- share/qtcreator/translations/qtcreator_de.ts | 244 ++++++++++--------- 1 file changed, 128 insertions(+), 116 deletions(-) diff --git a/share/qtcreator/translations/qtcreator_de.ts b/share/qtcreator/translations/qtcreator_de.ts index 82b05a47f0f..523d203aefa 100644 --- a/share/qtcreator/translations/qtcreator_de.ts +++ b/share/qtcreator/translations/qtcreator_de.ts @@ -70,7 +70,7 @@ &Undo - &Rückgangig + &Rückgängig @@ -360,7 +360,7 @@ CMake Wizard - CMake Assistent + CMake-Assistent @@ -696,7 +696,7 @@ &Undo - &Rückgangig + &Rückgängig @@ -734,7 +734,7 @@ Die Datei wurde geändert. Möchten Sie die Änderungen rückgängig machen? - + The commit list spans several repositories (%1). Please commit them one by one. Die abzugebenden Dateien umfassen mehrere Repositories. Bitte geben Sie sie einzeln ab. @@ -754,7 +754,7 @@ Es konnte keine temporäre Datei erstellt werden: %1 - + Project status Status des Projekts @@ -796,7 +796,7 @@ The process terminated abnormally. - Der Prozess wurde in unnormaler Weise beendet. + Der Prozess wurde in anormaler Weise beendet. @@ -907,7 +907,7 @@ CVSPlugin - + Cannot find repository for '%1' Das Repository der Datei '%1' konnte nicht gefunden werden @@ -1170,7 +1170,7 @@ When this option is checked, 'Step Into' compresses several steps into one in certain situations, leading to 'less noisy' debugging. So will, e.g., the atomic reference counting code be skipped, and a single 'Step Into' for a signal emission will end up directly in the slot connected to it. - Diese Option bewirkt, dass 'Einzelschritt in' in bestimmten Situationen mehrere Schritte zusammenfaßt, was das Debuggen beschleunigt. Zum Beispiel wird der Code des atomaren Referenzzählung übersprungen; und bei der Emission eines Signals gelangt man zum verbundenen Slot. + Diese Option bewirkt, dass 'Einzelschritt in' in bestimmten Situationen mehrere Schritte zusammenfasst, was das Debuggen beschleunigt. Zum Beispiel wird der Code des atomaren Referenzzählung übersprungen; und bei der Emission eines Signals gelangt man zum verbundenen Slot. @@ -1190,7 +1190,7 @@ Use alternating row colors in debug views - Alternierende Farben für Debugansichten benutzen + Alternierende Farben für Debug-Ansichten benutzen @@ -1670,7 +1670,7 @@ Sollen sie überschrieben werden? Split Top/Bottom - Open/unten teilen + Oben/unten teilen @@ -1863,7 +1863,7 @@ Sollen sie überschrieben werden? Ausgaben - + &File &Datei @@ -1949,7 +1949,7 @@ Sollen sie überschrieben werden? &Undo - &Rückgangig + &Rückgängig @@ -2194,7 +2194,7 @@ Sollen sie überschrieben werden? Plugin Details of %1 - Pluginbeschreibung zu %1 + Beschreibung zu %1 @@ -2342,19 +2342,19 @@ Sollen sie überschrieben werden? CppEditor::Internal::CPPEditor - + Sort alphabetically Alphabetisch sortieren - + This change cannot be undone. Diese Änderung kann nicht rückgängig gemacht werden. Yes, I know what I am doing. - Ja, Ich bin mir dessen bewußt. + Ja, Ich bin mir dessen bewusst. @@ -2402,7 +2402,7 @@ Sollen sie überschrieben werden? CppEditor::Internal::CppPlugin - + C++ C++ @@ -2437,7 +2437,7 @@ Sollen sie überschrieben werden? Erzeugt C++-Header- und Quelldatei für eine neue Klasse - + Follow Symbol under Cursor Symbol unter Einfügemarke verfolgen @@ -2461,6 +2461,11 @@ Sollen sie überschrieben werden? Rename Symbol under Cursor Symbol unter Einfügemarke umbenennen + + + Update code model + Code-Modell aktualisieren + CppFileSettingsPage @@ -2583,7 +2588,7 @@ Sollen sie überschrieben werden? CppTools::Internal::CppFindReferences - + Searching... Suche... @@ -2599,7 +2604,7 @@ Sollen sie überschrieben werden? CppTools::Internal::CppModelManager - + Scanning Suche @@ -2620,7 +2625,7 @@ Sollen sie überschrieben werden? CppTools::Internal::CppToolsPlugin - + &C++ &C++ @@ -2858,7 +2863,7 @@ Sollen sie überschrieben werden? Process ID - Prozess-Id' + Prozess-Id @@ -2986,7 +2991,7 @@ Sollen sie überschrieben werden? Breakpoint will only be hit after being ignored so many times. - Der Haltepunkt wird ausgelöst, nachdem er vorherh so viele Male übersprungen wurde. + Der Haltepunkt wird ausgelöst, nachdem er vorher so viele Male übersprungen wurde. @@ -3156,7 +3161,7 @@ Sollen sie überschrieben werden? Die Ausführung des Prozesses kann nicht fortgesetzt werden: %1 - + Reverse stepping is not implemented. Die Funktionalität für 'Einzelschritt rückwärts' ist nicht implementiert. @@ -3166,17 +3171,16 @@ Sollen sie überschrieben werden? Für den Thread %1 ist kein Einzelschritt möglich. - + Stepping %1 Führe Schritt aus (%1) - Running to 0x%1... - Ausführung bis zur Adresse 0x%1... + Ausführung bis zur Adresse 0x%1... - + Running requested... Fortsetzung angefordert... @@ -3257,7 +3261,7 @@ Sollen sie überschrieben werden? debugger call - Debuggeraufruf + Debugger-Aufruf @@ -3557,7 +3561,7 @@ Sollen sie überschrieben werden? Debugger::Internal::DebuggerRunControlFactory - + Debug Debuggen @@ -3565,7 +3569,7 @@ Sollen sie überschrieben werden? Debugger::Internal::DebuggerRunControl - + Debugger Debugger @@ -3575,7 +3579,7 @@ Sollen sie überschrieben werden? Debugger properties... - Debuggereinstellungen... + Debugger-Einstellungen... @@ -3710,7 +3714,7 @@ Sollen sie überschrieben werden? Show address data in stack view when debugging - Addressen im Stack-Fenster anzeigen + Adressen im Stack-Fenster anzeigen @@ -3776,7 +3780,7 @@ Sollen sie überschrieben werden? The last waitFor...() function timed out. The state of QProcess is unchanged, and you can try calling waitFor...() again. - Zeitüberschreitung bei der letzten waitFor...()-Funktion. Der Status des QProcess ist unverändert, und waitFor...() kann nocheinmal gerufen. + Zeitüberschreitung bei der letzten waitFor...()-Funktion. Der Status des QProcess ist unverändert, und waitFor...() kann noch einmal gerufen. @@ -3834,7 +3838,7 @@ Sollen sie überschrieben werden? Der Prozess konnte nicht gestartet werden. - + <p>The inferior stopped because it received a signal from the Operating System.<p><table><tr><td>Signal name : </td><td>%1</td></tr><tr><td>Signal meaning : </td><td>%2</td></tr></table> <p>Der Prozess wurde nach Erhalt eines Signals vom Betriebssystem angehalten.<p><table><tr><td>Name des Signals : </td><td>%1</td></tr><tr><td>Bedeutung : </td><td>%2</td></tr></table> @@ -3850,7 +3854,7 @@ Sollen sie überschrieben werden? Signal erhalten - + Reading %1... Lese %1... @@ -3860,12 +3864,12 @@ Sollen sie überschrieben werden? Sprung ausgeführt/ Angehalten. - + Loading %1... Lade %1... - + Stopped at breakpoint. An Haltepunkt angehalten. @@ -3889,12 +3893,12 @@ Das Debuggen wird wahrscheinlich nicht richtig funktionieren. Es wird empfohlen, gdb 6.7 oder später zu benutzen. - + Processing queued commands. Kommando-Warteschlange wird abgearbeitet. - + Stopped. Angehalten. @@ -3984,7 +3988,7 @@ Es wird empfohlen, gdb 6.7 oder später zu benutzen. - + An unknown error in the Gdb process occurred. Im Gdb-Prozess trat ein unbekannter Fehler auf. @@ -4012,7 +4016,7 @@ Es wird empfohlen, gdb 6.7 oder später zu benutzen. Fehler bei Ausführung: %1 - + Program exited with exit code %1. Das Programm wurde beendet, Rückgabewert %1. @@ -4027,7 +4031,7 @@ Es wird empfohlen, gdb 6.7 oder später zu benutzen. Das Programm wurde normal beendet. - + Continuing after temporary stop... Setze nach temporärem Anhalten fort... @@ -4074,7 +4078,7 @@ Es wird empfohlen, gdb 6.7 oder später zu benutzen. Jumping out of bogus frame... - Verlasse ungültigen Stack-Frame... + Verlasse ungültigen Stack-Rahmen... @@ -4145,27 +4149,27 @@ Es wird empfohlen, gdb 6.7 oder später zu benutzen. Der Start des Adapters schlug fehl - + Setting breakpoints... Setze Haltepunkte... - + Starting inferior... Starte zu debuggenden Prozess... - + Inferior start failed Der Start des zu debuggenden Prozesses schlug fehl - + Inferior shutdown failed Das Beenden des zu debuggenden Prozesses schlug fehl - + Adapter crashed Der Adapter ist abgestürzt @@ -4325,7 +4329,7 @@ Es wird empfohlen, gdb 6.7 oder später zu benutzen. Cannot set up communication with child process: %1 - Die Kommunikation mit dem untergeordneten Prozesss konnte nicht hergestellt werden: %1 + Die Kommunikation mit dem untergeordneten Prozess konnte nicht hergestellt werden: %1 @@ -4480,17 +4484,30 @@ Es wird empfohlen, gdb 6.7 oder später zu benutzen. Angehalten. + + Debugger::Internal::SourceFilesModel + + + Internal name + Interner Name + + + + Full name + Vollständiger Name + + Debugger::Internal::SourceFilesWindow - + Source Files Quelldateien Reload data - Daten akualisieren + Daten aktualisieren @@ -4710,7 +4727,7 @@ Es wird empfohlen, gdb 6.7 oder später zu benutzen. Debugger::Internal::TrkGdbAdapter - + Process started, PID: 0x%1, thread id: 0x%2, code segment: 0x%3, data segment: 0x%4. Der Prozess wurde gestartet, PID: 0x%1, Thread-Id: 0x%2, Code-Segment: 0x%3, Datensegment: 0x%4. @@ -4742,7 +4759,7 @@ Es wird empfohlen, gdb 6.7 oder später zu benutzen. Communication - Kommunkation + Kommunikation @@ -5485,7 +5502,7 @@ It also automatically sets the correct Qt version. Could not open file for read: %1 - Die Datei konnte nicht zum Lesen geöffnen werden: %1 + Die Datei konnte nicht zum Lesen geöffnet werden: %1 @@ -5655,17 +5672,17 @@ Grund: %3 FakeVim::Internal::FakeVimHandler - + Not implemented in FakeVim In FakeVim nicht implementiert - + E20: Mark '%1' not set E20: Die Marke '%1' ist nicht gesetzt - + %1%2% %1%2% @@ -5738,7 +5755,7 @@ Grund: %3 Die Suche hat den Anfang erreicht, setze am Ende fort - + Already at oldest change Älteste Änderung erreicht @@ -5878,7 +5895,7 @@ Grund: %3 Incremental search: - Inkrimentelle Suche: + Inkrementelle Suche: @@ -6018,7 +6035,7 @@ Grund: %3 Replace && Find Previous - Ersetzen und rückwarts weitersuchen + Ersetzen und rückwärts weitersuchen @@ -6529,7 +6546,7 @@ Grund: %3 Git::Internal::GitClient - + Note that the git plugin for QtCreator is not able to interact with the server so far. Thus, manual ssh-identification etc. will not work. Not used. @@ -6558,7 +6575,7 @@ Grund: %3 Warte auf Daten... - + Git Diff Git Diff @@ -6583,7 +6600,7 @@ Grund: %3 Git Blame %1 - + Unable to add %n file(s) to %1: %2 Keine der %n Dateien konnte zu %1 hinzugefügt werden: %2 @@ -6622,7 +6639,7 @@ Grund: %3 Das Kommando 'show' konnte nicht ausgeführt werden: %1: %2 - + Changes Änderungen @@ -6672,12 +6689,12 @@ Grund: %3 Die Datei wurde geändert. Möchten Sie die Änderungen rückgängig machen? - + The file is not modified. Datei ungeändert. - + There are no modified files. Es gibt keine geänderten Dateien. @@ -6685,7 +6702,7 @@ Grund: %3 Git::Internal::GitPlugin - + &Git &Git @@ -6897,7 +6914,7 @@ Grund: %3 &Undo - &Rückgangig + &Rückgängig @@ -6905,7 +6922,7 @@ Grund: %3 &Wiederholen - + Could not find working directory Das Arbeitsverzeichnis konnte nicht gefunden werden. @@ -7655,7 +7672,7 @@ Grund: %3 Open Link in New Tab Ctrl+LMB - Link in neuem Reiter öffnen\t(Ctrl+Linke Maustaste) + Link in neuem Reiter öffnen (Strg+Linke Maustaste) @@ -7681,7 +7698,7 @@ Grund: %3 Type Ctrl-<Return> to execute a line. - Sie können eine Zeile mittels <Ctrl-Return> ausführen. + Sie können eine Zeile mittels <Strg+Return> ausführen. @@ -7865,12 +7882,12 @@ in your .pro file. C Header file - C-Headerdatei + C-Header-Datei C++ Header file - C++-Headerdatei + C++-Header-Datei @@ -8584,7 +8601,7 @@ p, li { white-space: pre-wrap; } &Undo - &Rückgangig + &Rückgängig @@ -8602,7 +8619,7 @@ p, li { white-space: pre-wrap; } Die Datei wurde geändert. Möchten Sie die Änderungen rückgängig machen? - + Another submit is currently executed. Es läuft bereits ein Submit-Vorgang. @@ -8651,7 +8668,7 @@ p, li { white-space: pre-wrap; } The process terminated abnormally. - Der Prozess wurde in unnormaler Weise beendet. + Der Prozess wurde in abnormaler Weise beendet. @@ -8782,7 +8799,7 @@ p, li { white-space: pre-wrap; } P4 Port: - P4 Portnummer: + P4 Port-Nummer: @@ -8861,7 +8878,7 @@ p, li { white-space: pre-wrap; } Plugin Details of %1 - Pluginbeschreibung zu %1 + Beschreibung zu %1 @@ -8953,7 +8970,7 @@ p, li { white-space: pre-wrap; } Plugin initialization failed: %1 - Die Initialisierungs des Plugins schlug fehl: %1 + Die Initialisierung des Plugins schlug fehl: %1 @@ -10006,7 +10023,7 @@ Fehler: %2 Cannot retrieve debugging output! - Es konnte keine Debugausgabe erhalten werden! + Es konnte keine Debug-Ausgabe erhalten werden! @@ -11024,12 +11041,12 @@ unter Versionsverwaltung (%2) gestellt werden? Qt4 Designer Custom Widget - Benutzerdefinertes Widget für Qt4 Designer + Benutzerdefiniertes Widget für Qt4 Designer Creates a Qt4 Designer Custom Widget or a Custom Widget Collection. - Erstellt ein oder mehrere benutzerdefinerte Widgets für Qt4 Designer. + Erstellt ein oder mehrere benutzerdefinierte Widgets für Qt4 Designer. @@ -11037,7 +11054,7 @@ unter Versionsverwaltung (%2) gestellt werden? This wizard generates a Qt4 Designer Custom Widget or a Qt4 Designer Custom Widget Collection project. - Dieser Wizard erstellt ein Projekt mit einem oder mehreren benutzerdefinerten Widgets für Qt4 Designer. + Dieser Wizard erstellt ein Projekt mit einem oder mehreren benutzerdefinierten Widgets für Qt4 Designer. @@ -11405,7 +11422,7 @@ unter Versionsverwaltung (%2) gestellt werden? Cannot open icon file %1. - DIe Icon-Datei %1 kann nicht geöffnet werden. + Die Icon-Datei %1 kann nicht geöffnet werden. @@ -11733,7 +11750,7 @@ unter Versionsverwaltung (%2) gestellt werden? Qt4ProjectManager::Internal::Qt4RunConfiguration - + Qt4RunConfiguration Qt4RunConfiguration @@ -11880,7 +11897,7 @@ unter Versionsverwaltung (%2) gestellt werden? <html><body><table><tr><td>Datei:</td><td><pre>%1</pre></td></tr><tr><td>Letzte Änderung:</td><td>%2</td></tr><tr><td>Größe:</td><td>%3 Bytes</td></tr></table></body></html> - + The Qt Version identified by %1 is not installed. Run make install Die Qt-Version %1 ist nicht installiert. Führen Sie make install aus @@ -12182,7 +12199,7 @@ Bitte prüfen Sie, ob das Gerät verbunden ist und die Anwendung 'TRK' Debugger for Symbian Platform - Debugger für Symbian-Platform + Debugger für Symbian-Plattform @@ -12552,7 +12569,7 @@ Installiere Anwendung auf '%2'... <font color="#0000ff">Configuration unchanged, skipping QMake step.</font> - <font color="#0000ff">Konfiguration unverändert, übersrpinge QMake-Schritt.</font> + <font color="#0000ff">Konfiguration unverändert, überspringe QMake-Schritt.</font> @@ -12643,7 +12660,7 @@ Installiere Anwendung auf '%2'... Qt4ProjectManager::QtVersionManager - + <not found> <nicht gefunden> @@ -12679,7 +12696,7 @@ Installiere Anwendung auf '%2'... Vorgabe: - + Compiler: Compiler: @@ -12697,7 +12714,7 @@ Installiere Anwendung auf '%2'... QApplication - + The Qt Version has no toolchain. Dieser Qt-Version ist keine Toolchain zugeordnet. @@ -12868,15 +12885,14 @@ Installiere Anwendung auf '%2'... QtScriptEditor::Internal::QtScriptEditorActionHandler - Qt Script Error - Fehler in Qt-Skript + Fehler in Qt-Skript QtScriptEditor::Internal::QtScriptEditorPlugin - + Creates a Qt Script file. Erzeugt eine Qt-Skript-Datei. @@ -12891,20 +12907,18 @@ Installiere Anwendung auf '%2'... Qt - Run - Ausführen + Ausführen - Ctrl+R - Ctrl+R + Ctrl+R QtScriptEditor::Internal::ScriptEditor - + <Select Symbol> <Symbol auswählen> @@ -13271,7 +13285,7 @@ Um es abzurufen, tippen Sie das Kürzel im Locator, gefolgt von einem Leerzeich &Undo - &Rückgangig + &Rückgängig @@ -13544,14 +13558,12 @@ Um es abzurufen, tippen Sie das Kürzel im Locator, gefolgt von einem Leerzeich SourceFilesModel - Internal name - Interner Name + Interner Name - Full name - Vollständiger Name + Vollständiger Name @@ -13802,7 +13814,7 @@ Um es abzurufen, tippen Sie das Kürzel im Locator, gefolgt von einem Leerzeich &Undo - &Rückgangig + &Rückgängig @@ -13825,12 +13837,12 @@ Um es abzurufen, tippen Sie das Kürzel im Locator, gefolgt von einem Leerzeich Die Überprüfung der Beschreibung schlug fehl. Möchten Sie den Commit trotzdem ausführen? - + The commit list spans several repositories (%1). Please commit them one by one. Die abzugebenden Dateien umfassen mehrere Repositories (%1). Bitte geben Sie sie einzeln ab. - + Executing: %1 %2 Executing: <executable> <arguments> @@ -13838,12 +13850,12 @@ Um es abzurufen, tippen Sie das Kürzel im Locator, gefolgt von einem Leerzeich - + The file has been changed. Do you want to revert it? Die Datei wurde geändert. Möchten Sie sie zurücksetzen? - + Another commit is currently being executed. Es läuft bereits ein Abgabevorgang. @@ -13858,7 +13870,7 @@ Um es abzurufen, tippen Sie das Kürzel im Locator, gefolgt von einem Leerzeich Es konnte keine temporäre Datei erstellt werden: %1 - + Describe Beschreibe @@ -13881,7 +13893,7 @@ Um es abzurufen, tippen Sie das Kürzel im Locator, gefolgt von einem Leerzeich The process terminated abnormally. - Der Prozess wurde in unnormaler Weise beendet. + Der Prozess wurde in anormaler Weise beendet. @@ -13963,7 +13975,7 @@ Um es abzurufen, tippen Sie das Kürzel im Locator, gefolgt von einem Leerzeich TextEditor::BaseTextEditorEditable - + Line: %1, Col: %2 Zeile: %1, Spalte: %2 @@ -14202,7 +14214,7 @@ Um es abzurufen, tippen Sie das Kürzel im Locator, gefolgt von einem Leerzeich Text Encoding - Text Encoding + Text-Encoding @@ -14411,7 +14423,7 @@ Die folgenden Encodings scheinen der Datei zu entsprechen: &Undo - &Rückgangig + &Rückgängig @@ -15569,7 +15581,7 @@ Namen <E-Mail> Alias <E-Mail? VCSManager - + Version Control Versionskontrolle From 23e06304f8b6c917a9fbbb4b34f7af02d5096913 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 9 Nov 2009 22:07:56 +0100 Subject: [PATCH 21/34] further cleanups in less expected shutdown paths Reviewed-by: hjk --- src/plugins/debugger/gdb/gdbengine.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 11e0860b11c..b7e231434b5 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -285,6 +285,8 @@ void GdbEngine::initializeVariables() m_inbuffer.clear(); + m_commandTimer->stop(); + // ConverterState has no reset() function. m_outputCodecState.~ConverterState(); new (&m_outputCodecState) QTextCodec::ConverterState(); @@ -1456,6 +1458,7 @@ void GdbEngine::shutdown() case InferiorRunning: case InferiorStopping: case InferiorStopped: + m_commandsToRunOnTemporaryBreak.clear(); postCommand(_(m_gdbAdapter->inferiorShutdownCommand()), NeedsStop | LosesChild, CB(handleInferiorShutdown)); break; @@ -1496,6 +1499,7 @@ void GdbEngine::handleGdbExit(const GdbResponse &response) { if (response.resultClass == GdbResultExit) { debugMessage(_("GDB CLAIMS EXIT; WAITING")); + m_commandsDoneCallback = 0; // don't set state here, this will be handled in handleGdbFinished() } else { QString msg = m_gdbAdapter->msgGdbStopFailed(_(response.data.findChild("msg").data())); From 5976b1ba43266d4281d1cbdc859f87d7f52c6e63 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 9 Nov 2009 22:11:56 +0100 Subject: [PATCH 22/34] actively try to obtain PID of non-pthread inferiors with gdb < 7 on linux Reviewed-by: hjk --- src/plugins/debugger/gdb/gdbengine.cpp | 33 +++++++++++++++----- src/plugins/debugger/gdb/gdbengine.h | 2 ++ src/plugins/debugger/gdb/plaingdbadapter.cpp | 30 ++++++++++++++++++ src/plugins/debugger/gdb/plaingdbadapter.h | 3 ++ 4 files changed, 61 insertions(+), 7 deletions(-) diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index b7e231434b5..47a4de1f878 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -1152,14 +1152,21 @@ void GdbEngine::handleStopResponse(const GdbMi &data) setState(InferiorStopped); #ifdef Q_OS_LINUX - // For some reason, attaching to a stopped process causes *two* stops - // when trying to continue (kernel i386 2.6.24-23-ubuntu, gdb 6.8). - // Interestingly enough, on MacOSX no signal is delivered at all. if (!m_entryPoint.isEmpty()) { - if (reason == "signal-received" - && data.findChild("signal-name").data() == "SIGSTOP") { - GdbMi frameData = data.findChild("frame"); - if (frameData.findChild("addr").data() == m_entryPoint) { + GdbMi frameData = data.findChild("frame"); + if (frameData.findChild("addr").data() == m_entryPoint) { + if (reason == "signal-received" + && data.findChild("signal-name").data() == "SIGSTOP") { + // For some reason, attaching to a stopped process causes *two* stops + // when trying to continue (kernel i386 2.6.24-23-ubuntu, gdb 6.8). + // Interestingly enough, on MacOSX no signal is delivered at all. + continueInferiorInternal(); + return; + } + if (reason.isEmpty()) { // tbreak does that + // For programs without -pthread under gdb <= 6.8. + if (!inferiorPid()) + postCommand(_("info proc"), CB(handleInfoProc)); continueInferiorInternal(); return; } @@ -1325,6 +1332,18 @@ void GdbEngine::handleStop1(const GdbMi &data) manager()->reloadRegisters(); } +#ifdef Q_OS_LINUX +void GdbEngine::handleInfoProc(const GdbResponse &response) +{ + if (response.resultClass == GdbResultDone) { + static QRegExp re(_("\\bprocess ([0-9]+)\n")); + QTC_ASSERT(re.isValid(), return); + if (re.indexIn(_(response.data.findChild("consolestreamoutput").data())) != -1) + maybeHandleInferiorPidChanged(re.cap(1)); + } +} +#endif + void GdbEngine::handleShowVersion(const GdbResponse &response) { //qDebug () << "VERSION 2:" << response.data.findChild("consolestreamoutput").data(); diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h index aafe05b96e0..dc1acf68fcc 100644 --- a/src/plugins/debugger/gdb/gdbengine.h +++ b/src/plugins/debugger/gdb/gdbengine.h @@ -302,6 +302,8 @@ private: ////////// Inferior Management ////////// void maybeHandleInferiorPidChanged(const QString &pid); #ifdef Q_OS_LINUX + void handleInfoProc(const GdbResponse &response); + QByteArray m_entryPoint; #endif diff --git a/src/plugins/debugger/gdb/plaingdbadapter.cpp b/src/plugins/debugger/gdb/plaingdbadapter.cpp index 9f0d4c0e832..fbcf96c8605 100644 --- a/src/plugins/debugger/gdb/plaingdbadapter.cpp +++ b/src/plugins/debugger/gdb/plaingdbadapter.cpp @@ -110,6 +110,13 @@ void PlainGdbAdapter::handleFileExecAndSymbols(const GdbResponse &response) { QTC_ASSERT(state() == InferiorStarting, qDebug() << state()); if (response.resultClass == GdbResultDone) { +#ifdef Q_OS_LINUX + // Old gdbs do not announce the PID for programs without pthreads. + // Note that successfully preloading the debugging helpers will + // automatically load pthreads, so this will be unnecessary. + if (m_engine->m_gdbVersion < 70000) + m_engine->postCommand(_("info target"), CB(handleInfoTarget)); +#endif emit inferiorPrepared(); } else { QString msg = tr("Starting executable failed:\n") + @@ -118,6 +125,29 @@ void PlainGdbAdapter::handleFileExecAndSymbols(const GdbResponse &response) } } +#ifdef Q_OS_LINUX +void PlainGdbAdapter::handleInfoTarget(const GdbResponse &response) +{ + if (response.resultClass == GdbResultDone) { + // [some leading stdout here] + // >&" Entry point: 0x80831f0 0x08048134 - 0x08048147 is .interp\n" + // [some trailing stdout here] + QString msg = _(response.data.findChild("consolestreamoutput").data()); + QRegExp needle(_("\\bEntry point: 0x([0-9a-f]+)\\b")); + if (needle.indexIn(msg) != -1) { + m_engine->m_entryPoint = + "0x" + needle.cap(1).toLatin1().rightJustified(sizeof(void *) * 2, '0'); + m_engine->postCommand(_("tbreak *0x") + needle.cap(1)); + // Do nothing here - inferiorPrepared handles the sequencing. + } else { + emit inferiorStartFailed(_("Parsing start address failed")); + } + } else if (response.resultClass == GdbResultError) { + emit inferiorStartFailed(_("Fetching start address failed")); + } +} +#endif + void PlainGdbAdapter::startInferiorPhase2() { setState(InferiorRunningRequested); diff --git a/src/plugins/debugger/gdb/plaingdbadapter.h b/src/plugins/debugger/gdb/plaingdbadapter.h index 21545212af7..2a60a86643a 100644 --- a/src/plugins/debugger/gdb/plaingdbadapter.h +++ b/src/plugins/debugger/gdb/plaingdbadapter.h @@ -62,6 +62,9 @@ public: private: void handleFileExecAndSymbols(const GdbResponse &response); void handleExecRun(const GdbResponse &response); +#ifdef Q_OS_LINUX + void handleInfoTarget(const GdbResponse &response); +#endif OutputCollector m_outputCollector; }; From de9438df0cd3b17bbd61876b95e51aa156332ffe Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 9 Nov 2009 23:21:18 +0100 Subject: [PATCH 23/34] clear pending stream outputs after handling stop response any output will most definitely belong to later issued commands, so not clearing it will only cost cpu or even confuse the evaluation. Reviewed-by: hjk --- src/plugins/debugger/gdb/gdbengine.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 47a4de1f878..e27ee38940c 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -427,6 +427,8 @@ void GdbEngine::handleResponse(const QByteArray &buff) } if (asyncClass == "stopped") { handleStopResponse(result); + m_pendingLogStreamOutput.clear(); + m_pendingConsoleStreamOutput.clear(); } else if (asyncClass == "running") { // Archer has 'thread-id="all"' here } else if (asyncClass == "library-loaded") { From cb4b13914826f3e508428a3b91fb8238514de54e Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 10 Nov 2009 12:40:23 +0100 Subject: [PATCH 24/34] track shared library events even on gdb < 7 this is to update breakpoint, source and module lists automatically. also remove the now pointless -break-list on every stop. Reviewed-by: hjk --- src/plugins/debugger/gdb/gdbengine.cpp | 57 ++++++++++++++------------ 1 file changed, 31 insertions(+), 26 deletions(-) diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index e27ee38940c..984531ed116 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -1153,6 +1153,33 @@ void GdbEngine::handleStopResponse(const GdbMi &data) } setState(InferiorStopped); + // Due to LD_PRELOADing the dumpers, these events can occur even before + // reaching the entry point. So handle it before the entry point hacks below. + if (reason.isEmpty() && m_gdbVersion < 70000 && !m_isMacGdb) { + // On Linux it reports "Stopped due to shared library event\n", but + // on Windows it simply forgets about it. Thus, we identify the response + // based on it having no frame information. + if (!data.findChild("frame").isValid()) { + m_modulesListOutdated = m_sourcesListOutdated = true; + // Each stop causes a roundtrip and button flicker, so prevent + // a flood of useless stops. Will be automatically re-enabled. + postCommand(_("set stop-on-solib-events 0")); +#if 0 + // The related code (handleAqcuiredInferior()) is disabled as well. + if (theDebuggerBoolSetting(SelectedPluginBreakpoints)) { + QString dataStr = _(data.toString()); + debugMessage(_("SHARED LIBRARY EVENT: ") + dataStr); + QString pat = theDebuggerStringSetting(SelectedPluginBreakpointsPattern); + debugMessage(_("PATTERN: ") + pat); + postCommand(_("sharedlibrary ") + pat); + showStatusMessage(tr("Loading %1...").arg(dataStr)); + } +#endif + continueInferiorInternal(); + return; + } + } + #ifdef Q_OS_LINUX if (!m_entryPoint.isEmpty()) { GdbMi frameData = data.findChild("frame"); @@ -1178,27 +1205,6 @@ void GdbEngine::handleStopResponse(const GdbMi &data) } #endif -#if 0 - // The related code (handleAqcuiredInferior()) is disabled as well. - // When re-enabling, try something to avoid spurious source list updates - // due to unrelated no-reason stops. - const QByteArray &msg = data.findChild("consolestreamoutput").data(); - if (msg.contains("Stopped due to shared library event") || reason.isEmpty()) { - m_modulesListOutdated = m_sourcesListOutdated = true; - if (theDebuggerBoolSetting(SelectedPluginBreakpoints)) { - QString dataStr = _(data.toString()); - debugMessage(_("SHARED LIBRARY EVENT: ") + dataStr); - QString pat = theDebuggerStringSetting(SelectedPluginBreakpointsPattern); - debugMessage(_("PATTERN: ") + pat); - postCommand(_("sharedlibrary ") + pat); - continueInferiorInternal(); - showStatusMessage(tr("Loading %1...").arg(dataStr)); - return; - } - // fall through - } -#endif - // seen on XP after removing a breakpoint while running // >945*stopped,reason="signal-received",signal-name="SIGTRAP", // signal-meaning="Trace/breakpoint trap",thread-id="2", @@ -1269,11 +1275,6 @@ void GdbEngine::handleStop1(const GdbMi &data) if (m_sourcesListOutdated) reloadSourceFilesInternal(); // This needs to be done before fullName() may need it - // Older gdb versions do not produce "library loaded" messages - // so the breakpoint update is not triggered. - if (m_gdbVersion < 70000 && !m_isMacGdb) - postCommand(_("-break-list"), CB(handleBreakList)); - QByteArray reason = data.findChild("reason").data(); if (reason == "breakpoint-hit") { showStatusMessage(tr("Stopped at breakpoint.")); @@ -2249,6 +2250,8 @@ void GdbEngine::reloadModulesInternal() { m_modulesListOutdated = false; postCommand(_("info shared"), NeedsStop, CB(handleModulesList)); + if (m_gdbVersion < 70000 && !m_isMacGdb) + postCommand(_("set stop-on-solib-events 1")); } void GdbEngine::handleModulesList(const GdbResponse &response) @@ -2317,6 +2320,8 @@ void GdbEngine::reloadSourceFilesInternal() m_sourcesListOutdated = false; postCommand(_("-file-list-exec-source-files"), NeedsStop, CB(handleQuerySources)); postCommand(_("-break-list"), CB(handleBreakList)); + if (m_gdbVersion < 70000 && !m_isMacGdb) + postCommand(_("set stop-on-solib-events 1")); } From 5fa7d54ea4b5d2fd60f99ad054be76d221aa9ff9 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Mon, 9 Nov 2009 17:09:30 +0100 Subject: [PATCH 25/34] Quote CDB_PATH. When setting CDB_PATH via the environment. Reviewed-By: ossi (cherry picked from commit e288c4c4e7ec3420f2afdd51f8ae3c37a85d57db) --- src/plugins/debugger/cdb/cdb.pri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/debugger/cdb/cdb.pri b/src/plugins/debugger/cdb/cdb.pri index 34a89b7042a..a1ab1d4c4e6 100644 --- a/src/plugins/debugger/cdb/cdb.pri +++ b/src/plugins/debugger/cdb/cdb.pri @@ -4,7 +4,7 @@ win32 { contains(QMAKE_CXX, cl) { -CDB_PATH=$$(CDB_PATH) +CDB_PATH="$$(CDB_PATH)" isEmpty(CDB_PATH):CDB_PATH="$$(ProgramFiles)/Debugging Tools For Windows/sdk" !exists($$CDB_PATH):CDB_PATH="$$(ProgramFiles)/Debugging Tools For Windows (x86)/sdk" From 4e4adc865af2a375b9d36c0a2de777611f953b5d Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Tue, 10 Nov 2009 16:21:49 +0100 Subject: [PATCH 26/34] Provide disambiguations for "unknown" string --- src/plugins/debugger/gdb/gdbengine.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 984531ed116..4878ef6e7e6 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -1290,8 +1290,8 @@ void GdbEngine::handleStop1(const GdbMi &data) "signal from the Operating System.

" "" "
Signal name : %1
Signal meaning : %2
") - .arg(name.isEmpty() ? tr(" ") : _(name)) - .arg(meaning.isEmpty() ? tr(" ") : _(meaning)); + .arg(name.isEmpty() ? tr(" ", "name") : _(name)) + .arg(meaning.isEmpty() ? tr(" ", "meaning") : _(meaning)); showMessageBox(QMessageBox::Information, tr("Signal received"), msg); } @@ -2292,7 +2292,7 @@ void GdbEngine::handleModulesList(const GdbResponse &response) module.symbolsRead = (item.findChild("state").data() == "Y"); module.startAddress = _(item.findChild("loaded_addr").data()); //: End address of loaded module - module.endAddress = tr(""); + module.endAddress = tr("", "address"); modules.append(module); } } From 2fba3888dc76f92855b2e72cf57f46273bfffe4b Mon Sep 17 00:00:00 2001 From: mae Date: Tue, 10 Nov 2009 17:10:39 +0100 Subject: [PATCH 27/34] Fix combobox tooltip and lock-button visibility for empty editor views Reviewed-by: con --- src/plugins/coreplugin/editormanager/editorview.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/plugins/coreplugin/editormanager/editorview.cpp b/src/plugins/coreplugin/editormanager/editorview.cpp index 743d2f728e6..93e59ff1594 100644 --- a/src/plugins/coreplugin/editormanager/editorview.cpp +++ b/src/plugins/coreplugin/editormanager/editorview.cpp @@ -343,6 +343,7 @@ void EditorView::setCurrentEditor(IEditor *editor) { if (!editor || m_container->count() <= 0 || m_container->indexOf(editor->widget()) == -1) { + updateEditorStatus(0); // ### TODO the combo box m_editorList should show an empty item return; } @@ -377,6 +378,13 @@ void EditorView::updateEditorStatus(IEditor *editor) static const QIcon lockedIcon(QLatin1String(":/core/images/locked.png")); static const QIcon unlockedIcon(QLatin1String(":/core/images/unlocked.png")); + m_lockButton->setVisible(editor != 0); + + if (!editor) { + m_editorList->setToolTip(QString()); + return; + } + if (editor->file()->isReadOnly()) { m_lockButton->setIcon(lockedIcon); m_lockButton->setEnabled(!editor->file()->fileName().isEmpty()); From b71be596aa498fe89c9c4fa99dca8765428af58f Mon Sep 17 00:00:00 2001 From: Daniel Molkentin Date: Mon, 9 Nov 2009 17:25:59 +0100 Subject: [PATCH 28/34] Adjust qtlibspatcher to new pathnames, change purpose of qpatch qpatch should not try to rename debug symbols, but modify the prl files instead. This purely replaces forward-slashed pathes. The pathes in the debugging symbols use backslashes and are not touched. Reviewed-By: con --- src/tools/qpatch/files-to-patch-windows | 53 +++++++++-------- src/tools/qtlibspatcher/qtlibspatchermain.cpp | 57 ++++++++----------- 2 files changed, 49 insertions(+), 61 deletions(-) diff --git a/src/tools/qpatch/files-to-patch-windows b/src/tools/qpatch/files-to-patch-windows index 38545a7defc..a1fd431f9a2 100644 --- a/src/tools/qpatch/files-to-patch-windows +++ b/src/tools/qpatch/files-to-patch-windows @@ -1,28 +1,27 @@ -bin/Qt3Supportd4.dll +bin/qmake.exe +bin/QtCore4.dll bin/QtCored4.dll -bin/QtGuid4.dll -bin/QtHelpd4.dll -bin/QtMultimediad4.dll -bin/QtNetworkd4.dll -bin/QtOpenGLd4.dll -bin/QtScriptd4.dll -bin/QtScriptToolsd4.dll -bin/QtSqld4.dll -bin/QtSvgd4.dll -bin/QtTestd4.dll -bin/QtWebKitd4.dll -bin/QtXmld4.dll -bin/QtXmlPatternsd4.dll -plugins/accessible/qtaccessiblecompatwidgetsd4.dll -plugins/accessible/qtaccessiblewidgetsd4.dll -plugins/codecs/qcncodecsd4.dll -plugins/codecs/qjpcodecsd4.dll -plugins/codecs/qkrcodecsd4.dll -plugins/codecs/qtwcodecsd4.dll -plugins/iconengines/qsvgicond4.dll -plugins/imageformats/qgifd4.dll -plugins/imageformats/qjpegd4.dll -plugins/imageformats/qmngd4.dll -plugins/imageformats/qsvgd4.dll -plugins/imageformats/qtiffd4.dll -plugins/sqldrivers/qsqlited4.dll +%% +mkspecs/default/qmake.conf +demos/shared/libdemo_shared.prl +lib/libQt3Support.prl +lib/libQtAssistantClient.prl +lib/libQtCLucene.prl +lib/libQtCore.prl +lib/libQtDBus.prl +lib/libQtDesignerComponents.prl +lib/libQtDesigner.prl +lib/libQtGui.prl +lib/libQtHelp.prl +lib/libQtMultimedia.prl +lib/libQtNetwork.prl +lib/libQtOpenGL.prl +lib/libQtScript.prl +lib/libQtScriptTools.prl +lib/libQtSql.prl +lib/libQtSvg.prl +lib/libQtTest.prl +lib/libQtUiTools.prl +lib/libQtWebKit.prl +lib/libQtXmlPatterns.prl +lib/libQtXml.prl diff --git a/src/tools/qtlibspatcher/qtlibspatchermain.cpp b/src/tools/qtlibspatcher/qtlibspatchermain.cpp index b478c02dd98..bf92cb3c1a6 100644 --- a/src/tools/qtlibspatcher/qtlibspatchermain.cpp +++ b/src/tools/qtlibspatcher/qtlibspatchermain.cpp @@ -38,7 +38,7 @@ #include #ifdef Q_OS_WIN -# define QT_INSTALL_DIR "C:/qt-greenhouse/Trolltech/Code_less_create_more/Trolltech/Code_less_create_more/Troll/4.5.0/qt"; +# define QT_INSTALL_DIR "C:/qt-greenhouse/Trolltech/Code_less_create_more/Trolltech/Code_less_create_more/Troll/4.6/qt"; const char * const oldInstallBase = QT_INSTALL_DIR; const char * const oldSourceBase = QT_INSTALL_DIR; @@ -170,6 +170,7 @@ bool patchDebugLibrariesWithQtPath(const char *baseQtPath) { "/bin/QtGuid4.dll" }, { "/bin/QtHelpd4.dll" }, { "/bin/QtNetworkd4.dll" }, + { "/bin/QtNetworkd4.dll" }, { "/bin/QtOpenGLd4.dll" }, { "/bin/QtScriptd4.dll" }, { "/bin/QtScriptToolsd4.dll" }, @@ -179,20 +180,6 @@ bool patchDebugLibrariesWithQtPath(const char *baseQtPath) { "/bin/QtWebKitd4.dll" }, { "/bin/QtXmld4.dll" }, { "/bin/QtXmlPatternsd4.dll" }, - { "/lib/Qt3Supportd4.dll" }, - { "/lib/QtCored4.dll" }, - { "/lib/QtGuid4.dll" }, - { "/lib/QtHelpd4.dll" }, - { "/lib/QtNetworkd4.dll" }, - { "/lib/QtOpenGLd4.dll" }, - { "/lib/QtScriptd4.dll" }, - { "/lib/QtScriptToolsd4.dll" }, - { "/lib/QtSqld4.dll" }, - { "/lib/QtSvgd4.dll" }, - { "/lib/QtTestd4.dll" }, - { "/lib/QtWebKitd4.dll" }, - { "/lib/QtXmld4.dll" }, - { "/lib/QtXmlPatternsd4.dll" }, { "/plugins/accessible/qtaccessiblecompatwidgetsd4.dll" }, { "/plugins/accessible/qtaccessiblewidgetsd4.dll" }, { "/plugins/codecs/qcncodecsd4.dll" }, @@ -445,26 +432,27 @@ bool patchDebugLibrariesWithQtPath(const char *baseQtPath) { "/examples/xmlpatterns/filetree/filetree" }, { "/examples/xmlpatterns/qobjectxmlmodel/qobjectxmlmodel" }, { "/examples/xmlpatterns/recipes/recipes" }, - { "/lib/libQt3Support.so.4.5.0" }, - { "/lib/libQtAssistantClient.so.4.5.0" }, - { "/lib/libQtCLucene.so.4.5.0" }, - { "/lib/libQtCore.so.4.5.0" }, - { "/lib/libQtDBus.so.4.5.0" }, - { "/lib/libQtDesigner.so.4.5.0" }, - { "/lib/libQtDesignerComponents.so.4.5.0" }, - { "/lib/libQtGui.so.4.5.0" }, - { "/lib/libQtHelp.so.4.5.0" }, - { "/lib/libQtNetwork.so.4.5.0" }, - { "/lib/libQtOpenGL.so.4.5.0" }, - { "/lib/libQtScript.so.4.5.0" }, - { "/lib/libQtScriptTools.so.4.5.0" }, - { "/lib/libQtSql.so.4.5.0" }, - { "/lib/libQtSvg.so.4.5.0" }, - { "/lib/libQtTest.so.4.5.0" }, + { "/lib/libQt3Support.so" }, + { "/lib/libQtAssistantClient.so" }, + { "/lib/libQtCLucene.so" }, + { "/lib/libQtCore.so" }, + { "/lib/libQtDBus.so" }, + { "/lib/libQtDesigner.so" }, + { "/lib/libQtDesignerComponents.so" }, + { "/lib/libQtGui.so" }, + { "/lib/libQtHelp.so" }, + { "/lib/libQtMultimedia.so" }, + { "/lib/libQtNetwork.so" }, + { "/lib/libQtOpenGL.so" }, + { "/lib/libQtScript.so" }, + { "/lib/libQtScriptTools.so" }, + { "/lib/libQtSql.so" }, + { "/lib/libQtSvg.so" }, + { "/lib/libQtTest.so" }, { "/lib/libQtUiTools.a" }, - { "/lib/libQtWebKit.so.4.5.0" }, - { "/lib/libQtXml.so.4.5.0" }, - { "/lib/libQtXmlPatterns.so.4.5.0" }, + { "/lib/libQtWebKit.so" }, + { "/lib/libQtXml.so" }, + { "/lib/libQtXmlPatterns.so" }, { "/plugins/accessible/libqtaccessiblecompatwidgets.so" }, { "/plugins/accessible/libqtaccessiblewidgets.so" }, { "/plugins/codecs/libqcncodecs.so" }, @@ -572,6 +560,7 @@ const char * const textFileFileNames[] = "/lib/libQtDesigner.prl", "/lib/libQtGui.prl", "/lib/libQtHelp.prl", + "/lib/libQtMultimedia.prl", "/lib/libQtNetwork.prl", "/lib/libQtOpenGL.prl", "/lib/libQtScript.prl", From 6a9e7ab0f4963eed3edec4985e24e4c005c43a23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Tue, 10 Nov 2009 17:33:44 +0100 Subject: [PATCH 29/34] Fixed the direction in which include paths are traversed Reviewed-by: Roberto Raggi --- src/plugins/cpptools/cppmodelmanager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp index 6a490518401..b0f3838a4e8 100644 --- a/src/plugins/cpptools/cppmodelmanager.cpp +++ b/src/plugins/cpptools/cppmodelmanager.cpp @@ -379,8 +379,8 @@ QString CppPreprocessor::tryIncludeFile(QString &fileName, IncludeType type) } } - foreach (const QString &includePath, m_includePaths) { - QString path = includePath; + for (int i = m_includePaths.size() - 1; i != -1; --i) { + QString path = m_includePaths.at(i); path += QLatin1Char('/'); path += fileName; path = QDir::cleanPath(path); From 3cd7f49e71f263a5cc80cac90d5b15a2bbde0b56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Tue, 10 Nov 2009 18:12:36 +0100 Subject: [PATCH 30/34] Fixed search results handling of font height This patch makes sure that the rows that show the file and the rows that show the results are the same height, to satisfy the uniform row heights setting. Also, a layout changed signal is now emitted when the font is changed. This makes active search results update correctly when the text editor font is changed. Reviewed-by: con --- src/plugins/find/searchresulttreeitemdelegate.cpp | 2 +- src/plugins/find/searchresulttreemodel.cpp | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/plugins/find/searchresulttreeitemdelegate.cpp b/src/plugins/find/searchresulttreeitemdelegate.cpp index 5502069a177..88ac8d05535 100644 --- a/src/plugins/find/searchresulttreeitemdelegate.cpp +++ b/src/plugins/find/searchresulttreeitemdelegate.cpp @@ -109,7 +109,7 @@ int SearchResultTreeItemDelegate::drawLineNumber(QPainter *painter, const QStyle painter->setPen(isSelected ? option.palette.color(cg, QPalette::HighlightedText) : Qt::darkGray); painter->drawText(lineNumberAreaRect.adjusted(0, 0, -lineNumberAreaHorizontalPadding, 0), - Qt::AlignRight, QString::number(lineNumber)); + Qt::AlignRight | Qt::AlignVCenter, QString::number(lineNumber)); return lineNumberAreaWidth; } diff --git a/src/plugins/find/searchresulttreemodel.cpp b/src/plugins/find/searchresulttreemodel.cpp index 267022bb437..3afb91d31da 100644 --- a/src/plugins/find/searchresulttreemodel.cpp +++ b/src/plugins/find/searchresulttreemodel.cpp @@ -33,6 +33,7 @@ #include #include +#include #include #include #include @@ -45,7 +46,7 @@ SearchResultTreeModel::SearchResultTreeModel(QObject *parent) , m_lastAppendedResultFile(0) , m_showReplaceUI(false) { - m_rootItem = new SearchResultTreeItem(); + m_rootItem = new SearchResultTreeItem; m_textEditorFont = QFont("Courier"); } @@ -61,7 +62,9 @@ void SearchResultTreeModel::setShowReplaceUI(bool show) void SearchResultTreeModel::setTextEditorFont(const QFont &font) { + layoutAboutToBeChanged(); m_textEditorFont = font; + layoutChanged(); } Qt::ItemFlags SearchResultTreeModel::flags(const QModelIndex &index) const @@ -143,7 +146,13 @@ QVariant SearchResultTreeModel::data(const QModelIndex &index, int role) const QVariant result; - if (item->itemType() == SearchResultTreeItem::ResultRow) + if (role == Qt::SizeHintRole) + { + const int appFontHeight = QApplication::fontMetrics().height(); + const int editorFontHeight = QFontMetrics(m_textEditorFont).height(); + result = QSize(0, qMax(appFontHeight, editorFontHeight)); + } + else if (item->itemType() == SearchResultTreeItem::ResultRow) { const SearchResultTextRow *row = static_cast(item); result = data(row, role); From e4b1a25dd2bb8233a02c7ae5a5476e88ac4f0451 Mon Sep 17 00:00:00 2001 From: con Date: Tue, 10 Nov 2009 18:02:42 +0100 Subject: [PATCH 31/34] Revert "Code model: Update on changes from the versioning system." This reverts commit 7aa24116935249a840e1350a6f8de73bc794fb09. It breaks the code model updates completely. So reverting this change until we have the right thing. Reviewed-by: Roberto Raggi --- src/plugins/coreplugin/iversioncontrol.h | 4 -- src/plugins/coreplugin/mainwindow.cpp | 3 +- src/plugins/coreplugin/vcsmanager.cpp | 14 +--- src/plugins/coreplugin/vcsmanager.h | 12 +--- src/plugins/cppeditor/cppeditorconstants.h | 2 - src/plugins/cppeditor/cppplugin.cpp | 67 +++++++------------ src/plugins/cppeditor/cppplugin.h | 5 +- src/plugins/cpptools/cppmodelmanager.cpp | 41 +----------- src/plugins/cpptools/cppmodelmanager.h | 7 -- .../cpptools/cppmodelmanagerinterface.h | 6 -- src/plugins/cpptools/cpptoolsplugin.cpp | 6 -- src/plugins/cvs/cvscontrol.cpp | 11 --- src/plugins/cvs/cvscontrol.h | 3 - src/plugins/cvs/cvsplugin.cpp | 9 +-- src/plugins/cvs/cvsplugin.h | 3 +- src/plugins/git/gitclient.cpp | 48 +++---------- src/plugins/git/gitclient.h | 16 ++--- src/plugins/git/gitcommand.cpp | 2 - src/plugins/git/gitcommand.h | 1 - src/plugins/git/gitplugin.cpp | 14 ++-- src/plugins/git/gitplugin.h | 3 - src/plugins/git/gitversioncontrol.cpp | 5 -- src/plugins/git/gitversioncontrol.h | 2 - src/plugins/perforce/perforceplugin.cpp | 7 +- .../perforce/perforceversioncontrol.cpp | 10 --- src/plugins/perforce/perforceversioncontrol.h | 3 - src/plugins/subversion/subversioncontrol.cpp | 10 --- src/plugins/subversion/subversioncontrol.h | 3 - src/plugins/subversion/subversionplugin.cpp | 6 +- src/plugins/subversion/subversionplugin.h | 3 +- 30 files changed, 61 insertions(+), 265 deletions(-) diff --git a/src/plugins/coreplugin/iversioncontrol.h b/src/plugins/coreplugin/iversioncontrol.h index edaab39fbdb..8cbd8240b36 100644 --- a/src/plugins/coreplugin/iversioncontrol.h +++ b/src/plugins/coreplugin/iversioncontrol.h @@ -106,10 +106,6 @@ public: */ virtual bool vcsDelete(const QString &filename) = 0; -signals: - void repositoryChanged(const QString &repository); - void filesChanged(const QStringList &files); - // TODO: ADD A WAY TO DETECT WHETHER A FILE IS MANAGED, e.g // virtual bool sccManaged(const QString &filename) = 0; }; diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index e7b8e7fa544..282b2bf6815 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -126,7 +126,7 @@ MainWindow::MainWindow() : m_progressManager(new ProgressManagerPrivate()), m_scriptManager(new ScriptManagerPrivate(this)), m_variableManager(new VariableManager(this)), - m_vcsManager(new VCSManager), + m_vcsManager(new VCSManager()), m_viewManager(0), m_modeManager(0), m_mimeDatabase(new MimeDatabase), @@ -346,7 +346,6 @@ void MainWindow::extensionsInitialized() OutputPaneManager::instance()->init(); m_actionManager->initialize(); - m_vcsManager->extensionsInitialized(); readSettings(); updateContext(); diff --git a/src/plugins/coreplugin/vcsmanager.cpp b/src/plugins/coreplugin/vcsmanager.cpp index e07ba2ff12e..33c7e484a02 100644 --- a/src/plugins/coreplugin/vcsmanager.cpp +++ b/src/plugins/coreplugin/vcsmanager.cpp @@ -57,8 +57,7 @@ struct VCSManagerPrivate { QMap m_cachedMatches; }; -VCSManager::VCSManager(QObject *parent) : - QObject(parent), +VCSManager::VCSManager() : m_d(new VCSManagerPrivate) { } @@ -68,17 +67,6 @@ VCSManager::~VCSManager() delete m_d; } -void VCSManager::extensionsInitialized() -{ - // Change signal connections - foreach (IVersionControl *versionControl, allVersionControls()) { - connect(versionControl, SIGNAL(filesChanged(QStringList)), - this, SIGNAL(filesChanged(QStringList))); - connect(versionControl, SIGNAL(repositoryChanged(QString)), - this, SIGNAL(repositoryChanged(QString))); - } -} - void VCSManager::setVCSEnabled(const QString &directory) { if (debug) diff --git a/src/plugins/coreplugin/vcsmanager.h b/src/plugins/coreplugin/vcsmanager.h index 772243dd957..fa94efc618c 100644 --- a/src/plugins/coreplugin/vcsmanager.h +++ b/src/plugins/coreplugin/vcsmanager.h @@ -33,7 +33,6 @@ #include "core_global.h" #include -#include namespace Core { @@ -50,16 +49,13 @@ class IVersionControl; // for the topmost directory it manages. This information is cached and // VCSManager thus knows pretty fast which IVersionControl * is responsible. -class CORE_EXPORT VCSManager : public QObject +class CORE_EXPORT VCSManager { - Q_OBJECT Q_DISABLE_COPY(VCSManager) public: - explicit VCSManager(QObject *parent = 0); + VCSManager(); virtual ~VCSManager(); - void extensionsInitialized(); - IVersionControl *findVersionControlForDirectory(const QString &directory); // Enable the VCS managing a certain directory only. This should @@ -73,10 +69,6 @@ public: // if a failure occurs bool showDeleteDialog(const QString &fileName); -signals: - void repositoryChanged(const QString &repository); - void filesChanged(const QStringList &files); - private: VCSManagerPrivate *m_d; }; diff --git a/src/plugins/cppeditor/cppeditorconstants.h b/src/plugins/cppeditor/cppeditorconstants.h index 85d02021251..356f711ba9e 100644 --- a/src/plugins/cppeditor/cppeditorconstants.h +++ b/src/plugins/cppeditor/cppeditorconstants.h @@ -41,10 +41,8 @@ const char * const SWITCH_DECLARATION_DEFINITION = "CppEditor.SwitchDeclarationD const char * const RENAME_SYMBOL_UNDER_CURSOR = "CppEditor.RenameSymbolUnderCursor"; const char * const FIND_USAGES = "CppEditor.FindUsages"; const char * const SEPARATOR = "CppEditor.Separator"; -const char * const SEPARATOR2 = "CppEditor.Separator2"; const char * const FIND_REFERENCES = "CppEditor.FindReferences"; const char * const JUMP_TO_DEFINITION = "CppEditor.JumpToDefinition"; -const char * const UPDATE_CODEMODEL = "CppEditor.UpdateCodeModel"; const char * const HEADER_FILE_TYPE = "CppHeaderFiles"; const char * const SOURCE_FILE_TYPE = "CppSourceFiles"; diff --git a/src/plugins/cppeditor/cppplugin.cpp b/src/plugins/cppeditor/cppplugin.cpp index 16d7ce4b914..f98fb680873 100644 --- a/src/plugins/cppeditor/cppplugin.cpp +++ b/src/plugins/cppeditor/cppplugin.cpp @@ -43,7 +43,7 @@ #include #include #include -#include +#include #include #include #include @@ -112,11 +112,7 @@ CppPlugin *CppPlugin::m_instance = 0; CppPlugin::CppPlugin() : m_actionHandler(0), - m_sortedMethodOverview(false), - m_renameSymbolUnderCursorAction(0), - m_findUsagesAction(0), - m_updateCodeModelAction(0) - + m_sortedMethodOverview(false) { m_instance = this; } @@ -162,17 +158,6 @@ bool CppPlugin::sortedMethodOverview() const return m_sortedMethodOverview; } -static inline - Core::Command *createSeparator(Core::ActionManager *am, - QObject *parent, - const QList &context, - const char *id) -{ - QAction *separator = new QAction(parent); - separator->setSeparator(true); - return am->registerAction(separator, QLatin1String(id), context); -} - bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage) { Core::ICore *core = Core::ICore::instance(); @@ -207,7 +192,6 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess Core::ActionContainer *contextMenu= am->createMenu(CppEditor::Constants::M_CONTEXT); Core::Command *cmd; - Core::ActionContainer *cppToolsMenu = am->actionContainer(QLatin1String(CppTools::Constants::M_TOOLS_CPP)); QAction *jumpToDefinition = new QAction(tr("Follow Symbol under Cursor"), this); cmd = am->registerAction(jumpToDefinition, @@ -216,7 +200,7 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess connect(jumpToDefinition, SIGNAL(triggered()), this, SLOT(jumpToDefinition())); contextMenu->addAction(cmd); - cppToolsMenu->addAction(cmd); + am->actionContainer(CppTools::Constants::M_TOOLS_CPP)->addAction(cmd); QAction *switchDeclarationDefinition = new QAction(tr("Switch between Method Declaration/Definition"), this); cmd = am->registerAction(switchDeclarationDefinition, @@ -225,14 +209,14 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess connect(switchDeclarationDefinition, SIGNAL(triggered()), this, SLOT(switchDeclarationDefinition())); contextMenu->addAction(cmd); - cppToolsMenu->addAction(cmd); + am->actionContainer(CppTools::Constants::M_TOOLS_CPP)->addAction(cmd); m_findUsagesAction = new QAction(tr("Find Usages"), this); cmd = am->registerAction(m_findUsagesAction, Constants::FIND_USAGES, context); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+U"))); connect(m_findUsagesAction, SIGNAL(triggered()), this, SLOT(findUsages())); contextMenu->addAction(cmd); - cppToolsMenu->addAction(cmd); + am->actionContainer(CppTools::Constants::M_TOOLS_CPP)->addAction(cmd); m_renameSymbolUnderCursorAction = new QAction(tr("Rename Symbol under Cursor"), this); cmd = am->registerAction(m_renameSymbolUnderCursorAction, @@ -240,17 +224,7 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess cmd->setDefaultKeySequence(QKeySequence("CTRL+SHIFT+R")); connect(m_renameSymbolUnderCursorAction, SIGNAL(triggered()), this, SLOT(renameSymbolUnderCursor())); contextMenu->addAction(cmd); - cppToolsMenu->addAction(cmd); - - // Update context in global context - QList globalContext; - globalContext.append(Core::Constants::C_GLOBAL_ID); - cppToolsMenu->addAction(createSeparator(am, this, globalContext, CppEditor::Constants::SEPARATOR2)); - m_updateCodeModelAction = new QAction(tr("Update code model"), this); - cmd = am->registerAction(m_updateCodeModelAction, QLatin1String(Constants::UPDATE_CODEMODEL), globalContext); - CppTools::CppModelManagerInterface *cppModelManager = CppTools::CppModelManagerInterface::instance(); - connect(m_updateCodeModelAction, SIGNAL(triggered()), cppModelManager, SLOT(updateModifiedSourceFiles())); - cppToolsMenu->addAction(cmd); + am->actionContainer(CppTools::Constants::M_TOOLS_CPP)->addAction(cmd); m_actionHandler = new TextEditor::TextEditorActionHandler(CppEditor::Constants::C_CPPEDITOR, TextEditor::TextEditorActionHandler::Format @@ -259,7 +233,10 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess m_actionHandler->initializeActions(); - contextMenu->addAction(createSeparator(am, this, context, CppEditor::Constants::SEPARATOR)); + QAction *separator = new QAction(this); + separator->setSeparator(true); + cmd = am->registerAction(separator, CppEditor::Constants::SEPARATOR, context); + contextMenu->addAction(cmd); cmd = am->command(TextEditor::Constants::AUTO_INDENT_SELECTION); contextMenu->addAction(cmd); @@ -267,8 +244,10 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess cmd = am->command(TextEditor::Constants::UN_COMMENT_SELECTION); contextMenu->addAction(cmd); - connect(cppModelManager, SIGNAL(indexingStarted()), this, SLOT(onCppModelIndexingStarted())); - connect(cppModelManager, SIGNAL(indexingFinished()), this, SLOT(onCppModelIndexingFinished())); + connect(core->progressManager(), SIGNAL(taskStarted(QString)), + this, SLOT(onTaskStarted(QString))); + connect(core->progressManager(), SIGNAL(allTasksFinished(QString)), + this, SLOT(onAllTasksFinished(QString))); readSettings(); return true; } @@ -324,18 +303,20 @@ void CppPlugin::findUsages() editor->findUsages(); } -void CppPlugin::onCppModelIndexingStarted() +void CppPlugin::onTaskStarted(const QString &type) { - m_renameSymbolUnderCursorAction->setEnabled(false); - m_findUsagesAction->setEnabled(false); - m_updateCodeModelAction->setEnabled(false); + if (type == CppTools::Constants::TASK_INDEX) { + m_renameSymbolUnderCursorAction->setEnabled(false); + m_findUsagesAction->setEnabled(false); + } } -void CppPlugin::onCppModelIndexingFinished() +void CppPlugin::onAllTasksFinished(const QString &type) { - m_renameSymbolUnderCursorAction->setEnabled(true); - m_findUsagesAction->setEnabled(true); - m_updateCodeModelAction->setEnabled(true); + if (type == CppTools::Constants::TASK_INDEX) { + m_renameSymbolUnderCursorAction->setEnabled(true); + m_findUsagesAction->setEnabled(true); + } } Q_EXPORT_PLUGIN(CppPlugin) diff --git a/src/plugins/cppeditor/cppplugin.h b/src/plugins/cppeditor/cppplugin.h index e0ccc7ac64e..3456bd9baf2 100644 --- a/src/plugins/cppeditor/cppplugin.h +++ b/src/plugins/cppeditor/cppplugin.h @@ -75,8 +75,8 @@ private slots: void switchDeclarationDefinition(); void jumpToDefinition(); void renameSymbolUnderCursor(); - void onCppModelIndexingStarted(); - void onCppModelIndexingFinished(); + void onTaskStarted(const QString &type); + void onAllTasksFinished(const QString &type); void findUsages(); private: @@ -90,7 +90,6 @@ private: bool m_sortedMethodOverview; QAction *m_renameSymbolUnderCursorAction; QAction *m_findUsagesAction; - QAction *m_updateCodeModelAction; }; class CppEditorFactory : public Core::IEditorFactory diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp index b0f3838a4e8..38c4e61c8a0 100644 --- a/src/plugins/cpptools/cppmodelmanager.cpp +++ b/src/plugins/cpptools/cppmodelmanager.cpp @@ -595,8 +595,6 @@ Document::Ptr CppPreprocessor::switchDocument(Document::Ptr doc) void CppTools::CppModelManagerInterface::updateModifiedSourceFiles() { - if (isIndexing()) - return; const Snapshot snapshot = this->snapshot(); QStringList sourceFiles; @@ -632,8 +630,7 @@ CppTools::CppModelManagerInterface *CppTools::CppModelManagerInterface::instance */ CppModelManager::CppModelManager(QObject *parent) - : CppModelManagerInterface(parent), - m_indexing(false) + : CppModelManagerInterface(parent) { m_findReferences = new CppFindReferences(this); @@ -678,11 +675,6 @@ CppModelManager::CppModelManager(QObject *parent) connect(m_core->editorManager(), SIGNAL(editorAboutToClose(Core::IEditor *)), this, SLOT(editorAboutToClose(Core::IEditor *))); - - connect(m_core->progressManager(), SIGNAL(taskStarted(QString)), - this, SLOT(onTaskStarted(QString))); - connect(m_core->progressManager(), SIGNAL(allTasksFinished(QString)), - this, SLOT(onAllTasksFinished(QString))); } CppModelManager::~CppModelManager() @@ -879,7 +871,7 @@ QStringList CppModelManager::includesInPath(const QString &path) const QFuture CppModelManager::refreshSourceFiles(const QStringList &sourceFiles) { - if (!m_indexing && !sourceFiles.isEmpty() && qgetenv("QTCREATOR_NO_CODE_INDEXER").isNull()) { + if (! sourceFiles.isEmpty() && qgetenv("QTCREATOR_NO_CODE_INDEXER").isNull()) { const QMap workingCopy = buildWorkingCopyList(); CppPreprocessor *preproc = new CppPreprocessor(this); @@ -905,7 +897,7 @@ QFuture CppModelManager::refreshSourceFiles(const QStringList &sourceFiles m_synchronizer.addFuture(result); - if (sourceFiles.count() > 1) { + if (sourceFiles.count() > 1) { m_core->progressManager()->addTask(result, tr("Indexing"), CppTools::Constants::TASK_INDEX, Core::ProgressManager::CloseOnSuccess); @@ -1399,31 +1391,4 @@ void CppModelManager::GC() protectSnapshot.unlock(); } -bool CppModelManager::isIndexing() const -{ - return m_indexing; -} -void CppModelManager::setIndexing(bool v) -{ - if (m_indexing == v) - return; - m_indexing = v; - if (v) { - emit indexingStarted(); - } else { - emit indexingFinished(); - } -} - -void CppModelManager::onTaskStarted(const QString &type) -{ - if (type == QLatin1String(CppTools::Constants::TASK_INDEX)) - setIndexing(true); -} - -void CppModelManager::onAllTasksFinished(const QString &type) -{ - if (type == QLatin1String(CppTools::Constants::TASK_INDEX)) - setIndexing(false); -} diff --git a/src/plugins/cpptools/cppmodelmanager.h b/src/plugins/cpptools/cppmodelmanager.h index ca13b44a242..4222ccab6be 100644 --- a/src/plugins/cpptools/cppmodelmanager.h +++ b/src/plugins/cpptools/cppmodelmanager.h @@ -111,8 +111,6 @@ public: void setHeaderSuffixes(const QStringList &suffixes) { m_headerSuffixes = suffixes; } - virtual bool isIndexing() const; - Q_SIGNALS: void projectPathChanged(const QString &projectPath); @@ -131,8 +129,6 @@ private Q_SLOTS: void onProjectAdded(ProjectExplorer::Project *project); void postEditorUpdate(); void updateEditorSelections(); - void onTaskStarted(const QString &type); - void onAllTasksFinished(const QString &type); private: QMap buildWorkingCopyList(); @@ -179,13 +175,10 @@ private: CppPreprocessor *preproc, QStringList files); - void setIndexing(bool); - private: Core::ICore *m_core; CPlusPlus::Snapshot m_snapshot; - bool m_indexing; // cache bool m_dirty; QStringList m_projectFiles; diff --git a/src/plugins/cpptools/cppmodelmanagerinterface.h b/src/plugins/cpptools/cppmodelmanagerinterface.h index 1ec38abe304..1976df75eab 100644 --- a/src/plugins/cpptools/cppmodelmanagerinterface.h +++ b/src/plugins/cpptools/cppmodelmanagerinterface.h @@ -102,12 +102,6 @@ public: virtual void renameUsages(CPlusPlus::Symbol *symbol) = 0; virtual void findUsages(CPlusPlus::Symbol *symbol) = 0; - virtual bool isIndexing() const = 0; - -signals: - void indexingStarted(); - void indexingFinished(); - public Q_SLOTS: void updateModifiedSourceFiles(); virtual void updateSourceFiles(const QStringList &sourceFiles) = 0; diff --git a/src/plugins/cpptools/cpptoolsplugin.cpp b/src/plugins/cpptools/cpptoolsplugin.cpp index d321b7c39b3..bbc894390c8 100644 --- a/src/plugins/cpptools/cpptoolsplugin.cpp +++ b/src/plugins/cpptools/cpptoolsplugin.cpp @@ -47,7 +47,6 @@ #include #include #include -#include #include #include @@ -98,11 +97,6 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error) // Objects m_modelManager = new CppModelManager(this); - Core::VCSManager *vcsManager = core->vcsManager(); - connect(vcsManager, SIGNAL(repositoryChanged(QString)), - m_modelManager, SLOT(updateModifiedSourceFiles())); - connect(vcsManager, SIGNAL(filesChanged(QStringList)), - m_modelManager, SLOT(updateModifiedSourceFiles())); addAutoReleasedObject(m_modelManager); m_completion = new CppCodeCompletion(m_modelManager); diff --git a/src/plugins/cvs/cvscontrol.cpp b/src/plugins/cvs/cvscontrol.cpp index 1689f220527..51edeec5a69 100644 --- a/src/plugins/cvs/cvscontrol.cpp +++ b/src/plugins/cvs/cvscontrol.cpp @@ -96,14 +96,3 @@ QString CVSControl::findTopLevelForDirectory(const QString &directory) const { return m_plugin->findTopLevelForDirectory(directory); } - -void CVSControl::emitRepositoryChanged(const QString &s) -{ - emit repositoryChanged(s); -} - -void CVSControl::emitFilesChanged(const QStringList &l) -{ - emit filesChanged(l); -} - diff --git a/src/plugins/cvs/cvscontrol.h b/src/plugins/cvs/cvscontrol.h index c6adb7ffa9c..52067ad3702 100644 --- a/src/plugins/cvs/cvscontrol.h +++ b/src/plugins/cvs/cvscontrol.h @@ -56,9 +56,6 @@ public: virtual bool vcsAdd(const QString &fileName); virtual bool vcsDelete(const QString &filename); - void emitRepositoryChanged(const QString &s); - void emitFilesChanged(const QStringList &l); - signals: void enabledChanged(bool); diff --git a/src/plugins/cvs/cvsplugin.cpp b/src/plugins/cvs/cvsplugin.cpp index 0fa8619e270..654fce42bb3 100644 --- a/src/plugins/cvs/cvsplugin.cpp +++ b/src/plugins/cvs/cvsplugin.cpp @@ -551,11 +551,9 @@ void CVSPlugin::revertCurrentFile() QStringList args(QLatin1String("update")); args.push_back(QLatin1String("-C")); - const QStringList files = QStringList(file); - const CVSResponse revertResponse = runCVS(args, files, cvsShortTimeOut, true); + const CVSResponse revertResponse = runCVS(args, QStringList(file), cvsShortTimeOut, true); if (revertResponse.result == CVSResponse::Ok) { fcb.setModifiedReload(true); - m_versionControl->emitFilesChanged(files); } } @@ -736,10 +734,7 @@ void CVSPlugin::updateProject() if (!topLevels.empty()) { QStringList args(QLatin1String("update")); args.push_back(QLatin1String("-dR")); - const CVSResponse response = runCVS(args, topLevels, cvsLongTimeOut, true); - if (response.result == CVSResponse::Ok) - foreach(const QString &topLevel, topLevels) - m_versionControl->emitRepositoryChanged(topLevel); + runCVS(args, topLevels, cvsLongTimeOut, true); } } diff --git a/src/plugins/cvs/cvsplugin.h b/src/plugins/cvs/cvsplugin.h index a1515cfc931..c0f63473b2b 100644 --- a/src/plugins/cvs/cvsplugin.h +++ b/src/plugins/cvs/cvsplugin.h @@ -59,7 +59,6 @@ namespace CVS { namespace Internal { class CVSSubmitEditor; -class CVSControl; struct CVSResponse { @@ -154,7 +153,7 @@ private: void cleanCommitMessageFile(); CVSSettings m_settings; - CVSControl *m_versionControl; + Core::IVersionControl *m_versionControl; QString m_commitMessageFileName; ProjectExplorer::ProjectExplorerPlugin *m_projectExplorer; diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 486196174af..419784887f0 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -34,7 +34,6 @@ #include "gitconstants.h" #include "gitplugin.h" #include "gitsubmiteditor.h" -#include "gitversioncontrol.h" #include #include @@ -44,9 +43,6 @@ #include #include #include -#include -#include - #include #include #include @@ -59,7 +55,6 @@ #include #include #include -#include #include // for msg box parent #include @@ -107,8 +102,7 @@ static QString formatCommand(const QString &binary, const QStringList &args) GitClient::GitClient(GitPlugin* plugin) : m_msgWait(tr("Waiting for data...")), m_plugin(plugin), - m_core(Core::ICore::instance()), - m_repositoryChangedSignalMapper(0) + m_core(Core::ICore::instance()) { if (QSettings *s = m_core->settings()) { m_settings.fromSettings(s); @@ -323,8 +317,7 @@ void GitClient::checkoutBranch(const QString &workingDirectory, const QString &b { QStringList arguments(QLatin1String("checkout")); arguments << branch; - GitCommand *cmd = executeGit(workingDirectory, arguments, 0, true); - connectRepositoryChanged(workingDirectory, cmd); + executeGit(workingDirectory, arguments, 0, true); } void GitClient::checkout(const QString &workingDirectory, const QString &fileName) @@ -348,8 +341,7 @@ void GitClient::hardReset(const QString &workingDirectory, const QString &commit if (!commit.isEmpty()) arguments << commit; - GitCommand *cmd = executeGit(workingDirectory, arguments, 0, true); - connectRepositoryChanged(workingDirectory, cmd); + executeGit(workingDirectory, arguments, 0, true); } void GitClient::addFile(const QString &workingDirectory, const QString &fileName) @@ -508,19 +500,18 @@ GitCommand *GitClient::createCommand(const QString &workingDirectory, } // Execute a single command -GitCommand *GitClient::executeGit(const QString &workingDirectory, - const QStringList &arguments, - VCSBase::VCSBaseEditor* editor, - bool outputToWindow, - GitCommand::TerminationReportMode tm, - int editorLineNumber) +void GitClient::executeGit(const QString &workingDirectory, + const QStringList &arguments, + VCSBase::VCSBaseEditor* editor, + bool outputToWindow, + GitCommand::TerminationReportMode tm, + int editorLineNumber) { VCSBase::VCSBaseOutputWindow::instance()->appendCommand(formatCommand(QLatin1String(Constants::GIT_BINARY), arguments)); GitCommand *command = createCommand(workingDirectory, editor, outputToWindow, editorLineNumber); command->addJob(arguments, m_settings.timeout); command->setTerminationReportMode(tm); command->execute(); - return command; } // Return fixed arguments required to run @@ -912,8 +903,6 @@ void GitClient::revert(const QStringList &files) QString errorMessage; switch (revertI(files, &isDirectory, &errorMessage)) { case RevertOk: - m_plugin->versionControl()->emitFilesChanged(files); - break; case RevertCanceled: break; case RevertUnchanged: { @@ -929,8 +918,7 @@ void GitClient::revert(const QStringList &files) void GitClient::pull(const QString &workingDirectory) { - GitCommand *cmd = executeGit(workingDirectory, QStringList(QLatin1String("pull")), 0, true, GitCommand::ReportStderr); - connectRepositoryChanged(workingDirectory, cmd); + executeGit(workingDirectory, QStringList(QLatin1String("pull")), 0, true, GitCommand::ReportStderr); } void GitClient::push(const QString &workingDirectory) @@ -964,8 +952,7 @@ void GitClient::stashPop(const QString &workingDirectory) { QStringList arguments(QLatin1String("stash")); arguments << QLatin1String("pop"); - GitCommand *cmd = executeGit(workingDirectory, arguments, 0, true); - connectRepositoryChanged(workingDirectory, cmd); + executeGit(workingDirectory, arguments, 0, true); } void GitClient::branchList(const QString &workingDirectory) @@ -1013,16 +1000,3 @@ void GitClient::setSettings(const GitSettings &s) m_binaryPath = m_settings.gitBinaryPath(); } } - -void GitClient::connectRepositoryChanged(const QString & repository, GitCommand *cmd) -{ - // Bind command success termination with repository to changed signal - if (!m_repositoryChangedSignalMapper) { - m_repositoryChangedSignalMapper = new QSignalMapper(this); - connect(m_repositoryChangedSignalMapper, SIGNAL(mapped(QString)), - m_plugin->versionControl(), SIGNAL(repositoryChanged(QString))); - } - m_repositoryChangedSignalMapper->setMapping(cmd, repository); - connect(cmd, SIGNAL(success()), m_repositoryChangedSignalMapper, SLOT(map()), - Qt::QueuedConnection); -} diff --git a/src/plugins/git/gitclient.h b/src/plugins/git/gitclient.h index 76da3120347..341e177f353 100644 --- a/src/plugins/git/gitclient.h +++ b/src/plugins/git/gitclient.h @@ -33,6 +33,7 @@ #include "gitsettings.h" #include "gitcommand.h" +#include #include #include @@ -40,7 +41,6 @@ QT_BEGIN_NAMESPACE class QErrorMessage; -class QSignalMapper; QT_END_NAMESPACE namespace Core { @@ -158,12 +158,12 @@ private: bool outputToWindow = false, int editorLineNumber = -1); - GitCommand *executeGit(const QString &workingDirectory, - const QStringList &arguments, - VCSBase::VCSBaseEditor* editor = 0, - bool outputToWindow = false, - GitCommand::TerminationReportMode tm = GitCommand::NoReport, - int editorLineNumber = -1); + void executeGit(const QString &workingDirectory, + const QStringList &arguments, + VCSBase::VCSBaseEditor* editor = 0, + bool outputToWindow = false, + GitCommand::TerminationReportMode tm = GitCommand::NoReport, + int editorLineNumber = -1); bool synchronousGit(const QString &workingDirectory, const QStringList &arguments, @@ -173,14 +173,12 @@ private: enum RevertResult { RevertOk, RevertUnchanged, RevertCanceled, RevertFailed }; RevertResult revertI(QStringList files, bool *isDirectory, QString *errorMessage); - void connectRepositoryChanged(const QString & repository, GitCommand *cmd); const QString m_msgWait; GitPlugin *m_plugin; Core::ICore *m_core; GitSettings m_settings; QString m_binaryPath; - QSignalMapper *m_repositoryChangedSignalMapper; }; diff --git a/src/plugins/git/gitcommand.cpp b/src/plugins/git/gitcommand.cpp index ea6c17dab13..3f7a97095e6 100644 --- a/src/plugins/git/gitcommand.cpp +++ b/src/plugins/git/gitcommand.cpp @@ -177,8 +177,6 @@ void GitCommand::run() emit errorText(error); emit finished(ok, m_cookie); - if (ok) - emit success(); // As it is used asynchronously, we need to delete ourselves this->deleteLater(); } diff --git a/src/plugins/git/gitcommand.h b/src/plugins/git/gitcommand.h index 8f1c5aad0ec..7acf167750f 100644 --- a/src/plugins/git/gitcommand.h +++ b/src/plugins/git/gitcommand.h @@ -73,7 +73,6 @@ Q_SIGNALS: void outputData(const QByteArray&); void errorText(const QString&); void finished(bool ok, const QVariant &cookie); - void success(); private: struct Job { diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index 6e442bec7f2..0af7286ac91 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -142,7 +142,6 @@ GitPlugin::GitPlugin() : m_stashListAction(0), m_branchListAction(0), m_gitClient(0), - m_versionControl(0), m_changeSelectionDialog(0), m_submitActionTriggered(false) { @@ -216,8 +215,8 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage) addAutoReleasedObject(new GitSubmitEditorFactory(&submitParameters)); - m_versionControl = new GitVersionControl(m_gitClient); - addAutoReleasedObject(m_versionControl); + GitVersionControl *versionControl = new GitVersionControl(m_gitClient); + addAutoReleasedObject(versionControl); addAutoReleasedObject(new CloneWizard); addAutoReleasedObject(new Gitorious::Internal::GitoriousCloneWizard); @@ -233,8 +232,8 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage) gitContainer->menu()->setTitle(tr("&Git")); toolsContainer->addMenu(gitContainer); if (QAction *ma = gitContainer->menu()->menuAction()) { - ma->setEnabled(m_versionControl->isEnabled()); - connect(m_versionControl, SIGNAL(enabledChanged(bool)), ma, SLOT(setVisible(bool))); + ma->setEnabled(versionControl->isEnabled()); + connect(versionControl, SIGNAL(enabledChanged(bool)), ma, SLOT(setVisible(bool))); } Core::Command *command; @@ -399,11 +398,6 @@ void GitPlugin::extensionsInitialized() { } -GitVersionControl *GitPlugin::versionControl() const -{ - return m_versionControl; -} - void GitPlugin::submitEditorDiff(const QStringList &unstaged, const QStringList &staged) { m_gitClient->diff(m_submitRepository, QStringList(), unstaged, staged); diff --git a/src/plugins/git/gitplugin.h b/src/plugins/git/gitplugin.h index 0d6ad7fbdd5..4f934a89393 100644 --- a/src/plugins/git/gitplugin.h +++ b/src/plugins/git/gitplugin.h @@ -59,7 +59,6 @@ namespace Git { namespace Internal { class GitPlugin; -class GitVersionControl; class GitClient; class ChangeSelectionDialog; class GitSubmitEditor; @@ -97,7 +96,6 @@ public: void setSettings(const GitSettings &s); GitClient *gitClient() const; - GitVersionControl *versionControl() const; public slots: void updateActions(); @@ -161,7 +159,6 @@ private: QAction *m_branchListAction; GitClient *m_gitClient; - GitVersionControl *m_versionControl; ChangeSelectionDialog *m_changeSelectionDialog; QString m_submitRepository; QStringList m_submitOrigCommitFiles; diff --git a/src/plugins/git/gitversioncontrol.cpp b/src/plugins/git/gitversioncontrol.cpp index c64a683bea0..559d296220e 100644 --- a/src/plugins/git/gitversioncontrol.cpp +++ b/src/plugins/git/gitversioncontrol.cpp @@ -96,10 +96,5 @@ QString GitVersionControl::findTopLevelForDirectory(const QString &directory) co return GitClient::findRepositoryForDirectory(directory); } -void GitVersionControl::emitFilesChanged(const QStringList &l) -{ - emit filesChanged(l); -} - } // Internal } // Git diff --git a/src/plugins/git/gitversioncontrol.h b/src/plugins/git/gitversioncontrol.h index 44598000638..72908b0da22 100644 --- a/src/plugins/git/gitversioncontrol.h +++ b/src/plugins/git/gitversioncontrol.h @@ -57,8 +57,6 @@ public: virtual bool vcsAdd(const QString &fileName); virtual bool vcsDelete(const QString &filename); - void emitFilesChanged(const QStringList &); - signals: void enabledChanged(bool); diff --git a/src/plugins/perforce/perforceplugin.cpp b/src/plugins/perforce/perforceplugin.cpp index a80d8f55973..7039798b094 100644 --- a/src/plugins/perforce/perforceplugin.cpp +++ b/src/plugins/perforce/perforceplugin.cpp @@ -454,8 +454,6 @@ void PerforcePlugin::revertCurrentFile() Core::FileChangeBlocker fcb(fileName); fcb.setModifiedReload(true); PerforceResponse result2 = runP4Cmd(QStringList() << QLatin1String("revert") << fileName, QStringList(), CommandToWindow|StdOutToWindow|StdErrToWindow|ErrorToWindow); - if (!result2.error) - m_versionControl->emitFilesChanged(QStringList(fileName)); } void PerforcePlugin::diffCurrentFile() @@ -516,10 +514,7 @@ void PerforcePlugin::updateCheckout(const QStringList &dirs) { QStringList args(QLatin1String("sync")); args.append(dirs); - const PerforceResponse resp = runP4Cmd(args, QStringList(), CommandToWindow|StdOutToWindow|StdErrToWindow|ErrorToWindow); - if (!dirs.empty()) - foreach(const QString &dir, dirs) - m_versionControl->emitRepositoryChanged(dir); + runP4Cmd(args, QStringList(), CommandToWindow|StdOutToWindow|StdErrToWindow|ErrorToWindow); } void PerforcePlugin::printOpenedFileList() diff --git a/src/plugins/perforce/perforceversioncontrol.cpp b/src/plugins/perforce/perforceversioncontrol.cpp index ad915b2a208..040692428d8 100644 --- a/src/plugins/perforce/perforceversioncontrol.cpp +++ b/src/plugins/perforce/perforceversioncontrol.cpp @@ -94,15 +94,5 @@ QString PerforceVersionControl::findTopLevelForDirectory(const QString &director return m_plugin->findTopLevelForDirectory(directory); } -void PerforceVersionControl::emitRepositoryChanged(const QString &s) -{ - emit repositoryChanged(s); -} - -void PerforceVersionControl::emitFilesChanged(const QStringList &l) -{ - emit filesChanged(l); -} - } // Internal } // Perforce diff --git a/src/plugins/perforce/perforceversioncontrol.h b/src/plugins/perforce/perforceversioncontrol.h index dd385061cbc..2992e5518be 100644 --- a/src/plugins/perforce/perforceversioncontrol.h +++ b/src/plugins/perforce/perforceversioncontrol.h @@ -56,9 +56,6 @@ public: virtual bool vcsAdd(const QString &fileName); virtual bool vcsDelete(const QString &filename); - void emitRepositoryChanged(const QString &s); - void emitFilesChanged(const QStringList &l); - signals: void enabledChanged(bool); diff --git a/src/plugins/subversion/subversioncontrol.cpp b/src/plugins/subversion/subversioncontrol.cpp index ff0e0f1c81e..32ef57e5ecc 100644 --- a/src/plugins/subversion/subversioncontrol.cpp +++ b/src/plugins/subversion/subversioncontrol.cpp @@ -96,13 +96,3 @@ QString SubversionControl::findTopLevelForDirectory(const QString &directory) co { return m_plugin->findTopLevelForDirectory(directory); } - -void SubversionControl::emitRepositoryChanged(const QString &s) -{ - emit repositoryChanged(s); -} - -void SubversionControl::emitFilesChanged(const QStringList &l) -{ - emit filesChanged(l); -} diff --git a/src/plugins/subversion/subversioncontrol.h b/src/plugins/subversion/subversioncontrol.h index 325cfd10989..42f64ab147e 100644 --- a/src/plugins/subversion/subversioncontrol.h +++ b/src/plugins/subversion/subversioncontrol.h @@ -56,9 +56,6 @@ public: virtual bool vcsAdd(const QString &fileName); virtual bool vcsDelete(const QString &filename); - void emitRepositoryChanged(const QString &); - void emitFilesChanged(const QStringList &); - signals: void enabledChanged(bool); diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp index 0060e023953..676ffc2b8ad 100644 --- a/src/plugins/subversion/subversionplugin.cpp +++ b/src/plugins/subversion/subversionplugin.cpp @@ -574,7 +574,6 @@ void SubversionPlugin::revertCurrentFile() const SubversionResponse revertResponse = runSvn(args, subversionShortTimeOut, true); if (!revertResponse.error) { fcb.setModifiedReload(true); - m_versionControl->emitFilesChanged(QStringList(file)); } } @@ -751,10 +750,7 @@ void SubversionPlugin::updateProject() QStringList args(QLatin1String("update")); args.push_back(QLatin1String(nonInteractiveOptionC)); args.append(topLevels); - const SubversionResponse response = runSvn(args, subversionLongTimeOut, true); - if (!response.error) - foreach(const QString &repo, topLevels) - m_versionControl->emitRepositoryChanged(repo); + runSvn(args, subversionLongTimeOut, true); } void SubversionPlugin::annotateCurrentFile() diff --git a/src/plugins/subversion/subversionplugin.h b/src/plugins/subversion/subversionplugin.h index 6e3dab7e5d3..1dcfce68032 100644 --- a/src/plugins/subversion/subversionplugin.h +++ b/src/plugins/subversion/subversionplugin.h @@ -56,7 +56,6 @@ namespace Subversion { namespace Internal { class SubversionSubmitEditor; -class SubversionControl; struct SubversionResponse { @@ -132,7 +131,7 @@ private: const QStringList m_svnDirectories; SubversionSettings m_settings; - SubversionControl *m_versionControl; + Core::IVersionControl *m_versionControl; QString m_commitMessageFileName; ProjectExplorer::ProjectExplorerPlugin *m_projectExplorer; From 5bd5fa63bf6caf90170f9e703e0dba433fe407a7 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 11 Nov 2009 11:34:16 +0100 Subject: [PATCH 32/34] be more lenient when matching the stops at _start archer reports stops at tbreaks properly, so checking for an empty stop reason is no particularly good idea. instead, we simply skip *all* stops at the entry point, assuming the user will not really set a breakpoint there anyway. Reviewed-by: hjk --- src/plugins/debugger/gdb/gdbengine.cpp | 29 ++++++++++++-------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 4878ef6e7e6..2fec141eeb3 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -1184,23 +1184,20 @@ void GdbEngine::handleStopResponse(const GdbMi &data) if (!m_entryPoint.isEmpty()) { GdbMi frameData = data.findChild("frame"); if (frameData.findChild("addr").data() == m_entryPoint) { - if (reason == "signal-received" - && data.findChild("signal-name").data() == "SIGSTOP") { - // For some reason, attaching to a stopped process causes *two* stops - // when trying to continue (kernel i386 2.6.24-23-ubuntu, gdb 6.8). - // Interestingly enough, on MacOSX no signal is delivered at all. - continueInferiorInternal(); - return; - } - if (reason.isEmpty()) { // tbreak does that - // For programs without -pthread under gdb <= 6.8. - if (!inferiorPid()) - postCommand(_("info proc"), CB(handleInfoProc)); - continueInferiorInternal(); - return; - } + // There are two expected reasons for getting here: + // 1) For some reason, attaching to a stopped process causes *two* SIGSTOPs + // when trying to continue (kernel i386 2.6.24-23-ubuntu, gdb 6.8). + // Interestingly enough, on MacOSX no signal is delivered at all. + // 2) The explicit tbreak at the entry point we set to query the PID. + // Gdb <= 6.8 reports a frame but no reason, 6.8.50+ reports everything. + // The case of the user really setting a breakpoint at _start is simply + // unsupported. + if (!inferiorPid()) // For programs without -pthread under gdb <= 6.8. + postCommand(_("info proc"), CB(handleInfoProc)); + continueInferiorInternal(); + return; } - // We are past the initial stops. No need to waste time on further checks. + // We are past the initial stop(s). No need to waste time on further checks. m_entryPoint.clear(); } #endif From 4d45ad00037a056e52c74dca8a5c00ab2763da5d Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 11 Nov 2009 12:41:06 +0100 Subject: [PATCH 33/34] always clear pending command queue before posting shutdown commands this ensures that, among other things, we won't get into this scenario: - process is running - interrupt is requested by user - termination is requested by user - before interrupt takes effect, the process terminates => shutdown is called => exit is also queued, as there is already a queued kill => nothing happens, as there will never be a stop response Reviewed-by: hjk --- src/plugins/debugger/gdb/gdbengine.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 2fec141eeb3..2c33f40e1da 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -1406,7 +1406,6 @@ void GdbEngine::handleExecContinue(const GdbResponse &response) } else { if (state() == InferiorRunningRequested_Kill) { setState(InferiorStopped); - m_commandsToRunOnTemporaryBreak.clear(); shutdown(); return; } @@ -1423,7 +1422,6 @@ void GdbEngine::handleExecContinue(const GdbResponse &response) } else { showMessageBox(QMessageBox::Critical, tr("Execution Error"), tr("Cannot continue debugged process:\n") + QString::fromLocal8Bit(msg)); - m_commandsToRunOnTemporaryBreak.clear(); shutdown(); } } @@ -1468,6 +1466,7 @@ void GdbEngine::shutdown() // fall-through case AdapterStartFailed: // Adapter "did something", but it did not help if (m_gdbProc.state() == QProcess::Running) { + m_commandsToRunOnTemporaryBreak.clear(); postCommand(_("-gdb-exit"), GdbEngine::ExitRequest, CB(handleGdbExit)); } else { setState(DebuggerNotReady); @@ -1486,6 +1485,7 @@ void GdbEngine::shutdown() case InferiorShutDown: case InferiorShutdownFailed: // Whatever case InferiorUnrunnable: + m_commandsToRunOnTemporaryBreak.clear(); postCommand(_("-gdb-exit"), GdbEngine::ExitRequest, CB(handleGdbExit)); setState(EngineShuttingDown); // Do it after posting the command! break; From 8335a06ed4e1918c7216d82dc7a97bbea2b774aa Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 11 Nov 2009 14:32:54 +0100 Subject: [PATCH 34/34] Code model: Update on changes from the versioning system. Add changed signals to IVersionControl and VCSManager and wire them to the update methods. Add a menu action for manually updating. Improved version of reverted 7aa24116935249a840e1350a6f8de73bc794fb09. Reviewed-by: Roberto Raggi --- src/plugins/coreplugin/iversioncontrol.h | 4 ++ src/plugins/coreplugin/mainwindow.cpp | 3 +- src/plugins/coreplugin/vcsmanager.cpp | 14 +++++- src/plugins/coreplugin/vcsmanager.h | 12 ++++- src/plugins/cppeditor/cppeditorconstants.h | 2 + src/plugins/cppeditor/cppplugin.cpp | 44 +++++++++++++---- src/plugins/cppeditor/cppplugin.h | 1 + src/plugins/cpptools/cpptoolsplugin.cpp | 6 +++ src/plugins/cvs/cvscontrol.cpp | 11 +++++ src/plugins/cvs/cvscontrol.h | 3 ++ src/plugins/cvs/cvsplugin.cpp | 9 +++- src/plugins/cvs/cvsplugin.h | 3 +- src/plugins/git/gitclient.cpp | 48 ++++++++++++++----- src/plugins/git/gitclient.h | 16 ++++--- src/plugins/git/gitcommand.cpp | 2 + src/plugins/git/gitcommand.h | 1 + src/plugins/git/gitplugin.cpp | 14 ++++-- src/plugins/git/gitplugin.h | 3 ++ src/plugins/git/gitversioncontrol.cpp | 5 ++ src/plugins/git/gitversioncontrol.h | 2 + src/plugins/perforce/perforceplugin.cpp | 7 ++- .../perforce/perforceversioncontrol.cpp | 10 ++++ src/plugins/perforce/perforceversioncontrol.h | 3 ++ src/plugins/subversion/subversioncontrol.cpp | 10 ++++ src/plugins/subversion/subversioncontrol.h | 3 ++ src/plugins/subversion/subversionplugin.cpp | 6 ++- src/plugins/subversion/subversionplugin.h | 3 +- 27 files changed, 204 insertions(+), 41 deletions(-) diff --git a/src/plugins/coreplugin/iversioncontrol.h b/src/plugins/coreplugin/iversioncontrol.h index 8cbd8240b36..edaab39fbdb 100644 --- a/src/plugins/coreplugin/iversioncontrol.h +++ b/src/plugins/coreplugin/iversioncontrol.h @@ -106,6 +106,10 @@ public: */ virtual bool vcsDelete(const QString &filename) = 0; +signals: + void repositoryChanged(const QString &repository); + void filesChanged(const QStringList &files); + // TODO: ADD A WAY TO DETECT WHETHER A FILE IS MANAGED, e.g // virtual bool sccManaged(const QString &filename) = 0; }; diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index 282b2bf6815..e7b8e7fa544 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -126,7 +126,7 @@ MainWindow::MainWindow() : m_progressManager(new ProgressManagerPrivate()), m_scriptManager(new ScriptManagerPrivate(this)), m_variableManager(new VariableManager(this)), - m_vcsManager(new VCSManager()), + m_vcsManager(new VCSManager), m_viewManager(0), m_modeManager(0), m_mimeDatabase(new MimeDatabase), @@ -346,6 +346,7 @@ void MainWindow::extensionsInitialized() OutputPaneManager::instance()->init(); m_actionManager->initialize(); + m_vcsManager->extensionsInitialized(); readSettings(); updateContext(); diff --git a/src/plugins/coreplugin/vcsmanager.cpp b/src/plugins/coreplugin/vcsmanager.cpp index 33c7e484a02..e07ba2ff12e 100644 --- a/src/plugins/coreplugin/vcsmanager.cpp +++ b/src/plugins/coreplugin/vcsmanager.cpp @@ -57,7 +57,8 @@ struct VCSManagerPrivate { QMap m_cachedMatches; }; -VCSManager::VCSManager() : +VCSManager::VCSManager(QObject *parent) : + QObject(parent), m_d(new VCSManagerPrivate) { } @@ -67,6 +68,17 @@ VCSManager::~VCSManager() delete m_d; } +void VCSManager::extensionsInitialized() +{ + // Change signal connections + foreach (IVersionControl *versionControl, allVersionControls()) { + connect(versionControl, SIGNAL(filesChanged(QStringList)), + this, SIGNAL(filesChanged(QStringList))); + connect(versionControl, SIGNAL(repositoryChanged(QString)), + this, SIGNAL(repositoryChanged(QString))); + } +} + void VCSManager::setVCSEnabled(const QString &directory) { if (debug) diff --git a/src/plugins/coreplugin/vcsmanager.h b/src/plugins/coreplugin/vcsmanager.h index fa94efc618c..772243dd957 100644 --- a/src/plugins/coreplugin/vcsmanager.h +++ b/src/plugins/coreplugin/vcsmanager.h @@ -33,6 +33,7 @@ #include "core_global.h" #include +#include namespace Core { @@ -49,13 +50,16 @@ class IVersionControl; // for the topmost directory it manages. This information is cached and // VCSManager thus knows pretty fast which IVersionControl * is responsible. -class CORE_EXPORT VCSManager +class CORE_EXPORT VCSManager : public QObject { + Q_OBJECT Q_DISABLE_COPY(VCSManager) public: - VCSManager(); + explicit VCSManager(QObject *parent = 0); virtual ~VCSManager(); + void extensionsInitialized(); + IVersionControl *findVersionControlForDirectory(const QString &directory); // Enable the VCS managing a certain directory only. This should @@ -69,6 +73,10 @@ public: // if a failure occurs bool showDeleteDialog(const QString &fileName); +signals: + void repositoryChanged(const QString &repository); + void filesChanged(const QStringList &files); + private: VCSManagerPrivate *m_d; }; diff --git a/src/plugins/cppeditor/cppeditorconstants.h b/src/plugins/cppeditor/cppeditorconstants.h index 356f711ba9e..85d02021251 100644 --- a/src/plugins/cppeditor/cppeditorconstants.h +++ b/src/plugins/cppeditor/cppeditorconstants.h @@ -41,8 +41,10 @@ const char * const SWITCH_DECLARATION_DEFINITION = "CppEditor.SwitchDeclarationD const char * const RENAME_SYMBOL_UNDER_CURSOR = "CppEditor.RenameSymbolUnderCursor"; const char * const FIND_USAGES = "CppEditor.FindUsages"; const char * const SEPARATOR = "CppEditor.Separator"; +const char * const SEPARATOR2 = "CppEditor.Separator2"; const char * const FIND_REFERENCES = "CppEditor.FindReferences"; const char * const JUMP_TO_DEFINITION = "CppEditor.JumpToDefinition"; +const char * const UPDATE_CODEMODEL = "CppEditor.UpdateCodeModel"; const char * const HEADER_FILE_TYPE = "CppHeaderFiles"; const char * const SOURCE_FILE_TYPE = "CppSourceFiles"; diff --git a/src/plugins/cppeditor/cppplugin.cpp b/src/plugins/cppeditor/cppplugin.cpp index f98fb680873..a4476d6d904 100644 --- a/src/plugins/cppeditor/cppplugin.cpp +++ b/src/plugins/cppeditor/cppplugin.cpp @@ -52,6 +52,7 @@ #include #include #include +#include #include #include @@ -108,11 +109,26 @@ QStringList CppEditorFactory::mimeTypes() const ///////////////////////////////// CppPlugin ////////////////////////////////// +static inline + Core::Command *createSeparator(Core::ActionManager *am, + QObject *parent, + const QList &context, + const char *id) +{ + QAction *separator = new QAction(parent); + separator->setSeparator(true); + return am->registerAction(separator, QLatin1String(id), context); +} + CppPlugin *CppPlugin::m_instance = 0; CppPlugin::CppPlugin() : m_actionHandler(0), - m_sortedMethodOverview(false) + m_sortedMethodOverview(false), + m_renameSymbolUnderCursorAction(0), + m_findUsagesAction(0), + m_updateCodeModelAction(0) + { m_instance = this; } @@ -192,6 +208,7 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess Core::ActionContainer *contextMenu= am->createMenu(CppEditor::Constants::M_CONTEXT); Core::Command *cmd; + Core::ActionContainer *cppToolsMenu = am->actionContainer(QLatin1String(CppTools::Constants::M_TOOLS_CPP)); QAction *jumpToDefinition = new QAction(tr("Follow Symbol under Cursor"), this); cmd = am->registerAction(jumpToDefinition, @@ -200,7 +217,7 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess connect(jumpToDefinition, SIGNAL(triggered()), this, SLOT(jumpToDefinition())); contextMenu->addAction(cmd); - am->actionContainer(CppTools::Constants::M_TOOLS_CPP)->addAction(cmd); + cppToolsMenu->addAction(cmd); QAction *switchDeclarationDefinition = new QAction(tr("Switch between Method Declaration/Definition"), this); cmd = am->registerAction(switchDeclarationDefinition, @@ -209,14 +226,14 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess connect(switchDeclarationDefinition, SIGNAL(triggered()), this, SLOT(switchDeclarationDefinition())); contextMenu->addAction(cmd); - am->actionContainer(CppTools::Constants::M_TOOLS_CPP)->addAction(cmd); + cppToolsMenu->addAction(cmd); m_findUsagesAction = new QAction(tr("Find Usages"), this); cmd = am->registerAction(m_findUsagesAction, Constants::FIND_USAGES, context); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+U"))); connect(m_findUsagesAction, SIGNAL(triggered()), this, SLOT(findUsages())); contextMenu->addAction(cmd); - am->actionContainer(CppTools::Constants::M_TOOLS_CPP)->addAction(cmd); + cppToolsMenu->addAction(cmd); m_renameSymbolUnderCursorAction = new QAction(tr("Rename Symbol under Cursor"), this); cmd = am->registerAction(m_renameSymbolUnderCursorAction, @@ -224,7 +241,17 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess cmd->setDefaultKeySequence(QKeySequence("CTRL+SHIFT+R")); connect(m_renameSymbolUnderCursorAction, SIGNAL(triggered()), this, SLOT(renameSymbolUnderCursor())); contextMenu->addAction(cmd); - am->actionContainer(CppTools::Constants::M_TOOLS_CPP)->addAction(cmd); + cppToolsMenu->addAction(cmd); + + // Update context in global context + QList globalContext; + globalContext.append(Core::Constants::C_GLOBAL_ID); + cppToolsMenu->addAction(createSeparator(am, this, globalContext, CppEditor::Constants::SEPARATOR2)); + m_updateCodeModelAction = new QAction(tr("Update code model"), this); + cmd = am->registerAction(m_updateCodeModelAction, QLatin1String(Constants::UPDATE_CODEMODEL), globalContext); + CppTools::CppModelManagerInterface *cppModelManager = CppTools::CppModelManagerInterface::instance(); + connect(m_updateCodeModelAction, SIGNAL(triggered()), cppModelManager, SLOT(updateModifiedSourceFiles())); + cppToolsMenu->addAction(cmd); m_actionHandler = new TextEditor::TextEditorActionHandler(CppEditor::Constants::C_CPPEDITOR, TextEditor::TextEditorActionHandler::Format @@ -233,10 +260,7 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess m_actionHandler->initializeActions(); - QAction *separator = new QAction(this); - separator->setSeparator(true); - cmd = am->registerAction(separator, CppEditor::Constants::SEPARATOR, context); - contextMenu->addAction(cmd); + contextMenu->addAction(createSeparator(am, this, context, CppEditor::Constants::SEPARATOR)); cmd = am->command(TextEditor::Constants::AUTO_INDENT_SELECTION); contextMenu->addAction(cmd); @@ -308,6 +332,7 @@ void CppPlugin::onTaskStarted(const QString &type) if (type == CppTools::Constants::TASK_INDEX) { m_renameSymbolUnderCursorAction->setEnabled(false); m_findUsagesAction->setEnabled(false); + m_updateCodeModelAction->setEnabled(false); } } @@ -316,6 +341,7 @@ void CppPlugin::onAllTasksFinished(const QString &type) if (type == CppTools::Constants::TASK_INDEX) { m_renameSymbolUnderCursorAction->setEnabled(true); m_findUsagesAction->setEnabled(true); + m_updateCodeModelAction->setEnabled(true); } } diff --git a/src/plugins/cppeditor/cppplugin.h b/src/plugins/cppeditor/cppplugin.h index 3456bd9baf2..25687c300e0 100644 --- a/src/plugins/cppeditor/cppplugin.h +++ b/src/plugins/cppeditor/cppplugin.h @@ -90,6 +90,7 @@ private: bool m_sortedMethodOverview; QAction *m_renameSymbolUnderCursorAction; QAction *m_findUsagesAction; + QAction *m_updateCodeModelAction; }; class CppEditorFactory : public Core::IEditorFactory diff --git a/src/plugins/cpptools/cpptoolsplugin.cpp b/src/plugins/cpptools/cpptoolsplugin.cpp index bbc894390c8..d321b7c39b3 100644 --- a/src/plugins/cpptools/cpptoolsplugin.cpp +++ b/src/plugins/cpptools/cpptoolsplugin.cpp @@ -47,6 +47,7 @@ #include #include #include +#include #include #include @@ -97,6 +98,11 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error) // Objects m_modelManager = new CppModelManager(this); + Core::VCSManager *vcsManager = core->vcsManager(); + connect(vcsManager, SIGNAL(repositoryChanged(QString)), + m_modelManager, SLOT(updateModifiedSourceFiles())); + connect(vcsManager, SIGNAL(filesChanged(QStringList)), + m_modelManager, SLOT(updateModifiedSourceFiles())); addAutoReleasedObject(m_modelManager); m_completion = new CppCodeCompletion(m_modelManager); diff --git a/src/plugins/cvs/cvscontrol.cpp b/src/plugins/cvs/cvscontrol.cpp index 51edeec5a69..1689f220527 100644 --- a/src/plugins/cvs/cvscontrol.cpp +++ b/src/plugins/cvs/cvscontrol.cpp @@ -96,3 +96,14 @@ QString CVSControl::findTopLevelForDirectory(const QString &directory) const { return m_plugin->findTopLevelForDirectory(directory); } + +void CVSControl::emitRepositoryChanged(const QString &s) +{ + emit repositoryChanged(s); +} + +void CVSControl::emitFilesChanged(const QStringList &l) +{ + emit filesChanged(l); +} + diff --git a/src/plugins/cvs/cvscontrol.h b/src/plugins/cvs/cvscontrol.h index 52067ad3702..c6adb7ffa9c 100644 --- a/src/plugins/cvs/cvscontrol.h +++ b/src/plugins/cvs/cvscontrol.h @@ -56,6 +56,9 @@ public: virtual bool vcsAdd(const QString &fileName); virtual bool vcsDelete(const QString &filename); + void emitRepositoryChanged(const QString &s); + void emitFilesChanged(const QStringList &l); + signals: void enabledChanged(bool); diff --git a/src/plugins/cvs/cvsplugin.cpp b/src/plugins/cvs/cvsplugin.cpp index 654fce42bb3..0fa8619e270 100644 --- a/src/plugins/cvs/cvsplugin.cpp +++ b/src/plugins/cvs/cvsplugin.cpp @@ -551,9 +551,11 @@ void CVSPlugin::revertCurrentFile() QStringList args(QLatin1String("update")); args.push_back(QLatin1String("-C")); - const CVSResponse revertResponse = runCVS(args, QStringList(file), cvsShortTimeOut, true); + const QStringList files = QStringList(file); + const CVSResponse revertResponse = runCVS(args, files, cvsShortTimeOut, true); if (revertResponse.result == CVSResponse::Ok) { fcb.setModifiedReload(true); + m_versionControl->emitFilesChanged(files); } } @@ -734,7 +736,10 @@ void CVSPlugin::updateProject() if (!topLevels.empty()) { QStringList args(QLatin1String("update")); args.push_back(QLatin1String("-dR")); - runCVS(args, topLevels, cvsLongTimeOut, true); + const CVSResponse response = runCVS(args, topLevels, cvsLongTimeOut, true); + if (response.result == CVSResponse::Ok) + foreach(const QString &topLevel, topLevels) + m_versionControl->emitRepositoryChanged(topLevel); } } diff --git a/src/plugins/cvs/cvsplugin.h b/src/plugins/cvs/cvsplugin.h index c0f63473b2b..a1515cfc931 100644 --- a/src/plugins/cvs/cvsplugin.h +++ b/src/plugins/cvs/cvsplugin.h @@ -59,6 +59,7 @@ namespace CVS { namespace Internal { class CVSSubmitEditor; +class CVSControl; struct CVSResponse { @@ -153,7 +154,7 @@ private: void cleanCommitMessageFile(); CVSSettings m_settings; - Core::IVersionControl *m_versionControl; + CVSControl *m_versionControl; QString m_commitMessageFileName; ProjectExplorer::ProjectExplorerPlugin *m_projectExplorer; diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 419784887f0..486196174af 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -34,6 +34,7 @@ #include "gitconstants.h" #include "gitplugin.h" #include "gitsubmiteditor.h" +#include "gitversioncontrol.h" #include #include @@ -43,6 +44,9 @@ #include #include #include +#include +#include + #include #include #include @@ -55,6 +59,7 @@ #include #include #include +#include #include // for msg box parent #include @@ -102,7 +107,8 @@ static QString formatCommand(const QString &binary, const QStringList &args) GitClient::GitClient(GitPlugin* plugin) : m_msgWait(tr("Waiting for data...")), m_plugin(plugin), - m_core(Core::ICore::instance()) + m_core(Core::ICore::instance()), + m_repositoryChangedSignalMapper(0) { if (QSettings *s = m_core->settings()) { m_settings.fromSettings(s); @@ -317,7 +323,8 @@ void GitClient::checkoutBranch(const QString &workingDirectory, const QString &b { QStringList arguments(QLatin1String("checkout")); arguments << branch; - executeGit(workingDirectory, arguments, 0, true); + GitCommand *cmd = executeGit(workingDirectory, arguments, 0, true); + connectRepositoryChanged(workingDirectory, cmd); } void GitClient::checkout(const QString &workingDirectory, const QString &fileName) @@ -341,7 +348,8 @@ void GitClient::hardReset(const QString &workingDirectory, const QString &commit if (!commit.isEmpty()) arguments << commit; - executeGit(workingDirectory, arguments, 0, true); + GitCommand *cmd = executeGit(workingDirectory, arguments, 0, true); + connectRepositoryChanged(workingDirectory, cmd); } void GitClient::addFile(const QString &workingDirectory, const QString &fileName) @@ -500,18 +508,19 @@ GitCommand *GitClient::createCommand(const QString &workingDirectory, } // Execute a single command -void GitClient::executeGit(const QString &workingDirectory, - const QStringList &arguments, - VCSBase::VCSBaseEditor* editor, - bool outputToWindow, - GitCommand::TerminationReportMode tm, - int editorLineNumber) +GitCommand *GitClient::executeGit(const QString &workingDirectory, + const QStringList &arguments, + VCSBase::VCSBaseEditor* editor, + bool outputToWindow, + GitCommand::TerminationReportMode tm, + int editorLineNumber) { VCSBase::VCSBaseOutputWindow::instance()->appendCommand(formatCommand(QLatin1String(Constants::GIT_BINARY), arguments)); GitCommand *command = createCommand(workingDirectory, editor, outputToWindow, editorLineNumber); command->addJob(arguments, m_settings.timeout); command->setTerminationReportMode(tm); command->execute(); + return command; } // Return fixed arguments required to run @@ -903,6 +912,8 @@ void GitClient::revert(const QStringList &files) QString errorMessage; switch (revertI(files, &isDirectory, &errorMessage)) { case RevertOk: + m_plugin->versionControl()->emitFilesChanged(files); + break; case RevertCanceled: break; case RevertUnchanged: { @@ -918,7 +929,8 @@ void GitClient::revert(const QStringList &files) void GitClient::pull(const QString &workingDirectory) { - executeGit(workingDirectory, QStringList(QLatin1String("pull")), 0, true, GitCommand::ReportStderr); + GitCommand *cmd = executeGit(workingDirectory, QStringList(QLatin1String("pull")), 0, true, GitCommand::ReportStderr); + connectRepositoryChanged(workingDirectory, cmd); } void GitClient::push(const QString &workingDirectory) @@ -952,7 +964,8 @@ void GitClient::stashPop(const QString &workingDirectory) { QStringList arguments(QLatin1String("stash")); arguments << QLatin1String("pop"); - executeGit(workingDirectory, arguments, 0, true); + GitCommand *cmd = executeGit(workingDirectory, arguments, 0, true); + connectRepositoryChanged(workingDirectory, cmd); } void GitClient::branchList(const QString &workingDirectory) @@ -1000,3 +1013,16 @@ void GitClient::setSettings(const GitSettings &s) m_binaryPath = m_settings.gitBinaryPath(); } } + +void GitClient::connectRepositoryChanged(const QString & repository, GitCommand *cmd) +{ + // Bind command success termination with repository to changed signal + if (!m_repositoryChangedSignalMapper) { + m_repositoryChangedSignalMapper = new QSignalMapper(this); + connect(m_repositoryChangedSignalMapper, SIGNAL(mapped(QString)), + m_plugin->versionControl(), SIGNAL(repositoryChanged(QString))); + } + m_repositoryChangedSignalMapper->setMapping(cmd, repository); + connect(cmd, SIGNAL(success()), m_repositoryChangedSignalMapper, SLOT(map()), + Qt::QueuedConnection); +} diff --git a/src/plugins/git/gitclient.h b/src/plugins/git/gitclient.h index 341e177f353..76da3120347 100644 --- a/src/plugins/git/gitclient.h +++ b/src/plugins/git/gitclient.h @@ -33,7 +33,6 @@ #include "gitsettings.h" #include "gitcommand.h" -#include #include #include @@ -41,6 +40,7 @@ QT_BEGIN_NAMESPACE class QErrorMessage; +class QSignalMapper; QT_END_NAMESPACE namespace Core { @@ -158,12 +158,12 @@ private: bool outputToWindow = false, int editorLineNumber = -1); - void executeGit(const QString &workingDirectory, - const QStringList &arguments, - VCSBase::VCSBaseEditor* editor = 0, - bool outputToWindow = false, - GitCommand::TerminationReportMode tm = GitCommand::NoReport, - int editorLineNumber = -1); + GitCommand *executeGit(const QString &workingDirectory, + const QStringList &arguments, + VCSBase::VCSBaseEditor* editor = 0, + bool outputToWindow = false, + GitCommand::TerminationReportMode tm = GitCommand::NoReport, + int editorLineNumber = -1); bool synchronousGit(const QString &workingDirectory, const QStringList &arguments, @@ -173,12 +173,14 @@ private: enum RevertResult { RevertOk, RevertUnchanged, RevertCanceled, RevertFailed }; RevertResult revertI(QStringList files, bool *isDirectory, QString *errorMessage); + void connectRepositoryChanged(const QString & repository, GitCommand *cmd); const QString m_msgWait; GitPlugin *m_plugin; Core::ICore *m_core; GitSettings m_settings; QString m_binaryPath; + QSignalMapper *m_repositoryChangedSignalMapper; }; diff --git a/src/plugins/git/gitcommand.cpp b/src/plugins/git/gitcommand.cpp index 3f7a97095e6..ea6c17dab13 100644 --- a/src/plugins/git/gitcommand.cpp +++ b/src/plugins/git/gitcommand.cpp @@ -177,6 +177,8 @@ void GitCommand::run() emit errorText(error); emit finished(ok, m_cookie); + if (ok) + emit success(); // As it is used asynchronously, we need to delete ourselves this->deleteLater(); } diff --git a/src/plugins/git/gitcommand.h b/src/plugins/git/gitcommand.h index 7acf167750f..8f1c5aad0ec 100644 --- a/src/plugins/git/gitcommand.h +++ b/src/plugins/git/gitcommand.h @@ -73,6 +73,7 @@ Q_SIGNALS: void outputData(const QByteArray&); void errorText(const QString&); void finished(bool ok, const QVariant &cookie); + void success(); private: struct Job { diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index 0af7286ac91..6e442bec7f2 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -142,6 +142,7 @@ GitPlugin::GitPlugin() : m_stashListAction(0), m_branchListAction(0), m_gitClient(0), + m_versionControl(0), m_changeSelectionDialog(0), m_submitActionTriggered(false) { @@ -215,8 +216,8 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage) addAutoReleasedObject(new GitSubmitEditorFactory(&submitParameters)); - GitVersionControl *versionControl = new GitVersionControl(m_gitClient); - addAutoReleasedObject(versionControl); + m_versionControl = new GitVersionControl(m_gitClient); + addAutoReleasedObject(m_versionControl); addAutoReleasedObject(new CloneWizard); addAutoReleasedObject(new Gitorious::Internal::GitoriousCloneWizard); @@ -232,8 +233,8 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage) gitContainer->menu()->setTitle(tr("&Git")); toolsContainer->addMenu(gitContainer); if (QAction *ma = gitContainer->menu()->menuAction()) { - ma->setEnabled(versionControl->isEnabled()); - connect(versionControl, SIGNAL(enabledChanged(bool)), ma, SLOT(setVisible(bool))); + ma->setEnabled(m_versionControl->isEnabled()); + connect(m_versionControl, SIGNAL(enabledChanged(bool)), ma, SLOT(setVisible(bool))); } Core::Command *command; @@ -398,6 +399,11 @@ void GitPlugin::extensionsInitialized() { } +GitVersionControl *GitPlugin::versionControl() const +{ + return m_versionControl; +} + void GitPlugin::submitEditorDiff(const QStringList &unstaged, const QStringList &staged) { m_gitClient->diff(m_submitRepository, QStringList(), unstaged, staged); diff --git a/src/plugins/git/gitplugin.h b/src/plugins/git/gitplugin.h index 4f934a89393..0d6ad7fbdd5 100644 --- a/src/plugins/git/gitplugin.h +++ b/src/plugins/git/gitplugin.h @@ -59,6 +59,7 @@ namespace Git { namespace Internal { class GitPlugin; +class GitVersionControl; class GitClient; class ChangeSelectionDialog; class GitSubmitEditor; @@ -96,6 +97,7 @@ public: void setSettings(const GitSettings &s); GitClient *gitClient() const; + GitVersionControl *versionControl() const; public slots: void updateActions(); @@ -159,6 +161,7 @@ private: QAction *m_branchListAction; GitClient *m_gitClient; + GitVersionControl *m_versionControl; ChangeSelectionDialog *m_changeSelectionDialog; QString m_submitRepository; QStringList m_submitOrigCommitFiles; diff --git a/src/plugins/git/gitversioncontrol.cpp b/src/plugins/git/gitversioncontrol.cpp index 559d296220e..c64a683bea0 100644 --- a/src/plugins/git/gitversioncontrol.cpp +++ b/src/plugins/git/gitversioncontrol.cpp @@ -96,5 +96,10 @@ QString GitVersionControl::findTopLevelForDirectory(const QString &directory) co return GitClient::findRepositoryForDirectory(directory); } +void GitVersionControl::emitFilesChanged(const QStringList &l) +{ + emit filesChanged(l); +} + } // Internal } // Git diff --git a/src/plugins/git/gitversioncontrol.h b/src/plugins/git/gitversioncontrol.h index 72908b0da22..44598000638 100644 --- a/src/plugins/git/gitversioncontrol.h +++ b/src/plugins/git/gitversioncontrol.h @@ -57,6 +57,8 @@ public: virtual bool vcsAdd(const QString &fileName); virtual bool vcsDelete(const QString &filename); + void emitFilesChanged(const QStringList &); + signals: void enabledChanged(bool); diff --git a/src/plugins/perforce/perforceplugin.cpp b/src/plugins/perforce/perforceplugin.cpp index 7039798b094..a80d8f55973 100644 --- a/src/plugins/perforce/perforceplugin.cpp +++ b/src/plugins/perforce/perforceplugin.cpp @@ -454,6 +454,8 @@ void PerforcePlugin::revertCurrentFile() Core::FileChangeBlocker fcb(fileName); fcb.setModifiedReload(true); PerforceResponse result2 = runP4Cmd(QStringList() << QLatin1String("revert") << fileName, QStringList(), CommandToWindow|StdOutToWindow|StdErrToWindow|ErrorToWindow); + if (!result2.error) + m_versionControl->emitFilesChanged(QStringList(fileName)); } void PerforcePlugin::diffCurrentFile() @@ -514,7 +516,10 @@ void PerforcePlugin::updateCheckout(const QStringList &dirs) { QStringList args(QLatin1String("sync")); args.append(dirs); - runP4Cmd(args, QStringList(), CommandToWindow|StdOutToWindow|StdErrToWindow|ErrorToWindow); + const PerforceResponse resp = runP4Cmd(args, QStringList(), CommandToWindow|StdOutToWindow|StdErrToWindow|ErrorToWindow); + if (!dirs.empty()) + foreach(const QString &dir, dirs) + m_versionControl->emitRepositoryChanged(dir); } void PerforcePlugin::printOpenedFileList() diff --git a/src/plugins/perforce/perforceversioncontrol.cpp b/src/plugins/perforce/perforceversioncontrol.cpp index 040692428d8..ad915b2a208 100644 --- a/src/plugins/perforce/perforceversioncontrol.cpp +++ b/src/plugins/perforce/perforceversioncontrol.cpp @@ -94,5 +94,15 @@ QString PerforceVersionControl::findTopLevelForDirectory(const QString &director return m_plugin->findTopLevelForDirectory(directory); } +void PerforceVersionControl::emitRepositoryChanged(const QString &s) +{ + emit repositoryChanged(s); +} + +void PerforceVersionControl::emitFilesChanged(const QStringList &l) +{ + emit filesChanged(l); +} + } // Internal } // Perforce diff --git a/src/plugins/perforce/perforceversioncontrol.h b/src/plugins/perforce/perforceversioncontrol.h index 2992e5518be..dd385061cbc 100644 --- a/src/plugins/perforce/perforceversioncontrol.h +++ b/src/plugins/perforce/perforceversioncontrol.h @@ -56,6 +56,9 @@ public: virtual bool vcsAdd(const QString &fileName); virtual bool vcsDelete(const QString &filename); + void emitRepositoryChanged(const QString &s); + void emitFilesChanged(const QStringList &l); + signals: void enabledChanged(bool); diff --git a/src/plugins/subversion/subversioncontrol.cpp b/src/plugins/subversion/subversioncontrol.cpp index 32ef57e5ecc..ff0e0f1c81e 100644 --- a/src/plugins/subversion/subversioncontrol.cpp +++ b/src/plugins/subversion/subversioncontrol.cpp @@ -96,3 +96,13 @@ QString SubversionControl::findTopLevelForDirectory(const QString &directory) co { return m_plugin->findTopLevelForDirectory(directory); } + +void SubversionControl::emitRepositoryChanged(const QString &s) +{ + emit repositoryChanged(s); +} + +void SubversionControl::emitFilesChanged(const QStringList &l) +{ + emit filesChanged(l); +} diff --git a/src/plugins/subversion/subversioncontrol.h b/src/plugins/subversion/subversioncontrol.h index 42f64ab147e..325cfd10989 100644 --- a/src/plugins/subversion/subversioncontrol.h +++ b/src/plugins/subversion/subversioncontrol.h @@ -56,6 +56,9 @@ public: virtual bool vcsAdd(const QString &fileName); virtual bool vcsDelete(const QString &filename); + void emitRepositoryChanged(const QString &); + void emitFilesChanged(const QStringList &); + signals: void enabledChanged(bool); diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp index 676ffc2b8ad..0060e023953 100644 --- a/src/plugins/subversion/subversionplugin.cpp +++ b/src/plugins/subversion/subversionplugin.cpp @@ -574,6 +574,7 @@ void SubversionPlugin::revertCurrentFile() const SubversionResponse revertResponse = runSvn(args, subversionShortTimeOut, true); if (!revertResponse.error) { fcb.setModifiedReload(true); + m_versionControl->emitFilesChanged(QStringList(file)); } } @@ -750,7 +751,10 @@ void SubversionPlugin::updateProject() QStringList args(QLatin1String("update")); args.push_back(QLatin1String(nonInteractiveOptionC)); args.append(topLevels); - runSvn(args, subversionLongTimeOut, true); + const SubversionResponse response = runSvn(args, subversionLongTimeOut, true); + if (!response.error) + foreach(const QString &repo, topLevels) + m_versionControl->emitRepositoryChanged(repo); } void SubversionPlugin::annotateCurrentFile() diff --git a/src/plugins/subversion/subversionplugin.h b/src/plugins/subversion/subversionplugin.h index 1dcfce68032..6e3dab7e5d3 100644 --- a/src/plugins/subversion/subversionplugin.h +++ b/src/plugins/subversion/subversionplugin.h @@ -56,6 +56,7 @@ namespace Subversion { namespace Internal { class SubversionSubmitEditor; +class SubversionControl; struct SubversionResponse { @@ -131,7 +132,7 @@ private: const QStringList m_svnDirectories; SubversionSettings m_settings; - Core::IVersionControl *m_versionControl; + SubversionControl *m_versionControl; QString m_commitMessageFileName; ProjectExplorer::ProjectExplorerPlugin *m_projectExplorer;