kylin-nm 1.0.8
This commit is contained in:
parent
7f5a1a5cff
commit
9a7530edb6
|
@ -17,7 +17,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "backthread.h"
|
#include "backthread.h"
|
||||||
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
#include <QRegExp>
|
||||||
|
|
||||||
BackThread::BackThread(QObject *parent) : QObject(parent){
|
BackThread::BackThread(QObject *parent) : QObject(parent){
|
||||||
}
|
}
|
||||||
|
@ -108,12 +110,15 @@ void BackThread::execDisWifi(){
|
||||||
void BackThread::execConnLan(QString connName){
|
void BackThread::execConnLan(QString connName){
|
||||||
QString net_card = "ifconfig>/tmp/kylin-nm-ifconfig";
|
QString net_card = "ifconfig>/tmp/kylin-nm-ifconfig";
|
||||||
system(net_card.toUtf8().data());
|
system(net_card.toUtf8().data());
|
||||||
|
|
||||||
QFile file("/tmp/kylin-nm-ifconfig");
|
QFile file("/tmp/kylin-nm-ifconfig");
|
||||||
if(!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
if(!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||||
qDebug()<<"Can't open the file kylin-nm-ifconfig!"<<endl;
|
qDebug()<<"Can't open the file kylin-nm-ifconfig!"<<endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString txt = file.readLine();
|
QString txt = file.readLine();
|
||||||
QString strType = txt.mid(0, 6);
|
QString strType = txt.mid(0, 6);
|
||||||
|
|
||||||
QString carrierPath ="/sys/class/net/" + strType + "/carrier";
|
QString carrierPath ="/sys/class/net/" + strType + "/carrier";
|
||||||
QFile sys_carrier(carrierPath);
|
QFile sys_carrier(carrierPath);
|
||||||
if(!sys_carrier.open(QIODevice::ReadOnly | QIODevice::Text)){
|
if(!sys_carrier.open(QIODevice::ReadOnly | QIODevice::Text)){
|
||||||
|
|
|
@ -1,3 +1,29 @@
|
||||||
|
kylin-nm (1.0.9-0ubuntu1) eoan; urgency=medium
|
||||||
|
|
||||||
|
* reUpload
|
||||||
|
|
||||||
|
-- handsome_feng <jianfengli@ubuntukylin.com> Thu, 26 Sep 2019 17:31:40 +0800
|
||||||
|
|
||||||
|
kylin-nm (1.0.8-0ubuntu1) eoan; urgency=medium
|
||||||
|
|
||||||
|
* Change a sentence in backthread.cpp, this sentence is wrong in 1.0.7-0ubuntu1
|
||||||
|
|
||||||
|
-- handsome_feng <jianfengli@ubuntukylin.com> Thu, 26 Sep 2019 17:11:40 +0800
|
||||||
|
|
||||||
|
kylin-nm (1.0.7-0ubuntu1) eoan; urgency=medium
|
||||||
|
|
||||||
|
* Bug-fix:
|
||||||
|
- Fix the bug which kylin-nm window-state can not update after pluging in or out wireless network adapter
|
||||||
|
|
||||||
|
-- handsome_feng <jianfengli@ubuntukylin.com> Thu, 26 Sep 2019 16:51:40 +0800
|
||||||
|
|
||||||
|
kylin-nm (1.0.6-0ubuntu1) eoan; urgency=medium
|
||||||
|
|
||||||
|
* Use ukui-icon-theme to set the tray icon of kylin-nm
|
||||||
|
* Can not open the function of wifi without wireless network adapter
|
||||||
|
|
||||||
|
-- handsome_feng <jianfengli@ubuntukylin.com> Tue, 24 Sep 2019 12:51:40 +0800
|
||||||
|
|
||||||
kylin-nm (1.0.5-0ubuntu1) eoan; urgency=medium
|
kylin-nm (1.0.5-0ubuntu1) eoan; urgency=medium
|
||||||
|
|
||||||
* Change the method to get the path of carrier file
|
* Change the method to get the path of carrier file
|
||||||
|
|
|
@ -1,14 +1,10 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE QtCreatorProject>
|
<!DOCTYPE QtCreatorProject>
|
||||||
<<<<<<< HEAD
|
<!-- Written by QtCreator 4.6.2, 2019-09-26T18:17:25. -->
|
||||||
<!-- Written by QtCreator 4.6.2, 2019-09-24T13:06:38. -->
|
|
||||||
=======
|
|
||||||
<!-- Written by QtCreator 4.6.2, 2019-09-23T17:00:02. -->
|
|
||||||
>>>>>>> b43f78de198252c1f54a06af74b0f347f757ec1d
|
|
||||||
<qtcreator>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>EnvironmentId</variable>
|
<variable>EnvironmentId</variable>
|
||||||
<value type="QByteArray">{d24ee5cf-e33b-4ac0-b3ff-aa81cafc226a}</value>
|
<value type="QByteArray">{871a7e44-b0ca-4f6c-adc5-39582f458132}</value>
|
||||||
</data>
|
</data>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||||
|
@ -65,7 +61,7 @@
|
||||||
<valuemap type="QVariantMap">
|
<valuemap type="QVariantMap">
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">桌面</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">桌面</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">桌面</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">桌面</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{3b9e90dd-8b5f-4932-ae85-9f4afd675bbc}</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{efe0a144-059c-4715-871b-4801b9a8c8f6}</value>
|
||||||
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
||||||
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||||
|
|
2
main.cpp
2
main.cpp
|
@ -30,6 +30,8 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
|
|
||||||
|
QIcon::setThemeName("ukui-icon-theme");
|
||||||
|
|
||||||
// 国际化
|
// 国际化
|
||||||
QString locale = QLocale::system().name();
|
QString locale = QLocale::system().name();
|
||||||
QTranslator trans_global;
|
QTranslator trans_global;
|
||||||
|
|
135
mainwindow.cpp
135
mainwindow.cpp
|
@ -180,14 +180,12 @@ void MainWindow::createTrayIcon()
|
||||||
trayIcon->setContextMenu(trayIconMenu);
|
trayIcon->setContextMenu(trayIconMenu);
|
||||||
|
|
||||||
// 初始化托盘所有Icon
|
// 初始化托盘所有Icon
|
||||||
QString iconDir = "/usr/share/icons/ukui-icon-theme/48x48/status/";
|
iconLanOnline = QIcon::fromTheme("nm-device-wired");
|
||||||
iconLanOnline = QIcon(iconDir + "nm-device-wire.png");
|
iconLanOffline = QIcon::fromTheme("nm-no-connection");
|
||||||
iconLanOffline = QIcon(iconDir + "nm-no-connection.png");
|
iconWifiFull = QIcon::fromTheme("nm-signal-100");
|
||||||
iconWifiFull = QIcon(iconDir + "nm-signal-100.png");
|
iconWifiHigh = QIcon::fromTheme("nm-signal-75");
|
||||||
iconWifiHigh = QIcon(iconDir + "nm-signal-75.png");
|
iconWifiMedium = QIcon::fromTheme("nm-signal-50");
|
||||||
iconWifiMedium = QIcon(iconDir + "nm-signal-50.png");
|
iconWifiLow = QIcon::fromTheme("nm-signal-25");
|
||||||
iconWifiLow = QIcon(iconDir + "nm-signal-25.png");
|
|
||||||
iconConnecting = QIcon(iconDir + ".png");
|
|
||||||
|
|
||||||
loadIcons.append(QIcon(":/res/s/conning-s/1.png"));
|
loadIcons.append(QIcon(":/res/s/conning-s/1.png"));
|
||||||
loadIcons.append(QIcon(":/res/s/conning-s/2.png"));
|
loadIcons.append(QIcon(":/res/s/conning-s/2.png"));
|
||||||
|
@ -340,7 +338,7 @@ void MainWindow::getIface(){
|
||||||
} else if(iface->lstate == 0) {
|
} else if(iface->lstate == 0) {
|
||||||
connLanDone(3);
|
connLanDone(3);
|
||||||
} else if(iface->wstate == 1 && (iface->lstate == 1)) {
|
} else if(iface->wstate == 1 && (iface->lstate == 1)) {
|
||||||
qDebug()<<"开机,即将循环检测 Lan或Wifi 是否开启";
|
qDebug()<<"启动软件,即将循环检测 Lan或Wifi 是否开启";
|
||||||
check_isNetOn = new QTimer(this);
|
check_isNetOn = new QTimer(this);
|
||||||
check_isNetOn->setTimerType(Qt::PreciseTimer);
|
check_isNetOn->setTimerType(Qt::PreciseTimer);
|
||||||
QObject::connect(check_isNetOn, SIGNAL(timeout()), this, SLOT(on_isNetOn()));
|
QObject::connect(check_isNetOn, SIGNAL(timeout()), this, SLOT(on_isNetOn()));
|
||||||
|
@ -772,30 +770,52 @@ void MainWindow::on_btnNet_clicked()
|
||||||
|
|
||||||
void MainWindow::on_btnWifi_clicked()
|
void MainWindow::on_btnWifi_clicked()
|
||||||
{
|
{
|
||||||
// 网络开关关闭时,点击Wifi开关无效
|
QString wlan_card = "iwconfig>/tmp/kylin-nm-iwconfig";
|
||||||
if(checkLanOn()){
|
system(wlan_card.toUtf8().data());
|
||||||
if(checkWlOn()){
|
|
||||||
QThread *t = new QThread();
|
|
||||||
BackThread *bt = new BackThread();
|
|
||||||
bt->moveToThread(t);
|
|
||||||
connect(t, SIGNAL(finished()), t, SLOT(deleteLater()));
|
|
||||||
connect(t, SIGNAL(started()), bt, SLOT(execDisWifi()));
|
|
||||||
connect(bt, SIGNAL(disWifiDone()), this, SLOT(disWifiDone()));
|
|
||||||
connect(bt, SIGNAL(btFinish()), t, SLOT(quit()));
|
|
||||||
t->start();
|
|
||||||
|
|
||||||
}else{
|
QFile file("/tmp/kylin-nm-iwconfig");
|
||||||
QThread *t = new QThread();
|
if(!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||||
BackThread *bt = new BackThread();
|
qDebug()<<"Can't open the file kylin-nm-iwconfig!"<<endl;
|
||||||
bt->moveToThread(t);
|
}
|
||||||
connect(t, SIGNAL(finished()), t, SLOT(deleteLater()));
|
QString txt = file.readAll();
|
||||||
connect(t, SIGNAL(started()), bt, SLOT(execEnWifi()));
|
file.close();
|
||||||
connect(bt, SIGNAL(enWifiDone()), this, SLOT(enWifiDone()));
|
|
||||||
connect(bt, SIGNAL(btFinish()), t, SLOT(quit()));
|
//当连接上无线网卡时才能打开wifi开关
|
||||||
t->start();
|
if(txt.indexOf("IEEE 802.11") != -1){
|
||||||
|
// 网络开关关闭时,点击Wifi开关无效
|
||||||
|
if(checkLanOn()){
|
||||||
|
if(checkWlOn()){
|
||||||
|
QThread *t = new QThread();
|
||||||
|
BackThread *bt = new BackThread();
|
||||||
|
bt->moveToThread(t);
|
||||||
|
connect(t, SIGNAL(finished()), t, SLOT(deleteLater()));
|
||||||
|
connect(t, SIGNAL(started()), bt, SLOT(execDisWifi()));
|
||||||
|
connect(bt, SIGNAL(disWifiDone()), this, SLOT(disWifiDone()));
|
||||||
|
connect(bt, SIGNAL(btFinish()), t, SLOT(quit()));
|
||||||
|
t->start();
|
||||||
|
|
||||||
|
}else{
|
||||||
|
QThread *t = new QThread();
|
||||||
|
BackThread *bt = new BackThread();
|
||||||
|
bt->moveToThread(t);
|
||||||
|
connect(t, SIGNAL(finished()), t, SLOT(deleteLater()));
|
||||||
|
connect(t, SIGNAL(started()), bt, SLOT(execEnWifi()));
|
||||||
|
connect(bt, SIGNAL(enWifiDone()), this, SLOT(enWifiDone()));
|
||||||
|
connect(bt, SIGNAL(btFinish()), t, SLOT(quit()));
|
||||||
|
t->start();
|
||||||
|
}
|
||||||
|
|
||||||
|
this->startLoading();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
this->startLoading();
|
QThread *t = new QThread();
|
||||||
|
BackThread *bt = new BackThread();
|
||||||
|
bt->moveToThread(t);
|
||||||
|
connect(t, SIGNAL(finished()), t, SLOT(deleteLater()));
|
||||||
|
connect(t, SIGNAL(started()), bt, SLOT(execDisWifi()));
|
||||||
|
connect(bt, SIGNAL(disWifiDone()), this, SLOT(keepDisWifiState()));
|
||||||
|
connect(bt, SIGNAL(btFinish()), t, SLOT(quit()));
|
||||||
|
t->start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -933,7 +953,7 @@ void MainWindow::on_isLanConnect()
|
||||||
IFace *iface = bt->execGetIface();
|
IFace *iface = bt->execGetIface();
|
||||||
|
|
||||||
if (iface->lstate == 1){
|
if (iface->lstate == 1){
|
||||||
qDebug()<<"注意:Lan 网络连接已经断开";
|
qDebug()<<"注意:有线网络连接已经断开";
|
||||||
if(this->is_btnNetList_clicked == 1) {
|
if(this->is_btnNetList_clicked == 1) {
|
||||||
this->ksnm->execGetLanList();
|
this->ksnm->execGetLanList();
|
||||||
}
|
}
|
||||||
|
@ -959,6 +979,10 @@ void MainWindow::on_isLanConnect()
|
||||||
count_loop = 0;
|
count_loop = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (iface->wstate == 2) {
|
||||||
|
on_btnWifi_clicked();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_isNetOn()
|
void MainWindow::on_isNetOn()
|
||||||
|
@ -1011,6 +1035,10 @@ void MainWindow::on_isNetOn()
|
||||||
count_loop = 0;
|
count_loop = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (iface->wstate == 2) {
|
||||||
|
on_btnWifi_clicked();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wifi连接结果,0点击连接成功 1失败 2没有配置文件 3开机直连成功
|
// Wifi连接结果,0点击连接成功 1失败 2没有配置文件 3开机直连成功
|
||||||
|
@ -1067,6 +1095,10 @@ void MainWindow::on_isWifiConnect()
|
||||||
count_loop = 0;
|
count_loop = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (iface->wstate == 2) {
|
||||||
|
on_btnWifi_clicked();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_btnAdvConf_clicked()
|
void MainWindow::on_btnAdvConf_clicked()
|
||||||
|
@ -1379,3 +1411,42 @@ void MainWindow::disWifiDone(){
|
||||||
|
|
||||||
this->stopLoading();
|
this->stopLoading();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::keepDisWifiState()
|
||||||
|
{
|
||||||
|
if(this->is_btnNetList_clicked == 1) {
|
||||||
|
ui->lbWifiImg->setStyleSheet("QLabel{background-image:url(:/res/x/wifi-offline.png);}");
|
||||||
|
ui->lbBtnWifiBG->setStyleSheet(btnOffQss);
|
||||||
|
ui->lbBtnWifiT1->setText(tr("Disabled"));//"已关闭"
|
||||||
|
}
|
||||||
|
if(this->is_btnWifiList_clicked== 1) {
|
||||||
|
QList<OneConnForm *> wifiList = wifiListWidget->findChildren<OneConnForm *>();
|
||||||
|
for(int i = 0; i < wifiList.size(); i ++){
|
||||||
|
OneConnForm *ocf = wifiList.at(i);
|
||||||
|
if(ocf->isActive == true){
|
||||||
|
ocf->setSelected(false);
|
||||||
|
ocf->setName(tr("Not connected"));//"当前未连接任何 Wifi"
|
||||||
|
ocf->setSafe("--");
|
||||||
|
ocf->setSignal("0");
|
||||||
|
ocf->setSafeString("--");
|
||||||
|
ocf->setConnedString(tr("Disconnected"));//"未连接"
|
||||||
|
ocf->setShowPoint(true);
|
||||||
|
disconnect(ocf, SIGNAL(selectedOneWifiForm(QString)), this, SLOT(oneWifiFormSelected(QString)));
|
||||||
|
}else{
|
||||||
|
ocf->deleteLater();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lbWifiList->move(12, 68);
|
||||||
|
|
||||||
|
ui->lbWifiImg->setStyleSheet("QLabel{background-image:url(:/res/x/wifi-offline.png);}");
|
||||||
|
ui->lbBtnWifiBG->setStyleSheet(btnOffQss);
|
||||||
|
ui->lbBtnWifiT1->setText(tr("Disabled"));//"已关闭"
|
||||||
|
|
||||||
|
this->lanListWidget->hide();
|
||||||
|
this->wifiListWidget->show();
|
||||||
|
this->scrollAreal->hide();
|
||||||
|
this->scrollAreaw->show();
|
||||||
|
|
||||||
|
this->stopLoading();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -160,6 +160,7 @@ private slots:
|
||||||
void disNetDone();
|
void disNetDone();
|
||||||
void enWifiDone();
|
void enWifiDone();
|
||||||
void disWifiDone();
|
void disWifiDone();
|
||||||
|
void keepDisWifiState();
|
||||||
void connLanDone(int connFlag);
|
void connLanDone(int connFlag);
|
||||||
void connDone(int connFlag);
|
void connDone(int connFlag);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue