summaryrefslogtreecommitdiffstats
path: root/kradio3/convert-presets
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-01 03:43:07 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-01 03:43:07 +0000
commit70b9eea2ba01c3691497f49e4c45cb070c16193c (patch)
tree9a6df61aa247a27275aad9c5245e419e89c2c640 /kradio3/convert-presets
parent998c1384ace4ae4655997c181fa33242148cd0a4 (diff)
downloadtderadio-70b9eea2ba01c3691497f49e4c45cb070c16193c.tar.gz
tderadio-70b9eea2ba01c3691497f49e4c45cb070c16193c.zip
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
Diffstat (limited to 'kradio3/convert-presets')
-rw-r--r--kradio3/convert-presets/convert-presets.cpp60
1 files changed, 30 insertions, 30 deletions
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 <kapplication.h>
-#include <qstring.h>
-#include <qtextstream.h>
-#include <qfile.h>
+#include <tqstring.h>
+#include <tqtextstream.h>
+#include <tqfile.h>
#include <klocale.h>
#include <kdebug.h>
#include <kaboutdata.h>
#include <kcmdlineargs.h>
-#include <qregexp.h>
+#include <tqregexp.h>
#include <time.h>
#include <sys/fcntl.h>
#include <unistd.h>
#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("<format>", 0, false) >= 0) {
+ if (xmlData.tqfind("<format>", 0, false) >= 0) {
kdDebug() << "file " << file << " already in new format" << endl;
// but add <?xml line at beginning if missing
{
presetFile.reset();
- QTextStream ins(&presetFile);
- ins.setEncoding(QTextStream::UnicodeUTF8);
+ TQTextStream ins(&presetFile);
+ ins.setEncoding(TQTextStream::UnicodeUTF8);
xmlData = ins.read();
}
- if (xmlData.find("<?xml", 0, false) < 0) {
+ if (xmlData.tqfind("<?xml", 0, false) < 0) {
xmlData = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + xmlData;
}
@@ -85,11 +85,11 @@ bool convertFile(const QString &file)
// convert file
////////////////////////////////////////////////////////////////////////
- QRegExp qselect("<quickselect>.*</quickselect>");
- QRegExp docking("<dockingmenu>.*</dockingmenu>");
- QRegExp station("<station>(.*)</station>");
- QRegExp stationlist("<stationlist>");
- QRegExp emptyLines("\\n\\s*\\n");
+ TQRegExp qselect("<quickselect>.*</quickselect>");
+ TQRegExp docking("<dockingmenu>.*</dockingmenu>");
+ TQRegExp station("<station>(.*)</station>");
+ TQRegExp stationlist("<stationlist>");
+ TQRegExp emptyLines("\\n\\s*\\n");
#define stationIDElement "stationID"
@@ -98,21 +98,21 @@ bool convertFile(const QString &file)
station.setMinimal(true);
xmlData = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + xmlData;
- xmlData.replace(stationlist, "<stationlist>\n\t\t<format>kradio-1.0</format>");
- xmlData.replace(qselect, "");
- xmlData.replace(docking, "");
- xmlData.replace(station, "<FrequencyRadioStation>\n"
+ xmlData.tqreplace(stationlist, "<stationlist>\n\t\t<format>kradio-1.0</format>");
+ xmlData.tqreplace(qselect, "");
+ xmlData.tqreplace(docking, "");
+ xmlData.tqreplace(station, "<FrequencyRadioStation>\n"
"\t\t\t<" stationIDElement "></" stationIDElement ">"
"\\1</FrequencyRadioStation>"
);
int p = 0;
int f = 0;
- while ( (f = xmlData.find("<" stationIDElement "></" stationIDElement ">", p) ) >= 0) {
- xmlData.insert(f + 2 + QString(stationIDElement).length(), createStationID());
+ while ( (f = xmlData.tqfind("<" stationIDElement "></" 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;