Index: /trunk/src/VBox/Frontends/VirtualBox/src/globals/UIPopupCenter.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/globals/UIPopupCenter.cpp	(revision 45507)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/globals/UIPopupCenter.cpp	(revision 45508)
@@ -212,4 +212,38 @@
                  "or pressing the host key) in order to use the mouse inside the guest OS.</p>"));
     }
+}
+
+void UIAnimationFramework::installPropertyAnimation(QWidget *pParent, const QByteArray &strPropertyName,
+                                                    int iStartValue, int iFinalValue, int iAnimationDuration,
+                                                    const char *pSignalForward, const char *pSignalBackward)
+{
+    /* State-machine: */
+    QStateMachine *pStateMachine = new QStateMachine(pParent);
+    /* State-machine 'start' state: */
+    QState *pStateStart = new QState(pStateMachine);
+    /* State-machine 'final' state: */
+    QState *pStateFinal = new QState(pStateMachine);
+
+    /* State-machine 'forward' animation: */
+    QPropertyAnimation *pForwardAnimation = new QPropertyAnimation(pParent, strPropertyName, pParent);
+    pForwardAnimation->setDuration(iAnimationDuration);
+    pForwardAnimation->setStartValue(iStartValue);
+    pForwardAnimation->setEndValue(iFinalValue);
+    /* State-machine 'backward' animation: */
+    QPropertyAnimation *pBackwardAnimation = new QPropertyAnimation(pParent, strPropertyName, pParent);
+    pBackwardAnimation->setDuration(iAnimationDuration);
+    pBackwardAnimation->setStartValue(iFinalValue);
+    pBackwardAnimation->setEndValue(iStartValue);
+
+    /* State-machine state transitions: */
+    QSignalTransition *pDefaultToHovered = pStateStart->addTransition(pParent, pSignalForward, pStateFinal);
+    pDefaultToHovered->addAnimation(pForwardAnimation);
+    QSignalTransition *pHoveredToDefault = pStateFinal->addTransition(pParent, pSignalBackward, pStateStart);
+    pHoveredToDefault->addAnimation(pBackwardAnimation);
+
+    /* Initial state is 'start': */
+    pStateMachine->setInitialState(pStateStart);
+    /* Start hover-machine: */
+    pStateMachine->start();
 }
 
@@ -369,29 +403,5 @@
                     /* Configure button-box: */
                     m_pButtonBox->installEventFilter(pMainFrame);
-                    QList<int> activeButtons;
-                    m_pButton1 = createButton(m_iButton1);
-                    if (m_pButton1)
-                    {
-                        activeButtons << m_iButton1;
-                        connect(m_pButton1, SIGNAL(clicked()), SLOT(done1()));
-                        if (!m_strButtonText1.isEmpty())
-                            m_pButton1->setText(m_strButtonText1);
-                    }
-                    m_pButton2 = createButton(m_iButton2);
-                    if (m_pButton2)
-                    {
-                        activeButtons << m_iButton2;
-                        connect(m_pButton2, SIGNAL(clicked()), SLOT(done2()));
-                        if (!m_strButtonText2.isEmpty())
-                            m_pButton1->setText(m_strButtonText2);
-                    }
-                    m_pButton3 = createButton(m_iButton3);
-                    if (m_pButton3)
-                    {
-                        activeButtons << m_iButton3;
-                        connect(m_pButton3, SIGNAL(clicked()), SLOT(done3()));
-                        if (!m_strButtonText3.isEmpty())
-                            m_pButton1->setText(m_strButtonText3);
-                    }
+                    prepareButtons();
                 }
             }
@@ -400,7 +410,91 @@
 }
 
