fix bug 101649

This commit is contained in:
jzxc95 2022-01-17 14:29:24 +08:00
parent 285cef5be9
commit 8fb0b84c52
9 changed files with 82 additions and 119 deletions

View File

@ -27,8 +27,16 @@ LanItem::LanItem(bool isAcitve, QWidget *parent)
mLanLyt->addStretch(); mLanLyt->addStretch();
mLanLyt->addWidget(statusLabel); mLanLyt->addWidget(statusLabel);
mLanLyt->addWidget(infoLabel); mLanLyt->addWidget(infoLabel);
loadIcons.append(QIcon::fromTheme("ukui-loading-1-symbolic"));
loadIcons.append(QIcon::fromTheme("ukui-loading-2-symbolic"));
loadIcons.append(QIcon::fromTheme("ukui-loading-3-symbolic"));
loadIcons.append(QIcon::fromTheme("ukui-loading-4-symbolic"));
loadIcons.append(QIcon::fromTheme("ukui-loading-5-symbolic"));
loadIcons.append(QIcon::fromTheme("ukui-loading-6-symbolic"));
loadIcons.append(QIcon::fromTheme("ukui-loading-7-symbolic"));
waitTimer = new QTimer(this); waitTimer = new QTimer(this);
connect(waitTimer, &QTimer::timeout, this, &LanItem::waitAnimStep); connect(waitTimer, &QTimer::timeout, this, &LanItem::updateIcon);
} }
LanItem::~LanItem() LanItem::~LanItem()
@ -36,14 +44,13 @@ LanItem::~LanItem()
} }
void LanItem::setWaitPage(int waitPage) void LanItem::updateIcon()
{ {
this->waitPage = waitPage; if (currentIconIndex > 6) {
} currentIconIndex = 0;
}
void LanItem::setCountCurrentTime(int countCurrentTime) statusLabel->setPixmap(loadIcons.at(currentIconIndex).pixmap(16,16));
{ currentIconIndex ++;
this->countCurrentTime = countCurrentTime;
} }
void LanItem::startLoading() void LanItem::startLoading()
@ -57,40 +64,6 @@ void LanItem::stopLoading(){
loading = false; loading = false;
} }
void LanItem::waitAnimStep()
{
QString qpmQss = "QLabel{background-image:url(':/img/plugins/netconnect/";
qpmQss.append(QString::number(this->waitPage));
QString imgPath = ":/img/plugins/netconnect/";
imgPath.append(QString::number(this->waitPage));
const QByteArray id(THEME_QT_SCHEMA);
themeGsettings = new QGSettings(id, QByteArray(), this);
if (themeGsettings->get(MODE_QT_KEY).toString() == "ukui-default") {
qpmQss.append("-black.png');}");
imgPath.append("-black.png");
} else {
qpmQss.append(".png');}");
imgPath.append(".png");
}
QImage img;
img.load(imgPath);
statusLabel->setText("");
statusLabel->setFixedSize(img.size());
statusLabel->setProperty("useIconHighlightEffect", 0x10);
statusLabel->setStyleSheet(qpmQss);
this->waitPage ++;
if (this->waitPage > TOTAL_PAGE) {
this->waitPage = 1; //循环播放8张图片
}
this->countCurrentTime += FRAME_SPEED;
if (this->countCurrentTime >= LIMIT_TIME) {
this->stopLoading(); //动画超出时间限制,强制停止动画
}
}
void LanItem::paintEvent(QPaintEvent *event) void LanItem::paintEvent(QPaintEvent *event)
{ {
QPalette pal = this->palette(); QPalette pal = this->palette();

View File

@ -23,13 +23,9 @@ public:
InfoButton * infoLabel = nullptr; InfoButton * infoLabel = nullptr;
FixLabel * titileLabel = nullptr; FixLabel * titileLabel = nullptr;
QLabel * statusLabel = nullptr; QLabel * statusLabel = nullptr;
int waitPage;
int countCurrentTime;
public: public:
void startLoading(); void startLoading();
void setWaitPage(int waitPage);
void setCountCurrentTime(int countCurrentTime);
void waitAnimStep();
void stopLoading(); void stopLoading();
bool loading = false; bool loading = false;
@ -44,6 +40,11 @@ protected:
private: private:
QTimer *waitTimer = nullptr; QTimer *waitTimer = nullptr;
QGSettings *themeGsettings = nullptr; QGSettings *themeGsettings = nullptr;
QList<QIcon> loadIcons;
int currentIconIndex=0;
private slots:
void updateIcon();
}; };

View File

