热点管控功能代码增加宏开关, 修改拼写错误的变量名称

This commit is contained in:
chenxuechao 2022-07-15 11:19:12 +08:00
parent fe36d99816
commit f8a0548d62
3 changed files with 22 additions and 5 deletions

View File

@ -65,17 +65,18 @@ QFrame* ConnectdevPage::myLine()
void ConnectdevPage::getConnectStaDevice(QMap<QString, QString> &staMap) void ConnectdevPage::getConnectStaDevice(QMap<QString, QString> &staMap)
{ {
staMap.clear(); staMap.clear();
if (m_avtivePathInterface == nullptr || !m_avtivePathInterface->isValid()) { if (m_activePathInterface == nullptr || !m_activePathInterface->isValid()) {
qDebug() << "dbus interface m_avtivePathInterface is invaild"; qDebug() << "dbus interface m_activePathInterface is invaild";
return; return;
} }
QDBusMessage reply = m_avtivePathInterface->call("Getstainfo"); QDBusMessage reply = m_activePathInterface->call("Getstainfo");
if(reply.type() == QDBusMessage::ErrorMessage) if(reply.type() == QDBusMessage::ErrorMessage)
{ {
qWarning() << "[mobilehotspot]Getstainfo error:" << reply.errorMessage(); qWarning() << "[mobilehotspot]Getstainfo error:" << reply.errorMessage();
return; return;
} }
if (reply.arguments().isEmpty() if (reply.arguments().isEmpty()
|| reply.arguments().at(0).toString() == "" || reply.arguments().at(0).toString() == ""
|| reply.arguments().at(0).toString() == "[Invalid UTF-8]" || reply.arguments().at(0).toString() == "[Invalid UTF-8]"
@ -91,6 +92,7 @@ void ConnectdevPage::getConnectStaDevice(QMap<QString, QString> &staMap)
staMap[macList.at(index)] = hostNameList.at(index); staMap[macList.at(index)] = hostNameList.at(index);
} }
} }
} }
void ConnectdevPage::initStaDev() void ConnectdevPage::initStaDev()

View File

@ -44,7 +44,7 @@ public:
void refreshStalist(); void refreshStalist();
inline void setInterface(QDBusInterface *activeInterface) { inline void setInterface(QDBusInterface *activeInterface) {
m_avtivePathInterface = activeInterface; m_activePathInterface = activeInterface;
} }
private: private:
@ -54,7 +54,7 @@ private:
QVBoxLayout *m_staListLayout = nullptr; QVBoxLayout *m_staListLayout = nullptr;
QMap<QString, QString> m_staMap; QMap<QString, QString> m_staMap;
QDBusInterface *m_avtivePathInterface = nullptr; QDBusInterface *m_activePathInterface = nullptr;
void getConnectStaDevice(QMap<QString, QString> &blacklistMap); void getConnectStaDevice(QMap<QString, QString> &blacklistMap);
bool removeStaFromBlacklist(QString staMac); bool removeStaFromBlacklist(QString staMac);

View File

