Index: /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.cpp	(revision 85952)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.cpp	(revision 85953)
@@ -332,21 +332,21 @@
 
 UIMachineSettingsUSB::UIMachineSettingsUSB()
-    : m_pToolBar(0)
-    , m_pActionNew(0),
-      m_pActionAdd(0),
-      m_pActionEdit(0),
-      m_pActionRemove(0)
-    , m_pActionMoveUp(0),
-      m_pActionMoveDown(0)
-    , m_pMenuUSBDevices(0)
-    , m_pCache(0)
+    : m_pCache(0)
     , m_pCheckBoxUSB(0)
-    , m_pTreeWidgetFilters(0)
+    , m_pWidgetUSBSettings(0)
     , m_pRadioButtonUSB1(0)
     , m_pRadioButtonUSB2(0)
     , m_pRadioButtonUSB3(0)
-    , m_pCheckBoxUSBFilters(0)
-    , m_pUSBChild(0)
-    , m_pFiltersToolBar(0)
+    , m_pLabelSeparatorFilters(0)
+    , m_pLayoutFilters(0)
+    , m_pTreeWidgetFilters(0)
+    , m_pToolBarFilters(0)
+    , m_pActionNew(0)
+    , m_pActionAdd(0)
+    , m_pActionEdit(0)
+    , m_pActionRemove(0)
+    , m_pActionMoveUp(0)
+    , m_pActionMoveDown(0)
+    , m_pMenuUSBDevices(0)
 {
     /* Prepare: */
@@ -570,5 +570,5 @@
                                         "this machine. The USB xHCI controller provides USB 3.0 support."));
     m_pRadioButtonUSB3->setText(tr("USB &3.0 (xHCI) Controller"));
-    m_pCheckBoxUSBFilters->setText(tr("USB Device &Filters"));
+    m_pLabelSeparatorFilters->setText(tr("USB Device &Filters"));
     QTreeWidgetItem *pQtreewidgetitem = m_pTreeWidgetFilters->headerItem();
     pQtreewidgetitem->setText(0, tr("[filter]"));
@@ -607,5 +607,5 @@
     /* Polish USB page availability: */
     m_pCheckBoxUSB->setEnabled(isMachineOffline());
-    m_pUSBChild->setEnabled(isMachineInValidMode() && m_pCheckBoxUSB->isChecked());
+    m_pWidgetUSBSettings->setEnabled(isMachineInValidMode() && m_pCheckBoxUSB->isChecked());
     m_pRadioButtonUSB1->setEnabled(isMachineOffline() && m_pCheckBoxUSB->isChecked());
     m_pRadioButtonUSB2->setEnabled(isMachineOffline() && m_pCheckBoxUSB->isChecked());
