Changeset 102836 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Jan 11, 2024 12:12:42 PM (11 months ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualMachineItemCloud.cpp
r101382 r102836 114 114 , m_enmMachineState(KCloudMachineState_Invalid) 115 115 , m_enmFakeCloudItemState(enmState) 116 , m_f RefreshScheduled(false)116 , m_fUpdateRequiredByLocalReason(false) 117 117 , m_pProgressTaskRefresh(0) 118 118 { … … 125 125 , m_enmMachineState(KCloudMachineState_Invalid) 126 126 , m_enmFakeCloudItemState(UIFakeCloudVirtualMachineItemState_NotApplicable) 127 , m_f RefreshScheduled(false)127 , m_fUpdateRequiredByLocalReason(false) 128 128 , m_pProgressTaskRefresh(0) 129 129 { … … 148 148 } 149 149 150 void UIVirtualMachineItemCloud::updateInfoAsync(bool fDelayed, bool fSubscribe /* = false */) 150 void UIVirtualMachineItemCloud::setUpdateRequiredByLocalReason(bool fRequired) 151 { 152 m_fUpdateRequiredByLocalReason = fRequired; 153 } 154 155 void UIVirtualMachineItemCloud::updateInfoAsync(bool fDelayed) 151 156 { 152 157 /* Ignore refresh request if progress-task is absent: */ 153 158 if (!m_pProgressTaskRefresh) 154 159 return; 155 156 /* Mark update scheduled if requested: */157 if (fSubscribe)158 m_fRefreshScheduled = true;159 160 160 161 /* Schedule refresh request in a 10 or 0 seconds … … 165 166 } 166 167 167 void UIVirtualMachineItemCloud:: stopAsyncUpdates()168 void UIVirtualMachineItemCloud::waitForAsyncInfoUpdateFinished() 168 169 { 169 170 /* Ignore cancel request if progress-task is absent: */ … … 172 173 173 174 /* Mark update canceled in any case: */ 174 m_fRefreshScheduled = false; 175 } 176 177 void UIVirtualMachineItemCloud::waitForAsyncInfoUpdateFinished() 178 { 179 /* Ignore cancel request if progress-task is absent: */ 180 if (!m_pProgressTaskRefresh) 181 return; 182 183 /* Mark update canceled in any case: */ 184 m_fRefreshScheduled = false; 175 m_fUpdateRequiredByLocalReason = false; 185 176 186 177 /* Cancel refresh request … … 400 391 emit sigRefreshFinished(); 401 392 402 /* Refresh again if scheduled: */403 if (m_f RefreshScheduled)404 updateInfoAsync(true /* async? */);393 /* Refresh again if required: */ 394 if (m_fUpdateRequiredByLocalReason) 395 updateInfoAsync(true /* delayed? */); 405 396 } 406 397 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualMachineItemCloud.h
r98103 r102836 84 84 QString fakeCloudItemErrorMessage() const { return m_strFakeCloudItemErrorMessage; } 85 85 86 /** Updates cloud VM info async way, @a fDelayed if requested or instant otherwise. 87 * @param fSubscribe Brings whether this update should be performed periodically. */ 88 void updateInfoAsync(bool fDelayed, bool fSubscribe = false); 89 /** Stop periodical updates previously requested. */ 90 void stopAsyncUpdates(); 86 /** Defines whether update is @a fRequired by local reason. */ 87 void setUpdateRequiredByLocalReason(bool fRequired); 88 /** Updates cloud VM info async way, @a fDelayed if requested or instantly otherwise. */ 89 void updateInfoAsync(bool fDelayed); 91 90 /** Makes sure async info update is finished. 92 91 * @note This method creates own event-loop to avoid blocking calling thread event processing, … … 166 165 QString m_strFakeCloudItemErrorMessage; 167 166 168 /** Holds whether we plan to refresh info. */169 bool m_f RefreshScheduled;167 /** Holds whether update is required by local reason. */ 168 bool m_fUpdateRequiredByLocalReason; 170 169 /** Holds the refresh progress-task instance. */ 171 170 UIProgressTask *m_pProgressTaskRefresh; -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserAbstractModel.cpp
r101571 r102836 1647 1647 { 1648 1648 AssertReturnVoid(pNode && pNode->cacheType() == UIVirtualMachineItemType_CloudReal); 1649 pNode->cache()->toCloud()->updateInfoAsync(false /* delayed? */); 1649 UIVirtualMachineItemCloud *pCloudMachineItem = pNode->cache()->toCloud(); 1650 pCloudMachineItem->updateInfoAsync(false /* delayed? */); 1650 1651 } 1651 1652 } -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemMachine.cpp
r101559 r102836 241 241 UIVirtualMachineItemCloud *pCloudMachineItem = cache()->toCloud(); 242 242 AssertPtrReturnVoid(pCloudMachineItem); 243 if (fSelected && pCloudMachineItem->accessible())244 pCloudMachineItem->updateInfoAsync(false /* delayed? */, true /* subscribe */);245 else246 pCloudMachineItem-> stopAsyncUpdates();243 const bool fUpdateRequired = fSelected && pCloudMachineItem->accessible(); 244 pCloudMachineItem->setUpdateRequiredByLocalReason(fUpdateRequired); 245 if (fUpdateRequired) 246 pCloudMachineItem->updateInfoAsync(false /* delayed? */); 247 247 } 248 248 }
Note:
See TracChangeset
for help on using the changeset viewer.