-QPushButton* UIPopupPane::createButton(int iButton)
-{
-    /* Not for AlertButton_NoButton: */
+void UIPopupPane::prepareButtons()
+{
+    /* Prepare descriptions: */
+    QList<int> descriptions;
+    descriptions << m_iButton1 << m_iButton2 << m_iButton3;
+
+    /* Choose 'escape' button: */
+    foreach (int iButton, descriptions)
+        if (iButton & AlertButtonOption_Escape)
+        {
+            m_iButtonEsc = iButton & AlertButtonMask;
+            break;
+        }
+
+    /* Create buttons: */
+    QList<QPushButton*> buttons = createButtons(m_pButtonBox, descriptions);
+
+    /* Install focus-proxy into the 'default' button: */
+    foreach (QPushButton *pButton, buttons)
+        if (pButton && pButton->isDefault())
+        {
+            setFocusProxy(pButton);
+            m_pTextPane->setFocusProxy(pButton);
+            break;
+        }
+
+    /* Prepare button 1: */
+    m_pButton1 = buttons[0];
+    if (m_pButton1)
+    {
+        connect(m_pButton1, SIGNAL(clicked()), SLOT(done1()));
+        if (!m_strButtonText1.isEmpty())
+            m_pButton1->setText(m_strButtonText1);
+    }
+    /* Prepare button 2: */
+    m_pButton2 = buttons[1];
+    if (m_pButton2)
+    {
+        connect(m_pButton2, SIGNAL(clicked()), SLOT(done2()));
+        if (!m_strButtonText2.isEmpty())
+            m_pButton1->setText(m_strButtonText2);
+    }
+    /* Prepare button 3: */
+    m_pButton3 = buttons[2];
+    if (m_pButton3)
+    {
+        connect(m_pButton3, SIGNAL(clicked()), SLOT(done3()));
+        if (!m_strButtonText3.isEmpty())
+            m_pButton1->setText(m_strButtonText3);
+    }
+}
+
+void UIPopupPane::done(int iButtonCode)
+{
+    /* Close the window: */
+    close();
+
+    /* Notify listeners: */
+    emit sigDone(iButtonCode);
+}
+
+/* static */
+int UIPopupPane::parentStatusBarHeight(QWidget *pParent)
+{
+    /* Check if passed parent is QMainWindow and contains status-bar: */
+    if (QMainWindow *pParentWindow = qobject_cast<QMainWindow*>(pParent))
+        if (pParentWindow->statusBar())
+            return pParentWindow->statusBar()->height();
+    /* Zero by default: */
+    return 0;
+}
+
+/* static */
+QList<QPushButton*> UIPopupPane::createButtons(QIDialogButtonBox *pButtonBox, const QList<int> descriptions)
+{
+    /* Create button according descriptions: */
+    QList<QPushButton*> buttons;
+    foreach (int iButton, descriptions)
+        buttons << createButton(pButtonBox, iButton);
+    /* Return buttons: */
+    return buttons;
+}
+
+/* static */
+QPushButton* UIPopupPane::createButton(QIDialogButtonBox *pButtonBox, int iButton)
+{
+    /* Null for AlertButton_NoButton: */
     if (iButton == 0)
         return 0;
@@ -411,51 +505,24 @@
     switch (iButton & AlertButtonMask)
     {
-        case AlertButton_Ok:      strText = tr("OK");     role = QDialogButtonBox::AcceptRole; break;
-        case AlertButton_Cancel:  strText = tr("Cancel"); role = QDialogButtonBox::RejectRole; break;
-        case AlertButton_Choice1: strText = tr("Yes");    role = QDialogButtonBox::YesRole; break;
-        case AlertButton_Choice2: strText = tr("No");     role = QDialogButtonBox::NoRole; break;
+        case AlertButton_Ok:      strText = QIMessageBox::tr("OK");     role = QDialogButtonBox::AcceptRole; break;
+        case AlertButton_Cancel:  strText = QIMessageBox::tr("Cancel"); role = QDialogButtonBox::RejectRole; break;
+        case AlertButton_Choice1: strText = QIMessageBox::tr("Yes");    role = QDialogButtonBox::YesRole; break;
+        case AlertButton_Choice2: strText = QIMessageBox::tr("No");     role = QDialogButtonBox::NoRole; break;
         default: return 0;
     }
 
     /* Create push-button: */
-    QPushButton *pButton = m_pButtonBox->addButton(strText, role);
-
-    /* Configure <default> button: */
+    QPushButton *pButton = pButtonBox->addButton(strText, role);
+
+    /* Configure 'default' button: */
     if (iButton & AlertButtonOption_Default)
     {
         pButton->setDefault(true);
         pButton->setFocusPolicy(Qt::StrongFocus);
-        setFocusProxy(pButton);
-        m_pTextPane->setFocusProxy(pButton);
         pButton->setFocus();
-    }
-
-    /* Configure <escape> button: */
-    if (iButton & AlertButtonOption_Escape)
-    {
-        m_iButtonEsc = iButton & AlertButtonMask;
     }
 
     /* Return button: */
     return pButton;
-}
-
-void UIPopupPane::done(int iButtonCode)
-{
-    /* Close the window: */
-    close();
-
-    /* Notify listeners: */
-    emit sigDone(iButtonCode);
-}
-
-/* static */
-int UIPopupPane::parentStatusBarHeight(QWidget *pParent)
-{
-    /* Check if passed parent is QMainWindow and contains status-bar: */
-    if (QMainWindow *pParentWindow = qobject_cast<QMainWindow*>(pParent))
-        if (pParentWindow->statusBar())
-            return pParentWindow->statusBar()->height();
-    return 0;
 }
 
@@ -483,7 +550,7 @@
     installEventFilter(this);
     /* Install 'hover' animation for 'opacity' property: */
-    installPropertyAnimation(this, QByteArray("opacity"),
-                             m_iDefaultOpacity, m_iHoveredOpacity, m_iHoverAnimationDuration,
-                             SIGNAL(sigHoverEnter()), SIGNAL(sigHoverLeave()));
+    UIAnimationFramework::installPropertyAnimation(this, QByteArray("opacity"),
+                                                   m_iDefaultOpacity, m_iHoveredOpacity, m_iHoverAnimationDuration,
+                                                   SIGNAL(sigHoverEnter()), SIGNAL(sigHoverLeave()));
 }
 
