Index: trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk	(revision 72090)
+++ trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk	(revision 72092)
@@ -520,5 +520,4 @@
 	src/selector/graphics/details/UIGDetailsElements.h \
 	src/selector/graphics/details/UIGMachinePreview.h \
-	src/settings/UISettingsDialogSpecific.h \
 	src/settings/UISettingsPage.h \
 	src/settings/UISettingsSelector.h \
@@ -664,4 +663,5 @@
 	src/selector/UIVirtualBoxEventHandler.h \
 	src/settings/UISettingsDialog.h \
+	src/settings/UISettingsDialogSpecific.h \
 	src/widgets/UIAddDiskEncryptionPasswordDialog.h \
 	src/widgets/UIBootTable.h \
@@ -778,4 +778,5 @@
 	src/selector/UIVirtualBoxEventHandler.h \
 	src/settings/UISettingsDialog.h \
+	src/settings/UISettingsDialogSpecific.h \
 	src/widgets/UIAddDiskEncryptionPasswordDialog.h \
 	src/widgets/UIBootTable.h \
@@ -1035,5 +1036,4 @@
 	src/selector/graphics/details/UIGDetailsElements.cpp \
 	src/selector/graphics/details/UIGMachinePreview.cpp \
-	src/settings/UISettingsDialogSpecific.cpp \
 	src/settings/UISettingsPage.cpp \
 	src/settings/UISettingsSelector.cpp \
@@ -1220,4 +1220,5 @@
 	src/settings/UISettingsDefs.cpp \
 	src/settings/UISettingsDialog.cpp \
+	src/settings/UISettingsDialogSpecific.cpp \
 	src/widgets/UIAddDiskEncryptionPasswordDialog.cpp \
 	src/widgets/UIBootTable.cpp \
@@ -1361,4 +1362,5 @@
 	src/settings/UISettingsDefs.cpp \
 	src/settings/UISettingsDialog.cpp \
+	src/settings/UISettingsDialogSpecific.cpp \
 	src/widgets/UIAddDiskEncryptionPasswordDialog.cpp \
 	src/widgets/UIBootTable.cpp \
Index: trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp	(revision 72090)
+++ trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp	(revision 72092)
@@ -5,5 +5,5 @@
 
 /*
- * Copyright (C) 2006-2017 Oracle Corporation
+ * Copyright (C) 2006-2018 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -21,37 +21,37 @@
 
 /* GUI includes: */
+# include "QIWidgetValidator.h"
+# include "VBoxGlobal.h"
+# include "UIExtraDataManager.h"
+# include "UIMessageCenter.h"
+# include "UISettingsDefs.h"
 # include "UISettingsDialogSpecific.h"
 # include "UISettingsSerializer.h"
-# include "UISettingsDefs.h"
-# include "VBoxGlobal.h"
-# include "UIMessageCenter.h"
-# include "UIExtraDataManager.h"
-# include "QIWidgetValidator.h"
 # include "UISettingsSelector.h"
 # include "UIVirtualBoxEventHandler.h"
 
+/* GUI includes: Global Preferences: */
+# include "UIGlobalSettingsDisplay.h"
+# include "UIGlobalSettingsExtension.h"
 # include "UIGlobalSettingsGeneral.h"
 # include "UIGlobalSettingsInput.h"
-# ifdef VBOX_GUI_WITH_NETWORK_MANAGER
-#  include "UIGlobalSettingsUpdate.h"
-# endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
 # include "UIGlobalSettingsLanguage.h"
-# include "UIGlobalSettingsDisplay.h"
 # include "UIGlobalSettingsNetwork.h"
-# include "UIGlobalSettingsExtension.h"
 # ifdef VBOX_GUI_WITH_NETWORK_MANAGER
 #  include "UIGlobalSettingsProxy.h"
-# endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
-
+#  include "UIGlobalSettingsUpdate.h"
+# endif
+
+/* GUI includes: Machine Settings: */
+# include "UIMachineSettingsAudio.h"
+# include "UIMachineSettingsDisplay.h"
 # include "UIMachineSettingsGeneral.h"
-# include "UIMachineSettingsSystem.h"
-# include "UIMachineSettingsDisplay.h"
-# include "UIMachineSettingsStorage.h"
-# include "UIMachineSettingsAudio.h"
+# include "UIMachineSettingsInterface.h"
 # include "UIMachineSettingsNetwork.h"
 # include "UIMachineSettingsSerial.h"
+# include "UIMachineSettingsSF.h"
+# include "UIMachineSettingsStorage.h"
+# include "UIMachineSettingsSystem.h"
 # include "UIMachineSettingsUSB.h"
-# include "UIMachineSettingsSF.h"
-# include "UIMachineSettingsInterface.h"
 
 /* COM includes: */
@@ -62,5 +62,10 @@
 #ifdef VBOX_WS_MAC
 # define VBOX_GUI_WITH_TOOLBAR_SETTINGS
-#endif /* VBOX_WS_MAC */
+#endif
+
+
+/*********************************************************************************************************************************
+*   Class UISettingsDialogGlobal implementation.                                                                                 *
+*********************************************************************************************************************************/
 
 UISettingsDialogGlobal::UISettingsDialogGlobal(QWidget *pParent,
@@ -68,9 +73,109 @@
                                                const QString &strControl /* = QString() */)
     : UISettingsDialog(pParent)
