Commit 6fe3eec5 authored by Tobias Hunger's avatar Tobias Hunger

VcsCommand: Use Qt5-style connects

Change-Id: I81688ce998bf9f8d47b7d88e639699b626be90dd
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
parent e7e8f226
......@@ -1327,8 +1327,9 @@ void ClearCasePlugin::viewStatus()
if (m_viewData.name.isEmpty())
m_viewData = ccGetView(m_topLevel);
QTC_ASSERT(!m_viewData.name.isEmpty() && !m_settings.disableIndexer, return);
VcsOutputWindow::appendCommand(QLatin1String("Indexed files status (C=Checked Out, "
"H=Hijacked, ?=Missing)"));
VcsOutputWindow::append(QLatin1String("Indexed files status (C=Checked Out, "
"H=Hijacked, ?=Missing)"),
VcsOutputWindow::Command, true);
bool anymod = false;
for (StatusMap::ConstIterator it = m_statusMap->constBegin();
it != m_statusMap->constEnd();
......
......@@ -682,7 +682,8 @@ bool VcsBaseSubmitEditor::runSubmitMessageCheckScript(const QString &checkScript
if (!saver.finalize(errorMessage))
return false;
// Run check process
VcsOutputWindow::appendCommand(msgCheckScript(d->m_checkScriptWorkingDirectory, checkScript));
VcsOutputWindow::appendShellCommandLine(msgCheckScript(d->m_checkScriptWorkingDirectory,
checkScript));
QProcess checkProcess;
if (!d->m_checkScriptWorkingDirectory.isEmpty())
checkProcess.setWorkingDirectory(d->m_checkScriptWorkingDirectory);
......
......@@ -155,8 +155,8 @@ VcsCommand::VcsCommand(const Utils::FileName &binary,
const QProcessEnvironment &environment) :
d(new Internal::VcsCommandPrivate(binary, workingDirectory, environment))
{
connect(Core::ICore::instance(), SIGNAL(coreAboutToClose()),
this, SLOT(coreAboutToClose()));
connect(Core::ICore::instance(), &Core::ICore::coreAboutToClose,
this, &VcsCommand::coreAboutToClose);
}
VcsCommand::~VcsCommand()
......@@ -220,7 +220,7 @@ void VcsCommand::execute()
// For some reason QtConcurrent::run() only works on this
QFuture<void> task = QtConcurrent::run(&VcsCommand::run, this);
d->m_watcher.setFuture(task);
connect(&d->m_watcher, SIGNAL(canceled()), this, SLOT(cancel()));
connect(&d->m_watcher, &QFutureWatcher<void>::canceled, this, &VcsCommand::cancel);
QString binary = d->m_binaryPath.toFileInfo().baseName();
if (!binary.isEmpty())
binary = binary.replace(0, 1, binary[0].toUpper()); // Upper the first letter
......@@ -315,12 +315,12 @@ public:
// Users of this class can either be in the GUI thread or in other threads.
// Use Qt::AutoConnection to always append in the GUI thread (directly or queued)
VcsOutputWindow *outputWindow = VcsOutputWindow::instance();
connect(this, SIGNAL(append(QString)), outputWindow, SLOT(append(QString)));
connect(this, SIGNAL(appendSilently(QString)), outputWindow, SLOT(appendSilently(QString)));
connect(this, SIGNAL(appendError(QString)), outputWindow, SLOT(appendError(QString)));
connect(this, SIGNAL(appendCommand(QString,Utils::FileName,QStringList)),
outputWindow, SLOT(appendCommand(QString,Utils::FileName,QStringList)));
connect(this, SIGNAL(appendMessage(QString)), outputWindow, SLOT(appendMessage(QString)));
connect(this, &OutputProxy::append,
outputWindow, [](const QString &txt) { VcsOutputWindow::append(txt); });
connect(this, &OutputProxy::appendSilently, outputWindow, &VcsOutputWindow::appendSilently);
connect(this, &OutputProxy::appendError, outputWindow, &VcsOutputWindow::appendError);
connect(this, &OutputProxy::appendCommand, outputWindow, &VcsOutputWindow::appendCommand);
connect(this, &OutputProxy::appendMessage, outputWindow, &VcsOutputWindow::appendMessage);
}
signals:
......@@ -382,7 +382,7 @@ Utils::SynchronousProcessResponse VcsCommand::runVcs(const QStringList &argument
} else {
Utils::SynchronousProcess process;
process.setExitCodeInterpreter(interpreter);
connect(this, SIGNAL(terminate()), &process, SLOT(terminate()));
connect(this, &VcsCommand::terminate, &process, &Utils::SynchronousProcess::terminate);
if (!d->m_workingDirectory.isEmpty())
process.setWorkingDirectory(d->m_workingDirectory);
......@@ -405,15 +405,16 @@ Utils::SynchronousProcessResponse VcsCommand::runVcs(const QStringList &argument
} else if (d->m_progressiveOutput
|| !(d->m_flags & VcsBasePlugin::SuppressStdErrInLogWindow)) {
process.setStdErrBufferedSignalsEnabled(true);
connect(&process, SIGNAL(stdErrBuffered(QString,bool)),
this, SLOT(bufferedError(QString)));
connect(&process, &Utils::SynchronousProcess::stdErrBuffered,
this, &VcsCommand::bufferedError);
}
// connect stdout to the output window if desired
if (d->m_progressParser || d->m_progressiveOutput
|| (d->m_flags & VcsBasePlugin::ShowStdOutInLogWindow)) {
process.setStdOutBufferedSignalsEnabled(true);
connect(&process, SIGNAL(stdOutBuffered(QString,bool)), this, SLOT(bufferedOutput(QString)));
connect(&process, &Utils::SynchronousProcess::stdOutBuffered,
this, &VcsCommand::bufferedOutput);
}
process.setTimeOutMessageBoxEnabled(true);
......
......@@ -469,7 +469,7 @@ QString VcsOutputWindow::msgExecutionLogEntry(const QString &workingDir,
arg(QDir::toNativeSeparators(workingDir), nativeExecutable, args) + QLatin1Char('\n');
}
void VcsOutputWindow::appendCommand(const QString &text)
void VcsOutputWindow::appendShellCommandLine(const QString &text)
{
append(filterPasswordFromUrls(text), Command, true);
}
......@@ -478,7 +478,7 @@ void VcsOutputWindow::appendCommand(const QString &workingDirectory,
const Utils::FileName &binary,
const QStringList &args)
{
appendCommand(msgExecutionLogEntry(workingDirectory, binary, args));
appendShellCommandLine(msgExecutionLogEntry(workingDirectory, binary, args));
}
void VcsOutputWindow::appendMessage(const QString &text)
......
......@@ -109,7 +109,9 @@ public slots:
// Append a command, prepended by a log time stamp. "Executing: vcs -diff"
// will result in "10:00 Executing: vcs -diff" in bold
static void appendCommand(const QString &text);
// Filter passwords from URLs while doing this.
static void appendShellCommandLine(const QString &text);
// Append a standard-formatted entry for command execution
// (see msgExecutionLogEntry).
static void appendCommand(const QString &workingDirectory,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment