This commit is contained in:
king 2021-10-15 17:48:44 +08:00
parent 10ae024e48
commit ea1b89434a
8 changed files with 36 additions and 4 deletions

View File

@ -82,11 +82,17 @@ void LanListItem::onRightButtonClicked()
void LanListItem::onInfoButtonClicked()
{
if(isDetailShow){
qDebug() << "has show the detail page,and do not show again" << Q_FUNC_INFO << __LINE__;
return;
}
if(m_data){
qDebug()<<"Net active or not:"<<m_isActive;
qDebug() << "On lan info button clicked! uuid = " << m_data->m_connectUuid << "; name = " << m_data->m_connectName << "." <<Q_FUNC_INFO << __LINE__;
NetDetail *netDetail = new NetDetail(deviceName, m_data->m_connectName, m_data->m_connectUuid, m_isActive,false, false, this);
connect(netDetail, &NetDetail::detailPageClose, this, &LanListItem::onDetailShow);
netDetail->show();
emit this->detailShow(true);
}
else{
qDebug() << "On lan info button clicked! But there is no wlan connect " ;

View File

@ -13,9 +13,11 @@
ListItem::ListItem(QWidget *parent) : QFrame(parent)
{
isDetailShow = false;
initUI();
initConnection();
connect(qApp, &QApplication::paletteChanged, this, &ListItem::onPaletteChanged);
connect(this, &ListItem::detailShow, this, &ListItem::onDetailShow);
// m_itemFrame->installEventFilter(this);
}
@ -160,3 +162,8 @@ void ListItem::onPaletteChanged()
pal.setColor(QPalette::Window, qApp->palette().base().color());
this->setPalette(pal);
}
void ListItem::onDetailShow(bool isShow)
{
isDetailShow = isShow;
}

View File

@ -39,6 +39,7 @@ protected:
public:
QVBoxLayout * m_mainLayout = nullptr;
QHBoxLayout * m_hItemLayout = nullptr;
bool isDetailShow;
private:
void initUI();
void initConnection();
@ -46,6 +47,10 @@ private:
public slots:
virtual void onNetButtonClicked() = 0;
void onPaletteChanged();
void onDetailShow(bool isShow);
signals:
void detailShow(bool isShow);
};
#endif // LISTITEM_H

View File

@ -265,11 +265,17 @@ void WlanListItem::refreshIcon()
void WlanListItem::onInfoButtonClicked()
{
//ZJP_TODO 呼出无线详情页
if(isDetailShow){
qDebug() << "has show the detail page,and do not show again" << Q_FUNC_INFO << __LINE__;
return;
}
if(m_data){
qDebug()<<"Net active or not:"<<m_isActive;
qDebug() << "On wlan info button clicked! ssid = " << m_data->m_NetSsid << "; name = " << m_data->m_connName << "." <<Q_FUNC_INFO << __LINE__;
NetDetail *netDetail = new NetDetail(m_wlanDevice, m_data->m_NetSsid, m_data->m_connectUuid, m_isActive, true, !m_data->m_isConfigured, this);
connect(netDetail, &NetDetail::detailPageClose, this, &WlanListItem::onDetailShow);
netDetail->show();
emit this->detailShow(true);
}
else{
qDebug() << "On wlan info button clicked! But there is no wlan connect " ;

View File

@ -102,6 +102,12 @@ void NetDetail::paintEvent(QPaintEvent *event)
return QDialog::paintEvent(event);
}
void NetDetail::closeEvent(QCloseEvent *event)
{
emit this->detailPageClose(false);
return QDialog::closeEvent(event);
}
void NetDetail::centerToScreen()
{
QDesktopWidget* m = QApplication::desktop();

View File

@ -19,6 +19,7 @@
#include <QDBusObjectPath>
#include <QDBusInterface>
#include <QDBusReply>
#include <QCloseEvent>
#include "detailpage.h"
#include "ipv4page.h"
@ -37,6 +38,7 @@ public:
~NetDetail();
protected:
void paintEvent(QPaintEvent *event);
void closeEvent(QCloseEvent *event);
private:
void initUI();
@ -127,5 +129,8 @@ private:
private slots:
void on_btnConfirm_clicked();
void on_btnForget_clicked();
signals:
void detailPageClose(bool on);
};
#endif // NETDETAIL_H

View File

@ -789,12 +789,11 @@ void LanPage::onUpdateLanlist(QString uuid,
if (state == NetworkManager::ActiveConnection::State::Activated) {
updateActivatedConnectionArea(uuid);
m_isLanConnected = true;
emit this->lanConnectChanged();
} else if (state == NetworkManager::ActiveConnection::State::Deactivated) {
updateConnectionArea(uuid);
m_isLanConnected = false;
emit this->lanConnectChanged();
}
emit this->lanConnectChanged();
return;
}

View File

@ -254,8 +254,6 @@ void WlanPage::getActiveWlan()
m_activatedWlanSSid.clear();
m_activatedWlanUuid.clear();
WlanListItem *wlanItemWidget = new WlanListItem();
connect(wlanItemWidget, &WlanListItem::itemHeightChanged, this, &WlanPage::onItemHeightChanged);
connect(wlanItemWidget, &WlanListItem::connectButtonClicked, this, &WlanPage::onConnectButtonClicked);
qDebug() << "There is no activated wlan." << Q_FUNC_INFO << __LINE__ ;
QListWidgetItem *wlanItem = new QListWidgetItem();
wlanItem->setSizeHint(QSize(m_activatedNetListWidget->width(), wlanItemWidget->height()));