diff --git a/mythtv/libs/libmyth/programinfo.cpp b/mythtv/libs/libmyth/programinfo.cpp index 968a85ce224..36803b7f52c 100644 --- a/mythtv/libs/libmyth/programinfo.cpp +++ b/mythtv/libs/libmyth/programinfo.cpp @@ -866,8 +866,8 @@ ProgramInfo::ProgramInfo(const QString &_pathname, QString pn = _pathname; if ((!_pathname.startsWith("myth://")) && - (_pathname.right(4).toLower() == ".iso" || - _pathname.right(4).toLower() == ".img" || + (_pathname.endsWith(".iso", Qt::CaseInsensitive) || + _pathname.endsWith(".img", Qt::CaseInsensitive) || QDir(_pathname + "/VIDEO_TS").exists())) { pn = QString("dvd:%1").arg(_pathname); @@ -1676,7 +1676,7 @@ void ProgramInfo::ToMap(InfoMap &progMap, progMap["yearstars"] = ""; if (!originalAirDate.isValid() || - (!programid.isEmpty() && (programid.left(2) == "MV"))) + (!programid.isEmpty() && programid.startsWith("MV"))) { progMap["originalairdate"] = ""; progMap["shortoriginalairdate"] = ""; @@ -2176,13 +2176,13 @@ static ProgramInfoType discover_program_info_type( if (fn_lower.startsWith("dvd:") || fn_lower.endsWith(".iso") || fn_lower.endsWith(".img") || - ((pathname.left(1) == "/") && + ((pathname.startsWith("/")) && QDir(pathname + "/VIDEO_TS").exists())) { pit = kProgramInfoTypeVideoDVD; } else if (fn_lower.startsWith("bd:") || - ((pathname.left(1) == "/") && + ((pathname.startsWith("/")) && QDir(pathname + "/BDMV").exists())) { pit = kProgramInfoTypeVideoBD; @@ -4107,7 +4107,7 @@ QString ProgramInfo::DiscoverRecordingDirectory(void) const return ""; QString path = GetPlaybackURL(false, true); - if (path.left(1) == "/") + if (path.startsWith("/")) { QFileInfo testFile(path); return testFile.path(); @@ -4508,7 +4508,7 @@ QString ProgramInfo::i18n(const QString &msg) void ProgramInfo::SubstituteMatches(QString &str) { QString pburl = GetPlaybackURL(false, true); - if (pburl.left(7) == "myth://") + if (pburl.startsWith("myth://")) { str.replace(QString("%DIR%"), pburl); } diff --git a/mythtv/libs/libmyth/programinfo.h b/mythtv/libs/libmyth/programinfo.h index 6e8e26375db..5402aadf942 100644 --- a/mythtv/libs/libmyth/programinfo.h +++ b/mythtv/libs/libmyth/programinfo.h @@ -320,12 +320,12 @@ class MPUBLIC ProgramInfo { return GetProgramInfoType() == kProgramInfoTypeVideoDVD; } bool IsVideoBD(void) const { return GetProgramInfoType() == kProgramInfoTypeVideoBD; } - bool IsLocal(void) const { return pathname.left(1) == "/" + bool IsLocal(void) const { return pathname.startsWith("/") #ifdef _WIN32 || pathname.at(1) == ':' #endif ; } - bool IsMythStream(void) const { return pathname.left(7) == "myth://"; } + bool IsMythStream(void) const { return pathname.startsWith("myth://"); } bool IsPathSet(void) const { return GetBasename() != pathname; } bool HasPathname(void) const { return !GetPathname().isEmpty(); } bool IsFileReadable(void) const; diff --git a/mythtv/libs/libmyth/schemawizard.cpp b/mythtv/libs/libmyth/schemawizard.cpp index 13f30fb0961..8b6870d59d6 100644 --- a/mythtv/libs/libmyth/schemawizard.cpp +++ b/mythtv/libs/libmyth/schemawizard.cpp @@ -425,12 +425,12 @@ SchemaUpgradeWizard::PromptForUpgrade(const char *name, if (m_expertMode) { resp = getResponse("Would you like to use the existing schema?", "yes"); - if (resp.isEmpty() || resp.left(1).toLower() == "y") + if (resp.isEmpty() || resp.startsWith("y", Qt::CaseInsensitive)) return MYTH_SCHEMA_USE_EXISTING; } resp = getResponse("\nShall I upgrade this database?", "yes"); - if (!resp.isEmpty() && resp.left(1).toLower() != "y") + if (!resp.isEmpty() && !resp.startsWith("y", Qt::CaseInsensitive)) return MYTH_SCHEMA_EXIT; if (connections) @@ -441,7 +441,7 @@ SchemaUpgradeWizard::PromptForUpgrade(const char *name, { resp = getResponse("\nA database backup might be a good idea" "\nAre you sure you want to upgrade?", "no"); - if (resp.isEmpty() || resp.left(1).toLower() == "n") + if (resp.isEmpty() || resp.startsWith("n", Qt::CaseInsensitive)) return MYTH_SCHEMA_EXIT; } diff --git a/mythtv/libs/libmyth/settings.h b/mythtv/libs/libmyth/settings.h index c3ad34c6f6f..04bf691062e 100644 --- a/mythtv/libs/libmyth/settings.h +++ b/mythtv/libs/libmyth/settings.h @@ -441,8 +441,8 @@ class MPUBLIC BooleanSetting : public Setting virtual void setValue(const QString &newValue) { setValue((newValue=="1" || - newValue.toLower().left(1)=="y" || - newValue.toLower().left(1)=="t")); + newValue.toLower().startsWith("y") || + newValue.toLower().startsWith("t"))); } signals: diff --git a/mythtv/libs/libmyth/storagegroupeditor.cpp b/mythtv/libs/libmyth/storagegroupeditor.cpp index fd5afc334fc..6ab6d994934 100644 --- a/mythtv/libs/libmyth/storagegroupeditor.cpp +++ b/mythtv/libs/libmyth/storagegroupeditor.cpp @@ -96,7 +96,7 @@ void StorageGroupEditor::open(QString name) if (name.isEmpty()) return; - if (name.right(1) != "/") + if (!name.endsWith("/")) name.append("/"); MSqlQuery query(MSqlQuery::InitCon()); @@ -118,7 +118,7 @@ void StorageGroupEditor::open(QString name) if (result == SGPopup_CANCEL) return; - if (name.right(1) != "/") + if (!name.endsWith("/")) name.append("/"); MSqlQuery query(MSqlQuery::InitCon()); @@ -257,7 +257,7 @@ void StorageGroupListEditor::open(QString name) { lastValue = name; - if (name.left(28) == "__CREATE_NEW_STORAGE_GROUP__") + if (name.startsWith("__CREATE_NEW_STORAGE_GROUP__")) { if (name.length() > 28) { @@ -286,7 +286,7 @@ void StorageGroupListEditor::open(QString name) void StorageGroupListEditor::doDelete(void) { QString name = listbox->getValue(); - if (name.left(28) == "__CREATE_NEW_STORAGE_GROUP__") + if (name.startsWith("__CREATE_NEW_STORAGE_GROUP__")) return; bool is_master_host = gCoreContext->IsMasterHost(); diff --git a/mythtv/libs/libmythbase/logging.cpp b/mythtv/libs/libmythbase/logging.cpp index de06e4e7e8a..6435e5aaa33 100644 --- a/mythtv/libs/libmythbase/logging.cpp +++ b/mythtv/libs/libmythbase/logging.cpp @@ -1120,7 +1120,7 @@ int verboseArgParse(QString arg) option = (*it).toLower(); bool reverseOption = false; - if (option != "none" && option.left(2) == "no") + if (option != "none" && option.startsWith("no")) { reverseOption = true; option = option.right(option.length() - 2); diff --git a/mythtv/libs/libmythbase/mythmiscutil.cpp b/mythtv/libs/libmythbase/mythmiscutil.cpp index 7477afb1619..ff8330acd5e 100644 --- a/mythtv/libs/libmythbase/mythmiscutil.cpp +++ b/mythtv/libs/libmythbase/mythmiscutil.cpp @@ -959,7 +959,7 @@ void wrapList(QStringList &list, int width) QString left = string.left(width); bool inserted = false; - while( !inserted && left.right(1) != " " ) + while( !inserted && !left.endsWith(" " )) { if( string.mid(left.size(), 1) == " " ) { diff --git a/mythtv/libs/libmythbase/plist.cpp b/mythtv/libs/libmythbase/plist.cpp index 5cc2c7d74f0..7429f218bf5 100644 --- a/mythtv/libs/libmythbase/plist.cpp +++ b/mythtv/libs/libmythbase/plist.cpp @@ -233,7 +233,7 @@ void PList::ParseBinaryPList(const QByteArray &data) .arg(size).arg(data.left(8).data())); // check plist type & version - if ((data.left(6) != MAGIC) || + if ((!data.startsWith(MAGIC)) || (data.mid(MAGIC_SIZE, VERSION_SIZE) != VERSION)) { LOG(VB_GENERAL, LOG_ERR, LOC + "Unrecognised start sequence. Corrupt?"); diff --git a/mythtv/libs/libmythbase/remotefile.cpp b/mythtv/libs/libmythbase/remotefile.cpp index 678d546d53d..fa300399313 100644 --- a/mythtv/libs/libmythbase/remotefile.cpp +++ b/mythtv/libs/libmythbase/remotefile.cpp @@ -268,10 +268,10 @@ bool RemoteFile::DeleteFile(const QString &url) QString filename = qurl.path(); QString sgroup = qurl.userName(); - if (!qurl.fragment().isEmpty() || url.right(1) == "#") + if (!qurl.fragment().isEmpty() || url.endsWith("#")) filename = filename + "#" + qurl.fragment(); - if (filename.left(1) == "/") + if (filename.startsWith("/")) filename = filename.right(filename.length()-1); if (filename.isEmpty() || sgroup.isEmpty()) @@ -301,10 +301,10 @@ bool RemoteFile::Exists(const QString &url, struct stat *fileinfo) QString filename = qurl.path(); QString sgroup = qurl.userName(); - if (!qurl.fragment().isEmpty() || url.right(1) == "#") + if (!qurl.fragment().isEmpty() || url.endsWith("#")) filename = filename + "#" + qurl.fragment(); - if (filename.left(1) == "/") + if (filename.startsWith("/")) filename = filename.right(filename.length()-1); if (filename.isEmpty()) @@ -356,10 +356,10 @@ QString RemoteFile::GetFileHash(const QString &url) QString hostname = qurl.host(); QString sgroup = qurl.userName(); - if (!qurl.fragment().isEmpty() || url.right(1) == "#") + if (!qurl.fragment().isEmpty() || url.endsWith("#")) filename = filename + "#" + qurl.fragment(); - if (filename.left(1) == "/") + if (filename.startsWith("/")) filename = filename.right(filename.length()-1); if (filename.isEmpty() || sgroup.isEmpty()) @@ -651,10 +651,10 @@ QDateTime RemoteFile::LastModified(const QString &url) QString filename = qurl.path(); QString sgroup = qurl.userName(); - if (!qurl.fragment().isEmpty() || url.right(1) == "#") + if (!qurl.fragment().isEmpty() || url.endsWith("#")) filename = filename + "#" + qurl.fragment(); - if (filename.left(1) == "/") + if (filename.startsWith("/")) filename = filename.right(filename.length()-1); if (filename.isEmpty() || sgroup.isEmpty()) diff --git a/mythtv/libs/libmythbase/storagegroup.cpp b/mythtv/libs/libmythbase/storagegroup.cpp index 66821363d29..1729626fdb9 100644 --- a/mythtv/libs/libmythbase/storagegroup.cpp +++ b/mythtv/libs/libmythbase/storagegroup.cpp @@ -549,7 +549,7 @@ bool StorageGroup::FindDirs(const QString group, const QString hostname, .toByteArray().constData()); dirname.replace(QRegExp("^\\s*"), ""); dirname.replace(QRegExp("\\s*$"), ""); - if (dirname.right(1) == "/") + if (dirname.endsWith("/")) dirname.remove(dirname.length() - 1, 1); if (dirlist) diff --git a/mythtv/libs/libmythprotoserver/requesthandler/fileserverhandler.cpp b/mythtv/libs/libmythprotoserver/requesthandler/fileserverhandler.cpp index ddaf8375f96..b8ae4823eb4 100644 --- a/mythtv/libs/libmythprotoserver/requesthandler/fileserverhandler.cpp +++ b/mythtv/libs/libmythprotoserver/requesthandler/fileserverhandler.cpp @@ -90,14 +90,14 @@ QString FileServerHandler::LocalFilePath(const QUrl &url, lpath = lpath.section('/', -1); QString fpath = lpath; - if (fpath.right(4) == ".png") + if (fpath.endsWith(".png")) fpath = fpath.left(fpath.length() - 4); ProgramInfo pginfo(fpath); if (pginfo.GetChanID()) { QString pburl = GetPlaybackURL(&pginfo); - if (pburl.left(1) == "/") + if (pburl.startsWith("/")) { lpath = pburl.section('/', 0, -2) + "/" + lpath; LOG(VB_FILE, LOG_INFO, @@ -517,7 +517,7 @@ QList FileServerHandler::QueryFileSystems(void) .toByteArray().constData()); disk.setPath(currentDir); - if (currentDir.right(1) == "/") + if (currentDir.endsWith("/")) currentDir.remove(currentDir.length() - 1, 1); checkDir.setPath(currentDir); diff --git a/mythtv/libs/libmythprotoserver/requesthandler/fileserverutil.cpp b/mythtv/libs/libmythprotoserver/requesthandler/fileserverutil.cpp index 6d5f98a81e2..3e990f019db 100644 --- a/mythtv/libs/libmythprotoserver/requesthandler/fileserverutil.cpp +++ b/mythtv/libs/libmythprotoserver/requesthandler/fileserverutil.cpp @@ -58,7 +58,7 @@ QString GetPlaybackURL(ProgramInfo *pginfo, bool storePath) else { result = pginfo->GetPlaybackURL(false, true); - if (storePath && result.left(1) == "/") + if (storePath && result.startsWith("/")) recordingPathCache[cacheKey] = result; } diff --git a/mythtv/libs/libmythtv/DVD/dvdringbuffer.cpp b/mythtv/libs/libmythtv/DVD/dvdringbuffer.cpp index 2932cd8bc25..c1202ede963 100644 --- a/mythtv/libs/libmythtv/DVD/dvdringbuffer.cpp +++ b/mythtv/libs/libmythtv/DVD/dvdringbuffer.cpp @@ -38,11 +38,11 @@ DVDInfo::DVDInfo(const QString &filename) { LOG(VB_PLAYBACK, LOG_INFO, QString("DVDInfo: Trying %1").arg(filename)); QString name = filename; - if (name.left(6) == "dvd://") + if (name.startsWith("dvd://")) name.remove(0,5); - else if (name.left(5) == "dvd:/") + else if (name.startsWith("dvd:/")) name.remove(0,4); - else if (name.left(4) == "dvd:") + else if (name.startsWith("dvd:")) name.remove(0,4); QByteArray fname = name.toLocal8Bit(); diff --git a/mythtv/libs/libmythtv/cc608decoder.cpp b/mythtv/libs/libmythtv/cc608decoder.cpp index 3e3b44965cd..a38ed795ad8 100644 --- a/mythtv/libs/libmythtv/cc608decoder.cpp +++ b/mythtv/libs/libmythtv/cc608decoder.cpp @@ -376,7 +376,7 @@ void CC608Decoder::FormatCCField(int tc, int field, int data) len = NewRowCC(mode, len); if (len == 0 || - ccbuf[mode].left(1) == "\b") + ccbuf[mode].startsWith("\b")) { ccbuf[mode] += (char)'\b'; len++; @@ -1122,16 +1122,16 @@ QString CC608Decoder::GetXDS(const QString &key) const if (key == "ratings") return QString::number(GetRatingSystems(false)); - else if (key.left(11) == "has_rating_") + else if (key.startsWith("has_rating_")) return ((1<GetSignalTimeout() < 1000)) { sigmonScanner->SetSignalTimeout(1000); diff --git a/mythtv/libs/libmythtv/channelscan/iptvchannelfetcher.cpp b/mythtv/libs/libmythtv/channelscan/iptvchannelfetcher.cpp index a5a82fddb92..9e6281c7d38 100644 --- a/mythtv/libs/libmythtv/channelscan/iptvchannelfetcher.cpp +++ b/mythtv/libs/libmythtv/channelscan/iptvchannelfetcher.cpp @@ -210,7 +210,7 @@ void IPTVChannelFetcher::SetMessage(const QString &status) QString IPTVChannelFetcher::DownloadPlaylist(const QString &url, bool inQtThread) { - if (url.left(4).toLower() == "file") + if (url.startsWith("file", Qt::CaseInsensitive)) { QString ret = ""; QUrl qurl(url); diff --git a/mythtv/libs/libmythtv/decoderbase.cpp b/mythtv/libs/libmythtv/decoderbase.cpp index 2f1933dd1d0..f181d2f683b 100644 --- a/mythtv/libs/libmythtv/decoderbase.cpp +++ b/mythtv/libs/libmythtv/decoderbase.cpp @@ -1145,23 +1145,23 @@ int to_track_type(const QString &str) { int ret = -1; - if (str.left(5) == "AUDIO") + if (str.startsWith("AUDIO")) ret = kTrackTypeAudio; - else if (str.left(5) == "VIDEO") + else if (str.startsWith("VIDEO")) ret = kTrackTypeVideo; - else if (str.left(8) == "SUBTITLE") + else if (str.startsWith("SUBTITLE")) ret = kTrackTypeSubtitle; - else if (str.left(5) == "CC608") + else if (str.startsWith("CC608")) ret = kTrackTypeCC608; - else if (str.left(5) == "CC708") + else if (str.startsWith("CC708")) ret = kTrackTypeCC708; - else if (str.left(3) == "TTC") + else if (str.startsWith("TTC")) ret = kTrackTypeTeletextCaptions; - else if (str.left(3) == "TTM") + else if (str.startsWith("TTM")) ret = kTrackTypeTeletextMenu; - else if (str.left(3) == "TFL") + else if (str.startsWith("TFL")) ret = kTrackTypeTextSubtitle; - else if (str.left(7) == "RAWTEXT") + else if (str.startsWith("RAWTEXT")) ret = kTrackTypeRawText; return ret; } diff --git a/mythtv/libs/libmythtv/fileringbuffer.cpp b/mythtv/libs/libmythtv/fileringbuffer.cpp index 6f51aa1f1f2..65e15c1e643 100644 --- a/mythtv/libs/libmythtv/fileringbuffer.cpp +++ b/mythtv/libs/libmythtv/fileringbuffer.cpp @@ -200,8 +200,8 @@ bool FileRingBuffer::OpenFile(const QString &lfilename, uint retry_ms) } bool is_local = - (filename.left(4) != "/dev") && - ((filename.left(1) == "/") || QFile::exists(filename)); + (!filename.startsWith("/dev")) && + ((filename.startsWith("/")) || QFile::exists(filename)); if (is_local) { diff --git a/mythtv/libs/libmythtv/jobqueue.cpp b/mythtv/libs/libmythtv/jobqueue.cpp index bfa39ac2947..b29aa095fb1 100644 --- a/mythtv/libs/libmythtv/jobqueue.cpp +++ b/mythtv/libs/libmythtv/jobqueue.cpp @@ -91,7 +91,7 @@ void JobQueue::customEvent(QEvent *e) MythEvent *me = (MythEvent *)e; QString message = me->Message(); - if (message.left(9) == "LOCAL_JOB") + if (message.startsWith("LOCAL_JOB")) { // LOCAL_JOB action ID jobID // LOCAL_JOB action type chanid recstartts hostname diff --git a/mythtv/libs/libmythtv/mythplayer.cpp b/mythtv/libs/libmythtv/mythplayer.cpp index 7b2b2b09e4e..febd6359f21 100644 --- a/mythtv/libs/libmythtv/mythplayer.cpp +++ b/mythtv/libs/libmythtv/mythplayer.cpp @@ -1046,7 +1046,7 @@ void MythPlayer::InitFilters(void) } else { - if ((filters.length() > 1) && (filters.right(1) != ",")) + if ((filters.length() > 1) && (!filters.endsWith(","))) filters += ","; filters += videoFiltersForProgram.mid(1); } diff --git a/mythtv/libs/libmythtv/playercontext.cpp b/mythtv/libs/libmythtv/playercontext.cpp index 2f9f6643697..aff3aead801 100644 --- a/mythtv/libs/libmythtv/playercontext.cpp +++ b/mythtv/libs/libmythtv/playercontext.cpp @@ -747,7 +747,7 @@ QString PlayerContext::GetFilters(const QString &baseFilters) const } else { - if (!filters.isEmpty() && (filters.right(1) != ",")) + if (!filters.isEmpty() && (!filters.endsWith(","))) filters += ","; filters += chanFilters.mid(1); diff --git a/mythtv/libs/libmythtv/previewgenerator.cpp b/mythtv/libs/libmythtv/previewgenerator.cpp index a5f002c8e62..67b62b8fcab 100644 --- a/mythtv/libs/libmythtv/previewgenerator.cpp +++ b/mythtv/libs/libmythtv/previewgenerator.cpp @@ -722,7 +722,7 @@ bool PreviewGenerator::IsLocal(void) const { QString tmppathname = pathname; - if (tmppathname.left(4) == "dvd:") + if (tmppathname.startsWith("dvd:")) tmppathname = tmppathname.section(":", 1, 1); if (!QFileInfo(tmppathname).isReadable()) @@ -779,7 +779,7 @@ char *PreviewGenerator::GetScreenGrab( } // pre-test local files for existence and size. 500 ms speed-up... - if (filename.left(1)=="/") + if (filename.startsWith("/")) { QFileInfo info(filename); bool invalid = (!info.exists() || !info.isReadable() || diff --git a/mythtv/libs/libmythtv/previewgeneratorqueue.cpp b/mythtv/libs/libmythtv/previewgeneratorqueue.cpp index 2272b172e7e..0f11a22ae6b 100644 --- a/mythtv/libs/libmythtv/previewgeneratorqueue.cpp +++ b/mythtv/libs/libmythtv/previewgeneratorqueue.cpp @@ -273,7 +273,7 @@ QString PreviewGeneratorQueue::GeneratePreviewImage( if (!is_special) { QDateTime previewLastModified; - bool streaming = filename.left(1) != "/"; + bool streaming = !filename.startsWith("/"); bool locally_accessible = false; bool bookmark_updated = false; diff --git a/mythtv/libs/libmythtv/recorders/channelbase.cpp b/mythtv/libs/libmythtv/recorders/channelbase.cpp index 35544fc0ffd..eeaddf13213 100644 --- a/mythtv/libs/libmythtv/recorders/channelbase.cpp +++ b/mythtv/libs/libmythtv/recorders/channelbase.cpp @@ -1173,7 +1173,7 @@ ChannelBase *ChannelBase::CreateChannel( else if ((genOpt.cardtype == "IMPORT") || (genOpt.cardtype == "DEMO") || (genOpt.cardtype == "MPEG" && - genOpt.videodev.toLower().left(5) == "file:")) + genOpt.videodev.toLower().startsWith("file:"))) { channel = new DummyChannel(tvrec); } diff --git a/mythtv/libs/libmythtv/recorders/firewiredevice.cpp b/mythtv/libs/libmythtv/recorders/firewiredevice.cpp index c9f5f343869..c735f211692 100644 --- a/mythtv/libs/libmythtv/recorders/firewiredevice.cpp +++ b/mythtv/libs/libmythtv/recorders/firewiredevice.cpp @@ -230,12 +230,12 @@ bool FirewireDevice::SetChannel(const QString &panel_model, // the PACE is obviously not a Motorola channel changer, but the // same commands work for it as the Motorola. - bool is_mot = ((panel_model.toUpper().left(4) == "DCT-") || - (panel_model.toUpper().left(4) == "DCH-") || - (panel_model.toUpper().left(4) == "DCX-") || - (panel_model.toUpper().left(4) == "QIP-") || - (panel_model.toUpper().left(4) == "MOTO") || - (panel_model.toUpper().left(5) == "PACE-")); + bool is_mot = ((panel_model.toUpper().startsWith("DCT-")) || + (panel_model.toUpper().startsWith("DCH-")) || + (panel_model.toUpper().startsWith("DCX-")) || + (panel_model.toUpper().startsWith("QIP-")) || + (panel_model.toUpper().startsWith("MOTO")) || + (panel_model.toUpper().startsWith("PACE-"))); if (is_mot && !alt_method) { diff --git a/mythtv/libs/libmythtv/recorders/mpegrecorder.cpp b/mythtv/libs/libmythtv/recorders/mpegrecorder.cpp index 8a5ff1474fa..46d8e3a5394 100644 --- a/mythtv/libs/libmythtv/recorders/mpegrecorder.cpp +++ b/mythtv/libs/libmythtv/recorders/mpegrecorder.cpp @@ -185,24 +185,24 @@ void MpegRecorder::SetOption(const QString &opt, int value) } else if (opt == "mpeg2audvolume") audvolume = value; - else if (opt.right(16) == "_mpeg4avgbitrate") + else if (opt.endsWith("_mpeg4avgbitrate")) { - if (opt.left(3) == "low") + if (opt.startsWith("low")) low_mpeg4avgbitrate = value; - else if (opt.left(6) == "medium") + else if (opt.startsWith("medium")) medium_mpeg4avgbitrate = value; - else if (opt.left(4) == "high") + else if (opt.startsWith("high")) high_mpeg4avgbitrate = value; else V4LRecorder::SetOption(opt, value); } - else if (opt.right(17) == "_mpeg4peakbitrate") + else if (opt.endsWith("_mpeg4peakbitrate")) { - if (opt.left(3) == "low") + if (opt.startsWith("low")) low_mpeg4peakbitrate = value; - else if (opt.left(6) == "medium") + else if (opt.startsWith("medium")) medium_mpeg4peakbitrate = value; - else if (opt.left(4) == "high") + else if (opt.startsWith("high")) high_mpeg4peakbitrate = value; else V4LRecorder::SetOption(opt, value); @@ -296,7 +296,7 @@ void MpegRecorder::SetOptionsFromProfile(RecordingProfile *profile, (void)audiodev; (void)vbidev; - if (videodev.toLower().left(5) == "file:") + if (videodev.toLower().startsWith("file:")) { deviceIsMpegFile = true; bufferSize = 64000; @@ -755,7 +755,7 @@ bool MpegRecorder::SetV4L2DeviceOptions(int chanfd) // Set controls if (driver != "hdpvr") { - if (driver.left(7) != "saa7164") + if (!driver.startsWith("saa7164")) { add_ext_ctrl(ext_ctrls, V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ, GetFilteredAudioSampleRate()); @@ -783,7 +783,7 @@ bool MpegRecorder::SetV4L2DeviceOptions(int chanfd) } maxbitrate = std::max(maxbitrate, bitrate); - if (driver == "hdpvr" || driver.left(7) == "saa7164") + if (driver == "hdpvr" || driver.startsWith("saa7164")) { add_ext_ctrl(ext_ctrls, V4L2_CID_MPEG_VIDEO_BITRATE_MODE, (maxbitrate == bitrate) ? diff --git a/mythtv/libs/libmythtv/recorders/v4lchannel.cpp b/mythtv/libs/libmythtv/recorders/v4lchannel.cpp index c325e231901..1ef7059b7b3 100644 --- a/mythtv/libs/libmythtv/recorders/v4lchannel.cpp +++ b/mythtv/libs/libmythtv/recorders/v4lchannel.cpp @@ -158,11 +158,11 @@ static int format_to_mode(const QString &fmt) else if (fmt == "NTSC-JP") return V4L2_STD_NTSC_M_JP; // generics... - else if (fmt.left(4) == "NTSC") + else if (fmt.startsWith("NTSC")) return V4L2_STD_NTSC; - else if (fmt.left(4) == "ATSC") + else if (fmt.startsWith("ATSC")) return V4L2_STD_NTSC; // We've dropped V4L ATSC support... - else if (fmt.left(3) == "PAL") + else if (fmt.startsWith("PAL")) return V4L2_STD_PAL; return V4L2_STD_NTSC; } diff --git a/mythtv/libs/libmythtv/recordingprofile.cpp b/mythtv/libs/libmythtv/recordingprofile.cpp index e8060a4a888..71ed05a9b2c 100644 --- a/mythtv/libs/libmythtv/recordingprofile.cpp +++ b/mythtv/libs/libmythtv/recordingprofile.cpp @@ -1114,8 +1114,8 @@ class ImageSize : public VerticalConfigurationGroup setLabel(labelName); QSize defaultsize(768, 576), maxsize(768, 576); - bool transcoding = profName.left(11) == "Transcoders"; - bool ivtv = profName.left(20) == "IVTV MPEG-2 Encoders"; + bool transcoding = profName.startsWith("Transcoders"); + bool ivtv = profName.startsWith("IVTV MPEG-2 Encoders"); if (transcoding) { @@ -1125,7 +1125,7 @@ class ImageSize : public VerticalConfigurationGroup else defaultsize = QSize(480, 576); } - else if (tvFormat.toLower().left(4) == "ntsc") + else if (tvFormat.toLower().startsWith("ntsc")) { maxsize = QSize(720, 480); defaultsize = (ivtv) ? QSize(720, 480) : QSize(480, 480); @@ -1211,7 +1211,7 @@ RecordingProfile::RecordingProfile(QString profName) if (!profName.isEmpty()) { - if (profName.left(11) == "Transcoders") + if (profName.startsWith("Transcoders")) { tr_filters = new TranscodeFilters(*this); tr_lossless = new TranscodeLossless(*this); @@ -1401,7 +1401,7 @@ void RecordingProfile::CompleteLoad(int profileId, const QString &type, audioSettings = new AudioCompressionSettings(*this, profileName); addChild(audioSettings); - if (!profileName.isEmpty() && profileName.left(11) == "Transcoders") + if (!profileName.isEmpty() && profileName.startsWith("Transcoders")) { connect(tr_resize, SIGNAL(valueChanged (bool)), this, SLOT( ResizeTranscode(bool))); diff --git a/mythtv/libs/libmythtv/ringbuffer.cpp b/mythtv/libs/libmythtv/ringbuffer.cpp index 0e3673af0b2..59a92865ca9 100644 --- a/mythtv/libs/libmythtv/ringbuffer.cpp +++ b/mythtv/libs/libmythtv/ringbuffer.cpp @@ -150,7 +150,7 @@ RingBuffer *RingBuffer::Create( if (!stream_only && (dvdurl || dvddir || dvdext)) { - if (lfilename.left(4) == "dvd:") // URI "dvd:" + path + if (lfilename.startsWith("dvd:")) // URI "dvd:" + path lfilename.remove(0,4); // e.g. "dvd:/dev/dvd" if (!(mythurl || QFile::exists(lfilename))) @@ -161,7 +161,7 @@ RingBuffer *RingBuffer::Create( } else if (!stream_only && (bdurl || bddir)) { - if (lfilename.left(3) == "bd:") // URI "bd:" + path + if (lfilename.startsWith("bd:")) // URI "bd:" + path lfilename.remove(0,3); // e.g. "bd:/videos/ET" if (!(mythurl || QFile::exists(lfilename))) diff --git a/mythtv/libs/libmythtv/sourceutil.cpp b/mythtv/libs/libmythtv/sourceutil.cpp index f64d55ea23d..0408cd0c3c9 100644 --- a/mythtv/libs/libmythtv/sourceutil.cpp +++ b/mythtv/libs/libmythtv/sourceutil.cpp @@ -80,7 +80,7 @@ QString SourceUtil::GetChannelSeparator(uint sourceid) { const QString channum = query.value(0).toString(); const int where = channum.indexOf(sepExpr); - if (channum.right(2).left(1) == "0") + if (channum.right(2).startsWith("0")) counts["0"]++; else counts[(where < 0) ? "" : QString(channum.at(where))]++; @@ -190,7 +190,7 @@ static QStringList get_cardtypes(uint sourceid) /// BEGIN HACK HACK HACK -- return correct card type for child cards QString cardtype = query.value(0).toString().toUpper(); QString inputname = query.value(1).toString().toUpper(); - cardtype = ((cardtype == "DVB") && (inputname.left(3) != "DVB")) ? + cardtype = ((cardtype == "DVB") && (!inputname.startsWith("DVB"))) ? "V4L" : cardtype; /// END HACK HACK HACK list += cardtype; diff --git a/mythtv/libs/libmythtv/transporteditor.cpp b/mythtv/libs/libmythtv/transporteditor.cpp index 53216baaaff..f33dc412ce3 100644 --- a/mythtv/libs/libmythtv/transporteditor.cpp +++ b/mythtv/libs/libmythtv/transporteditor.cpp @@ -66,10 +66,10 @@ class TransportWizard : public ConfigurationWizard static QString pp_modulation(QString mod) { - if (mod.right(3) == "vsb") + if (mod.endsWith("vsb")) return mod.left(mod.length() - 3) + "-VSB"; - if (mod.left(4) == "qam_") + if (mod.startsWith("qam_")) return "QAM-" + mod.mid(4, mod.length()); if (mod == "analog") diff --git a/mythtv/libs/libmythtv/tv_play.cpp b/mythtv/libs/libmythtv/tv_play.cpp index 0058cac4bfb..aaac44baddb 100644 --- a/mythtv/libs/libmythtv/tv_play.cpp +++ b/mythtv/libs/libmythtv/tv_play.cpp @@ -3656,7 +3656,7 @@ bool TV::HandleTrackAction(PlayerContext *ctx, const QString &action) ctx->player->ToggleCaptions(); } } - else if (action.left(6) == "TOGGLE") + else if (action.startsWith("TOGGLE")) { int type = to_track_type(action.mid(6)); if (type == kTrackTypeTeletextMenu) @@ -3666,7 +3666,7 @@ bool TV::HandleTrackAction(PlayerContext *ctx, const QString &action) else handled = false; } - else if (action.left(6) == "SELECT") + else if (action.startsWith("SELECT")) { int type = to_track_type(action.mid(6)); int num = action.section("_", -1).toInt(); @@ -3675,13 +3675,13 @@ bool TV::HandleTrackAction(PlayerContext *ctx, const QString &action) else handled = false; } - else if (action.left(4) == "NEXT" || action.left(4) == "PREV") + else if (action.startsWith("NEXT") || action.startsWith("PREV")) { - int dir = (action.left(4) == "NEXT") ? +1 : -1; + int dir = (action.startsWith("NEXT")) ? +1 : -1; int type = to_track_type(action.mid(4)); if (type >= kTrackTypeAudio) ctx->player->ChangeTrack(type, dir); - else if (action.right(2) == "CC") + else if (action.endsWith("CC")) ctx->player->ChangeCaptionTrack(dir); else handled = false; @@ -9315,7 +9315,7 @@ void TV::customEvent(QEvent *e) { GetStatus(); } - else if (message.left(14) == "DONE_RECORDING") + else if (message.startsWith("DONE_RECORDING")) { int seconds = 0; //long long frames = 0; @@ -9376,7 +9376,7 @@ void TV::customEvent(QEvent *e) ReturnPlayerLock(mctx); } - if (message.left(14) == "ASK_RECORDING ") + if (message.startsWith("ASK_RECORDING ")) { int timeuntil = 0, hasrec = 0, haslater = 0; if (tokens.size() >= 5) @@ -9413,7 +9413,7 @@ void TV::customEvent(QEvent *e) ReturnPlayerLock(mctx); } - if (message.left(11) == "QUIT_LIVETV") + if (message.startsWith("QUIT_LIVETV")) { cardnum = (tokens.size() >= 2) ? tokens[1].toUInt() : 0; @@ -9452,7 +9452,7 @@ void TV::customEvent(QEvent *e) ReturnPlayerLock(mctx); } - if (message.left(12) == "LIVETV_WATCH") + if (message.startsWith("LIVETV_WATCH")) { int watch = 0; if (tokens.size() >= 3) @@ -9493,7 +9493,7 @@ void TV::customEvent(QEvent *e) ReturnPlayerLock(mctx); } - if (message.left(12) == "LIVETV_CHAIN") + if (message.startsWith("LIVETV_CHAIN")) { QString id = QString::null; if ((tokens.size() >= 2) && tokens[1] == "UPDATE") @@ -9513,7 +9513,7 @@ void TV::customEvent(QEvent *e) ReturnPlayerLock(mctx); } - if (message.left(12) == "EXIT_TO_MENU") + if (message.startsWith("EXIT_TO_MENU")) { PlayerContext *mctx = GetPlayerReadLock(0, __FILE__, __LINE__); for (uint i = 0; mctx && (i < player.size()); i++) @@ -9528,7 +9528,7 @@ void TV::customEvent(QEvent *e) ReturnPlayerLock(mctx); } - if (message.left(6) == "SIGNAL") + if (message.startsWith("SIGNAL")) { cardnum = (tokens.size() >= 2) ? tokens[1].toUInt() : 0; QStringList signalList = me->ExtraDataList(); @@ -9552,7 +9552,7 @@ void TV::customEvent(QEvent *e) ReturnPlayerLock(mctx); } - if (message.left(15) == "NETWORK_CONTROL") + if (message.startsWith("NETWORK_CONTROL")) { if ((tokens.size() >= 2) && (tokens[1] != "ANSWER") && (tokens[1] != "RESPONSE")) @@ -9570,17 +9570,17 @@ void TV::customEvent(QEvent *e) } } - if (message.left(9) == "START_EPG") + if (message.startsWith("START_EPG")) { int editType = tokens[1].toInt(); DoEditSchedule(editType); } - if (message.left(11) == "EPG_EXITING" || - message.left(18) == "PROGFINDER_EXITING" || - message.left(21) == "VIEWSCHEDULED_EXITING" || - message.left(19) == "PLAYBACKBOX_EXITING" || - message.left(22) == "SCHEDULEEDITOR_EXITING") + if (message.startsWith("EPG_EXITING") || + message.startsWith("PROGFINDER_EXITING") || + message.startsWith("VIEWSCHEDULED_EXITING") || + message.startsWith("PLAYBACKBOX_EXITING") || + message.startsWith("SCHEDULEEDITOR_EXITING")) { // Resize the window back to the MythTV Player size PlayerContext *actx = GetPlayerReadLock(-1, __FILE__, __LINE__); @@ -9622,7 +9622,7 @@ void TV::customEvent(QEvent *e) isEmbedded = false; ignoreKeyPresses = false; - if (message.left(19) == "PLAYBACKBOX_EXITING") + if (message.startsWith("PLAYBACKBOX_EXITING")) { ProgramInfo pginfo(me->ExtraDataList()); if (pginfo.HasPathname() || pginfo.GetChanID()) @@ -9633,7 +9633,7 @@ void TV::customEvent(QEvent *e) } - if (message.left(14) == "COMMFLAG_START" && (tokens.size() >= 2)) + if (message.startsWith("COMMFLAG_START") && (tokens.size() >= 2)) { uint evchanid = 0; QDateTime evrecstartts; @@ -9660,7 +9660,7 @@ void TV::customEvent(QEvent *e) ReturnPlayerLock(mctx); } - if (message.left(15) == "COMMFLAG_UPDATE" && (tokens.size() >= 3)) + if (message.startsWith("COMMFLAG_UPDATE") && (tokens.size() >= 3)) { uint evchanid = 0; QDateTime evrecstartts; @@ -10696,7 +10696,7 @@ void TV::OSDDialogEvent(int result, QString text, QString action) EnableUpmix(actx, true); else if (action == ACTION_DISABLEUPMIX) EnableUpmix(actx, false); - else if (action.left(13) == "ADJUSTSTRETCH") + else if (action.startsWith("ADJUSTSTRETCH")) { bool floatRead; float stretch = action.right(action.length() - 13).toFloat(&floatRead); @@ -10714,7 +10714,7 @@ void TV::OSDDialogEvent(int result, QString text, QString action) ChangeTimeStretch(actx, 0, !floatRead); // just display } - else if (action.left(11) == "SELECTSCAN_") + else if (action.startsWith("SELECTSCAN_")) { QString msg = QString::null; actx->LockDeletePlayer(__FILE__, __LINE__); @@ -10725,7 +10725,7 @@ void TV::OSDDialogEvent(int result, QString text, QString action) if (!msg.isEmpty()) SetOSDMessage(actx, msg); } - else if (action.left(15) == ACTION_TOGGELAUDIOSYNC) + else if (action.startsWith(ACTION_TOGGELAUDIOSYNC)) ChangeAudioSync(actx, 0); else if (action == ACTION_TOGGLESUBTITLEZOOM) ChangeSubtitleZoom(actx, 0); @@ -10737,17 +10737,17 @@ void TV::OSDDialogEvent(int result, QString text, QString action) EnableVisualisation(actx, true); else if (action == ACTION_DISABLEVISUALISATION) EnableVisualisation(actx, false); - else if (action.left(11) == ACTION_TOGGLESLEEP) + else if (action.startsWith(ACTION_TOGGLESLEEP)) { ToggleSleepTimer(actx, action.left(13)); } - else if (action.left(17) == "TOGGLEPICCONTROLS") + else if (action.startsWith("TOGGLEPICCONTROLS")) { adjustingPictureAttribute = (PictureAttribute) (action.right(1).toInt() - 1); DoTogglePictureAttribute(actx, kAdjustingPicture_Playback); } - else if (action.left(18) == ACTION_TOGGLESTUDIOLEVELS) + else if (action.startsWith(ACTION_TOGGLESTUDIOLEVELS)) { DoToggleStudioLevels(actx); } @@ -10755,12 +10755,12 @@ void TV::OSDDialogEvent(int result, QString text, QString action) { DoToggleNightMode(actx); } - else if (action.left(12) == "TOGGLEASPECT") + else if (action.startsWith("TOGGLEASPECT")) { ToggleAspectOverride(actx, (AspectOverrideMode) action.right(1).toInt()); } - else if (action.left(10) == "TOGGLEFILL") + else if (action.startsWith("TOGGLEFILL")) { ToggleAdjustFill(actx, (AdjustFillMode) action.right(1).toInt()); } @@ -10770,7 +10770,7 @@ void TV::OSDDialogEvent(int result, QString text, QString action) } else if (action == ACTION_GUIDE) EditSchedule(actx, kScheduleProgramGuide); - else if (action.left(10) == "CHANGROUP_" && db_use_channel_groups) + else if (action.startsWith("CHANGROUP_") && db_use_channel_groups) { if (action == "CHANGROUP_ALL_CHANNELS") { @@ -10859,7 +10859,7 @@ void TV::OSDDialogEvent(int result, QString text, QString action) browsehelper->BrowseStart(actx); else if (action == "PREVCHAN") PopPreviousChannel(actx, true); - else if (action.left(14) == "SWITCHTOINPUT_") + else if (action.startsWith("SWITCHTOINPUT_")) { switchToInputId = action.mid(14).toUInt(); QMutexLocker locker(&timerIdLock); @@ -10897,17 +10897,17 @@ void TV::OSDDialogEvent(int result, QString text, QString action) actx->player->GoToMenu(menu); actx->UnlockDeletePlayer(__FILE__, __LINE__); } - else if (action.left(13) == ACTION_JUMPCHAPTER) + else if (action.startsWith(ACTION_JUMPCHAPTER)) { int chapter = action.right(3).toInt(); DoJumpChapter(actx, chapter); } - else if (action.left(11) == ACTION_SWITCHTITLE) + else if (action.startsWith(ACTION_SWITCHTITLE)) { int title = action.right(3).toInt(); DoSwitchTitle(actx, title); } - else if (action.left(13) == ACTION_SWITCHANGLE) + else if (action.startsWith(ACTION_SWITCHANGLE)) { int angle = action.right(3).toInt(); DoSwitchAngle(actx, angle); @@ -10919,7 +10919,7 @@ void TV::OSDDialogEvent(int result, QString text, QString action) } else if (action == "TOGGLEAUTOEXPIRE") ToggleAutoExpire(actx); - else if (action.left(14) == "TOGGLECOMMSKIP") + else if (action.startsWith("TOGGLECOMMSKIP")) SetAutoCommercialSkip( actx, (CommSkipMode)(action.right(1).toInt())); else if (action == "QUEUETRANSCODE") @@ -12355,7 +12355,7 @@ bool TV::HandleJumpToProgramAction( QStringList::const_iterator it = actions.begin(); for (; it != actions.end(); ++it) { - if ((*it).left(8) != "JUMPPROG") + if (!(*it).startsWith("JUMPPROG")) continue; const QString &action = *it; diff --git a/mythtv/libs/libmythtv/videoout_xv.cpp b/mythtv/libs/libmythtv/videoout_xv.cpp index e2df180f270..cbdedf20b85 100644 --- a/mythtv/libs/libmythtv/videoout_xv.cpp +++ b/mythtv/libs/libmythtv/videoout_xv.cpp @@ -845,7 +845,7 @@ bool VideoOutputXv::InitSetupBuffers(void) } // Create video buffers - bool use_xv = (renderer.left(2) == "xv"); + bool use_xv = (renderer.startsWith("xv")); bool use_shm = (renderer == "xshm"); bool ok = InitVideoBuffers(use_xv, use_shm); diff --git a/mythtv/libs/libmythtv/videooutbase.cpp b/mythtv/libs/libmythtv/videooutbase.cpp index 2e5dc13a00e..9ba73942e0d 100644 --- a/mythtv/libs/libmythtv/videooutbase.cpp +++ b/mythtv/libs/libmythtv/videooutbase.cpp @@ -1871,7 +1871,7 @@ int VideoOutput::CalcHueBase(const QString &adaptor_name) { hue_adj = 50; } - else if (adaptor_name.left(4) == "NV17") /* nVidia */ + else if (adaptor_name.startsWith("NV17")) /* nVidia */ { hue_adj = 0; } diff --git a/mythtv/libs/libmythtv/videosource.cpp b/mythtv/libs/libmythtv/videosource.cpp index de13cfa518e..5f0ead32a10 100644 --- a/mythtv/libs/libmythtv/videosource.cpp +++ b/mythtv/libs/libmythtv/videosource.cpp @@ -1464,9 +1464,9 @@ void HDHomeRunDeviceIDList::fillSelections(const QString &cur) QString sel = man_addr; devs.push_back(sel); - if (3 == devs.size() && current.left(8).toUpper() == "FFFFFFFF") + if (3 == devs.size() && current.startsWith("FFFFFFFF", Qt::CaseInsensitive)) { - current = sel = (current.right(1) == "0") ? + current = sel = (current.endsWith("0")) ? *(devs.begin()) : *(++devs.begin()); } else @@ -3538,19 +3538,19 @@ static QString remove_chaff(const QString &name) { // Trim off some of the chaff. QString short_name = name; - if (short_name.left(14) == "LG Electronics") + if (short_name.startsWith("LG Electronics")) short_name = short_name.right(short_name.length() - 15); - if (short_name.left(4) == "Oren") + if (short_name.startsWith("Oren")) short_name = short_name.right(short_name.length() - 5); - if (short_name.left(8) == "Nextwave") + if (short_name.startsWith("Nextwave")) short_name = short_name.right(short_name.length() - 9); - if (short_name.right(8).toLower() == "frontend") + if (short_name.startsWith("frontend", Qt::CaseInsensitive)) short_name = short_name.left(short_name.length() - 9); - if (short_name.right(7) == "VSB/QAM") + if (short_name.endsWith("VSB/QAM")) short_name = short_name.left(short_name.length() - 8); - if (short_name.right(3) == "VSB") + if (short_name.endsWith("VSB")) short_name = short_name.left(short_name.length() - 4); - if (short_name.right(5) == "DVB-T") + if (short_name.endsWith("DVB-T")) short_name = short_name.left(short_name.length() - 6); // It would be infinitely better if DVB allowed us to query @@ -3558,19 +3558,19 @@ static QString remove_chaff(const QString &name) // demodulator name. This means cards like the Air2PC HD5000 // and DViCO Fusion HDTV cards are not identified correctly. short_name = short_name.simplified(); - if (short_name.left(7).toLower() == "or51211") + if (short_name.startsWith("or51211", Qt::CaseInsensitive)) short_name = "pcHDTV HD-2000"; - else if (short_name.left(7).toLower() == "or51132") + else if (short_name.startsWith("or51132", Qt::CaseInsensitive)) short_name = "pcHDTV HD-3000"; - else if (short_name.left(7).toLower() == "bcm3510") + else if (short_name.startsWith("bcm3510", Qt::CaseInsensitive)) short_name = "Air2PC v1"; - else if (short_name.left(7).toLower() == "nxt2002") + else if (short_name.startsWith("nxt2002", Qt::CaseInsensitive)) short_name = "Air2PC v2"; - else if (short_name.left(7).toLower() == "nxt200x") + else if (short_name.startsWith("nxt200x", Qt::CaseInsensitive)) short_name = "Air2PC v2"; - else if (short_name.left(8).toLower() == "lgdt3302") + else if (short_name.startsWith("lgdt3302", Qt::CaseInsensitive)) short_name = "DViCO HDTV3"; - else if (short_name.left(8).toLower() == "lgdt3303") + else if (short_name.startsWith("lgdt3303", Qt::CaseInsensitive)) short_name = "DViCO v2 or Air2PC v3 or pcHDTV HD-5500"; return short_name; @@ -3655,9 +3655,12 @@ void DVBConfigurationGroup::probeCard(const QString &videodevice) #if 0 // frontends on hybrid DVB-T/Analog cards QString short_name = remove_chaff(frontend_name); buttonAnalog->setVisible( - short_name.left(15).toLower() == "zarlink zl10353" || - short_name.toLower() == "wintv hvr 900 m/r: 65008/a1c0" || - short_name.left(17).toLower() == "philips tda10046h"); + short_name.startsWith("zarlink zl10353", + Qt::CaseInsensitive) || + short_name.startsWith("wintv hvr 900 m/r: 65008/a1c0", + Qt::CaseInsensitive) || + short_name.startsWith("philips tda10046h", + Qt::CaseInsensitive)); #endif } break; @@ -3681,9 +3684,9 @@ void DVBConfigurationGroup::probeCard(const QString &videodevice) if (frontend_name.toLower().indexOf("usb") < 0) { buttonAnalog->setVisible( - short_name.left(6).toLower() == "pchdtv" || - short_name.left(5).toLower() == "dvico" || - short_name.left(8).toLower() == "nextwave"); + short_name.startsWith("pchdtv", Qt::CaseInsensitive) || + short_name.startsWith("dvico", Qt::CaseInsensitive) || + short_name.startsWith("nextwave", Qt::CaseInsensitive)); } #endif } diff --git a/mythtv/libs/libmythui/myththemedmenu.cpp b/mythtv/libs/libmythui/myththemedmenu.cpp index 6711d4413b1..e3fa9dec502 100644 --- a/mythtv/libs/libmythui/myththemedmenu.cpp +++ b/mythtv/libs/libmythui/myththemedmenu.cpp @@ -762,7 +762,7 @@ bool MythThemedMenu::handleAction(const QString &action, const QString &password if (!password.isEmpty() && !checkPinCode(password)) return true; - if (action.left(5) == "EXEC ") + if (action.startsWith("EXEC ")) { QString rest = action.right(action.length() - 5); if (cbs && cbs->exec_program) @@ -770,13 +770,13 @@ bool MythThemedMenu::handleAction(const QString &action, const QString &password return false; } - else if (action.left(7) == "EXECTV ") + else if (action.startsWith("EXECTV ")) { QString rest = action.right(action.length() - 7).trimmed(); if (cbs && cbs->exec_program_tv) cbs->exec_program_tv(rest); } - else if (action.left(5) == "MENU ") + else if (action.startsWith("MENU ")) { QString menu = action.right(action.length() - 5); @@ -789,40 +789,40 @@ bool MythThemedMenu::handleAction(const QString &action, const QString &password else delete newmenu; } - else if (action.left(6) == "UPMENU") + else if (action.startsWith("UPMENU")) { m_wantpop = true; } - else if (action.left(12) == "CONFIGPLUGIN") + else if (action.startsWith("CONFIGPLUGIN")) { QString rest = action.right(action.length() - 13); if (cbs && cbs->configplugin) cbs->configplugin(rest); } - else if (action.left(6) == "PLUGIN") + else if (action.startsWith("PLUGIN")) { QString rest = action.right(action.length() - 7); if (cbs && cbs->plugin) cbs->plugin(rest); } - else if (action.left(8) == "SHUTDOWN") + else if (action.startsWith("SHUTDOWN")) { if (m_allocedstate) { m_wantpop = true; } } - else if (action.left(5) == "EJECT") + else if (action.startsWith("EJECT")) { if (cbs && cbs->eject) cbs->eject(); } - else if (action.left(5) == "JUMP ") + else if (action.startsWith("JUMP ")) { QString rest = action.right(action.length() - 5); GetMythMainWindow()->JumpTo(rest, false); } - else if (action.left(6) == "MEDIA ") + else if (action.startsWith("MEDIA ")) { // the format is MEDIA HANDLER URL // TODO: allow spaces in the url diff --git a/mythtv/libs/libmythui/mythuiwebbrowser.cpp b/mythtv/libs/libmythui/mythuiwebbrowser.cpp index 3a35549cbf2..0b59608db34 100644 --- a/mythtv/libs/libmythui/mythuiwebbrowser.cpp +++ b/mythtv/libs/libmythui/mythuiwebbrowser.cpp @@ -244,7 +244,7 @@ void BrowserApi::customEvent(QEvent *e) MythEvent *me = (MythEvent *)e; QString message = me->Message(); - if (message.left(13) != "MUSIC_CONTROL") + if (!message.startsWith("MUSIC_CONTROL")) return; QStringList tokens = message.simplified().split(" "); diff --git a/mythtv/libs/libmythupnp/upnpdevice.cpp b/mythtv/libs/libmythupnp/upnpdevice.cpp index 7cbdb4d53ef..dcb30e59bb4 100644 --- a/mythtv/libs/libmythupnp/upnpdevice.cpp +++ b/mythtv/libs/libmythupnp/upnpdevice.cpp @@ -856,7 +856,7 @@ QString UPnpDevice::toString(uint padding) const } // remove trailing newline - if (ret.right(1)=="\n") + if (ret.endsWith("\n")) ret = ret.left(ret.length()-1); // add any padding as necessary diff --git a/mythtv/programs/mythbackend/autoexpire.cpp b/mythtv/programs/mythbackend/autoexpire.cpp index b3b02e62d04..5755850c17c 100644 --- a/mythtv/programs/mythbackend/autoexpire.cpp +++ b/mythtv/programs/mythbackend/autoexpire.cpp @@ -571,7 +571,7 @@ void AutoExpire::ExpireRecordings(void) // Wasn't found so check locally QString file = GetPlaybackURL(p); - if (file.left(1) == "/") + if (file.startsWith("/")) { p->SetPathname(file); p->SetHostname(myHostName); diff --git a/mythtv/programs/mythbackend/backendutil.cpp b/mythtv/programs/mythbackend/backendutil.cpp index 321e259b352..70e5384e589 100644 --- a/mythtv/programs/mythbackend/backendutil.cpp +++ b/mythtv/programs/mythbackend/backendutil.cpp @@ -36,7 +36,7 @@ QString GetPlaybackURL(ProgramInfo *pginfo, bool storePath) locker.unlock(); result = pginfo->GetPlaybackURL(false, true); locker.relock(); - if (storePath && result.left(1) == "/") + if (storePath && result.startsWith("/")) recordingPathCache[cacheKey] = result; } diff --git a/mythtv/programs/mythbackend/httpconfig.cpp b/mythtv/programs/mythbackend/httpconfig.cpp index 36522b5139a..061c9f7dba9 100644 --- a/mythtv/programs/mythbackend/httpconfig.cpp +++ b/mythtv/programs/mythbackend/httpconfig.cpp @@ -72,7 +72,8 @@ bool HttpConfig::ProcessRequest(HTTPRequest *request) } // FIXME, this is always false, what's it for - if (request->m_sBaseUrl.right(7) == "config" && + // JMS "fixed" by using endsWith() + if (request->m_sBaseUrl.endsWith("config") && !database_settings.empty()) { QString checkResult; diff --git a/mythtv/programs/mythbackend/mainserver.cpp b/mythtv/programs/mythbackend/mainserver.cpp index e9cae9bb3e5..fea6690de4f 100644 --- a/mythtv/programs/mythbackend/mainserver.cpp +++ b/mythtv/programs/mythbackend/mainserver.cpp @@ -717,10 +717,10 @@ void MainServer::ProcessRequestWork(MythSocket *sock) } else if (command == "MESSAGE") { - if ((listline.size() >= 2) && (listline[1].left(11) == "SET_VERBOSE")) + if ((listline.size() >= 2) && (listline[1].startsWith("SET_VERBOSE"))) HandleSetVerbose(listline, pbs); else if ((listline.size() >= 2) && - (listline[1].left(13) == "SET_LOG_LEVEL")) + (listline[1].startsWith("SET_LOG_LEVEL"))) HandleSetLogLevel(listline, pbs); else HandleMessage(listline, pbs); @@ -1001,7 +1001,7 @@ void MainServer::customEvent(QEvent *e) broadcast += extra; } - if (me->Message().left(11) == "AUTO_EXPIRE") + if (me->Message().startsWith("AUTO_EXPIRE")) { QStringList tokens = me->Message() .split(" ", QString::SkipEmptyParts); @@ -1041,7 +1041,7 @@ void MainServer::customEvent(QEvent *e) return; } - if (me->Message().left(21) == "QUERY_NEXT_LIVETV_DIR" && m_sched) + if (me->Message().startsWith("QUERY_NEXT_LIVETV_DIR") && m_sched) { QStringList tokens = me->Message() .split(" ", QString::SkipEmptyParts); @@ -1057,8 +1057,8 @@ void MainServer::customEvent(QEvent *e) return; } - if ((me->Message().left(16) == "DELETE_RECORDING") || - (me->Message().left(22) == "FORCE_DELETE_RECORDING")) + if ((me->Message().startsWith("DELETE_RECORDING")) || + (me->Message().startsWith("FORCE_DELETE_RECORDING"))) { QStringList tokens = me->Message() .split(" ", QString::SkipEmptyParts); @@ -1090,14 +1090,14 @@ void MainServer::customEvent(QEvent *e) return; } - if (me->Message().left(21) == "RESCHEDULE_RECORDINGS" && m_sched) + if (me->Message().startsWith("RESCHEDULE_RECORDINGS") && m_sched) { QStringList request = me->ExtraDataList(); m_sched->Reschedule(request); return; } - if (me->Message().left(23) == "SCHEDULER_ADD_RECORDING" && m_sched) + if (me->Message().startsWith("SCHEDULER_ADD_RECORDING") && m_sched) { ProgramInfo pi(me->ExtraDataList()); if (!pi.GetChanID()) @@ -1110,7 +1110,7 @@ void MainServer::customEvent(QEvent *e) return; } - if (me->Message().left(23) == "UPDATE_RECORDING_STATUS" && m_sched) + if (me->Message().startsWith("UPDATE_RECORDING_STATUS") && m_sched) { QStringList tokens = me->Message() .split(" ", QString::SkipEmptyParts); @@ -1131,7 +1131,7 @@ void MainServer::customEvent(QEvent *e) return; } - if (me->Message().left(13) == "LIVETV_EXITED") + if (me->Message().startsWith("LIVETV_EXITED")) { QString chainid = me->ExtraData(); LiveTVChain *chain = GetExistingChain(chainid); @@ -1144,7 +1144,7 @@ void MainServer::customEvent(QEvent *e) if (me->Message() == "CLEAR_SETTINGS_CACHE") gCoreContext->ClearSettingsCache(); - if (me->Message().left(14) == "RESET_IDLETIME" && m_sched) + if (me->Message().startsWith("RESET_IDLETIME") && m_sched) m_sched->ResetIdleTime(); if (me->Message() == "LOCAL_RECONNECT_TO_MASTER") @@ -1153,11 +1153,11 @@ void MainServer::customEvent(QEvent *e) if (me->Message() == "LOCAL_SLAVE_BACKEND_ENCODERS_OFFLINE") HandleSlaveDisconnectedEvent(*me); - if (me->Message().left(6) == "LOCAL_") + if (me->Message().startsWith("LOCAL_")) return; MythEvent mod_me(""); - if (me->Message().left(23) == "MASTER_UPDATE_PROG_INFO") + if (me->Message().startsWith("MASTER_UPDATE_PROG_INFO")) { QStringList tokens = me->Message().simplified().split(" "); uint chanid = 0; @@ -1188,7 +1188,7 @@ void MainServer::customEvent(QEvent *e) } } - if (me->Message().left(13) == "DOWNLOAD_FILE") + if (me->Message().startsWith("DOWNLOAD_FILE")) { QStringList extraDataList = me->ExtraDataList(); QString localFile = extraDataList[1]; @@ -1230,7 +1230,7 @@ void MainServer::customEvent(QEvent *e) sockListLock.unlock(); bool sendGlobal = false; - if (ismaster && broadcast[1].left(7) == "GLOBAL_") + if (ismaster && broadcast[1].startsWith("GLOBAL_")) { broadcast[1].replace("GLOBAL_", "LOCAL_"); MythEvent me(broadcast[1], broadcast[2]); @@ -4483,7 +4483,7 @@ void MainServer::BackendQueryDiskSpace(QStringList &strlist, bool consolidated, * value using QString::fromUtf8() to prevent corruption. */ currentDir = QString::fromUtf8(query.value(1) .toByteArray().constData()); - if (currentDir.right(1) == "/") + if (currentDir.endsWith("/")) currentDir.remove(currentDir.length() - 1, 1); checkDir.setPath(currentDir); @@ -6130,14 +6130,14 @@ QString MainServer::LocalFilePath(const QUrl &url, const QString &wantgroup) lpath = lpath.section('/', -1); QString fpath = lpath; - if (fpath.right(4) == ".png") + if (fpath.endsWith(".png")) fpath = fpath.left(fpath.length() - 4); ProgramInfo pginfo(fpath); if (pginfo.GetChanID()) { QString pburl = GetPlaybackURL(&pginfo); - if (pburl.left(1) == "/") + if (pburl.startsWith("/")) { lpath = pburl.section('/', 0, -2) + "/" + lpath; LOG(VB_FILE, LOG_INFO, diff --git a/mythtv/programs/mythbackend/services/content.cpp b/mythtv/programs/mythbackend/services/content.cpp index 97fabe0bc04..c0c591e8808 100644 --- a/mythtv/programs/mythbackend/services/content.cpp +++ b/mythtv/programs/mythbackend/services/content.cpp @@ -493,7 +493,7 @@ QFileInfo Content::GetPreviewImage( int nChanId, // ------------------------------------------------------------------ // Must generate Preview Image, Generate Image and save. // ------------------------------------------------------------------ - if (!pginfo.IsLocal() && sFileName.left(1) == "/") + if (!pginfo.IsLocal() && sFileName.startsWith("/")) pginfo.SetPathname(sFileName); if (!pginfo.IsLocal()) diff --git a/mythtv/programs/mythcommflag/CommDetector2.cpp b/mythtv/programs/mythcommflag/CommDetector2.cpp index 76a74c380d8..002ac40885b 100644 --- a/mythtv/programs/mythcommflag/CommDetector2.cpp +++ b/mythtv/programs/mythcommflag/CommDetector2.cpp @@ -223,7 +223,7 @@ QString debugDirectory(int chanid, const QDateTime& recstartts) return ""; QString pburl = pginfo.GetPlaybackURL(true); - if (pburl.left(1) != "/") + if (!pburl.startsWith("/")) return ""; QString basename(query.value(0).toString()); diff --git a/mythtv/programs/mythfilldatabase/xmltvparser.cpp b/mythtv/programs/mythfilldatabase/xmltvparser.cpp index f7830106732..18430ade370 100644 --- a/mythtv/programs/mythfilldatabase/xmltvparser.cpp +++ b/mythtv/programs/mythfilldatabase/xmltvparser.cpp @@ -85,7 +85,7 @@ ChannelInfo *XMLTVParser::parseChannel(QDomElement &element, QUrl &baseUrl) { QString base = baseUrl.toString(QUrl::StripTrailingSlash); chaninfo->icon = base + - ((path.left(1) == "/") ? path : QString("/") + path); + ((path.startsWith("/")) ? path : QString("/") + path); } else if (!path.isEmpty()) { diff --git a/mythtv/programs/mythfrontend/globalsettings.cpp b/mythtv/programs/mythfrontend/globalsettings.cpp index 36bf5b9ca7d..293153b400c 100644 --- a/mythtv/programs/mythfrontend/globalsettings.cpp +++ b/mythtv/programs/mythfrontend/globalsettings.cpp @@ -920,7 +920,7 @@ void PlaybackProfileConfig::Save(void) void PlaybackProfileConfig::pressed(QString cmd) { - if (cmd.left(4) == "edit") + if (cmd.startsWith("edit")) { uint i = cmd.mid(4).toUInt(); PlaybackProfileItemConfig itemcfg(items[i]); @@ -931,7 +931,7 @@ void PlaybackProfileConfig::pressed(QString cmd) InitLabel(i); needs_save = true; } - else if (cmd.left(3) == "del") + else if (cmd.startsWith("del")) { uint i = cmd.mid(3).toUInt(); del_items.push_back(items[i]); diff --git a/mythtv/programs/mythfrontend/idlescreen.cpp b/mythtv/programs/mythfrontend/idlescreen.cpp index 8a1d98c0dc7..ec50a993197 100644 --- a/mythtv/programs/mythfrontend/idlescreen.cpp +++ b/mythtv/programs/mythfrontend/idlescreen.cpp @@ -142,13 +142,13 @@ void IdleScreen::customEvent(QEvent* event) { MythEvent *me = static_cast(event); - if (me->Message().left(18) == "SHUTDOWN_COUNTDOWN") + if (me->Message().startsWith("SHUTDOWN_COUNTDOWN")) { QString secs = me->Message().mid(19); m_secondsToShutdown = secs.toInt(); UpdateStatus(); } - else if (me->Message().left(12) == "SHUTDOWN_NOW") + else if (me->Message().startsWith("SHUTDOWN_NOW")) { if (gCoreContext->IsFrontendOnly()) { diff --git a/mythtv/programs/mythfrontend/main.cpp b/mythtv/programs/mythfrontend/main.cpp index 2a13d60cf86..dfd6d34558c 100644 --- a/mythtv/programs/mythfrontend/main.cpp +++ b/mythtv/programs/mythfrontend/main.cpp @@ -775,7 +775,7 @@ static void TVMenuCallback(void *data, QString &selection) (void)data; QString sel = selection.toLower(); - if (sel.left(9) == "settings ") + if (sel.startsWith("settings ")) { GetMythUI()->AddCurrentLocation("Setup"); gCoreContext->ActivateSettingsCache(false); @@ -786,7 +786,7 @@ static void TVMenuCallback(void *data, QString &selection) startTVNormal(); else if (sel == "tv_watch_live_epg") startTVInGuide(); - else if (sel.left(18) == "tv_watch_recording") + else if (sel.startsWith("tv_watch_recording")) { // use selection here because its case is untouched if ((selection.length() > 19) && (selection.mid(18, 1) == " ")) @@ -1000,7 +1000,7 @@ static void TVMenuCallback(void *data, QString &selection) else LOG(VB_GENERAL, LOG_ERR, "Unknown menu action: " + selection); - if (sel.left(9) == "settings " || sel == "video_settings_general") + if (sel.startsWith("settings ") || sel == "video_settings_general") { GetMythUI()->RemoveCurrentLocation(); diff --git a/mythtv/programs/mythfrontend/networkcontrol.cpp b/mythtv/programs/mythfrontend/networkcontrol.cpp index 18fa2a16990..1b03165b4e4 100644 --- a/mythtv/programs/mythfrontend/networkcontrol.cpp +++ b/mythtv/programs/mythfrontend/networkcontrol.cpp @@ -1257,7 +1257,7 @@ void NetworkControl::customEvent(QEvent *e) MythEvent *me = (MythEvent *)e; QString message = me->Message(); - if (message.left(13) == "MUSIC_CONTROL") + if (message.startsWith("MUSIC_CONTROL")) { QStringList tokens = message.simplified().split(" "); if ((tokens.size() >= 4) && @@ -1271,7 +1271,7 @@ void NetworkControl::customEvent(QEvent *e) } } - else if (message.left(15) == "NETWORK_CONTROL") + else if (message.startsWith("NETWORK_CONTROL")) { QStringList tokens = message.simplified().split(" "); if ((tokens.size() >= 3) && diff --git a/mythtv/programs/mythfrontend/playbackbox.cpp b/mythtv/programs/mythfrontend/playbackbox.cpp index ff618ce2635..af4af854d59 100644 --- a/mythtv/programs/mythfrontend/playbackbox.cpp +++ b/mythtv/programs/mythfrontend/playbackbox.cpp @@ -3884,7 +3884,7 @@ void PlaybackBox::customEvent(QEvent *event) MythEvent *me = (MythEvent *)event; QString message = me->Message(); - if (message.left(21) == "RECORDING_LIST_CHANGE") + if (message.startsWith("RECORDING_LIST_CHANGE")) { QStringList tokens = message.simplified().split(" "); uint chanid = 0; @@ -3920,7 +3920,7 @@ void PlaybackBox::customEvent(QEvent *event) m_programInfoCache.ScheduleLoad(); } } - else if (message.left(15) == "NETWORK_CONTROL") + else if (message.startsWith("NETWORK_CONTROL")) { QStringList tokens = message.simplified().split(" "); if ((tokens[1] != "ANSWER") && (tokens[1] != "RESPONSE")) @@ -3948,7 +3948,7 @@ void PlaybackBox::customEvent(QEvent *event) keyevent); } } - else if (message.left(16) == "UPDATE_FILE_SIZE") + else if (message.startsWith("UPDATE_FILE_SIZE")) { QStringList tokens = message.simplified().split(" "); bool ok = false; diff --git a/mythtv/programs/mythfrontend/progfind.cpp b/mythtv/programs/mythfrontend/progfind.cpp index 222e9e5ac54..436931117c7 100644 --- a/mythtv/programs/mythfrontend/progfind.cpp +++ b/mythtv/programs/mythfrontend/progfind.cpp @@ -670,13 +670,13 @@ bool ProgFinder::formatSelectedData(QString& data) if (searchChar == "T") { - if (data.left(4) != "The " && data.left(2) != "A ") + if (!data.startsWith("The ") && !data.startsWith("A ")) { // nothing, use as is } - else if (data.left(5) == "The T") + else if (data.startsWith("The T")) data = data.mid(4) + ", The"; - else if (data.left(3) == "A T") + else if (data.startsWith("A T")) data = data.mid(2) + ", A"; else { @@ -686,15 +686,15 @@ bool ProgFinder::formatSelectedData(QString& data) } else if (searchChar == "A") { - if (data.left(4) != "The " && data.left(2) != "A ") + if (!data.startsWith("The ") && !data.startsWith("A ")) { // nothing, use as is } - else if (data.left(5) == "The A") + else if (data.startsWith("The A")) data = data.mid(4) + ", The"; - else if (data.left(3) == "A A") + else if (data.startsWith("A A")) data = data.mid(2) + ", A"; - else if (data.left(4) == "An A") + else if (data.startsWith("An A")) data = data.mid(3) + ", An"; else { @@ -704,11 +704,11 @@ bool ProgFinder::formatSelectedData(QString& data) } else { - if (data.left(4) == "The ") + if (data.startsWith("The ")) data = data.mid(4) + ", The"; - else if (data.left(2) == "A ") + else if (data.startsWith("A ")) data = data.mid(2) + ", A"; - else if (data.left(3) == "An ") + else if (data.startsWith("An ")) data = data.mid(3) + ", An"; } @@ -721,17 +721,17 @@ bool ProgFinder::formatSelectedData(QString& data, int charNum) if (charNum == 29 || charNum == 10) { - if (data.left(5) == "The T" && charNum == 29) + if (data.startsWith("The T") && charNum == 29) data = data.mid(4) + ", The"; - else if (data.left(5) == "The A" && charNum == 10) + else if (data.startsWith("The A") && charNum == 10) data = data.mid(4) + ", The"; - else if (data.left(3) == "A T" && charNum == 29) + else if (data.startsWith("A T") && charNum == 29) data = data.mid(2) + ", A"; - else if (data.left(3) == "A A" && charNum == 10) + else if (data.startsWith("A A") && charNum == 10) data = data.mid(2) + ", A"; - else if (data.left(4) == "An A" && charNum == 10) + else if (data.startsWith("An A") && charNum == 10) data = data.mid(3) + ", An"; - else if (data.left(4) != "The " && data.left(2) != "A ") + else if (!data.startsWith("The ") && !data.startsWith("A ")) { // use as is } @@ -743,11 +743,11 @@ bool ProgFinder::formatSelectedData(QString& data, int charNum) } else { - if (data.left(4) == "The ") + if (data.startsWith("The ")) data = data.mid(4) + ", The"; - if (data.left(2) == "A ") + if (data.startsWith("A ")) data = data.mid(2) + ", A"; - if (data.left(3) == "An ") + if (data.startsWith("An ")) data = data.mid(3) + ", An"; } @@ -756,9 +756,9 @@ bool ProgFinder::formatSelectedData(QString& data, int charNum) void ProgFinder::restoreSelectedData(QString &data) { - if (data.right(5) == ", The") + if (data.endsWith(", The")) data = "The " + data.left(data.length() - 5); - if (data.right(3) == ", A") + if (data.endsWith(", A")) data = "A " + data.left(data.length() - 3); } diff --git a/mythtv/programs/mythfrontend/upnpscanner.cpp b/mythtv/programs/mythfrontend/upnpscanner.cpp index e475621aa41..b1d8c37d534 100644 --- a/mythtv/programs/mythfrontend/upnpscanner.cpp +++ b/mythtv/programs/mythfrontend/upnpscanner.cpp @@ -1275,15 +1275,15 @@ bool UPNPScanner::ParseDescription(const QUrl &url, QNetworkReply *reply) QUrl::RemoveQuery); // strip leading slashes off the controlURL - while (!controlURL.isEmpty() && controlURL.left(1) == "/") + while (!controlURL.isEmpty() && controlURL.startsWith("/")) controlURL = controlURL.mid(1); // strip leading slashes off the eventURL - //while (!eventURL.isEmpty() && eventURL.left(1) == "/") + //while (!eventURL.isEmpty() && eventURL.startsWith("/")) // eventURL = eventURL.mid(1); // strip trailing slashes off URLBase - while (!URLBase.isEmpty() && URLBase.right(1) == "/") + while (!URLBase.isEmpty() && URLBase.endsWith("/")) URLBase = URLBase.mid(0, URLBase.size() - 1); controlURL = URLBase + "/" + controlURL; diff --git a/mythtv/programs/mythfrontend/videolist.cpp b/mythtv/programs/mythfrontend/videolist.cpp index 0cd21e528b0..818d2cc80c0 100644 --- a/mythtv/programs/mythfrontend/videolist.cpp +++ b/mythtv/programs/mythfrontend/videolist.cpp @@ -211,7 +211,7 @@ static QString path_to_node_name(const QString &path) { QString ret; int slashLoc = path.lastIndexOf('/', -2) + 1; - if (path.right(1) == "/") + if (path.endsWith("/")) ret = path.mid(slashLoc, path.length() - slashLoc - 1); else ret = path.mid(slashLoc); diff --git a/mythtv/programs/mythlcdserver/lcdprocclient.cpp b/mythtv/programs/mythlcdserver/lcdprocclient.cpp index b62365ac61b..2d29128c390 100644 --- a/mythtv/programs/mythlcdserver/lcdprocclient.cpp +++ b/mythtv/programs/mythlcdserver/lcdprocclient.cpp @@ -2438,7 +2438,7 @@ void LCDProcClient::customEvent(QEvent *e) { MythEvent *me = (MythEvent *) e; - if (me->Message().left(21) == "RECORDING_LIST_CHANGE" || + if (me->Message().startsWith("RECORDING_LIST_CHANGE") || me->Message() == "UPDATE_PROG_INFO") { if (lcd_showrecstatus && !updateRecInfoTimer->isActive()) diff --git a/mythtv/programs/mythtranscode/main.cpp b/mythtv/programs/mythtranscode/main.cpp index f20a1b09bc3..347f20f3196 100644 --- a/mythtv/programs/mythtranscode/main.cpp +++ b/mythtv/programs/mythtranscode/main.cpp @@ -541,7 +541,7 @@ int main(int argc, char *argv[]) return QueueTranscodeJob(pginfo, profilename, hostname, useCutlist); } - if (infile.left(7) == "myth://" && (outfile.isEmpty() || outfile != "-") && + if (infile.startsWith("myth://") && (outfile.isEmpty() || outfile != "-") && fifodir.isEmpty() && !cmdline.toBool("hls") && !cmdline.toBool("avf")) { LOG(VB_GENERAL, LOG_ERR, diff --git a/mythtv/programs/mythtranscode/transcode.cpp b/mythtv/programs/mythtranscode/transcode.cpp index 45b94b98bf5..b6b0a4ea0f9 100644 --- a/mythtv/programs/mythtranscode/transcode.cpp +++ b/mythtv/programs/mythtranscode/transcode.cpp @@ -644,7 +644,7 @@ int Transcode::TranscodeFile(const QString &inputname, } } - if (encodingType.left(4).toLower() == "mpeg") + if (encodingType.startsWith("mpeg", Qt::CaseInsensitive)) { // make sure dimensions are valid for MPEG codecs newHeight = (newHeight + 15) & ~0xF; diff --git a/mythtv/programs/mythwelcome/welcomedialog.cpp b/mythtv/programs/mythwelcome/welcomedialog.cpp index 89d42639bbc..f092608c58c 100644 --- a/mythtv/programs/mythwelcome/welcomedialog.cpp +++ b/mythtv/programs/mythwelcome/welcomedialog.cpp @@ -149,7 +149,7 @@ void WelcomeDialog::customEvent(QEvent *e) { MythEvent *me = (MythEvent *) e; - if (me->Message().left(21) == "RECORDING_LIST_CHANGE" || + if (me->Message().startsWith("RECORDING_LIST_CHANGE") || me->Message() == "UPDATE_PROG_INFO") { LOG(VB_GENERAL, LOG_NOTICE, @@ -169,7 +169,7 @@ void WelcomeDialog::customEvent(QEvent *e) setPendingRecListUpdate(true); } } - else if (me->Message().left(15) == "SCHEDULE_CHANGE") + else if (me->Message().startsWith("SCHEDULE_CHANGE")) { LOG(VB_GENERAL, LOG_NOTICE, "MythWelcome received a SCHEDULE_CHANGE event"); @@ -187,7 +187,7 @@ void WelcomeDialog::customEvent(QEvent *e) setPendingSchedUpdate(true); } } - else if (me->Message().left(18) == "SHUTDOWN_COUNTDOWN") + else if (me->Message().startsWith("SHUTDOWN_COUNTDOWN")) { #if 0 LOG(VB_GENERAL, LOG_NOTICE, @@ -198,7 +198,7 @@ void WelcomeDialog::customEvent(QEvent *e) updateStatusMessage(); updateScreen(); } - else if (me->Message().left(12) == "SHUTDOWN_NOW") + else if (me->Message().startsWith("SHUTDOWN_NOW")) { LOG(VB_GENERAL, LOG_NOTICE, "MythWelcome received a SHUTDOWN_NOW event");