forked from qt-creator/qt-creator
VCS: Use namespace Utils
Change-Id: I41c818362398fd194995baf5b1adb16899e83217 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
dc29aafb52
commit
afb60d0434
@@ -37,6 +37,8 @@
|
||||
|
||||
#include <QCoreApplication>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace VcsBase {
|
||||
namespace Internal {
|
||||
|
||||
@@ -47,13 +49,13 @@ CommonSettingsWidget::CommonSettingsWidget(QWidget *parent) :
|
||||
m_ui(new Ui::CommonSettingsPage)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
m_ui->submitMessageCheckScriptChooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
|
||||
m_ui->submitMessageCheckScriptChooser->setExpectedKind(PathChooser::ExistingCommand);
|
||||
m_ui->submitMessageCheckScriptChooser->setHistoryCompleter(QLatin1String("Vcs.MessageCheckScript.History"));
|
||||
m_ui->nickNameFieldsFileChooser->setExpectedKind(Utils::PathChooser::File);
|
||||
m_ui->nickNameFieldsFileChooser->setExpectedKind(PathChooser::File);
|
||||
m_ui->nickNameFieldsFileChooser->setHistoryCompleter(QLatin1String("Vcs.NickFields.History"));
|
||||
m_ui->nickNameMailMapChooser->setExpectedKind(Utils::PathChooser::File);
|
||||
m_ui->nickNameMailMapChooser->setExpectedKind(PathChooser::File);
|
||||
m_ui->nickNameMailMapChooser->setHistoryCompleter(QLatin1String("Vcs.NickMap.History"));
|
||||
m_ui->sshPromptChooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
|
||||
m_ui->sshPromptChooser->setExpectedKind(PathChooser::ExistingCommand);
|
||||
m_ui->sshPromptChooser->setHistoryCompleter(QLatin1String("Vcs.SshPrompt.History"));
|
||||
|
||||
updatePath();
|
||||
@@ -93,9 +95,9 @@ void CommonSettingsWidget::setSettings(const CommonVcsSettings &s)
|
||||
|
||||
void CommonSettingsWidget::updatePath()
|
||||
{
|
||||
Utils::Environment env = Utils::Environment::systemEnvironment();
|
||||
Environment env = Environment::systemEnvironment();
|
||||
QStringList toAdd = Core::VcsManager::additionalToolsPath();
|
||||
env.appendOrSetPath(toAdd.join(Utils::HostOsInfo::pathListSeparator()));
|
||||
env.appendOrSetPath(toAdd.join(HostOsInfo::pathListSeparator()));
|
||||
m_ui->sshPromptChooser->setEnvironment(env);
|
||||
}
|
||||
|
||||
|
@@ -34,6 +34,8 @@
|
||||
#include <QStandardItemModel>
|
||||
#include <QSortFilterProxyModel>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
enum { NickNameRole = Qt::UserRole + 1 };
|
||||
|
||||
/*!
|
||||
@@ -175,7 +177,7 @@ NickNameDialog::NickNameDialog(QStandardItemModel *model, QWidget *parent) :
|
||||
m_filterModel->setSourceModel(model);
|
||||
m_filterModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
|
||||
m_ui->filterTreeView->setModel(m_filterModel);
|
||||
m_ui->filterTreeView->setActivationMode(Utils::DoubleClickActivation);
|
||||
m_ui->filterTreeView->setActivationMode(DoubleClickActivation);
|
||||
const int columnCount = m_filterModel->columnCount();
|
||||
int treeWidth = 0;
|
||||
for (int c = 0; c < columnCount; c++) {
|
||||
@@ -188,7 +190,7 @@ NickNameDialog::NickNameDialog(QStandardItemModel *model, QWidget *parent) :
|
||||
&NickNameDialog::slotActivated);
|
||||
connect(m_ui->filterTreeView->selectionModel(), &QItemSelectionModel::currentRowChanged,
|
||||
this, &NickNameDialog::slotCurrentItemChanged);
|
||||
connect(m_ui->filterLineEdit, &Utils::FancyLineEdit::filterChanged,
|
||||
connect(m_ui->filterLineEdit, &FancyLineEdit::filterChanged,
|
||||
m_filterModel, &QSortFilterProxyModel::setFilterFixedString);
|
||||
}
|
||||
|
||||
@@ -242,7 +244,7 @@ bool NickNameDialog::populateModelFromMailCapFile(const QString &fileName,
|
||||
model->removeRows(0, rowCount);
|
||||
if (fileName.isEmpty())
|
||||
return true;
|
||||
Utils::FileReader reader;
|
||||
FileReader reader;
|
||||
if (!reader.fetch(fileName, QIODevice::Text, errorMessage))
|
||||
return false;
|
||||
// Split into lines and read
|
||||
|
@@ -42,6 +42,8 @@
|
||||
#include <QSpacerItem>
|
||||
#include <QShortcut>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
enum { debug = 0 };
|
||||
enum { defaultLineWidth = 72 };
|
||||
|
||||
@@ -252,16 +254,16 @@ void SubmitEditorWidget::unregisterActions(QAction *editorUndoAction, QAction *
|
||||
QAction *submitAction, QAction *diffAction)
|
||||
{
|
||||
if (editorUndoAction) {
|
||||
disconnect(d->m_ui.description, &Utils::CompletingTextEdit::undoAvailable,
|
||||
disconnect(d->m_ui.description, &CompletingTextEdit::undoAvailable,
|
||||
editorUndoAction, &QAction::setEnabled);
|
||||
disconnect(editorUndoAction, &QAction::triggered,
|
||||
d->m_ui.description, &Utils::CompletingTextEdit::undo);
|
||||
d->m_ui.description, &CompletingTextEdit::undo);
|
||||
}
|
||||
if (editorRedoAction) {
|
||||
disconnect(d->m_ui.description, &Utils::CompletingTextEdit::redoAvailable,
|
||||
disconnect(d->m_ui.description, &CompletingTextEdit::redoAvailable,
|
||||
editorRedoAction, &QAction::setEnabled);
|
||||
disconnect(editorRedoAction, &QAction::triggered,
|
||||
d->m_ui.description, &Utils::CompletingTextEdit::redo);
|
||||
d->m_ui.description, &CompletingTextEdit::redo);
|
||||
}
|
||||
|
||||
if (submitAction) {
|
||||
@@ -446,7 +448,7 @@ QStringList SubmitEditorWidget::checkedFiles() const
|
||||
return rc;
|
||||
}
|
||||
|
||||
Utils::CompletingTextEdit *SubmitEditorWidget::descriptionEdit() const
|
||||
CompletingTextEdit *SubmitEditorWidget::descriptionEdit() const
|
||||
{
|
||||
return d->m_ui.description;
|
||||
}
|
||||
|
@@ -50,6 +50,8 @@
|
||||
#include <QVariant>
|
||||
#include <QProcessEnvironment>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
/*!
|
||||
\class VcsBase::VcsBaseClient
|
||||
|
||||
@@ -108,7 +110,7 @@ VcsBaseClientSettings &VcsBaseClientImpl::settings() const
|
||||
return *d->m_clientSettings;
|
||||
}
|
||||
|
||||
Utils::FileName VcsBaseClientImpl::vcsBinary() const
|
||||
FileName VcsBaseClientImpl::vcsBinary() const
|
||||
{
|
||||
return settings().binaryPath();
|
||||
}
|
||||
@@ -134,7 +136,7 @@ VcsCommand *VcsBaseClientImpl::createCommand(const QString &workingDirectory,
|
||||
|
||||
void VcsBaseClientImpl::enqueueJob(VcsCommand *cmd, const QStringList &args,
|
||||
const QString &workingDirectory,
|
||||
const Utils::ExitCodeInterpreter &interpreter) const
|
||||
const ExitCodeInterpreter &interpreter) const
|
||||
{
|
||||
cmd->addJob(vcsBinary(), args, vcsTimeoutS(), workingDirectory, interpreter);
|
||||
cmd->execute();
|
||||
@@ -149,7 +151,7 @@ QProcessEnvironment VcsBaseClientImpl::processEnvironment() const
|
||||
|
||||
QString VcsBaseClientImpl::commandOutputFromLocal8Bit(const QByteArray &a)
|
||||
{
|
||||
return Utils::SynchronousProcess::normalizeNewlines(QString::fromLocal8Bit(a));
|
||||
return SynchronousProcess::normalizeNewlines(QString::fromLocal8Bit(a));
|
||||
}
|
||||
|
||||
QStringList VcsBaseClientImpl::commandOutputLinesFromLocal8Bit(const QByteArray &a)
|
||||
@@ -175,8 +177,8 @@ QString VcsBaseClientImpl::stripLastNewline(const QString &in)
|
||||
return in;
|
||||
}
|
||||
|
||||
Utils::SynchronousProcessResponse
|
||||
VcsBaseClientImpl::vcsFullySynchronousExec(const QString &workingDir, const Utils::FileName &binary,
|
||||
SynchronousProcessResponse
|
||||
VcsBaseClientImpl::vcsFullySynchronousExec(const QString &workingDir, const FileName &binary,
|
||||
const QStringList &args, unsigned flags,
|
||||
int timeoutS, QTextCodec *codec) const
|
||||
{
|
||||
@@ -205,7 +207,7 @@ void VcsBaseClientImpl::annotateRevisionRequested(const QString &workingDirector
|
||||
annotate(workingDirectory, file, changeCopy, line);
|
||||
}
|
||||
|
||||
Utils::SynchronousProcessResponse
|
||||
SynchronousProcessResponse
|
||||
VcsBaseClientImpl::vcsFullySynchronousExec(const QString &workingDir, const QStringList &args,
|
||||
unsigned flags, int timeoutS, QTextCodec *codec) const
|
||||
{
|
||||
@@ -226,7 +228,7 @@ VcsCommand *VcsBaseClientImpl::vcsExec(const QString &workingDirectory, const QS
|
||||
return command;
|
||||
}
|
||||
|
||||
Utils::SynchronousProcessResponse VcsBaseClientImpl::vcsSynchronousExec(const QString &workingDir,
|
||||
SynchronousProcessResponse VcsBaseClientImpl::vcsSynchronousExec(const QString &workingDir,
|
||||
const QStringList &args,
|
||||
unsigned flags,
|
||||
QTextCodec *outputCodec) const
|
||||
@@ -316,8 +318,8 @@ bool VcsBaseClient::synchronousCreateRepository(const QString &workingDirectory,
|
||||
{
|
||||
QStringList args(vcsCommandString(CreateRepositoryCommand));
|
||||
args << extraOptions;
|
||||
Utils::SynchronousProcessResponse result = vcsFullySynchronousExec(workingDirectory, args);
|
||||
if (result.result != Utils::SynchronousProcessResponse::Finished)
|
||||
SynchronousProcessResponse result = vcsFullySynchronousExec(workingDirectory, args);
|
||||
if (result.result != SynchronousProcessResponse::Finished)
|
||||
return false;
|
||||
VcsOutputWindow::append(result.stdOut());
|
||||
|
||||
@@ -335,9 +337,9 @@ bool VcsBaseClient::synchronousClone(const QString &workingDir,
|
||||
args << vcsCommandString(CloneCommand)
|
||||
<< extraOptions << srcLocation << dstLocation;
|
||||
|
||||
Utils::SynchronousProcessResponse result = vcsFullySynchronousExec(workingDir, args);
|
||||
SynchronousProcessResponse result = vcsFullySynchronousExec(workingDir, args);
|
||||
resetCachedVcsInfo(workingDir);
|
||||
return result.result == Utils::SynchronousProcessResponse::Finished;
|
||||
return result.result == SynchronousProcessResponse::Finished;
|
||||
}
|
||||
|
||||
bool VcsBaseClient::synchronousAdd(const QString &workingDir, const QString &filename,
|
||||
@@ -345,7 +347,7 @@ bool VcsBaseClient::synchronousAdd(const QString &workingDir, const QString &fil
|
||||
{
|
||||
QStringList args;
|
||||
args << vcsCommandString(AddCommand) << extraOptions << filename;
|
||||
return vcsFullySynchronousExec(workingDir, args).result == Utils::SynchronousProcessResponse::Finished;
|
||||
return vcsFullySynchronousExec(workingDir, args).result == SynchronousProcessResponse::Finished;
|
||||
}
|
||||
|
||||
bool VcsBaseClient::synchronousRemove(const QString &workingDir, const QString &filename,
|
||||
@@ -353,7 +355,7 @@ bool VcsBaseClient::synchronousRemove(const QString &workingDir, const QString &
|
||||
{
|
||||
QStringList args;
|
||||
args << vcsCommandString(RemoveCommand) << extraOptions << filename;
|
||||
return vcsFullySynchronousExec(workingDir, args).result == Utils::SynchronousProcessResponse::Finished;
|
||||
return vcsFullySynchronousExec(workingDir, args).result == SynchronousProcessResponse::Finished;
|
||||
}
|
||||
|
||||
bool VcsBaseClient::synchronousMove(const QString &workingDir,
|
||||
@@ -362,7 +364,7 @@ bool VcsBaseClient::synchronousMove(const QString &workingDir,
|
||||
{
|
||||
QStringList args;
|
||||
args << vcsCommandString(MoveCommand) << extraOptions << from << to;
|
||||
return vcsFullySynchronousExec(workingDir, args).result == Utils::SynchronousProcessResponse::Finished;
|
||||
return vcsFullySynchronousExec(workingDir, args).result == SynchronousProcessResponse::Finished;
|
||||
}
|
||||
|
||||
bool VcsBaseClient::synchronousPull(const QString &workingDir,
|
||||
@@ -376,8 +378,8 @@ bool VcsBaseClient::synchronousPull(const QString &workingDir,
|
||||
VcsCommand::SshPasswordPrompt
|
||||
| VcsCommand::ShowStdOut
|
||||
| VcsCommand::ShowSuccessMessage;
|
||||
const Utils::SynchronousProcessResponse resp = vcsSynchronousExec(workingDir, args, flags);
|
||||
const bool ok = resp.result == Utils::SynchronousProcessResponse::Finished;
|
||||
const SynchronousProcessResponse resp = vcsSynchronousExec(workingDir, args, flags);
|
||||
const bool ok = resp.result == SynchronousProcessResponse::Finished;
|
||||
if (ok)
|
||||
emit changed(QVariant(workingDir));
|
||||
return ok;
|
||||
@@ -394,8 +396,8 @@ bool VcsBaseClient::synchronousPush(const QString &workingDir,
|
||||
VcsCommand::SshPasswordPrompt
|
||||
| VcsCommand::ShowStdOut
|
||||
| VcsCommand::ShowSuccessMessage;
|
||||
const Utils::SynchronousProcessResponse resp = vcsSynchronousExec(workingDir, args, flags);
|
||||
return resp.result == Utils::SynchronousProcessResponse::Finished;
|
||||
const SynchronousProcessResponse resp = vcsSynchronousExec(workingDir, args, flags);
|
||||
return resp.result == SynchronousProcessResponse::Finished;
|
||||
}
|
||||
|
||||
VcsBaseEditorWidget *VcsBaseClient::annotate(
|
||||
@@ -564,7 +566,7 @@ QString VcsBaseClient::vcsCommandString(VcsCommandTag cmd) const
|
||||
return QString();
|
||||
}
|
||||
|
||||
Utils::ExitCodeInterpreter VcsBaseClient::exitCodeInterpreter(VcsCommandTag cmd) const
|
||||
ExitCodeInterpreter VcsBaseClient::exitCodeInterpreter(VcsCommandTag cmd) const
|
||||
{
|
||||
Q_UNUSED(cmd)
|
||||
return Utils::defaultExitCodeInterpreter;
|
||||
@@ -640,7 +642,7 @@ QString VcsBaseClient::vcsEditorTitle(const QString &vcsCmd, const QString &sour
|
||||
{
|
||||
return vcsBinary().toFileInfo().baseName() +
|
||||
QLatin1Char(' ') + vcsCmd + QLatin1Char(' ') +
|
||||
Utils::FileName::fromString(sourceId).fileName();
|
||||
FileName::fromString(sourceId).fileName();
|
||||
}
|
||||
|
||||
void VcsBaseClient::statusParser(const QString &text)
|
||||
|
@@ -34,6 +34,8 @@
|
||||
#include <QSettings>
|
||||
#include <QVariant>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace {
|
||||
|
||||
class SettingValue
|
||||
@@ -176,7 +178,7 @@ public:
|
||||
QHash<QString, SettingValue> m_valueHash;
|
||||
QVariantHash m_defaultValueHash;
|
||||
QString m_settingsGroup;
|
||||
mutable Utils::FileName m_binaryFullPath;
|
||||
mutable FileName m_binaryFullPath;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
@@ -352,12 +354,12 @@ QVariant::Type VcsBaseClientSettings::valueType(const QString &key) const
|
||||
return QVariant::Invalid;
|
||||
}
|
||||
|
||||
Utils::FileName VcsBaseClientSettings::binaryPath() const
|
||||
FileName VcsBaseClientSettings::binaryPath() const
|
||||
{
|
||||
if (d->m_binaryFullPath.isEmpty()) {
|
||||
const Utils::FileNameList searchPaths
|
||||
= Utils::transform(searchPathList(), [](const QString &s) { return Utils::FileName::fromString(s); });
|
||||
d->m_binaryFullPath = Utils::Environment::systemEnvironment().searchInPath(
|
||||
const FileNameList searchPaths
|
||||
= Utils::transform(searchPathList(), [](const QString &s) { return FileName::fromString(s); });
|
||||
d->m_binaryFullPath = Environment::systemEnvironment().searchInPath(
|
||||
stringValue(binaryPathKey), searchPaths);
|
||||
}
|
||||
return d->m_binaryFullPath;
|
||||
@@ -365,7 +367,7 @@ Utils::FileName VcsBaseClientSettings::binaryPath() const
|
||||
|
||||
QStringList VcsBaseClientSettings::searchPathList() const
|
||||
{
|
||||
return stringValue(pathKey).split(Utils::HostOsInfo::pathListSeparator(), QString::SkipEmptyParts);
|
||||
return stringValue(pathKey).split(HostOsInfo::pathListSeparator(), QString::SkipEmptyParts);
|
||||
}
|
||||
|
||||
QString VcsBaseClientSettings::settingsGroup() const
|
||||
|
@@ -90,6 +90,7 @@
|
||||
*/
|
||||
|
||||
using namespace TextEditor;
|
||||
using namespace Utils;
|
||||
|
||||
namespace VcsBase {
|
||||
|
||||
@@ -563,7 +564,7 @@ public:
|
||||
QList<AbstractTextCursorHandler *> m_textCursorHandlers;
|
||||
QPointer<VcsCommand> m_command;
|
||||
VcsBaseEditorWidget::DescribeFunc m_describeFunc = nullptr;
|
||||
Utils::ProgressIndicator *m_progressIndicator = nullptr;
|
||||
ProgressIndicator *m_progressIndicator = nullptr;
|
||||
bool m_fileLogAnnotateEnabled = false;
|
||||
bool m_mouseDragging = false;
|
||||
|
||||
@@ -867,7 +868,7 @@ void VcsBaseEditorWidget::slotPopulateDiffBrowser()
|
||||
lastFileName = file;
|
||||
// ignore any headers
|
||||
d->m_entrySections.push_back(d->m_entrySections.empty() ? 0 : lineNumber);
|
||||
entriesComboBox->addItem(Utils::FileName::fromString(file).fileName());
|
||||
entriesComboBox->addItem(FileName::fromString(file).fileName());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1397,7 +1398,7 @@ void VcsBaseEditorWidget::setCommand(VcsCommand *command)
|
||||
}
|
||||
d->m_command = command;
|
||||
if (command) {
|
||||
d->m_progressIndicator = new Utils::ProgressIndicator(Utils::ProgressIndicatorSize::Large);
|
||||
d->m_progressIndicator = new ProgressIndicator(ProgressIndicatorSize::Large);
|
||||
d->m_progressIndicator->attachToWidget(this);
|
||||
connect(command, &VcsCommand::finished, this, &VcsBaseEditorWidget::reportCommandFinished);
|
||||
QTimer::singleShot(100, this, &VcsBaseEditorWidget::showProgressIndicator);
|
||||
|
@@ -33,6 +33,8 @@
|
||||
|
||||
#include <QProcessEnvironment>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace VcsBase {
|
||||
|
||||
VcsCommand::VcsCommand(const QString &workingDirectory,
|
||||
@@ -40,19 +42,19 @@ VcsCommand::VcsCommand(const QString &workingDirectory,
|
||||
Core::ShellCommand(workingDirectory, environment),
|
||||
m_preventRepositoryChanged(false)
|
||||
{
|
||||
setOutputProxyFactory([this]() -> Utils::OutputProxy * {
|
||||
auto proxy = new Utils::OutputProxy;
|
||||
setOutputProxyFactory([this]() -> OutputProxy * {
|
||||
auto proxy = new OutputProxy;
|
||||
VcsOutputWindow *outputWindow = VcsOutputWindow::instance();
|
||||
|
||||
connect(proxy, &Utils::OutputProxy::append,
|
||||
connect(proxy, &OutputProxy::append,
|
||||
outputWindow, [](const QString &txt) { VcsOutputWindow::append(txt); });
|
||||
connect(proxy, &Utils::OutputProxy::appendSilently,
|
||||
connect(proxy, &OutputProxy::appendSilently,
|
||||
outputWindow, &VcsOutputWindow::appendSilently);
|
||||
connect(proxy, &Utils::OutputProxy::appendError,
|
||||
connect(proxy, &OutputProxy::appendError,
|
||||
outputWindow, &VcsOutputWindow::appendError);
|
||||
connect(proxy, &Utils::OutputProxy::appendCommand,
|
||||
connect(proxy, &OutputProxy::appendCommand,
|
||||
outputWindow, &VcsOutputWindow::appendCommand);
|
||||
connect(proxy, &Utils::OutputProxy::appendMessage,
|
||||
connect(proxy, &OutputProxy::appendMessage,
|
||||
outputWindow, &VcsOutputWindow::appendMessage);
|
||||
|
||||
return proxy;
|
||||
@@ -74,12 +76,12 @@ const QProcessEnvironment VcsCommand::processEnvironment() const
|
||||
return env;
|
||||
}
|
||||
|
||||
Utils::SynchronousProcessResponse VcsCommand::runCommand(const Utils::FileName &binary,
|
||||
SynchronousProcessResponse VcsCommand::runCommand(const FileName &binary,
|
||||
const QStringList &arguments, int timeoutS,
|
||||
const QString &workingDirectory,
|
||||
const Utils::ExitCodeInterpreter &interpreter)
|
||||
const ExitCodeInterpreter &interpreter)
|
||||
{
|
||||
Utils::SynchronousProcessResponse response
|
||||
SynchronousProcessResponse response
|
||||
= Core::ShellCommand::runCommand(binary, arguments, timeoutS, workingDirectory,
|
||||
interpreter);
|
||||
emitRepositoryChanged(workingDirectory);
|
||||
@@ -99,7 +101,7 @@ unsigned VcsCommand::processFlags() const
|
||||
{
|
||||
unsigned processFlags = 0;
|
||||
if (!VcsBasePlugin::sshPrompt().isEmpty() && (flags() & SshPasswordPrompt))
|
||||
processFlags |= Utils::SynchronousProcess::UnixTerminalDisabled;
|
||||
processFlags |= SynchronousProcess::UnixTerminalDisabled;
|
||||
return processFlags;
|
||||
}
|
||||
|
||||
|
@@ -52,6 +52,8 @@
|
||||
#include <QPoint>
|
||||
#include <QFileInfo>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
/*!
|
||||
\class VcsBase::VcsBaseOutputWindow
|
||||
|
||||
@@ -107,7 +109,7 @@ private:
|
||||
QTextCharFormat m_warningFormat;
|
||||
QTextCharFormat m_commandFormat;
|
||||
QTextCharFormat m_messageFormat;
|
||||
Utils::OutputFormatter *m_formatter;
|
||||
OutputFormatter *m_formatter;
|
||||
};
|
||||
|
||||
OutputWindowPlainTextEdit::OutputWindowPlainTextEdit(QWidget *parent) :
|
||||
@@ -118,7 +120,6 @@ OutputWindowPlainTextEdit::OutputWindowPlainTextEdit(QWidget *parent) :
|
||||
m_commandFormat(m_defaultFormat),
|
||||
m_messageFormat(m_defaultFormat)
|
||||
{
|
||||
using Utils::Theme;
|
||||
setReadOnly(true);
|
||||
setUndoRedoEnabled(false);
|
||||
setFrameStyle(QFrame::NoFrame);
|
||||
@@ -126,7 +127,7 @@ OutputWindowPlainTextEdit::OutputWindowPlainTextEdit(QWidget *parent) :
|
||||
m_warningFormat.setForeground(Utils::creatorTheme()->color(Theme::OutputPanes_WarningMessageTextColor));
|
||||
m_commandFormat.setFontWeight(QFont::Bold);
|
||||
m_messageFormat.setForeground(Utils::creatorTheme()->color(Theme::OutputPanes_MessageOutput));
|
||||
m_formatter = new Utils::OutputFormatter;
|
||||
m_formatter = new OutputFormatter;
|
||||
m_formatter->setPlainTextEdit(this);
|
||||
Aggregation::Aggregate *agg = new Aggregation::Aggregate;
|
||||
agg->add(this);
|
||||
@@ -435,12 +436,12 @@ static inline QString formatArguments(const QStringList &args)
|
||||
if (i)
|
||||
str << ' ';
|
||||
if (arg.startsWith(QString::fromLatin1(passwordOptionC) + QLatin1Char('='))) {
|
||||
str << Utils::QtcProcess::quoteArg("--password=********");
|
||||
str << QtcProcess::quoteArg("--password=********");
|
||||
continue;
|
||||
}
|
||||
str << Utils::QtcProcess::quoteArg(arg);
|
||||
str << QtcProcess::quoteArg(arg);
|
||||
if (arg == QLatin1String(passwordOptionC)) {
|
||||
str << ' ' << Utils::QtcProcess::quoteArg("********");
|
||||
str << ' ' << QtcProcess::quoteArg("********");
|
||||
i++;
|
||||
}
|
||||
}
|
||||
@@ -448,11 +449,11 @@ static inline QString formatArguments(const QStringList &args)
|
||||
}
|
||||
|
||||
QString VcsOutputWindow::msgExecutionLogEntry(const QString &workingDir,
|
||||
const Utils::FileName &executable,
|
||||
const FileName &executable,
|
||||
const QStringList &arguments)
|
||||
{
|
||||
const QString args = formatArguments(arguments);
|
||||
const QString nativeExecutable = Utils::QtcProcess::quoteArg(executable.toUserOutput());
|
||||
const QString nativeExecutable = QtcProcess::quoteArg(executable.toUserOutput());
|
||||
if (workingDir.isEmpty())
|
||||
return tr("Running: %1 %2").arg(nativeExecutable, args) + QLatin1Char('\n');
|
||||
return tr("Running in %1: %2 %3").
|
||||
@@ -465,7 +466,7 @@ void VcsOutputWindow::appendShellCommandLine(const QString &text)
|
||||
}
|
||||
|
||||
void VcsOutputWindow::appendCommand(const QString &workingDirectory,
|
||||
const Utils::FileName &binary,
|
||||
const FileName &binary,
|
||||
const QStringList &args)
|
||||
{
|
||||
appendShellCommandLine(msgExecutionLogEntry(workingDirectory, binary, args));
|
||||
|
@@ -35,6 +35,8 @@
|
||||
|
||||
#include <limits>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace {
|
||||
|
||||
class PathMatcher
|
||||
@@ -44,7 +46,7 @@ public:
|
||||
ProjectExplorer::Project *project() { return m_project; }
|
||||
|
||||
void match(ProjectExplorer::Project *project,
|
||||
const Utils::FileName &base, const Utils::FileName &child) {
|
||||
const FileName &base, const FileName &child) {
|
||||
int count = std::numeric_limits<int>::max();
|
||||
if (child.isChildOf(base)) {
|
||||
const QString relative = child.toString().mid(base.count() + 1);
|
||||
@@ -98,7 +100,7 @@ ProjectExplorer::Project *VcsProjectCache::projectFor(const QString &repo)
|
||||
return m_instance->m_cache.at(0).project;
|
||||
}
|
||||
|
||||
project = projectForToplevel(Utils::FileName::fromString(repo));
|
||||
project = projectForToplevel(FileName::fromString(repo));
|
||||
m_instance->m_cache.prepend(CacheNode(repo, project));
|
||||
while (m_instance->m_cache.count() > 10)
|
||||
m_instance->m_cache.removeLast();
|
||||
@@ -121,12 +123,12 @@ void VcsProjectCache::destroy()
|
||||
delete m_instance;
|
||||
}
|
||||
|
||||
ProjectExplorer::Project *VcsProjectCache::projectForToplevel(const Utils::FileName &vcsTopLevel)
|
||||
ProjectExplorer::Project *VcsProjectCache::projectForToplevel(const FileName &vcsTopLevel)
|
||||
{
|
||||
PathMatcher parentMatcher;
|
||||
PathMatcher childMatcher;
|
||||
for (ProjectExplorer::Project *project : ProjectExplorer::SessionManager::projects()) {
|
||||
const Utils::FileName projectDir = project->projectDirectory();
|
||||
const FileName projectDir = project->projectDirectory();
|
||||
if (projectDir == vcsTopLevel)
|
||||
return project;
|
||||
parentMatcher.match(project, vcsTopLevel, projectDir);
|
||||
|
@@ -40,6 +40,7 @@
|
||||
|
||||
using namespace Core;
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
|
||||
namespace VcsBase {
|
||||
namespace Internal {
|
||||
@@ -68,8 +69,7 @@ VcsCommandPageFactory::VcsCommandPageFactory()
|
||||
setTypeIdsSuffix(QLatin1String("VcsCommand"));
|
||||
}
|
||||
|
||||
Utils::WizardPage *VcsCommandPageFactory::create(JsonWizard *wizard, Id typeId,
|
||||
const QVariant &data)
|
||||
WizardPage *VcsCommandPageFactory::create(JsonWizard *wizard, Id typeId, const QVariant &data)
|
||||
{
|
||||
Q_UNUSED(wizard);
|
||||
|
||||
@@ -286,8 +286,8 @@ void VcsCommandPage::delayedInitialize()
|
||||
extraArgs << tmp;
|
||||
}
|
||||
|
||||
ShellCommand *command
|
||||
= vc->createInitialCheckoutCommand(repo, Utils::FileName::fromString(base),
|
||||
Core::ShellCommand *command
|
||||
= vc->createInitialCheckoutCommand(repo, FileName::fromString(base),
|
||||
name, extraArgs);
|
||||
|
||||
foreach (const JobData &job, m_additionalJobs) {
|
||||
@@ -310,7 +310,7 @@ void VcsCommandPage::delayedInitialize()
|
||||
|
||||
const QString dir = wiz->expander()->expand(job.workDirectory);
|
||||
const int timeoutS = command->defaultTimeoutS() * job.timeOutFactor;
|
||||
command->addJob(Utils::FileName::fromUserInput(commandString), args, timeoutS, dir);
|
||||
command->addJob(FileName::fromUserInput(commandString), args, timeoutS, dir);
|
||||
}
|
||||
|
||||
start(command);
|
||||
|
Reference in New Issue
Block a user