Index: /trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk	(revision 67930)
+++ /trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk	(revision 67931)
@@ -435,4 +435,5 @@
 	src/widgets/UIHotKeyEditor.h \
 	src/widgets/UILineTextEdit.h \
+	src/widgets/UIMediumSizeEditor.h \
 	src/widgets/UIMenuBar.h \
 	src/widgets/UIPopupBox.h \
@@ -748,4 +749,5 @@
 	src/widgets/UIHotKeyEditor.cpp \
 	src/widgets/UILineTextEdit.cpp \
+	src/widgets/UIMediumSizeEditor.cpp \
 	src/widgets/UIMenuBar.cpp \
 	src/widgets/UIPopupBox.cpp \
Index: /trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumDetailsWidget.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumDetailsWidget.cpp	(revision 67930)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumDetailsWidget.cpp	(revision 67931)
@@ -37,4 +37,5 @@
 # include "UIIconPool.h"
 # include "UIMediumDetailsWidget.h"
+# include "UIMediumSizeEditor.h"
 # include "VBoxGlobal.h"
 
@@ -53,8 +54,5 @@
     , m_pLabelType(0), m_pComboBoxType(0), m_pErrorPaneType(0)
     , m_pLabelLocation(0), m_pSelectorLocation(0), m_pErrorPaneLocation(0)
-    , m_uMediumSizeMin(_4M)
-    , m_uMediumSizeMax(vboxGlobal().virtualBox().GetSystemProperties().GetInfoVDSize())
-    , m_iSliderScale(calculateSliderScale(m_uMediumSizeMax))
-    , m_pLabelSize(0), m_pSliderSize(0), m_pLabelMinSize(0), m_pLabelMaxSize(0), m_pEditorSize(0), m_pErrorPaneSize(0)
+    , m_pLabelSize(0), m_pEditorSize(0), m_pErrorPaneSize(0)
     , m_pButtonBox(0)
     , m_pLayoutDetails(0)
@@ -95,6 +93,4 @@
     m_pLabelLocation->setText(tr("&Location:"));
     m_pLabelSize->setText(tr("&Size:"));
-    m_pLabelMinSize->setText(vboxGlobal().formatSize(m_uMediumSizeMin));
-    m_pLabelMaxSize->setText(vboxGlobal().formatSize(m_uMediumSizeMax));
 
     /* Translate fields: */
@@ -103,5 +99,4 @@
         m_pComboBoxType->setItemText(i, gpConverter->toString(m_pComboBoxType->itemData(i).value<KMediumType>()));
     m_pSelectorLocation->setToolTip(tr("Holds the location of this medium."));
-    m_pSliderSize->setToolTip(tr("Holds the size of this medium."));
     m_pEditorSize->setToolTip(tr("Holds the size of this medium."));
 
@@ -141,23 +136,8 @@
 }
 
