VirtualBox

Changeset 47763 in vbox


Ignore:
Timestamp:
Aug 15, 2013 1:18:56 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
88021
Message:

FE/Qt: Settings Dialog: Moving validation mechanism warning from tooltip/whatsthis-pane to popup-pane.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/settings
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp

    r47616 r47763  
    3030#include "VBoxGlobal.h"
    3131#include "UIMessageCenter.h"
     32#include "UIPopupCenter.h"
    3233#include "QIWidgetValidator.h"
    3334#include "VBoxSettingsSelector.h"
     
    107108    /* Creating stack of pages: */
    108109    m_pStack = new QStackedWidget(m_pWtStackHandler);
     110    popupCenter().setPopupStackOrientation(m_pStack, UIPopupStackOrientation_Bottom);
    109111    QVBoxLayout *pStackLayout = new QVBoxLayout(m_pWtStackHandler);
    110112    pStackLayout->setContentsMargins(0, 0, 0, 0);
     
    120122    /* Setup error & warning stuff: */
    121123    m_pStatusBar->addWidget(m_pWarningPane);
     124    connect(m_pWarningPane, SIGNAL(sigHoverEnter()), this, SLOT(sltHandleWarningPaneHovered()));
     125    connect(m_pWarningPane, SIGNAL(sigHoverLeave()), this, SLOT(sltHandleWarningPaneUnhovered()));
    122126
    123127    /* Setup whatsthis stuff: */
     
    146150UISettingsDialog::~UISettingsDialog()
    147151{
     152    /* Recall popup-pane if any: */
     153    popupCenter().recall(m_pStack, "SettingsDialogWarning");
    148154    /* Delete selector early! */
    149155    delete m_pSelector;
     
    276282    m_strErrorString = strError.isEmpty() ? QString() :
    277283                       QString("<font color=red>%1</font>").arg(strError);
    278 
    279     /* Do not touching QILabel until dialog is polished
    280      * otherwise it can change its size to undefined: */
    281     if (m_fPolished)
    282     {
    283         if (!m_strErrorString.isEmpty() && m_pStatusBar->currentWidget() == m_pWarningPane)
    284             m_pLbWhatsThis->setText(m_strErrorString);
    285         else
    286             sltUpdateWhatsThis(true /* got focus? */);
    287     }
    288284}
    289285
     
    292288    m_strWarningString = strWarning.isEmpty() ? QString() :
    293289                         QString("<font color=#ff5400>%1</font>").arg(strWarning);
    294 
    295     /* Do not touching QILabel until dialog is polished
    296      * otherwise it can change its size to undefined: */
    297     if (m_fPolished)
    298     {
    299         if (!m_strWarningString.isEmpty() && m_pStatusBar->currentWidget() == m_pWarningPane)
    300             m_pLbWhatsThis->setText(m_strWarningString);
    301         else
    302             sltUpdateWhatsThis(true /* got focus? */);
    303     }
    304290}
    305291
     
    377363                setError(pValidator->lastMessage());
    378364                m_pWarningPane->setWarningText(m_strErrorHint);
    379 #ifdef Q_WS_MAC
    380                 m_pWarningPane->setToolTip(m_strErrorString);
    381 #endif /* Q_WS_MAC */
    382365            }
    383366            /* Show warning if message is not an error: */
     
    387370                setWarning(pValidator->lastMessage());
    388371                m_pWarningPane->setWarningText(m_strWarningHint);
    389 #ifdef Q_WS_MAC
    390                 m_pWarningPane->setToolTip(m_strWarningString);
    391 #endif /* Q_WS_MAC */
    392372            }
    393373
    394             /* Configure warning pixmap: */
     374            /* Configure warning-pane pixmap: */
    395375            m_pWarningPane->setWarningPixmap(pFailedSettingsPage->warningPixmap());
    396376
     
    434414}
    435415
     416void UISettingsDialog::sltHandleWarningPaneHovered()
     417{
     418    LogRel(("Settings Dialog: Warning-pane hovered.\n"));
     419
     420    /* Show corresponding popup: */
     421    if (!m_fValid || !m_fSilent)
     422    {
     423        popupCenter().popup(m_pStack, "SettingsDialogWarning",
     424                            !m_fValid ? m_strErrorString :
     425                            !m_fSilent ? m_strWarningString :
     426                            QString());
     427    }
     428}
     429
     430void UISettingsDialog::sltHandleWarningPaneUnhovered()
     431{
     432    LogRel(("Settings Dialog: Warning-pane unhovered.\n"));
     433
     434    /* Recall corresponding popup: */
     435    popupCenter().recall(m_pStack, "SettingsDialogWarning");
     436}
     437
    436438void UISettingsDialog::sltUpdateWhatsThis(bool fGotFocus /* = false */)
    437439{
     
    463465
    464466#ifndef Q_WS_MAC
    465     if (m_pStatusBar->currentWidget() == m_pWarningPane)
    466     {
    467         if (strWhatsThisText.isEmpty() && !m_strErrorString.isEmpty())
    468             strWhatsThisText = m_strErrorString;
    469         else if (strWhatsThisText.isEmpty() && !m_strWarningString.isEmpty())
    470             strWhatsThisText = m_strWarningString;
    471     }
    472467    if (strWhatsThisText.isEmpty())
    473468        strWhatsThisText = whatsThis();
    474469    m_pLbWhatsThis->setText(strWhatsThisText);
    475 #else
     470#else /* !Q_WS_MAC */
    476471    if (pWhatsThisWidget && !strWhatsThisText.isEmpty())
    477472        pWhatsThisWidget->setToolTip(QString("<qt>%1</qt>").arg(strWhatsThisText));
    478 #endif
     473#endif /* Q_WS_MAC */
    479474}
    480475
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.h

    r47616 r47763  
    104104private slots:
    105105
    106     /* Handler: Validation stuff: */
     106    /* Handlers: Validation stuff: */
    107107    void sltHandleValidityChange(UIPageValidator *pValidator);
     108    void sltHandleWarningPaneHovered();
     109    void sltHandleWarningPaneUnhovered();
    108110
    109111    /* Slot to update whats-this: */
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette