Merge branch '0907-new' into 'dbus-interface'
Feature:Add device comboBox. See merge request kylin-desktop/kylin-nm!237
This commit is contained in:
commit
f613c9c45e
|
@ -80,8 +80,3 @@ void ListItem::initConnection()
|
|||
connect(this->m_netButton, &RadioItemButton::clicked, this, &ListItem::onNetButtonClicked);
|
||||
// connect(this->m_infoButton, &InfoButton::clicked, this, &ListItem::onInfoButtonClicked);
|
||||
}
|
||||
|
||||
void ListItem::onNetButtonClicked()
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ private:
|
|||
void initConnection();
|
||||
|
||||
public slots:
|
||||
virtual void onNetButtonClicked();
|
||||
virtual void onNetButtonClicked() = 0;
|
||||
};
|
||||
|
||||
#endif // LISTITEM_H
|
||||
|
|
|
@ -14,10 +14,10 @@ WlanListItem::WlanListItem(KyWirelessNetResource *resource, KyWirelessNetItem *d
|
|||
|
||||
WlanListItem::WlanListItem(QWidget *parent) : ListItem(parent)
|
||||
{
|
||||
m_netButton->setIcon(QIcon::fromTheme("network-wireless-signal-none-symbolic"));
|
||||
const QString str="未连接任何wifi";
|
||||
m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-signal-none-symbolic"));
|
||||
const QString name = tr("Not connected");
|
||||
setExpanded(false);
|
||||
this->setName(str);
|
||||
this->setName(name);
|
||||
this->m_netButton->setEnabled(false);
|
||||
this->m_infoButton->hide();
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ LanPage::LanPage(QWidget *parent) : TabPage(parent)
|
|||
|
||||
initDevice();
|
||||
initUI();
|
||||
initDeviceCombox();
|
||||
if (QGSettings::isSchemaInstalled(GSETTINGS_SCHEMA)) {
|
||||
m_switchGsettings = new QGSettings(GSETTINGS_SCHEMA);
|
||||
initNetSwitch();
|
||||
|
@ -144,7 +145,12 @@ void LanPage::initDevice()
|
|||
m_settings = nullptr;
|
||||
for (int i = 0; i < devList.size(); ++i) {
|
||||
qDebug() << "[LanPage] Device: " << devList.at(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LanPage::initDeviceCombox()
|
||||
{
|
||||
//TODO 获取设备列表,单设备时隐藏下拉框,多设备时添加到下拉框
|
||||
}
|
||||
|
||||
void LanPage::onDeviceAdd(QString deviceName, NetworkManager::Device::Type deviceType)
|
||||
|
@ -198,6 +204,11 @@ void LanPage::onDeviceNameUpdate(QString oldName, QString newName)
|
|||
}
|
||||
}
|
||||
|
||||
void LanPage::onDeviceComboxIndexChanged(int currentIndex)
|
||||
{
|
||||
//TODO 设备变更时更新设备和列表
|
||||
}
|
||||
|
||||
void LanPage::initUI()
|
||||
{
|
||||
m_titleLabel->setText(tr("LAN"));
|
||||
|
|
|
@ -32,6 +32,7 @@ signals:
|
|||
|
||||
private:
|
||||
void initDevice();//初始化默认设备
|
||||
void initDeviceCombox();
|
||||
void initUI();
|
||||
void initList();
|
||||
void addNewItem(KyConnectItem *itemData, QListWidget *listWidget);
|
||||
|
@ -66,6 +67,7 @@ private slots:
|
|||
void onDeviceAdd(QString deviceName, NetworkManager::Device::Type deviceType);
|
||||
void onDeviceRemove(QString deviceName);
|
||||
void onDeviceNameUpdate(QString oldName, QString newName);
|
||||
void onDeviceComboxIndexChanged(int currentIndex);
|
||||
};
|
||||
|
||||
#endif // LANPAGE_H
|
||||
|
|
|
@ -31,6 +31,19 @@ void TabPage::initUI()
|
|||
m_titleLayout->addWidget(m_netSwitch);
|
||||
m_titleDivider = new Divider(this);
|
||||
|
||||
//临时增加的下拉框选择网卡区域
|
||||
m_deviceFrame = new QFrame(this);
|
||||
m_deviceLayout = new QHBoxLayout(m_deviceFrame);
|
||||
m_deviceLayout->setContentsMargins(TITLE_LAYOUT_MARGINS);
|
||||
m_deviceFrame->setLayout(m_deviceLayout);
|
||||
m_deviceLabel = new QLabel(m_deviceFrame);
|
||||
m_deviceComboBox = new QComboBox(m_deviceFrame);
|
||||
m_deviceLabel->setText(tr("Current Device"));
|
||||
m_deviceLayout->addWidget(m_deviceLabel);
|
||||
m_deviceLayout->addStretch();
|
||||
m_deviceLayout->addWidget(m_deviceComboBox);
|
||||
connect(m_deviceComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &TabPage::onDeviceComboxIndexChanged);
|
||||
|
||||
m_activatedNetFrame = new QFrame(this);
|
||||
m_activatedNetLayout = new QVBoxLayout(m_activatedNetFrame);
|
||||
m_activatedNetLayout->setContentsMargins(ACTIVE_NET_LAYOUT_MARGINS);
|
||||
|
@ -64,6 +77,8 @@ void TabPage::initUI()
|
|||
m_settingsFrame->setLayout(m_settingsLayout);
|
||||
|
||||
m_mainLayout->addWidget(m_titleFrame);
|
||||
//临时增加的设备选择区域
|
||||
m_mainLayout->addWidget(m_deviceFrame);
|
||||
m_mainLayout->addWidget(m_titleDivider);
|
||||
m_mainLayout->addWidget(m_activatedNetFrame);
|
||||
m_mainLayout->addWidget(m_activatedNetDivider);
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <QScrollArea>
|
||||
#include <QListWidget>
|
||||
#include <QDir>
|
||||
#include <QComboBox>
|
||||
#include "kylinnetworkdeviceresource.h"
|
||||
|
||||
#define MAIN_LAYOUT_MARGINS 0,0,0,0
|
||||
|
@ -55,6 +56,7 @@ signals:
|
|||
protected:
|
||||
void initUI();
|
||||
virtual void initDevice() = 0;//初始化默认设备
|
||||
virtual void initDeviceCombox() = 0;//初始化设备选择下拉框
|
||||
QVBoxLayout * m_mainLayout = nullptr;
|
||||
QFrame * m_titleFrame = nullptr;
|
||||
QHBoxLayout * m_titleLayout = nullptr;
|
||||
|
@ -80,6 +82,15 @@ protected:
|
|||
|
||||
QString defaultDevice = "";
|
||||
|
||||
//临时增加的下拉框选择网卡区域
|
||||
QFrame * m_deviceFrame = nullptr;
|
||||
QHBoxLayout * m_deviceLayout = nullptr;
|
||||
QLabel * m_deviceLabel = nullptr;
|
||||
QComboBox * m_deviceComboBox = nullptr;
|
||||
|
||||
public slots:
|
||||
virtual void onDeviceComboxIndexChanged(int currentIndex) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // TABPAGE_H
|
||||
|
|
|
@ -17,6 +17,7 @@ WlanPage::WlanPage(QWidget *parent) : TabPage(parent)
|
|||
initDevice();
|
||||
m_wirelessConnectOpreation = new KyWirelessConnectOperation(this);
|
||||
initWlanUI();
|
||||
initDeviceCombox();
|
||||
//要在initUI之后调用,保证UI的信号槽顺利绑定
|
||||
initConnections();
|
||||
getActiveWlan();
|
||||
|
@ -147,6 +148,11 @@ void WlanPage::initDevice()
|
|||
|
||||
}
|
||||
|
||||
void WlanPage::initDeviceCombox()
|
||||
{
|
||||
//TODO 获取设备列表,单设备时隐藏下拉框,多设备时添加到下拉框
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief WlanPage::getActiveWlan 获取所有已激活连接
|
||||
*/
|
||||
|
@ -441,6 +447,11 @@ void WlanPage::onWlanSwitchStatusChanged(const bool &checked)
|
|||
onWlanUpdated();
|
||||
}
|
||||
|
||||
void WlanPage::onDeviceComboxIndexChanged(int currentIndex)
|
||||
{
|
||||
//TODO 设备变更时更新设备和列表
|
||||
}
|
||||
|
||||
|
||||
//for dbus
|
||||
void WlanPage::getWirelessList(QMap<QString, QVector<QStringList> > &map)
|
||||
|
|
|
@ -44,6 +44,7 @@ private:
|
|||
void initConnections();
|
||||
|
||||
void initDevice();//初始化默认设备
|
||||
void initDeviceCombox();
|
||||
|
||||
void getActiveWlan();
|
||||
void appendActiveWlan(const QString &ssid, int &height);
|
||||
|
@ -84,6 +85,7 @@ private slots:
|
|||
void onConnectButtonClicked(KyWirelessConnectSetting &connSettingInfo, const bool &isHidden);
|
||||
void onWlanSwitchClicked();
|
||||
void onWlanSwitchStatusChanged(const bool &checked);
|
||||
void onDeviceComboxIndexChanged(int currentIndex);
|
||||
};
|
||||
|
||||
#endif // WLANPAGE_H
|
||||
|
|
Loading…
Reference in New Issue