Changeset 83719 in vbox for trunk/src/VBox
- Timestamp:
- Apr 16, 2020 4:30:01 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 137232
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDetailsGenerator.cpp
r83288 r83719 22 22 /* GUI includes: */ 23 23 #include "UIBootOrderEditor.h" 24 #include "UICloudMachine.h"25 24 #include "UIConverter.h" 26 25 #include "UIDetailsGenerator.h" … … 31 30 #include "COMEnums.h" 32 31 #include "CAudioAdapter.h" 32 #include "CBooleanFormValue.h" 33 #include "CChoiceFormValue.h" 34 #include "CCloudMachine.h" 35 #include "CForm.h" 36 #include "CFormValue.h" 33 37 #include "CGraphicsAdapter.h" 34 38 #include "CMachine.h" 35 39 #include "CMediumAttachment.h" 36 40 #include "CNetworkAdapter.h" 41 #include "CProgress.h" 42 #include "CRangedIntegerFormValue.h" 37 43 #include "CRecordingScreenSettings.h" 38 44 #include "CRecordingSettings.h" … … 40 46 #include "CSharedFolder.h" 41 47 #include "CStorageController.h" 48 #include "CStringFormValue.h" 42 49 #include "CSystemProperties.h" 43 50 #include "CUSBController.h" … … 45 52 #include "CUSBDeviceFilters.h" 46 53 #include "CVRDEServer.h" 54 55 /* VirtualBox interface declarations: */ 56 #include <VBox/com/VirtualBox.h> 57 47 58 48 59 UITextTable UIDetailsGenerator::generateMachineInformationGeneral(CMachine &comMachine, … … 123 134 } 124 135 125 UITextTable UIDetailsGenerator::generateMachineInformationGeneral(UICloudMachine &guiCloudMachine, 126 const UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral &fOptions) 127 { 128 UITextTable table; 129 130 if (guiCloudMachine.isNull()) 131 return table; 132 133 if (!guiCloudMachine.accessible()) 134 { 135 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString()); 136 return table; 137 } 138 139 /* Name: */ 140 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_Name) 141 table << UITextTableLine(QApplication::translate("UIDetails", "Name", "details (general)"), 142 guiCloudMachine.instanceName()); 143 144 /* Operating system: */ 145 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_OS) 146 table << UITextTableLine(QApplication::translate("UIDetails", "Operating System", "details (general)"), 147 uiCommon().vmGuestOSTypeDescription(guiCloudMachine.osType())); 148 149 /* Domain: */ 150 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_Location) 151 { 152 const QString strDomain = guiCloudMachine.domain(); 153 const QString strResult = !strDomain.isEmpty() 154 ? strDomain 155 : QApplication::translate("UIDetails", "Checking ...", "details"); 156 table << UITextTableLine(QApplication::translate("UIDetails", "Domain", "details (general)"), strResult); 136 UITextTable UIDetailsGenerator::generateMachineInformationGeneral(CCloudMachine &comCloudMachine, 137 const UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral &) 138 { 139 UITextTable table; 140 141 if (comCloudMachine.isNull()) 142 return table; 143 144 if (!comCloudMachine.GetAccessible()) 145 { 146 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString()); 147 return table; 148 } 149 150 // WORKAROUND: 151 // While we are waiting for GetDetailsForm implementation we will be using GetSettingsForm. 152 // This requires to wait for progress to complete and handle out all possible value types. 153 CForm comForm; 154 CProgress comProgress = comCloudMachine.GetSettingsForm(comForm); 155 /* Ignore cloud machine errors: */ 156 if (comCloudMachine.isOk()) 157 { 158 /* Wait for progress to complete: */ 159 comProgress.WaitForCompletion(-1); 160 /* Ignore progress errors: */ 161 if (comProgress.isOk() && comProgress.GetResultCode() == 0) 162 { 163 /* For each form value: */ 164 QVector<CFormValue> values = comForm.GetValues(); 165 foreach (const CFormValue &comIteratedValue, values) 166 { 167 /* Handle possible value type: */ 168 switch (comIteratedValue.GetType()) 169 { 170 case KFormValueType_Boolean: 171 { 172 CBooleanFormValue comValue(comIteratedValue); 173 const bool fBool = comValue.GetSelected(); 174 table << UITextTableLine(comValue.GetLabel(), 175 fBool ? QApplication::translate("UIDetails", "Enabled", "details (cloud value)") 176 : QApplication::translate("UIDetails", "Disabled", "details (cloud value)")); 177 break; 178 } 179 case KFormValueType_String: 180 { 181 CStringFormValue comValue(comIteratedValue); 182 table << UITextTableLine(comValue.GetLabel(), comValue.GetString()); 183 break; 184 } 185 case KFormValueType_Choice: 186 { 187 CChoiceFormValue comValue(comIteratedValue); 188 const QVector<QString> possibleValues = comValue.GetValues(); 189 const int iCurrentIndex = comValue.GetSelectedIndex(); 190 table << UITextTableLine(comValue.GetLabel(), possibleValues.at(iCurrentIndex)); 191 break; 192 } 193 case KFormValueType_RangedInteger: 194 { 195 CRangedIntegerFormValue comValue(comIteratedValue); 196 table << UITextTableLine(comValue.GetLabel(), 197 QString("%1 %2").arg(comValue.GetInteger()).arg(comValue.GetSuffix())); 198 break; 199 } 200 default: 201 break; 202 } 203 } 204 } 157 205 } 158 206 … … 279 327 table << UITextTableLine(QApplication::translate("UIDetails", "Acceleration", "details (system)"), 280 328 acceleration.join(", ")); 281 }282 283 return table;284 }285 286 UITextTable UIDetailsGenerator::generateMachineInformationSystem(UICloudMachine &guiCloudMachine,287 const UIExtraDataMetaDefs::DetailsElementOptionTypeSystem &fOptions)288 {289 UITextTable table;290 291 if (guiCloudMachine.isNull())292 return table;293 294 if (!guiCloudMachine.accessible())295 {296 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString());297 return table;298 }299 300 /* Shape: */301 {302 const QString strShape = guiCloudMachine.shape();303 const QString strResult = !strShape.isEmpty()304 ? strShape305 : QApplication::translate("UIDetails", "Checking ...", "details");306 table << UITextTableLine(QApplication::translate("UIDetails", "Shape", "details (system)"), strResult);307 }308 309 /* Base memory: */310 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_RAM)311 {312 const int iMemorySize = guiCloudMachine.memorySize();313 const QString strResult = iMemorySize > 0314 ? QApplication::translate("UIDetails", "%1 MB").arg(iMemorySize)315 : QApplication::translate("UIDetails", "Checking ...", "details");316 table << UITextTableLine(QApplication::translate("UIDetails", "Base Memory", "details (system)"), strResult);317 }318 319 /* Processors: */320 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_CPUCount)321 {322 const int cCpuCount = guiCloudMachine.cpuCount();323 const QString strResult = cCpuCount > 0324 ? QString::number(cCpuCount)325 : QApplication::translate("UIDetails", "Checking ...", "details");326 table << UITextTableLine(QApplication::translate("UIDetails", "Processors", "details (system)"), strResult);327 }328 329 /* Booting firmware: */330 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_Firmware)331 {332 const QString strBottingFirmware = guiCloudMachine.bootingFirmware();333 const QString strResult = !strBottingFirmware.isEmpty()334 ? strBottingFirmware335 : QApplication::translate("UIDetails", "Checking ...", "details");336 table << UITextTableLine(QApplication::translate("UIDetails", "Booting Firmware", "details (system)"), strResult);337 329 } 338 330 … … 559 551 if (table.isEmpty()) 560 552 table << UITextTableLine(QApplication::translate("UIDetails", "Not Attached", "details (storage)"), QString()); 561 562 return table;563 }564 565 UITextTable UIDetailsGenerator::generateMachineInformationStorage(UICloudMachine &guiCloudMachine,566 const UIExtraDataMetaDefs::DetailsElementOptionTypeStorage &fOptions)567 {568 UITextTable table;569 570 if (guiCloudMachine.isNull())571 return table;572 573 if (!guiCloudMachine.accessible())574 {575 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString());576 return table;577 }578 579 /* Image: */580 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeStorage_HardDisks)581 {582 const QString strImageName = guiCloudMachine.imageName();583 const QString strImageSize = guiCloudMachine.imageSize();584 const QString strResult = !strImageName.isEmpty() && !strImageSize.isEmpty()585 ? QString("%1 (%2)").arg(strImageName, strImageSize)586 : QApplication::translate("UIDetails", "Checking ...", "details");587 table << UITextTableLine(QApplication::translate("UIDetails", "Image", "details (storage)"), strResult);588 }589 553 590 554 return table; -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDetailsGenerator.h
r83191 r83719 27 27 28 28 /* Forward declarations: */ 29 class UICloudMachine;29 class CCloudMachine; 30 30 class CMachine; 31 31 … … 36 36 const UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral &fOptions); 37 37 38 SHARED_LIBRARY_STUFF UITextTable generateMachineInformationGeneral( UICloudMachine &guiCloudMachine,38 SHARED_LIBRARY_STUFF UITextTable generateMachineInformationGeneral(CCloudMachine &comCloudMachine, 39 39 const UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral &fOptions); 40 40 41 41 SHARED_LIBRARY_STUFF UITextTable generateMachineInformationSystem(CMachine &comMachine, 42 const UIExtraDataMetaDefs::DetailsElementOptionTypeSystem &fOptions);43 44 SHARED_LIBRARY_STUFF UITextTable generateMachineInformationSystem(UICloudMachine &guiCloudMachine,45 42 const UIExtraDataMetaDefs::DetailsElementOptionTypeSystem &fOptions); 46 43 … … 51 48 const UIExtraDataMetaDefs::DetailsElementOptionTypeStorage &fOptions, 52 49 bool fLink = true); 53 54 SHARED_LIBRARY_STUFF UITextTable generateMachineInformationStorage(UICloudMachine &guiCloudMachine,55 const UIExtraDataMetaDefs::DetailsElementOptionTypeStorage &fOptions);56 50 57 51 SHARED_LIBRARY_STUFF UITextTable generateMachineInformationAudio(CMachine &comMachine, -
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElement.cpp
r83149 r83719 305 305 } 306 306 307 const UICloudMachine &UIDetailsElement::cloudMachine()307 const CCloudMachine &UIDetailsElement::cloudMachine() 308 308 { 309 309 return m_pSet->cloudMachine(); -
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElement.h
r83149 r83719 34 34 class QStateMachine; 35 35 class QTextLayout; 36 class UICloudMachine;37 36 class UIDetailsSet; 38 37 class UIGraphicsRotatorButton; 39 38 class UIGraphicsTextPane; 39 class CCloudMachine; 40 40 class CMachine; 41 41 … … 161 161 const CMachine &machine(); 162 162 /** Returns cached cloud machine reference. */ 163 const UICloudMachine &cloudMachine();163 const CCloudMachine &cloudMachine(); 164 164 165 165 /** Returns whether element is of local type. */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElements.cpp
r83191 r83719 22 22 23 23 /* GUI includes: */ 24 #include "UICloudMachine.h"25 24 #include "UICommon.h" 26 25 #include "UIConverter.h" … … 38 37 #include "COMEnums.h" 39 38 #include "CAudioAdapter.h" 39 #include "CCloudMachine.h" 40 40 #include "CMachine.h" 41 41 #include "CMedium.h" … … 60 60 } 61 61 62 UIDetailsUpdateTask::UIDetailsUpdateTask(const UICloudMachine &guiCloudMachine)62 UIDetailsUpdateTask::UIDetailsUpdateTask(const CCloudMachine &comCloudMachine) 63 63 : UITask(UITask::Type_DetailsPopulation) 64 64 { 65 65 /* Store cloud machine as property: */ 66 setProperty("cloudMachine", QVariant::fromValue( guiCloudMachine));66 setProperty("cloudMachine", QVariant::fromValue(comCloudMachine)); 67 67 } 68 68 … … 246 246 { 247 247 /* Acquire corresponding machine: */ 248 UICloudMachine guiCloudMachine = property("cloudMachine").value<UICloudMachine>();249 if ( guiCloudMachine.isNull())250 return; 251 252 /* Generate details table: */ 253 UITextTable table = UIDetailsGenerator::generateMachineInformationGeneral( guiCloudMachine, m_fOptions);248 CCloudMachine comCloudMachine = property("cloudMachine").value<CCloudMachine>(); 249 if (comCloudMachine.isNull()) 250 return; 251 252 /* Generate details table: */ 253 UITextTable table = UIDetailsGenerator::generateMachineInformationGeneral(comCloudMachine, m_fOptions); 254 254 setProperty("table", QVariant::fromValue(table)); 255 255 } … … 275 275 } 276 276 277 void UIDetailsUpdateTaskSystemCloud::run()278 {279 /* Acquire corresponding machine: */280 UICloudMachine guiCloudMachine = property("cloudMachine").value<UICloudMachine>();281 if (guiCloudMachine.isNull())282 return;283 284 /* Generate details table: */285 UITextTable table = UIDetailsGenerator::generateMachineInformationSystem(guiCloudMachine, m_fOptions);286 setProperty("table", QVariant::fromValue(table));287 }288 289 277 UITask *UIDetailsElementSystem::createUpdateTask() 290 278 { 291 return isLocal() 292 ? static_cast<UITask*>(new UIDetailsUpdateTaskSystem(machine(), model()->optionsSystem())) 293 : static_cast<UITask*>(new UIDetailsUpdateTaskSystemCloud(cloudMachine(), model()->optionsSystem())); 279 return new UIDetailsUpdateTaskSystem(machine(), model()->optionsSystem()); 294 280 } 295 281 … … 325 311 } 326 312 327 void UIDetailsUpdateTaskStorageCloud::run()328 {329 /* Acquire corresponding machine: */330 UICloudMachine guiCloudMachine = property("cloudMachine").value<UICloudMachine>();331 if (guiCloudMachine.isNull())332 return;333 334 /* Generate details table: */335 UITextTable table = UIDetailsGenerator::generateMachineInformationStorage(guiCloudMachine, m_fOptions);336 setProperty("table", QVariant::fromValue(table));337 }338 339 313 UITask *UIDetailsElementStorage::createUpdateTask() 340 314 { 341 return isLocal() 342 ? static_cast<UITask*>(new UIDetailsUpdateTaskStorage(machine(), model()->optionsStorage())) 343 : static_cast<UITask*>(new UIDetailsUpdateTaskStorageCloud(cloudMachine(), model()->optionsStorage())); 315 return new UIDetailsUpdateTaskStorage(machine(), model()->optionsStorage()); 344 316 } 345 317 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElements.h
r83191 r83719 40 40 /** Constructs update task taking @a comMachine as data. */ 41 41 UIDetailsUpdateTask(const CMachine &comMachine); 42 /** Constructs update task taking @a guiCloudMachine as data. */43 UIDetailsUpdateTask(const UICloudMachine &guiCloudMachine);42 /** Constructs update task taking @a comCloudMachine as data. */ 43 UIDetailsUpdateTask(const CCloudMachine &comCloudMachine); 44 44 }; 45 45 … … 145 145 public: 146 146 147 /** Constructs update task passing @a guiCloudMachine to the base-class. */148 UIDetailsUpdateTaskGeneralCloud(const UICloudMachine &guiCloudMachine, UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral fOptions)149 : UIDetailsUpdateTask( guiCloudMachine), m_fOptions(fOptions) {}147 /** Constructs update task passing @a comCloudMachine to the base-class. */ 148 UIDetailsUpdateTaskGeneralCloud(const CCloudMachine &comCloudMachine, UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral fOptions) 149 : UIDetailsUpdateTask(comCloudMachine), m_fOptions(fOptions) {} 150 150 151 151 private: … … 197 197 }; 198 198 199 /** UITask extension used as update task for the details-element type 'System' of cloud VM. */200 class UIDetailsUpdateTaskSystemCloud : public UIDetailsUpdateTask201 {202 Q_OBJECT;203 204 public:205 206 /** Constructs update task passing @a guiCloudMachine to the base-class. */207 UIDetailsUpdateTaskSystemCloud(const UICloudMachine &guiCloudMachine, UIExtraDataMetaDefs::DetailsElementOptionTypeSystem fOptions)208 : UIDetailsUpdateTask(guiCloudMachine), m_fOptions(fOptions) {}209 210 private:211 212 /** Contains update task body. */213 void run();214 215 /** Holds the options. */216 UIExtraDataMetaDefs::DetailsElementOptionTypeSystem m_fOptions;217 };218 219 199 /** UIDetailsElementInterface extension for the details-element type 'System'. */ 220 200 class UIDetailsElementSystem : public UIDetailsElementInterface … … 295 275 }; 296 276 297 /** UITask extension used as update task for the details-element type 'Storage' of cloud VM. */298 class UIDetailsUpdateTaskStorageCloud : public UIDetailsUpdateTask299 {300 Q_OBJECT;301 302 public:303 304 /** Constructs update task passing @a guiCloudMachine to the base-class. */305 UIDetailsUpdateTaskStorageCloud(const UICloudMachine &guiCloudMachine, UIExtraDataMetaDefs::DetailsElementOptionTypeStorage fOptions)306 : UIDetailsUpdateTask(guiCloudMachine), m_fOptions(fOptions) {}307 308 private:309 310 /** Contains update task body. */311 void run();312 313 /** Holds the options. */314 UIExtraDataMetaDefs::DetailsElementOptionTypeStorage m_fOptions;315 };316 317 277 /** UIDetailsElementInterface extension for the details-element type 'Storage'. */ 318 278 class UIDetailsElementStorage : public UIDetailsElementInterface -
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsSet.cpp
r83654 r83719 85 85 { 86 86 /* Get local machine: */ 87 m_ machine = m_pMachineItem->toLocal()->machine();87 m_comMachine = m_pMachineItem->toLocal()->machine(); 88 88 89 89 /* Compose a list of types to build: */ … … 97 97 98 98 /* Take into account USB controller restrictions: */ 99 const CUSBDeviceFilters &filters = m_ machine.GetUSBDeviceFilters();100 if (filters.isNull() || !m_ machine.GetUSBProxyAvailable())99 const CUSBDeviceFilters &filters = m_comMachine.GetUSBDeviceFilters(); 100 if (filters.isNull() || !m_comMachine.GetUSBProxyAvailable()) 101 101 m_settings.remove(DetailsElementType_USB); 102 102 … … 106 106 { 107 107 /* Get cloud machine: */ 108 // m_cloudMachine = m_pMachineItem->toCloud()->machine();108 m_comCloudMachine = m_pMachineItem->toCloud()->machine(); 109 109 110 110 /* Compose a list of types to build: */ 111 types << DetailsElementType_General << DetailsElementType_System << DetailsElementType_Storage;111 types << DetailsElementType_General; 112 112 113 113 break; … … 565 565 { 566 566 /* Is this our VM changed? */ 567 if (m_ machine.GetId() != uId)567 if (m_comMachine.GetId() != uId) 568 568 return; 569 569 … … 575 575 { 576 576 /* Is this our VM changed? */ 577 if (m_ machine.GetId() != uId)577 if (m_comMachine.GetId() != uId) 578 578 return; 579 579 … … 587 587 const UIMedium guiMedium = uiCommon().medium(uId); 588 588 if ( guiMedium.isNull() 589 || !guiMedium.machineIds().contains(m_ machine.GetId()))589 || !guiMedium.machineIds().contains(m_comMachine.GetId())) 590 590 return; 591 591 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsSet.h
r83352 r83719 23 23 24 24 /* GUI includes: */ 25 #include "UICloudMachine.h"26 25 #include "UIDetailsItem.h" 27 26 #include "UIExtraDataDefs.h" … … 30 29 /* COM includes: */ 31 30 #include "COMEnums.h" 31 #include "CCloudMachine.h" 32 32 #include "CMachine.h" 33 33 … … 61 61 62 62 /** Returns cached machine. */ 63 const CMachine &machine() const { return m_ machine; }63 const CMachine &machine() const { return m_comMachine; } 64 64 /** Returns cached cloud machine. */ 65 const UICloudMachine &cloudMachine() const { return m_cloudMachine; }65 const CCloudMachine &cloudMachine() const { return m_comCloudMachine; } 66 66 67 67 /** Returns whether set is of local type. */ … … 204 204 205 205 /** Holds the machine reference. */ 206 CMachine m_machine;206 CMachine m_comMachine; 207 207 /** Holds the cloud machine reference. */ 208 UICloudMachine m_cloudMachine;208 CCloudMachine m_comCloudMachine; 209 209 210 210 /** Holds whether set is of local type. */
Note:
See TracChangeset
for help on using the changeset viewer.