Index: /trunk/src/VBox/Frontends/VirtualBox/src/widgets/UINameAndSystemEditor.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/widgets/UINameAndSystemEditor.cpp	(revision 60696)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/widgets/UINameAndSystemEditor.cpp	(revision 60697)
@@ -45,54 +45,86 @@
     qRegisterMetaType<CGuestOSType>();
 
-    /* Create widgets: */
+    /* Create main-layout: */
     QGridLayout *pMainLayout = new QGridLayout(this);
     {
+        /* Configure main-layout: */
         pMainLayout->setContentsMargins(0, 0, 0, 0);
-        m_pLabelName = new QLabel(this);
-        {
+
+        /* Create VM name label: */
+        m_pLabelName = new QLabel;
+        {
+            /* Configure VM name label: */
             m_pLabelName->setAlignment(Qt::AlignRight);
             m_pLabelName->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
-        }
-        m_pEditorName = new QLineEdit(this);
-        {
+            /* Add VM name label into main-layout: */
+            pMainLayout->addWidget(m_pLabelName, 0, 0);
+        }
+
+        /* Create VM name editor: */
+        m_pEditorName = new QLineEdit;
+        {
+            /* Configure VM name editor: */
             m_pEditorName->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
             m_pLabelName->setBuddy(m_pEditorName);
-        }
-        m_pLabelFamily = new QLabel(this);
-        {
+            /* Add VM name editor into main-layout: */
+            pMainLayout->addWidget(m_pEditorName, 0, 1, 1, 2);
+        }
+
+        /* Create VM OS family label: */
+        m_pLabelFamily = new QLabel;
+        {
+            /* Configure VM OS family label: */
             m_pLabelFamily->setAlignment(Qt::AlignRight);
             m_pLabelFamily->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
-        }
-        m_pComboFamily = new QComboBox(this);
-        {
+            /* Add VM OS family label into main-layout: */
+            pMainLayout->addWidget(m_pLabelFamily, 1, 0);
+        }
+
+        /* Create VM OS family combo: */
+        m_pComboFamily = new QComboBox;
+        {
+            /* Configure VM OS family combo: */
             m_pComboFamily->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
             m_pLabelFamily->setBuddy(m_pComboFamily);
-        }
-        m_pLabelType = new QLabel(this);
-        {
+            /* Add VM OS family combo into main-layout: */
+            pMainLayout->addWidget(m_pComboFamily, 1, 1);
+        }
+
+        /* Create VM OS type label: */
+        m_pLabelType = new QLabel;
+        {
+            /* Configure VM OS type label: */
             m_pLabelType->setAlignment(Qt::AlignRight);
             m_pLabelType->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
-        }
-        m_pComboType = new QComboBox(this);
-        {
+            /* Add VM OS type label into main-layout: */
+            pMainLayout->addWidget(m_pLabelType, 2, 0);
+        }
+
+        /* Create VM OS type combo: */
+        m_pComboType = new QComboBox;
+        {
+            /* Configure VM OS type combo: */
             m_pComboType->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
             m_pLabelType->setBuddy(m_pComboType);
-        }
+            /* Add VM OS type combo into main-layout: */
+            pMainLayout->addWidget(m_pComboType, 2, 1);
+        }
+
+        /* Create sub-layout: */
         QVBoxLayout *pLayoutIcon = new QVBoxLayout;
         {
-            m_pIconType = new QLabel(this);
+            /* Create VM OS type icon: */
+            m_pIconType = new QLabel;
             {
+                /* Configure VM OS type icon: */
                 m_pIconType->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+                /* Add VM OS type icon into sub-layout: */
+                pLayoutIcon->addWidget(m_pIconType);
             }
-            pLayoutIcon->addWidget(m_pIconType);
+            /* Add stretch to sub-layout: */
             pLayoutIcon->addStretch();
-        }
-        pMainLayout->addWidget(m_pLabelName, 0, 0);
-        pMainLayout->addWidget(m_pEditorName, 0, 1, 1, 2);
-        pMainLayout->addWidget(m_pLabelFamily, 1, 0);
-        pMainLayout->addWidget(m_pComboFamily, 1, 1);
-        pMainLayout->addWidget(m_pLabelType, 2, 0);
-        pMainLayout->addWidget(m_pComboType, 2, 1);
-        pMainLayout->addLayout(pLayoutIcon, 1, 2, 2, 1);
+            /* Add sub-layout into main-layout: */
+            pMainLayout->addLayout(pLayoutIcon, 1, 2, 2, 1);
+        }
     }
 
@@ -103,10 +135,10 @@
 
     /* Fill OS family selector: */