@@ -555,37 +622,2 @@
 }
 
-/* static */
-void UIPopupPaneFrame::installPropertyAnimation(QWidget *pParent, const QByteArray &strPropertyName,
-                                                int iStartValue, int iFinalValue, int iAnimationDuration,
-                                                const char *pSignalForward, const char *pSignalBackward)
-{
-    /* State-machine: */
-    QStateMachine *pStateMachine = new QStateMachine(pParent);
-    /* State-machine 'start' state: */
-    QState *pStateStart = new QState(pStateMachine);
-    /* State-machine 'final' state: */
-    QState *pStateFinal = new QState(pStateMachine);
-
-    /* State-machine 'forward' animation: */
-    QPropertyAnimation *pForwardAnimation = new QPropertyAnimation(pParent, strPropertyName, pParent);
-    pForwardAnimation->setDuration(iAnimationDuration);
-    pForwardAnimation->setStartValue(iStartValue);
-    pForwardAnimation->setEndValue(iFinalValue);
-    /* State-machine 'backward' animation: */
-    QPropertyAnimation *pBackwardAnimation = new QPropertyAnimation(pParent, strPropertyName, pParent);
-    pBackwardAnimation->setDuration(iAnimationDuration);
-    pBackwardAnimation->setStartValue(iFinalValue);
-    pBackwardAnimation->setEndValue(iStartValue);
-
-    /* State-machine state transitions: */
-    QSignalTransition *pDefaultToHovered = pStateStart->addTransition(pParent, pSignalForward, pStateFinal);
-    pDefaultToHovered->addAnimation(pForwardAnimation);
-    QSignalTransition *pHoveredToDefault = pStateFinal->addTransition(pParent, pSignalBackward, pStateStart);
-    pHoveredToDefault->addAnimation(pBackwardAnimation);
-
-    /* Initial state is 'start': */
-    pStateMachine->setInitialState(pStateStart);
-    /* Start hover-machine: */
-    pStateMachine->start();
-}
-
Index: /trunk/src/VBox/Frontends/VirtualBox/src/globals/UIPopupCenter.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/globals/UIPopupCenter.h	(revision 45507)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/globals/UIPopupCenter.h	(revision 45508)
@@ -126,4 +126,13 @@
 inline UIPopupCenter& popupCenter() { return *UIPopupCenter::instance(); }
 
+/* UIAnimationFramework namespace: */
+namespace UIAnimationFramework
+{
+    /* API: Animation stuff: */
+    void installPropertyAnimation(QWidget *pParent, const QByteArray &strPropertyName,
+                                  int iStartValue, int iFinalValue, int iAnimationDuration,
+                                  const char *pSignalForward, const char *pSignalBackward);
+}
+
 /* Popup-pane prototype class: */
 class UIPopupPane : public QWidget
@@ -174,11 +183,13 @@
     /* Helpers: Prepare stuff: */
     void prepareContent();
-    QPushButton* createButton(int iButton);
+    void prepareButtons();
 
     /* Helper: Complete stuff: */
     void done(int iButtonCode);
 
-    /* Helper: Parent stuff: */
+    /* Static helpers: Prepare stuff: */
     static int parentStatusBarHeight(QWidget *pParent);
+    static QList<QPushButton*> createButtons(QIDialogButtonBox *pButtonBox, const QList<int> description);
+    static QPushButton* createButton(QIDialogButtonBox *pButtonBox, int iButton);
 
     /* Variables: */
@@ -231,9 +242,4 @@
     void setOpacity(int iOpacity) { m_iOpacity = iOpacity; update(); }
 
-    /* Static helper: Animation stuff: */
-    static void installPropertyAnimation(QWidget *pParent, const QByteArray &strPropertyName,
-                                         int iStartValue, int iFinalValue, int iAnimationDuration,
-                                         const char *pSignalForward, const char *pSignalBackward);
-
     /* Hover-machine stuff: */
     bool m_fHovered;
