合并冲突

This commit is contained in:
jzxc95 2022-09-22 17:25:16 +08:00
commit 937a891ff0
28 changed files with 241 additions and 109 deletions

View File

@ -311,7 +311,12 @@ void KyNetworkResourceManager::addWifiNetwork(NetworkManager::WirelessNetwork::P
//device signals
connect(net.data(), &NetworkManager::WirelessNetwork::signalStrengthChanged, this, &KyNetworkResourceManager::onUpdateWirelessNet);
connect(net.data(), &NetworkManager::WirelessNetwork::referenceAccessPointChanged, this, &KyNetworkResourceManager::onUpdateWirelessNet);
connect(net.data(), &NetworkManager::WirelessNetwork::referenceAccessPointChanged, this, &KyNetworkResourceManager::onReferenceAccessPointChanged);
connect(net.data(), &NetworkManager::WirelessNetwork::disappeared, this, &KyNetworkResourceManager::onUpdateWirelessNet);
connect(net->referenceAccessPoint().data(), &NetworkManager::AccessPoint::wpaFlagsChanged, this, &KyNetworkResourceManager::onWifiNetworkSecuChang,
Qt::UniqueConnection);
connect(net->referenceAccessPoint().data(), &NetworkManager::AccessPoint::rsnFlagsChanged, this, &KyNetworkResourceManager::onWifiNetworkSecuChang,
Qt::UniqueConnection);
}
void KyNetworkResourceManager::insertWifiNetworks()
@ -867,6 +872,31 @@ void KyNetworkResourceManager::onWifiNetworkDisappeared(QString const & ssid)
return;
}
void KyNetworkResourceManager::onReferenceAccessPointChanged()
{
NetworkManager::WirelessNetwork *p_wirelessNet =
qobject_cast<NetworkManager::WirelessNetwork *>(sender());
if (nullptr != p_wirelessNet) {
onAccessPointUpdate(p_wirelessNet);
}
}
void KyNetworkResourceManager::onAccessPointUpdate(NetworkManager::WirelessNetwork * net)
{
if (nullptr == net) {
return;
}
auto index = std::find(m_wifiNets.cbegin(), m_wifiNets.cend(), net);
if (m_wifiNets.cend() != index) {
if (!net->referenceAccessPoint().isNull()) {
connect(net->referenceAccessPoint().data(), &NetworkManager::AccessPoint::wpaFlagsChanged, this, &KyNetworkResourceManager::onWifiNetworkSecuChang,
Qt::UniqueConnection);
connect(net->referenceAccessPoint().data(), &NetworkManager::AccessPoint::rsnFlagsChanged, this, &KyNetworkResourceManager::onWifiNetworkSecuChang,
Qt::UniqueConnection);
}
}
}
void KyNetworkResourceManager::onUpdateWirelessNet()
{
NetworkManager::WirelessNetwork *p_wirelessNet =
@ -878,6 +908,13 @@ void KyNetworkResourceManager::onUpdateWirelessNet()
return;
}
void KyNetworkResourceManager::onWifiNetworkSecuChang()
{
NetworkManager::AccessPoint *p_wirelessNet =
qobject_cast<NetworkManager::AccessPoint *>(sender());
emit wifiNetworkSecuChange(p_wirelessNet);
}
void KyNetworkResourceManager::onDeviceAdded(QString const & uni)
{
qDebug()<< "onDeviceAdded"<<uni;

View File

@ -123,6 +123,7 @@ Q_SIGNALS:
void wifiNetworkRemoved(QString, QString);
void wifiNetworkAdded(QString, QString);
void wifiNetworkPropertyChange(NetworkManager::WirelessNetwork * net);
void wifiNetworkSecuChange(NetworkManager::AccessPoint *);
void wifiNetworkDeviceDisappear();
void wifiEnabledChanged(bool);
void wiredEnabledChanged(bool);
@ -181,6 +182,7 @@ private Q_SLOTS:
//wifi network
void onUpdateWirelessNet();
void onWifiNetworkSecuChang();
//notifier
void onDeviceAdded(QString const & uni);
@ -197,6 +199,9 @@ private:
void onWifiNetworkUpdate(NetworkManager::WirelessNetwork * net);
void onWifiNetworkRemove(NetworkManager::Device * dev, QString const & ssid);
void onAccessPointUpdate(NetworkManager::WirelessNetwork * net);
void onReferenceAccessPointChanged();
private:
bool m_initFinished = false;

View File

@ -89,13 +89,14 @@ 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;
}
// 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;
// }
setKySecuType(m_secuType);
m_bssid = net->referenceAccessPoint()->hardwareAddress();
m_device = net->device();
m_uni = net->referenceAccessPoint()->uni();
@ -151,3 +152,16 @@ int KyWirelessNetItem::getCategory(QString uni)
}
}
void KyWirelessNetItem::setKySecuType(QString strSecuType)
{
if (strSecuType.indexOf(ENTERPRICE_TYPE) >= 0) {
m_kySecuType = WPA_AND_WPA2_ENTERPRISE;
} else if (strSecuType.indexOf(WPA3) >= 0) {
m_kySecuType = WPA3_PERSONAL;
} else if ( strSecuType.indexOf(WPA1_AND_WPA2) >= 0) {
m_kySecuType = WPA_AND_WPA2_PERSONAL;
} else {
m_kySecuType = NONE;
}
}

