解决部分机型WiFi断开后连接列表仍然显示的BUG
This commit is contained in:
parent
4904c35580
commit
7dc1bd145f
|
@ -130,7 +130,6 @@ void BlacklistPage::addBlacklistDevFrame(QString staMac, QString staName)
|
|||
|
||||
void BlacklistPage::clearBlacklistLayout()
|
||||
{
|
||||
m_blacklistMap.clear();
|
||||
if (m_blacklistLayout->layout() != NULL) {
|
||||
QLayoutItem* layoutItem;
|
||||
while ((layoutItem = m_blacklistLayout->layout()->takeAt(0)) != NULL) {
|
||||
|
@ -157,12 +156,8 @@ bool BlacklistPage::removeStaFromBlacklist(QString staMac)
|
|||
return true;
|
||||
}
|
||||
|
||||
void BlacklistPage::refreshBlacklist()
|
||||
void BlacklistPage::resetLayoutHight()
|
||||
{
|
||||
clearBlacklistLayout();
|
||||
getBlacklistDevice(m_blacklistMap);
|
||||
initBlacklistDev();
|
||||
|
||||
int height = 0;
|
||||
for (int i = 0; i < m_blacklistLayout->count(); i ++) {
|
||||
QWidget *w = m_blacklistLayout->itemAt(i)->widget();
|
||||
|
@ -172,14 +167,23 @@ void BlacklistPage::refreshBlacklist()
|
|||
}
|
||||
this->setFixedHeight(height + m_titleLabel->height() + 8);
|
||||
|
||||
if (!m_blacklistMap.isEmpty()) {
|
||||
this->show();
|
||||
} else {
|
||||
if (m_blacklistMap.isEmpty()) {
|
||||
this->hide();
|
||||
} else {
|
||||
this->show();
|
||||
}
|
||||
this->update();
|
||||
}
|
||||
|
||||
void BlacklistPage::refreshBlacklist()
|
||||
{
|
||||
m_blacklistMap.clear();
|
||||
getBlacklistDevice(m_blacklistMap);
|
||||
clearBlacklistLayout();
|
||||
initBlacklistDev();
|
||||
resetLayoutHight();
|
||||
}
|
||||
|
||||
void BlacklistPage::onRemoveFromBlacklistBtnClicked(QString staMac)
|
||||
{
|
||||
if (staMac.isNull() || staMac.isEmpty()) {
|
||||
|
|
|
@ -63,6 +63,7 @@ private:
|
|||
void initBlacklistDev();
|
||||
void addBlacklistDevFrame(QString staMac, QString staName);
|
||||
void clearBlacklistLayout();
|
||||
void resetLayoutHight();
|
||||
|
||||
private slots:
|
||||
void onsetStaIntoBlacklist(QString staMac);
|
||||
|
|
|
@ -116,7 +116,7 @@ void ConnectdevPage::addStaDevFrame(QString staMac, QString staName)
|
|||
|
||||
void ConnectdevPage::clearStaListLayout()
|
||||
{
|
||||
m_staMap.clear();
|
||||
|
||||
if (m_staListLayout->layout() != NULL) {
|
||||
QLayoutItem* layoutItem;
|
||||
while ((layoutItem = m_staListLayout->layout()->takeAt(0)) != NULL) {
|
||||
|
@ -128,30 +128,27 @@ void ConnectdevPage::clearStaListLayout()
|
|||
|
||||
void ConnectdevPage::onStaDevAdded(bool istrue, QString staMac, QString staName)
|
||||
{
|
||||
if (!m_staMap.keys().contains(staMac)) {
|
||||
onStaDevChanged(istrue, staMac, staName);
|
||||
if (!m_staMap.contains(staMac)) {
|
||||
m_staMap.insert(staMac, staName);
|
||||
clearStaListLayout();
|
||||
initStaDev();
|
||||
resetLayoutHight();
|
||||
}
|
||||
}
|
||||
|
||||
void ConnectdevPage::onStaDevRemoved(bool istrue, QString staMac, QString staName)
|
||||
{
|
||||
if (m_staMap.keys().contains(staMac)) {
|
||||
onStaDevChanged(istrue, staMac, staName);
|
||||
if (m_staMap.contains(staMac)) {
|
||||
if (m_staMap.remove(staMac)) {
|
||||
clearStaListLayout();
|
||||
initStaDev();
|
||||
resetLayoutHight();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ConnectdevPage::onStaDevChanged(bool istrue, QString staMac, QString staName)
|
||||
void ConnectdevPage::resetLayoutHight()
|
||||
{
|
||||
if (istrue) {
|
||||
refreshStalist();
|
||||
}
|
||||
}
|
||||
|
||||
void ConnectdevPage::refreshStalist()
|
||||
{
|
||||
clearStaListLayout();
|
||||
getConnectStaDevice(m_staMap);
|
||||
initStaDev();
|
||||
int height = 0;
|
||||
for (int i = 0; i < m_staListLayout->count(); i ++) {
|
||||
QWidget *w = m_staListLayout->itemAt(i)->widget();
|
||||
|
@ -169,6 +166,15 @@ void ConnectdevPage::refreshStalist()
|
|||
this->update();
|
||||
}
|
||||
|
||||
void ConnectdevPage::refreshStalist()
|
||||
{
|
||||
m_staMap.clear();
|
||||
getConnectStaDevice(m_staMap);
|
||||
clearStaListLayout();
|
||||
initStaDev();
|
||||
resetLayoutHight();
|
||||
}
|
||||
|
||||
void ConnectdevPage::onDropIntoBlacklistBtnClicked(QString staMac)
|
||||
{
|
||||
if (staMac.isNull() || staMac.isEmpty()) {
|
||||
|
|
|
@ -65,6 +65,7 @@ private:
|
|||
void initNmDbus(QDBusInterface *interface);
|
||||
|
||||
void onStaDevChanged(bool istrue, QString staMac, QString staName);
|
||||
void resetLayoutHight();
|
||||
|
||||
signals:
|
||||
void setStaIntoBlacklist(QString staMac);
|
||||
|
|
Loading…
Reference in New Issue