Commit adbc07ea authored by Laurent Navet's avatar Laurent Navet Committed by Sven Brauch
Browse files

Replace KProcess by QProcess

Use QProcess where KProcess features are not needed.

REVIEW: 127152
parent de5b4080
......@@ -28,7 +28,7 @@
#include <QStandardPaths>
#include <KLocalizedString>
#include <KProcess>
#include <QProcess>
#include <algorithm>
......@@ -58,18 +58,19 @@ void QtHelpQtDoc::registerDocumentations()
{
const QString qmake = qmakeCandidate();
if (!qmake.isEmpty()) {
KProcess *p = new KProcess;
p->setOutputChannelMode(KProcess::MergedChannels);
p->setProgram(qmake, QStringList("-query") << "QT_INSTALL_DOCS");
QProcess *p = new QProcess;
p->setProcessChannelMode(QProcess::MergedChannels);
p->setProgram(qmake);
p->setArguments(QStringList(QStringLiteral("-query QT_INSTALL_DOCS")));
p->start();
connect(p, static_cast<void(KProcess::*)(int)>(&KProcess::finished), this, &QtHelpQtDoc::lookupDone);
connect(p, static_cast<void(QProcess::*)(int)>(&QProcess::finished), this, &QtHelpQtDoc::lookupDone);
}
}
void QtHelpQtDoc::lookupDone(int code)
{
if(code==0) {
KProcess* p = qobject_cast<KProcess*>(sender());
QProcess* p = qobject_cast<QProcess*>(sender());
m_path = QDir::fromNativeSeparators(QString::fromLatin1(p->readAllStandardOutput().trimmed()));
qCDebug(QTHELP) << "Detected doc path:" << m_path;
......
......@@ -35,7 +35,6 @@ class OutputModel;
class CommandExecutor;
}
class KProcess;
class PlasmoidExecutionJob : public KDevelop::OutputJob
{
......
......@@ -41,7 +41,6 @@
#include <kaboutdata.h>
#include <kmessagebox.h>
#include <KLocalizedString>
#include <KProcess>
#include <kjob.h>
#include <QUrl>
......
......@@ -29,7 +29,6 @@
#include <interfaces/icore.h>
#include <interfaces/iprojectcontroller.h>
#include <KProcess>
#include <KLocalizedString>
#include <KConfigGroup>
......
......@@ -30,7 +30,6 @@ namespace KDevelop {
class KDevNinjaBuilderPlugin;
class KProcess;
class QUrl;
class NinjaJob : public KDevelop::OutputExecuteJob
......
......@@ -26,7 +26,6 @@
#include <project/helper.h>
#include <KColorScheme>
#include <KProcess>
#include <KMessageBox>
#include <KLocalizedString>
#include <KSharedConfig>
......
......@@ -35,7 +35,7 @@
#include <language/duchain/types/delayedtype.h>
#include <language/duchain/problem.h>
#include <KProcess>
#include <QProcess>
#include <KLocalizedString>
#include <QHash>
#include <QQueue>
......@@ -1469,11 +1469,12 @@ int CMakeProjectVisitor::visit(const ExecProgramAst *exec)
}
qCDebug(CMAKE) << "Executing:" << execName << "::" << args << "in" << exec->workingDirectory();
KProcess p;
QProcess p;
if(!exec->workingDirectory().isEmpty())
p.setWorkingDirectory(exec->workingDirectory());
p.setOutputChannelMode(KProcess::MergedChannels);
p.setProgram(execName, args);
p.setProcessChannelMode(QProcess::MergedChannels);
p.setProgram(execName);
p.setArguments(args);
p.start();
if(!p.waitForFinished())
......@@ -1501,7 +1502,7 @@ int CMakeProjectVisitor::visit(const ExecProgramAst *exec)
int CMakeProjectVisitor::visit(const ExecuteProcessAst *exec)
{
qCDebug(CMAKE) << "executing... " << exec->commands();
QList<KProcess*> procs;
QList<QProcess*> procs;
foreach(const QStringList& _args, exec->commands())
{
if(_args.isEmpty())
......@@ -1526,15 +1527,16 @@ int CMakeProjectVisitor::visit(const ExecuteProcessAst *exec)
workingDir = m_vars->value("CMAKE_CURRENT_BINARY_DIR").join(QString());
}
QStringList args(_args);
KProcess *p=new KProcess(), *prev=0;
QProcess *p=new QProcess(), *prev=0;
if(!procs.isEmpty())
{
prev=procs.last();
}
p->setWorkingDirectory(workingDir);
p->setOutputChannelMode(KProcess::MergedChannels);
p->setProcessChannelMode(QProcess::MergedChannels);
QString execName=args.takeFirst();
p->setProgram(execName, args);
p->setProgram(execName);
p->setArguments(args);
p->start();
procs.append(p);
qCDebug(CMAKE) << "Executing:" << execName << "::" << args /*<< "into" << *m_vars*/;
......@@ -1545,7 +1547,7 @@ int CMakeProjectVisitor::visit(const ExecuteProcessAst *exec)
}
}
foreach(KProcess* p, procs)
foreach(QProcess* p, procs)
{
if(!p->waitForFinished())
{
......
......@@ -28,7 +28,6 @@
#include <language/backgroundparser/backgroundparser.h>
#include <QFileInfo>
#include <KProcess>
#include <KLocalizedString>
CTestFindJob::CTestFindJob(CTestSuite* suite, QObject* parent)
......
......@@ -28,7 +28,6 @@ class IndexedString;
class ReferencedTopDUContext;
}
class KProcess;
class CTestSuite;
class CTestFindJob : public KJob
......
......@@ -35,7 +35,6 @@
#include <outputview/outputmodel.h>
#include <KConfigGroup>
#include <KProcess>
#include <KLocalizedString>
#include <KCompositeJob>
......
......@@ -25,7 +25,6 @@
#include <interfaces/itestcontroller.h>
class CTestSuite;
class KProcess;
namespace KDevelop {
class ILaunchConfiguration;
......
......@@ -21,7 +21,6 @@
#include "ctestrunjob.h"
#include "../debug.h"
#include <KProcess>
#include <QFileInfo>
#include <interfaces/itestcontroller.h>
......
......@@ -25,7 +25,7 @@
#include "cmake-test-paths.h"
#include "../debug.h"
#include <KProcess>
#include <QProcess>
#include <QFile>
#include <cmakeparserutils.h>
......@@ -43,8 +43,8 @@ QString CMakeCompliance::output;
//Copied from CMakeManager
QString executeProcess(const QString& execName, const QStringList& args=QStringList())
{
KProcess p;
p.setOutputChannelMode(KProcess::MergedChannels);
QProcess p;
p.setProcessChannelMode(QProcess::MergedChannels);
p.setProgram(execName, args);
p.start();
......
......@@ -20,7 +20,6 @@
#include "custombuildjob.h"
#include <KLocalizedString>
#include <KProcess>
#include <KConfigGroup>
#include <KShell>
......
......@@ -22,7 +22,7 @@
#include <QtCore/QFileInfo>
#include <QtCore/QDir>
#include <QDebug>
#include <KProcess>
#include <QProcess>
#include <KLocalizedString>
#include <KShell>
#include <util/processlinemaker.h>
......@@ -83,7 +83,6 @@ void QMakeJob::start()
startOutput();
QStringList args;
args << m_qmakePath;
if (m_buildType < 2)
args << QString("CONFIG+=") + BUILD_TYPES[m_buildType];
if (!m_installPrefix.isEmpty())
......@@ -111,10 +110,11 @@ void QMakeJob::start()
build.mkpath(build.absolutePath());
}
m_process = new KProcess(this);
m_process = new QProcess(this);
m_process->setWorkingDirectory(m_buildDir);
m_process->setProgram(args);
m_process->setOutputChannelMode(KProcess::MergedChannels);
m_process->setProgram(m_qmakePath);
m_process->setArguments(args);
m_process->setProcessChannelMode(QProcess::MergedChannels);
auto lineMaker = new KDevelop::ProcessLineMaker(m_process, this);
connect(lineMaker, SIGNAL(receivedStdoutLines(QStringList)), m_model, SLOT(appendLines(QStringList)));
......
......@@ -30,7 +30,7 @@ namespace KDevelop {
class OutputModel;
}
class KProcess;
class QProcess;
class QMakeJob : public KDevelop::OutputJob
{
Q_OBJECT
......@@ -61,7 +61,7 @@ private:
QString m_installPrefix;
int m_buildType;
QString m_extraArguments;
KProcess* m_process;
QProcess* m_process;
KDevelop::OutputModel* m_model;
};
......
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