@ -67,6 +67,8 @@ void MobileHotspotWidget::showDesktopNotify(const QString &message)
iface.callWithArgumentList(QDBus::AutoDetect,"Notify",args); iface.callWithArgumentList(QDBus::AutoDetect,"Notify",args);
} }
//#define HOTSPOT_CONTROL
MobileHotspotWidget::MobileHotspotWidget(QWidget *parent) : QWidget(parent) MobileHotspotWidget::MobileHotspotWidget(QWidget *parent) : QWidget(parent)
{ {
m_Vlayout = new QVBoxLayout(this); m_Vlayout = new QVBoxLayout(this);
@ -79,8 +81,11 @@ MobileHotspotWidget::MobileHotspotWidget(QWidget *parent) : QWidget(parent)
qDBusRegisterMetaType<QMap<QString, QVector<QStringList> >>(); qDBusRegisterMetaType<QMap<QString, QVector<QStringList> >>();
initUI(); initUI();
#ifdef HOTSPOT_CONTROL
initConnectDevPage(); initConnectDevPage();
initBlackListPage(); initBlackListPage();
#endif
m_switchBtn->installEventFilter(this); m_switchBtn->installEventFilter(this);
m_interface = new QDBusInterface("com.kylin.network", "/com/kylin/network", m_interface = new QDBusInterface("com.kylin.network", "/com/kylin/network",
@ -99,7 +104,9 @@ MobileHotspotWidget::MobileHotspotWidget(QWidget *parent) : QWidget(parent)
initInterfaceInfo(); initInterfaceInfo();
getApInfo(); getApInfo();
#ifdef HOTSPOT_CONTROL
initNmDbus(); initNmDbus();
#endif
this->setLayout(m_Vlayout); this->setLayout(m_Vlayout);
m_Vlayout->addStretch(); m_Vlayout->addStretch();
@ -110,8 +117,10 @@ MobileHotspotWidget::MobileHotspotWidget(QWidget *parent) : QWidget(parent)
updateBandCombox(); updateBandCombox();
}); });
#ifdef HOTSPOT_CONTROL
m_connectDevPage->refreshStalist(); m_connectDevPage->refreshStalist();
m_blacklistPage->refreshBlacklist(); m_blacklistPage->refreshBlacklist();
#endif
this->update(); this->update();
} }
@ -255,7 +264,9 @@ void MobileHotspotWidget::initDbusConnect()
} }
connect(m_apNameLine, &QLineEdit::textEdited, this, &MobileHotspotWidget::onApLineEditTextEdit); connect(m_apNameLine, &QLineEdit::textEdited, this, &MobileHotspotWidget::onApLineEditTextEdit);
#ifdef HOTSPOT_CONTROL
connect(m_connectDevPage, SIGNAL(setStaIntoBlacklist(QString)), m_blacklistPage, SLOT(onsetStaIntoBlacklist(QString))); connect(m_connectDevPage, SIGNAL(setStaIntoBlacklist(QString)), m_blacklistPage, SLOT(onsetStaIntoBlacklist(QString)));
#endif
connect(m_pwdNameLine, SIGNAL(textChanged(QString)), this, SLOT(onPwdTextChanged())); connect(m_pwdNameLine, SIGNAL(textChanged(QString)), this, SLOT(onPwdTextChanged()));
} }
@ -593,10 +604,12 @@ void MobileHotspotWidget::onDeviceNameChanged(QString oldName, QString newName,
//热点断开 //热点断开
void MobileHotspotWidget::onHotspotDeactivated(QString devName, QString ssid) void MobileHotspotWidget::onHotspotDeactivated(QString devName, QString ssid)
{ {
#ifdef HOTSPOT_CONTROL
deleteActivePathInterface(); deleteActivePathInterface();
m_connectDevPage->setInterface(nullptr); m_connectDevPage->setInterface(nullptr);
m_connectDevPage->refreshStalist(); m_connectDevPage->refreshStalist();
m_blacklistPage->refreshBlacklist(); m_blacklistPage->refreshBlacklist();
#endif
this->update(); this->update();
if (!m_switchBtn->isChecked()) { if (!m_switchBtn->isChecked()) {
@ -617,6 +630,7 @@ void MobileHotspotWidget::onHotspotActivated(QString devName, QString ssid, QStr
if (m_switchBtn->isChecked()) { if (m_switchBtn->isChecked()) {
return; return;
} }
#ifdef HOTSPOT_CONTROL
if (activePath != nullptr) { if (activePath != nullptr) {
deleteActivePathInterface(); deleteActivePathInterface();
initActivePathInterface(activePath); initActivePathInterface(activePath);
@ -628,6 +642,7 @@ void MobileHotspotWidget::onHotspotActivated(QString devName, QString ssid, QStr
m_connectDevPage->refreshStalist(); m_connectDevPage->refreshStalist();
m_blacklistPage->refreshBlacklist(); m_blacklistPage->refreshBlacklist();
#endif
this->update(); this->update();
if (devName == m_interfaceComboBox->currentText() && ssid == m_apNameLine->text()) { if (devName == m_interfaceComboBox->currentText() && ssid == m_apNameLine->text()) {