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() void LanListItem::onInfoButtonClicked()
{ {
if(isDetailShow){
qDebug() << "has show the detail page,and do not show again" << Q_FUNC_INFO << __LINE__;
return;
}
if(m_data){ if(m_data){
qDebug()<<"Net active or not:"<<m_isActive; 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__; 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); 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(); netDetail->show();
emit this->detailShow(true);
} }
else{ else{
qDebug() << "On lan info button clicked! But there is no wlan connect " ; qDebug() << "On lan info button clicked! But there is no wlan connect " ;

View File

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

View File

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

View File

@ -265,11 +265,17 @@ void WlanListItem::refreshIcon()
void WlanListItem::onInfoButtonClicked() void WlanListItem::onInfoButtonClicked()
{ {
//ZJP_TODO 呼出无线详情页 //ZJP_TODO 呼出无线详情页
if(isDetailShow){
qDebug() << "has show the detail page,and do not show again" << Q_FUNC_INFO << __LINE__;
return;
}
if(m_data){ if(m_data){
qDebug()<<"Net active or not:"<<m_isActive; 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__; 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); 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(); netDetail->show();
emit this->detailShow(true);
} }
else{ else{
qDebug() << "On wlan info button clicked! But there is no wlan connect " ; 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); return QDialog::paintEvent(event);
} }
void NetDetail::closeEvent(QCloseEvent *event)
{
emit this->detailPageClose(false);
return QDialog::closeEvent(event);
}
void NetDetail::centerToScreen() void NetDetail::centerToScreen()
{ {
QDesktopWidget* m = QApplication::desktop(); QDesktopWidget* m = QApplication::desktop();

View File

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

View File

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

View File

@ -254,8 +254,6 @@ void WlanPage::getActiveWlan()
m_activatedWlanSSid.clear(); m_activatedWlanSSid.clear();
m_activatedWlanUuid.clear(); m_activatedWlanUuid.clear();
WlanListItem *wlanItemWidget = new WlanListItem(); 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__ ; qDebug() << "There is no activated wlan." << Q_FUNC_INFO << __LINE__ ;
QListWidgetItem *wlanItem = new QListWidgetItem(); QListWidgetItem *wlanItem = new QListWidgetItem();
wlanItem->setSizeHint(QSize(m_activatedNetListWidget->width(), wlanItemWidget->height())); wlanItem->setSizeHint(QSize(m_activatedNetListWidget->width(), wlanItemWidget->height()));