ProjectExplorer: Inline desktopdeviceconfigurationwidget.ui

Change-Id: I1af75c1d6bda76df79c08d545e16ef127ba2534d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Alessandro Portale
2024-09-10 19:25:49 +02:00
parent 9a8b493afa
commit ace15a9e04
5 changed files with 38 additions and 143 deletions

View File

@@ -47,7 +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/desktopdeviceconfigurationwidget.cpp devicesupport/desktopdeviceconfigurationwidget.h
devicesupport/desktopdevicefactory.cpp devicesupport/desktopdevicefactory.h
devicesupport/desktopprocesssignaloperation.cpp devicesupport/desktopprocesssignaloperation.h
devicesupport/devicecheckbuildstep.cpp devicesupport/devicecheckbuildstep.h

View File

@@ -1,38 +1,19 @@
/****************************************************************************
**
** 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.
**
****************************************************************************/
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "desktopdeviceconfigurationwidget.h"
#include "ui_desktopdeviceconfigurationwidget.h"
#include "../projectexplorerconstants.h"
#include "../projectexplorertr.h"
#include "idevice.h"
#include <utils/utilsicons.h>
#include <utils/infolabel.h>
#include <utils/layoutbuilder.h>
#include <utils/portlist.h>
#include <utils/qtcassert.h>
#include <utils/utilsicons.h>
#include <QLineEdit>
#include <QRegularExpressionValidator>
using namespace ProjectExplorer::Constants;
@@ -40,21 +21,27 @@ using namespace ProjectExplorer::Constants;
namespace ProjectExplorer {
DesktopDeviceConfigurationWidget::DesktopDeviceConfigurationWidget(const IDevicePtr &device) :
IDeviceWidget(device),
m_ui(new Ui::DesktopDeviceConfigurationWidget)
IDeviceWidget(device)
{
m_ui->setupUi(this);
connect(m_ui->freePortsLineEdit, &QLineEdit::textChanged,
m_freePortsLineEdit = new QLineEdit;
m_portsWarningLabel = new Utils::InfoLabel(
Tr::tr("You will need at least one port for QML debugging."),
Utils::InfoLabel::Warning);
using namespace Layouting;
Form {
Tr::tr("Machine type:"), Tr::tr("Physical Device"), br,
Tr::tr("Free ports:"), m_freePortsLineEdit, br,
empty, m_portsWarningLabel, br,
noMargin,
}.attachTo(this);
connect(m_freePortsLineEdit, &QLineEdit::textChanged,
this, &DesktopDeviceConfigurationWidget::updateFreePorts);
initGui();
}
DesktopDeviceConfigurationWidget::~DesktopDeviceConfigurationWidget()
{
delete m_ui;
}
void DesktopDeviceConfigurationWidget::updateDeviceFromUi()
{
updateFreePorts();
@@ -62,25 +49,20 @@ void DesktopDeviceConfigurationWidget::updateDeviceFromUi()
void DesktopDeviceConfigurationWidget::updateFreePorts()
{
device()->setFreePorts(Utils::PortList::fromString(m_ui->freePortsLineEdit->text()));
m_ui->portsWarningLabel->setVisible(!device()->freePorts().hasMore());
device()->setFreePorts(Utils::PortList::fromString(m_freePortsLineEdit->text()));
m_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(
m_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("<font color=\"red\">")
+ tr("You will need at least one port for QML debugging.")
+ QLatin1String("</font>"));
const auto portsValidator = new QRegularExpressionValidator(
QRegularExpression(Utils::PortList::regularExpression()), this);
m_ui->freePortsLineEdit->setValidator(portsValidator);
m_freePortsLineEdit->setValidator(portsValidator);
m_ui->freePortsLineEdit->setText(device()->freePorts().toString());
m_freePortsLineEdit->setText(device()->freePorts().toString());
updateFreePorts();
}

View File

@@ -1,40 +1,21 @@
/****************************************************************************
**
** 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.
**
****************************************************************************/
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#pragma once
#include "idevicewidget.h"
QT_BEGIN_NAMESPACE
class QLineEdit;
class QLabel;
QT_END_NAMESPACE
namespace ProjectExplorer {
namespace Ui { class DesktopDeviceConfigurationWidget; }
class DesktopDeviceConfigurationWidget : public IDeviceWidget
{
public:
explicit DesktopDeviceConfigurationWidget(const IDevicePtr &device);
~DesktopDeviceConfigurationWidget() override;
void updateDeviceFromUi() override;
@@ -44,7 +25,8 @@ private:
void initGui();
private:
Ui::DesktopDeviceConfigurationWidget *m_ui;
QLineEdit *m_freePortsLineEdit;
QLabel *m_portsWarningLabel;
};
} // namespace ProjectExplorer

View File

@@ -1,69 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ProjectExplorer::DesktopDeviceConfigurationWidget</class>
<widget class="QWidget" name="ProjectExplorer::DesktopDeviceConfigurationWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>437</width>
<height>265</height>
</rect>
</property>
<property name="windowTitle">
<string/>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="machineTypeLabel">
<property name="text">
<string>Machine type:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="machineTypeValueLabel">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="freePortsLabel">
<property name="text">
<string>Free ports:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="freePortsLineEdit"/>
</item>
<item>
<widget class="QLabel" name="portsWarningLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -223,7 +223,7 @@ QtcPlugin {
"sshparameters.cpp", "sshparameters.h",
"sshsettings.cpp", "sshsettings.h",
"sshsettingspage.cpp", "sshsettingspage.h",
"desktopdeviceconfigurationwidget.cpp", "desktopdeviceconfigurationwidget.h", "desktopdeviceconfigurationwidget.ui",
"desktopdeviceconfigurationwidget.cpp", "desktopdeviceconfigurationwidget.h",
"desktopprocesssignaloperation.cpp", "desktopprocesssignaloperation.h",
]
}