forked from qt-creator/qt-creator
Device support: Rename DeviceProcess to DeviceProcessItem.
We want to introduce a new class that has more right to that name. Change-Id: I9535632e10872a97a8555e885a80c383bc5dcd2b Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -527,7 +527,7 @@ public:
|
||||
|
||||
static QString executableForPid(qint64 pid)
|
||||
{
|
||||
foreach (const DeviceProcess &p, DeviceProcessList::localProcesses())
|
||||
foreach (const DeviceProcessItem &p, DeviceProcessList::localProcesses())
|
||||
if (p.pid == pid)
|
||||
return p.exe;
|
||||
return QString();
|
||||
@@ -1688,7 +1688,7 @@ void DebuggerPluginPrivate::attachToProcess(bool startServerOnly)
|
||||
QTC_ASSERT(kit, return);
|
||||
IDevice::ConstPtr device = DeviceKitInformation::device(kit);
|
||||
QTC_ASSERT(device, return);
|
||||
DeviceProcess process = dlg->currentProcess();
|
||||
DeviceProcessItem process = dlg->currentProcess();
|
||||
if (process.pid == 0) {
|
||||
QMessageBox::warning(mainWindow(), tr("Warning"),
|
||||
tr("Cannot attach to process with PID 0"));
|
||||
|
@@ -62,7 +62,7 @@ public:
|
||||
|
||||
DeviceProcessesDialog *dialog;
|
||||
bool startServerOnly;
|
||||
DeviceProcess process;
|
||||
DeviceProcessItem process;
|
||||
Kit *kit;
|
||||
IDevice::ConstPtr device;
|
||||
|
||||
|
@@ -104,7 +104,7 @@ public slots:
|
||||
void handleProcessListUpdated();
|
||||
void handleProcessKilled();
|
||||
void updateButtons();
|
||||
DeviceProcess selectedProcess() const;
|
||||
DeviceProcessItem selectedProcess() const;
|
||||
|
||||
public:
|
||||
QWidget *q;
|
||||
@@ -277,11 +277,11 @@ void DeviceProcessesDialogPrivate::updateButtons()
|
||||
errorText->setVisible(!errorText->document()->isEmpty());
|
||||
}
|
||||
|
||||
DeviceProcess DeviceProcessesDialogPrivate::selectedProcess() const
|
||||
DeviceProcessItem DeviceProcessesDialogPrivate::selectedProcess() const
|
||||
{
|
||||
const QModelIndexList indexes = procView->selectionModel()->selectedIndexes();
|
||||
if (indexes.empty() || !processList)
|
||||
return DeviceProcess();
|
||||
return DeviceProcessItem();
|
||||
return processList->at(proxyModel.mapToSource(indexes.first()).row());
|
||||
}
|
||||
|
||||
@@ -355,7 +355,7 @@ void DeviceProcessesDialog::showAllDevices()
|
||||
d->updateDevice();
|
||||
}
|
||||
|
||||
DeviceProcess DeviceProcessesDialog::currentProcess() const
|
||||
DeviceProcessItem DeviceProcessesDialog::currentProcess() const
|
||||
{
|
||||
return d->selectedProcess();
|
||||
}
|
||||
|
@@ -38,7 +38,7 @@
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
class DeviceProcess;
|
||||
class DeviceProcessItem;
|
||||
class KitChooser;
|
||||
|
||||
namespace Internal { class DeviceProcessesDialogPrivate; }
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
|
||||
void setDevice(const IDevice::ConstPtr &device);
|
||||
void showAllDevices();
|
||||
DeviceProcess currentProcess() const;
|
||||
DeviceProcessItem currentProcess() const;
|
||||
KitChooser *kitChooser() const;
|
||||
void logMessage(const QString &line);
|
||||
DeviceProcessesDialog(KitChooser *chooser, QWidget *parent);
|
||||
|
@@ -46,7 +46,7 @@ public:
|
||||
{ }
|
||||
|
||||
const IDevice::ConstPtr device;
|
||||
QList<DeviceProcess> remoteProcesses;
|
||||
QList<DeviceProcessItem> remoteProcesses;
|
||||
State state;
|
||||
};
|
||||
|
||||
@@ -96,7 +96,7 @@ void DeviceProcessList::update()
|
||||
doUpdate();
|
||||
}
|
||||
|
||||
void DeviceProcessList::reportProcessListUpdated(const QList<DeviceProcess> &processes)
|
||||
void DeviceProcessList::reportProcessListUpdated(const QList<DeviceProcessItem> &processes)
|
||||
{
|
||||
QTC_ASSERT(d->state == Listing, return);
|
||||
setFinished();
|
||||
@@ -125,7 +125,7 @@ void DeviceProcessList::reportProcessKilled()
|
||||
emit processKilled();
|
||||
}
|
||||
|
||||
DeviceProcess DeviceProcessList::at(int row) const
|
||||
DeviceProcessItem DeviceProcessList::at(int row) const
|
||||
{
|
||||
return d->remoteProcesses.at(row);
|
||||
}
|
||||
@@ -156,7 +156,7 @@ QVariant DeviceProcessList::data(const QModelIndex &index, int role) const
|
||||
return QVariant();
|
||||
|
||||
if (role == Qt::DisplayRole || role == Qt::ToolTipRole) {
|
||||
const DeviceProcess &proc = d->remoteProcesses.at(index.row());
|
||||
const DeviceProcessItem &proc = d->remoteProcesses.at(index.row());
|
||||
if (index.column() == 0)
|
||||
return proc.pid;
|
||||
else
|
||||
@@ -182,12 +182,12 @@ void DeviceProcessList::reportError(const QString &message)
|
||||
emit error(message);
|
||||
}
|
||||
|
||||
QList<DeviceProcess> DeviceProcessList::localProcesses()
|
||||
QList<DeviceProcessItem> DeviceProcessList::localProcesses()
|
||||
{
|
||||
return LocalProcessList::getLocalProcesses();
|
||||
}
|
||||
|
||||
bool DeviceProcess::operator <(const DeviceProcess &other) const
|
||||
bool DeviceProcessItem::operator <(const DeviceProcessItem &other) const
|
||||
{
|
||||
if (pid != other.pid)
|
||||
return pid < other.pid;
|
||||
|
@@ -39,11 +39,11 @@ namespace ProjectExplorer {
|
||||
|
||||
namespace Internal { class DeviceProcessListPrivate; }
|
||||
|
||||
class PROJECTEXPLORER_EXPORT DeviceProcess
|
||||
class PROJECTEXPLORER_EXPORT DeviceProcessItem
|
||||
{
|
||||
public:
|
||||
DeviceProcess() : pid(0) {}
|
||||
bool operator<(const DeviceProcess &other) const;
|
||||
DeviceProcessItem() : pid(0) {}
|
||||
bool operator<(const DeviceProcessItem &other) const;
|
||||
|
||||
int pid;
|
||||
QString cmdLine;
|
||||
@@ -60,9 +60,9 @@ public:
|
||||
|
||||
void update();
|
||||
void killProcess(int row);
|
||||
DeviceProcess at(int row) const;
|
||||
DeviceProcessItem at(int row) const;
|
||||
|
||||
static QList<DeviceProcess> localProcesses();
|
||||
static QList<DeviceProcessItem> localProcesses();
|
||||
|
||||
signals:
|
||||
void processListUpdated();
|
||||
@@ -72,7 +72,7 @@ signals:
|
||||
protected:
|
||||
void reportError(const QString &message);
|
||||
void reportProcessKilled();
|
||||
void reportProcessListUpdated(const QList<DeviceProcess> &processes);
|
||||
void reportProcessListUpdated(const QList<DeviceProcessItem> &processes);
|
||||
|
||||
IDevice::ConstPtr device() const;
|
||||
|
||||
@@ -87,7 +87,7 @@ private:
|
||||
bool hasChildren(const QModelIndex &parent) const;
|
||||
|
||||
virtual void doUpdate() = 0;
|
||||
virtual void doKillProcess(const DeviceProcess &process) = 0;
|
||||
virtual void doKillProcess(const DeviceProcessItem &process) = 0;
|
||||
|
||||
void setFinished();
|
||||
|
||||
|
@@ -166,15 +166,15 @@ static bool isUnixProcessId(const QString &procname)
|
||||
|
||||
static const char procDirC[] = "/proc/";
|
||||
|
||||
static QList<DeviceProcess> getLocalProcessesUsingProc(const QDir &procDir)
|
||||
static QList<DeviceProcessItem> getLocalProcessesUsingProc(const QDir &procDir)
|
||||
{
|
||||
QList<DeviceProcess> processes;
|
||||
QList<DeviceProcessItem> processes;
|
||||
const QString procDirPath = QLatin1String(procDirC);
|
||||
const QStringList procIds = procDir.entryList();
|
||||
foreach (const QString &procId, procIds) {
|
||||
if (!isUnixProcessId(procId))
|
||||
continue;
|
||||
DeviceProcess proc;
|
||||
DeviceProcessItem proc;
|
||||
proc.pid = procId.toInt();
|
||||
const QString root = procDirPath + procId;
|
||||
|
||||
@@ -216,14 +216,14 @@ static QList<DeviceProcess> getLocalProcessesUsingProc(const QDir &procDir)
|
||||
}
|
||||
|
||||
// Determine UNIX processes by running ps
|
||||
static QList<DeviceProcess> getLocalProcessesUsingPs()
|
||||
static QList<DeviceProcessItem> getLocalProcessesUsingPs()
|
||||
{
|
||||
#ifdef Q_OS_MAC
|
||||
static const char formatC[] = "pid state command";
|
||||
#else
|
||||
static const char formatC[] = "pid,state,cmd";
|
||||
#endif
|
||||
QList<DeviceProcess> processes;
|
||||
QList<DeviceProcessItem> processes;
|
||||
QProcess psProcess;
|
||||
QStringList args;
|
||||
args << QLatin1String("-e") << QLatin1String("-o") << QLatin1String(formatC);
|
||||
@@ -240,7 +240,7 @@ static QList<DeviceProcess> getLocalProcessesUsingPs()
|
||||
const int pidSep = line.indexOf(blank);
|
||||
const int cmdSep = pidSep != -1 ? line.indexOf(blank, pidSep + 1) : -1;
|
||||
if (cmdSep > 0) {
|
||||
DeviceProcess procData;
|
||||
DeviceProcessItem procData;
|
||||
procData.pid = line.left(pidSep).toInt();
|
||||
procData.exe = line.mid(cmdSep + 1);
|
||||
procData.cmdLine = line.mid(cmdSep + 1);
|
||||
@@ -252,13 +252,13 @@ static QList<DeviceProcess> getLocalProcessesUsingPs()
|
||||
return processes;
|
||||
}
|
||||
|
||||
QList<DeviceProcess> LocalProcessList::getLocalProcesses()
|
||||
QList<DeviceProcessItem> LocalProcessList::getLocalProcesses()
|
||||
{
|
||||
const QDir procDir = QDir(QLatin1String(procDirC));
|
||||
return procDir.exists() ? getLocalProcessesUsingProc(procDir) : getLocalProcessesUsingPs();
|
||||
}
|
||||
|
||||
void LocalProcessList::doKillProcess(const DeviceProcess &process)
|
||||
void LocalProcessList::doKillProcess(const DeviceProcessItem &process)
|
||||
{
|
||||
if (kill(process.pid, SIGKILL) == -1)
|
||||
m_error = QString::fromLocal8Bit(strerror(errno));
|
||||
|
@@ -49,11 +49,11 @@ public:
|
||||
LocalProcessList(const IDevice::ConstPtr &device, QObject *parent = 0);
|
||||
virtual Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||
|
||||
static QList<DeviceProcess> getLocalProcesses();
|
||||
static QList<DeviceProcessItem> getLocalProcesses();
|
||||
|
||||
private:
|
||||
void doUpdate();
|
||||
void doKillProcess(const DeviceProcess &process);
|
||||
void doKillProcess(const DeviceProcessItem &process);
|
||||
|
||||
private slots:
|
||||
void handleUpdate();
|
||||
|
@@ -59,7 +59,7 @@ void SshDeviceProcessList::doUpdate()
|
||||
d->process.run(listProcessesCommandLine().toUtf8(), device()->sshParameters());
|
||||
}
|
||||
|
||||
void SshDeviceProcessList::doKillProcess(const DeviceProcess &process)
|
||||
void SshDeviceProcessList::doKillProcess(const DeviceProcessItem &process)
|
||||
{
|
||||
QTC_ASSERT(device()->processSupport(), return);
|
||||
connect(&d->process, SIGNAL(connectionError()), SLOT(handleConnectionError()));
|
||||
|
@@ -47,10 +47,10 @@ private slots:
|
||||
|
||||
private:
|
||||
virtual QString listProcessesCommandLine() const = 0;
|
||||
virtual QList<DeviceProcess> buildProcessList(const QString &listProcessesReply) const = 0;
|
||||
virtual QList<DeviceProcessItem> buildProcessList(const QString &listProcessesReply) const = 0;
|
||||
|
||||
void doUpdate();
|
||||
void doKillProcess(const DeviceProcess &process);
|
||||
void doKillProcess(const DeviceProcessItem &process);
|
||||
|
||||
void handleProcessError(const QString &errorMessage);
|
||||
void setFinished();
|
||||
|
@@ -105,9 +105,9 @@ private:
|
||||
return QLatin1String("pidin -F \"%a %A '/%n'\"");
|
||||
}
|
||||
|
||||
QList<ProjectExplorer::DeviceProcess> buildProcessList(const QString &listProcessesReply) const
|
||||
QList<ProjectExplorer::DeviceProcessItem> buildProcessList(const QString &listProcessesReply) const
|
||||
{
|
||||
QList<ProjectExplorer::DeviceProcess> processes;
|
||||
QList<ProjectExplorer::DeviceProcessItem> processes;
|
||||
QStringList lines = listProcessesReply.split(QLatin1Char('\n'));
|
||||
if (lines.isEmpty())
|
||||
return processes;
|
||||
@@ -122,7 +122,7 @@ private:
|
||||
const int pid = captures[1].toInt();
|
||||
const QString args = captures[2];
|
||||
const QString exe = captures[3];
|
||||
ProjectExplorer::DeviceProcess deviceProcess;
|
||||
ProjectExplorer::DeviceProcessItem deviceProcess;
|
||||
deviceProcess.pid = pid;
|
||||
deviceProcess.exe = exe.trimmed();
|
||||
deviceProcess.cmdLine = args.trimmed();
|
||||
|
@@ -72,9 +72,9 @@ private:
|
||||
"done").arg(QLatin1String(Delimiter0)).arg(QLatin1String(Delimiter1));
|
||||
}
|
||||
|
||||
QList<DeviceProcess> buildProcessList(const QString &listProcessesReply) const
|
||||
QList<DeviceProcessItem> buildProcessList(const QString &listProcessesReply) const
|
||||
{
|
||||
QList<DeviceProcess> processes;
|
||||
QList<DeviceProcessItem> processes;
|
||||
const QStringList lines = listProcessesReply.split(QString::fromLatin1(Delimiter0)
|
||||
+ QString::fromLatin1(Delimiter1), QString::SkipEmptyParts);
|
||||
foreach (const QString &line, lines) {
|
||||
@@ -104,7 +104,7 @@ private:
|
||||
+ QLatin1Char(']');
|
||||
}
|
||||
|
||||
DeviceProcess process;
|
||||
DeviceProcessItem process;
|
||||
process.pid = pid;
|
||||
process.cmdLine = command;
|
||||
process.exe = elements.at(3);
|
||||
|
Reference in New Issue
Block a user