Move patch command out of VcsPlugin

It will be needed soon inside DiffEditor plugin.
Move "Patch command" setting out of Version Control | General
into Environment | General | System.

Introduce PatchTool class, which hold the patch command
setting and a method for applying patches (runPatch() - moved
from VcsBasePlugin).

Change-Id: I9de94358ccd5c6e31ac2beefc27305c5111d67bb
Reviewed-by: Jarek Kobus <jaroslaw.kobus@digia.com>
This commit is contained in:
jkobus
2014-04-17 12:47:38 +02:00
committed by Jarek Kobus
parent ba29d9f9b5
commit 48aefde7ba
15 changed files with 239 additions and 104 deletions

View File

@@ -58,11 +58,6 @@ CommonSettingsWidget::CommonSettingsWidget(QWidget *parent) :
m_ui->nickNameMailMapChooser->setHistoryCompleter(QLatin1String("Vcs.NickMap.History"));
m_ui->sshPromptChooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
m_ui->sshPromptChooser->setHistoryCompleter(QLatin1String("Vcs.SshPrompt.History"));
const QString patchToolTip = tr("Command used for reverting diff chunks.");
m_ui->patchCommandLabel->setToolTip(patchToolTip);
m_ui->patchChooser->setToolTip(patchToolTip);
m_ui->patchChooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
m_ui->patchChooser->setHistoryCompleter(QLatin1String("Vcs.PatchCommand.History"));
updatePath();
@@ -84,7 +79,6 @@ CommonVcsSettings CommonSettingsWidget::settings() const
rc.lineWrap= m_ui->lineWrapCheckBox->isChecked();
rc.lineWrapWidth = m_ui->lineWrapSpinBox->value();
rc.sshPasswordPrompt = m_ui->sshPromptChooser->path();
rc.patchCommand = m_ui->patchChooser->path();
return rc;
}
@@ -96,21 +90,6 @@ void CommonSettingsWidget::setSettings(const CommonVcsSettings &s)
m_ui->lineWrapCheckBox->setChecked(s.lineWrap);
m_ui->lineWrapSpinBox->setValue(s.lineWrapWidth);
m_ui->sshPromptChooser->setPath(s.sshPasswordPrompt);
m_ui->patchChooser->setPath(s.patchCommand);
}
QString CommonSettingsWidget::searchKeyWordMatchString() const
{
const QChar blank = QLatin1Char(' ');
QString rc = m_ui->lineWrapCheckBox->text()
+ blank + m_ui->submitMessageCheckScriptLabel->text()
+ blank + m_ui->nickNameMailMapLabel->text()
+ blank + m_ui->nickNameFieldsFileLabel->text()
+ blank + m_ui->sshPromptLabel->text()
+ blank + m_ui->patchCommandLabel->text()
;
rc.remove(QLatin1Char('&')); // Strip buddy markers.
return rc;
}
void CommonSettingsWidget::updatePath()
@@ -118,7 +97,6 @@ void CommonSettingsWidget::updatePath()
Utils::Environment env = Utils::Environment::systemEnvironment();
QStringList toAdd = Core::VcsManager::additionalToolsPath();
env.appendOrSetPath(toAdd.join(QString(Utils::HostOsInfo::pathListSeparator())));
m_ui->patchChooser->setEnvironment(env);
m_ui->sshPromptChooser->setEnvironment(env);
}