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