forked from qt-creator/qt-creator
VCS: Replace QToolButtons in VCS toolbar with QActions
Change VcsBaseEditorParameterWidget to add actions/widgets to an existing toolbar, instead of being a widget itself. The class is renamed in a follow-up commit. Task-number: QTCREATORBUG-14934 Change-Id: I473a439d12a096f4cbb64f06faa0598ee72000de 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
6cd68d5401
commit
2c6adc1e74
@@ -50,8 +50,8 @@ class BazaarDiffParameterWidget : public VcsBaseEditorParameterWidget
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
BazaarDiffParameterWidget(VcsBaseClientSettings &settings, QWidget *parent = 0) :
|
BazaarDiffParameterWidget(VcsBaseClientSettings &settings, QToolBar *toolBar) :
|
||||||
VcsBaseEditorParameterWidget(parent)
|
VcsBaseEditorParameterWidget(toolBar)
|
||||||
{
|
{
|
||||||
mapSetting(addToggleButton(QLatin1String("-w"), tr("Ignore Whitespace")),
|
mapSetting(addToggleButton(QLatin1String("-w"), tr("Ignore Whitespace")),
|
||||||
settings.boolPointer(BazaarSettings::diffIgnoreWhiteSpaceKey));
|
settings.boolPointer(BazaarSettings::diffIgnoreWhiteSpaceKey));
|
||||||
@@ -77,8 +77,8 @@ class BazaarLogParameterWidget : public VcsBaseEditorParameterWidget
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
BazaarLogParameterWidget(VcsBaseClientSettings &settings, QWidget *parent = 0) :
|
BazaarLogParameterWidget(VcsBaseClientSettings &settings, QToolBar *toolBar) :
|
||||||
VcsBaseEditorParameterWidget(parent)
|
VcsBaseEditorParameterWidget(toolBar)
|
||||||
{
|
{
|
||||||
mapSetting(addToggleButton(QLatin1String("--verbose"), tr("Verbose"),
|
mapSetting(addToggleButton(QLatin1String("--verbose"), tr("Verbose"),
|
||||||
tr("Show files changed in each revision.")),
|
tr("Show files changed in each revision.")),
|
||||||
@@ -102,8 +102,12 @@ public:
|
|||||||
|
|
||||||
BazaarClient::BazaarClient() : VcsBaseClient(new BazaarSettings)
|
BazaarClient::BazaarClient() : VcsBaseClient(new BazaarSettings)
|
||||||
{
|
{
|
||||||
setDiffParameterWidgetCreator([this] { return new BazaarDiffParameterWidget(settings()); });
|
setDiffParameterWidgetCreator([this](QToolBar *toolBar) {
|
||||||
setLogParameterWidgetCreator([this] { return new BazaarLogParameterWidget(settings()); });
|
return new BazaarDiffParameterWidget(settings(), toolBar);
|
||||||
|
});
|
||||||
|
setLogParameterWidgetCreator([this](QToolBar *toolBar) {
|
||||||
|
return new BazaarLogParameterWidget(settings(), toolBar);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BazaarClient::synchronousSetUserId()
|
bool BazaarClient::synchronousSetUserId()
|
||||||
|
@@ -47,16 +47,15 @@ class CvsDiffParameterWidget : public VcsBaseEditorParameterWidget
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit CvsDiffParameterWidget(VcsBaseClientSettings &settings, QWidget *parent = 0);
|
CvsDiffParameterWidget(VcsBaseClientSettings &settings, QToolBar *toolBar);
|
||||||
QStringList arguments() const;
|
QStringList arguments() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VcsBaseClientSettings &m_settings;
|
VcsBaseClientSettings &m_settings;
|
||||||
};
|
};
|
||||||
|
|
||||||
CvsDiffParameterWidget::CvsDiffParameterWidget(VcsBaseClientSettings &settings,
|
CvsDiffParameterWidget::CvsDiffParameterWidget(VcsBaseClientSettings &settings, QToolBar *toolBar) :
|
||||||
QWidget *parent) :
|
VcsBaseEditorParameterWidget(toolBar),
|
||||||
VcsBaseEditorParameterWidget(parent),
|
|
||||||
m_settings(settings)
|
m_settings(settings)
|
||||||
{
|
{
|
||||||
mapSetting(addToggleButton(QLatin1String("-w"), tr("Ignore Whitespace")),
|
mapSetting(addToggleButton(QLatin1String("-w"), tr("Ignore Whitespace")),
|
||||||
@@ -76,7 +75,9 @@ QStringList CvsDiffParameterWidget::arguments() const
|
|||||||
|
|
||||||
CvsClient::CvsClient() : VcsBaseClient(new CvsSettings)
|
CvsClient::CvsClient() : VcsBaseClient(new CvsSettings)
|
||||||
{
|
{
|
||||||
setDiffParameterWidgetCreator([this] { return new CvsDiffParameterWidget(settings()); });
|
setDiffParameterWidgetCreator([this](QToolBar *toolBar) {
|
||||||
|
return new CvsDiffParameterWidget(settings(), toolBar);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
CvsSettings &CvsClient::settings() const
|
CvsSettings &CvsClient::settings() const
|
||||||
|
@@ -394,8 +394,8 @@ class BaseGitDiffArgumentsWidget : public VcsBaseEditorParameterWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BaseGitDiffArgumentsWidget(VcsBaseClientSettings &settings, QWidget *parent = nullptr) :
|
BaseGitDiffArgumentsWidget(VcsBaseClientSettings &settings, QToolBar *toolBar) :
|
||||||
VcsBaseEditorParameterWidget(parent)
|
VcsBaseEditorParameterWidget(toolBar)
|
||||||
{
|
{
|
||||||
m_patienceButton
|
m_patienceButton
|
||||||
= addToggleButton("--patience", tr("Patience"),
|
= addToggleButton("--patience", tr("Patience"),
|
||||||
@@ -408,8 +408,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QToolButton *m_patienceButton;
|
QAction *m_patienceButton;
|
||||||
QToolButton *m_ignoreWSButton;
|
QAction *m_ignoreWSButton;
|
||||||
};
|
};
|
||||||
|
|
||||||
class GitBlameArgumentsWidget : public VcsBaseEditorParameterWidget
|
class GitBlameArgumentsWidget : public VcsBaseEditorParameterWidget
|
||||||
@@ -417,8 +417,8 @@ class GitBlameArgumentsWidget : public VcsBaseEditorParameterWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GitBlameArgumentsWidget(VcsBaseClientSettings &settings, QWidget *parent = nullptr) :
|
GitBlameArgumentsWidget(VcsBaseClientSettings &settings, QToolBar *toolBar) :
|
||||||
VcsBaseEditorParameterWidget(parent)
|
VcsBaseEditorParameterWidget(toolBar)
|
||||||
{
|
{
|
||||||
mapSetting(addToggleButton(QString(), tr("Omit Date"),
|
mapSetting(addToggleButton(QString(), tr("Omit Date"),
|
||||||
tr("Hide the date of a change from the output.")),
|
tr("Hide the date of a change from the output.")),
|
||||||
@@ -434,21 +434,21 @@ class GitLogArgumentsWidget : public BaseGitDiffArgumentsWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GitLogArgumentsWidget(VcsBaseClientSettings &settings, QWidget *parent = nullptr) :
|
GitLogArgumentsWidget(VcsBaseClientSettings &settings, QToolBar *toolBar = nullptr) :
|
||||||
BaseGitDiffArgumentsWidget(settings, parent)
|
BaseGitDiffArgumentsWidget(settings, toolBar)
|
||||||
{
|
{
|
||||||
QToolButton *diffButton = addToggleButton("--patch", tr("Show Diff"),
|
QAction *diffButton = addToggleButton("--patch", tr("Show Diff"),
|
||||||
tr("Show difference."));
|
tr("Show difference."));
|
||||||
mapSetting(diffButton, settings.boolPointer(GitSettings::logDiffKey));
|
mapSetting(diffButton, settings.boolPointer(GitSettings::logDiffKey));
|
||||||
connect(diffButton, &QToolButton::toggled, m_patienceButton, &QToolButton::setVisible);
|
connect(diffButton, &QAction::toggled, m_patienceButton, &QAction::setVisible);
|
||||||
connect(diffButton, &QToolButton::toggled, m_ignoreWSButton, &QToolButton::setVisible);
|
connect(diffButton, &QAction::toggled, m_ignoreWSButton, &QAction::setVisible);
|
||||||
m_patienceButton->setVisible(diffButton->isChecked());
|
m_patienceButton->setVisible(diffButton->isChecked());
|
||||||
m_ignoreWSButton->setVisible(diffButton->isChecked());
|
m_ignoreWSButton->setVisible(diffButton->isChecked());
|
||||||
const QStringList graphArguments = {
|
const QStringList graphArguments = {
|
||||||
"--graph", "--oneline", "--topo-order",
|
"--graph", "--oneline", "--topo-order",
|
||||||
QLatin1String("--pretty=format:") + graphLogFormatC
|
QLatin1String("--pretty=format:") + graphLogFormatC
|
||||||
};
|
};
|
||||||
QToolButton *graphButton = addToggleButton(graphArguments, tr("Graph"),
|
QAction *graphButton = addToggleButton(graphArguments, tr("Graph"),
|
||||||
tr("Show textual graph log."));
|
tr("Show textual graph log."));
|
||||||
mapSetting(graphButton, settings.boolPointer(GitSettings::graphLogKey));
|
mapSetting(graphButton, settings.boolPointer(GitSettings::graphLogKey));
|
||||||
}
|
}
|
||||||
@@ -813,7 +813,7 @@ void GitClient::log(const QString &workingDirectory, const QString &fileName,
|
|||||||
QString msgArg;
|
QString msgArg;
|
||||||
if (!fileName.isEmpty())
|
if (!fileName.isEmpty())
|
||||||
msgArg = fileName;
|
msgArg = fileName;
|
||||||
else if (!args.isEmpty())
|
else if (!args.isEmpty() && !args.first().startsWith('-'))
|
||||||
msgArg = args.first();
|
msgArg = args.first();
|
||||||
else
|
else
|
||||||
msgArg = workingDirectory;
|
msgArg = workingDirectory;
|
||||||
@@ -824,11 +824,14 @@ void GitClient::log(const QString &workingDirectory, const QString &fileName,
|
|||||||
const QString sourceFile = VcsBaseEditor::getSource(workingDir, fileName);
|
const QString sourceFile = VcsBaseEditor::getSource(workingDir, fileName);
|
||||||
VcsBaseEditorWidget *editor = createVcsEditor(editorId, title, sourceFile,
|
VcsBaseEditorWidget *editor = createVcsEditor(editorId, title, sourceFile,
|
||||||
codecFor(CodecLogOutput), "logTitle", msgArg);
|
codecFor(CodecLogOutput), "logTitle", msgArg);
|
||||||
if (!editor->configurationWidget()) {
|
QStringList effectiveArgs = args;
|
||||||
auto *argWidget = new GitLogArgumentsWidget(settings());
|
if (!editor->configurationAdded()) {
|
||||||
|
auto *argWidget = new GitLogArgumentsWidget(settings(), editor->toolBar());
|
||||||
|
argWidget->setBaseArguments(args);
|
||||||
connect(argWidget, &VcsBaseEditorParameterWidget::commandExecutionRequested,
|
connect(argWidget, &VcsBaseEditorParameterWidget::commandExecutionRequested,
|
||||||
[=]() { this->log(workingDir, fileName, enableAnnotationContextMenu, args); });
|
[=]() { this->log(workingDir, fileName, enableAnnotationContextMenu, argWidget->arguments()); });
|
||||||
editor->setConfigurationWidget(argWidget);
|
effectiveArgs = argWidget->arguments();
|
||||||
|
editor->setConfigurationAdded();
|
||||||
}
|
}
|
||||||
editor->setFileLogAnnotateEnabled(enableAnnotationContextMenu);
|
editor->setFileLogAnnotateEnabled(enableAnnotationContextMenu);
|
||||||
editor->setWorkingDirectory(workingDir);
|
editor->setWorkingDirectory(workingDir);
|
||||||
@@ -838,11 +841,7 @@ void GitClient::log(const QString &workingDirectory, const QString &fileName,
|
|||||||
if (logCount > 0)
|
if (logCount > 0)
|
||||||
arguments << "-n" << QString::number(logCount);
|
arguments << "-n" << QString::number(logCount);
|
||||||
|
|
||||||
auto *argWidget = editor->configurationWidget();
|
arguments.append(effectiveArgs);
|
||||||
argWidget->setBaseArguments(args);
|
|
||||||
QStringList userArgs = argWidget->arguments();
|
|
||||||
|
|
||||||
arguments.append(userArgs);
|
|
||||||
|
|
||||||
if (!fileName.isEmpty())
|
if (!fileName.isEmpty())
|
||||||
arguments << "--follow" << "--" << fileName;
|
arguments << "--follow" << "--" << fileName;
|
||||||
@@ -911,21 +910,22 @@ VcsBaseEditorWidget *GitClient::annotate(
|
|||||||
VcsBaseEditorWidget *editor
|
VcsBaseEditorWidget *editor
|
||||||
= createVcsEditor(editorId, title, sourceFile, codecFor(CodecSource, sourceFile),
|
= createVcsEditor(editorId, title, sourceFile, codecFor(CodecSource, sourceFile),
|
||||||
"blameFileName", id);
|
"blameFileName", id);
|
||||||
if (!editor->configurationWidget()) {
|
QStringList effectiveArgs = extraOptions;
|
||||||
auto *argWidget = new GitBlameArgumentsWidget(settings());
|
if (!editor->configurationAdded()) {
|
||||||
|
auto *argWidget = new GitBlameArgumentsWidget(settings(), editor->toolBar());
|
||||||
argWidget->setBaseArguments(extraOptions);
|
argWidget->setBaseArguments(extraOptions);
|
||||||
connect(argWidget, &VcsBaseEditorParameterWidget::commandExecutionRequested,
|
connect(argWidget, &VcsBaseEditorParameterWidget::commandExecutionRequested,
|
||||||
[=] {
|
[=] {
|
||||||
const int line = VcsBaseEditor::lineNumberOfCurrentEditor();
|
const int line = VcsBaseEditor::lineNumberOfCurrentEditor();
|
||||||
annotate(workingDir, file, revision, line, extraOptions);
|
annotate(workingDir, file, revision, line, argWidget->arguments());
|
||||||
} );
|
} );
|
||||||
editor->setConfigurationWidget(argWidget);
|
effectiveArgs = argWidget->arguments();
|
||||||
|
editor->setConfigurationAdded();
|
||||||
}
|
}
|
||||||
|
|
||||||
editor->setWorkingDirectory(workingDir);
|
editor->setWorkingDirectory(workingDir);
|
||||||
QStringList arguments = { "blame", "--root" };
|
QStringList arguments = { "blame", "--root" };
|
||||||
arguments << editor->configurationWidget()->arguments();
|
arguments << effectiveArgs << "--" << file;
|
||||||
arguments << "--" << file;
|
|
||||||
if (!revision.isEmpty())
|
if (!revision.isEmpty())
|
||||||
arguments << revision;
|
arguments << revision;
|
||||||
vcsExec(workingDir, arguments, editor, false, 0, lineNumber);
|
vcsExec(workingDir, arguments, editor, false, 0, lineNumber);
|
||||||
|
@@ -54,8 +54,8 @@ class MercurialDiffParameterWidget : public VcsBaseEditorParameterWidget
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
MercurialDiffParameterWidget(VcsBaseClientSettings &settings, QWidget *parent = 0) :
|
MercurialDiffParameterWidget(VcsBaseClientSettings &settings, QToolBar *toolBar) :
|
||||||
VcsBaseEditorParameterWidget(parent)
|
VcsBaseEditorParameterWidget(toolBar)
|
||||||
{
|
{
|
||||||
mapSetting(addToggleButton(QLatin1String("-w"), tr("Ignore Whitespace")),
|
mapSetting(addToggleButton(QLatin1String("-w"), tr("Ignore Whitespace")),
|
||||||
settings.boolPointer(MercurialSettings::diffIgnoreWhiteSpaceKey));
|
settings.boolPointer(MercurialSettings::diffIgnoreWhiteSpaceKey));
|
||||||
@@ -66,7 +66,9 @@ public:
|
|||||||
|
|
||||||
MercurialClient::MercurialClient() : VcsBaseClient(new MercurialSettings)
|
MercurialClient::MercurialClient() : VcsBaseClient(new MercurialSettings)
|
||||||
{
|
{
|
||||||
setDiffParameterWidgetCreator([this] { return new MercurialDiffParameterWidget(settings()); });
|
setDiffParameterWidgetCreator([this](QToolBar *toolBar) {
|
||||||
|
return new MercurialDiffParameterWidget(settings(), toolBar);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MercurialClient::manifestSync(const QString &repository, const QString &relativeFilename)
|
bool MercurialClient::manifestSync(const QString &repository, const QString &relativeFilename)
|
||||||
|
@@ -1199,7 +1199,7 @@ class PerforceDiffParameterWidget : public VcsBaseEditorParameterWidget
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit PerforceDiffParameterWidget(const PerforceDiffParameters &p, QWidget *parent = 0);
|
explicit PerforceDiffParameterWidget(const PerforceDiffParameters &p, QToolBar *toolBar);
|
||||||
void triggerReRun();
|
void triggerReRun();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@@ -1209,8 +1209,9 @@ private:
|
|||||||
const PerforceDiffParameters m_parameters;
|
const PerforceDiffParameters m_parameters;
|
||||||
};
|
};
|
||||||
|
|
||||||
PerforceDiffParameterWidget::PerforceDiffParameterWidget(const PerforceDiffParameters &p, QWidget *parent) :
|
PerforceDiffParameterWidget::PerforceDiffParameterWidget(const PerforceDiffParameters &p,
|
||||||
VcsBaseEditorParameterWidget(parent), m_parameters(p)
|
QToolBar *toolBar) :
|
||||||
|
VcsBaseEditorParameterWidget(toolBar), m_parameters(p)
|
||||||
{
|
{
|
||||||
setBaseArguments(p.diffArguments);
|
setBaseArguments(p.diffArguments);
|
||||||
addToggleButton(QLatin1String("w"), tr("Ignore Whitespace"));
|
addToggleButton(QLatin1String("w"), tr("Ignore Whitespace"));
|
||||||
@@ -1269,12 +1270,12 @@ void PerforcePlugin::p4Diff(const PerforceDiffParameters &p)
|
|||||||
auto diffEditorWidget = qobject_cast<VcsBaseEditorWidget *>(editor->widget());
|
auto diffEditorWidget = qobject_cast<VcsBaseEditorWidget *>(editor->widget());
|
||||||
// Wire up the parameter widget to trigger a re-run on
|
// Wire up the parameter widget to trigger a re-run on
|
||||||
// parameter change and 'revert' from inside the diff editor.
|
// parameter change and 'revert' from inside the diff editor.
|
||||||
auto pw = new PerforceDiffParameterWidget(p);
|
auto pw = new PerforceDiffParameterWidget(p, diffEditorWidget->toolBar());
|
||||||
connect(pw, &PerforceDiffParameterWidget::reRunDiff,
|
connect(pw, &PerforceDiffParameterWidget::reRunDiff,
|
||||||
this, [this](const PerforceDiffParameters &p) { p4Diff(p); });
|
this, [this](const PerforceDiffParameters &p) { p4Diff(p); });
|
||||||
connect(diffEditorWidget, &VcsBaseEditorWidget::diffChunkReverted,
|
connect(diffEditorWidget, &VcsBaseEditorWidget::diffChunkReverted,
|
||||||
pw, &PerforceDiffParameterWidget::triggerReRun);
|
pw, &PerforceDiffParameterWidget::triggerReRun);
|
||||||
diffEditorWidget->setConfigurationWidget(pw);
|
diffEditorWidget->setConfigurationAdded();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerforcePlugin::describe(const QString & source, const QString &n)
|
void PerforcePlugin::describe(const QString & source, const QString &n)
|
||||||
|
@@ -56,8 +56,8 @@ class SubversionLogParameterWidget : public VcsBaseEditorParameterWidget
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
SubversionLogParameterWidget(VcsBaseClientSettings &settings, QWidget *parent = 0) :
|
SubversionLogParameterWidget(VcsBaseClientSettings &settings, QToolBar *toolBar) :
|
||||||
VcsBaseEditorParameterWidget(parent)
|
VcsBaseEditorParameterWidget(toolBar)
|
||||||
{
|
{
|
||||||
mapSetting(addToggleButton(QLatin1String("--verbose"), tr("Verbose"),
|
mapSetting(addToggleButton(QLatin1String("--verbose"), tr("Verbose"),
|
||||||
tr("Show files changed in each revision")),
|
tr("Show files changed in each revision")),
|
||||||
@@ -67,7 +67,9 @@ public:
|
|||||||
|
|
||||||
SubversionClient::SubversionClient() : VcsBaseClient(new SubversionSettings)
|
SubversionClient::SubversionClient() : VcsBaseClient(new SubversionSettings)
|
||||||
{
|
{
|
||||||
setLogParameterWidgetCreator([this] { return new SubversionLogParameterWidget(settings()); });
|
setLogParameterWidgetCreator([this](QToolBar *toolBar) {
|
||||||
|
return new SubversionLogParameterWidget(settings(), toolBar);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
VcsCommand *SubversionClient::createCommitCmd(const QString &repositoryRoot,
|
VcsCommand *SubversionClient::createCommitCmd(const QString &repositoryRoot,
|
||||||
|
@@ -7269,6 +7269,11 @@ void TextEditorWidget::setCursorPosition(int pos)
|
|||||||
setTextCursor(tc);
|
setTextCursor(tc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QToolBar *TextEditorWidget::toolBar()
|
||||||
|
{
|
||||||
|
return d->m_toolBar;
|
||||||
|
}
|
||||||
|
|
||||||
void BaseTextEditor::select(int toPos)
|
void BaseTextEditor::select(int toPos)
|
||||||
{
|
{
|
||||||
editorWidget()->setBlockSelection(false);
|
editorWidget()->setBlockSelection(false);
|
||||||
|
@@ -190,6 +190,7 @@ public:
|
|||||||
using QPlainTextEdit::cursorRect;
|
using QPlainTextEdit::cursorRect;
|
||||||
QRect cursorRect(int pos) const;
|
QRect cursorRect(int pos) const;
|
||||||
void setCursorPosition(int pos);
|
void setCursorPosition(int pos);
|
||||||
|
QToolBar *toolBar();
|
||||||
|
|
||||||
void print(QPrinter *);
|
void print(QPrinter *);
|
||||||
|
|
||||||
|
@@ -270,21 +270,21 @@ void VcsBaseClientImpl::saveSettings()
|
|||||||
class VcsBaseClientPrivate
|
class VcsBaseClientPrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VcsBaseEditorParameterWidget *createDiffEditor();
|
VcsBaseEditorParameterWidget *createDiffEditor(VcsBaseEditorWidget *editor);
|
||||||
VcsBaseEditorParameterWidget *createLogEditor();
|
VcsBaseEditorParameterWidget *createLogEditor(VcsBaseEditorWidget *editor);
|
||||||
|
|
||||||
VcsBaseClient::ParameterWidgetCreator m_diffParamWidgetCreator;
|
VcsBaseClient::ParameterWidgetCreator m_diffParamWidgetCreator;
|
||||||
VcsBaseClient::ParameterWidgetCreator m_logParamWidgetCreator;
|
VcsBaseClient::ParameterWidgetCreator m_logParamWidgetCreator;
|
||||||
};
|
};
|
||||||
|
|
||||||
VcsBaseEditorParameterWidget *VcsBaseClientPrivate::createDiffEditor()
|
VcsBaseEditorParameterWidget *VcsBaseClientPrivate::createDiffEditor(VcsBaseEditorWidget *editor)
|
||||||
{
|
{
|
||||||
return m_diffParamWidgetCreator ? m_diffParamWidgetCreator() : 0;
|
return m_diffParamWidgetCreator ? m_diffParamWidgetCreator(editor->toolBar()) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
VcsBaseEditorParameterWidget *VcsBaseClientPrivate::createLogEditor()
|
VcsBaseEditorParameterWidget *VcsBaseClientPrivate::createLogEditor(VcsBaseEditorWidget *editor)
|
||||||
{
|
{
|
||||||
return m_logParamWidgetCreator ? m_logParamWidgetCreator() : 0;
|
return m_logParamWidgetCreator ? m_logParamWidgetCreator(editor->toolBar()) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
VcsBaseClient::StatusItem::StatusItem(const QString &s, const QString &f) :
|
VcsBaseClient::StatusItem::StatusItem(const QString &s, const QString &f) :
|
||||||
@@ -425,19 +425,21 @@ void VcsBaseClient::diff(const QString &workingDir, const QStringList &files,
|
|||||||
vcsCmdString.toLatin1().constData(), id);
|
vcsCmdString.toLatin1().constData(), id);
|
||||||
editor->setWorkingDirectory(workingDir);
|
editor->setWorkingDirectory(workingDir);
|
||||||
|
|
||||||
VcsBaseEditorParameterWidget *paramWidget = editor->configurationWidget();
|
QStringList effectiveArgs = extraOptions;
|
||||||
if (!paramWidget && (paramWidget = d->createDiffEditor())) {
|
if (!editor->configurationAdded()) {
|
||||||
|
if (VcsBaseEditorParameterWidget *paramWidget = d->createDiffEditor(editor)) {
|
||||||
// editor has been just created, createVcsEditor() didn't set a configuration widget yet
|
// editor has been just created, createVcsEditor() didn't set a configuration widget yet
|
||||||
connect(editor, &VcsBaseEditorWidget::diffChunkReverted,
|
connect(editor, &VcsBaseEditorWidget::diffChunkReverted,
|
||||||
paramWidget, &VcsBaseEditorParameterWidget::executeCommand);
|
paramWidget, &VcsBaseEditorParameterWidget::executeCommand);
|
||||||
connect(paramWidget, &VcsBaseEditorParameterWidget::commandExecutionRequested,
|
connect(paramWidget, &VcsBaseEditorParameterWidget::commandExecutionRequested,
|
||||||
[=] { diff(workingDir, files, extraOptions); } );
|
[=] { diff(workingDir, files, extraOptions + paramWidget->arguments()); } );
|
||||||
editor->setConfigurationWidget(paramWidget);
|
effectiveArgs = paramWidget->arguments();
|
||||||
|
editor->setConfigurationAdded();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList args;
|
QStringList args;
|
||||||
const QStringList paramArgs = paramWidget != 0 ? paramWidget->arguments() : QStringList();
|
args << vcsCmdString << effectiveArgs << files;
|
||||||
args << vcsCmdString << extraOptions << paramArgs << files;
|
|
||||||
QTextCodec *codec = source.isEmpty() ? static_cast<QTextCodec *>(0) : VcsBaseEditor::getCodec(source);
|
QTextCodec *codec = source.isEmpty() ? static_cast<QTextCodec *>(0) : VcsBaseEditor::getCodec(source);
|
||||||
VcsCommand *command = createCommand(workingDir, editor);
|
VcsCommand *command = createCommand(workingDir, editor);
|
||||||
command->setCodec(codec);
|
command->setCodec(codec);
|
||||||
@@ -458,17 +460,20 @@ void VcsBaseClient::log(const QString &workingDir, const QStringList &files,
|
|||||||
vcsCmdString.toLatin1().constData(), id);
|
vcsCmdString.toLatin1().constData(), id);
|
||||||
editor->setFileLogAnnotateEnabled(enableAnnotationContextMenu);
|
editor->setFileLogAnnotateEnabled(enableAnnotationContextMenu);
|
||||||
|
|
||||||
VcsBaseEditorParameterWidget *paramWidget = editor->configurationWidget();
|
QStringList effectiveArgs = extraOptions;
|
||||||
if (!paramWidget && (paramWidget = d->createLogEditor())) {
|
if (!editor->configurationAdded()) {
|
||||||
|
if (VcsBaseEditorParameterWidget *paramWidget = d->createLogEditor(editor)) {
|
||||||
// editor has been just created, createVcsEditor() didn't set a configuration widget yet
|
// editor has been just created, createVcsEditor() didn't set a configuration widget yet
|
||||||
connect(paramWidget, &VcsBaseEditorParameterWidget::commandExecutionRequested,
|
connect(paramWidget, &VcsBaseEditorParameterWidget::commandExecutionRequested,
|
||||||
[=]() { this->log(workingDir, files, extraOptions, enableAnnotationContextMenu); } );
|
[=]() { this->log(workingDir, files, extraOptions + paramWidget->arguments(),
|
||||||
editor->setConfigurationWidget(paramWidget);
|
enableAnnotationContextMenu); } );
|
||||||
|
effectiveArgs = paramWidget->arguments();
|
||||||
|
editor->setConfigurationAdded();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList args;
|
QStringList args;
|
||||||
const QStringList paramArgs = paramWidget != 0 ? paramWidget->arguments() : QStringList();
|
args << vcsCmdString << effectiveArgs << files;
|
||||||
args << vcsCmdString << extraOptions << paramArgs << files;
|
|
||||||
enqueueJob(createCommand(workingDir, editor), args);
|
enqueueJob(createCommand(workingDir, editor), args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -39,6 +39,7 @@
|
|||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QFileInfo;
|
class QFileInfo;
|
||||||
class QProcessEnvironment;
|
class QProcessEnvironment;
|
||||||
|
class QToolBar;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace Core { class Id; }
|
namespace Core { class Id; }
|
||||||
@@ -223,7 +224,7 @@ protected:
|
|||||||
|
|
||||||
virtual QStringList revisionSpec(const QString &revision) const = 0;
|
virtual QStringList revisionSpec(const QString &revision) const = 0;
|
||||||
|
|
||||||
typedef std::function<VcsBaseEditorParameterWidget *()> ParameterWidgetCreator;
|
typedef std::function<VcsBaseEditorParameterWidget *(QToolBar *)> ParameterWidgetCreator;
|
||||||
void setDiffParameterWidgetCreator(ParameterWidgetCreator creator);
|
void setDiffParameterWidgetCreator(ParameterWidgetCreator creator);
|
||||||
void setLogParameterWidgetCreator(ParameterWidgetCreator creator);
|
void setLogParameterWidgetCreator(ParameterWidgetCreator creator);
|
||||||
|
|
||||||
|
@@ -565,7 +565,7 @@ public:
|
|||||||
QString m_annotateRevisionTextFormat;
|
QString m_annotateRevisionTextFormat;
|
||||||
QString m_annotatePreviousRevisionTextFormat;
|
QString m_annotatePreviousRevisionTextFormat;
|
||||||
QString m_copyRevisionTextFormat;
|
QString m_copyRevisionTextFormat;
|
||||||
VcsBaseEditorParameterWidget *m_configurationWidget = nullptr;
|
bool m_configurationAdded = false;
|
||||||
QList<AbstractTextCursorHandler *> m_textCursorHandlers;
|
QList<AbstractTextCursorHandler *> m_textCursorHandlers;
|
||||||
QPointer<VcsCommand> m_command;
|
QPointer<VcsCommand> m_command;
|
||||||
QObject *m_describeReceiver = nullptr;
|
QObject *m_describeReceiver = nullptr;
|
||||||
@@ -1390,20 +1390,14 @@ QString VcsBaseEditor::getTitleId(const QString &workingDirectory,
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VcsBaseEditorWidget::setConfigurationWidget(VcsBaseEditorParameterWidget *w)
|
void VcsBaseEditorWidget::setConfigurationAdded()
|
||||||
{
|
{
|
||||||
if (d->m_configurationWidget)
|
d->m_configurationAdded = true;
|
||||||
return false;
|
|
||||||
|
|
||||||
d->m_configurationWidget = w;
|
|
||||||
insertExtraToolBarWidget(TextEditorWidget::Right, w);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VcsBaseEditorParameterWidget *VcsBaseEditorWidget::configurationWidget() const
|
bool VcsBaseEditorWidget::configurationAdded() const
|
||||||
{
|
{
|
||||||
return d->m_configurationWidget;
|
return d->m_configurationAdded;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VcsBaseEditorWidget::setCommand(VcsCommand *command)
|
void VcsBaseEditorWidget::setCommand(VcsCommand *command)
|
||||||
|
@@ -209,8 +209,8 @@ public:
|
|||||||
|
|
||||||
EditorContentType contentType() const;
|
EditorContentType contentType() const;
|
||||||
|
|
||||||
bool setConfigurationWidget(VcsBaseEditorParameterWidget *w);
|
void setConfigurationAdded();
|
||||||
VcsBaseEditorParameterWidget *configurationWidget() const;
|
bool configurationAdded() const;
|
||||||
|
|
||||||
void setCommand(VcsCommand *command);
|
void setCommand(VcsCommand *command);
|
||||||
|
|
||||||
|
@@ -26,7 +26,7 @@
|
|||||||
#include "vcsbaseeditorparameterwidget.h"
|
#include "vcsbaseeditorparameterwidget.h"
|
||||||
|
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QToolButton>
|
#include <QAction>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
|
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
@@ -77,14 +77,18 @@ private:
|
|||||||
class VcsBaseEditorParameterWidgetPrivate
|
class VcsBaseEditorParameterWidgetPrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VcsBaseEditorParameterWidgetPrivate() :
|
VcsBaseEditorParameterWidgetPrivate(QToolBar *toolBar) : m_toolBar(toolBar)
|
||||||
m_layout(0)
|
{
|
||||||
{ }
|
if (!toolBar)
|
||||||
|
return;
|
||||||
|
toolBar->setContentsMargins(3, 0, 3, 0);
|
||||||
|
toolBar->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
||||||
|
}
|
||||||
|
|
||||||
QStringList m_baseArguments;
|
QStringList m_baseArguments;
|
||||||
QHBoxLayout *m_layout;
|
|
||||||
QList<VcsBaseEditorParameterWidget::OptionMapping> m_optionMappings;
|
QList<VcsBaseEditorParameterWidget::OptionMapping> m_optionMappings;
|
||||||
QHash<QWidget*, SettingMappingData> m_settingMapping;
|
QHash<QObject *, SettingMappingData> m_settingMapping;
|
||||||
|
QToolBar *m_toolBar;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
@@ -92,11 +96,10 @@ public:
|
|||||||
/*!
|
/*!
|
||||||
\class VcsBase::VcsBaseEditorParameterWidget
|
\class VcsBase::VcsBaseEditorParameterWidget
|
||||||
|
|
||||||
\brief The VcsBaseEditorParameterWidget is a toolbar-like widget for use
|
\brief The VcsBaseEditorParameterWidget is a widget/action aggregator for use
|
||||||
with VcsBase::VcsBaseEditor::setConfigurationWidget()
|
with VcsBase::VcsBaseEditor, influencing for example the generation of VCS diff output.
|
||||||
influencing for example the generation of VCS diff output.
|
|
||||||
|
|
||||||
The widget maintains a list of command line arguments (starting from baseArguments())
|
The class maintains a list of command line arguments (starting from baseArguments())
|
||||||
which are set according to the state of the inside widgets. A change signal is provided
|
which are set according to the state of the inside widgets. A change signal is provided
|
||||||
that should trigger the rerun of the VCS operation.
|
that should trigger the rerun of the VCS operation.
|
||||||
*/
|
*/
|
||||||
@@ -108,12 +111,9 @@ VcsBaseEditorParameterWidget::ComboBoxItem::ComboBoxItem(const QString &text,
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
VcsBaseEditorParameterWidget::VcsBaseEditorParameterWidget(QWidget *parent) :
|
VcsBaseEditorParameterWidget::VcsBaseEditorParameterWidget(QToolBar *toolBar) :
|
||||||
QWidget(parent), d(new Internal::VcsBaseEditorParameterWidgetPrivate)
|
QObject(toolBar), d(new Internal::VcsBaseEditorParameterWidgetPrivate(toolBar))
|
||||||
{
|
{
|
||||||
d->m_layout = new QHBoxLayout(this);
|
|
||||||
d->m_layout->setContentsMargins(3, 0, 3, 0);
|
|
||||||
d->m_layout->setSpacing(2);
|
|
||||||
connect(this, &VcsBaseEditorParameterWidget::argumentsChanged,
|
connect(this, &VcsBaseEditorParameterWidget::argumentsChanged,
|
||||||
this, &VcsBaseEditorParameterWidget::handleArgumentsChanged);
|
this, &VcsBaseEditorParameterWidget::handleArgumentsChanged);
|
||||||
}
|
}
|
||||||
@@ -142,23 +142,26 @@ QStringList VcsBaseEditorParameterWidget::arguments() const
|
|||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
QToolButton *VcsBaseEditorParameterWidget::addToggleButton(const QString &option,
|
QAction *VcsBaseEditorParameterWidget::addToggleButton(const QString &option,
|
||||||
const QString &label,
|
const QString &label,
|
||||||
const QString &tooltip)
|
const QString &tooltip)
|
||||||
{
|
{
|
||||||
return addToggleButton(option.isEmpty() ? QStringList() : QStringList(option), label, tooltip);
|
return addToggleButton(option.isEmpty() ? QStringList() : QStringList(option), label, tooltip);
|
||||||
}
|
}
|
||||||
|
|
||||||
QToolButton *VcsBaseEditorParameterWidget::addToggleButton(const QStringList &options, const QString &label, const QString &tooltip)
|
QAction *VcsBaseEditorParameterWidget::addToggleButton(const QStringList &options,
|
||||||
|
const QString &label,
|
||||||
|
const QString &tooltip)
|
||||||
{
|
{
|
||||||
auto tb = new QToolButton;
|
auto action = new QAction(label, d->m_toolBar);
|
||||||
tb->setText(label);
|
action->setToolTip(tooltip);
|
||||||
tb->setToolTip(tooltip);
|
action->setCheckable(true);
|
||||||
tb->setCheckable(true);
|
connect(action, &QAction::toggled, this, &VcsBaseEditorParameterWidget::argumentsChanged);
|
||||||
connect(tb, &QToolButton::toggled, this, &VcsBaseEditorParameterWidget::argumentsChanged);
|
const QList<QAction *> actions = d->m_toolBar->actions();
|
||||||
d->m_layout->addWidget(tb);
|
// Insert the action before line/column and split actions.
|
||||||
d->m_optionMappings.append(OptionMapping(options, tb));
|
d->m_toolBar->insertAction(actions.at(qMax(actions.count() - 2, 0)), action);
|
||||||
return tb;
|
d->m_optionMappings.append(OptionMapping(options, action));
|
||||||
|
return action;
|
||||||
}
|
}
|
||||||
|
|
||||||
QComboBox *VcsBaseEditorParameterWidget::addComboBox(const QStringList &options,
|
QComboBox *VcsBaseEditorParameterWidget::addComboBox(const QStringList &options,
|
||||||
@@ -169,12 +172,12 @@ QComboBox *VcsBaseEditorParameterWidget::addComboBox(const QStringList &options,
|
|||||||
cb->addItem(item.displayText, item.value);
|
cb->addItem(item.displayText, item.value);
|
||||||
connect(cb, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
connect(cb, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||||
this, &VcsBaseEditorParameterWidget::argumentsChanged);
|
this, &VcsBaseEditorParameterWidget::argumentsChanged);
|
||||||
d->m_layout->addWidget(cb);
|
d->m_toolBar->addWidget(cb);
|
||||||
d->m_optionMappings.append(OptionMapping(options, cb));
|
d->m_optionMappings.append(OptionMapping(options, cb));
|
||||||
return cb;
|
return cb;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VcsBaseEditorParameterWidget::mapSetting(QToolButton *button, bool *setting)
|
void VcsBaseEditorParameterWidget::mapSetting(QAction *button, bool *setting)
|
||||||
{
|
{
|
||||||
if (!d->m_settingMapping.contains(button) && button) {
|
if (!d->m_settingMapping.contains(button) && button) {
|
||||||
d->m_settingMapping.insert(button, Internal::SettingMappingData(setting));
|
d->m_settingMapping.insert(button, Internal::SettingMappingData(setting));
|
||||||
@@ -226,16 +229,16 @@ void VcsBaseEditorParameterWidget::executeCommand()
|
|||||||
emit commandExecutionRequested();
|
emit commandExecutionRequested();
|
||||||
}
|
}
|
||||||
|
|
||||||
VcsBaseEditorParameterWidget::OptionMapping::OptionMapping(const QString &option, QWidget *w) :
|
VcsBaseEditorParameterWidget::OptionMapping::OptionMapping(const QString &option, QObject *obj) :
|
||||||
widget(w)
|
object(obj)
|
||||||
{
|
{
|
||||||
if (!option.isEmpty())
|
if (!option.isEmpty())
|
||||||
options << option;
|
options << option;
|
||||||
}
|
}
|
||||||
|
|
||||||
VcsBaseEditorParameterWidget::OptionMapping::OptionMapping(const QStringList &optionList, QWidget *w) :
|
VcsBaseEditorParameterWidget::OptionMapping::OptionMapping(const QStringList &optionList, QObject *obj) :
|
||||||
options(optionList),
|
options(optionList),
|
||||||
widget(w)
|
object(obj)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,11 +249,11 @@ const QList<VcsBaseEditorParameterWidget::OptionMapping> &VcsBaseEditorParameter
|
|||||||
|
|
||||||
QStringList VcsBaseEditorParameterWidget::argumentsForOption(const OptionMapping &mapping) const
|
QStringList VcsBaseEditorParameterWidget::argumentsForOption(const OptionMapping &mapping) const
|
||||||
{
|
{
|
||||||
const QToolButton *tb = qobject_cast<const QToolButton *>(mapping.widget);
|
const QAction *action = qobject_cast<const QAction *>(mapping.object);
|
||||||
if (tb && tb->isChecked())
|
if (action && action->isChecked())
|
||||||
return mapping.options;
|
return mapping.options;
|
||||||
|
|
||||||
const QComboBox *cb = qobject_cast<const QComboBox *>(mapping.widget);
|
const QComboBox *cb = qobject_cast<const QComboBox *>(mapping.object);
|
||||||
if (cb) {
|
if (cb) {
|
||||||
const QString value = cb->itemData(cb->currentIndex()).toString();
|
const QString value = cb->itemData(cb->currentIndex()).toString();
|
||||||
QStringList args;
|
QStringList args;
|
||||||
@@ -265,26 +268,25 @@ QStringList VcsBaseEditorParameterWidget::argumentsForOption(const OptionMapping
|
|||||||
void VcsBaseEditorParameterWidget::updateMappedSettings()
|
void VcsBaseEditorParameterWidget::updateMappedSettings()
|
||||||
{
|
{
|
||||||
foreach (const OptionMapping &optMapping, d->m_optionMappings) {
|
foreach (const OptionMapping &optMapping, d->m_optionMappings) {
|
||||||
if (d->m_settingMapping.contains(optMapping.widget)) {
|
if (d->m_settingMapping.contains(optMapping.object)) {
|
||||||
Internal::SettingMappingData& settingData = d->m_settingMapping[optMapping.widget];
|
Internal::SettingMappingData& settingData = d->m_settingMapping[optMapping.object];
|
||||||
switch (settingData.type()) {
|
switch (settingData.type()) {
|
||||||
case Internal::SettingMappingData::Bool :
|
case Internal::SettingMappingData::Bool :
|
||||||
{
|
{
|
||||||
const QToolButton *tb = qobject_cast<const QToolButton *>(optMapping.widget);
|
if (auto action = qobject_cast<const QAction *>(optMapping.object))
|
||||||
if (tb)
|
*settingData.boolSetting = action->isChecked();
|
||||||
*settingData.boolSetting = tb->isChecked();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Internal::SettingMappingData::String :
|
case Internal::SettingMappingData::String :
|
||||||
{
|
{
|
||||||
const QComboBox *cb = qobject_cast<const QComboBox *>(optMapping.widget);
|
const QComboBox *cb = qobject_cast<const QComboBox *>(optMapping.object);
|
||||||
if (cb && cb->currentIndex() != -1)
|
if (cb && cb->currentIndex() != -1)
|
||||||
*settingData.stringSetting = cb->itemData(cb->currentIndex()).toString();
|
*settingData.stringSetting = cb->itemData(cb->currentIndex()).toString();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Internal::SettingMappingData::Int:
|
case Internal::SettingMappingData::Int:
|
||||||
{
|
{
|
||||||
const QComboBox *cb = qobject_cast<const QComboBox *>(optMapping.widget);
|
const QComboBox *cb = qobject_cast<const QComboBox *>(optMapping.object);
|
||||||
if (cb && cb->currentIndex() != -1)
|
if (cb && cb->currentIndex() != -1)
|
||||||
*settingData.intSetting = cb->currentIndex();
|
*settingData.intSetting = cb->currentIndex();
|
||||||
break;
|
break;
|
||||||
|
@@ -28,7 +28,7 @@
|
|||||||
#include "vcsbase_global.h"
|
#include "vcsbase_global.h"
|
||||||
|
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
#include <QWidget>
|
#include <QToolBar>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QComboBox;
|
class QComboBox;
|
||||||
@@ -38,15 +38,17 @@ QT_END_NAMESPACE
|
|||||||
|
|
||||||
namespace VcsBase {
|
namespace VcsBase {
|
||||||
|
|
||||||
|
class VcsBaseEditorWidget;
|
||||||
|
|
||||||
namespace Internal { class VcsBaseEditorParameterWidgetPrivate; }
|
namespace Internal { class VcsBaseEditorParameterWidgetPrivate; }
|
||||||
|
|
||||||
// Documentation->inside.
|
// Documentation->inside.
|
||||||
class VCSBASE_EXPORT VcsBaseEditorParameterWidget : public QWidget
|
class VCSBASE_EXPORT VcsBaseEditorParameterWidget : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit VcsBaseEditorParameterWidget(QWidget *parent = 0);
|
explicit VcsBaseEditorParameterWidget(QToolBar *toolBar);
|
||||||
~VcsBaseEditorParameterWidget() override;
|
~VcsBaseEditorParameterWidget() override;
|
||||||
|
|
||||||
class VCSBASE_EXPORT ComboBoxItem
|
class VCSBASE_EXPORT ComboBoxItem
|
||||||
@@ -61,13 +63,13 @@ public:
|
|||||||
QStringList baseArguments() const;
|
QStringList baseArguments() const;
|
||||||
void setBaseArguments(const QStringList &);
|
void setBaseArguments(const QStringList &);
|
||||||
|
|
||||||
QToolButton *addToggleButton(const QString &option, const QString &label,
|
QAction *addToggleButton(const QString &option, const QString &label,
|
||||||
const QString &tooltip = QString());
|
const QString &tooltip = QString());
|
||||||
QToolButton *addToggleButton(const QStringList &options, const QString &label,
|
QAction *addToggleButton(const QStringList &options, const QString &label,
|
||||||
const QString &tooltip = QString());
|
const QString &tooltip = QString());
|
||||||
QComboBox *addComboBox(const QStringList &options, const QList<ComboBoxItem> &items);
|
QComboBox *addComboBox(const QStringList &options, const QList<ComboBoxItem> &items);
|
||||||
|
|
||||||
void mapSetting(QToolButton *button, bool *setting);
|
void mapSetting(QAction *button, bool *setting);
|
||||||
void mapSetting(QComboBox *comboBox, QString *setting);
|
void mapSetting(QComboBox *comboBox, QString *setting);
|
||||||
void mapSetting(QComboBox *comboBox, int *setting);
|
void mapSetting(QComboBox *comboBox, int *setting);
|
||||||
|
|
||||||
@@ -89,10 +91,10 @@ protected:
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
OptionMapping() = default;
|
OptionMapping() = default;
|
||||||
OptionMapping(const QString &option, QWidget *w);
|
OptionMapping(const QString &option, QObject *obj);
|
||||||
OptionMapping(const QStringList &optionList, QWidget *w);
|
OptionMapping(const QStringList &optionList, QObject *obj);
|
||||||
QStringList options;
|
QStringList options;
|
||||||
QWidget *widget = nullptr;
|
QObject *object = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
const QList<OptionMapping> &optionMappings() const;
|
const QList<OptionMapping> &optionMappings() const;
|
||||||
|
Reference in New Issue
Block a user