diff options
author | Slávek Banko <[email protected]> | 2013-07-27 16:57:53 +0200 |
---|---|---|
committer | Slávek Banko <[email protected]> | 2013-07-27 18:48:46 +0200 |
commit | 7c2bc4b5ce4fc1a72868aa949e9ec49fbe2e7931 (patch) | |
tree | 4655c7263ca5c64d23d10167cb459dd9cb253815 /src/functions.cpp | |
parent | 88ea2b6cd4382627fb6efca9cc54825aee881d1e (diff) | |
download | tork-7c2bc4b5ce4fc1a72868aa949e9ec49fbe2e7931.tar.gz tork-7c2bc4b5ce4fc1a72868aa949e9ec49fbe2e7931.zip |
Initial TQt conversion
Diffstat (limited to 'src/functions.cpp')
-rw-r--r-- | src/functions.cpp | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/src/functions.cpp b/src/functions.cpp index 828222e..694f905 100644 --- a/src/functions.cpp +++ b/src/functions.cpp @@ -20,12 +20,12 @@ * Free Software Foundation, Inc., * * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#include <qdatetime.h> +#include <ntqdatetime.h> #include <klocale.h> #include <kglobal.h> #include <kdebug.h> #include <sys/time.h> -#include <qdir.h> +#include <ntqdir.h> #include <cstdlib> #include "functions.h" @@ -37,7 +37,7 @@ namespace tk const double TO_MEG = (1024.0 * 1024.0); const double TO_GIG = (1024.0 * 1024.0 * 1024.0); - QString BytesToString(Uint64 bytes,int precision) + TQString BytesToString(Uint64 bytes,int precision) { KLocale* loc = KGlobal::locale(); if (bytes >= 1024 * 1024 * 1024) @@ -50,7 +50,7 @@ namespace tk return i18n("%1 B").arg(bytes); } - QString BytesPerSecToString(double bytes,int precision) + TQString BytesPerSecToString(double bytes,int precision) { KLocale* loc = KGlobal::locale(); if (bytes >= 1024 * 1024 * 1024) @@ -63,32 +63,32 @@ namespace tk return i18n("%1 B/s").arg(loc->formatNumber(bytes,precision < 0 ? 1 : precision)); } - QString KBytesPerSecToString(double speed,int precision) + TQString KBytesPerSecToString(double speed,int precision) { KLocale* loc = KGlobal::locale(); return i18n("%1 KB/s").arg(loc->formatNumber(speed,precision)); } - QString DurationToString(Uint32 nsecs) + TQString DurationToString(Uint32 nsecs) { KLocale* loc = KGlobal::locale(); - QTime t; + TQTime t; int ndays = nsecs / 86400; t = t.addSecs(nsecs % 86400); - QString s = loc->formatTime(t,true,true); + TQString s = loc->formatTime(t,true,true); if (ndays > 0) s = i18n("1 day ","%n days ",ndays) + s; return s; } - QString calcBW(const QStringList &bwlist, int num) + TQString calcBW(const TQStringList &bwlist, int num) { double totalbw = 0; int numtmp=0; - for ( QStringList::ConstIterator it = bwlist.end(); it != bwlist.begin(); --it ) + for ( TQStringList::ConstIterator it = bwlist.end(); it != bwlist.begin(); --it ) { totalbw += (*it).toDouble(); numtmp++; @@ -122,53 +122,53 @@ namespace bt } -QString getFullLocation(const char *additionalPaths, const QString &name) +TQString getFullLocation(const char *additionalPaths, const TQString &name) { // do not search one path twice - QStringList paths; + TQStringList paths; // get the environment path variable paths = addPaths(getenv("PATH")); paths += addPaths(additionalPaths); - QStringList::ConstIterator dirpath = paths.begin(); - QStringList::ConstIterator end = paths.end(); + TQStringList::ConstIterator dirpath = paths.begin(); + TQStringList::ConstIterator end = paths.end(); for(; dirpath!=end; ++dirpath) { - QDir dir = *dirpath; + TQDir dir = *dirpath; if (!dir.exists()) continue; - QFile inf(*dirpath+'/'+name); + TQFile inf(*dirpath+'/'+name); if (inf.exists()) return *dirpath+'/'+name; } - return QString(); + return TQString(); } -QStringList findPrograms(const QStringList &programList) +TQStringList findPrograms(const TQStringList &programList) { // do not search one path twice - QStringList paths; + TQStringList paths; // get the environment path variable paths = addPaths(getenv("PATH")); - QStringList tofind; - QStringList remaining; - QStringList finds; - QStringList::ConstIterator dirpath = paths.begin(); - QStringList::ConstIterator end = paths.end(); + TQStringList tofind; + TQStringList remaining; + TQStringList finds; + TQStringList::ConstIterator dirpath = paths.begin(); + TQStringList::ConstIterator end = paths.end(); tofind = programList; remaining = tofind; for(; dirpath!=end; ++dirpath) { - QDir dir = *dirpath; + TQDir dir = *dirpath; if (!dir.exists()) continue; - for ( QStringList::Iterator it = tofind.begin(); it != tofind.end(); ++it ){ - QFile inf(*dirpath+'/'+*it); + for ( TQStringList::Iterator it = tofind.begin(); it != tofind.end(); ++it ){ + TQFile inf(*dirpath+'/'+*it); if (inf.exists()){ finds.append(*it); remaining.remove(*it); @@ -181,16 +181,16 @@ QStringList findPrograms(const QStringList &programList) } -QStringList addPaths(const char *env_path){ +TQStringList addPaths(const char *env_path){ // do not search one path twice - QStringList paths; + TQStringList paths; /* // get the environment path variable char* env_path = getenv("PATH");*/ if( env_path ) { - QStringList env_pathList = QStringList::split(":", QString::fromLocal8Bit(env_path)); - for( QStringList::const_iterator it = env_pathList.begin(); it != env_pathList.end(); ++it ) { - QString p = *it; + TQStringList env_pathList = TQStringList::split(":", TQString::fromLocal8Bit(env_path)); + for( TQStringList::const_iterator it = env_pathList.begin(); it != env_pathList.end(); ++it ) { + TQString p = *it; if( p[p.length()-1] == '/' ) p.truncate( p.length()-1 ); if( !paths.contains( p ) && !paths.contains( p + "/" ) ) |