forked from qt-creator/qt-creator
Rename VcsBaseEditorParameterWidget -> VcsBaseEditorConfig
Change-Id: I5626e66ba2b7a760ce55263edce9e716067ea6a4 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
2c6adc1e74
commit
c844071627
@@ -30,7 +30,7 @@
|
||||
|
||||
#include <vcsbase/vcsbaseplugin.h>
|
||||
#include <vcsbase/vcsoutputwindow.h>
|
||||
#include <vcsbase/vcsbaseeditorparameterwidget.h>
|
||||
#include <vcsbase/vcsbaseeditorconfig.h>
|
||||
|
||||
#include <utils/hostosinfo.h>
|
||||
|
||||
@@ -46,12 +46,12 @@ namespace Bazaar {
|
||||
namespace Internal {
|
||||
|
||||
// Parameter widget controlling whitespace diff mode, associated with a parameter
|
||||
class BazaarDiffParameterWidget : public VcsBaseEditorParameterWidget
|
||||
class BazaarDiffConfig : public VcsBaseEditorConfig
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
BazaarDiffParameterWidget(VcsBaseClientSettings &settings, QToolBar *toolBar) :
|
||||
VcsBaseEditorParameterWidget(toolBar)
|
||||
BazaarDiffConfig(VcsBaseClientSettings &settings, QToolBar *toolBar) :
|
||||
VcsBaseEditorConfig(toolBar)
|
||||
{
|
||||
mapSetting(addToggleButton(QLatin1String("-w"), tr("Ignore Whitespace")),
|
||||
settings.boolPointer(BazaarSettings::diffIgnoreWhiteSpaceKey));
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
{
|
||||
QStringList args;
|
||||
// Bazaar wants "--diff-options=-w -B.."
|
||||
const QStringList formatArguments = VcsBaseEditorParameterWidget::arguments();
|
||||
const QStringList formatArguments = VcsBaseEditorConfig::arguments();
|
||||
if (!formatArguments.isEmpty()) {
|
||||
const QString a = QLatin1String("--diff-options=")
|
||||
+ formatArguments.join(QString(QLatin1Char(' ')));
|
||||
@@ -73,12 +73,12 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class BazaarLogParameterWidget : public VcsBaseEditorParameterWidget
|
||||
class BazaarLogConfig : public VcsBaseEditorConfig
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
BazaarLogParameterWidget(VcsBaseClientSettings &settings, QToolBar *toolBar) :
|
||||
VcsBaseEditorParameterWidget(toolBar)
|
||||
BazaarLogConfig(VcsBaseClientSettings &settings, QToolBar *toolBar) :
|
||||
VcsBaseEditorConfig(toolBar)
|
||||
{
|
||||
mapSetting(addToggleButton(QLatin1String("--verbose"), tr("Verbose"),
|
||||
tr("Show files changed in each revision.")),
|
||||
@@ -102,11 +102,11 @@ public:
|
||||
|
||||
BazaarClient::BazaarClient() : VcsBaseClient(new BazaarSettings)
|
||||
{
|
||||
setDiffParameterWidgetCreator([this](QToolBar *toolBar) {
|
||||
return new BazaarDiffParameterWidget(settings(), toolBar);
|
||||
setDiffConfigCreator([this](QToolBar *toolBar) {
|
||||
return new BazaarDiffConfig(settings(), toolBar);
|
||||
});
|
||||
setLogParameterWidgetCreator([this](QToolBar *toolBar) {
|
||||
return new BazaarLogParameterWidget(settings(), toolBar);
|
||||
setLogConfigCreator([this](QToolBar *toolBar) {
|
||||
return new BazaarLogConfig(settings(), toolBar);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,6 @@
|
||||
#include <vcsbase/basevcseditorfactory.h>
|
||||
#include <vcsbase/basevcssubmiteditorfactory.h>
|
||||
#include <vcsbase/vcsbaseeditor.h>
|
||||
#include <vcsbase/vcsbaseeditorparameterwidget.h>
|
||||
#include <vcsbase/vcsoutputwindow.h>
|
||||
#include <vcsbase/vcsbasesubmiteditor.h>
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <vcsbase/vcsbaseplugin.h>
|
||||
#include <vcsbase/vcsbaseeditor.h>
|
||||
#include <vcsbase/vcsbaseconstants.h>
|
||||
#include <vcsbase/vcsbaseeditorparameterwidget.h>
|
||||
#include <vcsbase/vcsbaseeditorconfig.h>
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
@@ -43,19 +43,19 @@ namespace Cvs {
|
||||
namespace Internal {
|
||||
|
||||
// Parameter widget controlling whitespace diff mode, associated with a parameter
|
||||
class CvsDiffParameterWidget : public VcsBaseEditorParameterWidget
|
||||
class CvsDiffConfig : public VcsBaseEditorConfig
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CvsDiffParameterWidget(VcsBaseClientSettings &settings, QToolBar *toolBar);
|
||||
CvsDiffConfig(VcsBaseClientSettings &settings, QToolBar *toolBar);
|
||||
QStringList arguments() const;
|
||||
|
||||
private:
|
||||
VcsBaseClientSettings &m_settings;
|
||||
};
|
||||
|
||||
CvsDiffParameterWidget::CvsDiffParameterWidget(VcsBaseClientSettings &settings, QToolBar *toolBar) :
|
||||
VcsBaseEditorParameterWidget(toolBar),
|
||||
CvsDiffConfig::CvsDiffConfig(VcsBaseClientSettings &settings, QToolBar *toolBar) :
|
||||
VcsBaseEditorConfig(toolBar),
|
||||
m_settings(settings)
|
||||
{
|
||||
mapSetting(addToggleButton(QLatin1String("-w"), tr("Ignore Whitespace")),
|
||||
@@ -64,19 +64,19 @@ CvsDiffParameterWidget::CvsDiffParameterWidget(VcsBaseClientSettings &settings,
|
||||
settings.boolPointer(CvsSettings::diffIgnoreBlankLinesKey));
|
||||
}
|
||||
|
||||
QStringList CvsDiffParameterWidget::arguments() const
|
||||
QStringList CvsDiffConfig::arguments() const
|
||||
{
|
||||
QStringList args;
|
||||
args = m_settings.stringValue(CvsSettings::diffOptionsKey).split(QLatin1Char(' '),
|
||||
QString::SkipEmptyParts);
|
||||
args += VcsBaseEditorParameterWidget::arguments();
|
||||
args += VcsBaseEditorConfig::arguments();
|
||||
return args;
|
||||
}
|
||||
|
||||
CvsClient::CvsClient() : VcsBaseClient(new CvsSettings)
|
||||
{
|
||||
setDiffParameterWidgetCreator([this](QToolBar *toolBar) {
|
||||
return new CvsDiffParameterWidget(settings(), toolBar);
|
||||
setDiffConfigCreator([this](QToolBar *toolBar) {
|
||||
return new CvsDiffConfig(settings(), toolBar);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include <vcsbase/basevcssubmiteditorfactory.h>
|
||||
#include <vcsbase/vcsbaseconstants.h>
|
||||
#include <vcsbase/vcsbaseeditor.h>
|
||||
#include <vcsbase/vcsbaseeditorparameterwidget.h>
|
||||
#include <vcsbase/vcscommand.h>
|
||||
#include <vcsbase/vcsoutputwindow.h>
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
|
||||
#include <vcsbase/submitfilemodel.h>
|
||||
#include <vcsbase/vcsbaseeditor.h>
|
||||
#include <vcsbase/vcsbaseeditorparameterwidget.h>
|
||||
#include <vcsbase/vcsbaseeditorconfig.h>
|
||||
#include <vcsbase/vcsbaseplugin.h>
|
||||
#include <vcsbase/vcscommand.h>
|
||||
#include <vcsbase/vcsoutputwindow.h>
|
||||
@@ -389,13 +389,13 @@ void ShowController::reloadFinished(bool success)
|
||||
|
||||
///////////////////////////////
|
||||
|
||||
class BaseGitDiffArgumentsWidget : public VcsBaseEditorParameterWidget
|
||||
class BaseGitDiffArgumentsWidget : public VcsBaseEditorConfig
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
BaseGitDiffArgumentsWidget(VcsBaseClientSettings &settings, QToolBar *toolBar) :
|
||||
VcsBaseEditorParameterWidget(toolBar)
|
||||
VcsBaseEditorConfig(toolBar)
|
||||
{
|
||||
m_patienceButton
|
||||
= addToggleButton("--patience", tr("Patience"),
|
||||
@@ -412,13 +412,13 @@ protected:
|
||||
QAction *m_ignoreWSButton;
|
||||
};
|
||||
|
||||
class GitBlameArgumentsWidget : public VcsBaseEditorParameterWidget
|
||||
class GitBlameArgumentsWidget : public VcsBaseEditorConfig
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GitBlameArgumentsWidget(VcsBaseClientSettings &settings, QToolBar *toolBar) :
|
||||
VcsBaseEditorParameterWidget(toolBar)
|
||||
VcsBaseEditorConfig(toolBar)
|
||||
{
|
||||
mapSetting(addToggleButton(QString(), tr("Omit Date"),
|
||||
tr("Hide the date of a change from the output.")),
|
||||
@@ -828,7 +828,7 @@ void GitClient::log(const QString &workingDirectory, const QString &fileName,
|
||||
if (!editor->configurationAdded()) {
|
||||
auto *argWidget = new GitLogArgumentsWidget(settings(), editor->toolBar());
|
||||
argWidget->setBaseArguments(args);
|
||||
connect(argWidget, &VcsBaseEditorParameterWidget::commandExecutionRequested,
|
||||
connect(argWidget, &VcsBaseEditorConfig::commandExecutionRequested,
|
||||
[=]() { this->log(workingDir, fileName, enableAnnotationContextMenu, argWidget->arguments()); });
|
||||
effectiveArgs = argWidget->arguments();
|
||||
editor->setConfigurationAdded();
|
||||
@@ -914,7 +914,7 @@ VcsBaseEditorWidget *GitClient::annotate(
|
||||
if (!editor->configurationAdded()) {
|
||||
auto *argWidget = new GitBlameArgumentsWidget(settings(), editor->toolBar());
|
||||
argWidget->setBaseArguments(extraOptions);
|
||||
connect(argWidget, &VcsBaseEditorParameterWidget::commandExecutionRequested,
|
||||
connect(argWidget, &VcsBaseEditorConfig::commandExecutionRequested,
|
||||
[=] {
|
||||
const int line = VcsBaseEditor::lineNumberOfCurrentEditor();
|
||||
annotate(workingDir, file, revision, line, argWidget->arguments());
|
||||
|
||||
@@ -50,7 +50,6 @@ namespace VcsBase {
|
||||
class VcsCommand;
|
||||
class SubmitFileModel;
|
||||
class VcsBaseEditorWidget;
|
||||
class VcsBaseEditorParameterWidget;
|
||||
}
|
||||
|
||||
namespace DiffEditor {
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include <vcsbase/vcsoutputwindow.h>
|
||||
#include <vcsbase/vcsbaseplugin.h>
|
||||
#include <vcsbase/vcsbaseeditor.h>
|
||||
#include <vcsbase/vcsbaseeditorparameterwidget.h>
|
||||
#include <vcsbase/vcsbaseeditorconfig.h>
|
||||
#include <utils/synchronousprocess.h>
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
@@ -50,12 +50,12 @@ namespace Mercurial {
|
||||
namespace Internal {
|
||||
|
||||
// Parameter widget controlling whitespace diff mode, associated with a parameter
|
||||
class MercurialDiffParameterWidget : public VcsBaseEditorParameterWidget
|
||||
class MercurialDiffConfig : public VcsBaseEditorConfig
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MercurialDiffParameterWidget(VcsBaseClientSettings &settings, QToolBar *toolBar) :
|
||||
VcsBaseEditorParameterWidget(toolBar)
|
||||
MercurialDiffConfig(VcsBaseClientSettings &settings, QToolBar *toolBar) :
|
||||
VcsBaseEditorConfig(toolBar)
|
||||
{
|
||||
mapSetting(addToggleButton(QLatin1String("-w"), tr("Ignore Whitespace")),
|
||||
settings.boolPointer(MercurialSettings::diffIgnoreWhiteSpaceKey));
|
||||
@@ -66,8 +66,8 @@ public:
|
||||
|
||||
MercurialClient::MercurialClient() : VcsBaseClient(new MercurialSettings)
|
||||
{
|
||||
setDiffParameterWidgetCreator([this](QToolBar *toolBar) {
|
||||
return new MercurialDiffParameterWidget(settings(), toolBar);
|
||||
setDiffConfigCreator([this](QToolBar *toolBar) {
|
||||
return new MercurialDiffConfig(settings(), toolBar);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
#include <vcsbase/basevcssubmiteditorfactory.h>
|
||||
#include <vcsbase/vcsbaseeditor.h>
|
||||
#include <vcsbase/vcsoutputwindow.h>
|
||||
#include <vcsbase/vcsbaseeditorparameterwidget.h>
|
||||
#include <vcsbase/vcsbaseeditorconfig.h>
|
||||
|
||||
#include <QAction>
|
||||
#include <QDebug>
|
||||
@@ -1195,11 +1195,11 @@ struct PerforceDiffParameters
|
||||
};
|
||||
|
||||
// Parameter widget controlling whitespace diff mode, associated with a parameter
|
||||
class PerforceDiffParameterWidget : public VcsBaseEditorParameterWidget
|
||||
class PerforceDiffConfig : public VcsBaseEditorConfig
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit PerforceDiffParameterWidget(const PerforceDiffParameters &p, QToolBar *toolBar);
|
||||
explicit PerforceDiffConfig(const PerforceDiffParameters &p, QToolBar *toolBar);
|
||||
void triggerReRun();
|
||||
|
||||
signals:
|
||||
@@ -1209,16 +1209,15 @@ private:
|
||||
const PerforceDiffParameters m_parameters;
|
||||
};
|
||||
|
||||
PerforceDiffParameterWidget::PerforceDiffParameterWidget(const PerforceDiffParameters &p,
|
||||
QToolBar *toolBar) :
|
||||
VcsBaseEditorParameterWidget(toolBar), m_parameters(p)
|
||||
PerforceDiffConfig::PerforceDiffConfig(const PerforceDiffParameters &p, QToolBar *toolBar) :
|
||||
VcsBaseEditorConfig(toolBar), m_parameters(p)
|
||||
{
|
||||
setBaseArguments(p.diffArguments);
|
||||
addToggleButton(QLatin1String("w"), tr("Ignore Whitespace"));
|
||||
connect(this, &VcsBaseEditorParameterWidget::argumentsChanged, this, &PerforceDiffParameterWidget::triggerReRun);
|
||||
connect(this, &VcsBaseEditorConfig::argumentsChanged, this, &PerforceDiffConfig::triggerReRun);
|
||||
}
|
||||
|
||||
void PerforceDiffParameterWidget::triggerReRun()
|
||||
void PerforceDiffConfig::triggerReRun()
|
||||
{
|
||||
PerforceDiffParameters effectiveParameters = m_parameters;
|
||||
effectiveParameters.diffArguments = arguments();
|
||||
@@ -1270,11 +1269,11 @@ void PerforcePlugin::p4Diff(const PerforceDiffParameters &p)
|
||||
auto diffEditorWidget = qobject_cast<VcsBaseEditorWidget *>(editor->widget());
|
||||
// Wire up the parameter widget to trigger a re-run on
|
||||
// parameter change and 'revert' from inside the diff editor.
|
||||
auto pw = new PerforceDiffParameterWidget(p, diffEditorWidget->toolBar());
|
||||
connect(pw, &PerforceDiffParameterWidget::reRunDiff,
|
||||
auto pw = new PerforceDiffConfig(p, diffEditorWidget->toolBar());
|
||||
connect(pw, &PerforceDiffConfig::reRunDiff,
|
||||
this, [this](const PerforceDiffParameters &p) { p4Diff(p); });
|
||||
connect(diffEditorWidget, &VcsBaseEditorWidget::diffChunkReverted,
|
||||
pw, &PerforceDiffParameterWidget::triggerReRun);
|
||||
pw, &PerforceDiffConfig::triggerReRun);
|
||||
diffEditorWidget->setConfigurationAdded();
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include <vcsbase/vcscommand.h>
|
||||
#include <vcsbase/vcsbaseconstants.h>
|
||||
#include <vcsbase/vcsbaseeditor.h>
|
||||
#include <vcsbase/vcsbaseeditorparameterwidget.h>
|
||||
#include <vcsbase/vcsbaseeditorconfig.h>
|
||||
#include <vcsbase/vcsbaseplugin.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/synchronousprocess.h>
|
||||
@@ -52,12 +52,12 @@ using namespace VcsBase;
|
||||
namespace Subversion {
|
||||
namespace Internal {
|
||||
|
||||
class SubversionLogParameterWidget : public VcsBaseEditorParameterWidget
|
||||
class SubversionLogConfig : public VcsBaseEditorConfig
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SubversionLogParameterWidget(VcsBaseClientSettings &settings, QToolBar *toolBar) :
|
||||
VcsBaseEditorParameterWidget(toolBar)
|
||||
SubversionLogConfig(VcsBaseClientSettings &settings, QToolBar *toolBar) :
|
||||
VcsBaseEditorConfig(toolBar)
|
||||
{
|
||||
mapSetting(addToggleButton(QLatin1String("--verbose"), tr("Verbose"),
|
||||
tr("Show files changed in each revision")),
|
||||
@@ -67,8 +67,8 @@ public:
|
||||
|
||||
SubversionClient::SubversionClient() : VcsBaseClient(new SubversionSettings)
|
||||
{
|
||||
setLogParameterWidgetCreator([this](QToolBar *toolBar) {
|
||||
return new SubversionLogParameterWidget(settings(), toolBar);
|
||||
setLogConfigCreator([this](QToolBar *toolBar) {
|
||||
return new SubversionLogConfig(settings(), toolBar);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
#include <vcsbase/basevcssubmiteditorfactory.h>
|
||||
#include <vcsbase/vcsbaseconstants.h>
|
||||
#include <vcsbase/vcsoutputwindow.h>
|
||||
#include <vcsbase/vcsbaseeditorparameterwidget.h>
|
||||
|
||||
#include <texteditor/textdocument.h>
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ HEADERS += vcsbase_global.h \
|
||||
vcscommand.h \
|
||||
vcsbaseclient.h \
|
||||
vcsbaseclientsettings.h \
|
||||
vcsbaseeditorparameterwidget.h \
|
||||
vcsbaseeditorconfig.h \
|
||||
submitfieldwidget.h \
|
||||
submiteditorwidget.h
|
||||
|
||||
@@ -52,7 +52,7 @@ SOURCES += vcsplugin.cpp \
|
||||
vcscommand.cpp \
|
||||
vcsbaseclient.cpp \
|
||||
vcsbaseclientsettings.cpp \
|
||||
vcsbaseeditorparameterwidget.cpp \
|
||||
vcsbaseeditorconfig.cpp \
|
||||
submitfieldwidget.cpp \
|
||||
submiteditorwidget.cpp
|
||||
|
||||
|
||||
@@ -55,8 +55,8 @@ QtcPlugin {
|
||||
"vcsbaseconstants.h",
|
||||
"vcsbaseeditor.cpp",
|
||||
"vcsbaseeditor.h",
|
||||
"vcsbaseeditorparameterwidget.cpp",
|
||||
"vcsbaseeditorparameterwidget.h",
|
||||
"vcsbaseeditorconfig.cpp",
|
||||
"vcsbaseeditorconfig.h",
|
||||
"vcsbaseoptionspage.cpp",
|
||||
"vcsbaseoptionspage.h",
|
||||
"vcsbaseplugin.cpp",
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "vcsbaseclient.h"
|
||||
#include "vcscommand.h"
|
||||
#include "vcsbaseclientsettings.h"
|
||||
#include "vcsbaseeditorparameterwidget.h"
|
||||
#include "vcsbaseeditorconfig.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/vcsmanager.h>
|
||||
@@ -270,21 +270,21 @@ void VcsBaseClientImpl::saveSettings()
|
||||
class VcsBaseClientPrivate
|
||||
{
|
||||
public:
|
||||
VcsBaseEditorParameterWidget *createDiffEditor(VcsBaseEditorWidget *editor);
|
||||
VcsBaseEditorParameterWidget *createLogEditor(VcsBaseEditorWidget *editor);
|
||||
VcsBaseEditorConfig *createDiffEditor(VcsBaseEditorWidget *editor);
|
||||
VcsBaseEditorConfig *createLogEditor(VcsBaseEditorWidget *editor);
|
||||
|
||||
VcsBaseClient::ParameterWidgetCreator m_diffParamWidgetCreator;
|
||||
VcsBaseClient::ParameterWidgetCreator m_logParamWidgetCreator;
|
||||
VcsBaseClient::ConfigCreator m_diffConfigCreator;
|
||||
VcsBaseClient::ConfigCreator m_logConfigCreator;
|
||||
};
|
||||
|
||||
VcsBaseEditorParameterWidget *VcsBaseClientPrivate::createDiffEditor(VcsBaseEditorWidget *editor)
|
||||
VcsBaseEditorConfig *VcsBaseClientPrivate::createDiffEditor(VcsBaseEditorWidget *editor)
|
||||
{
|
||||
return m_diffParamWidgetCreator ? m_diffParamWidgetCreator(editor->toolBar()) : 0;
|
||||
return m_diffConfigCreator ? m_diffConfigCreator(editor->toolBar()) : 0;
|
||||
}
|
||||
|
||||
VcsBaseEditorParameterWidget *VcsBaseClientPrivate::createLogEditor(VcsBaseEditorWidget *editor)
|
||||
VcsBaseEditorConfig *VcsBaseClientPrivate::createLogEditor(VcsBaseEditorWidget *editor)
|
||||
{
|
||||
return m_logParamWidgetCreator ? m_logParamWidgetCreator(editor->toolBar()) : 0;
|
||||
return m_logConfigCreator ? m_logConfigCreator(editor->toolBar()) : 0;
|
||||
}
|
||||
|
||||
VcsBaseClient::StatusItem::StatusItem(const QString &s, const QString &f) :
|
||||
@@ -427,11 +427,11 @@ void VcsBaseClient::diff(const QString &workingDir, const QStringList &files,
|
||||
|
||||
QStringList effectiveArgs = extraOptions;
|
||||
if (!editor->configurationAdded()) {
|
||||
if (VcsBaseEditorParameterWidget *paramWidget = d->createDiffEditor(editor)) {
|
||||
if (VcsBaseEditorConfig *paramWidget = d->createDiffEditor(editor)) {
|
||||
// editor has been just created, createVcsEditor() didn't set a configuration widget yet
|
||||
connect(editor, &VcsBaseEditorWidget::diffChunkReverted,
|
||||
paramWidget, &VcsBaseEditorParameterWidget::executeCommand);
|
||||
connect(paramWidget, &VcsBaseEditorParameterWidget::commandExecutionRequested,
|
||||
paramWidget, &VcsBaseEditorConfig::executeCommand);
|
||||
connect(paramWidget, &VcsBaseEditorConfig::commandExecutionRequested,
|
||||
[=] { diff(workingDir, files, extraOptions + paramWidget->arguments()); } );
|
||||
effectiveArgs = paramWidget->arguments();
|
||||
editor->setConfigurationAdded();
|
||||
@@ -462,9 +462,9 @@ void VcsBaseClient::log(const QString &workingDir, const QStringList &files,
|
||||
|
||||
QStringList effectiveArgs = extraOptions;
|
||||
if (!editor->configurationAdded()) {
|
||||
if (VcsBaseEditorParameterWidget *paramWidget = d->createLogEditor(editor)) {
|
||||
if (VcsBaseEditorConfig *paramWidget = d->createLogEditor(editor)) {
|
||||
// editor has been just created, createVcsEditor() didn't set a configuration widget yet
|
||||
connect(paramWidget, &VcsBaseEditorParameterWidget::commandExecutionRequested,
|
||||
connect(paramWidget, &VcsBaseEditorConfig::commandExecutionRequested,
|
||||
[=]() { this->log(workingDir, files, extraOptions + paramWidget->arguments(),
|
||||
enableAnnotationContextMenu); } );
|
||||
effectiveArgs = paramWidget->arguments();
|
||||
@@ -553,14 +553,14 @@ Utils::ExitCodeInterpreter VcsBaseClient::exitCodeInterpreter(VcsCommandTag cmd)
|
||||
return Utils::defaultExitCodeInterpreter;
|
||||
}
|
||||
|
||||
void VcsBaseClient::setDiffParameterWidgetCreator(ParameterWidgetCreator creator)
|
||||
void VcsBaseClient::setDiffConfigCreator(ConfigCreator creator)
|
||||
{
|
||||
d->m_diffParamWidgetCreator = std::move(creator);
|
||||
d->m_diffConfigCreator = std::move(creator);
|
||||
}
|
||||
|
||||
void VcsBaseClient::setLogParameterWidgetCreator(ParameterWidgetCreator creator)
|
||||
void VcsBaseClient::setLogConfigCreator(ConfigCreator creator)
|
||||
{
|
||||
d->m_logParamWidgetCreator = std::move(creator);
|
||||
d->m_logConfigCreator = std::move(creator);
|
||||
}
|
||||
|
||||
void VcsBaseClient::import(const QString &repositoryRoot, const QStringList &files,
|
||||
|
||||
@@ -52,7 +52,7 @@ class VcsBaseClientSettings;
|
||||
class VcsJob;
|
||||
class VcsBaseClientImplPrivate;
|
||||
class VcsBaseClientPrivate;
|
||||
class VcsBaseEditorParameterWidget;
|
||||
class VcsBaseEditorConfig;
|
||||
|
||||
class VCSBASE_EXPORT VcsBaseClientImpl : public QObject
|
||||
{
|
||||
@@ -224,9 +224,9 @@ protected:
|
||||
|
||||
virtual QStringList revisionSpec(const QString &revision) const = 0;
|
||||
|
||||
typedef std::function<VcsBaseEditorParameterWidget *(QToolBar *)> ParameterWidgetCreator;
|
||||
void setDiffParameterWidgetCreator(ParameterWidgetCreator creator);
|
||||
void setLogParameterWidgetCreator(ParameterWidgetCreator creator);
|
||||
typedef std::function<VcsBaseEditorConfig *(QToolBar *)> ConfigCreator;
|
||||
void setDiffConfigCreator(ConfigCreator creator);
|
||||
void setLogConfigCreator(ConfigCreator creator);
|
||||
|
||||
virtual StatusItem parseStatusLine(const QString &line) const = 0;
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include "baseannotationhighlighter.h"
|
||||
#include "basevcseditorfactory.h"
|
||||
#include "vcsbaseplugin.h"
|
||||
#include "vcsbaseeditorparameterwidget.h"
|
||||
#include "vcsbaseeditorconfig.h"
|
||||
#include "vcscommand.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
@@ -46,7 +46,7 @@ class VcsBaseEditorWidgetPrivate;
|
||||
|
||||
class BaseAnnotationHighlighter;
|
||||
class VcsBaseEditorWidget;
|
||||
class VcsBaseEditorParameterWidget;
|
||||
class VcsBaseEditorConfig;
|
||||
class VcsCommand;
|
||||
|
||||
// Documentation inside
|
||||
|
||||
+35
-36
@@ -23,7 +23,7 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "vcsbaseeditorparameterwidget.h"
|
||||
#include "vcsbaseeditorconfig.h"
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QAction>
|
||||
@@ -74,10 +74,10 @@ private:
|
||||
Type m_type;
|
||||
};
|
||||
|
||||
class VcsBaseEditorParameterWidgetPrivate
|
||||
class VcsBaseEditorConfigPrivate
|
||||
{
|
||||
public:
|
||||
VcsBaseEditorParameterWidgetPrivate(QToolBar *toolBar) : m_toolBar(toolBar)
|
||||
VcsBaseEditorConfigPrivate(QToolBar *toolBar) : m_toolBar(toolBar)
|
||||
{
|
||||
if (!toolBar)
|
||||
return;
|
||||
@@ -86,7 +86,7 @@ public:
|
||||
}
|
||||
|
||||
QStringList m_baseArguments;
|
||||
QList<VcsBaseEditorParameterWidget::OptionMapping> m_optionMappings;
|
||||
QList<VcsBaseEditorConfig::OptionMapping> m_optionMappings;
|
||||
QHash<QObject *, SettingMappingData> m_settingMapping;
|
||||
QToolBar *m_toolBar;
|
||||
};
|
||||
@@ -94,9 +94,9 @@ public:
|
||||
} // namespace Internal
|
||||
|
||||
/*!
|
||||
\class VcsBase::VcsBaseEditorParameterWidget
|
||||
\class VcsBase::VcsBaseEditorConfig
|
||||
|
||||
\brief The VcsBaseEditorParameterWidget is a widget/action aggregator for use
|
||||
\brief The VcsBaseEditorConfig is a widget/action aggregator for use
|
||||
with VcsBase::VcsBaseEditor, influencing for example the generation of VCS diff output.
|
||||
|
||||
The class maintains a list of command line arguments (starting from baseArguments())
|
||||
@@ -104,36 +104,35 @@ public:
|
||||
that should trigger the rerun of the VCS operation.
|
||||
*/
|
||||
|
||||
VcsBaseEditorParameterWidget::ComboBoxItem::ComboBoxItem(const QString &text,
|
||||
const QVariant &val) :
|
||||
VcsBaseEditorConfig::ComboBoxItem::ComboBoxItem(const QString &text, const QVariant &val) :
|
||||
displayText(text),
|
||||
value(val)
|
||||
{
|
||||
}
|
||||
|
||||
VcsBaseEditorParameterWidget::VcsBaseEditorParameterWidget(QToolBar *toolBar) :
|
||||
QObject(toolBar), d(new Internal::VcsBaseEditorParameterWidgetPrivate(toolBar))
|
||||
VcsBaseEditorConfig::VcsBaseEditorConfig(QToolBar *toolBar) :
|
||||
QObject(toolBar), d(new Internal::VcsBaseEditorConfigPrivate(toolBar))
|
||||
{
|
||||
connect(this, &VcsBaseEditorParameterWidget::argumentsChanged,
|
||||
this, &VcsBaseEditorParameterWidget::handleArgumentsChanged);
|
||||
connect(this, &VcsBaseEditorConfig::argumentsChanged,
|
||||
this, &VcsBaseEditorConfig::handleArgumentsChanged);
|
||||
}
|
||||
|
||||
VcsBaseEditorParameterWidget::~VcsBaseEditorParameterWidget()
|
||||
VcsBaseEditorConfig::~VcsBaseEditorConfig()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
QStringList VcsBaseEditorParameterWidget::baseArguments() const
|
||||
QStringList VcsBaseEditorConfig::baseArguments() const
|
||||
{
|
||||
return d->m_baseArguments;
|
||||
}
|
||||
|
||||
void VcsBaseEditorParameterWidget::setBaseArguments(const QStringList &b)
|
||||
void VcsBaseEditorConfig::setBaseArguments(const QStringList &b)
|
||||
{
|
||||
d->m_baseArguments = b;
|
||||
}
|
||||
|
||||
QStringList VcsBaseEditorParameterWidget::arguments() const
|
||||
QStringList VcsBaseEditorConfig::arguments() const
|
||||
{
|
||||
// Compile effective arguments
|
||||
QStringList args = baseArguments();
|
||||
@@ -142,21 +141,21 @@ QStringList VcsBaseEditorParameterWidget::arguments() const
|
||||
return args;
|
||||
}
|
||||
|
||||
QAction *VcsBaseEditorParameterWidget::addToggleButton(const QString &option,
|
||||
const QString &label,
|
||||
const QString &tooltip)
|
||||
QAction *VcsBaseEditorConfig::addToggleButton(const QString &option,
|
||||
const QString &label,
|
||||
const QString &tooltip)
|
||||
{
|
||||
return addToggleButton(option.isEmpty() ? QStringList() : QStringList(option), label, tooltip);
|
||||
}
|
||||
|
||||
QAction *VcsBaseEditorParameterWidget::addToggleButton(const QStringList &options,
|
||||
const QString &label,
|
||||
const QString &tooltip)
|
||||
QAction *VcsBaseEditorConfig::addToggleButton(const QStringList &options,
|
||||
const QString &label,
|
||||
const QString &tooltip)
|
||||
{
|
||||
auto action = new QAction(label, d->m_toolBar);
|
||||
action->setToolTip(tooltip);
|
||||
action->setCheckable(true);
|
||||
connect(action, &QAction::toggled, this, &VcsBaseEditorParameterWidget::argumentsChanged);
|
||||
connect(action, &QAction::toggled, this, &VcsBaseEditorConfig::argumentsChanged);
|
||||
const QList<QAction *> actions = d->m_toolBar->actions();
|
||||
// Insert the action before line/column and split actions.
|
||||
d->m_toolBar->insertAction(actions.at(qMax(actions.count() - 2, 0)), action);
|
||||
@@ -164,20 +163,20 @@ QAction *VcsBaseEditorParameterWidget::addToggleButton(const QStringList &option
|
||||
return action;
|
||||
}
|
||||
|
||||
QComboBox *VcsBaseEditorParameterWidget::addComboBox(const QStringList &options,
|
||||
const QList<ComboBoxItem> &items)
|
||||
QComboBox *VcsBaseEditorConfig::addComboBox(const QStringList &options,
|
||||
const QList<ComboBoxItem> &items)
|
||||
{
|
||||
auto cb = new QComboBox;
|
||||
foreach (const ComboBoxItem &item, items)
|
||||
cb->addItem(item.displayText, item.value);
|
||||
connect(cb, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
this, &VcsBaseEditorParameterWidget::argumentsChanged);
|
||||
this, &VcsBaseEditorConfig::argumentsChanged);
|
||||
d->m_toolBar->addWidget(cb);
|
||||
d->m_optionMappings.append(OptionMapping(options, cb));
|
||||
return cb;
|
||||
}
|
||||
|
||||
void VcsBaseEditorParameterWidget::mapSetting(QAction *button, bool *setting)
|
||||
void VcsBaseEditorConfig::mapSetting(QAction *button, bool *setting)
|
||||
{
|
||||
if (!d->m_settingMapping.contains(button) && button) {
|
||||
d->m_settingMapping.insert(button, Internal::SettingMappingData(setting));
|
||||
@@ -189,7 +188,7 @@ void VcsBaseEditorParameterWidget::mapSetting(QAction *button, bool *setting)
|
||||
}
|
||||
}
|
||||
|
||||
void VcsBaseEditorParameterWidget::mapSetting(QComboBox *comboBox, QString *setting)
|
||||
void VcsBaseEditorConfig::mapSetting(QComboBox *comboBox, QString *setting)
|
||||
{
|
||||
if (!d->m_settingMapping.contains(comboBox) && comboBox) {
|
||||
d->m_settingMapping.insert(comboBox, Internal::SettingMappingData(setting));
|
||||
@@ -203,7 +202,7 @@ void VcsBaseEditorParameterWidget::mapSetting(QComboBox *comboBox, QString *sett
|
||||
}
|
||||
}
|
||||
|
||||
void VcsBaseEditorParameterWidget::mapSetting(QComboBox *comboBox, int *setting)
|
||||
void VcsBaseEditorConfig::mapSetting(QComboBox *comboBox, int *setting)
|
||||
{
|
||||
if (d->m_settingMapping.contains(comboBox) || !comboBox)
|
||||
return;
|
||||
@@ -218,36 +217,36 @@ void VcsBaseEditorParameterWidget::mapSetting(QComboBox *comboBox, int *setting)
|
||||
comboBox->blockSignals(false);
|
||||
}
|
||||
|
||||
void VcsBaseEditorParameterWidget::handleArgumentsChanged()
|
||||
void VcsBaseEditorConfig::handleArgumentsChanged()
|
||||
{
|
||||
updateMappedSettings();
|
||||
executeCommand();
|
||||
}
|
||||
|
||||
void VcsBaseEditorParameterWidget::executeCommand()
|
||||
void VcsBaseEditorConfig::executeCommand()
|
||||
{
|
||||
emit commandExecutionRequested();
|
||||
}
|
||||
|
||||
VcsBaseEditorParameterWidget::OptionMapping::OptionMapping(const QString &option, QObject *obj) :
|
||||
VcsBaseEditorConfig::OptionMapping::OptionMapping(const QString &option, QObject *obj) :
|
||||
object(obj)
|
||||
{
|
||||
if (!option.isEmpty())
|
||||
options << option;
|
||||
}
|
||||
|
||||
VcsBaseEditorParameterWidget::OptionMapping::OptionMapping(const QStringList &optionList, QObject *obj) :
|
||||
VcsBaseEditorConfig::OptionMapping::OptionMapping(const QStringList &optionList, QObject *obj) :
|
||||
options(optionList),
|
||||
object(obj)
|
||||
{
|
||||
}
|
||||
|
||||
const QList<VcsBaseEditorParameterWidget::OptionMapping> &VcsBaseEditorParameterWidget::optionMappings() const
|
||||
const QList<VcsBaseEditorConfig::OptionMapping> &VcsBaseEditorConfig::optionMappings() const
|
||||
{
|
||||
return d->m_optionMappings;
|
||||
}
|
||||
|
||||
QStringList VcsBaseEditorParameterWidget::argumentsForOption(const OptionMapping &mapping) const
|
||||
QStringList VcsBaseEditorConfig::argumentsForOption(const OptionMapping &mapping) const
|
||||
{
|
||||
const QAction *action = qobject_cast<const QAction *>(mapping.object);
|
||||
if (action && action->isChecked())
|
||||
@@ -265,7 +264,7 @@ QStringList VcsBaseEditorParameterWidget::argumentsForOption(const OptionMapping
|
||||
return QStringList();
|
||||
}
|
||||
|
||||
void VcsBaseEditorParameterWidget::updateMappedSettings()
|
||||
void VcsBaseEditorConfig::updateMappedSettings()
|
||||
{
|
||||
foreach (const OptionMapping &optMapping, d->m_optionMappings) {
|
||||
if (d->m_settingMapping.contains(optMapping.object)) {
|
||||
+6
-6
@@ -40,16 +40,16 @@ namespace VcsBase {
|
||||
|
||||
class VcsBaseEditorWidget;
|
||||
|
||||
namespace Internal { class VcsBaseEditorParameterWidgetPrivate; }
|
||||
namespace Internal { class VcsBaseEditorConfigPrivate; }
|
||||
|
||||
// Documentation->inside.
|
||||
class VCSBASE_EXPORT VcsBaseEditorParameterWidget : public QObject
|
||||
class VCSBASE_EXPORT VcsBaseEditorConfig : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit VcsBaseEditorParameterWidget(QToolBar *toolBar);
|
||||
~VcsBaseEditorParameterWidget() override;
|
||||
explicit VcsBaseEditorConfig(QToolBar *toolBar);
|
||||
~VcsBaseEditorConfig() override;
|
||||
|
||||
class VCSBASE_EXPORT ComboBoxItem
|
||||
{
|
||||
@@ -102,8 +102,8 @@ protected:
|
||||
void updateMappedSettings();
|
||||
|
||||
private:
|
||||
friend class Internal::VcsBaseEditorParameterWidgetPrivate;
|
||||
Internal::VcsBaseEditorParameterWidgetPrivate *const d;
|
||||
friend class Internal::VcsBaseEditorConfigPrivate;
|
||||
Internal::VcsBaseEditorConfigPrivate *const d;
|
||||
};
|
||||
|
||||
} // namespace VcsBase
|
||||
Reference in New Issue
Block a user