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