VirtualBox

Changeset 101232 in vbox for trunk/src


Ignore:
Timestamp:
Sep 22, 2023 5:39:44 AM (15 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10523. More fixes in os type detection stuff.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINameAndSystemEditor.cpp

    r101226 r101232  
    251251}
    252252
    253 void UINameAndSystemEditor::setGuestOSTypeByTypeId(const QString &strTypeId)
    254 {
    255     AssertReturnVoid(m_pComboFamily);
     253bool UINameAndSystemEditor::setGuestOSTypeByTypeId(const QString &strTypeId)
     254{
     255    AssertReturn(m_pComboFamily, false);
    256256
    257257    const UIGuestOSTypeManager * const pGuestOSTypeManager = uiCommon().guestOSTypeManager();
    258     AssertReturnVoid(pGuestOSTypeManager);
     258    AssertReturn(pGuestOSTypeManager, false);
    259259    const UIGuestOSTypeII &type = pGuestOSTypeManager->findGuestTypeById(strTypeId);
    260260    if (!type.isOk())
    261         return;
     261        return false;
    262262
    263263    int iFamilyComboIndex = -1;
     
    271271    /* Bail out if family combo has no such item: */
    272272    if (iFamilyComboIndex == -1)
    273         return;
     273        return false;
    274274    /* Set the family combo's index. This will cause variant combo to be populated accordingly: */
    275275    m_pComboFamily->setCurrentIndex(iFamilyComboIndex);
     
    287287            m_pComboVariant->setCurrentIndex(index);
    288288        else
    289             return;
     289            return false;
    290290    }
    291291
     
    299299    if (iTypeIndex != -1)
    300300        m_pComboType->setCurrentIndex(iTypeIndex);
     301    return true;
    301302}
    302303
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINameAndSystemEditor.h

    r101226 r101232  
    122122
    123123    /* strTypeId should be one of the type ids defined in Global.cpp and returned by IGuestOSType::getId(). */
    124     void setGuestOSTypeByTypeId(const QString &strTypeId);
     124    bool setGuestOSTypeByTypeId(const QString &strTypeId);
    125125    /** Defines the VM OS @a strTypeId and @a strFamilyId if passed. */
    126126    void setTypeId(QString strTypeId, QString strFamilyId = QString());
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMNameOSTypePage.cpp

    r101226 r101232  
    179179    { QRegularExpression("sarge.*32",                         QRegularExpression::CaseInsensitiveOption), "Debian31" },
    180180    { QRegularExpression("^etch.*64",                         QRegularExpression::CaseInsensitiveOption), "Debian4_x64" },
     181    { QRegularExpression("debian.*4.*64",                     QRegularExpression::CaseInsensitiveOption), "Debian4_x64" },
    181182    { QRegularExpression("^etch.*32",                         QRegularExpression::CaseInsensitiveOption), "Debian4" },
     183    { QRegularExpression("debian.*4.*32",                     QRegularExpression::CaseInsensitiveOption), "Debian4" },
    182184    { QRegularExpression("lenny.*64",                         QRegularExpression::CaseInsensitiveOption), "Debian5_x64" },
    183185    { QRegularExpression("lenny.*32",                         QRegularExpression::CaseInsensitiveOption), "Debian5" },
    184186    { QRegularExpression("squeeze.*64",                       QRegularExpression::CaseInsensitiveOption), "Debian6_x64" },
     187    { QRegularExpression("debian.*6.*64",                     QRegularExpression::CaseInsensitiveOption), "Debian6_x64" },
    185188    { QRegularExpression("squeeze.*32",                       QRegularExpression::CaseInsensitiveOption), "Debian6" },
     189    { QRegularExpression("debian.*6.*32",                     QRegularExpression::CaseInsensitiveOption), "Debian6" },
    186190    { QRegularExpression("wheezy.*64",                        QRegularExpression::CaseInsensitiveOption), "Debian7_x64" },
     191    { QRegularExpression("debian.*7.*64",                     QRegularExpression::CaseInsensitiveOption), "Debian7_x64" },
    187192    { QRegularExpression("wheezy.*32",                        QRegularExpression::CaseInsensitiveOption), "Debian7" },
     193    { QRegularExpression("debian.*7.*32",                     QRegularExpression::CaseInsensitiveOption), "Debian7" },
    188194    { QRegularExpression("jessie.*64",                        QRegularExpression::CaseInsensitiveOption), "Debian8_x64" },
     195    { QRegularExpression("debian.*8.*64",                     QRegularExpression::CaseInsensitiveOption), "Debian8_x64" },
    189196    { QRegularExpression("jessie.*32",                        QRegularExpression::CaseInsensitiveOption), "Debian8" },
     197    { QRegularExpression("debian.*8*32",                      QRegularExpression::CaseInsensitiveOption), "Debian8" },
    190198    { QRegularExpression("stretch.*64",                       QRegularExpression::CaseInsensitiveOption), "Debian9_x64" },
    191199    { QRegularExpression("debian.*9.*64",                     QRegularExpression::CaseInsensitiveOption), "Debian9_x64" },
     
    287295    {
    288296        if (strNewName.contains(gs_OSTypePattern[i].pattern))
     297            return pNameAndSystemEditor->setGuestOSTypeByTypeId(gs_OSTypePattern[i].pcstId);
     298    }
     299    return false;
     300}
     301
     302bool UIWizardNewVMNameOSTypeCommon::guessOSTypeDetectedOSTypeString(UINameAndSystemEditor *pNameAndSystemEditor, QString strDetectedOSType)
     303{
     304    AssertReturn(pNameAndSystemEditor, false);
     305    if (!strDetectedOSType.isEmpty())
     306    {
     307        if (!pNameAndSystemEditor->setGuestOSTypeByTypeId(strDetectedOSType))
    289308        {
    290             pNameAndSystemEditor->setGuestOSTypeByTypeId(gs_OSTypePattern[i].pcstId);
    291             return true;
     309            pNameAndSystemEditor->setGuestOSTypeByTypeId("Other");
     310            /* Return false to allow OS type guessing from name. See caller code: */
     311            return false;
    292312        }
    293     }
    294     return false;
    295 }
    296 
    297 bool UIWizardNewVMNameOSTypeCommon::guessOSTypeDetectedOSTypeString(UINameAndSystemEditor *pNameAndSystemEditor, QString strDetectedOSType)
    298 {
    299     AssertReturn(pNameAndSystemEditor, false);
    300 
    301     if (!strDetectedOSType.isEmpty())
    302     {
    303         CGuestOSType const osType = uiCommon().vmGuestOSType(strDetectedOSType);
    304         if (!osType.isNull())
    305         {
    306             pNameAndSystemEditor->setType(osType);
    307             return true;
    308         }
    309         /* The detectedOSType shall be a valid OS type ID. So, unless the UI is
    310            out of sync with the types in main this shouldn't ever happen. */
    311         AssertFailed();
    312     }
    313     pNameAndSystemEditor->setType(uiCommon().vmGuestOSType("Other"));
    314     /* Return false to allow OS type guessing from name. See caller code: */
     313        return true;
     314    }
     315    pNameAndSystemEditor->setGuestOSTypeByTypeId("Other");
    315316    return false;
    316317}
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