mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
add device switch button
Change-Id: I3a591b74d1a642a37f6ad1ac4e7f32367f1a0c27
This commit is contained in:
parent
bd38772b43
commit
0a78fc01ea
@ -147,10 +147,10 @@ public Q_SLOTS: // METHODS
|
||||
return asyncCallWithArgumentList(QStringLiteral("EditConnection"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> EnableDevice(const QDBusObjectPath &in0, bool in1)
|
||||
inline QDBusPendingReply<> EnableDevice(const QDBusObjectPath &devPath, bool enable)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0) << QVariant::fromValue(in1);
|
||||
argumentList << QVariant::fromValue(devPath) << QVariant::fromValue(enable);
|
||||
return asyncCallWithArgumentList(QStringLiteral("EnableDevice"), argumentList);
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,8 @@ DeviceControlWidget::DeviceControlWidget(QWidget *parent)
|
||||
|
||||
setLayout(centeralLayout);
|
||||
setFixedHeight(20);
|
||||
|
||||
connect(m_switchBtn, &DSwitchButton::checkedChanged, this, &DeviceControlWidget::deviceEnableChanged);
|
||||
}
|
||||
|
||||
void DeviceControlWidget::setDeviceName(const QString &name)
|
||||
|
@ -16,6 +16,9 @@ public:
|
||||
void setDeviceName(const QString &name);
|
||||
void setDeviceEnabled(const bool enable);
|
||||
|
||||
signals:
|
||||
void deviceEnableChanged(const bool enable) const;
|
||||
|
||||
private:
|
||||
QLabel *m_deviceName;
|
||||
Dtk::Widget::DSwitchButton *m_switchBtn;
|
||||
|
@ -39,6 +39,8 @@ WirelessApplet::WirelessApplet(const QString &devicePath, QWidget *parent)
|
||||
|
||||
connect(m_networkInter, &DBusNetwork::AccessPointPropertiesChanged, this, &WirelessApplet::APPropertiesChanged);
|
||||
|
||||
connect(m_controlPanel, &DeviceControlWidget::deviceEnableChanged, this, &WirelessApplet::deviceEnableChanged);
|
||||
|
||||
connect(m_updateAPTimer, &QTimer::timeout, this, &WirelessApplet::updateAPList);
|
||||
}
|
||||
|
||||
@ -137,3 +139,8 @@ void WirelessApplet::updateAPList()
|
||||
m_centeralWidget->setFixedHeight(contentHeight);
|
||||
setFixedHeight(std::min(contentHeight, MAX_HEIGHT));
|
||||
}
|
||||
|
||||
void WirelessApplet::deviceEnableChanged(const bool enable)
|
||||
{
|
||||
m_networkInter->EnableDevice(QDBusObjectPath(m_devicePath), enable);
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ private slots:
|
||||
void init();
|
||||
void APPropertiesChanged(const QString &devPath, const QString &info);
|
||||
void updateAPList();
|
||||
void deviceEnableChanged(const bool enable);
|
||||
|
||||
private:
|
||||
const QString m_devicePath;
|
||||
|
Loading…
x
Reference in New Issue
Block a user