VirtualBox

Ignore:
Timestamp:
Oct 20, 2021 11:26:48 AM (3 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10067: UINotificationCenter: Make handleNow() return result value.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationCenter.cpp

    r91844 r91877  
    156156    , m_iAnimatedValue(0)
    157157    , m_pTimerOpen(0)
     158    , m_fLastResult(false)
    158159{
    159160    prepare();
     
    227228}
    228229
    229 void UINotificationCenter::handleNow(UINotificationProgress *pProgress)
     230bool UINotificationCenter::handleNow(UINotificationProgress *pProgress)
    230231{
    231232    /* Check for the recursive run: */
    232     AssertMsgReturnVoid(!m_pEventLoop, ("UINotificationCenter::handleNow() is called recursively!\n"));
     233    AssertMsgReturn(!m_pEventLoop, ("UINotificationCenter::handleNow() is called recursively!\n"), false);
     234
     235    /* Reset the result: */
     236    m_fLastResult = false;
    233237
    234238    /* Guard progress for the case
     
    241245    /* Is progress still valid? */
    242246    if (guardProgress.isNull())
    243         return;
     247        return m_fLastResult;
    244248    /* Is progress still running? */
    245249    if (guardProgress->isFinished())
    246         return;
     250        return m_fLastResult;
    247251
    248252    /* Create a local event-loop: */
     
    259263    /* Are we still valid? */
    260264    if (guardThis.isNull())
    261         return;
     265        return false;
    262266
    263267    /* Cleanup event-loop: */
    264268    m_pEventLoop = 0;
     269
     270    /* Return actual result: */
     271    return m_fLastResult;
    265272}
    266273
     
    401408void UINotificationCenter::sltHandleProgressFinished()
    402409{
     410    /* Acquire the sender: */
     411    UINotificationProgress *pProgress = qobject_cast<UINotificationProgress*>(sender());
     412    AssertPtrReturnVoid(pProgress);
     413
     414    /* Set the result: */
     415    m_fLastResult = pProgress->error().isNull();
     416
    403417    /* Break the loop if exists: */
    404418    if (m_pEventLoop)
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationCenter.h

    r91755 r91877  
    8383    /** Immediately and synchronously handles passed notification @a pProgress.
    8484      * @note It's a blocking call finished by sltHandleProgressFinished(). */
    85     void handleNow(UINotificationProgress *pProgress);
     85    bool handleNow(UINotificationProgress *pProgress);
    8686
    8787protected:
     
    175175      *        handles progress directly via handleNow(). */
    176176    QPointer<QEventLoop>  m_pEventLoop;
     177    /** Holds the last handleNow() result. */
     178    bool                  m_fLastResult;
    177179};
    178180
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/UINativeWizard.cpp

    r91755 r91877  
    8080
    8181
    82 void UINativeWizard::handleNotificationProgressNow(UINotificationProgress *pProgress)
    83 {
    84     m_pNotificationCenter->handleNow(pProgress);
     82bool UINativeWizard::handleNotificationProgressNow(UINotificationProgress *pProgress)
     83{
     84    return m_pNotificationCenter->handleNow(pProgress);
    8585}
    8686
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/UINativeWizard.h

    r91755 r91877  
    8181
    8282    /** Immediately handles notification @a pProgress object. */
    83     void handleNotificationProgressNow(UINotificationProgress *pProgress);
     83    bool handleNotificationProgressNow(UINotificationProgress *pProgress);
    8484
    8585public slots:
Note: See TracChangeset for help on using the changeset viewer.

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