create a new directory to store some source and header files
This commit is contained in:
parent
113d7657d0
commit
56addcd079
|
@ -18,7 +18,7 @@
|
|||
|
||||
#include "dlghotspotcreate.h"
|
||||
#include "ui_dlghotspotcreate.h"
|
||||
#include "utils.h"
|
||||
#include "src/utils.h"
|
||||
|
||||
DlgHotspotCreate::DlgHotspotCreate(QString wiFiCardName, QWidget *parent) :
|
||||
wirelessCardName(wiFiCardName),
|
||||
|
|
55
kylin-nm.pro
55
kylin-nm.pro
|
@ -47,16 +47,17 @@ QMAKE_LFLAGS *= $(shell dpkg-buildflags --get LDFLAGS)
|
|||
|
||||
|
||||
SOURCES += \
|
||||
main.cpp \
|
||||
mainwindow.cpp \
|
||||
ksimplenm.cpp \
|
||||
oneconnform.cpp \
|
||||
confform.cpp \
|
||||
kylin-network-interface.c \
|
||||
backthread.cpp \
|
||||
onelancform.cpp \
|
||||
loadingdiv.cpp \
|
||||
utils.cpp \
|
||||
src/backthread.cpp \
|
||||
src/confform.cpp \
|
||||
src/ksimplenm.cpp \
|
||||
src/kylin-dbus-interface.cpp \
|
||||
src/kylin-network-interface.c \
|
||||
src/loadingdiv.cpp \
|
||||
src/main.cpp \
|
||||
src/mainwindow.cpp \
|
||||
src/oneconnform.cpp \
|
||||
src/onelancform.cpp \
|
||||
src/utils.cpp \
|
||||
wireless-security/dlgconnhidwifi.cpp \
|
||||
wireless-security/dlgconnhidwifisecfast.cpp \
|
||||
wireless-security/dlgconnhidwifisectunneltls.cpp \
|
||||
|
@ -67,20 +68,21 @@ SOURCES += \
|
|||
wireless-security/dlgconnhidwifiwep.cpp \
|
||||
wireless-security/dlgconnhidwifileap.cpp \
|
||||
wireless-security/dlgconnhidwifiwpa.cpp \
|
||||
kylin-dbus-interface.cpp \
|
||||
hot-spot/dlghotspotcreate.cpp \
|
||||
wireless-security/kylinheadfile.cpp
|
||||
wireless-security/kylinheadfile.cpp \
|
||||
hot-spot/dlghotspotcreate.cpp
|
||||
|
||||
|
||||
HEADERS += \
|
||||
mainwindow.h \
|
||||
ksimplenm.h \
|
||||
oneconnform.h \
|
||||
confform.h \
|
||||
kylin-network-interface.h \
|
||||
backthread.h \
|
||||
onelancform.h \
|
||||
loadingdiv.h \
|
||||
utils.h \
|
||||
src/backthread.h \
|
||||
src/confform.h \
|
||||
src/ksimplenm.h \
|
||||
src/kylin-dbus-interface.h \
|
||||
src/kylin-network-interface.h \
|
||||
src/loadingdiv.h \
|
||||
src/mainwindow.h \
|
||||
src/oneconnform.h \
|
||||
src/onelancform.h \
|
||||
src/utils.h \
|
||||
wireless-security/dlgconnhidwifi.h \
|
||||
wireless-security/dlgconnhidwifisecfast.h \
|
||||
wireless-security/dlgconnhidwifisectunneltls.h \
|
||||
|
@ -92,14 +94,13 @@ HEADERS += \
|
|||
wireless-security/dlgconnhidwifileap.h \
|
||||
wireless-security/dlgconnhidwifiwpa.h \
|
||||
wireless-security/kylinheadfile.h \
|
||||
kylin-dbus-interface.h \
|
||||
hot-spot/dlghotspotcreate.h
|
||||
|
||||
FORMS += \
|
||||
mainwindow.ui \
|
||||
oneconnform.ui \
|
||||
confform.ui \
|
||||
onelancform.ui \
|
||||
src/confform.ui \
|
||||
src/mainwindow.ui \
|
||||
src/oneconnform.ui \
|
||||
src/onelancform.ui \
|
||||
wireless-security/dlgconnhidwifi.ui \
|
||||
wireless-security/dlgconnhidwifisecfast.ui \
|
||||
wireless-security/dlgconnhidwifisectunneltls.ui \
|
||||
|
|
|
@ -1,71 +0,0 @@
|
|||
#include "networkspeed.h"
|
||||
|
||||
//NetworkSpeed::NetworkSpeed(QObject *parent) :QObject(parent)
|
||||
//{
|
||||
// qDebug()<<"debug: this is creator function of class NetworkSpeed";
|
||||
//}
|
||||
|
||||
int NetworkSpeed::getCurrentDownloadRates(char *netname, long *save_rate, long *tx_rate)
|
||||
{
|
||||
FILE * net_dev_file; //文件指针
|
||||
char buffer[1024]; //文件中的内容暂存在字符缓冲区里
|
||||
size_t bytes_read; //实际读取的内容大小
|
||||
char * match; //用以保存所匹配字符串及之后的内容
|
||||
int counter = 0;
|
||||
int i = 0;
|
||||
char tmp_value[128];
|
||||
|
||||
if((NULL == netname)||(NULL == save_rate)||(NULL == tx_rate))
|
||||
{
|
||||
printf("bad param\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ( (net_dev_file=fopen("/proc/net/dev", "r")) == NULL ) //打开文件/pro/net/dev/,我们要读取的数据就是它啦
|
||||
{
|
||||
printf("open file /proc/net/dev/ error!\n");
|
||||
return -1;
|
||||
}
|
||||
memset(buffer,0,sizeof(buffer));
|
||||
|
||||
while(fgets(buffer,sizeof(buffer),net_dev_file) != NULL)
|
||||
{
|
||||
match = strstr(buffer,netname);
|
||||
|
||||
if(NULL == match)
|
||||
{
|
||||
//printf("no eth0 keyword to find!\n");
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
//printf("%s\n",buffer);
|
||||
match = match + strlen(netname) + strlen(":");/*地址偏移到冒号*/
|
||||
sscanf(match,"%ld ",save_rate);
|
||||
memset(tmp_value,0,sizeof(tmp_value));
|
||||
sscanf(match,"%s ",tmp_value);
|
||||
match = match + strlen(tmp_value);
|
||||
for(i=0;i<strlen(buffer);i++)
|
||||
{
|
||||
if(0x20 == *match)
|
||||
{
|
||||
match ++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(8 == counter)
|
||||
{
|
||||
sscanf(match,"%ld ",tx_rate);
|
||||
}
|
||||
memset(tmp_value,0,sizeof(tmp_value));
|
||||
sscanf(match,"%s ",tmp_value);
|
||||
match = match + strlen(tmp_value);
|
||||
counter ++;
|
||||
}
|
||||
}
|
||||
//printf("%s save_rate:%ld tx_rate:%ld\n",netname,*save_rate,*tx_rate);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;/*返回成功*/
|
||||
}
|
|
@ -20,8 +20,8 @@
|
|||
#include "dlgconnhidwifi.h"
|
||||
#include "kylinheadfile.h"
|
||||
#include "ui_dlgconnhidwifi.h"
|
||||
#include "backthread.h"
|
||||
#include "mainwindow.h"
|
||||
#include "src/backthread.h"
|
||||
#include "src/mainwindow.h"
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
#include "dlgconnhidwifiwpa.h"
|
||||
#include "ui_dlgconnhidwifiwpa.h"
|
||||
#include "kylinheadfile.h"
|
||||
#include "backthread.h"
|
||||
#include "mainwindow.h"
|
||||
#include "src/backthread.h"
|
||||
#include "src/mainwindow.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
|
|
Loading…
Reference in New Issue