Changeset 83151 in vbox
- Timestamp:
- Feb 25, 2020 1:06:21 PM (5 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICloudMachine.cpp
r83146 r83151 30 30 , m_strId(strId) 31 31 , m_strName(strName) 32 , m_fAccessible(true) 33 , m_strOsType("Other") 34 , m_iMemorySize(0) 35 , m_iCpuCount(0) 32 36 { 33 37 //printf("Data for machine with id = {%s} is created\n", m_strId.toUtf8().constData()); … … 39 43 , m_strId(other.m_strId) 40 44 , m_strName(other.m_strName) 45 , m_fAccessible(other.m_fAccessible) 46 , m_strOsType(other.m_strOsType) 47 , m_iMemorySize(other.m_iMemorySize) 48 , m_iCpuCount(other.m_iCpuCount) 41 49 { 42 50 //printf("Data for machine with id = {%s} is copied\n", m_strId.toUtf8().constData()); -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICloudMachine.h
r83148 r83151 57 57 /** Holds the cloud VM name. */ 58 58 const QString m_strName; 59 60 /** Holds whether cloud VM is accessible. */ 61 bool m_fAccessible; 62 63 /** Holds the cloud VM OS type. */ 64 QString m_strOsType; 65 /** Holds the cloud VM memory size. */ 66 int m_iMemorySize; 67 /** Holds the cloud VM CPU count. */ 68 int m_iCpuCount; 59 69 }; 60 70 … … 90 100 QString name() const { return d->m_strName; } 91 101 102 /** Returns whether cloud VM is accessible. */ 103 bool isAccessible() const { return d->m_fAccessible; } 104 105 /** Returns cloud VM OS type. */ 106 QString osType() const { return d->m_strOsType; } 107 /** Returns cloud VM memory size. */ 108 int memorySize() const { return d->m_iMemorySize; } 109 /** Returns cloud VM CPU count. */ 110 int cpuCount() const { return d->m_iCpuCount; } 111 92 112 private: 93 113 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDetailsGenerator.cpp
r82968 r83151 22 22 /* GUI includes: */ 23 23 #include "UIBootOrderEditor.h" 24 #include "UICloudMachine.h" 24 25 #include "UIConverter.h" 25 26 #include "UIDetailsGenerator.h" … … 122 123 } 123 124 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.isAccessible()) 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.name()); 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 return table; 150 } 151 124 152 UITextTable UIDetailsGenerator::generateMachineInformationSystem(CMachine &comMachine, 125 153 const UIExtraDataMetaDefs::DetailsElementOptionTypeSystem &fOptions) … … 246 274 } 247 275 276 UITextTable UIDetailsGenerator::generateMachineInformationSystem(UICloudMachine &guiCloudMachine, 277 const UIExtraDataMetaDefs::DetailsElementOptionTypeSystem &fOptions) 278 { 279 UITextTable table; 280 281 if (guiCloudMachine.isNull()) 282 return table; 283 284 if (!guiCloudMachine.isAccessible()) 285 { 286 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString()); 287 return table; 288 } 289 290 /* Base memory: */ 291 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_RAM) 292 table << UITextTableLine(QApplication::translate("UIDetails", "Base Memory", "details (system)"), 293 QApplication::translate("UIDetails", "%1 MB").arg(guiCloudMachine.memorySize())); 294 295 /* Processors: */ 296 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_CPUCount) 297 table << UITextTableLine(QApplication::translate("UIDetails", "Processors", "details (system)"), 298 QString::number(guiCloudMachine.cpuCount())); 299 300 return table; 301 } 248 302 249 303 UITextTable UIDetailsGenerator::generateMachineInformationDisplay(CMachine &comMachine, -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDetailsGenerator.h
r82968 r83151 27 27 28 28 /* Forward declarations: */ 29 class UICloudMachine; 29 30 class CMachine; 30 31 … … 35 36 const UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral &fOptions); 36 37 38 SHARED_LIBRARY_STUFF UITextTable generateMachineInformationGeneral(UICloudMachine &guiCloudMachine, 39 const UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral &fOptions); 40 37 41 SHARED_LIBRARY_STUFF UITextTable generateMachineInformationSystem(CMachine &comMachine, 42 const UIExtraDataMetaDefs::DetailsElementOptionTypeSystem &fOptions); 43 44 SHARED_LIBRARY_STUFF UITextTable generateMachineInformationSystem(UICloudMachine &guiCloudMachine, 38 45 const UIExtraDataMetaDefs::DetailsElementOptionTypeSystem &fOptions); 39 46 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElements.cpp
r82998 r83151 22 22 23 23 /* GUI includes: */ 24 #include "UICloudMachine.h" 24 25 #include "UICommon.h" 25 26 #include "UIConverter.h" … … 52 53 #include "CVRDEServer.h" 53 54 54 UIDetailsUpdateTask::UIDetailsUpdateTask(const CMachine & machine)55 UIDetailsUpdateTask::UIDetailsUpdateTask(const CMachine &comMachine) 55 56 : UITask(UITask::Type_DetailsPopulation) 56 57 { 57 58 /* Store machine as property: */ 58 setProperty("machine", QVariant::fromValue(machine)); 59 setProperty("machine", QVariant::fromValue(comMachine)); 60 } 61 62 UIDetailsUpdateTask::UIDetailsUpdateTask(const UICloudMachine &guiCloudMachine) 63 : UITask(UITask::Type_DetailsPopulation) 64 { 65 /* Store cloud machine as property: */ 66 setProperty("cloudMachine", QVariant::fromValue(guiCloudMachine)); 59 67 } 60 68 … … 235 243 } 236 244 245 void UIDetailsUpdateTaskGeneralCloud::run() 246 { 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); 254 setProperty("table", QVariant::fromValue(table)); 255 } 256 237 257 UITask *UIDetailsElementGeneral::createUpdateTask() 238 258 { 239 return new UIDetailsUpdateTaskGeneral(machine(), model()->optionsGeneral()); 259 return isLocal() 260 ? static_cast<UITask*>(new UIDetailsUpdateTaskGeneral(machine(), model()->optionsGeneral())) 261 : static_cast<UITask*>(new UIDetailsUpdateTaskGeneralCloud(cloudMachine(), model()->optionsGeneral())); 240 262 } 241 263 … … 253 275 } 254 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 255 289 UITask *UIDetailsElementSystem::createUpdateTask() 256 290 { 257 return new UIDetailsUpdateTaskSystem(machine(), model()->optionsSystem()); 291 return isLocal() 292 ? static_cast<UITask*>(new UIDetailsUpdateTaskSystem(machine(), model()->optionsSystem())) 293 : static_cast<UITask*>(new UIDetailsUpdateTaskSystemCloud(cloudMachine(), model()->optionsSystem())); 258 294 } 259 295 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElements.h
r82998 r83151 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 44 }; 43 45 … … 136 138 }; 137 139 140 /** UITask extension used as update task for the details-element type 'General' of cloud VM. */ 141 class UIDetailsUpdateTaskGeneralCloud : public UIDetailsUpdateTask 142 { 143 Q_OBJECT; 144 145 public: 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) {} 150 151 private: 152 153 /** Contains update task body. */ 154 void run(); 155 156 /** Holds the options. */ 157 UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral m_fOptions; 158 }; 159 138 160 /** UIDetailsElementInterface extension for the details-element type 'General'. */ 139 161 class UIDetailsElementGeneral : public UIDetailsElementInterface … … 175 197 }; 176 198 199 /** UITask extension used as update task for the details-element type 'System' of cloud VM. */ 200 class UIDetailsUpdateTaskSystemCloud : public UIDetailsUpdateTask 201 { 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 177 219 /** UIDetailsElementInterface extension for the details-element type 'System'. */ 178 220 class UIDetailsElementSystem : public UIDetailsElementInterface
Note:
See TracChangeset
for help on using the changeset viewer.