@ -823,27 +823,22 @@ void NetConnect::itemActiveConnectionStatusChanged(LanItem *item, int status)
{ {
// QString iconPath = NoNetSymbolic; // QString iconPath = NoNetSymbolic;
if (status == ACTIVATING) { if (status == ACTIVATING) {
item->setCountCurrentTime(0);
item->setWaitPage(1);
item->startLoading(); item->startLoading();
} else if (status == ACTIVATED) { } else if (status == ACTIVATED) {
item->stopLoading(); item->stopLoading();
// iconPath = KLanSymbolic; // iconPath = KLanSymbolic;
item->statusLabel->setStyleSheet(""); item->statusLabel->clear();
item->statusLabel->setMinimumSize(36,36); item->statusLabel->setMinimumSize(36,36);
item->statusLabel->setMaximumSize(16777215,16777215); item->statusLabel->setMaximumSize(16777215,16777215);
item->statusLabel->setText(tr("connected")); item->statusLabel->setText(tr("connected"));
item->isAcitve = true; item->isAcitve = true;
} else if (status == DEACTIVATING) { } else if (status == DEACTIVATING) {
item->setCountCurrentTime(0);
item->setWaitPage(1);
item->startLoading(); item->startLoading();
} else { } else {
item->stopLoading(); item->stopLoading();
item->statusLabel->setStyleSheet("");
item->statusLabel->setMinimumSize(36,36); item->statusLabel->setMinimumSize(36,36);
item->statusLabel->setMaximumSize(16777215,16777215); item->statusLabel->setMaximumSize(16777215,16777215);
item->statusLabel->setText(""); item->statusLabel->clear();
item->isAcitve = false; item->isAcitve = false;
} }

View File

@ -986,26 +986,21 @@ void WlanConnect::removeOneWlanFrame(ItemFrame *frame, QString deviceName, QStri
void WlanConnect::itemActiveConnectionStatusChanged(WlanItem *item, int status) void WlanConnect::itemActiveConnectionStatusChanged(WlanItem *item, int status)
{ {
if (status == ACTIVATING) { if (status == ACTIVATING) {
item->setCountCurrentTime(0);
item->setWaitPage(1);
item->startLoading(); item->startLoading();
} else if (status == ACTIVATED) { } else if (status == ACTIVATED) {
item->stopLoading(); item->stopLoading();
item->statusLabel->setStyleSheet(""); item->statusLabel->clear();
item->statusLabel->setMinimumSize(36,36); item->statusLabel->setMinimumSize(36,36);
item->statusLabel->setMaximumSize(16777215,16777215); item->statusLabel->setMaximumSize(16777215,16777215);
item->statusLabel->setText(tr("connected")); item->statusLabel->setText(tr("connected"));
item->isAcitve = true; item->isAcitve = true;
} else if (status == DEACTIVATING) { } else if (status == DEACTIVATING) {
item->setCountCurrentTime(0);
item->setWaitPage(1);
item->startLoading(); item->startLoading();
} else if (status == DEACTIVATED) { } else if (status == DEACTIVATED) {
item->stopLoading(); item->stopLoading();
item->statusLabel->setStyleSheet(""); item->statusLabel->clear();
item->statusLabel->setMinimumSize(36,36); item->statusLabel->setMinimumSize(36,36);
item->statusLabel->setMaximumSize(16777215,16777215); item->statusLabel->setMaximumSize(16777215,16777215);
item->statusLabel->setText("");
item->isAcitve = false; item->isAcitve = false;
} }
} }

View File

@ -28,8 +28,18 @@ WlanItem::WlanItem(bool bAcitve, bool isLock, QWidget *parent)
mLanLyt->addStretch(); mLanLyt->addStretch();
mLanLyt->addWidget(statusLabel); mLanLyt->addWidget(statusLabel);
mLanLyt->addWidget(infoLabel); mLanLyt->addWidget(infoLabel);
loadIcons.append(QIcon::fromTheme("ukui-loading-1-symbolic"));
loadIcons.append(QIcon::fromTheme("ukui-loading-2-symbolic"));
loadIcons.append(QIcon::fromTheme("ukui-loading-3-symbolic"));
loadIcons.append(QIcon::fromTheme("ukui-loading-4-symbolic"));
loadIcons.append(QIcon::fromTheme("ukui-loading-5-symbolic"));
loadIcons.append(QIcon::fromTheme("ukui-loading-6-symbolic"));
loadIcons.append(QIcon::fromTheme("ukui-loading-7-symbolic"));
waitTimer = new QTimer(this); waitTimer = new QTimer(this);
connect(waitTimer, &QTimer::timeout, this, &WlanItem::waitAnimStep); connect(waitTimer, &QTimer::timeout, this, &WlanItem::updateIcon);
} }
WlanItem::~WlanItem() WlanItem::~WlanItem()
@ -37,14 +47,13 @@ WlanItem::~WlanItem()
} }
void WlanItem::setWaitPage(int waitPage) void WlanItem::updateIcon()
{ {
this->waitPage = waitPage; if (currentIconIndex > 6) {
} currentIconIndex = 0;
}
void WlanItem::setCountCurrentTime(int countCurrentTime) statusLabel->setPixmap(loadIcons.at(currentIconIndex).pixmap(16,16));
{ currentIconIndex ++;
this->countCurrentTime = countCurrentTime;
} }
void WlanItem::startLoading() void WlanItem::startLoading()
@ -58,40 +67,6 @@ void WlanItem::stopLoading(){
loading = false; loading = false;
} }
void WlanItem::waitAnimStep()
{
QString qpmQss = "QLabel{background-image:url(':/img/plugins/netconnect/";
qpmQss.append(QString::number(this->waitPage));
QString imgPath = ":/img/plugins/netconnect/";
imgPath.append(QString::number(this->waitPage));
const QByteArray id(THEME_QT_SCHEMA);
themeGsettings = new QGSettings(id, QByteArray(), this);
if (themeGsettings->get(MODE_QT_KEY).toString() == "ukui-default") {
qpmQss.append("-black.png');}");
imgPath.append("-black.png");
} else {
qpmQss.append(".png');}");
imgPath.append(".png");
}
QImage img;
img.load(imgPath);
statusLabel->setText("");
statusLabel->setFixedSize(img.size());
statusLabel->setProperty("useIconHighlightEffect", 0x10);
statusLabel->setStyleSheet(qpmQss);
this->waitPage ++;
if (this->waitPage > TOTAL_PAGE) {
this->waitPage = 1; //循环播放8张图片
}
this->countCurrentTime += FRAME_SPEED;
if (this->countCurrentTime >= LIMIT_TIME) {
this->stopLoading(); //动画超出时间限制,强制停止动画
}
}
void WlanItem::paintEvent(QPaintEvent *event) void WlanItem::paintEvent(QPaintEvent *event)
{ {
QPalette pal = this->palette(); QPalette pal = this->palette();

View File

@ -22,16 +22,11 @@ public:
InfoButton * infoLabel = nullptr; InfoButton * infoLabel = nullptr;
FixLabel * titileLabel = nullptr; FixLabel * titileLabel = nullptr;
QLabel * statusLabel = nullptr; QLabel * statusLabel = nullptr;
int waitPage;
int countCurrentTime;
QString uuid = ""; QString uuid = "";
void setHalfFillet(bool flag) {useHalfFillet = flag; repaint();} void setHalfFillet(bool flag) {useHalfFillet = flag; repaint();}
public: public:
void startLoading(); void startLoading();
void setWaitPage(int waitPage);
void setCountCurrentTime(int countCurrentTime);
void waitAnimStep();
void stopLoading(); void stopLoading();
bool isAcitve = false; bool isAcitve = false;
bool loading = false; bool loading = false;
@ -46,6 +41,11 @@ private:
QTimer *waitTimer = nullptr; QTimer *waitTimer = nullptr;
QGSettings *themeGsettings = nullptr; QGSettings *themeGsettings = nullptr;
bool useHalfFillet = false; bool useHalfFillet = false;
QList<QIcon> loadIcons;
int currentIconIndex=0;
private slots:
void updateIcon();
}; };