@@ -616,5 +616,5 @@
 {
     /* Enable/disable USB children: */
-    m_pUSBChild->setEnabled(isMachineInValidMode() && fEnabled);
+    m_pWidgetUSBSettings->setEnabled(isMachineInValidMode() && fEnabled);
     m_pRadioButtonUSB1->setEnabled(isMachineOffline() && fEnabled);
     m_pRadioButtonUSB2->setEnabled(isMachineOffline() && fEnabled);
@@ -847,24 +847,11 @@
 void UIMachineSettingsUSB::prepare()
 {
-    prepareWidgets();
-
-    /* Hide radio-button initially: */
-    m_pRadioButtonUSB1->setVisible(false);
-    m_pRadioButtonUSB2->setVisible(false);
-    m_pRadioButtonUSB3->setVisible(false);
-
     /* Prepare cache: */
     m_pCache = new UISettingsCacheMachineUSB;
     AssertPtrReturnVoid(m_pCache);
 
-    /* Layout created in the .ui file. */
-    {
-        /* Prepare USB Filters tree: */
-        prepareFiltersTree();
-        /* Prepare USB Filters toolbar: */
-        prepareFiltersToolbar();
-        /* Prepare connections: */
-        prepareConnections();
-    }
+    /* Prepare everything: */
+    prepareWidgets();
+    prepareConnections();
 
     /* Apply language settings: */
@@ -874,79 +861,98 @@
 void UIMachineSettingsUSB::prepareWidgets()
 {
-    if (objectName().isEmpty())
-        setObjectName(QStringLiteral("UIMachineSettingsUSB"));
-    resize(468, 328);
+    /* Prepare main layout: */
     QGridLayout *pMainLayout = new QGridLayout(this);
-    pMainLayout->setObjectName(QStringLiteral("pMainLayout"));
-    m_pCheckBoxUSB = new QCheckBox();
-    m_pCheckBoxUSB->setObjectName(QStringLiteral("m_pCheckBoxUSB"));
-    m_pCheckBoxUSB->setChecked(true);
-    pMainLayout->addWidget(m_pCheckBoxUSB, 0, 0, 1, 2);
-    QSpacerItem *pSpacerItem = new QSpacerItem(20, 0, QSizePolicy::Fixed, QSizePolicy::Minimum);
-    pMainLayout->addItem(pSpacerItem, 1, 0, 1, 1);
-
-    m_pUSBChild = new QWidget();
-    m_pUSBChild->setObjectName(QStringLiteral("m_pUSBChild"));
-    QVBoxLayout *pVboxLayout = new QVBoxLayout(m_pUSBChild);
-    pVboxLayout->setObjectName(QStringLiteral("pVboxLayout"));
-    pVboxLayout->setContentsMargins(0, 0, 0, 0);
-    QWidget *pRadioButtonContainer = new QWidget(m_pUSBChild);
-    pRadioButtonContainer->setObjectName(QStringLiteral("pRadioButtonContainer"));
-    QVBoxLayout *vboxLayout1 = new QVBoxLayout(pRadioButtonContainer);
-    vboxLayout1->setObjectName(QStringLiteral("vboxLayout1"));
-    vboxLayout1->setContentsMargins(0, 0, 0, 0);
-
-    m_pRadioButtonUSB1 = new QRadioButton(pRadioButtonContainer);
-    m_pRadioButtonUSB1->setObjectName(QStringLiteral("pRadioButtonUSB1"));
-    vboxLayout1->addWidget(m_pRadioButtonUSB1);
-
-    m_pRadioButtonUSB2 = new QRadioButton(pRadioButtonContainer);
-    m_pRadioButtonUSB2->setObjectName(QStringLiteral("m_pRadioButtonUSB2"));
-    vboxLayout1->addWidget(m_pRadioButtonUSB2);
-
-    m_pRadioButtonUSB3 = new QRadioButton(pRadioButtonContainer);
-    m_pRadioButtonUSB3->setObjectName(QStringLiteral("m_pRadioButtonUSB3"));
-    vboxLayout1->addWidget(m_pRadioButtonUSB3);
-    pVboxLayout->addWidget(pRadioButtonContainer);
-
-    m_pCheckBoxUSBFilters = new QILabelSeparator(m_pUSBChild);
-    m_pCheckBoxUSBFilters->setObjectName(QStringLiteral("m_pCheckBoxUSBFilters"));
-    pVboxLayout->addWidget(m_pCheckBoxUSBFilters);
-
-    QWidget *pFilterHandler = new QWidget(m_pUSBChild);
-    pFilterHandler->setObjectName(QStringLiteral("pFilterHandler"));
-    QHBoxLayout *pHBoxLayout = new QHBoxLayout(pFilterHandler);
-    pHBoxLayout->setSpacing(3);
-    pHBoxLayout->setObjectName(QStringLiteral("pHBoxLayout"));
-    pHBoxLayout->setContentsMargins(0, 0, 0, 0);
-    m_pTreeWidgetFilters = new QITreeWidget(pFilterHandler);
-    m_pTreeWidgetFilters->setObjectName(QStringLiteral("m_pTreeWidgetFilters"));
-    QSizePolicy sizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
-    sizePolicy.setHorizontalStretch(0);
-    sizePolicy.setVerticalStretch(0);
-    sizePolicy.setHeightForWidth(m_pTreeWidgetFilters->sizePolicy().hasHeightForWidth());
-    m_pTreeWidgetFilters->setSizePolicy(sizePolicy);
-    m_pTreeWidgetFilters->setContextMenuPolicy(Qt::CustomContextMenu);
-    m_pTreeWidgetFilters->setRootIsDecorated(false);
-    pHBoxLayout->addWidget(m_pTreeWidgetFilters);
-
-    m_pFiltersToolBar = new UIToolBar(pFilterHandler);
-    m_pFiltersToolBar->setObjectName(QStringLiteral("m_pFiltersToolBar"));
-    pHBoxLayout->addWidget(m_pFiltersToolBar);
-
-    pVboxLayout->addWidget(pFilterHandler);
-    pMainLayout->addWidget(m_pUSBChild, 1, 1, 1, 2);
-
-    pMainLayout->setColumnStretch(1, 1);
-    m_pCheckBoxUSBFilters->setBuddy(m_pTreeWidgetFilters);
-}
-
-void UIMachineSettingsUSB::prepareFiltersTree()
-{
-    /* USB Filters tree-widget created in the .ui file. */
-    AssertPtrReturnVoid(m_pTreeWidgetFilters);
-    {
-        /* Configure tree-widget: */
+    if (pMainLayout)
+    {
+        pMainLayout->setRowStretch(2, 1);
+        pMainLayout->setColumnStretch(1, 1);
+
+        /* Prepare USB check-box: */
+        m_pCheckBoxUSB = new QCheckBox;
+        if (m_pCheckBoxUSB)
+            pMainLayout->addWidget(m_pCheckBoxUSB, 0, 0, 1, 2);
+
+        /* Prepare 20-px shifting spacer: */
+        QSpacerItem *pSpacerItem = new QSpacerItem(20, 0, QSizePolicy::Fixed, QSizePolicy::Minimum);
+        if (pSpacerItem)
+            pMainLayout->addItem(pSpacerItem, 1, 0);
+
+        /* Prepare USB settings widget: */
+        m_pWidgetUSBSettings = new QWidget(this);
+        if (m_pWidgetUSBSettings)
+        {
+            /* Prepare USB settings widget layout: */
+            m_pLayoutUSBSettings = new QVBoxLayout(m_pWidgetUSBSettings);
+            if (m_pLayoutUSBSettings)
+            {
+                m_pLayoutUSBSettings->setContentsMargins(0, 0, 0, 0);
+
+                /* Prepare USB radio-buttons: */
+                prepareRadioButtons();
+
+                /* Prepare separator: */
+                m_pLabelSeparatorFilters = new QILabelSeparator(m_pWidgetUSBSettings);
+                if (m_pLabelSeparatorFilters)
+                    m_pLayoutUSBSettings->addWidget(m_pLabelSeparatorFilters);
+
+                /* Prepare USB filters layout: */
+                m_pLayoutFilters = new QHBoxLayout;
+                if (m_pLayoutFilters)
+                {
+                    m_pLayoutFilters->setContentsMargins(0, 0, 0, 0);
+                    m_pLayoutFilters->setSpacing(3);
+
+                    /* Prepare USB filters tree-widget: */
+                    prepareFiltersTreeWidget();
+                    /* Prepare USB filters toolbar: */
+                    prepareFiltersToolbar();
+
+                    m_pLayoutUSBSettings->addLayout(m_pLayoutFilters);
+                }
+            }
+
+            pMainLayout->addWidget(m_pWidgetUSBSettings, 1, 1, 1, 2);
+        }
+    }
+}
+
+void UIMachineSettingsUSB::prepareRadioButtons()
+{
+    /* Prepare USB1 radio-button: */
+    m_pRadioButtonUSB1 = new QRadioButton(m_pWidgetUSBSettings);
+    if (m_pRadioButtonUSB1)
+    {
+        m_pRadioButtonUSB1->setVisible(false);
+        m_pLayoutUSBSettings->addWidget(m_pRadioButtonUSB1);
+    }
+    /* Prepare USB2 radio-button: */
+    m_pRadioButtonUSB2 = new QRadioButton(m_pWidgetUSBSettings);
+    if (m_pRadioButtonUSB2)
+    {
+        m_pRadioButtonUSB2->setVisible(false);
+        m_pLayoutUSBSettings->addWidget(m_pRadioButtonUSB2);
+    }
+    /* Prepare USB3 radio-button: */
+    m_pRadioButtonUSB3 = new QRadioButton(m_pWidgetUSBSettings);
+    if (m_pRadioButtonUSB3)
+    {
+        m_pRadioButtonUSB3->setVisible(false);
+        m_pLayoutUSBSettings->addWidget(m_pRadioButtonUSB3);
+    }
+}
+
+void UIMachineSettingsUSB::prepareFiltersTreeWidget()
+{
+    /* Prepare USB filters tree-widget: */
+    m_pTreeWidgetFilters = new QITreeWidget(m_pWidgetUSBSettings);
+    if (m_pTreeWidgetFilters)
+    {
+        if (m_pLabelSeparatorFilters)
+            m_pLabelSeparatorFilters->setBuddy(m_pTreeWidgetFilters);
         m_pTreeWidgetFilters->header()->hide();
+        m_pTreeWidgetFilters->setRootIsDecorated(false);
+        m_pTreeWidgetFilters->setContextMenuPolicy(Qt::CustomContextMenu);
+
+        m_pLayoutFilters->addWidget(m_pTreeWidgetFilters);
     }
 }
@@ -954,75 +960,58 @@
 void UIMachineSettingsUSB::prepareFiltersToolbar()
 {
-    /* USB Filters toolbar created in the .ui file. */
-    AssertPtrReturnVoid(m_pFiltersToolBar);
-    {
-        /* Configure toolbar: */
+    /* Prepare USB filters toolbar: */
+    m_pToolBarFilters = new UIToolBar(m_pWidgetUSBSettings);
+    if (m_pToolBarFilters)
+    {
         const int iIconMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize);
-        m_pFiltersToolBar->setIconSize(QSize(iIconMetric, iIconMetric));
-        m_pFiltersToolBar->setOrientation(Qt::Vertical);
-
-        /* Create USB devices menu: */
-        m_pMenuUSBDevices = new VBoxUSBMenu(this);
-        AssertPtrReturnVoid(m_pMenuUSBDevices);
-
-        /* Create 'New USB Filter' action: */
-        m_pActionNew = m_pFiltersToolBar->addAction(UIIconPool::iconSet(":/usb_new_16px.png",
+        m_pToolBarFilters->setIconSize(QSize(iIconMetric, iIconMetric));
+        m_pToolBarFilters->setOrientation(Qt::Vertical);
+
+        /* Prepare 'New USB Filter' action: */
+        m_pActionNew = m_pToolBarFilters->addAction(UIIconPool::iconSet(":/usb_new_16px.png",
                                                                         ":/usb_new_disabled_16px.png"),
                                                     QString(), this, SLOT(sltNewFilter()));
-        AssertPtrReturnVoid(m_pActionNew);
-        {
-            /* Configure action: */
+        if (m_pActionNew)
             m_pActionNew->setShortcuts(QList<QKeySequence>() << QKeySequence("Ins") << QKeySequence("Ctrl+N"));
-        }
-
-        /* Create 'Add USB Filter' action: */
-        m_pActionAdd = m_pFiltersToolBar->addAction(UIIconPool::iconSet(":/usb_add_16px.png",
+
+        /* Prepare 'Add USB Filter' action: */
+        m_pActionAdd = m_pToolBarFilters->addAction(UIIconPool::iconSet(":/usb_add_16px.png",
                                                                         ":/usb_add_disabled_16px.png"),
                                                     QString(), this, SLOT(sltAddFilter()));
-        AssertPtrReturnVoid(m_pActionAdd);
-        {
-            /* Configure action: */
+        if (m_pActionAdd)
             m_pActionAdd->setShortcuts(QList<QKeySequence>() << QKeySequence("Alt+Ins") << QKeySequence("Ctrl+A"));
-        }
-
-        /* Create 'Edit USB Filter' action: */
-        m_pActionEdit = m_pFiltersToolBar->addAction(UIIconPool::iconSet(":/usb_filter_edit_16px.png",
+
+        /* Prepare 'Edit USB Filter' action: */
+        m_pActionEdit = m_pToolBarFilters->addAction(UIIconPool::iconSet(":/usb_filter_edit_16px.png",
                                                                          ":/usb_filter_edit_disabled_16px.png"),
                                                      QString(), this, SLOT(sltEditFilter()));
-        AssertPtrReturnVoid(m_pActionEdit);
-        {
-            /* Configure action: */
+        if (m_pActionEdit)
             m_pActionEdit->setShortcuts(QList<QKeySequence>() << QKeySequence("Alt+Return") << QKeySequence("Ctrl+Return"));
-        }
-
-        /* Create 'Remove USB Filter' action: */
-        m_pActionRemove = m_pFiltersToolBar->addAction(UIIconPool::iconSet(":/usb_remove_16px.png",
+
+        /* Prepare 'Remove USB Filter' action: */
+        m_pActionRemove = m_pToolBarFilters->addAction(UIIconPool::iconSet(":/usb_remove_16px.png",
                                                                            ":/usb_remove_disabled_16px.png"),
                                                        QString(), this, SLOT(sltRemoveFilter()));
-        AssertPtrReturnVoid(m_pActionRemove);
-        {
-            /* Configure action: */
+        if (m_pActionRemove)
             m_pActionRemove->setShortcuts(QList<QKeySequence>() << QKeySequence("Del") << QKeySequence("Ctrl+R"));
-        }
-
-        /* Create 'Move USB Filter Up' action: */
-        m_pActionMoveUp = m_pFiltersToolBar->addAction(UIIconPool::iconSet(":/usb_moveup_16px.png",
+
+        /* Prepare 'Move USB Filter Up' action: */
+        m_pActionMoveUp = m_pToolBarFilters->addAction(UIIconPool::iconSet(":/usb_moveup_16px.png",
                                                                            ":/usb_moveup_disabled_16px.png"),
                                                        QString(), this, SLOT(sltMoveFilterUp()));
-        AssertPtrReturnVoid(m_pActionMoveUp);
-        {
-            /* Configure action: */
+        if (m_pActionMoveUp)
             m_pActionMoveUp->setShortcuts(QList<QKeySequence>() << QKeySequence("Alt+Up") << QKeySequence("Ctrl+Up"));
-        }
-
-        /* Create 'Move USB Filter Down' action: */
-        m_pActionMoveDown = m_pFiltersToolBar->addAction(UIIconPool::iconSet(":/usb_movedown_16px.png",
+
+        /* Prepare 'Move USB Filter Down' action: */
+        m_pActionMoveDown = m_pToolBarFilters->addAction(UIIconPool::iconSet(":/usb_movedown_16px.png",
                                                                              ":/usb_movedown_disabled_16px.png"),
                                                          QString(), this, SLOT(sltMoveFilterDown()));
-        AssertPtrReturnVoid(m_pActionMoveDown);
-        {
-            /* Configure action: */
+        if (m_pActionMoveDown)
             m_pActionMoveDown->setShortcuts(QList<QKeySequence>() << QKeySequence("Alt+Down") << QKeySequence("Ctrl+Down"));
-        }
+
+        /* Prepare USB devices menu: */
+        m_pMenuUSBDevices = new VBoxUSBMenu(this);
+
+        m_pLayoutFilters->addWidget(m_pToolBarFilters);
     }
 }
Index: /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.h	(revision 85952)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.h	(revision 85953)
@@ -27,5 +27,7 @@
 /* Forward declarations: */
 class QCheckBox;
+class QHBoxLayout;
 class QRadioButton;
+class QVBoxLayout;
 class QTreeWidgetItem;
 class QILabelSeparator;
@@ -120,7 +122,9 @@
     /** Prepares widgets. */
     void prepareWidgets();
-    /** Prepares USB filters tree. */
-    void prepareFiltersTree();
-    /** Prepares USB filters toolbar. */
+    /** Prepares radio-buttons. */
+    void prepareRadioButtons();
+    /** Prepares filters tree-widget. */
+    void prepareFiltersTreeWidget();
+    /** Prepares filters toolbar. */
     void prepareFiltersToolbar();
     /** Prepares connections. */
@@ -143,21 +147,4 @@
     bool createUSBFilter(CUSBDeviceFilters &comFiltersObject, int iPosition, const UIDataSettingsMachineUSBFilter &filterData);
 
-    /** Holds the toolbar instance. */
-    UIToolBar   *m_pToolBar;
-    /** Holds the New action instance. */
-    QAction     *m_pActionNew;
-    /** Holds the Add action instance. */
-    QAction     *m_pActionAdd;
-    /** Holds the Edit action instance. */
-    QAction     *m_pActionEdit;
-    /** Holds the Remove action instance. */
-    QAction     *m_pActionRemove;
-    /** Holds the Move Up action instance. */
-    QAction     *m_pActionMoveUp;
-    /** Holds the Move Down action instance. */
-    QAction     *m_pActionMoveDown;
-    /** Holds the USB devices menu instance. */
-    VBoxUSBMenu *m_pMenuUSBDevices;
-
     /** Holds the "New Filter %1" translation tag. */
     QString  m_strTrUSBFilterName;
@@ -165,14 +152,41 @@
     /** Holds the page data cache instance. */
     UISettingsCacheMachineUSB *m_pCache;
+
     /** @name Widgets
      * @{ */
-       QCheckBox *m_pCheckBoxUSB;
-       QITreeWidget *m_pTreeWidgetFilters;
-       QRadioButton *m_pRadioButtonUSB1;
-       QRadioButton *m_pRadioButtonUSB2;
-       QRadioButton *m_pRadioButtonUSB3;
-       QILabelSeparator *m_pCheckBoxUSBFilters;
-       QWidget *m_pUSBChild;
-       UIToolBar *m_pFiltersToolBar;
+        /** Holds the USB check-box instance. */
+        QCheckBox        *m_pCheckBoxUSB;
+        /** Holds the USB settings widget instance. */
+        QWidget          *m_pWidgetUSBSettings;
+        /** Holds the USB settings widget layout instance. */
+        QVBoxLayout      *m_pLayoutUSBSettings;
+        /** Holds the USB1 radio-button instance. */
+        QRadioButton     *m_pRadioButtonUSB1;
+        /** Holds the USB2 radio-button instance. */
+        QRadioButton     *m_pRadioButtonUSB2;
+        /** Holds the USB3 radio-button instance. */
+        QRadioButton     *m_pRadioButtonUSB3;
+        /** Holds the USB widget separator instance. */
+        QILabelSeparator *m_pLabelSeparatorFilters;
+        /** Holds the USB filters layout instance. */
+        QHBoxLayout      *m_pLayoutFilters;
+        /** Holds the USB filters tree-widget instance. */
+        QITreeWidget     *m_pTreeWidgetFilters;
+        /** Holds the USB filters toolbar instance. */
+        UIToolBar        *m_pToolBarFilters;
+        /** Holds the New action instance. */
+        QAction          *m_pActionNew;
+        /** Holds the Add action instance. */
+        QAction          *m_pActionAdd;
+        /** Holds the Edit action instance. */
+        QAction          *m_pActionEdit;
+        /** Holds the Remove action instance. */
+        QAction          *m_pActionRemove;
+        /** Holds the Move Up action instance. */
+        QAction          *m_pActionMoveUp;
+        /** Holds the Move Down action instance. */
+        QAction          *m_pActionMoveDown;
+        /** Holds the USB devices menu instance. */
+        VBoxUSBMenu      *m_pMenuUSBDevices;
     /** @} */
 };
