VirtualBox

Ignore:
Timestamp:
Sep 21, 2020 2:33:29 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9653: Moving cloud machine refresh code from UICloudNetworkingStuff namespace directly to UITaskCloudRefreshMachineInfo class; It's done cause the progress code will be manipulated directly to allow to cancel it.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UICloudNetworkingStuff.cpp

    r86076 r86199  
    476476    }
    477477    return false;
    478 }
    479 
    480 bool UICloudNetworkingStuff::refreshCloudMachineInfo(CCloudMachine comCloudMachine,
    481                                                      QWidget *pParent /* = 0 */)
    482 {
    483     /* Acquire machine name first: */
    484     QString strMachineName;
    485     if (!cloudMachineName(comCloudMachine, strMachineName))
    486         return false;
    487 
    488     /* Now execute Refresh async method: */
    489     CProgress comProgress = comCloudMachine.Refresh();
    490     if (!comCloudMachine.isOk())
    491     {
    492         msgCenter().cannotAcquireCloudMachineParameter(comCloudMachine, pParent);
    493         return false;
    494     }
    495 
    496     /* Show "Refresh cloud machine information" progress: */
    497     msgCenter().showModalProgressDialog(comProgress,
    498                                         strMachineName,
    499                                         ":/progress_reading_appliance_90px.png", pParent, 0);
    500     if (!comProgress.isOk() || comProgress.GetResultCode() != 0)
    501     {
    502         msgCenter().cannotAcquireCloudMachineParameter(comProgress, pParent);
    503         return false;
    504     }
    505 
    506     /* Return result: */
    507     return true;
    508 }
    509 
    510 bool UICloudNetworkingStuff::refreshCloudMachineInfo(CCloudMachine comCloudMachine,
    511                                                      QString &strErrorMessage)
    512 {
    513     /* Execute Refresh async method: */
    514     CProgress comProgress = comCloudMachine.Refresh();
    515     if (!comCloudMachine.isOk())
    516     {
    517         strErrorMessage = UIErrorString::formatErrorInfo(comCloudMachine);
    518         return false;
    519     }
    520 
    521     /* Show "Refresh cloud machine information" progress: */
    522     comProgress.WaitForCompletion(-1);
    523     if (!comProgress.isOk() || comProgress.GetResultCode() != 0)
    524     {
    525         strErrorMessage = UIErrorString::formatErrorInfo(comProgress);
    526         return false;
    527     }
    528 
    529     /* Return result: */
    530     return true;
    531478}
    532479
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UICloudNetworkingStuff.h

    r86076 r86199  
    147147                                                                       QWidget *pParent = 0);
    148148
    149     /** Refreshes @a comCloudMachine information, using @a pParent to show messages according to.
    150       * @note  Be aware, this is a blocking function, corresponding progress dialog will be executed. */
    151     SHARED_LIBRARY_STUFF bool refreshCloudMachineInfo(CCloudMachine comCloudMachine,
    152                                                       QWidget *pParent = 0);
    153     /** Refreshes @a comCloudMachine information, using @a pParent to show messages according to.
    154       * @note  Be aware, this is a blocking function, it will hang for a time of progress being executed. */
    155     SHARED_LIBRARY_STUFF bool refreshCloudMachineInfo(CCloudMachine comCloudMachine,
    156                                                       QString &strErrorMessage);
    157149    /** Acquires @a comCloudMachine settings form as a @a comResult, using @a pParent to show messages according to.
    158150      * @note  Be aware, this is a blocking function, corresponding progress dialog will be executed. */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UITaskCloudRefreshMachineInfo.cpp

    r83691 r86199  
    1818/* GUI includes: */
    1919#include "UICloudNetworkingStuff.h"
     20#include "UIErrorString.h"
     21#include "UIProgressDialog.h"
    2022#include "UITaskCloudRefreshMachineInfo.h"
    2123
     
    3840{
    3941    m_mutex.lock();
    40     refreshCloudMachineInfo(m_comCloudMachine, m_strErrorInfo);
     42
     43    /* Execute Refresh async method: */
     44    m_comCloudMachineRefreshProgress = m_comCloudMachine.Refresh();
     45    if (m_comCloudMachine.isOk())
     46    {
     47        /* Show "Refresh cloud machine information" progress: */
     48        QPointer<UIProgress> pObject = new UIProgress(m_comCloudMachineRefreshProgress, this);
     49        pObject->run();
     50        if (pObject)
     51            delete pObject;
     52        else
     53        {
     54            // Premature application shutdown,
     55            // exit immediately:
     56            return;
     57        }
     58        if (!m_comCloudMachineRefreshProgress.isOk() || m_comCloudMachineRefreshProgress.GetResultCode() != 0)
     59            m_strErrorInfo = UIErrorString::formatErrorInfo(m_comCloudMachineRefreshProgress);
     60    }
     61    else
     62        m_strErrorInfo = UIErrorString::formatErrorInfo(m_comCloudMachine);
     63
    4164    m_mutex.unlock();
    4265}
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UITaskCloudRefreshMachineInfo.h

    r83658 r86199  
    3232#include "COMEnums.h"
    3333#include "CCloudMachine.h"
     34#include "CProgress.h"
    3435
    3536
     
    6061    /** Holds the cloud machine object. */
    6162    CCloudMachine  m_comCloudMachine;
     63    /** Holds the cloud machine refresh progress object. */
     64    CProgress      m_comCloudMachineRefreshProgress;
    6265
    6366    /** Holds the error info. */
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