Changeset 84189 in vbox
- Timestamp:
- May 7, 2020 3:13:27 PM (5 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackend.h
r83494 r84189 129 129 130 130 /* Declare COM canConvert specializations: */ 131 template<> SHARED_LIBRARY_STUFF bool canConvert<KCloudMachineState>(); 131 132 template<> SHARED_LIBRARY_STUFF bool canConvert<KMachineState>(); 132 133 template<> SHARED_LIBRARY_STUFF bool canConvert<KSessionState>(); … … 273 274 274 275 /* Declare COM conversion specializations: */ 276 template<> SHARED_LIBRARY_STUFF QIcon toIcon(const KCloudMachineState &state); 277 template<> SHARED_LIBRARY_STUFF QString toString(const KCloudMachineState &state); 275 278 template<> SHARED_LIBRARY_STUFF QColor toColor(const KMachineState &state); 276 279 template<> SHARED_LIBRARY_STUFF QIcon toIcon(const KMachineState &state); -
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendCOM.cpp
r82968 r84189 30 30 /* Determines if <Object of type X> can be converted to object of other type. 31 31 * These functions returns 'true' for all allowed conversions. */ 32 template<> bool canConvert<KCloudMachineState>() { return true; } 32 33 template<> bool canConvert<KMachineState>() { return true; } 33 34 template<> bool canConvert<KSessionState>() { return true; } … … 54 55 template<> bool canConvert<KChipsetType>() { return true; } 55 56 template<> bool canConvert<KNATProtocol>() { return true; } 57 58 /* QIcon <= KCloudMachineState: */ 59 template<> QIcon toIcon(const KCloudMachineState &state) 60 { 61 switch (state) 62 { 63 case KCloudMachineState_Provisioning: return UIIconPool::iconSet(":/state_running_16px.png"); 64 case KCloudMachineState_Running: return UIIconPool::iconSet(":/state_running_16px.png"); 65 case KCloudMachineState_Starting: return UIIconPool::iconSet(":/state_running_16px.png"); 66 case KCloudMachineState_Stopping: return UIIconPool::iconSet(":/state_saving_16px.png"); 67 case KCloudMachineState_Stopped: return UIIconPool::iconSet(":/state_saved_16px.png"); 68 case KCloudMachineState_CreatingImage: return UIIconPool::iconSet(":/state_saved_16px.png"); 69 case KCloudMachineState_Terminating: return UIIconPool::iconSet(":/state_discarding_16px.png"); 70 case KCloudMachineState_Terminated: return UIIconPool::iconSet(":/state_powered_off_16px.png"); 71 default: AssertMsgFailed(("No icon for %d", state)); break; 72 } 73 return QIcon(); 74 } 75 76 /* QString <= KCloudMachineState: */ 77 template<> QString toString(const KCloudMachineState &state) 78 { 79 switch (state) 80 { 81 case KCloudMachineState_Provisioning: return QApplication::translate("UICommon", "Provisioning", "CloudMachineState"); 82 case KCloudMachineState_Running: return QApplication::translate("UICommon", "Running", "CloudMachineState"); 83 case KCloudMachineState_Starting: return QApplication::translate("UICommon", "Starting", "CloudMachineState"); 84 case KCloudMachineState_Stopping: return QApplication::translate("UICommon", "Stopping", "CloudMachineState"); 85 case KCloudMachineState_Stopped: return QApplication::translate("UICommon", "Stopped", "CloudMachineState"); 86 case KCloudMachineState_CreatingImage: return QApplication::translate("UICommon", "Creating Image", "CloudMachineState"); 87 case KCloudMachineState_Terminating: return QApplication::translate("UICommon", "Terminating", "CloudMachineState"); 88 case KCloudMachineState_Terminated: return QApplication::translate("UICommon", "Terminated", "CloudMachineState"); 89 default: AssertMsgFailed(("No text for %d", state)); break; 90 } 91 return QString(); 92 } 56 93 57 94 /* QColor <= KMachineState: */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp
r84188 r84189 810 810 continue; 811 811 812 /* Get machine item state: */ 813 const KMachineState enmState = pItem->machineState(); 812 /* Get local machine item state: */ 813 UIVirtualMachineItemLocal *pLocalItem = pItem->toLocal(); 814 AssertPtrReturnVoid(pLocalItem); 815 const KMachineState enmState = pLocalItem->machineState(); 814 816 815 817 /* Check if current item could be paused/resumed: */ … … 937 939 /* Get session machine: */ 938 940 CMachine comMachine = comSession.GetMachine(); 939 /* Get machine item state: */ 940 const KMachineState enmState = pItem->machineState(); 941 942 /* Get local machine item state: */ 943 UIVirtualMachineItemLocal *pLocalItem = pItem->toLocal(); 944 AssertPtrReturnVoid(pLocalItem); 945 const KMachineState enmState = pLocalItem->machineState(); 946 941 947 /* Pause VM first if necessary: */ 942 948 if (enmState != KMachineState_Paused) -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualMachineItem.cpp
r83921 r84189 28 28 : m_enmType(enmType) 29 29 , m_fAccessible(false) 30 , m_enmMachineState(KMachineState_Null)31 30 , m_enmConfigurationAccessLevel(ConfigurationAccessLevel_Null) 32 31 , m_fHasDetails(false) -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualMachineItem.h
r84102 r84189 85 85 /** @name State attributes. 86 86 * @{ */ 87 /** Returns cached machine state. */88 KMachineState machineState() const { return m_enmMachineState; }89 87 /** Returns cached machine state name. */ 90 88 QString machineStateName() const { return m_strMachineStateName; } … … 172 170 /** @name State attributes. 173 171 * @{ */ 174 /** Holds cached machine state. */175 KMachineState m_enmMachineState;176 172 /** Holds cached machine state name. */ 177 173 QString m_strMachineStateName; -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualMachineItemCloud.cpp
r84182 r84189 37 37 UIVirtualMachineItemCloud::UIVirtualMachineItemCloud() 38 38 : UIVirtualMachineItem(UIVirtualMachineItemType_CloudFake) 39 , m_enmMachineState(KCloudMachineState_Invalid) 39 40 , m_enmFakeCloudItemState(UIFakeCloudVirtualMachineItemState_Loading) 40 41 , m_pTask(0) … … 46 47 : UIVirtualMachineItem(UIVirtualMachineItemType_CloudReal) 47 48 , m_comCloudMachine(comCloudMachine) 49 , m_enmMachineState(KCloudMachineState_Invalid) 48 50 , m_enmFakeCloudItemState(UIFakeCloudVirtualMachineItemState_NotApplicable) 49 51 , m_pTask(0) … … 94 96 95 97 /* Determine VM states: */ 96 m_enmMachineState = K MachineState_PoweredOff;98 m_enmMachineState = KCloudMachineState_Stopped; 97 99 m_strMachineStateName = gpConverter->toString(m_enmMachineState); 98 100 switch (m_enmFakeCloudItemState) … … 133 135 134 136 /* Determine VM states: */ 135 m_enmMachineState = m_fAccessible ? m_comCloudMachine.GetState() : KMachineState_PoweredOff;137 m_enmMachineState = m_fAccessible ? toCloudMachineState(m_comCloudMachine.GetState()) : KCloudMachineState_Stopped; 136 138 m_strMachineStateName = gpConverter->toString(m_enmMachineState); 137 139 m_machineStateIcon = gpConverter->toIcon(m_enmMachineState); … … 183 185 bool UIVirtualMachineItemCloud::isItemSaved() const 184 186 { 187 return false; 188 } 189 190 bool UIVirtualMachineItemCloud::isItemPoweredOff() const 191 { 185 192 return accessible() 186 && machineState() == KMachineState_Saved; 187 } 188 189 bool UIVirtualMachineItemCloud::isItemPoweredOff() const 190 { 191 return accessible() 192 && ( machineState() == KMachineState_PoweredOff 193 || machineState() == KMachineState_Saved 194 || machineState() == KMachineState_Teleported 195 || machineState() == KMachineState_Aborted); 193 && ( machineState() == KCloudMachineState_Stopped 194 || machineState() == KCloudMachineState_Terminated); 196 195 } 197 196 … … 205 204 { 206 205 return accessible() 207 && ( machineState() == KMachineState_Running 208 || machineState() == KMachineState_Teleporting 209 || machineState() == KMachineState_LiveSnapshotting); 206 && machineState() == KCloudMachineState_Running; 210 207 } 211 208 … … 217 214 bool UIVirtualMachineItemCloud::isItemPaused() const 218 215 { 219 return accessible() 220 && ( machineState() == KMachineState_Paused 221 || machineState() == KMachineState_TeleportingPausedVM); 216 return false; 222 217 } 223 218 224 219 bool UIVirtualMachineItemCloud::isItemStuck() const 225 220 { 226 return accessible() 227 && machineState() == KMachineState_Stuck; 221 return false; 228 222 } 229 223 … … 309 303 emit sigStateChange(); 310 304 } 305 306 /* static */ 307 KCloudMachineState UIVirtualMachineItemCloud::toCloudMachineState(KMachineState enmState) 308 { 309 switch (enmState) 310 { 311 case KMachineState_Starting: return KCloudMachineState_Starting; 312 case KMachineState_Running: return KCloudMachineState_Running; 313 case KMachineState_Stopping: return KCloudMachineState_Stopping; 314 case KMachineState_PoweredOff: return KCloudMachineState_Stopped; 315 default: return KCloudMachineState_Stopped; 316 } 317 } -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualMachineItemCloud.h
r84182 r84189 59 59 /** @name Data attributes. 60 60 * @{ */ 61 /** Returns cached machine state. */ 62 KCloudMachineState machineState() const { return m_enmMachineState; } 63 61 64 /** Defines fake cloud item @a enmState. */ 62 65 void setFakeCloudItemState(UIFakeCloudVirtualMachineItemState enmState); … … 122 125 private: 123 126 127 /** Temporary! Converts state from KMachineState to KCloudMachineState. */ 128 static KCloudMachineState toCloudMachineState(KMachineState enmState); 129 124 130 /** @name Arguments. 125 131 * @{ */ … … 130 136 /** @name Data attributes. 131 137 * @{ */ 138 /** Holds cached machine state. */ 139 KCloudMachineState m_enmMachineState; 140 132 141 /** Holds fake cloud item state. */ 133 142 UIFakeCloudVirtualMachineItemState m_enmFakeCloudItemState; -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualMachineItemLocal.cpp
r84102 r84189 43 43 , m_comMachine(comMachine) 44 44 , m_cSnaphot(0) 45 , m_enmMachineState(KMachineState_Null) 45 46 , m_enmSessionState(KSessionState_Null) 46 47 { -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualMachineItemLocal.h
r84102 r84189 67 67 /** @name State attributes. 68 68 * @{ */ 69 /** Returns cached machine state. */ 70 KMachineState machineState() const { return m_enmMachineState; } 69 71 /** Returns cached session state. */ 70 72 KSessionState sessionState() const { return m_enmSessionState; } … … 148 150 /** @name State attributes. 149 151 * @{ */ 152 /** Holds cached machine state. */ 153 KMachineState m_enmMachineState; 150 154 /** Holds cached session state. */ 151 155 KSessionState m_enmSessionState; -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemMachine.cpp
r84188 r84189 97 97 98 98 /* Acquire local machine state: */ 99 const KMachineState enmState = cache()->machineState(); 99 AssertPtrReturn(cache()->toLocal(), true); 100 const KMachineState enmState = cache()->toLocal()->machineState(); 100 101 return enmState != KMachineState_PoweredOff 101 102 && enmState != KMachineState_Saved
Note:
See TracChangeset
for help on using the changeset viewer.