aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/perforce/perforceplugin.h
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2020-02-04 11:09:59 +0100
committerhjk <hjk@qt.io>2020-02-05 06:15:04 +0000
commit76d31dd93dc96487eb142aac76e04645d24f384b (patch)
tree245a3ebe30c1cf53111ef1c145f778e7c43b3968 /src/plugins/perforce/perforceplugin.h
parentfd2ff624639264526e721ef5b6bca459d2965393 (diff)
Perforce: Move PluginPimpl definition to .cpp file
Helps to get rid of on option page parent, and a couple of accesses to singletons. Change-Id: Ifff2fb4aa56216f78acd5eb2a67c4b0f64a45c0e Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Diffstat (limited to 'src/plugins/perforce/perforceplugin.h')
-rw-r--r--src/plugins/perforce/perforceplugin.h234
1 files changed, 7 insertions, 227 deletions
diff --git a/src/plugins/perforce/perforceplugin.h b/src/plugins/perforce/perforceplugin.h
index 6bb7721ab4c..5c9de244324 100644
--- a/src/plugins/perforce/perforceplugin.h
+++ b/src/plugins/perforce/perforceplugin.h
@@ -25,236 +25,10 @@
#pragma once
-#include "perforcesettings.h"
-
-#include <coreplugin/editormanager/ieditorfactory.h>
-#include <coreplugin/iversioncontrol.h>
-
-#include <vcsbase/vcsbaseconstants.h>
-#include <vcsbase/vcsbaseplugin.h>
-
-#include <QObject>
-#include <QProcess>
-#include <QStringList>
-#include <QSharedPointer>
-#include <QHash>
-
-QT_BEGIN_NAMESPACE
-class QFile;
-class QAction;
-class QTextCodec;
-QT_END_NAMESPACE
-
-namespace Utils {
- class ParameterAction;
- class TempFileSaver;
-}
-
-namespace Core {
-class ActionContainer;
-class CommandLocator;
-}
+#include <extensionsystem/iplugin.h>
namespace Perforce {
namespace Internal {
-struct PerforceDiffParameters;
-class PerforceVersionControl;
-
-struct PerforceResponse
-{
- PerforceResponse();
-
- bool error;
- int exitCode;
- QString stdOut;
- QString stdErr;
- QString message;
-};
-
-class PerforcePluginPrivate final : public VcsBase::VcsBasePluginPrivate
-{
- Q_OBJECT
-
-public:
- PerforcePluginPrivate();
-
- // IVersionControl
- QString displayName() const final { return {"perforce"}; }
- Core::Id id() const final { return Core::Id(VcsBase::Constants::VCS_ID_PERFORCE); }
-
- bool isVcsFileOrDirectory(const Utils::FilePath &fileName) const final;
- bool managesDirectory(const QString &directory, QString *topLevel = nullptr) const final;
- bool managesFile(const QString &workingDirectory, const QString &fileName) const final;
-
- bool isConfigured() const final;
- bool supportsOperation(Operation operation) const final;
- OpenSupportMode openSupportMode(const QString &fileName) const final;
- bool vcsOpen(const QString &fileName) final;
- SettingsFlags settingsFlags() const final;
- bool vcsAdd(const QString &fileName) final;
- bool vcsDelete(const QString &filename) final;
- bool vcsMove(const QString &from, const QString &to) final;
- bool vcsCreateRepository(const QString &directory) final;
- bool vcsAnnotate(const QString &file, int line) final;
- QString vcsOpenText() const final;
- QString vcsMakeWritableText() const final;
-
- ///
- bool vcsOpen(const QString &workingDir, const QString &fileName, bool silently = false);
- bool vcsAdd(const QString &workingDir, const QString &fileName);
- bool vcsDelete(const QString &workingDir, const QString &filename);
- bool vcsMove(const QString &workingDir, const QString &from, const QString &to);
-
- void p4Diff(const QString &workingDir, const QStringList &files);
-
- Core::IEditor *openPerforceSubmitEditor(const QString &fileName, const QStringList &depotFileNames);
-
- static const PerforceSettings& settings();
- static void setSettings(const Settings &s);
-
- // Map a perforce name "//xx" to its real name in the file system
- static QString fileNameFromPerforceName(const QString& perforceName,
- bool quiet,
- QString *errorMessage);
-
- void describe(const QString &source, const QString &n);
- void vcsAnnotate(const QString &workingDirectory, const QString &file,
- const QString &revision, int lineNumber);
-
- static void getTopLevel(const QString &workingDirectory = QString(), bool isSync = false);
-
-protected:
- void updateActions(VcsBase::VcsBasePluginPrivate::ActionState) override;
- bool submitEditorAboutToClose() override;
-
-private:
- QString commitDisplayName() const final;
- void p4Diff(const PerforceDiffParameters &p);
-
- void openCurrentFile();
- void addCurrentFile();
- void revertCurrentFile();
- void printOpenedFileList();
- void diffCurrentFile();
- void diffCurrentProject();
- void updateCurrentProject();
- void revertCurrentProject();
- void revertUnchangedCurrentProject();
- void updateAll();
- void diffAllOpened();
- void startSubmitProject();
- void describeChange();
- void annotateCurrentFile();
- void annotateFile();
- void filelogCurrentFile();
- void filelogFile();
- void logProject();
- void logRepository();
-
- void commitFromEditor() override;
- void printPendingChanges();
- void slotSubmitDiff(const QStringList &files);
- void setTopLevel(const QString &);
- void slotTopLevelFailed(const QString &);
-
- class DirectoryCacheEntry
- {
- public:
- DirectoryCacheEntry(bool isManaged, const QString &topLevel):
- m_isManaged(isManaged), m_topLevel(topLevel)
- { }
-
- bool m_isManaged;
- QString m_topLevel;
- };
-
- typedef QHash<QString, DirectoryCacheEntry> ManagedDirectoryCache;
-
- Core::IEditor *showOutputInEditor(const QString &title, const QString &output,
- int editorType, const QString &source,
- QTextCodec *codec = nullptr);
-
- // Flags for runP4Cmd.
- enum RunFlags { CommandToWindow = 0x1, StdOutToWindow = 0x2,
- StdErrToWindow = 0x4, ErrorToWindow = 0x8,
- OverrideDiffEnvironment = 0x10,
- // Run completely synchronously, no signals emitted
- RunFullySynchronous = 0x20,
- IgnoreExitCode = 0x40,
- ShowBusyCursor = 0x80,
- LongTimeOut = 0x100,
- SilentStdOut = 0x200,
- };
-
- // args are passed as command line arguments
- // extra args via a tempfile and the option -x "temp-filename"
- static PerforceResponse runP4Cmd(const QString &workingDir,
- const QStringList &args,
- unsigned flags = CommandToWindow|StdErrToWindow|ErrorToWindow,
- const QStringList &extraArgs = QStringList(),
- const QByteArray &stdInput = QByteArray(),
- QTextCodec *outputCodec = nullptr);
-
- static PerforceResponse synchronousProcess(const QString &workingDir,
- const QStringList &args,
- unsigned flags,
- const QByteArray &stdInput,
- QTextCodec *outputCodec);
-
- static PerforceResponse fullySynchronousProcess(const QString &workingDir,
- const QStringList &args,
- unsigned flags,
- const QByteArray &stdInput,
- QTextCodec *outputCodec);
-
- QString clientFilePath(const QString &serverFilePath);
- void annotate(const QString &workingDir, const QString &fileName,
- const QString &changeList = QString(), int lineNumber = -1);
- void filelog(const QString &workingDir, const QString &fileName = QString(),
- bool enableAnnotationContextMenu = false);
- void changelists(const QString &workingDir, const QString &fileName = QString());
- void cleanCommitMessageFile();
- bool isCommitEditorOpen() const;
- static QSharedPointer<Utils::TempFileSaver> createTemporaryArgumentFile(const QStringList &extraArgs,
- QString *errorString);
-
- QString pendingChangesData();
-
- void updateCheckout(const QString &workingDir = QString(),
- const QStringList &dirs = QStringList());
- bool revertProject(const QString &workingDir, const QStringList &args, bool unchangedOnly);
- bool managesDirectoryFstat(const QString &directory);
-
- Core::CommandLocator *m_commandLocator = nullptr;
- Utils::ParameterAction *m_editAction = nullptr;
- Utils::ParameterAction *m_addAction = nullptr;
- Utils::ParameterAction *m_deleteAction = nullptr;
- QAction *m_openedAction = nullptr;
- Utils::ParameterAction *m_revertFileAction = nullptr;
- Utils::ParameterAction *m_diffFileAction = nullptr;
- Utils::ParameterAction *m_diffProjectAction = nullptr;
- Utils::ParameterAction *m_updateProjectAction = nullptr;
- Utils::ParameterAction *m_revertProjectAction = nullptr;
- Utils::ParameterAction *m_revertUnchangedAction = nullptr;
- QAction *m_diffAllAction = nullptr;
- Utils::ParameterAction *m_submitProjectAction = nullptr;
- QAction *m_pendingAction = nullptr;
- QAction *m_describeAction = nullptr;
- Utils::ParameterAction *m_annotateCurrentAction = nullptr;
- QAction *m_annotateAction = nullptr;
- Utils::ParameterAction *m_filelogCurrentAction = nullptr;
- QAction *m_filelogAction = nullptr;
- Utils::ParameterAction *m_logProjectAction = nullptr;
- QAction *m_logRepositoryAction = nullptr;
- QAction *m_updateAllAction = nullptr;
- bool m_submitActionTriggered = false;
- QString m_commitMessageFileName;
- mutable QString m_tempFilePattern;
- QAction *m_menuAction = nullptr;
-
- PerforceSettings m_settings;
- ManagedDirectoryCache m_managedDirectoryCache;
-};
class PerforcePlugin final : public ExtensionSystem::IPlugin
{
@@ -266,6 +40,12 @@ class PerforcePlugin final : public ExtensionSystem::IPlugin
bool initialize(const QStringList &arguments, QString *errorMessage) final;
void extensionsInitialized() final;
+public:
+ // Map a perforce name "//xx" to its real name in the file system
+ static QString fileNameFromPerforceName(const QString& perforceName,
+ bool quiet,
+ QString *errorMessage);
+
#ifdef WITH_TESTS
private slots:
void testLogResolving();