View File

@ -55,6 +55,7 @@ public:
uint m_channel;
int getCategory(QString uni);
void setKySecuType(QString strSecuType);
private:
KyNetworkResourceManager *m_networkResourceInstance = nullptr;

View File

@ -21,6 +21,9 @@
#include "kylinutil.h"
#define LOG_FLAG "[KyWirelessNetResource]"
const QString ENTERPRICE_TYPE = "802.1X";
const QString WPA1_AND_WPA2 = "WPA";
const QString WPA3 = "WPA3";
static bool subWifiListSort(const KyWirelessNetItem info1, const KyWirelessNetItem info2)
{
@ -63,6 +66,8 @@ KyWirelessNetResource::KyWirelessNetResource(QObject *parent)
this, &KyWirelessNetResource::onWifiNetworkRemoved, Qt::ConnectionType::DirectConnection);
connect(m_networkResourceInstance, &KyNetworkResourceManager::wifiNetworkPropertyChange,
this, &KyWirelessNetResource::onWifiNetworkPropertyChange, Qt::ConnectionType::DirectConnection);
connect(m_networkResourceInstance, &KyNetworkResourceManager::wifiNetworkSecuChange,
this, &KyWirelessNetResource::onWifiNetworkSecuChange, Qt::ConnectionType::DirectConnection);
connect(m_networkResourceInstance, &KyNetworkResourceManager::wifiNetworkDeviceDisappear,
this, &KyWirelessNetResource::onWifiNetworkDeviceDisappear, Qt::ConnectionType::DirectConnection);
@ -426,12 +431,39 @@ void KyWirelessNetResource::onWifiNetworkRemoved(QString devIfaceName, QString s
}
}
void KyWirelessNetResource::onWifiNetworkSecuChange(NetworkManager::AccessPoint *accessPointPtr)
{
QString secuType = enumToQstring(accessPointPtr->capabilities(),
accessPointPtr->wpaFlags(),
accessPointPtr->rsnFlags());
QMap<QString, QList<KyWirelessNetItem> >::iterator iter = m_WifiNetworkList.begin();
while (iter != m_WifiNetworkList.end()) {
QList<KyWirelessNetItem>::iterator itemIter = iter.value().begin();
while (itemIter != iter.value().end()) {
if (itemIter->m_NetSsid == accessPointPtr->ssid()) {
QString devName = iter.key();
itemIter->m_secuType = secuType;
itemIter->setKySecuType(secuType);
//qDebug() << "!!!!" << itemIter->m_NetSsid << itemIter->m_secuType << itemIter->m_kySecuType;
emit secuTypeChange(devName, accessPointPtr->ssid(), secuType);
break;
}
itemIter++;
}
iter++;
}
}
void KyWirelessNetResource::onWifiNetworkPropertyChange(NetworkManager::WirelessNetwork * net)
{
if (nullptr == net) {
return;
}
qDebug() << "onWifiNetworkPropertyChange" << net->ssid();
NetworkManager::AccessPoint::Ptr accessPointPtr = net->referenceAccessPoint();
QByteArray rawSsid = accessPointPtr->rawSsid();
QString wifiSsid = getSsidFromByteArray(rawSsid);
@ -460,7 +492,8 @@ void KyWirelessNetResource::onWifiNetworkPropertyChange(NetworkManager::Wireless
accessPointPtr->wpaFlags(),
accessPointPtr->rsnFlags());
if (iter->m_secuType != secuType) {
iter->m_secuType = secuType;
//qDebug() << "!!!!secuTypeChange" << wifiSsid << iter->m_secuType << "change to " << secuType;
iter->setKySecuType(secuType);
Q_EMIT secuTypeChange(devIface, wifiSsid, secuType);
}
@ -693,7 +726,7 @@ void KyWirelessNetResource::onConnectionRemove(QString path)
for(auto var = map.cbegin(); var != map.cend(); var++) {
QString devIfaceName = var.key();
QString ssid = var.value();
Q_EMIT connectionRemove(devIfaceName, ssid);
Q_EMIT connectionRemove(devIfaceName, ssid, path);
}
}

View File