-void UIMediumDetailsWidget::sltSizeSliderChanged(int iValue)
-{
-    m_newData.m_options.m_uLogicalSize = sliderToSizeMB(iValue, m_iSliderScale);
-    m_pEditorSize->blockSignals(true);
-    m_pEditorSize->setText(vboxGlobal().formatSize(m_newData.m_options.m_uLogicalSize));
-    m_pEditorSize->blockSignals(false);
+void UIMediumDetailsWidget::sltSizeEditorChanged(qulonglong uSize)
+{
+    m_newData.m_options.m_uLogicalSize = uSize;
     revalidate(m_pErrorPaneSize);
-    updateSizeToolTips(m_newData.m_options.m_uLogicalSize);
-    updateButtonStates();
-}
-
-void UIMediumDetailsWidget::sltSizeEditorChanged(const QString &strValue)
-{
-    m_newData.m_options.m_uLogicalSize = vboxGlobal().parseSize(strValue);
-    m_pSliderSize->blockSignals(true);
-    m_pSliderSize->setValue(sizeMBToSlider(m_newData.m_options.m_uLogicalSize, m_iSliderScale));
-    m_pSliderSize->blockSignals(false);
-    revalidate(m_pErrorPaneSize);
-    updateSizeToolTips(m_newData.m_options.m_uLogicalSize);
     updateButtonStates();
 }
@@ -357,67 +337,17 @@
                 /* Configure layout: */
                 pLayoutSize->setContentsMargins(0, 0, 0, 0);
-                pLayoutSize->setColumnStretch(0, 1);
-                pLayoutSize->setColumnStretch(1, 1);
-                pLayoutSize->setColumnStretch(2, 0);
-                pLayoutSize->setColumnStretch(3, 0);
-
-                /* Create size slider: */
-                m_pSliderSize = new QSlider;
-                AssertPtrReturnVoid(m_pSliderSize);
-                {
-                    /* Configure slider: */
-                    m_pSliderSize->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
-                    m_pSliderSize->setOrientation(Qt::Horizontal);
-                    m_pSliderSize->setTickPosition(QSlider::TicksBelow);
-                    m_pSliderSize->setFocusPolicy(Qt::StrongFocus);
-                    m_pSliderSize->setPageStep(m_iSliderScale);
-                    m_pSliderSize->setSingleStep(m_iSliderScale / 8);
-                    m_pSliderSize->setTickInterval(0);
-                    m_pSliderSize->setMinimum(sizeMBToSlider(m_uMediumSizeMin, m_iSliderScale));
-                    m_pSliderSize->setMaximum(sizeMBToSlider(m_uMediumSizeMax, m_iSliderScale));
-                    connect(m_pSliderSize, &QSlider::valueChanged,
-                            this, &UIMediumDetailsWidget::sltSizeSliderChanged);
-
-                    /* Add into layout: */
-                    pLayoutSize->addWidget(m_pSliderSize, 0, 0, 1, 2);
-                }
-
-                /* Create minimum size label: */
-                m_pLabelMinSize = new QLabel;
-                AssertPtrReturnVoid(m_pLabelMinSize);
-                {
-                    /* Configure label: */
-                    m_pLabelMinSize->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
-
-                    /* Add into layout: */
-                    pLayoutSize->addWidget(m_pLabelMinSize, 1, 0);
-                }
-
-                /* Create maximum size label: */
-                m_pLabelMaxSize = new QLabel;
-                AssertPtrReturnVoid(m_pLabelMaxSize);
-                {
-                    /* Configure label: */
-                    m_pLabelMaxSize->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
-
-                    /* Add into layout: */
-                    pLayoutSize->addWidget(m_pLabelMaxSize, 1, 1);
-                }
 
                 /* Create size editor: */
-                m_pEditorSize = new QILineEdit;
+                m_pEditorSize = new UIMediumSizeEditor;
                 AssertPtrReturnVoid(m_pEditorSize);
                 {
                     /* Configure editor: */
                     m_pLabelSize->setBuddy(m_pEditorSize);
-                    m_pEditorSize->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
-                    m_pEditorSize->setFixedWidthByText("88888.88 MB");
-                    m_pEditorSize->setAlignment(Qt::AlignRight);
-                    m_pEditorSize->setValidator(new QRegExpValidator(QRegExp(vboxGlobal().sizeRegexp()), this));
-                    connect(m_pEditorSize, &QILineEdit::textChanged,
+                    m_pEditorSize->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
+                    connect(m_pEditorSize, &UIMediumSizeEditor::sigSizeChanged,
                             this, &UIMediumDetailsWidget::sltSizeEditorChanged);
 
                     /* Add into layout: */
-                    pLayoutSize->addWidget(m_pEditorSize, 0, 2);
+                    pLayoutSize->addWidget(m_pEditorSize, 0, 0, 2, 1);
                 }
 
@@ -432,5 +362,5 @@
 
                     /* Add into layout: */
-                    pLayoutSize->addWidget(m_pErrorPaneSize, 0, 3);
+                    pLayoutSize->addWidget(m_pErrorPaneSize, 0, 1);
                 }
 
@@ -592,9 +522,6 @@
     /* Load size: */
     m_pLabelSize->setEnabled(m_newData.m_fValid && m_newData.m_enmType == UIMediumType_HardDisk);
-    m_pSliderSize->setEnabled(m_newData.m_fValid && m_newData.m_enmType == UIMediumType_HardDisk);
-    m_pLabelMinSize->setEnabled(m_newData.m_fValid && m_newData.m_enmType == UIMediumType_HardDisk);
-    m_pLabelMaxSize->setEnabled(m_newData.m_fValid && m_newData.m_enmType == UIMediumType_HardDisk);
     m_pEditorSize->setEnabled(m_newData.m_fValid && m_newData.m_enmType == UIMediumType_HardDisk);
-    m_pEditorSize->setText(vboxGlobal().formatSize(m_newData.m_options.m_uLogicalSize));
+    m_pEditorSize->setMediumSize(m_newData.m_options.m_uLogicalSize);
 }
 
@@ -673,83 +600,4 @@
 }
 
-/* static */
-int UIMediumDetailsWidget::calculateSliderScale(qulonglong uMaximumMediumSize)
-{
-    /* Detect how many steps to recognize between adjacent powers of 2
-     * to ensure that the last slider step is exactly that we need: */
-    int iSliderScale = 0;
-    int iPower = log2i(uMaximumMediumSize);
-    qulonglong uTickMB = (qulonglong)1 << iPower;
-    if (uTickMB < uMaximumMediumSize)
-    {
-        qulonglong uTickMBNext = (qulonglong)1 << (iPower + 1);
-        qulonglong uGap = uTickMBNext - uMaximumMediumSize;
-        iSliderScale = (int)((uTickMBNext - uTickMB) / uGap);
-#ifdef VBOX_WS_MAC
-        // WORKAROUND:
-        // There is an issue with Qt5 QSlider under OSX:
-        // Slider tick count (maximum - minimum) is limited with some
-        // "magical number" - 588351, having it more than that brings
-        // unpredictable results like slider token jumping and disappearing,
-        // so we are limiting tick count by lowering slider-scale 128 times.
-        iSliderScale /= 128;
-#endif /* VBOX_WS_MAC */
-    }
-    return qMax(iSliderScale, 8);
-}
-
-/* static */
-int UIMediumDetailsWidget::log2i(qulonglong uValue)
-{
-    int iPower = -1;
-    while (uValue)
-    {
-        ++iPower;
-        uValue >>= 1;
-    }
-    return iPower;
-}
-
-/* static */
-int UIMediumDetailsWidget::sizeMBToSlider(qulonglong uValue, int iSliderScale)
-{
-    /* Make sure *any* slider value is multiple of 512: */
-    uValue /= 512;
-
-    /* Calculate result: */
-    int iPower = log2i(uValue);
-    qulonglong uTickMB = qulonglong (1) << iPower;
-    qulonglong uTickMBNext = qulonglong (1) << (iPower + 1);
-    int iStep = (uValue - uTickMB) * iSliderScale / (uTickMBNext - uTickMB);
-    int iResult = iPower * iSliderScale + iStep;
-
-    /* Return result: */
-    return iResult;
-}
-
-/* static */
-qulonglong UIMediumDetailsWidget::sliderToSizeMB(int uValue, int iSliderScale)
-{
-    /* Calculate result: */
-    int iPower = uValue / iSliderScale;
-    int iStep = uValue % iSliderScale;
-    qulonglong uTickMB = qulonglong (1) << iPower;
-    qulonglong uTickMBNext = qulonglong (1) << (iPower + 1);
-    qulonglong uResult = uTickMB + (uTickMBNext - uTickMB) * iStep / iSliderScale;
-
-    /* Make sure *any* slider value is multiple of 512: */
-    uResult *= 512;
-
-    /* Return result: */
-    return uResult;
-}
-
-void UIMediumDetailsWidget::updateSizeToolTips(qulonglong uSize)
-{
-    const QString strToolTip = tr("<nobr>%1 (%2 B)</nobr>").arg(vboxGlobal().formatSize(uSize)).arg(uSize);
-    m_pSliderSize->setToolTip(strToolTip);
-    m_pEditorSize->setToolTip(strToolTip);
-}
-
 QWidget *UIMediumDetailsWidget::infoContainer(UIMediumType enmType) const
 {
Index: /trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumDetailsWidget.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumDetailsWidget.h	(revision 67930)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumDetailsWidget.h	(revision 67931)
@@ -34,11 +34,10 @@
 class QComboBox;
 class QLabel;
-class QSlider;
 class QStackedLayout;
 class QWidget;
 class QILabel;
-class QILineEdit;
 class QITabWidget;
 class UIFilePathSelector;
+class UIMediumSizeEditor;
 
 
@@ -196,8 +195,6 @@
         /** Handles location change. */
         void sltLocationPathChanged(const QString &strPath);
-        /** Handles size slider change. */
-        void sltSizeSliderChanged(int iValue);
         /** Handles size editor change. */
-        void sltSizeEditorChanged(const QString &strValue);
+        void sltSizeEditorChanged(qulonglong uSize);
 
         /** Handles button-box button click. */
@@ -239,15 +236,4 @@
         /** Updates button states. */
         void updateButtonStates();
-
-        /** Calculates slider scale according to passed @a uMaximumMediumSize. */
-        static int calculateSliderScale(qulonglong uMaximumMediumSize);
-        /** Returns log2 for passed @a uValue. */
-        static int log2i(qulonglong uValue);
-        /** Converts passed bytes @a uValue to slides scaled value using @a iSliderScale. */
-        static int sizeMBToSlider(qulonglong uValue, int iSliderScale);
-        /** Converts passed slider @a uValue to bytes unscaled value using @a iSliderScale. */
-        static qulonglong sliderToSizeMB(int uValue, int iSliderScale);
-        /** Updates slider/editor tool-tips. */
-        void updateSizeToolTips(qulonglong uSize);
     /** @} */
 
@@ -292,22 +278,10 @@
         QLabel    *m_pErrorPaneLocation;
 
-        /** Holds the minimum medium size. */
-        const qulonglong  m_uMediumSizeMin;
-        /** Holds the maximum medium size. */
-        const qulonglong  m_uMediumSizeMax;
-        /** Holds the slider scale. */
-        const int         m_iSliderScale;
         /** Holds the size label. */
-        QLabel           *m_pLabelSize;
-        /** Holds the size slider. */
-        QSlider          *m_pSliderSize;
-        /** Holds the minimum size label. */
-        QLabel           *m_pLabelMinSize;
-        /** Holds the maximum size label. */
-        QLabel           *m_pLabelMaxSize;
+        QLabel             *m_pLabelSize;
         /** Holds the size editor. */
-        QILineEdit       *m_pEditorSize;
+        UIMediumSizeEditor *m_pEditorSize;
         /** Holds the size error pane. */
-        QLabel           *m_pErrorPaneSize;
+        QLabel             *m_pErrorPaneSize;
 
         /** Holds the button-box instance. */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMediumSizeEditor.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMediumSizeEditor.cpp	(revision 67931)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMediumSizeEditor.cpp	(revision 67931)
@@ -0,0 +1,257 @@
+/* $Id$ */
+/** @file
+ * VBox Qt GUI - UIMediumSizeEditor class implementation.
+ */
+
+/*
+ * Copyright (C) 2006-2017 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+/* Qt includes: */
+# include <QGridLayout>
+# include <QLabel>
+# include <QRegExpValidator>
+# include <QSlider>
+
+/* GUI includes: */
+# include "QILineEdit.h"
+# include "UIMediumSizeEditor.h"
+# include "VBoxGlobal.h"
+
+/* COM includes: */
+# include "CSystemProperties.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+
+UIMediumSizeEditor::UIMediumSizeEditor(QWidget *pParent /* = 0 */)
+    : QIWithRetranslateUI<QWidget>(pParent)
+    , m_uSizeMin(_4M)
+    , m_uSizeMax(vboxGlobal().virtualBox().GetSystemProperties().GetInfoVDSize())
+    , m_iSliderScale(calculateSliderScale(m_uSizeMax))
+    , m_pSlider(0)
+    , m_pLabelMinSize(0)
+    , m_pLabelMaxSize(0)
+    , m_pEditor(0)
+{
+    /* Prepare: */
+    prepare();
+}
+
+void UIMediumSizeEditor::setMediumSize(qulonglong uSize)
+{
+    /* Remember the new size: */
+    m_uSize = uSize;
+    /* And assign it to the slider, editor will be auto-updated: */
+    m_pSlider->setValue(sizeMBToSlider(m_uSize, m_iSliderScale));
+}
+
+void UIMediumSizeEditor::retranslateUi()
+{
+    /* Translate labels: */
+    m_pLabelMinSize->setText(vboxGlobal().formatSize(m_uSizeMin));
+    m_pLabelMaxSize->setText(vboxGlobal().formatSize(m_uSizeMax));
+
+    /* Translate fields: */
+    m_pSlider->setToolTip(tr("Holds the size of this medium."));
+    m_pEditor->setToolTip(tr("Holds the size of this medium."));
+
+    /* Translate tool-tips: */
+    updateSizeToolTips(m_uSize);
+}
+
+void UIMediumSizeEditor::sltSizeSliderChanged(int iValue)
+{
+    /* Update the current size: */
+    m_uSize = sliderToSizeMB(iValue, m_iSliderScale);
+    /* Update the other widget: */
+    m_pEditor->blockSignals(true);
+    m_pEditor->setText(vboxGlobal().formatSize(m_uSize));
+    m_pEditor->blockSignals(false);
+    /* Update the tool-tips: */
+    updateSizeToolTips(m_uSize);
+    /* Notify the listeners: */
+    emit sigSizeChanged(m_uSize);
+}
+
+void UIMediumSizeEditor::sltSizeEditorChanged(const QString &strValue)
+{
+    /* Update the current size: */
+    m_uSize = vboxGlobal().parseSize(strValue);
+    /* Update the other widget: */
+    m_pSlider->blockSignals(true);
+    m_pSlider->setValue(sizeMBToSlider(m_uSize, m_iSliderScale));
+    m_pSlider->blockSignals(false);
+    /* Update the tool-tips: */
+    updateSizeToolTips(m_uSize);
+    /* Notify the listeners: */
+    emit sigSizeChanged(m_uSize);
+}
+
+void UIMediumSizeEditor::prepare()
+{
+    /* Create layout: */
+    QGridLayout *pLayout = new QGridLayout(this);
+    AssertPtrReturnVoid(pLayout);
+    {
+        /* Configure layout: */
+        pLayout->setContentsMargins(0, 0, 0, 0);
+        pLayout->setColumnStretch(0, 1);
+        pLayout->setColumnStretch(1, 1);
+        pLayout->setColumnStretch(2, 0);
+
+        /* Create size slider: */
+        m_pSlider = new QSlider;
+        AssertPtrReturnVoid(m_pSlider);
+        {
+            /* Configure slider: */
+            m_pSlider->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
+            m_pSlider->setOrientation(Qt::Horizontal);
+            m_pSlider->setTickPosition(QSlider::TicksBelow);
+            m_pSlider->setFocusPolicy(Qt::StrongFocus);
+            m_pSlider->setPageStep(m_iSliderScale);
+            m_pSlider->setSingleStep(m_iSliderScale / 8);
+            m_pSlider->setTickInterval(0);
+            m_pSlider->setMinimum(sizeMBToSlider(m_uSizeMin, m_iSliderScale));
+            m_pSlider->setMaximum(sizeMBToSlider(m_uSizeMax, m_iSliderScale));
+            connect(m_pSlider, &QSlider::valueChanged,
+                    this, &UIMediumSizeEditor::sltSizeSliderChanged);
+
+            /* Add into layout: */
+            pLayout->addWidget(m_pSlider, 0, 0, 1, 2);
+        }
+
+        /* Create minimum size label: */
+        m_pLabelMinSize = new QLabel;
+        AssertPtrReturnVoid(m_pLabelMinSize);
+        {
+            /* Configure label: */
+            m_pLabelMinSize->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
+
+            /* Add into layout: */
+            pLayout->addWidget(m_pLabelMinSize, 1, 0);
+        }
+
+        /* Create maximum size label: */
+        m_pLabelMaxSize = new QLabel;
+        AssertPtrReturnVoid(m_pLabelMaxSize);
+        {
+            /* Configure label: */
+            m_pLabelMaxSize->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
+
+            /* Add into layout: */
+            pLayout->addWidget(m_pLabelMaxSize, 1, 1);
+        }
+
+        /* Create size editor: */
+        m_pEditor = new QILineEdit;
+        AssertPtrReturnVoid(m_pEditor);
+        {
+            /* Configure editor: */
+            m_pEditor->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
+            m_pEditor->setFixedWidthByText("88888.88 MB");
+            m_pEditor->setAlignment(Qt::AlignRight);
+            m_pEditor->setValidator(new QRegExpValidator(QRegExp(vboxGlobal().sizeRegexp()), this));
+            connect(m_pEditor, &QILineEdit::textChanged,
+                    this, &UIMediumSizeEditor::sltSizeEditorChanged);
+
+            /* Add into layout: */
+            pLayout->addWidget(m_pEditor, 0, 2);
+        }
+    }
+
+    /* Apply language settings: */
+    retranslateUi();
+}
+
+/* static */
+int UIMediumSizeEditor::calculateSliderScale(qulonglong uMaximumMediumSize)
+{
+    /* Detect how many steps to recognize between adjacent powers of 2
+     * to ensure that the last slider step is exactly that we need: */
+    int iSliderScale = 0;
+    int iPower = log2i(uMaximumMediumSize);
+    qulonglong uTickMB = (qulonglong)1 << iPower;
+    if (uTickMB < uMaximumMediumSize)
+    {
+        qulonglong uTickMBNext = (qulonglong)1 << (iPower + 1);
+        qulonglong uGap = uTickMBNext - uMaximumMediumSize;
+        iSliderScale = (int)((uTickMBNext - uTickMB) / uGap);
+#ifdef VBOX_WS_MAC
+        // WORKAROUND:
+        // There is an issue with Qt5 QSlider under OSX:
+        // Slider tick count (maximum - minimum) is limited with some
+        // "magical number" - 588351, having it more than that brings
+        // unpredictable results like slider token jumping and disappearing,
+        // so we are limiting tick count by lowering slider-scale 128 times.
+        iSliderScale /= 128;
+#endif /* VBOX_WS_MAC */
+    }
+    return qMax(iSliderScale, 8);
+}
+
+/* static */
+int UIMediumSizeEditor::log2i(qulonglong uValue)
+{
+    int iPower = -1;
+    while (uValue)
+    {
+        ++iPower;
+        uValue >>= 1;
+    }
+    return iPower;
+}
+
+/* static */
+int UIMediumSizeEditor::sizeMBToSlider(qulonglong uValue, int iSliderScale)
+{
+    /* Make sure *any* slider value is multiple of 512: */
+    uValue /= 512;
+
+    /* Calculate result: */
+    int iPower = log2i(uValue);
+    qulonglong uTickMB = qulonglong (1) << iPower;
+    qulonglong uTickMBNext = qulonglong (1) << (iPower + 1);
+    int iStep = (uValue - uTickMB) * iSliderScale / (uTickMBNext - uTickMB);
+    int iResult = iPower * iSliderScale + iStep;
+
+    /* Return result: */
+    return iResult;
+}
+
+/* static */
+qulonglong UIMediumSizeEditor::sliderToSizeMB(int uValue, int iSliderScale)
+{
+    /* Calculate result: */
+    int iPower = uValue / iSliderScale;
+    int iStep = uValue % iSliderScale;
+    qulonglong uTickMB = qulonglong (1) << iPower;
+    qulonglong uTickMBNext = qulonglong (1) << (iPower + 1);
+    qulonglong uResult = uTickMB + (uTickMBNext - uTickMB) * iStep / iSliderScale;
+
+    /* Make sure *any* slider value is multiple of 512: */
+    uResult *= 512;
+
+    /* Return result: */
+    return uResult;
+}
+
+void UIMediumSizeEditor::updateSizeToolTips(qulonglong uSize)
+{
+    const QString strToolTip = tr("<nobr>%1 (%2 B)</nobr>").arg(vboxGlobal().formatSize(uSize)).arg(uSize);
+    m_pSlider->setToolTip(strToolTip);
+    m_pEditor->setToolTip(strToolTip);
+}
+
Index: /trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMediumSizeEditor.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMediumSizeEditor.h	(revision 67931)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMediumSizeEditor.h	(revision 67931)
@@ -0,0 +1,101 @@
+/* $Id$ */
+/** @file
+ * VBox Qt GUI - UIMediumSizeEditor class declaration.
+ */
+
+/*
+ * Copyright (C) 2006-2017 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef ___UIMediumSizeEditor_h___
+#define ___UIMediumSizeEditor_h___
+
+/* Qt includes: */
+#include <QWidget>
+
+/* GUI includes: */
+#include "QIWithRetranslateUI.h"
+
+/* Forward declarations: */
+class QLabel;
+class QSlider;
+class QILineEdit;
+
+
+/** Medium size editor widget. */
+class UIMediumSizeEditor : public QIWithRetranslateUI<QWidget>
+{
+    Q_OBJECT;
+
+signals:
+
+    /** Notifies listeners about medium size changed. */
+    void sigSizeChanged(qulonglong uSize);
+
+public:
+
+    /** Constructs medium size editor passing @a pParent to the base-class. */
+    UIMediumSizeEditor(QWidget *pParent = 0);
+
+    /** Returns the medium size. */
+    qulonglong mediumSize() const { return m_uSize; }
+    /** Defines the @a uSize. */
+    void setMediumSize(qulonglong uSize);
+
+protected:
+
+    /** Handles translation event. */
+    virtual void retranslateUi() /* override */;
+
+private slots:
+
+    /** Handles size slider change. */
+    void sltSizeSliderChanged(int iValue);
+    /** Handles size editor change. */
+    void sltSizeEditorChanged(const QString &strValue);
+
+private:
+
+    /** Prepares all. */
+    void prepare();
+
+    /** Calculates slider scale according to passed @a uMaximumMediumSize. */
+    static int calculateSliderScale(qulonglong uMaximumMediumSize);
+    /** Returns log2 for passed @a uValue. */
+    static int log2i(qulonglong uValue);
+    /** Converts passed bytes @a uValue to slides scaled value using @a iSliderScale. */
+    static int sizeMBToSlider(qulonglong uValue, int iSliderScale);
+    /** Converts passed slider @a uValue to bytes unscaled value using @a iSliderScale. */
+    static qulonglong sliderToSizeMB(int uValue, int iSliderScale);
+    /** Updates slider/editor tool-tips. */
+    void updateSizeToolTips(qulonglong uSize);
+
+    /** Holds the minimum medium size. */
+    const qulonglong  m_uSizeMin;
+    /** Holds the maximum medium size. */
+    const qulonglong  m_uSizeMax;
+    /** Holds the slider scale. */
+    const int         m_iSliderScale;
+    /** Holds the current medium size. */
+    qulonglong        m_uSize;
+
+    /** Holds the size slider. */
+    QSlider    *m_pSlider;
+    /** Holds the minimum size label. */
+    QLabel     *m_pLabelMinSize;
+    /** Holds the maximum size label. */
+    QLabel     *m_pLabelMaxSize;
+    /** Holds the size editor. */
+    QILineEdit *m_pEditor;
+};
+
+#endif /* !___UIMediumSizeEditor_h___ */
+
Index: /trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic3.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic3.cpp	(revision 67930)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic3.cpp	(revision 67931)
@@ -40,4 +40,5 @@
 # include "QIToolButton.h"
 # include "QILineEdit.h"
+# include "UIMediumSizeEditor.h"
 
 /* COM includes: */
@@ -53,5 +54,4 @@
     , m_uMediumSizeMin(_4M)
     , m_uMediumSizeMax(vboxGlobal().virtualBox().GetSystemProperties().GetInfoVDSize())
-    , m_iSliderScale(calculateSliderScale(m_uMediumSizeMax))
 {
 }
@@ -110,28 +110,4 @@
 }
 
-void UIWizardNewVDPage3::onSizeSliderValueChanged(int iValue)
-{
-    /* Get full size: */
-    qulonglong uMediumSize = sliderToSizeMB(iValue, m_iSliderScale);
-    /* Update tooltips: */
-    updateSizeToolTips(uMediumSize);
-    /* Notify size-editor about size had changed (preventing callback): */
-    m_pSizeEditor->blockSignals(true);
-    m_pSizeEditor->setText(vboxGlobal().formatSize(uMediumSize));
-    m_pSizeEditor->blockSignals(false);
-}
-
-void UIWizardNewVDPage3::onSizeEditorTextChanged(const QString &strValue)
-{
-    /* Get full size: */
-    qulonglong uMediumSize = vboxGlobal().parseSize(strValue);
-    /* Update tooltips: */
-    updateSizeToolTips(uMediumSize);
-    /* Notify size-slider about size had changed (preventing callback): */
-    m_pSizeSlider->blockSignals(true);
-    m_pSizeSlider->setValue(sizeMBToSlider(uMediumSize, m_iSliderScale));
-    m_pSizeSlider->blockSignals(false);
-}
-
 /* static */
 QString UIWizardNewVDPage3::toFileName(const QString &strName, const QString &strExtension)
@@ -183,83 +159,4 @@
 }
 
-/* static */
-int UIWizardNewVDPage3::calculateSliderScale(qulonglong uMaximumMediumSize)
-{
-    /* Detect how many steps to recognize between adjacent powers of 2
-     * to ensure that the last slider step is exactly that we need: */
-    int iSliderScale = 0;
-    int iPower = log2i(uMaximumMediumSize);
-    qulonglong uTickMB = (qulonglong)1 << iPower;
-    if (uTickMB < uMaximumMediumSize)
-    {
-        qulonglong uTickMBNext = (qulonglong)1 << (iPower + 1);
-        qulonglong uGap = uTickMBNext - uMaximumMediumSize;
-        iSliderScale = (int)((uTickMBNext - uTickMB) / uGap);
-#ifdef VBOX_WS_MAC
-        // WORKAROUND:
-        // There is an issue with Qt5 QSlider under OSX:
-        // Slider tick count (maximum - minimum) is limited with some
-        // "magical number" - 588351, having it more than that brings
-        // unpredictable results like slider token jumping and disappearing,
-        // so we are limiting tick count by lowering slider-scale 128 times.
-        iSliderScale /= 128;
-#endif /* VBOX_WS_MAC */
-    }
-    return qMax(iSliderScale, 8);
-}
-
-/* static */
-int UIWizardNewVDPage3::log2i(qulonglong uValue)
-{
-    int iPower = -1;
-    while (uValue)
-    {
-        ++iPower;
-        uValue >>= 1;
-    }
-    return iPower;
-}
-
-/* static */
-int UIWizardNewVDPage3::sizeMBToSlider(qulonglong uValue, int iSliderScale)
-{
-    /* Make sure *any* slider value is multiple of 512: */
-    uValue /= 512;
-
-    /* Calculate result: */
-    int iPower = log2i(uValue);
-    qulonglong uTickMB = qulonglong (1) << iPower;
-    qulonglong uTickMBNext = qulonglong (1) << (iPower + 1);
-    int iStep = (uValue - uTickMB) * iSliderScale / (uTickMBNext - uTickMB);
-    int iResult = iPower * iSliderScale + iStep;
-
-    /* Return result: */
-    return iResult;
-}
-
-/* static */
-qulonglong UIWizardNewVDPage3::sliderToSizeMB(int uValue, int iSliderScale)
-{
-    /* Calculate result: */
-    int iPower = uValue / iSliderScale;
-    int iStep = uValue % iSliderScale;
-    qulonglong uTickMB = qulonglong (1) << iPower;
-    qulonglong uTickMBNext = qulonglong (1) << (iPower + 1);
-    qulonglong uResult = uTickMB + (uTickMBNext - uTickMB) * iStep / iSliderScale;
-
-    /* Make sure *any* slider value is multiple of 512: */
-    uResult *= 512;
-
-    /* Return result: */
-    return uResult;
-}
-
-void UIWizardNewVDPage3::updateSizeToolTips(qulonglong uSize)
-{
-    QString strToolTip = UIWizardNewVD::tr("<nobr>%1 (%2 B)</nobr>").arg(vboxGlobal().formatSize(uSize)).arg(uSize);
-    m_pSizeSlider->setToolTip(strToolTip);
-    m_pSizeEditor->setToolTip(strToolTip);
-}
-
 QString UIWizardNewVDPage3::mediumPath() const
 {
@@ -269,19 +166,10 @@
 qulonglong UIWizardNewVDPage3::mediumSize() const
 {
-    return sliderToSizeMB(m_pSizeSlider->value(), m_iSliderScale);
+    return m_pEditorSize->mediumSize();
 }
 
 void UIWizardNewVDPage3::setMediumSize(qulonglong uMediumSize)
 {
-    /* Block signals: */
-    m_pSizeSlider->blockSignals(true);
-    m_pSizeEditor->blockSignals(true);
-    /* Set values: */
-    m_pSizeSlider->setValue(sizeMBToSlider(uMediumSize, m_iSliderScale));
-    m_pSizeEditor->setText(vboxGlobal().formatSize(uMediumSize));
-    updateSizeToolTips(uMediumSize);
-    /* Unblock signals: */
-    m_pSizeSlider->blockSignals(false);
-    m_pSizeEditor->blockSignals(false);
+    m_pEditorSize->setMediumSize(uMediumSize);
 }
 
@@ -305,46 +193,10 @@
         }
         m_pSizeLabel = new QIRichTextLabel(this);
-        QGridLayout *m_pSizeLayout = new QGridLayout;
-        {
-            m_pSizeSlider = new QSlider(this);
-            {
-                m_pSizeSlider->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
-                m_pSizeSlider->setOrientation(Qt::Horizontal);
-                m_pSizeSlider->setTickPosition(QSlider::TicksBelow);
-                m_pSizeSlider->setFocusPolicy(Qt::StrongFocus);
-                m_pSizeSlider->setPageStep(m_iSliderScale);
-                m_pSizeSlider->setSingleStep(m_iSliderScale / 8);
-                m_pSizeSlider->setTickInterval(0);
-                m_pSizeSlider->setMinimum(sizeMBToSlider(m_uMediumSizeMin, m_iSliderScale));
-                m_pSizeSlider->setMaximum(sizeMBToSlider(m_uMediumSizeMax, m_iSliderScale));
-            }
-            m_pSizeEditor = new QILineEdit(this);
-            {
-                m_pSizeEditor->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
-                m_pSizeEditor->setFixedWidthByText("88888.88 MB");
-                m_pSizeEditor->setAlignment(Qt::AlignRight);
-                m_pSizeEditor->setValidator(new QRegExpValidator(QRegExp(vboxGlobal().sizeRegexp()), this));
-            }
-            QLabel *m_pSizeMin = new QLabel(this);
-            {
-                m_pSizeMin->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);
-                m_pSizeMin->setText(vboxGlobal().formatSize(m_uMediumSizeMin));
-            }
-            QLabel *m_pSizeMax = new QLabel(this);
-            {
-                m_pSizeMax->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);
-                m_pSizeMax->setText(vboxGlobal().formatSize(m_uMediumSizeMax));
-            }
-            m_pSizeLayout->addWidget(m_pSizeSlider, 0, 0, 1, 3);
-            m_pSizeLayout->addWidget(m_pSizeEditor, 0, 3);
-            m_pSizeLayout->addWidget(m_pSizeMin, 1, 0);
-            m_pSizeLayout->setColumnStretch(1, 1);
-            m_pSizeLayout->addWidget(m_pSizeMax, 1, 2);
-        }
+        m_pEditorSize = new UIMediumSizeEditor;
         setMediumSize(uDefaultSize);
         pMainLayout->addWidget(m_pLocationLabel);
         pMainLayout->addLayout(pLocationLayout);
         pMainLayout->addWidget(m_pSizeLabel);
