Index: programs/mythfilldatabase/filldata.cpp =================================================================== --- programs/mythfilldatabase/filldata.cpp (revision 18833) +++ programs/mythfilldatabase/filldata.cpp (working copy) @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include // libmyth headers @@ -191,11 +191,8 @@ } else { - QDateTime fromdatetime = QDateTime(pdate); - QDateTime todatetime; - fromdatetime.setTime_t(QDateTime(pdate).toTime_t(),Qt::UTC); - fromdatetime = fromdatetime.addDays(poffset); - todatetime = fromdatetime.addDays(1); + QDateTime fromdatetime = QDateTime(pdate).toUTC().addDays(poffset); + QDateTime todatetime = fromdatetime.addDays(1); VERBOSE(VB_GENERAL, QString("Grabbing data for %1 offset %2") .arg(pdate.toString()) @@ -597,30 +594,28 @@ if (is_grabber_external(xmltv_grabber)) { - Q3Process grabber_capabilities_proc(xmltv_grabber); - grabber_capabilities_proc.addArgument(QString("--capabilities")); - if ( grabber_capabilities_proc.start() ) + QProcess grabber_capabilities_proc; + grabber_capabilities_proc.setProcessChannelMode( + QProcess::SeparateChannels); + grabber_capabilities_proc.start( + xmltv_grabber, + QStringList("--capabilities")); + + if (grabber_capabilities_proc.waitForStarted(1000)) { + bool ok = grabber_capabilities_proc.waitForFinished(15*1000); - int i=0; - // Assume it shouldn't take more than 10 seconds - // Broken versions of QT cause QProcess::start - // and QProcess::isRunning to return true even - // when the executable doesn't exist - while (grabber_capabilities_proc.isRunning() && i < 100) + if (ok && + QProcess::NormalExit == + grabber_capabilities_proc.exitStatus()) { - usleep(100000); - ++i; - } - - if (grabber_capabilities_proc.normalExit()) - { QString capabilites = ""; - - while (grabber_capabilities_proc.canReadLineStdout()) + grabber_capabilities_proc + .setReadChannel(QProcess::StandardOutput); + while (grabber_capabilities_proc.canReadLine()) { QString capability - = grabber_capabilities_proc.readLineStdout(); + = grabber_capabilities_proc.readLine(); capabilites += capability + " "; if (capability == "baseline") @@ -648,7 +643,9 @@ } else { - QString error = grabber_capabilities_proc.readLineStdout(); + grabber_capabilities_proc + .setReadChannel(QProcess::StandardOutput); + QString error = grabber_capabilities_proc.readLine(); VERBOSE(VB_IMPORTANT, QString("Failed to run %1 " "--capabilities").arg(xmltv_grabber)); } @@ -657,25 +654,24 @@ if (hasprefmethod) { - Q3Process grabber_method_proc(xmltv_grabber); - grabber_method_proc.addArgument("--preferredmethod"); - if ( grabber_method_proc.start() ) + QProcess grabber_method_proc; + grabber_method_proc.setProcessChannelMode( + QProcess::SeparateChannels); + grabber_method_proc.start( + xmltv_grabber, + QStringList("--preferredmethod")); + + if (grabber_method_proc.waitForStarted(1000)) { - int i=0; - // Assume it shouldn't take more than 10 seconds - // Broken versions of QT cause QProcess::start - // and QProcess::isRunning to return true even - // when the executable doesn't exist - while (grabber_method_proc.isRunning() && i < 100) - { - usleep(100000); - ++i; - } + bool ok = grabber_method_proc.waitForFinished(15*1000); - if (grabber_method_proc.normalExit()) + if (ok && + QProcess::NormalExit == grabber_method_proc.exitStatus()) { + grabber_method_proc + .setReadChannel(QProcess::StandardOutput); (*it).xmltvgrabber_prefmethod = - grabber_method_proc.readLineStdout(); + grabber_method_proc.readLine(); } else { @@ -689,7 +685,9 @@ } else { - QString error = grabber_method_proc.readLineStdout(); + grabber_method_proc + .setReadChannel(QProcess::StandardOutput); + QString error = grabber_method_proc.readLine(); VERBOSE(VB_IMPORTANT, QString("Failed to run %1 --preferredmethod") .arg(xmltv_grabber)); Index: programs/mythfilldatabase/channeldata.cpp =================================================================== --- programs/mythfilldatabase/channeldata.cpp (revision 18833) +++ programs/mythfilldatabase/channeldata.cpp (working copy) @@ -28,7 +28,7 @@ major = freqid; minor = 0; - int chansep = channum.find(QRegExp("\\D")); + int chansep = channum.indexOf(QRegExp("\\D")); if (chansep < 0) return; @@ -84,8 +84,8 @@ // Default is 0 to allow rapid skipping of many channels, // in some xmltv outputs there may be over 100 channel, but // only 10 or so that are available in each area. - chanid = atoi(getResponse("Choose a channel ID (positive integer) ", - "0")); + chanid = getResponse("Choose a channel ID (positive integer) ", "0") + .toUInt(); // If we wish to skip this channel, use the default 0 and return. if (chanid == 0) @@ -147,7 +147,7 @@ if (!actualfile.exists()) { QString command = QString("wget ") + (*i).iconpath; - system(command); + system(command.toLocal8Bit().constData()); } } @@ -385,7 +385,8 @@ if ((*i).callsign.isEmpty()) { - QStringList words = (*i).name.simplifyWhiteSpace().upper().split(" "); + QStringList words = (*i).name.simplified().toUpper() + .split(" "); QString callsign = ""; QString w1 = words.size() > 0 ? words[0] : QString(); QString w2 = words.size() > 1 ? words[1] : QString(); Index: programs/mythfilldatabase/icondata.cpp =================================================================== --- programs/mythfilldatabase/icondata.cpp (revision 18833) +++ programs/mythfilldatabase/icondata.cpp (working copy) @@ -105,7 +105,7 @@ int start_index = 0; while (found_at != -1) { - found_at = expandtarget.search(retval, start_index); + found_at = expandtarget.indexIn(retval, start_index); if (found_at != -1) { QString no_mapping("no_URL_mapping"); @@ -184,7 +184,7 @@ QString("Attempting to fetch icon with: %1") .arg(icon_get_command)); - system(icon_get_command); + system(icon_get_command.toLocal8Bit().constData()); } if (localfile.exists()) @@ -259,8 +259,8 @@ QString net = getNamedElementText(e, IM_NET_TAG); QString u = getNamedElementText(e, IM_NET_URL_TAG); - nm_query.bindValue(":NETWORK", net.stripWhiteSpace()); - nm_query.bindValue(":URL", u.stripWhiteSpace()); + nm_query.bindValue(":NETWORK", net.trimmed()); + nm_query.bindValue(":URL", u.trimmed()); if (!nm_query.exec()) MythDB::DBError( "Inserting network->url mapping", nm_query); @@ -270,8 +270,8 @@ QString cs = getNamedElementText(e, IM_CS_TAG); QString net = getNamedElementText(e, IM_NET_TAG); - cm_query.bindValue(":CALLSIGN", cs.stripWhiteSpace()); - cm_query.bindValue(":NETWORK", net.stripWhiteSpace()); + cm_query.bindValue(":CALLSIGN", cs.trimmed()); + cm_query.bindValue(":NETWORK", net.trimmed()); if (!cm_query.exec()) MythDB::DBError("Inserting callsign->network " "mapping", cm_query); @@ -408,7 +408,7 @@ while (query.next()) { QString base_stub = query.value(0).toString(); - if (baseax.search(base_stub) != -1) + if (baseax.indexIn(base_stub) != -1) { base_stub = baseax.cap(1); } Index: programs/mythfilldatabase/xmltvparser.cpp =================================================================== --- programs/mythfilldatabase/xmltvparser.cpp (revision 18833) +++ programs/mythfilldatabase/xmltvparser.cpp (working copy) @@ -2,6 +2,9 @@ #include #include #include +#include +#include +#include // C++ headers #include @@ -51,12 +54,12 @@ return ""; } -ChanInfo *XMLTVParser::parseChannel(QDomElement &element, Q3Url baseUrl) +ChanInfo *XMLTVParser::parseChannel(QDomElement &element, QUrl &baseUrl) { ChanInfo *chaninfo = new ChanInfo; QString xmltvid = element.attribute("id", ""); - QStringList split = QStringList::split(" ", xmltvid); + QStringList split = xmltvid.simplified().split(" "); chaninfo->callsign = ""; chaninfo->chanstr = ""; @@ -75,7 +78,8 @@ { if (info.tagName() == "icon") { - Q3Url iconUrl(baseUrl, info.attribute("src", ""), true); + Q3Url iconUrl(Q3Url(baseUrl.toString()), + info.attribute("src", ""), true); chaninfo->iconpath = iconUrl.toString(); } else if (info.tagName() == "display-name") @@ -105,7 +109,7 @@ // we signal an error by setting it invalid (> 840min = 14hr) int result = 841; - if (timezone.upper() == "UTC" || timezone.upper() == "GMT") + if (timezone.toUpper() == "UTC" || timezone.toUpper() == "GMT") return 0; if (timezone.length() == 5) @@ -144,7 +148,7 @@ return; } - QStringList split = QStringList::split(" ", timestr); + QStringList split = timestr.split(" "); QString ts = split[0]; bool ok; int year = 0, month = 0, day = 0, hour = 0, min = 0, sec = 0; @@ -169,7 +173,8 @@ } else { - cerr << "Ignoring unknown timestamp format: " << (const char *)ts << endl; + VERBOSE(VB_IMPORTANT, QString("Ignoring unknown timestamp format: %1") + .arg(ts)); return; } @@ -177,8 +182,7 @@ if ((split.size() > 1) && (localTimezoneOffset <= 840)) { - QString tmp = split[1]; - tmp.stripWhiteSpace(); + QString tmp = split[1].trimmed(); int ts_offset = TimezoneToInt(tmp); if (abs(ts_offset) > 840) @@ -299,14 +303,14 @@ pginfo->endts = text; text = element.attribute("channel", ""); - QStringList split = QStringList::split(" ", text); + QStringList split = text.split(" "); pginfo->channel = split[0]; text = element.attribute("clumpidx", ""); if (!text.isEmpty()) { - split = QStringList::split("/", text); + split = text.split("/"); pginfo->clumpidx = split[0]; pginfo->clumpmax = split[1]; } @@ -350,7 +354,7 @@ else if (info.tagName() == "category") { const QString cat = getFirstText(info); - const QString lcat = cat.lower(); + const QString lcat = cat.toLower(); if (lcat == "movie" || lcat == "series" || lcat == "sports" || lcat == "tvshow") @@ -448,7 +452,7 @@ { QString episodenum(getFirstText(info)); // if this field includes a dot, strip it out - int idx = episodenum.find('.'); + int idx = episodenum.indexOf('.'); if (idx != -1) episodenum.remove(idx, 1); pginfo->programid = episodenum; @@ -460,11 +464,11 @@ int tmp; QString episodenum(getFirstText(info)); episode = episodenum.section('.',1,1); - episode = episode.section('/',0,0).stripWhiteSpace(); - season = episodenum.section('.',0,0).stripWhiteSpace(); + episode = episode.section('/',0,0).trimmed(); + season = episodenum.section('.',0,0).trimmed(); QString part(episodenum.section('.',2,2)); - QString partnumber(part.section('/',0,0).stripWhiteSpace()); - QString parttotal(part.section('/',1,1).stripWhiteSpace()); + QString partnumber(part.section('/',0,0).trimmed()); + QString parttotal(part.section('/',1,1).trimmed()); pginfo->catType = "series"; @@ -546,7 +550,8 @@ { if (seriesid.isEmpty()) //need to hash ourself a seriesid from the title { - seriesid = QString::number(ELFHash(pginfo->title)); + seriesid = QString::number(ELFHash(pginfo->title.toLocal8Bit() + .constData())); } pginfo->seriesid = seriesid; programid.append(seriesid); @@ -628,9 +633,9 @@ QDomElement docElem = doc.documentElement(); - Q3Url baseUrl(docElem.attribute("source-data-url", "")); + QUrl baseUrl(docElem.attribute("source-data-url", "")); - Q3Url sourceUrl(docElem.attribute("source-info-url", "")); + QUrl sourceUrl(docElem.attribute("source-info-url", "")); if (sourceUrl.toString() == "http://labs.zap2it.com/") { VERBOSE(VB_IMPORTANT, "Don't use tv_grab_na_dd, use the" Index: programs/mythfilldatabase/mythfilldatabase.pro =================================================================== --- programs/mythfilldatabase/mythfilldatabase.pro (revision 18833) +++ programs/mythfilldatabase/mythfilldatabase.pro (working copy) @@ -2,6 +2,8 @@ include ( ../../settings.pro ) include ( ../programs-libs.pro ) +QT += network xml sql qt3support + TEMPLATE = app CONFIG += thread CONFIG -= moc @@ -20,5 +22,3 @@ SOURCES += fillutil.cpp SOURCES += main.cpp -#The following line was inserted by qt3to4 -QT += network xml sql opengl qt3support Index: programs/mythfilldatabase/xmltvparser.h =================================================================== --- programs/mythfilldatabase/xmltvparser.h (revision 18833) +++ programs/mythfilldatabase/xmltvparser.h (working copy) @@ -2,21 +2,21 @@ #define _XMLTVPARSER_H_ // Qt headers +#include #include -#include -#include -#include -#include +#include class ProgInfo; class ChanInfo; +class QUrl; +class QDomElement; class XMLTVParser { public: XMLTVParser() : isJapan(false) {} - ChanInfo *parseChannel(QDomElement &element, Q3Url baseUrl); + ChanInfo *parseChannel(QDomElement &element, QUrl &baseUrl); ProgInfo *parseProgram(QDomElement &element, int localTimezoneOffset); bool parseFile( QString filename, QList *chanlist,