Changeset 89713 in vbox
- Timestamp:
- Jun 15, 2021 3:30:02 PM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager/details
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElements.cpp
r89102 r89713 35 35 36 36 /* COM includes: */ 37 #include "COMEnums.h"38 37 #include "CAudioAdapter.h" 39 #include "CCloudMachine.h"40 #include "CMachine.h"41 38 #include "CMedium.h" 42 39 #include "CMediumAttachment.h" … … 55 52 UIDetailsUpdateTask::UIDetailsUpdateTask(const CMachine &comMachine) 56 53 : UITask(UITask::Type_DetailsPopulation) 57 { 58 /* Store machine as property: */ 59 setProperty("machine", QVariant::fromValue(comMachine)); 54 , m_comMachine(comMachine) 55 { 60 56 } 61 57 62 58 UIDetailsUpdateTask::UIDetailsUpdateTask(const CCloudMachine &comCloudMachine) 63 59 : UITask(UITask::Type_DetailsPopulation) 64 { 65 /* Store cloud machine as property: */ 66 setProperty("cloudMachine", QVariant::fromValue(comCloudMachine)); 60 , m_comCloudMachine(comCloudMachine) 61 { 62 } 63 64 CMachine UIDetailsUpdateTask::machine() const 65 { 66 /* Acquire copy under a proper lock: */ 67 m_machineMutex.lock(); 68 const CMachine comMachine = m_comMachine; 69 m_machineMutex.unlock(); 70 return comMachine; 71 } 72 73 CCloudMachine UIDetailsUpdateTask::cloudMachine() const 74 { 75 /* Acquire copy under a proper lock: */ 76 m_machineMutex.lock(); 77 const CCloudMachine comCloudMachine = m_comCloudMachine; 78 m_machineMutex.unlock(); 79 return comCloudMachine; 80 } 81 82 UITextTable UIDetailsUpdateTask::table() const 83 { 84 /* Acquire copy under a proper lock: */ 85 m_tableMutex.lock(); 86 const UITextTable guiTable = m_guiTable; 87 m_tableMutex.unlock(); 88 return guiTable; 89 } 90 91 void UIDetailsUpdateTask::setTable(const UITextTable &guiTable) 92 { 93 /* Assign under a proper lock: */ 94 m_tableMutex.lock(); 95 m_guiTable = guiTable; 96 m_tableMutex.unlock(); 67 97 } 68 98 … … 111 141 112 142 /* Assign new text if changed: */ 113 const UITextTable newText = pTask->property("table").value<UITextTable>();143 const UITextTable newText = qobject_cast<UIDetailsUpdateTask*>(pTask)->table(); 114 144 if (text() != newText) 115 145 setText(newText); … … 234 264 { 235 265 /* Acquire corresponding machine: */ 236 CMachine comMachine = property("machine").value<CMachine>(); 237 if (comMachine.isNull()) 238 return; 239 240 /* Generate details table: */ 241 UITextTable table = UIDetailsGenerator::generateMachineInformationGeneral(comMachine, m_fOptions); 242 setProperty("table", QVariant::fromValue(table)); 266 CMachine comMachine = machine(); 267 if (comMachine.isNull()) 268 return; 269 270 /* Generate details table: */ 271 setTable(UIDetailsGenerator::generateMachineInformationGeneral(comMachine, m_fOptions)); 243 272 } 244 273 … … 246 275 { 247 276 /* Acquire corresponding machine: */ 248 CCloudMachine comCloudMachine = property("cloudMachine").value<CCloudMachine>();277 CCloudMachine comCloudMachine = cloudMachine(); 249 278 if (comCloudMachine.isNull()) 250 279 return; 251 280 252 281 /* Generate details table: */ 253 UITextTable table = UIDetailsGenerator::generateMachineInformationGeneral(comCloudMachine, m_fOptions); 254 setProperty("table", QVariant::fromValue(table)); 282 setTable(UIDetailsGenerator::generateMachineInformationGeneral(comCloudMachine, m_fOptions)); 255 283 } 256 284 … … 266 294 { 267 295 /* Acquire corresponding machine: */ 268 CMachine comMachine = property("machine").value<CMachine>(); 269 if (comMachine.isNull()) 270 return; 271 272 /* Generate details table: */ 273 UITextTable table = UIDetailsGenerator::generateMachineInformationSystem(comMachine, m_fOptions); 274 setProperty("table", QVariant::fromValue(table)); 296 CMachine comMachine = machine(); 297 if (comMachine.isNull()) 298 return; 299 300 /* Generate details table: */ 301 setTable(UIDetailsGenerator::generateMachineInformationSystem(comMachine, m_fOptions)); 275 302 } 276 303 … … 284 311 { 285 312 /* Acquire corresponding machine: */ 286 CMachine comMachine = property("machine").value<CMachine>(); 287 if (comMachine.isNull()) 288 return; 289 290 /* Generate details table: */ 291 UITextTable table = UIDetailsGenerator::generateMachineInformationDisplay(comMachine, m_fOptions); 292 setProperty("table", QVariant::fromValue(table)); 313 CMachine comMachine = machine(); 314 if (comMachine.isNull()) 315 return; 316 317 /* Generate details table: */ 318 setTable(UIDetailsGenerator::generateMachineInformationDisplay(comMachine, m_fOptions)); 293 319 } 294 320 … … 302 328 { 303 329 /* Acquire corresponding machine: */ 304 CMachine comMachine = property("machine").value<CMachine>(); 305 if (comMachine.isNull()) 306 return; 307 308 /* Generate details table: */ 309 UITextTable table = UIDetailsGenerator::generateMachineInformationStorage(comMachine, m_fOptions); 310 setProperty("table", QVariant::fromValue(table)); 330 CMachine comMachine = machine(); 331 if (comMachine.isNull()) 332 return; 333 334 /* Generate details table: */ 335 setTable(UIDetailsGenerator::generateMachineInformationStorage(comMachine, m_fOptions)); 311 336 } 312 337 … … 320 345 { 321 346 /* Acquire corresponding machine: */ 322 CMachine comMachine = property("machine").value<CMachine>(); 323 if (comMachine.isNull()) 324 return; 325 326 /* Generate details table: */ 327 UITextTable table = UIDetailsGenerator::generateMachineInformationAudio(comMachine, m_fOptions); 328 setProperty("table", QVariant::fromValue(table)); 347 CMachine comMachine = machine(); 348 if (comMachine.isNull()) 349 return; 350 351 /* Generate details table: */ 352 setTable(UIDetailsGenerator::generateMachineInformationAudio(comMachine, m_fOptions)); 329 353 } 330 354 … … 337 361 { 338 362 /* Acquire corresponding machine: */ 339 CMachine comMachine = property("machine").value<CMachine>(); 340 if (comMachine.isNull()) 341 return; 342 343 /* Generate details table: */ 344 UITextTable table = UIDetailsGenerator::generateMachineInformationNetwork(comMachine, m_fOptions); 345 setProperty("table", QVariant::fromValue(table)); 363 CMachine comMachine = machine(); 364 if (comMachine.isNull()) 365 return; 366 367 /* Generate details table: */ 368 setTable(UIDetailsGenerator::generateMachineInformationNetwork(comMachine, m_fOptions)); 346 369 } 347 370 … … 354 377 { 355 378 /* Acquire corresponding machine: */ 356 CMachine comMachine = property("machine").value<CMachine>(); 357 if (comMachine.isNull()) 358 return; 359 360 /* Generate details table: */ 361 UITextTable table = UIDetailsGenerator::generateMachineInformationSerial(comMachine, m_fOptions); 362 setProperty("table", QVariant::fromValue(table)); 379 CMachine comMachine = machine(); 380 if (comMachine.isNull()) 381 return; 382 383 /* Generate details table: */ 384 setTable(UIDetailsGenerator::generateMachineInformationSerial(comMachine, m_fOptions)); 363 385 } 364 386 … … 371 393 { 372 394 /* Acquire corresponding machine: */ 373 CMachine comMachine = property("machine").value<CMachine>(); 374 if (comMachine.isNull()) 375 return; 376 377 /* Generate details table: */ 378 UITextTable table = UIDetailsGenerator::generateMachineInformationUSB(comMachine, m_fOptions); 379 setProperty("table", QVariant::fromValue(table)); 395 CMachine comMachine = machine(); 396 if (comMachine.isNull()) 397 return; 398 399 /* Generate details table: */ 400 setTable(UIDetailsGenerator::generateMachineInformationUSB(comMachine, m_fOptions)); 380 401 } 381 402 … … 389 410 { 390 411 /* Acquire corresponding machine: */ 391 CMachine comMachine = property("machine").value<CMachine>(); 392 if (comMachine.isNull()) 393 return; 394 395 /* Generate details table: */ 396 UITextTable table = UIDetailsGenerator::generateMachineInformationSharedFolders(comMachine, m_fOptions); 397 setProperty("table", QVariant::fromValue(table)); 412 CMachine comMachine = machine(); 413 if (comMachine.isNull()) 414 return; 415 416 /* Generate details table: */ 417 setTable(UIDetailsGenerator::generateMachineInformationSharedFolders(comMachine, m_fOptions)); 398 418 } 399 419 … … 407 427 { 408 428 /* Acquire corresponding machine: */ 409 CMachine comMachine = property("machine").value<CMachine>(); 410 if (comMachine.isNull()) 411 return; 412 413 /* Generate details table: */ 414 UITextTable table = UIDetailsGenerator::generateMachineInformationUI(comMachine, m_fOptions); 415 setProperty("table", QVariant::fromValue(table)); 429 CMachine comMachine = machine(); 430 if (comMachine.isNull()) 431 return; 432 433 /* Generate details table: */ 434 setTable(UIDetailsGenerator::generateMachineInformationUI(comMachine, m_fOptions)); 416 435 } 417 436 … … 425 444 { 426 445 /* Acquire corresponding machine: */ 427 CMachine comMachine = property("machine").value<CMachine>(); 428 if (comMachine.isNull()) 429 return; 430 431 /* Generate details table: */ 432 UITextTable table = UIDetailsGenerator::generateMachineInformationDescription(comMachine, m_fOptions); 433 setProperty("table", QVariant::fromValue(table)); 446 CMachine comMachine = machine(); 447 if (comMachine.isNull()) 448 return; 449 450 /* Generate details table: */ 451 setTable(UIDetailsGenerator::generateMachineInformationDescription(comMachine, m_fOptions)); 434 452 } 435 453 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElements.h
r89101 r89713 26 26 #include "UITask.h" 27 27 28 /* COM includes: */ 29 #include "COMEnums.h" 30 #include "CCloudMachine.h" 31 #include "CMachine.h" 32 28 33 /* Forward declarations: */ 29 34 class UIMachinePreview; … … 42 47 /** Constructs update task taking @a comCloudMachine as data. */ 43 48 UIDetailsUpdateTask(const CCloudMachine &comCloudMachine); 49 50 /** Returns the machine. */ 51 CMachine machine() const; 52 /** Returns the cloud machine. */ 53 CCloudMachine cloudMachine() const; 54 55 /** Returns the table. */ 56 UITextTable table() const; 57 /** Defines the @a guiTable. */ 58 void setTable(const UITextTable &guiTable); 59 60 private: 61 62 /** Holds the mutex to access m_comMachine and m_comCloudMachine members. */ 63 mutable QMutex m_machineMutex; 64 /** Holds the machine being processed. */ 65 CMachine m_comMachine; 66 /** Holds the cloud machine being processed. */ 67 CCloudMachine m_comCloudMachine; 68 69 /** Holds the mutex to access m_guiTable member. */ 70 mutable QMutex m_tableMutex; 71 /** Holds the machine being filled. */ 72 UITextTable m_guiTable; 44 73 }; 45 74
Note:
See TracChangeset
for help on using the changeset viewer.