-        pMainLayout->addLayout(m_pSizeLayout);
+        pMainLayout->addWidget(m_pEditorSize);
         pMainLayout->addStretch();
     }
@@ -353,6 +205,5 @@
     connect(m_pLocationEditor, SIGNAL(textChanged(const QString &)), this, SIGNAL(completeChanged()));
     connect(m_pLocationOpenButton, SIGNAL(clicked()), this, SLOT(sltSelectLocationButtonClicked()));
-    connect(m_pSizeSlider, SIGNAL(valueChanged(int)), this, SLOT(sltSizeSliderValueChanged(int)));
-    connect(m_pSizeEditor, SIGNAL(textChanged(const QString &)), this, SLOT(sltSizeEditorTextChanged(const QString &)));
+    connect(m_pEditorSize, &UIMediumSizeEditor::sigSizeChanged, this, &UIWizardNewVDPageBasic3::completeChanged);
 
     /* Register fields: */
@@ -365,22 +216,4 @@
     /* Call to base-class: */
     onSelectLocationButtonClicked();
-}
-
-void UIWizardNewVDPageBasic3::sltSizeSliderValueChanged(int iValue)
-{
-    /* Call to base-class: */
-    onSizeSliderValueChanged(iValue);
-
-    /* Broadcast complete-change: */
-    emit completeChanged();
-}
-
-void UIWizardNewVDPageBasic3::sltSizeEditorTextChanged(const QString &strValue)
-{
-    /* Call to base-class: */
-    onSizeEditorTextChanged(strValue);
-
-    /* Broadcast complete-change: */
-    emit completeChanged();
 }
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic3.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic3.h	(revision 67930)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic3.h	(revision 67931)
@@ -26,7 +26,6 @@
 class QLineEdit;
 class QIToolButton;
-class QSlider;
-class QILineEdit;
 class QIRichTextLabel;
+class UIMediumSizeEditor;
 
 /* 3rd page of the New Virtual Hard Drive wizard (base part): */
@@ -40,6 +39,4 @@
     /* Handlers: */
     void onSelectLocationButtonClicked();
-    void onSizeSliderValueChanged(int iValue);
-    void onSizeEditorTextChanged(const QString &strValue);
 
     /* Location-editors stuff: */
@@ -47,11 +44,4 @@
     static QString absoluteFilePath(const QString &strFileName, const QString &strDefaultPath);
     static QString defaultExtension(const CMediumFormat &mediumFormatRef);
