Index: trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooser.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooser.cpp	(revision 84102)
+++ trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooser.cpp	(revision 84103)
@@ -20,9 +20,9 @@
 
 /* GUI includes: */
+#include "UICommon.h"
 #include "UIChooser.h"
 #include "UIChooserModel.h"
 #include "UIChooserView.h"
 #include "UIVirtualBoxManagerWidget.h"
-#include "UICommon.h"
 
 
@@ -30,9 +30,7 @@
     : QWidget(pParent)
     , m_pManagerWidget(pParent)
-    , m_pMainLayout(0)
     , m_pChooserModel(0)
     , m_pChooserView(0)
 {
-    /* Prepare: */
     prepare();
 }
@@ -40,5 +38,4 @@
 UIChooser::~UIChooser()
 {
-    /* Cleanup: */
     cleanup();
 }
@@ -46,4 +43,5 @@
 UIActionPool *UIChooser::actionPool() const
 {
+    AssertPtrReturn(managerWidget(), 0);
     return managerWidget()->actionPool();
 }
@@ -51,50 +49,60 @@
 UIVirtualMachineItem *UIChooser::currentItem() const
 {
-    return m_pChooserModel->firstSelectedMachineItem();
+    AssertPtrReturn(model(), 0);
+    return model()->firstSelectedMachineItem();
 }
 
 QList<UIVirtualMachineItem*> UIChooser::currentItems() const
 {
-    return m_pChooserModel->selectedMachineItems();
+    AssertPtrReturn(model(), QList<UIVirtualMachineItem*>());
+    return model()->selectedMachineItems();
 }
 
 bool UIChooser::isGroupItemSelected() const
 {
-    return m_pChooserModel->isGroupItemSelected();
+    AssertPtrReturn(model(), false);
+    return model()->isGroupItemSelected();
 }
 
 bool UIChooser::isGlobalItemSelected() const
 {
-    return m_pChooserModel->isGlobalItemSelected();
+    AssertPtrReturn(model(), false);
+    return model()->isGlobalItemSelected();
 }
 
 bool UIChooser::isMachineItemSelected() const
 {
-    return m_pChooserModel->isMachineItemSelected();
+    AssertPtrReturn(model(), false);
+    return model()->isMachineItemSelected();
 }
 
 bool UIChooser::isSingleGroupSelected() const
 {
-    return m_pChooserModel->isSingleGroupSelected();
+    AssertPtrReturn(model(), false);
+    return model()->isSingleGroupSelected();
 }
 
 bool UIChooser::isSingleLocalGroupSelected() const
 {
-    return m_pChooserModel->isSingleLocalGroupSelected();
+    AssertPtrReturn(model(), false);
+    return model()->isSingleLocalGroupSelected();
 }
 
 bool UIChooser::isSingleCloudProfileGroupSelected() const
 {
-    return m_pChooserModel->isSingleCloudProfileGroupSelected();
+    AssertPtrReturn(model(), false);
+    return model()->isSingleCloudProfileGroupSelected();
 }
 
 bool UIChooser::isAllItemsOfOneGroupSelected() const
 {
-    return m_pChooserModel->isAllItemsOfOneGroupSelected();
+    AssertPtrReturn(model(), false);
+    return model()->isAllItemsOfOneGroupSelected();
 }
 
 bool UIChooser::isGroupSavingInProgress() const
 {
-    return m_pChooserModel->isGroupSavingInProgress();
+    AssertPtrReturn(model(), false);
+    return model()->isGroupSavingInProgress();
 }
 
@@ -102,4 +110,5 @@
 {
     /* Pass height to a model: */
+    AssertPtrReturnVoid(model());
     model()->setGlobalItemHeightHint(newSize.height());
 }
@@ -108,4 +117,5 @@
 {
     /* Translate scene coordinates to global one: */
+    AssertPtrReturnVoid(view());
     emit sigToolMenuRequested(enmClass, mapToGlobal(view()->mapFromScene(position)));
 }
@@ -113,17 +123,12 @@
 void UIChooser::prepare()
 {
-    /* Prepare palette: */
+    /* Prepare everything: */
     preparePalette();
-    /* Prepare layout: */
-    prepareLayout();
-    /* Prepare model: */
     prepareModel();
-    /* Prepare view: */
-    prepareView();
-    /* Prepare connections: */
+    prepareWidgets();
     prepareConnections();
 
-    /* Load settings: */
-    loadSettings();
+    /* Init model: */
+    initModel();
 }
 
@@ -138,68 +143,66 @@
 }
 
