fix bug 101649
This commit is contained in:
parent
285cef5be9
commit
8fb0b84c52
|
@ -27,8 +27,16 @@ LanItem::LanItem(bool isAcitve, QWidget *parent)
|
|||
mLanLyt->addStretch();
|
||||
mLanLyt->addWidget(statusLabel);
|
||||
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);
|
||||
connect(waitTimer, &QTimer::timeout, this, &LanItem::waitAnimStep);
|
||||
connect(waitTimer, &QTimer::timeout, this, &LanItem::updateIcon);
|
||||
}
|
||||
|
||||
LanItem::~LanItem()
|
||||
|
@ -36,14 +44,13 @@ LanItem::~LanItem()
|
|||
|
||||
}
|
||||
|
||||
void LanItem::setWaitPage(int waitPage)
|
||||
void LanItem::updateIcon()
|
||||
{
|
||||
this->waitPage = waitPage;
|
||||
}
|
||||
|
||||
void LanItem::setCountCurrentTime(int countCurrentTime)
|
||||
{
|
||||
this->countCurrentTime = countCurrentTime;
|
||||
if (currentIconIndex > 6) {
|
||||
currentIconIndex = 0;
|
||||
}
|
||||
statusLabel->setPixmap(loadIcons.at(currentIconIndex).pixmap(16,16));
|
||||
currentIconIndex ++;
|
||||
}
|
||||
|
||||
void LanItem::startLoading()
|
||||
|
@ -57,40 +64,6 @@ void LanItem::stopLoading(){
|
|||
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)
|
||||
{
|
||||
QPalette pal = this->palette();
|
||||
|
|
|
@ -23,13 +23,9 @@ public:
|
|||
InfoButton * infoLabel = nullptr;
|
||||
FixLabel * titileLabel = nullptr;
|
||||
QLabel * statusLabel = nullptr;
|
||||
int waitPage;
|
||||
int countCurrentTime;
|
||||
|
||||
public:
|
||||
void startLoading();
|
||||
void setWaitPage(int waitPage);
|
||||
void setCountCurrentTime(int countCurrentTime);
|
||||
void waitAnimStep();
|
||||
void stopLoading();
|
||||
|
||||
bool loading = false;
|
||||
|
@ -44,6 +40,11 @@ protected:
|
|||
private:
|
||||
QTimer *waitTimer = nullptr;
|
||||
QGSettings *themeGsettings = nullptr;
|
||||
QList<QIcon> loadIcons;
|
||||
int currentIconIndex=0;
|
||||
|
||||
private slots:
|
||||
void updateIcon();
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -823,27 +823,22 @@ void NetConnect::itemActiveConnectionStatusChanged(LanItem *item, int status)
|
|||
{
|
||||
// QString iconPath = NoNetSymbolic;
|
||||
if (status == ACTIVATING) {
|
||||
item->setCountCurrentTime(0);
|
||||
item->setWaitPage(1);
|
||||
item->startLoading();
|
||||
} else if (status == ACTIVATED) {
|
||||
item->stopLoading();
|
||||
// iconPath = KLanSymbolic;
|
||||
item->statusLabel->setStyleSheet("");
|
||||
item->statusLabel->clear();
|
||||
item->statusLabel->setMinimumSize(36,36);
|
||||
item->statusLabel->setMaximumSize(16777215,16777215);
|
||||
item->statusLabel->setText(tr("connected"));
|
||||
item->isAcitve = true;
|
||||
} else if (status == DEACTIVATING) {
|
||||
item->setCountCurrentTime(0);
|
||||
item->setWaitPage(1);
|
||||
item->startLoading();
|
||||
} else {
|
||||
item->stopLoading();
|
||||
item->statusLabel->setStyleSheet("");
|
||||
item->statusLabel->setMinimumSize(36,36);
|
||||
item->statusLabel->setMaximumSize(16777215,16777215);
|
||||
item->statusLabel->setText("");
|
||||
item->statusLabel->clear();
|
||||
item->isAcitve = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -986,26 +986,21 @@ void WlanConnect::removeOneWlanFrame(ItemFrame *frame, QString deviceName, QStri
|
|||
void WlanConnect::itemActiveConnectionStatusChanged(WlanItem *item, int status)
|
||||
{
|
||||
if (status == ACTIVATING) {
|
||||
item->setCountCurrentTime(0);
|
||||
item->setWaitPage(1);
|
||||
item->startLoading();
|
||||
} else if (status == ACTIVATED) {
|
||||
item->stopLoading();
|
||||
item->statusLabel->setStyleSheet("");
|
||||
item->statusLabel->clear();
|
||||
item->statusLabel->setMinimumSize(36,36);
|
||||
item->statusLabel->setMaximumSize(16777215,16777215);
|
||||
item->statusLabel->setText(tr("connected"));
|
||||
item->isAcitve = true;
|
||||
} else if (status == DEACTIVATING) {
|
||||
item->setCountCurrentTime(0);
|
||||
item->setWaitPage(1);
|
||||
item->startLoading();
|
||||
} else if (status == DEACTIVATED) {
|
||||
item->stopLoading();
|
||||
item->statusLabel->setStyleSheet("");
|
||||
item->statusLabel->clear();
|
||||
item->statusLabel->setMinimumSize(36,36);
|
||||
item->statusLabel->setMaximumSize(16777215,16777215);
|
||||
item->statusLabel->setText("");
|
||||
item->isAcitve = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,8 +28,18 @@ WlanItem::WlanItem(bool bAcitve, bool isLock, QWidget *parent)
|
|||
mLanLyt->addStretch();
|
||||
mLanLyt->addWidget(statusLabel);
|
||||
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);
|
||||
connect(waitTimer, &QTimer::timeout, this, &WlanItem::waitAnimStep);
|
||||
connect(waitTimer, &QTimer::timeout, this, &WlanItem::updateIcon);
|
||||
|
||||
}
|
||||
|
||||
WlanItem::~WlanItem()
|
||||
|
@ -37,14 +47,13 @@ WlanItem::~WlanItem()
|
|||
|
||||
}
|
||||
|
||||
void WlanItem::setWaitPage(int waitPage)
|
||||
void WlanItem::updateIcon()
|
||||
{
|
||||
this->waitPage = waitPage;
|
||||
}
|
||||
|
||||
void WlanItem::setCountCurrentTime(int countCurrentTime)
|
||||
{
|
||||
this->countCurrentTime = countCurrentTime;
|
||||
if (currentIconIndex > 6) {
|
||||
currentIconIndex = 0;
|
||||
}
|
||||
statusLabel->setPixmap(loadIcons.at(currentIconIndex).pixmap(16,16));
|
||||
currentIconIndex ++;
|
||||
}
|
||||
|
||||
void WlanItem::startLoading()
|
||||
|
@ -58,40 +67,6 @@ void WlanItem::stopLoading(){
|
|||
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)
|
||||
{
|
||||
QPalette pal = this->palette();
|
||||
|
|
|
@ -22,16 +22,11 @@ public:
|
|||
InfoButton * infoLabel = nullptr;
|
||||
FixLabel * titileLabel = nullptr;
|
||||
QLabel * statusLabel = nullptr;
|
||||
int waitPage;
|
||||
int countCurrentTime;
|
||||
QString uuid = "";
|
||||
|
||||
void setHalfFillet(bool flag) {useHalfFillet = flag; repaint();}
|
||||
public:
|
||||
void startLoading();
|
||||
void setWaitPage(int waitPage);
|
||||
void setCountCurrentTime(int countCurrentTime);
|
||||
void waitAnimStep();
|
||||
void stopLoading();
|
||||
bool isAcitve = false;
|
||||
bool loading = false;
|
||||
|
@ -46,6 +41,11 @@ private:
|
|||
QTimer *waitTimer = nullptr;
|
||||
QGSettings *themeGsettings = nullptr;
|
||||
bool useHalfFillet = false;
|
||||
QList<QIcon> loadIcons;
|
||||
int currentIconIndex=0;
|
||||
|
||||
private slots:
|
||||
void updateIcon();
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
#include "kywirelessnetitem.h"
|
||||
#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 out;
|
||||
|
@ -36,6 +40,7 @@ KyWirelessNetItem::KyWirelessNetItem(NetworkManager::WirelessNetwork::Ptr net)
|
|||
m_connName = "";
|
||||
m_connDbusPath = "";
|
||||
m_secuType = "";
|
||||
m_kySecuType = NONE;
|
||||
m_device = "";
|
||||
m_channel = 0;
|
||||
|
||||
|
@ -59,6 +64,13 @@ void KyWirelessNetItem::init(NetworkManager::WirelessNetwork::Ptr net)
|
|||
NetworkManager::AccessPoint::WpaFlags wpaFlag = net->referenceAccessPoint()->wpaFlags();
|
||||
NetworkManager::AccessPoint::WpaFlags rsnFlag = net->referenceAccessPoint()->rsnFlags();
|
||||
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_device = net->device();
|
||||
initInfoBySsid();
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <QString>
|
||||
|
||||
#include "kylinnetworkresourcemanager.h"
|
||||
#include "kywirelessconnectoperation.h"
|
||||
|
||||
QString enumToQstring(NetworkManager::AccessPoint::Capabilities, NetworkManager::AccessPoint::WpaFlags, NetworkManager::AccessPoint::WpaFlags);
|
||||
|
||||
|
@ -25,6 +26,7 @@ public:
|
|||
int m_signalStrength;
|
||||
uint m_frequency;
|
||||
QString m_secuType;
|
||||
KySecuType m_kySecuType;
|
||||
|
||||
//only for m_isConfiged = true
|
||||
bool m_isConfigured;
|
||||
|
|
|
@ -106,7 +106,10 @@ NetDetail::NetDetail(QString interface, QString name, QString uuid, bool isActiv
|
|||
isDetailOk = !(m_name.isEmpty());
|
||||
isIpv4Ok = 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;
|
||||
|
||||
|
@ -442,6 +445,10 @@ void NetDetail::getBaseInfo(ConInfo &conInfo)
|
|||
if (conInfo.strSecType.isEmpty()) {
|
||||
conInfo.strSecType = tr("None");
|
||||
}
|
||||
|
||||
if (!item.m_isConfigured) {
|
||||
conInfo.secType = item.m_kySecuType;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
uint iHz,iChan;
|
||||
|
@ -458,16 +465,19 @@ void NetDetail::getBaseInfo(ConInfo &conInfo)
|
|||
|
||||
|
||||
KyKeyMgmt type = m_wirelessConnOpration->getConnectKeyMgmt(m_uuid);
|
||||
if (type == WpaNone || type == Unknown) {
|
||||
conInfo.secType = NONE;
|
||||
} else if (type == WpaPsk) {
|
||||
conInfo.secType = WPA_AND_WPA2_PERSONAL;
|
||||
} else if (type == SAE) {
|
||||
conInfo.secType = WPA3_PERSONAL;
|
||||
} else if (type == WpaEap) {
|
||||
conInfo.secType = WPA_AND_WPA2_ENTERPRISE;
|
||||
} else {
|
||||
qDebug() << "KeyMgmt not support now " << type;
|
||||
if (!m_uuid.isEmpty()) {
|
||||
KyKeyMgmt type = m_wirelessConnOpration->getConnectKeyMgmt(m_uuid);
|
||||
if (type == WpaNone || type == Unknown) {
|
||||
conInfo.secType = NONE;
|
||||
} else if (type == WpaPsk) {
|
||||
conInfo.secType = WPA_AND_WPA2_PERSONAL;
|
||||
} else if (type == SAE) {
|
||||
conInfo.secType = WPA3_PERSONAL;
|
||||
} else if (type == WpaEap) {
|
||||
conInfo.secType = WPA_AND_WPA2_ENTERPRISE;
|
||||
} else {
|
||||
qDebug() << "KeyMgmt not support now " << type;
|
||||
}
|
||||
}
|
||||
|
||||
initSecuData();
|
||||
|
|
Loading…
Reference in New Issue