@ -64,6 +64,7 @@ public Q_SLOTS:
void onWifiNetworkAdded(QString, QString);
void onWifiNetworkRemoved(QString, QString);
void onWifiNetworkPropertyChange(NetworkManager::WirelessNetwork * net);
void onWifiNetworkSecuChange(NetworkManager::AccessPoint *accessPointPtr);
void onWifiNetworkDeviceDisappear();
void onConnectionAdd(QString uuid);
@ -78,7 +79,7 @@ Q_SIGNALS:
void signalStrengthChange(QString, QString, int);
void bssidChange(QString, QString, QString);
void secuTypeChange(QString, QString, QString);
void connectionRemove(QString, QString);
void connectionRemove(QString, QString, QString);
void connectionAdd(QString, QString);
void wifiNetworkUpdate();
void wifiNetworkAdd(QString, KyWirelessNetItem&);

View File

@ -22,9 +22,9 @@
#define MAIN_LAYOUT_MARGINS 0,0,0,0
#define MAIN_LAYOUT_SPACING 0
#define ITEM_FRAME_MARGINS 16,6,16,6
#define ITEM_FRAME_SPACING 10
#define FRAME_WIDTH 395
#define ITEM_FRAME_MARGINS 12,6,16,6
#define ITEM_FRAME_SPACING 8
#define FRAME_WIDTH 404
#define INFO_ICON_WIDTH 16
#define INFO_ICON_HEIGHT 16
#define LIGHT_HOVER_COLOR QColor(240,240,240,255)
@ -155,7 +155,7 @@ void ListItem::initUI()
m_hItemLayout = new QHBoxLayout(m_itemFrame);
m_hItemLayout->setContentsMargins(ITEM_FRAME_MARGINS);
// m_hItemLayout->setSpacing(ITEM_FRAME_SPACING);
m_hItemLayout->setSpacing(ITEM_FRAME_SPACING);
m_netButton = new RadioItemButton(m_itemFrame);
m_nameLabel = new FixLabel(m_itemFrame);

View File

@ -28,6 +28,10 @@
#define ENABLE_BUTTON_COLOR qApp->palette().highlight().color()
#define UNABLE_BUTTON_COLOR qApp->palette().button().color()
const QString ENTERPRICE_TYPE = "802.1X";
const QString WPA1_AND_WPA2 = "WPA";
const QString WPA3 = "WPA3";
WlanListItem::WlanListItem(KyWirelessNetItem &wirelessNetItem, QString device, bool isApMode, QWidget *parent)
: WlanListItem(wirelessNetItem, device, parent)
{
@ -84,6 +88,11 @@ QString WlanListItem::getUuid()
return m_wirelessNetItem.m_connectUuid;
}
QString WlanListItem::getPath()
{
return m_wirelessNetItem.m_connDbusPath;
}
void WlanListItem::setSignalStrength(const int &signal)
{
m_wirelessNetItem.m_signalStrength = signal;
@ -467,7 +476,7 @@ void WlanListItem::onNetButtonClicked()
} else {
qDebug() << "KeyMgmt not support now " << type;
}
//qDebug() << "!!!!" << m_wirelessNetItem.m_kySecuType << kySecuType;
//有配置或者无密码的wifi直接连接
if (m_wirelessNetItem.m_isConfigured) {
if (m_wirelessNetItem.m_kySecuType == kySecuType) {
@ -512,7 +521,7 @@ void WlanListItem::updateWirelessNetSecurity(QString ssid, QString securityType)
}
qDebug() << LOG_FLAG << "Security changed! ssid = " << m_wirelessNetItem.m_NetSsid
<< "; security = " << m_wirelessNetItem.m_secuType << "." <<Q_FUNC_INFO << __LINE__;
<< "; security = " << m_wirelessNetItem.m_secuType << "change to "<< securityType <<Q_FUNC_INFO << __LINE__;
m_wirelessNetItem.m_secuType = securityType;
bool newSecu = (m_wirelessNetItem.m_secuType.isEmpty() || m_wirelessNetItem.m_secuType == "") ? false : true;
@ -521,6 +530,8 @@ void WlanListItem::updateWirelessNetSecurity(QString ssid, QString securityType)
refreshIcon(false);
}
m_wirelessNetItem.setKySecuType(securityType);
return;
}

View File

@ -61,6 +61,8 @@ public:
QString getSsid();
QString getUuid();
QString getPath();
void setSignalStrength(const int &signal);
int getSignalStrength();

View File

@ -375,7 +375,7 @@ void MainWindow::resetWindowPosition()
return;
}
#define MARGIN 4
#define MARGIN 8
#define PANEL_TOP 1
#define PANEL_LEFT 2
#define PANEL_RIGHT 3

View File

@ -48,7 +48,7 @@ void CreatNetPage::initUI()
m_secDnsLabel = new QLabel(this);
m_connNameLabel->setText(tr("Connection Name"));
m_configLabel->setText(tr("Ipv4Config"));
m_configLabel->setText(tr("IPv4Config"));
m_addressLabel->setText(tr("Address"));
m_maskLabel->setText(tr("Netmask"));
m_gateWayLabel->setText(tr("Default Gateway"));

View File