-    QList<CGuestOSType> families(vboxGlobal().vmGuestOSFamilyList());
+    const QList<CGuestOSType> families = vboxGlobal().vmGuestOSFamilyList();
     for (int i = 0; i < families.size(); ++i)
     {
-        QString strFamilyName(families[i].GetFamilyDescription());
+        const QString strFamilyName = families.at(i).GetFamilyDescription();
         m_pComboFamily->insertItem(i, strFamilyName);
-        m_pComboFamily->setItemData(i, families[i].GetFamilyId(), TypeID);
+        m_pComboFamily->setItemData(i, families.at(i).GetFamilyId(), TypeID);
     }
     m_pComboFamily->setCurrentIndex(0);
@@ -140,9 +172,9 @@
 {
     /* Initialize variables: */
-    QString strFamilyId(type.GetFamilyId());
-    QString strTypeId(type.GetId());
+    const QString strFamilyId = type.GetFamilyId();
+    const QString strTypeId = type.GetId();
 
     /* Get/check family index: */
-    int iFamilyIndex = m_pComboFamily->findData(strFamilyId, TypeID);
+    const int iFamilyIndex = m_pComboFamily->findData(strFamilyId, TypeID);
     AssertMsg(iFamilyIndex != -1, ("Invalid family ID: '%s'", strFamilyId.toLatin1().constData()));
     if (iFamilyIndex != -1)
@@ -150,5 +182,5 @@
 
     /* Get/check type index: */
-    int iTypeIndex = m_pComboType->findData(strTypeId, TypeID);
+    const int iTypeIndex = m_pComboType->findData(strTypeId, TypeID);
     AssertMsg(iTypeIndex != -1, ("Invalid type ID: '%s'", strTypeId.toLatin1().constData()));
     if (iTypeIndex != -1)
@@ -176,11 +208,12 @@
 
     /* Populate combo-box with OS types related to currently selected family id: */
-    QString strFamilyId(m_pComboFamily->itemData(iIndex, TypeID).toString());
-    QList<CGuestOSType> types(vboxGlobal().vmGuestOSTypeList(strFamilyId));
+    const QString strFamilyId = m_pComboFamily->itemData(iIndex, TypeID).toString();
+    const QList<CGuestOSType> types = vboxGlobal().vmGuestOSTypeList(strFamilyId);
     for (int i = 0; i < types.size(); ++i)
     {
-        if (types[i].GetIs64Bit() && (!m_fSupportsHWVirtEx || !m_fSupportsLongMode))
+        /* Skip 64bit OS types is hardware virtualization or long mode is not supported: */
+        if (types.at(i).GetIs64Bit() && (!m_fSupportsHWVirtEx || !m_fSupportsLongMode))
             continue;
-        int iIndex = m_pComboType->count();
+        const int iIndex = m_pComboType->count();
         m_pComboType->insertItem(iIndex, types[i].GetDescription());
         m_pComboType->setItemData(iIndex, types[i].GetId(), TypeID);
@@ -190,6 +223,6 @@
     if (m_currentIds.contains(strFamilyId))
     {
-        QString strTypeId(m_currentIds[strFamilyId]);
-        int iTypeIndex = m_pComboType->findData(strTypeId, TypeID);
+        const QString strTypeId = m_currentIds.value(strFamilyId);
+        const int iTypeIndex = m_pComboType->findData(strTypeId, TypeID);
         if (iTypeIndex != -1)
             m_pComboType->setCurrentIndex(iTypeIndex);
@@ -201,5 +234,5 @@
         if (ARCH_BITS == 64 && m_fSupportsHWVirtEx && m_fSupportsLongMode)
             strDefaultID += "_64";
-        int iIndexWin7 = m_pComboType->findData(strDefaultID, TypeID);
+        const int iIndexWin7 = m_pComboType->findData(strDefaultID, TypeID);
         if (iIndexWin7 != -1)
             m_pComboType->setCurrentIndex(iIndexWin7);
@@ -211,10 +244,11 @@
         if (ARCH_BITS == 64 && m_fSupportsHWVirtEx && m_fSupportsLongMode)
             strDefaultID += "_64";
-        int iIndexUbuntu = m_pComboType->findData(strDefaultID, TypeID);
+        const int iIndexUbuntu = m_pComboType->findData(strDefaultID, TypeID);
         if (iIndexUbuntu != -1)
             m_pComboType->setCurrentIndex(iIndexUbuntu);
     }
     /* Else simply select the first one present: */
-    else m_pComboType->setCurrentIndex(0);
+    else
+        m_pComboType->setCurrentIndex(0);
 
     /* Update all the stuff: */
