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

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)
{
staMap.clear();
if (m_avtivePathInterface == nullptr || !m_avtivePathInterface->isValid()) {
qDebug() << "dbus interface m_avtivePathInterface is invaild";
if (m_activePathInterface == nullptr || !m_activePathInterface->isValid()) {
qDebug() << "dbus interface m_activePathInterface is invaild";
return;
}
QDBusMessage reply = m_avtivePathInterface->call("Getstainfo");
QDBusMessage reply = m_activePathInterface->call("Getstainfo");
if(reply.type() == QDBusMessage::ErrorMessage)
{
qWarning() << "[mobilehotspot]Getstainfo error:" << reply.errorMessage();
return;
}
if (reply.arguments().isEmpty()
|| reply.arguments().at(0).toString() == ""
|| 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);
}
}
}
void ConnectdevPage::initStaDev()

View File

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

View File

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