-
-    /* Size-editors stuff: */
-    static int calculateSliderScale(qulonglong uMaximumMediumSize);
-    static int log2i(qulonglong uValue);
-    static int sizeMBToSlider(qulonglong uValue, int iSliderScale);
-    static qulonglong sliderToSizeMB(int uValue, int iSliderScale);
-    void updateSizeToolTips(qulonglong uSize);
 
     /* Stuff for 'mediumPath' field: */
@@ -68,11 +58,9 @@
     qulonglong m_uMediumSizeMin;
     qulonglong m_uMediumSizeMax;
-    int m_iSliderScale;
 
     /* Widgets: */
     QLineEdit *m_pLocationEditor;
     QIToolButton *m_pLocationOpenButton;
-    QSlider *m_pSizeSlider;
-    QILineEdit *m_pSizeEditor;
+    UIMediumSizeEditor *m_pEditorSize;
 };
 
@@ -101,8 +89,4 @@
     void sltSelectLocationButtonClicked();
 
-    /* Size editors stuff: */
-    void sltSizeSliderValueChanged(int iValue);
-    void sltSizeEditorTextChanged(const QString &strValue);
-
 private:
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageExpert.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageExpert.cpp	(revision 67930)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageExpert.cpp	(revision 67931)
@@ -41,4 +41,5 @@
 # include "QIToolButton.h"
 # include "QILineEdit.h"
+# include "UIMediumSizeEditor.h"
 
 /* COM includes: */
@@ -77,40 +78,10 @@
         {
             m_pSizeCnt->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
-            QGridLayout *pSizeCntLayout = new QGridLayout(m_pSizeCnt);
-            {
-                m_pSizeSlider = new QSlider(m_pSizeCnt);
-                {
-                    m_pSizeSlider->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
-                    m_pSizeSlider->setOrientation(Qt::Horizontal);
-                    m_pSizeSlider->setTickPosition(QSlider::TicksBelow);
-                    m_pSizeSlider->setFocusPolicy(Qt::StrongFocus);
-                    m_pSizeSlider->setPageStep(m_iSliderScale);
-                    m_pSizeSlider->setSingleStep(m_iSliderScale / 8);
-                    m_pSizeSlider->setTickInterval(0);
-                    m_pSizeSlider->setMinimum(sizeMBToSlider(m_uMediumSizeMin, m_iSliderScale));
-                    m_pSizeSlider->setMaximum(sizeMBToSlider(m_uMediumSizeMax, m_iSliderScale));
-                }
-                m_pSizeEditor = new QILineEdit(m_pSizeCnt);
-                {
-                    m_pSizeEditor->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
-                    m_pSizeEditor->setFixedWidthByText("88888.88 MB");
-                    m_pSizeEditor->setAlignment(Qt::AlignRight);
-                    m_pSizeEditor->setValidator(new QRegExpValidator(QRegExp(vboxGlobal().sizeRegexp()), this));
-                }
-                QLabel *m_pSizeMin = new QLabel(m_pSizeCnt);
-                {
-                    m_pSizeMin->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);
-                    m_pSizeMin->setText(vboxGlobal().formatSize(m_uMediumSizeMin));
-                }
-                QLabel *m_pSizeMax = new QLabel(m_pSizeCnt);
-                {
-                    m_pSizeMax->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);
-                    m_pSizeMax->setText(vboxGlobal().formatSize(m_uMediumSizeMax));
-                }
-                pSizeCntLayout->addWidget(m_pSizeSlider, 0, 0, 1, 3);
-                pSizeCntLayout->addWidget(m_pSizeEditor, 0, 3);
-                pSizeCntLayout->addWidget(m_pSizeMin, 1, 0);
-                pSizeCntLayout->setColumnStretch(1, 1);
-                pSizeCntLayout->addWidget(m_pSizeMax, 1, 2);
+            QVBoxLayout *pSizeCntLayout = new QVBoxLayout(m_pSizeCnt);
+            {
+                m_pEditorSize = new UIMediumSizeEditor;
+                {
+                    pSizeCntLayout->addWidget(m_pEditorSize);
+                }
             }
         }
@@ -195,6 +166,5 @@
     connect(m_pLocationEditor, SIGNAL(textChanged(const QString &)), this, SIGNAL(completeChanged()));
     connect(m_pLocationOpenButton, SIGNAL(clicked()), this, SLOT(sltSelectLocationButtonClicked()));
-    connect(m_pSizeSlider, SIGNAL(valueChanged(int)), this, SLOT(sltSizeSliderValueChanged(int)));
-    connect(m_pSizeEditor, SIGNAL(textChanged(const QString &)), this, SLOT(sltSizeEditorTextChanged(const QString &)));
+    connect(m_pEditorSize, &UIMediumSizeEditor::sigSizeChanged, this, &UIWizardNewVDPageExpert::completeChanged);
 
     /* Register classes: */
@@ -242,18 +212,4 @@
     /* Call to base-class: */
     onSelectLocationButtonClicked();
-}
-
-void UIWizardNewVDPageExpert::sltSizeSliderValueChanged(int iValue)
-{
-    onSizeSliderValueChanged(iValue);
-
-    emit completeChanged();
-}
-
-void UIWizardNewVDPageExpert::sltSizeEditorTextChanged(const QString &strValue)
-{
-    onSizeEditorTextChanged(strValue);
-
-    emit completeChanged();
 }
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageExpert.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageExpert.h	(revision 67930)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageExpert.h	(revision 67931)
@@ -58,7 +58,4 @@
     /* Location editors stuff: */
     void sltSelectLocationButtonClicked();
-    /* Size editors stuff: */
-    void sltSizeSliderValueChanged(int iValue);
-    void sltSizeEditorTextChanged(const QString &strValue);
 
 private:
