ProjectExplorer: Merge device settings file pair, part 1

Step #1 into the "wrong" file to keep the change small.
Step #2 will rename the files

Change-Id: I2bdcc9e2149ca764f0bbebffb3ec520da72f8098
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2023-06-29 11:11:51 +02:00
parent f8366c5ef2
commit 5237998e5e
7 changed files with 80 additions and 141 deletions

View File

@@ -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

View File

@@ -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 <QCoreApplication>
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

View File

@@ -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 <coreplugin/dialogs/ioptionspage.h>
namespace ProjectExplorer {
namespace Internal {
class DeviceSettingsPage final : public Core::IOptionsPage
{
public:
DeviceSettingsPage();
};
} // namespace Internal
} // namespace ProjectExplorer

View File

@@ -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<QPushButton *> 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

View File

@@ -3,83 +3,14 @@
#pragma once
#include "idevicefwd.h"
#include <QList>
#include <QString>
#include <QWidget>
#include <coreplugin/dialogs/ioptionspage.h>
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<QPushButton *> 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

View File

@@ -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"

View File

@@ -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",