diff options
Diffstat (limited to 'src/plugins/projectexplorer/devicesupport')
19 files changed, 136 insertions, 137 deletions
diff --git a/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp b/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp index 283e921d92..a725658b9b 100644 --- a/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp +++ b/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp @@ -30,8 +30,10 @@ #include "desktopdeviceconfigurationwidget.h" #include "desktopprocesssignaloperation.h" +#include <coreplugin/fileutils.h> + #include <projectexplorer/projectexplorerconstants.h> -#include <projectexplorer/runconfiguration.h> +#include <projectexplorer/runcontrol.h> #include <ssh/sshconnection.h> @@ -58,10 +60,11 @@ DesktopDevice::DesktopDevice() const QString portRange = QString::fromLatin1("%1-%2").arg(DESKTOP_PORT_START).arg(DESKTOP_PORT_END); setFreePorts(Utils::PortList::fromString(portRange)); + setOpenTerminal([](const Utils::Environment &env, const QString &workingDir) { + Core::FileUtils::openTerminal(workingDir, env); + }); } -DesktopDevice::DesktopDevice(const DesktopDevice &other) = default; - IDevice::DeviceInfo DesktopDevice::deviceInformation() const { return DeviceInfo(); @@ -177,9 +180,4 @@ Utils::OsType DesktopDevice::osType() const return Utils::HostOsInfo::hostOs(); } -IDevice::Ptr DesktopDevice::clone() const -{ - return Ptr(new DesktopDevice(*this)); -} - } // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/devicesupport/desktopdevice.h b/src/plugins/projectexplorer/devicesupport/desktopdevice.h index da57cf95bd..dec063b5e5 100644 --- a/src/plugins/projectexplorer/devicesupport/desktopdevice.h +++ b/src/plugins/projectexplorer/devicesupport/desktopdevice.h @@ -53,11 +53,8 @@ public: QUrl toolControlChannel(const ControlChannelHint &) const override; Utils::OsType osType() const override; - IDevice::Ptr clone() const override; - protected: DesktopDevice(); - DesktopDevice(const DesktopDevice &other); friend class ProjectExplorerPlugin; friend class Internal::DesktopDeviceFactory; diff --git a/src/plugins/projectexplorer/devicesupport/desktopdeviceprocess.cpp b/src/plugins/projectexplorer/devicesupport/desktopdeviceprocess.cpp index d57b765bb0..bb9f6c8f43 100644 --- a/src/plugins/projectexplorer/devicesupport/desktopdeviceprocess.cpp +++ b/src/plugins/projectexplorer/devicesupport/desktopdeviceprocess.cpp @@ -26,7 +26,7 @@ #include "desktopdeviceprocess.h" #include "idevice.h" -#include "../runconfiguration.h" +#include "../runcontrol.h" #include <utils/environment.h> #include <utils/qtcassert.h> diff --git a/src/plugins/projectexplorer/devicesupport/devicecheckbuildstep.cpp b/src/plugins/projectexplorer/devicesupport/devicecheckbuildstep.cpp index 7935efb5fc..29e95751f6 100644 --- a/src/plugins/projectexplorer/devicesupport/devicecheckbuildstep.cpp +++ b/src/plugins/projectexplorer/devicesupport/devicecheckbuildstep.cpp @@ -44,9 +44,9 @@ DeviceCheckBuildStep::DeviceCheckBuildStep(BuildStepList *bsl) bool DeviceCheckBuildStep::init() { - IDevice::ConstPtr device = DeviceKitInformation::device(target()->kit()); + IDevice::ConstPtr device = DeviceKitAspect::device(target()->kit()); if (!device) { - Core::Id deviceTypeId = DeviceTypeKitInformation::deviceTypeId(target()->kit()); + Core::Id deviceTypeId = DeviceTypeKitAspect::deviceTypeId(target()->kit()); IDeviceFactory *factory = IDeviceFactory::find(deviceTypeId); if (!factory || !factory->canCreate()) { emit addOutput(tr("No device configured."), BuildStep::OutputFormat::ErrorMessage); @@ -71,7 +71,7 @@ bool DeviceCheckBuildStep::init() DeviceManager *dm = DeviceManager::instance(); dm->addDevice(newDevice); - DeviceKitInformation::setDevice(target()->kit(), newDevice); + DeviceKitAspect::setDevice(target()->kit(), newDevice); } return true; diff --git a/src/plugins/projectexplorer/devicesupport/devicemanager.cpp b/src/plugins/projectexplorer/devicesupport/devicemanager.cpp index d8c72aa354..cd6e7421aa 100644 --- a/src/plugins/projectexplorer/devicesupport/devicemanager.cpp +++ b/src/plugins/projectexplorer/devicesupport/devicemanager.cpp @@ -221,14 +221,14 @@ QVariantMap DeviceManager::toMap() const return map; } -Utils::FileName DeviceManager::settingsFilePath(const QString &extension) +Utils::FilePath DeviceManager::settingsFilePath(const QString &extension) { - return Utils::FileName::fromString(Core::ICore::userResourcePath() + extension); + return Utils::FilePath::fromString(Core::ICore::userResourcePath() + extension); } -Utils::FileName DeviceManager::systemSettingsFilePath(const QString &deviceFileRelativePath) +Utils::FilePath DeviceManager::systemSettingsFilePath(const QString &deviceFileRelativePath) { - return Utils::FileName::fromString(Core::ICore::installerResourcePath() + return Utils::FilePath::fromString(Core::ICore::installerResourcePath() + deviceFileRelativePath); } @@ -414,10 +414,8 @@ public: static Core::Id testTypeId() { return "TestType"; } private: - TestDevice(const TestDevice &other) = default; QString displayType() const override { return QLatin1String("blubb"); } IDeviceWidget *createWidget() override { return nullptr; } - Ptr clone() const override { return Ptr(new TestDevice(*this)); } DeviceProcessSignalOperation::Ptr signalOperation() const override { return DeviceProcessSignalOperation::Ptr(); @@ -425,8 +423,19 @@ private: Utils::OsType osType() const override { return Utils::HostOsInfo::hostOs(); } }; +class TestDeviceFactory : public IDeviceFactory +{ +public: + TestDeviceFactory() : IDeviceFactory(TestDevice::testTypeId()) + { + setConstructionFunction([] { return IDevice::Ptr(new TestDevice); }); + } +}; + void ProjectExplorerPlugin::testDeviceManager() { + TestDeviceFactory factory; + TestDevice::Ptr dev = IDevice::Ptr(new TestDevice); dev->setDisplayName(QLatin1String("blubbdiblubbfurz!")); QVERIFY(dev->isAutoDetected()); diff --git a/src/plugins/projectexplorer/devicesupport/devicemanager.h b/src/plugins/projectexplorer/devicesupport/devicemanager.h index bd9c2b606e..6f286845dd 100644 --- a/src/plugins/projectexplorer/devicesupport/devicemanager.h +++ b/src/plugins/projectexplorer/devicesupport/devicemanager.h @@ -33,7 +33,7 @@ #include <memory> -namespace Utils { class FileName; } +namespace Utils { class FilePath; } namespace ProjectExplorer { class IDevice; @@ -96,8 +96,8 @@ private: static void replaceInstance(); static void removeClonedInstance(); - static Utils::FileName settingsFilePath(const QString &extension); - static Utils::FileName systemSettingsFilePath(const QString &deviceFileRelativePath); + static Utils::FilePath settingsFilePath(const QString &extension); + static Utils::FilePath systemSettingsFilePath(const QString &deviceFileRelativePath); static void copy(const DeviceManager *source, DeviceManager *target, bool deep); const std::unique_ptr<Internal::DeviceManagerPrivate> d; diff --git a/src/plugins/projectexplorer/devicesupport/deviceprocess.h b/src/plugins/projectexplorer/devicesupport/deviceprocess.h index e26151d251..4aa197666c 100644 --- a/src/plugins/projectexplorer/devicesupport/deviceprocess.h +++ b/src/plugins/projectexplorer/devicesupport/deviceprocess.h @@ -26,7 +26,6 @@ #pragma once #include "../projectexplorer_export.h" -#include "../runconfiguration.h" #include <QObject> #include <QProcess> diff --git a/src/plugins/projectexplorer/devicesupport/deviceprocessesdialog.cpp b/src/plugins/projectexplorer/devicesupport/deviceprocessesdialog.cpp index dd6a851929..2e0cf6a660 100644 --- a/src/plugins/projectexplorer/devicesupport/deviceprocessesdialog.cpp +++ b/src/plugins/projectexplorer/devicesupport/deviceprocessesdialog.cpp @@ -185,14 +185,10 @@ DeviceProcessesDialogPrivate::DeviceProcessesDialogPrivate(KitChooser *chooser, proxyModel.setFilterRegExp(processFilterLineEdit->text()); - connect(processFilterLineEdit, - static_cast<void (FancyLineEdit::*)(const QString &)>(&FancyLineEdit::textChanged), - &proxyModel, - static_cast<void (ProcessListFilterModel::*)(const QString &)>( - &ProcessListFilterModel::setFilterRegExp)); - connect(procView->selectionModel(), - &QItemSelectionModel::selectionChanged, - this, &DeviceProcessesDialogPrivate::updateButtons); + connect(processFilterLineEdit, QOverload<const QString &>::of(&FancyLineEdit::textChanged), + &proxyModel, QOverload<const QString &>::of(&ProcessListFilterModel::setFilterRegExp)); + connect(procView->selectionModel(), &QItemSelectionModel::selectionChanged, + this, &DeviceProcessesDialogPrivate::updateButtons); connect(updateListButton, &QAbstractButton::clicked, this, &DeviceProcessesDialogPrivate::updateProcessList); connect(kitChooser, &KitChooser::currentIndexChanged, @@ -219,7 +215,7 @@ void DeviceProcessesDialogPrivate::setDevice(const IDevice::ConstPtr &device) processList = device->createProcessListModel(); QTC_ASSERT(processList, return); - proxyModel.setSourceModel(processList); + proxyModel.setSourceModel(processList->model()); connect(processList, &DeviceProcessList::error, this, &DeviceProcessesDialogPrivate::handleRemoteError); @@ -267,7 +263,7 @@ void DeviceProcessesDialogPrivate::killProcess() void DeviceProcessesDialogPrivate::updateDevice() { - setDevice(DeviceKitInformation::device(kitChooser->currentKit())); + setDevice(DeviceKitAspect::device(kitChooser->currentKit())); } void DeviceProcessesDialogPrivate::handleProcessKilled() diff --git a/src/plugins/projectexplorer/devicesupport/deviceprocesslist.cpp b/src/plugins/projectexplorer/devicesupport/deviceprocesslist.cpp index e6075da516..0405956100 100644 --- a/src/plugins/projectexplorer/devicesupport/deviceprocesslist.cpp +++ b/src/plugins/projectexplorer/devicesupport/deviceprocesslist.cpp @@ -27,23 +27,38 @@ #include "localprocesslist.h" #include <utils/qtcassert.h> +#include <utils/treemodel.h> + +using namespace Utils; namespace ProjectExplorer { namespace Internal { enum State { Inactive, Listing, Killing }; +class DeviceProcessTreeItem : public TreeItem +{ +public: + DeviceProcessTreeItem(const DeviceProcessItem &p, Qt::ItemFlags f) : process(p), fl(f) {} + + QVariant data(int column, int role) const final; + Qt::ItemFlags flags(int) const final { return fl; } + + DeviceProcessItem process; + Qt::ItemFlags fl; +}; + class DeviceProcessListPrivate { public: DeviceProcessListPrivate(const IDevice::ConstPtr &device) - : device(device), - state(Inactive) + : device(device) { } + qint64 ownPid = -1; const IDevice::ConstPtr device; - QList<DeviceProcessItem> remoteProcesses; - State state; + State state = Inactive; + TreeModel<TypedTreeItem<DeviceProcessTreeItem>, DeviceProcessTreeItem> model; }; } // namespace Internal @@ -51,39 +66,19 @@ public: using namespace Internal; DeviceProcessList::DeviceProcessList(const IDevice::ConstPtr &device, QObject *parent) - : QAbstractItemModel(parent), d(std::make_unique<DeviceProcessListPrivate>(device)) -{ } - -DeviceProcessList::~DeviceProcessList() = default; - -QModelIndex DeviceProcessList::parent(const QModelIndex &) const + : QObject(parent), d(std::make_unique<DeviceProcessListPrivate>(device)) { - return QModelIndex(); -} - -bool DeviceProcessList::hasChildren(const QModelIndex &parent) const -{ - if (!parent.isValid()) - return rowCount(parent) > 0 && columnCount(parent) > 0; - return false; -} - -QModelIndex DeviceProcessList::index(int row, int column, const QModelIndex &parent) const -{ - return hasIndex(row, column, parent) ? createIndex(row, column) : QModelIndex(); + d->model.setHeader({tr("Process ID"), tr("Command Line")}); } +DeviceProcessList::~DeviceProcessList() = default; void DeviceProcessList::update() { QTC_ASSERT(d->state == Inactive, return); QTC_ASSERT(device(), return); - if (!d->remoteProcesses.isEmpty()) { - beginRemoveRows(QModelIndex(), 0, d->remoteProcesses.count() - 1); - d->remoteProcesses.clear(); - endRemoveRows(); - } + d->model.clear(); d->state = Listing; doUpdate(); } @@ -92,22 +87,29 @@ void DeviceProcessList::reportProcessListUpdated(const QList<DeviceProcessItem> { QTC_ASSERT(d->state == Listing, return); setFinished(); - if (!processes.isEmpty()) { - beginInsertRows(QModelIndex(), 0, processes.count() - 1); - d->remoteProcesses = processes; - endInsertRows(); + for (const DeviceProcessItem &process : processes) { + Qt::ItemFlags fl; + if (process.pid != d->ownPid) + fl = Qt::ItemIsEnabled | Qt::ItemIsSelectable; + d->model.rootItem()->appendChild(new DeviceProcessTreeItem(process, fl)); } + emit processListUpdated(); } void DeviceProcessList::killProcess(int row) { - QTC_ASSERT(row >= 0 && row < d->remoteProcesses.count(), return); + QTC_ASSERT(row >= 0 && row < d->model.rootItem()->childCount(), return); QTC_ASSERT(d->state == Inactive, return); QTC_ASSERT(device(), return); d->state = Killing; - doKillProcess(d->remoteProcesses.at(row)); + doKillProcess(at(row)); +} + +void DeviceProcessList::setOwnPid(qint64 pid) +{ + d->ownPid = pid; } void DeviceProcessList::reportProcessKilled() @@ -119,40 +121,21 @@ void DeviceProcessList::reportProcessKilled() DeviceProcessItem DeviceProcessList::at(int row) const { - return d->remoteProcesses.at(row); + return d->model.rootItem()->childAt(row)->process; } -int DeviceProcessList::rowCount(const QModelIndex &parent) const +QAbstractItemModel *DeviceProcessList::model() const { - return parent.isValid() ? 0 : d->remoteProcesses.count(); + return &d->model; } -int DeviceProcessList::columnCount(const QModelIndex &) const +QVariant DeviceProcessTreeItem::data(int column, int role) const { - return 2; -} - -QVariant DeviceProcessList::headerData(int section, Qt::Orientation orientation, - int role) const -{ - if (orientation != Qt::Horizontal || role != Qt::DisplayRole || section < 0 - || section >= columnCount()) - return QVariant(); - return section == 0? tr("Process ID") : tr("Command Line"); -} - -QVariant DeviceProcessList::data(const QModelIndex &index, int role) const -{ - if (!index.isValid() || index.row() >= rowCount(index.parent()) - || index.column() >= columnCount()) - return QVariant(); - if (role == Qt::DisplayRole || role == Qt::ToolTipRole) { - const DeviceProcessItem &proc = d->remoteProcesses.at(index.row()); - if (index.column() == 0) - return proc.pid; + if (column == 0) + return process.pid; else - return proc.cmdLine; + return process.cmdLine; } return QVariant(); } diff --git a/src/plugins/projectexplorer/devicesupport/deviceprocesslist.h b/src/plugins/projectexplorer/devicesupport/deviceprocesslist.h index 18fa97337d..c7959dc3a5 100644 --- a/src/plugins/projectexplorer/devicesupport/deviceprocesslist.h +++ b/src/plugins/projectexplorer/devicesupport/deviceprocesslist.h @@ -46,7 +46,7 @@ public: QString exe; }; -class PROJECTEXPLORER_EXPORT DeviceProcessList : public QAbstractItemModel +class PROJECTEXPLORER_EXPORT DeviceProcessList : public QObject { Q_OBJECT @@ -56,7 +56,10 @@ public: void update(); void killProcess(int row); + void setOwnPid(qint64 pid); + DeviceProcessItem at(int row) const; + QAbstractItemModel *model() const; static QList<DeviceProcessItem> localProcesses(); @@ -73,15 +76,6 @@ protected: IDevice::ConstPtr device() const; private: - QModelIndex index(int row, int column, const QModelIndex &parent) const override; - int rowCount(const QModelIndex &parent = QModelIndex()) const override; - int columnCount(const QModelIndex &parent = QModelIndex()) const override; - QVariant headerData(int section, Qt::Orientation orientation, - int role = Qt::DisplayRole) const override; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; - QModelIndex parent(const QModelIndex &) const override; - bool hasChildren(const QModelIndex &parent) const override; - virtual void doUpdate() = 0; virtual void doKillProcess(const DeviceProcessItem &process) = 0; diff --git a/src/plugins/projectexplorer/devicesupport/devicesettingswidget.cpp b/src/plugins/projectexplorer/devicesupport/devicesettingswidget.cpp index 5cb6623f1c..af42589622 100644 --- a/src/plugins/projectexplorer/devicesupport/devicesettingswidget.cpp +++ b/src/plugins/projectexplorer/devicesupport/devicesettingswidget.cpp @@ -122,7 +122,7 @@ void DeviceSettingsWidget::initGui() lastIndex = 0; if (lastIndex < m_ui->configurationComboBox->count()) m_ui->configurationComboBox->setCurrentIndex(lastIndex); - connect(m_ui->configurationComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), + connect(m_ui->configurationComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &DeviceSettingsWidget::currentDeviceChanged); currentDeviceChanged(currentIndex()); connect(m_ui->defaultDeviceButton, &QAbstractButton::clicked, diff --git a/src/plugins/projectexplorer/devicesupport/deviceusedportsgatherer.h b/src/plugins/projectexplorer/devicesupport/deviceusedportsgatherer.h index e739af3163..4344f059a5 100644 --- a/src/plugins/projectexplorer/devicesupport/deviceusedportsgatherer.h +++ b/src/plugins/projectexplorer/devicesupport/deviceusedportsgatherer.h @@ -27,7 +27,7 @@ #include "idevice.h" -#include <projectexplorer/runconfiguration.h> +#include <projectexplorer/runcontrol.h> #include <utils/portlist.h> diff --git a/src/plugins/projectexplorer/devicesupport/idevice.cpp b/src/plugins/projectexplorer/devicesupport/idevice.cpp index 54caab5f99..86d783a6d9 100644 --- a/src/plugins/projectexplorer/devicesupport/idevice.cpp +++ b/src/plugins/projectexplorer/devicesupport/idevice.cpp @@ -27,6 +27,7 @@ #include "devicemanager.h" #include "deviceprocesslist.h" +#include "idevicefactory.h" #include "../kit.h" #include "../kitinformation.h" @@ -152,6 +153,7 @@ public: QList<Utils::Icon> deviceIcons; QList<IDevice::DeviceAction> deviceActions; QVariantMap extraData; + IDevice::OpenTerminal openTerminal; }; } // namespace Internal @@ -161,6 +163,11 @@ IDevice::IDevice() : d(new Internal::IDevicePrivate) { } +void IDevice::setOpenTerminal(const IDevice::OpenTerminal &openTerminal) +{ + d->openTerminal = openTerminal; +} + void IDevice::setupId(Origin origin, Core::Id id) { d->origin = origin; @@ -168,11 +175,15 @@ void IDevice::setupId(Origin origin, Core::Id id) d->id = id.isValid() ? id : newId(); } -IDevice::IDevice(const IDevice &other) - : QEnableSharedFromThis<IDevice>(other) - , d(std::make_unique<Internal::IDevicePrivate>()) +bool IDevice::canOpenTerminal() const { - *d = *other.d; + return bool(d->openTerminal); +} + +void IDevice::openTerminal(const Utils::Environment &env, const QString &workingDir) const +{ + QTC_ASSERT(canOpenTerminal(), return); + d->openTerminal(env, workingDir); } IDevice::~IDevice() = default; @@ -249,7 +260,7 @@ Core::Id IDevice::id() const */ bool IDevice::isCompatibleWith(const Kit *k) const { - return DeviceTypeKitInformation::deviceTypeId(k) == type(); + return DeviceTypeKitAspect::deviceTypeId(k) == type(); } void IDevice::addDeviceAction(const DeviceAction &deviceAction) @@ -395,6 +406,19 @@ QVariantMap IDevice::toMap() const return map; } +IDevice::Ptr IDevice::clone() const +{ + IDeviceFactory *factory = IDeviceFactory::find(d->type); + QTC_ASSERT(factory, return {}); + IDevice::Ptr device = factory->construct(); + QTC_ASSERT(device, return {}); + device->d->deviceState = d->deviceState; + device->d->deviceActions = d->deviceActions; + device->d->deviceIcons = d->deviceIcons; + device->fromMap(toMap()); + return device; +} + QString IDevice::deviceStateToString() const { const char context[] = "ProjectExplorer::IDevice"; diff --git a/src/plugins/projectexplorer/devicesupport/idevice.h b/src/plugins/projectexplorer/devicesupport/idevice.h index 560325617c..b263544000 100644 --- a/src/plugins/projectexplorer/devicesupport/idevice.h +++ b/src/plugins/projectexplorer/devicesupport/idevice.h @@ -120,6 +120,7 @@ public: // See cpp file for documentation. class PROJECTEXPLORER_EXPORT IDevice : public QEnableSharedFromThis<IDevice> { + friend class Internal::IDevicePrivate; public: using Ptr = QSharedPointer<IDevice>; using ConstPtr = QSharedPointer<const IDevice>; @@ -127,9 +128,10 @@ public: enum Origin { ManuallyAdded, AutoDetected }; enum MachineType { Hardware, Emulator }; - IDevice &operator=(const IDevice &) = delete; virtual ~IDevice(); + Ptr clone() const; + QString displayName() const; void setDisplayName(const QString &name); @@ -187,7 +189,6 @@ public: virtual void fromMap(const QVariantMap &map); virtual QVariantMap toMap() const; - virtual Ptr clone() const = 0; static Core::Id typeFromMap(const QVariantMap &map); static Core::Id idFromMap(const QVariantMap &map); @@ -218,11 +219,19 @@ public: void setupId(Origin origin, Core::Id id = Core::Id()); + bool canOpenTerminal() const; + void openTerminal(const Utils::Environment &env, const QString &workingDir) const; + protected: IDevice(); - IDevice(const IDevice &other); + + using OpenTerminal = std::function<void(const Utils::Environment &, const QString &)>; + void setOpenTerminal(const OpenTerminal &openTerminal); private: + IDevice(const IDevice &) = delete; + IDevice &operator=(const IDevice &) = delete; + int version() const; const std::unique_ptr<Internal::IDevicePrivate> d; diff --git a/src/plugins/projectexplorer/devicesupport/localprocesslist.cpp b/src/plugins/projectexplorer/devicesupport/localprocesslist.cpp index b0d95c6474..832cbd5246 100644 --- a/src/plugins/projectexplorer/devicesupport/localprocesslist.cpp +++ b/src/plugins/projectexplorer/devicesupport/localprocesslist.cpp @@ -56,8 +56,8 @@ namespace Internal { LocalProcessList::LocalProcessList(const IDevice::ConstPtr &device, QObject *parent) : DeviceProcessList(device, parent) - , m_myPid(GetCurrentProcessId()) { + setOwnPid(GetCurrentProcessId()); } QList<DeviceProcessItem> LocalProcessList::getLocalProcesses() @@ -89,8 +89,9 @@ QList<DeviceProcessItem> LocalProcessList::getLocalProcesses() #ifdef Q_OS_UNIX LocalProcessList::LocalProcessList(const IDevice::ConstPtr &device, QObject *parent) : DeviceProcessList(device, parent) - , m_myPid(getpid()) -{} +{ + setOwnPid(getpid()); +} static bool isUnixProcessId(const QString &procname) { @@ -206,14 +207,6 @@ void LocalProcessList::doKillProcess(const DeviceProcessItem &process) signalOperation->killProcess(process.pid); } -Qt::ItemFlags LocalProcessList::flags(const QModelIndex &index) const -{ - Qt::ItemFlags flags = DeviceProcessList::flags(index); - if (index.isValid() && at(index.row()).pid == m_myPid) - flags &= ~(Qt::ItemIsEnabled | Qt::ItemIsSelectable); - return flags; -} - void LocalProcessList::handleUpdate() { reportProcessListUpdated(getLocalProcesses()); diff --git a/src/plugins/projectexplorer/devicesupport/localprocesslist.h b/src/plugins/projectexplorer/devicesupport/localprocesslist.h index 599f20ed3e..8e10086849 100644 --- a/src/plugins/projectexplorer/devicesupport/localprocesslist.h +++ b/src/plugins/projectexplorer/devicesupport/localprocesslist.h @@ -36,7 +36,6 @@ class LocalProcessList : public DeviceProcessList public: explicit LocalProcessList(const IDevice::ConstPtr &device, QObject *parent = nullptr); - Qt::ItemFlags flags(const QModelIndex &index) const override; static QList<DeviceProcessItem> getLocalProcesses(); @@ -47,8 +46,6 @@ private: private: void handleUpdate(); void reportDelayedKillStatus(const QString &errorMessage); - - const qint64 m_myPid; }; } // namespace Internal diff --git a/src/plugins/projectexplorer/devicesupport/sshdeviceprocess.cpp b/src/plugins/projectexplorer/devicesupport/sshdeviceprocess.cpp index f094cb1473..7e8be72c65 100644 --- a/src/plugins/projectexplorer/devicesupport/sshdeviceprocess.cpp +++ b/src/plugins/projectexplorer/devicesupport/sshdeviceprocess.cpp @@ -26,7 +26,7 @@ #include "sshdeviceprocess.h" #include "idevice.h" -#include "../runconfiguration.h" +#include "../runcontrol.h" #include <ssh/sshconnection.h> #include <ssh/sshconnectionmanager.h> @@ -188,21 +188,21 @@ void SshDeviceProcess::handleConnected() d->process = runInTerminal() && d->runnable.executable.isEmpty() ? d->connection->createRemoteShell() - : d->connection->createRemoteProcess(fullCommandLine(d->runnable).toUtf8()); + : d->connection->createRemoteProcess(fullCommandLine(d->runnable)); const QString display = d->displayName(); if (!display.isEmpty()) d->process->requestX11Forwarding(display); if (runInTerminal()) { d->process->requestTerminal(); const QStringList cmdLine = d->process->fullLocalCommandLine(); - connect(&d->consoleProcess, - static_cast<void (ConsoleProcess::*)(QProcess::ProcessError)>(&ConsoleProcess::error), + connect(&d->consoleProcess, QOverload<QProcess::ProcessError>::of(&ConsoleProcess::error), this, &DeviceProcess::error); connect(&d->consoleProcess, &ConsoleProcess::processStarted, this, &SshDeviceProcess::handleProcessStarted); connect(&d->consoleProcess, &ConsoleProcess::stubStopped, this, [this] { handleProcessFinished(d->consoleProcess.errorString()); }); - d->consoleProcess.start(cmdLine.first(), cmdLine.mid(1).join(' ')); + d->consoleProcess.start(cmdLine.first(), cmdLine.mid(1).join(' '), + ConsoleProcess::MetaCharMode::Ignore); } else { connect(d->process.get(), &QSsh::SshRemoteProcess::started, this, &SshDeviceProcess::handleProcessStarted); diff --git a/src/plugins/projectexplorer/devicesupport/sshdeviceprocesslist.cpp b/src/plugins/projectexplorer/devicesupport/sshdeviceprocesslist.cpp index c1c7b0a45f..d8107458fd 100644 --- a/src/plugins/projectexplorer/devicesupport/sshdeviceprocesslist.cpp +++ b/src/plugins/projectexplorer/devicesupport/sshdeviceprocesslist.cpp @@ -54,7 +54,7 @@ void SshDeviceProcessList::doUpdate() this, &SshDeviceProcessList::handleConnectionError); connect(&d->process, &SshRemoteProcessRunner::processClosed, this, &SshDeviceProcessList::handleListProcessFinished); - d->process.run(listProcessesCommandLine().toUtf8(), device()->sshParameters()); + d->process.run(listProcessesCommandLine(), device()->sshParameters()); } void SshDeviceProcessList::doKillProcess(const DeviceProcessItem &process) diff --git a/src/plugins/projectexplorer/devicesupport/sshsettingspage.cpp b/src/plugins/projectexplorer/devicesupport/sshsettingspage.cpp index 32b6b3e83e..152467c93e 100644 --- a/src/plugins/projectexplorer/devicesupport/sshsettingspage.cpp +++ b/src/plugins/projectexplorer/devicesupport/sshsettingspage.cpp @@ -58,7 +58,7 @@ private: void setupSftpPathChooser(); void setupAskpassPathChooser(); void setupKeygenPathChooser(); - void setupPathChooser(PathChooser &chooser, const FileName &initialPath, bool &changedFlag); + void setupPathChooser(PathChooser &chooser, const FilePath &initialPath, bool &changedFlag); void updateCheckboxEnabled(); void updateSpinboxEnabled(); @@ -170,7 +170,7 @@ void SshSettingsWidget::setupKeygenPathChooser() setupPathChooser(m_keygenChooser, SshSettings::keygenFilePath(), m_keygenPathChanged); } -void SshSettingsWidget::setupPathChooser(PathChooser &chooser, const FileName &initialPath, +void SshSettingsWidget::setupPathChooser(PathChooser &chooser, const FilePath &initialPath, bool &changedFlag) { chooser.setExpectedKind(PathChooser::ExistingCommand); |