forked from qt-creator/qt-creator
Vcs: Pimpl plugins
Essentially rename all *Plugin into *PluginPrivate, and pull out the actual IPlugin related pieces into new *Plugin classes. Shift the construction of the PluginPrivate to initialize(), following the general pattern. I tried to keep the patch as mechanical as possible, giving room to some obvious but less mechanical cleanup needs, that are intentionally left out of this here. Change-Id: Iac662bf73338f9f7669064ed67b960246875c23c Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -129,24 +129,36 @@ const VcsBaseSubmitEditorParameters submitEditorParameters = {
|
||||
};
|
||||
|
||||
|
||||
BazaarPlugin *BazaarPlugin::m_instance = nullptr;
|
||||
static BazaarPluginPrivate *dd = nullptr;
|
||||
|
||||
BazaarPlugin::BazaarPlugin()
|
||||
BazaarPluginPrivate::~BazaarPluginPrivate()
|
||||
{
|
||||
m_instance = this;
|
||||
delete m_client;
|
||||
m_client = nullptr;
|
||||
}
|
||||
|
||||
BazaarPlugin::~BazaarPlugin()
|
||||
{
|
||||
delete m_client;
|
||||
m_client = nullptr;
|
||||
m_instance = nullptr;
|
||||
delete dd;
|
||||
dd = nullptr;
|
||||
}
|
||||
|
||||
bool BazaarPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
{
|
||||
Q_UNUSED(arguments)
|
||||
Q_UNUSED(errorMessage)
|
||||
dd = new BazaarPluginPrivate;
|
||||
return true;
|
||||
}
|
||||
|
||||
void BazaarPlugin::extensionsInitialized()
|
||||
{
|
||||
dd->extensionsInitialized();
|
||||
}
|
||||
|
||||
BazaarPluginPrivate::BazaarPluginPrivate()
|
||||
{
|
||||
dd = this;
|
||||
|
||||
Context context(Constants::BAZAAR_CONTEXT);
|
||||
|
||||
@@ -173,21 +185,19 @@ bool BazaarPlugin::initialize(const QStringList &arguments, QString *errorMessag
|
||||
m_commandLocator = new CommandLocator("Bazaar", prefix, prefix, this);
|
||||
|
||||
createMenu(context);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
BazaarPlugin *BazaarPlugin::instance()
|
||||
BazaarPluginPrivate *BazaarPluginPrivate::instance()
|
||||
{
|
||||
return m_instance;
|
||||
return dd;
|
||||
}
|
||||
|
||||
BazaarClient *BazaarPlugin::client() const
|
||||
BazaarClient *BazaarPluginPrivate::client() const
|
||||
{
|
||||
return m_client;
|
||||
}
|
||||
|
||||
void BazaarPlugin::createMenu(const Context &context)
|
||||
void BazaarPluginPrivate::createMenu(const Context &context)
|
||||
{
|
||||
// Create menu item for Bazaar
|
||||
m_bazaarContainer = ActionManager::createMenu("Bazaar.BazaarMenu");
|
||||
@@ -207,12 +217,12 @@ void BazaarPlugin::createMenu(const Context &context)
|
||||
m_menuAction = m_bazaarContainer->menu()->menuAction();
|
||||
}
|
||||
|
||||
void BazaarPlugin::createFileActions(const Context &context)
|
||||
void BazaarPluginPrivate::createFileActions(const Context &context)
|
||||
{
|
||||
m_annotateFile = new ParameterAction(tr("Annotate Current File"), tr("Annotate \"%1\""), ParameterAction::EnabledWithParameter, this);
|
||||
Command *command = ActionManager::registerAction(m_annotateFile, ANNOTATE, context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
connect(m_annotateFile, &QAction::triggered, this, &BazaarPlugin::annotateCurrentFile);
|
||||
connect(m_annotateFile, &QAction::triggered, this, &BazaarPluginPrivate::annotateCurrentFile);
|
||||
m_bazaarContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
@@ -220,7 +230,7 @@ void BazaarPlugin::createFileActions(const Context &context)
|
||||
command = ActionManager::registerAction(m_diffFile, DIFF, context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
command->setDefaultKeySequence(QKeySequence(useMacShortcuts ? tr("Meta+Z,Meta+D") : tr("ALT+Z,Alt+D")));
|
||||
connect(m_diffFile, &QAction::triggered, this, &BazaarPlugin::diffCurrentFile);
|
||||
connect(m_diffFile, &QAction::triggered, this, &BazaarPluginPrivate::diffCurrentFile);
|
||||
m_bazaarContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
@@ -228,7 +238,7 @@ void BazaarPlugin::createFileActions(const Context &context)
|
||||
command = ActionManager::registerAction(m_logFile, LOG, context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
command->setDefaultKeySequence(QKeySequence(useMacShortcuts ? tr("Meta+Z,Meta+L") : tr("ALT+Z,Alt+L")));
|
||||
connect(m_logFile, &QAction::triggered, this, &BazaarPlugin::logCurrentFile);
|
||||
connect(m_logFile, &QAction::triggered, this, &BazaarPluginPrivate::logCurrentFile);
|
||||
m_bazaarContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
@@ -236,7 +246,7 @@ void BazaarPlugin::createFileActions(const Context &context)
|
||||
command = ActionManager::registerAction(m_statusFile, STATUS, context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
command->setDefaultKeySequence(QKeySequence(useMacShortcuts ? tr("Meta+Z,Meta+S") : tr("ALT+Z,Alt+S")));
|
||||
connect(m_statusFile, &QAction::triggered, this, &BazaarPlugin::statusCurrentFile);
|
||||
connect(m_statusFile, &QAction::triggered, this, &BazaarPluginPrivate::statusCurrentFile);
|
||||
m_bazaarContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
@@ -245,47 +255,47 @@ void BazaarPlugin::createFileActions(const Context &context)
|
||||
m_addAction = new ParameterAction(tr("Add"), tr("Add \"%1\""), ParameterAction::EnabledWithParameter, this);
|
||||
command = ActionManager::registerAction(m_addAction, ADD, context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
connect(m_addAction, &QAction::triggered, this, &BazaarPlugin::addCurrentFile);
|
||||
connect(m_addAction, &QAction::triggered, this, &BazaarPluginPrivate::addCurrentFile);
|
||||
m_bazaarContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
m_deleteAction = new ParameterAction(tr("Delete..."), tr("Delete \"%1\"..."), ParameterAction::EnabledWithParameter, this);
|
||||
command = ActionManager::registerAction(m_deleteAction, DELETE, context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
connect(m_deleteAction, &QAction::triggered, this, &BazaarPlugin::promptToDeleteCurrentFile);
|
||||
connect(m_deleteAction, &QAction::triggered, this, &BazaarPluginPrivate::promptToDeleteCurrentFile);
|
||||
m_bazaarContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
m_revertFile = new ParameterAction(tr("Revert Current File..."), tr("Revert \"%1\"..."), ParameterAction::EnabledWithParameter, this);
|
||||
command = ActionManager::registerAction(m_revertFile, REVERT, context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
connect(m_revertFile, &QAction::triggered, this, &BazaarPlugin::revertCurrentFile);
|
||||
connect(m_revertFile, &QAction::triggered, this, &BazaarPluginPrivate::revertCurrentFile);
|
||||
m_bazaarContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
}
|
||||
|
||||
void BazaarPlugin::addCurrentFile()
|
||||
void BazaarPluginPrivate::addCurrentFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
m_client->synchronousAdd(state.currentFileTopLevel(), state.relativeCurrentFile());
|
||||
}
|
||||
|
||||
void BazaarPlugin::annotateCurrentFile()
|
||||
void BazaarPluginPrivate::annotateCurrentFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
m_client->annotate(state.currentFileTopLevel(), state.relativeCurrentFile());
|
||||
}
|
||||
|
||||
void BazaarPlugin::diffCurrentFile()
|
||||
void BazaarPluginPrivate::diffCurrentFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
m_client->diff(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()));
|
||||
}
|
||||
|
||||
void BazaarPlugin::logCurrentFile()
|
||||
void BazaarPluginPrivate::logCurrentFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
@@ -293,7 +303,7 @@ void BazaarPlugin::logCurrentFile()
|
||||
QStringList(), true);
|
||||
}
|
||||
|
||||
void BazaarPlugin::revertCurrentFile()
|
||||
void BazaarPluginPrivate::revertCurrentFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
@@ -308,53 +318,53 @@ void BazaarPlugin::revertCurrentFile()
|
||||
revertUi.revisionLineEdit->text());
|
||||
}
|
||||
|
||||
void BazaarPlugin::statusCurrentFile()
|
||||
void BazaarPluginPrivate::statusCurrentFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
m_client->status(state.currentFileTopLevel(), state.relativeCurrentFile());
|
||||
}
|
||||
|
||||
void BazaarPlugin::createDirectoryActions(const Context &context)
|
||||
void BazaarPluginPrivate::createDirectoryActions(const Context &context)
|
||||
{
|
||||
auto action = new QAction(tr("Diff"), this);
|
||||
m_repositoryActionList.append(action);
|
||||
Command *command = ActionManager::registerAction(action, DIFFMULTI, context);
|
||||
connect(action, &QAction::triggered, this, &BazaarPlugin::diffRepository);
|
||||
connect(action, &QAction::triggered, this, &BazaarPluginPrivate::diffRepository);
|
||||
m_bazaarContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
action = new QAction(tr("Log"), this);
|
||||
m_repositoryActionList.append(action);
|
||||
command = ActionManager::registerAction(action, LOGMULTI, context);
|
||||
connect(action, &QAction::triggered, this, &BazaarPlugin::logRepository);
|
||||
connect(action, &QAction::triggered, this, &BazaarPluginPrivate::logRepository);
|
||||
m_bazaarContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
action = new QAction(tr("Revert..."), this);
|
||||
m_repositoryActionList.append(action);
|
||||
command = ActionManager::registerAction(action, REVERTMULTI, context);
|
||||
connect(action, &QAction::triggered, this, &BazaarPlugin::revertAll);
|
||||
connect(action, &QAction::triggered, this, &BazaarPluginPrivate::revertAll);
|
||||
m_bazaarContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
action = new QAction(tr("Status"), this);
|
||||
m_repositoryActionList.append(action);
|
||||
command = ActionManager::registerAction(action, STATUSMULTI, context);
|
||||
connect(action, &QAction::triggered, this, &BazaarPlugin::statusMulti);
|
||||
connect(action, &QAction::triggered, this, &BazaarPluginPrivate::statusMulti);
|
||||
m_bazaarContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
}
|
||||
|
||||
|
||||
void BazaarPlugin::diffRepository()
|
||||
void BazaarPluginPrivate::diffRepository()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
m_client->diff(state.topLevel());
|
||||
}
|
||||
|
||||
void BazaarPlugin::logRepository()
|
||||
void BazaarPluginPrivate::logRepository()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
@@ -363,7 +373,7 @@ void BazaarPlugin::logRepository()
|
||||
m_client->log(state.topLevel(), QStringList(), extraOptions);
|
||||
}
|
||||
|
||||
void BazaarPlugin::revertAll()
|
||||
void BazaarPluginPrivate::revertAll()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
@@ -376,33 +386,33 @@ void BazaarPlugin::revertAll()
|
||||
m_client->revertAll(state.topLevel(), revertUi.revisionLineEdit->text());
|
||||
}
|
||||
|
||||
void BazaarPlugin::statusMulti()
|
||||
void BazaarPluginPrivate::statusMulti()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
m_client->status(state.topLevel());
|
||||
}
|
||||
|
||||
void BazaarPlugin::createRepositoryActions(const Context &context)
|
||||
void BazaarPluginPrivate::createRepositoryActions(const Context &context)
|
||||
{
|
||||
auto action = new QAction(tr("Pull..."), this);
|
||||
m_repositoryActionList.append(action);
|
||||
Command *command = ActionManager::registerAction(action, PULL, context);
|
||||
connect(action, &QAction::triggered, this, &BazaarPlugin::pull);
|
||||
connect(action, &QAction::triggered, this, &BazaarPluginPrivate::pull);
|
||||
m_bazaarContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
action = new QAction(tr("Push..."), this);
|
||||
m_repositoryActionList.append(action);
|
||||
command = ActionManager::registerAction(action, PUSH, context);
|
||||
connect(action, &QAction::triggered, this, &BazaarPlugin::push);
|
||||
connect(action, &QAction::triggered, this, &BazaarPluginPrivate::push);
|
||||
m_bazaarContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
action = new QAction(tr("Update..."), this);
|
||||
m_repositoryActionList.append(action);
|
||||
command = ActionManager::registerAction(action, UPDATE, context);
|
||||
connect(action, &QAction::triggered, this, &BazaarPlugin::update);
|
||||
connect(action, &QAction::triggered, this, &BazaarPluginPrivate::update);
|
||||
m_bazaarContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
@@ -410,24 +420,24 @@ void BazaarPlugin::createRepositoryActions(const Context &context)
|
||||
m_repositoryActionList.append(action);
|
||||
command = ActionManager::registerAction(action, COMMIT, context);
|
||||
command->setDefaultKeySequence(QKeySequence(useMacShortcuts ? tr("Meta+Z,Meta+C") : tr("ALT+Z,Alt+C")));
|
||||
connect(action, &QAction::triggered, this, &BazaarPlugin::commit);
|
||||
connect(action, &QAction::triggered, this, &BazaarPluginPrivate::commit);
|
||||
m_bazaarContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
action = new QAction(tr("Uncommit..."), this);
|
||||
m_repositoryActionList.append(action);
|
||||
command = ActionManager::registerAction(action, UNCOMMIT, context);
|
||||
connect(action, &QAction::triggered, this, &BazaarPlugin::uncommit);
|
||||
connect(action, &QAction::triggered, this, &BazaarPluginPrivate::uncommit);
|
||||
m_bazaarContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
auto createRepositoryAction = new QAction(tr("Create Repository..."), this);
|
||||
command = ActionManager::registerAction(createRepositoryAction, CREATE_REPOSITORY, context);
|
||||
connect(createRepositoryAction, &QAction::triggered, this, &BazaarPlugin::createRepository);
|
||||
connect(createRepositoryAction, &QAction::triggered, this, &BazaarPluginPrivate::createRepository);
|
||||
m_bazaarContainer->addAction(command);
|
||||
}
|
||||
|
||||
void BazaarPlugin::pull()
|
||||
void BazaarPluginPrivate::pull()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
@@ -447,7 +457,7 @@ void BazaarPlugin::pull()
|
||||
m_client->synchronousPull(state.topLevel(), dialog.branchLocation(), extraOptions);
|
||||
}
|
||||
|
||||
void BazaarPlugin::push()
|
||||
void BazaarPluginPrivate::push()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
@@ -469,7 +479,7 @@ void BazaarPlugin::push()
|
||||
m_client->synchronousPush(state.topLevel(), dialog.branchLocation(), extraOptions);
|
||||
}
|
||||
|
||||
void BazaarPlugin::update()
|
||||
void BazaarPluginPrivate::update()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
@@ -483,7 +493,7 @@ void BazaarPlugin::update()
|
||||
m_client->update(state.topLevel(), revertUi.revisionLineEdit->text());
|
||||
}
|
||||
|
||||
void BazaarPlugin::commit()
|
||||
void BazaarPluginPrivate::commit()
|
||||
{
|
||||
if (!promptBeforeCommit())
|
||||
return;
|
||||
@@ -497,16 +507,16 @@ void BazaarPlugin::commit()
|
||||
m_submitRepository = state.topLevel();
|
||||
|
||||
QObject::connect(m_client, &VcsBaseClient::parsedStatus,
|
||||
this, &BazaarPlugin::showCommitWidget);
|
||||
this, &BazaarPluginPrivate::showCommitWidget);
|
||||
// The "--short" option allows to easily parse status output
|
||||
m_client->emitParsedStatus(m_submitRepository, QStringList(QLatin1String("--short")));
|
||||
}
|
||||
|
||||
void BazaarPlugin::showCommitWidget(const QList<VcsBaseClient::StatusItem> &status)
|
||||
void BazaarPluginPrivate::showCommitWidget(const QList<VcsBaseClient::StatusItem> &status)
|
||||
{
|
||||
//Once we receive our data release the connection so it can be reused elsewhere
|
||||
QObject::disconnect(m_client, &VcsBaseClient::parsedStatus,
|
||||
this, &BazaarPlugin::showCommitWidget);
|
||||
this, &BazaarPluginPrivate::showCommitWidget);
|
||||
|
||||
if (status.isEmpty()) {
|
||||
VcsOutputWindow::appendError(tr("There are no changes to commit."));
|
||||
@@ -537,7 +547,7 @@ void BazaarPlugin::showCommitWidget(const QList<VcsBaseClient::StatusItem> &stat
|
||||
setSubmitEditor(commitEditor);
|
||||
|
||||
connect(commitEditor, &VcsBaseSubmitEditor::diffSelectedFiles,
|
||||
this, &BazaarPlugin::diffFromEditorSelected);
|
||||
this, &BazaarPluginPrivate::diffFromEditorSelected);
|
||||
commitEditor->setCheckScriptWorkingDirectory(m_submitRepository);
|
||||
|
||||
const QString msg = tr("Commit changes for \"%1\".").
|
||||
@@ -551,7 +561,7 @@ void BazaarPlugin::showCommitWidget(const QList<VcsBaseClient::StatusItem> &stat
|
||||
s.stringValue(BazaarSettings::userEmailKey), status);
|
||||
}
|
||||
|
||||
void BazaarPlugin::diffFromEditorSelected(const QStringList &files)
|
||||
void BazaarPluginPrivate::diffFromEditorSelected(const QStringList &files)
|
||||
{
|
||||
m_client->diff(m_submitRepository, files);
|
||||
}
|
||||
@@ -612,7 +622,7 @@ void BazaarPlugin::testLogResolving()
|
||||
}
|
||||
#endif
|
||||
|
||||
void BazaarPlugin::commitFromEditor()
|
||||
void BazaarPluginPrivate::commitFromEditor()
|
||||
{
|
||||
// Close the submit editor
|
||||
m_submitActionTriggered = true;
|
||||
@@ -620,7 +630,7 @@ void BazaarPlugin::commitFromEditor()
|
||||
EditorManager::closeDocument(submitEditor()->document());
|
||||
}
|
||||
|
||||
void BazaarPlugin::uncommit()
|
||||
void BazaarPluginPrivate::uncommit()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
@@ -630,7 +640,7 @@ void BazaarPlugin::uncommit()
|
||||
m_client->synchronousUncommit(state.topLevel(), dialog.revision(), dialog.extraOptions());
|
||||
}
|
||||
|
||||
bool BazaarPlugin::submitEditorAboutToClose()
|
||||
bool BazaarPluginPrivate::submitEditorAboutToClose()
|
||||
{
|
||||
auto commitEditor = qobject_cast<CommitEditor *>(submitEditor());
|
||||
QTC_ASSERT(commitEditor, return true);
|
||||
@@ -682,7 +692,7 @@ bool BazaarPlugin::submitEditorAboutToClose()
|
||||
return true;
|
||||
}
|
||||
|
||||
void BazaarPlugin::updateActions(VcsBasePlugin::ActionState as)
|
||||
void BazaarPluginPrivate::updateActions(VcsBasePluginPrivate::ActionState as)
|
||||
{
|
||||
if (!enableMenuAction(as, m_menuAction)) {
|
||||
m_commandLocator->setEnabled(false);
|
||||
|
@@ -51,29 +51,20 @@ class BazaarClient;
|
||||
class BazaarControl;
|
||||
class BazaarEditorWidget;
|
||||
|
||||
class BazaarPlugin : public VcsBase::VcsBasePlugin
|
||||
class BazaarPluginPrivate final : public VcsBase::VcsBasePluginPrivate
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Bazaar.json")
|
||||
|
||||
public:
|
||||
BazaarPlugin();
|
||||
~BazaarPlugin() override;
|
||||
bool initialize(const QStringList &arguments, QString *errorMessage) override;
|
||||
BazaarPluginPrivate();
|
||||
~BazaarPluginPrivate() final;
|
||||
|
||||
static BazaarPlugin *instance();
|
||||
static BazaarPluginPrivate *instance();
|
||||
BazaarClient *client() const;
|
||||
|
||||
protected:
|
||||
void updateActions(VcsBase::VcsBasePlugin::ActionState) override;
|
||||
bool submitEditorAboutToClose() override;
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
private slots:
|
||||
void testDiffFileResolving_data();
|
||||
void testDiffFileResolving();
|
||||
void testLogResolving();
|
||||
#endif
|
||||
void updateActions(VcsBase::VcsBasePluginPrivate::ActionState) final;
|
||||
bool submitEditorAboutToClose() final;
|
||||
|
||||
private:
|
||||
// File menu action slots
|
||||
@@ -107,8 +98,6 @@ private:
|
||||
void createRepositoryActions(const Core::Context &context);
|
||||
|
||||
// Variables
|
||||
static BazaarPlugin *m_instance;
|
||||
|
||||
BazaarSettings m_bazaarSettings;
|
||||
BazaarClient *m_client = nullptr;
|
||||
|
||||
@@ -132,5 +121,23 @@ private:
|
||||
bool m_submitActionTriggered = false;
|
||||
};
|
||||
|
||||
class BazaarPlugin final : public ExtensionSystem::IPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Bazaar.json")
|
||||
|
||||
~BazaarPlugin() final;
|
||||
|
||||
bool initialize(const QStringList &arguments, QString *errorMessage) final;
|
||||
void extensionsInitialized() final;
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
private slots:
|
||||
void testDiffFileResolving_data();
|
||||
void testDiffFileResolving();
|
||||
void testLogResolving();
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Bazaar
|
||||
|
@@ -54,7 +54,7 @@ private:
|
||||
|
||||
void OptionsPageWidget::apply()
|
||||
{
|
||||
VcsBaseClientSettings s = BazaarPlugin::instance()->client()->settings();
|
||||
VcsBaseClientSettings s = BazaarPluginPrivate::instance()->client()->settings();
|
||||
s.setValue(BazaarSettings::binaryPathKey, m_ui.commandChooser->rawPath());
|
||||
s.setValue(BazaarSettings::userNameKey, m_ui.defaultUsernameLineEdit->text().trimmed());
|
||||
s.setValue(BazaarSettings::userEmailKey, m_ui.defaultEmailLineEdit->text().trimmed());
|
||||
@@ -68,7 +68,7 @@ void OptionsPageWidget::apply()
|
||||
}
|
||||
|
||||
OptionsPageWidget::OptionsPageWidget(Core::IVersionControl *control)
|
||||
: m_control(control), m_client(BazaarPlugin::instance()->client())
|
||||
: m_control(control), m_client(BazaarPluginPrivate::instance()->client())
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
m_ui.commandChooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
|
||||
|
@@ -68,7 +68,7 @@ QString UnCommitDialog::revision() const
|
||||
|
||||
void UnCommitDialog::dryRun()
|
||||
{
|
||||
BazaarPlugin* bzrPlugin = BazaarPlugin::instance();
|
||||
BazaarPluginPrivate *bzrPlugin = BazaarPluginPrivate::instance();
|
||||
QTC_ASSERT(bzrPlugin->currentState().hasTopLevel(), return);
|
||||
bzrPlugin->client()->synchronousUncommit(bzrPlugin->currentState().topLevel(),
|
||||
revision(),
|
||||
|
@@ -39,7 +39,7 @@ using namespace ClearCase;
|
||||
using namespace ClearCase::Internal;
|
||||
|
||||
ActivitySelector::ActivitySelector(QWidget *parent) : QWidget(parent),
|
||||
m_plugin(ClearCasePlugin::instance())
|
||||
m_plugin(ClearCasePluginPrivate::instance())
|
||||
{
|
||||
QTC_ASSERT(m_plugin->isUcm(), return);
|
||||
|
||||
|
@@ -35,7 +35,7 @@ QT_END_NAMESPACE
|
||||
namespace ClearCase {
|
||||
namespace Internal {
|
||||
|
||||
class ClearCasePlugin;
|
||||
class ClearCasePluginPrivate;
|
||||
|
||||
class ActivitySelector : public QWidget
|
||||
{
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
private:
|
||||
void userChanged();
|
||||
|
||||
ClearCasePlugin *m_plugin = nullptr;
|
||||
ClearCasePluginPrivate *m_plugin = nullptr;
|
||||
bool m_changed = false;
|
||||
QComboBox *m_cmbActivity = nullptr;
|
||||
};
|
||||
|
@@ -36,7 +36,7 @@
|
||||
using namespace ClearCase;
|
||||
using namespace ClearCase::Internal;
|
||||
|
||||
ClearCaseControl::ClearCaseControl(ClearCasePlugin *plugin) : m_plugin(plugin)
|
||||
ClearCaseControl::ClearCaseControl(ClearCasePluginPrivate *plugin) : m_plugin(plugin)
|
||||
{ }
|
||||
|
||||
QString ClearCaseControl::displayName() const
|
||||
|
@@ -31,14 +31,14 @@
|
||||
namespace ClearCase {
|
||||
namespace Internal {
|
||||
|
||||
class ClearCasePlugin;
|
||||
class ClearCasePluginPrivate;
|
||||
|
||||
// Just a proxy for ClearCasePlugin
|
||||
class ClearCaseControl : public Core::IVersionControl
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ClearCaseControl(ClearCasePlugin *plugin);
|
||||
explicit ClearCaseControl(ClearCasePluginPrivate *plugin);
|
||||
QString displayName() const final;
|
||||
Core::Id id() const final;
|
||||
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
void emitConfigurationChanged();
|
||||
|
||||
private:
|
||||
ClearCasePlugin *const m_plugin;
|
||||
ClearCasePluginPrivate *const m_plugin;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -104,18 +104,14 @@ public:
|
||||
QString root;
|
||||
};
|
||||
|
||||
class ClearCasePlugin : public VcsBase::VcsBasePlugin
|
||||
class ClearCasePluginPrivate final : public VcsBase::VcsBasePluginPrivate
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "ClearCase.json")
|
||||
|
||||
enum { SilentRun = VcsBase::VcsCommand::NoOutput | VcsBase::VcsCommand::FullySynchronously };
|
||||
|
||||
public:
|
||||
ClearCasePlugin();
|
||||
~ClearCasePlugin() override;
|
||||
|
||||
bool initialize(const QStringList &arguments, QString *error_message) override;
|
||||
ClearCasePluginPrivate();
|
||||
~ClearCasePluginPrivate() final;
|
||||
|
||||
ClearCaseSubmitEditor *openClearCaseSubmitEditor(const QString &fileName, bool isUcm);
|
||||
|
||||
@@ -135,7 +131,7 @@ public:
|
||||
bool managesDirectory(const QString &directory, QString *topLevel = nullptr) const;
|
||||
bool vcsCheckout(const QString &directory, const QByteArray &url);
|
||||
|
||||
static ClearCasePlugin *instance();
|
||||
static ClearCasePluginPrivate *instance();
|
||||
|
||||
QString ccGetCurrentActivity() const;
|
||||
QList<QStringPair> activities(int *current = nullptr) const;
|
||||
@@ -168,30 +164,11 @@ public:
|
||||
void describe(const QString &source, const QString &changeNr);
|
||||
|
||||
protected:
|
||||
void updateActions(VcsBase::VcsBasePlugin::ActionState) override;
|
||||
void updateActions(VcsBase::VcsBasePluginPrivate::ActionState) override;
|
||||
bool submitEditorAboutToClose() override;
|
||||
QString ccGet(const QString &workingDir, const QString &file, const QString &prefix = QString());
|
||||
QList<QStringPair> ccGetActivities() const;
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
private slots:
|
||||
void initTestCase();
|
||||
void cleanupTestCase();
|
||||
void testDiffFileResolving_data();
|
||||
void testDiffFileResolving();
|
||||
void testLogResolving();
|
||||
void testFileStatusParsing_data();
|
||||
void testFileStatusParsing();
|
||||
void testFileNotManaged();
|
||||
void testFileCheckedOutDynamicView();
|
||||
void testFileCheckedInDynamicView();
|
||||
void testFileNotManagedDynamicView();
|
||||
void testStatusActions_data();
|
||||
void testStatusActions();
|
||||
void testVcsStatusDynamicReadonlyNotManaged();
|
||||
void testVcsStatusDynamicNotManaged();
|
||||
#endif
|
||||
|
||||
private:
|
||||
void syncSlot();
|
||||
Q_INVOKABLE void updateStatusActions();
|
||||
@@ -287,12 +264,42 @@ private:
|
||||
QList<QStringPair> m_activities;
|
||||
QSharedPointer<StatusMap> m_statusMap;
|
||||
|
||||
static ClearCasePlugin *m_clearcasePluginInstance;
|
||||
friend class ClearCasePlugin;
|
||||
#ifdef WITH_TESTS
|
||||
bool m_fakeClearTool = false;
|
||||
QString m_tempFile;
|
||||
#endif
|
||||
};
|
||||
|
||||
class ClearCasePlugin final : public ExtensionSystem::IPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "ClearCase.json")
|
||||
|
||||
~ClearCasePlugin() final;
|
||||
|
||||
bool initialize(const QStringList &arguments, QString *error_message) final;
|
||||
void extensionsInitialized() final;
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
private slots:
|
||||
void initTestCase();
|
||||
void cleanupTestCase();
|
||||
void testDiffFileResolving_data();
|
||||
void testDiffFileResolving();
|
||||
void testLogResolving();
|
||||
void testFileStatusParsing_data();
|
||||
void testFileStatusParsing();
|
||||
void testFileNotManaged();
|
||||
void testFileCheckedOutDynamicView();
|
||||
void testFileCheckedInDynamicView();
|
||||
void testFileNotManagedDynamicView();
|
||||
void testStatusActions_data();
|
||||
void testStatusActions();
|
||||
void testVcsStatusDynamicReadonlyNotManaged();
|
||||
void testVcsStatusDynamicNotManaged();
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ClearCase
|
||||
|
@@ -41,7 +41,7 @@
|
||||
namespace ClearCase {
|
||||
namespace Internal {
|
||||
|
||||
ClearCaseSync::ClearCaseSync(ClearCasePlugin *plugin, QSharedPointer<StatusMap> statusMap) :
|
||||
ClearCaseSync::ClearCaseSync(ClearCasePluginPrivate *plugin, QSharedPointer<StatusMap> statusMap) :
|
||||
m_plugin(plugin),
|
||||
m_statusMap(statusMap)
|
||||
{ }
|
||||
|
@@ -34,7 +34,7 @@ class ClearCaseSync : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ClearCaseSync(ClearCasePlugin *plugin, QSharedPointer<StatusMap> statusMap);
|
||||
explicit ClearCaseSync(ClearCasePluginPrivate *plugin, QSharedPointer<StatusMap> statusMap);
|
||||
void run(QFutureInterface<void> &future, QStringList &files);
|
||||
|
||||
QStringList updateStatusHotFiles(const QString &viewRoot, int &total);
|
||||
@@ -55,7 +55,7 @@ signals:
|
||||
void updateStreamAndView();
|
||||
|
||||
private:
|
||||
ClearCasePlugin *const m_plugin;
|
||||
ClearCasePluginPrivate *const m_plugin;
|
||||
QSharedPointer<StatusMap> m_statusMap;
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
|
@@ -65,7 +65,7 @@ SettingsPageWidget::SettingsPageWidget()
|
||||
m_ui.commandPathChooser->setExpectedKind(PathChooser::ExistingCommand);
|
||||
m_ui.commandPathChooser->setHistoryCompleter(QLatin1String("ClearCase.Command.History"));
|
||||
|
||||
ClearCaseSettings s = ClearCasePlugin::instance()->settings();
|
||||
ClearCaseSettings s = ClearCasePluginPrivate::instance()->settings();
|
||||
|
||||
m_ui.commandPathChooser->setPath(s.ccCommand);
|
||||
m_ui.timeOutSpinBox->setValue(s.timeOutS);
|
||||
@@ -117,7 +117,7 @@ void SettingsPageWidget::apply()
|
||||
rc.indexOnlyVOBs = m_ui.indexOnlyVOBsEdit->text();
|
||||
rc.extDiffAvailable = m_ui.externalDiffRadioButton->isEnabled();
|
||||
|
||||
ClearCasePlugin::instance()->setSettings(rc);
|
||||
ClearCasePluginPrivate::instance()->setSettings(rc);
|
||||
}
|
||||
|
||||
ClearCaseSettingsPage::ClearCaseSettingsPage(QObject *parent)
|
||||
|
@@ -41,7 +41,7 @@
|
||||
using namespace Cvs;
|
||||
using namespace Cvs::Internal;
|
||||
|
||||
CvsControl::CvsControl(CvsPlugin *plugin) :
|
||||
CvsControl::CvsControl(CvsPluginPrivate *plugin) :
|
||||
m_plugin(plugin)
|
||||
{ }
|
||||
|
||||
@@ -143,7 +143,7 @@ Core::ShellCommand *CvsControl::createInitialCheckoutCommand(const QString &url,
|
||||
{
|
||||
QTC_ASSERT(localName == url, return nullptr);
|
||||
|
||||
const CvsSettings settings = CvsPlugin::instance()->client()->settings();
|
||||
const CvsSettings settings = CvsPluginPrivate::instance()->client()->settings();
|
||||
|
||||
QStringList args;
|
||||
args << QLatin1String("checkout") << url << extraArgs;
|
||||
|
@@ -30,7 +30,7 @@
|
||||
namespace Cvs {
|
||||
namespace Internal {
|
||||
|
||||
class CvsPlugin;
|
||||
class CvsPluginPrivate;
|
||||
|
||||
// Just a proxy for CVSPlugin
|
||||
class CvsControl : public Core::IVersionControl
|
||||
@@ -38,7 +38,7 @@ class CvsControl : public Core::IVersionControl
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CvsControl(CvsPlugin *plugin);
|
||||
explicit CvsControl(CvsPluginPrivate *plugin);
|
||||
QString displayName() const final;
|
||||
Core::Id id() const final;
|
||||
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
void emitFilesChanged(const QStringList &l);
|
||||
|
||||
private:
|
||||
CvsPlugin *const m_plugin;
|
||||
CvsPluginPrivate *const m_plugin;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -82,13 +82,13 @@ namespace Internal {
|
||||
|
||||
static inline QString msgCannotFindTopLevel(const QString &f)
|
||||
{
|
||||
return CvsPlugin::tr("Cannot find repository for \"%1\".").
|
||||
return CvsPluginPrivate::tr("Cannot find repository for \"%1\".").
|
||||
arg(QDir::toNativeSeparators(f));
|
||||
}
|
||||
|
||||
static inline QString msgLogParsingFailed()
|
||||
{
|
||||
return CvsPlugin::tr("Parsing of the log output failed.");
|
||||
return CvsPluginPrivate::tr("Parsing of the log output failed.");
|
||||
}
|
||||
|
||||
const char CVS_CONTEXT[] = "CVS Context";
|
||||
@@ -155,21 +155,22 @@ static inline bool messageBoxQuestion(const QString &title, const QString &quest
|
||||
}
|
||||
|
||||
// ------------- CVSPlugin
|
||||
CvsPlugin *CvsPlugin::m_cvsPluginInstance = nullptr;
|
||||
|
||||
CvsPlugin::~CvsPlugin()
|
||||
static CvsPluginPrivate *dd = nullptr;
|
||||
|
||||
CvsPluginPrivate::~CvsPluginPrivate()
|
||||
{
|
||||
delete m_client;
|
||||
cleanCommitMessageFile();
|
||||
}
|
||||
|
||||
CvsClient *CvsPlugin::client() const
|
||||
CvsClient *CvsPluginPrivate::client() const
|
||||
{
|
||||
QTC_CHECK(m_client);
|
||||
return m_client;
|
||||
}
|
||||
|
||||
void CvsPlugin::cleanCommitMessageFile()
|
||||
void CvsPluginPrivate::cleanCommitMessageFile()
|
||||
{
|
||||
if (!m_commitMessageFileName.isEmpty()) {
|
||||
QFile::remove(m_commitMessageFileName);
|
||||
@@ -177,7 +178,7 @@ void CvsPlugin::cleanCommitMessageFile()
|
||||
m_commitRepository.clear();
|
||||
}
|
||||
}
|
||||
bool CvsPlugin::isCommitEditorOpen() const
|
||||
bool CvsPluginPrivate::isCommitEditorOpen() const
|
||||
{
|
||||
return !m_commitMessageFileName.isEmpty();
|
||||
}
|
||||
@@ -189,10 +190,27 @@ static const VcsBaseSubmitEditorParameters submitParameters = {
|
||||
VcsBaseSubmitEditorParameters::DiffFiles
|
||||
};
|
||||
|
||||
CvsPlugin::~CvsPlugin()
|
||||
{
|
||||
delete dd;
|
||||
dd = nullptr;
|
||||
}
|
||||
|
||||
bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
{
|
||||
Q_UNUSED(arguments)
|
||||
Q_UNUSED(errorMessage)
|
||||
dd = new CvsPluginPrivate;
|
||||
return true;
|
||||
}
|
||||
|
||||
void CvsPlugin::extensionsInitialized()
|
||||
{
|
||||
dd->extensionsInitialized();
|
||||
}
|
||||
|
||||
CvsPluginPrivate::CvsPluginPrivate()
|
||||
{
|
||||
using namespace Core::Constants;
|
||||
|
||||
Context context(CVS_CONTEXT);
|
||||
@@ -200,8 +218,6 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
auto vcsCtrl = new CvsControl(this);
|
||||
initializeVcs(vcsCtrl, context);
|
||||
|
||||
m_cvsPluginInstance = this;
|
||||
|
||||
m_client = new CvsClient;
|
||||
|
||||
new SettingsPage(versionControl(), this);
|
||||
@@ -237,7 +253,7 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
CMD_ID_DIFF_CURRENT, context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
command->setDefaultKeySequence(QKeySequence(useMacShortcuts ? tr("Meta+C,Meta+D") : tr("Alt+C,Alt+D")));
|
||||
connect(m_diffCurrentAction, &QAction::triggered, this, &CvsPlugin::diffCurrentFile);
|
||||
connect(m_diffCurrentAction, &QAction::triggered, this, &CvsPluginPrivate::diffCurrentFile);
|
||||
cvsMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
@@ -245,7 +261,7 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
command = ActionManager::registerAction(m_filelogCurrentAction,
|
||||
CMD_ID_FILELOG_CURRENT, context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
connect(m_filelogCurrentAction, &QAction::triggered, this, &CvsPlugin::filelogCurrentFile);
|
||||
connect(m_filelogCurrentAction, &QAction::triggered, this, &CvsPluginPrivate::filelogCurrentFile);
|
||||
cvsMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
@@ -253,7 +269,7 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
command = ActionManager::registerAction(m_annotateCurrentAction,
|
||||
CMD_ID_ANNOTATE_CURRENT, context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
connect(m_annotateCurrentAction, &QAction::triggered, this, &CvsPlugin::annotateCurrentFile);
|
||||
connect(m_annotateCurrentAction, &QAction::triggered, this, &CvsPluginPrivate::annotateCurrentFile);
|
||||
cvsMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
@@ -264,7 +280,7 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
command->setDefaultKeySequence(QKeySequence(useMacShortcuts ? tr("Meta+C,Meta+A") : tr("Alt+C,Alt+A")));
|
||||
connect(m_addAction, &QAction::triggered, this, &CvsPlugin::addCurrentFile);
|
||||
connect(m_addAction, &QAction::triggered, this, &CvsPluginPrivate::addCurrentFile);
|
||||
cvsMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
@@ -273,7 +289,7 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
CMD_ID_COMMIT_CURRENT, context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
command->setDefaultKeySequence(QKeySequence(useMacShortcuts ? tr("Meta+C,Meta+C") : tr("Alt+C,Alt+C")));
|
||||
connect(m_commitCurrentAction, &QAction::triggered, this, &CvsPlugin::startCommitCurrentFile);
|
||||
connect(m_commitCurrentAction, &QAction::triggered, this, &CvsPluginPrivate::startCommitCurrentFile);
|
||||
cvsMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
@@ -281,7 +297,7 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
command = ActionManager::registerAction(m_deleteAction, CMD_ID_DELETE_FILE,
|
||||
context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
connect(m_deleteAction, &QAction::triggered, this, &CvsPlugin::promptToDeleteCurrentFile);
|
||||
connect(m_deleteAction, &QAction::triggered, this, &CvsPluginPrivate::promptToDeleteCurrentFile);
|
||||
cvsMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
@@ -289,7 +305,7 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
command = ActionManager::registerAction(m_revertAction, CMD_ID_REVERT,
|
||||
context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
connect(m_revertAction, &QAction::triggered, this, &CvsPlugin::revertCurrentFile);
|
||||
connect(m_revertAction, &QAction::triggered, this, &CvsPluginPrivate::revertCurrentFile);
|
||||
cvsMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
@@ -298,20 +314,20 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
m_editCurrentAction = new ParameterAction(tr("Edit"), tr("Edit \"%1\""), ParameterAction::EnabledWithParameter, this);
|
||||
command = ActionManager::registerAction(m_editCurrentAction, CMD_ID_EDIT_FILE, context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
connect(m_editCurrentAction, &QAction::triggered, this, &CvsPlugin::editCurrentFile);
|
||||
connect(m_editCurrentAction, &QAction::triggered, this, &CvsPluginPrivate::editCurrentFile);
|
||||
cvsMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
m_uneditCurrentAction = new ParameterAction(tr("Unedit"), tr("Unedit \"%1\""), ParameterAction::EnabledWithParameter, this);
|
||||
command = ActionManager::registerAction(m_uneditCurrentAction, CMD_ID_UNEDIT_FILE, context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
connect(m_uneditCurrentAction, &QAction::triggered, this, &CvsPlugin::uneditCurrentFile);
|
||||
connect(m_uneditCurrentAction, &QAction::triggered, this, &CvsPluginPrivate::uneditCurrentFile);
|
||||
cvsMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
m_uneditRepositoryAction = new QAction(tr("Unedit Repository"), this);
|
||||
command = ActionManager::registerAction(m_uneditRepositoryAction, CMD_ID_UNEDIT_REPOSITORY, context);
|
||||
connect(m_uneditRepositoryAction, &QAction::triggered, this, &CvsPlugin::uneditCurrentRepository);
|
||||
connect(m_uneditRepositoryAction, &QAction::triggered, this, &CvsPluginPrivate::uneditCurrentRepository);
|
||||
cvsMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
@@ -321,7 +337,7 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
command = ActionManager::registerAction(m_diffProjectAction, CMD_ID_DIFF_PROJECT,
|
||||
context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
connect(m_diffProjectAction, &QAction::triggered, this, &CvsPlugin::diffProject);
|
||||
connect(m_diffProjectAction, &QAction::triggered, this, &CvsPluginPrivate::diffProject);
|
||||
cvsMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
@@ -329,28 +345,28 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
command = ActionManager::registerAction(m_statusProjectAction, CMD_ID_STATUS,
|
||||
context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
connect(m_statusProjectAction, &QAction::triggered, this, &CvsPlugin::projectStatus);
|
||||
connect(m_statusProjectAction, &QAction::triggered, this, &CvsPluginPrivate::projectStatus);
|
||||
cvsMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
m_logProjectAction = new ParameterAction(tr("Log Project"), tr("Log Project \"%1\""), ParameterAction::EnabledWithParameter, this);
|
||||
command = ActionManager::registerAction(m_logProjectAction, CMD_ID_PROJECTLOG, context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
connect(m_logProjectAction, &QAction::triggered, this, &CvsPlugin::logProject);
|
||||
connect(m_logProjectAction, &QAction::triggered, this, &CvsPluginPrivate::logProject);
|
||||
cvsMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
m_updateProjectAction = new ParameterAction(tr("Update Project"), tr("Update Project \"%1\""), ParameterAction::EnabledWithParameter, this);
|
||||
command = ActionManager::registerAction(m_updateProjectAction, CMD_ID_UPDATE, context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
connect(m_updateProjectAction, &QAction::triggered, this, &CvsPlugin::updateProject);
|
||||
connect(m_updateProjectAction, &QAction::triggered, this, &CvsPluginPrivate::updateProject);
|
||||
cvsMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
m_commitProjectAction = new ParameterAction(tr("Commit Project"), tr("Commit Project \"%1\""), ParameterAction::EnabledWithParameter, this);
|
||||
command = ActionManager::registerAction(m_commitProjectAction, CMD_ID_PROJECTCOMMIT, context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
connect(m_commitProjectAction, &QAction::triggered, this, &CvsPlugin::commitProject);
|
||||
connect(m_commitProjectAction, &QAction::triggered, this, &CvsPluginPrivate::commitProject);
|
||||
cvsMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
@@ -359,7 +375,7 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
m_updateDirectoryAction = new ParameterAction(tr("Update Directory"), tr("Update Directory \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
|
||||
command = ActionManager::registerAction(m_updateDirectoryAction, CMD_ID_UPDATE_DIRECTORY, context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
connect(m_updateDirectoryAction, &QAction::triggered, this, &CvsPlugin::updateDirectory);
|
||||
connect(m_updateDirectoryAction, &QAction::triggered, this, &CvsPluginPrivate::updateDirectory);
|
||||
cvsMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
@@ -367,7 +383,7 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
command = ActionManager::registerAction(m_commitDirectoryAction,
|
||||
CMD_ID_COMMIT_DIRECTORY, context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
connect(m_commitDirectoryAction, &QAction::triggered, this, &CvsPlugin::startCommitDirectory);
|
||||
connect(m_commitDirectoryAction, &QAction::triggered, this, &CvsPluginPrivate::startCommitDirectory);
|
||||
cvsMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
@@ -375,45 +391,44 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
|
||||
m_diffRepositoryAction = new QAction(tr("Diff Repository"), this);
|
||||
command = ActionManager::registerAction(m_diffRepositoryAction, CMD_ID_REPOSITORYDIFF, context);
|
||||
connect(m_diffRepositoryAction, &QAction::triggered, this, &CvsPlugin::diffRepository);
|
||||
connect(m_diffRepositoryAction, &QAction::triggered, this, &CvsPluginPrivate::diffRepository);
|
||||
cvsMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
m_statusRepositoryAction = new QAction(tr("Repository Status"), this);
|
||||
command = ActionManager::registerAction(m_statusRepositoryAction, CMD_ID_REPOSITORYSTATUS, context);
|
||||
connect(m_statusRepositoryAction, &QAction::triggered, this, &CvsPlugin::statusRepository);
|
||||
connect(m_statusRepositoryAction, &QAction::triggered, this, &CvsPluginPrivate::statusRepository);
|
||||
cvsMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
m_logRepositoryAction = new QAction(tr("Repository Log"), this);
|
||||
command = ActionManager::registerAction(m_logRepositoryAction, CMD_ID_REPOSITORYLOG, context);
|
||||
connect(m_logRepositoryAction, &QAction::triggered, this, &CvsPlugin::logRepository);
|
||||
connect(m_logRepositoryAction, &QAction::triggered, this, &CvsPluginPrivate::logRepository);
|
||||
cvsMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
m_updateRepositoryAction = new QAction(tr("Update Repository"), this);
|
||||
command = ActionManager::registerAction(m_updateRepositoryAction, CMD_ID_REPOSITORYUPDATE, context);
|
||||
connect(m_updateRepositoryAction, &QAction::triggered, this, &CvsPlugin::updateRepository);
|
||||
connect(m_updateRepositoryAction, &QAction::triggered, this, &CvsPluginPrivate::updateRepository);
|
||||
cvsMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
m_commitAllAction = new QAction(tr("Commit All Files"), this);
|
||||
command = ActionManager::registerAction(m_commitAllAction, CMD_ID_COMMIT_ALL,
|
||||
context);
|
||||
connect(m_commitAllAction, &QAction::triggered, this, &CvsPlugin::startCommitAll);
|
||||
connect(m_commitAllAction, &QAction::triggered, this, &CvsPluginPrivate::startCommitAll);
|
||||
cvsMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
m_revertRepositoryAction = new QAction(tr("Revert Repository..."), this);
|
||||
command = ActionManager::registerAction(m_revertRepositoryAction, CMD_ID_REVERT_ALL,
|
||||
context);
|
||||
connect(m_revertRepositoryAction, &QAction::triggered, this, &CvsPlugin::revertAll);
|
||||
connect(m_revertRepositoryAction, &QAction::triggered, this, &CvsPluginPrivate::revertAll);
|
||||
cvsMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CvsPlugin::submitEditorAboutToClose()
|
||||
bool CvsPluginPrivate::submitEditorAboutToClose()
|
||||
{
|
||||
if (!isCommitEditorOpen())
|
||||
return true;
|
||||
@@ -458,7 +473,7 @@ bool CvsPlugin::submitEditorAboutToClose()
|
||||
return closeEditor;
|
||||
}
|
||||
|
||||
void CvsPlugin::diffCommitFiles(const QStringList &files)
|
||||
void CvsPluginPrivate::diffCommitFiles(const QStringList &files)
|
||||
{
|
||||
m_client->diff(m_commitRepository, files);
|
||||
}
|
||||
@@ -469,18 +484,18 @@ static void setDiffBaseDirectory(IEditor *editor, const QString &db)
|
||||
ve->setWorkingDirectory(db);
|
||||
}
|
||||
|
||||
CvsSubmitEditor *CvsPlugin::openCVSSubmitEditor(const QString &fileName)
|
||||
CvsSubmitEditor *CvsPluginPrivate::openCVSSubmitEditor(const QString &fileName)
|
||||
{
|
||||
IEditor *editor = EditorManager::openEditor(fileName, CVSCOMMITEDITOR_ID);
|
||||
auto submitEditor = qobject_cast<CvsSubmitEditor*>(editor);
|
||||
QTC_ASSERT(submitEditor, return nullptr);
|
||||
connect(submitEditor, &VcsBaseSubmitEditor::diffSelectedFiles,
|
||||
this, &CvsPlugin::diffCommitFiles);
|
||||
this, &CvsPluginPrivate::diffCommitFiles);
|
||||
|
||||
return submitEditor;
|
||||
}
|
||||
|
||||
void CvsPlugin::updateActions(VcsBasePlugin::ActionState as)
|
||||
void CvsPluginPrivate::updateActions(VcsBasePluginPrivate::ActionState as)
|
||||
{
|
||||
if (!enableMenuAction(as, m_menuAction)) {
|
||||
m_commandLocator->setEnabled(false);
|
||||
@@ -523,14 +538,14 @@ void CvsPlugin::updateActions(VcsBasePlugin::ActionState as)
|
||||
m_uneditRepositoryAction->setEnabled(hasTopLevel);
|
||||
}
|
||||
|
||||
void CvsPlugin::addCurrentFile()
|
||||
void CvsPluginPrivate::addCurrentFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
vcsAdd(state.currentFileTopLevel(), state.relativeCurrentFile());
|
||||
}
|
||||
|
||||
void CvsPlugin::revertAll()
|
||||
void CvsPluginPrivate::revertAll()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
@@ -549,7 +564,7 @@ void CvsPlugin::revertAll()
|
||||
tr("Revert failed: %1").arg(revertResponse.message));
|
||||
}
|
||||
|
||||
void CvsPlugin::revertCurrentFile()
|
||||
void CvsPluginPrivate::revertCurrentFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
@@ -584,7 +599,7 @@ void CvsPlugin::revertCurrentFile()
|
||||
cvsVersionControl()->emitFilesChanged(QStringList(state.currentFile()));
|
||||
}
|
||||
|
||||
void CvsPlugin::diffProject()
|
||||
void CvsPluginPrivate::diffProject()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasProject(), return);
|
||||
@@ -593,14 +608,14 @@ void CvsPlugin::diffProject()
|
||||
relativeProject.isEmpty() ? QStringList() : QStringList(relativeProject));
|
||||
}
|
||||
|
||||
void CvsPlugin::diffCurrentFile()
|
||||
void CvsPluginPrivate::diffCurrentFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
m_client->diff(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()));
|
||||
}
|
||||
|
||||
void CvsPlugin::startCommitCurrentFile()
|
||||
void CvsPluginPrivate::startCommitCurrentFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
@@ -610,14 +625,14 @@ void CvsPlugin::startCommitCurrentFile()
|
||||
startCommit(state.currentFileDirectory(), state.currentFileName());
|
||||
}
|
||||
|
||||
void CvsPlugin::startCommitDirectory()
|
||||
void CvsPluginPrivate::startCommitDirectory()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
startCommit(state.currentFileDirectory());
|
||||
}
|
||||
|
||||
void CvsPlugin::startCommitAll()
|
||||
void CvsPluginPrivate::startCommitAll()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
@@ -627,7 +642,7 @@ void CvsPlugin::startCommitAll()
|
||||
/* Start commit of files of a single repository by displaying
|
||||
* template and files in a submit editor. On closing, the real
|
||||
* commit will start. */
|
||||
void CvsPlugin::startCommit(const QString &workingDir, const QString &file)
|
||||
void CvsPluginPrivate::startCommit(const QString &workingDir, const QString &file)
|
||||
{
|
||||
if (!promptBeforeCommit())
|
||||
return;
|
||||
@@ -682,7 +697,7 @@ void CvsPlugin::startCommit(const QString &workingDir, const QString &file)
|
||||
editor->setStateList(statusOutput);
|
||||
}
|
||||
|
||||
bool CvsPlugin::commit(const QString &messageFile,
|
||||
bool CvsPluginPrivate::commit(const QString &messageFile,
|
||||
const QStringList &fileList)
|
||||
{
|
||||
QStringList args = QStringList(QLatin1String("commit"));
|
||||
@@ -694,28 +709,28 @@ bool CvsPlugin::commit(const QString &messageFile,
|
||||
return response.result == CvsResponse::Ok ;
|
||||
}
|
||||
|
||||
void CvsPlugin::filelogCurrentFile()
|
||||
void CvsPluginPrivate::filelogCurrentFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
filelog(state.currentFileTopLevel(), state.relativeCurrentFile(), true);
|
||||
}
|
||||
|
||||
void CvsPlugin::logProject()
|
||||
void CvsPluginPrivate::logProject()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasProject(), return);
|
||||
filelog(state.currentProjectTopLevel(), state.relativeCurrentProject());
|
||||
}
|
||||
|
||||
void CvsPlugin::logRepository()
|
||||
void CvsPluginPrivate::logRepository()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
filelog(state.topLevel());
|
||||
}
|
||||
|
||||
void CvsPlugin::filelog(const QString &workingDir,
|
||||
void CvsPluginPrivate::filelog(const QString &workingDir,
|
||||
const QString &file,
|
||||
bool enableAnnotationContextMenu)
|
||||
{
|
||||
@@ -747,21 +762,21 @@ void CvsPlugin::filelog(const QString &workingDir,
|
||||
}
|
||||
}
|
||||
|
||||
void CvsPlugin::updateDirectory()
|
||||
void CvsPluginPrivate::updateDirectory()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
update(state.currentFileDirectory(), QString());
|
||||
}
|
||||
|
||||
void CvsPlugin::updateProject()
|
||||
void CvsPluginPrivate::updateProject()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasProject(), return);
|
||||
update(state.currentProjectTopLevel(), state.relativeCurrentProject());
|
||||
}
|
||||
|
||||
bool CvsPlugin::update(const QString &topLevel, const QString &file)
|
||||
bool CvsPluginPrivate::update(const QString &topLevel, const QString &file)
|
||||
{
|
||||
QStringList args(QLatin1String("update"));
|
||||
args.push_back(QLatin1String("-dR"));
|
||||
@@ -776,41 +791,41 @@ bool CvsPlugin::update(const QString &topLevel, const QString &file)
|
||||
return ok;
|
||||
}
|
||||
|
||||
void CvsPlugin::editCurrentFile()
|
||||
void CvsPluginPrivate::editCurrentFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
edit(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()));
|
||||
}
|
||||
|
||||
void CvsPlugin::uneditCurrentFile()
|
||||
void CvsPluginPrivate::uneditCurrentFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
unedit(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()));
|
||||
}
|
||||
|
||||
void CvsPlugin::uneditCurrentRepository()
|
||||
void CvsPluginPrivate::uneditCurrentRepository()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
unedit(state.topLevel(), QStringList());
|
||||
}
|
||||
|
||||
void CvsPlugin::annotateCurrentFile()
|
||||
void CvsPluginPrivate::annotateCurrentFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
annotate(state.currentFileTopLevel(), state.relativeCurrentFile());
|
||||
}
|
||||
|
||||
void CvsPlugin::vcsAnnotate(const QString &workingDirectory, const QString &file,
|
||||
void CvsPluginPrivate::vcsAnnotate(const QString &workingDirectory, const QString &file,
|
||||
const QString &revision, int lineNumber)
|
||||
{
|
||||
annotate(workingDirectory, file, revision, lineNumber);
|
||||
}
|
||||
|
||||
bool CvsPlugin::edit(const QString &topLevel, const QStringList &files)
|
||||
bool CvsPluginPrivate::edit(const QString &topLevel, const QStringList &files)
|
||||
{
|
||||
QStringList args(QLatin1String("edit"));
|
||||
args.append(files);
|
||||
@@ -820,7 +835,7 @@ bool CvsPlugin::edit(const QString &topLevel, const QStringList &files)
|
||||
return response.result == CvsResponse::Ok;
|
||||
}
|
||||
|
||||
bool CvsPlugin::diffCheckModified(const QString &topLevel, const QStringList &files, bool *modified)
|
||||
bool CvsPluginPrivate::diffCheckModified(const QString &topLevel, const QStringList &files, bool *modified)
|
||||
{
|
||||
// Quick check for modified files using diff
|
||||
*modified = false;
|
||||
@@ -834,7 +849,7 @@ bool CvsPlugin::diffCheckModified(const QString &topLevel, const QStringList &fi
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CvsPlugin::unedit(const QString &topLevel, const QStringList &files)
|
||||
bool CvsPluginPrivate::unedit(const QString &topLevel, const QStringList &files)
|
||||
{
|
||||
bool modified;
|
||||
// Prompt and use force flag if modified
|
||||
@@ -860,7 +875,7 @@ bool CvsPlugin::unedit(const QString &topLevel, const QStringList &files)
|
||||
return response.result == CvsResponse::Ok;
|
||||
}
|
||||
|
||||
void CvsPlugin::annotate(const QString &workingDir, const QString &file,
|
||||
void CvsPluginPrivate::annotate(const QString &workingDir, const QString &file,
|
||||
const QString &revision /* = QString() */,
|
||||
int lineNumber /* = -1 */)
|
||||
{
|
||||
@@ -897,7 +912,7 @@ void CvsPlugin::annotate(const QString &workingDir, const QString &file,
|
||||
}
|
||||
}
|
||||
|
||||
bool CvsPlugin::status(const QString &topLevel, const QString &file, const QString &title)
|
||||
bool CvsPluginPrivate::status(const QString &topLevel, const QString &file, const QString &title)
|
||||
{
|
||||
QStringList args(QLatin1String("status"));
|
||||
if (!file.isEmpty())
|
||||
@@ -910,35 +925,35 @@ bool CvsPlugin::status(const QString &topLevel, const QString &file, const QStri
|
||||
return ok;
|
||||
}
|
||||
|
||||
void CvsPlugin::projectStatus()
|
||||
void CvsPluginPrivate::projectStatus()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasProject(), return);
|
||||
status(state.currentProjectTopLevel(), state.relativeCurrentProject(), tr("Project status"));
|
||||
}
|
||||
|
||||
void CvsPlugin::commitProject()
|
||||
void CvsPluginPrivate::commitProject()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasProject(), return);
|
||||
startCommit(state.currentProjectTopLevel(), state.relativeCurrentProject());
|
||||
}
|
||||
|
||||
void CvsPlugin::diffRepository()
|
||||
void CvsPluginPrivate::diffRepository()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
m_client->diff(state.topLevel(), QStringList());
|
||||
}
|
||||
|
||||
void CvsPlugin::statusRepository()
|
||||
void CvsPluginPrivate::statusRepository()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
status(state.topLevel(), QString(), tr("Repository status"));
|
||||
}
|
||||
|
||||
void CvsPlugin::updateRepository()
|
||||
void CvsPluginPrivate::updateRepository()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
@@ -946,7 +961,7 @@ void CvsPlugin::updateRepository()
|
||||
|
||||
}
|
||||
|
||||
bool CvsPlugin::describe(const QString &file, const QString &changeNr, QString *errorMessage)
|
||||
bool CvsPluginPrivate::describe(const QString &file, const QString &changeNr, QString *errorMessage)
|
||||
{
|
||||
|
||||
QString toplevel;
|
||||
@@ -958,7 +973,7 @@ bool CvsPlugin::describe(const QString &file, const QString &changeNr, QString *
|
||||
return describe(toplevel, QDir(toplevel).relativeFilePath(file), changeNr, errorMessage);
|
||||
}
|
||||
|
||||
bool CvsPlugin::describe(const QString &toplevel, const QString &file, const
|
||||
bool CvsPluginPrivate::describe(const QString &toplevel, const QString &file, const
|
||||
QString &changeNr, QString *errorMessage)
|
||||
{
|
||||
|
||||
@@ -1020,7 +1035,7 @@ bool CvsPlugin::describe(const QString &toplevel, const QString &file, const
|
||||
|
||||
// Describe a set of files and revisions by
|
||||
// concatenating log and diffs to previous revisions
|
||||
bool CvsPlugin::describe(const QString &repositoryPath,
|
||||
bool CvsPluginPrivate::describe(const QString &repositoryPath,
|
||||
QList<CvsLogEntry> entries,
|
||||
QString *errorMessage)
|
||||
{
|
||||
@@ -1086,7 +1101,7 @@ bool CvsPlugin::describe(const QString &repositoryPath,
|
||||
return true;
|
||||
}
|
||||
|
||||
void CvsPlugin::commitFromEditor()
|
||||
void CvsPluginPrivate::commitFromEditor()
|
||||
{
|
||||
m_submitActionTriggered = true;
|
||||
QTC_ASSERT(submitEditor(), return);
|
||||
@@ -1095,7 +1110,7 @@ void CvsPlugin::commitFromEditor()
|
||||
|
||||
// Run CVS. At this point, file arguments must be relative to
|
||||
// the working directory (see above).
|
||||
CvsResponse CvsPlugin::runCvs(const QString &workingDirectory,
|
||||
CvsResponse CvsPluginPrivate::runCvs(const QString &workingDirectory,
|
||||
const QStringList &arguments,
|
||||
int timeOutS,
|
||||
unsigned flags,
|
||||
@@ -1135,7 +1150,7 @@ CvsResponse CvsPlugin::runCvs(const QString &workingDirectory,
|
||||
return response;
|
||||
}
|
||||
|
||||
IEditor *CvsPlugin::showOutputInEditor(const QString& title, const QString &output,
|
||||
IEditor *CvsPluginPrivate::showOutputInEditor(const QString& title, const QString &output,
|
||||
int editorType, const QString &source,
|
||||
QTextCodec *codec)
|
||||
{
|
||||
@@ -1147,7 +1162,7 @@ IEditor *CvsPlugin::showOutputInEditor(const QString& title, const QString &outp
|
||||
auto e = qobject_cast<CvsEditorWidget*>(editor->widget());
|
||||
if (!e)
|
||||
return nullptr;
|
||||
connect(e, &VcsBaseEditorWidget::annotateRevisionRequested, this, &CvsPlugin::annotate);
|
||||
connect(e, &VcsBaseEditorWidget::annotateRevisionRequested, this, &CvsPluginPrivate::annotate);
|
||||
s.replace(QLatin1Char(' '), QLatin1Char('_'));
|
||||
e->textDocument()->setFallbackSaveAsFileName(s);
|
||||
e->setForceReadOnly(true);
|
||||
@@ -1158,13 +1173,13 @@ IEditor *CvsPlugin::showOutputInEditor(const QString& title, const QString &outp
|
||||
return editor;
|
||||
}
|
||||
|
||||
CvsPlugin *CvsPlugin::instance()
|
||||
CvsPluginPrivate *CvsPluginPrivate::instance()
|
||||
{
|
||||
QTC_ASSERT(m_cvsPluginInstance, return m_cvsPluginInstance);
|
||||
return m_cvsPluginInstance;
|
||||
QTC_ASSERT(dd, return dd);
|
||||
return dd;
|
||||
}
|
||||
|
||||
bool CvsPlugin::vcsAdd(const QString &workingDir, const QString &rawFileName)
|
||||
bool CvsPluginPrivate::vcsAdd(const QString &workingDir, const QString &rawFileName)
|
||||
{
|
||||
QStringList args;
|
||||
args << QLatin1String("add") << rawFileName;
|
||||
@@ -1174,7 +1189,7 @@ bool CvsPlugin::vcsAdd(const QString &workingDir, const QString &rawFileName)
|
||||
return response.result == CvsResponse::Ok;
|
||||
}
|
||||
|
||||
bool CvsPlugin::vcsDelete(const QString &workingDir, const QString &rawFileName)
|
||||
bool CvsPluginPrivate::vcsDelete(const QString &workingDir, const QString &rawFileName)
|
||||
{
|
||||
QStringList args;
|
||||
args << QLatin1String("remove") << QLatin1String("-f") << rawFileName;
|
||||
@@ -1186,7 +1201,7 @@ bool CvsPlugin::vcsDelete(const QString &workingDir, const QString &rawFileName)
|
||||
|
||||
/* CVS has a "CVS" directory in each directory it manages. The top level
|
||||
* is the first directory under the directory that does not have it. */
|
||||
bool CvsPlugin::managesDirectory(const QString &directory, QString *topLevel /* = 0 */) const
|
||||
bool CvsPluginPrivate::managesDirectory(const QString &directory, QString *topLevel /* = 0 */) const
|
||||
{
|
||||
if (topLevel)
|
||||
topLevel->clear();
|
||||
@@ -1215,7 +1230,7 @@ bool CvsPlugin::managesDirectory(const QString &directory, QString *topLevel /*
|
||||
return manages;
|
||||
}
|
||||
|
||||
bool CvsPlugin::managesFile(const QString &workingDirectory, const QString &fileName) const
|
||||
bool CvsPluginPrivate::managesFile(const QString &workingDirectory, const QString &fileName) const
|
||||
{
|
||||
QStringList args;
|
||||
args << QLatin1String("status") << fileName;
|
||||
@@ -1226,13 +1241,13 @@ bool CvsPlugin::managesFile(const QString &workingDirectory, const QString &file
|
||||
return !response.stdOut.contains(QLatin1String("Status: Unknown"));
|
||||
}
|
||||
|
||||
bool CvsPlugin::checkCVSDirectory(const QDir &directory) const
|
||||
bool CvsPluginPrivate::checkCVSDirectory(const QDir &directory) const
|
||||
{
|
||||
const QString cvsDir = directory.absoluteFilePath(QLatin1String("CVS"));
|
||||
return QFileInfo(cvsDir).isDir();
|
||||
}
|
||||
|
||||
CvsControl *CvsPlugin::cvsVersionControl() const
|
||||
CvsControl *CvsPluginPrivate::cvsVersionControl() const
|
||||
{
|
||||
return static_cast<CvsControl *>(versionControl());
|
||||
}
|
||||
|
@@ -62,18 +62,16 @@ public:
|
||||
QString message;
|
||||
};
|
||||
|
||||
class CvsPlugin : public VcsBase::VcsBasePlugin
|
||||
class CvsPluginPrivate final : public VcsBase::VcsBasePluginPrivate
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "CVS.json")
|
||||
|
||||
public:
|
||||
~CvsPlugin() override;
|
||||
CvsPluginPrivate();
|
||||
~CvsPluginPrivate() final;
|
||||
|
||||
CvsClient *client() const;
|
||||
|
||||
bool initialize(const QStringList &arguments, QString *errorMessage) override;
|
||||
|
||||
CvsSubmitEditor *openCVSSubmitEditor(const QString &fileName);
|
||||
|
||||
// IVersionControl
|
||||
@@ -84,20 +82,13 @@ public:
|
||||
// cvs 'edit' is used to implement 'open' (cvsnt).
|
||||
bool edit(const QString &topLevel, const QStringList &files);
|
||||
|
||||
static CvsPlugin *instance();
|
||||
static CvsPluginPrivate *instance();
|
||||
|
||||
void vcsAnnotate(const QString &workingDirectory, const QString &file,
|
||||
const QString &revision, int lineNumber);
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
private slots:
|
||||
void testDiffFileResolving_data();
|
||||
void testDiffFileResolving();
|
||||
void testLogResolving();
|
||||
#endif
|
||||
|
||||
protected:
|
||||
void updateActions(VcsBase::VcsBasePlugin::ActionState) override;
|
||||
void updateActions(VcsBase::VcsBasePluginPrivate::ActionState) override;
|
||||
bool submitEditorAboutToClose() override;
|
||||
|
||||
private:
|
||||
@@ -190,8 +181,24 @@ private:
|
||||
|
||||
QAction *m_menuAction = nullptr;
|
||||
bool m_submitActionTriggered = false;
|
||||
};
|
||||
|
||||
static CvsPlugin *m_cvsPluginInstance;
|
||||
class CvsPlugin final : public ExtensionSystem::IPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "CVS.json")
|
||||
|
||||
~CvsPlugin() final;
|
||||
|
||||
bool initialize(const QStringList &arguments, QString *errorMessage) final;
|
||||
void extensionsInitialized() final;
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
private slots:
|
||||
void testDiffFileResolving_data();
|
||||
void testDiffFileResolving();
|
||||
void testLogResolving();
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace Cvs
|
||||
|
@@ -88,7 +88,7 @@ void SettingsPageWidget::setSettings(const VcsBaseClientSettings &s)
|
||||
}
|
||||
|
||||
SettingsPage::SettingsPage(Core::IVersionControl *control, QObject *parent) :
|
||||
VcsClientOptionsPage(control, CvsPlugin::instance()->client(), parent)
|
||||
VcsClientOptionsPage(control, CvsPluginPrivate::instance()->client(), parent)
|
||||
{
|
||||
setId(VcsBase::Constants::VCS_ID_CVS);
|
||||
setDisplayName(SettingsPageWidget::tr("CVS"));
|
||||
|
@@ -50,7 +50,7 @@ class BranchNameValidator : public QValidator
|
||||
public:
|
||||
BranchNameValidator(const QStringList &localBranches, QObject *parent = nullptr) :
|
||||
QValidator(parent),
|
||||
m_invalidChars(GitPlugin::invalidBranchAndRemoteNamePattern()),
|
||||
m_invalidChars(GitPluginPrivate::invalidBranchAndRemoteNamePattern()),
|
||||
m_localBranches(localBranches)
|
||||
{
|
||||
}
|
||||
|
@@ -82,7 +82,7 @@ BranchView::BranchView() :
|
||||
m_refreshButton(new QToolButton(this)),
|
||||
m_repositoryLabel(new Utils::ElidingLabel(this)),
|
||||
m_branchView(new Utils::NavigationTreeView(this)),
|
||||
m_model(new BranchModel(GitPlugin::client(), this)),
|
||||
m_model(new BranchModel(GitPluginPrivate::client(), this)),
|
||||
m_filterModel(new BranchFilterModel(this))
|
||||
{
|
||||
m_addButton->setIcon(Utils::Icons::PLUS_TOOLBAR.icon());
|
||||
@@ -122,7 +122,7 @@ BranchView::BranchView() :
|
||||
this, &BranchView::setIncludeOldEntries);
|
||||
m_includeTagsAction->setCheckable(true);
|
||||
m_includeTagsAction->setChecked(
|
||||
GitPlugin::client()->settings().boolValue(GitSettings::showTagsKey));
|
||||
GitPluginPrivate::client()->settings().boolValue(GitSettings::showTagsKey));
|
||||
connect(m_includeTagsAction, &QAction::toggled,
|
||||
this, &BranchView::setIncludeTags);
|
||||
|
||||
@@ -138,7 +138,7 @@ BranchView::BranchView() :
|
||||
this, &BranchView::expandAndResize);
|
||||
|
||||
m_branchView->selectionModel()->clear();
|
||||
m_repository = GitPlugin::instance()->currentState().topLevel();
|
||||
m_repository = GitPluginPrivate::instance()->currentState().topLevel();
|
||||
refreshCurrentRepository();
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ void BranchView::refresh(const QString &repository, bool force)
|
||||
m_branchView->setEnabled(false);
|
||||
} else {
|
||||
m_repositoryLabel->setText(QDir::toNativeSeparators(m_repository));
|
||||
m_repositoryLabel->setToolTip(GitPlugin::msgRepositoryLabel(m_repository));
|
||||
m_repositoryLabel->setToolTip(GitPluginPrivate::msgRepositoryLabel(m_repository));
|
||||
m_addButton->setToolTip(tr("Add Branch..."));
|
||||
m_branchView->setEnabled(true);
|
||||
}
|
||||
@@ -214,17 +214,17 @@ void BranchView::slotCustomContextMenu(const QPoint &point)
|
||||
const Utils::optional<QString> remote = m_model->remoteName(index);
|
||||
if (remote.has_value()) {
|
||||
contextMenu.addAction(tr("&Fetch"), this, [this, &remote]() {
|
||||
GitPlugin::client()->fetch(m_repository, *remote);
|
||||
GitPluginPrivate::client()->fetch(m_repository, *remote);
|
||||
});
|
||||
contextMenu.addSeparator();
|
||||
if (!remote->isEmpty()) {
|
||||
contextMenu.addAction(tr("Remove &Stale Branches"), this, [this, &remote]() {
|
||||
GitPlugin::client()->removeStaleRemoteBranches(m_repository, *remote);
|
||||
GitPluginPrivate::client()->removeStaleRemoteBranches(m_repository, *remote);
|
||||
});
|
||||
contextMenu.addSeparator();
|
||||
}
|
||||
contextMenu.addAction(tr("Manage &Remotes..."), GitPlugin::instance(),
|
||||
&GitPlugin::manageRemotes);
|
||||
contextMenu.addAction(tr("Manage &Remotes..."), GitPluginPrivate::instance(),
|
||||
&GitPluginPrivate::manageRemotes);
|
||||
}
|
||||
if (hasActions) {
|
||||
if (!currentSelected && (isLocal || isTag))
|
||||
@@ -237,7 +237,7 @@ void BranchView::slotCustomContextMenu(const QPoint &point)
|
||||
contextMenu.addAction(tr("&Diff"), this, [this] {
|
||||
const QString fullName = m_model->fullName(selectedIndex(), true);
|
||||
if (!fullName.isEmpty())
|
||||
GitPlugin::client()->diffBranch(m_repository, fullName);
|
||||
GitPluginPrivate::client()->diffBranch(m_repository, fullName);
|
||||
});
|
||||
contextMenu.addAction(tr("&Log"), this, [this] { log(selectedIndex()); });
|
||||
contextMenu.addSeparator();
|
||||
@@ -287,7 +287,7 @@ void BranchView::setIncludeOldEntries(bool filter)
|
||||
|
||||
void BranchView::setIncludeTags(bool includeTags)
|
||||
{
|
||||
GitPlugin::client()->settings().setValue(GitSettings::showTagsKey, includeTags);
|
||||
GitPluginPrivate::client()->settings().setValue(GitSettings::showTagsKey, includeTags);
|
||||
refreshCurrentRepository();
|
||||
}
|
||||
|
||||
@@ -302,7 +302,7 @@ QModelIndex BranchView::selectedIndex()
|
||||
bool BranchView::add()
|
||||
{
|
||||
if (m_repository.isEmpty()) {
|
||||
GitPlugin::instance()->initRepository();
|
||||
GitPluginPrivate::instance()->initRepository();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -363,7 +363,7 @@ bool BranchView::checkout()
|
||||
' ' + nextBranch + "-AutoStash ";
|
||||
|
||||
BranchCheckoutDialog branchCheckoutDialog(this, currentBranch, nextBranch);
|
||||
GitClient *client = GitPlugin::client();
|
||||
GitClient *client = GitPluginPrivate::client();
|
||||
|
||||
if (client->gitStatus(m_repository, StatusMode(NoUntracked | NoSubmodules)) != GitClient::StatusChanged)
|
||||
branchCheckoutDialog.foundNoLocalChanges();
|
||||
@@ -498,7 +498,7 @@ bool BranchView::reset(const QByteArray &resetType)
|
||||
if (QMessageBox::question(this, tr("Git Reset"), tr("Reset branch \"%1\" to \"%2\"?")
|
||||
.arg(currentName).arg(branchName),
|
||||
QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) {
|
||||
GitPlugin::client()->reset(m_repository, QLatin1String("--" + resetType), branchName);
|
||||
GitPluginPrivate::client()->reset(m_repository, QLatin1String("--" + resetType), branchName);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -510,7 +510,7 @@ bool BranchView::isFastForwardMerge()
|
||||
QTC_CHECK(selected != m_model->currentBranch());
|
||||
|
||||
const QString branch = m_model->fullName(selected, true);
|
||||
return GitPlugin::client()->isFastForwardMerge(m_repository, branch);
|
||||
return GitPluginPrivate::client()->isFastForwardMerge(m_repository, branch);
|
||||
}
|
||||
|
||||
bool BranchView::merge(bool allowFastForward)
|
||||
@@ -521,7 +521,7 @@ bool BranchView::merge(bool allowFastForward)
|
||||
QTC_CHECK(selected != m_model->currentBranch());
|
||||
|
||||
const QString branch = m_model->fullName(selected, true);
|
||||
GitClient *client = GitPlugin::client();
|
||||
GitClient *client = GitPluginPrivate::client();
|
||||
if (client->beginStashScope(m_repository, "merge", AllowUnstashed))
|
||||
return client->synchronousMerge(m_repository, branch, allowFastForward);
|
||||
|
||||
@@ -536,7 +536,7 @@ void BranchView::rebase()
|
||||
QTC_CHECK(selected != m_model->currentBranch());
|
||||
|
||||
const QString baseBranch = m_model->fullName(selected, true);
|
||||
GitClient *client = GitPlugin::client();
|
||||
GitClient *client = GitPluginPrivate::client();
|
||||
if (client->beginStashScope(m_repository, "rebase"))
|
||||
client->rebase(m_repository, baseBranch);
|
||||
}
|
||||
@@ -549,14 +549,14 @@ bool BranchView::cherryPick()
|
||||
QTC_CHECK(selected != m_model->currentBranch());
|
||||
|
||||
const QString branch = m_model->fullName(selected, true);
|
||||
return GitPlugin::client()->synchronousCherryPick(m_repository, branch);
|
||||
return GitPluginPrivate::client()->synchronousCherryPick(m_repository, branch);
|
||||
}
|
||||
|
||||
void BranchView::log(const QModelIndex &idx)
|
||||
{
|
||||
const QString branchName = m_model->fullName(idx, true);
|
||||
if (!branchName.isEmpty())
|
||||
GitPlugin::client()->log(m_repository, QString(), false, {branchName});
|
||||
GitPluginPrivate::client()->log(m_repository, QString(), false, {branchName});
|
||||
}
|
||||
|
||||
void BranchView::push()
|
||||
@@ -572,7 +572,7 @@ void BranchView::push()
|
||||
const QString remoteBranch = fullTargetName.mid(pos + 1);
|
||||
const QStringList pushArgs = {remoteName, localBranch + ':' + remoteBranch};
|
||||
|
||||
GitPlugin::client()->push(m_repository, pushArgs);
|
||||
GitPluginPrivate::client()->push(m_repository, pushArgs);
|
||||
}
|
||||
|
||||
BranchViewFactory::BranchViewFactory()
|
||||
|
@@ -58,12 +58,12 @@ ChangeSelectionDialog::ChangeSelectionDialog(const QString &workingDirectory, Co
|
||||
QDialog(parent), m_ui(new Ui::ChangeSelectionDialog)
|
||||
{
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
m_gitExecutable = GitPlugin::client()->vcsBinary();
|
||||
m_gitExecutable = GitPluginPrivate::client()->vcsBinary();
|
||||
m_ui->setupUi(this);
|
||||
m_ui->workingDirectoryChooser->setExpectedKind(PathChooser::ExistingDirectory);
|
||||
m_ui->workingDirectoryChooser->setPromptDialogTitle(tr("Select Git Directory"));
|
||||
m_ui->workingDirectoryChooser->setPath(workingDirectory);
|
||||
m_gitEnvironment = GitPlugin::client()->processEnvironment();
|
||||
m_gitEnvironment = GitPluginPrivate::client()->processEnvironment();
|
||||
m_ui->changeNumberEdit->setFocus();
|
||||
m_ui->changeNumberEdit->selectAll();
|
||||
|
||||
@@ -204,7 +204,7 @@ void ChangeSelectionDialog::recalculateCompletion()
|
||||
if (workingDir.isEmpty())
|
||||
return;
|
||||
|
||||
GitClient *client = GitPlugin::client();
|
||||
GitClient *client = GitPluginPrivate::client();
|
||||
VcsBase::VcsCommand *command = client->asyncForEachRefCmd(
|
||||
workingDir, {"--format=%(refname:short)"});
|
||||
connect(this, &QObject::destroyed, command, &VcsBase::VcsCommand::abort);
|
||||
|
@@ -36,7 +36,7 @@ BranchComboBox::BranchComboBox(QWidget *parent) : QComboBox(parent)
|
||||
void BranchComboBox::init(const QString &repository)
|
||||
{
|
||||
m_repository = repository;
|
||||
QString currentBranch = GitPlugin::client()->synchronousCurrentLocalBranch(repository);
|
||||
QString currentBranch = GitPluginPrivate::client()->synchronousCurrentLocalBranch(repository);
|
||||
if (currentBranch.isEmpty()) {
|
||||
m_detached = true;
|
||||
currentBranch = "HEAD";
|
||||
@@ -44,7 +44,7 @@ void BranchComboBox::init(const QString &repository)
|
||||
}
|
||||
QString output;
|
||||
const QString branchPrefix("refs/heads/");
|
||||
if (!GitPlugin::client()->synchronousForEachRefCmd(
|
||||
if (!GitPluginPrivate::client()->synchronousForEachRefCmd(
|
||||
m_repository, {"--format=%(refname)", branchPrefix}, &output)) {
|
||||
return;
|
||||
}
|
||||
|
@@ -139,7 +139,7 @@ void GerritDialog::setCurrentPath(const QString &path)
|
||||
if (path == m_repository)
|
||||
return;
|
||||
m_repository = path;
|
||||
m_ui->repositoryLabel->setText(Git::Internal::GitPlugin::msgRepositoryLabel(path));
|
||||
m_ui->repositoryLabel->setText(Git::Internal::GitPluginPrivate::msgRepositoryLabel(path));
|
||||
updateRemotes();
|
||||
}
|
||||
|
||||
|
@@ -295,7 +295,7 @@ QueryContext::QueryContext(const QString &query,
|
||||
connect(&m_process, &QProcess::errorOccurred, this, &QueryContext::processError);
|
||||
connect(&m_watcher, &QFutureWatcherBase::canceled, this, &QueryContext::terminate);
|
||||
m_watcher.setFuture(m_progress.future());
|
||||
m_process.setProcessEnvironment(Git::Internal::GitPlugin::client()->processEnvironment());
|
||||
m_process.setProcessEnvironment(Git::Internal::GitPluginPrivate::client()->processEnvironment());
|
||||
m_progress.setProgressRange(0, 1);
|
||||
|
||||
m_timer.setInterval(timeOutMS);
|
||||
|
@@ -149,7 +149,7 @@ FetchContext::FetchContext(const QSharedPointer<GerritChange> &change,
|
||||
connect(&m_watcher, &QFutureWatcher<void>::canceled, this, &FetchContext::terminate);
|
||||
m_watcher.setFuture(m_progress.future());
|
||||
m_process.setWorkingDirectory(repository);
|
||||
m_process.setProcessEnvironment(GitPlugin::client()->processEnvironment());
|
||||
m_process.setProcessEnvironment(GitPluginPrivate::client()->processEnvironment());
|
||||
m_process.closeWriteChannel();
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ void FetchContext::show()
|
||||
{
|
||||
const QString title = QString::number(m_change->number) + '/'
|
||||
+ QString::number(m_change->currentPatchSet.patchSetNumber);
|
||||
GitPlugin::client()->show(m_repository, "FETCH_HEAD", title);
|
||||
GitPluginPrivate::client()->show(m_repository, "FETCH_HEAD", title);
|
||||
}
|
||||
|
||||
void FetchContext::cherryPick()
|
||||
@@ -249,12 +249,12 @@ void FetchContext::cherryPick()
|
||||
// Point user to errors.
|
||||
VcsBase::VcsOutputWindow::instance()->popup(IOutputPane::ModeSwitch
|
||||
| IOutputPane::WithFocus);
|
||||
GitPlugin::client()->synchronousCherryPick(m_repository, "FETCH_HEAD");
|
||||
GitPluginPrivate::client()->synchronousCherryPick(m_repository, "FETCH_HEAD");
|
||||
}
|
||||
|
||||
void FetchContext::checkout()
|
||||
{
|
||||
GitPlugin::client()->checkout(m_repository, "FETCH_HEAD");
|
||||
GitPluginPrivate::client()->checkout(m_repository, "FETCH_HEAD");
|
||||
}
|
||||
|
||||
void FetchContext::terminate()
|
||||
@@ -272,7 +272,7 @@ GerritPlugin::GerritPlugin(QObject *parent)
|
||||
|
||||
GerritPlugin::~GerritPlugin() = default;
|
||||
|
||||
bool GerritPlugin::initialize(ActionContainer *ac)
|
||||
void GerritPlugin::initialize(ActionContainer *ac)
|
||||
{
|
||||
m_parameters->fromSettings(ICore::settings());
|
||||
|
||||
@@ -296,7 +296,6 @@ bool GerritPlugin::initialize(ActionContainer *ac)
|
||||
if (m_dialog)
|
||||
m_dialog->scheduleUpdateRemotes();
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
void GerritPlugin::updateActions(const VcsBase::VcsBasePluginState &state)
|
||||
@@ -330,12 +329,12 @@ void GerritPlugin::push(const QString &topLevel)
|
||||
|
||||
dialog.storeTopic();
|
||||
m_reviewers = dialog.reviewers();
|
||||
GitPlugin::client()->push(topLevel, {dialog.selectedRemoteName(), dialog.pushTarget()});
|
||||
GitPluginPrivate::client()->push(topLevel, {dialog.selectedRemoteName(), dialog.pushTarget()});
|
||||
}
|
||||
|
||||
static QString currentRepository()
|
||||
{
|
||||
return GitPlugin::instance()->currentState().topLevel();
|
||||
return GitPluginPrivate::instance()->currentState().topLevel();
|
||||
}
|
||||
|
||||
// Open or raise the Gerrit dialog window.
|
||||
@@ -377,19 +376,19 @@ void GerritPlugin::push()
|
||||
|
||||
Utils::FilePath GerritPlugin::gitBinDirectory()
|
||||
{
|
||||
return GitPlugin::client()->gitBinDirectory();
|
||||
return GitPluginPrivate::client()->gitBinDirectory();
|
||||
}
|
||||
|
||||
// Find the branch of a repository.
|
||||
QString GerritPlugin::branch(const QString &repository)
|
||||
{
|
||||
return GitPlugin::client()->synchronousCurrentLocalBranch(repository);
|
||||
return GitPluginPrivate::client()->synchronousCurrentLocalBranch(repository);
|
||||
}
|
||||
|
||||
void GerritPlugin::fetch(const QSharedPointer<GerritChange> &change, int mode)
|
||||
{
|
||||
// Locate git.
|
||||
const Utils::FilePath git = GitPlugin::client()->vcsBinary();
|
||||
const Utils::FilePath git = GitPluginPrivate::client()->vcsBinary();
|
||||
if (git.isEmpty()) {
|
||||
VcsBase::VcsOutputWindow::appendError(tr("Git is not available."));
|
||||
return;
|
||||
@@ -402,7 +401,7 @@ void GerritPlugin::fetch(const QSharedPointer<GerritChange> &change, int mode)
|
||||
|
||||
if (!repository.isEmpty()) {
|
||||
// Check if remote from a working dir is the same as remote from patch
|
||||
QMap<QString, QString> remotesList = GitPlugin::client()->synchronousRemotesList(repository);
|
||||
QMap<QString, QString> remotesList = GitPluginPrivate::client()->synchronousRemotesList(repository);
|
||||
if (!remotesList.isEmpty()) {
|
||||
const QStringList remotes = remotesList.values();
|
||||
for (QString remote : remotes) {
|
||||
@@ -415,7 +414,7 @@ void GerritPlugin::fetch(const QSharedPointer<GerritChange> &change, int mode)
|
||||
}
|
||||
|
||||
if (!verifiedRepository) {
|
||||
const SubmoduleDataMap submodules = GitPlugin::client()->submoduleList(repository);
|
||||
const SubmoduleDataMap submodules = GitPluginPrivate::client()->submoduleList(repository);
|
||||
for (const SubmoduleData &submoduleData : submodules) {
|
||||
QString remote = submoduleData.url;
|
||||
if (remote.endsWith(".git"))
|
||||
@@ -474,7 +473,7 @@ void GerritPlugin::fetch(const QSharedPointer<GerritChange> &change, int mode)
|
||||
// Try to find a matching repository for a project by asking the VcsManager.
|
||||
QString GerritPlugin::findLocalRepository(QString project, const QString &branch) const
|
||||
{
|
||||
const QStringList gitRepositories = VcsManager::repositories(GitPlugin::instance()->gitVersionControl());
|
||||
const QStringList gitRepositories = VcsManager::repositories(GitPluginPrivate::instance()->gitVersionControl());
|
||||
// Determine key (file name) to look for (qt/qtbase->'qtbase').
|
||||
const int slashPos = project.lastIndexOf('/');
|
||||
if (slashPos != -1)
|
||||
|
@@ -55,7 +55,7 @@ public:
|
||||
explicit GerritPlugin(QObject *parent = nullptr);
|
||||
~GerritPlugin() override;
|
||||
|
||||
bool initialize(Core::ActionContainer *ac);
|
||||
void initialize(Core::ActionContainer *ac);
|
||||
|
||||
static Utils::FilePath gitBinDirectory();
|
||||
static QString branch(const QString &repository);
|
||||
|
@@ -70,7 +70,7 @@ QString GerritPushDialog::determineRemoteBranch(const QString &localBranch)
|
||||
QString output;
|
||||
QString error;
|
||||
|
||||
if (!GitPlugin::client()->synchronousBranchCmd(
|
||||
if (!GitPluginPrivate::client()->synchronousBranchCmd(
|
||||
m_workingDir, {"-r", "--contains", earliestCommit + '^'}, &output, &error)) {
|
||||
return QString();
|
||||
}
|
||||
@@ -79,7 +79,7 @@ QString GerritPushDialog::determineRemoteBranch(const QString &localBranch)
|
||||
|
||||
QString remoteTrackingBranch;
|
||||
if (localBranch != "HEAD")
|
||||
remoteTrackingBranch = GitPlugin::client()->synchronousTrackingBranch(m_workingDir, localBranch);
|
||||
remoteTrackingBranch = GitPluginPrivate::client()->synchronousTrackingBranch(m_workingDir, localBranch);
|
||||
|
||||
QString remoteBranch;
|
||||
for (const QString &reference : refs) {
|
||||
@@ -103,7 +103,7 @@ void GerritPushDialog::initRemoteBranches()
|
||||
const QString head = "/HEAD";
|
||||
|
||||
QString remotesPrefix("refs/remotes/");
|
||||
if (!GitPlugin::client()->synchronousForEachRefCmd(
|
||||
if (!GitPluginPrivate::client()->synchronousForEachRefCmd(
|
||||
m_workingDir, {"--format=%(refname)\t%(committerdate:raw)", remotesPrefix}, &output)) {
|
||||
return;
|
||||
}
|
||||
@@ -187,7 +187,7 @@ QString GerritPushDialog::calculateChangeRange(const QString &branch)
|
||||
QString number;
|
||||
QString error;
|
||||
|
||||
GitPlugin::client()->synchronousRevListCmd(m_workingDir, { remote + ".." + branch, "--count" },
|
||||
GitPluginPrivate::client()->synchronousRevListCmd(m_workingDir, { remote + ".." + branch, "--count" },
|
||||
&number, &error);
|
||||
|
||||
number.chop(1);
|
||||
@@ -304,7 +304,7 @@ QString GerritPushDialog::pushTarget() const
|
||||
void GerritPushDialog::storeTopic()
|
||||
{
|
||||
const QString branch = m_ui->localBranchComboBox->currentText();
|
||||
GitPlugin::client()->setConfigValue(m_workingDir, QString("branch.%1.topic").arg(branch),
|
||||
GitPluginPrivate::client()->setConfigValue(m_workingDir, QString("branch.%1.topic").arg(branch),
|
||||
selectedTopic());
|
||||
}
|
||||
|
||||
@@ -317,7 +317,7 @@ void GerritPushDialog::setRemoteBranches(bool includeOld)
|
||||
const QString remoteName = selectedRemoteName();
|
||||
if (!m_remoteBranches.contains(remoteName)) {
|
||||
const QStringList remoteBranches =
|
||||
GitPlugin::client()->synchronousRepositoryBranches(remoteName, m_workingDir);
|
||||
GitPluginPrivate::client()->synchronousRepositoryBranches(remoteName, m_workingDir);
|
||||
for (const QString &branch : remoteBranches)
|
||||
m_remoteBranches.insertMulti(remoteName, qMakePair(branch, QDate()));
|
||||
if (remoteBranches.isEmpty()) {
|
||||
@@ -355,7 +355,7 @@ void GerritPushDialog::updateCommits(int index)
|
||||
{
|
||||
const QString branch = m_ui->localBranchComboBox->itemText(index);
|
||||
m_hasLocalCommits = m_ui->commitView->init(m_workingDir, branch, LogChangeWidget::Silent);
|
||||
QString topic = GitPlugin::client()->readConfigValue(
|
||||
QString topic = GitPluginPrivate::client()->readConfigValue(
|
||||
m_workingDir, QString("branch.%1.topic").arg(branch));
|
||||
if (!topic.isEmpty())
|
||||
m_ui->topicLineEdit->setText(topic);
|
||||
|
@@ -104,7 +104,7 @@ bool GerritRemoteChooser::updateRemotes(bool forceReload)
|
||||
m_remotes.clear();
|
||||
QString errorMessage; // Mute errors. We'll just fallback to the defaults
|
||||
const QMap<QString, QString> remotesList =
|
||||
Git::Internal::GitPlugin::client()->synchronousRemotesList(m_repository, &errorMessage);
|
||||
Git::Internal::GitPluginPrivate::client()->synchronousRemotesList(m_repository, &errorMessage);
|
||||
for (auto mapIt = remotesList.cbegin(), end = remotesList.cend(); mapIt != end; ++mapIt) {
|
||||
GerritServer server;
|
||||
if (!server.fillFromRemote(mapIt.value(), *m_parameters, forceReload))
|
||||
|
@@ -240,7 +240,7 @@ QStringList GerritServer::curlArguments() const
|
||||
|
||||
int GerritServer::testConnection()
|
||||
{
|
||||
static GitClient *const client = GitPlugin::client();
|
||||
static GitClient *const client = GitPluginPrivate::client();
|
||||
const QStringList arguments = curlArguments() << (url(RestUrl) + accountUrlC);
|
||||
const SynchronousProcessResponse resp = client->vcsFullySynchronousExec(
|
||||
QString(), {curlBinary, arguments},
|
||||
@@ -332,7 +332,7 @@ bool GerritServer::resolveRoot()
|
||||
|
||||
void GerritServer::resolveVersion(const GerritParameters &p, bool forceReload)
|
||||
{
|
||||
static GitClient *const client = GitPlugin::client();
|
||||
static GitClient *const client = GitPluginPrivate::client();
|
||||
QSettings *settings = Core::ICore::settings();
|
||||
const QString fullVersionKey = "Gerrit/" + host + '/' + versionKey;
|
||||
version = settings->value(fullVersionKey).toString();
|
||||
|
@@ -285,7 +285,7 @@ private:
|
||||
};
|
||||
|
||||
GitDiffEditorController::GitDiffEditorController(IDocument *document, const QString &workingDirectory) :
|
||||
VcsBaseDiffEditorController(document, GitPlugin::client(), workingDirectory),
|
||||
VcsBaseDiffEditorController(document, GitPluginPrivate::client(), workingDirectory),
|
||||
m_watcher(this),
|
||||
m_decorator(&m_watcher)
|
||||
{
|
||||
@@ -301,7 +301,7 @@ void GitDiffEditorController::updateBranchList()
|
||||
return;
|
||||
|
||||
const QString workingDirectory = baseDirectory();
|
||||
VcsCommand *command = GitPlugin::client()->vcsExec(
|
||||
VcsCommand *command = GitPluginPrivate::client()->vcsExec(
|
||||
workingDirectory, {"branch", noColorOption, "-a", "--contains", revision}, nullptr,
|
||||
false, 0, workingDirectory);
|
||||
connect(command, &VcsCommand::stdOutText, this, [this](const QString &text) {
|
||||
@@ -376,7 +376,7 @@ QStringList GitDiffEditorController::addHeadWhenCommandInProgress() const
|
||||
// This is workaround for lack of support for merge commits and resolving conflicts,
|
||||
// we compare the current state of working tree to the HEAD of current branch
|
||||
// instead of showing unsupported combined diff format.
|
||||
GitClient::CommandInProgress commandInProgress = GitPlugin::client()->checkCommandInProgress(workingDirectory());
|
||||
GitClient::CommandInProgress commandInProgress = GitPluginPrivate::client()->checkCommandInProgress(workingDirectory());
|
||||
if (commandInProgress != GitClient::NoCommand)
|
||||
return {HEAD};
|
||||
return QStringList();
|
||||
@@ -533,7 +533,7 @@ void ShowController::reload()
|
||||
// stage 1
|
||||
m_state = GettingDescription;
|
||||
const QStringList args = {"show", "-s", noColorOption, showFormatC, m_id};
|
||||
runCommand(QList<QStringList>() << args, GitPlugin::client()->encoding(workingDirectory(), "i18n.commitEncoding"));
|
||||
runCommand(QList<QStringList>() << args, GitPluginPrivate::client()->encoding(workingDirectory(), "i18n.commitEncoding"));
|
||||
setStartupFile(VcsBase::source(document()));
|
||||
}
|
||||
|
||||
@@ -541,7 +541,7 @@ void ShowController::processCommandOutput(const QString &output)
|
||||
{
|
||||
QTC_ASSERT(m_state != Idle, return);
|
||||
if (m_state == GettingDescription) {
|
||||
setDescription(GitPlugin::client()->extendedShowDescription(workingDirectory(), output));
|
||||
setDescription(GitPluginPrivate::client()->extendedShowDescription(workingDirectory(), output));
|
||||
// stage 2
|
||||
m_state = GettingDiff;
|
||||
const QStringList args = {"show", "--format=format:", // omit header, already generated
|
||||
@@ -680,7 +680,7 @@ private:
|
||||
{
|
||||
// If interactive rebase editor window is closed, plugin is terminated
|
||||
// but referenced here when the command ends
|
||||
if (GitPlugin *plugin = GitPlugin::instance()) {
|
||||
if (GitPluginPrivate *plugin = GitPluginPrivate::instance()) {
|
||||
GitClient *client = plugin->client();
|
||||
if (m_commit.isEmpty() && m_files.isEmpty()) {
|
||||
if (client->checkCommandInProgress(m_workingDirectory) == GitClient::NoCommand)
|
||||
@@ -1324,7 +1324,7 @@ void GitClient::removeStaleRemoteBranches(const QString &workingDirectory, const
|
||||
VcsCommand::ShowSuccessMessage);
|
||||
|
||||
connect(command, &VcsCommand::success,
|
||||
this, [workingDirectory]() { GitPlugin::instance()->updateBranches(workingDirectory); });
|
||||
this, [workingDirectory]() { GitPluginPrivate::instance()->updateBranches(workingDirectory); });
|
||||
}
|
||||
|
||||
void GitClient::recoverDeletedFiles(const QString &workingDirectory)
|
||||
@@ -2277,7 +2277,7 @@ GitClient::CommandInProgress GitClient::checkCommandInProgress(const QString &wo
|
||||
|
||||
void GitClient::continueCommandIfNeeded(const QString &workingDirectory, bool allowContinue)
|
||||
{
|
||||
if (GitPlugin::instance()->isCommitEditorOpen())
|
||||
if (GitPluginPrivate::instance()->isCommitEditorOpen())
|
||||
return;
|
||||
CommandInProgress command = checkCommandInProgress(workingDirectory);
|
||||
ContinueCommandMode continueMode;
|
||||
@@ -2350,7 +2350,7 @@ void GitClient::continuePreviousGitCommand(const QString &workingDirectory,
|
||||
if (isRebase)
|
||||
rebase(workingDirectory, QLatin1String(hasChanges ? "--continue" : "--skip"));
|
||||
else
|
||||
GitPlugin::instance()->startCommit();
|
||||
GitPluginPrivate::instance()->startCommit();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2843,7 +2843,7 @@ bool GitClient::addAndCommit(const QString &repositoryDirectory,
|
||||
if (resp.result == SynchronousProcessResponse::Finished) {
|
||||
VcsOutputWindow::appendMessage(msgCommitted(amendSHA1, commitCount));
|
||||
VcsOutputWindow::appendError(stdErr);
|
||||
GitPlugin::instance()->updateCurrentBranch();
|
||||
GitPluginPrivate::instance()->updateCurrentBranch();
|
||||
return true;
|
||||
} else {
|
||||
VcsOutputWindow::appendError(tr("Cannot commit %n files: %1\n", nullptr, commitCount).arg(stdErr));
|
||||
@@ -2945,7 +2945,7 @@ void GitClient::revert(const QStringList &files, bool revertStaging)
|
||||
QString errorMessage;
|
||||
switch (revertI(files, &isDirectory, &errorMessage, revertStaging)) {
|
||||
case RevertOk:
|
||||
GitPlugin::instance()->gitVersionControl()->emitFilesChanged(files);
|
||||
GitPluginPrivate::instance()->gitVersionControl()->emitFilesChanged(files);
|
||||
break;
|
||||
case RevertCanceled:
|
||||
break;
|
||||
@@ -2966,7 +2966,7 @@ void GitClient::fetch(const QString &workingDirectory, const QString &remote)
|
||||
VcsCommand *command = vcsExec(workingDirectory, arguments, nullptr, true,
|
||||
VcsCommand::ShowSuccessMessage);
|
||||
connect(command, &VcsCommand::success,
|
||||
this, [workingDirectory]() { GitPlugin::instance()->updateBranches(workingDirectory); });
|
||||
this, [workingDirectory]() { GitPluginPrivate::instance()->updateBranches(workingDirectory); });
|
||||
}
|
||||
|
||||
bool GitClient::executeAndHandleConflicts(const QString &workingDirectory,
|
||||
@@ -3180,7 +3180,7 @@ void GitClient::push(const QString &workingDirectory, const QStringList &pushArg
|
||||
QStringList({"push", "--force-with-lease"}) + pushArgs,
|
||||
nullptr, true, VcsCommand::ShowSuccessMessage);
|
||||
connect(rePushCommand, &VcsCommand::success,
|
||||
this, []() { GitPlugin::instance()->updateCurrentBranch(); });
|
||||
this, []() { GitPluginPrivate::instance()->updateCurrentBranch(); });
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -3201,13 +3201,13 @@ void GitClient::push(const QString &workingDirectory, const QStringList &pushArg
|
||||
fallbackCommandParts.mid(1),
|
||||
nullptr, true, VcsCommand::ShowSuccessMessage);
|
||||
connect(rePushCommand, &VcsCommand::success, this, [workingDirectory]() {
|
||||
GitPlugin::instance()->updateBranches(workingDirectory);
|
||||
GitPluginPrivate::instance()->updateBranches(workingDirectory);
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
GitPlugin::instance()->updateCurrentBranch();
|
||||
GitPluginPrivate::instance()->updateCurrentBranch();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -3469,7 +3469,7 @@ bool GitClient::StashInfo::init(const QString &workingDirectory, const QString &
|
||||
m_pushAction = pushAction;
|
||||
QString errorMessage;
|
||||
QString statusOutput;
|
||||
switch (GitPlugin::client()->gitStatus(m_workingDir, StatusMode(NoUntracked | NoSubmodules),
|
||||
switch (GitPluginPrivate::client()->gitStatus(m_workingDir, StatusMode(NoUntracked | NoSubmodules),
|
||||
&statusOutput, &errorMessage)) {
|
||||
case GitClient::StatusChanged:
|
||||
if (m_flags & NoPrompt)
|
||||
@@ -3522,14 +3522,14 @@ void GitClient::StashInfo::stashPrompt(const QString &command, const QString &st
|
||||
msgBox.exec();
|
||||
|
||||
if (msgBox.clickedButton() == discardButton) {
|
||||
m_stashResult = GitPlugin::client()->synchronousReset(m_workingDir, QStringList(), errorMessage) ?
|
||||
m_stashResult = GitPluginPrivate::client()->synchronousReset(m_workingDir, QStringList(), errorMessage) ?
|
||||
StashUnchanged : StashFailed;
|
||||
} else if (msgBox.clickedButton() == ignoreButton) { // At your own risk, so.
|
||||
m_stashResult = NotStashed;
|
||||
} else if (msgBox.clickedButton() == cancelButton) {
|
||||
m_stashResult = StashCanceled;
|
||||
} else if (msgBox.clickedButton() == stashButton) {
|
||||
const bool result = GitPlugin::client()->executeSynchronousStash(
|
||||
const bool result = GitPluginPrivate::client()->executeSynchronousStash(
|
||||
m_workingDir, creatorStashMessage(command), false, errorMessage);
|
||||
m_stashResult = result ? StashUnchanged : StashFailed;
|
||||
} else if (msgBox.clickedButton() == stashAndPopButton) {
|
||||
@@ -3540,7 +3540,7 @@ void GitClient::StashInfo::stashPrompt(const QString &command, const QString &st
|
||||
void GitClient::StashInfo::executeStash(const QString &command, QString *errorMessage)
|
||||
{
|
||||
m_message = creatorStashMessage(command);
|
||||
if (!GitPlugin::client()->executeSynchronousStash(m_workingDir, m_message, false, errorMessage))
|
||||
if (!GitPluginPrivate::client()->executeSynchronousStash(m_workingDir, m_message, false, errorMessage))
|
||||
m_stashResult = StashFailed;
|
||||
else
|
||||
m_stashResult = Stashed;
|
||||
@@ -3563,14 +3563,14 @@ void GitClient::StashInfo::end()
|
||||
{
|
||||
if (m_stashResult == Stashed) {
|
||||
QString stashName;
|
||||
if (GitPlugin::client()->stashNameFromMessage(m_workingDir, m_message, &stashName))
|
||||
GitPlugin::client()->stashPop(m_workingDir, stashName);
|
||||
if (GitPluginPrivate::client()->stashNameFromMessage(m_workingDir, m_message, &stashName))
|
||||
GitPluginPrivate::client()->stashPop(m_workingDir, stashName);
|
||||
}
|
||||
|
||||
if (m_pushAction == NormalPush)
|
||||
GitPlugin::client()->push(m_workingDir);
|
||||
GitPluginPrivate::client()->push(m_workingDir);
|
||||
else if (m_pushAction == PushToGerrit)
|
||||
GitPlugin::instance()->gerritPlugin()->push(m_workingDir);
|
||||
GitPluginPrivate::instance()->gerritPlugin()->push(m_workingDir);
|
||||
|
||||
m_pushAction = NoPush;
|
||||
m_stashResult = NotStashed;
|
||||
|
@@ -126,7 +126,7 @@ static QString sanitizeBlameOutput(const QString &b)
|
||||
if (b.isEmpty())
|
||||
return b;
|
||||
|
||||
const bool omitDate = GitPlugin::client()->settings().boolValue(
|
||||
const bool omitDate = GitPluginPrivate::client()->settings().boolValue(
|
||||
GitSettings::omitAnnotationDateKey);
|
||||
const QChar space(' ');
|
||||
const int parenPos = b.indexOf(')');
|
||||
@@ -192,7 +192,7 @@ void GitEditorWidget::setPlainText(const QString &text)
|
||||
|
||||
void GitEditorWidget::resetChange(const QByteArray &resetType)
|
||||
{
|
||||
GitPlugin::client()->reset(
|
||||
GitPluginPrivate::client()->reset(
|
||||
sourceWorkingDirectory(), QLatin1String("--" + resetType), m_currentChange);
|
||||
}
|
||||
|
||||
@@ -211,7 +211,7 @@ void GitEditorWidget::applyDiffChunk(const DiffChunk& chunk, bool revert)
|
||||
if (revert)
|
||||
args << "--reverse";
|
||||
QString errorMessage;
|
||||
if (GitPlugin::client()->synchronousApplyPatch(baseDir, patchFile.fileName(), &errorMessage, args)) {
|
||||
if (GitPluginPrivate::client()->synchronousApplyPatch(baseDir, patchFile.fileName(), &errorMessage, args)) {
|
||||
if (errorMessage.isEmpty())
|
||||
VcsOutputWindow::append(tr("Chunk successfully staged"));
|
||||
else
|
||||
@@ -260,14 +260,14 @@ void GitEditorWidget::aboutToOpen(const QString &fileName, const QString &realFi
|
||||
const QString gitPath = fi.absolutePath();
|
||||
setSource(gitPath);
|
||||
textDocument()->setCodec(
|
||||
GitPlugin::client()->encoding(gitPath, "i18n.commitEncoding"));
|
||||
GitPluginPrivate::client()->encoding(gitPath, "i18n.commitEncoding"));
|
||||
}
|
||||
}
|
||||
|
||||
QString GitEditorWidget::decorateVersion(const QString &revision) const
|
||||
{
|
||||
// Format verbose, SHA1 being first token
|
||||
return GitPlugin::client()->synchronousShortDescription(sourceWorkingDirectory(), revision);
|
||||
return GitPluginPrivate::client()->synchronousShortDescription(sourceWorkingDirectory(), revision);
|
||||
}
|
||||
|
||||
QStringList GitEditorWidget::annotationPreviousVersions(const QString &revision) const
|
||||
@@ -275,7 +275,7 @@ QStringList GitEditorWidget::annotationPreviousVersions(const QString &revision)
|
||||
QStringList revisions;
|
||||
QString errorMessage;
|
||||
// Get the SHA1's of the file.
|
||||
if (!GitPlugin::client()->synchronousParentRevisions(sourceWorkingDirectory(),
|
||||
if (!GitPluginPrivate::client()->synchronousParentRevisions(sourceWorkingDirectory(),
|
||||
revision, &revisions, &errorMessage)) {
|
||||
VcsOutputWindow::appendSilently(errorMessage);
|
||||
return QStringList();
|
||||
@@ -285,7 +285,7 @@ QStringList GitEditorWidget::annotationPreviousVersions(const QString &revision)
|
||||
|
||||
bool GitEditorWidget::isValidRevision(const QString &revision) const
|
||||
{
|
||||
return GitPlugin::client()->isValidRevision(revision);
|
||||
return GitPluginPrivate::client()->isValidRevision(revision);
|
||||
}
|
||||
|
||||
void GitEditorWidget::addChangeActions(QMenu *menu, const QString &change)
|
||||
@@ -295,25 +295,25 @@ void GitEditorWidget::addChangeActions(QMenu *menu, const QString &change)
|
||||
return;
|
||||
|
||||
menu->addAction(tr("Cherr&y-Pick Change %1").arg(change), this, [this] {
|
||||
GitPlugin::client()->synchronousCherryPick(sourceWorkingDirectory(), m_currentChange);
|
||||
GitPluginPrivate::client()->synchronousCherryPick(sourceWorkingDirectory(), m_currentChange);
|
||||
});
|
||||
menu->addAction(tr("Re&vert Change %1").arg(change), this, [this] {
|
||||
GitPlugin::client()->synchronousRevert(sourceWorkingDirectory(), m_currentChange);
|
||||
GitPluginPrivate::client()->synchronousRevert(sourceWorkingDirectory(), m_currentChange);
|
||||
});
|
||||
menu->addAction(tr("C&heckout Change %1").arg(change), this, [this] {
|
||||
GitPlugin::client()->checkout(sourceWorkingDirectory(), m_currentChange);
|
||||
GitPluginPrivate::client()->checkout(sourceWorkingDirectory(), m_currentChange);
|
||||
});
|
||||
connect(menu->addAction(tr("&Interactive Rebase from Change %1...").arg(change)),
|
||||
&QAction::triggered, this, [this] {
|
||||
GitPlugin::instance()->startRebaseFromCommit(sourceWorkingDirectory(), m_currentChange);
|
||||
GitPluginPrivate::instance()->startRebaseFromCommit(sourceWorkingDirectory(), m_currentChange);
|
||||
});
|
||||
menu->addAction(tr("&Log for Change %1").arg(change), this, [this] {
|
||||
GitPlugin::client()->log(sourceWorkingDirectory(), QString(), false, {m_currentChange});
|
||||
GitPluginPrivate::client()->log(sourceWorkingDirectory(), QString(), false, {m_currentChange});
|
||||
});
|
||||
menu->addAction(tr("Add &Tag for Change %1...").arg(change), this, [this] {
|
||||
QString output;
|
||||
QString errorMessage;
|
||||
GitPlugin::client()->synchronousTagCmd(sourceWorkingDirectory(), QStringList(),
|
||||
GitPluginPrivate::client()->synchronousTagCmd(sourceWorkingDirectory(), QStringList(),
|
||||
&output, &errorMessage);
|
||||
|
||||
const QStringList tags = output.split('\n');
|
||||
@@ -322,7 +322,7 @@ void GitEditorWidget::addChangeActions(QMenu *menu, const QString &change)
|
||||
if (dialog.exec() == QDialog::Rejected)
|
||||
return;
|
||||
|
||||
GitPlugin::client()->synchronousTagCmd(sourceWorkingDirectory(),
|
||||
GitPluginPrivate::client()->synchronousTagCmd(sourceWorkingDirectory(),
|
||||
{dialog.branchName(), m_currentChange},
|
||||
&output, &errorMessage);
|
||||
VcsOutputWindow::append(output);
|
||||
|
@@ -158,7 +158,7 @@ public:
|
||||
|
||||
void exec()
|
||||
{
|
||||
GitClient *client = GitPlugin::client();
|
||||
GitClient *client = GitPluginPrivate::client();
|
||||
QStringList arguments = {
|
||||
"-c", "color.grep.match=bold red",
|
||||
"-c", "color.grep=always",
|
||||
@@ -248,7 +248,7 @@ GitGrep::GitGrep(QObject *parent)
|
||||
const QRegularExpression refExpression("[\\S]*");
|
||||
m_treeLineEdit->setValidator(new QRegularExpressionValidator(refExpression, this));
|
||||
layout->addWidget(m_treeLineEdit);
|
||||
if (GitPlugin::client()->gitVersion() >= 0x021300) {
|
||||
if (GitPluginPrivate::client()->gitVersion() >= 0x021300) {
|
||||
m_recurseSubmodules = new QCheckBox(tr("Recurse submodules"));
|
||||
layout->addWidget(m_recurseSubmodules);
|
||||
}
|
||||
@@ -320,7 +320,7 @@ IEditor *GitGrep::openEditor(const SearchResultItem &item,
|
||||
QByteArray content;
|
||||
const QString topLevel = parameters.additionalParameters.toString();
|
||||
const QString relativePath = QDir(topLevel).relativeFilePath(path);
|
||||
if (!GitPlugin::client()->synchronousShow(topLevel, params.ref + ":./" + relativePath,
|
||||
if (!GitPluginPrivate::client()->synchronousShow(topLevel, params.ref + ":./" + relativePath,
|
||||
&content, nullptr)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@@ -129,25 +129,23 @@ const VcsBaseEditorParameters editorParameters[] = {
|
||||
|
||||
// GitPlugin
|
||||
|
||||
static GitPlugin *m_instance = nullptr;
|
||||
static GitPluginPrivate *dd = nullptr;
|
||||
|
||||
GitPlugin::GitPlugin()
|
||||
{
|
||||
m_instance = this;
|
||||
m_fileActions.reserve(10);
|
||||
m_projectActions.reserve(10);
|
||||
m_repositoryActions.reserve(50);
|
||||
}
|
||||
|
||||
GitPlugin::~GitPlugin()
|
||||
GitPluginPrivate::~GitPluginPrivate()
|
||||
{
|
||||
cleanCommitMessageFile();
|
||||
delete m_gitClient;
|
||||
delete m_branchViewFactory;
|
||||
m_instance = nullptr;
|
||||
}
|
||||
|
||||
void GitPlugin::cleanCommitMessageFile()
|
||||
|
||||
GitPlugin::~GitPlugin()
|
||||
{
|
||||
delete dd;
|
||||
dd = nullptr;
|
||||
}
|
||||
|
||||
void GitPluginPrivate::cleanCommitMessageFile()
|
||||
{
|
||||
if (!m_commitMessageFileName.isEmpty()) {
|
||||
QFile::remove(m_commitMessageFileName);
|
||||
@@ -155,22 +153,22 @@ void GitPlugin::cleanCommitMessageFile()
|
||||
}
|
||||
}
|
||||
|
||||
bool GitPlugin::isCommitEditorOpen() const
|
||||
bool GitPluginPrivate::isCommitEditorOpen() const
|
||||
{
|
||||
return !m_commitMessageFileName.isEmpty();
|
||||
}
|
||||
|
||||
GitPlugin *GitPlugin::instance()
|
||||
GitPluginPrivate *GitPluginPrivate::instance()
|
||||
{
|
||||
return m_instance;
|
||||
return dd;
|
||||
}
|
||||
|
||||
GitClient *GitPlugin::client()
|
||||
GitClient *GitPluginPrivate::client()
|
||||
{
|
||||
return m_instance->m_gitClient;
|
||||
return dd->m_gitClient;
|
||||
}
|
||||
|
||||
QString GitPlugin::msgRepositoryLabel(const QString &repository)
|
||||
QString GitPluginPrivate::msgRepositoryLabel(const QString &repository)
|
||||
{
|
||||
return repository.isEmpty() ?
|
||||
tr("<No repository>") :
|
||||
@@ -179,7 +177,7 @@ QString GitPlugin::msgRepositoryLabel(const QString &repository)
|
||||
|
||||
// Returns a regular expression pattern with characters not allowed
|
||||
// in branch and remote names.
|
||||
QString GitPlugin::invalidBranchAndRemoteNamePattern()
|
||||
QString GitPluginPrivate::invalidBranchAndRemoteNamePattern()
|
||||
{
|
||||
return QLatin1String(
|
||||
"\\s" // no whitespace
|
||||
@@ -206,7 +204,7 @@ const VcsBaseSubmitEditorParameters submitParameters = {
|
||||
VcsBaseSubmitEditorParameters::DiffRows
|
||||
};
|
||||
|
||||
Command *GitPlugin::createCommand(QAction *action, ActionContainer *ac, Id id,
|
||||
Command *GitPluginPrivate::createCommand(QAction *action, ActionContainer *ac, Id id,
|
||||
const Context &context, bool addToLocator,
|
||||
const std::function<void()> &callback, const QKeySequence &keys)
|
||||
{
|
||||
@@ -222,7 +220,7 @@ Command *GitPlugin::createCommand(QAction *action, ActionContainer *ac, Id id,
|
||||
}
|
||||
|
||||
// Create a parameter action
|
||||
ParameterAction *GitPlugin::createParameterAction(ActionContainer *ac,
|
||||
ParameterAction *GitPluginPrivate::createParameterAction(ActionContainer *ac,
|
||||
const QString &defaultText, const QString ¶meterText,
|
||||
Id id, const Context &context,
|
||||
bool addToLocator, const std::function<void()> &callback,
|
||||
@@ -235,7 +233,7 @@ ParameterAction *GitPlugin::createParameterAction(ActionContainer *ac,
|
||||
}
|
||||
|
||||
// Create an action to act on a file.
|
||||
QAction *GitPlugin::createFileAction(ActionContainer *ac,
|
||||
QAction *GitPluginPrivate::createFileAction(ActionContainer *ac,
|
||||
const QString &defaultText, const QString ¶meterText,
|
||||
Id id, const Context &context, bool addToLocator,
|
||||
const std::function<void()> &callback,
|
||||
@@ -247,9 +245,9 @@ QAction *GitPlugin::createFileAction(ActionContainer *ac,
|
||||
return action;
|
||||
}
|
||||
|
||||
QAction *GitPlugin::createProjectAction(ActionContainer *ac, const QString &defaultText,
|
||||
QAction *GitPluginPrivate::createProjectAction(ActionContainer *ac, const QString &defaultText,
|
||||
const QString ¶meterText, Id id, const Context &context,
|
||||
bool addToLocator, void (GitPlugin::*func)(),
|
||||
bool addToLocator, void (GitPluginPrivate::*func)(),
|
||||
const QKeySequence &keys)
|
||||
{
|
||||
ParameterAction *action = createParameterAction(ac, defaultText, parameterText, id, context,
|
||||
@@ -259,7 +257,7 @@ QAction *GitPlugin::createProjectAction(ActionContainer *ac, const QString &defa
|
||||
}
|
||||
|
||||
// Create an action to act on the repository
|
||||
QAction *GitPlugin::createRepositoryAction(ActionContainer *ac, const QString &text, Id id,
|
||||
QAction *GitPluginPrivate::createRepositoryAction(ActionContainer *ac, const QString &text, Id id,
|
||||
const Context &context, bool addToLocator,
|
||||
const std::function<void()> &callback,
|
||||
const QKeySequence &keys)
|
||||
@@ -270,17 +268,17 @@ QAction *GitPlugin::createRepositoryAction(ActionContainer *ac, const QString &t
|
||||
return action;
|
||||
}
|
||||
|
||||
QAction *GitPlugin::createChangeRelatedRepositoryAction(const QString &text, Id id,
|
||||
QAction *GitPluginPrivate::createChangeRelatedRepositoryAction(const QString &text, Id id,
|
||||
const Context &context)
|
||||
{
|
||||
return createRepositoryAction(nullptr, text, id, context, true,
|
||||
std::bind(&GitPlugin::startChangeRelatedAction, this, id),
|
||||
std::bind(&GitPluginPrivate::startChangeRelatedAction, this, id),
|
||||
QKeySequence());
|
||||
}
|
||||
|
||||
// Action to act on the repository forwarded to a git client member function
|
||||
// taking the directory.
|
||||
QAction *GitPlugin::createRepositoryAction(ActionContainer *ac, const QString &text, Id id,
|
||||
QAction *GitPluginPrivate::createRepositoryAction(ActionContainer *ac, const QString &text, Id id,
|
||||
const Context &context, bool addToLocator,
|
||||
GitClientMemberFunc func, const QKeySequence &keys)
|
||||
{
|
||||
@@ -296,6 +294,29 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
{
|
||||
Q_UNUSED(errorMessage)
|
||||
|
||||
dd = new GitPluginPrivate;
|
||||
|
||||
auto cmdContext = new QObject(this);
|
||||
connect(Core::ICore::instance(), &Core::ICore::coreOpened, cmdContext, [this, cmdContext, arguments] {
|
||||
remoteCommand(arguments, QDir::currentPath(), {});
|
||||
cmdContext->deleteLater();
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void GitPlugin::extensionsInitialized()
|
||||
{
|
||||
dd->extensionsInitialized() ;
|
||||
}
|
||||
|
||||
GitPluginPrivate::GitPluginPrivate()
|
||||
{
|
||||
dd = this;
|
||||
m_fileActions.reserve(10);
|
||||
m_projectActions.reserve(10);
|
||||
m_repositoryActions.reserve(50);
|
||||
|
||||
Context context(Constants::GIT_CONTEXT);
|
||||
|
||||
m_gitClient = new GitClient;
|
||||
@@ -306,7 +327,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
// Create the settings Page
|
||||
auto settingsPage = new SettingsPage(vc, this);
|
||||
connect(settingsPage, &SettingsPage::settingsChanged,
|
||||
this, &GitPlugin::updateRepositoryBrowserAction);
|
||||
this, &GitPluginPrivate::updateRepositoryBrowserAction);
|
||||
|
||||
new GitGrep(this);
|
||||
m_branchViewFactory = new BranchViewFactory;
|
||||
@@ -340,33 +361,33 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
gitContainer->addMenu(currentFileMenu);
|
||||
|
||||
createFileAction(currentFileMenu, tr("Diff Current File"), tr("Diff of \"%1\""),
|
||||
"Git.Diff", context, true, std::bind(&GitPlugin::diffCurrentFile, this),
|
||||
"Git.Diff", context, true, std::bind(&GitPluginPrivate::diffCurrentFile, this),
|
||||
QKeySequence(useMacShortcuts ? tr("Meta+G,Meta+D") : tr("Alt+G,Alt+D")));
|
||||
|
||||
createFileAction(currentFileMenu, tr("Log Current File"), tr("Log of \"%1\""),
|
||||
"Git.Log", context, true, std::bind(&GitPlugin::logFile, this),
|
||||
"Git.Log", context, true, std::bind(&GitPluginPrivate::logFile, this),
|
||||
QKeySequence(useMacShortcuts ? tr("Meta+G,Meta+L") : tr("Alt+G,Alt+L")));
|
||||
|
||||
createFileAction(currentFileMenu, tr("Blame Current File"), tr("Blame for \"%1\""),
|
||||
"Git.Blame", context, true, std::bind(&GitPlugin::blameFile, this),
|
||||
"Git.Blame", context, true, std::bind(&GitPluginPrivate::blameFile, this),
|
||||
QKeySequence(useMacShortcuts ? tr("Meta+G,Meta+B") : tr("Alt+G,Alt+B")));
|
||||
|
||||
currentFileMenu->addSeparator(context);
|
||||
|
||||
createFileAction(currentFileMenu, tr("Stage File for Commit"), tr("Stage \"%1\" for Commit"),
|
||||
"Git.Stage", context, true, std::bind(&GitPlugin::stageFile, this),
|
||||
"Git.Stage", context, true, std::bind(&GitPluginPrivate::stageFile, this),
|
||||
QKeySequence(useMacShortcuts ? tr("Meta+G,Meta+A") : tr("Alt+G,Alt+A")));
|
||||
|
||||
createFileAction(currentFileMenu, tr("Unstage File from Commit"), tr("Unstage \"%1\" from Commit"),
|
||||
"Git.Unstage", context, true, std::bind(&GitPlugin::unstageFile, this));
|
||||
"Git.Unstage", context, true, std::bind(&GitPluginPrivate::unstageFile, this));
|
||||
|
||||
createFileAction(currentFileMenu, tr("Undo Unstaged Changes"), tr("Undo Unstaged Changes for \"%1\""),
|
||||
"Git.UndoUnstaged", context,
|
||||
true, std::bind(&GitPlugin::undoFileChanges, this, false));
|
||||
true, std::bind(&GitPluginPrivate::undoFileChanges, this, false));
|
||||
|
||||
createFileAction(currentFileMenu, tr("Undo Uncommitted Changes"), tr("Undo Uncommitted Changes for \"%1\""),
|
||||
"Git.Undo", context,
|
||||
true, std::bind(&GitPlugin::undoFileChanges, this, true),
|
||||
true, std::bind(&GitPluginPrivate::undoFileChanges, this, true),
|
||||
QKeySequence(useMacShortcuts ? tr("Meta+G,Meta+U") : tr("Alt+G,Alt+U")));
|
||||
|
||||
|
||||
@@ -376,15 +397,15 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
gitContainer->addMenu(currentProjectMenu);
|
||||
|
||||
createProjectAction(currentProjectMenu, tr("Diff Current Project"), tr("Diff Project \"%1\""),
|
||||
"Git.DiffProject", context, true, &GitPlugin::diffCurrentProject,
|
||||
"Git.DiffProject", context, true, &GitPluginPrivate::diffCurrentProject,
|
||||
QKeySequence(useMacShortcuts ? tr("Meta+G,Meta+Shift+D") : tr("Alt+G,Alt+Shift+D")));
|
||||
|
||||
createProjectAction(currentProjectMenu, tr("Log Project"), tr("Log Project \"%1\""),
|
||||
"Git.LogProject", context, true, &GitPlugin::logProject,
|
||||
"Git.LogProject", context, true, &GitPluginPrivate::logProject,
|
||||
QKeySequence(useMacShortcuts ? tr("Meta+G,Meta+K") : tr("Alt+G,Alt+K")));
|
||||
|
||||
createProjectAction(currentProjectMenu, tr("Clean Project..."), tr("Clean Project \"%1\"..."),
|
||||
"Git.CleanProject", context, true, &GitPlugin::cleanProject);
|
||||
"Git.CleanProject", context, true, &GitPluginPrivate::cleanProject);
|
||||
|
||||
|
||||
/* "Local Repository" menu */
|
||||
@@ -396,7 +417,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
context, true, &GitClient::diffRepository);
|
||||
|
||||
createRepositoryAction(localRepositoryMenu, tr("Log"), "Git.LogRepository",
|
||||
context, true, std::bind(&GitPlugin::logRepository, this));
|
||||
context, true, std::bind(&GitPluginPrivate::logRepository, this));
|
||||
|
||||
createRepositoryAction(localRepositoryMenu, tr("Reflog"), "Git.ReflogRepository",
|
||||
context, true, &GitClient::reflog);
|
||||
@@ -411,88 +432,88 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
localRepositoryMenu->addSeparator(context);
|
||||
|
||||
createRepositoryAction(localRepositoryMenu, tr("Commit..."), "Git.Commit",
|
||||
context, true, std::bind(&GitPlugin::startCommit, this, SimpleCommit),
|
||||
context, true, std::bind(&GitPluginPrivate::startCommit, this, SimpleCommit),
|
||||
QKeySequence(useMacShortcuts ? tr("Meta+G,Meta+C") : tr("Alt+G,Alt+C")));
|
||||
|
||||
createRepositoryAction(localRepositoryMenu, tr("Amend Last Commit..."), "Git.AmendCommit",
|
||||
context, true, std::bind(&GitPlugin::startCommit, this, AmendCommit));
|
||||
context, true, std::bind(&GitPluginPrivate::startCommit, this, AmendCommit));
|
||||
|
||||
m_fixupCommitAction
|
||||
= createRepositoryAction(localRepositoryMenu,
|
||||
tr("Fixup Previous Commit..."), "Git.FixupCommit", context, true,
|
||||
std::bind(&GitPlugin::startCommit, this, FixupCommit));
|
||||
std::bind(&GitPluginPrivate::startCommit, this, FixupCommit));
|
||||
|
||||
// --------------
|
||||
localRepositoryMenu->addSeparator(context);
|
||||
|
||||
createRepositoryAction(localRepositoryMenu, tr("Reset..."), "Git.Reset",
|
||||
context, true, std::bind(&GitPlugin::resetRepository, this));
|
||||
context, true, std::bind(&GitPluginPrivate::resetRepository, this));
|
||||
|
||||
createRepositoryAction(localRepositoryMenu, tr("Recover Deleted Files"), "Git.RecoverDeleted",
|
||||
context, true, std::bind(&GitPlugin::recoverDeletedFiles, this));
|
||||
context, true, std::bind(&GitPluginPrivate::recoverDeletedFiles, this));
|
||||
|
||||
m_interactiveRebaseAction
|
||||
= createRepositoryAction(localRepositoryMenu,
|
||||
tr("Interactive Rebase..."), "Git.InteractiveRebase",
|
||||
context, true, std::bind(&GitPlugin::startRebase, this));
|
||||
context, true, std::bind(&GitPluginPrivate::startRebase, this));
|
||||
|
||||
m_submoduleUpdateAction
|
||||
= createRepositoryAction(localRepositoryMenu,
|
||||
tr("Update Submodules"), "Git.SubmoduleUpdate",
|
||||
context, true, std::bind(&GitPlugin::updateSubmodules, this));
|
||||
context, true, std::bind(&GitPluginPrivate::updateSubmodules, this));
|
||||
m_abortMergeAction
|
||||
= createRepositoryAction(localRepositoryMenu,
|
||||
tr("Abort Merge"), "Git.MergeAbort",
|
||||
context, true,
|
||||
std::bind(&GitPlugin::continueOrAbortCommand, this));
|
||||
std::bind(&GitPluginPrivate::continueOrAbortCommand, this));
|
||||
|
||||
m_abortRebaseAction
|
||||
= createRepositoryAction(localRepositoryMenu,
|
||||
tr("Abort Rebase"), "Git.RebaseAbort",
|
||||
context, true,
|
||||
std::bind(&GitPlugin::continueOrAbortCommand, this));
|
||||
std::bind(&GitPluginPrivate::continueOrAbortCommand, this));
|
||||
|
||||
m_abortCherryPickAction
|
||||
= createRepositoryAction(localRepositoryMenu,
|
||||
tr("Abort Cherry Pick"), "Git.CherryPickAbort",
|
||||
context, true,
|
||||
std::bind(&GitPlugin::continueOrAbortCommand, this));
|
||||
std::bind(&GitPluginPrivate::continueOrAbortCommand, this));
|
||||
|
||||
m_abortRevertAction
|
||||
= createRepositoryAction(localRepositoryMenu,
|
||||
tr("Abort Revert"), "Git.RevertAbort",
|
||||
context, true,
|
||||
std::bind(&GitPlugin::continueOrAbortCommand, this));
|
||||
std::bind(&GitPluginPrivate::continueOrAbortCommand, this));
|
||||
|
||||
m_continueRebaseAction
|
||||
= createRepositoryAction(localRepositoryMenu,
|
||||
tr("Continue Rebase"), "Git.RebaseContinue",
|
||||
context, true,
|
||||
std::bind(&GitPlugin::continueOrAbortCommand, this));
|
||||
std::bind(&GitPluginPrivate::continueOrAbortCommand, this));
|
||||
|
||||
m_skipRebaseAction
|
||||
= createRepositoryAction(localRepositoryMenu,
|
||||
tr("Skip Rebase"), "Git.RebaseSkip",
|
||||
context, true,
|
||||
std::bind(&GitPlugin::continueOrAbortCommand, this));
|
||||
std::bind(&GitPluginPrivate::continueOrAbortCommand, this));
|
||||
|
||||
m_continueCherryPickAction
|
||||
= createRepositoryAction(localRepositoryMenu,
|
||||
tr("Continue Cherry Pick"), "Git.CherryPickContinue",
|
||||
context, true,
|
||||
std::bind(&GitPlugin::continueOrAbortCommand, this));
|
||||
std::bind(&GitPluginPrivate::continueOrAbortCommand, this));
|
||||
|
||||
m_continueRevertAction
|
||||
= createRepositoryAction(localRepositoryMenu,
|
||||
tr("Continue Revert"), "Git.RevertContinue",
|
||||
context, true,
|
||||
std::bind(&GitPlugin::continueOrAbortCommand, this));
|
||||
std::bind(&GitPluginPrivate::continueOrAbortCommand, this));
|
||||
|
||||
// --------------
|
||||
localRepositoryMenu->addSeparator(context);
|
||||
|
||||
createRepositoryAction(localRepositoryMenu, tr("Branches..."), "Git.BranchList",
|
||||
context, true, std::bind(&GitPlugin::branchList, this));
|
||||
context, true, std::bind(&GitPluginPrivate::branchList, this));
|
||||
|
||||
// --------------
|
||||
localRepositoryMenu->addSeparator(context);
|
||||
@@ -507,9 +528,9 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
= createParameterAction(patchMenu,
|
||||
tr("Apply from Editor"), tr("Apply \"%1\""),
|
||||
"Git.ApplyCurrentFilePatch",
|
||||
context, true, std::bind(&GitPlugin::applyCurrentFilePatch, this));
|
||||
context, true, std::bind(&GitPluginPrivate::applyCurrentFilePatch, this));
|
||||
createRepositoryAction(patchMenu, tr("Apply from File..."), "Git.ApplyPatch",
|
||||
context, true, std::bind(&GitPlugin::promptApplyPatch, this));
|
||||
context, true, std::bind(&GitPluginPrivate::promptApplyPatch, this));
|
||||
|
||||
// "Stash" menu
|
||||
ActionContainer *stashMenu = ActionManager::createMenu("Git.StashMenu");
|
||||
@@ -517,27 +538,27 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
localRepositoryMenu->addMenu(stashMenu);
|
||||
|
||||
createRepositoryAction(stashMenu, tr("Stashes..."), "Git.StashList",
|
||||
context, false, std::bind(&GitPlugin::stashList, this));
|
||||
context, false, std::bind(&GitPluginPrivate::stashList, this));
|
||||
|
||||
stashMenu->addSeparator(context);
|
||||
|
||||
QAction *action = createRepositoryAction(stashMenu, tr("Stash"), "Git.Stash",
|
||||
context, true, std::bind(&GitPlugin::stash, this, false));
|
||||
context, true, std::bind(&GitPluginPrivate::stash, this, false));
|
||||
action->setToolTip(tr("Saves the current state of your work and resets the repository."));
|
||||
|
||||
action = createRepositoryAction(stashMenu, tr("Stash Unstaged Files"), "Git.StashUnstaged",
|
||||
context, true, std::bind(&GitPlugin::stashUnstaged, this));
|
||||
context, true, std::bind(&GitPluginPrivate::stashUnstaged, this));
|
||||
action->setToolTip(tr("Saves the current state of your unstaged files and resets the repository "
|
||||
"to its staged state."));
|
||||
|
||||
action = createRepositoryAction(stashMenu, tr("Take Snapshot..."), "Git.StashSnapshot",
|
||||
context, true, std::bind(&GitPlugin::stashSnapshot, this));
|
||||
context, true, std::bind(&GitPluginPrivate::stashSnapshot, this));
|
||||
action->setToolTip(tr("Saves the current state of your work."));
|
||||
|
||||
stashMenu->addSeparator(context);
|
||||
|
||||
action = createRepositoryAction(stashMenu, tr("Stash Pop"), "Git.StashPop",
|
||||
context, true, std::bind(&GitPlugin::stashPop, this));
|
||||
context, true, std::bind(&GitPluginPrivate::stashPop, this));
|
||||
action->setToolTip(tr("Restores changes saved to the stash list using \"Stash\"."));
|
||||
|
||||
|
||||
@@ -551,13 +572,13 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
gitContainer->addMenu(remoteRepositoryMenu);
|
||||
|
||||
createRepositoryAction(remoteRepositoryMenu, tr("Fetch"), "Git.Fetch",
|
||||
context, true, std::bind(&GitPlugin::fetch, this));
|
||||
context, true, std::bind(&GitPluginPrivate::fetch, this));
|
||||
|
||||
createRepositoryAction(remoteRepositoryMenu, tr("Pull"), "Git.Pull",
|
||||
context, true, std::bind(&GitPlugin::pull, this));
|
||||
context, true, std::bind(&GitPluginPrivate::pull, this));
|
||||
|
||||
createRepositoryAction(remoteRepositoryMenu, tr("Push"), "Git.Push",
|
||||
context, true, std::bind(&GitPlugin::push, this));
|
||||
context, true, std::bind(&GitPluginPrivate::push, this));
|
||||
|
||||
// --------------
|
||||
remoteRepositoryMenu->addSeparator(context);
|
||||
@@ -580,7 +601,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
remoteRepositoryMenu->addSeparator(context);
|
||||
|
||||
createRepositoryAction(remoteRepositoryMenu, tr("Manage Remotes..."), "Git.RemoteList",
|
||||
context, false, std::bind(&GitPlugin::manageRemotes, this));
|
||||
context, false, std::bind(&GitPluginPrivate::manageRemotes, this));
|
||||
|
||||
/* \"Remote Repository" menu */
|
||||
|
||||
@@ -594,9 +615,9 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
createChangeRelatedRepositoryAction(tr("Archive..."), "Git.Archive", context);
|
||||
|
||||
createRepositoryAction(nullptr, tr("Rebase..."), "Git.Rebase", context, true,
|
||||
std::bind(&GitPlugin::branchList, this));
|
||||
std::bind(&GitPluginPrivate::branchList, this));
|
||||
createRepositoryAction(nullptr, tr("Merge..."), "Git.Merge", context, true,
|
||||
std::bind(&GitPlugin::branchList, this));
|
||||
std::bind(&GitPluginPrivate::branchList, this));
|
||||
/* \Actions only in locator */
|
||||
|
||||
// --------------
|
||||
@@ -610,16 +631,16 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
context, true, &GitClient::launchGitK);
|
||||
|
||||
createFileAction(gitToolsMenu, tr("Gitk Current File"), tr("Gitk of \"%1\""),
|
||||
"Git.GitkFile", context, true, std::bind(&GitPlugin::gitkForCurrentFile, this));
|
||||
"Git.GitkFile", context, true, std::bind(&GitPluginPrivate::gitkForCurrentFile, this));
|
||||
|
||||
createFileAction(gitToolsMenu, tr("Gitk for folder of Current File"), tr("Gitk for folder of \"%1\""),
|
||||
"Git.GitkFolder", context, true, std::bind(&GitPlugin::gitkForCurrentFolder, this));
|
||||
"Git.GitkFolder", context, true, std::bind(&GitPluginPrivate::gitkForCurrentFolder, this));
|
||||
|
||||
// --------------
|
||||
gitToolsMenu->addSeparator(context);
|
||||
|
||||
createRepositoryAction(gitToolsMenu, tr("Git Gui"), "Git.GitGui",
|
||||
context, true, std::bind(&GitPlugin::gitGui, this));
|
||||
context, true, std::bind(&GitPluginPrivate::gitGui, this));
|
||||
|
||||
// --------------
|
||||
gitToolsMenu->addSeparator(context);
|
||||
@@ -631,7 +652,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
|
||||
m_mergeToolAction
|
||||
= createRepositoryAction(gitToolsMenu, tr("Merge Tool"), "Git.MergeTool",
|
||||
context, true, std::bind(&GitPlugin::startMergeTool, this));
|
||||
context, true, std::bind(&GitPluginPrivate::startMergeTool, this));
|
||||
|
||||
/* \"Git Tools" menu */
|
||||
|
||||
@@ -648,42 +669,34 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
QAction *createRepositoryAction = new QAction(tr("Create Repository..."), this);
|
||||
Command *createRepositoryCommand = ActionManager::registerAction(
|
||||
createRepositoryAction, "Git.CreateRepository");
|
||||
connect(createRepositoryAction, &QAction::triggered, this, &GitPlugin::createRepository);
|
||||
connect(createRepositoryAction, &QAction::triggered, this, &GitPluginPrivate::createRepository);
|
||||
gitContainer->addAction(createRepositoryCommand);
|
||||
|
||||
connect(VcsManager::instance(), &VcsManager::repositoryChanged,
|
||||
this, &GitPlugin::updateContinueAndAbortCommands);
|
||||
this, &GitPluginPrivate::updateContinueAndAbortCommands);
|
||||
connect(VcsManager::instance(), &VcsManager::repositoryChanged,
|
||||
this, &GitPlugin::updateBranches, Qt::QueuedConnection);
|
||||
this, &GitPluginPrivate::updateBranches, Qt::QueuedConnection);
|
||||
|
||||
/* "Gerrit" */
|
||||
m_gerritPlugin = new Gerrit::Internal::GerritPlugin(this);
|
||||
const bool ok = m_gerritPlugin->initialize(remoteRepositoryMenu);
|
||||
m_gerritPlugin->initialize(remoteRepositoryMenu);
|
||||
m_gerritPlugin->updateActions(currentState());
|
||||
m_gerritPlugin->addToLocator(m_commandLocator);
|
||||
|
||||
auto cmdContext = new QObject(this);
|
||||
connect(Core::ICore::instance(), &Core::ICore::coreOpened, cmdContext, [this, cmdContext, arguments] {
|
||||
remoteCommand(arguments, QDir::currentPath(), {});
|
||||
cmdContext->deleteLater();
|
||||
});
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
GitVersionControl *GitPlugin::gitVersionControl() const
|
||||
GitVersionControl *GitPluginPrivate::gitVersionControl() const
|
||||
{
|
||||
return static_cast<GitVersionControl *>(versionControl());
|
||||
}
|
||||
|
||||
void GitPlugin::diffCurrentFile()
|
||||
void GitPluginPrivate::diffCurrentFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
m_gitClient->diffFile(state.currentFileTopLevel(), state.relativeCurrentFile());
|
||||
}
|
||||
|
||||
void GitPlugin::diffCurrentProject()
|
||||
void GitPluginPrivate::diffCurrentProject()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasProject(), return);
|
||||
@@ -694,14 +707,14 @@ void GitPlugin::diffCurrentProject()
|
||||
m_gitClient->diffProject(state.currentProjectTopLevel(), relativeProject);
|
||||
}
|
||||
|
||||
void GitPlugin::logFile()
|
||||
void GitPluginPrivate::logFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
m_gitClient->log(state.currentFileTopLevel(), state.relativeCurrentFile(), true);
|
||||
}
|
||||
|
||||
void GitPlugin::blameFile()
|
||||
void GitPluginPrivate::blameFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
@@ -740,21 +753,21 @@ void GitPlugin::blameFile()
|
||||
editor->setFirstLineNumber(firstLine);
|
||||
}
|
||||
|
||||
void GitPlugin::logProject()
|
||||
void GitPluginPrivate::logProject()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasProject(), return);
|
||||
m_gitClient->log(state.currentProjectTopLevel(), state.relativeCurrentProject());
|
||||
}
|
||||
|
||||
void GitPlugin::logRepository()
|
||||
void GitPluginPrivate::logRepository()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
m_gitClient->log(state.topLevel());
|
||||
}
|
||||
|
||||
void GitPlugin::undoFileChanges(bool revertStaging)
|
||||
void GitPluginPrivate::undoFileChanges(bool revertStaging)
|
||||
{
|
||||
if (IDocument *document = EditorManager::currentDocument()) {
|
||||
if (!DocumentManager::saveModifiedDocumentSilently(document))
|
||||
@@ -793,7 +806,7 @@ protected:
|
||||
}
|
||||
};
|
||||
|
||||
void GitPlugin::resetRepository()
|
||||
void GitPluginPrivate::resetRepository()
|
||||
{
|
||||
if (!DocumentManager::saveAllModifiedDocuments())
|
||||
return;
|
||||
@@ -808,7 +821,7 @@ void GitPlugin::resetRepository()
|
||||
m_gitClient->reset(topLevel, dialog.resetFlag(), dialog.commit());
|
||||
}
|
||||
|
||||
void GitPlugin::recoverDeletedFiles()
|
||||
void GitPluginPrivate::recoverDeletedFiles()
|
||||
{
|
||||
if (!DocumentManager::saveAllModifiedDocuments())
|
||||
return;
|
||||
@@ -817,7 +830,7 @@ void GitPlugin::recoverDeletedFiles()
|
||||
m_gitClient->recoverDeletedFiles(state.topLevel());
|
||||
}
|
||||
|
||||
void GitPlugin::startRebase()
|
||||
void GitPluginPrivate::startRebase()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
@@ -826,7 +839,7 @@ void GitPlugin::startRebase()
|
||||
startRebaseFromCommit(topLevel, QString());
|
||||
}
|
||||
|
||||
void GitPlugin::startRebaseFromCommit(const QString &workingDirectory, QString commit)
|
||||
void GitPluginPrivate::startRebaseFromCommit(const QString &workingDirectory, QString commit)
|
||||
{
|
||||
if (!DocumentManager::saveAllModifiedDocuments())
|
||||
return;
|
||||
@@ -846,7 +859,7 @@ void GitPlugin::startRebaseFromCommit(const QString &workingDirectory, QString c
|
||||
m_gitClient->interactiveRebase(workingDirectory, commit, false);
|
||||
}
|
||||
|
||||
void GitPlugin::startChangeRelatedAction(const Id &id)
|
||||
void GitPluginPrivate::startChangeRelatedAction(const Id &id)
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
|
||||
@@ -890,28 +903,28 @@ void GitPlugin::startChangeRelatedAction(const Id &id)
|
||||
}
|
||||
}
|
||||
|
||||
void GitPlugin::stageFile()
|
||||
void GitPluginPrivate::stageFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
m_gitClient->addFile(state.currentFileTopLevel(), state.relativeCurrentFile());
|
||||
}
|
||||
|
||||
void GitPlugin::unstageFile()
|
||||
void GitPluginPrivate::unstageFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
m_gitClient->synchronousReset(state.currentFileTopLevel(), {state.relativeCurrentFile()});
|
||||
}
|
||||
|
||||
void GitPlugin::gitkForCurrentFile()
|
||||
void GitPluginPrivate::gitkForCurrentFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
m_gitClient->launchGitK(state.currentFileTopLevel(), state.relativeCurrentFile());
|
||||
}
|
||||
|
||||
void GitPlugin::gitkForCurrentFolder()
|
||||
void GitPluginPrivate::gitkForCurrentFolder()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
@@ -941,14 +954,14 @@ void GitPlugin::gitkForCurrentFolder()
|
||||
}
|
||||
}
|
||||
|
||||
void GitPlugin::gitGui()
|
||||
void GitPluginPrivate::gitGui()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
m_gitClient->launchGitGui(state.topLevel());
|
||||
}
|
||||
|
||||
void GitPlugin::startCommit(CommitType commitType)
|
||||
void GitPluginPrivate::startCommit(CommitType commitType)
|
||||
{
|
||||
if (!promptBeforeCommit())
|
||||
return;
|
||||
@@ -987,7 +1000,7 @@ void GitPlugin::startCommit(CommitType commitType)
|
||||
openSubmitEditor(m_commitMessageFileName, data);
|
||||
}
|
||||
|
||||
void GitPlugin::updateVersionWarning()
|
||||
void GitPluginPrivate::updateVersionWarning()
|
||||
{
|
||||
unsigned version = m_gitClient->gitVersion();
|
||||
if (!version || version >= minimumRequiredVersion)
|
||||
@@ -1005,7 +1018,7 @@ void GitPlugin::updateVersionWarning()
|
||||
InfoBarEntry::GlobalSuppression::Enabled));
|
||||
}
|
||||
|
||||
IEditor *GitPlugin::openSubmitEditor(const QString &fileName, const CommitData &cd)
|
||||
IEditor *GitPluginPrivate::openSubmitEditor(const QString &fileName, const CommitData &cd)
|
||||
{
|
||||
IEditor *editor = EditorManager::openEditor(fileName, Constants::GITSUBMITEDITOR_ID);
|
||||
auto submitEditor = qobject_cast<GitSubmitEditor*>(editor);
|
||||
@@ -1030,7 +1043,7 @@ IEditor *GitPlugin::openSubmitEditor(const QString &fileName, const CommitData &
|
||||
return editor;
|
||||
}
|
||||
|
||||
void GitPlugin::commitFromEditor()
|
||||
void GitPluginPrivate::commitFromEditor()
|
||||
{
|
||||
// Close the submit editor
|
||||
m_submitActionTriggered = true;
|
||||
@@ -1038,7 +1051,7 @@ void GitPlugin::commitFromEditor()
|
||||
EditorManager::closeDocument(submitEditor()->document());
|
||||
}
|
||||
|
||||
bool GitPlugin::submitEditorAboutToClose()
|
||||
bool GitPluginPrivate::submitEditorAboutToClose()
|
||||
{
|
||||
if (!isCommitEditorOpen())
|
||||
return true;
|
||||
@@ -1096,7 +1109,7 @@ bool GitPlugin::submitEditorAboutToClose()
|
||||
if (editor->panelData().pushAction == NormalPush) {
|
||||
m_gitClient->push(m_submitRepository);
|
||||
} else if (editor->panelData().pushAction == PushToGerrit) {
|
||||
connect(editor, &QObject::destroyed, this, &GitPlugin::delayedPushToGerrit,
|
||||
connect(editor, &QObject::destroyed, this, &GitPluginPrivate::delayedPushToGerrit,
|
||||
Qt::QueuedConnection);
|
||||
}
|
||||
}
|
||||
@@ -1104,12 +1117,12 @@ bool GitPlugin::submitEditorAboutToClose()
|
||||
return true;
|
||||
}
|
||||
|
||||
void GitPlugin::fetch()
|
||||
void GitPluginPrivate::fetch()
|
||||
{
|
||||
m_gitClient->fetch(currentState().topLevel(), QString());
|
||||
}
|
||||
|
||||
void GitPlugin::pull()
|
||||
void GitPluginPrivate::pull()
|
||||
{
|
||||
if (!DocumentManager::saveAllModifiedDocuments())
|
||||
return;
|
||||
@@ -1132,21 +1145,21 @@ void GitPlugin::pull()
|
||||
m_gitClient->pull(topLevel, rebase);
|
||||
}
|
||||
|
||||
void GitPlugin::push()
|
||||
void GitPluginPrivate::push()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
m_gitClient->push(state.topLevel());
|
||||
}
|
||||
|
||||
void GitPlugin::startMergeTool()
|
||||
void GitPluginPrivate::startMergeTool()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
m_gitClient->merge(state.topLevel());
|
||||
}
|
||||
|
||||
void GitPlugin::continueOrAbortCommand()
|
||||
void GitPluginPrivate::continueOrAbortCommand()
|
||||
{
|
||||
if (!DocumentManager::saveAllModifiedDocuments())
|
||||
return;
|
||||
@@ -1174,21 +1187,21 @@ void GitPlugin::continueOrAbortCommand()
|
||||
updateContinueAndAbortCommands();
|
||||
}
|
||||
|
||||
void GitPlugin::cleanProject()
|
||||
void GitPluginPrivate::cleanProject()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasProject(), return);
|
||||
cleanRepository(state.currentProjectPath());
|
||||
}
|
||||
|
||||
void GitPlugin::cleanRepository()
|
||||
void GitPluginPrivate::cleanRepository()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
cleanRepository(state.topLevel());
|
||||
}
|
||||
|
||||
void GitPlugin::cleanRepository(const QString &directory)
|
||||
void GitPluginPrivate::cleanRepository(const QString &directory)
|
||||
{
|
||||
// Find files to be deleted
|
||||
QString errorMessage;
|
||||
@@ -1214,7 +1227,7 @@ void GitPlugin::cleanRepository(const QString &directory)
|
||||
dialog.exec();
|
||||
}
|
||||
|
||||
void GitPlugin::updateSubmodules()
|
||||
void GitPluginPrivate::updateSubmodules()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
@@ -1227,7 +1240,7 @@ static bool ensureFileSaved(const QString &fileName)
|
||||
return DocumentManager::saveModifiedDocument(DocumentModel::documentForFilePath(fileName));
|
||||
}
|
||||
|
||||
void GitPlugin::applyCurrentFilePatch()
|
||||
void GitPluginPrivate::applyCurrentFilePatch()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasPatchFile() && state.hasTopLevel(), return);
|
||||
@@ -1237,14 +1250,14 @@ void GitPlugin::applyCurrentFilePatch()
|
||||
applyPatch(state.topLevel(), patchFile);
|
||||
}
|
||||
|
||||
void GitPlugin::promptApplyPatch()
|
||||
void GitPluginPrivate::promptApplyPatch()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
applyPatch(state.topLevel(), QString());
|
||||
}
|
||||
|
||||
void GitPlugin::applyPatch(const QString &workingDirectory, QString file)
|
||||
void GitPluginPrivate::applyPatch(const QString &workingDirectory, QString file)
|
||||
{
|
||||
// Ensure user has been notified about pending changes
|
||||
if (!m_gitClient->beginStashScope(workingDirectory, "Apply-Patch", AllowUnstashed))
|
||||
@@ -1271,7 +1284,7 @@ void GitPlugin::applyPatch(const QString &workingDirectory, QString file)
|
||||
m_gitClient->endStashScope(workingDirectory);
|
||||
}
|
||||
|
||||
void GitPlugin::stash(bool unstagedOnly)
|
||||
void GitPluginPrivate::stash(bool unstagedOnly)
|
||||
{
|
||||
if (!DocumentManager::saveAllModifiedDocuments())
|
||||
return;
|
||||
@@ -1285,12 +1298,12 @@ void GitPlugin::stash(bool unstagedOnly)
|
||||
m_stashDialog->refresh(topLevel, true);
|
||||
}
|
||||
|
||||
void GitPlugin::stashUnstaged()
|
||||
void GitPluginPrivate::stashUnstaged()
|
||||
{
|
||||
stash(true);
|
||||
}
|
||||
|
||||
void GitPlugin::stashSnapshot()
|
||||
void GitPluginPrivate::stashSnapshot()
|
||||
{
|
||||
// Prompt for description, restore immediately and keep on working.
|
||||
const VcsBasePluginState state = currentState();
|
||||
@@ -1301,7 +1314,7 @@ void GitPlugin::stashSnapshot()
|
||||
m_stashDialog->refresh(state.topLevel(), true);
|
||||
}
|
||||
|
||||
void GitPlugin::stashPop()
|
||||
void GitPluginPrivate::stashPop()
|
||||
{
|
||||
if (!DocumentManager::saveAllModifiedDocuments())
|
||||
return;
|
||||
@@ -1326,28 +1339,28 @@ template <class NonModalDialog>
|
||||
}
|
||||
}
|
||||
|
||||
void GitPlugin::branchList()
|
||||
void GitPluginPrivate::branchList()
|
||||
{
|
||||
ModeManager::activateMode(Core::Constants::MODE_EDIT);
|
||||
NavigationWidget::activateSubWidget(Constants::GIT_BRANCH_VIEW_ID, Side::Right);
|
||||
}
|
||||
|
||||
void GitPlugin::manageRemotes()
|
||||
void GitPluginPrivate::manageRemotes()
|
||||
{
|
||||
showNonModalDialog(currentState().topLevel(), m_remoteDialog);
|
||||
}
|
||||
|
||||
void GitPlugin::initRepository()
|
||||
void GitPluginPrivate::initRepository()
|
||||
{
|
||||
createRepository();
|
||||
}
|
||||
|
||||
void GitPlugin::stashList()
|
||||
void GitPluginPrivate::stashList()
|
||||
{
|
||||
showNonModalDialog(currentState().topLevel(), m_stashDialog);
|
||||
}
|
||||
|
||||
void GitPlugin::updateActions(VcsBasePlugin::ActionState as)
|
||||
void GitPluginPrivate::updateActions(VcsBasePluginPrivate::ActionState as)
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
const bool repositoryEnabled = state.hasTopLevel();
|
||||
@@ -1386,7 +1399,7 @@ void GitPlugin::updateActions(VcsBasePlugin::ActionState as)
|
||||
m_gerritPlugin->updateActions(state);
|
||||
}
|
||||
|
||||
void GitPlugin::updateContinueAndAbortCommands()
|
||||
void GitPluginPrivate::updateContinueAndAbortCommands()
|
||||
{
|
||||
if (currentState().hasTopLevel()) {
|
||||
GitClient::CommandInProgress gitCommandInProgress =
|
||||
@@ -1419,18 +1432,18 @@ void GitPlugin::updateContinueAndAbortCommands()
|
||||
}
|
||||
}
|
||||
|
||||
void GitPlugin::delayedPushToGerrit()
|
||||
void GitPluginPrivate::delayedPushToGerrit()
|
||||
{
|
||||
m_gerritPlugin->push(m_submitRepository);
|
||||
}
|
||||
|
||||
void GitPlugin::updateBranches(const QString &repository)
|
||||
void GitPluginPrivate::updateBranches(const QString &repository)
|
||||
{
|
||||
if (m_branchViewFactory && m_branchViewFactory->view())
|
||||
m_branchViewFactory->view()->refreshIfSame(repository);
|
||||
}
|
||||
|
||||
void GitPlugin::updateCurrentBranch()
|
||||
void GitPluginPrivate::updateCurrentBranch()
|
||||
{
|
||||
if (m_branchViewFactory && m_branchViewFactory->view())
|
||||
m_branchViewFactory->view()->refreshCurrentBranch();
|
||||
@@ -1439,15 +1452,15 @@ void GitPlugin::updateCurrentBranch()
|
||||
QObject *GitPlugin::remoteCommand(const QStringList &options, const QString &workingDirectory,
|
||||
const QStringList &)
|
||||
{
|
||||
if (!m_gitClient || options.size() < 2)
|
||||
if (!GitPluginPrivate::client() || options.size() < 2)
|
||||
return nullptr;
|
||||
|
||||
if (options.first() == "-git-show")
|
||||
m_gitClient->show(workingDirectory, options.at(1));
|
||||
GitPluginPrivate::client()->show(workingDirectory, options.at(1));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void GitPlugin::updateRepositoryBrowserAction()
|
||||
void GitPluginPrivate::updateRepositoryBrowserAction()
|
||||
{
|
||||
const bool repositoryEnabled = currentState().hasTopLevel();
|
||||
const bool hasRepositoryBrowserCmd
|
||||
@@ -1455,7 +1468,7 @@ void GitPlugin::updateRepositoryBrowserAction()
|
||||
m_repositoryBrowserAction->setEnabled(repositoryEnabled && hasRepositoryBrowserCmd);
|
||||
}
|
||||
|
||||
Gerrit::Internal::GerritPlugin *GitPlugin::gerritPlugin() const
|
||||
Gerrit::Internal::GerritPlugin *GitPluginPrivate::gerritPlugin() const
|
||||
{
|
||||
return m_gerritPlugin;
|
||||
}
|
||||
|
@@ -67,20 +67,17 @@ class RemoteDialog;
|
||||
|
||||
using GitClientMemberFunc = void (GitClient::*)(const QString &);
|
||||
|
||||
class GitPlugin : public VcsBase::VcsBasePlugin
|
||||
class GitPluginPrivate final : public VcsBase::VcsBasePluginPrivate
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Git.json")
|
||||
|
||||
public:
|
||||
GitPlugin();
|
||||
~GitPlugin() override;
|
||||
GitPluginPrivate();
|
||||
~GitPluginPrivate() final;
|
||||
|
||||
static GitPlugin *instance();
|
||||
static GitPluginPrivate *instance();
|
||||
static GitClient *client();
|
||||
|
||||
bool initialize(const QStringList &arguments, QString *errorMessage) override;
|
||||
|
||||
GitVersionControl *gitVersionControl() const;
|
||||
|
||||
Gerrit::Internal::GerritPlugin *gerritPlugin() const;
|
||||
@@ -91,27 +88,14 @@ public:
|
||||
void updateBranches(const QString &repository);
|
||||
void updateCurrentBranch();
|
||||
|
||||
QObject *remoteCommand(const QStringList &options, const QString &workingDirectory,
|
||||
const QStringList &args) override;
|
||||
void manageRemotes();
|
||||
void initRepository();
|
||||
void startRebaseFromCommit(const QString &workingDirectory, QString commit);
|
||||
|
||||
protected:
|
||||
void updateActions(VcsBase::VcsBasePlugin::ActionState) override;
|
||||
void updateActions(VcsBase::VcsBasePluginPrivate::ActionState) override;
|
||||
bool submitEditorAboutToClose() override;
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
private slots:
|
||||
void testStatusParsing_data();
|
||||
void testStatusParsing();
|
||||
void testDiffFileResolving_data();
|
||||
void testDiffFileResolving();
|
||||
void testLogResolving();
|
||||
void testGitRemote_data();
|
||||
void testGitRemote();
|
||||
#endif
|
||||
|
||||
private:
|
||||
void diffCurrentFile();
|
||||
void diffCurrentProject();
|
||||
@@ -169,7 +153,7 @@ private:
|
||||
QAction *createProjectAction(Core::ActionContainer *ac,
|
||||
const QString &defaultText, const QString ¶meterText,
|
||||
Core::Id id, const Core::Context &context, bool addToLocator,
|
||||
void (GitPlugin::*func)(),
|
||||
void (GitPluginPrivate::*func)(),
|
||||
const QKeySequence &keys = QKeySequence());
|
||||
|
||||
QAction *createRepositoryAction(Core::ActionContainer *ac, const QString &text, Core::Id id,
|
||||
@@ -222,5 +206,32 @@ private:
|
||||
bool m_submitActionTriggered = false;
|
||||
};
|
||||
|
||||
class GitPlugin final : public ExtensionSystem::IPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Git.json")
|
||||
|
||||
public:
|
||||
~GitPlugin() final;
|
||||
|
||||
bool initialize(const QStringList &arguments, QString *errorMessage) final;
|
||||
void extensionsInitialized() final;
|
||||
|
||||
QObject *remoteCommand(const QStringList &options, const QString &workingDirectory,
|
||||
const QStringList &args) final;
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
private slots:
|
||||
void testStatusParsing_data();
|
||||
void testStatusParsing();
|
||||
void testDiffFileResolving_data();
|
||||
void testDiffFileResolving();
|
||||
void testLogResolving();
|
||||
void testGitRemote_data();
|
||||
void testGitRemote();
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Git
|
||||
|
@@ -88,7 +88,7 @@ CommitDataFetchResult CommitDataFetchResult::fetch(CommitType commitType, const
|
||||
CommitDataFetchResult result;
|
||||
result.commitData.commitType = commitType;
|
||||
QString commitTemplate;
|
||||
result.success = GitPlugin::client()->getCommitData(workingDirectory, &commitTemplate,
|
||||
result.success = GitPluginPrivate::client()->getCommitData(workingDirectory, &commitTemplate,
|
||||
result.commitData, &result.errorMessage);
|
||||
return result;
|
||||
}
|
||||
@@ -103,7 +103,7 @@ GitSubmitEditor::GitSubmitEditor(const VcsBaseSubmitEditorParameters *parameters
|
||||
{
|
||||
connect(this, &VcsBaseSubmitEditor::diffSelectedRows, this, &GitSubmitEditor::slotDiffSelected);
|
||||
connect(submitEditorWidget(), &GitSubmitEditorWidget::show, this, &GitSubmitEditor::showCommit);
|
||||
connect(GitPlugin::instance()->versionControl(), &Core::IVersionControl::repositoryChanged,
|
||||
connect(GitPluginPrivate::instance()->versionControl(), &Core::IVersionControl::repositoryChanged,
|
||||
this, &GitSubmitEditor::forceUpdateFileModel);
|
||||
connect(&m_fetchWatcher, &QFutureWatcher<CommitDataFetchResult>::finished,
|
||||
this, &GitSubmitEditor::commitDataRetrieved);
|
||||
@@ -202,15 +202,15 @@ void GitSubmitEditor::slotDiffSelected(const QList<int> &rows)
|
||||
}
|
||||
}
|
||||
if (!unstagedFiles.empty() || !stagedFiles.empty())
|
||||
GitPlugin::client()->diffFiles(m_workingDirectory, unstagedFiles, stagedFiles);
|
||||
GitPluginPrivate::client()->diffFiles(m_workingDirectory, unstagedFiles, stagedFiles);
|
||||
if (!unmergedFiles.empty())
|
||||
GitPlugin::client()->merge(m_workingDirectory, unmergedFiles);
|
||||
GitPluginPrivate::client()->merge(m_workingDirectory, unmergedFiles);
|
||||
}
|
||||
|
||||
void GitSubmitEditor::showCommit(const QString &commit)
|
||||
{
|
||||
if (!m_workingDirectory.isEmpty())
|
||||
GitPlugin::client()->show(m_workingDirectory, commit);
|
||||
GitPluginPrivate::client()->show(m_workingDirectory, commit);
|
||||
}
|
||||
|
||||
void GitSubmitEditor::updateFileModel()
|
||||
@@ -230,7 +230,7 @@ void GitSubmitEditor::updateFileModel()
|
||||
Core::ProgressManager::addTask(m_fetchWatcher.future(), tr("Refreshing Commit Data"),
|
||||
TASK_UPDATE_COMMIT);
|
||||
|
||||
GitPlugin::client()->addFuture(m_fetchWatcher.future());
|
||||
GitPluginPrivate::client()->addFuture(m_fetchWatcher.future());
|
||||
}
|
||||
|
||||
void GitSubmitEditor::forceUpdateFileModel()
|
||||
|
@@ -79,7 +79,7 @@ bool LogChangeWidget::init(const QString &repository, const QString &commit, Log
|
||||
return true;
|
||||
if (!(flags & Silent)) {
|
||||
VcsOutputWindow::appendError(
|
||||
GitPlugin::client()->msgNoCommits(flags & IncludeRemotes));
|
||||
GitPluginPrivate::client()->msgNoCommits(flags & IncludeRemotes));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -159,7 +159,7 @@ bool LogChangeWidget::populateLog(const QString &repository, const QString &comm
|
||||
arguments << "--not" << "--remotes";
|
||||
arguments << "--";
|
||||
QString output;
|
||||
if (!GitPlugin::client()->synchronousLog(repository, arguments, &output, nullptr, VcsCommand::NoOutput))
|
||||
if (!GitPluginPrivate::client()->synchronousLog(repository, arguments, &output, nullptr, VcsCommand::NoOutput))
|
||||
return false;
|
||||
const QStringList lines = output.split('\n');
|
||||
for (const QString &line : lines) {
|
||||
@@ -211,7 +211,7 @@ LogChangeDialog::LogChangeDialog(bool isReset, QWidget *parent) :
|
||||
m_resetTypeComboBox->addItem(tr("Hard"), "--hard");
|
||||
m_resetTypeComboBox->addItem(tr("Mixed"), "--mixed");
|
||||
m_resetTypeComboBox->addItem(tr("Soft"), "--soft");
|
||||
m_resetTypeComboBox->setCurrentIndex(GitPlugin::client()->settings().intValue(
|
||||
m_resetTypeComboBox->setCurrentIndex(GitPluginPrivate::client()->settings().intValue(
|
||||
GitSettings::lastResetIndexKey));
|
||||
popUpLayout->addWidget(m_resetTypeComboBox);
|
||||
popUpLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Ignored));
|
||||
@@ -240,7 +240,7 @@ bool LogChangeDialog::runDialog(const QString &repository,
|
||||
|
||||
if (QDialog::exec() == QDialog::Accepted) {
|
||||
if (m_resetTypeComboBox) {
|
||||
GitPlugin::client()->settings().setValue(GitSettings::lastResetIndexKey,
|
||||
GitPluginPrivate::client()->settings().setValue(GitSettings::lastResetIndexKey,
|
||||
m_resetTypeComboBox->currentIndex());
|
||||
}
|
||||
return true;
|
||||
|
@@ -61,7 +61,7 @@ bool MergeTool::start(const QString &workingDirectory, const QStringList &files)
|
||||
m_process->setWorkingDirectory(workingDirectory);
|
||||
m_process->setProcessEnvironment(env);
|
||||
m_process->setProcessChannelMode(QProcess::MergedChannels);
|
||||
const Utils::FilePath binary = GitPlugin::client()->vcsBinary();
|
||||
const Utils::FilePath binary = GitPluginPrivate::client()->vcsBinary();
|
||||
VcsOutputWindow::appendCommand(workingDirectory, {binary, arguments});
|
||||
m_process->start(binary.toString(), arguments);
|
||||
if (m_process->waitForStarted()) {
|
||||
@@ -264,8 +264,8 @@ void MergeTool::done()
|
||||
VcsOutputWindow::appendError(tr("Merge tool process terminated with exit code %1")
|
||||
.arg(exitCode));
|
||||
}
|
||||
GitPlugin::client()->continueCommandIfNeeded(workingDirectory, exitCode == 0);
|
||||
GitPlugin::instance()->gitVersionControl()->emitRepositoryChanged(workingDirectory);
|
||||
GitPluginPrivate::client()->continueCommandIfNeeded(workingDirectory, exitCode == 0);
|
||||
GitPluginPrivate::instance()->gitVersionControl()->emitRepositoryChanged(workingDirectory);
|
||||
deleteLater();
|
||||
}
|
||||
|
||||
|
@@ -49,7 +49,7 @@ class RemoteAdditionDialog : public QDialog
|
||||
{
|
||||
public:
|
||||
RemoteAdditionDialog(const QStringList &remoteNames) :
|
||||
m_invalidRemoteNameChars(GitPlugin::invalidBranchAndRemoteNamePattern()),
|
||||
m_invalidRemoteNameChars(GitPluginPrivate::invalidBranchAndRemoteNamePattern()),
|
||||
m_remoteNames(remoteNames)
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
@@ -157,7 +157,7 @@ void RemoteDialog::refresh(const QString &repository, bool force)
|
||||
if (m_remoteModel->workingDirectory() == repository && !force)
|
||||
return;
|
||||
// Refresh
|
||||
m_ui->repositoryLabel->setText(GitPlugin::msgRepositoryLabel(repository));
|
||||
m_ui->repositoryLabel->setText(GitPluginPrivate::msgRepositoryLabel(repository));
|
||||
if (repository.isEmpty()) {
|
||||
m_remoteModel->clear();
|
||||
} else {
|
||||
@@ -205,7 +205,7 @@ void RemoteDialog::pushToRemote()
|
||||
|
||||
const int row = indexList.at(0).row();
|
||||
const QString remoteName = m_remoteModel->remoteName(row);
|
||||
GitPlugin::client()->push(m_remoteModel->workingDirectory(), {remoteName});
|
||||
GitPluginPrivate::client()->push(m_remoteModel->workingDirectory(), {remoteName});
|
||||
}
|
||||
|
||||
void RemoteDialog::fetchFromRemote()
|
||||
@@ -216,7 +216,7 @@ void RemoteDialog::fetchFromRemote()
|
||||
|
||||
int row = indexList.at(0).row();
|
||||
const QString remoteName = m_remoteModel->remoteName(row);
|
||||
GitPlugin::client()->fetch(m_remoteModel->workingDirectory(), remoteName);
|
||||
GitPluginPrivate::client()->fetch(m_remoteModel->workingDirectory(), remoteName);
|
||||
}
|
||||
|
||||
void RemoteDialog::updateButtonState()
|
||||
|
@@ -55,7 +55,7 @@ bool RemoteModel::removeRemote(int row)
|
||||
{
|
||||
QString output;
|
||||
QString error;
|
||||
bool success = GitPlugin::client()->synchronousRemoteCmd(
|
||||
bool success = GitPluginPrivate::client()->synchronousRemoteCmd(
|
||||
m_workingDirectory, {"rm", remoteName(row)}, &output, &error);
|
||||
if (success)
|
||||
success = refresh(m_workingDirectory, &error);
|
||||
@@ -69,7 +69,7 @@ bool RemoteModel::addRemote(const QString &name, const QString &url)
|
||||
if (name.isEmpty() || url.isEmpty())
|
||||
return false;
|
||||
|
||||
bool success = GitPlugin::client()->synchronousRemoteCmd(
|
||||
bool success = GitPluginPrivate::client()->synchronousRemoteCmd(
|
||||
m_workingDirectory, {"add", name, url}, &output, &error);
|
||||
if (success)
|
||||
success = refresh(m_workingDirectory, &error);
|
||||
@@ -80,7 +80,7 @@ bool RemoteModel::renameRemote(const QString &oldName, const QString &newName)
|
||||
{
|
||||
QString output;
|
||||
QString error;
|
||||
bool success = GitPlugin::client()->synchronousRemoteCmd(
|
||||
bool success = GitPluginPrivate::client()->synchronousRemoteCmd(
|
||||
m_workingDirectory, {"rename", oldName, newName}, &output, &error);
|
||||
if (success)
|
||||
success = refresh(m_workingDirectory, &error);
|
||||
@@ -91,7 +91,7 @@ bool RemoteModel::updateUrl(const QString &name, const QString &newUrl)
|
||||
{
|
||||
QString output;
|
||||
QString error;
|
||||
bool success = GitPlugin::client()->synchronousRemoteCmd(
|
||||
bool success = GitPluginPrivate::client()->synchronousRemoteCmd(
|
||||
m_workingDirectory, {"set-url", name, newUrl}, &output, &error);
|
||||
if (success)
|
||||
success = refresh(m_workingDirectory, &error);
|
||||
@@ -186,7 +186,7 @@ bool RemoteModel::refresh(const QString &workingDirectory, QString *errorMessage
|
||||
|
||||
// get list of remotes.
|
||||
QMap<QString,QString> remotesList
|
||||
= GitPlugin::client()->synchronousRemotesList(workingDirectory, errorMessage);
|
||||
= GitPluginPrivate::client()->synchronousRemotesList(workingDirectory, errorMessage);
|
||||
|
||||
beginResetModel();
|
||||
m_remotes.clear();
|
||||
|
@@ -124,7 +124,7 @@ void SettingsPageWidget::updateNoteField()
|
||||
// -------- SettingsPage
|
||||
|
||||
SettingsPage::SettingsPage(Core::IVersionControl *control, QObject *parent) :
|
||||
VcsClientOptionsPage(control, GitPlugin::client(), parent)
|
||||
VcsClientOptionsPage(control, GitPluginPrivate::client(), parent)
|
||||
{
|
||||
setId(VcsBase::Constants::VCS_ID_GIT);
|
||||
setDisplayName(SettingsPageWidget::tr("Git"));
|
||||
|
@@ -157,12 +157,12 @@ void StashDialog::refresh(const QString &repository, bool force)
|
||||
return;
|
||||
// Refresh
|
||||
m_repository = repository;
|
||||
ui->repositoryLabel->setText(GitPlugin::msgRepositoryLabel(repository));
|
||||
ui->repositoryLabel->setText(GitPluginPrivate::msgRepositoryLabel(repository));
|
||||
if (m_repository.isEmpty()) {
|
||||
m_model->setStashes(QList<Stash>());
|
||||
} else {
|
||||
QList<Stash> stashes;
|
||||
GitPlugin::client()->synchronousStashList(m_repository, &stashes);
|
||||
GitPluginPrivate::client()->synchronousStashList(m_repository, &stashes);
|
||||
m_model->setStashes(stashes);
|
||||
if (!stashes.isEmpty()) {
|
||||
for (int c = 0; c < ColumnCount; c++)
|
||||
@@ -178,7 +178,7 @@ void StashDialog::deleteAll()
|
||||
if (!ask(title, tr("Do you want to delete all stashes?")))
|
||||
return;
|
||||
QString errorMessage;
|
||||
if (GitPlugin::client()->synchronousStashRemove(m_repository, QString(), &errorMessage))
|
||||
if (GitPluginPrivate::client()->synchronousStashRemove(m_repository, QString(), &errorMessage))
|
||||
refresh(m_repository, true);
|
||||
else
|
||||
warning(title, errorMessage);
|
||||
@@ -195,7 +195,7 @@ void StashDialog::deleteSelection()
|
||||
QStringList errors;
|
||||
// Delete in reverse order as stashes rotate
|
||||
for (int r = rows.size() - 1; r >= 0; r--)
|
||||
if (!GitPlugin::client()->synchronousStashRemove(m_repository, m_model->at(rows.at(r)).name, &errorMessage))
|
||||
if (!GitPluginPrivate::client()->synchronousStashRemove(m_repository, m_model->at(rows.at(r)).name, &errorMessage))
|
||||
errors.push_back(errorMessage);
|
||||
refresh(m_repository, true);
|
||||
if (!errors.isEmpty())
|
||||
@@ -206,7 +206,7 @@ void StashDialog::showCurrent()
|
||||
{
|
||||
const int index = currentRow();
|
||||
QTC_ASSERT(index >= 0, return);
|
||||
GitPlugin::client()->show(m_repository, QString(m_model->at(index).name));
|
||||
GitPluginPrivate::client()->show(m_repository, QString(m_model->at(index).name));
|
||||
}
|
||||
|
||||
// Suggest Branch name to restore 'stash@{0}' -> 'stash0-date'
|
||||
@@ -267,7 +267,7 @@ bool StashDialog::promptForRestore(QString *stash,
|
||||
{
|
||||
const QString stashIn = *stash;
|
||||
bool modifiedPromptShown = false;
|
||||
switch (GitPlugin::client()->gitStatus(m_repository, StatusMode(NoUntracked | NoSubmodules), nullptr, errorMessage)) {
|
||||
switch (GitPluginPrivate::client()->gitStatus(m_repository, StatusMode(NoUntracked | NoSubmodules), nullptr, errorMessage)) {
|
||||
case GitClient::StatusFailed:
|
||||
return false;
|
||||
case GitClient::StatusChanged: {
|
||||
@@ -275,13 +275,13 @@ bool StashDialog::promptForRestore(QString *stash,
|
||||
case ModifiedRepositoryCancel:
|
||||
return false;
|
||||
case ModifiedRepositoryStash:
|
||||
if (GitPlugin::client()->synchronousStash(m_repository, QString(), GitClient::StashPromptDescription).isEmpty())
|
||||
if (GitPluginPrivate::client()->synchronousStash(m_repository, QString(), GitClient::StashPromptDescription).isEmpty())
|
||||
return false;
|
||||
*stash = nextStash(*stash); // Our stash id to be restored changed
|
||||
QTC_ASSERT(!stash->isEmpty(), return false);
|
||||
break;
|
||||
case ModifiedRepositoryDiscard:
|
||||
if (!GitPlugin::client()->synchronousReset(m_repository))
|
||||
if (!GitPluginPrivate::client()->synchronousReset(m_repository))
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
@@ -318,7 +318,7 @@ void StashDialog::restoreCurrent()
|
||||
// Make sure repository is not modified, restore. The command will
|
||||
// output to window on success.
|
||||
if (promptForRestore(&name, nullptr, &errorMessage)
|
||||
&& GitPlugin::client()->synchronousStashRestore(m_repository, name)) {
|
||||
&& GitPluginPrivate::client()->synchronousStashRestore(m_repository, name)) {
|
||||
refresh(m_repository, true); // Might have stashed away local changes.
|
||||
} else if (!errorMessage.isEmpty()) {
|
||||
warning(msgRestoreFailedTitle(name), errorMessage);
|
||||
@@ -333,7 +333,7 @@ void StashDialog::restoreCurrentInBranch()
|
||||
QString branch;
|
||||
QString name = m_model->at(index).name;
|
||||
if (promptForRestore(&name, &branch, &errorMessage)
|
||||
&& GitPlugin::client()->synchronousStashRestore(m_repository, name, false, branch)) {
|
||||
&& GitPluginPrivate::client()->synchronousStashRestore(m_repository, name, false, branch)) {
|
||||
refresh(m_repository, true); // git deletes the stash, unfortunately.
|
||||
} else if (!errorMessage.isEmpty()) {
|
||||
warning(msgRestoreFailedTitle(name), errorMessage);
|
||||
|
@@ -66,7 +66,7 @@ protected:
|
||||
};
|
||||
|
||||
MercurialDiffEditorController::MercurialDiffEditorController(IDocument *document, const QString &workingDirectory):
|
||||
VcsBaseDiffEditorController(document, MercurialPlugin::client(), workingDirectory)
|
||||
VcsBaseDiffEditorController(document, MercurialPluginPrivate::client(), workingDirectory)
|
||||
{
|
||||
setDisplayName("Hg Diff");
|
||||
}
|
||||
|
@@ -94,7 +94,7 @@ QString MercurialEditorWidget::decorateVersion(const QString &revision) const
|
||||
const QFileInfo fi(source());
|
||||
const QString workingDirectory = fi.absolutePath();
|
||||
// Format with short summary
|
||||
return MercurialPlugin::client()->shortDescriptionSync(workingDirectory, revision);
|
||||
return MercurialPluginPrivate::client()->shortDescriptionSync(workingDirectory, revision);
|
||||
}
|
||||
|
||||
QStringList MercurialEditorWidget::annotationPreviousVersions(const QString &revision) const
|
||||
@@ -102,7 +102,7 @@ QStringList MercurialEditorWidget::annotationPreviousVersions(const QString &rev
|
||||
const QFileInfo fi(source());
|
||||
const QString workingDirectory = fi.absolutePath();
|
||||
// Retrieve parent revisions
|
||||
return MercurialPlugin::client()->parentRevisionsSync(workingDirectory, fi.fileName(), revision);
|
||||
return MercurialPluginPrivate::client()->parentRevisionsSync(workingDirectory, fi.fileName(), revision);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -100,25 +100,44 @@ static const VcsBaseSubmitEditorParameters submitEditorParameters = {
|
||||
VcsBaseSubmitEditorParameters::DiffFiles
|
||||
};
|
||||
|
||||
MercurialPlugin *MercurialPlugin::m_instance = nullptr;
|
||||
static MercurialPluginPrivate *dd = nullptr;
|
||||
|
||||
MercurialPlugin::MercurialPlugin()
|
||||
MercurialPluginPrivate::~MercurialPluginPrivate()
|
||||
{
|
||||
m_instance = this;
|
||||
delete m_client;
|
||||
m_client = nullptr;
|
||||
}
|
||||
|
||||
MercurialPlugin::~MercurialPlugin()
|
||||
{
|
||||
if (m_client) {
|
||||
delete m_client;
|
||||
m_client = nullptr;
|
||||
}
|
||||
delete dd;
|
||||
dd = nullptr;
|
||||
}
|
||||
|
||||
m_instance = nullptr;
|
||||
MercurialPluginPrivate *MercurialPluginPrivate::instance()
|
||||
{
|
||||
return dd;
|
||||
}
|
||||
|
||||
MercurialClient *MercurialPluginPrivate::client()
|
||||
{
|
||||
return dd->m_client;
|
||||
}
|
||||
|
||||
bool MercurialPlugin::initialize(const QStringList & /* arguments */, QString * /*errorMessage */)
|
||||
{
|
||||
dd = new MercurialPluginPrivate;
|
||||
return true;
|
||||
}
|
||||
|
||||
void MercurialPlugin::extensionsInitialized()
|
||||
{
|
||||
dd->extensionsInitialized();
|
||||
}
|
||||
|
||||
MercurialPluginPrivate::MercurialPluginPrivate()
|
||||
{
|
||||
dd = this;
|
||||
Core::Context context(Constants::MERCURIAL_CONTEXT);
|
||||
|
||||
m_client = new MercurialClient;
|
||||
@@ -128,7 +147,7 @@ bool MercurialPlugin::initialize(const QStringList & /* arguments */, QString *
|
||||
new OptionsPage(vc, this);
|
||||
|
||||
connect(m_client, &VcsBaseClient::changed, vc, &MercurialControl::changed);
|
||||
connect(m_client, &MercurialClient::needUpdate, this, &MercurialPlugin::update);
|
||||
connect(m_client, &MercurialClient::needUpdate, this, &MercurialPluginPrivate::update);
|
||||
|
||||
const auto describeFunc = [this](const QString &source, const QString &id) {
|
||||
m_client->view(source, id);
|
||||
@@ -144,11 +163,9 @@ bool MercurialPlugin::initialize(const QStringList & /* arguments */, QString *
|
||||
m_commandLocator = new Core::CommandLocator("Mercurial", prefix, prefix, this);
|
||||
|
||||
createMenu(context);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void MercurialPlugin::createMenu(const Core::Context &context)
|
||||
void MercurialPluginPrivate::createMenu(const Core::Context &context)
|
||||
{
|
||||
// Create menu item for Mercurial
|
||||
m_mercurialContainer = Core::ActionManager::createMenu("Mercurial.MercurialMenu");
|
||||
@@ -168,14 +185,14 @@ void MercurialPlugin::createMenu(const Core::Context &context)
|
||||
m_menuAction = m_mercurialContainer->menu()->menuAction();
|
||||
}
|
||||
|
||||
void MercurialPlugin::createFileActions(const Core::Context &context)
|
||||
void MercurialPluginPrivate::createFileActions(const Core::Context &context)
|
||||
{
|
||||
Core::Command *command;
|
||||
|
||||
annotateFile = new ParameterAction(tr("Annotate Current File"), tr("Annotate \"%1\""), ParameterAction::EnabledWithParameter, this);
|
||||
command = Core::ActionManager::registerAction(annotateFile, Core::Id(Constants::ANNOTATE), context);
|
||||
command->setAttribute(Core::Command::CA_UpdateText);
|
||||
connect(annotateFile, &QAction::triggered, this, &MercurialPlugin::annotateCurrentFile);
|
||||
connect(annotateFile, &QAction::triggered, this, &MercurialPluginPrivate::annotateCurrentFile);
|
||||
m_mercurialContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
@@ -183,7 +200,7 @@ void MercurialPlugin::createFileActions(const Core::Context &context)
|
||||
command = Core::ActionManager::registerAction(diffFile, Core::Id(Constants::DIFF), context);
|
||||
command->setAttribute(Core::Command::CA_UpdateText);
|
||||
command->setDefaultKeySequence(QKeySequence(Core::useMacShortcuts ? tr("Meta+H,Meta+D") : tr("Alt+G,Alt+D")));
|
||||
connect(diffFile, &QAction::triggered, this, &MercurialPlugin::diffCurrentFile);
|
||||
connect(diffFile, &QAction::triggered, this, &MercurialPluginPrivate::diffCurrentFile);
|
||||
m_mercurialContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
@@ -191,7 +208,7 @@ void MercurialPlugin::createFileActions(const Core::Context &context)
|
||||
command = Core::ActionManager::registerAction(logFile, Core::Id(Constants::LOG), context);
|
||||
command->setAttribute(Core::Command::CA_UpdateText);
|
||||
command->setDefaultKeySequence(QKeySequence(Core::useMacShortcuts ? tr("Meta+H,Meta+L") : tr("Alt+G,Alt+L")));
|
||||
connect(logFile, &QAction::triggered, this, &MercurialPlugin::logCurrentFile);
|
||||
connect(logFile, &QAction::triggered, this, &MercurialPluginPrivate::logCurrentFile);
|
||||
m_mercurialContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
@@ -199,7 +216,7 @@ void MercurialPlugin::createFileActions(const Core::Context &context)
|
||||
command = Core::ActionManager::registerAction(statusFile, Core::Id(Constants::STATUS), context);
|
||||
command->setAttribute(Core::Command::CA_UpdateText);
|
||||
command->setDefaultKeySequence(QKeySequence(Core::useMacShortcuts ? tr("Meta+H,Meta+S") : tr("Alt+G,Alt+S")));
|
||||
connect(statusFile, &QAction::triggered, this, &MercurialPlugin::statusCurrentFile);
|
||||
connect(statusFile, &QAction::triggered, this, &MercurialPluginPrivate::statusCurrentFile);
|
||||
m_mercurialContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
@@ -208,33 +225,33 @@ void MercurialPlugin::createFileActions(const Core::Context &context)
|
||||
m_addAction = new ParameterAction(tr("Add"), tr("Add \"%1\""), ParameterAction::EnabledWithParameter, this);
|
||||
command = Core::ActionManager::registerAction(m_addAction, Core::Id(Constants::ADD), context);
|
||||
command->setAttribute(Core::Command::CA_UpdateText);
|
||||
connect(m_addAction, &QAction::triggered, this, &MercurialPlugin::addCurrentFile);
|
||||
connect(m_addAction, &QAction::triggered, this, &MercurialPluginPrivate::addCurrentFile);
|
||||
m_mercurialContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
m_deleteAction = new ParameterAction(tr("Delete..."), tr("Delete \"%1\"..."), ParameterAction::EnabledWithParameter, this);
|
||||
command = Core::ActionManager::registerAction(m_deleteAction, Core::Id(Constants::DELETE), context);
|
||||
command->setAttribute(Core::Command::CA_UpdateText);
|
||||
connect(m_deleteAction, &QAction::triggered, this, &MercurialPlugin::promptToDeleteCurrentFile);
|
||||
connect(m_deleteAction, &QAction::triggered, this, &MercurialPluginPrivate::promptToDeleteCurrentFile);
|
||||
m_mercurialContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
revertFile = new ParameterAction(tr("Revert Current File..."), tr("Revert \"%1\"..."), ParameterAction::EnabledWithParameter, this);
|
||||
command = Core::ActionManager::registerAction(revertFile, Core::Id(Constants::REVERT), context);
|
||||
command->setAttribute(Core::Command::CA_UpdateText);
|
||||
connect(revertFile, &QAction::triggered, this, &MercurialPlugin::revertCurrentFile);
|
||||
connect(revertFile, &QAction::triggered, this, &MercurialPluginPrivate::revertCurrentFile);
|
||||
m_mercurialContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
}
|
||||
|
||||
void MercurialPlugin::addCurrentFile()
|
||||
void MercurialPluginPrivate::addCurrentFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
m_client->synchronousAdd(state.currentFileTopLevel(), state.relativeCurrentFile());
|
||||
}
|
||||
|
||||
void MercurialPlugin::annotateCurrentFile()
|
||||
void MercurialPluginPrivate::annotateCurrentFile()
|
||||
{
|
||||
int currentLine = -1;
|
||||
if (Core::IEditor *editor = Core::EditorManager::currentEditor())
|
||||
@@ -244,14 +261,14 @@ void MercurialPlugin::annotateCurrentFile()
|
||||
m_client->annotate(state.currentFileTopLevel(), state.relativeCurrentFile(), QString(), currentLine);
|
||||
}
|
||||
|
||||
void MercurialPlugin::diffCurrentFile()
|
||||
void MercurialPluginPrivate::diffCurrentFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
m_client->diff(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()));
|
||||
}
|
||||
|
||||
void MercurialPlugin::logCurrentFile()
|
||||
void MercurialPluginPrivate::logCurrentFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
@@ -259,7 +276,7 @@ void MercurialPlugin::logCurrentFile()
|
||||
QStringList(), true);
|
||||
}
|
||||
|
||||
void MercurialPlugin::revertCurrentFile()
|
||||
void MercurialPluginPrivate::revertCurrentFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
@@ -270,59 +287,59 @@ void MercurialPlugin::revertCurrentFile()
|
||||
m_client->revertFile(state.currentFileTopLevel(), state.relativeCurrentFile(), reverter.revision());
|
||||
}
|
||||
|
||||
void MercurialPlugin::statusCurrentFile()
|
||||
void MercurialPluginPrivate::statusCurrentFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
m_client->status(state.currentFileTopLevel(), state.relativeCurrentFile());
|
||||
}
|
||||
|
||||
void MercurialPlugin::createDirectoryActions(const Core::Context &context)
|
||||
void MercurialPluginPrivate::createDirectoryActions(const Core::Context &context)
|
||||
{
|
||||
auto action = new QAction(tr("Diff"), this);
|
||||
m_repositoryActionList.append(action);
|
||||
Core::Command *command = Core::ActionManager::registerAction(action, Core::Id(Constants::DIFFMULTI), context);
|
||||
connect(action, &QAction::triggered, this, &MercurialPlugin::diffRepository);
|
||||
connect(action, &QAction::triggered, this, &MercurialPluginPrivate::diffRepository);
|
||||
m_mercurialContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
action = new QAction(tr("Log"), this);
|
||||
m_repositoryActionList.append(action);
|
||||
command = Core::ActionManager::registerAction(action, Core::Id(Constants::LOGMULTI), context);
|
||||
connect(action, &QAction::triggered, this, &MercurialPlugin::logRepository);
|
||||
connect(action, &QAction::triggered, this, &MercurialPluginPrivate::logRepository);
|
||||
m_mercurialContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
action = new QAction(tr("Revert..."), this);
|
||||
m_repositoryActionList.append(action);
|
||||
command = Core::ActionManager::registerAction(action, Core::Id(Constants::REVERTMULTI), context);
|
||||
connect(action, &QAction::triggered, this, &MercurialPlugin::revertMulti);
|
||||
connect(action, &QAction::triggered, this, &MercurialPluginPrivate::revertMulti);
|
||||
m_mercurialContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
action = new QAction(tr("Status"), this);
|
||||
m_repositoryActionList.append(action);
|
||||
command = Core::ActionManager::registerAction(action, Core::Id(Constants::STATUSMULTI), context);
|
||||
connect(action, &QAction::triggered, this, &MercurialPlugin::statusMulti);
|
||||
connect(action, &QAction::triggered, this, &MercurialPluginPrivate::statusMulti);
|
||||
m_mercurialContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
}
|
||||
|
||||
void MercurialPlugin::diffRepository()
|
||||
void MercurialPluginPrivate::diffRepository()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
m_client->diff(state.topLevel());
|
||||
}
|
||||
|
||||
void MercurialPlugin::logRepository()
|
||||
void MercurialPluginPrivate::logRepository()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
m_client->log(state.topLevel());
|
||||
}
|
||||
|
||||
void MercurialPlugin::revertMulti()
|
||||
void MercurialPluginPrivate::revertMulti()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
@@ -333,7 +350,7 @@ void MercurialPlugin::revertMulti()
|
||||
m_client->revertAll(state.topLevel(), reverter.revision());
|
||||
}
|
||||
|
||||
void MercurialPlugin::statusMulti()
|
||||
void MercurialPluginPrivate::statusMulti()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
@@ -341,47 +358,47 @@ void MercurialPlugin::statusMulti()
|
||||
m_client->status(state.topLevel());
|
||||
}
|
||||
|
||||
void MercurialPlugin::createRepositoryActions(const Core::Context &context)
|
||||
void MercurialPluginPrivate::createRepositoryActions(const Core::Context &context)
|
||||
{
|
||||
auto action = new QAction(tr("Pull..."), this);
|
||||
m_repositoryActionList.append(action);
|
||||
Core::Command *command = Core::ActionManager::registerAction(action, Core::Id(Constants::PULL), context);
|
||||
connect(action, &QAction::triggered, this, &MercurialPlugin::pull);
|
||||
connect(action, &QAction::triggered, this, &MercurialPluginPrivate::pull);
|
||||
m_mercurialContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
action = new QAction(tr("Push..."), this);
|
||||
m_repositoryActionList.append(action);
|
||||
command = Core::ActionManager::registerAction(action, Core::Id(Constants::PUSH), context);
|
||||
connect(action, &QAction::triggered, this, &MercurialPlugin::push);
|
||||
connect(action, &QAction::triggered, this, &MercurialPluginPrivate::push);
|
||||
m_mercurialContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
action = new QAction(tr("Update..."), this);
|
||||
m_repositoryActionList.append(action);
|
||||
command = Core::ActionManager::registerAction(action, Core::Id(Constants::UPDATE), context);
|
||||
connect(action, &QAction::triggered, this, &MercurialPlugin::update);
|
||||
connect(action, &QAction::triggered, this, &MercurialPluginPrivate::update);
|
||||
m_mercurialContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
action = new QAction(tr("Import..."), this);
|
||||
m_repositoryActionList.append(action);
|
||||
command = Core::ActionManager::registerAction(action, Core::Id(Constants::IMPORT), context);
|
||||
connect(action, &QAction::triggered, this, &MercurialPlugin::import);
|
||||
connect(action, &QAction::triggered, this, &MercurialPluginPrivate::import);
|
||||
m_mercurialContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
action = new QAction(tr("Incoming..."), this);
|
||||
m_repositoryActionList.append(action);
|
||||
command = Core::ActionManager::registerAction(action, Core::Id(Constants::INCOMING), context);
|
||||
connect(action, &QAction::triggered, this, &MercurialPlugin::incoming);
|
||||
connect(action, &QAction::triggered, this, &MercurialPluginPrivate::incoming);
|
||||
m_mercurialContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
action = new QAction(tr("Outgoing..."), this);
|
||||
m_repositoryActionList.append(action);
|
||||
command = Core::ActionManager::registerAction(action, Core::Id(Constants::OUTGOING), context);
|
||||
connect(action, &QAction::triggered, this, &MercurialPlugin::outgoing);
|
||||
connect(action, &QAction::triggered, this, &MercurialPluginPrivate::outgoing);
|
||||
m_mercurialContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
@@ -389,17 +406,17 @@ void MercurialPlugin::createRepositoryActions(const Core::Context &context)
|
||||
m_repositoryActionList.append(action);
|
||||
command = Core::ActionManager::registerAction(action, Core::Id(Constants::COMMIT), context);
|
||||
command->setDefaultKeySequence(QKeySequence(Core::useMacShortcuts ? tr("Meta+H,Meta+C") : tr("Alt+G,Alt+C")));
|
||||
connect(action, &QAction::triggered, this, &MercurialPlugin::commit);
|
||||
connect(action, &QAction::triggered, this, &MercurialPluginPrivate::commit);
|
||||
m_mercurialContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
m_createRepositoryAction = new QAction(tr("Create Repository..."), this);
|
||||
command = Core::ActionManager::registerAction(m_createRepositoryAction, Core::Id(Constants::CREATE_REPOSITORY), context);
|
||||
connect(m_createRepositoryAction, &QAction::triggered, this, &MercurialPlugin::createRepository);
|
||||
connect(m_createRepositoryAction, &QAction::triggered, this, &MercurialPluginPrivate::createRepository);
|
||||
m_mercurialContainer->addAction(command);
|
||||
}
|
||||
|
||||
void MercurialPlugin::pull()
|
||||
void MercurialPluginPrivate::pull()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
@@ -411,7 +428,7 @@ void MercurialPlugin::pull()
|
||||
m_client->synchronousPull(dialog.workingDir(), dialog.getRepositoryString());
|
||||
}
|
||||
|
||||
void MercurialPlugin::push()
|
||||
void MercurialPluginPrivate::push()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
@@ -423,7 +440,7 @@ void MercurialPlugin::push()
|
||||
m_client->synchronousPush(dialog.workingDir(), dialog.getRepositoryString());
|
||||
}
|
||||
|
||||
void MercurialPlugin::update()
|
||||
void MercurialPluginPrivate::update()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
@@ -435,7 +452,7 @@ void MercurialPlugin::update()
|
||||
m_client->update(state.topLevel(), updateDialog.revision());
|
||||
}
|
||||
|
||||
void MercurialPlugin::import()
|
||||
void MercurialPluginPrivate::import()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
@@ -451,7 +468,7 @@ void MercurialPlugin::import()
|
||||
m_client->import(state.topLevel(), fileNames);
|
||||
}
|
||||
|
||||
void MercurialPlugin::incoming()
|
||||
void MercurialPluginPrivate::incoming()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
@@ -463,14 +480,14 @@ void MercurialPlugin::incoming()
|
||||
m_client->incoming(state.topLevel(), dialog.getRepositoryString());
|
||||
}
|
||||
|
||||
void MercurialPlugin::outgoing()
|
||||
void MercurialPluginPrivate::outgoing()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
m_client->outgoing(state.topLevel());
|
||||
}
|
||||
|
||||
void MercurialPlugin::commit()
|
||||
void MercurialPluginPrivate::commit()
|
||||
{
|
||||
if (!promptBeforeCommit())
|
||||
return;
|
||||
@@ -483,14 +500,14 @@ void MercurialPlugin::commit()
|
||||
|
||||
m_submitRepository = state.topLevel();
|
||||
|
||||
connect(m_client, &MercurialClient::parsedStatus, this, &MercurialPlugin::showCommitWidget);
|
||||
connect(m_client, &MercurialClient::parsedStatus, this, &MercurialPluginPrivate::showCommitWidget);
|
||||
m_client->emitParsedStatus(m_submitRepository);
|
||||
}
|
||||
|
||||
void MercurialPlugin::showCommitWidget(const QList<VcsBaseClient::StatusItem> &status)
|
||||
void MercurialPluginPrivate::showCommitWidget(const QList<VcsBaseClient::StatusItem> &status)
|
||||
{
|
||||
//Once we receive our data release the connection so it can be reused elsewhere
|
||||
disconnect(m_client, &MercurialClient::parsedStatus, this, &MercurialPlugin::showCommitWidget);
|
||||
disconnect(m_client, &MercurialClient::parsedStatus, this, &MercurialPluginPrivate::showCommitWidget);
|
||||
|
||||
if (status.isEmpty()) {
|
||||
VcsOutputWindow::appendError(tr("There are no changes to commit."));
|
||||
@@ -518,7 +535,7 @@ void MercurialPlugin::showCommitWidget(const QList<VcsBaseClient::StatusItem> &s
|
||||
setSubmitEditor(commitEditor);
|
||||
|
||||
connect(commitEditor, &VcsBaseSubmitEditor::diffSelectedFiles,
|
||||
this, &MercurialPlugin::diffFromEditorSelected);
|
||||
this, &MercurialPluginPrivate::diffFromEditorSelected);
|
||||
commitEditor->setCheckScriptWorkingDirectory(m_submitRepository);
|
||||
|
||||
const QString msg = tr("Commit changes for \"%1\".").
|
||||
@@ -531,12 +548,12 @@ void MercurialPlugin::showCommitWidget(const QList<VcsBaseClient::StatusItem> &s
|
||||
m_client->settings().stringValue(MercurialSettings::userEmailKey), status);
|
||||
}
|
||||
|
||||
void MercurialPlugin::diffFromEditorSelected(const QStringList &files)
|
||||
void MercurialPluginPrivate::diffFromEditorSelected(const QStringList &files)
|
||||
{
|
||||
m_client->diff(m_submitRepository, files);
|
||||
}
|
||||
|
||||
void MercurialPlugin::commitFromEditor()
|
||||
void MercurialPluginPrivate::commitFromEditor()
|
||||
{
|
||||
// Close the submit editor
|
||||
m_submitActionTriggered = true;
|
||||
@@ -544,7 +561,7 @@ void MercurialPlugin::commitFromEditor()
|
||||
Core::EditorManager::closeDocument(submitEditor()->document());
|
||||
}
|
||||
|
||||
bool MercurialPlugin::submitEditorAboutToClose()
|
||||
bool MercurialPluginPrivate::submitEditorAboutToClose()
|
||||
{
|
||||
auto commitEditor = qobject_cast<CommitEditor *>(submitEditor());
|
||||
QTC_ASSERT(commitEditor, return true);
|
||||
@@ -579,7 +596,7 @@ bool MercurialPlugin::submitEditorAboutToClose()
|
||||
return true;
|
||||
}
|
||||
|
||||
void MercurialPlugin::updateActions(VcsBasePlugin::ActionState as)
|
||||
void MercurialPluginPrivate::updateActions(VcsBasePluginPrivate::ActionState as)
|
||||
{
|
||||
if (!enableMenuAction(as, m_menuAction)) {
|
||||
m_commandLocator->setEnabled(false);
|
||||
|
@@ -49,31 +49,21 @@ namespace Internal {
|
||||
class OptionsPage;
|
||||
class MercurialClient;
|
||||
|
||||
class MercurialPlugin : public VcsBase::VcsBasePlugin
|
||||
class MercurialPluginPrivate final : public VcsBase::VcsBasePluginPrivate
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Mercurial.json")
|
||||
|
||||
public:
|
||||
MercurialPlugin();
|
||||
~MercurialPlugin() override;
|
||||
MercurialPluginPrivate();
|
||||
~MercurialPluginPrivate() final;
|
||||
|
||||
bool initialize(const QStringList &arguments, QString *errorMessage) override;
|
||||
|
||||
static MercurialPlugin *instance() { return m_instance; }
|
||||
static MercurialClient *client() { return m_instance->m_client; }
|
||||
static MercurialPluginPrivate *instance();
|
||||
static MercurialClient *client();
|
||||
|
||||
protected:
|
||||
void updateActions(VcsBase::VcsBasePlugin::ActionState) override;
|
||||
void updateActions(VcsBase::VcsBasePluginPrivate::ActionState) override;
|
||||
bool submitEditorAboutToClose() override;
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
private slots:
|
||||
void testDiffFileResolving_data();
|
||||
void testDiffFileResolving();
|
||||
void testLogResolving();
|
||||
#endif
|
||||
|
||||
private:
|
||||
// File menu action slots
|
||||
void addCurrentFile();
|
||||
@@ -121,7 +111,6 @@ private:
|
||||
void createRepositoryActions(const Core::Context &context);
|
||||
|
||||
// Variables
|
||||
static MercurialPlugin *m_instance;
|
||||
OptionsPage *optionsPage = nullptr;
|
||||
MercurialClient *m_client = nullptr;
|
||||
|
||||
@@ -148,5 +137,24 @@ private:
|
||||
bool m_submitActionTriggered = false;
|
||||
};
|
||||
|
||||
class MercurialPlugin final : public ExtensionSystem::IPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Mercurial.json")
|
||||
|
||||
~MercurialPlugin() final;
|
||||
|
||||
bool initialize(const QStringList &arguments, QString *errorMessage) final;
|
||||
void extensionsInitialized() final;
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
private slots:
|
||||
void testDiffFileResolving_data();
|
||||
void testDiffFileResolving();
|
||||
void testLogResolving();
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Mercurial
|
||||
|
@@ -61,7 +61,7 @@ OptionsPageWidget::OptionsPageWidget(Core::IVersionControl *control)
|
||||
m_ui.commandChooser->setHistoryCompleter(QLatin1String("Mercurial.Command.History"));
|
||||
m_ui.commandChooser->setPromptDialogTitle(tr("Mercurial Command"));
|
||||
|
||||
const VcsBaseClientSettings &s = MercurialPlugin::client()->settings();
|
||||
const VcsBaseClientSettings &s = MercurialPluginPrivate::client()->settings();
|
||||
|
||||
m_ui.commandChooser->setPath(s.stringValue(MercurialSettings::binaryPathKey));
|
||||
m_ui.defaultUsernameLineEdit->setText(s.stringValue(MercurialSettings::userNameKey));
|
||||
@@ -79,7 +79,7 @@ void OptionsPageWidget::apply()
|
||||
ms.setValue(MercurialSettings::logCountKey, m_ui.logEntriesCount->value());
|
||||
ms.setValue(MercurialSettings::timeoutKey, m_ui.timeout->value());
|
||||
|
||||
VcsBaseClientSettings &s = MercurialPlugin::client()->settings();
|
||||
VcsBaseClientSettings &s = MercurialPluginPrivate::client()->settings();
|
||||
if (s != ms) {
|
||||
s = ms;
|
||||
m_control->configurationChanged();
|
||||
|
@@ -97,8 +97,7 @@ QString SrcDestDialog::workingDir() const
|
||||
|
||||
QUrl SrcDestDialog::getRepoUrl() const
|
||||
{
|
||||
MercurialPlugin *plugin = MercurialPlugin::instance();
|
||||
const VcsBasePluginState state = plugin->currentState();
|
||||
const VcsBasePluginState state = MercurialPluginPrivate::instance()->currentState();
|
||||
// Repo to use: Default to the project repo, but use the current
|
||||
const QString projectLoc = state.currentProjectPath();
|
||||
const QString fileLoc = state.currentFileTopLevel();
|
||||
|
@@ -106,7 +106,7 @@ VcsBase::BaseAnnotationHighlighter *PerforceEditorWidget::createAnnotationHighli
|
||||
QString PerforceEditorWidget::findDiffFile(const QString &f) const
|
||||
{
|
||||
QString errorMessage;
|
||||
const QString fileName = PerforcePlugin::fileNameFromPerforceName(f.trimmed(), false, &errorMessage);
|
||||
const QString fileName = PerforcePluginPrivate::fileNameFromPerforceName(f.trimmed(), false, &errorMessage);
|
||||
if (fileName.isEmpty())
|
||||
qWarning("%s", qPrintable(errorMessage));
|
||||
return fileName;
|
||||
|
@@ -168,7 +168,13 @@ PerforceResponse::PerforceResponse() :
|
||||
{
|
||||
}
|
||||
|
||||
PerforcePlugin *PerforcePlugin::m_instance = nullptr;
|
||||
static PerforcePluginPrivate *dd = nullptr;
|
||||
|
||||
PerforcePlugin::~PerforcePlugin()
|
||||
{
|
||||
delete dd;
|
||||
dd = nullptr;
|
||||
}
|
||||
|
||||
static const VcsBaseSubmitEditorParameters submitParameters = {
|
||||
SUBMIT_MIMETYPE,
|
||||
@@ -180,12 +186,18 @@ static const VcsBaseSubmitEditorParameters submitParameters = {
|
||||
bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *errorMessage)
|
||||
{
|
||||
Q_UNUSED(errorMessage)
|
||||
dd = new PerforcePluginPrivate;
|
||||
return true;
|
||||
}
|
||||
|
||||
PerforcePluginPrivate::PerforcePluginPrivate()
|
||||
{
|
||||
Context context(PERFORCE_CONTEXT);
|
||||
|
||||
auto vcsCtrl = new PerforceVersionControl(this);
|
||||
initializeVcs(vcsCtrl, context);
|
||||
|
||||
m_instance = this;
|
||||
dd = this;
|
||||
|
||||
m_settings.fromSettings(ICore::settings());
|
||||
|
||||
@@ -219,7 +231,7 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er
|
||||
command = ActionManager::registerAction(m_diffFileAction, CMD_ID_DIFF_CURRENT, context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
command->setDescription(tr("Diff Current File"));
|
||||
connect(m_diffFileAction, &QAction::triggered, this, &PerforcePlugin::diffCurrentFile);
|
||||
connect(m_diffFileAction, &QAction::triggered, this, &PerforcePluginPrivate::diffCurrentFile);
|
||||
perforceContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
@@ -227,7 +239,7 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er
|
||||
command = ActionManager::registerAction(m_annotateCurrentAction, CMD_ID_ANNOTATE_CURRENT, context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
command->setDescription(tr("Annotate Current File"));
|
||||
connect(m_annotateCurrentAction, &QAction::triggered, this, &PerforcePlugin::annotateCurrentFile);
|
||||
connect(m_annotateCurrentAction, &QAction::triggered, this, &PerforcePluginPrivate::annotateCurrentFile);
|
||||
perforceContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
@@ -236,7 +248,7 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
command->setDefaultKeySequence(QKeySequence(useMacShortcuts ? tr("Meta+P,Meta+F") : tr("Alt+P,Alt+F")));
|
||||
command->setDescription(tr("Filelog Current File"));
|
||||
connect(m_filelogCurrentAction, &QAction::triggered, this, &PerforcePlugin::filelogCurrentFile);
|
||||
connect(m_filelogCurrentAction, &QAction::triggered, this, &PerforcePluginPrivate::filelogCurrentFile);
|
||||
perforceContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
@@ -247,7 +259,7 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
command->setDefaultKeySequence(QKeySequence(useMacShortcuts ? tr("Meta+P,Meta+E") : tr("Alt+P,Alt+E")));
|
||||
command->setDescription(tr("Edit File"));
|
||||
connect(m_editAction, &QAction::triggered, this, &PerforcePlugin::openCurrentFile);
|
||||
connect(m_editAction, &QAction::triggered, this, &PerforcePluginPrivate::openCurrentFile);
|
||||
perforceContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
@@ -256,7 +268,7 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
command->setDefaultKeySequence(QKeySequence(useMacShortcuts ? tr("Meta+P,Meta+A") : tr("Alt+P,Alt+A")));
|
||||
command->setDescription(tr("Add File"));
|
||||
connect(m_addAction, &QAction::triggered, this, &PerforcePlugin::addCurrentFile);
|
||||
connect(m_addAction, &QAction::triggered, this, &PerforcePluginPrivate::addCurrentFile);
|
||||
perforceContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
@@ -264,7 +276,7 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er
|
||||
command = ActionManager::registerAction(m_deleteAction, CMD_ID_DELETE_FILE, context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
command->setDescription(tr("Delete File"));
|
||||
connect(m_deleteAction, &QAction::triggered, this, &PerforcePlugin::promptToDeleteCurrentFile);
|
||||
connect(m_deleteAction, &QAction::triggered, this, &PerforcePluginPrivate::promptToDeleteCurrentFile);
|
||||
perforceContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
@@ -273,7 +285,7 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
command->setDefaultKeySequence(QKeySequence(useMacShortcuts ? tr("Meta+P,Meta+R") : tr("Alt+P,Alt+R")));
|
||||
command->setDescription(tr("Revert File"));
|
||||
connect(m_revertFileAction, &QAction::triggered, this, &PerforcePlugin::revertCurrentFile);
|
||||
connect(m_revertFileAction, &QAction::triggered, this, &PerforcePluginPrivate::revertCurrentFile);
|
||||
perforceContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
@@ -285,14 +297,14 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
command->setDefaultKeySequence(QKeySequence(useMacShortcuts ? tr("Meta+P,Meta+D") : tr("Alt+P,Alt+D")));
|
||||
command->setDescription(diffProjectDefaultText);
|
||||
connect(m_diffProjectAction, &QAction::triggered, this, &PerforcePlugin::diffCurrentProject);
|
||||
connect(m_diffProjectAction, &QAction::triggered, this, &PerforcePluginPrivate::diffCurrentProject);
|
||||
perforceContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
m_logProjectAction = new ParameterAction(tr("Log Project"), tr("Log Project \"%1\""), ParameterAction::EnabledWithParameter, this);
|
||||
command = ActionManager::registerAction(m_logProjectAction, CMD_ID_PROJECTLOG, context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
connect(m_logProjectAction, &QAction::triggered, this, &PerforcePlugin::logProject);
|
||||
connect(m_logProjectAction, &QAction::triggered, this, &PerforcePluginPrivate::logProject);
|
||||
perforceContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
@@ -300,7 +312,7 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er
|
||||
command = ActionManager::registerAction(m_submitProjectAction, CMD_ID_SUBMIT, context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
command->setDefaultKeySequence(QKeySequence(useMacShortcuts ? tr("Meta+P,Meta+S") : tr("Alt+P,Alt+S")));
|
||||
connect(m_submitProjectAction, &QAction::triggered, this, &PerforcePlugin::startSubmitProject);
|
||||
connect(m_submitProjectAction, &QAction::triggered, this, &PerforcePluginPrivate::startSubmitProject);
|
||||
perforceContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
@@ -309,21 +321,21 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er
|
||||
command = ActionManager::registerAction(m_updateProjectAction, CMD_ID_UPDATE_PROJECT, context);
|
||||
command->setDescription(updateProjectDefaultText);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
connect(m_updateProjectAction, &QAction::triggered, this, &PerforcePlugin::updateCurrentProject);
|
||||
connect(m_updateProjectAction, &QAction::triggered, this, &PerforcePluginPrivate::updateCurrentProject);
|
||||
perforceContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
m_revertUnchangedAction = new ParameterAction(tr("Revert Unchanged"), tr("Revert Unchanged Files of Project \"%1\""), ParameterAction::EnabledWithParameter, this);
|
||||
command = ActionManager::registerAction(m_revertUnchangedAction, CMD_ID_REVERT_UNCHANGED_PROJECT, context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
connect(m_revertUnchangedAction, &QAction::triggered, this, &PerforcePlugin::revertUnchangedCurrentProject);
|
||||
connect(m_revertUnchangedAction, &QAction::triggered, this, &PerforcePluginPrivate::revertUnchangedCurrentProject);
|
||||
perforceContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
m_revertProjectAction = new ParameterAction(tr("Revert Project"), tr("Revert Project \"%1\""), ParameterAction::EnabledWithParameter, this);
|
||||
command = ActionManager::registerAction(m_revertProjectAction, CMD_ID_REVERT_PROJECT, context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
connect(m_revertProjectAction, &QAction::triggered, this, &PerforcePlugin::revertCurrentProject);
|
||||
connect(m_revertProjectAction, &QAction::triggered, this, &PerforcePluginPrivate::revertCurrentProject);
|
||||
perforceContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
@@ -331,32 +343,32 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er
|
||||
|
||||
m_diffAllAction = new QAction(tr("Diff Opened Files"), this);
|
||||
command = ActionManager::registerAction(m_diffAllAction, CMD_ID_DIFF_ALL, context);
|
||||
connect(m_diffAllAction, &QAction::triggered, this, &PerforcePlugin::diffAllOpened);
|
||||
connect(m_diffAllAction, &QAction::triggered, this, &PerforcePluginPrivate::diffAllOpened);
|
||||
perforceContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
m_openedAction = new QAction(tr("Opened"), this);
|
||||
command = ActionManager::registerAction(m_openedAction, CMD_ID_OPENED, context);
|
||||
command->setDefaultKeySequence(QKeySequence(useMacShortcuts ? tr("Meta+P,Meta+O") : tr("Alt+P,Alt+O")));
|
||||
connect(m_openedAction, &QAction::triggered, this, &PerforcePlugin::printOpenedFileList);
|
||||
connect(m_openedAction, &QAction::triggered, this, &PerforcePluginPrivate::printOpenedFileList);
|
||||
perforceContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
m_logRepositoryAction = new QAction(tr("Repository Log"), this);
|
||||
command = ActionManager::registerAction(m_logRepositoryAction, CMD_ID_REPOSITORYLOG, context);
|
||||
connect(m_logRepositoryAction, &QAction::triggered, this, &PerforcePlugin::logRepository);
|
||||
connect(m_logRepositoryAction, &QAction::triggered, this, &PerforcePluginPrivate::logRepository);
|
||||
perforceContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
m_pendingAction = new QAction(tr("Pending Changes..."), this);
|
||||
command = ActionManager::registerAction(m_pendingAction, CMD_ID_PENDING_CHANGES, context);
|
||||
connect(m_pendingAction, &QAction::triggered, this, &PerforcePlugin::printPendingChanges);
|
||||
connect(m_pendingAction, &QAction::triggered, this, &PerforcePluginPrivate::printPendingChanges);
|
||||
perforceContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
m_updateAllAction = new QAction(tr("Update All"), this);
|
||||
command = ActionManager::registerAction(m_updateAllAction, CMD_ID_UPDATEALL, context);
|
||||
connect(m_updateAllAction, &QAction::triggered, this, &PerforcePlugin::updateAll);
|
||||
connect(m_updateAllAction, &QAction::triggered, this, &PerforcePluginPrivate::updateAll);
|
||||
perforceContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
@@ -364,42 +376,41 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er
|
||||
|
||||
m_describeAction = new QAction(tr("Describe..."), this);
|
||||
command = ActionManager::registerAction(m_describeAction, CMD_ID_DESCRIBE, context);
|
||||
connect(m_describeAction, &QAction::triggered, this, &PerforcePlugin::describeChange);
|
||||
connect(m_describeAction, &QAction::triggered, this, &PerforcePluginPrivate::describeChange);
|
||||
perforceContainer->addAction(command);
|
||||
|
||||
m_annotateAction = new QAction(tr("Annotate..."), this);
|
||||
command = ActionManager::registerAction(m_annotateAction, CMD_ID_ANNOTATE, context);
|
||||
connect(m_annotateAction, &QAction::triggered, this, &PerforcePlugin::annotateFile);
|
||||
connect(m_annotateAction, &QAction::triggered, this, &PerforcePluginPrivate::annotateFile);
|
||||
perforceContainer->addAction(command);
|
||||
|
||||
m_filelogAction = new QAction(tr("Filelog..."), this);
|
||||
command = ActionManager::registerAction(m_filelogAction, CMD_ID_FILELOG, context);
|
||||
connect(m_filelogAction, &QAction::triggered, this, &PerforcePlugin::filelogFile);
|
||||
connect(m_filelogAction, &QAction::triggered, this, &PerforcePluginPrivate::filelogFile);
|
||||
perforceContainer->addAction(command);
|
||||
return true;
|
||||
}
|
||||
|
||||
void PerforcePlugin::extensionsInitialized()
|
||||
{
|
||||
VcsBasePlugin::extensionsInitialized();
|
||||
getTopLevel();
|
||||
dd->extensionsInitialized();
|
||||
dd->getTopLevel();
|
||||
}
|
||||
|
||||
void PerforcePlugin::openCurrentFile()
|
||||
void PerforcePluginPrivate::openCurrentFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
vcsOpen(state.currentFileTopLevel(), state.relativeCurrentFile());
|
||||
}
|
||||
|
||||
void PerforcePlugin::addCurrentFile()
|
||||
void PerforcePluginPrivate::addCurrentFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
vcsAdd(state.currentFileTopLevel(), state.relativeCurrentFile());
|
||||
}
|
||||
|
||||
void PerforcePlugin::revertCurrentFile()
|
||||
void PerforcePluginPrivate::revertCurrentFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
@@ -434,38 +445,38 @@ void PerforcePlugin::revertCurrentFile()
|
||||
perforceVersionControl()->emitFilesChanged(QStringList(state.currentFile()));
|
||||
}
|
||||
|
||||
void PerforcePlugin::diffCurrentFile()
|
||||
void PerforcePluginPrivate::diffCurrentFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
p4Diff(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()));
|
||||
}
|
||||
|
||||
void PerforcePlugin::diffCurrentProject()
|
||||
void PerforcePluginPrivate::diffCurrentProject()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasProject(), return);
|
||||
p4Diff(state.currentProjectTopLevel(), perforceRelativeProjectDirectory(state));
|
||||
}
|
||||
|
||||
void PerforcePlugin::diffAllOpened()
|
||||
void PerforcePluginPrivate::diffAllOpened()
|
||||
{
|
||||
p4Diff(m_settings.topLevel(), QStringList());
|
||||
}
|
||||
|
||||
void PerforcePlugin::updateCurrentProject()
|
||||
void PerforcePluginPrivate::updateCurrentProject()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasProject(), return);
|
||||
updateCheckout(state.currentProjectTopLevel(), perforceRelativeProjectDirectory(state));
|
||||
}
|
||||
|
||||
void PerforcePlugin::updateAll()
|
||||
void PerforcePluginPrivate::updateAll()
|
||||
{
|
||||
updateCheckout(m_settings.topLevel());
|
||||
}
|
||||
|
||||
void PerforcePlugin::revertCurrentProject()
|
||||
void PerforcePluginPrivate::revertCurrentProject()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasProject(), return);
|
||||
@@ -476,7 +487,7 @@ void PerforcePlugin::revertCurrentProject()
|
||||
revertProject(state.currentProjectTopLevel(), perforceRelativeProjectDirectory(state), false);
|
||||
}
|
||||
|
||||
void PerforcePlugin::revertUnchangedCurrentProject()
|
||||
void PerforcePluginPrivate::revertUnchangedCurrentProject()
|
||||
{
|
||||
// revert -a.
|
||||
const VcsBasePluginState state = currentState();
|
||||
@@ -484,7 +495,7 @@ void PerforcePlugin::revertUnchangedCurrentProject()
|
||||
revertProject(state.currentProjectTopLevel(), perforceRelativeProjectDirectory(state), true);
|
||||
}
|
||||
|
||||
bool PerforcePlugin::revertProject(const QString &workingDir, const QStringList &pathArgs, bool unchangedOnly)
|
||||
bool PerforcePluginPrivate::revertProject(const QString &workingDir, const QStringList &pathArgs, bool unchangedOnly)
|
||||
{
|
||||
QStringList args(QLatin1String("revert"));
|
||||
if (unchangedOnly)
|
||||
@@ -495,7 +506,7 @@ bool PerforcePlugin::revertProject(const QString &workingDir, const QStringList
|
||||
return !resp.error;
|
||||
}
|
||||
|
||||
void PerforcePlugin::updateCheckout(const QString &workingDir, const QStringList &dirs)
|
||||
void PerforcePluginPrivate::updateCheckout(const QString &workingDir, const QStringList &dirs)
|
||||
{
|
||||
QStringList args(QLatin1String("sync"));
|
||||
args.append(dirs);
|
||||
@@ -511,7 +522,7 @@ void PerforcePlugin::updateCheckout(const QString &workingDir, const QStringList
|
||||
}
|
||||
}
|
||||
|
||||
void PerforcePlugin::printOpenedFileList()
|
||||
void PerforcePluginPrivate::printOpenedFileList()
|
||||
{
|
||||
const PerforceResponse perforceResponse
|
||||
= runP4Cmd(m_settings.topLevel(), QStringList(QLatin1String("opened")),
|
||||
@@ -536,7 +547,7 @@ void PerforcePlugin::printOpenedFileList()
|
||||
VcsOutputWindow::instance()->popup(IOutputPane::ModeSwitch | IOutputPane::WithFocus);
|
||||
}
|
||||
|
||||
void PerforcePlugin::startSubmitProject()
|
||||
void PerforcePluginPrivate::startSubmitProject()
|
||||
{
|
||||
if (!promptBeforeCommit())
|
||||
return;
|
||||
@@ -600,19 +611,19 @@ void PerforcePlugin::startSubmitProject()
|
||||
openPerforceSubmitEditor(m_commitMessageFileName, depotFileNames);
|
||||
}
|
||||
|
||||
IEditor *PerforcePlugin::openPerforceSubmitEditor(const QString &fileName, const QStringList &depotFileNames)
|
||||
IEditor *PerforcePluginPrivate::openPerforceSubmitEditor(const QString &fileName, const QStringList &depotFileNames)
|
||||
{
|
||||
IEditor *editor = EditorManager::openEditor(fileName, PERFORCE_SUBMIT_EDITOR_ID);
|
||||
auto submitEditor = static_cast<PerforceSubmitEditor*>(editor);
|
||||
setSubmitEditor(submitEditor);
|
||||
submitEditor->restrictToProjectFiles(depotFileNames);
|
||||
connect(submitEditor, &VcsBaseSubmitEditor::diffSelectedFiles,
|
||||
this, &PerforcePlugin::slotSubmitDiff);
|
||||
this, &PerforcePluginPrivate::slotSubmitDiff);
|
||||
submitEditor->setCheckScriptWorkingDirectory(m_settings.topLevel());
|
||||
return editor;
|
||||
}
|
||||
|
||||
void PerforcePlugin::printPendingChanges()
|
||||
void PerforcePluginPrivate::printPendingChanges()
|
||||
{
|
||||
QGuiApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
PendingChangesDialog dia(pendingChangesData(), ICore::mainWindow());
|
||||
@@ -626,21 +637,21 @@ void PerforcePlugin::printPendingChanges()
|
||||
}
|
||||
}
|
||||
|
||||
void PerforcePlugin::describeChange()
|
||||
void PerforcePluginPrivate::describeChange()
|
||||
{
|
||||
ChangeNumberDialog dia;
|
||||
if (dia.exec() == QDialog::Accepted && dia.number() > 0)
|
||||
describe(QString(), QString::number(dia.number()));
|
||||
}
|
||||
|
||||
void PerforcePlugin::annotateCurrentFile()
|
||||
void PerforcePluginPrivate::annotateCurrentFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
annotate(state.currentFileTopLevel(), state.relativeCurrentFile());
|
||||
}
|
||||
|
||||
void PerforcePlugin::annotateFile()
|
||||
void PerforcePluginPrivate::annotateFile()
|
||||
{
|
||||
const QString file = QFileDialog::getOpenFileName(ICore::dialogParent(), tr("p4 annotate"));
|
||||
if (!file.isEmpty()) {
|
||||
@@ -649,13 +660,13 @@ void PerforcePlugin::annotateFile()
|
||||
}
|
||||
}
|
||||
|
||||
void PerforcePlugin::vcsAnnotate(const QString &workingDirectory, const QString &file,
|
||||
void PerforcePluginPrivate::vcsAnnotate(const QString &workingDirectory, const QString &file,
|
||||
const QString &revision, int lineNumber)
|
||||
{
|
||||
annotate(workingDirectory, file, revision, lineNumber);
|
||||
}
|
||||
|
||||
void PerforcePlugin::annotate(const QString &workingDir,
|
||||
void PerforcePluginPrivate::annotate(const QString &workingDir,
|
||||
const QString &fileName,
|
||||
const QString &changeList /* = QString() */,
|
||||
int lineNumber /* = -1 */)
|
||||
@@ -683,14 +694,14 @@ void PerforcePlugin::annotate(const QString &workingDir,
|
||||
}
|
||||
}
|
||||
|
||||
void PerforcePlugin::filelogCurrentFile()
|
||||
void PerforcePluginPrivate::filelogCurrentFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
filelog(state.currentFileTopLevel(), state.relativeCurrentFile(), true);
|
||||
}
|
||||
|
||||
void PerforcePlugin::filelogFile()
|
||||
void PerforcePluginPrivate::filelogFile()
|
||||
{
|
||||
const QString file = QFileDialog::getOpenFileName(ICore::dialogParent(), tr("p4 filelog"));
|
||||
if (!file.isEmpty()) {
|
||||
@@ -699,21 +710,21 @@ void PerforcePlugin::filelogFile()
|
||||
}
|
||||
}
|
||||
|
||||
void PerforcePlugin::logProject()
|
||||
void PerforcePluginPrivate::logProject()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasProject(), return);
|
||||
changelists(state.currentProjectTopLevel(), perforceRelativeFileArguments(state.relativeCurrentProject()));
|
||||
}
|
||||
|
||||
void PerforcePlugin::logRepository()
|
||||
void PerforcePluginPrivate::logRepository()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
changelists(state.topLevel(), perforceRelativeFileArguments(QString()));
|
||||
}
|
||||
|
||||
void PerforcePlugin::filelog(const QString &workingDir, const QString &fileName,
|
||||
void PerforcePluginPrivate::filelog(const QString &workingDir, const QString &fileName,
|
||||
bool enableAnnotationContextMenu)
|
||||
{
|
||||
const QString id = VcsBaseEditor::getTitleId(workingDir, QStringList(fileName));
|
||||
@@ -736,7 +747,7 @@ void PerforcePlugin::filelog(const QString &workingDir, const QString &fileName,
|
||||
}
|
||||
}
|
||||
|
||||
void PerforcePlugin::changelists(const QString &workingDir, const QString &fileName)
|
||||
void PerforcePluginPrivate::changelists(const QString &workingDir, const QString &fileName)
|
||||
{
|
||||
const QString id = VcsBaseEditor::getTitleId(workingDir, QStringList(fileName));
|
||||
QTextCodec *codec = VcsBaseEditor::getCodec(workingDir, QStringList(fileName));
|
||||
@@ -757,7 +768,7 @@ void PerforcePlugin::changelists(const QString &workingDir, const QString &fileN
|
||||
}
|
||||
}
|
||||
|
||||
void PerforcePlugin::updateActions(VcsBasePlugin::ActionState as)
|
||||
void PerforcePluginPrivate::updateActions(VcsBasePluginPrivate::ActionState as)
|
||||
{
|
||||
const bool menuActionEnabled = enableMenuAction(as, m_menuAction);
|
||||
const bool enableActions = currentState().hasTopLevel() && menuActionEnabled;
|
||||
@@ -783,7 +794,7 @@ void PerforcePlugin::updateActions(VcsBasePlugin::ActionState as)
|
||||
m_revertUnchangedAction->setParameter(projectName);
|
||||
}
|
||||
|
||||
bool PerforcePlugin::managesDirectory(const QString &directory, QString *topLevel /* = 0 */)
|
||||
bool PerforcePluginPrivate::managesDirectory(const QString &directory, QString *topLevel /* = 0 */)
|
||||
{
|
||||
const bool rc = managesDirectoryFstat(directory);
|
||||
if (topLevel) {
|
||||
@@ -795,7 +806,7 @@ bool PerforcePlugin::managesDirectory(const QString &directory, QString *topLeve
|
||||
return rc;
|
||||
}
|
||||
|
||||
bool PerforcePlugin::managesFile(const QString &workingDirectory, const QString &fileName) const
|
||||
bool PerforcePluginPrivate::managesFile(const QString &workingDirectory, const QString &fileName) const
|
||||
{
|
||||
QStringList args;
|
||||
args << QLatin1String("fstat") << QLatin1String("-m1") << fileName;
|
||||
@@ -803,7 +814,7 @@ bool PerforcePlugin::managesFile(const QString &workingDirectory, const QString
|
||||
return result.stdOut.contains(QLatin1String("depotFile"));
|
||||
}
|
||||
|
||||
bool PerforcePlugin::managesDirectoryFstat(const QString &directory)
|
||||
bool PerforcePluginPrivate::managesDirectoryFstat(const QString &directory)
|
||||
{
|
||||
// Cached?
|
||||
const ManagedDirectoryCache::const_iterator cit = m_managedDirectoryCache.constFind(directory);
|
||||
@@ -844,7 +855,7 @@ bool PerforcePlugin::managesDirectoryFstat(const QString &directory)
|
||||
return managed;
|
||||
}
|
||||
|
||||
bool PerforcePlugin::vcsOpen(const QString &workingDir, const QString &fileName, bool silently)
|
||||
bool PerforcePluginPrivate::vcsOpen(const QString &workingDir, const QString &fileName, bool silently)
|
||||
{
|
||||
QStringList args;
|
||||
args << QLatin1String("edit") << QDir::toNativeSeparators(fileName);
|
||||
@@ -857,7 +868,7 @@ bool PerforcePlugin::vcsOpen(const QString &workingDir, const QString &fileName,
|
||||
return !result.error;
|
||||
}
|
||||
|
||||
bool PerforcePlugin::vcsAdd(const QString &workingDir, const QString &fileName)
|
||||
bool PerforcePluginPrivate::vcsAdd(const QString &workingDir, const QString &fileName)
|
||||
{
|
||||
QStringList args;
|
||||
args << QLatin1String("add") << fileName;
|
||||
@@ -866,7 +877,7 @@ bool PerforcePlugin::vcsAdd(const QString &workingDir, const QString &fileName)
|
||||
return !result.error;
|
||||
}
|
||||
|
||||
bool PerforcePlugin::vcsDelete(const QString &workingDir, const QString &fileName)
|
||||
bool PerforcePluginPrivate::vcsDelete(const QString &workingDir, const QString &fileName)
|
||||
{
|
||||
|
||||
QStringList args;
|
||||
@@ -889,7 +900,7 @@ bool PerforcePlugin::vcsDelete(const QString &workingDir, const QString &fileNam
|
||||
return !deleteResult.error;
|
||||
}
|
||||
|
||||
bool PerforcePlugin::vcsMove(const QString &workingDir, const QString &from, const QString &to)
|
||||
bool PerforcePluginPrivate::vcsMove(const QString &workingDir, const QString &from, const QString &to)
|
||||
{
|
||||
// TODO verify this works
|
||||
QStringList args;
|
||||
@@ -907,16 +918,16 @@ bool PerforcePlugin::vcsMove(const QString &workingDir, const QString &from, con
|
||||
|
||||
// Write extra args to temporary file
|
||||
QSharedPointer<TempFileSaver>
|
||||
PerforcePlugin::createTemporaryArgumentFile(const QStringList &extraArgs,
|
||||
PerforcePluginPrivate::createTemporaryArgumentFile(const QStringList &extraArgs,
|
||||
QString *errorString)
|
||||
{
|
||||
if (extraArgs.isEmpty())
|
||||
return QSharedPointer<TempFileSaver>();
|
||||
// create pattern
|
||||
QString pattern = m_instance->m_tempFilePattern;
|
||||
QString pattern = dd->m_tempFilePattern;
|
||||
if (pattern.isEmpty()) {
|
||||
pattern = Utils::TemporaryDirectory::masterDirectoryPath() + "/qtc_p4_XXXXXX.args";
|
||||
m_instance->m_tempFilePattern = pattern;
|
||||
dd->m_tempFilePattern = pattern;
|
||||
}
|
||||
QSharedPointer<TempFileSaver> rc(new TempFileSaver(pattern));
|
||||
rc->setAutoRemove(true);
|
||||
@@ -935,26 +946,26 @@ PerforcePlugin::createTemporaryArgumentFile(const QStringList &extraArgs,
|
||||
|
||||
static inline QString msgNotStarted(const QString &cmd)
|
||||
{
|
||||
return PerforcePlugin::tr("Could not start perforce \"%1\". Please check your settings in the preferences.").arg(cmd);
|
||||
return PerforcePluginPrivate::tr("Could not start perforce \"%1\". Please check your settings in the preferences.").arg(cmd);
|
||||
}
|
||||
|
||||
static inline QString msgTimeout(int timeOutS)
|
||||
{
|
||||
return PerforcePlugin::tr("Perforce did not respond within timeout limit (%1 s).").arg(timeOutS);
|
||||
return PerforcePluginPrivate::tr("Perforce did not respond within timeout limit (%1 s).").arg(timeOutS);
|
||||
}
|
||||
|
||||
static inline QString msgCrash()
|
||||
{
|
||||
return PerforcePlugin::tr("The process terminated abnormally.");
|
||||
return PerforcePluginPrivate::tr("The process terminated abnormally.");
|
||||
}
|
||||
|
||||
static inline QString msgExitCode(int ex)
|
||||
{
|
||||
return PerforcePlugin::tr("The process terminated with exit code %1.").arg(ex);
|
||||
return PerforcePluginPrivate::tr("The process terminated with exit code %1.").arg(ex);
|
||||
}
|
||||
|
||||
// Run using a SynchronousProcess, emitting signals to the message window
|
||||
PerforceResponse PerforcePlugin::synchronousProcess(const QString &workingDir,
|
||||
PerforceResponse PerforcePluginPrivate::synchronousProcess(const QString &workingDir,
|
||||
const QStringList &args,
|
||||
unsigned flags,
|
||||
const QByteArray &stdInput,
|
||||
@@ -1026,7 +1037,7 @@ PerforceResponse PerforcePlugin::synchronousProcess(const QString &workingDir,
|
||||
}
|
||||
|
||||
// Run using a QProcess, for short queries
|
||||
PerforceResponse PerforcePlugin::fullySynchronousProcess(const QString &workingDir,
|
||||
PerforceResponse PerforcePluginPrivate::fullySynchronousProcess(const QString &workingDir,
|
||||
const QStringList &args,
|
||||
unsigned flags,
|
||||
const QByteArray &stdInput,
|
||||
@@ -1091,7 +1102,7 @@ PerforceResponse PerforcePlugin::fullySynchronousProcess(const QString &workingD
|
||||
return response;
|
||||
}
|
||||
|
||||
PerforceResponse PerforcePlugin::runP4Cmd(const QString &workingDir,
|
||||
PerforceResponse PerforcePluginPrivate::runP4Cmd(const QString &workingDir,
|
||||
const QStringList &args,
|
||||
unsigned flags,
|
||||
const QStringList &extraArgs,
|
||||
@@ -1136,7 +1147,7 @@ PerforceResponse PerforcePlugin::runP4Cmd(const QString &workingDir,
|
||||
return response;
|
||||
}
|
||||
|
||||
IEditor *PerforcePlugin::showOutputInEditor(const QString &title,
|
||||
IEditor *PerforcePluginPrivate::showOutputInEditor(const QString &title,
|
||||
const QString &output,
|
||||
int editorType,
|
||||
const QString &source,
|
||||
@@ -1158,7 +1169,7 @@ IEditor *PerforcePlugin::showOutputInEditor(const QString &title,
|
||||
auto e = qobject_cast<PerforceEditorWidget*>(editor->widget());
|
||||
if (!e)
|
||||
return nullptr;
|
||||
connect(e, &VcsBaseEditorWidget::annotateRevisionRequested, this, &PerforcePlugin::annotate);
|
||||
connect(e, &VcsBaseEditorWidget::annotateRevisionRequested, this, &PerforcePluginPrivate::annotate);
|
||||
e->setForceReadOnly(true);
|
||||
e->setSource(source);
|
||||
s.replace(QLatin1Char(' '), QLatin1Char('_'));
|
||||
@@ -1168,7 +1179,7 @@ IEditor *PerforcePlugin::showOutputInEditor(const QString &title,
|
||||
return editor;
|
||||
}
|
||||
|
||||
void PerforcePlugin::slotSubmitDiff(const QStringList &files)
|
||||
void PerforcePluginPrivate::slotSubmitDiff(const QStringList &files)
|
||||
{
|
||||
p4Diff(m_settings.topLevel(), files);
|
||||
}
|
||||
@@ -1210,12 +1221,12 @@ void PerforceDiffConfig::triggerReRun()
|
||||
emit reRunDiff(effectiveParameters);
|
||||
}
|
||||
|
||||
QString PerforcePlugin::commitDisplayName() const
|
||||
QString PerforcePluginPrivate::commitDisplayName() const
|
||||
{
|
||||
return tr("Submit");
|
||||
}
|
||||
|
||||
void PerforcePlugin::p4Diff(const QString &workingDir, const QStringList &files)
|
||||
void PerforcePluginPrivate::p4Diff(const QString &workingDir, const QStringList &files)
|
||||
{
|
||||
PerforceDiffParameters p;
|
||||
p.workingDir = workingDir;
|
||||
@@ -1224,7 +1235,7 @@ void PerforcePlugin::p4Diff(const QString &workingDir, const QStringList &files)
|
||||
p4Diff(p);
|
||||
}
|
||||
|
||||
void PerforcePlugin::p4Diff(const PerforceDiffParameters &p)
|
||||
void PerforcePluginPrivate::p4Diff(const PerforceDiffParameters &p)
|
||||
{
|
||||
QTextCodec *codec = VcsBaseEditor::getCodec(p.workingDir, p.files);
|
||||
const QString id = VcsBaseEditor::getTitleId(p.workingDir, p.files);
|
||||
@@ -1268,7 +1279,7 @@ void PerforcePlugin::p4Diff(const PerforceDiffParameters &p)
|
||||
diffEditorWidget->setEditorConfig(pw);
|
||||
}
|
||||
|
||||
void PerforcePlugin::describe(const QString & source, const QString &n)
|
||||
void PerforcePluginPrivate::describe(const QString & source, const QString &n)
|
||||
{
|
||||
QTextCodec *codec = source.isEmpty() ? static_cast<QTextCodec *>(nullptr)
|
||||
: VcsBaseEditor::getCodec(source);
|
||||
@@ -1280,14 +1291,14 @@ void PerforcePlugin::describe(const QString & source, const QString &n)
|
||||
showOutputInEditor(tr("p4 describe %1").arg(n), result.stdOut, VcsBase::DiffOutput, source, codec);
|
||||
}
|
||||
|
||||
void PerforcePlugin::commitFromEditor()
|
||||
void PerforcePluginPrivate::commitFromEditor()
|
||||
{
|
||||
m_submitActionTriggered = true;
|
||||
QTC_ASSERT(submitEditor(), return);
|
||||
EditorManager::closeDocument(submitEditor()->document());
|
||||
}
|
||||
|
||||
void PerforcePlugin::cleanCommitMessageFile()
|
||||
void PerforcePluginPrivate::cleanCommitMessageFile()
|
||||
{
|
||||
if (!m_commitMessageFileName.isEmpty()) {
|
||||
QFile::remove(m_commitMessageFileName);
|
||||
@@ -1295,12 +1306,12 @@ void PerforcePlugin::cleanCommitMessageFile()
|
||||
}
|
||||
}
|
||||
|
||||
bool PerforcePlugin::isCommitEditorOpen() const
|
||||
bool PerforcePluginPrivate::isCommitEditorOpen() const
|
||||
{
|
||||
return !m_commitMessageFileName.isEmpty();
|
||||
}
|
||||
|
||||
bool PerforcePlugin::submitEditorAboutToClose()
|
||||
bool PerforcePluginPrivate::submitEditorAboutToClose()
|
||||
{
|
||||
if (!isCommitEditorOpen())
|
||||
return true;
|
||||
@@ -1353,7 +1364,7 @@ bool PerforcePlugin::submitEditorAboutToClose()
|
||||
return true;
|
||||
}
|
||||
|
||||
QString PerforcePlugin::clientFilePath(const QString &serverFilePath)
|
||||
QString PerforcePluginPrivate::clientFilePath(const QString &serverFilePath)
|
||||
{
|
||||
QTC_ASSERT(m_settings.isValid(), return QString());
|
||||
|
||||
@@ -1369,7 +1380,7 @@ QString PerforcePlugin::clientFilePath(const QString &serverFilePath)
|
||||
return r.indexIn(response.stdOut) != -1 ? r.cap(1).trimmed() : QString();
|
||||
}
|
||||
|
||||
QString PerforcePlugin::pendingChangesData()
|
||||
QString PerforcePluginPrivate::pendingChangesData()
|
||||
{
|
||||
QTC_ASSERT(m_settings.isValid(), return QString());
|
||||
|
||||
@@ -1392,17 +1403,17 @@ QString PerforcePlugin::pendingChangesData()
|
||||
return dataResponse.error ? QString() : dataResponse.stdOut;
|
||||
}
|
||||
|
||||
const PerforceSettings& PerforcePlugin::settings()
|
||||
const PerforceSettings& PerforcePluginPrivate::settings()
|
||||
{
|
||||
return m_instance->m_settings;
|
||||
return dd->m_settings;
|
||||
}
|
||||
|
||||
void PerforcePlugin::setSettings(const Settings &newSettings)
|
||||
void PerforcePluginPrivate::setSettings(const Settings &newSettings)
|
||||
{
|
||||
if (newSettings != m_instance->m_settings.settings()) {
|
||||
m_instance->m_settings.setSettings(newSettings);
|
||||
m_instance->m_managedDirectoryCache.clear();
|
||||
m_instance->m_settings.toSettings(ICore::settings());
|
||||
if (newSettings != dd->m_settings.settings()) {
|
||||
dd->m_settings.setSettings(newSettings);
|
||||
dd->m_managedDirectoryCache.clear();
|
||||
dd->m_settings.toSettings(ICore::settings());
|
||||
getTopLevel();
|
||||
perforceVersionControl()->emitConfigurationChanged();
|
||||
}
|
||||
@@ -1412,12 +1423,12 @@ static inline QString msgWhereFailed(const QString & file, const QString &why)
|
||||
{
|
||||
//: Failed to run p4 "where" to resolve a Perforce file name to a local
|
||||
//: file system name.
|
||||
return PerforcePlugin::tr("Error running \"where\" on %1: %2").
|
||||
return PerforcePluginPrivate::tr("Error running \"where\" on %1: %2").
|
||||
arg(QDir::toNativeSeparators(file), why);
|
||||
}
|
||||
|
||||
// Map a perforce name "//xx" to its real name in the file system
|
||||
QString PerforcePlugin::fileNameFromPerforceName(const QString& perforceName,
|
||||
QString PerforcePluginPrivate::fileNameFromPerforceName(const QString& perforceName,
|
||||
bool quiet,
|
||||
QString *errorMessage)
|
||||
{
|
||||
@@ -1448,15 +1459,15 @@ QString PerforcePlugin::fileNameFromPerforceName(const QString& perforceName,
|
||||
return QString();
|
||||
}
|
||||
const QString p4fileSpec = output.mid(output.lastIndexOf(QLatin1Char(' ')) + 1);
|
||||
return m_instance->m_settings.mapToFileSystem(p4fileSpec);
|
||||
return dd->m_settings.mapToFileSystem(p4fileSpec);
|
||||
}
|
||||
|
||||
PerforceVersionControl *PerforcePlugin::perforceVersionControl()
|
||||
PerforceVersionControl *PerforcePluginPrivate::perforceVersionControl()
|
||||
{
|
||||
return static_cast<PerforceVersionControl *>(m_instance->versionControl());
|
||||
return static_cast<PerforceVersionControl *>(dd->versionControl());
|
||||
}
|
||||
|
||||
void PerforcePlugin::setTopLevel(const QString &topLevel)
|
||||
void PerforcePluginPrivate::setTopLevel(const QString &topLevel)
|
||||
{
|
||||
if (m_settings.topLevel() == topLevel)
|
||||
return;
|
||||
@@ -1467,20 +1478,20 @@ void PerforcePlugin::setTopLevel(const QString &topLevel)
|
||||
VcsOutputWindow::appendSilently(msg);
|
||||
}
|
||||
|
||||
void PerforcePlugin::slotTopLevelFailed(const QString &errorMessage)
|
||||
void PerforcePluginPrivate::slotTopLevelFailed(const QString &errorMessage)
|
||||
{
|
||||
VcsOutputWindow::appendSilently(tr("Perforce: Unable to determine the repository: %1").arg(errorMessage));
|
||||
}
|
||||
|
||||
void PerforcePlugin::getTopLevel(const QString &workingDirectory, bool isSync)
|
||||
void PerforcePluginPrivate::getTopLevel(const QString &workingDirectory, bool isSync)
|
||||
{
|
||||
// Run a new checker
|
||||
if (m_instance->m_settings.p4BinaryPath().isEmpty())
|
||||
if (dd->m_settings.p4BinaryPath().isEmpty())
|
||||
return;
|
||||
auto checker = new PerforceChecker(m_instance);
|
||||
connect(checker, &PerforceChecker::failed, m_instance, &PerforcePlugin::slotTopLevelFailed);
|
||||
auto checker = new PerforceChecker(dd);
|
||||
connect(checker, &PerforceChecker::failed, dd, &PerforcePluginPrivate::slotTopLevelFailed);
|
||||
connect(checker, &PerforceChecker::failed, checker, &QObject::deleteLater);
|
||||
connect(checker, &PerforceChecker::succeeded, m_instance, &PerforcePlugin::setTopLevel);
|
||||
connect(checker, &PerforceChecker::succeeded, dd, &PerforcePluginPrivate::setTopLevel);
|
||||
connect(checker, &PerforceChecker::succeeded,checker, &QObject::deleteLater);
|
||||
|
||||
checker->start(settings().p4BinaryPath(), workingDirectory,
|
||||
|
@@ -69,16 +69,12 @@ struct PerforceResponse
|
||||
QString message;
|
||||
};
|
||||
|
||||
class PerforcePlugin : public VcsBase::VcsBasePlugin
|
||||
class PerforcePluginPrivate final : public VcsBase::VcsBasePluginPrivate
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Perforce.json")
|
||||
|
||||
public:
|
||||
PerforcePlugin() = default;
|
||||
|
||||
bool initialize(const QStringList &arguments, QString *errorMessage) override;
|
||||
void extensionsInitialized() override;
|
||||
PerforcePluginPrivate();
|
||||
|
||||
bool managesDirectory(const QString &directory, QString *topLevel = nullptr);
|
||||
bool managesFile(const QString &workingDirectory, const QString &fileName) const;
|
||||
@@ -103,14 +99,11 @@ public:
|
||||
void vcsAnnotate(const QString &workingDirectory, const QString &file,
|
||||
const QString &revision, int lineNumber);
|
||||
|
||||
protected:
|
||||
void updateActions(VcsBase::VcsBasePlugin::ActionState) override;
|
||||
bool submitEditorAboutToClose() override;
|
||||
static void getTopLevel(const QString &workingDirectory = QString(), bool isSync = false);
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
private slots:
|
||||
void testLogResolving();
|
||||
#endif
|
||||
protected:
|
||||
void updateActions(VcsBase::VcsBasePluginPrivate::ActionState) override;
|
||||
bool submitEditorAboutToClose() override;
|
||||
|
||||
private:
|
||||
QString commitDisplayName() const final;
|
||||
@@ -203,7 +196,6 @@ private:
|
||||
static QSharedPointer<Utils::TempFileSaver> createTemporaryArgumentFile(const QStringList &extraArgs,
|
||||
QString *errorString);
|
||||
|
||||
static void getTopLevel(const QString &workingDirectory = QString(), bool isSync = false);
|
||||
QString pendingChangesData();
|
||||
|
||||
void updateCheckout(const QString &workingDir = QString(),
|
||||
@@ -240,11 +232,25 @@ private:
|
||||
mutable QString m_tempFilePattern;
|
||||
QAction *m_menuAction = nullptr;
|
||||
|
||||
static PerforcePlugin *m_instance;
|
||||
|
||||
PerforceSettings m_settings;
|
||||
ManagedDirectoryCache m_managedDirectoryCache;
|
||||
};
|
||||
|
||||
class PerforcePlugin final : public ExtensionSystem::IPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Perforce.json")
|
||||
|
||||
~PerforcePlugin() final;
|
||||
|
||||
bool initialize(const QStringList &arguments, QString *errorMessage) final;
|
||||
void extensionsInitialized() final;
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
private slots:
|
||||
void testLogResolving();
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace Perforce
|
||||
} // namespace Internal
|
||||
|
@@ -36,7 +36,7 @@ namespace Perforce {
|
||||
namespace Internal {
|
||||
|
||||
class PerforceSubmitEditorWidget;
|
||||
class PerforcePlugin;
|
||||
class PerforcePluginPrivate;
|
||||
|
||||
/* PerforceSubmitEditor: In p4, the file list is contained in the
|
||||
* submit message file (change list). On setting the file contents,
|
||||
|
@@ -35,7 +35,7 @@
|
||||
namespace Perforce {
|
||||
namespace Internal {
|
||||
|
||||
PerforceVersionControl::PerforceVersionControl(PerforcePlugin *plugin) :
|
||||
PerforceVersionControl::PerforceVersionControl(PerforcePluginPrivate *plugin) :
|
||||
m_plugin(plugin)
|
||||
{ }
|
||||
|
||||
|
@@ -29,14 +29,14 @@
|
||||
|
||||
namespace Perforce {
|
||||
namespace Internal {
|
||||
class PerforcePlugin;
|
||||
class PerforcePluginPrivate;
|
||||
|
||||
// Just a proxy for PerforcePlugin
|
||||
class PerforceVersionControl : public Core::IVersionControl
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit PerforceVersionControl(PerforcePlugin *plugin);
|
||||
explicit PerforceVersionControl(PerforcePluginPrivate *plugin);
|
||||
|
||||
QString displayName() const final;
|
||||
Core::Id id() const final;
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
void emitConfigurationChanged();
|
||||
|
||||
private:
|
||||
PerforcePlugin *m_plugin;
|
||||
PerforcePluginPrivate *m_plugin;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -134,14 +134,14 @@ QWidget *SettingsPage::widget()
|
||||
{
|
||||
if (!m_widget) {
|
||||
m_widget = new SettingsPageWidget;
|
||||
m_widget->setSettings(PerforcePlugin::settings());
|
||||
m_widget->setSettings(PerforcePluginPrivate::settings());
|
||||
}
|
||||
return m_widget;
|
||||
}
|
||||
|
||||
void SettingsPage::apply()
|
||||
{
|
||||
PerforcePlugin::setSettings(m_widget->settings());
|
||||
PerforcePluginPrivate::setSettings(m_widget->settings());
|
||||
}
|
||||
|
||||
void SettingsPage::finish()
|
||||
|
@@ -97,7 +97,7 @@ void SettingsPageWidget::setSettings(const VcsBaseClientSettings &s)
|
||||
}
|
||||
|
||||
SettingsPage::SettingsPage(Core::IVersionControl *control, QObject *parent) :
|
||||
VcsClientOptionsPage(control, SubversionPlugin::instance()->client(), parent)
|
||||
VcsClientOptionsPage(control, SubversionPluginPrivate::instance()->client(), parent)
|
||||
{
|
||||
setId(VcsBase::Constants::VCS_ID_SUBVERSION);
|
||||
setDisplayName(SettingsPageWidget::tr("Subversion"));
|
||||
|
@@ -194,7 +194,7 @@ private:
|
||||
SubversionDiffEditorController::SubversionDiffEditorController(
|
||||
IDocument *document,
|
||||
const QString &workingDirectory)
|
||||
: VcsBaseDiffEditorController(document, SubversionPlugin::instance()->client(), workingDirectory)
|
||||
: VcsBaseDiffEditorController(document, SubversionPluginPrivate::instance()->client(), workingDirectory)
|
||||
, m_state(Idle)
|
||||
{
|
||||
forceContextLineCount(3); // SVN cannot change that when using internal diff
|
||||
|
@@ -44,7 +44,7 @@ namespace Internal {
|
||||
class SubversionTopicCache : public Core::IVersionControl::TopicCache
|
||||
{
|
||||
public:
|
||||
SubversionTopicCache(SubversionPlugin *plugin) :
|
||||
SubversionTopicCache(SubversionPluginPrivate *plugin) :
|
||||
m_plugin(plugin)
|
||||
{ }
|
||||
|
||||
@@ -60,10 +60,10 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
SubversionPlugin *m_plugin;
|
||||
SubversionPluginPrivate *m_plugin;
|
||||
};
|
||||
|
||||
SubversionControl::SubversionControl(SubversionPlugin *plugin) :
|
||||
SubversionControl::SubversionControl(SubversionPluginPrivate *plugin) :
|
||||
Core::IVersionControl(new SubversionTopicCache(plugin)),
|
||||
m_plugin(plugin)
|
||||
{ }
|
||||
|
@@ -30,14 +30,14 @@
|
||||
namespace Subversion {
|
||||
namespace Internal {
|
||||
|
||||
class SubversionPlugin;
|
||||
class SubversionPluginPrivate;
|
||||
|
||||
// Just a proxy for SubversionPlugin
|
||||
class SubversionControl : public Core::IVersionControl
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SubversionControl(SubversionPlugin *plugin);
|
||||
explicit SubversionControl(SubversionPluginPrivate *plugin);
|
||||
QString displayName() const final;
|
||||
Core::Id id() const final;
|
||||
bool isVcsFileOrDirectory(const Utils::FilePath &fileName) const final;
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
void emitFilesChanged(const QStringList &);
|
||||
|
||||
private:
|
||||
SubversionPlugin *m_plugin;
|
||||
SubversionPluginPrivate *m_plugin;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -169,20 +169,22 @@ static inline QStringList svnDirectories()
|
||||
}
|
||||
|
||||
// ------------- SubversionPlugin
|
||||
SubversionPlugin *SubversionPlugin::m_subversionPluginInstance = nullptr;
|
||||
|
||||
SubversionPlugin::SubversionPlugin() :
|
||||
m_svnDirectories(svnDirectories())
|
||||
{
|
||||
}
|
||||
static SubversionPluginPrivate *dd = nullptr;
|
||||
|
||||
SubversionPlugin::~SubversionPlugin()
|
||||
{
|
||||
delete dd;
|
||||
dd = nullptr;
|
||||
}
|
||||
|
||||
SubversionPluginPrivate::~SubversionPluginPrivate()
|
||||
{
|
||||
delete m_client;
|
||||
cleanCommitMessageFile();
|
||||
}
|
||||
|
||||
void SubversionPlugin::cleanCommitMessageFile()
|
||||
void SubversionPluginPrivate::cleanCommitMessageFile()
|
||||
{
|
||||
if (!m_commitMessageFileName.isEmpty()) {
|
||||
QFile::remove(m_commitMessageFileName);
|
||||
@@ -191,7 +193,7 @@ void SubversionPlugin::cleanCommitMessageFile()
|
||||
}
|
||||
}
|
||||
|
||||
bool SubversionPlugin::isCommitEditorOpen() const
|
||||
bool SubversionPluginPrivate::isCommitEditorOpen() const
|
||||
{
|
||||
return !m_commitMessageFileName.isEmpty();
|
||||
}
|
||||
@@ -206,16 +208,27 @@ const VcsBaseSubmitEditorParameters submitParameters = {
|
||||
bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *errorMessage)
|
||||
{
|
||||
Q_UNUSED(errorMessage)
|
||||
dd = new SubversionPluginPrivate;
|
||||
return true;
|
||||
}
|
||||
|
||||
void SubversionPlugin::extensionsInitialized()
|
||||
{
|
||||
dd->extensionsInitialized();
|
||||
}
|
||||
|
||||
SubversionPluginPrivate::SubversionPluginPrivate() :
|
||||
m_svnDirectories(svnDirectories())
|
||||
{
|
||||
dd = this;
|
||||
|
||||
using namespace Constants;
|
||||
using namespace Core::Constants;
|
||||
|
||||
Context context(SUBVERSION_CONTEXT);
|
||||
|
||||
auto vcsCtrl = new SubversionControl(this);
|
||||
initializeVcs(vcsCtrl, context);
|
||||
|
||||
m_subversionPluginInstance = this;
|
||||
|
||||
m_client = new SubversionClient;
|
||||
|
||||
new SettingsPage(versionControl(), this);
|
||||
@@ -248,7 +261,7 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e
|
||||
CMD_ID_DIFF_CURRENT, context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
command->setDefaultKeySequence(QKeySequence(useMacShortcuts ? tr("Meta+S,Meta+D") : tr("Alt+S,Alt+D")));
|
||||
connect(m_diffCurrentAction, &QAction::triggered, this, &SubversionPlugin::diffCurrentFile);
|
||||
connect(m_diffCurrentAction, &QAction::triggered, this, &SubversionPluginPrivate::diffCurrentFile);
|
||||
subversionMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
@@ -256,7 +269,7 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e
|
||||
command = ActionManager::registerAction(m_filelogCurrentAction,
|
||||
CMD_ID_FILELOG_CURRENT, context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
connect(m_filelogCurrentAction, &QAction::triggered, this, &SubversionPlugin::filelogCurrentFile);
|
||||
connect(m_filelogCurrentAction, &QAction::triggered, this, &SubversionPluginPrivate::filelogCurrentFile);
|
||||
subversionMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
@@ -264,7 +277,7 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e
|
||||
command = ActionManager::registerAction(m_annotateCurrentAction,
|
||||
CMD_ID_ANNOTATE_CURRENT, context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
connect(m_annotateCurrentAction, &QAction::triggered, this, &SubversionPlugin::annotateCurrentFile);
|
||||
connect(m_annotateCurrentAction, &QAction::triggered, this, &SubversionPluginPrivate::annotateCurrentFile);
|
||||
subversionMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
@@ -275,7 +288,7 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e
|
||||
context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
command->setDefaultKeySequence(QKeySequence(useMacShortcuts ? tr("Meta+S,Meta+A") : tr("Alt+S,Alt+A")));
|
||||
connect(m_addAction, &QAction::triggered, this, &SubversionPlugin::addCurrentFile);
|
||||
connect(m_addAction, &QAction::triggered, this, &SubversionPluginPrivate::addCurrentFile);
|
||||
subversionMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
@@ -284,7 +297,7 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e
|
||||
CMD_ID_COMMIT_CURRENT, context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
command->setDefaultKeySequence(QKeySequence(useMacShortcuts ? tr("Meta+S,Meta+C") : tr("Alt+S,Alt+C")));
|
||||
connect(m_commitCurrentAction, &QAction::triggered, this, &SubversionPlugin::startCommitCurrentFile);
|
||||
connect(m_commitCurrentAction, &QAction::triggered, this, &SubversionPluginPrivate::startCommitCurrentFile);
|
||||
subversionMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
@@ -292,7 +305,7 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e
|
||||
command = ActionManager::registerAction(m_deleteAction, CMD_ID_DELETE_FILE,
|
||||
context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
connect(m_deleteAction, &QAction::triggered, this, &SubversionPlugin::promptToDeleteCurrentFile);
|
||||
connect(m_deleteAction, &QAction::triggered, this, &SubversionPluginPrivate::promptToDeleteCurrentFile);
|
||||
subversionMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
@@ -300,7 +313,7 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e
|
||||
command = ActionManager::registerAction(m_revertAction, CMD_ID_REVERT,
|
||||
context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
connect(m_revertAction, &QAction::triggered, this, &SubversionPlugin::revertCurrentFile);
|
||||
connect(m_revertAction, &QAction::triggered, this, &SubversionPluginPrivate::revertCurrentFile);
|
||||
subversionMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
@@ -310,7 +323,7 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e
|
||||
command = ActionManager::registerAction(m_diffProjectAction, CMD_ID_DIFF_PROJECT,
|
||||
context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
connect(m_diffProjectAction, &QAction::triggered, this, &SubversionPlugin::diffProject);
|
||||
connect(m_diffProjectAction, &QAction::triggered, this, &SubversionPluginPrivate::diffProject);
|
||||
subversionMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
@@ -318,27 +331,27 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e
|
||||
command = ActionManager::registerAction(m_statusProjectAction, CMD_ID_STATUS,
|
||||
context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
connect(m_statusProjectAction, &QAction::triggered, this, &SubversionPlugin::projectStatus);
|
||||
connect(m_statusProjectAction, &QAction::triggered, this, &SubversionPluginPrivate::projectStatus);
|
||||
subversionMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
m_logProjectAction = new ParameterAction(tr("Log Project"), tr("Log Project \"%1\""), ParameterAction::EnabledWithParameter, this);
|
||||
command = ActionManager::registerAction(m_logProjectAction, CMD_ID_PROJECTLOG, context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
connect(m_logProjectAction, &QAction::triggered, this, &SubversionPlugin::logProject);
|
||||
connect(m_logProjectAction, &QAction::triggered, this, &SubversionPluginPrivate::logProject);
|
||||
subversionMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
m_updateProjectAction = new ParameterAction(tr("Update Project"), tr("Update Project \"%1\""), ParameterAction::EnabledWithParameter, this);
|
||||
command = ActionManager::registerAction(m_updateProjectAction, CMD_ID_UPDATE, context);
|
||||
connect(m_updateProjectAction, &QAction::triggered, this, &SubversionPlugin::updateProject);
|
||||
connect(m_updateProjectAction, &QAction::triggered, this, &SubversionPluginPrivate::updateProject);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
subversionMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
m_commitProjectAction = new ParameterAction(tr("Commit Project"), tr("Commit Project \"%1\""), ParameterAction::EnabledWithParameter, this);
|
||||
command = ActionManager::registerAction(m_commitProjectAction, CMD_ID_COMMIT_PROJECT, context);
|
||||
connect(m_commitProjectAction, &QAction::triggered, this, &SubversionPlugin::startCommitProject);
|
||||
connect(m_commitProjectAction, &QAction::triggered, this, &SubversionPluginPrivate::startCommitProject);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
subversionMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
@@ -347,51 +360,49 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e
|
||||
|
||||
m_diffRepositoryAction = new QAction(tr("Diff Repository"), this);
|
||||
command = ActionManager::registerAction(m_diffRepositoryAction, CMD_ID_REPOSITORYDIFF, context);
|
||||
connect(m_diffRepositoryAction, &QAction::triggered, this, &SubversionPlugin::diffRepository);
|
||||
connect(m_diffRepositoryAction, &QAction::triggered, this, &SubversionPluginPrivate::diffRepository);
|
||||
subversionMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
m_statusRepositoryAction = new QAction(tr("Repository Status"), this);
|
||||
command = ActionManager::registerAction(m_statusRepositoryAction, CMD_ID_REPOSITORYSTATUS, context);
|
||||
connect(m_statusRepositoryAction, &QAction::triggered, this, &SubversionPlugin::statusRepository);
|
||||
connect(m_statusRepositoryAction, &QAction::triggered, this, &SubversionPluginPrivate::statusRepository);
|
||||
subversionMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
m_logRepositoryAction = new QAction(tr("Log Repository"), this);
|
||||
command = ActionManager::registerAction(m_logRepositoryAction, CMD_ID_REPOSITORYLOG, context);
|
||||
connect(m_logRepositoryAction, &QAction::triggered, this, &SubversionPlugin::logRepository);
|
||||
connect(m_logRepositoryAction, &QAction::triggered, this, &SubversionPluginPrivate::logRepository);
|
||||
subversionMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
m_updateRepositoryAction = new QAction(tr("Update Repository"), this);
|
||||
command = ActionManager::registerAction(m_updateRepositoryAction, CMD_ID_REPOSITORYUPDATE, context);
|
||||
connect(m_updateRepositoryAction, &QAction::triggered, this, &SubversionPlugin::updateRepository);
|
||||
connect(m_updateRepositoryAction, &QAction::triggered, this, &SubversionPluginPrivate::updateRepository);
|
||||
subversionMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
m_commitAllAction = new QAction(tr("Commit All Files"), this);
|
||||
command = ActionManager::registerAction(m_commitAllAction, CMD_ID_COMMIT_ALL,
|
||||
context);
|
||||
connect(m_commitAllAction, &QAction::triggered, this, &SubversionPlugin::startCommitAll);
|
||||
connect(m_commitAllAction, &QAction::triggered, this, &SubversionPluginPrivate::startCommitAll);
|
||||
subversionMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
m_describeAction = new QAction(tr("Describe..."), this);
|
||||
command = ActionManager::registerAction(m_describeAction, CMD_ID_DESCRIBE, context);
|
||||
connect(m_describeAction, &QAction::triggered, this, &SubversionPlugin::slotDescribe);
|
||||
connect(m_describeAction, &QAction::triggered, this, &SubversionPluginPrivate::slotDescribe);
|
||||
subversionMenu->addAction(command);
|
||||
|
||||
m_revertRepositoryAction = new QAction(tr("Revert Repository..."), this);
|
||||
command = ActionManager::registerAction(m_revertRepositoryAction, CMD_ID_REVERT_ALL,
|
||||
context);
|
||||
connect(m_revertRepositoryAction, &QAction::triggered, this, &SubversionPlugin::revertAll);
|
||||
connect(m_revertRepositoryAction, &QAction::triggered, this, &SubversionPluginPrivate::revertAll);
|
||||
subversionMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SubversionPlugin::isVcsDirectory(const FilePath &fileName)
|
||||
bool SubversionPluginPrivate::isVcsDirectory(const FilePath &fileName)
|
||||
{
|
||||
const QString baseName = fileName.fileName();
|
||||
return fileName.isDir() && contains(m_svnDirectories, [baseName](const QString &s) {
|
||||
@@ -399,13 +410,13 @@ bool SubversionPlugin::isVcsDirectory(const FilePath &fileName)
|
||||
});
|
||||
}
|
||||
|
||||
SubversionClient *SubversionPlugin::client() const
|
||||
SubversionClient *SubversionPluginPrivate::client() const
|
||||
{
|
||||
QTC_CHECK(m_client);
|
||||
return m_client;
|
||||
}
|
||||
|
||||
bool SubversionPlugin::submitEditorAboutToClose()
|
||||
bool SubversionPluginPrivate::submitEditorAboutToClose()
|
||||
{
|
||||
if (!isCommitEditorOpen())
|
||||
return true;
|
||||
@@ -450,24 +461,24 @@ bool SubversionPlugin::submitEditorAboutToClose()
|
||||
return closeEditor;
|
||||
}
|
||||
|
||||
void SubversionPlugin::diffCommitFiles(const QStringList &files)
|
||||
void SubversionPluginPrivate::diffCommitFiles(const QStringList &files)
|
||||
{
|
||||
m_client->diff(m_commitRepository, files, QStringList());
|
||||
}
|
||||
|
||||
SubversionSubmitEditor *SubversionPlugin::openSubversionSubmitEditor(const QString &fileName)
|
||||
SubversionSubmitEditor *SubversionPluginPrivate::openSubversionSubmitEditor(const QString &fileName)
|
||||
{
|
||||
IEditor *editor = EditorManager::openEditor(fileName, Constants::SUBVERSION_COMMIT_EDITOR_ID);
|
||||
auto submitEditor = qobject_cast<SubversionSubmitEditor*>(editor);
|
||||
QTC_ASSERT(submitEditor, return nullptr);
|
||||
setSubmitEditor(submitEditor);
|
||||
connect(submitEditor, &VcsBaseSubmitEditor::diffSelectedFiles,
|
||||
this, &SubversionPlugin::diffCommitFiles);
|
||||
this, &SubversionPluginPrivate::diffCommitFiles);
|
||||
submitEditor->setCheckScriptWorkingDirectory(m_commitRepository);
|
||||
return submitEditor;
|
||||
}
|
||||
|
||||
void SubversionPlugin::updateActions(VcsBasePlugin::ActionState as)
|
||||
void SubversionPluginPrivate::updateActions(VcsBasePluginPrivate::ActionState as)
|
||||
{
|
||||
if (!enableMenuAction(as, m_menuAction)) {
|
||||
m_commandLocator->setEnabled(false);
|
||||
@@ -503,14 +514,14 @@ void SubversionPlugin::updateActions(VcsBasePlugin::ActionState as)
|
||||
m_annotateCurrentAction->setParameter(fileName);
|
||||
}
|
||||
|
||||
void SubversionPlugin::addCurrentFile()
|
||||
void SubversionPluginPrivate::addCurrentFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
vcsAdd(state.currentFileTopLevel(), state.relativeCurrentFile());
|
||||
}
|
||||
|
||||
void SubversionPlugin::revertAll()
|
||||
void SubversionPluginPrivate::revertAll()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
@@ -534,7 +545,7 @@ void SubversionPlugin::revertAll()
|
||||
subVersionControl()->emitRepositoryChanged(state.topLevel());
|
||||
}
|
||||
|
||||
void SubversionPlugin::revertCurrentFile()
|
||||
void SubversionPluginPrivate::revertCurrentFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
@@ -572,7 +583,7 @@ void SubversionPlugin::revertCurrentFile()
|
||||
subVersionControl()->emitFilesChanged(QStringList(state.currentFile()));
|
||||
}
|
||||
|
||||
void SubversionPlugin::diffProject()
|
||||
void SubversionPluginPrivate::diffProject()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasProject(), return);
|
||||
@@ -582,7 +593,7 @@ void SubversionPlugin::diffProject()
|
||||
QStringList());
|
||||
}
|
||||
|
||||
void SubversionPlugin::diffCurrentFile()
|
||||
void SubversionPluginPrivate::diffCurrentFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
@@ -590,21 +601,21 @@ void SubversionPlugin::diffCurrentFile()
|
||||
QStringList());
|
||||
}
|
||||
|
||||
void SubversionPlugin::startCommitCurrentFile()
|
||||
void SubversionPluginPrivate::startCommitCurrentFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
startCommit(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()));
|
||||
}
|
||||
|
||||
void SubversionPlugin::startCommitAll()
|
||||
void SubversionPluginPrivate::startCommitAll()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
startCommit(state.topLevel());
|
||||
}
|
||||
|
||||
void SubversionPlugin::startCommitProject()
|
||||
void SubversionPluginPrivate::startCommitProject()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasProject(), return);
|
||||
@@ -614,7 +625,7 @@ void SubversionPlugin::startCommitProject()
|
||||
/* Start commit of files of a single repository by displaying
|
||||
* template and files in a submit editor. On closing, the real
|
||||
* commit will start. */
|
||||
void SubversionPlugin::startCommit(const QString &workingDir, const QStringList &files)
|
||||
void SubversionPluginPrivate::startCommit(const QString &workingDir, const QStringList &files)
|
||||
{
|
||||
if (!promptBeforeCommit())
|
||||
return;
|
||||
@@ -660,49 +671,49 @@ void SubversionPlugin::startCommit(const QString &workingDir, const QStringList
|
||||
editor->setStatusList(statusOutput);
|
||||
}
|
||||
|
||||
void SubversionPlugin::filelogCurrentFile()
|
||||
void SubversionPluginPrivate::filelogCurrentFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
filelog(state.currentFileTopLevel(), state.relativeCurrentFile(), true);
|
||||
}
|
||||
|
||||
void SubversionPlugin::logProject()
|
||||
void SubversionPluginPrivate::logProject()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasProject(), return);
|
||||
filelog(state.currentProjectTopLevel(), state.relativeCurrentProject());
|
||||
}
|
||||
|
||||
void SubversionPlugin::logRepository()
|
||||
void SubversionPluginPrivate::logRepository()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
filelog(state.topLevel());
|
||||
}
|
||||
|
||||
void SubversionPlugin::diffRepository()
|
||||
void SubversionPluginPrivate::diffRepository()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
m_client->diff(state.topLevel(), QStringList(), QStringList());
|
||||
}
|
||||
|
||||
void SubversionPlugin::statusRepository()
|
||||
void SubversionPluginPrivate::statusRepository()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
svnStatus(state.topLevel());
|
||||
}
|
||||
|
||||
void SubversionPlugin::updateRepository()
|
||||
void SubversionPluginPrivate::updateRepository()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
svnUpdate(state.topLevel());
|
||||
}
|
||||
|
||||
void SubversionPlugin::svnStatus(const QString &workingDir, const QString &relativePath)
|
||||
void SubversionPluginPrivate::svnStatus(const QString &workingDir, const QString &relativePath)
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
@@ -716,21 +727,21 @@ void SubversionPlugin::svnStatus(const QString &workingDir, const QString &relat
|
||||
VcsOutputWindow::clearRepository();
|
||||
}
|
||||
|
||||
void SubversionPlugin::filelog(const QString &workingDir,
|
||||
void SubversionPluginPrivate::filelog(const QString &workingDir,
|
||||
const QString &file,
|
||||
bool enableAnnotationContextMenu)
|
||||
{
|
||||
m_client->log(workingDir, QStringList(file), QStringList(), enableAnnotationContextMenu);
|
||||
}
|
||||
|
||||
void SubversionPlugin::updateProject()
|
||||
void SubversionPluginPrivate::updateProject()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasProject(), return);
|
||||
svnUpdate(state.currentProjectTopLevel(), state.relativeCurrentProject());
|
||||
}
|
||||
|
||||
void SubversionPlugin::svnUpdate(const QString &workingDir, const QString &relativePath)
|
||||
void SubversionPluginPrivate::svnUpdate(const QString &workingDir, const QString &relativePath)
|
||||
{
|
||||
QStringList args(QLatin1String("update"));
|
||||
args << SubversionClient::addAuthenticationOptions(client()->settings());
|
||||
@@ -744,14 +755,14 @@ void SubversionPlugin::svnUpdate(const QString &workingDir, const QString &relat
|
||||
subVersionControl()->emitRepositoryChanged(workingDir);
|
||||
}
|
||||
|
||||
void SubversionPlugin::annotateCurrentFile()
|
||||
void SubversionPluginPrivate::annotateCurrentFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
vcsAnnotate(state.currentFileTopLevel(), state.relativeCurrentFile());
|
||||
}
|
||||
|
||||
void SubversionPlugin::vcsAnnotate(const QString &workingDir, const QString &file,
|
||||
void SubversionPluginPrivate::vcsAnnotate(const QString &workingDir, const QString &file,
|
||||
const QString &revision /* = QString() */,
|
||||
int lineNumber /* = -1 */)
|
||||
{
|
||||
@@ -794,14 +805,14 @@ void SubversionPlugin::vcsAnnotate(const QString &workingDir, const QString &fil
|
||||
}
|
||||
}
|
||||
|
||||
void SubversionPlugin::projectStatus()
|
||||
void SubversionPluginPrivate::projectStatus()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasProject(), return);
|
||||
svnStatus(state.currentProjectTopLevel(), state.relativeCurrentProject());
|
||||
}
|
||||
|
||||
void SubversionPlugin::describe(const QString &source, const QString &changeNr)
|
||||
void SubversionPluginPrivate::describe(const QString &source, const QString &changeNr)
|
||||
{
|
||||
// To describe a complete change, find the top level and then do
|
||||
//svn diff -r 472958:472959 <top level>
|
||||
@@ -824,7 +835,7 @@ void SubversionPlugin::describe(const QString &source, const QString &changeNr)
|
||||
m_client->describe(topLevel, number, title);
|
||||
}
|
||||
|
||||
void SubversionPlugin::slotDescribe()
|
||||
void SubversionPluginPrivate::slotDescribe()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
@@ -842,14 +853,14 @@ void SubversionPlugin::slotDescribe()
|
||||
describe(state.topLevel(), QString::number(revision));
|
||||
}
|
||||
|
||||
void SubversionPlugin::commitFromEditor()
|
||||
void SubversionPluginPrivate::commitFromEditor()
|
||||
{
|
||||
m_submitActionTriggered = true;
|
||||
QTC_ASSERT(submitEditor(), return);
|
||||
EditorManager::closeDocument(submitEditor()->document());
|
||||
}
|
||||
|
||||
SubversionResponse SubversionPlugin::runSvn(const QString &workingDir,
|
||||
SubversionResponse SubversionPluginPrivate::runSvn(const QString &workingDir,
|
||||
const QStringList &arguments,
|
||||
int timeOutS, unsigned flags,
|
||||
QTextCodec *outputCodec) const
|
||||
@@ -872,7 +883,7 @@ SubversionResponse SubversionPlugin::runSvn(const QString &workingDir,
|
||||
return response;
|
||||
}
|
||||
|
||||
IEditor *SubversionPlugin::showOutputInEditor(const QString &title, const QString &output,
|
||||
IEditor *SubversionPluginPrivate::showOutputInEditor(const QString &title, const QString &output,
|
||||
int editorType, const QString &source,
|
||||
QTextCodec *codec)
|
||||
{
|
||||
@@ -887,7 +898,7 @@ IEditor *SubversionPlugin::showOutputInEditor(const QString &title, const QStrin
|
||||
auto e = qobject_cast<SubversionEditorWidget*>(editor->widget());
|
||||
if (!e)
|
||||
return nullptr;
|
||||
connect(e, &VcsBaseEditorWidget::annotateRevisionRequested, this, &SubversionPlugin::vcsAnnotate);
|
||||
connect(e, &VcsBaseEditorWidget::annotateRevisionRequested, this, &SubversionPluginPrivate::vcsAnnotate);
|
||||
e->setForceReadOnly(true);
|
||||
s.replace(QLatin1Char(' '), QLatin1Char('_'));
|
||||
e->textDocument()->setFallbackSaveAsFileName(s);
|
||||
@@ -898,13 +909,13 @@ IEditor *SubversionPlugin::showOutputInEditor(const QString &title, const QStrin
|
||||
return editor;
|
||||
}
|
||||
|
||||
SubversionPlugin *SubversionPlugin::instance()
|
||||
SubversionPluginPrivate *SubversionPluginPrivate::instance()
|
||||
{
|
||||
QTC_ASSERT(m_subversionPluginInstance, return m_subversionPluginInstance);
|
||||
return m_subversionPluginInstance;
|
||||
QTC_ASSERT(dd, return dd);
|
||||
return dd;
|
||||
}
|
||||
|
||||
QString SubversionPlugin::monitorFile(const QString &repository) const
|
||||
QString SubversionPluginPrivate::monitorFile(const QString &repository) const
|
||||
{
|
||||
QTC_ASSERT(!repository.isEmpty(), return QString());
|
||||
QDir repoDir(repository);
|
||||
@@ -918,12 +929,12 @@ QString SubversionPlugin::monitorFile(const QString &repository) const
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString SubversionPlugin::synchronousTopic(const QString &repository) const
|
||||
QString SubversionPluginPrivate::synchronousTopic(const QString &repository) const
|
||||
{
|
||||
return m_client->synchronousTopic(repository);
|
||||
}
|
||||
|
||||
bool SubversionPlugin::vcsAdd(const QString &workingDir, const QString &rawFileName)
|
||||
bool SubversionPluginPrivate::vcsAdd(const QString &workingDir, const QString &rawFileName)
|
||||
{
|
||||
const QString file = QDir::toNativeSeparators(SubversionClient::escapeFile(rawFileName));
|
||||
QStringList args;
|
||||
@@ -936,7 +947,7 @@ bool SubversionPlugin::vcsAdd(const QString &workingDir, const QString &rawFileN
|
||||
return !response.error;
|
||||
}
|
||||
|
||||
bool SubversionPlugin::vcsDelete(const QString &workingDir, const QString &rawFileName)
|
||||
bool SubversionPluginPrivate::vcsDelete(const QString &workingDir, const QString &rawFileName)
|
||||
{
|
||||
const QString file = QDir::toNativeSeparators(SubversionClient::escapeFile(rawFileName));
|
||||
|
||||
@@ -951,7 +962,7 @@ bool SubversionPlugin::vcsDelete(const QString &workingDir, const QString &rawFi
|
||||
return !response.error;
|
||||
}
|
||||
|
||||
bool SubversionPlugin::vcsMove(const QString &workingDir, const QString &from, const QString &to)
|
||||
bool SubversionPluginPrivate::vcsMove(const QString &workingDir, const QString &from, const QString &to)
|
||||
{
|
||||
QStringList args(QLatin1String("move"));
|
||||
args << SubversionClient::addAuthenticationOptions(client()->settings());
|
||||
@@ -964,7 +975,7 @@ bool SubversionPlugin::vcsMove(const QString &workingDir, const QString &from, c
|
||||
return !response.error;
|
||||
}
|
||||
|
||||
bool SubversionPlugin::vcsCheckout(const QString &directory, const QByteArray &url)
|
||||
bool SubversionPluginPrivate::vcsCheckout(const QString &directory, const QByteArray &url)
|
||||
{
|
||||
QUrl tempUrl = QUrl::fromEncoded(url);
|
||||
QString username = tempUrl.userName();
|
||||
@@ -992,7 +1003,7 @@ bool SubversionPlugin::vcsCheckout(const QString &directory, const QByteArray &u
|
||||
|
||||
}
|
||||
|
||||
bool SubversionPlugin::managesDirectory(const QString &directory, QString *topLevel /* = 0 */) const
|
||||
bool SubversionPluginPrivate::managesDirectory(const QString &directory, QString *topLevel /* = 0 */) const
|
||||
{
|
||||
const QDir dir(directory);
|
||||
if (topLevel)
|
||||
@@ -1015,7 +1026,7 @@ bool SubversionPlugin::managesDirectory(const QString &directory, QString *topLe
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SubversionPlugin::managesFile(const QString &workingDirectory, const QString &fileName) const
|
||||
bool SubversionPluginPrivate::managesFile(const QString &workingDirectory, const QString &fileName) const
|
||||
{
|
||||
QStringList args;
|
||||
args << QLatin1String("status");
|
||||
@@ -1027,7 +1038,7 @@ bool SubversionPlugin::managesFile(const QString &workingDirectory, const QStrin
|
||||
}
|
||||
|
||||
// Check whether SVN management subdirs exist.
|
||||
bool SubversionPlugin::checkSVNSubDir(const QDir &directory) const
|
||||
bool SubversionPluginPrivate::checkSVNSubDir(const QDir &directory) const
|
||||
{
|
||||
const int dirCount = m_svnDirectories.size();
|
||||
for (int i = 0; i < dirCount; i++) {
|
||||
@@ -1041,7 +1052,7 @@ bool SubversionPlugin::checkSVNSubDir(const QDir &directory) const
|
||||
return false;
|
||||
}
|
||||
|
||||
SubversionControl *SubversionPlugin::subVersionControl() const
|
||||
SubversionControl *SubversionPluginPrivate::subVersionControl() const
|
||||
{
|
||||
return static_cast<SubversionControl *>(versionControl());
|
||||
}
|
||||
|
@@ -62,16 +62,13 @@ const char FileConflictedC[] = "C";
|
||||
const char FileDeletedC[] = "D";
|
||||
const char FileModifiedC[] = "M";
|
||||
|
||||
class SubversionPlugin : public VcsBase::VcsBasePlugin
|
||||
class SubversionPluginPrivate final : public VcsBase::VcsBasePluginPrivate
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Subversion.json")
|
||||
|
||||
public:
|
||||
SubversionPlugin();
|
||||
~SubversionPlugin() override;
|
||||
|
||||
bool initialize(const QStringList &arguments, QString *errorMessage) override;
|
||||
SubversionPluginPrivate();
|
||||
~SubversionPluginPrivate() final;
|
||||
|
||||
bool isVcsDirectory(const Utils::FilePath &fileName);
|
||||
|
||||
@@ -87,7 +84,7 @@ public:
|
||||
bool managesFile(const QString &workingDirectory, const QString &fileName) const;
|
||||
bool vcsCheckout(const QString &directory, const QByteArray &url);
|
||||
|
||||
static SubversionPlugin *instance();
|
||||
static SubversionPluginPrivate *instance();
|
||||
|
||||
QString monitorFile(const QString &repository) const;
|
||||
QString synchronousTopic(const QString &repository) const;
|
||||
@@ -98,13 +95,8 @@ public:
|
||||
void vcsAnnotate(const QString &workingDir, const QString &file,
|
||||
const QString &revision = QString(), int lineNumber = -1);
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
private slots:
|
||||
void testLogResolving();
|
||||
#endif
|
||||
|
||||
protected:
|
||||
void updateActions(VcsBase::VcsBasePlugin::ActionState) override;
|
||||
void updateActions(VcsBase::VcsBasePluginPrivate::ActionState) override;
|
||||
bool submitEditorAboutToClose() override;
|
||||
|
||||
private:
|
||||
@@ -173,8 +165,23 @@ private:
|
||||
|
||||
QAction *m_menuAction = nullptr;
|
||||
bool m_submitActionTriggered = false;
|
||||
};
|
||||
|
||||
class SubversionPlugin final : public ExtensionSystem::IPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Subversion.json")
|
||||
|
||||
~SubversionPlugin() final;
|
||||
|
||||
bool initialize(const QStringList &arguments, QString *errorMessage) final;
|
||||
void extensionsInitialized() final;
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
private slots:
|
||||
void testLogResolving();
|
||||
#endif
|
||||
|
||||
static SubversionPlugin *m_subversionPluginInstance;
|
||||
};
|
||||
|
||||
} // namespace Subversion
|
||||
|
@@ -43,7 +43,7 @@ const char DIFF_SELECTED[] = "Vcs.DiffSelectedFiles";
|
||||
VcsSubmitEditorFactory::VcsSubmitEditorFactory
|
||||
(const VcsBaseSubmitEditorParameters *parameters,
|
||||
const EditorCreator &editorCreator,
|
||||
VcsBasePlugin *plugin)
|
||||
VcsBasePluginPrivate *plugin)
|
||||
: IEditorFactory(plugin), m_editorCreator(editorCreator)
|
||||
{
|
||||
setId(parameters->id);
|
||||
@@ -62,7 +62,7 @@ VcsSubmitEditorFactory::VcsSubmitEditorFactory
|
||||
plugin->commitDisplayName(), this);
|
||||
Command *command = ActionManager::registerAction(m_submitAction, SUBMIT, context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
connect(m_submitAction, &QAction::triggered, plugin, &VcsBasePlugin::commitFromEditor);
|
||||
connect(m_submitAction, &QAction::triggered, plugin, &VcsBasePluginPrivate::commitFromEditor);
|
||||
|
||||
m_diffAction = new QAction(VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this);
|
||||
ActionManager::registerAction(m_diffAction, DIFF_SELECTED, context);
|
||||
|
@@ -36,7 +36,7 @@ namespace VcsBase {
|
||||
|
||||
class VcsBaseSubmitEditor;
|
||||
class VcsBaseSubmitEditorParameters;
|
||||
class VcsBasePlugin;
|
||||
class VcsBasePluginPrivate;
|
||||
|
||||
// Parametrizable base class for editor factories creating instances of
|
||||
// VcsBaseSubmitEditor subclasses.
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
|
||||
VcsSubmitEditorFactory(const VcsBaseSubmitEditorParameters *parameters,
|
||||
const EditorCreator &editorCreator,
|
||||
VcsBasePlugin *plugin);
|
||||
VcsBasePluginPrivate *plugin);
|
||||
|
||||
Core::IEditor *createEditor() override;
|
||||
|
||||
|
@@ -516,113 +516,97 @@ VCSBASE_EXPORT QDebug operator<<(QDebug in, const VcsBasePluginState &state)
|
||||
the virtual submitEditorAboutToClose() to trigger the submit process.
|
||||
*/
|
||||
|
||||
class VcsBasePluginPrivate
|
||||
{
|
||||
public:
|
||||
inline bool supportsRepositoryCreation() const;
|
||||
|
||||
QPointer<VcsBaseSubmitEditor> m_submitEditor;
|
||||
IVersionControl *m_versionControl = nullptr;
|
||||
Context m_context;
|
||||
VcsBasePluginState m_state;
|
||||
int m_actionState = -1;
|
||||
|
||||
static Internal::StateListener *m_listener;
|
||||
};
|
||||
|
||||
bool VcsBasePluginPrivate::supportsRepositoryCreation() const
|
||||
{
|
||||
return m_versionControl && m_versionControl->supportsOperation(IVersionControl::CreateRepositoryOperation);
|
||||
}
|
||||
|
||||
Internal::StateListener *VcsBasePluginPrivate::m_listener = nullptr;
|
||||
static Internal::StateListener *m_listener = nullptr;
|
||||
|
||||
VcsBasePlugin::VcsBasePlugin() :
|
||||
d(new VcsBasePluginPrivate())
|
||||
VcsBasePluginPrivate::VcsBasePluginPrivate()
|
||||
{ }
|
||||
|
||||
VcsBasePlugin::~VcsBasePlugin()
|
||||
VcsBasePluginPrivate::~VcsBasePluginPrivate()
|
||||
{
|
||||
delete d->m_versionControl;
|
||||
delete d;
|
||||
delete m_versionControl;
|
||||
}
|
||||
|
||||
void VcsBasePlugin::initializeVcs(IVersionControl *vc, const Context &context)
|
||||
void VcsBasePluginPrivate::initializeVcs(IVersionControl *vc, const Context &context)
|
||||
{
|
||||
QTC_ASSERT(vc, return);
|
||||
|
||||
d->m_versionControl = vc;
|
||||
d->m_context = context;
|
||||
m_versionControl = vc;
|
||||
m_context = context;
|
||||
|
||||
Internal::VcsPlugin *plugin = Internal::VcsPlugin::instance();
|
||||
connect(plugin, &Internal::VcsPlugin::submitEditorAboutToClose,
|
||||
this, &VcsBasePlugin::slotSubmitEditorAboutToClose);
|
||||
this, &VcsBasePluginPrivate::slotSubmitEditorAboutToClose);
|
||||
// First time: create new listener
|
||||
if (!VcsBasePluginPrivate::m_listener)
|
||||
VcsBasePluginPrivate::m_listener = new Internal::StateListener(plugin);
|
||||
connect(VcsBasePluginPrivate::m_listener, &Internal::StateListener::stateChanged,
|
||||
this, &VcsBasePlugin::slotStateChanged);
|
||||
if (!m_listener)
|
||||
m_listener = new Internal::StateListener(plugin);
|
||||
connect(m_listener, &Internal::StateListener::stateChanged,
|
||||
this, &VcsBasePluginPrivate::slotStateChanged);
|
||||
// VCSes might have become (un-)available, so clear the VCS directory cache
|
||||
connect(vc, &IVersionControl::configurationChanged,
|
||||
VcsManager::instance(), &VcsManager::clearVersionControlCache);
|
||||
connect(vc, &IVersionControl::configurationChanged,
|
||||
VcsBasePluginPrivate::m_listener, &Internal::StateListener::slotStateChanged);
|
||||
m_listener, &Internal::StateListener::slotStateChanged);
|
||||
}
|
||||
|
||||
void VcsBasePlugin::extensionsInitialized()
|
||||
void VcsBasePluginPrivate::extensionsInitialized()
|
||||
{
|
||||
// Initialize enable menus.
|
||||
VcsBasePluginPrivate::m_listener->slotStateChanged();
|
||||
m_listener->slotStateChanged();
|
||||
}
|
||||
|
||||
void VcsBasePlugin::slotSubmitEditorAboutToClose(VcsBaseSubmitEditor *submitEditor, bool *result)
|
||||
void VcsBasePluginPrivate::slotSubmitEditorAboutToClose(VcsBaseSubmitEditor *submitEditor, bool *result)
|
||||
{
|
||||
qCDebug(baseLog) << this << "plugin's submit editor" << d->m_submitEditor
|
||||
<< (d->m_submitEditor ? d->m_submitEditor->document()->id().name() : QByteArray())
|
||||
qCDebug(baseLog) << this << "plugin's submit editor" << m_submitEditor
|
||||
<< (m_submitEditor ? m_submitEditor->document()->id().name() : QByteArray())
|
||||
<< "closing submit editor" << submitEditor
|
||||
<< (submitEditor ? submitEditor->document()->id().name() : QByteArray());
|
||||
if (submitEditor == d->m_submitEditor)
|
||||
if (submitEditor == m_submitEditor)
|
||||
*result = submitEditorAboutToClose();
|
||||
}
|
||||
|
||||
IVersionControl *VcsBasePlugin::versionControl() const
|
||||
IVersionControl *VcsBasePluginPrivate::versionControl() const
|
||||
{
|
||||
return d->m_versionControl;
|
||||
return m_versionControl;
|
||||
}
|
||||
|
||||
void VcsBasePlugin::slotStateChanged(const VcsBase::Internal::State &newInternalState, IVersionControl *vc)
|
||||
void VcsBasePluginPrivate::slotStateChanged(const VcsBase::Internal::State &newInternalState, IVersionControl *vc)
|
||||
{
|
||||
if (vc == d->m_versionControl) {
|
||||
if (vc == m_versionControl) {
|
||||
// We are directly affected: Change state
|
||||
if (!d->m_state.equals(newInternalState)) {
|
||||
d->m_state.setState(newInternalState);
|
||||
if (!m_state.equals(newInternalState)) {
|
||||
m_state.setState(newInternalState);
|
||||
updateActions(VcsEnabled);
|
||||
ICore::addAdditionalContext(d->m_context);
|
||||
ICore::addAdditionalContext(m_context);
|
||||
}
|
||||
} else {
|
||||
// Some other VCS plugin or state changed: Reset us to empty state.
|
||||
const ActionState newActionState = vc ? OtherVcsEnabled : NoVcsEnabled;
|
||||
if (d->m_actionState != newActionState || !d->m_state.isEmpty()) {
|
||||
d->m_actionState = newActionState;
|
||||
if (m_actionState != newActionState || !m_state.isEmpty()) {
|
||||
m_actionState = newActionState;
|
||||
const VcsBasePluginState emptyState;
|
||||
d->m_state = emptyState;
|
||||
m_state = emptyState;
|
||||
updateActions(newActionState);
|
||||
}
|
||||
ICore::removeAdditionalContext(d->m_context);
|
||||
ICore::removeAdditionalContext(m_context);
|
||||
}
|
||||
}
|
||||
|
||||
const VcsBasePluginState &VcsBasePlugin::currentState() const
|
||||
const VcsBasePluginState &VcsBasePluginPrivate::currentState() const
|
||||
{
|
||||
return d->m_state;
|
||||
return m_state;
|
||||
}
|
||||
|
||||
bool VcsBasePlugin::enableMenuAction(ActionState as, QAction *menuAction) const
|
||||
bool VcsBasePluginPrivate::enableMenuAction(ActionState as, QAction *menuAction) const
|
||||
{
|
||||
qCDebug(baseLog) << "enableMenuAction" << menuAction->text() << as;
|
||||
switch (as) {
|
||||
case NoVcsEnabled: {
|
||||
const bool supportsCreation = d->supportsRepositoryCreation();
|
||||
const bool supportsCreation = supportsRepositoryCreation();
|
||||
menuAction->setVisible(supportsCreation);
|
||||
menuAction->setEnabled(supportsCreation);
|
||||
return supportsCreation;
|
||||
@@ -638,18 +622,18 @@ bool VcsBasePlugin::enableMenuAction(ActionState as, QAction *menuAction) const
|
||||
return true;
|
||||
}
|
||||
|
||||
QString VcsBasePlugin::commitDisplayName() const
|
||||
QString VcsBasePluginPrivate::commitDisplayName() const
|
||||
{
|
||||
return tr("Commit", "name of \"commit\" action of the VCS.");
|
||||
}
|
||||
|
||||
bool VcsBasePlugin::promptBeforeCommit()
|
||||
bool VcsBasePluginPrivate::promptBeforeCommit()
|
||||
{
|
||||
return DocumentManager::saveAllModifiedDocuments(tr("Save before %1?")
|
||||
.arg(commitDisplayName().toLower()));
|
||||
}
|
||||
|
||||
void VcsBasePlugin::promptToDeleteCurrentFile()
|
||||
void VcsBasePluginPrivate::promptToDeleteCurrentFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
@@ -668,9 +652,9 @@ static inline bool ask(QWidget *parent, const QString &title, const QString &que
|
||||
return QMessageBox::question(parent, title, question, QMessageBox::Yes|QMessageBox::No, defaultButton) == QMessageBox::Yes;
|
||||
}
|
||||
|
||||
void VcsBasePlugin::createRepository()
|
||||
void VcsBasePluginPrivate::createRepository()
|
||||
{
|
||||
QTC_ASSERT(d->m_versionControl->supportsOperation(IVersionControl::CreateRepositoryOperation), return);
|
||||
QTC_ASSERT(m_versionControl->supportsOperation(IVersionControl::CreateRepositoryOperation), return);
|
||||
// Find current starting directory
|
||||
QString directory;
|
||||
if (const Project *currentProject = ProjectTree::currentProject())
|
||||
@@ -691,7 +675,7 @@ void VcsBasePlugin::createRepository()
|
||||
return;
|
||||
} while (true);
|
||||
// Create
|
||||
const bool rc = d->m_versionControl->vcsCreateRepository(directory);
|
||||
const bool rc = m_versionControl->vcsCreateRepository(directory);
|
||||
const QString nativeDir = QDir::toNativeSeparators(directory);
|
||||
if (rc) {
|
||||
QMessageBox::information(mw, tr("Repository Created"),
|
||||
@@ -704,21 +688,21 @@ void VcsBasePlugin::createRepository()
|
||||
}
|
||||
}
|
||||
|
||||
void VcsBasePlugin::setSubmitEditor(VcsBaseSubmitEditor *submitEditor)
|
||||
void VcsBasePluginPrivate::setSubmitEditor(VcsBaseSubmitEditor *submitEditor)
|
||||
{
|
||||
d->m_submitEditor = submitEditor;
|
||||
m_submitEditor = submitEditor;
|
||||
}
|
||||
|
||||
VcsBaseSubmitEditor *VcsBasePlugin::submitEditor() const
|
||||
VcsBaseSubmitEditor *VcsBasePluginPrivate::submitEditor() const
|
||||
{
|
||||
return d->m_submitEditor;
|
||||
return m_submitEditor;
|
||||
}
|
||||
|
||||
bool VcsBasePlugin::raiseSubmitEditor() const
|
||||
bool VcsBasePluginPrivate::raiseSubmitEditor() const
|
||||
{
|
||||
if (!d->m_submitEditor)
|
||||
if (!m_submitEditor)
|
||||
return false;
|
||||
EditorManager::activateEditor(d->m_submitEditor, EditorManager::IgnoreNavigationHistory);
|
||||
EditorManager::activateEditor(m_submitEditor, EditorManager::IgnoreNavigationHistory);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -768,7 +752,7 @@ static const char SOURCE_PROPERTY[] = "qtcreator_source";
|
||||
void setSource(IDocument *document, const QString &source)
|
||||
{
|
||||
document->setProperty(SOURCE_PROPERTY, source);
|
||||
VcsBasePluginPrivate::m_listener->slotStateChanged();
|
||||
m_listener->slotStateChanged();
|
||||
}
|
||||
|
||||
QString source(IDocument *document)
|
||||
|
@@ -27,6 +27,7 @@
|
||||
|
||||
#include "vcsbase_global.h"
|
||||
|
||||
#include <coreplugin/icontext.h>
|
||||
#include <coreplugin/iversioncontrol.h>
|
||||
#include <coreplugin/vcsmanager.h>
|
||||
#include <extensionsystem/iplugin.h>
|
||||
@@ -59,7 +60,7 @@ namespace Internal { class State; }
|
||||
class VcsBaseSubmitEditor;
|
||||
class VcsBasePluginPrivate;
|
||||
class VcsBasePluginStateData;
|
||||
class VcsBasePlugin;
|
||||
class VcsBasePluginPrivate;
|
||||
|
||||
// Documentation inside.
|
||||
class VCSBASE_EXPORT VcsBasePluginState
|
||||
@@ -109,7 +110,7 @@ public:
|
||||
friend VCSBASE_EXPORT QDebug operator<<(QDebug in, const VcsBasePluginState &state);
|
||||
|
||||
private:
|
||||
friend class VcsBasePlugin;
|
||||
friend class VcsBasePluginPrivate;
|
||||
bool equals(const Internal::State &s) const;
|
||||
void setState(const Internal::State &s);
|
||||
|
||||
@@ -153,17 +154,17 @@ VCSBASE_EXPORT Utils::SynchronousProcessResponse runVcs(const QString &workingDi
|
||||
QTextCodec *outputCodec = nullptr,
|
||||
const QProcessEnvironment &env = {});
|
||||
|
||||
class VCSBASE_EXPORT VcsBasePlugin : public ExtensionSystem::IPlugin
|
||||
class VCSBASE_EXPORT VcsBasePluginPrivate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
protected:
|
||||
explicit VcsBasePlugin();
|
||||
|
||||
void extensionsInitialized() override;
|
||||
explicit VcsBasePluginPrivate();
|
||||
|
||||
public:
|
||||
~VcsBasePlugin() override;
|
||||
~VcsBasePluginPrivate() override;
|
||||
|
||||
void extensionsInitialized();
|
||||
|
||||
const VcsBasePluginState ¤tState() const;
|
||||
Core::IVersionControl *versionControl() const;
|
||||
@@ -214,7 +215,13 @@ private:
|
||||
void slotSubmitEditorAboutToClose(VcsBaseSubmitEditor *submitEditor, bool *result);
|
||||
void slotStateChanged(const VcsBase::Internal::State &s, Core::IVersionControl *vc);
|
||||
|
||||
VcsBasePluginPrivate *d;
|
||||
bool supportsRepositoryCreation() const;
|
||||
|
||||
QPointer<VcsBaseSubmitEditor> m_submitEditor;
|
||||
Core::IVersionControl *m_versionControl = nullptr;
|
||||
Core::Context m_context;
|
||||
VcsBasePluginState m_state;
|
||||
int m_actionState = -1;
|
||||
};
|
||||
|
||||
} // namespace VcsBase
|
||||
|
@@ -509,7 +509,7 @@ static QString withUnusedMnemonic(QString string, const QList<QPushButton *> &ot
|
||||
}
|
||||
|
||||
VcsBaseSubmitEditor::PromptSubmitResult
|
||||
VcsBaseSubmitEditor::promptSubmit(VcsBasePlugin *plugin,
|
||||
VcsBaseSubmitEditor::promptSubmit(VcsBasePluginPrivate *plugin,
|
||||
bool *promptSetting,
|
||||
bool forcePrompt,
|
||||
bool canCommitOnFailure)
|
||||
|
@@ -46,7 +46,7 @@ namespace Internal {
|
||||
|
||||
class SubmitEditorWidget;
|
||||
class SubmitFileModel;
|
||||
class VcsBasePlugin;
|
||||
class VcsBasePluginPrivate;
|
||||
class VcsBaseSubmitEditorPrivate;
|
||||
|
||||
class VCSBASE_EXPORT VcsBaseSubmitEditorParameters
|
||||
@@ -85,7 +85,7 @@ public:
|
||||
// 'promptSetting' points to a bool variable containing the plugin's
|
||||
// prompt setting. The user can uncheck it from the message box.
|
||||
enum PromptSubmitResult { SubmitConfirmed, SubmitCanceled, SubmitDiscarded };
|
||||
PromptSubmitResult promptSubmit(VcsBasePlugin *plugin,
|
||||
PromptSubmitResult promptSubmit(VcsBasePluginPrivate *plugin,
|
||||
bool *promptSetting,
|
||||
bool forcePrompt = false,
|
||||
bool canCommitOnFailure = true);
|
||||
|
Reference in New Issue
Block a user