QNX: Export QnxDeviceConfiguration

Allow other plugins to use the existing Qnx device implementation.
Move QnxDeviceProcess into separate header/source files.

Change-Id: I3fe62aefbe8a71adf75acfc1a2c0c8ac1cc3d1e1
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
BogDan Vatra
2015-11-09 14:20:46 +02:00
parent 2dc660e698
commit aaaef7d1b2
8 changed files with 206 additions and 70 deletions

View File

@@ -35,11 +35,11 @@
#include "qnxdeviceprocesslist.h"
#include "qnxdeviceprocesssignaloperation.h"
#include "qnxdeployqtlibrariesdialog.h"
#include "qnxdeviceprocess.h"
#include <projectexplorer/devicesupport/sshdeviceprocess.h>
#include <ssh/sshconnection.h>
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
#include <QApplication>
#include <QRegExp>
@@ -50,51 +50,12 @@ using namespace ProjectExplorer;
using namespace Utils;
namespace Qnx {
namespace Internal {
using namespace Internal;
const char QnxVersionKey[] = "QnxVersion";
const char DeployQtLibrariesActionId [] = "Qnx.Qnx.DeployQtLibrariesAction";
static int pidFileCounter = 0;
QnxDeviceProcess::QnxDeviceProcess(const QSharedPointer<const IDevice> &device, QObject *parent)
: SshDeviceProcess(device, parent)
{
setEnvironment(Environment(OsTypeLinux));
m_pidFile = QString::fromLatin1("/var/run/qtc.%1.pid").arg(++pidFileCounter);
}
QString QnxDeviceProcess::fullCommandLine() const
{
QStringList args = arguments();
args.prepend(executable());
QString cmd = QtcProcess::Arguments::createUnixArgs(args).toString();
QString fullCommandLine = QLatin1String(
"test -f /etc/profile && . /etc/profile ; "
"test -f $HOME/profile && . $HOME/profile ; "
);
if (!m_workingDir.isEmpty())
fullCommandLine += QString::fromLatin1("cd %1 ; ").arg(QtcProcess::quoteArg(m_workingDir));
for (auto it = environment().constBegin(); it != environment().constEnd(); ++it)
fullCommandLine += QString::fromLatin1("%1='%2' ").arg(it.key()).arg(it.value());
fullCommandLine += QString::fromLatin1("%1 & echo $! > %2").arg(cmd).arg(m_pidFile);
return fullCommandLine;
}
void QnxDeviceProcess::doSignal(int sig)
{
auto signaler = new SshDeviceProcess(device(), this);
QString cmd = QString::fromLatin1("kill -%2 `cat %1`").arg(m_pidFile).arg(sig);
connect(signaler, &SshDeviceProcess::finished, signaler, &QObject::deleteLater);
signaler->start(cmd, QStringList());
}
class QnxPortsGatheringMethod : public PortsGatheringMethod
{
// TODO: The command is probably needlessly complicated because the parsing method
@@ -276,5 +237,4 @@ DeviceProcessSignalOperation::Ptr QnxDeviceConfiguration::signalOperation() cons
new QnxDeviceProcessSignalOperation(sshParameters()));
}
} // namespace Internal
} // namespace Qnx