summaryrefslogtreecommitdiffstats
path: root/src/knemod/interfacestatistics.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-30 18:16:06 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-30 18:16:06 +0000
commit02a6c8f36311eb6225066df35adf8d00f9cd942b (patch)
treeceb91c373877f7a69209e184c81b53dc6f9402d7 /src/knemod/interfacestatistics.cpp
parent09e6e27fe85b2efb28072f1c81f6581fa6837d92 (diff)
downloadknemo-02a6c8f36311eb6225066df35adf8d00f9cd942b.tar.gz
knemo-02a6c8f36311eb6225066df35adf8d00f9cd942b.zip
TQt4 port knemo
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/knemo@1238869 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/knemod/interfacestatistics.cpp')
-rw-r--r--src/knemod/interfacestatistics.cpp108
1 files changed, 54 insertions, 54 deletions
diff --git a/src/knemod/interfacestatistics.cpp b/src/knemod/interfacestatistics.cpp
index a73d04b..c013603 100644
--- a/src/knemod/interfacestatistics.cpp
+++ b/src/knemod/interfacestatistics.cpp
@@ -17,11 +17,11 @@
Boston, MA 02110-1301, USA.
*/
-#include <qdom.h>
-#include <qfile.h>
-#include <qtimer.h>
-#include <qstring.h>
-#include <qdatetime.h>
+#include <tqdom.h>
+#include <tqfile.h>
+#include <tqtimer.h>
+#include <tqstring.h>
+#include <tqdatetime.h>
#include <kdebug.h>
@@ -29,7 +29,7 @@
#include "interfacestatistics.h"
InterfaceStatistics::InterfaceStatistics( Interface* interface )
- : QObject(),
+ : TQObject(),
mInterface( interface )
{
mDayStatistics.setAutoDelete( true );
@@ -37,8 +37,8 @@ InterfaceStatistics::InterfaceStatistics( Interface* interface )
mYearStatistics.setAutoDelete( true );
initStatistics();
- mSaveTimer = new QTimer();
- connect( mSaveTimer, SIGNAL( timeout() ), this, SLOT( saveStatistics() ) );
+ mSaveTimer = new TQTimer();
+ connect( mSaveTimer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( saveStatistics() ) );
mSaveTimer->start( mInterface->getGeneralData().saveInterval * 1000 );
}
@@ -54,9 +54,9 @@ InterfaceStatistics::~InterfaceStatistics()
void InterfaceStatistics::loadStatistics()
{
- QDomDocument doc( "statistics" );
- QString dir = mInterface->getGeneralData().statisticsDir;
- QFile file( dir + "/statistics_" + mInterface->getName() );
+ TQDomDocument doc( "statistics" );
+ TQString dir = mInterface->getGeneralData().statisticsDir;
+ TQFile file( dir + "/statistics_" + mInterface->getName() );
if ( !file.open( IO_ReadOnly ) )
return;
@@ -71,22 +71,22 @@ void InterfaceStatistics::loadStatistics()
mMonthStatistics.clear();
mYearStatistics.clear();
- QDomElement root = doc.documentElement();
- QDomNode n = root.namedItem( "days" );
+ TQDomElement root = doc.documentElement();
+ TQDomNode n = root.namedItem( "days" );
if ( !n.isNull() )
{
- QDomNode dayNode = n.firstChild();
+ TQDomNode dayNode = n.firstChild();
while ( !dayNode.isNull() )
{
- QDomElement day = dayNode.toElement();
+ TQDomElement day = dayNode.toElement();
if ( !day.isNull() )
{
StatisticEntry* entry = new StatisticEntry();
entry->day = day.attribute( "day" ).toInt();
entry->month = day.attribute( "month" ).toInt();
entry->year = day.attribute( "year" ).toInt();
- entry->rxBytes = (Q_UINT64) day.attribute( "rxBytes" ).toDouble();
- entry->txBytes = (Q_UINT64) day.attribute( "txBytes" ).toDouble();
+ entry->rxBytes = (TQ_UINT64) day.attribute( "rxBytes" ).toDouble();
+ entry->txBytes = (TQ_UINT64) day.attribute( "txBytes" ).toDouble();
mDayStatistics.append( entry );
}
dayNode = dayNode.nextSibling();
@@ -97,18 +97,18 @@ void InterfaceStatistics::loadStatistics()
n = root.namedItem( "months" );
if ( !n.isNull() )
{
- QDomNode monthNode = n.firstChild();
+ TQDomNode monthNode = n.firstChild();
while ( !monthNode.isNull() )
{
- QDomElement month = monthNode.toElement();
+ TQDomElement month = monthNode.toElement();
if ( !month.isNull() )
{
StatisticEntry* entry = new StatisticEntry();
entry->day = 0;
entry->month = month.attribute( "month" ).toInt();
entry->year = month.attribute( "year" ).toInt();
- entry->rxBytes = (Q_UINT64) month.attribute( "rxBytes" ).toDouble();
- entry->txBytes = (Q_UINT64) month.attribute( "txBytes" ).toDouble();
+ entry->rxBytes = (TQ_UINT64) month.attribute( "rxBytes" ).toDouble();
+ entry->txBytes = (TQ_UINT64) month.attribute( "txBytes" ).toDouble();
mMonthStatistics.append( entry );
}
monthNode = monthNode.nextSibling();
@@ -119,18 +119,18 @@ void InterfaceStatistics::loadStatistics()
n = root.namedItem( "years" );
if ( !n.isNull() )
{
- QDomNode yearNode = n.firstChild();
+ TQDomNode yearNode = n.firstChild();
while ( !yearNode.isNull() )
{
- QDomElement year = yearNode.toElement();
+ TQDomElement year = yearNode.toElement();
if ( !year.isNull() )
{
StatisticEntry* entry = new StatisticEntry();
entry->day = 0;
entry->month = 0;
entry->year = year.attribute( "year" ).toInt();
- entry->rxBytes = (Q_UINT64) year.attribute( "rxBytes" ).toDouble();
- entry->txBytes = (Q_UINT64) year.attribute( "txBytes" ).toDouble();
+ entry->rxBytes = (TQ_UINT64) year.attribute( "rxBytes" ).toDouble();
+ entry->txBytes = (TQ_UINT64) year.attribute( "txBytes" ).toDouble();
mYearStatistics.append( entry );
}
yearNode = yearNode.nextSibling();
@@ -142,15 +142,15 @@ void InterfaceStatistics::loadStatistics()
void InterfaceStatistics::saveStatistics()
{
- QDomDocument doc( "statistics" );
- QDomElement root = doc.createElement( "statistics" );
+ TQDomDocument doc( "statistics" );
+ TQDomElement root = doc.createElement( "statistics" );
doc.appendChild( root );
- QDomElement days = doc.createElement( "days" );
+ TQDomElement days = doc.createElement( "days" );
StatisticEntry* iterator = mDayStatistics.first();
while ( iterator )
{
- QDomElement day = doc.createElement( "day" );
+ TQDomElement day = doc.createElement( "day" );
day.setAttribute( "day", iterator->day );
day.setAttribute( "month", iterator->month );
day.setAttribute( "year", iterator->year );
@@ -161,11 +161,11 @@ void InterfaceStatistics::saveStatistics()
}
root.appendChild( days );
- QDomElement months = doc.createElement( "months" );
+ TQDomElement months = doc.createElement( "months" );
iterator = mMonthStatistics.first();
while ( iterator )
{
- QDomElement month = doc.createElement( "month" );
+ TQDomElement month = doc.createElement( "month" );
month.setAttribute( "month", iterator->month );
month.setAttribute( "year", iterator->year );
month.setAttribute( "rxBytes", (double) iterator->rxBytes );
@@ -175,11 +175,11 @@ void InterfaceStatistics::saveStatistics()
}
root.appendChild( months );
- QDomElement years = doc.createElement( "years" );
+ TQDomElement years = doc.createElement( "years" );
iterator = mYearStatistics.first();
while ( iterator )
{
- QDomElement year = doc.createElement( "year" );
+ TQDomElement year = doc.createElement( "year" );
year.setAttribute( "year", iterator->year );
year.setAttribute( "rxBytes", (double) iterator->rxBytes );
year.setAttribute( "txBytes", (double) iterator->txBytes );
@@ -188,12 +188,12 @@ void InterfaceStatistics::saveStatistics()
}
root.appendChild( years );
- QString dir = mInterface->getGeneralData().statisticsDir;
- QFile file( dir + "/statistics_" + mInterface->getName() );
+ TQString dir = mInterface->getGeneralData().statisticsDir;
+ TQFile file( dir + "/statistics_" + mInterface->getName() );
if ( !file.open( IO_WriteOnly ) )
return;
- QTextStream stream( &file );
+ TQTextStream stream( &file );
stream << doc.toString();
file.close();
}
@@ -276,21 +276,21 @@ void InterfaceStatistics::clearYearStatistics()
void InterfaceStatistics::checkCurrentEntry()
{
- if ( mCurrentDay->day != QDate::currentDate().day() ||
- mCurrentDay->month != QDate::currentDate().month() ||
- mCurrentDay->year != QDate::currentDate().year() )
+ if ( mCurrentDay->day != TQDate::tqcurrentDate().day() ||
+ mCurrentDay->month != TQDate::tqcurrentDate().month() ||
+ mCurrentDay->year != TQDate::tqcurrentDate().year() )
{
// current day has changed
updateCurrentDay();
- if ( mCurrentMonth->month != QDate::currentDate().month() ||
- mCurrentMonth->year != QDate::currentDate().year() )
+ if ( mCurrentMonth->month != TQDate::tqcurrentDate().month() ||
+ mCurrentMonth->year != TQDate::tqcurrentDate().year() )
{
// current month has also changed
updateCurrentMonth();
}
- if ( mCurrentYear->year != QDate::currentDate().year() )
+ if ( mCurrentYear->year != TQDate::tqcurrentDate().year() )
{
// current year has also changed
updateCurrentYear();
@@ -312,9 +312,9 @@ void InterfaceStatistics::updateCurrentDay()
mCurrentDay = mDayStatistics.first();
while ( mCurrentDay )
{
- if ( mCurrentDay->day == QDate::currentDate().day() &&
- mCurrentDay->month == QDate::currentDate().month() &&
- mCurrentDay->year == QDate::currentDate().year() )
+ if ( mCurrentDay->day == TQDate::tqcurrentDate().day() &&
+ mCurrentDay->month == TQDate::tqcurrentDate().month() &&
+ mCurrentDay->year == TQDate::tqcurrentDate().year() )
{
// found current day in list
return;
@@ -324,9 +324,9 @@ void InterfaceStatistics::updateCurrentDay()
// the current day is not in the list
mCurrentDay = new StatisticEntry();
- mCurrentDay->day = QDate::currentDate().day();
- mCurrentDay->month = QDate::currentDate().month();
- mCurrentDay->year = QDate::currentDate().year();
+ mCurrentDay->day = TQDate::tqcurrentDate().day();
+ mCurrentDay->month = TQDate::tqcurrentDate().month();
+ mCurrentDay->year = TQDate::tqcurrentDate().year();
mCurrentDay->rxBytes = 0;
mCurrentDay->txBytes = 0;
mDayStatistics.append( mCurrentDay ); // TODO: insert at correct position
@@ -338,8 +338,8 @@ void InterfaceStatistics::updateCurrentMonth()
mCurrentMonth = mMonthStatistics.first();
while ( mCurrentMonth )
{
- if ( mCurrentMonth->month == QDate::currentDate().month() &&
- mCurrentMonth->year == QDate::currentDate().year() )
+ if ( mCurrentMonth->month == TQDate::tqcurrentDate().month() &&
+ mCurrentMonth->year == TQDate::tqcurrentDate().year() )
{
// found current month in list
return;
@@ -350,8 +350,8 @@ void InterfaceStatistics::updateCurrentMonth()
// the current month is not in the list
mCurrentMonth = new StatisticEntry();
mCurrentMonth->day = 0;
- mCurrentMonth->month = QDate::currentDate().month();
- mCurrentMonth->year = QDate::currentDate().year();
+ mCurrentMonth->month = TQDate::tqcurrentDate().month();
+ mCurrentMonth->year = TQDate::tqcurrentDate().year();
mCurrentMonth->rxBytes = 0;
mCurrentMonth->txBytes = 0;
mMonthStatistics.append( mCurrentMonth ); // TODO: insert at correct position
@@ -363,7 +363,7 @@ void InterfaceStatistics::updateCurrentYear()
mCurrentYear = mYearStatistics.first();
while ( mCurrentYear )
{
- if ( mCurrentYear->year == QDate::currentDate().year() )
+ if ( mCurrentYear->year == TQDate::tqcurrentDate().year() )
{
// found current year in list
return;
@@ -375,7 +375,7 @@ void InterfaceStatistics::updateCurrentYear()
mCurrentYear = new StatisticEntry();
mCurrentYear->day = 0;
mCurrentYear->month = 0;
- mCurrentYear->year = QDate::currentDate().year();
+ mCurrentYear->year = TQDate::tqcurrentDate().year();
mCurrentYear->rxBytes = 0;
mCurrentYear->txBytes = 0;
mYearStatistics.append( mCurrentYear ); // TODO: insert at correct position