From ec3d232fb6e9011a70121e97edfc128c0c8962f3 Mon Sep 17 00:00:00 2001 From: chenlelin Date: Tue, 31 Mar 2020 17:17:49 +0800 Subject: [PATCH] change the method to get size and position of task bar --- README.md | 2 +- kylin-nm.pro | 3 + nmqrc.qrc | 2 + res/g/close_black.png | Bin 0 -> 205 bytes res/g/close_white.png | Bin 0 -> 152 bytes src/backthread.cpp | 5 - src/confform.cpp | 6 + src/confform.h | 4 + src/kylin-dbus-interface.cpp | 95 ++++++---- src/kylin-dbus-interface.h | 7 +- src/mainwindow.cpp | 114 +++++++----- src/mainwindow.h | 3 + src/notifysend.cpp | 54 ++++++ src/notifysend.h | 34 ++++ src/notifysend.ui | 69 ++++++++ src/oneconnform.cpp | 4 + src/oneconnform.h | 2 + src/utils.cpp | 10 +- translations/kylin-nm_bo.ts | 219 ++++++++++-------------- translations/kylin-nm_zh_CN.qm | Bin 21025 -> 20293 bytes translations/kylin-nm_zh_CN.ts | 198 ++++++++++----------- wireless-security/dlgconnhidwifi.cpp | 10 +- wireless-security/dlgconnhidwifi.ui | 8 +- wireless-security/dlgconnhidwifiwpa.cpp | 10 +- wireless-security/dlgconnhidwifiwpa.ui | 8 +- 25 files changed, 542 insertions(+), 325 deletions(-) create mode 100644 res/g/close_black.png create mode 100644 res/g/close_white.png create mode 100644 src/notifysend.cpp create mode 100644 src/notifysend.h create mode 100644 src/notifysend.ui diff --git a/README.md b/README.md index 8a0baa36..33c85489 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,6 @@ # BUILD KYLIN-NM down the source sode - install depend packages(writed in the cntrol files in the debian directory) + install dependency packages(see cntrol files in the debian directory) execute debuild command in the root directory of project execute sudo dpkg -i packagename.deb to install diff --git a/kylin-nm.pro b/kylin-nm.pro index 9b1a4dcf..44bc4ba4 100644 --- a/kylin-nm.pro +++ b/kylin-nm.pro @@ -55,6 +55,7 @@ SOURCES += \ src/loadingdiv.cpp \ src/main.cpp \ src/mainwindow.cpp \ + src/notifysend.cpp \ src/oneconnform.cpp \ src/onelancform.cpp \ src/utils.cpp \ @@ -80,6 +81,7 @@ HEADERS += \ src/kylin-network-interface.h \ src/loadingdiv.h \ src/mainwindow.h \ + src/notifysend.h \ src/oneconnform.h \ src/onelancform.h \ src/utils.h \ @@ -99,6 +101,7 @@ HEADERS += \ FORMS += \ src/confform.ui \ src/mainwindow.ui \ + src/notifysend.ui \ src/oneconnform.ui \ src/onelancform.ui \ wireless-security/dlgconnhidwifi.ui \ diff --git a/nmqrc.qrc b/nmqrc.qrc index 332cd1b5..7051d9fd 100644 --- a/nmqrc.qrc +++ b/nmqrc.qrc @@ -75,5 +75,7 @@ res/s/conning-a/7.png res/s/conning-a/8.png qss/style.qss + res/g/close_black.png + res/g/close_white.png diff --git a/res/g/close_black.png b/res/g/close_black.png new file mode 100644 index 0000000000000000000000000000000000000000..237e555213079ed8a44c34bd702e94bf8999d310 GIT binary patch literal 205 zcmeAS@N?(olHy`uVBq!ia0vp^av;pX1|+Qw)-3{3Q#@T9Lp(a)PCm$aK!L|~|6JX7 ziRzoHU*w4$Z02oKd$3fMziQ>d^he@-k1hVUc1Q^>y(SeFAOG6)7Nbm?=Uj%O9>b5V zANBiZ?R^wdhxDIGZJktT*?6`2Rt#2l<1Kr2q>FVdQ&MBb@ E0JbGncmMzZ literal 0 HcmV?d00001 diff --git a/res/g/close_white.png b/res/g/close_white.png new file mode 100644 index 0000000000000000000000000000000000000000..0943a4bb87ef3488385d4707b140c5a951fc95c1 GIT binary patch literal 152 zcmeAS@N?(olHy`uVBq!ia0vp^av;pX1|+Qw)-3{3@t!V@As(G?FFSHI81T4UJUF@P zzjseZNRQ$LS0}HT>~|wx=r43~Nr|tSqawJby8k7!1Uvi3^7TqGN6&6w^}+s$UXbL! zV|QPq%l-`axn}!n+VQL3tX%_z{rS5))-WDm4HDBb@?X&K7iblOr>mdKI;Vst0D5XS AbpQYW literal 0 HcmV?d00001 diff --git a/src/backthread.cpp b/src/backthread.cpp index c8512aa6..4418fe3e 100644 --- a/src/backthread.cpp +++ b/src/backthread.cpp @@ -243,11 +243,6 @@ void BackThread::execConnWifiPWD(QString connName, QString password){ qDebug()<<"debug: in function execConnWifiPWD, wireless net state is: "<wstate); syslog(LOG_DEBUG, "In function execConnWifiPWD, wireless net state is: %d", execGetIface()->wstate); }else{ - QString txt(tr("Confirm your Wi-Fi password")); - QString cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';notify-send '" + txt + "...' -t 3800"; - int status1 = system(cmd.toUtf8().data()); - if (status1 != 0){ syslog(LOG_ERR, "execute 'notify-send' in function 'execConnWifiPWD' failed");} - emit connDone(1); } diff --git a/src/confform.cpp b/src/confform.cpp index b4e7fb1a..6a9365d9 100644 --- a/src/confform.cpp +++ b/src/confform.cpp @@ -126,6 +126,8 @@ ConfForm::ConfForm(QWidget *parent) : ui->btnOk->setFocusPolicy(Qt::NoFocus); ui->btnCreate->setFocusPolicy(Qt::NoFocus); + //m_notify = new NotifySend(); //显示桌面通知 + // IP的正则格式限制 QRegExp rx("\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b"); ui->leAddr->setValidator(new QRegExpValidator(rx, this)); @@ -138,6 +140,7 @@ ConfForm::ConfForm(QWidget *parent) : ConfForm::~ConfForm() { + m_notify->deleteLater(); delete ui; } @@ -211,6 +214,7 @@ void ConfForm::on_btnCreate_clicked() this->on_btnOk_clicked(); } else { QString txt(tr("New network already created")); + //m_notify->execNotifySend(txt); QString cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';notify-send '" + txt + "...' -t 3800"; int status1 = system(cmd.toUtf8().data()); if (status1 != 0){ syslog(LOG_ERR, "execute 'notify-send' in function 'execConnWifiPWD' failed");} @@ -248,6 +252,7 @@ void ConfForm::on_btnOk_clicked() } QString txt(tr("New network settings already finished")); + //m_notify->execNotifySend(txt); QString cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';notify-send '" + txt + "...' -t 3800"; int status1 = system(cmd.toUtf8().data()); if (status1 != 0){ syslog(LOG_ERR, "execute 'notify-send' in function 'execConnWifiPWD' failed");} @@ -263,6 +268,7 @@ void ConfForm::on_btnOk_clicked() // if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection up' in function 'on_btnOk_clicked' failed");} QString txt(tr("New settings already effective")); + //m_notify->execNotifySend(txt); QString cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';notify-send '" + txt + "' -t 3800"; int status1 = system(cmd.toUtf8().data()); if (status1 != 0){ syslog(LOG_ERR, "execute 'notify-send' in function 'on_btnOk_clicked' failed");} diff --git a/src/confform.h b/src/confform.h index c086a9db..807d7550 100644 --- a/src/confform.h +++ b/src/confform.h @@ -19,6 +19,8 @@ #ifndef CONFFORM_H #define CONFFORM_H +#include "notifysend.h" + #include #include #include @@ -40,6 +42,8 @@ public: void setProp(QString connName, QString v4method, QString addr, QString mask, QString gateway, QString dns, bool isActConf); + NotifySend *m_notify = nullptr; + public slots: void cbTypeChanged(int index); diff --git a/src/kylin-dbus-interface.cpp b/src/kylin-dbus-interface.cpp index 5f7f2270..19ae9e44 100644 --- a/src/kylin-dbus-interface.cpp +++ b/src/kylin-dbus-interface.cpp @@ -33,7 +33,8 @@ KylinDBus::KylinDBus(MainWindow *mainWindow, QObject *parent) :QObject(parent) getPhysicalCarrierState(0); //初始化获取网线插入状态 getLanHwAddressState(); //获取有线网Mac地址 getWiredCardName(); - getWifiSwitchState(); + initTaskbarGsetting(); //初始化taskbar的GSetting方法 + getWifiSwitchState(); //初始化wifi开关GSetting通信方法 QDBusConnection::systemBus().connect(QString("org.freedesktop.NetworkManager"), QString("/org/freedesktop/NetworkManager"), @@ -55,10 +56,14 @@ KylinDBus::KylinDBus(MainWindow *mainWindow, QObject *parent) :QObject(parent) QString("org.freedesktop.NetworkManager.Settings"), QString("ConnectionRemoved"), this, SLOT(onConnectionRemoved(QDBusObjectPath) ) ); - QDBusConnection::systemBus().connect(QString("org.freedesktop.NetworkManager"), - QString(wiredPath.path()), - QString("org.freedesktop.NetworkManager.Device.Wired"), - QString("PropertiesChanged"), this, SLOT(onLanPropertyChanged(QVariantMap) ) ); + if (wirelessPath.path() != ""){ + QDBusConnection::systemBus().connect(QString("org.freedesktop.NetworkManager"), + QString(wiredPath.path()), + QString("org.freedesktop.NetworkManager.Device.Wired"), + QString("PropertiesChanged"), this, SLOT(onLanPropertyChanged(QVariantMap) ) ); + } else { + qDebug()<<"Can not find wired device object path when using dbus."; + } if (wirelessPath.path() != ""){ QDBusConnection::systemBus().connect(QString("org.freedesktop.NetworkManager"), @@ -71,6 +76,8 @@ KylinDBus::KylinDBus(MainWindow *mainWindow, QObject *parent) :QObject(parent) QString("org.freedesktop.NetworkManager.Device.Wireless"), QString("AccessPointAdded"), this, SLOT(onAccessPointAdded(QDBusObjectPath) ) ); getWirelessCardName();//获取无线网卡名称 + } else { + qDebug()<<"Can not find wireless device object path when using dbus."; } time = new QTimer(this); @@ -80,6 +87,10 @@ KylinDBus::KylinDBus(MainWindow *mainWindow, QObject *parent) :QObject(parent) QObject::connect(this, SIGNAL(updateWiredList(int)), mw, SLOT(onBtnNetListClicked(int))); } + +/////////////////////////////////////////////////////////////////////////////// +//下方使用Dbus 进程通信方法 + void KylinDBus::getObjectPath() { QDBusInterface m_interface( "org.freedesktop.NetworkManager", @@ -88,6 +99,10 @@ void KylinDBus::getObjectPath() QDBusConnection::systemBus() ); QDBusReply> obj_reply = m_interface.call("GetAllDevices"); + if (!obj_reply.isValid()) { + qDebug()<<"execute dbus method 'GetAllDevices' is invalid in func getObjectPath()"; + } + QList obj_paths = obj_reply.value(); foreach (QDBusObjectPath obj_path, obj_paths){ @@ -97,6 +112,10 @@ void KylinDBus::getObjectPath() QDBusConnection::systemBus() ); QDBusReply reply = interface.call("Introspect"); + if (!reply.isValid()) { + qDebug()<<"execute dbus method 'Introspect' is invalid in func getObjectPath()"; + } + if(reply.value().indexOf("org.freedesktop.NetworkManager.Device.Wired") != -1){ wiredPath = obj_path; } else if (reply.value().indexOf("org.freedesktop.NetworkManager.Device.Wireless") != -1){ @@ -115,16 +134,20 @@ void KylinDBus::getPhysicalCarrierState(int n) QDBusReply reply = interface.call("Get", "org.freedesktop.NetworkManager.Device.Wired", "Carrier"); - if (reply.value().toString() == "true"){ - isWiredCableOn = true; - } else if (reply.value().toString() == "false"){ - isWiredCableOn = false; - } else { + try{ + if (reply.value().toString() == "true"){ + isWiredCableOn = true; + if (n == 1){ this->mw->onPhysicalCarrierChanged(isWiredCableOn);} + } else if (reply.value().toString() == "false"){ + isWiredCableOn = false; + if (n == 1){ this->mw->onPhysicalCarrierChanged(isWiredCableOn);} + } else { + throw -1; + } + }catch(...){ syslog(LOG_ERR, "Error occurred when get the property 'Carrier' of Wired"); qDebug()<<"Error occurred when get the property 'Carrier' of Wired"; } - - if (n == 1){ this->mw->onPhysicalCarrierChanged(isWiredCableOn);} } void KylinDBus::getLanHwAddressState() @@ -135,7 +158,11 @@ void KylinDBus::getLanHwAddressState() QDBusConnection::systemBus() ); QDBusReply lanReply = lanInterface.call("Get", "org.freedesktop.NetworkManager.Device.Wired", "HwAddress"); - dbusLanMac = lanReply.value().toString(); + if (!lanReply.isValid()) { + qDebug()<<"can not get the attribute 'HwAddress' in func getLanHwAddressState()"; + } else { + dbusLanMac = lanReply.value().toString(); + } } void KylinDBus::getWiredCardName() @@ -146,7 +173,11 @@ void KylinDBus::getWiredCardName() QDBusConnection::systemBus() ); QDBusReply lanReply = lanInterface.call("Get", "org.freedesktop.NetworkManager.Device", "Interface"); - dbusLanCardName = lanReply.value().toString(); + if (!lanReply.isValid()) { + qDebug()<<"can not get the attribute 'Interface' in func getWiredCardName()"; + } else { + dbusLanCardName = lanReply.value().toString(); + } } void KylinDBus::getWirelessCardName() @@ -157,7 +188,11 @@ void KylinDBus::getWirelessCardName() QDBusConnection::systemBus() ); QDBusReply lanReply = lanInterface.call("Get", "org.freedesktop.NetworkManager.Device", "Interface"); - dbusWiFiCardName = lanReply.value().toString(); + if (!lanReply.isValid()) { + qDebug()<<"can not get the attribute 'Interface' in func getWirelessCardName()"; + } else { + dbusWiFiCardName = lanReply.value().toString(); + } } void KylinDBus::getLanIp(QString netName) @@ -442,26 +477,26 @@ void KylinDBus::onAccessPointAdded(QDBusObjectPath objPath) //qDebug()<<"debug: &&&&&&&&&&&&&"< reply = interface.call("GetPanelPosition", str); - return reply; +void KylinDBus::initTaskbarGsetting() +{ + if(QGSettings::isSchemaInstalled("org.ukui.panel.settings")) { + m_tastbar_gsettings = new QGSettings("org.ukui.panel.settings"); + } } -int KylinDBus::getTaskbarHeight(QString str) +int KylinDBus::getTaskbarHeight() { - QDBusInterface interface( "com.ukui.panel.desktop", - "/", - "com.ukui.panel.desktop", - QDBusConnection::sessionBus() ); + int h = m_tastbar_gsettings->get("panelsize").toInt(); + return h; +} - QDBusReply reply = interface.call("GetPanelSize", str); - return reply; +int KylinDBus::getTaskbarPos() +{ + int p = m_tastbar_gsettings->get("panelposition").toInt(); + return p; } void KylinDBus::getWifiSwitchState() diff --git a/src/kylin-dbus-interface.h b/src/kylin-dbus-interface.h index 4a4cde66..a3c5f3ae 100644 --- a/src/kylin-dbus-interface.h +++ b/src/kylin-dbus-interface.h @@ -27,8 +27,10 @@ public: void getObjectPath(); int getAccessPointsNumber(); int getLanConnState(); - int getTaskbarPos(QString str); - int getTaskbarHeight(QString str); + + void initTaskbarGsetting(); + int getTaskbarHeight(); + int getTaskbarPos(); void getWifiSwitchState(); bool getSwitchStatus(QString key); @@ -71,6 +73,7 @@ private: bool isRunningFunction = false; QTimer *time = nullptr; + QGSettings *m_tastbar_gsettings = nullptr; QGSettings *m_gsettings = nullptr; signals: diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 5aee82b0..3117e52c 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -87,8 +87,8 @@ MainWindow::MainWindow(QWidget *parent) : trayIcon->show(); objKyDBus = new KylinDBus(this); - objNetSpeed = new NetworkSpeed(); + //m_notify = new NotifySend(); this->confForm = new ConfForm(); @@ -126,13 +126,22 @@ MainWindow::~MainWindow() void MainWindow::checkSingle() { - //int fd = open("/tmp/kylin-nm-lock", O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); + int fd = 0; + try{ + QStringList homePath = QStandardPaths::standardLocations(QStandardPaths::HomeLocation); + QString lockPath = homePath.at(0) + "/.config/kylin-nm-lock"; + fd = open(lockPath.toUtf8().data(), O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); - QStringList homePath = QStandardPaths::standardLocations(QStandardPaths::HomeLocation); - QString lockPath = homePath.at(0) + "/.config/kylin-nm-lock"; - int fd = open(lockPath.toUtf8().data(), O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); + if (fd < 0) { + throw -1; + } + }catch(...){ + fd = open("/tmp/kylin-nm-lock", O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); + if (fd < 0) { + exit(0); + } + } - if (fd < 0) { exit(1); } if (lockf(fd, F_TLOCK, 0)) { syslog(LOG_ERR, "Can't lock single file, kylin-network-manager is already running!"); @@ -424,8 +433,10 @@ void MainWindow::initNetwork() mwBandWidth = bt->execChkLanWidth(lname); // 开关状态 - qDebug()<<"lstate ="<lstate<<" wstate ="<wstate ; - syslog(LOG_DEBUG, "state of switch: lstate =%d wstate =%d", iface->lstate, iface->wstate); + qDebug()<<"state of network: '0' is connection, '1' is disconnection, '2' is net device off"; + syslog(LOG_DEBUG, "state of network: '0' is connection, '1' is disconnection, '2' is switch off "); + qDebug()<<"current network state: lan state ="<lstate<<", wifi state ="<wstate ; + syslog(LOG_DEBUG, "current network state: lan state =%d, wifi state =%d", iface->lstate, iface->wstate); ui->lbBtnNetBG->setStyleSheet(btnOnQss); if(iface->wstate == 0 || iface->wstate == 1){ @@ -455,6 +466,7 @@ void MainWindow::initNetwork() ui->btnNetList->setStyleSheet("QPushButton{border:0px solid rgba(255,255,255,0);background-color:rgba(255,255,255,0);}"); ui->btnWifiList->setStyleSheet("QPushButton{border:none;}"); } else { + objKyDBus->setWifiSwitchState(false); //通知控制面板wifi未开启 if(iface->lstate != 2){ if (iface->lstate == 0) { connLanDone(3); @@ -692,8 +704,9 @@ void MainWindow::handleIconClicked() // qDebug()<<"deskDupRect: "<getTaskbarPos("position"); - int m = objKyDBus->getTaskbarHeight("height"); + int m = objKyDBus->getTaskbarHeight(); + int n = objKyDBus->getTaskbarPos(); + qDebug()<<"aaaaaaaa "<move(availableGeometry.x() + availableGeometry.width() - this->width(), screenMainRect.y() + screenGeometry.height() - availableGeometry.height() + m + d); } else if (n == 2){ //任务栏在左侧 - if (screenGeometry.x() == 0){//主屏在左侧 - this->move(screenGeometry.width() - availableGeometry.width() + m + d, screenMainRect.y() + screenMainRect.height() - this->height()); - }else{//主屏在右侧 - this->move(screenGeometry.width() - availableGeometry.width() + m + d,screenDupRect.y() + screenDupRect.height() - this->height()); - } + this->move(m + d, screenMainRect.y() + screenMainRect.height() - this->height()); +// if (screenGeometry.x() == 0){//主屏在左侧 +// this->move(screenGeometry.width() - availableGeometry.width() + m + d, screenMainRect.y() + screenMainRect.height() - this->height()); +// }else{//主屏在右侧 +// this->move(screenGeometry.width() - availableGeometry.width() + m + d,screenDupRect.y() + screenDupRect.height() - this->height()); +// } } else if (n == 3){ //任务栏在右侧 - if (screenGeometry.x() == 0){//主屏在左侧 - this->move(screenMainRect.width() + screenDupRect.width() - this->width() - m - d, screenDupRect.y() + screenDupRect.height() - this->height()); - }else{//主屏在右侧 - this->move(availableGeometry.x() + availableGeometry.width() - this->width() - m - d, screenMainRect.y() + screenMainRect.height() - this->height()); - } + this->move(screenMainRect.width() - this->width() - m - d, screenDupRect.y() + screenDupRect.height() - this->height()); +// if (screenGeometry.x() == 0){//主屏在左侧 +// this->move(screenMainRect.width() + screenDupRect.width() - this->width() - m - d, screenDupRect.y() + screenDupRect.height() - this->height()); +// }else{//主屏在右侧 +// this->move(availableGeometry.x() + availableGeometry.width() - this->width() - m - d, screenMainRect.y() + screenMainRect.height() - this->height()); +// } } } else if(screenGeometry.width() == availableGeometry.width() ){ if (trayIcon->geometry().y() > availableGeometry.height()/2){ @@ -748,8 +763,8 @@ void MainWindow::showTrayIconMenu() // QRect deskDupRect = desktopWidget->availableGeometry(1);//获取可用桌面大小 QRect screenDupRect = desktopWidget->screenGeometry(1);//获取设备屏幕大小 - int n = objKyDBus->getTaskbarPos("position"); - int m = objKyDBus->getTaskbarHeight("height"); + int m = objKyDBus->getTaskbarHeight(); + int n = objKyDBus->getTaskbarPos(); int d = 2; //窗口边沿到任务栏距离 int s = 80; //窗口边沿到屏幕边沿距离 @@ -759,17 +774,19 @@ void MainWindow::showTrayIconMenu() }else if(n == 1){ //任务栏在上侧 trayIconMenu->move(availableGeometry.x() + availableGeometry.width() - trayIconMenu->width(), screenMainRect.y() + screenGeometry.height() - availableGeometry.height() + m + d); } else if (n == 2){ //任务栏在左侧 - if (screenGeometry.x() == 0){//主屏在左侧 - trayIconMenu->move(screenGeometry.width() - availableGeometry.width() + m + d, screenMainRect.y() + screenMainRect.height() - trayIconMenu->height() - s); - }else{//主屏在右侧 - trayIconMenu->move(screenGeometry.width() - availableGeometry.width() + m + d,screenDupRect.y() + screenDupRect.height() - trayIconMenu->height() - s); - } + trayIconMenu->move(m + d, screenMainRect.y() + screenMainRect.height() - trayIconMenu->height() - s); +// if (screenGeometry.x() == 0){//主屏在左侧 +// trayIconMenu->move(screenGeometry.width() - availableGeometry.width() + m + d, screenMainRect.y() + screenMainRect.height() - trayIconMenu->height() - s); +// }else{//主屏在右侧 +// trayIconMenu->move(screenGeometry.width() - availableGeometry.width() + m + d,screenDupRect.y() + screenDupRect.height() - trayIconMenu->height() - s); +// } } else if (n == 3){ //任务栏在右侧 - if (screenGeometry.x() == 0){//主屏在左侧 - trayIconMenu->move(screenMainRect.width() + screenDupRect.width() - trayIconMenu->width() - m - d, screenDupRect.y() + screenDupRect.height() - trayIconMenu->height() - s); - }else{//主屏在右侧 - trayIconMenu->move(availableGeometry.x() + availableGeometry.width() - trayIconMenu->width() - m - d, screenMainRect.y() + screenMainRect.height() - trayIconMenu->height() - s); - } + trayIconMenu->move(screenMainRect.width() - trayIconMenu->width() - m - d, screenDupRect.y() + screenDupRect.height() - trayIconMenu->height() - s); +// if (screenGeometry.x() == 0){//主屏在左侧 +// trayIconMenu->move(screenMainRect.width() + screenDupRect.width() - trayIconMenu->width() - m - d, screenDupRect.y() + screenDupRect.height() - trayIconMenu->height() - s); +// }else{//主屏在右侧 +// trayIconMenu->move(availableGeometry.x() + availableGeometry.width() - trayIconMenu->width() - m - d, screenMainRect.y() + screenMainRect.height() - trayIconMenu->height() - s); +// } } } else if(screenGeometry.width() == availableGeometry.width() ){ if (trayIcon->geometry().y() > availableGeometry.height()/2){ //任务栏在下侧 @@ -1126,8 +1143,8 @@ void MainWindow::onBtnWifiClicked(int flag) if (is_fly_mode_on == 0){ on_btnWifiList_clicked(); is_stop_check_net_state = 1; - objKyDBus->setWifiCardState(true); - objKyDBus->setWifiSwitchState(true); + objKyDBus->setWifiCardState(true); + objKyDBus->setWifiSwitchState(true); lbTopWifiList->show(); btnAddNet->show(); @@ -1189,6 +1206,7 @@ void MainWindow::onBtnWifiClicked(int flag) } QString txt(tr("please insert the wireless network adapter")); + //m_notify->execNotifySend(txt); QString cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';notify-send '" + txt + "' -t 3800"; int status = system(cmd.toUtf8().data()); if (status != 0){ syslog(LOG_ERR, "execute 'notify-send' in function 'onBtnWifiClicked' failed");} @@ -1249,9 +1267,10 @@ void MainWindow::onBtnNetListClicked(int flag) QString line(buf); if(line.indexOf("ethernet") != -1){ QString txt(tr("Abnormal connection exist, program will delete it"));//仍然有连接异常的有线网络,断开异常连接的网络 + //m_notify->execNotifySend(txt); QString cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';notify-send '" + txt + "...' -t 3800"; - int status = system(cmd.toUtf8().data()); - if (status != 0){ syslog(LOG_ERR, "execute 'notify-send' in function 'onBtnNetListClicked' failed");} + int status = system(cmd.toUtf8().data()); + if (status != 0){ syslog(LOG_ERR, "execute 'notify-send' in function 'onBtnNetListClicked' failed");} is_stop_check_net_state = 1; this->startLoading(); @@ -2104,6 +2123,7 @@ void MainWindow::activeLanDisconn() syslog(LOG_DEBUG, "Wired net is disconnected"); QString txt(tr("Wired net is disconnected")); + //m_notify->execNotifySend(txt); QString cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';notify-send '" + txt + "...' -t 3800"; int status1 = system(cmd.toUtf8().data()); if (status1 != 0){ syslog(LOG_ERR, "execute 'notify-send' in function 'execConnWifiPWD' failed");} @@ -2131,6 +2151,7 @@ void MainWindow::activeStartLoading() syslog(LOG_DEBUG, "Wi-Fi is disconnected"); QString txt(tr("Wi-Fi is disconnected")); + //m_notify->execNotifySend(txt); QString cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';notify-send '" + txt + "...' -t 3800"; int status1 = system(cmd.toUtf8().data()); if (status1 != 0){ syslog(LOG_ERR, "execute 'notify-send' in function 'execConnWifiPWD' failed");} @@ -2330,9 +2351,13 @@ void MainWindow::on_setNetSpeed() { if (this->isVisible() && is_stop_check_net_state==0){ if (is_btnWifiList_clicked == 1){ - objNetSpeed->getCurrentDownloadRates(objKyDBus->dbusWiFiCardName.toUtf8().data(), &start_rcv_rates, &start_tx_rates); + if ( objNetSpeed->getCurrentDownloadRates(objKyDBus->dbusWiFiCardName.toUtf8().data(), &start_rcv_rates, &start_tx_rates) == -1){ + start_rcv_rates = end_rcv_rates; + } }else if(is_btnNetList_clicked == 1){ - objNetSpeed->getCurrentDownloadRates(objKyDBus->dbusLanCardName.toUtf8().data(), &start_rcv_rates, &start_tx_rates); + if ( objNetSpeed->getCurrentDownloadRates(objKyDBus->dbusLanCardName.toUtf8().data(), &start_rcv_rates, &start_tx_rates) == -1){ + start_tx_rates = end_tx_rates; + } } long int delta_rcv = (start_rcv_rates - end_rcv_rates)/800; @@ -2407,7 +2432,9 @@ void MainWindow::connLanDone(int connFlag) this->is_wired_line_ready = 1; this->is_by_click_connect = 1; this->ksnm->execGetLanList(); + QString txt(tr("Conn Ethernet Success")); + //m_notify->execNotifySend(txt); QString cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';notify-send '" + txt + "' -t 3800"; int status = system(cmd.toUtf8().data()); if (status != 0){ syslog(LOG_ERR, "execute 'notify-send' in function 'connLanDone' failed");} @@ -2420,10 +2447,10 @@ void MainWindow::connLanDone(int connFlag) qDebug()<<"without net line connect to computer"; this->is_wired_line_ready = 0; //without net line connect to computer QString txt(tr("Conn Ethernet Fail")); + //m_notify->execNotifySend(txt); QString cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';notify-send '" + txt + "' -t 3800"; int status = system(cmd.toUtf8().data()); if (status != 0){ syslog(LOG_ERR, "execute 'notify-send' in function 'connLanDone' failed");} - } if(connFlag == 3){ @@ -2542,6 +2569,7 @@ void MainWindow::connWifiDone(int connFlag) this->is_by_click_connect = 1; this->ksnm->execGetWifiList(); QString txt(tr("Conn Wifi Success")); + //m_notify->execNotifySend(txt); QString cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';notify-send '" + txt + "' -t 3800"; int status = system(cmd.toUtf8().data()); if (status != 0){ syslog(LOG_ERR, "execute 'notify-send' in function 'connWifiDone' failed");} @@ -2550,6 +2578,12 @@ void MainWindow::connWifiDone(int connFlag) //checkIfWifiConnect->start(8000); } else if (connFlag == 1) { is_stop_check_net_state = 0; + + QString txt(tr("Confirm your Wi-Fi password or usable of wireless card")); + //m_notify->execNotifySend(txt); + QString cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';notify-send '" + txt + "...' -t 3800"; + int status1 = system(cmd.toUtf8().data()); + if (status1 != 0){ syslog(LOG_ERR, "execute 'notify-send' in function 'execConnWifiPWD' failed");} } else if (connFlag == 3) { syslog(LOG_DEBUG, "Launch kylin-nm, Wi-Fi already connected"); //syslog(LOG_DEBUG, "Launch kylin-nm, Wi-Fi already connected, will check if Wi-Fi disconnected circularly"); @@ -2594,7 +2628,7 @@ void MainWindow::on_isWifiConnect() if (count_loop >= 2){ count_loop = 1;} } } - \ + delete loop_iface; delete loop_bt; } diff --git a/src/mainwindow.h b/src/mainwindow.h index ee1d2171..db908b4d 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -25,6 +25,7 @@ #include "kylin-dbus-interface.h" #include "kylin-network-interface.h" #include "utils.h" +#include "notifysend.h" #include #include @@ -141,6 +142,7 @@ public: QString mwBandWidth; KylinDBus *objKyDBus = nullptr; NetworkSpeed *objNetSpeed = nullptr; + NotifySend *m_notify = nullptr; //状态设置,0为假,1为真 int is_update_wifi_list = 0; //是否是update wifi列表,而不是load wifi列表 @@ -305,6 +307,7 @@ private slots: void onBtnAddNetClicked(); void onBtnCreateNetClicked(); + signals: void disConnSparedNet(QString type); diff --git a/src/notifysend.cpp b/src/notifysend.cpp new file mode 100644 index 00000000..3066f660 --- /dev/null +++ b/src/notifysend.cpp @@ -0,0 +1,54 @@ +#include "notifysend.h" +#include "ui_notifysend.h" + +NotifySend::NotifySend(QWidget *parent) : + QWidget(parent), + ui(new Ui::NotifySend) +{ + ui->setupUi(this); + + this->setWindowFlags(Qt::FramelessWindowHint | Qt::Popup); + this->setAttribute(Qt::WA_TranslucentBackground); + + QPainterPath path; + auto rect = this->rect(); + rect.adjust(1, 1, -1, -1); + path.addRoundedRect(rect, 4, 4); + setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon())); + + this->setStyleSheet("QWidget{border:none;border-radius:4px;}"); + ui->backwidget->setStyleSheet("QWidget{border:1px solid rgba(255, 255, 255, 0.05);border-radius:4px;background:rgba(19,19,20,0.7);}"); + ui->lbColor->setStyleSheet("QLabel{border:none;background:rgba(61,107,229,1);}"); + ui->leText->setStyleSheet("QLineEdit{border:none;background:transparent;font-size:14px;color:white;font-size:14px;}"); + ui->btnClose->setStyleSheet("QPushButton{background-image:url(:/res/g/close_white.png);background-color:transparent;border:none;}"); + ui->btnClose->setFocusPolicy(Qt::NoFocus); + + QRect availableGeometry = qApp->primaryScreen()->availableGeometry(); + int d = 10; //窗口上边沿到屏幕边沿距离 + int s = 10; //窗口右边沿到屏幕边沿距离 + + this->move(availableGeometry.x() + availableGeometry.width() - this->width() - s, availableGeometry.y() + d); +} + +NotifySend::~NotifySend() +{ + delete ui; +} + +void NotifySend::execNotifySend(QString text) +{ + ui->leText->setText(text); + this->show(); + + QTimer::singleShot(4000, this, SLOT(closeNotifyDialog() )); +} + +void NotifySend::closeNotifyDialog(){ + ui->leText->setText(""); + this->hide(); +} + +void NotifySend::on_btnClose_clicked() +{ + this->hide(); +} diff --git a/src/notifysend.h b/src/notifysend.h new file mode 100644 index 00000000..8a103135 --- /dev/null +++ b/src/notifysend.h @@ -0,0 +1,34 @@ +#ifndef NOTIFYSEND_H +#define NOTIFYSEND_H + +#include +#include +#include + +namespace Ui { +class NotifySend; +} + +class NotifySend : public QWidget +{ + Q_OBJECT + +public: + explicit NotifySend(QWidget *parent = nullptr); + ~NotifySend(); + + void execNotifySend(QString text); + +private: + Ui::NotifySend *ui; + +private slots: + void closeNotifyDialog(); + + void on_btnClose_clicked(); + +signals: + void timeout(); +}; + +#endif // NOTIFYSEND_H diff --git a/src/notifysend.ui b/src/notifysend.ui new file mode 100644 index 00000000..4c23ef41 --- /dev/null +++ b/src/notifysend.ui @@ -0,0 +1,69 @@ + + + NotifySend + + + + 0 + 0 + 400 + 70 + + + + Form + + + + + 0 + 0 + 60 + 70 + + + + + + + + + + 360 + 20 + 30 + 30 + + + + + + + + + + 80 + 20 + 260 + 27 + + + + + + + 0 + 0 + 400 + 70 + + + + backwidget + lbColor + btnClose + leText + + + + diff --git a/src/oneconnform.cpp b/src/oneconnform.cpp index 0641be81..bcdbd522 100644 --- a/src/oneconnform.cpp +++ b/src/oneconnform.cpp @@ -112,6 +112,8 @@ OneConnForm::OneConnForm(QWidget *parent, MainWindow *mainWindow, ConfForm *conf ui->btnInfo->setAttribute(Qt::WA_Hover,true); ui->btnInfo->installEventFilter(this); + //m_notify = new NotifySend(); + connect(ui->lePassword, SIGNAL(returnPressed()), this, SLOT(on_btnConnPWD_clicked())); ui->btnConn->setShortcut(Qt::Key_Return);//将字母区回车键与登录按钮绑定在一起 @@ -123,6 +125,7 @@ OneConnForm::OneConnForm(QWidget *parent, MainWindow *mainWindow, ConfForm *conf OneConnForm::~OneConnForm() { + m_notify->deleteLater(); delete ui; } @@ -603,6 +606,7 @@ void OneConnForm::slotConnWifiResult(int connFlag){ // 使用配置文件连接失败,需要删除该配置文件 QString txt(tr("Conn Wifi Failed"));//"连接 Wifi 失败" syslog(LOG_DEBUG, "Try to connect wifi named %s, but failed, will delete it's configuration file", ui->lbName->text().toUtf8().data()); + //m_notify->execNotifySend(txt); QString cmd = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';nmcli connection delete '" + ui->lbName->text() + "';notify-send '" + txt + "...' -t 3800"; int status = system(cmd.toUtf8().data()); if (status != 0){ syslog(LOG_ERR, "execute 'nmcli connection delete' in function 'slotConnWifiResult' failed");} diff --git a/src/oneconnform.h b/src/oneconnform.h index ec10074f..32b2931c 100644 --- a/src/oneconnform.h +++ b/src/oneconnform.h @@ -31,6 +31,7 @@ #include "kylin-network-interface.h" #include "backthread.h" #include "ksimplenm.h" +#include "notifysend.h" #define FRAME_SPEED 150 #define LIMIT_TIME 30*1000 @@ -80,6 +81,7 @@ public: void setLePassword(); + NotifySend *m_notify = nullptr; QString wifiName; bool isSelected; bool isActive; diff --git a/src/utils.cpp b/src/utils.cpp index 9f2c4226..3ffdc5a6 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -85,12 +85,14 @@ int NetworkSpeed::getCurrentDownloadRates(char *netname, long *save_rate, long * char tmp_value[128]; if((NULL == netname)||(NULL == save_rate)||(NULL == tx_rate)){ - printf("bad param\n"); + qDebug()<<"parameter pass to function getCurrentDownloadRates() error"; + syslog(LOG_ERR, "parameter pass to function getCurrentDownloadRates() error"); return -1; } if ( (net_dev_file=fopen("/proc/net/dev", "r")) == NULL ){ //打开文件/pro/net/dev/,从中读取流量数据 - printf("open file /proc/net/dev/ error!\n"); + qDebug()<<"error occured when try to open file /proc/net/dev/"; + syslog(LOG_ERR, "error occured when try to open file /proc/net/dev/"); return -1; } memset(buffer,0,sizeof(buffer)); @@ -99,10 +101,9 @@ int NetworkSpeed::getCurrentDownloadRates(char *netname, long *save_rate, long * match = strstr(buffer,netname); if(NULL == match){ - //printf("no eth0 keyword to find!\n"); + // qDebug()<<"No eth0 keyword to find!"; continue; }else{ - //printf("%s\n",buffer); match = match + strlen(netname) + strlen(":"); //地址偏移到冒号 sscanf(match,"%ld ",save_rate); memset(tmp_value,0,sizeof(tmp_value)); @@ -121,7 +122,6 @@ int NetworkSpeed::getCurrentDownloadRates(char *netname, long *save_rate, long * counter ++; } } - //printf("%s save_rate:%ld tx_rate:%ld\n",netname,*save_rate,*tx_rate); } } diff --git a/translations/kylin-nm_bo.ts b/translations/kylin-nm_bo.ts index d7c7e9c7..d04ec70d 100644 --- a/translations/kylin-nm_bo.ts +++ b/translations/kylin-nm_bo.ts @@ -1,104 +1,96 @@ - - BackThread - - - Confirm your Wi-Fi password - - - ConfForm - - + + edit network - + Network name: - + Method: - + Address: - + Netmask: - + Gateway: - + DNS 1: - + DNS 2: - + Edit Conn - + Auto(DHCP) - + Manual - + Cancel - + Save - + Ok - + New network already created - + New network settings already finished - + New settings already effective - + add wired network @@ -155,26 +147,6 @@ WPA & WPA2 Personal - - - WEP 40/128-bit Key (Hex or ASCII) - - - - - WEP 128-bit Passphrase - - - - - Dynamic WEP (802.1X) - - - - - WPA & WPA2 Enterprise - - DlgConnHidWifiLeap @@ -1175,26 +1147,6 @@ WPA & WPA2 Personal - - - WEP 40/128-bit Key (Hex or ASCII) - - - - - WEP 128-bit Passphrase - - - - - Dynamic WEP (802.1X) - - - - - WPA & WPA2 Enterprise - - DlgHotspotCreate @@ -1247,183 +1199,196 @@ MainWindow - - + + kylin-nm - - + + Advanced - - + + Ethernet - - + + Wifi - + HotSpot - + FlyMode - - - - - - + + + + + + Not connected - - - - - - - - - - + + + + + + + + + + Disconnected - + Ethernet Networks - - + + Connected - + Wifi Networks - + Create Lan Net - + Add Hide Network - + No usable network in the list - + Show MainWindow - + No Other Wired Network Scheme - + No Other Wireless Network Scheme - + + Confirm your Wi-Fi password or usable of wireless card + + + + please insert the wireless network adapter - + Abnormal connection exist, program will delete it - + Wired net is disconnected - + Wi-Fi is disconnected - + Conn Ethernet Success - + Conn Ethernet Fail - + Conn Wifi Success + + NotifySend + + + Form + + + OneConnForm - + Form - - - - + + + + Connect - + Disconnect - - + + Input Password... - + Connect to Hidden Wi-Fi Network - + None - + Conn Wifi Failed @@ -1431,24 +1396,24 @@ OneLancForm - + Form - - + + Connect - + Disconnect - - + + no configuration diff --git a/translations/kylin-nm_zh_CN.qm b/translations/kylin-nm_zh_CN.qm index 91ced1f00e75a0bc4966b375cb11e692d1ef1b41..ccee5390ad31978b64a118c1681ae77fc0b19de3 100644 GIT binary patch delta 2335 zcmXxldr(wW90%~UAca9%|9- z_(TlH)k+ObN^(jxM^r*9LVTbJYEDg9TA~h8*l+#XU!QY-_nvdl{hi-Acdtv-xkuFK zBg`R^6%$FsFw;i#Y8R39OOkH;gh-P>(kokta@N4y?J#dG$>!&BpGDBa3U%9{Pd*Gd z0w?#uh+Y_<1cl^4G}4#COkbEgMzS59JTVi=26#f*`D6_EnrLb>#rdw~>tU*RFh)ef z)PL$akv;?Zd=3r8FgP8W#W4PWC@k_ak-1ltbt{ns%3da_y_rm;8W3H~*~tSYh(_c1 z0b7eW`m~EEYl}Fsl2x~ht6TEfrOlW1d6H8JPC+ey&dCy21lX3RIn6aOxwJs!QM6c$WmLu07>1v{k9@H%i$a zb;@_V0-~ep@-vA<69UznZxkZa+bH3myGa7sg==OXCa z3nx8-Aq!!o3?|%!DPFp|yfQw*Lv-i$?-D6mpjJ4B#<<5&eN(K|j4<@+`IA+3uu7~Nxa!(ESZqBgD4Q|5e}YjSSaWwt%gw_5mOx3gr1pR+Z_Oh>R71we@L=AyF3B{jJ0*f<@Kdy)plcTrE#UB x&R%V=uQ!&L)>SxrX8AhJg_^eEf)T0n_8dR8YF6zsN9F3*>@^i_zs*h+{|8Dvhlv0H delta 2397 zcmXZc2~bsK6bJD0cHVspi;sQZ_nik1Sswf1k}K+jma-^>A#Q^X)nytQb;zY&s3I_gl_AJqIO++a$XT;#ML> zF_CN`%y@@rUO$nkmgKuXA=3R#^4r^q3Q}O9FDVw~5-Al>{S4YIfleCexfc5GfniNB z?jL9xhGJSH8W{^?WYodg$c|{a?bcZWv!72@1bS6y7As8j2^8^30MogGof%!;)(`&HS1M$#@J8 z$gYw`UT!1GT_TNN$?7&sSGN|j@z8ZCjM^!!v9BPS{))6_c$_DGTc$o&PL#7s7J7F* zQP#V%#5KIDy0dWF1L%6hsz~Hphd|JeFzPN$JS{6vzeVIW3`0C&j7c6Nmhr@H%2&Vk zf?tp+-&=T|C*BF=TcAw|)K@@5DResteV?)--x&NG0@44$B!8GP4$UXz2Rk@F^7G|q zlX%NLq%brE##YNO3VP0;45$uK+-5oy`V4^zr|;J zOffUCmRGu4F>}~@Bud4i0p41>t%{3nNBMd{sqDQ#l&n<-^>uS@Y*a4aVd0~Ep{zT> zTWA)GR9L7I zbT^3XXF;bf=v4&+X25WJ7~iQ1b;}|0^bpYq%Y<<)D$6cw_N!H&W&KN}YKB@ZoHhr# zbVHx}Feo2JK7qzTm=X)kB``Bebwk-eWWHl_;^+HBf*6Q~T`zP>fu5t#e<~gyj_b5@ zFypvQ`y>7ulJnKZFn&;8o!XdC&q;VsZ8WkHgL+2)dt4`?pzr~-?}N^1Q1o7gMnE@= zsDTNYFj<6Y57qS(QM_e`)vX?X5_vsf9}{`|sr$2^@=9KX_B)`n40@e{0gW(0Dy$e! z;DV-`RHT9@LitQyf&2`#u|RzbH0*)yVbCuGhOC4!TVT=xm>LfAr{V>DLj7N#^7HRO zn;xkD&MJTZhHD78zYhJD!jOG1rVA!Dz|^V!{Lh89+x%czi_mk1k0NwHxZah)Tfag0 zevDU`ohbaiOU|}vOkeZKNTr(6EAd3G!~$*)Q3SsAoT5k z!KYyKd6@VsOzF}bwU+Gg`I^4j-CU3yGy@0vi4r3<&x_{rixV{CMMlnrF{mkl4u>@3 zqP4@tfPl}`z`$l)N9IDKADq4orhlca{-&DGuvB}f(1X8{La6D04$q*=o6u)F415eD z4?ttRR-Amm^dSVywlHH*d#q?9mtJQW>;|JfwWsHE@=301Zx!$gBO-O_xuaa`HM(XG zu8`7p-TvoATnVp1btklQfsO;vV-Wf;5zz>f!nnoI)CSY$zzi2%kF~-{D|IjH8hB#G zFnAe^Ua5C%{gSs>gu*Y-!3R1wLGLeMpgW8ZucDD~5GLP%>1O@9yb}Jd|IlBx-Nq}b zh3XP$y8$|`fgUF4_Y#KIz}Vx^|p8t Dta6wx diff --git a/translations/kylin-nm_zh_CN.ts b/translations/kylin-nm_zh_CN.ts index 5e4c8856..032507c6 100644 --- a/translations/kylin-nm_zh_CN.ts +++ b/translations/kylin-nm_zh_CN.ts @@ -4,91 +4,90 @@ BackThread - Confirm your Wi-Fi password - 请再次确认Wi-Fi密码 + 请再次确认Wi-Fi密码 ConfForm - - + + edit network 编辑网络设置 - + Network name: 网络名称: - + Method: 编辑IP设置: - + Address: IP地址: - + Netmask: 子网掩码: - + Gateway: 默认网关: - + DNS 1: 首选DNS: - + DNS 2: 备选DNS: - + Edit Conn 网络设置 - + Auto(DHCP) 自动(DHCP) - + Manual 手动 - + Cancel 取消 - + Save 保存 - + Ok 确定 - + New network already created 已创建新的有线网络 - + New network settings already finished 新的网络配置已经完成 @@ -101,12 +100,12 @@ 新的设置已经生效 - + New settings already effective 新的设置已经生效 - + add wired network 新建有线网络 @@ -159,24 +158,20 @@ WPA 及 WPA2 个人 - WEP 40/128-bit Key (Hex or ASCII) - WEP 40/128 位密钥(十六进制或ASCII) + WEP 40/128 位密钥(十六进制或ASCII) - WEP 128-bit Passphrase - WEP 128 位密码句 + WEP 128 位密码句 - Dynamic WEP (802.1X) - 动态 WEP (802.1x) + 动态 WEP (802.1x) - WPA & WPA2 Enterprise - WPA 及 WPA2 企业 + WPA 及 WPA2 企业 @@ -1184,24 +1179,20 @@ WPA 及 WPA2 个人 - WEP 40/128-bit Key (Hex or ASCII) - WEP 40/128 位密钥(十六进制或ASCII) + WEP 40/128 位密钥(十六进制或ASCII) - WEP 128-bit Passphrase - WEP 128 位密码句 + WEP 128 位密码句 - Dynamic WEP (802.1X) - 动态 WEP (802.1x) + 动态 WEP (802.1x) - WPA & WPA2 Enterprise - WPA 及 WPA2 企业 + WPA 及 WPA2 企业 @@ -1255,8 +1246,8 @@ MainWindow - - + + kylin-nm 网络工具 @@ -1265,14 +1256,14 @@ 网络 - - + + Advanced 网络配置 - - + + Ethernet 有线网络 @@ -1281,8 +1272,8 @@ 加入网络 - - + + Wifi 无线网络 @@ -1295,92 +1286,97 @@ 已关闭 - + HotSpot 个人热点 - + FlyMode 飞行模式 - + Show MainWindow 显示网络连接界面 - - - - - - + + + + + + Not connected 当前未连接任何网络 - - - - - - - - - - + + + + + + + + + + Disconnected 未连接 - + No Other Wired Network Scheme 列表中无其他有线网络 - + No Other Wireless Network Scheme 未检测到其他无线网络 - + Wired net is disconnected 断开有线网络 - + Wi-Fi is disconnected 断开无线网络 - + + Confirm your Wi-Fi password or usable of wireless card + 请确认Wi-Fi密码或无线设备 + + + Ethernet Networks 可用有线网络列表 - + Create Lan Net 新建网络 - + Add Hide Network 加入网络 - + No usable network in the list 列表暂无可连接网络 - - + + Connected 已连接, - + Wifi Networks 可用无线网络列表 @@ -1393,12 +1389,12 @@ 打开无线网开关前保持有线网开关打开 - + please insert the wireless network adapter 请先插入无线网卡 - + Abnormal connection exist, program will delete it 正在断开异常连接的网络 @@ -1411,25 +1407,33 @@ 正在更新 Wi-Fi列表 - + Conn Ethernet Success 连接有线网络成功 - + Conn Ethernet Fail 连接有线网络失败 - + Conn Wifi Success 连接无线网络成功 + + NotifySend + + + Form + -- + + OneConnForm - + Form -- @@ -1442,26 +1446,26 @@ 设置 - - - - + + + + Connect 连接 - + Disconnect 断开 - - + + Input Password... 输入密码... - + Connect to Hidden Wi-Fi Network 连接到隐藏 Wi-Fi 网络 @@ -1478,12 +1482,12 @@ 速率 - + None - + Conn Wifi Failed 连接无线网络失败 @@ -1491,7 +1495,7 @@ OneLancForm - + Form -- @@ -1500,19 +1504,19 @@ 设置 - - + + Connect 连接 - + Disconnect 断开 - - + + no configuration 未配置 diff --git a/wireless-security/dlgconnhidwifi.cpp b/wireless-security/dlgconnhidwifi.cpp index afaaed97..c5960b0f 100644 --- a/wireless-security/dlgconnhidwifi.cpp +++ b/wireless-security/dlgconnhidwifi.cpp @@ -94,11 +94,11 @@ DlgConnHidWifi::DlgConnHidWifi(int type, MainWindow *mainWindow, QWidget *parent ui->cbxSecurity->addItem(tr("None")); //无 ui->cbxSecurity->addItem(tr("WPA & WPA2 Personal")); //WPA 及 WPA2 个人 - ui->cbxSecurity->addItem(tr("WEP 40/128-bit Key (Hex or ASCII)")); //WEP 40/128 位密钥(十六进制或ASCII) - ui->cbxSecurity->addItem(tr("WEP 128-bit Passphrase")); //WEP 128 位密码句 - ui->cbxSecurity->addItem("LEAP"); - ui->cbxSecurity->addItem(tr("Dynamic WEP (802.1X)")); //动态 WEP (802.1x) - ui->cbxSecurity->addItem(tr("WPA & WPA2 Enterprise")); //WPA 及 WPA2 企业 +// ui->cbxSecurity->addItem(tr("WEP 40/128-bit Key (Hex or ASCII)")); //WEP 40/128 位密钥(十六进制或ASCII) +// ui->cbxSecurity->addItem(tr("WEP 128-bit Passphrase")); //WEP 128 位密码句 +// ui->cbxSecurity->addItem("LEAP"); +// ui->cbxSecurity->addItem(tr("Dynamic WEP (802.1X)")); //动态 WEP (802.1x) +// ui->cbxSecurity->addItem(tr("WPA & WPA2 Enterprise")); //WPA 及 WPA2 企业 ui->cbxSecurity->setCurrentIndex(0); connect(ui->cbxSecurity,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeDialog())); diff --git a/wireless-security/dlgconnhidwifi.ui b/wireless-security/dlgconnhidwifi.ui index 32885f76..bd6906fb 100644 --- a/wireless-security/dlgconnhidwifi.ui +++ b/wireless-security/dlgconnhidwifi.ui @@ -56,7 +56,7 @@ 76 - 176 + 221 90 20 @@ -74,7 +74,7 @@ 175 - 215 + 170 182 32 @@ -92,7 +92,7 @@ 76 - 221 + 176 90 20 @@ -110,7 +110,7 @@ 175 - 170 + 215 182 32 diff --git a/wireless-security/dlgconnhidwifiwpa.cpp b/wireless-security/dlgconnhidwifiwpa.cpp index 45d30de9..8cb8a173 100644 --- a/wireless-security/dlgconnhidwifiwpa.cpp +++ b/wireless-security/dlgconnhidwifiwpa.cpp @@ -100,11 +100,11 @@ DlgConnHidWifiWpa::DlgConnHidWifiWpa(int type, MainWindow *mainWindow, QWidget * ui->cbxSecurity->addItem(tr("None")); //无 ui->cbxSecurity->addItem(tr("WPA & WPA2 Personal")); //WPA 及 WPA2 个人 - ui->cbxSecurity->addItem(tr("WEP 40/128-bit Key (Hex or ASCII)")); //WEP 40/128 位密钥(十六进制或ASCII) - ui->cbxSecurity->addItem(tr("WEP 128-bit Passphrase")); //WEP 128 位密码句 - ui->cbxSecurity->addItem("LEAP"); - ui->cbxSecurity->addItem(tr("Dynamic WEP (802.1X)")); //动态 WEP (802.1x) - ui->cbxSecurity->addItem(tr("WPA & WPA2 Enterprise")); //WPA 及 WPA2 企业 +// ui->cbxSecurity->addItem(tr("WEP 40/128-bit Key (Hex or ASCII)")); //WEP 40/128 位密钥(十六进制或ASCII) +// ui->cbxSecurity->addItem(tr("WEP 128-bit Passphrase")); //WEP 128 位密码句 +// ui->cbxSecurity->addItem("LEAP"); +// ui->cbxSecurity->addItem(tr("Dynamic WEP (802.1X)")); //动态 WEP (802.1x) +// ui->cbxSecurity->addItem(tr("WPA & WPA2 Enterprise")); //WPA 及 WPA2 企业 ui->cbxSecurity->setCurrentIndex(1); connect(ui->cbxSecurity,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeDialog())); diff --git a/wireless-security/dlgconnhidwifiwpa.ui b/wireless-security/dlgconnhidwifiwpa.ui index d8b5b4a5..1c6b36c5 100644 --- a/wireless-security/dlgconnhidwifiwpa.ui +++ b/wireless-security/dlgconnhidwifiwpa.ui @@ -17,7 +17,7 @@ 76 - 176 + 221 90 20 @@ -35,7 +35,7 @@ 76 - 221 + 176 90 20 @@ -125,7 +125,7 @@ 175 - 215 + 170 182 32 @@ -200,7 +200,7 @@ 175 - 170 + 215 182 32