Commit 9553309a authored by hjk's avatar hjk

Device support: Remove one use of Id::fromUniqueIdentifier and Co.

Change-Id: I4771079ff5c78c12780308fd32923fd3fad137cc
Reviewed-by: default avatarChristian Kandeler <christian.kandeler@theqtcompany.com>
parent 12461c41
......@@ -47,7 +47,6 @@
#include <QPixmap>
#include <QPushButton>
#include <QSignalMapper>
#include <QTextStream>
#include <algorithm>
......@@ -95,12 +94,9 @@ DeviceSettingsWidget::DeviceSettingsWidget(QWidget *parent)
m_deviceManager(DeviceManager::cloneInstance()),
m_deviceManagerModel(new DeviceManagerModel(m_deviceManager, this)),
m_nameValidator(new NameValidator(m_deviceManager, this)),
m_additionalActionsMapper(new QSignalMapper(this)),
m_configWidget(0)
{
initGui();
connect(m_additionalActionsMapper, SIGNAL(mapped(int)),
SLOT(handleAdditionalActionRequest(int)));
connect(m_deviceManager, SIGNAL(deviceUpdated(Core::Id)), SLOT(handleDeviceUpdated(Core::Id)));
}
......@@ -302,8 +298,8 @@ void DeviceSettingsWidget::currentDeviceChanged(int index)
foreach (Id actionId, device->actionIds()) {
QPushButton * const button = new QPushButton(device->displayNameForActionId(actionId));
m_additionalActionButtons << button;
connect(button, SIGNAL(clicked()), m_additionalActionsMapper, SLOT(map()));
m_additionalActionsMapper->setMapping(button, actionId.uniqueIdentifier());
connect(button, &QAbstractButton::clicked, this,
[this, actionId] { handleAdditionalActionRequest(actionId); });
m_ui->buttonsLayout->insertWidget(m_ui->buttonsLayout->count() - 1, button);
}
......@@ -322,12 +318,12 @@ void DeviceSettingsWidget::clearDetails()
m_ui->autoDetectionValueLabel->clear();
}
void DeviceSettingsWidget::handleAdditionalActionRequest(int actionId)
void DeviceSettingsWidget::handleAdditionalActionRequest(Id actionId)
{
const IDevice::Ptr device = m_deviceManager->mutableDevice(currentDevice()->id());
QTC_ASSERT(device, return);
updateDeviceFromUi();
device->executeAction(Id::fromUniqueIdentifier(actionId), this);
device->executeAction(actionId, this);
// Widget must be set up from scratch, because the action could have changed random attributes.
currentDeviceChanged(currentIndex());
......
......@@ -38,7 +38,6 @@
#include <QWidget>
QT_BEGIN_NAMESPACE
class QSignalMapper;
class QPushButton;
QT_END_NAMESPACE
......@@ -69,11 +68,11 @@ private slots:
void deviceNameEditingFinished();
void setDefaultDevice();
void testDevice();
void handleAdditionalActionRequest(int actionId);
void handleProcessListRequested();
private:
void initGui();
void handleAdditionalActionRequest(Core::Id actionId);
void displayCurrent();
void setDeviceInfoWidgetsEnabled(bool enable);
IDevice::ConstPtr currentDevice() const;
......@@ -88,7 +87,6 @@ private:
DeviceManagerModel * const m_deviceManagerModel;
NameValidator * const m_nameValidator;
QList<QPushButton *> m_additionalActionButtons;
QSignalMapper * const m_additionalActionsMapper;
IDeviceWidget *m_configWidget;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment