Extending Qt Creator Manual | VcsBasePlugin

Extending Qt Creator Manual 4.5.2

# VcsBasePlugin Class

(VcsBase::VcsBasePlugin)

The VcsBasePlugin class is the base class for all version control plugins. More...

Header: | #include <VcsBasePlugin>
Inherits: | ExtensionSystem::IPlugin

- List of all members, including inherited members

## Public Functions

| ~VcsBasePlugin() override
const VcsBasePluginState & | currentState() const
Core::IVersionControl * | versionControl() const

- 10 public functions inherited from ExtensionSystem::IPlugin

## Static Public Members

QString | findRepositoryForDirectory(const QString &dir, const QString &checkFile)
bool | isSshPromptConfigured()
Utils::SynchronousProcessResponse | runVcs(const QString &workingDir, const Utils::FileName &binary, const QStringList &arguments, int timeOutS, unsigned flags = 0, QTextCodec *outputCodec = 0, const QProcessEnvironment &env = QProcessEnvironment())
void | setProcessEnvironment(QProcessEnvironment *e, bool forceCLocale, const QString &sshPasswordPrompt = sshPrompt())
void | setSource(Core::IDocument *document, const QString &source)
QString | source(Core::IDocument *document)
QString | sshPrompt()

## Protected Types

enum | ActionState { NoVcsEnabled, OtherVcsEnabled, VcsEnabled }

## Protected Functions

| VcsBasePlugin()
virtual QString | commitDisplayName() const
void | createRepository()
bool | enableMenuAction(ActionState as, QAction *in) const
T * | initializeVcs(const Core::Context &context, Args &&... args)
bool | promptBeforeCommit()
void | promptToDeleteCurrentFile()
bool | raiseSubmitEditor() const
void | setSubmitEditor(VcsBaseSubmitEditor *submitEditor)
VcsBaseSubmitEditor * | submitEditor() const
virtual bool | submitEditorAboutToClose() = 0
virtual void | updateActions(ActionState as) = 0

## Reimplemented Protected Functions

virtual void | extensionsInitialized() override

### Additional Inherited Members

- 1 signal inherited from ExtensionSystem::IPlugin

## Detailed Description

The VcsBasePlugin class is the base class for all version control plugins.

The plugin connects to the relevant change signals in Qt Creator and calls the virtual updateActions() for the plugins to update their menu actions according to the new state. This is done centrally to avoid single plugins repeatedly invoking searches/QFileInfo on files, etc.

Independently, there are accessors for current patch files, which return a file name if the current file could be a patch file which could be applied and a repository exists.

If current file/project are managed by different version controls, the project is discarded and only the current file is taken into account, allowing to do a diff also when the project of a file is not opened.

When triggering an action, a copy of the state should be made to keep it, as it may rapidly change due to context changes, etc.

The class also detects the VCS plugin submit editor closing and calls the virtual submitEditorAboutToClose() to trigger the submit process.

## Member Type Documentation

### enum VcsBasePlugin::ActionState

## Member Function Documentation

### `[protected]` VcsBasePlugin::VcsBasePlugin()

Default constructs an instance of VcsBasePlugin.

### VcsBasePlugin::~VcsBasePlugin()

Destroys the instance of VcsBasePlugin.

### `[virtual protected]` QString VcsBasePlugin::commitDisplayName() const

### `[protected]` void VcsBasePlugin::createRepository()

### const VcsBasePluginState &VcsBasePlugin::currentState() const

### `[protected]` bool VcsBasePlugin::enableMenuAction(ActionState as, QAction *in) const

### `[override virtual protected]` void VcsBasePlugin::extensionsInitialized()

### `[static]` QString VcsBasePlugin::findRepositoryForDirectory(const QString &dir, const QString &checkFile)

### `[protected]` T *VcsBasePlugin::initializeVcs(const Core::Context &context, Args &&... args)

### `[static]` bool VcsBasePlugin::isSshPromptConfigured()

### `[protected]` bool VcsBasePlugin::promptBeforeCommit()

### `[protected]` void VcsBasePlugin::promptToDeleteCurrentFile()

### `[protected]` bool VcsBasePlugin::raiseSubmitEditor() const

### `[static]` Utils::SynchronousProcessResponse VcsBasePlugin::runVcs(const QString &workingDir, const Utils::FileName &binary, const QStringList &arguments, int timeOutS, unsigned flags = 0, QTextCodec *outputCodec = 0, const QProcessEnvironment &env = QProcessEnvironment())

### `[static]` void VcsBasePlugin::setProcessEnvironment(QProcessEnvironment *e, bool forceCLocale, const QString &sshPasswordPrompt = sshPrompt())

### `[static]` void VcsBasePlugin::setSource(Core::IDocument *document, const QString &source)

See also source().

### `[protected]` void VcsBasePlugin::setSubmitEditor(VcsBaseSubmitEditor *submitEditor)

See also submitEditor().

### `[static]` QString VcsBasePlugin::source(Core::IDocument *document)

See also setSource().

### `[static]` QString VcsBasePlugin::sshPrompt()

### `[protected]` VcsBaseSubmitEditor *VcsBasePlugin::submitEditor() const

See also setSubmitEditor().

### `[pure virtual protected]` bool VcsBasePlugin::submitEditorAboutToClose()

### `[pure virtual protected]` void VcsBasePlugin::updateActions(ActionState as)

### Core::IVersionControl *VcsBasePlugin::versionControl() const