Changeset 86215 in vbox
- Timestamp:
- Sep 22, 2020 10:40:19 AM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualMachineItemCloud.cpp
r86208 r86215 40 40 , m_enmMachineState(KCloudMachineState_Invalid) 41 41 , m_enmFakeCloudItemState(enmState) 42 { 43 recache(); 42 , m_pTimer(0) 43 { 44 prepare(); 44 45 } 45 46 … … 49 50 , m_enmMachineState(KCloudMachineState_Invalid) 50 51 , m_enmFakeCloudItemState(UIFakeCloudVirtualMachineItemState_NotApplicable) 51 { 52 recache(); 52 , m_pTimer(0) 53 { 54 prepare(); 53 55 } 54 56 … … 71 73 void UIVirtualMachineItemCloud::updateInfoAsync(bool fDelayed) 72 74 { 73 QTimer::singleShot(fDelayed ? 10000 : 0, this, SLOT(sltRefreshCloudMachineInfo())); 75 /* Ignore refresh request if timer or progress is already running: */ 76 if (m_pTimer->isActive() || m_pProgressHandler) 77 return; 78 79 /* Schedule refresh request in a 10 or 0 seconds: */ 80 m_pTimer->setInterval(fDelayed ? 10000 : 0); 81 m_pTimer->start(); 74 82 } 75 83 … … 305 313 void UIVirtualMachineItemCloud::sltHandleRefreshCloudMachineInfoDone() 306 314 { 315 /* Was the progress canceled? */ 316 const bool fCanceled = m_comProgress.GetCanceled(); 317 307 318 /* If not canceled => check progress result: */ 308 if ( !m_comProgress.GetCanceled() 309 && (!m_comProgress.isOk() || m_comProgress.GetResultCode() != 0)) 310 msgCenter().cannotAcquireCloudMachineParameter(m_comProgress); 319 if (!fCanceled && (!m_comProgress.isOk() || m_comProgress.GetResultCode() != 0)) 320 msgCenter().cannotAcquireCloudMachineParameter(m_comProgress); 311 321 312 322 /* Recache: */ 313 323 recache(); 314 324 315 /* If not canceled => notify listeners: */316 if (!m_comProgress.GetCanceled())317 emit sigStateChange();318 319 325 /* Cleanup the handler and the progress: */ 320 326 delete m_pProgressHandler; 321 m_pProgressHandler = 0;322 327 m_comProgress = CProgress(); 323 } 328 329 /* If not canceled => notify listeners: */ 330 if (!fCanceled) 331 emit sigStateChange(); 332 } 333 334 void UIVirtualMachineItemCloud::prepare() 335 { 336 /* Prepare timer: */ 337 m_pTimer = new QTimer(this); 338 if (m_pTimer) 339 { 340 m_pTimer->setSingleShot(true); 341 connect(m_pTimer, &QTimer::timeout, 342 this, &UIVirtualMachineItemCloud::sltRefreshCloudMachineInfo); 343 } 344 345 /* Recache finally: */ 346 recache(); 347 } 348 349 void UIVirtualMachineItemCloud::cleanup() 350 { 351 /* Cleanup timer: */ 352 delete m_pTimer; 353 m_pTimer = 0; 354 } -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualMachineItemCloud.h
r86207 r86215 34 34 35 35 /* Forward declarations: */ 36 class QTimer; 36 37 class UIProgress; 37 38 … … 133 134 private: 134 135 136 /** @name Prepare/Cleanup cascade. 137 * @{ */ 138 /** Prepares all. */ 139 void prepare(); 140 /** Cleanups all. */ 141 void cleanup(); 142 /** @} */ 143 135 144 /** @name Arguments. 136 145 * @{ */ … … 149 158 QString m_strFakeCloudItemErrorMessage; 150 159 160 /** Holds the machine refresh timer instance. */ 161 QTimer *m_pTimer; 151 162 /** Holds the machine refresh progress object instance. */ 152 163 CProgress m_comProgress;
Note:
See TracChangeset
for help on using the changeset viewer.