Merge remote-tracking branch 'origin/2.8'

Conflicts:
	src/plugins/fakevim/fakevimhandler.cpp

Change-Id: I8101f18b87859924644471817d4f1408790d5628
This commit is contained in:
Eike Ziller
2013-06-25 10:14:14 +02:00
376 changed files with 3762 additions and 2070 deletions

View File

@@ -163,7 +163,8 @@ BuiltinIndexingSupport::BuiltinIndexingSupport()
BuiltinIndexingSupport::~BuiltinIndexingSupport()
{}
QFuture<void> BuiltinIndexingSupport::refreshSourceFiles(const QStringList &sourceFiles)
QFuture<void> BuiltinIndexingSupport::refreshSourceFiles(const QStringList &sourceFiles,
CppModelManagerInterface::ProgressNotificationMode mode)
{
CppModelManager *mgr = CppModelManager::instance();
const WorkingCopy workingCopy = mgr->workingCopy();
@@ -189,7 +190,7 @@ QFuture<void> BuiltinIndexingSupport::refreshSourceFiles(const QStringList &sour
m_synchronizer.addFuture(result);
if (sourceFiles.count() > 1) {
if (mode == CppModelManagerInterface::ForcedProgressNotification || sourceFiles.count() > 1) {
Core::ICore::progressManager()->addTask(result,
QCoreApplication::translate("CppTools::Internal::BuiltinIndexingSupport", "Parsing"),
QLatin1String(CppTools::Constants::TASK_INDEX));

View File

@@ -46,8 +46,10 @@ public:
BuiltinIndexingSupport();
~BuiltinIndexingSupport();
virtual QFuture<void> refreshSourceFiles(const QStringList &sourceFiles);
virtual SymbolSearcher *createSymbolSearcher(SymbolSearcher::Parameters parameters, QSet<QString> fileNames);
virtual QFuture<void> refreshSourceFiles(const QStringList &sourceFiles,
CppModelManagerInterface::ProgressNotificationMode mode);
virtual SymbolSearcher *createSymbolSearcher(SymbolSearcher::Parameters parameters,
QSet<QString> fileNames);
private:
QFutureSynchronizer<void> m_synchronizer;

View File

@@ -32,6 +32,8 @@
#include "cpptools_global.h"
#include "cppmodelmanagerinterface.h"
#include <find/searchresultwindow.h>
#include <find/textfindconstants.h>
@@ -80,8 +82,10 @@ class CPPTOOLS_EXPORT CppIndexingSupport
public:
virtual ~CppIndexingSupport() = 0;
virtual QFuture<void> refreshSourceFiles(const QStringList &sourceFiles) = 0;
virtual SymbolSearcher *createSymbolSearcher(SymbolSearcher::Parameters parameters, QSet<QString> fileNames) = 0;
virtual QFuture<void> refreshSourceFiles(const QStringList &sourceFiles,
CppModelManagerInterface::ProgressNotificationMode mode) = 0;
virtual SymbolSearcher *createSymbolSearcher(SymbolSearcher::Parameters parameters,
QSet<QString> fileNames) = 0;
};
} // namespace CppTools

View File

@@ -194,8 +194,8 @@ void CppModelManager::updateModifiedSourceFiles()
/*!
\class CppTools::CppModelManager
\brief The CppModelManager keeps track of one CppCodeModel instance
for each project and all related CppCodeModelPart instances.
\brief The CppModelManager class keeps track of one CppCodeModel instance
for each project and all the related CppCodeModelPart instances.
It also takes care of updating the code models when C++ files are
modified within Qt Creator.
@@ -512,7 +512,7 @@ CppModelManager::WorkingCopy CppModelManager::buildWorkingCopyList()
// add the project configuration file
QByteArray conf(pp_configuration);
conf += definedMacros();
workingCopy.insert(configurationFileName(), QString::fromUtf8(conf));
workingCopy.insert(configurationFileName(), QString::fromLocal8Bit(conf));
return workingCopy;
}
@@ -522,14 +522,15 @@ CppModelManager::WorkingCopy CppModelManager::workingCopy() const
return const_cast<CppModelManager *>(this)->buildWorkingCopyList();
}
QFuture<void> CppModelManager::updateSourceFiles(const QStringList &sourceFiles)
QFuture<void> CppModelManager::updateSourceFiles(const QStringList &sourceFiles,
ProgressNotificationMode mode)
{
if (sourceFiles.isEmpty() || !m_indexerEnabled)
return QFuture<void>();
if (m_indexingSupporter)
m_indexingSupporter->refreshSourceFiles(sourceFiles);
return m_internalIndexingSupport->refreshSourceFiles(sourceFiles);
m_indexingSupporter->refreshSourceFiles(sourceFiles, mode);
return m_internalIndexingSupport->refreshSourceFiles(sourceFiles, mode);
}
QList<CppModelManager::ProjectInfo> CppModelManager::projectInfos() const

View File

@@ -67,7 +67,8 @@ public:
static CppModelManager *instance();
virtual QFuture<void> updateSourceFiles(const QStringList &sourceFiles);
virtual QFuture<void> updateSourceFiles(const QStringList &sourceFiles,
ProgressNotificationMode mode = ReservedProgressNotification);
virtual WorkingCopy workingCopy() const;
virtual QList<ProjectInfo> projectInfos() const;

View File

@@ -35,6 +35,20 @@
#include <QtCore/QSet>
/*!
\enum CppTools::CppModelManagerInterface::ProgressNotificationMode
This enum type specifies whether a progress bar notification should be
shown if more than one file is requested to update via
CppModelManagerInterface::updateSourceFiles().
\value ForcedProgressNotification
Notify regardless of the number of files requested for update.
\value ReservedProgressNotification
Notify only if more than one file is requested for update.
*/
/*!
\enum CppTools::CppModelManagerInterface::QtVersion
Allows C++ parser engine to inject headers or change inner settings as

View File

@@ -117,6 +117,12 @@ class CPPTOOLS_EXPORT CppModelManagerInterface : public QObject
public:
// Documented in source file.
enum ProgressNotificationMode {
ForcedProgressNotification,
ReservedProgressNotification
};
class CPPTOOLS_EXPORT ProjectInfo
{
public:
@@ -212,6 +218,8 @@ public:
virtual void updateProjectInfo(const ProjectInfo &pinfo) = 0;
virtual QList<ProjectPart::Ptr> projectPart(const QString &fileName) const = 0;
virtual QStringList includePaths() = 0;
virtual void addEditorSupport(CppTools::AbstractEditorSupport *editorSupport) = 0;
virtual void removeEditorSupport(CppTools::AbstractEditorSupport *editorSupport) = 0;
virtual CppEditorSupport *cppEditorSupport(TextEditor::BaseTextEditor *editor) = 0;
@@ -249,8 +257,10 @@ Q_SIGNALS:
void projectPartsUpdated(ProjectExplorer::Project *project);
public Q_SLOTS:
virtual void updateModifiedSourceFiles() = 0;
virtual QFuture<void> updateSourceFiles(const QStringList &sourceFiles) = 0;
virtual QFuture<void> updateSourceFiles(const QStringList &sourceFiles,
ProgressNotificationMode mode = ReservedProgressNotification) = 0;
virtual void GC() = 0;
};

View File

@@ -46,7 +46,8 @@ typedef Utils::ChangeSet::Range Range;
/*!
\class CppTools::PointerDeclarationFormatter
\brief Rewrite pointer or reference declarations accordingly to an Overview.
\brief The PointerDeclarationFormatter class rewrites pointer or reference
declarations to an Overview.
The following constructs are supported:
\list

View File

@@ -33,6 +33,7 @@
#include <coreplugin/editormanager/editormanager.h>
#include <utils/qtcassert.h>
#include <utils/runextensions.h>
#include <QList>
@@ -113,12 +114,19 @@ CppEditorSupport::CppEditorSupport(CppModelManager *modelManager, BaseTextEditor
, m_updateDocumentInterval(UpdateDocumentDefaultInterval)
, m_revision(0)
, m_cachedContentsEditorRevision(-1)
, m_fileIsBeingReloaded(false)
, m_initialized(false)
, m_lastHighlightRevision(0)
, m_highlightingSupport(modelManager->highlightingSupport(textEditor))
{
connect(m_modelManager, SIGNAL(documentUpdated(CPlusPlus::Document::Ptr)),
this, SLOT(onDocumentUpdated(CPlusPlus::Document::Ptr)));
if (m_highlightingSupport && m_highlightingSupport->requiresSemanticInfo()) {
connect(this, SIGNAL(semanticInfoUpdated(CppTools::SemanticInfo)),
this, SLOT(startHighlighting()));
}
m_updateDocumentTimer = new QTimer(this);
m_updateDocumentTimer->setSingleShot(true);
m_updateDocumentTimer->setInterval(m_updateDocumentInterval);
@@ -135,6 +143,13 @@ CppEditorSupport::CppEditorSupport(CppModelManager *modelManager, BaseTextEditor
connect(m_textEditor->document(), SIGNAL(mimeTypeChanged()),
this, SLOT(onMimeTypeChanged()));
connect(m_textEditor->document(), SIGNAL(aboutToReload()),
this, SLOT(onAboutToReload()));
connect(m_textEditor->document(), SIGNAL(reloadFinished(bool)),
this, SLOT(onReloadFinished()));
updateDocument();
}
CppEditorSupport::~CppEditorSupport()
@@ -154,7 +169,7 @@ QString CppEditorSupport::fileName() const
QString CppEditorSupport::contents() const
{
const int editorRev = editorRevision();
if (m_cachedContentsEditorRevision != editorRev) {
if (m_cachedContentsEditorRevision != editorRev && !m_fileIsBeingReloaded) {
m_cachedContentsEditorRevision = editorRev;
m_cachedContents = m_textEditor->textDocument()->contents();
}
@@ -225,9 +240,11 @@ void CppEditorSupport::updateDocumentNow()
} else {
m_updateDocumentTimer->stop();
if (m_highlightingSupport && !m_highlightingSupport->requiresSemanticInfo()) {
if (m_fileIsBeingReloaded)
return;
if (m_highlightingSupport && !m_highlightingSupport->requiresSemanticInfo())
startHighlighting();
}
const QStringList sourceFiles(m_textEditor->document()->fileName());
m_documentParser = m_modelManager->updateSourceFiles(sourceFiles);
@@ -497,3 +514,16 @@ void CppEditorSupport::onMimeTypeChanged()
updateDocumentNow();
}
void CppEditorSupport::onAboutToReload()
{
QTC_CHECK(!m_fileIsBeingReloaded);
m_fileIsBeingReloaded = true;
}
void CppEditorSupport::onReloadFinished()
{
QTC_CHECK(m_fileIsBeingReloaded);
m_fileIsBeingReloaded = false;
updateDocument();
}

View File

@@ -121,6 +121,9 @@ signals:
private slots:
void onMimeTypeChanged();
void onAboutToReload();
void onReloadFinished();
void updateDocument();
void updateDocumentNow();
@@ -166,6 +169,7 @@ private:
// content caching
mutable QString m_cachedContents;
mutable int m_cachedContentsEditorRevision;
bool m_fileIsBeingReloaded;
QTimer *m_updateEditorTimer;
EditorUpdates m_editorUpdates;

View File

@@ -139,9 +139,12 @@ bool SearchSymbols::visit(Namespace *symbol)
bool SearchSymbols::visit(Declaration *symbol)
{
if (!(symbolsToSearchFor & SymbolSearcher::Declarations)) {
// if we're searching for functions, still allow function declarations to show up.
// if we're searching for functions, still allow signal declarations to show up.
if (symbolsToSearchFor & SymbolSearcher::Functions) {
if (!symbol->type()->asFunctionType())
Function *funTy = symbol->type()->asFunctionType();
if (!funTy)
return false;
if (!funTy->isSignal())
return false;
} else {
return false;