forked from qt-creator/qt-creator
Code model: Update on changes from the versioning system.
Add state logic to CppCodeModelManagerInterface, making it aware whether an indexer is running, protect the update methods from another invocation while running. Add changed signals to IVersionControl and VCSManager and wire them to the update methods. Add a menu action for manually updating. Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com> Reviewed-by: con <qtc-committer@nokia.com>
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user