VirtualBox

Changeset 103362 in vbox for trunk/src


Ignore:
Timestamp:
Feb 14, 2024 4:50:56 PM (12 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10450: Get rid of QRegExp which is a part of Qt5 legacy API; This is necessary to get rid of Qt5 support lib.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp

    r103321 r103362  
    2929#include <QApplication>
    3030#include <QHash>
    31 #include <QRegExp>
    3231#include <QRegularExpression>
    3332
     
    312311    /* Search for a template index strStorageSlot corresponds to: */
    313312    int iIndex = -1;
    314     QRegExp regExp;
     313    QRegularExpression re;
     314    QRegularExpressionMatch mt;
    315315    for (int i = 0; i < templates.size(); ++i)
    316316    {
    317         regExp = QRegExp(i >= 0 && i <= 3 ? templates.value(i) : templates.value(i).arg("(\\d+)"));
    318         if (regExp.indexIn(strStorageSlot) != -1)
     317        re.setPattern(i >= 0 && i <= 3 ? templates.value(i) : templates.value(i).arg("(\\d+)"));
     318        mt = re.match(strStorageSlot);
     319        if (mt.hasMatch())
    319320        {
    320321            iIndex = i;
     
    382383                break;
    383384            const int iMaxPort = uiCommon().virtualBox().GetPlatformProperties(KPlatformArchitecture_x86).GetMaxPortCountForStorageBus(result.bus);
    384             const LONG iPort = regExp.cap(1).toInt();
     385            const LONG iPort = mt.captured(1).toInt();
    385386            const LONG iDevice = 0;
    386387            if (iPort < 0 || iPort > iMaxPort)
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QILabel.cpp

    r101561 r103362  
    5151/* static */
    5252const QRegularExpression QILabel::s_regExpCopy = QRegularExpression("<[^>]*>");
    53 QRegExp QILabel::s_regExpElide = QRegExp("(<compact\\s+elipsis=\"(start|middle|end)\"?>([^<]*)</compact>)");
     53const QRegularExpression QILabel::s_regExpElide = QRegularExpression("(<compact\\s+elipsis=\"(start|middle|end)\"?>([^<]*)</compact>)");
    5454
    5555QILabel::QILabel(QWidget *pParent /* = 0 */, Qt::WindowFlags enmFlags /* = Qt::WindowFlags() */)
     
    323323    {
    324324        /* Search for the compact tag: */
    325         if (s_regExpElide.indexIn(strLine) > -1)
     325        const QRegularExpressionMatch mt = s_regExpElide.match(strLine);
     326        if (mt.hasMatch())
    326327        {
    327328            /* USe the untouchable text to work on: */
    328329            const QString strWork = strLine;
    329330            /* Grep out the necessary info of the regexp: */
    330             const QString strCompact   = s_regExpElide.cap(1);
    331             const QString strElideMode = s_regExpElide.cap(2);
    332             const QString strElide     = s_regExpElide.cap(3);
     331            const QString strCompact   = mt.captured(1);
     332            const QString strElideMode = mt.captured(2);
     333            const QString strElide     = mt.captured(3);
    333334            /* Remove the whole compact tag (also the text): */
    334335            const QString strFlat = removeHtmlTags(QString(strWork).remove(strCompact));
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QILabel.h

    r98103 r103362  
    3939#include <QLabel>
    4040#include <QRegularExpression>
    41 #include <QRegExp>
    4241
    4342/* GUI includes: */
     
    142141    static const QRegularExpression s_regExpCopy;
    143142    /** Holds text-elide reg-exp. */
    144     static QRegExp                  s_regExpElide;
     143    static const QRegularExpression s_regExpElide;
    145144};
    146145
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIMessageBox.cpp

    r99946 r103362  
    3333#include <QMimeData>
    3434#include <QPushButton>
    35 #include <QRegExp>
    3635#include <QRegularExpression>
    3736#include <QStyle>
     
    413412    // characters with ellipsiss using the following template:
    414413    // "[50 first symbols]...[50 last symbols]"
    415     QRegExp re("[a-zA-Z0-9]{101,}");
    416     int iPosition = re.indexIn(strText);
     414    const QRegularExpression re("[a-zA-Z0-9]{101,}");
     415    QRegularExpressionMatch mt = re.match(strText);
     416    int iPosition = mt.capturedStart();
    417417    bool fChangeAllowed = iPosition != -1;
    418418    while (fChangeAllowed)
    419419    {
    420420        QString strNewText = strText;
    421         const QString strFound = re.cap(0);
     421        const QString strFound = mt.captured();
    422422        strNewText.replace(iPosition, strFound.size(), strFound.left(50) + "..." + strFound.right(50));
    423423        fChangeAllowed = fChangeAllowed && strText != strNewText;
    424424        strText = strNewText;
    425         iPosition = re.indexIn(strText);
     425        mt = re.match(strText);
     426        iPosition = mt.capturedStart();
    426427        fChangeAllowed = fChangeAllowed && iPosition != -1;
    427428    }
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp

    r102775 r103362  
    3030#include <QMetaEnum>
    3131#include <QMutex>
    32 #include <QRegExp>
    3332#include <QRegularExpression>
    3433#include <QRegularExpressionValidator>
     
    31573156    /* Gather a list of keys matching required expression: */
    31583157    QStringList result;
    3159     QRegExp re(QString("^%1/([^/]+)$").arg(GUI_CloudConsoleManager_Application));
     3158    const QRegularExpression re(QString("^%1/([^/]+)$").arg(GUI_CloudConsoleManager_Application));
    31603159    foreach (const QString &strKey, m_data.value(GlobalID).keys())
    3161         if (re.indexIn(strKey) != -1)
    3162             result << re.cap(1);
     3160    {
     3161        const QRegularExpressionMatch mt = re.match(strKey);
     3162        if (mt.hasMatch())
     3163            result << mt.captured(1);
     3164    }
    31633165    return result;
    31643166}
     
    31683170    /* Gather a list of keys matching required expression: */
    31693171    QStringList result;
    3170     QRegExp re(QString("^%1/%2/([^/]+)$").arg(GUI_CloudConsoleManager_Application, strId));
     3172    const QRegularExpression re(QString("^%1/%2/([^/]+)$").arg(GUI_CloudConsoleManager_Application, strId));
    31713173    foreach (const QString &strKey, m_data.value(GlobalID).keys())
    3172         if (re.indexIn(strKey) != -1)
    3173             result << re.cap(1);
     3174    {
     3175        const QRegularExpressionMatch mt = re.match(strKey);
     3176        if (mt.hasMatch())
     3177            result << mt.captured(1);
     3178    }
    31743179    return result;
    31753180}
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UITranslator.cpp

    r103320 r103362  
    3030#include <QDir>
    3131#include <QKeySequence>
    32 #include <QRegExp>
    3332#include <QRegularExpression>
    3433#ifdef Q_OS_UNIX
     
    111110    if (!strEffectiveLangId.isEmpty() && strEffectiveLangId != vboxBuiltInLanguageName())
    112111    {
    113         QRegExp regExp(vboxLanguageIdRegExp());
    114         int iPos = regExp.indexIn(strEffectiveLangId);
     112        const QRegularExpression re(vboxLanguageIdRegExp());
     113        const QRegularExpressionMatch mt = re.match(strEffectiveLangId);
    115114        /* The language ID should match the regexp completely: */
    116         AssertReturnVoid(iPos == 0);
    117 
    118         QString strStrippedLangId = regExp.cap(2);
     115        AssertReturnVoid(mt.capturedStart() == 0);
     116
     117        QString strStrippedLangId = mt.captured(2);
    119118
    120119        if (nlsDir.exists(vboxLanguageFileBase() + strEffectiveLangId + vboxLanguageFileExtension()))
     
    394393{
    395394    /* Text should be in form of B|KB|MB|GB|TB|PB. */
    396     QRegExp regexp(sizeRegexp());
    397     int iPos = regexp.indexIn(strText);
    398     if (iPos != -1)
    399     {
    400         QString strInteger = regexp.cap(1);
     395    const QRegularExpression re(sizeRegexp());
     396    const QRegularExpressionMatch mt = re.match(strText);
     397    if (mt.hasMatch())
     398    {
     399        QString strInteger = mt.captured(1);
    401400        QString strHundred;
    402         QString strSuff = regexp.cap(2);
     401        QString strSuff = mt.captured(2);
    403402        if (strInteger.isEmpty())
    404403        {
    405             strInteger = regexp.cap(3);
    406             strHundred = regexp.cap(4);
    407             strSuff = regexp.cap(5);
     404            strInteger = mt.captured(3);
     405            strHundred = mt.captured(4);
     406            strSuff = mt.captured(5);
    408407        }
    409408
     
    439438{
    440439    /* Text should be in form of B|KB|MB|GB|TB|PB. */
    441     QRegExp regexp(sizeRegexp());
    442     int iPos = regexp.indexIn(strText);
    443     if (iPos != -1)
    444     {
    445         QString strInteger = regexp.cap(1);
    446         QString strSuff = regexp.cap(2);
     440    const QRegularExpression re(sizeRegexp());
     441    const QRegularExpressionMatch mt = re.match(strText);
     442    if (mt.hasMatch())
     443    {
     444        QString strInteger = mt.captured(1);
     445        QString strSuff = mt.captured(2);
    447446        if (strInteger.isEmpty())
    448447        {
    449             strInteger = regexp.cap(3);
    450             strSuff = regexp.cap(5);
     448            strInteger = mt.captured(3);
     449            strSuff = mt.captured(5);
    451450        }
    452451
     
    475474{
    476475    /* Text should be in form of B|KB|MB|GB|TB|PB. */
    477     QRegExp regexp(sizeRegexp());
    478     int iPos = regexp.indexIn(strText);
    479     if (iPos != -1)
    480     {
    481         QString strInteger = regexp.cap(1);
    482         QString strSuff = regexp.cap(2);
     476    const QRegularExpression re(sizeRegexp());
     477    const QRegularExpressionMatch mt = re.match(strText);
     478    if (mt.hasMatch())
     479    {
     480        QString strInteger = mt.captured(1);
     481        QString strSuff = mt.captured(2);
    483482        if (strInteger.isEmpty())
    484483        {
    485             strInteger = regexp.cap(3);
    486             strSuff = regexp.cap(5);
     484            strInteger = mt.captured(3);
     485            strSuff = mt.captured(5);
    487486        }
    488487
     
    756755     * removed from the string. */
    757756
    758     QRegExp accel("\\(&[a-zA-Z]\\)");
    759     int iPos = accel.indexIn(strText);
     757    const QRegularExpression re("\\(&[a-zA-Z]\\)");
     758    const QRegularExpressionMatch mt = re.match(strText);
     759    int iPos = mt.capturedStart();
    760760    if (iPos >= 0)
    761         strText.remove(iPos, accel.cap().length());
     761        strText.remove(iPos, mt.capturedLength());
    762762    else
    763763    {
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp

    r102787 r103362  
    4242#include <QWindow>
    4343#ifndef VBOX_WS_WIN
    44 # include <QRegExp>
     44# include <QRegularExpression>
    4545#endif
    4646
     
    30493049    /* Parse argument string: */
    30503050    QStringList arguments;
    3051     QRegExp re("(\"[^\"]+\")|('[^']+')|([^\\s\"']+)");
     3051    const QRegularExpression re("(\"[^\"]+\")|('[^']+')|([^\\s\"']+)");
    30523052    int iPosition = 0;
    3053     int iIndex = re.indexIn(strArguments, iPosition);
     3053    QRegularExpressionMatch mt = re.match(strArguments, iPosition);
     3054    int iIndex = mt.capturedStart();
    30543055    while (iIndex != -1)
    30553056    {
    30563057        /* Get what's the sequence we have: */
    3057         const QString strCap0 = re.cap(0);
     3058        const QString strCap0 = mt.captured(0);
    30583059        /* Get what's the double-quoted sequence we have: */
    3059         const QString strCap1 = re.cap(1);
     3060        const QString strCap1 = mt.captured(1);
    30603061        /* Get what's the single-quoted sequence we have: */
    3061         const QString strCap2 = re.cap(2);
     3062        const QString strCap2 = mt.captured(2);
    30623063        /* Get what's the unquoted sequence we have: */
    3063         const QString strCap3 = re.cap(3);
     3064        const QString strCap3 = mt.captured(3);
    30643065
    30653066        /* If new sequence starts where previous ended
     
    31033104        iPosition = iIndex + strCap0.size();
    31043105        /* Search for a next sequence: */
    3105         iIndex = re.indexIn(strArguments, iPosition);
     3106        mt = re.match(strArguments, iPosition);
     3107        iIndex = mt.capturedStart();
    31063108    }
    31073109
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserAbstractModel.cpp

    r103023 r103362  
    2727
    2828/* Qt includes: */
    29 #include <QRegExp>
    3029#include <QRegularExpression>
    3130#include <QThread>
     
    471470    const QString strShortTemplate = strMinimumName;
    472471    const QString strFullTemplate = strShortTemplate + QString(" (\\d+)");
    473     const QRegExp shortRegExp(strShortTemplate);
    474     const QRegExp fullRegExp(strFullTemplate);
     472    const QRegularExpression shortRegExp(strShortTemplate);
     473    const QRegularExpression fullRegExp(strFullTemplate);
    475474
    476475    /* Search for the maximum index: */
     
    478477    foreach (const QString &strName, groupNames)
    479478    {
    480         if (shortRegExp.exactMatch(strName))
     479        const QRegularExpressionMatch mtShort = shortRegExp.match(strName);
     480        const QRegularExpressionMatch mtFull = fullRegExp.match(strName);
     481        if (mtShort.hasMatch())
    481482            iMinimumPossibleNumber = qMax(iMinimumPossibleNumber, 2);
    482         else if (fullRegExp.exactMatch(strName))
    483             iMinimumPossibleNumber = qMax(iMinimumPossibleNumber, fullRegExp.cap(1).toInt() + 1);
     483        else if (mtFull.hasMatch())
     484            iMinimumPossibleNumber = qMax(iMinimumPossibleNumber, mtFull.captured(1).toInt() + 1);
    484485    }
    485486
     
    654655{
    655656    /* Compose RE for profile: */
    656     QRegExp re("^/[^/]+/[^/]+$");
     657    const QRegularExpression re("^/[^/]+/[^/]+$");
    657658    /* Check whether keys match profile RE: */
    658659    foreach (const UICloudEntityKey &key, m_cloudEntityKeysBeingUpdated)
    659660    {
    660         const int iIndex = re.indexIn(key.toString());
    661         if (iIndex != -1)
     661        const QRegularExpressionMatch mt = re.match(key.toString());
     662        if (mt.hasMatch())
    662663            return true;
    663664    }
     
    14631464    const QString strNodeOptionOpened = optionToString(UIChooserNodeDataOptionType_GroupOpened);
    14641465    const QString strDefinitionTemplate = QString("%1(\\S)*=%2").arg(strNodePrefix, strName);
    1465     const QRegExp definitionRegExp(strDefinitionTemplate);
     1466    const QRegularExpression re(strDefinitionTemplate);
    14661467    /* For each the group definition: */
    14671468    foreach (const QString &strDefinition, definitions)
    14681469    {
    14691470        /* Check if this is required definition: */
    1470         if (definitionRegExp.indexIn(strDefinition) == 0)
     1471        const QRegularExpressionMatch mt = re.match(strDefinition);
     1472        if (mt.capturedStart() == 0)
    14711473        {
    14721474            /* Get group descriptor: */
    1473             const QString strDescriptor(definitionRegExp.cap(1));
     1475            const QString strDescriptor = mt.captured(1);
    14741476            if (strDescriptor.contains(strNodeOptionOpened))
    14751477                return true;
     
    14941496    const QString strNodeValueDefault = valueToString(UIChooserNodeDataValueType_GlobalDefault);
    14951497    const QString strDefinitionTemplate = QString("%1(\\S)*=%2").arg(strNodePrefix, strNodeValueDefault);
    1496     const QRegExp definitionRegExp(strDefinitionTemplate);
     1498    const QRegularExpression re(strDefinitionTemplate);
    14971499    /* For each the group definition: */
    14981500    foreach (const QString &strDefinition, definitions)
    14991501    {
    15001502        /* Check if this is required definition: */
    1501         if (definitionRegExp.indexIn(strDefinition) == 0)
     1503        const QRegularExpressionMatch mt = re.match(strDefinition);
     1504        if (mt.capturedStart() == 0)
    15021505        {
    15031506            /* Get group descriptor: */
    1504             const QString strDescriptor(definitionRegExp.cap(1));
     1507            const QString strDescriptor = mt.captured(1);
    15051508            if (strDescriptor.contains(strNodeOptionFavorite))
    15061509                return true;
     
    16461649            return -1;
    16471650    }
    1648     QRegExp definitionRegExpShort(strDefinitionTemplateShort);
    1649     QRegExp definitionRegExpFull(strDefinitionTemplateFull);
     1651    const QRegularExpression definitionRegExpShort(strDefinitionTemplateShort);
     1652    const QRegularExpression definitionRegExpFull(strDefinitionTemplateFull);
    16501653
    16511654    /* For each the definition: */
     
    16541657    {
    16551658        /* Check if this definition is of required type: */
    1656         if (definitionRegExpShort.indexIn(strDefinition) == 0)
     1659        const QRegularExpressionMatch mtShort = definitionRegExpShort.match(strDefinition);
     1660        if (mtShort.capturedStart() == 0)
    16571661        {
    16581662            ++iDefinitionIndex;
    16591663            /* Check if this definition is exactly what we need: */
    1660             if (definitionRegExpFull.indexIn(strDefinition) == 0)
     1664            const QRegularExpressionMatch mtFull = definitionRegExpFull.match(strDefinition);
     1665            if (mtFull.capturedStart() == 0)
    16611666                return iDefinitionIndex;
    16621667        }
  • trunk/src/VBox/Frontends/VirtualBox/src/networkmanager/UINetworkManager.cpp

    r102269 r103362  
    3030#include <QMenuBar>
    3131#include <QPushButton>
    32 #include <QRegExp>
     32#include <QRegularExpression>
    3333#include <QVBoxLayout>
    3434
     
    525525    QMap<int, bool> presence;
    526526    const QString strNameTemplate("HostNetwork%1");
    527     const QRegExp regExp(strNameTemplate.arg("([\\d]*)"));
     527    const QRegularExpression re(strNameTemplate.arg("([\\d]*)"));
    528528    foreach (const QString &strName, names)
    529         if (regExp.indexIn(strName) != -1)
    530             presence[regExp.cap(1).toInt()] = true;
     529    {
     530        const QRegularExpressionMatch mt = re.match(strName);
     531        if (mt.hasMatch())
     532            presence[mt.captured(1).toInt()] = true;
     533    }
    531534    /* Search for a minimum index: */
    532535    int iMinimumIndex = 0;
     
    780783    QMap<int, bool> presence;
    781784    const QString strNameTemplate("NatNetwork%1");
    782     const QRegExp regExp(strNameTemplate.arg("([\\d]*)"));
     785    const QRegularExpression re(strNameTemplate.arg("([\\d]*)"));
    783786    foreach (const QString &strName, names)
    784         if (regExp.indexIn(strName) != -1)
    785             presence[regExp.cap(1).toInt()] = true;
     787    {
     788        const QRegularExpressionMatch mt = re.match(strName);
     789        if (mt.hasMatch())
     790            presence[mt.captured(1).toInt()] = true;
     791    }
    786792    /* Search for a minimum index: */
    787793    int iMinimumIndex = 0;
     
    919925    QMap<int, bool> presence;
    920926    const QString strNameTemplate("CloudNetwork%1");
    921     const QRegExp regExp(strNameTemplate.arg("([\\d]*)"));
     927    const QRegularExpression re(strNameTemplate.arg("([\\d]*)"));
    922928    foreach (const QString &strName, names)
    923         if (regExp.indexIn(strName) != -1)
    924             presence[regExp.cap(1).toInt()] = true;
     929    {
     930        const QRegularExpressionMatch mt = re.match(strName);
     931        if (mt.hasMatch())
     932            presence[mt.captured(1).toInt()] = true;
     933    }
    925934    /* Search for a minimum index: */
    926935    int iMinimumIndex = 0;
     
    22572266            strIPv6Rule.replace(':', ',');
    22582267            /* But replace ',' back with ':' for addresses: */
    2259             QRegExp re("\\[[0-9a-fA-F,]*,[0-9a-fA-F,]*\\]");
    2260             re.setMinimal(true);
    2261             while (re.indexIn(strIPv6Rule) != -1)
     2268            QRegularExpression re("\\[[0-9a-fA-F,]*,[0-9a-fA-F,]*\\]");
     2269            re.setPatternOptions(QRegularExpression::InvertedGreedinessOption);
     2270            QRegularExpressionMatch mt = re.match(strIPv6Rule);
     2271            while (mt.hasMatch())
    22622272            {
    2263                 QString strCapOld = re.cap(0);
     2273                QString strCapOld = mt.captured();
    22642274                QString strCapNew = strCapOld;
    22652275                strCapNew.replace(',', ':');
    22662276                strIPv6Rule.replace(strCapOld, strCapNew);
     2277                mt = re.match(strIPv6Rule);
    22672278            }
    22682279            /* Parse rules: */
  • trunk/src/VBox/Frontends/VirtualBox/src/objects/UIRichTextString.cpp

    r98103 r103362  
    2929#include <QApplication>
    3030#include <QPalette>
    31 #include <QRegExp>
     31#include <QRegularExpression>
    3232
    3333/* GUI includes: */
     
    145145                const QString strFullPattern = composeFullPattern(strPattern, strPattern, iMaxLevel);
    146146                //printf("  Full pattern: %s\n", strFullPattern.toUtf8().constData());
    147                 QRegExp regExp(strFullPattern);
    148                 regExp.setMinimal(true);
    149                 const int iPosition = regExp.indexIn(m_strString);
     147                QRegularExpression re(strFullPattern);
     148                re.setPatternOptions(QRegularExpression::InvertedGreedinessOption);
     149                const QRegularExpressionMatch mt = re.match(m_strString);
     150                const int iPosition = mt.capturedStart();
    150151                AssertReturnVoid(iPosition != -1);
    151                 if (iPosition != -1)
    152                 {
    153                     /* Cut the found string: */
    154                     m_strString.remove(iPosition, regExp.cap(0).size());
    155                     /* And paste that string as our child: */
    156                     const bool fPatterHasMeta = s_doPatternHasMeta.value(enmPattern);
    157                     const QString strSubString = !fPatterHasMeta ? regExp.cap(1) : regExp.cap(2);
    158                     const QString strSubMeta   = !fPatterHasMeta ? QString()     : regExp.cap(1);
    159                     m_strings.insert(iPosition, new UIRichTextString(strSubString, enmPattern, strSubMeta));
    160                 }
     152                /* Cut the found string: */
     153                m_strString.remove(iPosition, mt.capturedLength());
     154                /* And paste that string as our child: */
     155                const bool fPatterHasMeta = s_doPatternHasMeta.value(enmPattern);
     156                const QString strSubString = !fPatterHasMeta ? mt.captured(1) : mt.captured(2);
     157                const QString strSubMeta   = !fPatterHasMeta ? QString()      : mt.captured(1);
     158                m_strings.insert(iPosition, new UIRichTextString(strSubString, enmPattern, strSubMeta));
    161159            }
    162160        }
     
    189187                                        const QString &strCurrentPattern, int iCurrentLevel /* = 0 */)
    190188{
    191     QRegExp regExp(strCurrentPattern.arg(s_strAny));
    192     regExp.setMinimal(true);
    193     if (regExp.indexIn(strString) != -1)
     189    QRegularExpression re(strCurrentPattern.arg(s_strAny));
     190    re.setPatternOptions(QRegularExpression::InvertedGreedinessOption);
     191    const QRegularExpressionMatch mt = re.match(strString);
     192    if (mt.hasMatch())
    194193        return searchForMaxLevel(strString, strPattern,
    195194                                 strCurrentPattern.arg(s_strAny + strPattern + s_strAny),
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r102599 r103362  
    3333#include <QImageWriter>
    3434#include <QPainter>
    35 #include <QRegExp>
    3635#include <QRegularExpression>
    3736#include <QTimer>
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r102600 r103362  
    2828/* Qt includes: */
    2929#include <QApplication>
    30 #include <QRegExp>
     30#include <QRegularExpression>
    3131#include <QWidget>
    3232
     
    29352935    bool fSuccess = true;
    29362936    ulong uMaxIndex = 0;
    2937     QRegExp regExp(QString("^") + strNameTemplate.arg("([0-9]+)") + QString("$"));
     2937    const QRegularExpression re(QString("^") + strNameTemplate.arg("([0-9]+)") + QString("$"));
    29382938    if (!comSnapshot.isNull())
    29392939    {
     
    29452945        else
    29462946        {
    2947             const int iPos = regExp.indexIn(strName);
    2948             if (iPos != -1)
    2949                 uMaxIndex = regExp.cap(1).toULong() > uMaxIndex ? regExp.cap(1).toULong() : uMaxIndex;
     2947            const QRegularExpressionMatch mt = re.match(strName);
     2948            if (mt.hasMatch())
     2949            {
     2950                const ulong uFoundIndex = mt.captured(1).toULong();
     2951                uMaxIndex = uFoundIndex > uMaxIndex ? uFoundIndex : uMaxIndex;
     2952            }
    29502953            /* Traversing all the snapshot children: */
    29512954            QVector<CSnapshot> comSnapshotChildren = comSnapshot.GetChildren();
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UILanguageSettingsEditor.cpp

    r101455 r103362  
    3030#include <QHeaderView>
    3131#include <QPainter>
    32 #include <QRegExp>
     32#include <QRegularExpression>
    3333#include <QTranslator>
    3434#include <QVBoxLayout>
     
    387387    {
    388388        QString strFileName = *it;
    389         QRegExp regExp(UITranslator::vboxLanguageFileBase() + UITranslator::vboxLanguageIdRegExp());
    390         int iPos = regExp.indexIn(strFileName);
    391         if (iPos == -1)
     389        const QRegularExpression re(UITranslator::vboxLanguageFileBase() + UITranslator::vboxLanguageIdRegExp());
     390        const QRegularExpressionMatch mt = re.match(strFileName);
     391        if (!mt.hasMatch())
    392392            continue;
    393393
    394394        /* Skip any English version, cause this is extra handled: */
    395         QString strLanguage = regExp.cap(2);
     395        QString strLanguage = mt.captured(2);
    396396        if (strLanguage.toLower() == "en")
    397397            continue;
     
    401401            continue;
    402402
    403         new UILanguageItem(m_pTreeWidget, translator, regExp.cap(1));
     403        new UILanguageItem(m_pTreeWidget, translator, mt.captured(1));
    404404    }
    405405
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UISharedFoldersEditor.cpp

    r101498 r103362  
    2929#include <QHeaderView>
    3030#include <QMenu>
    31 #include <QRegExp>
     31#include <QRegularExpression>
    3232#include <QTimer>
    3333#include <QVBoxLayout>
     
    232232                case FormatType_EllipsisFile:
    233233                {
    234                     const QRegExp regExp("([\\\\/][^\\\\^/]+[\\\\/]?$)");
    235                     const int iNewFinish = regExp.indexIn(strOneString);
     234                    const QRegularExpression re("([\\\\/][^\\\\^/]+[\\\\/]?$)");
     235                    const QRegularExpressionMatch mt = re.match(strOneString);
     236                    const int iNewFinish = mt.capturedStart();
    236237                    if (iNewFinish != -1)
    237238                        iFinish = iNewFinish;
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIUSBFiltersEditor.cpp

    r101011 r103362  
    2929#include <QHeaderView>
    3030#include <QMenu>
    31 #include <QRegExp>
     31#include <QRegularExpression>
    3232#include <QToolTip>
    3333#include <QVBoxLayout>
     
    353353    /* Search for the max available filter index: */
    354354    int iMaxFilterIndex = 0;
    355     const QRegExp regExp(QString("^") + m_strTrUSBFilterName.arg("([0-9]+)") + QString("$"));
     355    const QRegularExpression re(QString("^") + m_strTrUSBFilterName.arg("([0-9]+)") + QString("$"));
    356356    QTreeWidgetItemIterator iterator(m_pTreeWidget);
    357357    while (*iterator)
    358358    {
    359359        const QString filterName = (*iterator)->text(0);
    360         const int pos = regExp.indexIn(filterName);
    361         if (pos != -1)
    362             iMaxFilterIndex = regExp.cap(1).toInt() > iMaxFilterIndex ?
    363                               regExp.cap(1).toInt() : iMaxFilterIndex;
     360        const QRegularExpressionMatch mt = re.match(filterName);
     361        if (mt.hasMatch())
     362        {
     363            const int iFoundIndex = mt.captured(1).toInt();
     364            iMaxFilterIndex = iFoundIndex > iMaxFilterIndex
     365                            ? iFoundIndex : iMaxFilterIndex;
     366        }
    364367        ++iterator;
    365368    }
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.cpp

    r101230 r103362  
    3434#include <QMenu>
    3535#include <QRadioButton>
    36 #include <QRegExp>
    3736#include <QSpacerItem>
    3837#include <QVBoxLayout>
  • trunk/src/VBox/Frontends/VirtualBox/src/snapshots/UISnapshotPane.cpp

    r102269 r103362  
    3535#include <QPointer>
    3636#include <QReadWriteLock>
    37 #include <QRegExp>
     37#include <QRegularExpression>
    3838#include <QScrollBar>
    3939#include <QTimer>
     
    16651665    int iMaximumIndex = 0;
    16661666    const QString strNameTemplate = tr("Snapshot %1");
    1667     const QRegExp reName(QString("^") + strNameTemplate.arg("([0-9]+)") + QString("$"));
     1667    const QRegularExpression re(QString("^") + strNameTemplate.arg("([0-9]+)") + QString("$"));
    16681668    QTreeWidgetItemIterator iterator(m_pSnapshotTree);
    16691669    while (*iterator)
    16701670    {
    16711671        const QString strName = static_cast<UISnapshotItem*>(*iterator)->name();
    1672         const int iPosition = reName.indexIn(strName);
    1673         if (iPosition != -1)
    1674             iMaximumIndex = reName.cap(1).toInt() > iMaximumIndex
    1675                           ? reName.cap(1).toInt()
    1676                           : iMaximumIndex;
     1672        const QRegularExpressionMatch mt = re.match(strName);
     1673        if (mt.hasMatch())
     1674        {
     1675            const int iFoundIndex = mt.captured(1).toInt();
     1676            iMaximumIndex = iFoundIndex > iMaximumIndex
     1677                          ? iFoundIndex : iMaximumIndex;
     1678        }
    16771679        ++iterator;
    16781680    }
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceEditorWidget.cpp

    r103246 r103362  
    3333#include <QLabel>
    3434#include <QLineEdit>
    35 #include <QRegExp>
     35#include <QRegularExpression>
    3636#include <QSpinBox>
    3737#include <QTextEdit>
     
    13751375            }
    13761376        }
    1377         QRegExp rx("controller=(\\d+);?");
     1377        const QRegularExpression re("controller=(\\d+);?");
    13781378        /* Now process the hard disk images */
    13791379        for (int iHDIndex = 0; iHDIndex < hdIndexes.size(); ++iHDIndex)
     
    13811381            int i = hdIndexes[iHDIndex];
    13821382            QString ecnf = extraConfigValues[i];
    1383             if (rx.indexIn(ecnf) != -1)
     1383            const QRegularExpressionMatch mt = re.match(ecnf);
     1384            if (mt.hasMatch())
    13841385            {
    13851386                /* Get the controller */
    1386                 UIVirtualHardwareItem *pControllerItem = controllerMap[rx.cap(1).toInt()];
     1387                UIVirtualHardwareItem *pControllerItem = controllerMap[mt.captured(1).toInt()];
    13871388                if (pControllerItem)
    13881389                {
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIFilePathSelector.cpp

    r101563 r103362  
    3434#include <QHBoxLayout>
    3535#include <QLineEdit>
     36#include <QRegularExpression>
    3637#ifdef VBOX_WS_WIN
    3738# include <QListView>
    3839#endif
    39 #include <QRegExp>
    4040
    4141/* GUI includes: */
     
    520520
    521521            /* Selecting remove position: */
    522             QRegExp regExp("([\\\\/][^\\\\^/]+[\\\\/]?$)");
    523             int iNewFinish = regExp.indexIn(strFullText);
     522            const QRegularExpression re("([\\\\/][^\\\\^/]+[\\\\/]?$)");
     523            const QRegularExpressionMatch mt = re.match(strFullText);
     524            const int iNewFinish = mt.capturedStart();
    524525            if (iNewFinish != -1)
    525526                iFinish = iNewFinish;
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPortForwardingTable.cpp

    r100349 r103362  
    3434#include <QLineEdit>
    3535#include <QMenu>
    36 #include <QRegExp>
     36#include <QRegularExpression>
    3737#include <QSpinBox>
    3838#include <QStyledItemDelegate>
     
    592592    uint uMaxIndex = 0;
    593593    QString strTemplate("Rule %1");
    594     QRegExp regExp(strTemplate.arg("(\\d+)"));
     594    const QRegularExpression re(strTemplate.arg("(\\d+)"));
    595595    for (int i = 0; i < m_dataList.size(); ++i)
    596         if (regExp.indexIn(m_dataList[i]->name()) > -1)
    597             uMaxIndex = regExp.cap(1).toUInt() > uMaxIndex ? regExp.cap(1).toUInt() : uMaxIndex;
     596    {
     597        const QRegularExpressionMatch mt = re.match(m_dataList[i]->name());
     598        if (mt.hasMatch())
     599        {
     600            const uint uFoundIndex = mt.captured(1).toUInt();
     601            uMaxIndex = uFoundIndex > uMaxIndex ? uFoundIndex : uMaxIndex;
     602        }
     603    }
    598604    /* If index is valid => copy data: */
    599605    if (index.isValid())
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette