diff --git a/src/plugins/boot2qt/boot2qt.pro b/src/plugins/boot2qt/boot2qt.pro index e26910cf1ab..8c5f51e5043 100644 --- a/src/plugins/boot2qt/boot2qt.pro +++ b/src/plugins/boot2qt/boot2qt.pro @@ -11,7 +11,6 @@ HEADERS += \ qdbdevice.h \ qdbqtversion.h \ qdbdeployconfigurationfactory.h \ - qdbdevicewizard.h \ qdbrunconfiguration.h \ qdbmakedefaultappstep.h \ qdbmakedefaultappservice.h \ @@ -28,7 +27,6 @@ SOURCES += \ qdbdevice.cpp \ qdbqtversion.cpp \ qdbdeployconfigurationfactory.cpp \ - qdbdevicewizard.cpp \ qdbrunconfiguration.cpp \ qdbmakedefaultappstep.cpp \ qdbmakedefaultappservice.cpp \ @@ -38,8 +36,5 @@ SOURCES += \ qdbdevicedebugsupport.cpp \ qdbplugin.cpp \ -FORMS += \ - qdbdevicewizardsettingspage.ui - RESOURCES += \ qdb.qrc diff --git a/src/plugins/boot2qt/boot2qt.qbs b/src/plugins/boot2qt/boot2qt.qbs index eb80cd03a4d..ac6a33f2797 100644 --- a/src/plugins/boot2qt/boot2qt.qbs +++ b/src/plugins/boot2qt/boot2qt.qbs @@ -29,9 +29,6 @@ QtcPlugin { "qdbdevice.h", "qdbdevicedebugsupport.cpp", "qdbdevicedebugsupport.h", - "qdbdevicewizard.cpp", - "qdbdevicewizard.h", - "qdbdevicewizardsettingspage.ui", "qdbmakedefaultappservice.cpp", "qdbmakedefaultappservice.h", "qdbmakedefaultappstep.cpp", diff --git a/src/plugins/boot2qt/qdbdevice.cpp b/src/plugins/boot2qt/qdbdevice.cpp index a5b898d3cd7..8156ee7a89a 100644 --- a/src/plugins/boot2qt/qdbdevice.cpp +++ b/src/plugins/boot2qt/qdbdevice.cpp @@ -28,7 +28,6 @@ #include "qdbutils.h" #include "qdbconstants.h" #include "qdbdevicedebugsupport.h" -#include "qdbdevicewizard.h" #include @@ -44,6 +43,11 @@ #include #include +#include +#include +#include +#include + using namespace ProjectExplorer; using namespace Utils; @@ -213,16 +217,85 @@ std::function } -// Device factory +// QdbDeviceWizard -static IDevice::Ptr createDevice(QdbDeviceWizard::DeviceType deviceType) +class QdbSettingsPage : public QWizardPage { - QdbDeviceWizard wizard(deviceType, Core::ICore::mainWindow()); +public: + QdbSettingsPage() + { + setWindowTitle(QdbDevice::tr("WizardPage")); + setTitle(QdbDevice::tr("Device Settings")); - if (wizard.exec() != QDialog::Accepted) - return IDevice::Ptr(); - return wizard.device(); -} + nameLineEdit = new QLineEdit(this); + nameLineEdit->setPlaceholderText(QdbDevice::tr("A short, free-text description")); + + addressLineEdit = new QLineEdit(this); + addressLineEdit->setPlaceholderText(QdbDevice::tr("Host name or IP address")); + + auto usbWarningLabel = new QLabel(this); + usbWarningLabel->setText(QString("%1

%2

") + .arg("Note:") + .arg("Do not use this wizard for devices connected via USB.
" + "Those will be auto-detected.

" + "

The connectivity to the device is tested after finishing.")); + + auto formLayout = new QFormLayout(this); + formLayout->addRow(QdbDevice::tr("Device name:"), nameLineEdit); + formLayout->addRow(QdbDevice::tr("Device address:"), addressLineEdit); + formLayout->addRow(usbWarningLabel); + + connect(nameLineEdit, &QLineEdit::textChanged, this, &QWizardPage::completeChanged); + connect(addressLineEdit, &QLineEdit::textChanged, this, &QWizardPage::completeChanged); + } + + QString deviceName() const { return nameLineEdit->text().trimmed(); } + QString deviceAddress() const { return addressLineEdit->text().trimmed(); } + +private: + bool isComplete() const final { + return !deviceName().isEmpty() && !deviceAddress().isEmpty(); + } + + QLineEdit *nameLineEdit; + QLineEdit *addressLineEdit; + +}; + +class QdbDeviceWizard : public QWizard +{ +public: + QdbDeviceWizard(QWidget *parent) + : QWizard(parent) + { + setWindowTitle(QdbDeviceWizard::tr("Boot2Qt Network Device Setup")); + settingsPage.setCommitPage(true); + + enum { SettingsPageId }; + + setPage(SettingsPageId, &settingsPage); + } + + ProjectExplorer::IDevice::Ptr device() + { + QdbDevice::Ptr device = QdbDevice::create(); + + device->setDisplayName(settingsPage.deviceName()); + device->setupId(ProjectExplorer::IDevice::ManuallyAdded, Core::Id()); + device->setType(Constants::QdbLinuxOsType); + device->setMachineType(ProjectExplorer::IDevice::Hardware); + + device->setupDefaultNetworkSettings(settingsPage.deviceAddress()); + + return device; + } + +private: + QdbSettingsPage settingsPage; +}; + + +// Device factory QdbLinuxDeviceFactory::QdbLinuxDeviceFactory() : IDeviceFactory(Constants::QdbLinuxOsType) @@ -235,7 +308,11 @@ QdbLinuxDeviceFactory::QdbLinuxDeviceFactory() IDevice::Ptr QdbLinuxDeviceFactory::create() const { - return createDevice(QdbDeviceWizard::HardwareDevice); + QdbDeviceWizard wizard(Core::ICore::mainWindow()); + + if (wizard.exec() != QDialog::Accepted) + return IDevice::Ptr(); + return wizard.device(); } } // namespace Internal diff --git a/src/plugins/boot2qt/qdbdevicewizard.cpp b/src/plugins/boot2qt/qdbdevicewizard.cpp deleted file mode 100644 index 165732084cc..00000000000 --- a/src/plugins/boot2qt/qdbdevicewizard.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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 "qdbdevicewizard.h" -#include "ui_qdbdevicewizardsettingspage.h" - -#include "qdbconstants.h" -#include "qdbdevice.h" - -#include - -#include -#include - -namespace { -enum PageId { SettingsPageId }; -} // anonymous namespace - -namespace Qdb { -namespace Internal { - -class QdbSettingsPage : public QWizardPage -{ - Q_OBJECT -public: - QdbSettingsPage(QdbDeviceWizard::DeviceType deviceType, QWidget *parent = 0) - : QWizardPage(parent), m_deviceType(deviceType) - { - m_ui.setupUi(this); - setTitle(tr("Device Settings")); - connect(m_ui.nameLineEdit, &QLineEdit::textChanged, this, &QWizardPage::completeChanged); - connect(m_ui.addressLineEdit, &QLineEdit::textChanged, - this, &QWizardPage::completeChanged); - } - - QdbDeviceWizard::DeviceType deviceType() const { return m_deviceType; } - QString deviceName() const { return m_ui.nameLineEdit->text().trimmed(); } - QString deviceAddress() const { return m_ui.addressLineEdit->text().trimmed(); } - -private: - bool isComplete() const final { - return !deviceName().isEmpty() && !deviceAddress().isEmpty(); - } - - QdbDeviceWizard::DeviceType m_deviceType; - Ui::QdbDeviceWizardSettingsPage m_ui; -}; - -class QdbDeviceWizard::DeviceWizardPrivate -{ -public: - DeviceWizardPrivate(DeviceType deviceType) - : settingsPage(deviceType) - { - - } - - QdbSettingsPage settingsPage; -}; - -QdbDeviceWizard::QdbDeviceWizard(DeviceType deviceType, QWidget *parent) - : QWizard(parent), d(new DeviceWizardPrivate(deviceType)) -{ - setWindowTitle(tr("Boot2Qt Network Device Setup")); - d->settingsPage.setCommitPage(true); - setPage(SettingsPageId, &d->settingsPage); -} - -QdbDeviceWizard::~QdbDeviceWizard() -{ - delete d; -} - -ProjectExplorer::IDevice::Ptr QdbDeviceWizard::device() -{ - QdbDevice::Ptr device = QdbDevice::create(); - - device->setDisplayName(d->settingsPage.deviceName()); - device->setupId(ProjectExplorer::IDevice::ManuallyAdded, Core::Id()); - device->setType(Constants::QdbLinuxOsType); - device->setMachineType(ProjectExplorer::IDevice::Hardware); - - device->setupDefaultNetworkSettings(d->settingsPage.deviceAddress()); - - return device; -} - -} // namespace Internal -} // namespace Qdb - -#include "qdbdevicewizard.moc" diff --git a/src/plugins/boot2qt/qdbdevicewizard.h b/src/plugins/boot2qt/qdbdevicewizard.h deleted file mode 100644 index 5191c8cedfe..00000000000 --- a/src/plugins/boot2qt/qdbdevicewizard.h +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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 - -#include - -namespace Qdb { -namespace Internal { - -class QdbDeviceWizard : public QWizard -{ - Q_OBJECT -public: - enum DeviceType - { - HardwareDevice - }; - - QdbDeviceWizard(DeviceType deviceType, QWidget *parent = 0); - ~QdbDeviceWizard(); - - ProjectExplorer::IDevice::Ptr device(); - -private: - class DeviceWizardPrivate; - DeviceWizardPrivate * const d; -}; - -} // namespace Internal -} // namespace Qdb diff --git a/src/plugins/boot2qt/qdbdevicewizardsettingspage.ui b/src/plugins/boot2qt/qdbdevicewizardsettingspage.ui deleted file mode 100644 index 2aefa42fbf7..00000000000 --- a/src/plugins/boot2qt/qdbdevicewizardsettingspage.ui +++ /dev/null @@ -1,73 +0,0 @@ - - - Qdb::Internal::QdbDeviceWizardSettingsPage - - - - 0 - 0 - 669 - 308 - - - - WizardPage - - - - - - - - Device name: - - - - - - - A short, free-text description - - - - - - - Device address: - - - - - - - Host name or IP address - - - - - - - - - <html><head/><body><p><span style=" font-weight:600;">Note:</span> Do not use this wizard for devices connected via USB.<br/>Those will be auto-detected.</p><p>The connectivity to the device is tested after finishing.</p></body></html> - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - -