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;
|
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
|
// TODO: ADD A WAY TO DETECT WHETHER A FILE IS MANAGED, e.g
|
||||||
// virtual bool sccManaged(const QString &filename) = 0;
|
// virtual bool sccManaged(const QString &filename) = 0;
|
||||||
};
|
};
|
||||||
|
@@ -126,7 +126,7 @@ MainWindow::MainWindow() :
|
|||||||
m_progressManager(new ProgressManagerPrivate()),
|
m_progressManager(new ProgressManagerPrivate()),
|
||||||
m_scriptManager(new ScriptManagerPrivate(this)),
|
m_scriptManager(new ScriptManagerPrivate(this)),
|
||||||
m_variableManager(new VariableManager(this)),
|
m_variableManager(new VariableManager(this)),
|
||||||
m_vcsManager(new VCSManager()),
|
m_vcsManager(new VCSManager),
|
||||||
m_viewManager(0),
|
m_viewManager(0),
|
||||||
m_modeManager(0),
|
m_modeManager(0),
|
||||||
m_mimeDatabase(new MimeDatabase),
|
m_mimeDatabase(new MimeDatabase),
|
||||||
@@ -346,6 +346,7 @@ void MainWindow::extensionsInitialized()
|
|||||||
OutputPaneManager::instance()->init();
|
OutputPaneManager::instance()->init();
|
||||||
|
|
||||||
m_actionManager->initialize();
|
m_actionManager->initialize();
|
||||||
|
m_vcsManager->extensionsInitialized();
|
||||||
readSettings();
|
readSettings();
|
||||||
updateContext();
|
updateContext();
|
||||||
|
|
||||||
|
@@ -57,7 +57,8 @@ struct VCSManagerPrivate {
|
|||||||
QMap<QString, IVersionControl *> m_cachedMatches;
|
QMap<QString, IVersionControl *> m_cachedMatches;
|
||||||
};
|
};
|
||||||
|
|
||||||
VCSManager::VCSManager() :
|
VCSManager::VCSManager(QObject *parent) :
|
||||||
|
QObject(parent),
|
||||||
m_d(new VCSManagerPrivate)
|
m_d(new VCSManagerPrivate)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -67,6 +68,17 @@ VCSManager::~VCSManager()
|
|||||||
delete m_d;
|
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)
|
void VCSManager::setVCSEnabled(const QString &directory)
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
|
@@ -33,6 +33,7 @@
|
|||||||
#include "core_global.h"
|
#include "core_global.h"
|
||||||
|
|
||||||
#include <QtCore/QString>
|
#include <QtCore/QString>
|
||||||
|
#include <QtCore/QObject>
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
@@ -49,13 +50,16 @@ class IVersionControl;
|
|||||||
// for the topmost directory it manages. This information is cached and
|
// for the topmost directory it manages. This information is cached and
|
||||||
// VCSManager thus knows pretty fast which IVersionControl * is responsible.
|
// 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)
|
Q_DISABLE_COPY(VCSManager)
|
||||||
public:
|
public:
|
||||||
VCSManager();
|
explicit VCSManager(QObject *parent = 0);
|
||||||
virtual ~VCSManager();
|
virtual ~VCSManager();
|
||||||
|
|
||||||
|
void extensionsInitialized();
|
||||||
|
|
||||||
IVersionControl *findVersionControlForDirectory(const QString &directory);
|
IVersionControl *findVersionControlForDirectory(const QString &directory);
|
||||||
|
|
||||||
// Enable the VCS managing a certain directory only. This should
|
// Enable the VCS managing a certain directory only. This should
|
||||||
@@ -69,6 +73,10 @@ public:
|
|||||||
// if a failure occurs
|
// if a failure occurs
|
||||||
bool showDeleteDialog(const QString &fileName);
|
bool showDeleteDialog(const QString &fileName);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void repositoryChanged(const QString &repository);
|
||||||
|
void filesChanged(const QStringList &files);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VCSManagerPrivate *m_d;
|
VCSManagerPrivate *m_d;
|
||||||
};
|
};
|
||||||
|
@@ -41,8 +41,10 @@ const char * const SWITCH_DECLARATION_DEFINITION = "CppEditor.SwitchDeclarationD
|
|||||||
const char * const RENAME_SYMBOL_UNDER_CURSOR = "CppEditor.RenameSymbolUnderCursor";
|
const char * const RENAME_SYMBOL_UNDER_CURSOR = "CppEditor.RenameSymbolUnderCursor";
|
||||||
const char * const FIND_USAGES = "CppEditor.FindUsages";
|
const char * const FIND_USAGES = "CppEditor.FindUsages";
|
||||||
const char * const SEPARATOR = "CppEditor.Separator";
|
const char * const SEPARATOR = "CppEditor.Separator";
|
||||||
|
const char * const SEPARATOR2 = "CppEditor.Separator2";
|
||||||
const char * const FIND_REFERENCES = "CppEditor.FindReferences";
|
const char * const FIND_REFERENCES = "CppEditor.FindReferences";
|
||||||
const char * const JUMP_TO_DEFINITION = "CppEditor.JumpToDefinition";
|
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 HEADER_FILE_TYPE = "CppHeaderFiles";
|
||||||
const char * const SOURCE_FILE_TYPE = "CppSourceFiles";
|
const char * const SOURCE_FILE_TYPE = "CppSourceFiles";
|
||||||
|
@@ -43,7 +43,7 @@
|
|||||||
#include <coreplugin/actionmanager/actionmanager.h>
|
#include <coreplugin/actionmanager/actionmanager.h>
|
||||||
#include <coreplugin/actionmanager/command.h>
|
#include <coreplugin/actionmanager/command.h>
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/progressmanager/progressmanager.h>
|
#include <cpptools/cppmodelmanagerinterface.h>
|
||||||
#include <texteditor/completionsupport.h>
|
#include <texteditor/completionsupport.h>
|
||||||
#include <texteditor/fontsettings.h>
|
#include <texteditor/fontsettings.h>
|
||||||
#include <texteditor/storagesettings.h>
|
#include <texteditor/storagesettings.h>
|
||||||
@@ -112,7 +112,11 @@ CppPlugin *CppPlugin::m_instance = 0;
|
|||||||
|
|
||||||
CppPlugin::CppPlugin() :
|
CppPlugin::CppPlugin() :
|
||||||
m_actionHandler(0),
|
m_actionHandler(0),
|
||||||
m_sortedMethodOverview(false)
|
m_sortedMethodOverview(false),
|
||||||
|
m_renameSymbolUnderCursorAction(0),
|
||||||
|
m_findUsagesAction(0),
|
||||||
|
m_updateCodeModelAction(0)
|
||||||
|
|
||||||
{
|
{
|
||||||
m_instance = this;
|
m_instance = this;
|
||||||
}
|
}
|
||||||
@@ -158,6 +162,17 @@ bool CppPlugin::sortedMethodOverview() const
|
|||||||
return m_sortedMethodOverview;
|
return m_sortedMethodOverview;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage)
|
bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage)
|
||||||
{
|
{
|
||||||
Core::ICore *core = Core::ICore::instance();
|
Core::ICore *core = Core::ICore::instance();
|
||||||
@@ -192,6 +207,7 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
|
|||||||
Core::ActionContainer *contextMenu= am->createMenu(CppEditor::Constants::M_CONTEXT);
|
Core::ActionContainer *contextMenu= am->createMenu(CppEditor::Constants::M_CONTEXT);
|
||||||
|
|
||||||
Core::Command *cmd;
|
Core::Command *cmd;
|
||||||
|
Core::ActionContainer *cppToolsMenu = am->actionContainer(QLatin1String(CppTools::Constants::M_TOOLS_CPP));
|
||||||
|
|
||||||
QAction *jumpToDefinition = new QAction(tr("Follow Symbol under Cursor"), this);
|
QAction *jumpToDefinition = new QAction(tr("Follow Symbol under Cursor"), this);
|
||||||
cmd = am->registerAction(jumpToDefinition,
|
cmd = am->registerAction(jumpToDefinition,
|
||||||
@@ -200,7 +216,7 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
|
|||||||
connect(jumpToDefinition, SIGNAL(triggered()),
|
connect(jumpToDefinition, SIGNAL(triggered()),
|
||||||
this, SLOT(jumpToDefinition()));
|
this, SLOT(jumpToDefinition()));
|
||||||
contextMenu->addAction(cmd);
|
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);
|
QAction *switchDeclarationDefinition = new QAction(tr("Switch between Method Declaration/Definition"), this);
|
||||||
cmd = am->registerAction(switchDeclarationDefinition,
|
cmd = am->registerAction(switchDeclarationDefinition,
|
||||||
@@ -209,14 +225,14 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
|
|||||||
connect(switchDeclarationDefinition, SIGNAL(triggered()),
|
connect(switchDeclarationDefinition, SIGNAL(triggered()),
|
||||||
this, SLOT(switchDeclarationDefinition()));
|
this, SLOT(switchDeclarationDefinition()));
|
||||||
contextMenu->addAction(cmd);
|
contextMenu->addAction(cmd);
|
||||||
am->actionContainer(CppTools::Constants::M_TOOLS_CPP)->addAction(cmd);
|
cppToolsMenu->addAction(cmd);
|
||||||
|
|
||||||
m_findUsagesAction = new QAction(tr("Find Usages"), this);
|
m_findUsagesAction = new QAction(tr("Find Usages"), this);
|
||||||
cmd = am->registerAction(m_findUsagesAction, Constants::FIND_USAGES, context);
|
cmd = am->registerAction(m_findUsagesAction, Constants::FIND_USAGES, context);
|
||||||
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+U")));
|
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+U")));
|
||||||
connect(m_findUsagesAction, SIGNAL(triggered()), this, SLOT(findUsages()));
|
connect(m_findUsagesAction, SIGNAL(triggered()), this, SLOT(findUsages()));
|
||||||
contextMenu->addAction(cmd);
|
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);
|
m_renameSymbolUnderCursorAction = new QAction(tr("Rename Symbol under Cursor"), this);
|
||||||
cmd = am->registerAction(m_renameSymbolUnderCursorAction,
|
cmd = am->registerAction(m_renameSymbolUnderCursorAction,
|
||||||
@@ -224,7 +240,17 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
|
|||||||
cmd->setDefaultKeySequence(QKeySequence("CTRL+SHIFT+R"));
|
cmd->setDefaultKeySequence(QKeySequence("CTRL+SHIFT+R"));
|
||||||
connect(m_renameSymbolUnderCursorAction, SIGNAL(triggered()), this, SLOT(renameSymbolUnderCursor()));
|
connect(m_renameSymbolUnderCursorAction, SIGNAL(triggered()), this, SLOT(renameSymbolUnderCursor()));
|
||||||
contextMenu->addAction(cmd);
|
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,
|
m_actionHandler = new TextEditor::TextEditorActionHandler(CppEditor::Constants::C_CPPEDITOR,
|
||||||
TextEditor::TextEditorActionHandler::Format
|
TextEditor::TextEditorActionHandler::Format
|
||||||
@@ -233,10 +259,7 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
|
|||||||
|
|
||||||
m_actionHandler->initializeActions();
|
m_actionHandler->initializeActions();
|
||||||
|
|
||||||
QAction *separator = new QAction(this);
|
contextMenu->addAction(createSeparator(am, this, context, CppEditor::Constants::SEPARATOR));
|
||||||
separator->setSeparator(true);
|
|
||||||
cmd = am->registerAction(separator, CppEditor::Constants::SEPARATOR, context);
|
|
||||||
contextMenu->addAction(cmd);
|
|
||||||
|
|
||||||
cmd = am->command(TextEditor::Constants::AUTO_INDENT_SELECTION);
|
cmd = am->command(TextEditor::Constants::AUTO_INDENT_SELECTION);
|
||||||
contextMenu->addAction(cmd);
|
contextMenu->addAction(cmd);
|
||||||
@@ -244,10 +267,8 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
|
|||||||
cmd = am->command(TextEditor::Constants::UN_COMMENT_SELECTION);
|
cmd = am->command(TextEditor::Constants::UN_COMMENT_SELECTION);
|
||||||
contextMenu->addAction(cmd);
|
contextMenu->addAction(cmd);
|
||||||
|
|
||||||
connect(core->progressManager(), SIGNAL(taskStarted(QString)),
|
connect(cppModelManager, SIGNAL(indexingStarted()), this, SLOT(onCppModelIndexingStarted()));
|
||||||
this, SLOT(onTaskStarted(QString)));
|
connect(cppModelManager, SIGNAL(indexingFinished()), this, SLOT(onCppModelIndexingFinished()));
|
||||||
connect(core->progressManager(), SIGNAL(allTasksFinished(QString)),
|
|
||||||
this, SLOT(onAllTasksFinished(QString)));
|
|
||||||
readSettings();
|
readSettings();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -303,20 +324,18 @@ void CppPlugin::findUsages()
|
|||||||
editor->findUsages();
|
editor->findUsages();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CppPlugin::onTaskStarted(const QString &type)
|
void CppPlugin::onCppModelIndexingStarted()
|
||||||
{
|
{
|
||||||
if (type == CppTools::Constants::TASK_INDEX) {
|
m_renameSymbolUnderCursorAction->setEnabled(false);
|
||||||
m_renameSymbolUnderCursorAction->setEnabled(false);
|
m_findUsagesAction->setEnabled(false);
|
||||||
m_findUsagesAction->setEnabled(false);
|
m_updateCodeModelAction->setEnabled(false);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CppPlugin::onAllTasksFinished(const QString &type)
|
void CppPlugin::onCppModelIndexingFinished()
|
||||||
{
|
{
|
||||||
if (type == CppTools::Constants::TASK_INDEX) {
|
m_renameSymbolUnderCursorAction->setEnabled(true);
|
||||||
m_renameSymbolUnderCursorAction->setEnabled(true);
|
m_findUsagesAction->setEnabled(true);
|
||||||
m_findUsagesAction->setEnabled(true);
|
m_updateCodeModelAction->setEnabled(true);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_EXPORT_PLUGIN(CppPlugin)
|
Q_EXPORT_PLUGIN(CppPlugin)
|
||||||
|
@@ -75,8 +75,8 @@ private slots:
|
|||||||
void switchDeclarationDefinition();
|
void switchDeclarationDefinition();
|
||||||
void jumpToDefinition();
|
void jumpToDefinition();
|
||||||
void renameSymbolUnderCursor();
|
void renameSymbolUnderCursor();
|
||||||
void onTaskStarted(const QString &type);
|
void onCppModelIndexingStarted();
|
||||||
void onAllTasksFinished(const QString &type);
|
void onCppModelIndexingFinished();
|
||||||
void findUsages();
|
void findUsages();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -90,6 +90,7 @@ private:
|
|||||||
bool m_sortedMethodOverview;
|
bool m_sortedMethodOverview;
|
||||||
QAction *m_renameSymbolUnderCursorAction;
|
QAction *m_renameSymbolUnderCursorAction;
|
||||||
QAction *m_findUsagesAction;
|
QAction *m_findUsagesAction;
|
||||||
|
QAction *m_updateCodeModelAction;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CppEditorFactory : public Core::IEditorFactory
|
class CppEditorFactory : public Core::IEditorFactory
|
||||||
|
@@ -595,6 +595,8 @@ Document::Ptr CppPreprocessor::switchDocument(Document::Ptr doc)
|
|||||||
|
|
||||||
void CppTools::CppModelManagerInterface::updateModifiedSourceFiles()
|
void CppTools::CppModelManagerInterface::updateModifiedSourceFiles()
|
||||||
{
|
{
|
||||||
|
if (isIndexing())
|
||||||
|
return;
|
||||||
const Snapshot snapshot = this->snapshot();
|
const Snapshot snapshot = this->snapshot();
|
||||||
QStringList sourceFiles;
|
QStringList sourceFiles;
|
||||||
|
|
||||||
@@ -630,7 +632,8 @@ CppTools::CppModelManagerInterface *CppTools::CppModelManagerInterface::instance
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
CppModelManager::CppModelManager(QObject *parent)
|
CppModelManager::CppModelManager(QObject *parent)
|
||||||
: CppModelManagerInterface(parent)
|
: CppModelManagerInterface(parent),
|
||||||
|
m_indexing(false)
|
||||||
{
|
{
|
||||||
m_findReferences = new CppFindReferences(this);
|
m_findReferences = new CppFindReferences(this);
|
||||||
|
|
||||||
@@ -675,6 +678,11 @@ CppModelManager::CppModelManager(QObject *parent)
|
|||||||
|
|
||||||
connect(m_core->editorManager(), SIGNAL(editorAboutToClose(Core::IEditor *)),
|
connect(m_core->editorManager(), SIGNAL(editorAboutToClose(Core::IEditor *)),
|
||||||
this, SLOT(editorAboutToClose(Core::IEditor *)));
|
this, SLOT(editorAboutToClose(Core::IEditor *)));
|
||||||
|
|
||||||
|
connect(m_core->progressManager(), SIGNAL(taskStarted(QString)),
|
||||||
|
this, SLOT(onTaskStarted(QString)));
|
||||||
|
connect(m_core->progressManager(), SIGNAL(allTasksFinished(QString)),
|
||||||
|
this, SLOT(onAllTasksFinished(QString)));
|
||||||
}
|
}
|
||||||
|
|
||||||
CppModelManager::~CppModelManager()
|
CppModelManager::~CppModelManager()
|
||||||
@@ -871,7 +879,7 @@ QStringList CppModelManager::includesInPath(const QString &path) const
|
|||||||
|
|
||||||
QFuture<void> CppModelManager::refreshSourceFiles(const QStringList &sourceFiles)
|
QFuture<void> CppModelManager::refreshSourceFiles(const QStringList &sourceFiles)
|
||||||
{
|
{
|
||||||
if (! sourceFiles.isEmpty() && qgetenv("QTCREATOR_NO_CODE_INDEXER").isNull()) {
|
if (!m_indexing && !sourceFiles.isEmpty() && qgetenv("QTCREATOR_NO_CODE_INDEXER").isNull()) {
|
||||||
const QMap<QString, QString> workingCopy = buildWorkingCopyList();
|
const QMap<QString, QString> workingCopy = buildWorkingCopyList();
|
||||||
|
|
||||||
CppPreprocessor *preproc = new CppPreprocessor(this);
|
CppPreprocessor *preproc = new CppPreprocessor(this);
|
||||||
@@ -897,7 +905,7 @@ QFuture<void> CppModelManager::refreshSourceFiles(const QStringList &sourceFiles
|
|||||||
|
|
||||||
m_synchronizer.addFuture(result);
|
m_synchronizer.addFuture(result);
|
||||||
|
|
||||||
if (sourceFiles.count() > 1) {
|
if (sourceFiles.count() > 1) {
|
||||||
m_core->progressManager()->addTask(result, tr("Indexing"),
|
m_core->progressManager()->addTask(result, tr("Indexing"),
|
||||||
CppTools::Constants::TASK_INDEX,
|
CppTools::Constants::TASK_INDEX,
|
||||||
Core::ProgressManager::CloseOnSuccess);
|
Core::ProgressManager::CloseOnSuccess);
|
||||||
@@ -1391,4 +1399,31 @@ void CppModelManager::GC()
|
|||||||
protectSnapshot.unlock();
|
protectSnapshot.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CppModelManager::isIndexing() const
|
||||||
|
{
|
||||||
|
return m_indexing;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CppModelManager::setIndexing(bool v)
|
||||||
|
{
|
||||||
|
if (m_indexing == v)
|
||||||
|
return;
|
||||||
|
m_indexing = v;
|
||||||
|
if (v) {
|
||||||
|
emit indexingStarted();
|
||||||
|
} else {
|
||||||
|
emit indexingFinished();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CppModelManager::onTaskStarted(const QString &type)
|
||||||
|
{
|
||||||
|
if (type == QLatin1String(CppTools::Constants::TASK_INDEX))
|
||||||
|
setIndexing(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CppModelManager::onAllTasksFinished(const QString &type)
|
||||||
|
{
|
||||||
|
if (type == QLatin1String(CppTools::Constants::TASK_INDEX))
|
||||||
|
setIndexing(false);
|
||||||
|
}
|
||||||
|
@@ -111,6 +111,8 @@ public:
|
|||||||
void setHeaderSuffixes(const QStringList &suffixes)
|
void setHeaderSuffixes(const QStringList &suffixes)
|
||||||
{ m_headerSuffixes = suffixes; }
|
{ m_headerSuffixes = suffixes; }
|
||||||
|
|
||||||
|
virtual bool isIndexing() const;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void projectPathChanged(const QString &projectPath);
|
void projectPathChanged(const QString &projectPath);
|
||||||
|
|
||||||
@@ -129,6 +131,8 @@ private Q_SLOTS:
|
|||||||
void onProjectAdded(ProjectExplorer::Project *project);
|
void onProjectAdded(ProjectExplorer::Project *project);
|
||||||
void postEditorUpdate();
|
void postEditorUpdate();
|
||||||
void updateEditorSelections();
|
void updateEditorSelections();
|
||||||
|
void onTaskStarted(const QString &type);
|
||||||
|
void onAllTasksFinished(const QString &type);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QMap<QString, QString> buildWorkingCopyList();
|
QMap<QString, QString> buildWorkingCopyList();
|
||||||
@@ -175,10 +179,13 @@ private:
|
|||||||
CppPreprocessor *preproc,
|
CppPreprocessor *preproc,
|
||||||
QStringList files);
|
QStringList files);
|
||||||
|
|
||||||
|
void setIndexing(bool);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Core::ICore *m_core;
|
Core::ICore *m_core;
|
||||||
CPlusPlus::Snapshot m_snapshot;
|
CPlusPlus::Snapshot m_snapshot;
|
||||||
|
|
||||||
|
bool m_indexing;
|
||||||
// cache
|
// cache
|
||||||
bool m_dirty;
|
bool m_dirty;
|
||||||
QStringList m_projectFiles;
|
QStringList m_projectFiles;
|
||||||
|
@@ -102,6 +102,12 @@ public:
|
|||||||
virtual void renameUsages(CPlusPlus::Symbol *symbol) = 0;
|
virtual void renameUsages(CPlusPlus::Symbol *symbol) = 0;
|
||||||
virtual void findUsages(CPlusPlus::Symbol *symbol) = 0;
|
virtual void findUsages(CPlusPlus::Symbol *symbol) = 0;
|
||||||
|
|
||||||
|
virtual bool isIndexing() const = 0;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void indexingStarted();
|
||||||
|
void indexingFinished();
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void updateModifiedSourceFiles();
|
void updateModifiedSourceFiles();
|
||||||
virtual void updateSourceFiles(const QStringList &sourceFiles) = 0;
|
virtual void updateSourceFiles(const QStringList &sourceFiles) = 0;
|
||||||
|
@@ -47,6 +47,7 @@
|
|||||||
#include <coreplugin/actionmanager/actionmanager.h>
|
#include <coreplugin/actionmanager/actionmanager.h>
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/progressmanager/progressmanager.h>
|
#include <coreplugin/progressmanager/progressmanager.h>
|
||||||
|
#include <coreplugin/vcsmanager.h>
|
||||||
#include <cppeditor/cppeditorconstants.h>
|
#include <cppeditor/cppeditorconstants.h>
|
||||||
|
|
||||||
#include <QtCore/QtConcurrentRun>
|
#include <QtCore/QtConcurrentRun>
|
||||||
@@ -97,6 +98,11 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error)
|
|||||||
|
|
||||||
// Objects
|
// Objects
|
||||||
m_modelManager = new CppModelManager(this);
|
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);
|
addAutoReleasedObject(m_modelManager);
|
||||||
|
|
||||||
m_completion = new CppCodeCompletion(m_modelManager);
|
m_completion = new CppCodeCompletion(m_modelManager);
|
||||||
|
@@ -96,3 +96,14 @@ QString CVSControl::findTopLevelForDirectory(const QString &directory) const
|
|||||||
{
|
{
|
||||||
return m_plugin->findTopLevelForDirectory(directory);
|
return m_plugin->findTopLevelForDirectory(directory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CVSControl::emitRepositoryChanged(const QString &s)
|
||||||
|
{
|
||||||
|
emit repositoryChanged(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CVSControl::emitFilesChanged(const QStringList &l)
|
||||||
|
{
|
||||||
|
emit filesChanged(l);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -56,6 +56,9 @@ public:
|
|||||||
virtual bool vcsAdd(const QString &fileName);
|
virtual bool vcsAdd(const QString &fileName);
|
||||||
virtual bool vcsDelete(const QString &filename);
|
virtual bool vcsDelete(const QString &filename);
|
||||||
|
|
||||||
|
void emitRepositoryChanged(const QString &s);
|
||||||
|
void emitFilesChanged(const QStringList &l);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void enabledChanged(bool);
|
void enabledChanged(bool);
|
||||||
|
|
||||||
|
@@ -551,9 +551,11 @@ void CVSPlugin::revertCurrentFile()
|
|||||||
QStringList args(QLatin1String("update"));
|
QStringList args(QLatin1String("update"));
|
||||||
args.push_back(QLatin1String("-C"));
|
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) {
|
if (revertResponse.result == CVSResponse::Ok) {
|
||||||
fcb.setModifiedReload(true);
|
fcb.setModifiedReload(true);
|
||||||
|
m_versionControl->emitFilesChanged(files);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -734,7 +736,10 @@ void CVSPlugin::updateProject()
|
|||||||
if (!topLevels.empty()) {
|
if (!topLevels.empty()) {
|
||||||
QStringList args(QLatin1String("update"));
|
QStringList args(QLatin1String("update"));
|
||||||
args.push_back(QLatin1String("-dR"));
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -59,6 +59,7 @@ namespace CVS {
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class CVSSubmitEditor;
|
class CVSSubmitEditor;
|
||||||
|
class CVSControl;
|
||||||
|
|
||||||
struct CVSResponse
|
struct CVSResponse
|
||||||
{
|
{
|
||||||
@@ -153,7 +154,7 @@ private:
|
|||||||
void cleanCommitMessageFile();
|
void cleanCommitMessageFile();
|
||||||
|
|
||||||
CVSSettings m_settings;
|
CVSSettings m_settings;
|
||||||
Core::IVersionControl *m_versionControl;
|
CVSControl *m_versionControl;
|
||||||
QString m_commitMessageFileName;
|
QString m_commitMessageFileName;
|
||||||
|
|
||||||
ProjectExplorer::ProjectExplorerPlugin *m_projectExplorer;
|
ProjectExplorer::ProjectExplorerPlugin *m_projectExplorer;
|
||||||
|
@@ -34,6 +34,7 @@
|
|||||||
#include "gitconstants.h"
|
#include "gitconstants.h"
|
||||||
#include "gitplugin.h"
|
#include "gitplugin.h"
|
||||||
#include "gitsubmiteditor.h"
|
#include "gitsubmiteditor.h"
|
||||||
|
#include "gitversioncontrol.h"
|
||||||
|
|
||||||
#include <coreplugin/actionmanager/actionmanager.h>
|
#include <coreplugin/actionmanager/actionmanager.h>
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
@@ -43,6 +44,9 @@
|
|||||||
#include <coreplugin/progressmanager/progressmanager.h>
|
#include <coreplugin/progressmanager/progressmanager.h>
|
||||||
#include <coreplugin/uniqueidmanager.h>
|
#include <coreplugin/uniqueidmanager.h>
|
||||||
#include <coreplugin/filemanager.h>
|
#include <coreplugin/filemanager.h>
|
||||||
|
#include <coreplugin/filemanager.h>
|
||||||
|
#include <coreplugin/iversioncontrol.h>
|
||||||
|
|
||||||
#include <texteditor/itexteditor.h>
|
#include <texteditor/itexteditor.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <vcsbase/vcsbaseeditor.h>
|
#include <vcsbase/vcsbaseeditor.h>
|
||||||
@@ -55,6 +59,7 @@
|
|||||||
#include <QtCore/QTime>
|
#include <QtCore/QTime>
|
||||||
#include <QtCore/QFileInfo>
|
#include <QtCore/QFileInfo>
|
||||||
#include <QtCore/QDir>
|
#include <QtCore/QDir>
|
||||||
|
#include <QtCore/QSignalMapper>
|
||||||
|
|
||||||
#include <QtGui/QMainWindow> // for msg box parent
|
#include <QtGui/QMainWindow> // for msg box parent
|
||||||
#include <QtGui/QMessageBox>
|
#include <QtGui/QMessageBox>
|
||||||
@@ -102,7 +107,8 @@ static QString formatCommand(const QString &binary, const QStringList &args)
|
|||||||
GitClient::GitClient(GitPlugin* plugin)
|
GitClient::GitClient(GitPlugin* plugin)
|
||||||
: m_msgWait(tr("Waiting for data...")),
|
: m_msgWait(tr("Waiting for data...")),
|
||||||
m_plugin(plugin),
|
m_plugin(plugin),
|
||||||
m_core(Core::ICore::instance())
|
m_core(Core::ICore::instance()),
|
||||||
|
m_repositoryChangedSignalMapper(0)
|
||||||
{
|
{
|
||||||
if (QSettings *s = m_core->settings()) {
|
if (QSettings *s = m_core->settings()) {
|
||||||
m_settings.fromSettings(s);
|
m_settings.fromSettings(s);
|
||||||
@@ -317,7 +323,8 @@ void GitClient::checkoutBranch(const QString &workingDirectory, const QString &b
|
|||||||
{
|
{
|
||||||
QStringList arguments(QLatin1String("checkout"));
|
QStringList arguments(QLatin1String("checkout"));
|
||||||
arguments << branch;
|
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)
|
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())
|
if (!commit.isEmpty())
|
||||||
arguments << commit;
|
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)
|
void GitClient::addFile(const QString &workingDirectory, const QString &fileName)
|
||||||
@@ -500,18 +508,19 @@ GitCommand *GitClient::createCommand(const QString &workingDirectory,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Execute a single command
|
// Execute a single command
|
||||||
void GitClient::executeGit(const QString &workingDirectory,
|
GitCommand *GitClient::executeGit(const QString &workingDirectory,
|
||||||
const QStringList &arguments,
|
const QStringList &arguments,
|
||||||
VCSBase::VCSBaseEditor* editor,
|
VCSBase::VCSBaseEditor* editor,
|
||||||
bool outputToWindow,
|
bool outputToWindow,
|
||||||
GitCommand::TerminationReportMode tm,
|
GitCommand::TerminationReportMode tm,
|
||||||
int editorLineNumber)
|
int editorLineNumber)
|
||||||
{
|
{
|
||||||
VCSBase::VCSBaseOutputWindow::instance()->appendCommand(formatCommand(QLatin1String(Constants::GIT_BINARY), arguments));
|
VCSBase::VCSBaseOutputWindow::instance()->appendCommand(formatCommand(QLatin1String(Constants::GIT_BINARY), arguments));
|
||||||
GitCommand *command = createCommand(workingDirectory, editor, outputToWindow, editorLineNumber);
|
GitCommand *command = createCommand(workingDirectory, editor, outputToWindow, editorLineNumber);
|
||||||
command->addJob(arguments, m_settings.timeout);
|
command->addJob(arguments, m_settings.timeout);
|
||||||
command->setTerminationReportMode(tm);
|
command->setTerminationReportMode(tm);
|
||||||
command->execute();
|
command->execute();
|
||||||
|
return command;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return fixed arguments required to run
|
// Return fixed arguments required to run
|
||||||
@@ -903,6 +912,8 @@ void GitClient::revert(const QStringList &files)
|
|||||||
QString errorMessage;
|
QString errorMessage;
|
||||||
switch (revertI(files, &isDirectory, &errorMessage)) {
|
switch (revertI(files, &isDirectory, &errorMessage)) {
|
||||||
case RevertOk:
|
case RevertOk:
|
||||||
|
m_plugin->versionControl()->emitFilesChanged(files);
|
||||||
|
break;
|
||||||
case RevertCanceled:
|
case RevertCanceled:
|
||||||
break;
|
break;
|
||||||
case RevertUnchanged: {
|
case RevertUnchanged: {
|
||||||
@@ -918,7 +929,8 @@ void GitClient::revert(const QStringList &files)
|
|||||||
|
|
||||||
void GitClient::pull(const QString &workingDirectory)
|
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)
|
void GitClient::push(const QString &workingDirectory)
|
||||||
@@ -952,7 +964,8 @@ void GitClient::stashPop(const QString &workingDirectory)
|
|||||||
{
|
{
|
||||||
QStringList arguments(QLatin1String("stash"));
|
QStringList arguments(QLatin1String("stash"));
|
||||||
arguments << QLatin1String("pop");
|
arguments << QLatin1String("pop");
|
||||||
executeGit(workingDirectory, arguments, 0, true);
|
GitCommand *cmd = executeGit(workingDirectory, arguments, 0, true);
|
||||||
|
connectRepositoryChanged(workingDirectory, cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GitClient::branchList(const QString &workingDirectory)
|
void GitClient::branchList(const QString &workingDirectory)
|
||||||
@@ -1000,3 +1013,16 @@ void GitClient::setSettings(const GitSettings &s)
|
|||||||
m_binaryPath = m_settings.gitBinaryPath();
|
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);
|
||||||
|
}
|
||||||
|
@@ -33,7 +33,6 @@
|
|||||||
#include "gitsettings.h"
|
#include "gitsettings.h"
|
||||||
#include "gitcommand.h"
|
#include "gitcommand.h"
|
||||||
|
|
||||||
#include <coreplugin/iversioncontrol.h>
|
|
||||||
#include <coreplugin/editormanager/ieditor.h>
|
#include <coreplugin/editormanager/ieditor.h>
|
||||||
|
|
||||||
#include <QtCore/QString>
|
#include <QtCore/QString>
|
||||||
@@ -41,6 +40,7 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QErrorMessage;
|
class QErrorMessage;
|
||||||
|
class QSignalMapper;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
@@ -158,12 +158,12 @@ private:
|
|||||||
bool outputToWindow = false,
|
bool outputToWindow = false,
|
||||||
int editorLineNumber = -1);
|
int editorLineNumber = -1);
|
||||||
|
|
||||||
void executeGit(const QString &workingDirectory,
|
GitCommand *executeGit(const QString &workingDirectory,
|
||||||
const QStringList &arguments,
|
const QStringList &arguments,
|
||||||
VCSBase::VCSBaseEditor* editor = 0,
|
VCSBase::VCSBaseEditor* editor = 0,
|
||||||
bool outputToWindow = false,
|
bool outputToWindow = false,
|
||||||
GitCommand::TerminationReportMode tm = GitCommand::NoReport,
|
GitCommand::TerminationReportMode tm = GitCommand::NoReport,
|
||||||
int editorLineNumber = -1);
|
int editorLineNumber = -1);
|
||||||
|
|
||||||
bool synchronousGit(const QString &workingDirectory,
|
bool synchronousGit(const QString &workingDirectory,
|
||||||
const QStringList &arguments,
|
const QStringList &arguments,
|
||||||
@@ -173,12 +173,14 @@ private:
|
|||||||
|
|
||||||
enum RevertResult { RevertOk, RevertUnchanged, RevertCanceled, RevertFailed };
|
enum RevertResult { RevertOk, RevertUnchanged, RevertCanceled, RevertFailed };
|
||||||
RevertResult revertI(QStringList files, bool *isDirectory, QString *errorMessage);
|
RevertResult revertI(QStringList files, bool *isDirectory, QString *errorMessage);
|
||||||
|
void connectRepositoryChanged(const QString & repository, GitCommand *cmd);
|
||||||
|
|
||||||
const QString m_msgWait;
|
const QString m_msgWait;
|
||||||
GitPlugin *m_plugin;
|
GitPlugin *m_plugin;
|
||||||
Core::ICore *m_core;
|
Core::ICore *m_core;
|
||||||
GitSettings m_settings;
|
GitSettings m_settings;
|
||||||
QString m_binaryPath;
|
QString m_binaryPath;
|
||||||
|
QSignalMapper *m_repositoryChangedSignalMapper;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -177,6 +177,8 @@ void GitCommand::run()
|
|||||||
emit errorText(error);
|
emit errorText(error);
|
||||||
|
|
||||||
emit finished(ok, m_cookie);
|
emit finished(ok, m_cookie);
|
||||||
|
if (ok)
|
||||||
|
emit success();
|
||||||
// As it is used asynchronously, we need to delete ourselves
|
// As it is used asynchronously, we need to delete ourselves
|
||||||
this->deleteLater();
|
this->deleteLater();
|
||||||
}
|
}
|
||||||
|
@@ -73,6 +73,7 @@ Q_SIGNALS:
|
|||||||
void outputData(const QByteArray&);
|
void outputData(const QByteArray&);
|
||||||
void errorText(const QString&);
|
void errorText(const QString&);
|
||||||
void finished(bool ok, const QVariant &cookie);
|
void finished(bool ok, const QVariant &cookie);
|
||||||
|
void success();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct Job {
|
struct Job {
|
||||||
|
@@ -142,6 +142,7 @@ GitPlugin::GitPlugin() :
|
|||||||
m_stashListAction(0),
|
m_stashListAction(0),
|
||||||
m_branchListAction(0),
|
m_branchListAction(0),
|
||||||
m_gitClient(0),
|
m_gitClient(0),
|
||||||
|
m_versionControl(0),
|
||||||
m_changeSelectionDialog(0),
|
m_changeSelectionDialog(0),
|
||||||
m_submitActionTriggered(false)
|
m_submitActionTriggered(false)
|
||||||
{
|
{
|
||||||
@@ -215,8 +216,8 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
|||||||
|
|
||||||
addAutoReleasedObject(new GitSubmitEditorFactory(&submitParameters));
|
addAutoReleasedObject(new GitSubmitEditorFactory(&submitParameters));
|
||||||
|
|
||||||
GitVersionControl *versionControl = new GitVersionControl(m_gitClient);
|
m_versionControl = new GitVersionControl(m_gitClient);
|
||||||
addAutoReleasedObject(versionControl);
|
addAutoReleasedObject(m_versionControl);
|
||||||
|
|
||||||
addAutoReleasedObject(new CloneWizard);
|
addAutoReleasedObject(new CloneWizard);
|
||||||
addAutoReleasedObject(new Gitorious::Internal::GitoriousCloneWizard);
|
addAutoReleasedObject(new Gitorious::Internal::GitoriousCloneWizard);
|
||||||
@@ -232,8 +233,8 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
|||||||
gitContainer->menu()->setTitle(tr("&Git"));
|
gitContainer->menu()->setTitle(tr("&Git"));
|
||||||
toolsContainer->addMenu(gitContainer);
|
toolsContainer->addMenu(gitContainer);
|
||||||
if (QAction *ma = gitContainer->menu()->menuAction()) {
|
if (QAction *ma = gitContainer->menu()->menuAction()) {
|
||||||
ma->setEnabled(versionControl->isEnabled());
|
ma->setEnabled(m_versionControl->isEnabled());
|
||||||
connect(versionControl, SIGNAL(enabledChanged(bool)), ma, SLOT(setVisible(bool)));
|
connect(m_versionControl, SIGNAL(enabledChanged(bool)), ma, SLOT(setVisible(bool)));
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::Command *command;
|
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)
|
void GitPlugin::submitEditorDiff(const QStringList &unstaged, const QStringList &staged)
|
||||||
{
|
{
|
||||||
m_gitClient->diff(m_submitRepository, QStringList(), unstaged, staged);
|
m_gitClient->diff(m_submitRepository, QStringList(), unstaged, staged);
|
||||||
|
@@ -59,6 +59,7 @@ namespace Git {
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class GitPlugin;
|
class GitPlugin;
|
||||||
|
class GitVersionControl;
|
||||||
class GitClient;
|
class GitClient;
|
||||||
class ChangeSelectionDialog;
|
class ChangeSelectionDialog;
|
||||||
class GitSubmitEditor;
|
class GitSubmitEditor;
|
||||||
@@ -96,6 +97,7 @@ public:
|
|||||||
void setSettings(const GitSettings &s);
|
void setSettings(const GitSettings &s);
|
||||||
|
|
||||||
GitClient *gitClient() const;
|
GitClient *gitClient() const;
|
||||||
|
GitVersionControl *versionControl() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void updateActions();
|
void updateActions();
|
||||||
@@ -159,6 +161,7 @@ private:
|
|||||||
QAction *m_branchListAction;
|
QAction *m_branchListAction;
|
||||||
|
|
||||||
GitClient *m_gitClient;
|
GitClient *m_gitClient;
|
||||||
|
GitVersionControl *m_versionControl;
|
||||||
ChangeSelectionDialog *m_changeSelectionDialog;
|
ChangeSelectionDialog *m_changeSelectionDialog;
|
||||||
QString m_submitRepository;
|
QString m_submitRepository;
|
||||||
QStringList m_submitOrigCommitFiles;
|
QStringList m_submitOrigCommitFiles;
|
||||||
|
@@ -96,5 +96,10 @@ QString GitVersionControl::findTopLevelForDirectory(const QString &directory) co
|
|||||||
return GitClient::findRepositoryForDirectory(directory);
|
return GitClient::findRepositoryForDirectory(directory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GitVersionControl::emitFilesChanged(const QStringList &l)
|
||||||
|
{
|
||||||
|
emit filesChanged(l);
|
||||||
|
}
|
||||||
|
|
||||||
} // Internal
|
} // Internal
|
||||||
} // Git
|
} // Git
|
||||||
|
@@ -57,6 +57,8 @@ public:
|
|||||||
virtual bool vcsAdd(const QString &fileName);
|
virtual bool vcsAdd(const QString &fileName);
|
||||||
virtual bool vcsDelete(const QString &filename);
|
virtual bool vcsDelete(const QString &filename);
|
||||||
|
|
||||||
|
void emitFilesChanged(const QStringList &);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void enabledChanged(bool);
|
void enabledChanged(bool);
|
||||||
|
|
||||||
|
@@ -454,6 +454,8 @@ void PerforcePlugin::revertCurrentFile()
|
|||||||
Core::FileChangeBlocker fcb(fileName);
|
Core::FileChangeBlocker fcb(fileName);
|
||||||
fcb.setModifiedReload(true);
|
fcb.setModifiedReload(true);
|
||||||
PerforceResponse result2 = runP4Cmd(QStringList() << QLatin1String("revert") << fileName, QStringList(), CommandToWindow|StdOutToWindow|StdErrToWindow|ErrorToWindow);
|
PerforceResponse result2 = runP4Cmd(QStringList() << QLatin1String("revert") << fileName, QStringList(), CommandToWindow|StdOutToWindow|StdErrToWindow|ErrorToWindow);
|
||||||
|
if (!result2.error)
|
||||||
|
m_versionControl->emitFilesChanged(QStringList(fileName));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerforcePlugin::diffCurrentFile()
|
void PerforcePlugin::diffCurrentFile()
|
||||||
@@ -514,7 +516,10 @@ void PerforcePlugin::updateCheckout(const QStringList &dirs)
|
|||||||
{
|
{
|
||||||
QStringList args(QLatin1String("sync"));
|
QStringList args(QLatin1String("sync"));
|
||||||
args.append(dirs);
|
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()
|
void PerforcePlugin::printOpenedFileList()
|
||||||
|
@@ -94,5 +94,15 @@ QString PerforceVersionControl::findTopLevelForDirectory(const QString &director
|
|||||||
return m_plugin->findTopLevelForDirectory(directory);
|
return m_plugin->findTopLevelForDirectory(directory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PerforceVersionControl::emitRepositoryChanged(const QString &s)
|
||||||
|
{
|
||||||
|
emit repositoryChanged(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PerforceVersionControl::emitFilesChanged(const QStringList &l)
|
||||||
|
{
|
||||||
|
emit filesChanged(l);
|
||||||
|
}
|
||||||
|
|
||||||
} // Internal
|
} // Internal
|
||||||
} // Perforce
|
} // Perforce
|
||||||
|
@@ -56,6 +56,9 @@ public:
|
|||||||
virtual bool vcsAdd(const QString &fileName);
|
virtual bool vcsAdd(const QString &fileName);
|
||||||
virtual bool vcsDelete(const QString &filename);
|
virtual bool vcsDelete(const QString &filename);
|
||||||
|
|
||||||
|
void emitRepositoryChanged(const QString &s);
|
||||||
|
void emitFilesChanged(const QStringList &l);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void enabledChanged(bool);
|
void enabledChanged(bool);
|
||||||
|
|
||||||
|
@@ -96,3 +96,13 @@ QString SubversionControl::findTopLevelForDirectory(const QString &directory) co
|
|||||||
{
|
{
|
||||||
return m_plugin->findTopLevelForDirectory(directory);
|
return m_plugin->findTopLevelForDirectory(directory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SubversionControl::emitRepositoryChanged(const QString &s)
|
||||||
|
{
|
||||||
|
emit repositoryChanged(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SubversionControl::emitFilesChanged(const QStringList &l)
|
||||||
|
{
|
||||||
|
emit filesChanged(l);
|
||||||
|
}
|
||||||
|
@@ -56,6 +56,9 @@ public:
|
|||||||
virtual bool vcsAdd(const QString &fileName);
|
virtual bool vcsAdd(const QString &fileName);
|
||||||
virtual bool vcsDelete(const QString &filename);
|
virtual bool vcsDelete(const QString &filename);
|
||||||
|
|
||||||
|
void emitRepositoryChanged(const QString &);
|
||||||
|
void emitFilesChanged(const QStringList &);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void enabledChanged(bool);
|
void enabledChanged(bool);
|
||||||
|
|
||||||
|
@@ -574,6 +574,7 @@ void SubversionPlugin::revertCurrentFile()
|
|||||||
const SubversionResponse revertResponse = runSvn(args, subversionShortTimeOut, true);
|
const SubversionResponse revertResponse = runSvn(args, subversionShortTimeOut, true);
|
||||||
if (!revertResponse.error) {
|
if (!revertResponse.error) {
|
||||||
fcb.setModifiedReload(true);
|
fcb.setModifiedReload(true);
|
||||||
|
m_versionControl->emitFilesChanged(QStringList(file));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -750,7 +751,10 @@ void SubversionPlugin::updateProject()
|
|||||||
QStringList args(QLatin1String("update"));
|
QStringList args(QLatin1String("update"));
|
||||||
args.push_back(QLatin1String(nonInteractiveOptionC));
|
args.push_back(QLatin1String(nonInteractiveOptionC));
|
||||||
args.append(topLevels);
|
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()
|
void SubversionPlugin::annotateCurrentFile()
|
||||||
|
@@ -56,6 +56,7 @@ namespace Subversion {
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class SubversionSubmitEditor;
|
class SubversionSubmitEditor;
|
||||||
|
class SubversionControl;
|
||||||
|
|
||||||
struct SubversionResponse
|
struct SubversionResponse
|
||||||
{
|
{
|
||||||
@@ -131,7 +132,7 @@ private:
|
|||||||
const QStringList m_svnDirectories;
|
const QStringList m_svnDirectories;
|
||||||
|
|
||||||
SubversionSettings m_settings;
|
SubversionSettings m_settings;
|
||||||
Core::IVersionControl *m_versionControl;
|
SubversionControl *m_versionControl;
|
||||||
QString m_commitMessageFileName;
|
QString m_commitMessageFileName;
|
||||||
|
|
||||||
ProjectExplorer::ProjectExplorerPlugin *m_projectExplorer;
|
ProjectExplorer::ProjectExplorerPlugin *m_projectExplorer;
|
||||||
|
Reference in New Issue
Block a user