forked from qt-creator/qt-creator
remotelinux/projectexplorer: move processlist closer to the core
Change-Id: Icc33981a625da093600273f84b681e79a5a4fa22 Reviewed-by: Christian Kandeler <christian.kandeler@nokia.com>
This commit is contained in:
@@ -32,13 +32,14 @@
|
|||||||
#include "maddedevicetester.h"
|
#include "maddedevicetester.h"
|
||||||
#include "maemoconstants.h"
|
#include "maemoconstants.h"
|
||||||
|
|
||||||
|
#include <projectexplorer/devicesupport/deviceprocessesdialog.h>
|
||||||
|
#include <projectexplorer/devicesupport/deviceprocesslist.h>
|
||||||
#include <remotelinux/linuxdevicetestdialog.h>
|
#include <remotelinux/linuxdevicetestdialog.h>
|
||||||
#include <remotelinux/publickeydeploymentdialog.h>
|
#include <remotelinux/publickeydeploymentdialog.h>
|
||||||
#include <remotelinux/remotelinuxprocessesdialog.h>
|
|
||||||
#include <remotelinux/remotelinuxprocesslist.h>
|
|
||||||
#include <remotelinux/remotelinux_constants.h>
|
#include <remotelinux/remotelinux_constants.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
|
using namespace ProjectExplorer;
|
||||||
using namespace RemoteLinux;
|
using namespace RemoteLinux;
|
||||||
|
|
||||||
namespace Madde {
|
namespace Madde {
|
||||||
@@ -106,14 +107,14 @@ void MaddeDevice::executeAction(Core::Id actionId, QWidget *parent) const
|
|||||||
QTC_ASSERT(actionIds().contains(actionId), return);
|
QTC_ASSERT(actionIds().contains(actionId), return);
|
||||||
|
|
||||||
QDialog *d = 0;
|
QDialog *d = 0;
|
||||||
const LinuxDeviceConfiguration::ConstPtr device
|
const IDevice::ConstPtr device = sharedFromThis();
|
||||||
= sharedFromThis().staticCast<const LinuxDeviceConfiguration>();
|
|
||||||
if (actionId == Core::Id(MaddeDeviceTestActionId))
|
if (actionId == Core::Id(MaddeDeviceTestActionId))
|
||||||
d = new LinuxDeviceTestDialog(device, new MaddeDeviceTester, parent);
|
d = new LinuxDeviceTestDialog(device, new MaddeDeviceTester, parent);
|
||||||
else if (actionId == Core::Id(MaddeRemoteProcessesActionId))
|
else if (actionId == Core::Id(MaddeRemoteProcessesActionId))
|
||||||
d = new RemoteLinuxProcessesDialog(new GenericRemoteLinuxProcessList(device), parent);
|
d = new DeviceProcessesDialog(new GenericLinuxProcessList(device), parent);
|
||||||
else if (actionId == Core::Id(Constants::GenericDeployKeyToDeviceActionId))
|
else if (actionId == Core::Id(Constants::GenericDeployKeyToDeviceActionId))
|
||||||
d = PublicKeyDeploymentDialog::createDialog(device, parent);
|
d = PublicKeyDeploymentDialog::createDialog(device, parent);
|
||||||
|
// FIXME: Leak?
|
||||||
if (d)
|
if (d)
|
||||||
d->exec();
|
d->exec();
|
||||||
}
|
}
|
||||||
|
@@ -27,26 +27,26 @@
|
|||||||
**
|
**
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "remotelinuxprocessesdialog.h"
|
#include "devicesupport/deviceprocessesdialog.h"
|
||||||
#include "ui_remotelinuxprocessesdialog.h"
|
#include "devicesupport/deviceprocesslist.h"
|
||||||
|
#include "ui_deviceprocessesdialog.h"
|
||||||
#include "remotelinuxprocesslist.h"
|
|
||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QSortFilterProxyModel>
|
#include <QSortFilterProxyModel>
|
||||||
|
|
||||||
namespace RemoteLinux {
|
namespace ProjectExplorer {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
class RemoteLinuxProcessesDialogPrivate
|
|
||||||
|
class DeviceProcessesDialogPrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RemoteLinuxProcessesDialogPrivate(AbstractRemoteLinuxProcessList *processList)
|
DeviceProcessesDialogPrivate(DeviceProcessList *processList)
|
||||||
: processList(processList)
|
: processList(processList)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Ui::RemoteLinuxProcessesDialog ui;
|
Ui::DeviceProcessesDialog ui;
|
||||||
AbstractRemoteLinuxProcessList * const processList;
|
DeviceProcessList * const processList;
|
||||||
QSortFilterProxyModel proxyModel;
|
QSortFilterProxyModel proxyModel;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -54,9 +54,8 @@ public:
|
|||||||
|
|
||||||
using namespace Internal;
|
using namespace Internal;
|
||||||
|
|
||||||
RemoteLinuxProcessesDialog::RemoteLinuxProcessesDialog(AbstractRemoteLinuxProcessList *processList,
|
DeviceProcessesDialog::DeviceProcessesDialog(DeviceProcessList *processList, QWidget *parent)
|
||||||
QWidget *parent)
|
: QDialog(parent), d(new DeviceProcessesDialogPrivate(processList))
|
||||||
: QDialog(parent), d(new RemoteLinuxProcessesDialogPrivate(processList))
|
|
||||||
{
|
{
|
||||||
processList->setParent(this);
|
processList->setParent(this);
|
||||||
|
|
||||||
@@ -88,32 +87,32 @@ RemoteLinuxProcessesDialog::RemoteLinuxProcessesDialog(AbstractRemoteLinuxProces
|
|||||||
updateProcessList();
|
updateProcessList();
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoteLinuxProcessesDialog::~RemoteLinuxProcessesDialog()
|
DeviceProcessesDialog::~DeviceProcessesDialog()
|
||||||
{
|
{
|
||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteLinuxProcessesDialog::handleRemoteError(const QString &errorMsg)
|
void DeviceProcessesDialog::handleRemoteError(const QString &errorMsg)
|
||||||
{
|
{
|
||||||
QMessageBox::critical(this, tr("Remote Error"), errorMsg);
|
QMessageBox::critical(this, tr("Remote Error"), errorMsg);
|
||||||
d->ui.updateListButton->setEnabled(true);
|
d->ui.updateListButton->setEnabled(true);
|
||||||
handleSelectionChanged();
|
handleSelectionChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteLinuxProcessesDialog::handleProcessListUpdated()
|
void DeviceProcessesDialog::handleProcessListUpdated()
|
||||||
{
|
{
|
||||||
d->ui.updateListButton->setEnabled(true);
|
d->ui.updateListButton->setEnabled(true);
|
||||||
handleSelectionChanged();
|
handleSelectionChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteLinuxProcessesDialog::updateProcessList()
|
void DeviceProcessesDialog::updateProcessList()
|
||||||
{
|
{
|
||||||
d->ui.updateListButton->setEnabled(false);
|
d->ui.updateListButton->setEnabled(false);
|
||||||
d->ui.killProcessButton->setEnabled(false);
|
d->ui.killProcessButton->setEnabled(false);
|
||||||
d->processList->update();
|
d->processList->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteLinuxProcessesDialog::killProcess()
|
void DeviceProcessesDialog::killProcess()
|
||||||
{
|
{
|
||||||
const QModelIndexList &indexes
|
const QModelIndexList &indexes
|
||||||
= d->ui.treeView->selectionModel()->selectedIndexes();
|
= d->ui.treeView->selectionModel()->selectedIndexes();
|
||||||
@@ -124,12 +123,12 @@ void RemoteLinuxProcessesDialog::killProcess()
|
|||||||
d->processList->killProcess(d->proxyModel.mapToSource(indexes.first()).row());
|
d->processList->killProcess(d->proxyModel.mapToSource(indexes.first()).row());
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteLinuxProcessesDialog::handleProcessKilled()
|
void DeviceProcessesDialog::handleProcessKilled()
|
||||||
{
|
{
|
||||||
updateProcessList();
|
updateProcessList();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteLinuxProcessesDialog::handleSelectionChanged()
|
void DeviceProcessesDialog::handleSelectionChanged()
|
||||||
{
|
{
|
||||||
d->ui.killProcessButton->setEnabled(d->ui.treeView->selectionModel()->hasSelection());
|
d->ui.killProcessButton->setEnabled(d->ui.treeView->selectionModel()->hasSelection());
|
||||||
}
|
}
|
@@ -26,28 +26,28 @@
|
|||||||
**
|
**
|
||||||
**
|
**
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
#ifndef REMOTELINUXPROCESSESDIALOG_H
|
|
||||||
#define REMOTELINUXPROCESSESDIALOG_H
|
|
||||||
|
|
||||||
#include "remotelinux_export.h"
|
#ifndef DEVICEPROCESSESDIALOG_H
|
||||||
|
#define DEVICEPROCESSESDIALOG_H
|
||||||
|
|
||||||
|
#include "../projectexplorer_export.h"
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
namespace RemoteLinux {
|
namespace ProjectExplorer {
|
||||||
class AbstractRemoteLinuxProcessList;
|
|
||||||
|
|
||||||
namespace Internal {
|
class DeviceProcessList;
|
||||||
class RemoteLinuxProcessesDialogPrivate;
|
|
||||||
} // namespace Internal
|
|
||||||
|
|
||||||
class REMOTELINUX_EXPORT RemoteLinuxProcessesDialog : public QDialog
|
namespace Internal { class DeviceProcessesDialogPrivate; }
|
||||||
|
|
||||||
|
class PROJECTEXPLORER_EXPORT DeviceProcessesDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Note: The dialog takes ownership of processList.
|
// Note: The dialog takes ownership of processList.
|
||||||
explicit RemoteLinuxProcessesDialog(AbstractRemoteLinuxProcessList *processList,
|
explicit DeviceProcessesDialog(DeviceProcessList *processList, QWidget *parent = 0);
|
||||||
QWidget *parent = 0);
|
~DeviceProcessesDialog();
|
||||||
~RemoteLinuxProcessesDialog();
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updateProcessList();
|
void updateProcessList();
|
||||||
@@ -58,7 +58,7 @@ private slots:
|
|||||||
void handleSelectionChanged();
|
void handleSelectionChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Internal::RemoteLinuxProcessesDialogPrivate * const d;
|
Internal::DeviceProcessesDialogPrivate * const d;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace RemoteLinux
|
} // namespace RemoteLinux
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>RemoteLinux::Internal::RemoteLinuxProcessesDialog</class>
|
<class>ProjectExplorer::Internal::DeviceProcessesDialog</class>
|
||||||
<widget class="QDialog" name="RemoteLinux::Internal::RemoteLinuxProcessesDialog">
|
<widget class="QDialog" name="ProjectExplorer::Internal::DeviceProcessesDialog">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
@@ -99,7 +99,7 @@
|
|||||||
<connection>
|
<connection>
|
||||||
<sender>buttonBox</sender>
|
<sender>buttonBox</sender>
|
||||||
<signal>accepted()</signal>
|
<signal>accepted()</signal>
|
||||||
<receiver>RemoteLinux::Internal::RemoteLinuxProcessesDialog</receiver>
|
<receiver>ProjectExplorer::Internal::DeviceProcessesDialog</receiver>
|
||||||
<slot>accept()</slot>
|
<slot>accept()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
@@ -115,7 +115,7 @@
|
|||||||
<connection>
|
<connection>
|
||||||
<sender>buttonBox</sender>
|
<sender>buttonBox</sender>
|
||||||
<signal>rejected()</signal>
|
<signal>rejected()</signal>
|
||||||
<receiver>RemoteLinux::Internal::RemoteLinuxProcessesDialog</receiver>
|
<receiver>ProjectExplorer::Internal::DeviceProcessesDialog</receiver>
|
||||||
<slot>reject()</slot>
|
<slot>reject()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
@@ -27,41 +27,36 @@
|
|||||||
**
|
**
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "remotelinuxprocesslist.h"
|
#include "deviceprocesslist.h"
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <ssh/sshremoteprocessrunner.h>
|
#include <ssh/sshremoteprocessrunner.h>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
|
||||||
using namespace QSsh;
|
using namespace QSsh;
|
||||||
|
|
||||||
namespace RemoteLinux {
|
namespace ProjectExplorer {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
namespace {
|
|
||||||
enum State { Inactive, Listing, Killing };
|
enum State { Inactive, Listing, Killing };
|
||||||
const char Delimiter0[] = "x--";
|
const char Delimiter0[] = "x--";
|
||||||
const char Delimiter1[] = "---";
|
const char Delimiter1[] = "---";
|
||||||
} // anonymous namespace
|
|
||||||
|
|
||||||
static QString visualizeNull(QString s)
|
static QString visualizeNull(QString s)
|
||||||
{
|
{
|
||||||
return s.replace(QLatin1Char('\0'), QLatin1String("<null>"));
|
return s.replace(QLatin1Char('\0'), QLatin1String("<null>"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class DeviceProcessListPrivate
|
||||||
class AbstractRemoteLinuxProcessListPrivate
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AbstractRemoteLinuxProcessListPrivate(const IDevice::ConstPtr &devConf)
|
DeviceProcessListPrivate(const IDevice::ConstPtr &devConf)
|
||||||
: deviceConfiguration(devConf),
|
: deviceConfiguration(devConf),
|
||||||
state(Inactive)
|
state(Inactive)
|
||||||
{
|
{ }
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const IDevice::ConstPtr deviceConfiguration;
|
const IDevice::ConstPtr deviceConfiguration;
|
||||||
SshRemoteProcessRunner process;
|
SshRemoteProcessRunner process;
|
||||||
QList<RemoteProcess> remoteProcesses;
|
QList<DeviceProcess> remoteProcesses;
|
||||||
QString errorMsg;
|
QString errorMsg;
|
||||||
State state;
|
State state;
|
||||||
};
|
};
|
||||||
@@ -70,18 +65,17 @@ public:
|
|||||||
|
|
||||||
using namespace Internal;
|
using namespace Internal;
|
||||||
|
|
||||||
AbstractRemoteLinuxProcessList::AbstractRemoteLinuxProcessList(const IDevice::ConstPtr &devConfig,
|
DeviceProcessList::DeviceProcessList(const IDevice::ConstPtr &devConfig, QObject *parent)
|
||||||
QObject *parent)
|
: QAbstractTableModel(parent), d(new DeviceProcessListPrivate(devConfig))
|
||||||
: QAbstractTableModel(parent), d(new AbstractRemoteLinuxProcessListPrivate(devConfig))
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractRemoteLinuxProcessList::~AbstractRemoteLinuxProcessList()
|
DeviceProcessList::~DeviceProcessList()
|
||||||
{
|
{
|
||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractRemoteLinuxProcessList::update()
|
void DeviceProcessList::update()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(d->state == Inactive, return);
|
QTC_ASSERT(d->state == Inactive, return);
|
||||||
|
|
||||||
@@ -94,7 +88,7 @@ void AbstractRemoteLinuxProcessList::update()
|
|||||||
startProcess(listProcessesCommandLine());
|
startProcess(listProcessesCommandLine());
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractRemoteLinuxProcessList::killProcess(int row)
|
void DeviceProcessList::killProcess(int row)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(row >= 0 && row < d->remoteProcesses.count(), return);
|
QTC_ASSERT(row >= 0 && row < d->remoteProcesses.count(), return);
|
||||||
QTC_ASSERT(d->state == Inactive, return);
|
QTC_ASSERT(d->state == Inactive, return);
|
||||||
@@ -103,19 +97,19 @@ void AbstractRemoteLinuxProcessList::killProcess(int row)
|
|||||||
startProcess(killProcessCommandLine(d->remoteProcesses.at(row)));
|
startProcess(killProcessCommandLine(d->remoteProcesses.at(row)));
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoteProcess AbstractRemoteLinuxProcessList::at(int row) const
|
DeviceProcess DeviceProcessList::at(int row) const
|
||||||
{
|
{
|
||||||
return d->remoteProcesses.at(row);
|
return d->remoteProcesses.at(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
int AbstractRemoteLinuxProcessList::rowCount(const QModelIndex &parent) const
|
int DeviceProcessList::rowCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
return parent.isValid() ? 0 : d->remoteProcesses.count();
|
return parent.isValid() ? 0 : d->remoteProcesses.count();
|
||||||
}
|
}
|
||||||
|
|
||||||
int AbstractRemoteLinuxProcessList::columnCount(const QModelIndex &) const { return 2; }
|
int DeviceProcessList::columnCount(const QModelIndex &) const { return 2; }
|
||||||
|
|
||||||
QVariant AbstractRemoteLinuxProcessList::headerData(int section, Qt::Orientation orientation,
|
QVariant DeviceProcessList::headerData(int section, Qt::Orientation orientation,
|
||||||
int role) const
|
int role) const
|
||||||
{
|
{
|
||||||
if (orientation != Qt::Horizontal || role != Qt::DisplayRole || section < 0
|
if (orientation != Qt::Horizontal || role != Qt::DisplayRole || section < 0
|
||||||
@@ -124,14 +118,14 @@ QVariant AbstractRemoteLinuxProcessList::headerData(int section, Qt::Orientation
|
|||||||
return section == 0? tr("PID") : tr("Command Line");
|
return section == 0? tr("PID") : tr("Command Line");
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant AbstractRemoteLinuxProcessList::data(const QModelIndex &index, int role) const
|
QVariant DeviceProcessList::data(const QModelIndex &index, int role) const
|
||||||
{
|
{
|
||||||
if (!index.isValid() || index.row() >= rowCount(index.parent())
|
if (!index.isValid() || index.row() >= rowCount(index.parent())
|
||||||
|| index.column() >= columnCount())
|
|| index.column() >= columnCount())
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
if (role == Qt::DisplayRole || role == Qt::ToolTipRole) {
|
if (role == Qt::DisplayRole || role == Qt::ToolTipRole) {
|
||||||
const RemoteProcess &proc = d->remoteProcesses.at(index.row());
|
const DeviceProcess &proc = d->remoteProcesses.at(index.row());
|
||||||
if (index.column() == 0)
|
if (index.column() == 0)
|
||||||
return proc.pid;
|
return proc.pid;
|
||||||
else
|
else
|
||||||
@@ -140,7 +134,7 @@ QVariant AbstractRemoteLinuxProcessList::data(const QModelIndex &index, int role
|
|||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractRemoteLinuxProcessList::handleConnectionError()
|
void DeviceProcessList::handleConnectionError()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(d->state != Inactive, return);
|
QTC_ASSERT(d->state != Inactive, return);
|
||||||
|
|
||||||
@@ -151,7 +145,7 @@ void AbstractRemoteLinuxProcessList::handleConnectionError()
|
|||||||
setFinished();
|
setFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractRemoteLinuxProcessList::handleRemoteProcessFinished(int exitStatus)
|
void DeviceProcessList::handleRemoteProcessFinished(int exitStatus)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(d->state != Inactive, return);
|
QTC_ASSERT(d->state != Inactive, return);
|
||||||
|
|
||||||
@@ -169,7 +163,7 @@ void AbstractRemoteLinuxProcessList::handleRemoteProcessFinished(int exitStatus)
|
|||||||
if (d->state == Listing) {
|
if (d->state == Listing) {
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
const QByteArray remoteStdout = d->process.readAllStandardOutput();
|
const QByteArray remoteStdout = d->process.readAllStandardOutput();
|
||||||
QList<RemoteProcess> processes = buildProcessList(QString::fromUtf8(remoteStdout.data(),
|
QList<DeviceProcess> processes = buildProcessList(QString::fromUtf8(remoteStdout.data(),
|
||||||
remoteStdout.count()));
|
remoteStdout.count()));
|
||||||
if (!processes.isEmpty()) {
|
if (!processes.isEmpty()) {
|
||||||
beginInsertRows(QModelIndex(), 0, processes.count()-1);
|
beginInsertRows(QModelIndex(), 0, processes.count()-1);
|
||||||
@@ -200,7 +194,7 @@ void AbstractRemoteLinuxProcessList::handleRemoteProcessFinished(int exitStatus)
|
|||||||
setFinished();
|
setFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractRemoteLinuxProcessList::startProcess(const QString &cmdLine)
|
void DeviceProcessList::startProcess(const QString &cmdLine)
|
||||||
{
|
{
|
||||||
connect(&d->process, SIGNAL(connectionError()), SLOT(handleConnectionError()));
|
connect(&d->process, SIGNAL(connectionError()), SLOT(handleConnectionError()));
|
||||||
connect(&d->process, SIGNAL(processClosed(int)),
|
connect(&d->process, SIGNAL(processClosed(int)),
|
||||||
@@ -209,20 +203,20 @@ void AbstractRemoteLinuxProcessList::startProcess(const QString &cmdLine)
|
|||||||
d->process.run(cmdLine.toUtf8(), d->deviceConfiguration->sshParameters());
|
d->process.run(cmdLine.toUtf8(), d->deviceConfiguration->sshParameters());
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractRemoteLinuxProcessList::setFinished()
|
void DeviceProcessList::setFinished()
|
||||||
{
|
{
|
||||||
disconnect(&d->process, 0, this, 0);
|
disconnect(&d->process, 0, this, 0);
|
||||||
d->state = Inactive;
|
d->state = Inactive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GenericRemoteLinuxProcessList::GenericRemoteLinuxProcessList(const IDevice::ConstPtr &devConfig,
|
GenericLinuxProcessList::GenericLinuxProcessList(const IDevice::ConstPtr &devConfig,
|
||||||
QObject *parent)
|
QObject *parent)
|
||||||
: AbstractRemoteLinuxProcessList(devConfig, parent)
|
: DeviceProcessList(devConfig, parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GenericRemoteLinuxProcessList::listProcessesCommandLine() const
|
QString GenericLinuxProcessList::listProcessesCommandLine() const
|
||||||
{
|
{
|
||||||
return QString::fromLatin1(
|
return QString::fromLatin1(
|
||||||
"for dir in `ls -d /proc/[0123456789]*`; do "
|
"for dir in `ls -d /proc/[0123456789]*`; do "
|
||||||
@@ -235,14 +229,14 @@ QString GenericRemoteLinuxProcessList::listProcessesCommandLine() const
|
|||||||
"done").arg(Delimiter0).arg(Delimiter1);
|
"done").arg(Delimiter0).arg(Delimiter1);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GenericRemoteLinuxProcessList::killProcessCommandLine(const RemoteProcess &process) const
|
QString GenericLinuxProcessList::killProcessCommandLine(const DeviceProcess &process) const
|
||||||
{
|
{
|
||||||
return QLatin1String("kill -9 ") + QString::number(process.pid);
|
return QLatin1String("kill -9 ") + QString::number(process.pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<RemoteProcess> GenericRemoteLinuxProcessList::buildProcessList(const QString &listProcessesReply) const
|
QList<DeviceProcess> GenericLinuxProcessList::buildProcessList(const QString &listProcessesReply) const
|
||||||
{
|
{
|
||||||
QList<RemoteProcess> processes;
|
QList<DeviceProcess> processes;
|
||||||
const QStringList lines = listProcessesReply.split(QString::fromLatin1(Delimiter0)
|
const QStringList lines = listProcessesReply.split(QString::fromLatin1(Delimiter0)
|
||||||
+ QString::fromLatin1(Delimiter1), QString::SkipEmptyParts);
|
+ QString::fromLatin1(Delimiter1), QString::SkipEmptyParts);
|
||||||
foreach (const QString &line, lines) {
|
foreach (const QString &line, lines) {
|
||||||
@@ -272,7 +266,7 @@ QList<RemoteProcess> GenericRemoteLinuxProcessList::buildProcessList(const QStri
|
|||||||
+ QLatin1Char(']');
|
+ QLatin1Char(']');
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoteProcess process;
|
DeviceProcess process;
|
||||||
process.pid = pid;
|
process.pid = pid;
|
||||||
process.cmdLine = command;
|
process.cmdLine = command;
|
||||||
process.exe = elements.at(3);
|
process.exe = elements.at(3);
|
||||||
@@ -283,7 +277,7 @@ QList<RemoteProcess> GenericRemoteLinuxProcessList::buildProcessList(const QStri
|
|||||||
return processes;
|
return processes;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RemoteProcess::operator <(const RemoteProcess &other) const
|
bool DeviceProcess::operator <(const DeviceProcess &other) const
|
||||||
{
|
{
|
||||||
if (pid != other.pid)
|
if (pid != other.pid)
|
||||||
return pid < other.pid;
|
return pid < other.pid;
|
||||||
@@ -292,4 +286,4 @@ bool RemoteProcess::operator <(const RemoteProcess &other) const
|
|||||||
return cmdLine < other.cmdLine;
|
return cmdLine < other.cmdLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace RemoteLinux
|
} // namespace ProjectExplorer
|
@@ -26,44 +26,43 @@
|
|||||||
**
|
**
|
||||||
**
|
**
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
#ifndef REMOTELINUXPROCESSLIST_H
|
|
||||||
#define REMOTELINUXPROCESSLIST_H
|
|
||||||
|
|
||||||
#include "remotelinux_export.h"
|
#ifndef DEVICEPROCESSLIST_H
|
||||||
|
#define DEVICEPROCESSLIST_H
|
||||||
|
|
||||||
#include <projectexplorer/devicesupport/idevice.h>
|
#include "idevice.h"
|
||||||
|
|
||||||
#include <QAbstractTableModel>
|
#include <QAbstractTableModel>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
|
|
||||||
namespace RemoteLinux {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
class AbstractRemoteLinuxProcessListPrivate;
|
class DeviceProcessListPrivate;
|
||||||
}
|
}
|
||||||
|
|
||||||
class REMOTELINUX_EXPORT RemoteProcess
|
class PROJECTEXPLORER_EXPORT DeviceProcess
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RemoteProcess() : pid(0) {}
|
DeviceProcess() : pid(0) {}
|
||||||
bool operator<(const RemoteProcess &other) const;
|
bool operator<(const DeviceProcess &other) const;
|
||||||
|
|
||||||
int pid;
|
int pid;
|
||||||
QString cmdLine;
|
QString cmdLine;
|
||||||
QString exe;
|
QString exe;
|
||||||
};
|
};
|
||||||
|
|
||||||
class REMOTELINUX_EXPORT AbstractRemoteLinuxProcessList : public QAbstractTableModel
|
class PROJECTEXPLORER_EXPORT DeviceProcessList : public QAbstractTableModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
friend class Internal::AbstractRemoteLinuxProcessListPrivate;
|
friend class Internal::DeviceProcessListPrivate;
|
||||||
public:
|
public:
|
||||||
~AbstractRemoteLinuxProcessList();
|
~DeviceProcessList();
|
||||||
|
|
||||||
void update();
|
void update();
|
||||||
void killProcess(int row);
|
void killProcess(int row);
|
||||||
RemoteProcess at(int row) const;
|
DeviceProcess at(int row) const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void processListUpdated();
|
void processListUpdated();
|
||||||
@@ -71,8 +70,7 @@ signals:
|
|||||||
void processKilled();
|
void processKilled();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
AbstractRemoteLinuxProcessList(const ProjectExplorer::IDevice::ConstPtr &devConfig,
|
DeviceProcessList(const IDevice::ConstPtr &devConfig, QObject *parent = 0);
|
||||||
QObject *parent = 0);
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void handleConnectionError();
|
void handleConnectionError();
|
||||||
@@ -86,29 +84,30 @@ private:
|
|||||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||||
|
|
||||||
virtual QString listProcessesCommandLine() const = 0;
|
virtual QString listProcessesCommandLine() const = 0;
|
||||||
virtual QString killProcessCommandLine(const RemoteProcess &process) const = 0;
|
virtual QString killProcessCommandLine(const DeviceProcess &process) const = 0;
|
||||||
virtual QList<RemoteProcess> buildProcessList(const QString &listProcessesReply) const = 0;
|
virtual QList<DeviceProcess> buildProcessList(const QString &listProcessesReply) const = 0;
|
||||||
|
|
||||||
void startProcess(const QString &cmdLine);
|
void startProcess(const QString &cmdLine);
|
||||||
void setFinished();
|
void setFinished();
|
||||||
|
|
||||||
Internal::AbstractRemoteLinuxProcessListPrivate * const d;
|
Internal::DeviceProcessListPrivate * const d;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class REMOTELINUX_EXPORT GenericRemoteLinuxProcessList : public AbstractRemoteLinuxProcessList
|
class PROJECTEXPLORER_EXPORT GenericLinuxProcessList : public DeviceProcessList
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GenericRemoteLinuxProcessList(const ProjectExplorer::IDevice::ConstPtr &devConfig,
|
GenericLinuxProcessList(const IDevice::ConstPtr &devConfig,
|
||||||
QObject *parent = 0);
|
QObject *parent = 0);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QString listProcessesCommandLine() const;
|
QString listProcessesCommandLine() const;
|
||||||
QString killProcessCommandLine(const RemoteProcess &process) const;
|
QString killProcessCommandLine(const DeviceProcess &process) const;
|
||||||
QList<RemoteProcess> buildProcessList(const QString &listProcessesReply) const;
|
QList<DeviceProcess> buildProcessList(const QString &listProcessesReply) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace RemoteLinux
|
} // namespace ProjectExplorer
|
||||||
|
|
||||||
#endif // REMOTELINUXPROCESSLIST_H
|
#endif // DEVICEPROCESSLIST_H
|
@@ -121,6 +121,8 @@ HEADERS += projectexplorer.h \
|
|||||||
devicesupport/devicemanager.h \
|
devicesupport/devicemanager.h \
|
||||||
devicesupport/devicemanagermodel.h \
|
devicesupport/devicemanagermodel.h \
|
||||||
devicesupport/devicefactoryselectiondialog.h \
|
devicesupport/devicefactoryselectiondialog.h \
|
||||||
|
devicesupport/deviceprocesslist.h \
|
||||||
|
devicesupport/deviceprocessesdialog.h \
|
||||||
devicesupport/devicesettingswidget.h \
|
devicesupport/devicesettingswidget.h \
|
||||||
devicesupport/devicesettingspage.h
|
devicesupport/devicesettingspage.h
|
||||||
|
|
||||||
@@ -220,6 +222,8 @@ SOURCES += projectexplorer.cpp \
|
|||||||
devicesupport/devicemanager.cpp \
|
devicesupport/devicemanager.cpp \
|
||||||
devicesupport/devicemanagermodel.cpp \
|
devicesupport/devicemanagermodel.cpp \
|
||||||
devicesupport/devicefactoryselectiondialog.cpp \
|
devicesupport/devicefactoryselectiondialog.cpp \
|
||||||
|
devicesupport/deviceprocesslist.cpp \
|
||||||
|
devicesupport/deviceprocessesdialog.cpp \
|
||||||
devicesupport/devicesettingswidget.cpp \
|
devicesupport/devicesettingswidget.cpp \
|
||||||
devicesupport/devicesettingspage.cpp
|
devicesupport/devicesettingspage.cpp
|
||||||
|
|
||||||
@@ -233,6 +237,7 @@ FORMS += processstep.ui \
|
|||||||
publishing/publishingwizardselectiondialog.ui \
|
publishing/publishingwizardselectiondialog.ui \
|
||||||
codestylesettingspropertiespage.ui \
|
codestylesettingspropertiespage.ui \
|
||||||
devicesupport/devicefactoryselectiondialog.ui \
|
devicesupport/devicefactoryselectiondialog.ui \
|
||||||
|
devicesupport/deviceprocessesdialog.ui \
|
||||||
devicesupport/devicesettingswidget.ui
|
devicesupport/devicesettingswidget.ui
|
||||||
|
|
||||||
WINSOURCES += \
|
WINSOURCES += \
|
||||||
|
@@ -296,6 +296,11 @@ QtcPlugin {
|
|||||||
"devicesupport/devicefactoryselectiondialog.cpp",
|
"devicesupport/devicefactoryselectiondialog.cpp",
|
||||||
"devicesupport/devicefactoryselectiondialog.h",
|
"devicesupport/devicefactoryselectiondialog.h",
|
||||||
"devicesupport/devicefactoryselectiondialog.ui",
|
"devicesupport/devicefactoryselectiondialog.ui",
|
||||||
|
"devicesupport/deviceprocesslist.cpp",
|
||||||
|
"devicesupport/deviceprocesslist.h",
|
||||||
|
"devicesupport/deviceprocessesdialog.cpp",
|
||||||
|
"devicesupport/deviceprocessesdialog.h",
|
||||||
|
"devicesupport/deviceprocessesdialog.ui",
|
||||||
"devicesupport/devicesettingswidget.cpp",
|
"devicesupport/devicesettingswidget.cpp",
|
||||||
"devicesupport/devicesettingswidget.h",
|
"devicesupport/devicesettingswidget.h",
|
||||||
"devicesupport/devicesettingswidget.ui",
|
"devicesupport/devicesettingswidget.ui",
|
||||||
|
@@ -33,16 +33,17 @@
|
|||||||
#include "genericlinuxdeviceconfigurationwidget.h"
|
#include "genericlinuxdeviceconfigurationwidget.h"
|
||||||
#include "linuxdevicetestdialog.h"
|
#include "linuxdevicetestdialog.h"
|
||||||
#include "publickeydeploymentdialog.h"
|
#include "publickeydeploymentdialog.h"
|
||||||
#include "remotelinuxprocessesdialog.h"
|
|
||||||
#include "remotelinuxprocesslist.h"
|
|
||||||
#include "remotelinux_constants.h"
|
#include "remotelinux_constants.h"
|
||||||
|
|
||||||
#include <coreplugin/id.h>
|
#include <coreplugin/id.h>
|
||||||
|
#include <projectexplorer/devicesupport/deviceprocesslist.h>
|
||||||
#include <utils/portlist.h>
|
#include <projectexplorer/devicesupport/deviceprocessesdialog.h>
|
||||||
#include <ssh/sshconnection.h>
|
#include <ssh/sshconnection.h>
|
||||||
|
#include <utils/portlist.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
namespace RemoteLinux {
|
namespace RemoteLinux {
|
||||||
|
|
||||||
LinuxDeviceConfiguration::Ptr LinuxDeviceConfiguration::create(const QString &name,
|
LinuxDeviceConfiguration::Ptr LinuxDeviceConfiguration::create(const QString &name,
|
||||||
@@ -92,7 +93,7 @@ void LinuxDeviceConfiguration::executeAction(Core::Id actionId, QWidget *parent)
|
|||||||
if (actionId == Core::Id(Constants::GenericTestDeviceActionId))
|
if (actionId == Core::Id(Constants::GenericTestDeviceActionId))
|
||||||
d = new LinuxDeviceTestDialog(device, new GenericLinuxDeviceTester, parent);
|
d = new LinuxDeviceTestDialog(device, new GenericLinuxDeviceTester, parent);
|
||||||
else if (actionId == Core::Id(Constants::GenericRemoteProcessesActionId))
|
else if (actionId == Core::Id(Constants::GenericRemoteProcessesActionId))
|
||||||
d = new RemoteLinuxProcessesDialog(new GenericRemoteLinuxProcessList(device, parent));
|
d = new DeviceProcessesDialog(new GenericLinuxProcessList(device, parent));
|
||||||
else if (actionId == Core::Id(Constants::GenericDeployKeyToDeviceActionId))
|
else if (actionId == Core::Id(Constants::GenericDeployKeyToDeviceActionId))
|
||||||
d = PublicKeyDeploymentDialog::createDialog(device, parent);
|
d = PublicKeyDeploymentDialog::createDialog(device, parent);
|
||||||
if (d)
|
if (d)
|
||||||
|
@@ -41,8 +41,6 @@ HEADERS += \
|
|||||||
linuxdevicetester.h \
|
linuxdevicetester.h \
|
||||||
remotelinux_constants.h \
|
remotelinux_constants.h \
|
||||||
linuxdevicetestdialog.h \
|
linuxdevicetestdialog.h \
|
||||||
remotelinuxprocesslist.h \
|
|
||||||
remotelinuxprocessesdialog.h \
|
|
||||||
remotelinuxenvironmentreader.h \
|
remotelinuxenvironmentreader.h \
|
||||||
sshkeydeployer.h \
|
sshkeydeployer.h \
|
||||||
typespecificdeviceconfigurationlistmodel.h \
|
typespecificdeviceconfigurationlistmodel.h \
|
||||||
@@ -91,8 +89,6 @@ SOURCES += \
|
|||||||
packageuploader.cpp \
|
packageuploader.cpp \
|
||||||
linuxdevicetester.cpp \
|
linuxdevicetester.cpp \
|
||||||
linuxdevicetestdialog.cpp \
|
linuxdevicetestdialog.cpp \
|
||||||
remotelinuxprocesslist.cpp \
|
|
||||||
remotelinuxprocessesdialog.cpp \
|
|
||||||
remotelinuxenvironmentreader.cpp \
|
remotelinuxenvironmentreader.cpp \
|
||||||
sshkeydeployer.cpp \
|
sshkeydeployer.cpp \
|
||||||
typespecificdeviceconfigurationlistmodel.cpp \
|
typespecificdeviceconfigurationlistmodel.cpp \
|
||||||
@@ -111,7 +107,6 @@ SOURCES += \
|
|||||||
FORMS += \
|
FORMS += \
|
||||||
genericlinuxdeviceconfigurationwizardsetuppage.ui \
|
genericlinuxdeviceconfigurationwizardsetuppage.ui \
|
||||||
linuxdevicetestdialog.ui \
|
linuxdevicetestdialog.ui \
|
||||||
remotelinuxprocessesdialog.ui \
|
|
||||||
remotelinuxdeployconfigurationwidget.ui \
|
remotelinuxdeployconfigurationwidget.ui \
|
||||||
profilesupdatedialog.ui \
|
profilesupdatedialog.ui \
|
||||||
genericlinuxdeviceconfigurationwidget.ui \
|
genericlinuxdeviceconfigurationwidget.ui \
|
||||||
|
@@ -80,9 +80,6 @@ QtcPlugin {
|
|||||||
"remotelinuxpackageinstaller.cpp",
|
"remotelinuxpackageinstaller.cpp",
|
||||||
"remotelinuxplugin.cpp",
|
"remotelinuxplugin.cpp",
|
||||||
"remotelinuxplugin.h",
|
"remotelinuxplugin.h",
|
||||||
"remotelinuxprocessesdialog.cpp",
|
|
||||||
"remotelinuxprocesslist.cpp",
|
|
||||||
"remotelinuxprocesslist.h",
|
|
||||||
"remotelinuxrunconfiguration.cpp",
|
"remotelinuxrunconfiguration.cpp",
|
||||||
"remotelinuxrunconfiguration.h",
|
"remotelinuxrunconfiguration.h",
|
||||||
"remotelinuxrunconfigurationfactory.cpp",
|
"remotelinuxrunconfigurationfactory.cpp",
|
||||||
@@ -108,8 +105,6 @@ QtcPlugin {
|
|||||||
"remotelinuxenvironmentreader.cpp",
|
"remotelinuxenvironmentreader.cpp",
|
||||||
"remotelinuxenvironmentreader.h",
|
"remotelinuxenvironmentreader.h",
|
||||||
"remotelinuxpackageinstaller.h",
|
"remotelinuxpackageinstaller.h",
|
||||||
"remotelinuxprocessesdialog.h",
|
|
||||||
"remotelinuxprocessesdialog.ui",
|
|
||||||
"remotelinuxusedportsgatherer.h",
|
"remotelinuxusedportsgatherer.h",
|
||||||
"sshkeydeployer.cpp",
|
"sshkeydeployer.cpp",
|
||||||
"sshkeydeployer.h",
|
"sshkeydeployer.h",
|
||||||
|
@@ -30,13 +30,13 @@
|
|||||||
|
|
||||||
#include "startgdbserverdialog.h"
|
#include "startgdbserverdialog.h"
|
||||||
|
|
||||||
#include "remotelinuxprocesslist.h"
|
|
||||||
#include "remotelinuxusedportsgatherer.h"
|
#include "remotelinuxusedportsgatherer.h"
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include <projectexplorer/profilechooser.h>
|
#include <projectexplorer/profilechooser.h>
|
||||||
#include <projectexplorer/profileinformation.h>
|
#include <projectexplorer/profileinformation.h>
|
||||||
|
#include <projectexplorer/devicesupport/deviceprocesslist.h>
|
||||||
#include <utils/pathchooser.h>
|
#include <utils/pathchooser.h>
|
||||||
#include <utils/portlist.h>
|
#include <utils/portlist.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
@@ -91,7 +91,7 @@ public:
|
|||||||
|
|
||||||
StartGdbServerDialog *q;
|
StartGdbServerDialog *q;
|
||||||
bool startServerOnly;
|
bool startServerOnly;
|
||||||
AbstractRemoteLinuxProcessList *processList;
|
DeviceProcessList *processList;
|
||||||
QSortFilterProxyModel proxyModel;
|
QSortFilterProxyModel proxyModel;
|
||||||
|
|
||||||
QLineEdit *processFilterLineEdit;
|
QLineEdit *processFilterLineEdit;
|
||||||
@@ -206,7 +206,7 @@ void StartGdbServerDialog::attachToDevice()
|
|||||||
if (!device)
|
if (!device)
|
||||||
return;
|
return;
|
||||||
delete d->processList;
|
delete d->processList;
|
||||||
d->processList = new GenericRemoteLinuxProcessList(device);
|
d->processList = new GenericLinuxProcessList(device);
|
||||||
d->proxyModel.setSourceModel(d->processList);
|
d->proxyModel.setSourceModel(d->processList);
|
||||||
connect(d->processList, SIGNAL(error(QString)),
|
connect(d->processList, SIGNAL(error(QString)),
|
||||||
SLOT(handleRemoteError(QString)));
|
SLOT(handleRemoteError(QString)));
|
||||||
@@ -253,7 +253,7 @@ void StartGdbServerDialog::attachToProcess()
|
|||||||
const int port = d->gatherer.getNextFreePort(&ports);
|
const int port = d->gatherer.getNextFreePort(&ports);
|
||||||
const int row = d->proxyModel.mapToSource(indexes.first()).row();
|
const int row = d->proxyModel.mapToSource(indexes.first()).row();
|
||||||
QTC_ASSERT(row >= 0, return);
|
QTC_ASSERT(row >= 0, return);
|
||||||
RemoteProcess process = d->processList->at(row);
|
DeviceProcess process = d->processList->at(row);
|
||||||
d->remoteCommandLine = process.cmdLine;
|
d->remoteCommandLine = process.cmdLine;
|
||||||
d->remoteExecutable = process.exe;
|
d->remoteExecutable = process.exe;
|
||||||
if (port == -1) {
|
if (port == -1) {
|
||||||
|
Reference in New Issue
Block a user