diff options
Diffstat (limited to 'src')
74 files changed, 649 insertions, 483 deletions
diff --git a/src/libs/cplusplus/CppDocument.cpp b/src/libs/cplusplus/CppDocument.cpp index ab8ef268bb..bd86eecaae 100644 --- a/src/libs/cplusplus/CppDocument.cpp +++ b/src/libs/cplusplus/CppDocument.cpp @@ -42,6 +42,7 @@ #include <QtCore/QByteArray> #include <QtCore/QBitArray> +#include <QtCore/QDir> #include <QtCore/QtDebug> /*! @@ -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<QString, Document::Ptr>::value(QDir::cleanPath(fileName)); +} diff --git a/src/libs/cplusplus/CppDocument.h b/src/libs/cplusplus/CppDocument.h index 596bee794b..0f879b872d 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 8fe7762758..8d50162501 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/libs/utils/codegeneration.cpp b/src/libs/utils/codegeneration.cpp index c0b1a64356..f5975fe0fb 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 5c8fc746ce..6f0ec6c7e1 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/libs/utils/stylehelper.cpp b/src/libs/utils/stylehelper.cpp index 3087894c8d..3236d74821 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)); +} + +void StyleHelper::verticalGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect) +{ + 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); + } - if (StyleHelper::usePixmapCache() && !QPixmapCache::find(key, pixmap)) { painter->drawPixmap(clipRect.topLeft(), pixmap); - p->end(); - delete p; - QPixmapCache::insert(key, pixmap); + } else { + verticalGradientHelper(painter, spanRect, clipRect); } - } -void StyleHelper::horizontalGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect) +static void horizontalGradientHelper(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(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)) { - painter->drawPixmap(clipRect.topLeft(), pixmap); - p->end(); - delete p; - QPixmapCache::insert(key, pixmap); - } } -void StyleHelper::menuGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect) +void StyleHelper::horizontalGradient(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_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); + + } else { + horizontalGradientHelper(painter, spanRect, clipRect); } +} +static void menuGradientHelper(QPainter *p, const QRect &spanRect, const QRect &rect) +{ QLinearGradient grad(spanRect.topLeft(), spanRect.bottomLeft()); - QColor menuColor = mergedColors(StyleHelper::baseColor(), QColor(244, 244, 244), 25); + 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) +{ + 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()); + + 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); } } diff --git a/src/plugins/coreplugin/editormanager/editorview.cpp b/src/plugins/coreplugin/editormanager/editorview.cpp index 743d2f728e..93e59ff159 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()); diff --git a/src/plugins/coreplugin/iversioncontrol.h b/src/plugins/coreplugin/iversioncontrol.h index 8cbd8240b3..edaab39fbd 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 282b2bf681..e7b8e7fa54 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 33c7e484a0..e07ba2ff12 100644 --- a/src/plugins/coreplugin/vcsmanager.cpp +++ b/src/plugins/coreplugin/vcsmanager.cpp @@ -57,7 +57,8 @@ struct VCSManagerPrivate { QMap<QString, IVersionControl *> 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 fa94efc618..772243dd95 100644 --- a/src/plugins/coreplugin/vcsmanager.h +++ b/src/plugins/coreplugin/vcsmanager.h @@ -33,6 +33,7 @@ #include "core_global.h" #include <QtCore/QString> +#include <QtCore/QObject> 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 356f711ba9..85d0202125 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 f98fb68087..a4476d6d90 100644 --- a/src/plugins/cppeditor/cppplugin.cpp +++ b/src/plugins/cppeditor/cppplugin.cpp @@ -52,6 +52,7 @@ #include <texteditor/texteditorsettings.h> #include <texteditor/texteditorconstants.h> #include <cpptools/cpptoolsconstants.h> +#include <cpptools/cppmodelmanagerinterface.h> #include <QtCore/QFileInfo> #include <QtCore/QSettings> @@ -108,11 +109,26 @@ QStringList CppEditorFactory::mimeTypes() const ///////////////////////////////// CppPlugin ////////////////////////////////// +static inline + Core::Command *createSeparator(Core::ActionManager *am, + QObject *parent, + const QList<int> &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<int> 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 3456bd9baf..25687c300e 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/cppfindreferences.cpp b/src/plugins/cpptools/cppfindreferences.cpp index 72677abf6e..6d1c527bac 100644 --- a/src/plugins/cpptools/cppfindreferences.cpp +++ b/src/plugins/cpptools/cppfindreferences.cpp @@ -110,7 +110,6 @@ static void find_helper(QFutureInterface<Usage> &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<Usage> &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<QString, QString> wl = _modelManager->workingCopy(); Core::ProgressManager *progressManager = Core::ICore::instance()->progressManager(); - QFuture<Usage> 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 5adc395870..38c4e61c8a 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); @@ -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/cpptools/cpptoolsplugin.cpp b/src/plugins/cpptools/cpptoolsplugin.cpp index bbc894390c..d321b7c39b 100644 --- a/src/plugins/cpptools/cpptoolsplugin.cpp +++ b/src/plugins/cpptools/cpptoolsplugin.cpp @@ -47,6 +47,7 @@ #include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/editormanager/editormanager.h> #include <coreplugin/progressmanager/progressmanager.h> +#include <coreplugin/vcsmanager.h> #include <cppeditor/cppeditorconstants.h> #include <QtCore/QtConcurrentRun> @@ -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 51edeec5a6..1689f22052 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 52067ad370..c6adb7ffa9 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 654fce42bb..0fa8619e27 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 c0f63473b2..a1515cfc93 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/debugger/cdb/cdbdebugengine.cpp b/src/plugins/debugger/cdb/cdbdebugengine.cpp index 6c307af0c5..08c552dab8 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<StackFrame> 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 c96a020596..077faf4e14 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); diff --git a/src/plugins/debugger/debuggeractions.cpp b/src/plugins/debugger/debuggeractions.cpp index 4a0b0f783e..52a483d952 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/debuggermanager.h b/src/plugins/debugger/debuggermanager.h index d78c00bef5..bcc21ba4b8 100644 --- a/src/plugins/debugger/debuggermanager.h +++ b/src/plugins/debugger/debuggermanager.h @@ -121,6 +121,7 @@ public: QString debuggerCommand; int toolChainType; QString remoteDumperLib; + QString qtInstallPath; QString dumperLibrary; QStringList dumperLibraryLocations; diff --git a/src/plugins/debugger/debuggerrunner.cpp b/src/plugins/debugger/debuggerrunner.cpp index a924791f16..796684a5ad 100644 --- a/src/plugins/debugger/debuggerrunner.cpp +++ b/src/plugins/debugger/debuggerrunner.cpp @@ -31,6 +31,7 @@ #include "debuggermanager.h" +#include <projectexplorer/debugginghelper.h> #include <projectexplorer/environment.h> #include <projectexplorer/project.h> #include <projectexplorer/projectexplorerconstants.h> @@ -139,6 +140,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(); + } + } DebuggerRunControl::DebuggerRunControl(DebuggerManager *manager, const DebuggerStartParametersPtr &startParameters) diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index b3328cb6a1..1665061aad 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(); @@ -425,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") { @@ -1157,42 +1161,52 @@ 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) { - continueInferiorInternal(); - return; + // 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; } - // We are past the initial stops. No need to waste time on further checks. - m_entryPoint.clear(); } -#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); +#ifdef Q_OS_LINUX + if (!m_entryPoint.isEmpty()) { + GdbMi frameData = data.findChild("frame"); + if (frameData.findChild("addr").data() == m_entryPoint) { + // 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(); - showStatusMessage(tr("Loading %1...").arg(dataStr)); return; } - // fall through + // We are past the initial stop(s). No need to waste time on further checks. + m_entryPoint.clear(); } #endif @@ -1270,11 +1284,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.")); @@ -1292,8 +1301,8 @@ void GdbEngine::handleStop1(const GdbMi &data) "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>") - .arg(name.isEmpty() ? tr(" <Unknown> ") : _(name)) - .arg(meaning.isEmpty() ? tr(" <Unknown> ") : _(meaning)); + .arg(name.isEmpty() ? tr(" <Unknown> ", "name") : _(name)) + .arg(meaning.isEmpty() ? tr(" <Unknown> ", "meaning") : _(meaning)); showMessageBox(QMessageBox::Information, tr("Signal received"), msg); } @@ -1337,6 +1346,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(); @@ -1399,7 +1420,6 @@ void GdbEngine::handleExecContinue(const GdbResponse &response) } else { if (state() == InferiorRunningRequested_Kill) { setState(InferiorStopped); - m_commandsToRunOnTemporaryBreak.clear(); shutdown(); return; } @@ -1416,7 +1436,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(); } } @@ -1461,6 +1480,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); @@ -1470,6 +1490,7 @@ void GdbEngine::shutdown() case InferiorRunning: case InferiorStopping: case InferiorStopped: + m_commandsToRunOnTemporaryBreak.clear(); postCommand(_(m_gdbAdapter->inferiorShutdownCommand()), NeedsStop | LosesChild, CB(handleInferiorShutdown)); break; @@ -1478,6 +1499,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; @@ -1510,6 +1532,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())); @@ -2238,6 +2261,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) @@ -2278,7 +2303,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("<unknown>"); + module.endAddress = tr("<unknown>", "address"); modules.append(module); } } @@ -2306,6 +2331,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")); } @@ -4450,6 +4477,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(); diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h index aafe05b96e..dc1acf68fc 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 9f0d4c0e83..fbcf96c860 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 21545212af..2a60a86643 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; }; diff --git a/src/plugins/debugger/gdb/trkgdbadapter.cpp b/src/plugins/debugger/gdb/trkgdbadapter.cpp index dcbe2851ee..3eab98ab2e 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 diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index 6606776f0e..c8cf6b9082 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; @@ -660,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) @@ -1947,7 +1954,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 +2507,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? @@ -2591,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()); @@ -2635,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; ) { @@ -2644,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; @@ -2656,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; } @@ -2727,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()); diff --git a/src/plugins/find/searchresulttreeitemdelegate.cpp b/src/plugins/find/searchresulttreeitemdelegate.cpp index 5502069a17..88ac8d0553 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 b711e8c110..3afb91d31d 100644 --- a/src/plugins/find/searchresulttreemodel.cpp +++ b/src/plugins/find/searchresulttreemodel.cpp @@ -33,6 +33,7 @@ #include <QtGui/QApplication> #include <QtGui/QFont> +#include <QtGui/QFontMetrics> #include <QtGui/QColor> #include <QtGui/QPalette> #include <QtCore/QDir> @@ -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<const SearchResultTextRow *>(item); result = data(row, role); @@ -243,7 +252,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 +279,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) { diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 419784887f..486196174a 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 <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/coreconstants.h> @@ -43,6 +44,9 @@ #include <coreplugin/progressmanager/progressmanager.h> #include <coreplugin/uniqueidmanager.h> #include <coreplugin/filemanager.h> +#include <coreplugin/filemanager.h> +#include <coreplugin/iversioncontrol.h> + #include <texteditor/itexteditor.h> #include <utils/qtcassert.h> #include <vcsbase/vcsbaseeditor.h> @@ -55,6 +59,7 @@ #include <QtCore/QTime> #include <QtCore/QFileInfo> #include <QtCore/QDir> +#include <QtCore/QSignalMapper> #include <QtGui/QMainWindow> // for msg box parent #include <QtGui/QMessageBox> @@ -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 341e177f35..76da312034 100644 --- a/src/plugins/git/gitclient.h +++ b/src/plugins/git/gitclient.h @@ -33,7 +33,6 @@ #include "gitsettings.h" #include "gitcommand.h" -#include <coreplugin/iversioncontrol.h> #include <coreplugin/editormanager/ieditor.h> #include <QtCore/QString> @@ -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 3f7a97095e..ea6c17dab1 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 7acf167750..8f1c5aad0e 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 7b51b39fbf..6e442bec7f 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); @@ -753,6 +759,7 @@ void GitPlugin::updateActions() m_statusProjectAction->setEnabled(false); m_logProjectAction->setParameter(repository); m_logProjectAction->setEnabled(false); + m_undoProjectAction->setEnabled(false); return; } @@ -772,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() diff --git a/src/plugins/git/gitplugin.h b/src/plugins/git/gitplugin.h index 4f934a8939..0d6ad7fbdd 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 559d296220..c64a683bea 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 72908b0da2..4459800063 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 7039798b09..a80d8f5597 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 040692428d..ad915b2a20 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 2992e5518b..dd385061cb 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/projectexplorer/runconfiguration.cpp b/src/plugins/projectexplorer/runconfiguration.cpp index 6aa8ea34de..d99907bea5 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()); } diff --git a/src/plugins/qmleditor/qmleditor.cpp b/src/plugins/qmleditor/qmleditor.cpp index e82d9319d5..2819b87f68 100644 --- a/src/plugins/qmleditor/qmleditor.cpp +++ b/src/plugins/qmleditor/qmleditor.cpp @@ -762,7 +762,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(); @@ -778,6 +778,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 e0bfedc94d..078e88a719 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(m_modelManager); addAutoReleasedObject(m_completion); diff --git a/src/plugins/qt4projectmanager/qt-s60/gccetoolchain.cpp b/src/plugins/qt4projectmanager/qt-s60/gccetoolchain.cpp index 3c467bb1cb..ab4bb0df8d 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<HeaderPath> 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 53cd0515c5..84d30909dc 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<ProjectExplorer::HeaderPath> 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 f12c509f82..46524f72d3 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 572f1c76fb..0d9b27cf8a 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 <QtCore/QByteArray> +#include <QtCore/QString> #include <QtDebug> 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<HeaderPath> WINSCWToolChain::systemHeaderPaths() @@ -67,10 +68,8 @@ QList<HeaderPath> 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 c37faaaf03..54f25cba48 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<ProjectExplorer::HeaderPath> m_systemHeaderPaths; }; diff --git a/src/plugins/qt4projectmanager/qt4runconfiguration.cpp b/src/plugins/qt4projectmanager/qt4runconfiguration.cpp index ff9f17efae..bcfd15cf37 100644 --- a/src/plugins/qt4projectmanager/qt4runconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt4runconfiguration.cpp @@ -110,6 +110,8 @@ bool Qt4RunConfiguration::isEnabled(ProjectExplorer::BuildConfiguration *configu if (type == ProjectExplorer::ToolChain::GCC_MAEMO) return false; #endif +#else + Q_UNUSED(configuration); #endif return true; } diff --git a/src/plugins/qt4projectmanager/qtoptionspage.cpp b/src/plugins/qt4projectmanager/qtoptionspage.cpp index 297ee85962..50fe634a87 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 d3090e481f..a03f7f0bec 100644 --- a/src/plugins/qt4projectmanager/qtversionmanager.cpp +++ b/src/plugins/qt4projectmanager/qtversionmanager.cpp @@ -128,11 +128,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(); @@ -266,11 +264,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(); } @@ -1219,7 +1215,6 @@ void QtVersion::updateToolChainAndMkspec() const m_toolChainUpToDate = true; } -#ifdef QTCREATOR_WITH_S60 QString QtVersion::mwcDirectory() const { return m_mwcDirectory; @@ -1248,7 +1243,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 07e97d3f28..bbcdb51484 100644 --- a/src/plugins/qt4projectmanager/qtversionmanager.h +++ b/src/plugins/qt4projectmanager/qtversionmanager.h @@ -92,14 +92,13 @@ public: // Returns the PREFIX, BINPREFIX, DOCPREFIX and similar information QHash<QString,QString> 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; @@ -153,11 +152,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_toolChainUpToDate; mutable QString m_mkspec; // updated lazily diff --git a/src/plugins/qt4projectmanager/wizards/qtprojectparameters.cpp b/src/plugins/qt4projectmanager/wizards/qtprojectparameters.cpp index 0cfbb7dcaa..a658a6bc22 100644 --- a/src/plugins/qt4projectmanager/wizards/qtprojectparameters.cpp +++ b/src/plugins/qt4projectmanager/wizards/qtprojectparameters.cpp @@ -28,6 +28,7 @@ **************************************************************************/ #include "qtprojectparameters.h" +#include <utils/codegeneration.h> #include <QtCore/QTextStream> #include <QtCore/QDir> @@ -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) diff --git a/src/plugins/qtscripteditor/qtscripteditor.cpp b/src/plugins/qtscripteditor/qtscripteditor.cpp index 403571b14c..d751a87d39 100644 --- a/src/plugins/qtscripteditor/qtscripteditor.cpp +++ b/src/plugins/qtscripteditor/qtscripteditor.cpp @@ -40,6 +40,7 @@ #include "parser/javascriptast_p.h" #include <indenter.h> +#include <utils/uncommentselection.h> #include <coreplugin/icore.h> #include <coreplugin/actionmanager/actionmanager.h> @@ -395,7 +396,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,9 +404,15 @@ void ScriptEditor::contextMenuEvent(QContextMenuEvent *e) menu->addAction(action); } + appendStandardContextMenuActions(menu); menu->exec(e->globalPos()); 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 06e72371bd..6556176a35 100644 --- a/src/plugins/qtscripteditor/qtscripteditor.h +++ b/src/plugins/qtscripteditor/qtscripteditor.h @@ -95,6 +95,8 @@ public: QList<Declaration> 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 7fd3ff19c6..2ff0c5699e 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 b00ac381eb..0000000000 --- a/src/plugins/qtscripteditor/qtscripteditoractionhandler.cpp +++ /dev/null @@ -1,100 +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 <coreplugin/icore.h> -#include <coreplugin/actionmanager/actionmanager.h> -#include <coreplugin/scriptmanager/scriptmanager.h> - -#include <QtCore/QDebug> -#include <QtGui/QAction> -#include <QtGui/QMainWindow> -#include <QtGui/QMessageBox> - -static QAction *actionFromId(const QString &id) -{ - Core::Command *cmd = Core::ICore::instance()->actionManager()->command(id); - if (!cmd) - return 0; - return cmd->action(); -} - -namespace QtScriptEditor { -namespace Internal { - -QtScriptEditorActionHandler::QtScriptEditorActionHandler() - : TextEditor::TextEditorActionHandler(QLatin1String(QtScriptEditor::Constants::C_QTSCRIPTEDITOR), - Format), - m_runAction(0) -{ -} - -void QtScriptEditorActionHandler::createActions() -{ - TextEditor::TextEditorActionHandler::createActions(); - m_runAction = actionFromId(QLatin1String(QtScriptEditor::Constants::RUN)); - connect(m_runAction, SIGNAL(triggered()), this, SLOT(run())); -} - - -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 3272a77c2f..0000000000 --- a/src/plugins/qtscripteditor/qtscripteditoractionhandler.h +++ /dev/null @@ -1,58 +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 <texteditor/texteditoractionhandler.h> - -namespace QtScriptEditor { -namespace Internal { - -class QtScriptEditorActionHandler : public TextEditor::TextEditorActionHandler -{ - Q_OBJECT - -public: - QtScriptEditorActionHandler(); - -private: - virtual void createActions(); - -private slots: - void run(); - -private: - QAction *m_runAction; -}; - -} // namespace Internal -} // namespace QtScriptEditor - -#endif // QTSCRIPTDITORACTIONHANDLER_H diff --git a/src/plugins/qtscripteditor/qtscripteditorconstants.h b/src/plugins/qtscripteditor/qtscripteditorconstants.h index 401697a814..0c7704ba0d 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/qtscripteditorfactory.cpp b/src/plugins/qtscripteditor/qtscripteditorfactory.cpp index 03cf1b9844..7e4ae5715b 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 <coreplugin/icore.h> #include <coreplugin/editormanager/editormanager.h> +#include <coreplugin/actionmanager/actionmanager.h> + +#include <texteditor/texteditorconstants.h> #include <QtCore/QFileInfo> #include <QtCore/QDebug> @@ -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 93c222daa9..0556f35f16 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 c3c06b7280..266d2d4820 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,18 +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); - - 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); + 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) diff --git a/src/plugins/subversion/subversioncontrol.cpp b/src/plugins/subversion/subversioncontrol.cpp index 32ef57e5ec..ff0e0f1c81 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 42f64ab147..325cfd1098 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 676ffc2b8a..0060e02395 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 1dcfce6803..6e3dab7e5d 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; diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index cd406907e0..278ea7f0f2 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) { @@ -3411,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()); @@ -4654,6 +4668,7 @@ void BaseTextEditor::insertFromMimeData(const QMimeData *source) } cursor.beginEditBlock(); + cursor.removeSelectedText(); bool insertAtBeginningOfLine = ts.cursorIsAtBeginningOfLine(cursor); @@ -4664,8 +4679,6 @@ void BaseTextEditor::insertFromMimeData(const QMimeData *source) return; } - cursor.removeSelectedText(); - int reindentBlockStart = cursor.blockNumber() + (insertAtBeginningOfLine?0:1); bool hasFinalNewline = (text.endsWith(QLatin1Char('\n')) diff --git a/src/tools/qpatch/files-to-patch-windows b/src/tools/qpatch/files-to-patch-windows index 38545a7def..a1fd431f9a 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 b478c02dd9..bf92cb3c1a 100644 --- a/src/tools/qtlibspatcher/qtlibspatchermain.cpp +++ b/src/tools/qtlibspatcher/qtlibspatchermain.cpp @@ -38,7 +38,7 @@ #include <QtCore/QDebug> #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", |