diff --git a/src/backend/dbus-interface/kylinnetworkresourcemanager.cpp b/src/backend/dbus-interface/kylinnetworkresourcemanager.cpp index bacd1029..85f02402 100644 --- a/src/backend/dbus-interface/kylinnetworkresourcemanager.cpp +++ b/src/backend/dbus-interface/kylinnetworkresourcemanager.cpp @@ -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(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(sender()); + emit wifiNetworkSecuChange(p_wirelessNet); +} + void KyNetworkResourceManager::onDeviceAdded(QString const & uni) { qDebug()<< "onDeviceAdded"<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; + } +} diff --git a/src/backend/dbus-interface/kywirelessnetitem.h b/src/backend/dbus-interface/kywirelessnetitem.h index 0eb10690..36eecc76 100644 --- a/src/backend/dbus-interface/kywirelessnetitem.h +++ b/src/backend/dbus-interface/kywirelessnetitem.h @@ -55,6 +55,7 @@ public: uint m_channel; int getCategory(QString uni); + void setKySecuType(QString strSecuType); private: KyNetworkResourceManager *m_networkResourceInstance = nullptr; diff --git a/src/backend/dbus-interface/kywirelessnetresource.cpp b/src/backend/dbus-interface/kywirelessnetresource.cpp index 6772f465..486e7f9b 100644 --- a/src/backend/dbus-interface/kywirelessnetresource.cpp +++ b/src/backend/dbus-interface/kywirelessnetresource.cpp @@ -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 >::iterator iter = m_WifiNetworkList.begin(); + while (iter != m_WifiNetworkList.end()) { + QList::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); } } diff --git a/src/backend/dbus-interface/kywirelessnetresource.h b/src/backend/dbus-interface/kywirelessnetresource.h index 02e9c943..807746d0 100644 --- a/src/backend/dbus-interface/kywirelessnetresource.h +++ b/src/backend/dbus-interface/kywirelessnetresource.h @@ -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&); diff --git a/src/frontend/list-items/listitem.cpp b/src/frontend/list-items/listitem.cpp index 2cfe9a9f..e6809c1d 100644 --- a/src/frontend/list-items/listitem.cpp +++ b/src/frontend/list-items/listitem.cpp @@ -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); diff --git a/src/frontend/list-items/wlanlistitem.cpp b/src/frontend/list-items/wlanlistitem.cpp index c7986b1e..2c034183 100644 --- a/src/frontend/list-items/wlanlistitem.cpp +++ b/src/frontend/list-items/wlanlistitem.cpp @@ -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 << "." <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")); diff --git a/src/frontend/netdetails/detailpage.cpp b/src/frontend/netdetails/detailpage.cpp index 8d79d22b..8b410378 100644 --- a/src/frontend/netdetails/detailpage.cpp +++ b/src/frontend/netdetails/detailpage.cpp @@ -243,17 +243,17 @@ void DetailPage::initUI() { m_IPV4 = new QLabel(this); m_ipv4Widget = new DetailWidget(qobject_cast(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(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(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(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; diff --git a/src/frontend/netdetails/ipv4page.cpp b/src/frontend/netdetails/ipv4page.cpp index 3834a0d1..6e2ca81c 100644 --- a/src/frontend/netdetails/ipv4page.cpp +++ b/src/frontend/netdetails/ipv4page.cpp @@ -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")); diff --git a/src/frontend/netdetails/ipv6page.cpp b/src/frontend/netdetails/ipv6page.cpp index 084c8a63..cfa568ac 100644 --- a/src/frontend/netdetails/ipv6page.cpp +++ b/src/frontend/netdetails/ipv6page.cpp @@ -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")); diff --git a/src/frontend/netdetails/netdetail.cpp b/src/frontend/netdetails/netdetail.cpp index f53da77e..cc04c773 100644 --- a/src/frontend/netdetails/netdetail.cpp +++ b/src/frontend/netdetails/netdetail.cpp @@ -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); diff --git a/src/frontend/networkmode/firewalldialog.cpp b/src/frontend/networkmode/firewalldialog.cpp index 6013ecc0..74dc3427 100644 --- a/src/frontend/networkmode/firewalldialog.cpp +++ b/src/frontend/networkmode/firewalldialog.cpp @@ -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()); } diff --git a/src/frontend/networkmode/firewalldialog.h b/src/frontend/networkmode/firewalldialog.h index 09e5d833..6351977a 100644 --- a/src/frontend/networkmode/firewalldialog.h +++ b/src/frontend/networkmode/firewalldialog.h @@ -24,6 +24,8 @@ #include #include #include +#include +#include #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; diff --git a/src/frontend/tab-pages/lanpage.cpp b/src/frontend/tab-pages/lanpage.cpp index 4c2d1dff..949648fe 100644 --- a/src/frontend/tab-pages/lanpage.cpp +++ b/src/frontend/tab-pages/lanpage.cpp @@ -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(); } diff --git a/src/frontend/tab-pages/tabpage.cpp b/src/frontend/tab-pages/tabpage.cpp index 44322ce0..e7191570 100644 --- a/src/frontend/tab-pages/tabpage.cpp +++ b/src/frontend/tab-pages/tabpage.cpp @@ -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); diff --git a/src/frontend/tab-pages/tabpage.h b/src/frontend/tab-pages/tabpage.h index 6044e3fd..fef9a30e 100644 --- a/src/frontend/tab-pages/tabpage.h +++ b/src/frontend/tab-pages/tabpage.h @@ -21,6 +21,7 @@ #define TABPAGE_H #include "divider.h" +#include "kylable.h" #include #include #include @@ -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; diff --git a/src/frontend/tab-pages/wlanpage.cpp b/src/frontend/tab-pages/wlanpage.cpp index 2af65ffb..2e3ebe25 100644 --- a/src/frontend/tab-pages/wlanpage.cpp +++ b/src/frontend/tab-pages/wlanpage.cpp @@ -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); diff --git a/src/frontend/tab-pages/wlanpage.h b/src/frontend/tab-pages/wlanpage.h index 329ac374..95450ca1 100644 --- a/src/frontend/tab-pages/wlanpage.h +++ b/src/frontend/tab-pages/wlanpage.h @@ -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); diff --git a/src/frontend/tools/kylable.cpp b/src/frontend/tools/kylable.cpp index 488fddf5..a734877b 100644 --- a/src/frontend/tools/kylable.cpp +++ b/src/frontend/tools/kylable.cpp @@ -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() diff --git a/src/main.cpp b/src/main.cpp index 5669c6d7..2454937e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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; diff --git a/translations/kylin-nm_bo_CN.qm b/translations/kylin-nm_bo_CN.qm index fb2d4979..ecf1d183 100644 Binary files a/translations/kylin-nm_bo_CN.qm and b/translations/kylin-nm_bo_CN.qm differ diff --git a/translations/kylin-nm_bo_CN.ts b/translations/kylin-nm_bo_CN.ts index e11cd60f..a0b8c59d 100644 --- a/translations/kylin-nm_bo_CN.ts +++ b/translations/kylin-nm_bo_CN.ts @@ -24,11 +24,11 @@ 正在检测ip地址冲突 - IPV4 address conflict, Please change IP + IPv4 address conflict, Please change IP ip地址冲突,请更改ip - IPV6 address conflict, Please change IP + IPv6 address conflict, Please change IP ip地址冲突,请更改ip {6 ?} @@ -87,8 +87,8 @@ - Ipv4Config - Ipv4ཁུང་ཙི། + IPv4Config + IPv4ཁུང་ཙི། @@ -187,20 +187,20 @@ - IPV6: - IPV6: + IPv6: + IPv6: - IPV4: - IPV4: + IPv4: + IPv4: - IPV4 Dns: - IPV4 Dns: + IPv4 Dns: + IPv4 Dns: @@ -518,8 +518,8 @@ Ipv4Page - Ipv4Config - Ipv4ཁུང་ཙི། + IPv4Config + IPv4ཁུང་ཙི། @@ -582,8 +582,8 @@ Ipv6Page - Ipv6Config - Ipv6ཁུང་ཙི། + IPv6Config + IPv6ཁུང་ཙི། @@ -814,13 +814,13 @@ - Ipv4 - Ipv4 + IPv4 + IPv4 - Ipv6 - Ipv6 + IPv6 + IPv6 @@ -935,16 +935,16 @@ 带宽: - IPV4: - IPV4地址: + IPv4: + IPv4地址: - IPV4 Dns: - IPV4 DNS服务器: + IPv4 Dns: + IPv4 DNS服务器: - IPV6: - 本地链接IPV6地址: + IPv6: + 本地链接IPv6地址: Mac: diff --git a/translations/kylin-nm_zh_CN.qm b/translations/kylin-nm_zh_CN.qm index e7d265ba..35bd96cd 100644 Binary files a/translations/kylin-nm_zh_CN.qm and b/translations/kylin-nm_zh_CN.qm differ diff --git a/translations/kylin-nm_zh_CN.ts b/translations/kylin-nm_zh_CN.ts index df5867e5..2e25f448 100644 --- a/translations/kylin-nm_zh_CN.ts +++ b/translations/kylin-nm_zh_CN.ts @@ -24,11 +24,11 @@ 正在检测ip地址冲突 - IPV4 address conflict, Please change IP + IPv4 address conflict, Please change IP ip地址冲突,请更改ip - IPV6 address conflict, Please change IP + IPv6 address conflict, Please change IP ip地址冲突,请更改ip {6 ?} @@ -87,13 +87,13 @@ - Ipv4Config - IPV4配置 + IPv4Config + IPv4配置 Address - IPV4地址 + IPv4地址 @@ -187,20 +187,20 @@ - IPV6: - 本地链接IPV6地址: + IPv6: + 本地链接IPv6地址: - IPV4: - IPV4地址: + IPv4: + IPv4地址: - IPV4 Dns: - IPV4 DNS服务器: + IPv4 Dns: + IPv4 DNS服务器: @@ -518,8 +518,8 @@ Ipv4Page - Ipv4Config - Ipv4配置 + IPv4Config + IPv4配置 @@ -582,8 +582,8 @@ Ipv6Page - Ipv6Config - Ipv6配置 + IPv6Config + IPv6配置 @@ -814,13 +814,13 @@ - Ipv4 - Ipv4 + IPv4 + IPv4 - Ipv6 - Ipv6 + IPv6 + IPv6 @@ -935,16 +935,16 @@ 带宽: - IPV4: - IPV4地址: + IPv4: + IPv4地址: - IPV4 Dns: - IPV4 DNS服务器: + IPv4 Dns: + IPv4 DNS服务器: - IPV6: - 本地链接IPV6地址: + IPv6: + 本地链接IPv6地址: Mac: