[PC-BSD Commits] r2070 - pcbsd/trunk/ethernetconfig

svn at pcbsd.org svn at pcbsd.org
Mon Jun 9 10:57:17 PDT 2008


Author: tim
Date: 2008-06-09 10:57:17 -0700 (Mon, 09 Jun 2008)
New Revision: 2070

Modified:
   pcbsd/trunk/ethernetconfig/ethernetconfigwidget.cpp
Log:
Refactoring for libpcbsd

Modified: pcbsd/trunk/ethernetconfig/ethernetconfigwidget.cpp
===================================================================
--- pcbsd/trunk/ethernetconfig/ethernetconfigwidget.cpp	2008-06-09 17:56:52 UTC (rev 2069)
+++ pcbsd/trunk/ethernetconfig/ethernetconfigwidget.cpp	2008-06-09 17:57:17 UTC (rev 2070)
@@ -494,59 +494,26 @@
 
 QString ethernetconfigWidget::getInPacketsForIdent(QString ident)
 {
-        QString command = "netstat -n -I " +ident + " | grep \"Link\"";
-	QString inputLine = getLineFromCommandOutput(command);
-	QString packets = "";
-	
-	if (inputLine != "" && inputLine.find("Link") != -1){
-		inputLine = inputLine.simplifyWhiteSpace();
-		packets = inputLine.section(' ', 4, 4 );
-	}
-	
-	return packets;
-
+   NetworkInterface ifr(ident);
+   return QString::number(ifr.packetsRx());
 }
 
 QString ethernetconfigWidget::getInErrorsForIdent(QString ident)
 {
-        QString command = "netstat -n -I " +ident + " | grep \"Link\"";
-	QString inputLine = getLineFromCommandOutput(command);
-	QString packets = "";
-	
-	if (inputLine != "" && inputLine.find("Link") != -1){
-		inputLine = inputLine.simplifyWhiteSpace();
-		packets = inputLine.section(' ', 5, 5 );
-	}
-	
-	return packets;
+   NetworkInterface ifr(ident);
+   return QString::number(ifr.errorsRx());
 }
 
 QString ethernetconfigWidget::getOutPacketsForIdent(QString ident)
 {
-        QString command = "netstat -n -I " +ident + " | grep \"Link\"";
-	QString inputLine = getLineFromCommandOutput(command);
-	QString packets = "";
-	
-	if (inputLine != "" && inputLine.find("Link") != -1){
-		inputLine = inputLine.simplifyWhiteSpace();
-		packets = inputLine.section(' ', 6, 6 );
-	}
-	
-	return packets;
+   NetworkInterface ifr(ident);
+   return QString::number(ifr.packetsTx());
 }
 
 QString ethernetconfigWidget::getOutErrorsForIdent(QString ident)
 {
-        QString command = "netstat -n -I " +ident + " | grep \"Link\"";
-	QString inputLine = getLineFromCommandOutput(command);
-	QString packets = "";
-	
-	if (inputLine != "" && inputLine.find("Link") != -1){
-		inputLine = inputLine.simplifyWhiteSpace();
-		packets = inputLine.section(' ', 7, 7 );
-	}
-	
-	return packets;
+   NetworkInterface ifr(ident);
+   return QString::number(ifr.errorsTx());
 }
 
 QString ethernetconfigWidget::getNetmaskForIdent( QString ident )



More information about the Commits mailing list