aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cvs
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2020-01-23 17:22:05 +0100
committerhjk <hjk@qt.io>2020-01-24 09:47:28 +0000
commit1cd936c53145f520fb9a3817a6548d9d25c399f0 (patch)
tree2c1cc9c375b986b5d9a7abf3f982781256ae612d /src/plugins/cvs
parent01e4f573e812c9c855a11d0cb199f9d9bed8de49 (diff)
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>
Diffstat (limited to 'src/plugins/cvs')
-rw-r--r--src/plugins/cvs/cvscontrol.cpp4
-rw-r--r--src/plugins/cvs/cvscontrol.h6
-rw-r--r--src/plugins/cvs/cvsplugin.cpp187
-rw-r--r--src/plugins/cvs/cvsplugin.h37
-rw-r--r--src/plugins/cvs/settingspage.cpp2
5 files changed, 129 insertions, 107 deletions
diff --git a/src/plugins/cvs/cvscontrol.cpp b/src/plugins/cvs/cvscontrol.cpp
index 7c499a20f6..03bdb43b77 100644
--- a/src/plugins/cvs/cvscontrol.cpp
+++ b/src/plugins/cvs/cvscontrol.cpp
@@ -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;
diff --git a/src/plugins/cvs/cvscontrol.h b/src/plugins/cvs/cvscontrol.h
index b988fb6adc..a0abe96c2d 100644
--- a/src/plugins/cvs/cvscontrol.h
+++ b/src/plugins/cvs/cvscontrol.h
@@ -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
diff --git a/src/plugins/cvs/cvsplugin.cpp b/src/plugins/cvs/cvsplugin.cpp
index ef90627e4e..f9445e617e 100644
--- a/src/plugins/cvs/cvsplugin.cpp
+++ b/src/plugins/cvs/cvsplugin.cpp
@@ -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());
}
diff --git a/src/plugins/cvs/cvsplugin.h b/src/plugins/cvs/cvsplugin.h
index 9290002569..0329eecca9 100644
--- a/src/plugins/cvs/cvsplugin.h
+++ b/src/plugins/cvs/cvsplugin.h
@@ -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;
+};
+
+class CvsPlugin final : public ExtensionSystem::IPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "CVS.json")
- static CvsPlugin *m_cvsPluginInstance;
+ ~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
diff --git a/src/plugins/cvs/settingspage.cpp b/src/plugins/cvs/settingspage.cpp
index ec89dbd9cf..d6a4325f50 100644
--- a/src/plugins/cvs/settingspage.cpp
+++ b/src/plugins/cvs/settingspage.cpp
@@ -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"));