diff --git a/src/plugins/projectexplorer/CMakeLists.txt b/src/plugins/projectexplorer/CMakeLists.txt index b587cb1f390..f256b9e0eb6 100644 --- a/src/plugins/projectexplorer/CMakeLists.txt +++ b/src/plugins/projectexplorer/CMakeLists.txt @@ -47,6 +47,7 @@ add_qtc_plugin(ProjectExplorer deploymentdataview.cpp deploymentdataview.h desktoprunconfiguration.cpp desktoprunconfiguration.h devicesupport/desktopdevice.cpp devicesupport/desktopdevice.h + devicesupport/desktopdeviceconfigurationwidget.cpp devicesupport/desktopdeviceconfigurationwidget.h devicesupport/desktopdeviceconfigurationwidget.ui devicesupport/desktopdevicefactory.cpp devicesupport/desktopdevicefactory.h devicesupport/desktopprocesssignaloperation.cpp devicesupport/desktopprocesssignaloperation.h devicesupport/devicecheckbuildstep.cpp devicesupport/devicecheckbuildstep.h diff --git a/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp b/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp index 417d143a6e2..c7ce56ac14f 100644 --- a/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp +++ b/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp @@ -5,6 +5,7 @@ #include "../projectexplorerconstants.h" #include "../projectexplorertr.h" +#include "desktopdeviceconfigurationwidget.h" #include "desktopprocesssignaloperation.h" #include @@ -80,10 +81,7 @@ IDevice::DeviceInfo DesktopDevice::deviceInformation() const IDeviceWidget *DesktopDevice::createWidget() { - return nullptr; - // DesktopDeviceConfigurationWidget currently has just one editable field viz. free ports. - // Querying for an available port is quite straightforward. Having a field for the port - // range can be confusing to the user. Hence, disabling the widget for now. + return new DesktopDeviceConfigurationWidget(shared_from_this()); } bool DesktopDevice::canCreateProcessModel() const diff --git a/src/plugins/projectexplorer/devicesupport/desktopdeviceconfigurationwidget.cpp b/src/plugins/projectexplorer/devicesupport/desktopdeviceconfigurationwidget.cpp new file mode 100644 index 00000000000..9a603a9b054 --- /dev/null +++ b/src/plugins/projectexplorer/devicesupport/desktopdeviceconfigurationwidget.cpp @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "desktopdeviceconfigurationwidget.h" +#include "ui_desktopdeviceconfigurationwidget.h" + +#include "../projectexplorerconstants.h" +#include "idevice.h" + +#include +#include +#include + +#include + +using namespace ProjectExplorer::Constants; + +namespace ProjectExplorer { + +DesktopDeviceConfigurationWidget::DesktopDeviceConfigurationWidget(const IDevicePtr &device) : + IDeviceWidget(device), + m_ui(new Ui::DesktopDeviceConfigurationWidget) +{ + m_ui->setupUi(this); + connect(m_ui->freePortsLineEdit, &QLineEdit::textChanged, + this, &DesktopDeviceConfigurationWidget::updateFreePorts); + + initGui(); +} + +DesktopDeviceConfigurationWidget::~DesktopDeviceConfigurationWidget() +{ + delete m_ui; +} + +void DesktopDeviceConfigurationWidget::updateDeviceFromUi() +{ + updateFreePorts(); +} + +void DesktopDeviceConfigurationWidget::updateFreePorts() +{ + device()->setFreePorts(Utils::PortList::fromString(m_ui->freePortsLineEdit->text())); + m_ui->portsWarningLabel->setVisible(!device()->freePorts().hasMore()); +} + +void DesktopDeviceConfigurationWidget::initGui() +{ + QTC_CHECK(device()->machineType() == IDevice::Hardware); + m_ui->machineTypeValueLabel->setText(tr("Physical Device")); + m_ui->freePortsLineEdit->setPlaceholderText( + QString::fromLatin1("eg: %1-%2").arg(DESKTOP_PORT_START).arg(DESKTOP_PORT_END)); + m_ui->portsWarningLabel->setPixmap(Utils::Icons::WARNING.pixmap()); + m_ui->portsWarningLabel->setToolTip(QLatin1String("") + + tr("You will need at least one port for QML debugging.") + + QLatin1String("")); + const auto portsValidator = new QRegularExpressionValidator( + QRegularExpression(Utils::PortList::regularExpression()), this); + m_ui->freePortsLineEdit->setValidator(portsValidator); + + m_ui->freePortsLineEdit->setText(device()->freePorts().toString()); + updateFreePorts(); +} + +} // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/devicesupport/desktopdeviceconfigurationwidget.h b/src/plugins/projectexplorer/devicesupport/desktopdeviceconfigurationwidget.h new file mode 100644 index 00000000000..11112b04ed6 --- /dev/null +++ b/src/plugins/projectexplorer/devicesupport/desktopdeviceconfigurationwidget.h @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include "idevicewidget.h" + +namespace ProjectExplorer { +namespace Ui { class DesktopDeviceConfigurationWidget; } + +class DesktopDeviceConfigurationWidget : public IDeviceWidget +{ +public: + explicit DesktopDeviceConfigurationWidget(const IDevicePtr &device); + ~DesktopDeviceConfigurationWidget() override; + + void updateDeviceFromUi() override; + +private: + void updateFreePorts(); + + void initGui(); + +private: + Ui::DesktopDeviceConfigurationWidget *m_ui; +}; + +} // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/devicesupport/desktopdeviceconfigurationwidget.ui b/src/plugins/projectexplorer/devicesupport/desktopdeviceconfigurationwidget.ui new file mode 100644 index 00000000000..3fd9fd184eb --- /dev/null +++ b/src/plugins/projectexplorer/devicesupport/desktopdeviceconfigurationwidget.ui @@ -0,0 +1,69 @@ + + + ProjectExplorer::DesktopDeviceConfigurationWidget + + + + 0 + 0 + 437 + 265 + + + + + + + + + + Machine type: + + + + + + + TextLabel + + + + + + + Free ports: + + + + + + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + diff --git a/src/plugins/projectexplorer/projectexplorer.qbs b/src/plugins/projectexplorer/projectexplorer.qbs index 28902c9c3d1..b3b6f6930ae 100644 --- a/src/plugins/projectexplorer/projectexplorer.qbs +++ b/src/plugins/projectexplorer/projectexplorer.qbs @@ -223,7 +223,8 @@ QtcPlugin { "sshparameters.cpp", "sshparameters.h", "sshsettings.cpp", "sshsettings.h", "sshsettingspage.cpp", "sshsettingspage.h", - "desktopprocesssignaloperation.cpp", "desktopprocesssignaloperation.h" + "desktopdeviceconfigurationwidget.cpp", "desktopdeviceconfigurationwidget.h", "desktopdeviceconfigurationwidget.ui", + "desktopprocesssignaloperation.cpp", "desktopprocesssignaloperation.h", ] }