forked from qt-creator/qt-creator
Perforce: Hide plugin class definition in .cpp
Change-Id: I6ae58a937b069ccc6a9b9f411bc42178f57133e6 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -59,7 +59,7 @@ VcsBase::BaseAnnotationHighlighterCreator PerforceEditorWidget::annotationHighli
|
|||||||
QString PerforceEditorWidget::findDiffFile(const QString &f) const
|
QString PerforceEditorWidget::findDiffFile(const QString &f) const
|
||||||
{
|
{
|
||||||
QString errorMessage;
|
QString errorMessage;
|
||||||
const QString fileName = PerforcePlugin::fileNameFromPerforceName(f.trimmed(), false, &errorMessage);
|
const QString fileName = fileNameFromPerforceName(f.trimmed(), false, &errorMessage);
|
||||||
if (fileName.isEmpty())
|
if (fileName.isEmpty())
|
||||||
qWarning("%s", qPrintable(errorMessage));
|
qWarning("%s", qPrintable(errorMessage));
|
||||||
return fileName;
|
return fileName;
|
||||||
|
@@ -22,6 +22,8 @@
|
|||||||
#include <coreplugin/messagemanager.h>
|
#include <coreplugin/messagemanager.h>
|
||||||
#include <coreplugin/locator/commandlocator.h>
|
#include <coreplugin/locator/commandlocator.h>
|
||||||
|
|
||||||
|
#include <extensionsystem/iplugin.h>
|
||||||
|
|
||||||
#include <texteditor/textdocument.h>
|
#include <texteditor/textdocument.h>
|
||||||
|
|
||||||
#include <utils/environment.h>
|
#include <utils/environment.h>
|
||||||
@@ -42,7 +44,6 @@
|
|||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFileDialog>
|
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
@@ -557,12 +558,6 @@ PerforcePluginPrivate::PerforcePluginPrivate()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerforcePlugin::extensionsInitialized()
|
|
||||||
{
|
|
||||||
dd->extensionsInitialized();
|
|
||||||
dd->getTopLevel();
|
|
||||||
}
|
|
||||||
|
|
||||||
void PerforcePluginPrivate::openCurrentFile()
|
void PerforcePluginPrivate::openCurrentFile()
|
||||||
{
|
{
|
||||||
const VcsBasePluginState state = currentState();
|
const VcsBasePluginState state = currentState();
|
||||||
@@ -704,7 +699,7 @@ void PerforcePluginPrivate::printOpenedFileList()
|
|||||||
mapped.clear();
|
mapped.clear();
|
||||||
const int delimiterPos = line.indexOf(delimiter);
|
const int delimiterPos = line.indexOf(delimiter);
|
||||||
if (delimiterPos > 0)
|
if (delimiterPos > 0)
|
||||||
mapped = PerforcePlugin::fileNameFromPerforceName(line.left(delimiterPos), true, &errorMessage);
|
mapped = fileNameFromPerforceName(line.left(delimiterPos), true, &errorMessage);
|
||||||
if (mapped.isEmpty())
|
if (mapped.isEmpty())
|
||||||
VcsOutputWindow::appendSilently(line);
|
VcsOutputWindow::appendSilently(line);
|
||||||
else
|
else
|
||||||
@@ -1623,9 +1618,7 @@ static QString msgWhereFailed(const QString & file, const QString &why)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Map a perforce name "//xx" to its real name in the file system
|
// Map a perforce name "//xx" to its real name in the file system
|
||||||
QString PerforcePlugin::fileNameFromPerforceName(const QString& perforceName,
|
QString fileNameFromPerforceName(const QString &perforceName, bool quiet, QString *errorMessage)
|
||||||
bool quiet,
|
|
||||||
QString *errorMessage)
|
|
||||||
{
|
{
|
||||||
// All happy, already mapped
|
// All happy, already mapped
|
||||||
if (!perforceName.startsWith(QLatin1String("//")))
|
if (!perforceName.startsWith(QLatin1String("//")))
|
||||||
@@ -1691,16 +1684,33 @@ void PerforcePluginPrivate::getTopLevel(const FilePath &workingDirectory, bool i
|
|||||||
checker->waitForFinished();
|
checker->waitForFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
PerforcePlugin::~PerforcePlugin()
|
class PerforcePlugin final : public ExtensionSystem::IPlugin
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Perforce.json")
|
||||||
|
|
||||||
|
~PerforcePlugin() final
|
||||||
|
{
|
||||||
delete dd;
|
delete dd;
|
||||||
dd = nullptr;
|
dd = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerforcePlugin::initialize()
|
void initialize() final
|
||||||
{
|
{
|
||||||
dd = new PerforcePluginPrivate;
|
dd = new PerforcePluginPrivate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void extensionsInitialized() final
|
||||||
|
{
|
||||||
|
dd->extensionsInitialized();
|
||||||
|
dd->getTopLevel();
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef WITH_TESTS
|
||||||
|
private slots:
|
||||||
|
void testLogResolving();
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
void PerforcePlugin::testLogResolving()
|
void PerforcePlugin::testLogResolving()
|
||||||
|
@@ -3,30 +3,11 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <extensionsystem/iplugin.h>
|
#include <QString>
|
||||||
|
|
||||||
namespace Perforce::Internal {
|
namespace Perforce::Internal {
|
||||||
|
|
||||||
class PerforcePlugin final : public ExtensionSystem::IPlugin
|
// Map a perforce name "//xx" to its real name in the file system
|
||||||
{
|
QString fileNameFromPerforceName(const QString &perforceName, bool quiet, QString *errorMessage);
|
||||||
Q_OBJECT
|
|
||||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Perforce.json")
|
|
||||||
|
|
||||||
~PerforcePlugin() final;
|
|
||||||
|
|
||||||
void initialize() 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();
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
} // Perforce::Internal
|
} // Perforce::Internal
|
||||||
|
Reference in New Issue
Block a user