Ticket #11536: startsendswith.patch

File startsendswith.patch, 81.7 KB (added by Jim Stichnoth, 12 years ago)
  • mythplugins/mytharchive/mytharchivehelper/main.cpp

    diff --git a/mythplugins/mytharchive/mytharchivehelper/main.cpp b/mythplugins/mytharchive/mytharchivehelper/main.cpp
    index df4b201..c326d64 100644
    a b static int grabThumbnail(QString inFile, QString thumbList, QString outFile, int 
    17281728                {
    17291729                    // work out what format to save to
    17301730                    QString saveFormat = "JPEG";
    1731                     if (outFile.right(4) == ".png")
     1731                    if (outFile.endsWith(".png"))
    17321732                        saveFormat = "PNG";
    17331733
    17341734                    int count = 0;
  • mythplugins/mythgame/mythgame/gamehandler.cpp

    diff --git a/mythplugins/mythgame/mythgame/gamehandler.cpp b/mythplugins/mythgame/mythgame/gamehandler.cpp
    index 54d873d..ef61987 100644
    a b static void UpdateGameCounts(QStringList updatelist) 
    337337                        pos = (RomName.length() - extlength) - 1;
    338338                        basename = RomName.left(pos);
    339339
    340                         if (basename.right(1) == ".")
     340                        if (basename.endsWith("."))
    341341                            basename = RomName.left(pos - 1);
    342342                    }
    343343                    else
  • mythplugins/mythmusic/mythmusic/cddecoder.cpp

    diff --git a/mythplugins/mythmusic/mythmusic/cddecoder.cpp b/mythplugins/mythmusic/mythmusic/cddecoder.cpp
    index ac793b2..9e69977 100644
    a b MusicMetadata *CdDecoder::getMetadata() 
    767767        }
    768768    }
    769769
    770     if (compilation_artist.toLower().left(7) == "various")
     770    if (compilation_artist.startsWith("various", Qt::CaseInsensitive))
    771771        compilation_artist = QObject::tr("Various Artists");
    772772
    773773    if (artist.isEmpty())
  • mythplugins/mythmusic/mythmusic/musicplayer.cpp

    diff --git a/mythplugins/mythmusic/mythmusic/musicplayer.cpp b/mythplugins/mythmusic/mythmusic/musicplayer.cpp
    index b2b075b..6f83ee6 100644
    a b void MusicPlayer::customEvent(QEvent *event) 
    576576        if (!me)
    577577            return;
    578578
    579         if (me->Message().left(14) == "PLAYBACK_START")
     579        if (me->Message().startsWith("PLAYBACK_START"))
    580580        {
    581581            m_wasPlaying = m_isPlaying;
    582582            QString hostname = me->Message().mid(15);
    void MusicPlayer::customEvent(QEvent *event) 
    588588                stop(true);
    589589            }
    590590        }
    591         else if (me->Message().left(12) == "PLAYBACK_END")
     591        else if (me->Message().startsWith("PLAYBACK_END"))
    592592        {
    593593            if (m_wasPlaying)
    594594            {
    void MusicPlayer::customEvent(QEvent *event) 
    605605                m_wasPlaying = false;
    606606            }
    607607        }
    608         else if (me->Message().left(13) == "MUSIC_COMMAND")
     608        else if (me->Message().startsWith("MUSIC_COMMAND"))
    609609        {
    610610            QStringList list = me->Message().simplified().split(' ');
    611611
  • mythplugins/mythmusic/mythmusic/shoutcast.cpp

    diff --git a/mythplugins/mythmusic/mythmusic/shoutcast.cpp b/mythplugins/mythmusic/mythmusic/shoutcast.cpp
    index 065e35c..11e1fd2 100644
    a b class ShoutCastResponse 
    186186    QString getGenre(void) { return getString("icy-genre"); }
    187187    QString getName(void) { return getString("icy-name"); }
    188188    int getStatus(void) { return getInt("status"); }
    189     bool isICY(void) { return QString(m_data["protocol"]).left(3) == "ICY"; }
     189    bool isICY(void) { return QString(m_data["protocol"]).startsWith("ICY"); }
    190190    QString getContent(void) { return getString("content-type"); }
    191191    QString getLocation(void) { return getString("location"); }
    192192
    int ShoutCastResponse::fillResponse(const char *s, int l) 
    215215            break;
    216216
    217217        // Extract the line
    218         QByteArray snip(d.data(), pos + 1);
     218        QString snip(QByteArray(d.data(), pos + 1));
    219219        d.remove(0, pos + 2);
    220220        result += pos + 2;
    221221
    222         if (snip.left(4) == "ICY ")
     222        if (snip.startsWith("ICY "))
    223223        {
    224224            int space = snip.indexOf(' ');
    225225            m_data["protocol"] = "ICY";
    int ShoutCastResponse::fillResponse(const char *s, int l) 
    230230            else
    231231                m_data["status"] = tmp;
    232232        }
    233         else if (snip.left(7) == "HTTP/1.")
     233        else if (snip.startsWith("HTTP/1."))
    234234        {
    235235            int space = snip.indexOf(' ');
    236236            m_data["protocol"] = snip.left(space);
    int ShoutCastResponse::fillResponse(const char *s, int l) 
    241241            else
    242242                m_data["status"] = tmp;
    243243        }
    244         else if (snip.left(9).toLower() == "location:")
     244        else if (snip.startsWith("location:", Qt::CaseInsensitive))
    245245        {
    246246            m_data["location"] = snip.mid(9).trimmed();
    247247        }
    248         else if (snip.left(13).toLower() == "content-type:")
     248        else if (snip.startsWith("content-type:", Qt::CaseInsensitive))
    249249        {
    250250            m_data["content-type"] = snip.mid(13).trimmed();
    251251        }
    252         else if (snip.left(4) == "icy-")
     252        else if (snip.startsWith("icy-"))
    253253        {
    254254            int pos = snip.indexOf(':');
    255255            QString key = snip.left(pos);
  • mythplugins/mythmusic/mythmusic/smartplaylist.cpp

    diff --git a/mythplugins/mythmusic/mythmusic/smartplaylist.cpp b/mythplugins/mythmusic/mythmusic/smartplaylist.cpp
    index 78b2cb0..e34a9d8 100644
    a b QString getOrderBySQL(QString orderByFields) 
    254254        Field = lookupField(fieldName.left(fieldName.length() - 4));
    255255        if (Field)
    256256        {
    257             if (fieldName.right(3) == "(D)")
     257            if (fieldName.endsWith("(D)"))
    258258                order = " DESC";
    259259            else
    260260                order = " ASC";
    void SmartPLOrderByDialog::orderByChanged(void) 
    20302030        m_deleteButton->SetEnabled(true);
    20312031        m_moveUpButton->SetEnabled((m_fieldList->GetCurrentPos() != 0));
    20322032        m_moveDownButton->SetEnabled((m_fieldList->GetCurrentPos() != m_fieldList->GetCount() - 1) );
    2033         m_ascendingButton->SetEnabled((m_fieldList->GetValue().right(3) == "(D)") );
    2034         m_descendingButton->SetEnabled((m_fieldList->GetValue().right(3) == "(A)"));
     2033        m_ascendingButton->SetEnabled((m_fieldList->GetValue().endsWith("(D)")) );
     2034        m_descendingButton->SetEnabled((m_fieldList->GetValue().endsWith("(A)")));
    20352035    }
    20362036    else
    20372037    {
  • mythplugins/mythzoneminder/mythzoneminder/zmconsole.cpp

    diff --git a/mythplugins/mythzoneminder/mythzoneminder/zmconsole.cpp b/mythplugins/mythzoneminder/mythzoneminder/zmconsole.cpp
    index 6a0cf01..ac01fec 100644
    a b void ZMConsole::getDaemonStatus(void) 
    206206    {
    207207        zm->getServerStatus(m_daemonStatus, m_cpuStat, m_diskStat);
    208208
    209         if (m_daemonStatus.left(7) == "running")
     209        if (m_daemonStatus.startsWith("running"))
    210210        {
    211211            m_status_text->SetFontState("running");
    212212            m_status_text->SetText(tr("Running"));
  • mythtv/libs/libmyth/programinfo.cpp

    diff --git a/mythtv/libs/libmyth/programinfo.cpp b/mythtv/libs/libmyth/programinfo.cpp
    index 968a85c..36803b7 100644
    a b ProgramInfo::ProgramInfo(const QString &_pathname, 
    866866
    867867    QString pn = _pathname;
    868868    if ((!_pathname.startsWith("myth://")) &&
    869         (_pathname.right(4).toLower() == ".iso" ||
    870          _pathname.right(4).toLower() == ".img" ||
     869        (_pathname.endsWith(".iso", Qt::CaseInsensitive) ||
     870         _pathname.endsWith(".img", Qt::CaseInsensitive) ||
    871871         QDir(_pathname + "/VIDEO_TS").exists()))
    872872    {
    873873        pn = QString("dvd:%1").arg(_pathname);
    void ProgramInfo::ToMap(InfoMap &progMap, 
    16761676        progMap["yearstars"] = "";
    16771677
    16781678    if (!originalAirDate.isValid() ||
    1679         (!programid.isEmpty() && (programid.left(2) == "MV")))
     1679        (!programid.isEmpty() && programid.startsWith("MV")))
    16801680    {
    16811681        progMap["originalairdate"] = "";
    16821682        progMap["shortoriginalairdate"] = "";
    static ProgramInfoType discover_program_info_type( 
    21762176        if (fn_lower.startsWith("dvd:") ||
    21772177            fn_lower.endsWith(".iso") ||
    21782178            fn_lower.endsWith(".img") ||
    2179             ((pathname.left(1) == "/") &&
     2179            ((pathname.startsWith("/")) &&
    21802180             QDir(pathname + "/VIDEO_TS").exists()))
    21812181        {
    21822182            pit = kProgramInfoTypeVideoDVD;
    21832183        }
    21842184        else if (fn_lower.startsWith("bd:") ||
    2185                  ((pathname.left(1) == "/") &&
     2185                 ((pathname.startsWith("/")) &&
    21862186                  QDir(pathname + "/BDMV").exists()))
    21872187        {
    21882188            pit = kProgramInfoTypeVideoBD;
    QString ProgramInfo::DiscoverRecordingDirectory(void) const 
    41074107            return "";
    41084108
    41094109        QString path = GetPlaybackURL(false, true);
    4110         if (path.left(1) == "/")
     4110        if (path.startsWith("/"))
    41114111        {
    41124112            QFileInfo testFile(path);
    41134113            return testFile.path();
    QString ProgramInfo::i18n(const QString &msg) 
    45084508void ProgramInfo::SubstituteMatches(QString &str)
    45094509{
    45104510    QString pburl = GetPlaybackURL(false, true);
    4511     if (pburl.left(7) == "myth://")
     4511    if (pburl.startsWith("myth://"))
    45124512    {
    45134513        str.replace(QString("%DIR%"), pburl);
    45144514    }
  • mythtv/libs/libmyth/programinfo.h

    diff --git a/mythtv/libs/libmyth/programinfo.h b/mythtv/libs/libmyth/programinfo.h
    index 6e8e263..5402aad 100644
    a b class MPUBLIC ProgramInfo 
    320320        { return GetProgramInfoType() == kProgramInfoTypeVideoDVD; }
    321321    bool IsVideoBD(void) const
    322322        { return GetProgramInfoType() == kProgramInfoTypeVideoBD; }
    323     bool IsLocal(void) const { return pathname.left(1) == "/"
     323    bool IsLocal(void) const { return pathname.startsWith("/")
    324324#ifdef _WIN32
    325325        || pathname.at(1) == ':'
    326326#endif
    327327            ; }
    328     bool IsMythStream(void) const { return pathname.left(7) == "myth://"; }
     328    bool IsMythStream(void) const { return pathname.startsWith("myth://"); }
    329329    bool IsPathSet(void) const { return GetBasename() != pathname; }
    330330    bool HasPathname(void) const { return !GetPathname().isEmpty(); }
    331331    bool IsFileReadable(void) const;
  • mythtv/libs/libmyth/schemawizard.cpp

    diff --git a/mythtv/libs/libmyth/schemawizard.cpp b/mythtv/libs/libmyth/schemawizard.cpp
    index 13f30fb..8b6870d 100644
    a b SchemaUpgradeWizard::PromptForUpgrade(const char *name, 
    425425    if (m_expertMode)
    426426    {
    427427        resp = getResponse("Would you like to use the existing schema?", "yes");
    428         if (resp.isEmpty() || resp.left(1).toLower() == "y")
     428        if (resp.isEmpty() || resp.startsWith("y", Qt::CaseInsensitive))
    429429            return MYTH_SCHEMA_USE_EXISTING;
    430430    }
    431431
    432432    resp = getResponse("\nShall I upgrade this database?", "yes");
    433     if (!resp.isEmpty() && resp.left(1).toLower() != "y")
     433    if (!resp.isEmpty() && !resp.startsWith("y", Qt::CaseInsensitive))
    434434        return MYTH_SCHEMA_EXIT;
    435435
    436436    if (connections)
    SchemaUpgradeWizard::PromptForUpgrade(const char *name, 
    441441    {
    442442        resp = getResponse("\nA database backup might be a good idea"
    443443                           "\nAre you sure you want to upgrade?", "no");
    444         if (resp.isEmpty() || resp.left(1).toLower() == "n")
     444        if (resp.isEmpty() || resp.startsWith("n", Qt::CaseInsensitive))
    445445            return MYTH_SCHEMA_EXIT;
    446446    }
    447447
  • mythtv/libs/libmyth/settings.h

    diff --git a/mythtv/libs/libmyth/settings.h b/mythtv/libs/libmyth/settings.h
    index c3ad34c..04bf691 100644
    a b class MPUBLIC BooleanSetting : public Setting 
    441441    virtual void setValue(const QString &newValue)
    442442    {
    443443        setValue((newValue=="1" ||
    444                   newValue.toLower().left(1)=="y" ||
    445                   newValue.toLower().left(1)=="t"));
     444                  newValue.toLower().startsWith("y") ||
     445                  newValue.toLower().startsWith("t")));
    446446    }
    447447
    448448  signals:
  • mythtv/libs/libmyth/storagegroupeditor.cpp

    diff --git a/mythtv/libs/libmyth/storagegroupeditor.cpp b/mythtv/libs/libmyth/storagegroupeditor.cpp
    index fd5afc3..6ab6d99 100644
    a b void StorageGroupEditor::open(QString name) 
    9696        if (name.isEmpty())
    9797            return;
    9898
    99         if (name.right(1) != "/")
     99        if (!name.endsWith("/"))
    100100            name.append("/");
    101101
    102102        MSqlQuery query(MSqlQuery::InitCon());
    void StorageGroupEditor::open(QString name) 
    118118        if (result == SGPopup_CANCEL)
    119119            return;
    120120
    121         if (name.right(1) != "/")
     121        if (!name.endsWith("/"))
    122122            name.append("/");
    123123
    124124        MSqlQuery query(MSqlQuery::InitCon());
    void StorageGroupListEditor::open(QString name) 
    257257{
    258258    lastValue = name;
    259259
    260     if (name.left(28) == "__CREATE_NEW_STORAGE_GROUP__")
     260    if (name.startsWith("__CREATE_NEW_STORAGE_GROUP__"))
    261261    {
    262262        if (name.length() > 28)
    263263        {
    void StorageGroupListEditor::open(QString name) 
    286286void StorageGroupListEditor::doDelete(void)
    287287{
    288288    QString name = listbox->getValue();
    289     if (name.left(28) == "__CREATE_NEW_STORAGE_GROUP__")
     289    if (name.startsWith("__CREATE_NEW_STORAGE_GROUP__"))
    290290        return;
    291291
    292292    bool is_master_host = gCoreContext->IsMasterHost();
  • mythtv/libs/libmythbase/logging.cpp

    diff --git a/mythtv/libs/libmythbase/logging.cpp b/mythtv/libs/libmythbase/logging.cpp
    index de06e4e..6435e5a 100644
    a b int verboseArgParse(QString arg) 
    11201120        option = (*it).toLower();
    11211121        bool reverseOption = false;
    11221122
    1123         if (option != "none" && option.left(2) == "no")
     1123        if (option != "none" && option.startsWith("no"))
    11241124        {
    11251125            reverseOption = true;
    11261126            option = option.right(option.length() - 2);
  • mythtv/libs/libmythbase/mythmiscutil.cpp

    diff --git a/mythtv/libs/libmythbase/mythmiscutil.cpp b/mythtv/libs/libmythbase/mythmiscutil.cpp
    index 7477afb..ff8330a 100644
    a b void wrapList(QStringList &list, int width) 
    959959        QString left   = string.left(width);
    960960        bool inserted  = false;
    961961
    962         while( !inserted && left.right(1) != " " )
     962        while( !inserted && !left.endsWith(" " ))
    963963        {
    964964            if( string.mid(left.size(), 1) == " " )
    965965            {
  • mythtv/libs/libmythbase/plist.cpp

    diff --git a/mythtv/libs/libmythbase/plist.cpp b/mythtv/libs/libmythbase/plist.cpp
    index 5cc2c7d..7429f21 100644
    a b void PList::ParseBinaryPList(const QByteArray &data) 
    233233        .arg(size).arg(data.left(8).data()));
    234234
    235235    // check plist type & version
    236     if ((data.left(6) != MAGIC) ||
     236    if ((!data.startsWith(MAGIC)) ||
    237237        (data.mid(MAGIC_SIZE, VERSION_SIZE) != VERSION))
    238238    {
    239239        LOG(VB_GENERAL, LOG_ERR, LOC + "Unrecognised start sequence. Corrupt?");
  • mythtv/libs/libmythbase/remotefile.cpp

    diff --git a/mythtv/libs/libmythbase/remotefile.cpp b/mythtv/libs/libmythbase/remotefile.cpp
    index 678d546..fa30039 100644
    a b bool RemoteFile::DeleteFile(const QString &url) 
    268268    QString filename = qurl.path();
    269269    QString sgroup   = qurl.userName();
    270270
    271     if (!qurl.fragment().isEmpty() || url.right(1) == "#")
     271    if (!qurl.fragment().isEmpty() || url.endsWith("#"))
    272272        filename = filename + "#" + qurl.fragment();
    273273
    274     if (filename.left(1) == "/")
     274    if (filename.startsWith("/"))
    275275        filename = filename.right(filename.length()-1);
    276276
    277277    if (filename.isEmpty() || sgroup.isEmpty())
    bool RemoteFile::Exists(const QString &url, struct stat *fileinfo) 
    301301    QString filename = qurl.path();
    302302    QString sgroup   = qurl.userName();
    303303
    304     if (!qurl.fragment().isEmpty() || url.right(1) == "#")
     304    if (!qurl.fragment().isEmpty() || url.endsWith("#"))
    305305        filename = filename + "#" + qurl.fragment();
    306306
    307     if (filename.left(1) == "/")
     307    if (filename.startsWith("/"))
    308308        filename = filename.right(filename.length()-1);
    309309
    310310    if (filename.isEmpty())
    QString RemoteFile::GetFileHash(const QString &url) 
    356356    QString hostname = qurl.host();
    357357    QString sgroup   = qurl.userName();
    358358
    359     if (!qurl.fragment().isEmpty() || url.right(1) == "#")
     359    if (!qurl.fragment().isEmpty() || url.endsWith("#"))
    360360        filename = filename + "#" + qurl.fragment();
    361361
    362     if (filename.left(1) == "/")
     362    if (filename.startsWith("/"))
    363363        filename = filename.right(filename.length()-1);
    364364
    365365    if (filename.isEmpty() || sgroup.isEmpty())
    QDateTime RemoteFile::LastModified(const QString &url) 
    651651    QString filename = qurl.path();
    652652    QString sgroup   = qurl.userName();
    653653
    654     if (!qurl.fragment().isEmpty() || url.right(1) == "#")
     654    if (!qurl.fragment().isEmpty() || url.endsWith("#"))
    655655        filename = filename + "#" + qurl.fragment();
    656656
    657     if (filename.left(1) == "/")
     657    if (filename.startsWith("/"))
    658658        filename = filename.right(filename.length()-1);
    659659
    660660    if (filename.isEmpty() || sgroup.isEmpty())
  • mythtv/libs/libmythbase/storagegroup.cpp

    diff --git a/mythtv/libs/libmythbase/storagegroup.cpp b/mythtv/libs/libmythbase/storagegroup.cpp
    index 6682136..1729626 100644
    a b bool StorageGroup::FindDirs(const QString group, const QString hostname, 
    549549                                        .toByteArray().constData());
    550550            dirname.replace(QRegExp("^\\s*"), "");
    551551            dirname.replace(QRegExp("\\s*$"), "");
    552             if (dirname.right(1) == "/")
     552            if (dirname.endsWith("/"))
    553553                dirname.remove(dirname.length() - 1, 1);
    554554
    555555            if (dirlist)
  • mythtv/libs/libmythprotoserver/requesthandler/fileserverhandler.cpp

    diff --git a/mythtv/libs/libmythprotoserver/requesthandler/fileserverhandler.cpp b/mythtv/libs/libmythprotoserver/requesthandler/fileserverhandler.cpp
    index ddaf837..b8ae482 100644
    a b QString FileServerHandler::LocalFilePath(const QUrl &url, 
    9090        lpath = lpath.section('/', -1);
    9191
    9292        QString fpath = lpath;
    93         if (fpath.right(4) == ".png")
     93        if (fpath.endsWith(".png"))
    9494            fpath = fpath.left(fpath.length() - 4);
    9595
    9696        ProgramInfo pginfo(fpath);
    9797        if (pginfo.GetChanID())
    9898        {
    9999            QString pburl = GetPlaybackURL(&pginfo);
    100             if (pburl.left(1) == "/")
     100            if (pburl.startsWith("/"))
    101101            {
    102102                lpath = pburl.section('/', 0, -2) + "/" + lpath;
    103103                LOG(VB_FILE, LOG_INFO,
    QList<FileSystemInfo> FileServerHandler::QueryFileSystems(void) 
    517517                                           .toByteArray().constData());
    518518            disk.setPath(currentDir);
    519519
    520             if (currentDir.right(1) == "/")
     520            if (currentDir.endsWith("/"))
    521521                currentDir.remove(currentDir.length() - 1, 1);
    522522
    523523            checkDir.setPath(currentDir);
  • mythtv/libs/libmythprotoserver/requesthandler/fileserverutil.cpp

    diff --git a/mythtv/libs/libmythprotoserver/requesthandler/fileserverutil.cpp b/mythtv/libs/libmythprotoserver/requesthandler/fileserverutil.cpp
    index 6d5f98a..3e990f0 100644
    a b QString GetPlaybackURL(ProgramInfo *pginfo, bool storePath) 
    5858    else
    5959    {
    6060        result = pginfo->GetPlaybackURL(false, true);
    61         if (storePath && result.left(1) == "/")
     61        if (storePath && result.startsWith("/"))
    6262            recordingPathCache[cacheKey] = result;
    6363    }
    6464
  • mythtv/libs/libmythtv/DVD/dvdringbuffer.cpp

    diff --git a/mythtv/libs/libmythtv/DVD/dvdringbuffer.cpp b/mythtv/libs/libmythtv/DVD/dvdringbuffer.cpp
    index 2932cd8..c1202ed 100644
    a b DVDInfo::DVDInfo(const QString &filename) 
    3838{
    3939    LOG(VB_PLAYBACK, LOG_INFO, QString("DVDInfo: Trying %1").arg(filename));
    4040    QString name = filename;
    41     if (name.left(6) == "dvd://")
     41    if (name.startsWith("dvd://"))
    4242        name.remove(0,5);
    43     else if (name.left(5) == "dvd:/")
     43    else if (name.startsWith("dvd:/"))
    4444        name.remove(0,4);
    45     else if (name.left(4) == "dvd:")
     45    else if (name.startsWith("dvd:"))
    4646        name.remove(0,4);
    4747
    4848    QByteArray fname = name.toLocal8Bit();
  • mythtv/libs/libmythtv/cc608decoder.cpp

    diff --git a/mythtv/libs/libmythtv/cc608decoder.cpp b/mythtv/libs/libmythtv/cc608decoder.cpp
    index 3e3b449..a38ed79 100644
    a b void CC608Decoder::FormatCCField(int tc, int field, int data) 
    376376                                len = NewRowCC(mode, len);
    377377
    378378                            if (len == 0 ||
    379                                 ccbuf[mode].left(1) == "\b")
     379                                ccbuf[mode].startsWith("\b"))
    380380                            {
    381381                                ccbuf[mode] += (char)'\b';
    382382                                len++;
    QString CC608Decoder::GetXDS(const QString &key) const 
    11221122
    11231123    if (key == "ratings")
    11241124        return QString::number(GetRatingSystems(false));
    1125     else if (key.left(11) == "has_rating_")
     1125    else if (key.startsWith("has_rating_"))
    11261126        return ((1<<key.right(1).toUInt()) & GetRatingSystems(false))?"1":"0";
    1127     else if (key.left(7) == "rating_")
     1127    else if (key.startsWith("rating_"))
    11281128        return GetRatingString(key.right(1).toUInt(), false);
    11291129
    11301130    else if (key == "future_ratings")
    11311131        return QString::number(GetRatingSystems(true));
    1132     else if (key.left(11) == "has_future_rating_")
     1132    else if (key.startsWith("has_future_rating_"))
    11331133        return ((1<<key.right(1).toUInt()) & GetRatingSystems(true))?"1":"0";
    1134     else if (key.left(14) == "future_rating_")
     1134    else if (key.startsWith("future_rating_"))
    11351135        return GetRatingString(key.right(1).toUInt(), true);
    11361136
    11371137    else if (key == "programname")
  • mythtv/libs/libmythtv/channelscan/channelscanner.cpp

    diff --git a/mythtv/libs/libmythtv/channelscan/channelscanner.cpp b/mythtv/libs/libmythtv/channelscan/channelscanner.cpp
    index 3986991..3d03200 100644
    a b void ChannelScanner::Scan( 
    140140
    141141        // HACK HACK HACK -- begin
    142142        // if using QAM we may need additional time... (at least with HD-3000)
    143         if ((mod.left(3).toLower() == "qam") &&
     143        if ((mod.startsWith("qam", Qt::CaseInsensitive)) &&
    144144            (sigmonScanner->GetSignalTimeout() < 1000))
    145145        {
    146146            sigmonScanner->SetSignalTimeout(1000);
  • mythtv/libs/libmythtv/channelscan/iptvchannelfetcher.cpp

    diff --git a/mythtv/libs/libmythtv/channelscan/iptvchannelfetcher.cpp b/mythtv/libs/libmythtv/channelscan/iptvchannelfetcher.cpp
    index a5a82fd..9e6281c 100644
    a b void IPTVChannelFetcher::SetMessage(const QString &status) 
    210210QString IPTVChannelFetcher::DownloadPlaylist(const QString &url,
    211211                                             bool inQtThread)
    212212{
    213     if (url.left(4).toLower() == "file")
     213    if (url.startsWith("file", Qt::CaseInsensitive))
    214214    {
    215215        QString ret = "";
    216216        QUrl qurl(url);
  • mythtv/libs/libmythtv/decoderbase.cpp

    diff --git a/mythtv/libs/libmythtv/decoderbase.cpp b/mythtv/libs/libmythtv/decoderbase.cpp
    index 2f1933d..f181d2f 100644
    a b int to_track_type(const QString &str) 
    11451145{
    11461146    int ret = -1;
    11471147
    1148     if (str.left(5) == "AUDIO")
     1148    if (str.startsWith("AUDIO"))
    11491149        ret = kTrackTypeAudio;
    1150     else if (str.left(5) == "VIDEO")
     1150    else if (str.startsWith("VIDEO"))
    11511151        ret = kTrackTypeVideo;
    1152     else if (str.left(8) == "SUBTITLE")
     1152    else if (str.startsWith("SUBTITLE"))
    11531153        ret = kTrackTypeSubtitle;
    1154     else if (str.left(5) == "CC608")
     1154    else if (str.startsWith("CC608"))
    11551155        ret = kTrackTypeCC608;
    1156     else if (str.left(5) == "CC708")
     1156    else if (str.startsWith("CC708"))
    11571157        ret = kTrackTypeCC708;
    1158     else if (str.left(3) == "TTC")
     1158    else if (str.startsWith("TTC"))
    11591159        ret = kTrackTypeTeletextCaptions;
    1160     else if (str.left(3) == "TTM")
     1160    else if (str.startsWith("TTM"))
    11611161        ret = kTrackTypeTeletextMenu;
    1162     else if (str.left(3) == "TFL")
     1162    else if (str.startsWith("TFL"))
    11631163        ret = kTrackTypeTextSubtitle;
    1164     else if (str.left(7) == "RAWTEXT")
     1164    else if (str.startsWith("RAWTEXT"))
    11651165        ret = kTrackTypeRawText;
    11661166    return ret;
    11671167}
  • mythtv/libs/libmythtv/fileringbuffer.cpp

    diff --git a/mythtv/libs/libmythtv/fileringbuffer.cpp b/mythtv/libs/libmythtv/fileringbuffer.cpp
    index 6f51aa1..65e15c1 100644
    a b bool FileRingBuffer::OpenFile(const QString &lfilename, uint retry_ms) 
    200200    }
    201201
    202202    bool is_local =
    203         (filename.left(4) != "/dev") &&
    204         ((filename.left(1) == "/") || QFile::exists(filename));
     203        (!filename.startsWith("/dev")) &&
     204        ((filename.startsWith("/")) || QFile::exists(filename));
    205205
    206206    if (is_local)
    207207    {
  • mythtv/libs/libmythtv/jobqueue.cpp

    diff --git a/mythtv/libs/libmythtv/jobqueue.cpp b/mythtv/libs/libmythtv/jobqueue.cpp
    index bfa39ac..b29aa09 100644
    a b void JobQueue::customEvent(QEvent *e) 
    9191        MythEvent *me = (MythEvent *)e;
    9292        QString message = me->Message();
    9393
    94         if (message.left(9) == "LOCAL_JOB")
     94        if (message.startsWith("LOCAL_JOB"))
    9595        {
    9696            // LOCAL_JOB action ID jobID
    9797            // LOCAL_JOB action type chanid recstartts hostname
  • mythtv/libs/libmythtv/mythplayer.cpp

    diff --git a/mythtv/libs/libmythtv/mythplayer.cpp b/mythtv/libs/libmythtv/mythplayer.cpp
    index 7b2b2b0..febd635 100644
    a b void MythPlayer::InitFilters(void) 
    10461046        }
    10471047        else
    10481048        {
    1049             if ((filters.length() > 1) && (filters.right(1) != ","))
     1049            if ((filters.length() > 1) && (!filters.endsWith(",")))
    10501050                filters += ",";
    10511051            filters += videoFiltersForProgram.mid(1);
    10521052        }
  • mythtv/libs/libmythtv/playercontext.cpp

    diff --git a/mythtv/libs/libmythtv/playercontext.cpp b/mythtv/libs/libmythtv/playercontext.cpp
    index 2f9f664..aff3aea 100644
    a b QString PlayerContext::GetFilters(const QString &baseFilters) const 
    747747        }
    748748        else
    749749        {
    750             if (!filters.isEmpty() && (filters.right(1) != ","))
     750            if (!filters.isEmpty() && (!filters.endsWith(",")))
    751751                filters += ",";
    752752
    753753            filters += chanFilters.mid(1);
  • mythtv/libs/libmythtv/previewgenerator.cpp

    diff --git a/mythtv/libs/libmythtv/previewgenerator.cpp b/mythtv/libs/libmythtv/previewgenerator.cpp
    index a5f002c..67b62b8 100644
    a b bool PreviewGenerator::IsLocal(void) const 
    722722{
    723723    QString tmppathname = pathname;
    724724
    725     if (tmppathname.left(4) == "dvd:")
     725    if (tmppathname.startsWith("dvd:"))
    726726        tmppathname = tmppathname.section(":", 1, 1);
    727727
    728728    if (!QFileInfo(tmppathname).isReadable())
    char *PreviewGenerator::GetScreenGrab( 
    779779    }
    780780
    781781    // pre-test local files for existence and size. 500 ms speed-up...
    782     if (filename.left(1)=="/")
     782    if (filename.startsWith("/"))
    783783    {
    784784        QFileInfo info(filename);
    785785        bool invalid = (!info.exists() || !info.isReadable() ||
  • mythtv/libs/libmythtv/previewgeneratorqueue.cpp

    diff --git a/mythtv/libs/libmythtv/previewgeneratorqueue.cpp b/mythtv/libs/libmythtv/previewgeneratorqueue.cpp
    index 2272b17..0f11a22 100644
    a b QString PreviewGeneratorQueue::GeneratePreviewImage( 
    273273    if (!is_special)
    274274    {
    275275        QDateTime previewLastModified;
    276         bool streaming = filename.left(1) != "/";
     276        bool streaming = !filename.startsWith("/");
    277277        bool locally_accessible = false;
    278278        bool bookmark_updated = false;
    279279
  • mythtv/libs/libmythtv/recorders/channelbase.cpp

    diff --git a/mythtv/libs/libmythtv/recorders/channelbase.cpp b/mythtv/libs/libmythtv/recorders/channelbase.cpp
    index 35544fc..eeaddf1 100644
    a b ChannelBase *ChannelBase::CreateChannel( 
    11731173    else if ((genOpt.cardtype == "IMPORT") ||
    11741174             (genOpt.cardtype == "DEMO") ||
    11751175             (genOpt.cardtype == "MPEG" &&
    1176               genOpt.videodev.toLower().left(5) == "file:"))
     1176              genOpt.videodev.toLower().startsWith("file:")))
    11771177    {
    11781178        channel = new DummyChannel(tvrec);
    11791179    }
  • mythtv/libs/libmythtv/recorders/firewiredevice.cpp

    diff --git a/mythtv/libs/libmythtv/recorders/firewiredevice.cpp b/mythtv/libs/libmythtv/recorders/firewiredevice.cpp
    index c9f5f34..c735f21 100644
    a b bool FirewireDevice::SetChannel(const QString &panel_model, 
    230230
    231231    // the PACE is obviously not a Motorola channel changer, but the
    232232    // same commands work for it as the Motorola.
    233     bool is_mot = ((panel_model.toUpper().left(4) == "DCT-") ||
    234                    (panel_model.toUpper().left(4) == "DCH-") ||
    235                    (panel_model.toUpper().left(4) == "DCX-") ||
    236                    (panel_model.toUpper().left(4) == "QIP-") ||
    237                    (panel_model.toUpper().left(4) == "MOTO") ||
    238                    (panel_model.toUpper().left(5) == "PACE-"));
     233    bool is_mot = ((panel_model.toUpper().startsWith("DCT-")) ||
     234                   (panel_model.toUpper().startsWith("DCH-")) ||
     235                   (panel_model.toUpper().startsWith("DCX-")) ||
     236                   (panel_model.toUpper().startsWith("QIP-")) ||
     237                   (panel_model.toUpper().startsWith("MOTO")) ||
     238                   (panel_model.toUpper().startsWith("PACE-")));
    239239
    240240    if (is_mot && !alt_method)
    241241    {
  • mythtv/libs/libmythtv/recorders/mpegrecorder.cpp

    diff --git a/mythtv/libs/libmythtv/recorders/mpegrecorder.cpp b/mythtv/libs/libmythtv/recorders/mpegrecorder.cpp
    index 8a5ff14..46d8e3a 100644
    a b void MpegRecorder::SetOption(const QString &opt, int value) 
    185185    }
    186186    else if (opt == "mpeg2audvolume")
    187187        audvolume = value;
    188     else if (opt.right(16) == "_mpeg4avgbitrate")
     188    else if (opt.endsWith("_mpeg4avgbitrate"))
    189189    {
    190         if (opt.left(3) == "low")
     190        if (opt.startsWith("low"))
    191191            low_mpeg4avgbitrate = value;
    192         else if (opt.left(6) == "medium")
     192        else if (opt.startsWith("medium"))
    193193            medium_mpeg4avgbitrate = value;
    194         else if (opt.left(4) == "high")
     194        else if (opt.startsWith("high"))
    195195            high_mpeg4avgbitrate = value;
    196196        else
    197197            V4LRecorder::SetOption(opt, value);
    198198    }
    199     else if (opt.right(17) == "_mpeg4peakbitrate")
     199    else if (opt.endsWith("_mpeg4peakbitrate"))
    200200    {
    201         if (opt.left(3) == "low")
     201        if (opt.startsWith("low"))
    202202            low_mpeg4peakbitrate = value;
    203         else if (opt.left(6) == "medium")
     203        else if (opt.startsWith("medium"))
    204204            medium_mpeg4peakbitrate = value;
    205         else if (opt.left(4) == "high")
     205        else if (opt.startsWith("high"))
    206206            high_mpeg4peakbitrate = value;
    207207        else
    208208            V4LRecorder::SetOption(opt, value);
    void MpegRecorder::SetOptionsFromProfile(RecordingProfile *profile, 
    296296    (void)audiodev;
    297297    (void)vbidev;
    298298
    299     if (videodev.toLower().left(5) == "file:")
     299    if (videodev.toLower().startsWith("file:"))
    300300    {
    301301        deviceIsMpegFile = true;
    302302        bufferSize = 64000;
    bool MpegRecorder::SetV4L2DeviceOptions(int chanfd) 
    755755    // Set controls
    756756    if (driver != "hdpvr")
    757757    {
    758         if (driver.left(7) != "saa7164")
     758        if (!driver.startsWith("saa7164"))
    759759        {
    760760            add_ext_ctrl(ext_ctrls, V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ,
    761761                         GetFilteredAudioSampleRate());
    bool MpegRecorder::SetV4L2DeviceOptions(int chanfd) 
    783783    }
    784784    maxbitrate = std::max(maxbitrate, bitrate);
    785785
    786     if (driver == "hdpvr" || driver.left(7) == "saa7164")
     786    if (driver == "hdpvr" || driver.startsWith("saa7164"))
    787787    {
    788788        add_ext_ctrl(ext_ctrls, V4L2_CID_MPEG_VIDEO_BITRATE_MODE,
    789789                     (maxbitrate == bitrate) ?
  • mythtv/libs/libmythtv/recorders/v4lchannel.cpp

    diff --git a/mythtv/libs/libmythtv/recorders/v4lchannel.cpp b/mythtv/libs/libmythtv/recorders/v4lchannel.cpp
    index c325e23..1ef7059 100644
    a b static int format_to_mode(const QString &fmt) 
    158158    else if (fmt == "NTSC-JP")
    159159        return V4L2_STD_NTSC_M_JP;
    160160        // generics...
    161     else if (fmt.left(4) == "NTSC")
     161    else if (fmt.startsWith("NTSC"))
    162162        return V4L2_STD_NTSC;
    163     else if (fmt.left(4) == "ATSC")
     163    else if (fmt.startsWith("ATSC"))
    164164        return V4L2_STD_NTSC; // We've dropped V4L ATSC support...
    165     else if (fmt.left(3) == "PAL")
     165    else if (fmt.startsWith("PAL"))
    166166        return V4L2_STD_PAL;
    167167    return V4L2_STD_NTSC;
    168168}
  • mythtv/libs/libmythtv/recordingprofile.cpp

    diff --git a/mythtv/libs/libmythtv/recordingprofile.cpp b/mythtv/libs/libmythtv/recordingprofile.cpp
    index e8060a4..71ed05a 100644
    a b class ImageSize : public VerticalConfigurationGroup 
    11141114        setLabel(labelName);
    11151115
    11161116        QSize defaultsize(768, 576), maxsize(768, 576);
    1117         bool transcoding = profName.left(11) == "Transcoders";
    1118         bool ivtv = profName.left(20) == "IVTV MPEG-2 Encoders";
     1117        bool transcoding = profName.startsWith("Transcoders");
     1118        bool ivtv = profName.startsWith("IVTV MPEG-2 Encoders");
    11191119
    11201120        if (transcoding)
    11211121        {
    class ImageSize : public VerticalConfigurationGroup 
    11251125            else
    11261126                defaultsize = QSize(480, 576);
    11271127        }
    1128         else if (tvFormat.toLower().left(4) == "ntsc")
     1128        else if (tvFormat.toLower().startsWith("ntsc"))
    11291129        {
    11301130            maxsize     = QSize(720, 480);
    11311131            defaultsize = (ivtv) ? QSize(720, 480) : QSize(480, 480);
    RecordingProfile::RecordingProfile(QString profName) 
    12111211
    12121212    if (!profName.isEmpty())
    12131213    {
    1214         if (profName.left(11) == "Transcoders")
     1214        if (profName.startsWith("Transcoders"))
    12151215        {
    12161216            tr_filters = new TranscodeFilters(*this);
    12171217            tr_lossless = new TranscodeLossless(*this);
    void RecordingProfile::CompleteLoad(int profileId, const QString &type, 
    14011401        audioSettings = new AudioCompressionSettings(*this, profileName);
    14021402        addChild(audioSettings);
    14031403
    1404         if (!profileName.isEmpty() && profileName.left(11) == "Transcoders")
     1404        if (!profileName.isEmpty() && profileName.startsWith("Transcoders"))
    14051405        {
    14061406            connect(tr_resize,   SIGNAL(valueChanged   (bool)),
    14071407                    this,        SLOT(  ResizeTranscode(bool)));
  • mythtv/libs/libmythtv/ringbuffer.cpp

    diff --git a/mythtv/libs/libmythtv/ringbuffer.cpp b/mythtv/libs/libmythtv/ringbuffer.cpp
    index 0e3673a..59a9286 100644
    a b RingBuffer *RingBuffer::Create( 
    150150
    151151    if (!stream_only && (dvdurl || dvddir || dvdext))
    152152    {
    153         if (lfilename.left(4) == "dvd:")        // URI "dvd:" + path
     153        if (lfilename.startsWith("dvd:"))        // URI "dvd:" + path
    154154            lfilename.remove(0,4);              // e.g. "dvd:/dev/dvd"
    155155
    156156        if (!(mythurl || QFile::exists(lfilename)))
    RingBuffer *RingBuffer::Create( 
    161161    }
    162162    else if (!stream_only && (bdurl || bddir))
    163163    {
    164         if (lfilename.left(3) == "bd:")        // URI "bd:" + path
     164        if (lfilename.startsWith("bd:"))        // URI "bd:" + path
    165165            lfilename.remove(0,3);             // e.g. "bd:/videos/ET"
    166166
    167167        if (!(mythurl || QFile::exists(lfilename)))
  • mythtv/libs/libmythtv/sourceutil.cpp

    diff --git a/mythtv/libs/libmythtv/sourceutil.cpp b/mythtv/libs/libmythtv/sourceutil.cpp
    index f64d55e..0408cd0 100644
    a b QString SourceUtil::GetChannelSeparator(uint sourceid) 
    8080        {
    8181            const QString channum = query.value(0).toString();
    8282            const int where = channum.indexOf(sepExpr);
    83             if (channum.right(2).left(1) == "0")
     83            if (channum.right(2).startsWith("0"))
    8484                counts["0"]++;
    8585            else
    8686                counts[(where < 0) ? "" : QString(channum.at(where))]++;
    static QStringList get_cardtypes(uint sourceid) 
    190190/// BEGIN HACK HACK HACK -- return correct card type for child cards
    191191            QString cardtype = query.value(0).toString().toUpper();
    192192            QString inputname = query.value(1).toString().toUpper();
    193             cardtype = ((cardtype == "DVB") && (inputname.left(3) != "DVB")) ?
     193            cardtype = ((cardtype == "DVB") && (!inputname.startsWith("DVB"))) ?
    194194                "V4L" : cardtype;
    195195/// END  HACK HACK HACK
    196196            list += cardtype;
  • mythtv/libs/libmythtv/transporteditor.cpp

    diff --git a/mythtv/libs/libmythtv/transporteditor.cpp b/mythtv/libs/libmythtv/transporteditor.cpp
    index 53216ba..f33dc41 100644
    a b class TransportWizard : public ConfigurationWizard 
    6666
    6767static QString pp_modulation(QString mod)
    6868{
    69     if (mod.right(3) == "vsb")
     69    if (mod.endsWith("vsb"))
    7070        return mod.left(mod.length() - 3) + "-VSB";
    7171
    72     if (mod.left(4) == "qam_")
     72    if (mod.startsWith("qam_"))
    7373        return "QAM-" + mod.mid(4, mod.length());
    7474
    7575    if (mod == "analog")
  • mythtv/libs/libmythtv/tv_play.cpp

    diff --git a/mythtv/libs/libmythtv/tv_play.cpp b/mythtv/libs/libmythtv/tv_play.cpp
    index 1575a6c..1d4147d 100644
    a b bool TV::HandleTrackAction(PlayerContext *ctx, const QString &action) 
    36493649            ctx->player->ToggleCaptions();
    36503650        }
    36513651    }
    3652     else if (action.left(6) == "TOGGLE")
     3652    else if (action.startsWith("TOGGLE"))
    36533653    {
    36543654        int type = to_track_type(action.mid(6));
    36553655        if (type == kTrackTypeTeletextMenu)
    bool TV::HandleTrackAction(PlayerContext *ctx, const QString &action) 
    36593659        else
    36603660            handled = false;
    36613661    }
    3662     else if (action.left(6) == "SELECT")
     3662    else if (action.startsWith("SELECT"))
    36633663    {
    36643664        int type = to_track_type(action.mid(6));
    36653665        int num = action.section("_", -1).toInt();
    bool TV::HandleTrackAction(PlayerContext *ctx, const QString &action) 
    36683668        else
    36693669            handled = false;
    36703670    }
    3671     else if (action.left(4) == "NEXT" || action.left(4) == "PREV")
     3671    else if (action.startsWith("NEXT") || action.startsWith("PREV"))
    36723672    {
    3673         int dir = (action.left(4) == "NEXT") ? +1 : -1;
     3673        int dir = (action.startsWith("NEXT")) ? +1 : -1;
    36743674        int type = to_track_type(action.mid(4));
    36753675        if (type >= kTrackTypeAudio)
    36763676            ctx->player->ChangeTrack(type, dir);
    3677         else if (action.right(2) == "CC")
     3677        else if (action.endsWith("CC"))
    36783678            ctx->player->ChangeCaptionTrack(dir);
    36793679        else
    36803680            handled = false;
    void TV::customEvent(QEvent *e) 
    92979297    {
    92989298        GetStatus();
    92999299    }
    9300     else if (message.left(14) == "DONE_RECORDING")
     9300    else if (message.startsWith("DONE_RECORDING"))
    93019301    {
    93029302        int seconds = 0;
    93039303        //long long frames = 0;
    void TV::customEvent(QEvent *e) 
    93589358        ReturnPlayerLock(mctx);
    93599359    }
    93609360
    9361     if (message.left(14) == "ASK_RECORDING ")
     9361    if (message.startsWith("ASK_RECORDING "))
    93629362    {
    93639363        int timeuntil = 0, hasrec = 0, haslater = 0;
    93649364        if (tokens.size() >= 5)
    void TV::customEvent(QEvent *e) 
    93959395        ReturnPlayerLock(mctx);
    93969396    }
    93979397
    9398     if (message.left(11) == "QUIT_LIVETV")
     9398    if (message.startsWith("QUIT_LIVETV"))
    93999399    {
    94009400        cardnum = (tokens.size() >= 2) ? tokens[1].toUInt() : 0;
    94019401
    void TV::customEvent(QEvent *e) 
    94349434        ReturnPlayerLock(mctx);
    94359435    }
    94369436
    9437     if (message.left(12) == "LIVETV_WATCH")
     9437    if (message.startsWith("LIVETV_WATCH"))
    94389438    {
    94399439        int watch = 0;
    94409440        if (tokens.size() >= 3)
    void TV::customEvent(QEvent *e) 
    94759475        ReturnPlayerLock(mctx);
    94769476    }
    94779477
    9478     if (message.left(12) == "LIVETV_CHAIN")
     9478    if (message.startsWith("LIVETV_CHAIN"))
    94799479    {
    94809480        QString id = QString::null;
    94819481        if ((tokens.size() >= 2) && tokens[1] == "UPDATE")
    void TV::customEvent(QEvent *e) 
    94959495        ReturnPlayerLock(mctx);
    94969496    }
    94979497
    9498     if (message.left(12) == "EXIT_TO_MENU")
     9498    if (message.startsWith("EXIT_TO_MENU"))
    94999499    {
    95009500        PlayerContext *mctx = GetPlayerReadLock(0, __FILE__, __LINE__);
    95019501        for (uint i = 0; mctx && (i < player.size()); i++)
    void TV::customEvent(QEvent *e) 
    95109510        ReturnPlayerLock(mctx);
    95119511    }
    95129512
    9513     if (message.left(6) == "SIGNAL")
     9513    if (message.startsWith("SIGNAL"))
    95149514    {
    95159515        cardnum = (tokens.size() >= 2) ? tokens[1].toUInt() : 0;
    95169516        QStringList signalList = me->ExtraDataList();
    void TV::customEvent(QEvent *e) 
    95349534        ReturnPlayerLock(mctx);
    95359535    }
    95369536
    9537     if (message.left(15) == "NETWORK_CONTROL")
     9537    if (message.startsWith("NETWORK_CONTROL"))
    95389538    {
    95399539        if ((tokens.size() >= 2) &&
    95409540            (tokens[1] != "ANSWER") && (tokens[1] != "RESPONSE"))
    void TV::customEvent(QEvent *e) 
    95529552        }
    95539553    }
    95549554
    9555     if (message.left(9) == "START_EPG")
     9555    if (message.startsWith("START_EPG"))
    95569556    {
    95579557        int editType = tokens[1].toInt();
    95589558        DoEditSchedule(editType);
    95599559    }
    95609560
    9561     if (message.left(11) == "EPG_EXITING" ||
    9562         message.left(18) == "PROGFINDER_EXITING" ||
    9563         message.left(21) == "VIEWSCHEDULED_EXITING" ||
    9564         message.left(19)   == "PLAYBACKBOX_EXITING" ||
    9565         message.left(22) == "SCHEDULEEDITOR_EXITING")
     9561    if (message.startsWith("EPG_EXITING") ||
     9562        message.startsWith("PROGFINDER_EXITING") ||
     9563        message.startsWith("VIEWSCHEDULED_EXITING") ||
     9564        message.startsWith("PLAYBACKBOX_EXITING") ||
     9565        message.startsWith("SCHEDULEEDITOR_EXITING"))
    95669566    {
    95679567        // Resize the window back to the MythTV Player size
    95689568        PlayerContext *actx = GetPlayerReadLock(-1, __FILE__, __LINE__);
    void TV::customEvent(QEvent *e) 
    96049604        isEmbedded = false;
    96059605        ignoreKeyPresses = false;
    96069606
    9607         if (message.left(19) == "PLAYBACKBOX_EXITING")
     9607        if (message.startsWith("PLAYBACKBOX_EXITING"))
    96089608        {
    96099609            ProgramInfo pginfo(me->ExtraDataList());
    96109610            if (pginfo.HasPathname() || pginfo.GetChanID())
    void TV::customEvent(QEvent *e) 
    96159615
    96169616    }
    96179617
    9618     if (message.left(14) == "COMMFLAG_START" && (tokens.size() >= 2))
     9618    if (message.startsWith("COMMFLAG_START") && (tokens.size() >= 2))
    96199619    {
    96209620        uint evchanid = 0;
    96219621        QDateTime evrecstartts;
    void TV::customEvent(QEvent *e) 
    96429642        ReturnPlayerLock(mctx);
    96439643    }
    96449644
    9645     if (message.left(15) == "COMMFLAG_UPDATE" && (tokens.size() >= 3))
     9645    if (message.startsWith("COMMFLAG_UPDATE") && (tokens.size() >= 3))
    96469646    {
    96479647        uint evchanid = 0;
    96489648        QDateTime evrecstartts;
    void TV::OSDDialogEvent(int result, QString text, QString action) 
    1068310683        EnableUpmix(actx, true);
    1068410684    else if (action == ACTION_DISABLEUPMIX)
    1068510685        EnableUpmix(actx, false);
    10686     else if (action.left(13) == "ADJUSTSTRETCH")
     10686    else if (action.startsWith("ADJUSTSTRETCH"))
    1068710687    {
    1068810688        bool floatRead;
    1068910689        float stretch = action.right(action.length() - 13).toFloat(&floatRead);
    void TV::OSDDialogEvent(int result, QString text, QString action) 
    1070110701
    1070210702        ChangeTimeStretch(actx, 0, !floatRead);   // just display
    1070310703    }
    10704     else if (action.left(11) == "SELECTSCAN_")
     10704    else if (action.startsWith("SELECTSCAN_"))
    1070510705    {
    1070610706        QString msg = QString::null;
    1070710707        actx->LockDeletePlayer(__FILE__, __LINE__);
    void TV::OSDDialogEvent(int result, QString text, QString action) 
    1071210712        if (!msg.isEmpty())
    1071310713            SetOSDMessage(actx, msg);
    1071410714    }
    10715     else if (action.left(15) == ACTION_TOGGELAUDIOSYNC)
     10715    else if (action.startsWith(ACTION_TOGGELAUDIOSYNC))
    1071610716        ChangeAudioSync(actx, 0);
    1071710717    else if (action == ACTION_TOGGLESUBTITLEZOOM)
    1071810718        ChangeSubtitleZoom(actx, 0);
    void TV::OSDDialogEvent(int result, QString text, QString action) 
    1072410724        EnableVisualisation(actx, true);
    1072510725    else if (action == ACTION_DISABLEVISUALISATION)
    1072610726        EnableVisualisation(actx, false);
    10727     else if (action.left(11) == ACTION_TOGGLESLEEP)
     10727    else if (action.startsWith(ACTION_TOGGLESLEEP))
    1072810728    {
    1072910729        ToggleSleepTimer(actx, action.left(13));
    1073010730    }
    10731     else if (action.left(17) == "TOGGLEPICCONTROLS")
     10731    else if (action.startsWith("TOGGLEPICCONTROLS"))
    1073210732    {
    1073310733        adjustingPictureAttribute = (PictureAttribute)
    1073410734            (action.right(1).toInt() - 1);
    1073510735        DoTogglePictureAttribute(actx, kAdjustingPicture_Playback);
    1073610736    }
    10737     else if (action.left(18) == ACTION_TOGGLESTUDIOLEVELS)
     10737    else if (action.startsWith(ACTION_TOGGLESTUDIOLEVELS))
    1073810738    {
    1073910739        DoToggleStudioLevels(actx);
    1074010740    }
    void TV::OSDDialogEvent(int result, QString text, QString action) 
    1074210742    {
    1074310743        DoToggleNightMode(actx);
    1074410744    }
    10745     else if (action.left(12) == "TOGGLEASPECT")
     10745    else if (action.startsWith("TOGGLEASPECT"))
    1074610746    {
    1074710747        ToggleAspectOverride(actx,
    1074810748                             (AspectOverrideMode) action.right(1).toInt());
    1074910749    }
    10750     else if (action.left(10) == "TOGGLEFILL")
     10750    else if (action.startsWith("TOGGLEFILL"))
    1075110751    {
    1075210752        ToggleAdjustFill(actx, (AdjustFillMode) action.right(1).toInt());
    1075310753    }
    void TV::OSDDialogEvent(int result, QString text, QString action) 
    1075710757    }
    1075810758    else if (action == ACTION_GUIDE)
    1075910759        EditSchedule(actx, kScheduleProgramGuide);
    10760     else if (action.left(10) == "CHANGROUP_" && db_use_channel_groups)
     10760    else if (action.startsWith("CHANGROUP_") && db_use_channel_groups)
    1076110761    {
    1076210762        if (action == "CHANGROUP_ALL_CHANNELS")
    1076310763        {
    void TV::OSDDialogEvent(int result, QString text, QString action) 
    1084610846            browsehelper->BrowseStart(actx);
    1084710847        else if (action == "PREVCHAN")
    1084810848            PopPreviousChannel(actx, true);
    10849         else if (action.left(14) == "SWITCHTOINPUT_")
     10849        else if (action.startsWith("SWITCHTOINPUT_"))
    1085010850        {
    1085110851            switchToInputId = action.mid(14).toUInt();
    1085210852            QMutexLocker locker(&timerIdLock);
    void TV::OSDDialogEvent(int result, QString text, QString action) 
    1088410884                actx->player->GoToMenu(menu);
    1088510885            actx->UnlockDeletePlayer(__FILE__, __LINE__);
    1088610886        }
    10887         else if (action.left(13) == ACTION_JUMPCHAPTER)
     10887        else if (action.startsWith(ACTION_JUMPCHAPTER))
    1088810888        {
    1088910889            int chapter = action.right(3).toInt();
    1089010890            DoJumpChapter(actx, chapter);
    1089110891        }
    10892         else if (action.left(11) == ACTION_SWITCHTITLE)
     10892        else if (action.startsWith(ACTION_SWITCHTITLE))
    1089310893        {
    1089410894            int title = action.right(3).toInt();
    1089510895            DoSwitchTitle(actx, title);
    1089610896        }
    10897         else if (action.left(13) == ACTION_SWITCHANGLE)
     10897        else if (action.startsWith(ACTION_SWITCHANGLE))
    1089810898        {
    1089910899            int angle = action.right(3).toInt();
    1090010900            DoSwitchAngle(actx, angle);
    void TV::OSDDialogEvent(int result, QString text, QString action) 
    1090610906        }
    1090710907        else if (action == "TOGGLEAUTOEXPIRE")
    1090810908            ToggleAutoExpire(actx);
    10909         else if (action.left(14) == "TOGGLECOMMSKIP")
     10909        else if (action.startsWith("TOGGLECOMMSKIP"))
    1091010910            SetAutoCommercialSkip(
    1091110911                actx, (CommSkipMode)(action.right(1).toInt()));
    1091210912        else if (action == "QUEUETRANSCODE")
    bool TV::HandleJumpToProgramAction( 
    1228212282    QStringList::const_iterator it = actions.begin();
    1228312283    for (; it != actions.end(); ++it)
    1228412284    {
    12285         if ((*it).left(8) != "JUMPPROG")
     12285        if (!(*it).startsWith("JUMPPROG"))
    1228612286            continue;
    1228712287
    1228812288        const QString &action = *it;
  • mythtv/libs/libmythtv/videoout_xv.cpp

    diff --git a/mythtv/libs/libmythtv/videoout_xv.cpp b/mythtv/libs/libmythtv/videoout_xv.cpp
    index e2df180..cbdedf2 100644
    a b bool VideoOutputXv::InitSetupBuffers(void) 
    845845    }
    846846
    847847    // Create video buffers
    848     bool use_xv     = (renderer.left(2) == "xv");
     848    bool use_xv     = (renderer.startsWith("xv"));
    849849    bool use_shm    = (renderer == "xshm");
    850850    bool ok = InitVideoBuffers(use_xv, use_shm);
    851851
  • mythtv/libs/libmythtv/videooutbase.cpp

    diff --git a/mythtv/libs/libmythtv/videooutbase.cpp b/mythtv/libs/libmythtv/videooutbase.cpp
    index 2e5dc13..9ba7394 100644
    a b int VideoOutput::CalcHueBase(const QString &adaptor_name) 
    18711871    {
    18721872        hue_adj = 50;
    18731873    }
    1874     else if (adaptor_name.left(4) == "NV17") /* nVidia */
     1874    else if (adaptor_name.startsWith("NV17")) /* nVidia */
    18751875    {
    18761876        hue_adj = 0;
    18771877    }
  • mythtv/libs/libmythtv/videosource.cpp

    diff --git a/mythtv/libs/libmythtv/videosource.cpp b/mythtv/libs/libmythtv/videosource.cpp
    index de13cfa..5f0ead3 100644
    a b void HDHomeRunDeviceIDList::fillSelections(const QString &cur) 
    14641464    QString sel = man_addr;
    14651465    devs.push_back(sel);
    14661466
    1467     if (3 == devs.size() && current.left(8).toUpper() == "FFFFFFFF")
     1467    if (3 == devs.size() && current.startsWith("FFFFFFFF", Qt::CaseInsensitive))
    14681468    {
    1469         current = sel = (current.right(1) == "0") ?
     1469        current = sel = (current.endsWith("0")) ?
    14701470            *(devs.begin()) : *(++devs.begin());
    14711471    }
    14721472    else
    static QString remove_chaff(const QString &name) 
    35383538{
    35393539    // Trim off some of the chaff.
    35403540    QString short_name = name;
    3541     if (short_name.left(14) == "LG Electronics")
     3541    if (short_name.startsWith("LG Electronics"))
    35423542        short_name = short_name.right(short_name.length() - 15);
    3543     if (short_name.left(4) == "Oren")
     3543    if (short_name.startsWith("Oren"))
    35443544        short_name = short_name.right(short_name.length() - 5);
    3545     if (short_name.left(8) == "Nextwave")
     3545    if (short_name.startsWith("Nextwave"))
    35463546        short_name = short_name.right(short_name.length() - 9);
    3547     if (short_name.right(8).toLower() == "frontend")
     3547    if (short_name.startsWith("frontend", Qt::CaseInsensitive))
    35483548        short_name = short_name.left(short_name.length() - 9);
    3549     if (short_name.right(7) == "VSB/QAM")
     3549    if (short_name.endsWith("VSB/QAM"))
    35503550        short_name = short_name.left(short_name.length() - 8);
    3551     if (short_name.right(3) == "VSB")
     3551    if (short_name.endsWith("VSB"))
    35523552        short_name = short_name.left(short_name.length() - 4);
    3553     if (short_name.right(5) == "DVB-T")
     3553    if (short_name.endsWith("DVB-T"))
    35543554        short_name = short_name.left(short_name.length() - 6);
    35553555
    35563556    // It would be infinitely better if DVB allowed us to query
    static QString remove_chaff(const QString &name) 
    35583558    // demodulator name. This means cards like the Air2PC HD5000
    35593559    // and DViCO Fusion HDTV cards are not identified correctly.
    35603560    short_name = short_name.simplified();
    3561     if (short_name.left(7).toLower() == "or51211")
     3561    if (short_name.startsWith("or51211", Qt::CaseInsensitive))
    35623562        short_name = "pcHDTV HD-2000";
    3563     else if (short_name.left(7).toLower() == "or51132")
     3563    else if (short_name.startsWith("or51132", Qt::CaseInsensitive))
    35643564        short_name = "pcHDTV HD-3000";
    3565     else if (short_name.left(7).toLower() == "bcm3510")
     3565    else if (short_name.startsWith("bcm3510", Qt::CaseInsensitive))
    35663566        short_name = "Air2PC v1";
    3567     else if (short_name.left(7).toLower() == "nxt2002")
     3567    else if (short_name.startsWith("nxt2002", Qt::CaseInsensitive))
    35683568        short_name = "Air2PC v2";
    3569     else if (short_name.left(7).toLower() == "nxt200x")
     3569    else if (short_name.startsWith("nxt200x", Qt::CaseInsensitive))
    35703570        short_name = "Air2PC v2";
    3571     else if (short_name.left(8).toLower() == "lgdt3302")
     3571    else if (short_name.startsWith("lgdt3302", Qt::CaseInsensitive))
    35723572        short_name = "DViCO HDTV3";
    3573     else if (short_name.left(8).toLower() == "lgdt3303")
     3573    else if (short_name.startsWith("lgdt3303", Qt::CaseInsensitive))
    35743574        short_name = "DViCO v2 or Air2PC v3 or pcHDTV HD-5500";
    35753575
    35763576    return short_name;
    void DVBConfigurationGroup::probeCard(const QString &videodevice) 
    36553655#if 0 // frontends on hybrid DVB-T/Analog cards
    36563656            QString short_name = remove_chaff(frontend_name);
    36573657            buttonAnalog->setVisible(
    3658                 short_name.left(15).toLower() == "zarlink zl10353" ||
    3659                 short_name.toLower() == "wintv hvr 900 m/r: 65008/a1c0" ||
    3660                 short_name.left(17).toLower() == "philips tda10046h");
     3658                short_name.startsWith("zarlink zl10353",
     3659                                      Qt::CaseInsensitive) ||
     3660                short_name.startsWith("wintv hvr 900 m/r: 65008/a1c0",
     3661                                      Qt::CaseInsensitive) ||
     3662                short_name.startsWith("philips tda10046h",
     3663                                      Qt::CaseInsensitive));
    36613664#endif
    36623665        }
    36633666        break;
    void DVBConfigurationGroup::probeCard(const QString &videodevice) 
    36813684            if (frontend_name.toLower().indexOf("usb") < 0)
    36823685            {
    36833686                buttonAnalog->setVisible(
    3684                     short_name.left(6).toLower() == "pchdtv" ||
    3685                     short_name.left(5).toLower() == "dvico" ||
    3686                     short_name.left(8).toLower() == "nextwave");
     3687                    short_name.startsWith("pchdtv", Qt::CaseInsensitive) ||
     3688                    short_name.startsWith("dvico", Qt::CaseInsensitive) ||
     3689                    short_name.startsWith("nextwave", Qt::CaseInsensitive));
    36873690            }
    36883691#endif
    36893692        }
  • mythtv/libs/libmythui/myththemedmenu.cpp

    diff --git a/mythtv/libs/libmythui/myththemedmenu.cpp b/mythtv/libs/libmythui/myththemedmenu.cpp
    index 6711d44..e3fa9de 100644
    a b bool MythThemedMenu::handleAction(const QString &action, const QString &password 
    762762    if (!password.isEmpty() && !checkPinCode(password))
    763763        return true;
    764764
    765     if (action.left(5) == "EXEC ")
     765    if (action.startsWith("EXEC "))
    766766    {
    767767        QString rest = action.right(action.length() - 5);
    768768        if (cbs && cbs->exec_program)
    bool MythThemedMenu::handleAction(const QString &action, const QString &password 
    770770
    771771        return false;
    772772    }
    773     else if (action.left(7) == "EXECTV ")
     773    else if (action.startsWith("EXECTV "))
    774774    {
    775775        QString rest = action.right(action.length() - 7).trimmed();
    776776        if (cbs && cbs->exec_program_tv)
    777777            cbs->exec_program_tv(rest);
    778778    }
    779     else if (action.left(5) == "MENU ")
     779    else if (action.startsWith("MENU "))
    780780    {
    781781        QString menu = action.right(action.length() - 5);
    782782
    bool MythThemedMenu::handleAction(const QString &action, const QString &password 
    789789        else
    790790            delete newmenu;
    791791    }
    792     else if (action.left(6) == "UPMENU")
     792    else if (action.startsWith("UPMENU"))
    793793    {
    794794        m_wantpop = true;
    795795    }
    796     else if (action.left(12) == "CONFIGPLUGIN")
     796    else if (action.startsWith("CONFIGPLUGIN"))
    797797    {
    798798        QString rest = action.right(action.length() - 13);
    799799        if (cbs && cbs->configplugin)
    800800            cbs->configplugin(rest);
    801801    }
    802     else if (action.left(6) == "PLUGIN")
     802    else if (action.startsWith("PLUGIN"))
    803803    {
    804804        QString rest = action.right(action.length() - 7);
    805805        if (cbs && cbs->plugin)
    806806            cbs->plugin(rest);
    807807    }
    808     else if (action.left(8) == "SHUTDOWN")
     808    else if (action.startsWith("SHUTDOWN"))
    809809    {
    810810        if (m_allocedstate)
    811811        {
    812812            m_wantpop = true;
    813813        }
    814814    }
    815     else if (action.left(5) == "EJECT")
     815    else if (action.startsWith("EJECT"))
    816816    {
    817817        if (cbs && cbs->eject)
    818818            cbs->eject();
    819819    }
    820     else if (action.left(5) == "JUMP ")
     820    else if (action.startsWith("JUMP "))
    821821    {
    822822        QString rest = action.right(action.length() - 5);
    823823        GetMythMainWindow()->JumpTo(rest, false);
    824824    }
    825     else if (action.left(6) == "MEDIA ")
     825    else if (action.startsWith("MEDIA "))
    826826    {
    827827        // the format is MEDIA HANDLER URL
    828828        // TODO: allow spaces in the url
  • mythtv/libs/libmythui/mythuiwebbrowser.cpp

    diff --git a/mythtv/libs/libmythui/mythuiwebbrowser.cpp b/mythtv/libs/libmythui/mythuiwebbrowser.cpp
    index 3a35549..0b59608 100644
    a b void BrowserApi::customEvent(QEvent *e) 
    244244        MythEvent *me = (MythEvent *)e;
    245245        QString message = me->Message();
    246246
    247         if (message.left(13) != "MUSIC_CONTROL")
     247        if (!message.startsWith("MUSIC_CONTROL"))
    248248            return;
    249249
    250250        QStringList tokens = message.simplified().split(" ");
  • mythtv/libs/libmythupnp/upnpdevice.cpp

    diff --git a/mythtv/libs/libmythupnp/upnpdevice.cpp b/mythtv/libs/libmythupnp/upnpdevice.cpp
    index 7cbdb4d..dcb30e5 100644
    a b QString UPnpDevice::toString(uint padding) const 
    856856    }
    857857
    858858    // remove trailing newline
    859     if (ret.right(1)=="\n")
     859    if (ret.endsWith("\n"))
    860860        ret = ret.left(ret.length()-1);
    861861
    862862    // add any padding as necessary
  • mythtv/programs/mythbackend/autoexpire.cpp

    diff --git a/mythtv/programs/mythbackend/autoexpire.cpp b/mythtv/programs/mythbackend/autoexpire.cpp
    index b3b02e6..5755850 100644
    a b void AutoExpire::ExpireRecordings(void) 
    571571                        // Wasn't found so check locally
    572572                        QString file = GetPlaybackURL(p);
    573573
    574                         if (file.left(1) == "/")
     574                        if (file.startsWith("/"))
    575575                        {
    576576                            p->SetPathname(file);
    577577                            p->SetHostname(myHostName);
  • mythtv/programs/mythbackend/backendutil.cpp

    diff --git a/mythtv/programs/mythbackend/backendutil.cpp b/mythtv/programs/mythbackend/backendutil.cpp
    index 321e259..70e5384 100644
    a b QString GetPlaybackURL(ProgramInfo *pginfo, bool storePath) 
    3636        locker.unlock();
    3737        result = pginfo->GetPlaybackURL(false, true);
    3838        locker.relock();
    39         if (storePath && result.left(1) == "/")
     39        if (storePath && result.startsWith("/"))
    4040            recordingPathCache[cacheKey] = result;
    4141    }
    4242
  • mythtv/programs/mythbackend/httpconfig.cpp

    diff --git a/mythtv/programs/mythbackend/httpconfig.cpp b/mythtv/programs/mythbackend/httpconfig.cpp
    index 36522b5..061c9f7 100644
    a b bool HttpConfig::ProcessRequest(HTTPRequest *request) 
    7272        }
    7373
    7474        // FIXME, this is always false, what's it for
    75         if (request->m_sBaseUrl.right(7) == "config" &&
     75        // JMS "fixed" by using endsWith()
     76        if (request->m_sBaseUrl.endsWith("config") &&
    7677            !database_settings.empty())
    7778        {
    7879            QString checkResult;
  • mythtv/programs/mythbackend/mainserver.cpp

    diff --git a/mythtv/programs/mythbackend/mainserver.cpp b/mythtv/programs/mythbackend/mainserver.cpp
    index e9cae9b..fea6690 100644
    a b void MainServer::ProcessRequestWork(MythSocket *sock) 
    717717    }
    718718    else if (command == "MESSAGE")
    719719    {
    720         if ((listline.size() >= 2) && (listline[1].left(11) == "SET_VERBOSE"))
     720        if ((listline.size() >= 2) && (listline[1].startsWith("SET_VERBOSE")))
    721721            HandleSetVerbose(listline, pbs);
    722722        else if ((listline.size() >= 2) &&
    723                  (listline[1].left(13) == "SET_LOG_LEVEL"))
     723                 (listline[1].startsWith("SET_LOG_LEVEL")))
    724724            HandleSetLogLevel(listline, pbs);
    725725        else
    726726            HandleMessage(listline, pbs);
    void MainServer::customEvent(QEvent *e) 
    10011001            broadcast += extra;
    10021002        }
    10031003
    1004         if (me->Message().left(11) == "AUTO_EXPIRE")
     1004        if (me->Message().startsWith("AUTO_EXPIRE"))
    10051005        {
    10061006            QStringList tokens = me->Message()
    10071007                .split(" ", QString::SkipEmptyParts);
    void MainServer::customEvent(QEvent *e) 
    10411041            return;
    10421042        }
    10431043
    1044         if (me->Message().left(21) == "QUERY_NEXT_LIVETV_DIR" && m_sched)
     1044        if (me->Message().startsWith("QUERY_NEXT_LIVETV_DIR") && m_sched)
    10451045        {
    10461046            QStringList tokens = me->Message()
    10471047                .split(" ", QString::SkipEmptyParts);
    void MainServer::customEvent(QEvent *e) 
    10571057            return;
    10581058        }
    10591059
    1060         if ((me->Message().left(16) == "DELETE_RECORDING") ||
    1061             (me->Message().left(22) == "FORCE_DELETE_RECORDING"))
     1060        if ((me->Message().startsWith("DELETE_RECORDING")) ||
     1061            (me->Message().startsWith("FORCE_DELETE_RECORDING")))
    10621062        {
    10631063            QStringList tokens = me->Message()
    10641064                .split(" ", QString::SkipEmptyParts);
    void MainServer::customEvent(QEvent *e) 
    10901090            return;
    10911091        }
    10921092
    1093         if (me->Message().left(21) == "RESCHEDULE_RECORDINGS" && m_sched)
     1093        if (me->Message().startsWith("RESCHEDULE_RECORDINGS") && m_sched)
    10941094        {
    10951095            QStringList request = me->ExtraDataList();
    10961096            m_sched->Reschedule(request);
    10971097            return;
    10981098        }
    10991099
    1100         if (me->Message().left(23) == "SCHEDULER_ADD_RECORDING" && m_sched)
     1100        if (me->Message().startsWith("SCHEDULER_ADD_RECORDING") && m_sched)
    11011101        {
    11021102            ProgramInfo pi(me->ExtraDataList());
    11031103            if (!pi.GetChanID())
    void MainServer::customEvent(QEvent *e) 
    11101110            return;
    11111111        }
    11121112
    1113         if (me->Message().left(23) == "UPDATE_RECORDING_STATUS" && m_sched)
     1113        if (me->Message().startsWith("UPDATE_RECORDING_STATUS") && m_sched)
    11141114        {
    11151115            QStringList tokens = me->Message()
    11161116                .split(" ", QString::SkipEmptyParts);
    void MainServer::customEvent(QEvent *e) 
    11311131            return;
    11321132        }
    11331133
    1134         if (me->Message().left(13) == "LIVETV_EXITED")
     1134        if (me->Message().startsWith("LIVETV_EXITED"))
    11351135        {
    11361136            QString chainid = me->ExtraData();
    11371137            LiveTVChain *chain = GetExistingChain(chainid);
    void MainServer::customEvent(QEvent *e) 
    11441144        if (me->Message() == "CLEAR_SETTINGS_CACHE")
    11451145            gCoreContext->ClearSettingsCache();
    11461146
    1147         if (me->Message().left(14) == "RESET_IDLETIME" && m_sched)
     1147        if (me->Message().startsWith("RESET_IDLETIME") && m_sched)
    11481148            m_sched->ResetIdleTime();
    11491149
    11501150        if (me->Message() == "LOCAL_RECONNECT_TO_MASTER")
    void MainServer::customEvent(QEvent *e) 
    11531153        if (me->Message() == "LOCAL_SLAVE_BACKEND_ENCODERS_OFFLINE")
    11541154            HandleSlaveDisconnectedEvent(*me);
    11551155
    1156         if (me->Message().left(6) == "LOCAL_")
     1156        if (me->Message().startsWith("LOCAL_"))
    11571157            return;
    11581158
    11591159        MythEvent mod_me("");
    1160         if (me->Message().left(23) == "MASTER_UPDATE_PROG_INFO")
     1160        if (me->Message().startsWith("MASTER_UPDATE_PROG_INFO"))
    11611161        {
    11621162            QStringList tokens = me->Message().simplified().split(" ");
    11631163            uint chanid = 0;
    void MainServer::customEvent(QEvent *e) 
    11881188            }
    11891189        }
    11901190
    1191         if (me->Message().left(13) == "DOWNLOAD_FILE")
     1191        if (me->Message().startsWith("DOWNLOAD_FILE"))
    11921192        {
    11931193            QStringList extraDataList = me->ExtraDataList();
    11941194            QString localFile = extraDataList[1];
    void MainServer::customEvent(QEvent *e) 
    12301230        sockListLock.unlock();
    12311231
    12321232        bool sendGlobal = false;
    1233         if (ismaster && broadcast[1].left(7) == "GLOBAL_")
     1233        if (ismaster && broadcast[1].startsWith("GLOBAL_"))
    12341234        {
    12351235            broadcast[1].replace("GLOBAL_", "LOCAL_");
    12361236            MythEvent me(broadcast[1], broadcast[2]);
    void MainServer::BackendQueryDiskSpace(QStringList &strlist, bool consolidated, 
    44834483             * value using QString::fromUtf8() to prevent corruption. */
    44844484            currentDir = QString::fromUtf8(query.value(1)
    44854485                                           .toByteArray().constData());
    4486             if (currentDir.right(1) == "/")
     4486            if (currentDir.endsWith("/"))
    44874487                currentDir.remove(currentDir.length() - 1, 1);
    44884488
    44894489            checkDir.setPath(currentDir);
    QString MainServer::LocalFilePath(const QUrl &url, const QString &wantgroup) 
    61306130        lpath = lpath.section('/', -1);
    61316131
    61326132        QString fpath = lpath;
    6133         if (fpath.right(4) == ".png")
     6133        if (fpath.endsWith(".png"))
    61346134            fpath = fpath.left(fpath.length() - 4);
    61356135
    61366136        ProgramInfo pginfo(fpath);
    61376137        if (pginfo.GetChanID())
    61386138        {
    61396139            QString pburl = GetPlaybackURL(&pginfo);
    6140             if (pburl.left(1) == "/")
     6140            if (pburl.startsWith("/"))
    61416141            {
    61426142                lpath = pburl.section('/', 0, -2) + "/" + lpath;
    61436143                LOG(VB_FILE, LOG_INFO,
  • mythtv/programs/mythbackend/services/content.cpp

    diff --git a/mythtv/programs/mythbackend/services/content.cpp b/mythtv/programs/mythbackend/services/content.cpp
    index 97fabe0..c0c591e 100644
    a b QFileInfo Content::GetPreviewImage( int nChanId, 
    493493        // ------------------------------------------------------------------
    494494        // Must generate Preview Image, Generate Image and save.
    495495        // ------------------------------------------------------------------
    496         if (!pginfo.IsLocal() && sFileName.left(1) == "/")
     496        if (!pginfo.IsLocal() && sFileName.startsWith("/"))
    497497            pginfo.SetPathname(sFileName);
    498498
    499499        if (!pginfo.IsLocal())
  • mythtv/programs/mythcommflag/CommDetector2.cpp

    diff --git a/mythtv/programs/mythcommflag/CommDetector2.cpp b/mythtv/programs/mythcommflag/CommDetector2.cpp
    index 76a74c3..002ac40 100644
    a b QString debugDirectory(int chanid, const QDateTime& recstartts) 
    223223        return "";
    224224
    225225    QString pburl = pginfo.GetPlaybackURL(true);
    226     if (pburl.left(1) != "/")
     226    if (!pburl.startsWith("/"))
    227227        return "";
    228228
    229229    QString basename(query.value(0).toString());
  • mythtv/programs/mythfilldatabase/xmltvparser.cpp

    diff --git a/mythtv/programs/mythfilldatabase/xmltvparser.cpp b/mythtv/programs/mythfilldatabase/xmltvparser.cpp
    index f7830106..18430ad 100644
    a b ChannelInfo *XMLTVParser::parseChannel(QDomElement &element, QUrl &baseUrl) 
    8585                {
    8686                    QString base = baseUrl.toString(QUrl::StripTrailingSlash);
    8787                    chaninfo->icon = base +
    88                         ((path.left(1) == "/") ? path : QString("/") + path);
     88                        ((path.startsWith("/")) ? path : QString("/") + path);
    8989                }
    9090                else if (!path.isEmpty())
    9191                {
  • mythtv/programs/mythfrontend/globalsettings.cpp

    diff --git a/mythtv/programs/mythfrontend/globalsettings.cpp b/mythtv/programs/mythfrontend/globalsettings.cpp
    index 36bf5b9..293153b 100644
    a b void PlaybackProfileConfig::Save(void) 
    920920
    921921void PlaybackProfileConfig::pressed(QString cmd)
    922922{
    923     if (cmd.left(4) == "edit")
     923    if (cmd.startsWith("edit"))
    924924    {
    925925        uint i = cmd.mid(4).toUInt();
    926926        PlaybackProfileItemConfig itemcfg(items[i]);
    void PlaybackProfileConfig::pressed(QString cmd) 
    931931        InitLabel(i);
    932932        needs_save = true;
    933933    }
    934     else if (cmd.left(3) == "del")
     934    else if (cmd.startsWith("del"))
    935935    {
    936936        uint i = cmd.mid(3).toUInt();
    937937        del_items.push_back(items[i]);
  • mythtv/programs/mythfrontend/idlescreen.cpp

    diff --git a/mythtv/programs/mythfrontend/idlescreen.cpp b/mythtv/programs/mythfrontend/idlescreen.cpp
    index 8a1d98c..ec50a99 100644
    a b void IdleScreen::customEvent(QEvent* event) 
    142142    {
    143143        MythEvent *me = static_cast<MythEvent *>(event);
    144144
    145         if (me->Message().left(18) == "SHUTDOWN_COUNTDOWN")
     145        if (me->Message().startsWith("SHUTDOWN_COUNTDOWN"))
    146146        {
    147147            QString secs = me->Message().mid(19);
    148148            m_secondsToShutdown = secs.toInt();
    149149            UpdateStatus();
    150150        }
    151         else if (me->Message().left(12) == "SHUTDOWN_NOW")
     151        else if (me->Message().startsWith("SHUTDOWN_NOW"))
    152152        {
    153153            if (gCoreContext->IsFrontendOnly())
    154154            {
  • mythtv/programs/mythfrontend/main.cpp

    diff --git a/mythtv/programs/mythfrontend/main.cpp b/mythtv/programs/mythfrontend/main.cpp
    index 2a13d60..dfd6d34 100644
    a b static void TVMenuCallback(void *data, QString &selection) 
    775775    (void)data;
    776776    QString sel = selection.toLower();
    777777
    778     if (sel.left(9) == "settings ")
     778    if (sel.startsWith("settings "))
    779779    {
    780780        GetMythUI()->AddCurrentLocation("Setup");
    781781        gCoreContext->ActivateSettingsCache(false);
    static void TVMenuCallback(void *data, QString &selection) 
    786786        startTVNormal();
    787787    else if (sel == "tv_watch_live_epg")
    788788        startTVInGuide();
    789     else if (sel.left(18) == "tv_watch_recording")
     789    else if (sel.startsWith("tv_watch_recording"))
    790790    {
    791791        // use selection here because its case is untouched
    792792        if ((selection.length() > 19) && (selection.mid(18, 1) == " "))
    static void TVMenuCallback(void *data, QString &selection) 
    10001000    else
    10011001        LOG(VB_GENERAL, LOG_ERR, "Unknown menu action: " + selection);
    10021002
    1003     if (sel.left(9) == "settings " || sel == "video_settings_general")
     1003    if (sel.startsWith("settings ") || sel == "video_settings_general")
    10041004    {
    10051005        GetMythUI()->RemoveCurrentLocation();
    10061006
  • mythtv/programs/mythfrontend/networkcontrol.cpp

    diff --git a/mythtv/programs/mythfrontend/networkcontrol.cpp b/mythtv/programs/mythfrontend/networkcontrol.cpp
    index 18fa2a1..1b03165 100644
    a b void NetworkControl::customEvent(QEvent *e) 
    12571257        MythEvent *me = (MythEvent *)e;
    12581258        QString message = me->Message();
    12591259
    1260         if (message.left(13) == "MUSIC_CONTROL")
     1260        if (message.startsWith("MUSIC_CONTROL"))
    12611261        {
    12621262            QStringList tokens = message.simplified().split(" ");
    12631263            if ((tokens.size() >= 4) &&
    void NetworkControl::customEvent(QEvent *e) 
    12711271            }
    12721272
    12731273        }
    1274         else if (message.left(15) == "NETWORK_CONTROL")
     1274        else if (message.startsWith("NETWORK_CONTROL"))
    12751275        {
    12761276            QStringList tokens = message.simplified().split(" ");
    12771277            if ((tokens.size() >= 3) &&
  • mythtv/programs/mythfrontend/playbackbox.cpp

    diff --git a/mythtv/programs/mythfrontend/playbackbox.cpp b/mythtv/programs/mythfrontend/playbackbox.cpp
    index ff618ce..af4af85 100644
    a b void PlaybackBox::customEvent(QEvent *event) 
    38843884        MythEvent *me = (MythEvent *)event;
    38853885        QString message = me->Message();
    38863886
    3887         if (message.left(21) == "RECORDING_LIST_CHANGE")
     3887        if (message.startsWith("RECORDING_LIST_CHANGE"))
    38883888        {
    38893889            QStringList tokens = message.simplified().split(" ");
    38903890            uint chanid = 0;
    void PlaybackBox::customEvent(QEvent *event) 
    39203920                m_programInfoCache.ScheduleLoad();
    39213921            }
    39223922        }
    3923         else if (message.left(15) == "NETWORK_CONTROL")
     3923        else if (message.startsWith("NETWORK_CONTROL"))
    39243924        {
    39253925            QStringList tokens = message.simplified().split(" ");
    39263926            if ((tokens[1] != "ANSWER") && (tokens[1] != "RESPONSE"))
    void PlaybackBox::customEvent(QEvent *event) 
    39483948                                            keyevent);
    39493949            }
    39503950        }
    3951         else if (message.left(16) == "UPDATE_FILE_SIZE")
     3951        else if (message.startsWith("UPDATE_FILE_SIZE"))
    39523952        {
    39533953            QStringList tokens = message.simplified().split(" ");
    39543954            bool ok = false;
  • mythtv/programs/mythfrontend/progfind.cpp

    diff --git a/mythtv/programs/mythfrontend/progfind.cpp b/mythtv/programs/mythfrontend/progfind.cpp
    index 222e9e5..4369311 100644
    a b bool ProgFinder::formatSelectedData(QString& data) 
    670670
    671671    if (searchChar == "T")
    672672    {
    673         if (data.left(4) != "The " && data.left(2) != "A ")
     673        if (!data.startsWith("The ") && !data.startsWith("A "))
    674674        {
    675675             // nothing, use as is
    676676        }
    677         else if (data.left(5) == "The T")
     677        else if (data.startsWith("The T"))
    678678            data = data.mid(4) + ", The";
    679         else if (data.left(3) == "A T")
     679        else if (data.startsWith("A T"))
    680680            data = data.mid(2) + ", A";
    681681        else
    682682        {
    bool ProgFinder::formatSelectedData(QString& data) 
    686686    }
    687687    else if (searchChar == "A")
    688688    {
    689         if (data.left(4) != "The " && data.left(2) != "A ")
     689        if (!data.startsWith("The ") && !data.startsWith("A "))
    690690        {
    691691             // nothing, use as is
    692692        }
    693         else if (data.left(5) == "The A")
     693        else if (data.startsWith("The A"))
    694694            data = data.mid(4) + ", The";
    695         else if (data.left(3) == "A A")
     695        else if (data.startsWith("A A"))
    696696             data = data.mid(2) + ", A";
    697         else if (data.left(4) == "An A")
     697        else if (data.startsWith("An A"))
    698698             data = data.mid(3) + ", An";
    699699        else
    700700        {
    bool ProgFinder::formatSelectedData(QString& data) 
    704704    }
    705705    else
    706706    {
    707         if (data.left(4) == "The ")
     707        if (data.startsWith("The "))
    708708            data = data.mid(4) + ", The";
    709         else if (data.left(2) == "A ")
     709        else if (data.startsWith("A "))
    710710            data = data.mid(2) + ", A";
    711         else if (data.left(3) == "An ")
     711        else if (data.startsWith("An "))
    712712            data = data.mid(3) + ", An";
    713713    }
    714714
    bool ProgFinder::formatSelectedData(QString& data, int charNum) 
    721721
    722722    if (charNum == 29 || charNum == 10)
    723723    {
    724         if (data.left(5) == "The T" && charNum == 29)
     724        if (data.startsWith("The T") && charNum == 29)
    725725            data = data.mid(4) + ", The";
    726         else if (data.left(5) == "The A" && charNum == 10)
     726        else if (data.startsWith("The A") && charNum == 10)
    727727            data = data.mid(4) + ", The";
    728         else if (data.left(3) == "A T" && charNum == 29)
     728        else if (data.startsWith("A T") && charNum == 29)
    729729            data = data.mid(2) + ", A";
    730         else if (data.left(3) == "A A" && charNum == 10)
     730        else if (data.startsWith("A A") && charNum == 10)
    731731            data = data.mid(2) + ", A";
    732         else if (data.left(4) == "An A" && charNum == 10)
     732        else if (data.startsWith("An A") && charNum == 10)
    733733             data = data.mid(3) + ", An";
    734         else if (data.left(4) != "The " && data.left(2) != "A ")
     734        else if (!data.startsWith("The ") && !data.startsWith("A "))
    735735        {
    736736            // use as is
    737737        }
    bool ProgFinder::formatSelectedData(QString& data, int charNum) 
    743743    }
    744744    else
    745745    {
    746         if (data.left(4) == "The ")
     746        if (data.startsWith("The "))
    747747            data = data.mid(4) + ", The";
    748         if (data.left(2) == "A ")
     748        if (data.startsWith("A "))
    749749            data = data.mid(2) + ", A";
    750         if (data.left(3) == "An ")
     750        if (data.startsWith("An "))
    751751            data = data.mid(3) + ", An";
    752752    }
    753753
    bool ProgFinder::formatSelectedData(QString& data, int charNum) 
    756756
    757757void ProgFinder::restoreSelectedData(QString &data)
    758758{
    759     if (data.right(5) == ", The")
     759    if (data.endsWith(", The"))
    760760        data = "The " + data.left(data.length() - 5);
    761     if (data.right(3) == ", A")
     761    if (data.endsWith(", A"))
    762762        data = "A " + data.left(data.length() - 3);
    763763}
    764764
  • mythtv/programs/mythfrontend/upnpscanner.cpp

    diff --git a/mythtv/programs/mythfrontend/upnpscanner.cpp b/mythtv/programs/mythfrontend/upnpscanner.cpp
    index e475621..b1d8c37 100644
    a b bool UPNPScanner::ParseDescription(const QUrl &url, QNetworkReply *reply) 
    12751275                               QUrl::RemoveQuery);
    12761276
    12771277    // strip leading slashes off the controlURL
    1278     while (!controlURL.isEmpty() && controlURL.left(1) == "/")
     1278    while (!controlURL.isEmpty() && controlURL.startsWith("/"))
    12791279        controlURL = controlURL.mid(1);
    12801280
    12811281    // strip leading slashes off the eventURL
    1282     //while (!eventURL.isEmpty() && eventURL.left(1) == "/")
     1282    //while (!eventURL.isEmpty() && eventURL.startsWith("/"))
    12831283    //    eventURL = eventURL.mid(1);
    12841284
    12851285    // strip trailing slashes off URLBase
    1286     while (!URLBase.isEmpty() && URLBase.right(1) == "/")
     1286    while (!URLBase.isEmpty() && URLBase.endsWith("/"))
    12871287        URLBase = URLBase.mid(0, URLBase.size() - 1);
    12881288
    12891289    controlURL = URLBase + "/" + controlURL;
  • mythtv/programs/mythfrontend/videolist.cpp

    diff --git a/mythtv/programs/mythfrontend/videolist.cpp b/mythtv/programs/mythfrontend/videolist.cpp
    index 0cd21e5..818d2cc 100644
    a b static QString path_to_node_name(const QString &path) 
    211211{
    212212    QString ret;
    213213    int slashLoc = path.lastIndexOf('/', -2) + 1;
    214     if (path.right(1) == "/")
     214    if (path.endsWith("/"))
    215215        ret = path.mid(slashLoc, path.length() - slashLoc - 1);
    216216    else
    217217        ret = path.mid(slashLoc);
  • mythtv/programs/mythlcdserver/lcdprocclient.cpp

    diff --git a/mythtv/programs/mythlcdserver/lcdprocclient.cpp b/mythtv/programs/mythlcdserver/lcdprocclient.cpp
    index b62365a..2d29128 100644
    a b void LCDProcClient::customEvent(QEvent *e) 
    24382438    {
    24392439        MythEvent *me = (MythEvent *) e;
    24402440
    2441         if (me->Message().left(21) == "RECORDING_LIST_CHANGE" ||
     2441        if (me->Message().startsWith("RECORDING_LIST_CHANGE") ||
    24422442            me->Message() == "UPDATE_PROG_INFO")
    24432443        {
    24442444            if (lcd_showrecstatus && !updateRecInfoTimer->isActive())
  • mythtv/programs/mythtranscode/main.cpp

    diff --git a/mythtv/programs/mythtranscode/main.cpp b/mythtv/programs/mythtranscode/main.cpp
    index f20a1b0..347f20f 100644
    a b int main(int argc, char *argv[]) 
    541541        return QueueTranscodeJob(pginfo, profilename, hostname, useCutlist);
    542542    }
    543543
    544     if (infile.left(7) == "myth://" && (outfile.isEmpty() || outfile != "-") &&
     544    if (infile.startsWith("myth://") && (outfile.isEmpty() || outfile != "-") &&
    545545        fifodir.isEmpty() && !cmdline.toBool("hls") && !cmdline.toBool("avf"))
    546546    {
    547547        LOG(VB_GENERAL, LOG_ERR,
  • mythtv/programs/mythtranscode/transcode.cpp

    diff --git a/mythtv/programs/mythtranscode/transcode.cpp b/mythtv/programs/mythtranscode/transcode.cpp
    index 45b94b9..b6b0a4e 100644
    a b int Transcode::TranscodeFile(const QString &inputname, 
    644644                }
    645645            }
    646646
    647             if (encodingType.left(4).toLower() == "mpeg")
     647            if (encodingType.startsWith("mpeg", Qt::CaseInsensitive))
    648648            {
    649649                // make sure dimensions are valid for MPEG codecs
    650650                newHeight = (newHeight + 15) & ~0xF;
  • mythtv/programs/mythwelcome/welcomedialog.cpp

    diff --git a/mythtv/programs/mythwelcome/welcomedialog.cpp b/mythtv/programs/mythwelcome/welcomedialog.cpp
    index 89d4263..f092608 100644
    a b void WelcomeDialog::customEvent(QEvent *e) 
    149149    {
    150150        MythEvent *me = (MythEvent *) e;
    151151
    152         if (me->Message().left(21) == "RECORDING_LIST_CHANGE" ||
     152        if (me->Message().startsWith("RECORDING_LIST_CHANGE") ||
    153153            me->Message() == "UPDATE_PROG_INFO")
    154154        {
    155155            LOG(VB_GENERAL, LOG_NOTICE,
    void WelcomeDialog::customEvent(QEvent *e) 
    169169                setPendingRecListUpdate(true);
    170170            }
    171171        }
    172         else if (me->Message().left(15) == "SCHEDULE_CHANGE")
     172        else if (me->Message().startsWith("SCHEDULE_CHANGE"))
    173173        {
    174174            LOG(VB_GENERAL, LOG_NOTICE,
    175175                "MythWelcome received a SCHEDULE_CHANGE event");
    void WelcomeDialog::customEvent(QEvent *e) 
    187187                setPendingSchedUpdate(true);
    188188            }
    189189        }
    190         else if (me->Message().left(18) == "SHUTDOWN_COUNTDOWN")
     190        else if (me->Message().startsWith("SHUTDOWN_COUNTDOWN"))
    191191        {
    192192#if 0
    193193            LOG(VB_GENERAL, LOG_NOTICE,
    void WelcomeDialog::customEvent(QEvent *e) 
    198198            updateStatusMessage();
    199199            updateScreen();
    200200        }
    201         else if (me->Message().left(12) == "SHUTDOWN_NOW")
     201        else if (me->Message().startsWith("SHUTDOWN_NOW"))
    202202        {
    203203            LOG(VB_GENERAL, LOG_NOTICE,
    204204                "MythWelcome received a SHUTDOWN_NOW event");