diff --git a/src/plugins/projectexplorer/CMakeLists.txt b/src/plugins/projectexplorer/CMakeLists.txt index dd3d2d1e995..9c6d81eaa18 100644 --- a/src/plugins/projectexplorer/CMakeLists.txt +++ b/src/plugins/projectexplorer/CMakeLists.txt @@ -55,7 +55,6 @@ add_qtc_plugin(ProjectExplorer devicesupport/devicemanager.cpp devicesupport/devicemanager.h devicesupport/devicemanagermodel.cpp devicesupport/devicemanagermodel.h devicesupport/deviceprocessesdialog.cpp devicesupport/deviceprocessesdialog.h - devicesupport/devicesettingspage.cpp devicesupport/devicesettingspage.h devicesupport/devicesettingswidget.cpp devicesupport/devicesettingswidget.h devicesupport/devicetestdialog.cpp devicesupport/devicetestdialog.h devicesupport/deviceusedportsgatherer.cpp devicesupport/deviceusedportsgatherer.h diff --git a/src/plugins/projectexplorer/devicesupport/devicesettingspage.cpp b/src/plugins/projectexplorer/devicesupport/devicesettingspage.cpp deleted file mode 100644 index 6fdb19f38d1..00000000000 --- a/src/plugins/projectexplorer/devicesupport/devicesettingspage.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// 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 "devicesettingspage.h" - -#include "devicesettingswidget.h" -#include "../projectexplorerconstants.h" -#include "../projectexplorertr.h" - -#include - -namespace ProjectExplorer { -namespace Internal { - -DeviceSettingsPage::DeviceSettingsPage() -{ - setId(Constants::DEVICE_SETTINGS_PAGE_ID); - setDisplayName(Tr::tr("Devices")); - setCategory(Constants::DEVICE_SETTINGS_CATEGORY); - setDisplayCategory(Tr::tr("Devices")); - setCategoryIconPath(":/projectexplorer/images/settingscategory_devices.png"); - setWidgetCreator([] { return new DeviceSettingsWidget; }); -} - -} // namespace Internal -} // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/devicesupport/devicesettingspage.h b/src/plugins/projectexplorer/devicesupport/devicesettingspage.h deleted file mode 100644 index 202f5010815..00000000000 --- a/src/plugins/projectexplorer/devicesupport/devicesettingspage.h +++ /dev/null @@ -1,18 +0,0 @@ -// 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 - -namespace ProjectExplorer { -namespace Internal { - -class DeviceSettingsPage final : public Core::IOptionsPage -{ -public: - DeviceSettingsPage(); -}; - -} // namespace Internal -} // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/devicesupport/devicesettingswidget.cpp b/src/plugins/projectexplorer/devicesupport/devicesettingswidget.cpp index 280b6139f87..61db581ed4e 100644 --- a/src/plugins/projectexplorer/devicesupport/devicesettingswidget.cpp +++ b/src/plugins/projectexplorer/devicesupport/devicesettingswidget.cpp @@ -11,6 +11,7 @@ #include "idevice.h" #include "idevicefactory.h" #include "idevicewidget.h" +#include "../projectexplorerconstants.h" #include "../projectexplorericons.h" #include "../projectexplorertr.h" @@ -38,8 +39,8 @@ using namespace Core; using namespace Utils; -namespace ProjectExplorer { -namespace Internal { +namespace ProjectExplorer::Internal { + const char LastDeviceIndexKey[] = "LastDisplayedMaemoDeviceConfig"; class NameValidator : public QValidator @@ -72,24 +73,65 @@ private: const DeviceManager * const m_deviceManager; }; +class DeviceSettingsWidget final : public Core::IOptionsPageWidget +{ +public: + DeviceSettingsWidget(); + ~DeviceSettingsWidget() final + { + DeviceManager::removeClonedInstance(); + delete m_configWidget; + } + +private: + void apply() final { saveSettings(); } + + void saveSettings(); + + void handleDeviceUpdated(Utils::Id id); + void currentDeviceChanged(int index); + void addDevice(); + void removeDevice(); + void deviceNameEditingFinished(); + void setDefaultDevice(); + void testDevice(); + void handleProcessListRequested(); + + void initGui(); + void displayCurrent(); + void setDeviceInfoWidgetsEnabled(bool enable); + IDeviceConstPtr currentDevice() const; + int currentIndex() const; + void clearDetails(); + QString parseTestOutput(); + void fillInValues(); + void updateDeviceFromUi(); + + DeviceManager * const m_deviceManager; + DeviceManagerModel * const m_deviceManagerModel; + NameValidator * const m_nameValidator; + QList m_additionalActionButtons; + IDeviceWidget *m_configWidget; + + QLabel *m_configurationLabel; + QComboBox *m_configurationComboBox; + QGroupBox *m_generalGroupBox; + QLineEdit *m_nameLineEdit; + QLabel *m_osTypeValueLabel; + QLabel *m_autoDetectionLabel; + QLabel *m_deviceStateIconLabel; + QLabel *m_deviceStateTextLabel; + QGroupBox *m_osSpecificGroupBox; + QPushButton *m_removeConfigButton; + QPushButton *m_defaultDeviceButton; + QVBoxLayout *m_buttonsLayout; +}; + DeviceSettingsWidget::DeviceSettingsWidget() : m_deviceManager(DeviceManager::cloneInstance()), m_deviceManagerModel(new DeviceManagerModel(m_deviceManager, this)), m_nameValidator(new NameValidator(m_deviceManager, this)), m_configWidget(nullptr) -{ - initGui(); - connect(m_deviceManager, &DeviceManager::deviceUpdated, - this, &DeviceSettingsWidget::handleDeviceUpdated); -} - -DeviceSettingsWidget::~DeviceSettingsWidget() -{ - DeviceManager::removeClonedInstance(); - delete m_configWidget; -} - -void DeviceSettingsWidget::initGui() { m_configurationLabel = new QLabel(Tr::tr("&Device:")); m_configurationComboBox = new QComboBox; @@ -185,6 +227,7 @@ void DeviceSettingsWidget::initGui() lastIndex = 0; if (lastIndex < m_configurationComboBox->count()) m_configurationComboBox->setCurrentIndex(lastIndex); + connect(m_configurationComboBox, &QComboBox::currentIndexChanged, this, &DeviceSettingsWidget::currentDeviceChanged); currentDeviceChanged(currentIndex()); @@ -192,10 +235,10 @@ void DeviceSettingsWidget::initGui() this, &DeviceSettingsWidget::setDefaultDevice); connect(m_removeConfigButton, &QAbstractButton::clicked, this, &DeviceSettingsWidget::removeDevice); - connect(m_nameLineEdit, - &QLineEdit::editingFinished, - this, - &DeviceSettingsWidget::deviceNameEditingFinished); + connect(m_nameLineEdit, &QLineEdit::editingFinished, + this, &DeviceSettingsWidget::deviceNameEditingFinished); + connect(m_deviceManager, &DeviceManager::deviceUpdated, + this, &DeviceSettingsWidget::handleDeviceUpdated); } void DeviceSettingsWidget::addDevice() @@ -408,5 +451,16 @@ void DeviceSettingsWidget::handleProcessListRequested() dlg.exec(); } -} // namespace Internal -} // namespace ProjectExplorer +// DeviceSettingsPage + +DeviceSettingsPage::DeviceSettingsPage() +{ + setId(Constants::DEVICE_SETTINGS_PAGE_ID); + setDisplayName(Tr::tr("Devices")); + setCategory(Constants::DEVICE_SETTINGS_CATEGORY); + setDisplayCategory(Tr::tr("Devices")); + setCategoryIconPath(":/projectexplorer/images/settingscategory_devices.png"); + setWidgetCreator([] { return new DeviceSettingsWidget; }); +} + +} // ProjectExplorer::Internal diff --git a/src/plugins/projectexplorer/devicesupport/devicesettingswidget.h b/src/plugins/projectexplorer/devicesupport/devicesettingswidget.h index 207b60cf749..f154d91ce57 100644 --- a/src/plugins/projectexplorer/devicesupport/devicesettingswidget.h +++ b/src/plugins/projectexplorer/devicesupport/devicesettingswidget.h @@ -3,83 +3,14 @@ #pragma once -#include "idevicefwd.h" - -#include -#include -#include - #include -QT_BEGIN_NAMESPACE -class QComboBox; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QVBoxLayout; -QT_END_NAMESPACE +namespace ProjectExplorer::Internal { -namespace ProjectExplorer { -class DeviceManager; -class DeviceManagerModel; -class IDeviceWidget; - -namespace Internal { -namespace Ui { class DeviceSettingsWidget; } -class NameValidator; - -class DeviceSettingsWidget final : public Core::IOptionsPageWidget +class DeviceSettingsPage final : public Core::IOptionsPage { - Q_OBJECT public: - DeviceSettingsWidget(); - ~DeviceSettingsWidget() final; - -private: - void apply() final { saveSettings(); } - - void saveSettings(); - - void handleDeviceUpdated(Utils::Id id); - void currentDeviceChanged(int index); - void addDevice(); - void removeDevice(); - void deviceNameEditingFinished(); - void setDefaultDevice(); - void testDevice(); - void handleProcessListRequested(); - - void initGui(); - void displayCurrent(); - void setDeviceInfoWidgetsEnabled(bool enable); - IDeviceConstPtr currentDevice() const; - int currentIndex() const; - void clearDetails(); - QString parseTestOutput(); - void fillInValues(); - void updateDeviceFromUi(); - - Ui::DeviceSettingsWidget *m_ui; - DeviceManager * const m_deviceManager; - DeviceManagerModel * const m_deviceManagerModel; - NameValidator * const m_nameValidator; - QList m_additionalActionButtons; - IDeviceWidget *m_configWidget; - - QLabel *m_configurationLabel; - QComboBox *m_configurationComboBox; - QGroupBox *m_generalGroupBox; - QLineEdit *m_nameLineEdit; - QLabel *m_osTypeValueLabel; - QLabel *m_autoDetectionLabel; - QLabel *m_deviceStateIconLabel; - QLabel *m_deviceStateTextLabel; - QGroupBox *m_osSpecificGroupBox; - QPushButton *m_removeConfigButton; - QPushButton *m_defaultDeviceButton; - QVBoxLayout *m_buttonsLayout; + DeviceSettingsPage(); }; -} // namespace Internal -} // namespace ProjectExplorer +} // ProjectExplorer::Internal diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 0b57384ea22..85f768913a7 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -37,7 +37,7 @@ #include "devicesupport/desktopdevicefactory.h" #include "devicesupport/devicecheckbuildstep.h" #include "devicesupport/devicemanager.h" -#include "devicesupport/devicesettingspage.h" +#include "devicesupport/devicesettingswidget.h" #include "devicesupport/sshsettings.h" #include "devicesupport/sshsettingspage.h" #include "editorsettingspropertiespage.h" diff --git a/src/plugins/projectexplorer/projectexplorer.qbs b/src/plugins/projectexplorer/projectexplorer.qbs index 68e3c85d03d..3fa62265613 100644 --- a/src/plugins/projectexplorer/projectexplorer.qbs +++ b/src/plugins/projectexplorer/projectexplorer.qbs @@ -209,7 +209,6 @@ Project { "devicemanager.cpp", "devicemanager.h", "devicemanagermodel.cpp", "devicemanagermodel.h", "deviceprocessesdialog.cpp", "deviceprocessesdialog.h", - "devicesettingspage.cpp", "devicesettingspage.h", "devicesettingswidget.cpp", "devicesettingswidget.h", "devicetestdialog.cpp", "devicetestdialog.h", "deviceusedportsgatherer.cpp", "deviceusedportsgatherer.h",