Commit 8335a06e authored by Friedemann Kleint's avatar Friedemann Kleint

Code model: Update on changes from the versioning system.

Add changed signals to IVersionControl and
VCSManager and wire them to the update methods. Add a menu action for
manually updating. Improved version of reverted
7aa24116.
Reviewed-by: default avatarRoberto Raggi <roberto.raggi@nokia.com>
parent 4d45ad00
......@@ -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;
};
......
......@@ -41,8 +41,10 @@ const char * const SWITCH_DECLARATION_DEFINITION = "CppEditor.SwitchDeclarationD
const char * const RENAME_SYMBOL_UNDER_CURSOR = "CppEditor.RenameSymbolUnderCursor";
const char * const FIND_USAGES = "CppEditor.FindUsages";
const char * const SEPARATOR = "CppEditor.Separator";
const char * const SEPARATOR2 = "CppEditor.Separator2";
const char * const FIND_REFERENCES = "CppEditor.FindReferences";
const char * const JUMP_TO_DEFINITION = "CppEditor.JumpToDefinition";
const char * const UPDATE_CODEMODEL = "CppEditor.UpdateCodeModel";
const char * const HEADER_FILE_TYPE = "CppHeaderFiles";
const char * const SOURCE_FILE_TYPE = "CppSourceFiles";
......
......@@ -52,6 +52,7 @@
#include <texteditor/texteditorsettings.h>
#include <texteditor/texteditorconstants.h>
#include <cpptools/cpptoolsconstants.h>
#include <cpptools/cppmodelmanagerinterface.h>
#include <QtCore/QFileInfo>
#include <QtCore/QSettings>
......@@ -108,11 +109,26 @@ QStringList CppEditorFactory::mimeTypes() const
///////////////////////////////// CppPlugin //////////////////////////////////
static inline
Core::Command *createSeparator(Core::ActionManager *am,
QObject *parent,
const QList<int> &context,
const char *id)
{
QAction *separator = new QAction(parent);
separator->setSeparator(true);
return am->registerAction(separator, QLatin1String(id), context);
}
CppPlugin *CppPlugin::m_instance = 0;
CppPlugin::CppPlugin() :
m_actionHandler(0),
m_sortedMethodOverview(false)
m_sortedMethodOverview(false),
m_renameSymbolUnderCursorAction(0),
m_findUsagesAction(0),
m_updateCodeModelAction(0)
{
m_instance = this;
}
......@@ -192,6 +208,7 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
Core::ActionContainer *contextMenu= am->createMenu(CppEditor::Constants::M_CONTEXT);
Core::Command *cmd;
Core::ActionContainer *cppToolsMenu = am->actionContainer(QLatin1String(CppTools::Constants::M_TOOLS_CPP));
QAction *jumpToDefinition = new QAction(tr("Follow Symbol under Cursor"), this);
cmd = am->registerAction(jumpToDefinition,
......@@ -200,7 +217,7 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
connect(jumpToDefinition, SIGNAL(triggered()),
this, SLOT(jumpToDefinition()));
contextMenu->addAction(cmd);
am->actionContainer(CppTools::Constants::M_TOOLS_CPP)->addAction(cmd);
cppToolsMenu->addAction(cmd);
QAction *switchDeclarationDefinition = new QAction(tr("Switch between Method Declaration/Definition"), this);
cmd = am->registerAction(switchDeclarationDefinition,
......@@ -209,14 +226,14 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
connect(switchDeclarationDefinition, SIGNAL(triggered()),
this, SLOT(switchDeclarationDefinition()));
contextMenu->addAction(cmd);
am->actionContainer(CppTools::Constants::M_TOOLS_CPP)->addAction(cmd);
cppToolsMenu->addAction(cmd);
m_findUsagesAction = new QAction(tr("Find Usages"), this);
cmd = am->registerAction(m_findUsagesAction, Constants::FIND_USAGES, context);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+U")));
connect(m_findUsagesAction, SIGNAL(triggered()), this, SLOT(findUsages()));
contextMenu->addAction(cmd);
am->actionContainer(CppTools::Constants::M_TOOLS_CPP)->addAction(cmd);
cppToolsMenu->addAction(cmd);
m_renameSymbolUnderCursorAction = new QAction(tr("Rename Symbol under Cursor"), this);
cmd = am->registerAction(m_renameSymbolUnderCursorAction,
......@@ -224,7 +241,17 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
cmd->setDefaultKeySequence(QKeySequence("CTRL+SHIFT+R"));
connect(m_renameSymbolUnderCursorAction, SIGNAL(triggered()), this, SLOT(renameSymbolUnderCursor()));
contextMenu->addAction(cmd);
am->actionContainer(CppTools::Constants::M_TOOLS_CPP)->addAction(cmd);
cppToolsMenu->addAction(cmd);
// Update context in global context
QList<int> globalContext;
globalContext.append(Core::Constants::C_GLOBAL_ID);
cppToolsMenu->addAction(createSeparator(am, this, globalContext, CppEditor::Constants::SEPARATOR2));
m_updateCodeModelAction = new QAction(tr("Update code model"), this);
cmd = am->registerAction(m_updateCodeModelAction, QLatin1String(Constants::UPDATE_CODEMODEL), globalContext);
CppTools::CppModelManagerInterface *cppModelManager = CppTools::CppModelManagerInterface::instance();
connect(m_updateCodeModelAction, SIGNAL(triggered()), cppModelManager, SLOT(updateModifiedSourceFiles()));
cppToolsMenu->addAction(cmd);
m_actionHandler = new TextEditor::TextEditorActionHandler(CppEditor::Constants::C_CPPEDITOR,
TextEditor::TextEditorActionHandler::Format
......@@ -233,10 +260,7 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
m_actionHandler->initializeActions();
QAction *separator = new QAction(this);
separator->setSeparator(true);
cmd = am->registerAction(separator, CppEditor::Constants::SEPARATOR, context);
contextMenu->addAction(cmd);
contextMenu->addAction(createSeparator(am, this, context, CppEditor::Constants::SEPARATOR));
cmd = am->command(TextEditor::Constants::AUTO_INDENT_SELECTION);
contextMenu->addAction(cmd);
......@@ -308,6 +332,7 @@ void CppPlugin::onTaskStarted(const QString &type)
if (type == CppTools::Constants::TASK_INDEX) {
m_renameSymbolUnderCursorAction->setEnabled(false);
m_findUsagesAction->setEnabled(false);
m_updateCodeModelAction->setEnabled(false);
}
}
......@@ -316,6 +341,7 @@ void CppPlugin::onAllTasksFinished(const QString &type)
if (type == CppTools::Constants::TASK_INDEX) {
m_renameSymbolUnderCursorAction->setEnabled(true);
m_findUsagesAction->setEnabled(true);
m_updateCodeModelAction->setEnabled(true);
}
}
......
......@@ -90,6 +90,7 @@ private:
bool m_sortedMethodOverview;
QAction *m_renameSymbolUnderCursorAction;
QAction *m_findUsagesAction;
QAction *m_updateCodeModelAction;
};
class CppEditorFactory : public Core::IEditorFactory
......
......@@ -47,6 +47,7 @@
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/progressmanager/progressmanager.h>
#include <coreplugin/vcsmanager.h>
#include <cppeditor/cppeditorconstants.h>
#include <QtCore/QtConcurrentRun>
......@@ -97,6 +98,11 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error)
// Objects
m_modelManager = new CppModelManager(this);
Core::VCSManager *vcsManager = core->vcsManager();
connect(vcsManager, SIGNAL(repositoryChanged(QString)),
m_modelManager, SLOT(updateModifiedSourceFiles()));
connect(vcsManager, SIGNAL(filesChanged(QStringList)),
m_modelManager, SLOT(updateModifiedSourceFiles()));
addAutoReleasedObject(m_modelManager);
m_completion = new CppCodeCompletion(m_modelManager);
......
......@@ -96,3 +96,14 @@ QString CVSControl::findTopLevelForDirectory(const QString &directory) const
{
return m_plugin->findTopLevelForDirectory(directory);
}
void CVSControl::emitRepositoryChanged(const QString &s)
{
emit repositoryChanged(s);
}
void CVSControl::emitFilesChanged(const QStringList &l)
{
emit filesChanged(l);
}
......@@ -56,6 +56,9 @@ public:
virtual bool vcsAdd(const QString &fileName);
virtual bool vcsDelete(const QString &filename);
void emitRepositoryChanged(const QString &s);
void emitFilesChanged(const QStringList &l);
signals:
void enabledChanged(bool);
......
......@@ -551,9 +551,11 @@ void CVSPlugin::revertCurrentFile()
QStringList args(QLatin1String("update"));
args.push_back(QLatin1String("-C"));
const CVSResponse revertResponse = runCVS(args, QStringList(file), cvsShortTimeOut, true);
const QStringList files = QStringList(file);
const CVSResponse revertResponse = runCVS(args, files, cvsShortTimeOut, true);
if (revertResponse.result == CVSResponse::Ok) {
fcb.setModifiedReload(true);
m_versionControl->emitFilesChanged(files);
}
}
......@@ -734,7 +736,10 @@ void CVSPlugin::updateProject()
if (!topLevels.empty()) {
QStringList args(QLatin1String("update"));
args.push_back(QLatin1String("-dR"));
runCVS(args, topLevels, cvsLongTimeOut, true);
const CVSResponse response = runCVS(args, topLevels, cvsLongTimeOut, true);
if (response.result == CVSResponse::Ok)
foreach(const QString &topLevel, topLevels)
m_versionControl->emitRepositoryChanged(topLevel);
}
}
......
......@@ -59,6 +59,7 @@ namespace CVS {
namespace Internal {
class CVSSubmitEditor;
class CVSControl;
struct CVSResponse
{
......@@ -153,7 +154,7 @@ private:
void cleanCommitMessageFile();
CVSSettings m_settings;
Core::IVersionControl *m_versionControl;
CVSControl *m_versionControl;
QString m_commitMessageFileName;
ProjectExplorer::ProjectExplorerPlugin *m_projectExplorer;
......
......@@ -34,6 +34,7 @@
#include "gitconstants.h"
#include "gitplugin.h"
#include "gitsubmiteditor.h"
#include "gitversioncontrol.h"
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/coreconstants.h>
......@@ -43,6 +44,9 @@
#include <coreplugin/progressmanager/progressmanager.h>
#include <coreplugin/uniqueidmanager.h>
#include <coreplugin/filemanager.h>
#include <coreplugin/filemanager.h>
#include <coreplugin/iversioncontrol.h>
#include <texteditor/itexteditor.h>
#include <utils/qtcassert.h>
#include <vcsbase/vcsbaseeditor.h>
......@@ -55,6 +59,7 @@
#include <QtCore/QTime>
#include <QtCore/QFileInfo>
#include <QtCore/QDir>
#include <QtCore/QSignalMapper>
#include <QtGui/QMainWindow> // for msg box parent
#include <QtGui/QMessageBox>
......@@ -102,7 +107,8 @@ static QString formatCommand(const QString &binary, const QStringList &args)
GitClient::GitClient(GitPlugin* plugin)
: m_msgWait(tr("Waiting for data...")),
m_plugin(plugin),
m_core(Core::ICore::instance())
m_core(Core::ICore::instance()),
m_repositoryChangedSignalMapper(0)
{
if (QSettings *s = m_core->settings()) {
m_settings.fromSettings(s);
......@@ -317,7 +323,8 @@ void GitClient::checkoutBranch(const QString &workingDirectory, const QString &b
{
QStringList arguments(QLatin1String("checkout"));
arguments << branch;
executeGit(workingDirectory, arguments, 0, true);
GitCommand *cmd = executeGit(workingDirectory, arguments, 0, true);
connectRepositoryChanged(workingDirectory, cmd);
}
void GitClient::checkout(const QString &workingDirectory, const QString &fileName)
......@@ -341,7 +348,8 @@ void GitClient::hardReset(const QString &workingDirectory, const QString &commit
if (!commit.isEmpty())
arguments << commit;
executeGit(workingDirectory, arguments, 0, true);
GitCommand *cmd = executeGit(workingDirectory, arguments, 0, true);
connectRepositoryChanged(workingDirectory, cmd);
}
void GitClient::addFile(const QString &workingDirectory, const QString &fileName)
......@@ -500,18 +508,19 @@ GitCommand *GitClient::createCommand(const QString &workingDirectory,
}
// Execute a single command
void GitClient::executeGit(const QString &workingDirectory,
const QStringList &arguments,
VCSBase::VCSBaseEditor* editor,
bool outputToWindow,
GitCommand::TerminationReportMode tm,
int editorLineNumber)
GitCommand *GitClient::executeGit(const QString &workingDirectory,
const QStringList &arguments,
VCSBase::VCSBaseEditor* editor,
bool outputToWindow,
GitCommand::TerminationReportMode tm,
int editorLineNumber)
{
VCSBase::VCSBaseOutputWindow::instance()->appendCommand(formatCommand(QLatin1String(Constants::GIT_BINARY), arguments));
GitCommand *command = createCommand(workingDirectory, editor, outputToWindow, editorLineNumber);
command->addJob(arguments, m_settings.timeout);
command->setTerminationReportMode(tm);
command->execute();
return command;
}
// Return fixed arguments required to run
......@@ -903,6 +912,8 @@ void GitClient::revert(const QStringList &files)
QString errorMessage;
switch (revertI(files, &isDirectory, &errorMessage)) {
case RevertOk:
m_plugin->versionControl()->emitFilesChanged(files);
break;
case RevertCanceled:
break;
case RevertUnchanged: {
......@@ -918,7 +929,8 @@ void GitClient::revert(const QStringList &files)
void GitClient::pull(const QString &workingDirectory)
{
executeGit(workingDirectory, QStringList(QLatin1String("pull")), 0, true, GitCommand::ReportStderr);
GitCommand *cmd = executeGit(workingDirectory, QStringList(QLatin1String("pull")), 0, true, GitCommand::ReportStderr);
connectRepositoryChanged(workingDirectory, cmd);
}
void GitClient::push(const QString &workingDirectory)
......@@ -952,7 +964,8 @@ void GitClient::stashPop(const QString &workingDirectory)
{
QStringList arguments(QLatin1String("stash"));
arguments << QLatin1String("pop");
executeGit(workingDirectory, arguments, 0, true);
GitCommand *cmd = executeGit(workingDirectory, arguments, 0, true);
connectRepositoryChanged(workingDirectory, cmd);
}
void GitClient::branchList(const QString &workingDirectory)
......@@ -1000,3 +1013,16 @@ void GitClient::setSettings(const GitSettings &s)
m_binaryPath = m_settings.gitBinaryPath();
}
}
void GitClient::connectRepositoryChanged(const QString & repository, GitCommand *cmd)
{
// Bind command success termination with repository to changed signal
if (!m_repositoryChangedSignalMapper) {
m_repositoryChangedSignalMapper = new QSignalMapper(this);
connect(m_repositoryChangedSignalMapper, SIGNAL(mapped(QString)),
m_plugin->versionControl(), SIGNAL(repositoryChanged(QString)));
}
m_repositoryChangedSignalMapper->setMapping(cmd, repository);
connect(cmd, SIGNAL(success()), m_repositoryChangedSignalMapper, SLOT(map()),
Qt::QueuedConnection);
}
......@@ -33,7 +33,6 @@
#include "gitsettings.h"
#include "gitcommand.h"
#include <coreplugin/iversioncontrol.h>
#include <coreplugin/editormanager/ieditor.h>
#include <QtCore/QString>
......@@ -41,6 +40,7 @@
QT_BEGIN_NAMESPACE
class QErrorMessage;
class QSignalMapper;
QT_END_NAMESPACE
namespace Core {
......@@ -158,12 +158,12 @@ private:
bool outputToWindow = false,
int editorLineNumber = -1);
void executeGit(const QString &workingDirectory,
const QStringList &arguments,
VCSBase::VCSBaseEditor* editor = 0,
bool outputToWindow = false,
GitCommand::TerminationReportMode tm = GitCommand::NoReport,
int editorLineNumber = -1);
GitCommand *executeGit(const QString &workingDirectory,
const QStringList &arguments,
VCSBase::VCSBaseEditor* editor = 0,
bool outputToWindow = false,
GitCommand::TerminationReportMode tm = GitCommand::NoReport,
int editorLineNumber = -1);
bool synchronousGit(const QString &workingDirectory,
const QStringList &arguments,
......@@ -173,12 +173,14 @@ private:
enum RevertResult { RevertOk, RevertUnchanged, RevertCanceled, RevertFailed };
RevertResult revertI(QStringList files, bool *isDirectory, QString *errorMessage);
void connectRepositoryChanged(const QString & repository, GitCommand *cmd);
const QString m_msgWait;
GitPlugin *m_plugin;
Core::ICore *m_core;
GitSettings m_settings;
QString m_binaryPath;
QSignalMapper *m_repositoryChangedSignalMapper;
};
......
......@@ -177,6 +177,8 @@ void GitCommand::run()
emit errorText(error);
emit finished(ok, m_cookie);
if (ok)
emit success();
// As it is used asynchronously, we need to delete ourselves
this->deleteLater();
}
......
......@@ -73,6 +73,7 @@ Q_SIGNALS:
void outputData(const QByteArray&);
void errorText(const QString&);
void finished(bool ok, const QVariant &cookie);
void success();
private:
struct Job {
......
......@@ -142,6 +142,7 @@ GitPlugin::GitPlugin() :
m_stashListAction(0),
m_branchListAction(0),
m_gitClient(0),
m_versionControl(0),
m_changeSelectionDialog(0),
m_submitActionTriggered(false)
{
......@@ -215,8 +216,8 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
addAutoReleasedObject(new GitSubmitEditorFactory(&submitParameters));
GitVersionControl *versionControl = new GitVersionControl(m_gitClient);
addAutoReleasedObject(versionControl);
m_versionControl = new GitVersionControl(m_gitClient);
addAutoReleasedObject(m_versionControl);
addAutoReleasedObject(new CloneWizard);
addAutoReleasedObject(new Gitorious::Internal::GitoriousCloneWizard);
......@@ -232,8 +233,8 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
gitContainer->menu()->setTitle(tr("&Git"));
toolsContainer->addMenu(gitContainer);
if (QAction *ma = gitContainer->menu()->menuAction()) {
ma->setEnabled(versionControl->isEnabled());
connect(versionControl, SIGNAL(enabledChanged(bool)), ma, SLOT(setVisible(bool)));
ma->setEnabled(m_versionControl->isEnabled());
connect(m_versionControl, SIGNAL(enabledChanged(bool)), ma, SLOT(setVisible(bool)));
}
Core::Command *command;
......@@ -398,6 +399,11 @@ void GitPlugin::extensionsInitialized()
{
}
GitVersionControl *GitPlugin::versionControl() const
{
return m_versionControl;
}
void GitPlugin::submitEditorDiff(const QStringList &unstaged, const QStringList &staged)
{
m_gitClient->diff(m_submitRepository, QStringList(), unstaged, staged);
......
......@@ -59,6 +59,7 @@ namespace Git {
namespace Internal {
class GitPlugin;
class GitVersionControl;
class GitClient;
class ChangeSelectionDialog;
class GitSubmitEditor;
......@@ -96,6 +97,7 @@ public:
void setSettings(const GitSettings &s);
GitClient *gitClient() const;
GitVersionControl *versionControl() const;
public slots:
void updateActions();
......@@ -159,6 +161,7 @@ private:
QAction *m_branchListAction;
GitClient *m_gitClient;
GitVersionControl *m_versionControl;
ChangeSelectionDialog *m_changeSelectionDialog;
QString m_submitRepository;
QStringList m_submitOrigCommitFiles;
......
......@@ -96,5 +96,10 @@ QString GitVersionControl::findTopLevelForDirectory(const QString &directory) co
return GitClient::findRepositoryForDirectory(directory);
}
void GitVersionControl::emitFilesChanged(const QStringList &l)
{
emit filesChanged(l);
}
} // Internal
} // Git
......@@ -57,6 +57,8 @@ public:
virtual bool vcsAdd(const QString &fileName);
virtual bool vcsDelete(const QString &filename);
void emitFilesChanged(const QStringList &);
signals:
void enabledChanged(bool);
......
......@@ -454,6 +454,8 @@ void PerforcePlugin::revertCurrentFile()
Core::FileChangeBlocker fcb(fileName);
fcb.setModifiedReload(true);
PerforceResponse result2 = runP4Cmd(QStringList() << QLatin1String("revert") << fileName, QStringList(), CommandToWindow|StdOutToWindow|StdErrToWindow|ErrorToWindow);
if (!result2.error)
m_versionControl->emitFilesChanged(QStringList(fileName));
}
void PerforcePlugin::diffCurrentFile()
......@@ -514,7 +516,10 @@ void PerforcePlugin::updateCheckout(const QStringList &dirs)
{
QStringList args(QLatin1String("sync"));
args.append(dirs);
runP4Cmd(args, QStringList(), CommandToWindow|StdOutToWindow|StdErrToWindow|ErrorToWindow);
const PerforceResponse resp = runP4Cmd(args, QStringList(), CommandToWindow|StdOutToWindow|StdErrToWindow|ErrorToWindow);
if (!dirs.empty())
foreach(const QString &dir, dirs)
m_versionControl->emitRepositoryChanged(dir);
}
void PerforcePlugin::printOpenedFileList()
......
......@@ -94,5 +94,15 @@ QString PerforceVersionControl::findTopLevelForDirectory(const QString &director
return m_plugin->findTopLevelForDirectory(directory);
}
void PerforceVersionControl::emitRepositoryChanged(const QString &s)
{
emit repositoryChanged(s);
}
void PerforceVersionControl::emitFilesChanged(const QStringList &l)
{
emit filesChanged(l);
}
} // Internal
} // Perforce
......@@ -56,6 +56,9 @@ public:
virtual bool vcsAdd(const QString &fileName);
virtual bool vcsDelete(const QString &filename);
void emitRepositoryChanged(const QString &s);
void emitFilesChanged(const QStringList &l);
signals:
void enabledChanged(bool);
......
......@@ -96,3 +96,13 @@ QString SubversionControl::findTopLevelForDirectory(const QString &directory) co
{
return m_plugin->findTopLevelForDirectory(directory);
}
void SubversionControl::emitRepositoryChanged(const QString &s)
{
emit repositoryChanged(s);
}
void SubversionControl::emitFilesChanged(const QStringList &l)
{
emit filesChanged(l);
}
......@@ -56,6 +56,9 @@ public:
virtual bool vcsAdd(const QString &fileName);
virtual bool vcsDelete(const QString &filename);
void emitRepositoryChanged(const QString &);
void emitFilesChanged(const QStringList &);
signals:
void enabledChanged(bool);
......
......@@ -574,6 +574,7 @@ void SubversionPlugin::revertCurrentFile()
const SubversionResponse revertResponse = runSvn(args, subversionShortTimeOut, true);
if (!revertResponse.error) {
fcb.setModifiedReload(true);
m_versionControl->emitFilesChanged(QStringList(file));
}
}
......@@ -750,7 +751,10 @@ void SubversionPlugin::updateProject()
QStringList args(QLatin1String("update"));
args.push_back(QLatin1String(nonInteractiveOptionC));
args.append(topLevels);
runSvn(args, subversionLongTimeOut, true);
const SubversionResponse response = runSvn(args, subversionLongTimeOut, true);
if (!response.error)
foreach(const QString &repo, topLevels)
m_versionControl->emitRepositoryChanged(repo);
}
void SubversionPlugin::annotateCurrentFile()
......
......@@ -56,6 +56,7 @@ namespace Subversion {
namespace Internal {
class SubversionSubmitEditor;
class SubversionControl;
struct SubversionResponse
{
......@@ -131,7 +132,7 @@ private:
const QStringList m_svnDirectories;
SubversionSettings m_settings;
Core::IVersionControl *m_versionControl;
SubversionControl *m_versionControl;
QString m_commitMessageFileName;