update wired list after remove a wired network

This commit is contained in:
chenlelin 2020-03-13 09:41:30 +08:00
parent b1b4175eb6
commit 94b47ab16c
17 changed files with 70 additions and 49 deletions

View File

@ -43,7 +43,7 @@ ConfForm::ConfForm(QWidget *parent) :
path.addRoundedRect(rect, 6, 6);
setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon()));
// this->setStyleSheet("QWidget{border-radius:6px;border:none;}");
this->setStyleSheet("QWidget{border-radius:6px;border:none;}");
ui->centralWidget->setStyleSheet("#centralWidget{border:1px solid rgba(255,255,255,0.05);border-radius:6px;background:rgba(19,19,20,0.9);}");
ui->lbName->setText(tr("Network name: "));//"网络名称:"

View File

@ -1 +0,0 @@
./man/kylin-nm.1

View File

@ -1 +0,0 @@
1e622cec1ec1692a16f4690843cd87e91a8fa8fe

View File

@ -1,13 +0,0 @@
Package: kylin-nm-dbgsym
Package-Type: ddeb
Source: kylin-nm
Version: 1.2.0-1
Auto-Built-Package: debug-symbols
Architecture: amd64
Maintainer: Kylin Team <team+kylin@tracker.debian.org>
Installed-Size: 2536
Depends: kylin-nm (= 1.2.0-1)
Section: debug
Priority: optional
Description: debug symbols for kylin-nm
Build-Ids: 1e622cec1ec1692a16f4690843cd87e91a8fa8fe

View File

@ -1 +0,0 @@
de19370323a6a918a5586ae80ff7f7fa usr/lib/debug/.build-id/1e/622cec1ec1692a16f4690843cd87e91a8fa8fe.debug

View File

@ -1 +0,0 @@
kylin-nm

1
debian/control vendored
View File

@ -20,6 +20,7 @@ Vcs-Browser: https://github.com/ukui/kylin-nm
Package: kylin-nm
Architecture: any
Depends: network-manager (>=1.12.4),
libnotify-bin,
${shlibs:Depends},
${misc:Depends}
Description: Gui Applet tool for display and edit network simply

View File