@ -243,17 +243,17 @@ void DetailPage::initUI() {
m_IPV4 = new QLabel(this);
m_ipv4Widget = new DetailWidget(qobject_cast<QWidget *>(m_IPV4), m_listWidget);
m_ipv4Widget->setKey(tr("IPV4:"));
m_ipv4Widget->setKey(tr("IPv4:"));
m_IPV4Dns = new QLabel(this);
m_ipv4DnsWidget = new DetailWidget(qobject_cast<QWidget *>(m_IPV4Dns), m_listWidget);
m_ipv4DnsWidget->setKey(tr("IPV4 Dns:"));
m_ipv4DnsWidget->setKey(tr("IPv4 Dns:"));
m_IPV6 = new FixLabel(this);
m_IPV6->setFixedWidth(MAX_LABEL_WIDTH);
m_IPV6->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
m_ipv6Widget = new DetailWidget(qobject_cast<QWidget *>(m_IPV6), m_listWidget);
m_ipv6Widget->setKey(tr("IPV6:"));
m_ipv6Widget->setKey(tr("IPv6:"));
m_Mac = new QLabel(this);
m_macWidget = new DetailWidget(qobject_cast<QWidget *>(m_Mac), m_listWidget);
@ -322,9 +322,9 @@ void DetailPage::on_btnCopyNetDetail_clicked()
QString hzCopy= tr ("Hz:");
QString chanCopy= tr ("Chan:");
QString bandwithCopy = tr("BandWidth:");
QString ipv4Copy = tr("IPV4:");
QString ipv4dnsCopy = tr("IPV4 Dns:");
QString ipv6Copy = tr("IPV6:");
QString ipv4Copy = tr("IPv4:");
QString ipv4dnsCopy = tr("IPv4 Dns:");
QString ipv6Copy = tr("IPv6:");
QString macCopy = tr("Mac:");
QString netDetailCopyText;

View File

@ -68,7 +68,7 @@ void Ipv4Page::initUI() {
m_firstDnsEmptyLabel->setFixedHeight(LABEL_HEIGHT);
m_configLabel->setText(tr("Ipv4Config"));
m_configLabel->setText(tr("IPv4Config"));
m_addressLabel->setText(tr("Address"));
m_maskLabel->setText(tr("Netmask"));
m_gateWayLabel->setText(tr("Default Gateway"));

View File

@ -149,7 +149,7 @@ void Ipv6Page::initUI() {
m_firstDnsEmptyLabel->setFixedHeight(LABEL_HEIGHT);
m_configLabel->setText(tr("Ipv6Config"));
m_configLabel->setText(tr("IPv6Config"));
m_addressLabel->setText(tr("Address"));
m_subnetLabel->setText(tr("Subnet prefix Length"));
m_gateWayLabel->setText(tr("Default Gateway"));

View File

@ -37,7 +37,7 @@
#define WINDOW_HEIGHT 602
#define ICON_SIZE 22,22
#define TITLE_LAYOUT_MARGINS 9,9,0,0
#define CENTER_LAYOUT_MARGINS 24,0,0,0
#define CENTER_LAYOUT_MARGINS 24,0,24,0
#define BOTTOM_LAYOUT_MARGINS 24,0,24,0
#define BOTTOM_LAYOUT_SPACING 16
#define PAGE_LAYOUT_SPACING 1
@ -328,15 +328,15 @@ void NetDetail::initUI()
pageFrame = new QFrame(this);
QHBoxLayout *pageLayout = new QHBoxLayout(pageFrame);
pageLayout->setSpacing(PAGE_LAYOUT_SPACING);
// pageLayout->setSpacing(PAGE_LAYOUT_SPACING);
// TabBar
// m_netTabBar = new KTabBar(KTabBarStyle::SegmentDark, this);
m_netTabBar = new NetTabBar(this);
m_netTabBar->setTabBarStyle(KTabBarStyle::SegmentDark);
m_netTabBar->addTab(tr("Detail")); //详情
m_netTabBar->addTab(tr("Ipv4"));//Ipv4
m_netTabBar->addTab(tr("Ipv6"));//Ipv6
m_netTabBar->addTab(tr("IPv4"));//Ipv4
m_netTabBar->addTab(tr("IPv6"));//Ipv6
if (isWlan) {
m_netTabBar->addTab(tr("Security"));//安全
if (isActive) {
@ -354,9 +354,7 @@ void NetDetail::initUI()
}
}
pageLayout->addStretch();
pageLayout->addWidget(m_netTabBar);
pageLayout->addStretch();
pageLayout->addWidget(m_netTabBar, Qt::AlignCenter);
// TabBar关联选项卡页面
connect(m_netTabBar, SIGNAL(currentChanged(int)), this, SLOT(currentRowChangeSlot(int)));
@ -371,8 +369,6 @@ void NetDetail::initUI()
forgetBtn = new QPushButton(this);
forgetBtn->setText(tr("Forget this network"));
this->setWindowIcon(QIcon::fromTheme("kylin-network"));
QVBoxLayout *centerlayout = new QVBoxLayout(centerWidget);
centerlayout->setContentsMargins(CENTER_LAYOUT_MARGINS);
centerlayout->addWidget(pageFrame);

View File

@ -27,6 +27,7 @@ FirewallDialog::FirewallDialog(KDialog *parent)
this->setWindowIcon(QIcon::fromTheme("kylin-network"));
this->setFixedSize(480, 204);
setAttribute(Qt::WA_DeleteOnClose);
centerToScreen();
}
FirewallDialog::~FirewallDialog()
@ -84,6 +85,17 @@ void FirewallDialog::initUI()
this->closeButton();
this->mainWidget()->setLayout(m_dialogLayout);
connect(m_YesBtn, &QPushButton::clicked, this, &FirewallDialog::setPrivateNetMode);
connect(m_NoBtn, &QPushButton::clicked, this, &FirewallDialog::setPublicNetMode);
connect(m_YesBtn, &QPushButton::clicked, this, &FirewallDialog::setPublicNetMode);
connect(m_NoBtn, &QPushButton::clicked, this, &FirewallDialog::setPrivateNetMode);
}
void FirewallDialog::centerToScreen()
{
QDesktopWidget* m = QApplication::desktop();
QRect desk_rect = m->screenGeometry(m->screenNumber(QCursor::pos()));
int desk_x = desk_rect.width();
int desk_y = desk_rect.height();
int x = this->width();
int y = this->height();
this->move(desk_x / 2 - x / 2 + desk_rect.left(), desk_y / 2 - y / 2 + desk_rect.top());
}

View File

@ -24,6 +24,8 @@
#include <QHBoxLayout>
#include <QFormLayout>
#include <QLabel>
#include <QDesktopWidget>
#include <QApplication>
#include "kwidget.h"
#include "kdialog.h"
@ -41,6 +43,7 @@ public:
private:
void initUI();
void centerToScreen();
QString m_uuid;
QLabel * m_iconLabel = nullptr;
QLabel * m_contentLabel = nullptr;

View File

@ -747,7 +747,7 @@ void LanPage::initUI()
m_activatedLanListWidget->setPalette(pal);
m_inactivatedLanListWidget->setPalette(pal);
m_settingsBtn->installEventFilter(this);
m_settingsLabel->installEventFilter(this);
m_netSwitch->installEventFilter(this);
}
@ -1170,7 +1170,7 @@ void LanPage::setWiredDeviceEnable(const QString& devName, bool enable)
bool LanPage::eventFilter(QObject *watched, QEvent *event)
{
if (watched == m_settingsBtn) {
if (watched == m_settingsLabel) {
if (event->type() == QEvent::MouseButtonRelease) {
onShowControlCenter();
}

View File

@ -116,10 +116,16 @@ void TabPage::initUI()
m_settingsLayout = new QHBoxLayout(m_settingsFrame);
m_settingsLayout->setContentsMargins(SETTINGS_LAYOUT_MARGINS);
m_settingsBtn = new KBorderlessButton(m_settingsFrame);
m_settingsBtn->setText(tr("Settings"));
// m_settingsBtn = new KBorderlessButton(m_settingsFrame);
// m_settingsBtn->setText(tr("Settings"));
// m_settingsLayout->addWidget(m_settingsBtn);
m_settingsLayout->addWidget(m_settingsBtn);
m_settingsLabel = new KyLable(m_settingsFrame);
m_settingsLabel->setCursor(Qt::PointingHandCursor);
m_settingsLabel->setText(tr("Settings"));
m_settingsLabel->setScaledContents(true);
m_settingsLayout->addWidget(m_settingsLabel);
m_settingsLayout->addStretch();
m_settingsFrame->setLayout(m_settingsLayout);

View File

@ -21,6 +21,7 @@
#define TABPAGE_H
#include "divider.h"
#include "kylable.h"
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QFormLayout>
@ -36,7 +37,7 @@
#include "firewalldialog.h"
#include "kwidget.h"
#include "kswitchbutton.h"
#include "kborderlessbutton.h"
//#include "kborderlessbutton.h"
using namespace kdk;
@ -57,14 +58,14 @@ enum network_mode {
#define NET_LIST_SPACING 0
#define TEXT_MARGINS 16,0,0,0
//#define SCROLL_AREA_HEIGHT 200
#define SETTINGS_LAYOUT_MARGINS 24,0,24,0
#define SETTINGS_LAYOUT_MARGINS 23,0,24,0
#define TRANSPARENT_COLOR QColor(0,0,0,0)
#define INACTIVE_AREA_MIN_HEIGHT 170
#define ACTIVE_AREA_MAX_HEIGHT 92
#define MAX_ITEMS 4
#define MAX_WIDTH 408
#define MIN_WIDTH 396
#define MAX_WIDTH 412
#define MIN_WIDTH 404
#define SCROLL_STEP 4
@ -139,7 +140,8 @@ protected:
QFrame * m_settingsFrame = nullptr;
QHBoxLayout * m_settingsLayout = nullptr;
KBorderlessButton *m_settingsBtn = nullptr;
KyLable * m_settingsLabel = nullptr;
// KBorderlessButton *m_settingsBtn = nullptr;
//临时增加的下拉框选择网卡区域
QFrame * m_deviceFrame = nullptr;

View File

@ -82,7 +82,7 @@ WlanPage::WlanPage(QWidget *parent) : TabPage(parent)
bool WlanPage::eventFilter(QObject *w, QEvent *e)
{
if (w == m_settingsBtn) {
if (w == m_settingsLabel) {
if (e->type() == QEvent::MouseButtonRelease) {
//ZJP_TODO 打开控制面板
qDebug() << LOG_FLAG <<"recive event show control center";
@ -134,7 +134,7 @@ void WlanPage::initWlanUI()
m_activatedNetListWidget->setPalette(pal);
m_inactivatedNetListWidget->setPalette(pal);
m_settingsBtn->installEventFilter(this);
m_settingsLabel->installEventFilter(this);
m_netSwitch->installEventFilter(this);
}
@ -606,12 +606,12 @@ void WlanPage::onConnectionAdd(QString deviceName, QString ssid)
return;
}
void WlanPage::onConnectionRemove(QString deviceName, QString ssid)
void WlanPage::onConnectionRemove(QString deviceName, QString ssid, QString path)
{
qDebug() << LOG_FLAG << "one connection is removed, it's ssid " << ssid << "device name"<< deviceName;
if (deviceName == m_currentDevice) {
if (m_activateConnectionItemMap.contains(ssid)) {
updateWirelessNetArea(nullptr, ssid, deviceName);
updateWirelessNetArea(nullptr, ssid, deviceName, path);
}
updateWlanListItem(ssid);
}
@ -872,7 +872,7 @@ void WlanPage::updateActivatedArea(QString uuid, QString ssid, QString devName)
return;
}
void WlanPage::updateWirelessNetArea(QString uuid, QString ssid, QString devName)
void WlanPage::updateWirelessNetArea(QString uuid, QString ssid, QString devName, QString path)
{
if(m_wirelessNetItemMap.contains(ssid)) {
return;
@ -889,7 +889,12 @@ void WlanPage::updateWirelessNetArea(QString uuid, QString ssid, QString devName
qWarning() << LOG_FLAG << "p_wlanItem is null";
return;
}
if (p_wlanItem->getUuid() == uuid) {
if (p_wlanItem->getUuid() == uuid || uuid.isEmpty()) {
if (uuid.isEmpty() && p_wlanItem->getPath() != path) {
return;
}
deleteWirelessItemFormMap(m_activateConnectionItemMap, m_activatedNetListWidget, ssid);
QListWidgetItem *p_activeListWidgetItem = addEmptyItem(m_activatedNetListWidget);
m_activateConnectionItemMap.insert(EMPTY_SSID, p_activeListWidgetItem);
@ -1005,7 +1010,9 @@ void WlanPage::onConnectionStateChanged(QString uuid,
if (devName.isEmpty()) {
devName = m_currentDevice;
}
updateWirelessNetArea(uuid, ssid, devName);
updateWirelessNetArea(uuid, ssid, devName,"");
if (m_wirelessNetItemMap.contains(ssid)) {
QListWidgetItem *p_listWidgetItem = m_wirelessNetItemMap.value(ssid);
updateWlanItemState(m_inactivatedNetListWidget, p_listWidgetItem, Deactivated);

View File

@ -108,7 +108,7 @@ private Q_SLOTS:
void onWlanRemoved(QString interface, QString ssid);
void onConnectionAdd(QString deviceName, QString ssid);
void onConnectionRemove(QString deviceName, QString ssid);
void onConnectionRemove(QString deviceName, QString ssid, QString path);
void onDeviceAdd(QString deviceName, NetworkManager::Device::Type deviceType);
void onDeviceRemove(QString deviceName);
@ -167,7 +167,7 @@ private:
void constructActivateConnectionArea();
void updateActivatedArea(QString uuid, QString ssid, QString devName);
void updateWirelessNetArea(QString uuid, QString ssid, QString devName);
void updateWirelessNetArea(QString uuid, QString ssid, QString devName, QString path);
void addDeviceToCombox(QString deviceName);
void deleteDeviceFromCombox(QString deviceName);

View File

@ -66,14 +66,15 @@ void KyLable::setPressColor()
{
QColor hightlight = this->palette().color(QPalette::Active,QPalette::Highlight);
QColor mix = this->palette().color(QPalette::Active,QPalette::BrightText);
m_foregroundColor = mixColor(hightlight, mix, 0.05);
m_foregroundColor = mixColor(hightlight, mix, 0.2);
}
void KyLable::setHoverColor()
{
QColor hightlight = this->palette().color(QPalette::Active,QPalette::Highlight);
QColor mix = this->palette().color(QPalette::Active,QPalette::BrightText);
m_foregroundColor = mixColor(hightlight, mix, 0.2);
// QColor hightlight = this->palette().color(QPalette::Active,QPalette::Highlight);
// QColor mix = this->palette().color(QPalette::Active,QPalette::BrightText);
// m_foregroundColor = mixColor(hightlight, mix, 0.2);
m_foregroundColor = this->palette().color(QPalette::Active,QPalette::Highlight);
}
void KyLable::setNormalColor()

View File

@ -151,6 +151,7 @@ int main(int argc, char *argv[])
MainWindow w;
a.setActivationWindow(&w);
w.setProperty("useStyleWindowManager", false); //禁用拖动
a.setWindowIcon(QIcon::fromTheme("kylin-network"));
//设置窗口无边框,阴影
// MotifWmHints window_hints;

Binary file not shown.

View File

@ -24,11 +24,11 @@
<translation type="vanished">ip地址冲突</translation>
</message>
<message>
<source>IPV4 address conflict, Please change IP</source>
<source>IPv4 address conflict, Please change IP</source>
<translation type="vanished">ip地址冲突ip</translation>
</message>
<message>
<source>IPV6 address conflict, Please change IP</source>
<source>IPv6 address conflict, Please change IP</source>
<translation type="obsolete">ip地址冲突ip {6 ?}</translation>
</message>
</context>
@ -87,8 +87,8 @@
</message>
<message>
<location filename="../src/frontend/netdetails/creatnetpage.cpp" line="51"/>
<source>Ipv4Config</source>
<translation>Ipv4ཁུང</translation>
<source>IPv4Config</source>
<translation>IPv4ཁུང</translation>
</message>
<message>
<location filename="../src/frontend/netdetails/creatnetpage.cpp" line="52"/>
@ -187,20 +187,20 @@
<message>
<location filename="../src/frontend/netdetails/detailpage.cpp" line="256"/>
<location filename="../src/frontend/netdetails/detailpage.cpp" line="327"/>
<source>IPV6:</source>
<translation>IPV6:</translation>
<source>IPv6:</source>
<translation>IPv6:</translation>
</message>
<message>
<location filename="../src/frontend/netdetails/detailpage.cpp" line="246"/>
<location filename="../src/frontend/netdetails/detailpage.cpp" line="325"/>
<source>IPV4:</source>
<translation>IPV4:</translation>
<source>IPv4:</source>
<translation>IPv4:</translation>
</message>
<message>
<location filename="../src/frontend/netdetails/detailpage.cpp" line="250"/>
<location filename="../src/frontend/netdetails/detailpage.cpp" line="326"/>
<source>IPV4 Dns:</source>
<translation>IPV4 Dns:</translation>
<source>IPv4 Dns:</source>
<translation>IPv4 Dns:</translation>
</message>
<message>
<location filename="../src/frontend/netdetails/detailpage.cpp" line="260"/>
@ -518,8 +518,8 @@
<name>Ipv4Page</name>
<message>
<location filename="../src/frontend/netdetails/ipv4page.cpp" line="71"/>
<source>Ipv4Config</source>
<translation>Ipv4ཁུང</translation>
<source>IPv4Config</source>
<translation>IPv4ཁུང</translation>
</message>
<message>
<location filename="../src/frontend/netdetails/ipv4page.cpp" line="72"/>
@ -582,8 +582,8 @@
<name>Ipv6Page</name>
<message>
<location filename="../src/frontend/netdetails/ipv6page.cpp" line="152"/>
<source>Ipv6Config</source>
<translation>Ipv6ཁུང</translation>
<source>IPv6Config</source>
<translation>IPv6ཁུང</translation>
</message>
<message>
<location filename="../src/frontend/netdetails/ipv6page.cpp" line="153"/>
@ -814,13 +814,13 @@
</message>
<message>
<location filename="../src/frontend/netdetails/netdetail.cpp" line="338"/>
<source>Ipv4</source>
<translation>Ipv4</translation>
<source>IPv4</source>
<translation>IPv4</translation>
</message>
<message>
<location filename="../src/frontend/netdetails/netdetail.cpp" line="339"/>
<source>Ipv6</source>
<translation>Ipv6</translation>
<source>IPv6</source>
<translation>IPv6</translation>
</message>
<message>
<location filename="../src/frontend/netdetails/netdetail.cpp" line="341"/>
@ -935,16 +935,16 @@
<translation type="obsolete"></translation>
</message>
<message>
<source>IPV4:</source>
<translation type="obsolete">IPV4地址</translation>
<source>IPv4:</source>
<translation type="obsolete">IPv4地址</translation>
</message>
<message>
<source>IPV4 Dns:</source>
<translation type="obsolete">IPV4 DNS服务器</translation>
<source>IPv4 Dns:</source>
<translation type="obsolete">IPv4 DNS服务器</translation>
</message>
<message>
<source>IPV6:</source>
<translation type="obsolete">IPV6地址</translation>
<source>IPv6:</source>
<translation type="obsolete">IPv6地址</translation>
</message>
<message>
<source>Mac:</source>

Binary file not shown.

View File

@ -24,11 +24,11 @@
<translation type="vanished">ip地址冲突</translation>
</message>
<message>
<source>IPV4 address conflict, Please change IP</source>
<source>IPv4 address conflict, Please change IP</source>
<translation type="vanished">ip地址冲突ip</translation>
</message>
<message>
<source>IPV6 address conflict, Please change IP</source>
<source>IPv6 address conflict, Please change IP</source>
<translation type="obsolete">ip地址冲突ip {6 ?}</translation>
</message>
</context>
@ -87,13 +87,13 @@
</message>
<message>
<location filename="../src/frontend/netdetails/creatnetpage.cpp" line="51"/>
<source>Ipv4Config</source>
<translation>IPV4配置</translation>
<source>IPv4Config</source>
<translation>IPv4配置</translation>
</message>
<message>
<location filename="../src/frontend/netdetails/creatnetpage.cpp" line="52"/>
<source>Address</source>
<translation>IPV4地址</translation>
<translation>IPv4地址</translation>
</message>
<message>
<location filename="../src/frontend/netdetails/creatnetpage.cpp" line="53"/>
@ -187,20 +187,20 @@
<message>
<location filename="../src/frontend/netdetails/detailpage.cpp" line="256"/>
<location filename="../src/frontend/netdetails/detailpage.cpp" line="327"/>
<source>IPV6:</source>
<translation>IPV6地址</translation>
<source>IPv6:</source>
<translation>IPv6地址</translation>
</message>
<message>
<location filename="../src/frontend/netdetails/detailpage.cpp" line="246"/>
<location filename="../src/frontend/netdetails/detailpage.cpp" line="325"/>
<source>IPV4:</source>
<translation>IPV4地址</translation>
<source>IPv4:</source>
<translation>IPv4地址</translation>
</message>
<message>
<location filename="../src/frontend/netdetails/detailpage.cpp" line="250"/>
<location filename="../src/frontend/netdetails/detailpage.cpp" line="326"/>
<source>IPV4 Dns:</source>
<translation>IPV4 DNS服务器</translation>
<source>IPv4 Dns:</source>
<translation>IPv4 DNS服务器</translation>
</message>
<message>
<location filename="../src/frontend/netdetails/detailpage.cpp" line="260"/>
@ -518,8 +518,8 @@
<name>Ipv4Page</name>
<message>
<location filename="../src/frontend/netdetails/ipv4page.cpp" line="71"/>
<source>Ipv4Config</source>
<translation>Ipv4配置</translation>
<source>IPv4Config</source>
<translation>IPv4配置</translation>
</message>
<message>
<location filename="../src/frontend/netdetails/ipv4page.cpp" line="72"/>
@ -582,8 +582,8 @@
<name>Ipv6Page</name>
<message>
<location filename="../src/frontend/netdetails/ipv6page.cpp" line="152"/>
<source>Ipv6Config</source>
<translation>Ipv6配置</translation>
<source>IPv6Config</source>
<translation>IPv6配置</translation>
</message>
<message>
<location filename="../src/frontend/netdetails/ipv6page.cpp" line="153"/>
@ -814,13 +814,13 @@
</message>
<message>
<location filename="../src/frontend/netdetails/netdetail.cpp" line="338"/>
<source>Ipv4</source>
<translation>Ipv4</translation>
<source>IPv4</source>
<translation>IPv4</translation>
</message>
<message>
<location filename="../src/frontend/netdetails/netdetail.cpp" line="339"/>
<source>Ipv6</source>
<translation>Ipv6</translation>
<source>IPv6</source>
<translation>IPv6</translation>
</message>
<message>
<location filename="../src/frontend/netdetails/netdetail.cpp" line="341"/>
@ -935,16 +935,16 @@
<translation type="obsolete"></translation>
</message>
<message>
<source>IPV4:</source>
<translation type="obsolete">IPV4地址</translation>
<source>IPv4:</source>
<translation type="obsolete">IPv4地址</translation>
</message>
<message>
<source>IPV4 Dns:</source>
<translation type="obsolete">IPV4 DNS服务器</translation>
<source>IPv4 Dns:</source>
<translation type="obsolete">IPv4 DNS服务器</translation>
</message>
<message>
<source>IPV6:</source>
<translation type="obsolete">IPV6地址</translation>
<source>IPv6:</source>
<translation type="obsolete">IPv6地址</translation>
</message>
<message>
<source>Mac:</source>