- Timestamp:
- Feb 14, 2024 4:50:56 PM (12 months ago)
- 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 29 29 #include <QApplication> 30 30 #include <QHash> 31 #include <QRegExp>32 31 #include <QRegularExpression> 33 32 … … 312 311 /* Search for a template index strStorageSlot corresponds to: */ 313 312 int iIndex = -1; 314 QRegExp regExp; 313 QRegularExpression re; 314 QRegularExpressionMatch mt; 315 315 for (int i = 0; i < templates.size(); ++i) 316 316 { 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()) 319 320 { 320 321 iIndex = i; … … 382 383 break; 383 384 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(); 385 386 const LONG iDevice = 0; 386 387 if (iPort < 0 || iPort > iMaxPort) -
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QILabel.cpp
r101561 r103362 51 51 /* static */ 52 52 const QRegularExpression QILabel::s_regExpCopy = QRegularExpression("<[^>]*>"); 53 QRegExp QILabel::s_regExpElide = QRegExp("(<compact\\s+elipsis=\"(start|middle|end)\"?>([^<]*)</compact>)");53 const QRegularExpression QILabel::s_regExpElide = QRegularExpression("(<compact\\s+elipsis=\"(start|middle|end)\"?>([^<]*)</compact>)"); 54 54 55 55 QILabel::QILabel(QWidget *pParent /* = 0 */, Qt::WindowFlags enmFlags /* = Qt::WindowFlags() */) … … 323 323 { 324 324 /* Search for the compact tag: */ 325 if (s_regExpElide.indexIn(strLine) > -1) 325 const QRegularExpressionMatch mt = s_regExpElide.match(strLine); 326 if (mt.hasMatch()) 326 327 { 327 328 /* USe the untouchable text to work on: */ 328 329 const QString strWork = strLine; 329 330 /* 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); 333 334 /* Remove the whole compact tag (also the text): */ 334 335 const QString strFlat = removeHtmlTags(QString(strWork).remove(strCompact)); -
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QILabel.h
r98103 r103362 39 39 #include <QLabel> 40 40 #include <QRegularExpression> 41 #include <QRegExp>42 41 43 42 /* GUI includes: */ … … 142 141 static const QRegularExpression s_regExpCopy; 143 142 /** Holds text-elide reg-exp. */ 144 static QRegExps_regExpElide;143 static const QRegularExpression s_regExpElide; 145 144 }; 146 145 -
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIMessageBox.cpp
r99946 r103362 33 33 #include <QMimeData> 34 34 #include <QPushButton> 35 #include <QRegExp>36 35 #include <QRegularExpression> 37 36 #include <QStyle> … … 413 412 // characters with ellipsiss using the following template: 414 413 // "[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(); 417 417 bool fChangeAllowed = iPosition != -1; 418 418 while (fChangeAllowed) 419 419 { 420 420 QString strNewText = strText; 421 const QString strFound = re.cap(0);421 const QString strFound = mt.captured(); 422 422 strNewText.replace(iPosition, strFound.size(), strFound.left(50) + "..." + strFound.right(50)); 423 423 fChangeAllowed = fChangeAllowed && strText != strNewText; 424 424 strText = strNewText; 425 iPosition = re.indexIn(strText); 425 mt = re.match(strText); 426 iPosition = mt.capturedStart(); 426 427 fChangeAllowed = fChangeAllowed && iPosition != -1; 427 428 } -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
r102775 r103362 30 30 #include <QMetaEnum> 31 31 #include <QMutex> 32 #include <QRegExp>33 32 #include <QRegularExpression> 34 33 #include <QRegularExpressionValidator> … … 3157 3156 /* Gather a list of keys matching required expression: */ 3158 3157 QStringList result; 3159 QRegExpre(QString("^%1/([^/]+)$").arg(GUI_CloudConsoleManager_Application));3158 const QRegularExpression re(QString("^%1/([^/]+)$").arg(GUI_CloudConsoleManager_Application)); 3160 3159 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 } 3163 3165 return result; 3164 3166 } … … 3168 3170 /* Gather a list of keys matching required expression: */ 3169 3171 QStringList result; 3170 QRegExpre(QString("^%1/%2/([^/]+)$").arg(GUI_CloudConsoleManager_Application, strId));3172 const QRegularExpression re(QString("^%1/%2/([^/]+)$").arg(GUI_CloudConsoleManager_Application, strId)); 3171 3173 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 } 3174 3179 return result; 3175 3180 } -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UITranslator.cpp
r103320 r103362 30 30 #include <QDir> 31 31 #include <QKeySequence> 32 #include <QRegExp>33 32 #include <QRegularExpression> 34 33 #ifdef Q_OS_UNIX … … 111 110 if (!strEffectiveLangId.isEmpty() && strEffectiveLangId != vboxBuiltInLanguageName()) 112 111 { 113 QRegExp regExp(vboxLanguageIdRegExp());114 int iPos = regExp.indexIn(strEffectiveLangId);112 const QRegularExpression re(vboxLanguageIdRegExp()); 113 const QRegularExpressionMatch mt = re.match(strEffectiveLangId); 115 114 /* 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); 119 118 120 119 if (nlsDir.exists(vboxLanguageFileBase() + strEffectiveLangId + vboxLanguageFileExtension())) … … 394 393 { 395 394 /* 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); 401 400 QString strHundred; 402 QString strSuff = regexp.cap(2);401 QString strSuff = mt.captured(2); 403 402 if (strInteger.isEmpty()) 404 403 { 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); 408 407 } 409 408 … … 439 438 { 440 439 /* 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); 447 446 if (strInteger.isEmpty()) 448 447 { 449 strInteger = regexp.cap(3);450 strSuff = regexp.cap(5);448 strInteger = mt.captured(3); 449 strSuff = mt.captured(5); 451 450 } 452 451 … … 475 474 { 476 475 /* 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); 483 482 if (strInteger.isEmpty()) 484 483 { 485 strInteger = regexp.cap(3);486 strSuff = regexp.cap(5);484 strInteger = mt.captured(3); 485 strSuff = mt.captured(5); 487 486 } 488 487 … … 756 755 * removed from the string. */ 757 756 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(); 760 760 if (iPos >= 0) 761 strText.remove(iPos, accel.cap().length());761 strText.remove(iPos, mt.capturedLength()); 762 762 else 763 763 { -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp
r102787 r103362 42 42 #include <QWindow> 43 43 #ifndef VBOX_WS_WIN 44 # include <QReg Exp>44 # include <QRegularExpression> 45 45 #endif 46 46 … … 3049 3049 /* Parse argument string: */ 3050 3050 QStringList arguments; 3051 QRegExpre("(\"[^\"]+\")|('[^']+')|([^\\s\"']+)");3051 const QRegularExpression re("(\"[^\"]+\")|('[^']+')|([^\\s\"']+)"); 3052 3052 int iPosition = 0; 3053 int iIndex = re.indexIn(strArguments, iPosition); 3053 QRegularExpressionMatch mt = re.match(strArguments, iPosition); 3054 int iIndex = mt.capturedStart(); 3054 3055 while (iIndex != -1) 3055 3056 { 3056 3057 /* Get what's the sequence we have: */ 3057 const QString strCap0 = re.cap(0);3058 const QString strCap0 = mt.captured(0); 3058 3059 /* Get what's the double-quoted sequence we have: */ 3059 const QString strCap1 = re.cap(1);3060 const QString strCap1 = mt.captured(1); 3060 3061 /* Get what's the single-quoted sequence we have: */ 3061 const QString strCap2 = re.cap(2);3062 const QString strCap2 = mt.captured(2); 3062 3063 /* Get what's the unquoted sequence we have: */ 3063 const QString strCap3 = re.cap(3);3064 const QString strCap3 = mt.captured(3); 3064 3065 3065 3066 /* If new sequence starts where previous ended … … 3103 3104 iPosition = iIndex + strCap0.size(); 3104 3105 /* Search for a next sequence: */ 3105 iIndex = re.indexIn(strArguments, iPosition); 3106 mt = re.match(strArguments, iPosition); 3107 iIndex = mt.capturedStart(); 3106 3108 } 3107 3109 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserAbstractModel.cpp
r103023 r103362 27 27 28 28 /* Qt includes: */ 29 #include <QRegExp>30 29 #include <QRegularExpression> 31 30 #include <QThread> … … 471 470 const QString strShortTemplate = strMinimumName; 472 471 const QString strFullTemplate = strShortTemplate + QString(" (\\d+)"); 473 const QReg ExpshortRegExp(strShortTemplate);474 const QReg ExpfullRegExp(strFullTemplate);472 const QRegularExpression shortRegExp(strShortTemplate); 473 const QRegularExpression fullRegExp(strFullTemplate); 475 474 476 475 /* Search for the maximum index: */ … … 478 477 foreach (const QString &strName, groupNames) 479 478 { 480 if (shortRegExp.exactMatch(strName)) 479 const QRegularExpressionMatch mtShort = shortRegExp.match(strName); 480 const QRegularExpressionMatch mtFull = fullRegExp.match(strName); 481 if (mtShort.hasMatch()) 481 482 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); 484 485 } 485 486 … … 654 655 { 655 656 /* Compose RE for profile: */ 656 QRegExpre("^/[^/]+/[^/]+$");657 const QRegularExpression re("^/[^/]+/[^/]+$"); 657 658 /* Check whether keys match profile RE: */ 658 659 foreach (const UICloudEntityKey &key, m_cloudEntityKeysBeingUpdated) 659 660 { 660 const int iIndex = re.indexIn(key.toString());661 if ( iIndex != -1)661 const QRegularExpressionMatch mt = re.match(key.toString()); 662 if (mt.hasMatch()) 662 663 return true; 663 664 } … … 1463 1464 const QString strNodeOptionOpened = optionToString(UIChooserNodeDataOptionType_GroupOpened); 1464 1465 const QString strDefinitionTemplate = QString("%1(\\S)*=%2").arg(strNodePrefix, strName); 1465 const QReg Exp definitionRegExp(strDefinitionTemplate);1466 const QRegularExpression re(strDefinitionTemplate); 1466 1467 /* For each the group definition: */ 1467 1468 foreach (const QString &strDefinition, definitions) 1468 1469 { 1469 1470 /* Check if this is required definition: */ 1470 if (definitionRegExp.indexIn(strDefinition) == 0) 1471 const QRegularExpressionMatch mt = re.match(strDefinition); 1472 if (mt.capturedStart() == 0) 1471 1473 { 1472 1474 /* Get group descriptor: */ 1473 const QString strDescriptor (definitionRegExp.cap(1));1475 const QString strDescriptor = mt.captured(1); 1474 1476 if (strDescriptor.contains(strNodeOptionOpened)) 1475 1477 return true; … … 1494 1496 const QString strNodeValueDefault = valueToString(UIChooserNodeDataValueType_GlobalDefault); 1495 1497 const QString strDefinitionTemplate = QString("%1(\\S)*=%2").arg(strNodePrefix, strNodeValueDefault); 1496 const QReg Exp definitionRegExp(strDefinitionTemplate);1498 const QRegularExpression re(strDefinitionTemplate); 1497 1499 /* For each the group definition: */ 1498 1500 foreach (const QString &strDefinition, definitions) 1499 1501 { 1500 1502 /* Check if this is required definition: */ 1501 if (definitionRegExp.indexIn(strDefinition) == 0) 1503 const QRegularExpressionMatch mt = re.match(strDefinition); 1504 if (mt.capturedStart() == 0) 1502 1505 { 1503 1506 /* Get group descriptor: */ 1504 const QString strDescriptor (definitionRegExp.cap(1));1507 const QString strDescriptor = mt.captured(1); 1505 1508 if (strDescriptor.contains(strNodeOptionFavorite)) 1506 1509 return true; … … 1646 1649 return -1; 1647 1650 } 1648 QRegExpdefinitionRegExpShort(strDefinitionTemplateShort);1649 QRegExpdefinitionRegExpFull(strDefinitionTemplateFull);1651 const QRegularExpression definitionRegExpShort(strDefinitionTemplateShort); 1652 const QRegularExpression definitionRegExpFull(strDefinitionTemplateFull); 1650 1653 1651 1654 /* For each the definition: */ … … 1654 1657 { 1655 1658 /* 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) 1657 1661 { 1658 1662 ++iDefinitionIndex; 1659 1663 /* 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) 1661 1666 return iDefinitionIndex; 1662 1667 } -
trunk/src/VBox/Frontends/VirtualBox/src/networkmanager/UINetworkManager.cpp
r102269 r103362 30 30 #include <QMenuBar> 31 31 #include <QPushButton> 32 #include <QReg Exp>32 #include <QRegularExpression> 33 33 #include <QVBoxLayout> 34 34 … … 525 525 QMap<int, bool> presence; 526 526 const QString strNameTemplate("HostNetwork%1"); 527 const QReg Exp regExp(strNameTemplate.arg("([\\d]*)"));527 const QRegularExpression re(strNameTemplate.arg("([\\d]*)")); 528 528 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 } 531 534 /* Search for a minimum index: */ 532 535 int iMinimumIndex = 0; … … 780 783 QMap<int, bool> presence; 781 784 const QString strNameTemplate("NatNetwork%1"); 782 const QReg Exp regExp(strNameTemplate.arg("([\\d]*)"));785 const QRegularExpression re(strNameTemplate.arg("([\\d]*)")); 783 786 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 } 786 792 /* Search for a minimum index: */ 787 793 int iMinimumIndex = 0; … … 919 925 QMap<int, bool> presence; 920 926 const QString strNameTemplate("CloudNetwork%1"); 921 const QReg Exp regExp(strNameTemplate.arg("([\\d]*)"));927 const QRegularExpression re(strNameTemplate.arg("([\\d]*)")); 922 928 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 } 925 934 /* Search for a minimum index: */ 926 935 int iMinimumIndex = 0; … … 2257 2266 strIPv6Rule.replace(':', ','); 2258 2267 /* 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()) 2262 2272 { 2263 QString strCapOld = re.cap(0);2273 QString strCapOld = mt.captured(); 2264 2274 QString strCapNew = strCapOld; 2265 2275 strCapNew.replace(',', ':'); 2266 2276 strIPv6Rule.replace(strCapOld, strCapNew); 2277 mt = re.match(strIPv6Rule); 2267 2278 } 2268 2279 /* Parse rules: */ -
trunk/src/VBox/Frontends/VirtualBox/src/objects/UIRichTextString.cpp
r98103 r103362 29 29 #include <QApplication> 30 30 #include <QPalette> 31 #include <QReg Exp>31 #include <QRegularExpression> 32 32 33 33 /* GUI includes: */ … … 145 145 const QString strFullPattern = composeFullPattern(strPattern, strPattern, iMaxLevel); 146 146 //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(); 150 151 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)); 161 159 } 162 160 } … … 189 187 const QString &strCurrentPattern, int iCurrentLevel /* = 0 */) 190 188 { 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()) 194 193 return searchForMaxLevel(strString, strPattern, 195 194 strCurrentPattern.arg(s_strAny + strPattern + s_strAny), -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r102599 r103362 33 33 #include <QImageWriter> 34 34 #include <QPainter> 35 #include <QRegExp>36 35 #include <QRegularExpression> 37 36 #include <QTimer> -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r102600 r103362 28 28 /* Qt includes: */ 29 29 #include <QApplication> 30 #include <QReg Exp>30 #include <QRegularExpression> 31 31 #include <QWidget> 32 32 … … 2935 2935 bool fSuccess = true; 2936 2936 ulong uMaxIndex = 0; 2937 QRegExp regExp(QString("^") + strNameTemplate.arg("([0-9]+)") + QString("$"));2937 const QRegularExpression re(QString("^") + strNameTemplate.arg("([0-9]+)") + QString("$")); 2938 2938 if (!comSnapshot.isNull()) 2939 2939 { … … 2945 2945 else 2946 2946 { 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 } 2950 2953 /* Traversing all the snapshot children: */ 2951 2954 QVector<CSnapshot> comSnapshotChildren = comSnapshot.GetChildren(); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UILanguageSettingsEditor.cpp
r101455 r103362 30 30 #include <QHeaderView> 31 31 #include <QPainter> 32 #include <QReg Exp>32 #include <QRegularExpression> 33 33 #include <QTranslator> 34 34 #include <QVBoxLayout> … … 387 387 { 388 388 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()) 392 392 continue; 393 393 394 394 /* Skip any English version, cause this is extra handled: */ 395 QString strLanguage = regExp.cap(2);395 QString strLanguage = mt.captured(2); 396 396 if (strLanguage.toLower() == "en") 397 397 continue; … … 401 401 continue; 402 402 403 new UILanguageItem(m_pTreeWidget, translator, regExp.cap(1));403 new UILanguageItem(m_pTreeWidget, translator, mt.captured(1)); 404 404 } 405 405 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UISharedFoldersEditor.cpp
r101498 r103362 29 29 #include <QHeaderView> 30 30 #include <QMenu> 31 #include <QReg Exp>31 #include <QRegularExpression> 32 32 #include <QTimer> 33 33 #include <QVBoxLayout> … … 232 232 case FormatType_EllipsisFile: 233 233 { 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(); 236 237 if (iNewFinish != -1) 237 238 iFinish = iNewFinish; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIUSBFiltersEditor.cpp
r101011 r103362 29 29 #include <QHeaderView> 30 30 #include <QMenu> 31 #include <QReg Exp>31 #include <QRegularExpression> 32 32 #include <QToolTip> 33 33 #include <QVBoxLayout> … … 353 353 /* Search for the max available filter index: */ 354 354 int iMaxFilterIndex = 0; 355 const QReg Exp regExp(QString("^") + m_strTrUSBFilterName.arg("([0-9]+)") + QString("$"));355 const QRegularExpression re(QString("^") + m_strTrUSBFilterName.arg("([0-9]+)") + QString("$")); 356 356 QTreeWidgetItemIterator iterator(m_pTreeWidget); 357 357 while (*iterator) 358 358 { 359 359 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 } 364 367 ++iterator; 365 368 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.cpp
r101230 r103362 34 34 #include <QMenu> 35 35 #include <QRadioButton> 36 #include <QRegExp>37 36 #include <QSpacerItem> 38 37 #include <QVBoxLayout> -
trunk/src/VBox/Frontends/VirtualBox/src/snapshots/UISnapshotPane.cpp
r102269 r103362 35 35 #include <QPointer> 36 36 #include <QReadWriteLock> 37 #include <QReg Exp>37 #include <QRegularExpression> 38 38 #include <QScrollBar> 39 39 #include <QTimer> … … 1665 1665 int iMaximumIndex = 0; 1666 1666 const QString strNameTemplate = tr("Snapshot %1"); 1667 const QReg Exp reName(QString("^") + strNameTemplate.arg("([0-9]+)") + QString("$"));1667 const QRegularExpression re(QString("^") + strNameTemplate.arg("([0-9]+)") + QString("$")); 1668 1668 QTreeWidgetItemIterator iterator(m_pSnapshotTree); 1669 1669 while (*iterator) 1670 1670 { 1671 1671 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 } 1677 1679 ++iterator; 1678 1680 } -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceEditorWidget.cpp
r103246 r103362 33 33 #include <QLabel> 34 34 #include <QLineEdit> 35 #include <QReg Exp>35 #include <QRegularExpression> 36 36 #include <QSpinBox> 37 37 #include <QTextEdit> … … 1375 1375 } 1376 1376 } 1377 QRegExp rx("controller=(\\d+);?");1377 const QRegularExpression re("controller=(\\d+);?"); 1378 1378 /* Now process the hard disk images */ 1379 1379 for (int iHDIndex = 0; iHDIndex < hdIndexes.size(); ++iHDIndex) … … 1381 1381 int i = hdIndexes[iHDIndex]; 1382 1382 QString ecnf = extraConfigValues[i]; 1383 if (rx.indexIn(ecnf) != -1) 1383 const QRegularExpressionMatch mt = re.match(ecnf); 1384 if (mt.hasMatch()) 1384 1385 { 1385 1386 /* Get the controller */ 1386 UIVirtualHardwareItem *pControllerItem = controllerMap[ rx.cap(1).toInt()];1387 UIVirtualHardwareItem *pControllerItem = controllerMap[mt.captured(1).toInt()]; 1387 1388 if (pControllerItem) 1388 1389 { -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIFilePathSelector.cpp
r101563 r103362 34 34 #include <QHBoxLayout> 35 35 #include <QLineEdit> 36 #include <QRegularExpression> 36 37 #ifdef VBOX_WS_WIN 37 38 # include <QListView> 38 39 #endif 39 #include <QRegExp>40 40 41 41 /* GUI includes: */ … … 520 520 521 521 /* 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(); 524 525 if (iNewFinish != -1) 525 526 iFinish = iNewFinish; -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPortForwardingTable.cpp
r100349 r103362 34 34 #include <QLineEdit> 35 35 #include <QMenu> 36 #include <QReg Exp>36 #include <QRegularExpression> 37 37 #include <QSpinBox> 38 38 #include <QStyledItemDelegate> … … 592 592 uint uMaxIndex = 0; 593 593 QString strTemplate("Rule %1"); 594 QRegExp regExp(strTemplate.arg("(\\d+)"));594 const QRegularExpression re(strTemplate.arg("(\\d+)")); 595 595 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 } 598 604 /* If index is valid => copy data: */ 599 605 if (index.isValid())
Note:
See TracChangeset
for help on using the changeset viewer.