View File

@ -1,6 +1,10 @@
#include "kywirelessnetitem.h" #include "kywirelessnetitem.h"
#include <NetworkManagerQt/Connection> #include <NetworkManagerQt/Connection>
const QString ENTERPRICE_TYPE = "802.1X";
const QString WPA1_AND_WPA2 = "WPA";
const QString WPA3 = "WPA3";
QString enumToQstring(NetworkManager::AccessPoint::Capabilities cap, NetworkManager::AccessPoint::WpaFlags wpa_flags,NetworkManager::AccessPoint::WpaFlags rsn_flags) QString enumToQstring(NetworkManager::AccessPoint::Capabilities cap, NetworkManager::AccessPoint::WpaFlags wpa_flags,NetworkManager::AccessPoint::WpaFlags rsn_flags)
{ {
QString out; QString out;
@ -36,6 +40,7 @@ KyWirelessNetItem::KyWirelessNetItem(NetworkManager::WirelessNetwork::Ptr net)
m_connName = ""; m_connName = "";
m_connDbusPath = ""; m_connDbusPath = "";
m_secuType = ""; m_secuType = "";
m_kySecuType = NONE;
m_device = ""; m_device = "";
m_channel = 0; m_channel = 0;
@ -59,6 +64,13 @@ void KyWirelessNetItem::init(NetworkManager::WirelessNetwork::Ptr net)
NetworkManager::AccessPoint::WpaFlags wpaFlag = net->referenceAccessPoint()->wpaFlags(); NetworkManager::AccessPoint::WpaFlags wpaFlag = net->referenceAccessPoint()->wpaFlags();
NetworkManager::AccessPoint::WpaFlags rsnFlag = net->referenceAccessPoint()->rsnFlags(); NetworkManager::AccessPoint::WpaFlags rsnFlag = net->referenceAccessPoint()->rsnFlags();
m_secuType = enumToQstring(cap, wpaFlag, rsnFlag); m_secuType = enumToQstring(cap, wpaFlag, rsnFlag);
if (m_secuType.indexOf(ENTERPRICE_TYPE) >= 0) {
m_kySecuType = WPA_AND_WPA2_ENTERPRISE;
} else if (m_secuType.indexOf(WPA3) >= 0) {
m_kySecuType = WPA3_PERSONAL;
} else if ( m_secuType.indexOf(WPA1_AND_WPA2) >= 0) {
m_kySecuType = WPA_AND_WPA2_PERSONAL;
}
m_bssid = net->referenceAccessPoint()->hardwareAddress(); m_bssid = net->referenceAccessPoint()->hardwareAddress();
m_device = net->device(); m_device = net->device();
initInfoBySsid(); initInfoBySsid();

View File

@ -4,6 +4,7 @@
#include <QString> #include <QString>
#include "kylinnetworkresourcemanager.h" #include "kylinnetworkresourcemanager.h"
#include "kywirelessconnectoperation.h"
QString enumToQstring(NetworkManager::AccessPoint::Capabilities, NetworkManager::AccessPoint::WpaFlags, NetworkManager::AccessPoint::WpaFlags); QString enumToQstring(NetworkManager::AccessPoint::Capabilities, NetworkManager::AccessPoint::WpaFlags, NetworkManager::AccessPoint::WpaFlags);
@ -25,6 +26,7 @@ public:
int m_signalStrength; int m_signalStrength;
uint m_frequency; uint m_frequency;
QString m_secuType; QString m_secuType;
KySecuType m_kySecuType;
//only for m_isConfiged = true //only for m_isConfiged = true
bool m_isConfigured; bool m_isConfigured;

View File

@ -106,7 +106,10 @@ NetDetail::NetDetail(QString interface, QString name, QString uuid, bool isActiv
isDetailOk = !(m_name.isEmpty()); isDetailOk = !(m_name.isEmpty());
isIpv4Ok = true; isIpv4Ok = true;
isIpv6Ok = true; isIpv6Ok = true;
isSecuOk = true; isSecuOk = false;
if (!m_uuid.isEmpty() || (m_uuid.isEmpty() && m_info.secType == NONE)) {
isSecuOk = true;
}
qDebug() << interface << name << uuid << "isWlan" << isWlan << "isCreateNet" <<m_isCreateNet; qDebug() << interface << name << uuid << "isWlan" << isWlan << "isCreateNet" <<m_isCreateNet;
@ -442,6 +445,10 @@ void NetDetail::getBaseInfo(ConInfo &conInfo)
if (conInfo.strSecType.isEmpty()) { if (conInfo.strSecType.isEmpty()) {
conInfo.strSecType = tr("None"); conInfo.strSecType = tr("None");
} }
if (!item.m_isConfigured) {
conInfo.secType = item.m_kySecuType;
}
} }
} else { } else {
uint iHz,iChan; uint iHz,iChan;
@ -458,16 +465,19 @@ void NetDetail::getBaseInfo(ConInfo &conInfo)
KyKeyMgmt type = m_wirelessConnOpration->getConnectKeyMgmt(m_uuid); KyKeyMgmt type = m_wirelessConnOpration->getConnectKeyMgmt(m_uuid);
if (type == WpaNone || type == Unknown) { if (!m_uuid.isEmpty()) {
conInfo.secType = NONE; KyKeyMgmt type = m_wirelessConnOpration->getConnectKeyMgmt(m_uuid);
} else if (type == WpaPsk) { if (type == WpaNone || type == Unknown) {
conInfo.secType = WPA_AND_WPA2_PERSONAL; conInfo.secType = NONE;
} else if (type == SAE) { } else if (type == WpaPsk) {
conInfo.secType = WPA3_PERSONAL; conInfo.secType = WPA_AND_WPA2_PERSONAL;
} else if (type == WpaEap) { } else if (type == SAE) {
conInfo.secType = WPA_AND_WPA2_ENTERPRISE; conInfo.secType = WPA3_PERSONAL;
} else { } else if (type == WpaEap) {
qDebug() << "KeyMgmt not support now " << type; conInfo.secType = WPA_AND_WPA2_ENTERPRISE;
} else {
qDebug() << "KeyMgmt not support now " << type;
}
} }
initSecuData(); initSecuData();