From 70b9eea2ba01c3691497f49e4c45cb070c16193c Mon Sep 17 00:00:00 2001 From: tpearson Date: Fri, 1 Jul 2011 03:43:07 +0000 Subject: TQt4 port kradio This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kradio@1238952 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kradio3/convert-presets/convert-presets.cpp | 60 ++++++++++++++--------------- 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'kradio3/convert-presets/convert-presets.cpp') diff --git a/kradio3/convert-presets/convert-presets.cpp b/kradio3/convert-presets/convert-presets.cpp index 3ba733c..93e99ea 100644 --- a/kradio3/convert-presets/convert-presets.cpp +++ b/kradio3/convert-presets/convert-presets.cpp @@ -3,33 +3,33 @@ #endif #include -#include -#include -#include +#include +#include +#include #include #include #include #include -#include +#include #include #include #include #define dev_urandom "/dev/urandom" -QString createStationID() +TQString createStationID() { const int buffersize = 32; unsigned char buffer[buffersize]; - QString stime, srandom = ""; + TQString stime, srandom = ""; stime.setNum(time(NULL)); int fd = open (dev_urandom, O_RDONLY); read(fd, buffer, buffersize); close(fd); for (int i = 0; i < buffersize; ++i) - srandom += QString().sprintf("%02X", (unsigned int)buffer[i]); + srandom += TQString().sprintf("%02X", (unsigned int)buffer[i]); // kdDebug() << i18n("generated StationID: ") << stime << srandom << endl; @@ -39,13 +39,13 @@ QString createStationID() -bool convertFile(const QString &file) +bool convertFile(const TQString &file) { //////////////////////////////////////////////////////////////////////// // read input //////////////////////////////////////////////////////////////////////// - QFile presetFile (file); + TQFile presetFile (file); if (! presetFile.open(IO_ReadOnly)) { kdDebug() << "convertFile: " @@ -55,27 +55,27 @@ bool convertFile(const QString &file) return false; } - QString xmlData; + TQString xmlData; // make sure that qtextstream is gone when we close presetFile { - QTextStream ins(&presetFile); - ins.setEncoding(QTextStream::Locale); + TQTextStream ins(&presetFile); + ins.setEncoding(TQTextStream::Locale); xmlData = ins.read(); } - if (xmlData.find("", 0, false) >= 0) { + if (xmlData.tqfind("", 0, false) >= 0) { kdDebug() << "file " << file << " already in new format" << endl; // but add \n" + xmlData; } @@ -85,11 +85,11 @@ bool convertFile(const QString &file) // convert file //////////////////////////////////////////////////////////////////////// - QRegExp qselect(".*"); - QRegExp docking(".*"); - QRegExp station("(.*)"); - QRegExp stationlist(""); - QRegExp emptyLines("\\n\\s*\\n"); + TQRegExp qselect(".*"); + TQRegExp docking(".*"); + TQRegExp station("(.*)"); + TQRegExp stationlist(""); + TQRegExp emptyLines("\\n\\s*\\n"); #define stationIDElement "stationID" @@ -98,21 +98,21 @@ bool convertFile(const QString &file) station.setMinimal(true); xmlData = "\n" + xmlData; - xmlData.replace(stationlist, "\n\t\tkradio-1.0"); - xmlData.replace(qselect, ""); - xmlData.replace(docking, ""); - xmlData.replace(station, "\n" + xmlData.tqreplace(stationlist, "\n\t\tkradio-1.0"); + xmlData.tqreplace(qselect, ""); + xmlData.tqreplace(docking, ""); + xmlData.tqreplace(station, "\n" "\t\t\t<" stationIDElement ">" "\\1" ); int p = 0; int f = 0; - while ( (f = xmlData.find("<" stationIDElement ">", p) ) >= 0) { - xmlData.insert(f + 2 + QString(stationIDElement).length(), createStationID()); + while ( (f = xmlData.tqfind("<" stationIDElement ">", p) ) >= 0) { + xmlData.insert(f + 2 + TQString(stationIDElement).length(), createStationID()); } - xmlData.replace(emptyLines, "\n"); + xmlData.tqreplace(emptyLines, "\n"); } presetFile.close(); @@ -130,8 +130,8 @@ bool convertFile(const QString &file) return false; } - QTextStream outs(&presetFile); - outs.setEncoding(QTextStream::UnicodeUTF8); + TQTextStream outs(&presetFile); + outs.setEncoding(TQTextStream::UnicodeUTF8); outs << xmlData; -- cgit v1.2.1