+    , m_strCategory(strCategory)
+    , m_strControl(strControl)
+{
+    /* Prepare: */
+    prepare();
+}
+
+void UISettingsDialogGlobal::retranslateUi()
+{
+    /* Selector itself: */
+    m_pSelector->widget()->setWhatsThis(tr("Allows to navigate through Global Property categories"));
+
+    /* General page: */
+    m_pSelector->setItemText(GlobalSettingsPageType_General, tr("General"));
+
+    /* Input page: */
+    m_pSelector->setItemText(GlobalSettingsPageType_Input, tr("Input"));
+
+#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
+    /* Update page: */
+    m_pSelector->setItemText(GlobalSettingsPageType_Update, tr("Update"));
+#endif
+
+    /* Language page: */
+    m_pSelector->setItemText(GlobalSettingsPageType_Language, tr("Language"));
+
+    /* Display page: */
+    m_pSelector->setItemText(GlobalSettingsPageType_Display, tr("Display"));
+
+    /* Network page: */
+    m_pSelector->setItemText(GlobalSettingsPageType_Network, tr("Network"));
+
+    /* Extension page: */
+    m_pSelector->setItemText(GlobalSettingsPageType_Extensions, tr("Extensions"));
+
+#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
+    /* Proxy page: */
+    m_pSelector->setItemText(GlobalSettingsPageType_Proxy, tr("Proxy"));
+#endif
+
+    /* Polish the selector: */
+    m_pSelector->polish();
+
+    /* Base-class UI translation: */
+    UISettingsDialog::retranslateUi();
+
+    /* Set dialog's name: */
+    setWindowTitle(title());
+}
+
+void UISettingsDialogGlobal::loadOwnData()
+{
+    /* Get properties: */
+    CSystemProperties comProperties = vboxGlobal().virtualBox().GetSystemProperties();
+    /* Prepare global data: */
+    qRegisterMetaType<UISettingsDataGlobal>();
+    UISettingsDataGlobal data(comProperties);
+    QVariant varData = QVariant::fromValue(data);
+
+    /* Call to base-class: */
+    UISettingsDialog::loadData(varData);
+}
+
+void UISettingsDialogGlobal::saveOwnData()
+{
+    /* Get properties: */
+    CSystemProperties comProperties = vboxGlobal().virtualBox().GetSystemProperties();
+    /* Prepare global data: */
+    qRegisterMetaType<UISettingsDataGlobal>();
+    UISettingsDataGlobal data(comProperties);
+    QVariant varData = QVariant::fromValue(data);
+
+    /* Call to base-class: */
+    UISettingsDialog::saveData(varData);
+
+    /* Get updated properties: */
+    CSystemProperties comNewProperties = varData.value<UISettingsDataGlobal>().m_properties;
+    /* If properties are not OK => show the error: */
+    if (!comNewProperties.isOk())
+        msgCenter().cannotSetSystemProperties(comNewProperties, this);
+
+    /* Mark as saved: */
+    sltMarkSaved();
+}
+
+QString UISettingsDialogGlobal::titleExtension() const
+{
+#ifdef VBOX_GUI_WITH_TOOLBAR_SETTINGS
+    return m_pSelector->itemText(m_pSelector->currentId());
+#else
+    return tr("Preferences");
+#endif
+}
+
+QString UISettingsDialogGlobal::title() const
+{
+    return tr("VirtualBox - %1").arg(titleExtension());
+}
+
+void UISettingsDialogGlobal::prepare()
 {
     /* Window icon: */
 #ifndef VBOX_WS_MAC
     setWindowIcon(QIcon(":/global_settings_16px.png"));
-#endif /* !VBOX_WS_MAC */
+#endif
 
     /* Creating settings pages: */
@@ -165,15 +270,15 @@
     setConfigurationAccessLevel(ConfigurationAccessLevel_Full);
 
-    /* Retranslate UI: */
+    /* Apply language settings: */
     retranslateUi();
 
     /* Setup settings window: */
-    if (!strCategory.isNull())
-    {
-        m_pSelector->selectByLink(strCategory);
+    if (!m_strCategory.isNull())
+    {
+        m_pSelector->selectByLink(m_strCategory);
         /* Search for a widget with the given name: */
-        if (!strControl.isNull())
-        {
-            if (QWidget *pWidget = m_pStack->findChild<QWidget*>(strControl))
+        if (!m_strControl.isNull())
+        {
+            if (QWidget *pWidget = m_pStack->findChild<QWidget*>(m_strControl))
             {
                 QList<QWidget*> parents;
@@ -183,6 +288,7 @@
                     if (QTabWidget *pTabWidget = qobject_cast<QTabWidget*>(pParentWidget))
                     {
-                        /* The tab contents widget is two steps down
-                         * (QTabWidget -> QStackedWidget -> QWidget): */
+                        // WORKAROUND:
+                        // The tab contents widget is two steps down
+                        // (QTabWidget -> QStackedWidget -> QWidget).
                         QWidget *pTabPage = parents[parents.count() - 1];
                         if (pTabPage)
@@ -202,97 +308,5 @@
 }
 
-void UISettingsDialogGlobal::loadOwnData()
-{
-    /* Get properties: */
-    CSystemProperties properties = vboxGlobal().virtualBox().GetSystemProperties();
-    /* Prepare global data: */
-    qRegisterMetaType<UISettingsDataGlobal>();
-    UISettingsDataGlobal data(properties);
-    QVariant varData = QVariant::fromValue(data);
-
-    /* Call to base-class: */
-    UISettingsDialog::loadData(varData);
-}
-
-void UISettingsDialogGlobal::saveOwnData()
-{
-    /* Get properties: */
-    CSystemProperties properties = vboxGlobal().virtualBox().GetSystemProperties();
-    /* Prepare global data: */
-    qRegisterMetaType<UISettingsDataGlobal>();
-    UISettingsDataGlobal data(properties);
-    QVariant varData = QVariant::fromValue(data);
-
-    /* Call to base-class: */
-    UISettingsDialog::saveData(varData);
-
-    /* Get updated properties: */
-    CSystemProperties newProperties = varData.value<UISettingsDataGlobal>().m_properties;
-    /* If properties are not OK => show the error: */
-    if (!newProperties.isOk())
-        msgCenter().cannotSetSystemProperties(newProperties, this);
-
-    /* Mark as saved: */
-    sltMarkSaved();
-}
-
-void UISettingsDialogGlobal::retranslateUi()
-{
-    /* Selector itself: */
-    m_pSelector->widget()->setWhatsThis(tr("Allows to navigate through Global Property categories"));
-
-    /* General page: */
-    m_pSelector->setItemText(GlobalSettingsPageType_General, tr("General"));
-
-    /* Input page: */
-    m_pSelector->setItemText(GlobalSettingsPageType_Input, tr("Input"));
-
-#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
-    /* Update page: */
-    m_pSelector->setItemText(GlobalSettingsPageType_Update, tr("Update"));
-#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
-
-    /* Language page: */
-    m_pSelector->setItemText(GlobalSettingsPageType_Language, tr("Language"));
-
-    /* Display page: */
-    m_pSelector->setItemText(GlobalSettingsPageType_Display, tr("Display"));
-
-    /* Network page: */
-    m_pSelector->setItemText(GlobalSettingsPageType_Network, tr("Network"));
-
-    /* Extension page: */
-    m_pSelector->setItemText(GlobalSettingsPageType_Extensions, tr("Extensions"));
-
-#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
-    /* Proxy page: */
-    m_pSelector->setItemText(GlobalSettingsPageType_Proxy, tr("Proxy"));
-#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
-
-    /* Polish the selector: */
-    m_pSelector->polish();
-
-    /* Base-class UI translation: */
-    UISettingsDialog::retranslateUi();
-
-    /* Set dialog's name: */
-    setWindowTitle(title());
-}
-
-QString UISettingsDialogGlobal::titleExtension() const
-{
-#ifdef VBOX_GUI_WITH_TOOLBAR_SETTINGS
-    return m_pSelector->itemText(m_pSelector->currentId());
-#else /* VBOX_GUI_WITH_TOOLBAR_SETTINGS */
-    return tr("Preferences");
-#endif /* !VBOX_GUI_WITH_TOOLBAR_SETTINGS */
-}
-
-QString UISettingsDialogGlobal::title() const
-{
-    return tr("VirtualBox - %1").arg(titleExtension());
-}
-
-bool UISettingsDialogGlobal::isPageAvailable(int iPageId)
+bool UISettingsDialogGlobal::isPageAvailable(int iPageId) const
 {
     switch (iPageId)
@@ -302,5 +316,5 @@
 #ifndef VBOX_WITH_NETFLT
             return false;
-#endif /* !VBOX_WITH_NETFLT */
+#endif
             break;
         }
@@ -310,4 +324,9 @@
     return true;
 }
+
+
+/*********************************************************************************************************************************
+*   Class UISettingsDialogMachine implementation.                                                                                *
+*********************************************************************************************************************************/
 
 UISettingsDialogMachine::UISettingsDialogMachine(QWidget *pParent, const QString &strMachineId,
@@ -315,175 +334,68 @@
     : UISettingsDialog(pParent)
     , m_strMachineId(strMachineId)
+    , m_strCategory(strCategory)
+    , m_strControl(strControl)
     , m_fAllowResetFirstRunFlag(false)
     , m_fResetFirstRunFlag(false)
 {
-    /* Window icon: */
-#ifndef VBOX_WS_MAC
-    setWindowIcon(QIcon(":/vm_settings_16px.png"));
-#endif /* VBOX_WS_MAC */
-
-    /* Allow to reset first-run flag just when medium enumeration was finished: */
-    connect(&vboxGlobal(), SIGNAL(sigMediumEnumerationFinished()), this, SLOT(sltAllowResetFirstRunFlag()));
-
-    /* Make sure settings window will be updated on session/machine state/data changes: */
-    connect(gVBoxEvents, SIGNAL(sigSessionStateChange(QString, KSessionState)),
-            this, SLOT(sltSessionStateChanged(QString, KSessionState)));
-    connect(gVBoxEvents, SIGNAL(sigMachineStateChange(QString, KMachineState)),
-            this, SLOT(sltMachineStateChanged(QString, KMachineState)));
-    connect(gVBoxEvents, SIGNAL(sigMachineDataChange(QString)),
-            this, SLOT(sltMachineDataChanged(QString)));
-
-    /* Get corresponding machine (required to determine dialog type and page availability): */
-    m_machine = vboxGlobal().virtualBox().FindMachine(m_strMachineId);
-    AssertMsg(!m_machine.isNull(), ("Can't find corresponding machine!\n"));
-    m_sessionState = m_machine.GetSessionState();
-    m_machineState = m_machine.GetState();
-
-    /* Creating settings pages: */
-    QList<MachineSettingsPageType> restrictedMachineSettingsPages = gEDataManager->restrictedMachineSettingsPages(m_strMachineId);
-    for (int iPageIndex = MachineSettingsPageType_General; iPageIndex < MachineSettingsPageType_Max; ++iPageIndex)
-    {
-        /* Make sure page was not restricted: */
-        if (restrictedMachineSettingsPages.contains(static_cast<MachineSettingsPageType>(iPageIndex)))
-            continue;
-
-        /* Make sure page is available: */
-        if (isPageAvailable(iPageIndex))
-        {
-            UISettingsPage *pSettingsPage = 0;
-            switch (iPageIndex)
-            {
-                /* General page: */
-                case MachineSettingsPageType_General:
-                {
-                    pSettingsPage = new UIMachineSettingsGeneral;
-                    addItem(":/machine_32px.png", ":/machine_24px.png", ":/machine_16px.png",
-                            iPageIndex, "#general", pSettingsPage);
-                    break;
-                }
-                /* System page: */
-                case MachineSettingsPageType_System:
-                {
-                    pSettingsPage = new UIMachineSettingsSystem;
-                    addItem(":/chipset_32px.png", ":/chipset_24px.png", ":/chipset_16px.png",
-                            iPageIndex, "#system", pSettingsPage);
-                    break;
-                }
-                /* Display page: */
-                case MachineSettingsPageType_Display:
-                {
-                    pSettingsPage = new UIMachineSettingsDisplay;
-                    addItem(":/vrdp_32px.png", ":/vrdp_24px.png", ":/vrdp_16px.png",
-                            iPageIndex, "#display", pSettingsPage);
-                    break;
-                }
-                /* Storage page: */
-                case MachineSettingsPageType_Storage:
-                {
-                    pSettingsPage = new UIMachineSettingsStorage;
-                    connect(pSettingsPage, SIGNAL(sigStorageChanged()), this, SLOT(sltResetFirstRunFlag()));
-                    addItem(":/hd_32px.png", ":/hd_24px.png", ":/hd_16px.png",
-                            iPageIndex, "#storage", pSettingsPage);
-                    break;
-                }
-                /* Audio page: */
-                case MachineSettingsPageType_Audio:
-                {
-                    pSettingsPage = new UIMachineSettingsAudio;
-                    addItem(":/sound_32px.png", ":/sound_24px.png", ":/sound_16px.png",
-                            iPageIndex, "#audio", pSettingsPage);
-                    break;
-                }
-                /* Network page: */
-                case MachineSettingsPageType_Network:
-                {
-                    pSettingsPage = new UIMachineSettingsNetworkPage;
-                    addItem(":/nw_32px.png", ":/nw_24px.png", ":/nw_16px.png",
-                            iPageIndex, "#network", pSettingsPage);
-                    break;
-                }
-                /* Ports page: */
-                case MachineSettingsPageType_Ports:
-                {
-                    addItem(":/serial_port_32px.png", ":/serial_port_24px.png", ":/serial_port_16px.png",
-                            iPageIndex, "#ports");
-                    break;
-                }
-                /* Serial page: */
-                case MachineSettingsPageType_Serial:
-                {
-                    pSettingsPage = new UIMachineSettingsSerialPage;
-                    addItem(":/serial_port_32px.png", ":/serial_port_24px.png", ":/serial_port_16px.png",
-                            iPageIndex, "#serialPorts", pSettingsPage, MachineSettingsPageType_Ports);
-                    break;
-                }
-                /* USB page: */
-                case MachineSettingsPageType_USB:
-                {
-                    pSettingsPage = new UIMachineSettingsUSB;
-                    addItem(":/usb_32px.png", ":/usb_24px.png", ":/usb_16px.png",
-                            iPageIndex, "#usb", pSettingsPage, MachineSettingsPageType_Ports);
-                    break;
-                }
-                /* Shared Folders page: */
-                case MachineSettingsPageType_SF:
-                {
-                    pSettingsPage = new UIMachineSettingsSF;
-                    addItem(":/sf_32px.png", ":/sf_24px.png", ":/sf_16px.png",
-                            iPageIndex, "#sharedFolders", pSettingsPage);
-                    break;
-                }
-                /* Interface page: */
-                case MachineSettingsPageType_Interface:
-                {
-                    pSettingsPage = new UIMachineSettingsInterface(m_machine.GetId());
-                    addItem(":/interface_32px.png", ":/interface_24px.png", ":/interface_16px.png",
-                            iPageIndex, "#userInterface", pSettingsPage);
-                    break;
-                }
-                default:
-                    break;
-            }
-        }
-    }
-
-    /* Calculate initial configuration access level: */
-    setConfigurationAccessLevel(::configurationAccessLevel(m_sessionState, m_machineState));
-
-    /* Retranslate UI: */
-    retranslateUi();
-
-    /* Setup settings window: */
-    if (!strCategory.isNull())
-    {
-        m_pSelector->selectByLink(strCategory);
-        /* Search for a widget with the given name: */
-        if (!strControl.isNull())
-        {
-            if (QWidget *pWidget = m_pStack->findChild<QWidget*>(strControl))
-            {
-                QList<QWidget*> parents;
-                QWidget *pParentWidget = pWidget;
-                while ((pParentWidget = pParentWidget->parentWidget()) != 0)
-                {
-                    if (QTabWidget *pTabWidget = qobject_cast<QTabWidget*>(pParentWidget))
-                    {
-                        /* The tab contents widget is two steps down
-                         * (QTabWidget -> QStackedWidget -> QWidget): */
-                        QWidget *pTabPage = parents[parents.count() - 1];
-                        if (pTabPage)
-                            pTabPage = parents[parents.count() - 2];
-                        if (pTabPage)
-                            pTabWidget->setCurrentWidget(pTabPage);
-                    }
-                    parents.append(pParentWidget);
-                }
-                pWidget->setFocus();
-            }
-        }
-    }
-    /* First item as default: */
-    else
-        m_pSelector->selectById(MachineSettingsPageType_General);
+    /* Prepare: */
+    prepare();
+}
+
+void UISettingsDialogMachine::retranslateUi()
+{
+    /* Selector itself: */
+    m_pSelector->widget()->setWhatsThis(tr("Allows to navigate through VM Settings categories"));
+
+    /* We have to make sure that the Network, Serial pages are retranslated
+     * before they are revalidated. Cause: They do string comparing within
+     * vboxGlobal which is retranslated at that point already: */
+    QEvent event(QEvent::LanguageChange);
+    if (QWidget *pPage = m_pSelector->idToPage(MachineSettingsPageType_Network))
+        qApp->sendEvent(pPage, &event);
+    if (QWidget *pPage = m_pSelector->idToPage(MachineSettingsPageType_Serial))
+        qApp->sendEvent(pPage, &event);
+
+    /* General page: */
+    m_pSelector->setItemText(MachineSettingsPageType_General, tr("General"));
+
+    /* System page: */
+    m_pSelector->setItemText(MachineSettingsPageType_System, tr("System"));
+
+    /* Display page: */
+    m_pSelector->setItemText(MachineSettingsPageType_Display, tr("Display"));
+
+    /* Storage page: */
+    m_pSelector->setItemText(MachineSettingsPageType_Storage, tr("Storage"));
+
+    /* Audio page: */
+    m_pSelector->setItemText(MachineSettingsPageType_Audio, tr("Audio"));
+
+    /* Network page: */
+    m_pSelector->setItemText(MachineSettingsPageType_Network, tr("Network"));
+
+    /* Ports page: */
+    m_pSelector->setItemText(MachineSettingsPageType_Ports, tr("Ports"));
+
+    /* Serial page: */
+    m_pSelector->setItemText(MachineSettingsPageType_Serial, tr("Serial Ports"));
+
+    /* USB page: */
+    m_pSelector->setItemText(MachineSettingsPageType_USB, tr("USB"));
+
+    /* SFolders page: */
+    m_pSelector->setItemText(MachineSettingsPageType_SF, tr("Shared Folders"));
+
+    /* Interface page: */
+    m_pSelector->setItemText(MachineSettingsPageType_Interface, tr("User Interface"));
+
+    /* Polish the selector: */
+    m_pSelector->polish();
+
+    /* Base-class UI translation: */
+    UISettingsDialog::retranslateUi();
+
+    /* Set dialog's name: */
+    setWindowTitle(title());
 }
 
@@ -584,68 +496,11 @@
 }
 
-void UISettingsDialogMachine::retranslateUi()
-{
-    /* Selector itself: */
-    m_pSelector->widget()->setWhatsThis(tr("Allows to navigate through VM Settings categories"));
-
-    /* We have to make sure that the Network, Serial pages are retranslated
-     * before they are revalidated. Cause: They do string comparing within
-     * vboxGlobal which is retranslated at that point already: */
-    QEvent event(QEvent::LanguageChange);
-    if (QWidget *pPage = m_pSelector->idToPage(MachineSettingsPageType_Network))
-        qApp->sendEvent(pPage, &event);
-    if (QWidget *pPage = m_pSelector->idToPage(MachineSettingsPageType_Serial))
-        qApp->sendEvent(pPage, &event);
-
-    /* General page: */
-    m_pSelector->setItemText(MachineSettingsPageType_General, tr("General"));
-
-    /* System page: */
-    m_pSelector->setItemText(MachineSettingsPageType_System, tr("System"));
-
-    /* Display page: */
-    m_pSelector->setItemText(MachineSettingsPageType_Display, tr("Display"));
-
-    /* Storage page: */
-    m_pSelector->setItemText(MachineSettingsPageType_Storage, tr("Storage"));
-
-    /* Audio page: */
-    m_pSelector->setItemText(MachineSettingsPageType_Audio, tr("Audio"));
-
-    /* Network page: */
-    m_pSelector->setItemText(MachineSettingsPageType_Network, tr("Network"));
-
-    /* Ports page: */
-    m_pSelector->setItemText(MachineSettingsPageType_Ports, tr("Ports"));
-
-    /* Serial page: */
-    m_pSelector->setItemText(MachineSettingsPageType_Serial, tr("Serial Ports"));
-
-    /* USB page: */
-    m_pSelector->setItemText(MachineSettingsPageType_USB, tr("USB"));
-
-    /* SFolders page: */
-    m_pSelector->setItemText(MachineSettingsPageType_SF, tr("Shared Folders"));
-
-    /* Interface page: */
-    m_pSelector->setItemText(MachineSettingsPageType_Interface, tr("User Interface"));
-
-    /* Polish the selector: */
-    m_pSelector->polish();
-
-    /* Base-class UI translation: */
-    UISettingsDialog::retranslateUi();
-
-    /* Set dialog's name: */
-    setWindowTitle(title());
-}
-
 QString UISettingsDialogMachine::titleExtension() const
 {
 #ifdef VBOX_GUI_WITH_TOOLBAR_SETTINGS
     return m_pSelector->itemText(m_pSelector->currentId());
-#else /* VBOX_GUI_WITH_TOOLBAR_SETTINGS */
+#else
     return tr("Settings");
-#endif /* !VBOX_GUI_WITH_TOOLBAR_SETTINGS */
+#endif
 }
 
@@ -705,4 +560,14 @@
 }
 
+void UISettingsDialogMachine::sltCategoryChanged(int cId)
+{
+    /* Raise priority of requested page: */
+    if (serializeProcess())
+        serializeProcess()->raisePriorityOfPage(cId);
+
+    /* Call to base-class: */
+    UISettingsDialog::sltCategoryChanged(cId);
+}
+
 void UISettingsDialogMachine::sltMarkLoaded()
 {
@@ -738,10 +603,9 @@
 }
 
-void UISettingsDialogMachine::sltSessionStateChanged(QString strMachineId, KSessionState sessionState)
+void UISettingsDialogMachine::sltSessionStateChanged(QString strMachineId, KSessionState enmSessionState)
 {
     /* Ignore if serialization is in progress: */
     if (isSerializationInProgress())
         return;
-
     /* Ignore if thats NOT our VM: */
     if (strMachineId != m_strMachineId)
@@ -749,9 +613,8 @@
 
     /* Ignore if state was NOT actually changed: */
-    if (m_sessionState == sessionState)
-        return;
-
+    if (m_enmSessionState == enmSessionState)
+        return;
     /* Update current session state: */
-    m_sessionState = sessionState;
+    m_enmSessionState = enmSessionState;
 
     /* Recalculate configuration access level: */
@@ -759,10 +622,9 @@
 }
 
-void UISettingsDialogMachine::sltMachineStateChanged(QString strMachineId, KMachineState machineState)
+void UISettingsDialogMachine::sltMachineStateChanged(QString strMachineId, KMachineState enmMachineState)
 {
     /* Ignore if serialization is in progress: */
     if (isSerializationInProgress())
         return;
-
     /* Ignore if thats NOT our VM: */
     if (strMachineId != m_strMachineId)
@@ -770,9 +632,8 @@
 
     /* Ignore if state was NOT actually changed: */
-    if (m_machineState == machineState)
-        return;
-
+    if (m_enmMachineState == enmMachineState)
+        return;
     /* Update current machine state: */
-    m_machineState = machineState;
+    m_enmMachineState = enmMachineState;
 
     /* Recalculate configuration access level: */
@@ -785,5 +646,4 @@
     if (isSerializationInProgress())
         return;
-
     /* Ignore if thats NOT our VM: */
     if (strMachineId != m_strMachineId)
@@ -798,12 +658,4 @@
 }
 
-void UISettingsDialogMachine::sltCategoryChanged(int cId)
-{
-    if (serializeProcess())
-        serializeProcess()->raisePriorityOfPage(cId);
-
-    UISettingsDialog::sltCategoryChanged(cId);
-}
-
 void UISettingsDialogMachine::sltAllowResetFirstRunFlag()
 {
@@ -817,5 +669,180 @@
 }
 
-bool UISettingsDialogMachine::isPageAvailable(int iPageId)
+void UISettingsDialogMachine::prepare()
+{
+    /* Window icon: */
+#ifndef VBOX_WS_MAC
+    setWindowIcon(QIcon(":/vm_settings_16px.png"));
+#endif
+
+    /* Allow to reset first-run flag just when medium enumeration was finished: */
+    connect(&vboxGlobal(), &VBoxGlobal::sigMediumEnumerationFinished,
+            this, &UISettingsDialogMachine::sltAllowResetFirstRunFlag);
+
+    /* Make sure settings window will be updated on session/machine state/data changes: */
+    connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigSessionStateChange,
+            this, &UISettingsDialogMachine::sltSessionStateChanged);
+    connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigMachineStateChange,
+            this, &UISettingsDialogMachine::sltMachineStateChanged);
+    connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigMachineDataChange,
+            this, &UISettingsDialogMachine::sltMachineDataChanged);
+
+    /* Get corresponding machine (required to determine dialog type and page availability): */
+    m_machine = vboxGlobal().virtualBox().FindMachine(m_strMachineId);
+    AssertMsg(!m_machine.isNull(), ("Can't find corresponding machine!\n"));
+    m_enmSessionState = m_machine.GetSessionState();
+    m_enmMachineState = m_machine.GetState();
+
+    /* Creating settings pages: */
+    QList<MachineSettingsPageType> restrictedMachineSettingsPages = gEDataManager->restrictedMachineSettingsPages(m_strMachineId);
+    for (int iPageIndex = MachineSettingsPageType_General; iPageIndex < MachineSettingsPageType_Max; ++iPageIndex)
+    {
+        /* Make sure page was not restricted: */
+        if (restrictedMachineSettingsPages.contains(static_cast<MachineSettingsPageType>(iPageIndex)))
+            continue;
+
+        /* Make sure page is available: */
+        if (isPageAvailable(iPageIndex))
+        {
+            UISettingsPage *pSettingsPage = 0;
+            switch (iPageIndex)
+            {
+                /* General page: */
+                case MachineSettingsPageType_General:
+                {
+                    pSettingsPage = new UIMachineSettingsGeneral;
+                    addItem(":/machine_32px.png", ":/machine_24px.png", ":/machine_16px.png",
+                            iPageIndex, "#general", pSettingsPage);
+                    break;
+                }
+                /* System page: */
+                case MachineSettingsPageType_System:
+                {
+                    pSettingsPage = new UIMachineSettingsSystem;
+                    addItem(":/chipset_32px.png", ":/chipset_24px.png", ":/chipset_16px.png",
+                            iPageIndex, "#system", pSettingsPage);
+                    break;
+                }
+                /* Display page: */
+                case MachineSettingsPageType_Display:
+                {
+                    pSettingsPage = new UIMachineSettingsDisplay;
+                    addItem(":/vrdp_32px.png", ":/vrdp_24px.png", ":/vrdp_16px.png",
+                            iPageIndex, "#display", pSettingsPage);
+                    break;
+                }
+                /* Storage page: */
+                case MachineSettingsPageType_Storage:
+                {
+                    pSettingsPage = new UIMachineSettingsStorage;
+                    connect(static_cast<UIMachineSettingsStorage*>(pSettingsPage), &UIMachineSettingsStorage::sigStorageChanged,
+                            this, &UISettingsDialogMachine::sltResetFirstRunFlag);
+                    addItem(":/hd_32px.png", ":/hd_24px.png", ":/hd_16px.png",
+                            iPageIndex, "#storage", pSettingsPage);
+                    break;
+                }
+                /* Audio page: */
+                case MachineSettingsPageType_Audio:
+                {
+                    pSettingsPage = new UIMachineSettingsAudio;
+                    addItem(":/sound_32px.png", ":/sound_24px.png", ":/sound_16px.png",
+                            iPageIndex, "#audio", pSettingsPage);
+                    break;
+                }
+                /* Network page: */
+                case MachineSettingsPageType_Network:
+                {
+                    pSettingsPage = new UIMachineSettingsNetworkPage;
+                    addItem(":/nw_32px.png", ":/nw_24px.png", ":/nw_16px.png",
+                            iPageIndex, "#network", pSettingsPage);
+                    break;
+                }
+                /* Ports page: */
+                case MachineSettingsPageType_Ports:
+                {
+                    addItem(":/serial_port_32px.png", ":/serial_port_24px.png", ":/serial_port_16px.png",
+                            iPageIndex, "#ports");
+                    break;
+                }
+                /* Serial page: */
+                case MachineSettingsPageType_Serial:
+                {
+                    pSettingsPage = new UIMachineSettingsSerialPage;
+                    addItem(":/serial_port_32px.png", ":/serial_port_24px.png", ":/serial_port_16px.png",
+                            iPageIndex, "#serialPorts", pSettingsPage, MachineSettingsPageType_Ports);
+                    break;
+                }
+                /* USB page: */
+                case MachineSettingsPageType_USB:
+                {
+                    pSettingsPage = new UIMachineSettingsUSB;
+                    addItem(":/usb_32px.png", ":/usb_24px.png", ":/usb_16px.png",
+                            iPageIndex, "#usb", pSettingsPage, MachineSettingsPageType_Ports);
+                    break;
+                }
+                /* Shared Folders page: */
+                case MachineSettingsPageType_SF:
+                {
+                    pSettingsPage = new UIMachineSettingsSF;
+                    addItem(":/sf_32px.png", ":/sf_24px.png", ":/sf_16px.png",
+                            iPageIndex, "#sharedFolders", pSettingsPage);
+                    break;
+                }
+                /* Interface page: */
+                case MachineSettingsPageType_Interface:
+                {
+                    pSettingsPage = new UIMachineSettingsInterface(m_machine.GetId());
+                    addItem(":/interface_32px.png", ":/interface_24px.png", ":/interface_16px.png",
+                            iPageIndex, "#userInterface", pSettingsPage);
+                    break;
+                }
+                default:
+                    break;
+            }
+        }
+    }
+
+    /* Calculate initial configuration access level: */
+    setConfigurationAccessLevel(::configurationAccessLevel(m_enmSessionState, m_enmMachineState));
+
+    /* Apply language settings: */
+    retranslateUi();
+
+    /* Setup settings window: */
+    if (!m_strCategory.isNull())
+    {
+        m_pSelector->selectByLink(m_strCategory);
+        /* Search for a widget with the given name: */
+        if (!m_strControl.isNull())
+        {
+            if (QWidget *pWidget = m_pStack->findChild<QWidget*>(m_strControl))
+            {
+                QList<QWidget*> parents;
+                QWidget *pParentWidget = pWidget;
+                while ((pParentWidget = pParentWidget->parentWidget()) != 0)
+                {
+                    if (QTabWidget *pTabWidget = qobject_cast<QTabWidget*>(pParentWidget))
+                    {
+                        // WORKAROUND:
+                        // The tab contents widget is two steps down
+                        // (QTabWidget -> QStackedWidget -> QWidget).
+                        QWidget *pTabPage = parents[parents.count() - 1];
+                        if (pTabPage)
+                            pTabPage = parents[parents.count() - 2];
+                        if (pTabPage)
+                            pTabWidget->setCurrentWidget(pTabPage);
+                    }
+                    parents.append(pParentWidget);
+                }
+                pWidget->setFocus();
+            }
+        }
+    }
+    /* First item as default: */
+    else
+        m_pSelector->selectById(MachineSettingsPageType_General);
+}
+
+bool UISettingsDialogMachine::isPageAvailable(int iPageId) const
 {
     if (m_machine.isNull())
@@ -869,5 +896,5 @@
 {
     /* Determine new configuration access level: */
-    ConfigurationAccessLevel newConfigurationAccessLevel = ::configurationAccessLevel(m_sessionState, m_machineState);
+    const ConfigurationAccessLevel newConfigurationAccessLevel = ::configurationAccessLevel(m_enmSessionState, m_enmMachineState);
 
     /* Make sure someting changed: */
@@ -876,5 +903,5 @@
 
     /* Should we warn a user about access level decrease? */
-    bool fShouldWeWarn = configurationAccessLevel() == ConfigurationAccessLevel_Full;
+    const bool fShouldWeWarn = configurationAccessLevel() == ConfigurationAccessLevel_Full;
 
     /* Apply new configuration access level: */
@@ -885,3 +912,2 @@
         msgCenter().warnAboutStateChange(this);
 }
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.h	(revision 72090)
+++ trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.h	(revision 72092)
@@ -5,5 +5,5 @@
 
 /*
- * Copyright (C) 2006-2017 Oracle Corporation
+ * Copyright (C) 2006-2018 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -16,6 +16,6 @@
  */
 
-#ifndef __UISettingsDialogSpecific_h__
-#define __UISettingsDialogSpecific_h__
+#ifndef ___UISettingsDialogSpecific_h___
+#define ___UISettingsDialogSpecific_h___
 
 /* GUI includes: */
@@ -24,10 +24,11 @@
 /* COM includes: */
 #include "COMEnums.h"
-#include "CSession.h"
 #include "CConsole.h"
 #include "CMachine.h"
+#include "CSession.h"
 
-/* Dialog which encapsulate all the specific functionalities of the Global Settings */
-class UISettingsDialogGlobal : public UISettingsDialog
+
+/** UISettingsDialog extension encapsulating all the specific functionality of the Global Preferences. */
+class SHARED_LIBRARY_STUFF UISettingsDialogGlobal : public UISettingsDialog
 {
     Q_OBJECT;
@@ -35,4 +36,7 @@
 public:
 
+    /** Constructs settings dialog passing @a pParent to the base-class.
+      * @param  strCategory  Brings the name of category to be opened.
+      * @param  strControl   Brings the name of control to be focused. */
     UISettingsDialogGlobal(QWidget *pParent,
                            const QString &strCategory = QString(),
@@ -41,23 +45,34 @@
 protected:
 
+    /** Handles translation event. */
+    virtual void retranslateUi() /* override */;
+
     /** Loads the data from the corresponding source. */
-    void loadOwnData();
+    virtual void loadOwnData() /* override */;
     /** Saves the data to the corresponding source. */
-    void saveOwnData();
-
-    void retranslateUi();
+    virtual void saveOwnData() /* override */;
 
     /** Returns the dialog title extension. */
-    QString titleExtension() const;
+    virtual QString titleExtension() const /* override */;
     /** Returns the dialog title. */
-    QString title() const;
+    virtual QString title() const /* override */;
 
 private:
 
-    bool isPageAvailable(int iPageId);
+    /** Prepares all. */
+    void prepare();
+
+    /** Returns whether page with certain @a iPageId is available. */
+    bool isPageAvailable(int iPageId) const;
+
+    /** Holds the name of category to be opened. */
+    QString  m_strCategory;
+    /** Holds the name of control to be focused. */
+    QString  m_strControl;
 };
 
-/* Dialog which encapsulate all the specific functionalities of the Virtual Machine Settings */
-class UISettingsDialogMachine : public UISettingsDialog
+
+/** UISettingsDialog extension encapsulating all the specific functionality of the Machine Settings. */
+class SHARED_LIBRARY_STUFF UISettingsDialogMachine : public UISettingsDialog
 {
     Q_OBJECT;
@@ -65,4 +80,8 @@
 public:
 
+    /** Constructs settings dialog passing @a pParent to the base-class.
+      * @param  strMachineId  Brings the machine ID.
+      * @param  strCategory   Brings the name of category to be opened.
+      * @param  strControl    Brings the name of control to be focused. */
     UISettingsDialogMachine(QWidget *pParent, const QString &strMachineId,
                             const QString &strCategory, const QString &strControl);
@@ -70,49 +89,83 @@
 protected:
 
+    /** Handles translation event. */
+    virtual void retranslateUi() /* override */;
+
     /** Loads the data from the corresponding source. */
-    void loadOwnData();
+    virtual void loadOwnData() /* override */;
     /** Saves the data to the corresponding source. */
-    void saveOwnData();
-
-    void retranslateUi();
+    virtual void saveOwnData() /* override */;
 
     /** Returns the dialog title extension. */
-    QString titleExtension() const;
+    virtual QString titleExtension() const /* override */;
     /** Returns the dialog title. */
-    QString title() const;
+    virtual QString title() const /* override */;
 
-    void recorrelate(UISettingsPage *pSettingsPage);
+    /** Verifies data integrity between certain @a pSettingsPage and other pages. */
+    virtual void recorrelate(UISettingsPage *pSettingsPage) /* override */;
+
+protected slots:
+
+    /** Handles category change to @a cId. */
+    virtual void sltCategoryChanged(int cId) /* override */;
+
+    /** Marks dialog loaded. */
+    virtual void sltMarkLoaded() /* override */;
+    /** Marks dialog saved. */
+    virtual void sltMarkSaved() /* override */;
 
 private slots:
 
-    void sltMarkLoaded();
-    void sltMarkSaved();
-    void sltSessionStateChanged(QString strMachineId, KSessionState sessionState);
-    void sltMachineStateChanged(QString strMachineId, KMachineState machineState);
+    /** Handles session state change for machine with certain @a strMachineId to @a enmSessionState. */
+    void sltSessionStateChanged(QString strMachineId, KSessionState enmSessionState);
+    /** Handles machine state change for machine with certain @a strMachineId to @a enmMachineState. */
+    void sltMachineStateChanged(QString strMachineId, KMachineState enmMachineState);
+    /** Handles machine data change for machine with certain @a strMachineId. */
     void sltMachineDataChanged(QString strMachineId);
-    void sltCategoryChanged(int cId);
+
+    /** Handles request to allow to reset first run flag. */
     void sltAllowResetFirstRunFlag();
+    /** Handles request to reset first run flag. */
     void sltResetFirstRunFlag();
 
 private:
 
-    bool isPageAvailable(int iPageId);
+    /** Prepares all. */
+    void prepare();
+
+    /** Returns whether page with certain @a iPageId is available. */
+    bool isPageAvailable(int iPageId) const;
+
+    /** Returns whether settings were changed. */
     bool isSettingsChanged();
 
-    /* Recalculates configuration access level. */
+    /** Recalculates configuration access level. */
     void updateConfigurationAccessLevel();
 
-    QString m_strMachineId;
-    KSessionState m_sessionState;
-    KMachineState m_machineState;
+    /** Holds the machine ID. */
+    QString  m_strMachineId;
+    /** Holds the name of category to be opened. */
+    QString  m_strCategory;
+    /** Holds the name of control to be focused. */
+    QString  m_strControl;
 
-    CSession m_session;
-    CMachine m_machine;
-    CConsole m_console;
+    /** Holds the session state. */
+    KSessionState  m_enmSessionState;
+    /** Holds the machine state. */
+    KMachineState  m_enmMachineState;
 
-    bool m_fAllowResetFirstRunFlag;
-    bool m_fResetFirstRunFlag;
+    /** Holds the session reference. */
+    CSession  m_session;
+    /** Holds the machine reference. */
+    CMachine  m_machine;
+    /** Holds the console reference. */
+    CConsole  m_console;
+
+    /** Holds whether we are allowed to reset first run flag. */
+    bool  m_fAllowResetFirstRunFlag : 1;
+    /** Holds whether we have request to reset first run flag. */
+    bool  m_fResetFirstRunFlag : 1;
 };
 
-#endif // __UISettingsDialogSpecific_h__
 
+#endif /* !___UISettingsDialogSpecific_h___ */
