show None when switch button closed

This commit is contained in:
ksn 2021-09-22 16:31:02 +08:00
parent 3a276a7dee
commit 0c517f952e
2 changed files with 7 additions and 5 deletions

View File

@ -81,17 +81,13 @@ void LanPage::onSwithGsettingsChanged(const QString &key)
qDebug()<<"[LanPage] open wired device "<< m_devList.at(index); qDebug()<<"[LanPage] open wired device "<< m_devList.at(index);
wiredOperation.openWiredNetworkWithDevice(m_devList.at(index)); wiredOperation.openWiredNetworkWithDevice(m_devList.at(index));
} }
m_inactivatedLanListWidget->show();
initDeviceCombox();
} else { } else {
for (int index = 0; index < m_devList.size(); ++index) { for (int index = 0; index < m_devList.size(); ++index) {
qDebug()<<"[LanPage] close wired device "<< m_devList.at(index); qDebug()<<"[LanPage] close wired device "<< m_devList.at(index);
wiredOperation.closeWiredNetworkWithDevice(m_devList.at(index)); wiredOperation.closeWiredNetworkWithDevice(m_devList.at(index));
} }
m_inactivatedLanListWidget->hide();
m_deviceFrame->hide();
} }
initDeviceCombox();
m_netSwitch->setSwitchStatus(isOn); m_netSwitch->setSwitchStatus(isOn);
m_netSwitch->blockSignals(false); m_netSwitch->blockSignals(false);
} }
@ -188,6 +184,10 @@ void LanPage::initDeviceCombox()
bool isOn = m_switchGsettings->get(WIRED_SWITCH).toBool(); bool isOn = m_switchGsettings->get(WIRED_SWITCH).toBool();
if (!isOn) { if (!isOn) {
m_deviceFrame->hide(); m_deviceFrame->hide();
m_activatedNetFrame->hide();
m_inactivatedNetFrame->hide();
m_activatedNetDivider->hide();
m_inactivatedNetDivider->hide();
} else { } else {
m_device->getNetworkDeviceList(NetworkManager::Device::Type::Ethernet, m_devList); m_device->getNetworkDeviceList(NetworkManager::Device::Type::Ethernet, m_devList);
for (int i=0; i<m_devList.size(); ++i) { for (int i=0; i<m_devList.size(); ++i) {

View File

@ -77,6 +77,7 @@ void TabPage::initUI()
m_inactivatedNetDivider = new Divider(this); m_inactivatedNetDivider = new Divider(this);
m_settingsFrame = new QFrame(this); m_settingsFrame = new QFrame(this);
m_settingsFrame->setFixedHeight(TITLE_FRAME_HEIGHT);
m_settingsLayout = new QHBoxLayout(m_settingsFrame); m_settingsLayout = new QHBoxLayout(m_settingsFrame);
m_settingsLayout->setContentsMargins(SETTINGS_LAYOUT_MARGINS); m_settingsLayout->setContentsMargins(SETTINGS_LAYOUT_MARGINS);
m_settingsLabel = new QLabel(m_settingsFrame); m_settingsLabel = new QLabel(m_settingsFrame);
@ -92,6 +93,7 @@ void TabPage::initUI()
m_mainLayout->addWidget(m_activatedNetDivider); m_mainLayout->addWidget(m_activatedNetDivider);
m_mainLayout->addWidget(m_inactivatedNetFrame); m_mainLayout->addWidget(m_inactivatedNetFrame);
m_mainLayout->addWidget(m_inactivatedNetDivider); m_mainLayout->addWidget(m_inactivatedNetDivider);
m_mainLayout->addStretch();
m_mainLayout->addWidget(m_settingsFrame); m_mainLayout->addWidget(m_settingsFrame);
} }