-void UIChooser::prepareLayout()
-{
-    /* Create main-layout: */
-    m_pMainLayout = new QVBoxLayout(this);
-    if (m_pMainLayout)
+void UIChooser::prepareModel()
+{
+    m_pChooserModel = new UIChooserModel(this);
+}
+
+void UIChooser::prepareWidgets()
+{
+    /* Prepare main-layout: */
+    QVBoxLayout *pMainLayout = new QVBoxLayout(this);
+    if (pMainLayout)
     {
-        /* Configure main-layout: */
-        m_pMainLayout->setContentsMargins(0, 0, 0, 0);
-        m_pMainLayout->setSpacing(0);
+        pMainLayout->setContentsMargins(0, 0, 0, 0);
+        pMainLayout->setSpacing(0);
+
+        /* Prepare chooser-view: */
+        m_pChooserView = new UIChooserView(this);
+        if (m_pChooserView)
+        {
+            AssertPtrReturnVoid(model());
+            m_pChooserView->setScene(model()->scene());
+            m_pChooserView->show();
+            setFocusProxy(m_pChooserView);
+
+            /* Add into layout: */
+            pMainLayout->addWidget(m_pChooserView);
+        }
     }
 }
 
-void UIChooser::prepareModel()
-{
-    /* Create chooser-model: */
-    m_pChooserModel = new UIChooserModel(this);
-}
-
-void UIChooser::prepareView()
-{
-    /* Setup chooser-view: */
-    m_pChooserView = new UIChooserView(this);
-    if (m_pChooserView)
-    {
-        /* Configure chooser-view. */
-        m_pChooserView->setScene(m_pChooserModel->scene());
-        m_pChooserView->show();
-        setFocusProxy(m_pChooserView);
-
-        /* Add into layout: */
-        m_pMainLayout->addWidget(m_pChooserView);
-    }
-}
-
 void UIChooser::prepareConnections()
 {
+    AssertPtrReturnVoid(model());
+    AssertPtrReturnVoid(view());
+
     /* Setup chooser-model connections: */
-    connect(m_pChooserModel, &UIChooserModel::sigRootItemMinimumWidthHintChanged,
-            m_pChooserView, &UIChooserView::sltMinimumWidthHintChanged);
-    connect(m_pChooserModel, &UIChooserModel::sigToolMenuRequested,
+    connect(model(), &UIChooserModel::sigRootItemMinimumWidthHintChanged,
+            view(), &UIChooserView::sltMinimumWidthHintChanged);
+    connect(model(), &UIChooserModel::sigToolMenuRequested,
             this, &UIChooser::sltToolMenuRequested);
-    connect(m_pChooserModel, &UIChooserModel::sigCloudMachineStateChange,
+    connect(model(), &UIChooserModel::sigCloudMachineStateChange,
             this, &UIChooser::sigCloudMachineStateChange);
 
     /* Setup chooser-view connections: */
-    connect(m_pChooserView, &UIChooserView::sigResized,
-            m_pChooserModel, &UIChooserModel::sltHandleViewResized);
-}
-
-void UIChooser::loadSettings()
-{
-    /* Init model: */
-    m_pChooserModel->init();
-}
-
-void UIChooser::saveSettings()
+    connect(view(), &UIChooserView::sigResized,
+            model(), &UIChooserModel::sltHandleViewResized);
+}
+
+void UIChooser::initModel()
+{
+    AssertPtrReturnVoid(model());
+    model()->init();
+}
+
+void UIChooser::deinitModel()
+{
+    AssertPtrReturnVoid(model());
+    model()->deinit();
+}
+
+void UIChooser::cleanup()
 {
     /* Deinit model: */
-    m_pChooserModel->deinit();
-}
-
-void UIChooser::cleanup()
-{
-    /* Save settings: */
-    saveSettings();
-}
+    deinitModel();
+}
Index: trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooser.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooser.h	(revision 84102)
+++ trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooser.h	(revision 84103)
@@ -29,5 +29,4 @@
 
 /* Forward declarations: */
-class QVBoxLayout;
 class UIActionPool;
 class UIChooserModel;
@@ -146,17 +145,15 @@
         /** Prepares palette. */
         void preparePalette();
-        /** Prepares layout. */
-        void prepareLayout();
         /** Prepares model. */
         void prepareModel();
-        /** Prepares view. */
-        void prepareView();
+        /** Prepares widgets. */
+        void prepareWidgets();
         /** Prepares connections. */
         void prepareConnections();
-        /** Loads settings. */
-        void loadSettings();
+        /** Init model. */
+        void initModel();
 
-        /** Saves settings. */
-        void saveSettings();
+        /** Deinit model. */
+        void deinitModel();
         /** Cleanups all. */
         void cleanup();
@@ -168,6 +165,4 @@
         UIVirtualBoxManagerWidget *m_pManagerWidget;
 
-        /** Holds the main layout instane. */
-        QVBoxLayout    *m_pMainLayout;
         /** Holds the Chooser-model instane. */
         UIChooserModel *m_pChooserModel;