@ -47,6 +47,11 @@ KylinDBus::KylinDBus(MainWindow *mainWindow, QObject *parent) :QObject(parent)
QString("org.freedesktop.NetworkManager.Settings"),
QString("NewConnection"), this, SLOT(onNewConnection(QDBusObjectPath) ) );
QDBusConnection::systemBus().connect(QString("org.freedesktop.NetworkManager"),
QString("/org/freedesktop/NetworkManager/Settings"),
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"),
@ -204,7 +209,7 @@ void KylinDBus::getLanIp(QString netName)
}
}
void KylinDBus::getWifiMac(QString netName, int num)
void KylinDBus::getWifiMac(QString netName)
{
dbusWifiMac = "";
@ -364,11 +369,19 @@ void KylinDBus::onNewConnection(QDBusObjectPath objPath)
}
}
void KylinDBus::onConnectionRemoved(QDBusObjectPath objPath)
{
syslog(LOG_DEBUG, "An old network was removed from configure directory.");
qDebug()<<"An old network was removed from configure directory.";
emit this->updateWiredList(0);
}
void KylinDBus::onLanPropertyChanged(QVariantMap qvm)
{
if (!isRunningFunction) {
syslog(LOG_DEBUG, "kylin-nm receive a signal about interface 'Device.Wired' propertiesChanged.");
qDebug()<<"kylin-nm receive a signal about interface 'Device.Wired' propertiesChanged.";
syslog(LOG_DEBUG, "kylin-nm receive a signal 'Device.Wired propertiesChanged' about interface.");
qDebug()<<"kylin-nm receive a signal 'Device.Wired propertiesChanged' about interface.";
isRunningFunction = true;
time->start(3000);

View File

@ -8,8 +8,8 @@
#include <QtDBus/QDBusMessage>
#include <QtDBus/QDBusInterface>
#include <QtDBus/QDBusObjectPath>
#include <QDBusObjectPath>
#include <QDBusReply>
#include <QDBusObjectPath>
#include <QVariant>
#include <QVariantMap>
#include <QTimer>
@ -43,6 +43,7 @@ public:
public slots:
void onNewConnection(QDBusObjectPath objPath);
void onConnectionRemoved(QDBusObjectPath objPath);
void onLanPropertyChanged(QVariantMap qvm);
void onWifiPropertyChanged(QVariantMap qvm);
void onAccessPointAdded(QDBusObjectPath objPath);
@ -51,7 +52,7 @@ public slots:
void getWiredCardName();
void getWirelessCardName();
void getLanIp(QString netName);
void getWifiMac(QString netName, int num);
void getWifiMac(QString netName);
void getActWifiMac(QString netName);
void slot_timeout();

View File

@ -31,6 +31,8 @@
int main(int argc, char *argv[])
{
// QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication a(argc, argv);
openlog(LOG_IDENT, LOG_NDELAY | LOG_NOWAIT | LOG_PID, LOG_USER);

View File

@ -1164,12 +1164,13 @@ void MainWindow::loadWifiListDone(QStringList slist)
ccf->setRate(wrate);
ccf->setSignal(wsignal, wsecu);
activeWifiSignalLv = wsignal.toInt();
objKyDBus->getActWifiMac(wname);
//objKyDBus->getActWifiMac(wname);
objKyDBus->getWifiMac(wname);
ccf->setWifiInfo(wsecu, wsignal, objKyDBus->dbusWifiMac);
ccf->setConnedString(1, tr("Connected"), wsecu);//"已连接"
ccf->isConnected = true;
ifWLanConnected = true;
qDebug()<<"show load down and load up";
qDebug()<<"show load down and load up in the function loadWifiListDone";
lbLoadDown->show();
lbLoadUp->show();
lbLoadDownImg->show();
@ -1187,7 +1188,7 @@ void MainWindow::loadWifiListDone(QStringList slist)
ocf->setRate(wrate);
ocf->setLine(true);
ocf->setSignal(wsignal, wsecu);
objKyDBus->getWifiMac(wname, i-1);
objKyDBus->getWifiMac(wname);
ocf->setWifiInfo(wsecu, wsignal, objKyDBus->dbusWifiMac);
ocf->setConnedString(0, tr("Disconnected"), wsecu);
ocf->move(4, j * 60);
@ -1263,8 +1264,8 @@ void MainWindow::updateWifiListDone(QStringList slist)
//删除元素下面的的所有元素上移
for(int after_pos = pos+1; after_pos < wifiList.size(); after_pos ++){
OneConnForm *after_ocf = wifiList.at(after_pos);
if (lastWname == currSelNetName) {after_ocf->move(0, after_ocf->y() - 60 - 88);}
else {after_ocf->move(0, after_ocf->y() - 60);}
if (lastWname == currSelNetName) {after_ocf->move(4, after_ocf->y() - 60 - 88);}
else {after_ocf->move(4, after_ocf->y() - 60);}
}
wifiListWidget->resize(440, wifiListWidget->height() - 60);
break;
@ -1320,7 +1321,7 @@ void MainWindow::updateWifiListDone(QStringList slist)
addItem->setRate(wrate);
addItem->setLine(false);
addItem->setSignal(wsignal, wsecu);
objKyDBus->getWifiMac(wname, i-1);
objKyDBus->getWifiMac(wname);
addItem->setWifiInfo(wsecu, wsignal, objKyDBus->dbusWifiMac);
addItem->setConnedString(0, tr("Disconnected"), wsecu);//"未连接"
addItem->move(4, posY);
@ -1644,7 +1645,7 @@ void MainWindow::on_setNetSpeed()
objNetSpeed->getCurrentDownloadRates(objKyDBus->dbusLanCardName.toUtf8().data(), &start_rcv_rates, &start_tx_rates);
}
long int delta_rcv = (start_rcv_rates - end_rcv_rates)/8;
long int delta_rcv = (start_rcv_rates - end_rcv_rates)/800;
long int delta_tx = (start_tx_rates - end_tx_rates)/8;
if (delta_rcv>=10000 || delta_rcv<0){delta_rcv = 0;}
if (delta_tx>=10000 || delta_tx<0){delta_tx = 0;}
@ -1912,15 +1913,12 @@ void MainWindow::oneLanFormSelected(QString lanName)
currSelNetName = "";
} else {
// 选中的选项卡放大,其他选项卡缩小
int selectY = 0;
for(int i = 0;i < lanList.size(); i ++){
OneLancForm *ocf = lanList.at(i);
if(ocf->lanName == lanName){
ocf->setSelected(true, false);
selectY = ocf->y();
}else{
ocf->setSelected(false, false);
selectY = ocf->y(); //获取选中item的y坐标
break;
}
}
@ -1932,6 +1930,16 @@ void MainWindow::oneLanFormSelected(QString lanName)
}
}
for(int i = 0;i < lanList.size(); i ++){
OneLancForm *ocf = lanList.at(i);
if(ocf->lanName == lanName){
ocf->setSelected(true, false);
selectY = ocf->y();
}else{
ocf->setSelected(false, false);
}
}
currSelNetName = lanName;
}
@ -2032,24 +2040,12 @@ void MainWindow::oneWifiFormSelected(QString wifiName, int extendLength)
}
currSelNetName = "";
} else {
// 选中的选项卡放大,其他选项卡缩小
int selectY = 0;
for(int i = 0;i < wifiList.size(); i ++){
OneConnForm *ocf = wifiList.at(i);
if(ocf->wifiName == wifiName){
if (ocf->wifiName == hideWiFiConn){
ocf->setHideItem(true, true);
}else{
ocf->setSelected(true, false);
}
selectY = ocf->y();
}else{
if (ocf->wifiName == hideWiFiConn){
ocf->setHideItem(true, true);
}else{
ocf->setSelected(false, false);
}
selectY = ocf->y(); //获取选中item的y坐标
break;
}
}
@ -2061,9 +2057,27 @@ void MainWindow::oneWifiFormSelected(QString wifiName, int extendLength)
}
}
for(int i = 0;i < wifiList.size(); i ++){
OneConnForm *ocf = wifiList.at(i);
if(ocf->wifiName == wifiName){
if (ocf->wifiName == hideWiFiConn){
ocf->setHideItem(true, true);
}else{
ocf->setSelected(true, false);
}
}else{
if (ocf->wifiName == hideWiFiConn){
ocf->setHideItem(true, true);
}else{
ocf->setSelected(false, false);
}
}
}
currSelNetName = wifiName;
}
//最后一个item没有下划线
QList<OneConnForm *> itemList = wifiListWidget->findChildren<OneConnForm *>();
int n = itemList.size();
if (n >= 1){

View File

@ -78,6 +78,7 @@ OneConnForm::OneConnForm(QWidget *parent, MainWindow *mainWindow, ConfForm *conf
ui->lbWaitingIcon->setStyleSheet("QLabel{border:0px;background-color:transparent;}");
ui->btnInfo->setCursor(QCursor(Qt::PointingHandCursor));
ui->btnInfo->setFocusPolicy(Qt::NoFocus);
ui->checkBoxPwd->setFocusPolicy(Qt::NoFocus);
ui->btnConnSub->setFocusPolicy(Qt::NoFocus);
ui->btnConn->setFocusPolicy(Qt::NoFocus);

View File

@ -60,6 +60,7 @@ OneLancForm::OneLancForm(QWidget *parent, MainWindow *mainWindow, ConfForm *conf
ui->lbWaitingIcon->setStyleSheet("QLabel{border:0px;background-color:transparent;}");
ui->btnInfo->setCursor(QCursor(Qt::PointingHandCursor));
ui->btnInfo->setFocusPolicy(Qt::NoFocus);
ui->btnConnSub->setFocusPolicy(Qt::NoFocus);
ui->btnConn->setFocusPolicy(Qt::NoFocus);
ui->btnDisConn->setFocusPolicy(Qt::NoFocus);

View File

@ -7,6 +7,8 @@
#include <QProxyStyle>
#include <QStyleFactory>
#include <QWidget>
#include <QPainter>
#include <QStyleOptionSlider>
#include <stdio.h>
#include <stdlib.h>
@ -155,6 +157,9 @@ public:
signals:
public slots:
private:
void drawScrollbar( ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget ) const;
};
#endif // UTILS_H