Changeset 77427 in vbox
- Timestamp:
- Feb 22, 2019 11:11:17 AM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 3 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r77311 r77427 1053 1053 src/manager/details/UIDetailsElement.cpp \ 1054 1054 src/manager/details/UIDetailsElements.cpp \ 1055 src/manager/details/UIDetailsGenerator.cpp \ 1055 1056 src/manager/details/UIMachinePreview.cpp \ 1056 1057 src/manager/tools/UITools.cpp \ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElements.cpp
r76606 r77427 23 23 /* GUI includes: */ 24 24 #include "UIDetailsElements.h" 25 #include "UIDetailsGenerator.h" 25 26 #include "UIDetailsModel.h" 26 27 #include "UIMachinePreview.h" … … 50 51 #include "CMedium.h" 51 52 52 53 53 UIDetailsUpdateTask::UIDetailsUpdateTask(const CMachine &machine) 54 54 : UITask(UITask::Type_DetailsPopulation) … … 229 229 return; 230 230 231 /* Prepare table: */ 232 UITextTable table; 233 234 /* Gather information: */ 235 if (comMachine.GetAccessible()) 236 { 237 /* Name: */ 238 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_Name) 239 table << UITextTableLine(QApplication::translate("UIDetails", "Name", "details (general)"), comMachine.GetName()); 240 241 /* Operating system: */ 242 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_OS) 243 table << UITextTableLine(QApplication::translate("UIDetails", "Operating System", "details (general)"), 244 vboxGlobal().vmGuestOSTypeDescription(comMachine.GetOSTypeId())); 245 246 /* Settings file location: */ 247 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_Location) 248 table << UITextTableLine(QApplication::translate("UIDetails", "Settings File Location", "details (general)"), 249 QDir::toNativeSeparators(QFileInfo(comMachine.GetSettingsFilePath()).absolutePath())); 250 251 /* Groups: */ 252 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_Groups) 253 { 254 QStringList groups = comMachine.GetGroups().toList(); 255 /* Do not show groups for machine which is in root group only: */ 256 if (groups.size() == 1) 257 groups.removeAll("/"); 258 /* If group list still not empty: */ 259 if (!groups.isEmpty()) 260 { 261 /* For every group: */ 262 for (int i = 0; i < groups.size(); ++i) 263 { 264 /* Trim first '/' symbol: */ 265 QString &strGroup = groups[i]; 266 if (strGroup.startsWith("/") && strGroup != "/") 267 strGroup.remove(0, 1); 268 } 269 table << UITextTableLine(QApplication::translate("UIDetails", "Groups", "details (general)"), groups.join(", ")); 270 } 271 } 272 } 273 else 274 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString()); 275 276 /* Save the table as property: */ 231 /* Generate the table: */ 232 UITextTable table = UIDetailsGenerator::generateMachineInformationGeneral(comMachine, m_fOptions); 277 233 setProperty("table", QVariant::fromValue(table)); 278 234 } … … 292 248 293 249 /* Prepare table: */ 294 UITextTable table; 295 296 /* Gather information: */ 297 if (comMachine.GetAccessible()) 298 { 299 /* Base memory: */ 300 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_RAM) 301 table << UITextTableLine(QApplication::translate("UIDetails", "Base Memory", "details (system)"), 302 QApplication::translate("UIDetails", "%1 MB", "details").arg(comMachine.GetMemorySize())); 303 304 /* Processors: */ 305 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_CPUCount) 306 { 307 const int cCPU = comMachine.GetCPUCount(); 308 if (cCPU > 1) 309 table << UITextTableLine(QApplication::translate("UIDetails", "Processors", "details (system)"), 310 QString::number(cCPU)); 311 } 312 313 /* Execution cap: */ 314 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_CPUExecutionCap) 315 { 316 const int iCPUExecutionCap = comMachine.GetCPUExecutionCap(); 317 if (iCPUExecutionCap < 100) 318 table << UITextTableLine(QApplication::translate("UIDetails", "Execution Cap", "details (system)"), 319 QApplication::translate("UIDetails", "%1%", "details").arg(iCPUExecutionCap)); 320 } 321 322 /* Boot order: */ 323 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_BootOrder) 324 { 325 QStringList bootOrder; 326 for (ulong i = 1; i <= vboxGlobal().virtualBox().GetSystemProperties().GetMaxBootPosition(); ++i) 327 { 328 const KDeviceType enmDeviceType = comMachine.GetBootOrder(i); 329 if (enmDeviceType == KDeviceType_Null) 330 continue; 331 bootOrder << gpConverter->toString(enmDeviceType); 332 } 333 if (bootOrder.isEmpty()) 334 bootOrder << gpConverter->toString(KDeviceType_Null); 335 table << UITextTableLine(QApplication::translate("UIDetails", "Boot Order", "details (system)"), bootOrder.join(", ")); 336 } 337 338 /* Chipset type: */ 339 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_ChipsetType) 340 { 341 const KChipsetType enmChipsetType = comMachine.GetChipsetType(); 342 if (enmChipsetType == KChipsetType_ICH9) 343 table << UITextTableLine(QApplication::translate("UIDetails", "Chipset Type", "details (system)"), 344 gpConverter->toString(enmChipsetType)); 345 } 346 347 /* EFI: */ 348 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_Firmware) 349 { 350 switch (comMachine.GetFirmwareType()) 351 { 352 case KFirmwareType_EFI: 353 case KFirmwareType_EFI32: 354 case KFirmwareType_EFI64: 355 case KFirmwareType_EFIDUAL: 356 { 357 table << UITextTableLine(QApplication::translate("UIDetails", "EFI", "details (system)"), 358 QApplication::translate("UIDetails", "Enabled", "details (system/EFI)")); 359 break; 360 } 361 default: 362 { 363 // For NLS purpose: 364 QApplication::translate("UIDetails", "Disabled", "details (system/EFI)"); 365 break; 366 } 367 } 368 } 369 370 /* Acceleration: */ 371 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_Acceleration) 372 { 373 QStringList acceleration; 374 if (vboxGlobal().virtualBox().GetHost().GetProcessorFeature(KProcessorFeature_HWVirtEx)) 375 { 376 /* VT-x/AMD-V: */ 377 if (comMachine.GetHWVirtExProperty(KHWVirtExPropertyType_Enabled)) 378 { 379 acceleration << QApplication::translate("UIDetails", "VT-x/AMD-V", "details (system)"); 380 /* Nested Paging (only when hw virt is enabled): */ 381 if (comMachine.GetHWVirtExProperty(KHWVirtExPropertyType_NestedPaging)) 382 acceleration << QApplication::translate("UIDetails", "Nested Paging", "details (system)"); 383 } 384 } 385 /* PAE/NX: */ 386 if (comMachine.GetCPUProperty(KCPUPropertyType_PAE)) 387 acceleration << QApplication::translate("UIDetails", "PAE/NX", "details (system)"); 388 /* Paravirtualization provider: */ 389 switch (comMachine.GetEffectiveParavirtProvider()) 390 { 391 case KParavirtProvider_Minimal: acceleration << QApplication::translate("UIDetails", "Minimal Paravirtualization", "details (system)"); break; 392 case KParavirtProvider_HyperV: acceleration << QApplication::translate("UIDetails", "Hyper-V Paravirtualization", "details (system)"); break; 393 case KParavirtProvider_KVM: acceleration << QApplication::translate("UIDetails", "KVM Paravirtualization", "details (system)"); break; 394 default: break; 395 } 396 if (!acceleration.isEmpty()) 397 table << UITextTableLine(QApplication::translate("UIDetails", "Acceleration", "details (system)"), 398 acceleration.join(", ")); 399 } 400 } 401 else 402 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), 403 QString()); 404 250 UITextTable table = UIDetailsGenerator::generateMachineInformationSystem(comMachine, m_fOptions); 405 251 /* Save the table as property: */ 406 252 setProperty("table", QVariant::fromValue(table)); … … 421 267 422 268 /* Prepare table: */ 423 UITextTable table; 424 425 /* Gather information: */ 426 if (comMachine.GetAccessible()) 427 { 428 /* Video memory: */ 429 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_VRAM) 430 table << UITextTableLine(QApplication::translate("UIDetails", "Video Memory", "details (display)"), 431 QApplication::translate("UIDetails", "%1 MB", "details").arg(comMachine.GetVRAMSize())); 432 433 /* Screens: */ 434 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_ScreenCount) 435 { 436 const int cGuestScreens = comMachine.GetMonitorCount(); 437 if (cGuestScreens > 1) 438 table << UITextTableLine(QApplication::translate("UIDetails", "Screens", "details (display)"), 439 QString::number(cGuestScreens)); 440 } 441 442 /* Scale-factor: */ 443 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_ScaleFactor) 444 { 445 const QString strScaleFactor = comMachine.GetExtraData(UIExtraDataDefs::GUI_ScaleFactor); 446 { 447 /* Try to convert loaded data to double: */ 448 bool fOk = false; 449 double dValue = strScaleFactor.toDouble(&fOk); 450 /* Invent the default value: */ 451 if (!fOk || !dValue) 452 dValue = 1.0; 453 /* Append information: */ 454 if (dValue != 1.0) 455 table << UITextTableLine(QApplication::translate("UIDetails", "Scale-factor", "details (display)"), 456 QString::number(dValue, 'f', 2)); 457 } 458 } 459 460 /* Graphics Controller: */ 461 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_GraphicsController) 462 table << UITextTableLine(QApplication::translate("UIDetails", "Graphics Controller", "details (display)"), 463 gpConverter->toString(comMachine.GetGraphicsControllerType())); 464 465 /* Acceleration: */ 466 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_Acceleration) 467 { 468 QStringList acceleration; 469 #ifdef VBOX_WITH_VIDEOHWACCEL 470 /* 2D acceleration: */ 471 if (comMachine.GetAccelerate2DVideoEnabled()) 472 acceleration << QApplication::translate("UIDetails", "2D Video", "details (display)"); 473 #endif 474 /* 3D acceleration: */ 475 if (comMachine.GetAccelerate3DEnabled()) 476 acceleration << QApplication::translate("UIDetails", "3D", "details (display)"); 477 if (!acceleration.isEmpty()) 478 table << UITextTableLine(QApplication::translate("UIDetails", "Acceleration", "details (display)"), 479 acceleration.join(", ")); 480 } 481 482 /* Remote desktop server: */ 483 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_VRDE) 484 { 485 const CVRDEServer comServer = comMachine.GetVRDEServer(); 486 if (!comServer.isNull()) 487 { 488 if (comServer.GetEnabled()) 489 table << UITextTableLine(QApplication::translate("UIDetails", "Remote Desktop Server Port", "details (display/vrde)"), 490 comServer.GetVRDEProperty("TCP/Ports")); 491 else 492 table << UITextTableLine(QApplication::translate("UIDetails", "Remote Desktop Server", "details (display/vrde)"), 493 QApplication::translate("UIDetails", "Disabled", "details (display/vrde/VRDE server)")); 494 } 495 } 496 497 /* Recording: */ 498 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_Recording) 499 { 500 CRecordingSettings comRecordingSettings = comMachine.GetRecordingSettings(); 501 if (comRecordingSettings.GetEnabled()) 502 { 503 /* For now all screens have the same config: */ 504 const CRecordingScreenSettings comRecordingScreen0Settings = comRecordingSettings.GetScreenSettings(0); 505 506 /** @todo r=andy Refine these texts (wrt audio and/or video). */ 507 table << UITextTableLine(QApplication::translate("UIDetails", "Recording File", "details (display/recording)"), 508 comRecordingScreen0Settings.GetFilename()); 509 table << UITextTableLine(QApplication::translate("UIDetails", "Recording Attributes", "details (display/recording)"), 510 QApplication::translate("UIDetails", "Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps") 511 .arg(comRecordingScreen0Settings.GetVideoWidth()).arg(comRecordingScreen0Settings.GetVideoHeight()) 512 .arg(comRecordingScreen0Settings.GetVideoFPS()).arg(comRecordingScreen0Settings.GetVideoRate())); 513 } 514 else 515 { 516 table << UITextTableLine(QApplication::translate("UIDetails", "Recording", "details (display/recording)"), 517 QApplication::translate("UIDetails", "Disabled", "details (display/recording)")); 518 } 519 } 520 } 521 else 522 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString()); 269 UITextTable table = UIDetailsGenerator::generateMachineInformationDisplay(comMachine, m_fOptions); 523 270 524 271 /* Save the table as property: */ … … 540 287 541 288 /* Prepare table: */ 542 UITextTable table; 543 544 /* Gather information: */ 545 if (comMachine.GetAccessible()) 546 { 547 /* Iterate over all the machine controllers: */ 548 foreach (const CStorageController &comController, comMachine.GetStorageControllers()) 549 { 550 /* Add controller information: */ 551 const QString strControllerName = QApplication::translate("UIMachineSettingsStorage", "Controller: %1"); 552 table << UITextTableLine(strControllerName.arg(comController.GetName()), QString()); 553 /* Populate map (its sorted!): */ 554 QMap<StorageSlot, QString> attachmentsMap; 555 foreach (const CMediumAttachment &attachment, comMachine.GetMediumAttachmentsOfController(comController.GetName())) 556 { 557 /* Acquire device type first of all: */ 558 const KDeviceType enmDeviceType = attachment.GetType(); 559 560 /* Ignore restricted device types: */ 561 if ( ( !(m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeStorage_HardDisks) 562 && enmDeviceType == KDeviceType_HardDisk) 563 || ( !(m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeStorage_OpticalDevices) 564 && enmDeviceType == KDeviceType_DVD) 565 || ( !(m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeStorage_FloppyDevices) 566 && enmDeviceType == KDeviceType_Floppy)) 567 continue; 568 569 /* Prepare current storage slot: */ 570 const StorageSlot attachmentSlot(comController.GetBus(), attachment.GetPort(), attachment.GetDevice()); 571 AssertMsg(comController.isOk(), 572 ("Unable to acquire controller data: %s\n", 573 UIErrorString::formatRC(comController.lastRC()).toUtf8().constData())); 574 if (!comController.isOk()) 575 continue; 576 577 /* Prepare attachment information: */ 578 QString strAttachmentInfo = vboxGlobal().details(attachment.GetMedium(), false, false); 579 /* That hack makes sure 'Inaccessible' word is always bold: */ 580 { // hack 581 const QString strInaccessibleString(VBoxGlobal::tr("Inaccessible", "medium")); 582 const QString strBoldInaccessibleString(QString("<b>%1</b>").arg(strInaccessibleString)); 583 strAttachmentInfo.replace(strInaccessibleString, strBoldInaccessibleString); 584 } // hack 585 586 /* Append 'device slot name' with 'device type name' for optical devices only: */ 587 QString strDeviceType = enmDeviceType == KDeviceType_DVD 588 ? QApplication::translate("UIDetails", "[Optical Drive]", "details (storage)") 589 : QString(); 590 if (!strDeviceType.isNull()) 591 strDeviceType.append(' '); 592 593 /* Insert that attachment information into the map: */ 594 if (!strAttachmentInfo.isNull()) 595 { 596 /* Configure hovering anchors: */ 597 const QString strAnchorType = enmDeviceType == KDeviceType_DVD || enmDeviceType == KDeviceType_Floppy ? QString("mount") : 598 enmDeviceType == KDeviceType_HardDisk ? QString("attach") : QString(); 599 const CMedium medium = attachment.GetMedium(); 600 const QString strMediumLocation = medium.isNull() ? QString() : medium.GetLocation(); 601 attachmentsMap.insert(attachmentSlot, 602 QString("<a href=#%1,%2,%3,%4>%5</a>") 603 .arg(strAnchorType, 604 comController.GetName(), 605 gpConverter->toString(attachmentSlot), 606 strMediumLocation, 607 strDeviceType + strAttachmentInfo)); 608 } 609 } 610 611 /* Iterate over the sorted map: */ 612 const QList<StorageSlot> storageSlots = attachmentsMap.keys(); 613 const QList<QString> storageInfo = attachmentsMap.values(); 614 for (int i = 0; i < storageSlots.size(); ++i) 615 table << UITextTableLine(QString(" ") + gpConverter->toString(storageSlots[i]), storageInfo[i]); 616 } 617 if (table.isEmpty()) 618 table << UITextTableLine(QApplication::translate("UIDetails", "Not Attached", "details (storage)"), QString()); 619 } 620 else 621 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString()); 289 UITextTable table = UIDetailsGenerator::generateMachineInformationStorage(comMachine, m_fOptions); 622 290 623 291 /* Save the table as property: */ … … 639 307 640 308 /* Prepare table: */ 641 UITextTable table; 642 643 /* Gather information: */ 644 if (comMachine.GetAccessible()) 645 { 646 const CAudioAdapter comAudio = comMachine.GetAudioAdapter(); 647 if (comAudio.GetEnabled()) 648 { 649 /* Host driver: */ 650 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeAudio_Driver) 651 table << UITextTableLine(QApplication::translate("UIDetails", "Host Driver", "details (audio)"), 652 gpConverter->toString(comAudio.GetAudioDriver())); 653 654 /* Controller: */ 655 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeAudio_Controller) 656 table << UITextTableLine(QApplication::translate("UIDetails", "Controller", "details (audio)"), 657 gpConverter->toString(comAudio.GetAudioController())); 658 659 #ifdef VBOX_WITH_AUDIO_INOUT_INFO 660 /* Audio I/O: */ 661 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeAudio_IO) 662 { 663 table << UITextTableLine(QApplication::translate("UIDetails", "Audio Input", "details (audio)"), 664 comAudio.GetEnabledIn() ? 665 QApplication::translate("UIDetails", "Enabled", "details (audio/input)") : 666 QApplication::translate("UIDetails", "Disabled", "details (audio/input)")); 667 table << UITextTableLine(QApplication::translate("UIDetails", "Audio Output", "details (audio)"), 668 comAudio.GetEnabledOut() ? 669 QApplication::translate("UIDetails", "Enabled", "details (audio/output)") : 670 QApplication::translate("UIDetails", "Disabled", "details (audio/output)")); 671 } 672 #endif /* VBOX_WITH_AUDIO_INOUT_INFO */ 673 } 674 else 675 table << UITextTableLine(QApplication::translate("UIDetails", "Disabled", "details (audio)"), 676 QString()); 677 } 678 else 679 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), 680 QString()); 309 UITextTable table = UIDetailsGenerator::generateMachineInformationAudio(comMachine, m_fOptions); 310 681 311 682 312 /* Save the table as property: */ … … 689 319 } 690 320 691 692 321 void UIDetailsUpdateTaskNetwork::run() 693 322 { … … 698 327 699 328 /* Prepare table: */ 700 UITextTable table; 701 702 /* Gather information: */ 703 if (comMachine.GetAccessible()) 704 { 705 /* Iterate over all the adapters: */ 706 const ulong uCount = vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(comMachine.GetChipsetType()); 707 for (ulong uSlot = 0; uSlot < uCount; ++uSlot) 708 { 709 const CNetworkAdapter comAdapter = comMachine.GetNetworkAdapter(uSlot); 710 711 /* Skip disabled adapters: */ 712 if (!comAdapter.GetEnabled()) 713 continue; 714 715 /* Gather adapter information: */ 716 const KNetworkAttachmentType enmType = comAdapter.GetAttachmentType(); 717 const QString strAttachmentTemplate = gpConverter->toString(comAdapter.GetAdapterType()).replace(QRegExp("\\s\\(.+\\)"), " (%1)"); 718 QString strAttachmentType; 719 switch (enmType) 720 { 721 case KNetworkAttachmentType_Bridged: 722 { 723 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_BridgetAdapter) 724 strAttachmentType = strAttachmentTemplate.arg(QApplication::translate("UIDetails", "Bridged Adapter, %1", "details (network)") 725 .arg(comAdapter.GetBridgedInterface())); 726 break; 727 } 728 case KNetworkAttachmentType_Internal: 729 { 730 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_InternalNetwork) 731 strAttachmentType = strAttachmentTemplate.arg(QApplication::translate("UIDetails", "Internal Network, '%1'", "details (network)") 732 .arg(comAdapter.GetInternalNetwork())); 733 break; 734 } 735 case KNetworkAttachmentType_HostOnly: 736 { 737 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_HostOnlyAdapter) 738 strAttachmentType = strAttachmentTemplate.arg(QApplication::translate("UIDetails", "Host-only Adapter, '%1'", "details (network)") 739 .arg(comAdapter.GetHostOnlyInterface())); 740 break; 741 } 742 case KNetworkAttachmentType_Generic: 743 { 744 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_GenericDriver) 745 { 746 const QString strGenericDriverProperties(summarizeGenericProperties(comAdapter)); 747 strAttachmentType = strGenericDriverProperties.isNull() ? 748 strAttachmentTemplate.arg(QApplication::translate("UIDetails", "Generic Driver, '%1'", "details (network)") 749 .arg(comAdapter.GetGenericDriver())) : 750 strAttachmentTemplate.arg(QApplication::translate("UIDetails", "Generic Driver, '%1' { %2 }", "details (network)") 751 .arg(comAdapter.GetGenericDriver(), strGenericDriverProperties)); 752 } 753 break; 754 } 755 case KNetworkAttachmentType_NATNetwork: 756 { 757 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_NAT) 758 strAttachmentType = strAttachmentTemplate.arg(QApplication::translate("UIDetails", "NAT Network, '%1'", "details (network)") 759 .arg(comAdapter.GetNATNetwork())); 760 break; 761 } 762 default: 763 { 764 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_NotAttached) 765 strAttachmentType = strAttachmentTemplate.arg(gpConverter->toString(enmType)); 766 break; 767 } 768 } 769 if (!strAttachmentType.isNull()) 770 table << UITextTableLine(QApplication::translate("UIDetails", "Adapter %1", "details (network)").arg(comAdapter.GetSlot() + 1), strAttachmentType); 771 } 772 if (table.isEmpty()) 773 table << UITextTableLine(QApplication::translate("UIDetails", "Disabled", "details (network/adapter)"), QString()); 774 } 775 else 776 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString()); 329 UITextTable table = UIDetailsGenerator::generateMachineInformationNetwork(comMachine, m_fOptions); 777 330 778 331 /* Save the table as property: */ … … 785 338 } 786 339 787 /* static */788 QString UIDetailsUpdateTaskNetwork::summarizeGenericProperties(const CNetworkAdapter &adapter)789 {790 QVector<QString> names;791 QVector<QString> props;792 props = adapter.GetProperties(QString(), names);793 QString strResult;794 for (int i = 0; i < names.size(); ++i)795 {796 strResult += names[i] + "=" + props[i];797 if (i < names.size() - 1)798 strResult += ", ";799 }800 return strResult;801 }802 803 804 340 void UIDetailsUpdateTaskSerial::run() 805 341 { … … 810 346 811 347 /* Prepare table: */ 812 UITextTable table; 813 814 /* Gather information: */ 815 if (comMachine.GetAccessible()) 816 { 817 /* Iterate over all the ports: */ 818 const ulong uCount = vboxGlobal().virtualBox().GetSystemProperties().GetSerialPortCount(); 819 for (ulong uSlot = 0; uSlot < uCount; ++uSlot) 820 { 821 const CSerialPort comPort = comMachine.GetSerialPort(uSlot); 822 823 /* Skip disabled adapters: */ 824 if (!comPort.GetEnabled()) 825 continue; 826 827 /* Gather port information: */ 828 const KPortMode enmMode = comPort.GetHostMode(); 829 const QString strModeTemplate = vboxGlobal().toCOMPortName(comPort.GetIRQ(), comPort.GetIOBase()) + ", "; 830 QString strModeType; 831 switch (enmMode) 832 { 833 case KPortMode_HostPipe: 834 { 835 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_HostPipe) 836 strModeType = strModeTemplate + QString("%1 (%2)").arg(gpConverter->toString(enmMode)).arg(QDir::toNativeSeparators(comPort.GetPath())); 837 break; 838 } 839 case KPortMode_HostDevice: 840 { 841 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_HostDevice) 842 strModeType = strModeTemplate + QString("%1 (%2)").arg(gpConverter->toString(enmMode)).arg(QDir::toNativeSeparators(comPort.GetPath())); 843 break; 844 } 845 case KPortMode_RawFile: 846 { 847 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_RawFile) 848 strModeType = strModeTemplate + QString("%1 (%2)").arg(gpConverter->toString(enmMode)).arg(QDir::toNativeSeparators(comPort.GetPath())); 849 break; 850 } 851 case KPortMode_TCP: 852 { 853 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_TCP) 854 strModeType = strModeTemplate + QString("%1 (%2)").arg(gpConverter->toString(enmMode)).arg(QDir::toNativeSeparators(comPort.GetPath())); 855 break; 856 } 857 default: 858 { 859 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_Disconnected) 860 strModeType = strModeTemplate + gpConverter->toString(enmMode); 861 break; 862 } 863 } 864 if (!strModeType.isNull()) 865 table << UITextTableLine(QApplication::translate("UIDetails", "Port %1", "details (serial)").arg(comPort.GetSlot() + 1), strModeType); 866 } 867 if (table.isEmpty()) 868 table << UITextTableLine(QApplication::translate("UIDetails", "Disabled", "details (serial)"), QString()); 869 } 870 else 871 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString()); 872 348 UITextTable table = UIDetailsGenerator::generateMachineInformationSerial(comMachine, m_fOptions); 873 349 /* Save the table as property: */ 874 350 setProperty("table", QVariant::fromValue(table)); … … 880 356 } 881 357 882 883 358 void UIDetailsUpdateTaskUSB::run() 884 359 { … … 889 364 890 365 /* Prepare table: */ 891 UITextTable table; 892 893 /* Gather information: */ 894 if (comMachine.GetAccessible()) 895 { 896 /* Iterate over all the USB filters: */ 897 const CUSBDeviceFilters comFilterObject = comMachine.GetUSBDeviceFilters(); 898 if (!comFilterObject.isNull() && comMachine.GetUSBProxyAvailable()) 899 { 900 const CUSBControllerVector controllers = comMachine.GetUSBControllers(); 901 if (!controllers.isEmpty()) 902 { 903 /* USB controllers: */ 904 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeUsb_Controller) 905 { 906 QStringList controllersReadable; 907 foreach (const CUSBController &comController, controllers) 908 controllersReadable << gpConverter->toString(comController.GetType()); 909 table << UITextTableLine(QApplication::translate("UIDetails", "USB Controller", "details (usb)"), 910 controllersReadable.join(", ")); 911 } 912 913 /* Device filters: */ 914 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeUsb_DeviceFilters) 915 { 916 const CUSBDeviceFilterVector filters = comFilterObject.GetDeviceFilters(); 917 uint uActive = 0; 918 for (int i = 0; i < filters.size(); ++i) 919 if (filters.at(i).GetActive()) 920 ++uActive; 921 table << UITextTableLine(QApplication::translate("UIDetails", "Device Filters", "details (usb)"), 922 QApplication::translate("UIDetails", "%1 (%2 active)", "details (usb)").arg(filters.size()).arg(uActive)); 923 } 924 } 925 else 926 table << UITextTableLine(QApplication::translate("UIDetails", "Disabled", "details (usb)"), QString()); 927 } 928 else 929 table << UITextTableLine(QApplication::translate("UIDetails", "USB Controller Inaccessible", "details (usb)"), QString()); 930 } 931 else 932 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString()); 366 UITextTable table = UIDetailsGenerator::generateMachineInformationUSB(comMachine, m_fOptions); 933 367 934 368 /* Save the table as property: */ … … 950 384 951 385 /* Prepare table: */ 952 UITextTable table; 953 954 /* Gather information: */ 955 if (comMachine.GetAccessible()) 956 { 957 /* Summary: */ 958 const ulong uCount = comMachine.GetSharedFolders().size(); 959 if (uCount > 0) 960 table << UITextTableLine(QApplication::translate("UIDetails", "Shared Folders", "details (shared folders)"), QString::number(uCount)); 961 else 962 table << UITextTableLine(QApplication::translate("UIDetails", "None", "details (shared folders)"), QString()); 963 } 964 else 965 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString()); 386 UITextTable table = UIDetailsGenerator::generateMachineInformationSharedFolders(comMachine, m_fOptions); 966 387 967 388 /* Save the table as property: */ … … 983 404 984 405 /* Prepare table: */ 985 UITextTable table; 986 987 /* Gather information: */ 988 if (comMachine.GetAccessible()) 989 { 990 #ifndef VBOX_WS_MAC 991 /* Menu-bar: */ 992 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_MenuBar) 993 { 994 const QString strMenubarEnabled = comMachine.GetExtraData(UIExtraDataDefs::GUI_MenuBar_Enabled); 995 /* Try to convert loaded data to bool: */ 996 const bool fEnabled = !( strMenubarEnabled.compare("false", Qt::CaseInsensitive) == 0 997 || strMenubarEnabled.compare("no", Qt::CaseInsensitive) == 0 998 || strMenubarEnabled.compare("off", Qt::CaseInsensitive) == 0 999 || strMenubarEnabled == "0"); 1000 /* Append information: */ 1001 table << UITextTableLine(QApplication::translate("UIDetails", "Menu-bar", "details (user interface)"), 1002 fEnabled ? QApplication::translate("UIDetails", "Enabled", "details (user interface/menu-bar)") 1003 : QApplication::translate("UIDetails", "Disabled", "details (user interface/menu-bar)")); 1004 } 1005 #endif /* !VBOX_WS_MAC */ 1006 1007 /* Status-bar: */ 1008 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_StatusBar) 1009 { 1010 const QString strStatusbarEnabled = comMachine.GetExtraData(UIExtraDataDefs::GUI_StatusBar_Enabled); 1011 /* Try to convert loaded data to bool: */ 1012 const bool fEnabled = !( strStatusbarEnabled.compare("false", Qt::CaseInsensitive) == 0 1013 || strStatusbarEnabled.compare("no", Qt::CaseInsensitive) == 0 1014 || strStatusbarEnabled.compare("off", Qt::CaseInsensitive) == 0 1015 || strStatusbarEnabled == "0"); 1016 /* Append information: */ 1017 table << UITextTableLine(QApplication::translate("UIDetails", "Status-bar", "details (user interface)"), 1018 fEnabled ? QApplication::translate("UIDetails", "Enabled", "details (user interface/status-bar)") 1019 : QApplication::translate("UIDetails", "Disabled", "details (user interface/status-bar)")); 1020 } 1021 1022 #ifndef VBOX_WS_MAC 1023 /* Mini-toolbar: */ 1024 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_MiniToolbar) 1025 { 1026 const QString strMiniToolbarEnabled = comMachine.GetExtraData(UIExtraDataDefs::GUI_ShowMiniToolBar); 1027 /* Try to convert loaded data to bool: */ 1028 const bool fEnabled = !( strMiniToolbarEnabled.compare("false", Qt::CaseInsensitive) == 0 1029 || strMiniToolbarEnabled.compare("no", Qt::CaseInsensitive) == 0 1030 || strMiniToolbarEnabled.compare("off", Qt::CaseInsensitive) == 0 1031 || strMiniToolbarEnabled == "0"); 1032 /* Append information: */ 1033 if (fEnabled) 1034 { 1035 /* Get mini-toolbar position: */ 1036 const QString strMiniToolbarPosition = comMachine.GetExtraData(UIExtraDataDefs::GUI_MiniToolBarAlignment); 1037 { 1038 /* Try to convert loaded data to alignment: */ 1039 switch (gpConverter->fromInternalString<MiniToolbarAlignment>(strMiniToolbarPosition)) 1040 { 1041 /* Append information: */ 1042 case MiniToolbarAlignment_Top: 1043 table << UITextTableLine(QApplication::translate("UIDetails", "Mini-toolbar Position", "details (user interface)"), 1044 QApplication::translate("UIDetails", "Top", "details (user interface/mini-toolbar position)")); 1045 break; 1046 /* Append information: */ 1047 case MiniToolbarAlignment_Bottom: 1048 table << UITextTableLine(QApplication::translate("UIDetails", "Mini-toolbar Position", "details (user interface)"), 1049 QApplication::translate("UIDetails", "Bottom", "details (user interface/mini-toolbar position)")); 1050 break; 1051 } 1052 } 1053 } 1054 /* Append information: */ 1055 else 1056 table << UITextTableLine(QApplication::translate("UIDetails", "Mini-toolbar", "details (user interface)"), 1057 QApplication::translate("UIDetails", "Disabled", "details (user interface/mini-toolbar)")); 1058 } 1059 #endif /* !VBOX_WS_MAC */ 1060 } 1061 else 1062 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString()); 406 UITextTable table = UIDetailsGenerator::generateMachineInformationUI(comMachine, m_fOptions); 1063 407 1064 408 /* Save the table as property: */ … … 1080 424 1081 425 /* Prepare table: */ 1082 UITextTable table; 1083 1084 /* Gather information: */ 1085 if (comMachine.GetAccessible()) 1086 { 1087 /* Summary: */ 1088 const QString strDescription = comMachine.GetDescription(); 1089 if (!strDescription.isEmpty()) 1090 table << UITextTableLine(strDescription, QString()); 1091 else 1092 table << UITextTableLine(QApplication::translate("UIDetails", "None", "details (description)"), QString()); 1093 } 1094 else 1095 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString()); 426 UITextTable table = UIDetailsGenerator::generateMachineInformationDetails(comMachine, m_fOptions); 1096 427 1097 428 /* Save the table as property: */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElements.h
r76581 r77427 327 327 void run(); 328 328 329 /** Summarizes generic properties. */330 static QString summarizeGenericProperties(const CNetworkAdapter &adapter);331 332 329 /** Holds the options. */ 333 330 UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork m_fOptions; … … 548 545 549 546 #endif /* !FEQT_INCLUDED_SRC_manager_details_UIDetailsElements_h */ 550 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsGenerator.cpp
r77409 r77427 1 1 /* $Id$ */ 2 2 /** @file 3 * VBox Qt GUI - UIDetails Element[Name] classesimplementation.3 * VBox Qt GUI - UIDetailsGenerator implementation. 4 4 */ 5 5 … … 18 18 /* Qt includes: */ 19 19 #include <QDir> 20 #include <QTimer>21 #include <QGraphicsLinearLayout>22 20 23 21 /* GUI includes: */ 24 #include "UIDetailsElements.h" 25 #include "UIDetailsModel.h" 26 #include "UIMachinePreview.h" 27 #include "UIGraphicsRotatorButton.h" 22 #include "UIConverter.h" 23 #include "UIErrorString.h" 24 #include "UIInformationItem.h" 28 25 #include "VBoxGlobal.h" 29 #include "UIIconPool.h"30 #include "UIConverter.h"31 #include "UIGraphicsTextPane.h"32 #include "UIErrorString.h"33 26 34 27 /* COM includes: */ … … 48 41 #include "CUSBDeviceFilter.h" 49 42 #include "CSharedFolder.h" 50 #include "CMedium.h" 51 52 53 UIDetailsUpdateTask::UIDetailsUpdateTask(const CMachine &machine) 54 : UITask(UITask::Type_DetailsPopulation) 43 44 namespace UIDetailsGenerator 55 45 { 56 /* Store machine as property: */ 57 setProperty("machine", QVariant::fromValue(machine)); 58 } 59 60 UIDetailsElementInterface::UIDetailsElementInterface(UIDetailsSet *pParent, DetailsElementType type, bool fOpened) 61 : UIDetailsElement(pParent, type, fOpened) 62 , m_pTask(0) 63 { 64 /* Listen for the global thread-pool: */ 65 connect(vboxGlobal().threadPool(), SIGNAL(sigTaskComplete(UITask*)), 66 this, SLOT(sltUpdateAppearanceFinished(UITask*))); 67 68 /* Translate finally: */ 69 retranslateUi(); 70 } 71 72 void UIDetailsElementInterface::retranslateUi() 73 { 74 /* Assign corresponding name: */ 75 setName(gpConverter->toString(elementType())); 76 } 77 78 void UIDetailsElementInterface::updateAppearance() 79 { 80 /* Call to base-class: */ 81 UIDetailsElement::updateAppearance(); 82 83 /* Prepare/start update task: */ 84 if (!m_pTask) 85 { 86 /* Prepare update task: */ 87 m_pTask = createUpdateTask(); 88 /* Post task into global thread-pool: */ 89 vboxGlobal().threadPool()->enqueueTask(m_pTask); 90 } 91 } 92 93 void UIDetailsElementInterface::sltUpdateAppearanceFinished(UITask *pTask) 94 { 95 /* Make sure that is one of our tasks: */ 96 if (pTask->type() != UITask::Type_DetailsPopulation) 97 return; 98 99 /* Skip unrelated tasks: */ 100 if (m_pTask != pTask) 101 return; 102 103 /* Assign new text if changed: */ 104 const UITextTable newText = pTask->property("table").value<UITextTable>(); 105 if (text() != newText) 106 setText(newText); 107 108 /* Mark task processed: */ 109 m_pTask = 0; 110 111 /* Notify listeners about update task complete: */ 112 emit sigBuildDone(); 113 } 114 115 116 UIDetailsElementPreview::UIDetailsElementPreview(UIDetailsSet *pParent, bool fOpened) 117 : UIDetailsElement(pParent, DetailsElementType_Preview, fOpened) 118 { 119 /* Create preview: */ 120 m_pPreview = new UIMachinePreview(this); 121 AssertPtr(m_pPreview); 122 { 123 /* Configure preview: */ 124 connect(m_pPreview, SIGNAL(sigSizeHintChanged()), 125 this, SLOT(sltPreviewSizeHintChanged())); 126 } 127 128 /* Translate finally: */ 129 retranslateUi(); 130 } 131 132 void UIDetailsElementPreview::sltPreviewSizeHintChanged() 133 { 134 /* Recursively update size-hints: */ 135 updateGeometry(); 136 /* Update whole model layout: */ 137 model()->updateLayout(); 138 } 139 140 void UIDetailsElementPreview::retranslateUi() 141 { 142 /* Assign corresponding name: */ 143 setName(gpConverter->toString(elementType())); 144 } 145 146 int UIDetailsElementPreview::minimumWidthHint() const 147 { 148 /* Prepare variables: */ 149 int iMargin = data(ElementData_Margin).toInt(); 150 151 /* Calculating proposed width: */ 152 int iProposedWidth = 0; 153 154 /* Maximum between header width and preview width: */ 155 iProposedWidth += qMax(minimumHeaderWidth(), m_pPreview->minimumSizeHint().toSize().width()); 156 157 /* Two margins: */ 158 iProposedWidth += 2 * iMargin; 159 160 /* Return result: */ 161 return iProposedWidth; 162 } 163 164 int UIDetailsElementPreview::minimumHeightHintForElement(bool fClosed) const 165 { 166 /* Prepare variables: */ 167 int iMargin = data(ElementData_Margin).toInt(); 168 169 /* Calculating proposed height: */ 170 int iProposedHeight = 0; 171 172 /* Two margins: */ 173 iProposedHeight += 2 * iMargin; 174 175 /* Header height: */ 176 iProposedHeight += minimumHeaderHeight(); 177 178 /* Element is opened? */ 179 if (!fClosed) 180 { 181 iProposedHeight += iMargin; 182 iProposedHeight += m_pPreview->minimumSizeHint().toSize().height(); 183 } 184 else 185 { 186 /* Additional height during animation: */ 187 if (button()->isAnimationRunning()) 188 iProposedHeight += additionalHeight(); 189 } 190 191 /* Return result: */ 192 return iProposedHeight; 193 } 194 195 void UIDetailsElementPreview::updateLayout() 196 { 197 /* Call to base-class: */ 198 UIDetailsElement::updateLayout(); 199 200 /* Show/hide preview: */ 201 if (isClosed() && m_pPreview->isVisible()) 202 m_pPreview->hide(); 203 if (isOpened() && !m_pPreview->isVisible() && !isAnimationRunning()) 204 m_pPreview->show(); 205 206 /* And update preview layout itself: */ 207 const int iMargin = data(ElementData_Margin).toInt(); 208 m_pPreview->setPos(iMargin, 2 * iMargin + minimumHeaderHeight()); 209 m_pPreview->resize(m_pPreview->minimumSizeHint()); 210 } 211 212 void UIDetailsElementPreview::updateAppearance() 213 { 214 /* Call to base-class: */ 215 UIDetailsElement::updateAppearance(); 216 217 /* Set new machine attribute directly: */ 218 m_pPreview->setMachine(machine()); 219 m_pPreview->resize(m_pPreview->minimumSizeHint()); 220 emit sigBuildDone(); 221 } 222 223 224 void UIDetailsUpdateTaskGeneral::run() 225 { 226 /* Acquire corresponding machine: */ 227 CMachine comMachine = property("machine").value<CMachine>(); 228 if (comMachine.isNull()) 229 return; 230 231 /* Prepare table: */ 232 UITextTable table; 233 234 /* Gather information: */ 235 if (comMachine.GetAccessible()) 236 { 46 47 UITextTable generateMachineInformationGeneral(CMachine &comMachine, 48 const UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral &fOptions) 49 { 50 UITextTable table; 51 52 if (comMachine.isNull()) 53 return table; 54 55 if (!comMachine.GetAccessible()) 56 { 57 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString()); 58 return table; 59 } 60 61 /* Gather information: */ 237 62 /* Name: */ 238 if ( m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_Name)63 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_Name) 239 64 table << UITextTableLine(QApplication::translate("UIDetails", "Name", "details (general)"), comMachine.GetName()); 240 65 241 66 /* Operating system: */ 242 if ( m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_OS)67 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_OS) 243 68 table << UITextTableLine(QApplication::translate("UIDetails", "Operating System", "details (general)"), 244 69 vboxGlobal().vmGuestOSTypeDescription(comMachine.GetOSTypeId())); 245 70 246 71 /* Settings file location: */ 247 if ( m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_Location)72 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_Location) 248 73 table << UITextTableLine(QApplication::translate("UIDetails", "Settings File Location", "details (general)"), 249 74 QDir::toNativeSeparators(QFileInfo(comMachine.GetSettingsFilePath()).absolutePath())); 250 75 251 76 /* Groups: */ 252 if ( m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_Groups)77 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_Groups) 253 78 { 254 79 QStringList groups = comMachine.GetGroups().toList(); … … 270 95 } 271 96 } 272 } 273 else 274 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString()); 275 276 /* Save the table as property: */ 277 setProperty("table", QVariant::fromValue(table)); 278 } 279 280 UITask *UIDetailsElementGeneral::createUpdateTask() 281 { 282 return new UIDetailsUpdateTaskGeneral(machine(), model()->optionsGeneral()); 283 } 284 285 286 void UIDetailsUpdateTaskSystem::run() 287 { 288 /* Acquire corresponding machine: */ 289 CMachine comMachine = property("machine").value<CMachine>(); 290 if (comMachine.isNull()) 291 return; 292 293 /* Prepare table: */ 294 UITextTable table; 295 296 /* Gather information: */ 297 if (comMachine.GetAccessible()) 298 { 97 return table; 98 } 99 100 101 UITextTable generateMachineInformationSystem(CMachine &comMachine, 102 const UIExtraDataMetaDefs::DetailsElementOptionTypeSystem &fOptions) 103 { 104 UITextTable table; 105 if (comMachine.isNull()) 106 return table; 107 108 if (!comMachine.GetAccessible()) 109 { 110 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString()); 111 return table; 112 } 113 299 114 /* Base memory: */ 300 if ( m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_RAM)115 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_RAM) 301 116 table << UITextTableLine(QApplication::translate("UIDetails", "Base Memory", "details (system)"), 302 117 QApplication::translate("UIDetails", "%1 MB", "details").arg(comMachine.GetMemorySize())); 303 118 304 119 /* Processors: */ 305 if ( m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_CPUCount)120 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_CPUCount) 306 121 { 307 122 const int cCPU = comMachine.GetCPUCount(); … … 312 127 313 128 /* Execution cap: */ 314 if ( m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_CPUExecutionCap)129 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_CPUExecutionCap) 315 130 { 316 131 const int iCPUExecutionCap = comMachine.GetCPUExecutionCap(); … … 321 136 322 137 /* Boot order: */ 323 if ( m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_BootOrder)138 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_BootOrder) 324 139 { 325 140 QStringList bootOrder; … … 337 152 338 153 /* Chipset type: */ 339 if ( m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_ChipsetType)154 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_ChipsetType) 340 155 { 341 156 const KChipsetType enmChipsetType = comMachine.GetChipsetType(); … … 346 161 347 162 /* EFI: */ 348 if ( m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_Firmware)163 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_Firmware) 349 164 { 350 165 switch (comMachine.GetFirmwareType()) … … 354 169 case KFirmwareType_EFI64: 355 170 case KFirmwareType_EFIDUAL: 356 {357 table << UITextTableLine(QApplication::translate("UIDetails", "EFI", "details (system)"),358 QApplication::translate("UIDetails", "Enabled", "details (system/EFI)"));359 break;360 }171 { 172 table << UITextTableLine(QApplication::translate("UIDetails", "EFI", "details (system)"), 173 QApplication::translate("UIDetails", "Enabled", "details (system/EFI)")); 174 break; 175 } 361 176 default: 362 {363 // For NLS purpose:364 QApplication::translate("UIDetails", "Disabled", "details (system/EFI)");365 break;366 }177 { 178 // For NLS purpose: 179 QApplication::translate("UIDetails", "Disabled", "details (system/EFI)"); 180 break; 181 } 367 182 } 368 183 } 369 184 370 185 /* Acceleration: */ 371 if ( m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_Acceleration)186 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_Acceleration) 372 187 { 373 188 QStringList acceleration; … … 398 213 acceleration.join(", ")); 399 214 } 400 } 401 else 402 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), 403 QString()); 404 405 /* Save the table as property: */ 406 setProperty("table", QVariant::fromValue(table)); 407 } 408 409 UITask *UIDetailsElementSystem::createUpdateTask() 410 { 411 return new UIDetailsUpdateTaskSystem(machine(), model()->optionsSystem()); 412 } 413 414 415 void UIDetailsUpdateTaskDisplay::run() 416 { 417 /* Acquire corresponding machine: */ 418 CMachine comMachine = property("machine").value<CMachine>(); 419 if (comMachine.isNull()) 420 return; 421 422 /* Prepare table: */ 423 UITextTable table; 424 425 /* Gather information: */ 426 if (comMachine.GetAccessible()) 427 { 215 return table; 216 } 217 218 219 UITextTable generateMachineInformationDisplay(CMachine &comMachine, 220 const UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay &fOptions) 221 { 222 UITextTable table; 223 224 if (comMachine.isNull()) 225 return table; 226 227 if (!comMachine.GetAccessible()) 228 { 229 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString()); 230 return table; 231 } 232 428 233 /* Video memory: */ 429 if ( m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_VRAM)234 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_VRAM) 430 235 table << UITextTableLine(QApplication::translate("UIDetails", "Video Memory", "details (display)"), 431 236 QApplication::translate("UIDetails", "%1 MB", "details").arg(comMachine.GetVRAMSize())); 432 237 433 238 /* Screens: */ 434 if ( m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_ScreenCount)239 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_ScreenCount) 435 240 { 436 241 const int cGuestScreens = comMachine.GetMonitorCount(); … … 441 246 442 247 /* Scale-factor: */ 443 if ( m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_ScaleFactor)248 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_ScaleFactor) 444 249 { 445 250 const QString strScaleFactor = comMachine.GetExtraData(UIExtraDataDefs::GUI_ScaleFactor); … … 459 264 460 265 /* Graphics Controller: */ 461 if ( m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_GraphicsController)266 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_GraphicsController) 462 267 table << UITextTableLine(QApplication::translate("UIDetails", "Graphics Controller", "details (display)"), 463 268 gpConverter->toString(comMachine.GetGraphicsControllerType())); 464 269 465 270 /* Acceleration: */ 466 if ( m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_Acceleration)271 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_Acceleration) 467 272 { 468 273 QStringList acceleration; … … 481 286 482 287 /* Remote desktop server: */ 483 if ( m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_VRDE)288 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_VRDE) 484 289 { 485 290 const CVRDEServer comServer = comMachine.GetVRDEServer(); … … 496 301 497 302 /* Recording: */ 498 if ( m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_Recording)303 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_Recording) 499 304 { 500 305 CRecordingSettings comRecordingSettings = comMachine.GetRecordingSettings(); … … 509 314 table << UITextTableLine(QApplication::translate("UIDetails", "Recording Attributes", "details (display/recording)"), 510 315 QApplication::translate("UIDetails", "Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps") 511 512 316 .arg(comRecordingScreen0Settings.GetVideoWidth()).arg(comRecordingScreen0Settings.GetVideoHeight()) 317 .arg(comRecordingScreen0Settings.GetVideoFPS()).arg(comRecordingScreen0Settings.GetVideoRate())); 513 318 } 514 319 else … … 518 323 } 519 324 } 520 } 521 else 522 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString()); 523 524 /* Save the table as property: */ 525 setProperty("table", QVariant::fromValue(table)); 526 } 527 528 UITask *UIDetailsElementDisplay::createUpdateTask() 529 { 530 return new UIDetailsUpdateTaskDisplay(machine(), model()->optionsDisplay()); 531 } 532 533 534 void UIDetailsUpdateTaskStorage::run() 535 { 536 /* Acquire corresponding machine: */ 537 CMachine comMachine = property("machine").value<CMachine>(); 538 if (comMachine.isNull()) 539 return; 540 541 /* Prepare table: */ 542 UITextTable table; 543 544 /* Gather information: */ 545 if (comMachine.GetAccessible()) 546 { 325 return table; 326 } 327 328 UITextTable generateMachineInformationStorage(CMachine &comMachine, 329 const UIExtraDataMetaDefs::DetailsElementOptionTypeStorage &fOptions) 330 { 331 UITextTable table; 332 333 if (comMachine.isNull()) 334 return table; 335 336 if (!comMachine.GetAccessible()) 337 { 338 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString()); 339 return table; 340 } 341 547 342 /* Iterate over all the machine controllers: */ 548 343 foreach (const CStorageController &comController, comMachine.GetStorageControllers()) … … 559 354 560 355 /* Ignore restricted device types: */ 561 if ( ( !( m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeStorage_HardDisks)562 && enmDeviceType == KDeviceType_HardDisk)563 || ( !(m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeStorage_OpticalDevices)564 && enmDeviceType == KDeviceType_DVD)565 || ( !(m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeStorage_FloppyDevices)566 && enmDeviceType == KDeviceType_Floppy))356 if ( ( !(fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeStorage_HardDisks) 357 && enmDeviceType == KDeviceType_HardDisk) 358 || ( !(fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeStorage_OpticalDevices) 359 && enmDeviceType == KDeviceType_DVD) 360 || ( !(fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeStorage_FloppyDevices) 361 && enmDeviceType == KDeviceType_Floppy)) 567 362 continue; 568 363 … … 586 381 /* Append 'device slot name' with 'device type name' for optical devices only: */ 587 382 QString strDeviceType = enmDeviceType == KDeviceType_DVD 588 589 383 ? QApplication::translate("UIDetails", "[Optical Drive]", "details (storage)") 384 : QString(); 590 385 if (!strDeviceType.isNull()) 591 386 strDeviceType.append(' '); … … 596 391 /* Configure hovering anchors: */ 597 392 const QString strAnchorType = enmDeviceType == KDeviceType_DVD || enmDeviceType == KDeviceType_Floppy ? QString("mount") : 598 393 enmDeviceType == KDeviceType_HardDisk ? QString("attach") : QString(); 599 394 const CMedium medium = attachment.GetMedium(); 600 395 const QString strMediumLocation = medium.isNull() ? QString() : medium.GetLocation(); 601 396 attachmentsMap.insert(attachmentSlot, 602 397 QString("<a href=#%1,%2,%3,%4>%5</a>") 603 604 605 606 607 398 .arg(strAnchorType, 399 comController.GetName(), 400 gpConverter->toString(attachmentSlot), 401 strMediumLocation, 402 strDeviceType + strAttachmentInfo)); 608 403 } 609 404 } … … 617 412 if (table.isEmpty()) 618 413 table << UITextTableLine(QApplication::translate("UIDetails", "Not Attached", "details (storage)"), QString()); 619 } 620 else 621 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString()); 622 623 /* Save the table as property: */ 624 setProperty("table", QVariant::fromValue(table)); 625 } 626 627 UITask *UIDetailsElementStorage::createUpdateTask() 628 { 629 return new UIDetailsUpdateTaskStorage(machine(), model()->optionsStorage()); 630 } 631 632 633 void UIDetailsUpdateTaskAudio::run() 634 { 635 /* Acquire corresponding machine: */ 636 CMachine comMachine = property("machine").value<CMachine>(); 637 if (comMachine.isNull()) 638 return; 639 640 /* Prepare table: */ 641 UITextTable table; 642 643 /* Gather information: */ 644 if (comMachine.GetAccessible()) 645 { 414 415 return table; 416 } 417 418 419 UITextTable generateMachineInformationAudio(CMachine &comMachine, 420 const UIExtraDataMetaDefs::DetailsElementOptionTypeAudio &fOptions) 421 { 422 423 UITextTable table; 424 425 if (comMachine.isNull()) 426 return table; 427 428 if (!comMachine.GetAccessible()) 429 { 430 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString()); 431 return table; 432 } 433 646 434 const CAudioAdapter comAudio = comMachine.GetAudioAdapter(); 647 435 if (comAudio.GetEnabled()) 648 436 { 649 437 /* Host driver: */ 650 if ( m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeAudio_Driver)438 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeAudio_Driver) 651 439 table << UITextTableLine(QApplication::translate("UIDetails", "Host Driver", "details (audio)"), 652 440 gpConverter->toString(comAudio.GetAudioDriver())); 653 441 654 442 /* Controller: */ 655 if ( m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeAudio_Controller)443 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeAudio_Controller) 656 444 table << UITextTableLine(QApplication::translate("UIDetails", "Controller", "details (audio)"), 657 445 gpConverter->toString(comAudio.GetAudioController())); … … 659 447 #ifdef VBOX_WITH_AUDIO_INOUT_INFO 660 448 /* Audio I/O: */ 661 if ( m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeAudio_IO)449 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeAudio_IO) 662 450 { 663 451 table << UITextTableLine(QApplication::translate("UIDetails", "Audio Input", "details (audio)"), … … 675 463 table << UITextTableLine(QApplication::translate("UIDetails", "Disabled", "details (audio)"), 676 464 QString()); 677 } 678 else 679 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), 680 QString()); 681 682 /* Save the table as property: */ 683 setProperty("table", QVariant::fromValue(table)); 684 } 685 686 UITask *UIDetailsElementAudio::createUpdateTask() 687 { 688 return new UIDetailsUpdateTaskAudio(machine(), model()->optionsAudio()); 689 } 690 691 692 void UIDetailsUpdateTaskNetwork::run() 693 { 694 /* Acquire corresponding machine: */ 695 CMachine comMachine = property("machine").value<CMachine>(); 696 if (comMachine.isNull()) 697 return; 698 699 /* Prepare table: */ 700 UITextTable table; 701 702 /* Gather information: */ 703 if (comMachine.GetAccessible()) 704 { 465 return table; 466 } 467 468 QString summarizeGenericProperties(const CNetworkAdapter &adapter) 469 { 470 QVector<QString> names; 471 QVector<QString> props; 472 props = adapter.GetProperties(QString(), names); 473 QString strResult; 474 for (int i = 0; i < names.size(); ++i) 475 { 476 strResult += names[i] + "=" + props[i]; 477 if (i < names.size() - 1) 478 strResult += ", "; 479 } 480 return strResult; 481 } 482 483 UITextTable generateMachineInformationNetwork(CMachine &comMachine, 484 const UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork &fOptions) 485 { 486 UITextTable table; 487 488 if (comMachine.isNull()) 489 return table; 490 491 if (!comMachine.GetAccessible()) 492 { 493 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString()); 494 return table; 495 } 496 705 497 /* Iterate over all the adapters: */ 706 498 const ulong uCount = vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(comMachine.GetChipsetType()); … … 720 512 { 721 513 case KNetworkAttachmentType_Bridged: 722 {723 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_BridgetAdapter)724 strAttachmentType = strAttachmentTemplate.arg(QApplication::translate("UIDetails", "Bridged Adapter, %1", "details (network)")725 .arg(comAdapter.GetBridgedInterface()));726 break;727 }514 { 515 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_BridgetAdapter) 516 strAttachmentType = strAttachmentTemplate.arg(QApplication::translate("UIDetails", "Bridged Adapter, %1", "details (network)") 517 .arg(comAdapter.GetBridgedInterface())); 518 break; 519 } 728 520 case KNetworkAttachmentType_Internal: 729 {730 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_InternalNetwork)731 strAttachmentType = strAttachmentTemplate.arg(QApplication::translate("UIDetails", "Internal Network, '%1'", "details (network)")732 .arg(comAdapter.GetInternalNetwork()));733 break;734 }521 { 522 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_InternalNetwork) 523 strAttachmentType = strAttachmentTemplate.arg(QApplication::translate("UIDetails", "Internal Network, '%1'", "details (network)") 524 .arg(comAdapter.GetInternalNetwork())); 525 break; 526 } 735 527 case KNetworkAttachmentType_HostOnly: 736 {737 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_HostOnlyAdapter)738 strAttachmentType = strAttachmentTemplate.arg(QApplication::translate("UIDetails", "Host-only Adapter, '%1'", "details (network)")739 .arg(comAdapter.GetHostOnlyInterface()));740 break;741 }528 { 529 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_HostOnlyAdapter) 530 strAttachmentType = strAttachmentTemplate.arg(QApplication::translate("UIDetails", "Host-only Adapter, '%1'", "details (network)") 531 .arg(comAdapter.GetHostOnlyInterface())); 532 break; 533 } 742 534 case KNetworkAttachmentType_Generic: 743 {744 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_GenericDriver)745 {746 const QString strGenericDriverProperties(summarizeGenericProperties(comAdapter));747 strAttachmentType = strGenericDriverProperties.isNull() ?748 strAttachmentTemplate.arg(QApplication::translate("UIDetails", "Generic Driver, '%1'", "details (network)")749 .arg(comAdapter.GetGenericDriver())) :750 strAttachmentTemplate.arg(QApplication::translate("UIDetails", "Generic Driver, '%1' { %2 }", "details (network)")751 .arg(comAdapter.GetGenericDriver(), strGenericDriverProperties));752 }753 break;754 }535 { 536 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_GenericDriver) 537 { 538 const QString strGenericDriverProperties(summarizeGenericProperties(comAdapter)); 539 strAttachmentType = strGenericDriverProperties.isNull() ? 540 strAttachmentTemplate.arg(QApplication::translate("UIDetails", "Generic Driver, '%1'", "details (network)") 541 .arg(comAdapter.GetGenericDriver())) : 542 strAttachmentTemplate.arg(QApplication::translate("UIDetails", "Generic Driver, '%1' { %2 }", "details (network)") 543 .arg(comAdapter.GetGenericDriver(), strGenericDriverProperties)); 544 } 545 break; 546 } 755 547 case KNetworkAttachmentType_NATNetwork: 756 {757 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_NAT)758 strAttachmentType = strAttachmentTemplate.arg(QApplication::translate("UIDetails", "NAT Network, '%1'", "details (network)")759 .arg(comAdapter.GetNATNetwork()));760 break;761 }548 { 549 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_NAT) 550 strAttachmentType = strAttachmentTemplate.arg(QApplication::translate("UIDetails", "NAT Network, '%1'", "details (network)") 551 .arg(comAdapter.GetNATNetwork())); 552 break; 553 } 762 554 default: 763 {764 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_NotAttached)765 strAttachmentType = strAttachmentTemplate.arg(gpConverter->toString(enmType));766 break;767 }555 { 556 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_NotAttached) 557 strAttachmentType = strAttachmentTemplate.arg(gpConverter->toString(enmType)); 558 break; 559 } 768 560 } 769 561 if (!strAttachmentType.isNull()) … … 772 564 if (table.isEmpty()) 773 565 table << UITextTableLine(QApplication::translate("UIDetails", "Disabled", "details (network/adapter)"), QString()); 774 } 775 else 776 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString()); 777 778 /* Save the table as property: */ 779 setProperty("table", QVariant::fromValue(table)); 780 } 781 782 UITask *UIDetailsElementNetwork::createUpdateTask() 783 { 784 return new UIDetailsUpdateTaskNetwork(machine(), model()->optionsNetwork()); 785 } 786 787 /* static */ 788 QString UIDetailsUpdateTaskNetwork::summarizeGenericProperties(const CNetworkAdapter &adapter) 789 { 790 QVector<QString> names; 791 QVector<QString> props; 792 props = adapter.GetProperties(QString(), names); 793 QString strResult; 794 for (int i = 0; i < names.size(); ++i) 795 { 796 strResult += names[i] + "=" + props[i]; 797 if (i < names.size() - 1) 798 strResult += ", "; 799 } 800 return strResult; 801 } 802 803 804 void UIDetailsUpdateTaskSerial::run() 805 { 806 /* Acquire corresponding machine: */ 807 CMachine comMachine = property("machine").value<CMachine>(); 808 if (comMachine.isNull()) 809 return; 810 811 /* Prepare table: */ 812 UITextTable table; 813 814 /* Gather information: */ 815 if (comMachine.GetAccessible()) 816 { 566 567 return table; 568 } 569 570 UITextTable generateMachineInformationSerial(CMachine &comMachine, 571 const UIExtraDataMetaDefs::DetailsElementOptionTypeSerial &fOptions) 572 { 573 UITextTable table; 574 575 if (comMachine.isNull()) 576 return table; 577 578 if (!comMachine.GetAccessible()) 579 { 580 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString()); 581 return table; 582 } 583 584 817 585 /* Iterate over all the ports: */ 818 586 const ulong uCount = vboxGlobal().virtualBox().GetSystemProperties().GetSerialPortCount(); … … 832 600 { 833 601 case KPortMode_HostPipe: 834 {835 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_HostPipe)836 strModeType = strModeTemplate + QString("%1 (%2)").arg(gpConverter->toString(enmMode)).arg(QDir::toNativeSeparators(comPort.GetPath()));837 break;838 }602 { 603 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_HostPipe) 604 strModeType = strModeTemplate + QString("%1 (%2)").arg(gpConverter->toString(enmMode)).arg(QDir::toNativeSeparators(comPort.GetPath())); 605 break; 606 } 839 607 case KPortMode_HostDevice: 840 {841 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_HostDevice)842 strModeType = strModeTemplate + QString("%1 (%2)").arg(gpConverter->toString(enmMode)).arg(QDir::toNativeSeparators(comPort.GetPath()));843 break;844 }608 { 609 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_HostDevice) 610 strModeType = strModeTemplate + QString("%1 (%2)").arg(gpConverter->toString(enmMode)).arg(QDir::toNativeSeparators(comPort.GetPath())); 611 break; 612 } 845 613 case KPortMode_RawFile: 846 {847 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_RawFile)848 strModeType = strModeTemplate + QString("%1 (%2)").arg(gpConverter->toString(enmMode)).arg(QDir::toNativeSeparators(comPort.GetPath()));849 break;850 }614 { 615 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_RawFile) 616 strModeType = strModeTemplate + QString("%1 (%2)").arg(gpConverter->toString(enmMode)).arg(QDir::toNativeSeparators(comPort.GetPath())); 617 break; 618 } 851 619 case KPortMode_TCP: 852 {853 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_TCP)854 strModeType = strModeTemplate + QString("%1 (%2)").arg(gpConverter->toString(enmMode)).arg(QDir::toNativeSeparators(comPort.GetPath()));855 break;856 }620 { 621 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_TCP) 622 strModeType = strModeTemplate + QString("%1 (%2)").arg(gpConverter->toString(enmMode)).arg(QDir::toNativeSeparators(comPort.GetPath())); 623 break; 624 } 857 625 default: 858 {859 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_Disconnected)860 strModeType = strModeTemplate + gpConverter->toString(enmMode);861 break;862 }626 { 627 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_Disconnected) 628 strModeType = strModeTemplate + gpConverter->toString(enmMode); 629 break; 630 } 863 631 } 864 632 if (!strModeType.isNull()) … … 867 635 if (table.isEmpty()) 868 636 table << UITextTableLine(QApplication::translate("UIDetails", "Disabled", "details (serial)"), QString()); 869 } 870 else 871 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString()); 872 873 /* Save the table as property: */ 874 setProperty("table", QVariant::fromValue(table)); 875 } 876 877 UITask *UIDetailsElementSerial::createUpdateTask() 878 { 879 return new UIDetailsUpdateTaskSerial(machine(), model()->optionsSerial()); 880 } 881 882 883 void UIDetailsUpdateTaskUSB::run() 884 { 885 /* Acquire corresponding machine: */ 886 CMachine comMachine = property("machine").value<CMachine>(); 887 if (comMachine.isNull()) 888 return; 889 890 /* Prepare table: */ 891 UITextTable table; 892 893 /* Gather information: */ 894 if (comMachine.GetAccessible()) 895 { 637 638 return table; 639 } 640 641 UITextTable generateMachineInformationUSB(CMachine &comMachine, 642 const UIExtraDataMetaDefs::DetailsElementOptionTypeUsb &fOptions) 643 { 644 645 UITextTable table; 646 647 if (comMachine.isNull()) 648 return table; 649 650 if (!comMachine.GetAccessible()) 651 { 652 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString()); 653 return table; 654 } 896 655 /* Iterate over all the USB filters: */ 897 656 const CUSBDeviceFilters comFilterObject = comMachine.GetUSBDeviceFilters(); … … 902 661 { 903 662 /* USB controllers: */ 904 if ( m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeUsb_Controller)663 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeUsb_Controller) 905 664 { 906 665 QStringList controllersReadable; … … 912 671 913 672 /* Device filters: */ 914 if ( m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeUsb_DeviceFilters)673 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeUsb_DeviceFilters) 915 674 { 916 675 const CUSBDeviceFilterVector filters = comFilterObject.GetDeviceFilters(); … … 928 687 else 929 688 table << UITextTableLine(QApplication::translate("UIDetails", "USB Controller Inaccessible", "details (usb)"), QString()); 930 } 931 else 932 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString()); 933 934 /* Save the table as property: */ 935 setProperty("table", QVariant::fromValue(table)); 936 } 937 938 UITask *UIDetailsElementUSB::createUpdateTask() 939 { 940 return new UIDetailsUpdateTaskUSB(machine(), model()->optionsUsb()); 941 } 942 943 944 void UIDetailsUpdateTaskSF::run() 945 { 946 /* Acquire corresponding machine: */ 947 CMachine comMachine = property("machine").value<CMachine>(); 948 if (comMachine.isNull()) 949 return; 950 951 /* Prepare table: */ 952 UITextTable table; 953 954 /* Gather information: */ 955 if (comMachine.GetAccessible()) 956 { 689 690 return table; 691 } 692 693 UITextTable generateMachineInformationSharedFolders(CMachine &comMachine, 694 const UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders &fOptions) 695 { 696 (void)fOptions; 697 UITextTable table; 698 699 if (comMachine.isNull()) 700 return table; 701 702 if (!comMachine.GetAccessible()) 703 { 704 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString()); 705 return table; 706 } 957 707 /* Summary: */ 958 708 const ulong uCount = comMachine.GetSharedFolders().size(); … … 961 711 else 962 712 table << UITextTableLine(QApplication::translate("UIDetails", "None", "details (shared folders)"), QString()); 963 } 964 else 965 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString()); 966 967 /* Save the table as property: */ 968 setProperty("table", QVariant::fromValue(table)); 969 } 970 971 UITask *UIDetailsElementSF::createUpdateTask() 972 { 973 return new UIDetailsUpdateTaskSF(machine(), model()->optionsSharedFolders()); 974 } 975 976 977 void UIDetailsUpdateTaskUI::run() 978 { 979 /* Acquire corresponding machine: */ 980 CMachine comMachine = property("machine").value<CMachine>(); 981 if (comMachine.isNull()) 982 return; 983 984 /* Prepare table: */ 985 UITextTable table; 986 987 /* Gather information: */ 988 if (comMachine.GetAccessible()) 989 { 713 714 return table; 715 } 716 717 UITextTable generateMachineInformationUI(CMachine &comMachine, 718 const UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface &fOptions) 719 { 720 UITextTable table; 721 722 if (comMachine.isNull()) 723 return table; 724 725 if (!comMachine.GetAccessible()) 726 { 727 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString()); 728 return table; 729 } 730 /* Gather information: */ 990 731 #ifndef VBOX_WS_MAC 991 992 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_MenuBar)993 994 995 996 997 || strMenubarEnabled.compare("no", Qt::CaseInsensitive) == 0998 || strMenubarEnabled.compare("off", Qt::CaseInsensitive) == 0999 || strMenubarEnabled == "0");1000 1001 1002 1003 1004 732 /* Menu-bar: */ 733 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_MenuBar) 734 { 735 const QString strMenubarEnabled = comMachine.GetExtraData(UIExtraDataDefs::GUI_MenuBar_Enabled); 736 /* Try to convert loaded data to bool: */ 737 const bool fEnabled = !( strMenubarEnabled.compare("false", Qt::CaseInsensitive) == 0 738 || strMenubarEnabled.compare("no", Qt::CaseInsensitive) == 0 739 || strMenubarEnabled.compare("off", Qt::CaseInsensitive) == 0 740 || strMenubarEnabled == "0"); 741 /* Append information: */ 742 table << UITextTableLine(QApplication::translate("UIDetails", "Menu-bar", "details (user interface)"), 743 fEnabled ? QApplication::translate("UIDetails", "Enabled", "details (user interface/menu-bar)") 744 : QApplication::translate("UIDetails", "Disabled", "details (user interface/menu-bar)")); 745 } 1005 746 #endif /* !VBOX_WS_MAC */ 1006 747 1007 1008 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_StatusBar)1009 1010 1011 1012 1013 || strStatusbarEnabled.compare("no", Qt::CaseInsensitive) == 01014 || strStatusbarEnabled.compare("off", Qt::CaseInsensitive) == 01015 || strStatusbarEnabled == "0");1016 1017 1018 1019 1020 748 /* Status-bar: */ 749 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_StatusBar) 750 { 751 const QString strStatusbarEnabled = comMachine.GetExtraData(UIExtraDataDefs::GUI_StatusBar_Enabled); 752 /* Try to convert loaded data to bool: */ 753 const bool fEnabled = !( strStatusbarEnabled.compare("false", Qt::CaseInsensitive) == 0 754 || strStatusbarEnabled.compare("no", Qt::CaseInsensitive) == 0 755 || strStatusbarEnabled.compare("off", Qt::CaseInsensitive) == 0 756 || strStatusbarEnabled == "0"); 757 /* Append information: */ 758 table << UITextTableLine(QApplication::translate("UIDetails", "Status-bar", "details (user interface)"), 759 fEnabled ? QApplication::translate("UIDetails", "Enabled", "details (user interface/status-bar)") 760 : QApplication::translate("UIDetails", "Disabled", "details (user interface/status-bar)")); 761 } 1021 762 1022 763 #ifndef VBOX_WS_MAC 1023 1024 if (m_fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_MiniToolbar)1025 1026 1027 1028 1029 || strMiniToolbarEnabled.compare("no", Qt::CaseInsensitive) == 01030 || strMiniToolbarEnabled.compare("off", Qt::CaseInsensitive) == 01031 || strMiniToolbarEnabled == "0");1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 /* Append information: */1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 764 /* Mini-toolbar: */ 765 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_MiniToolbar) 766 { 767 const QString strMiniToolbarEnabled = comMachine.GetExtraData(UIExtraDataDefs::GUI_ShowMiniToolBar); 768 /* Try to convert loaded data to bool: */ 769 const bool fEnabled = !( strMiniToolbarEnabled.compare("false", Qt::CaseInsensitive) == 0 770 || strMiniToolbarEnabled.compare("no", Qt::CaseInsensitive) == 0 771 || strMiniToolbarEnabled.compare("off", Qt::CaseInsensitive) == 0 772 || strMiniToolbarEnabled == "0"); 773 /* Append information: */ 774 if (fEnabled) 775 { 776 /* Get mini-toolbar position: */ 777 const QString strMiniToolbarPosition = comMachine.GetExtraData(UIExtraDataDefs::GUI_MiniToolBarAlignment); 778 { 779 /* Try to convert loaded data to alignment: */ 780 switch (gpConverter->fromInternalString<MiniToolbarAlignment>(strMiniToolbarPosition)) 781 { 782 /* Append information: */ 783 case MiniToolbarAlignment_Top: 784 table << UITextTableLine(QApplication::translate("UIDetails", "Mini-toolbar Position", "details (user interface)"), 785 QApplication::translate("UIDetails", "Top", "details (user interface/mini-toolbar position)")); 786 break; 787 /* Append information: */ 788 case MiniToolbarAlignment_Bottom: 789 table << UITextTableLine(QApplication::translate("UIDetails", "Mini-toolbar Position", "details (user interface)"), 790 QApplication::translate("UIDetails", "Bottom", "details (user interface/mini-toolbar position)")); 791 break; 792 } 793 } 794 } 795 /* Append information: */ 796 else 797 table << UITextTableLine(QApplication::translate("UIDetails", "Mini-toolbar", "details (user interface)"), 798 QApplication::translate("UIDetails", "Disabled", "details (user interface/mini-toolbar)")); 799 } 1059 800 #endif /* !VBOX_WS_MAC */ 1060 } 1061 else 1062 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString()); 1063 1064 /* Save the table as property: */ 1065 setProperty("table", QVariant::fromValue(table)); 1066 } 1067 1068 UITask *UIDetailsElementUI::createUpdateTask() 1069 { 1070 return new UIDetailsUpdateTaskUI(machine(), model()->optionsUserInterface()); 1071 } 1072 1073 1074 void UIDetailsUpdateTaskDescription::run() 1075 { 1076 /* Acquire corresponding machine: */ 1077 CMachine comMachine = property("machine").value<CMachine>(); 1078 if (comMachine.isNull()) 1079 return; 1080 1081 /* Prepare table: */ 1082 UITextTable table; 1083 1084 /* Gather information: */ 1085 if (comMachine.GetAccessible()) 1086 { 801 return table; 802 } 803 804 UITextTable generateMachineInformationDetails(CMachine &comMachine, 805 const UIExtraDataMetaDefs::DetailsElementOptionTypeDescription &fOptions) 806 { 807 (void)fOptions; 808 UITextTable table; 809 810 if (comMachine.isNull()) 811 return table; 812 813 if (!comMachine.GetAccessible()) 814 { 815 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString()); 816 return table; 817 } 818 819 /* Gather information: */ 1087 820 /* Summary: */ 1088 821 const QString strDescription = comMachine.GetDescription(); … … 1091 824 else 1092 825 table << UITextTableLine(QApplication::translate("UIDetails", "None", "details (description)"), QString()); 1093 } 1094 else 1095 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString()); 1096 1097 /* Save the table as property: */ 1098 setProperty("table", QVariant::fromValue(table)); 826 827 return table; 828 } 1099 829 } 1100 1101 UITask *UIDetailsElementDescription::createUpdateTask()1102 {1103 return new UIDetailsUpdateTaskDescription(machine(), model()->optionsDescription());1104 } -
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsGenerator.h
r77409 r77427 1 1 /* $Id$ */ 2 2 /** @file 3 * VBox Qt GUI - UIDetails Element[Name] classesdeclaration.3 * VBox Qt GUI - UIDetailsGenerator declaration. 4 4 */ 5 5 … … 16 16 */ 17 17 18 #ifndef FEQT_INCLUDED_SRC_manager_details_UIDetails Elements_h19 #define FEQT_INCLUDED_SRC_manager_details_UIDetails Elements_h18 #ifndef FEQT_INCLUDED_SRC_manager_details_UIDetailsGenerator_h 19 #define FEQT_INCLUDED_SRC_manager_details_UIDetailsGenerator_h 20 20 #ifndef RT_WITHOUT_PRAGMA_ONCE 21 21 # pragma once 22 22 #endif 23 23 24 /* GUI includes: */ 25 #include "UIThreadPool.h" 26 #include "UIDetailsElement.h" 24 namespace UIDetailsGenerator 25 { 26 UITextTable generateMachineInformationGeneral(CMachine &comMachine, 27 const UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral &fOptions); 27 28 28 /* Forward declarations: */ 29 class UIMachinePreview; 30 class CNetworkAdapter; 29 UITextTable generateMachineInformationSystem(CMachine &comMachine, 30 const UIExtraDataMetaDefs::DetailsElementOptionTypeSystem &fOptions); 31 31 32 UITextTable generateMachineInformationDisplay(CMachine &comMachine, 33 const UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay &fOptions); 32 34 33 /** UITask extension used as update task for the details-element. */ 34 class UIDetailsUpdateTask : public UITask 35 { 36 Q_OBJECT; 35 UITextTable generateMachineInformationStorage(CMachine &comMachine, 36 const UIExtraDataMetaDefs::DetailsElementOptionTypeStorage &fOptions); 37 37 38 public: 38 UITextTable generateMachineInformationAudio(CMachine &comMachine, 39 const UIExtraDataMetaDefs::DetailsElementOptionTypeAudio &fOptions); 39 40 40 /** Constructs update task taking @a comMachine as data. */ 41 UIDetailsUpdateTask(const CMachine &comMachine); 42 }; 41 UITextTable generateMachineInformationNetwork(CMachine &comMachine, 42 const UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork &fOptions); 43 43 44 /** UIDetailsElement extension used as a wrapping interface to 45 * extend base-class with async functionality performed by the COM worker-threads. */ 46 class UIDetailsElementInterface : public UIDetailsElement 47 { 48 Q_OBJECT; 44 UITextTable generateMachineInformationSerial(CMachine &comMachine, 45 const UIExtraDataMetaDefs::DetailsElementOptionTypeSerial &fOptions); 49 46 50 public: 47 UITextTable generateMachineInformationUSB(CMachine &comMachine, 48 const UIExtraDataMetaDefs::DetailsElementOptionTypeUsb &fOptions); 51 49 52 /** Constructs details-element interface for passed @a pParent set. 53 * @param type brings the details-element type this element belongs to. 54 * @param fOpened brings whether the details-element should be visually opened. */ 55 UIDetailsElementInterface(UIDetailsSet *pParent, DetailsElementType type, bool fOpened); 50 UITextTable generateMachineInformationSharedFolders(CMachine &comMachine, 51 const UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders &fOptions); 56 52 57 protected: 53 UITextTable generateMachineInformationUI(CMachine &comMachine, 54 const UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface &fOptions); 58 55 59 /** Performs translation. */ 60 virtual void retranslateUi(); 56 UITextTable generateMachineInformationDetails(CMachine &comMachine, 57 const UIExtraDataMetaDefs::DetailsElementOptionTypeDescription &fOptions); 58 } 61 59 62 /** Updates appearance. */ 63 virtual void updateAppearance(); 64 65 /** Creates update task. */ 66 virtual UITask *createUpdateTask() = 0; 67 68 private slots: 69 70 /** Handles the signal about update @a pTask is finished. */ 71 virtual void sltUpdateAppearanceFinished(UITask *pTask); 72 73 private: 74 75 /** Holds the instance of the update task. */ 76 UITask *m_pTask; 77 }; 78 79 80 /** UIDetailsElementInterface extension for the details-element type 'Preview'. */ 81 class UIDetailsElementPreview : public UIDetailsElement 82 { 83 Q_OBJECT; 84 85 public: 86 87 /** Constructs details-element interface for passed @a pParent set. 88 * @param fOpened brings whether the details-element should be opened. */ 89 UIDetailsElementPreview(UIDetailsSet *pParent, bool fOpened); 90 91 private slots: 92 93 /** Handles preview size-hint changes. */ 94 void sltPreviewSizeHintChanged(); 95 96 private: 97 98 /** Performs translation. */ 99 virtual void retranslateUi(); 100 101 /** Returns minimum width hint. */ 102 int minimumWidthHint() const; 103 /** Returns minimum height hint. 104 * @param fClosed allows to specify whether the hint should 105 * be calculated for the closed element. */ 106 int minimumHeightHintForElement(bool fClosed) const; 107 /** Updates layout. */ 108 void updateLayout(); 109 110 /** Updates appearance. */ 111 void updateAppearance(); 112 113 /** Holds the instance of VM preview. */ 114 UIMachinePreview *m_pPreview; 115 }; 116 117 118 /** UITask extension used as update task for the details-element type 'General'. */ 119 class UIDetailsUpdateTaskGeneral : public UIDetailsUpdateTask 120 { 121 Q_OBJECT; 122 123 public: 124 125 /** Constructs update task passing @a comMachine to the base-class. */ 126 UIDetailsUpdateTaskGeneral(const CMachine &comMachine, UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral fOptions) 127 : UIDetailsUpdateTask(comMachine), m_fOptions(fOptions) {} 128 129 private: 130 131 /** Contains update task body. */ 132 void run(); 133 134 /** Holds the options. */ 135 UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral m_fOptions; 136 }; 137 138 /** UIDetailsElementInterface extension for the details-element type 'General'. */ 139 class UIDetailsElementGeneral : public UIDetailsElementInterface 140 { 141 Q_OBJECT; 142 143 public: 144 145 /** Constructs details-element object for passed @a pParent set. 146 * @param fOpened brings whether the details-element should be visually opened. */ 147 UIDetailsElementGeneral(UIDetailsSet *pParent, bool fOpened) 148 : UIDetailsElementInterface(pParent, DetailsElementType_General, fOpened) {} 149 150 private: 151 152 /** Creates update task for this element. */ 153 virtual UITask *createUpdateTask() /* override */; 154 }; 155 156 157 /** UITask extension used as update task for the details-element type 'System'. */ 158 class UIDetailsUpdateTaskSystem : public UIDetailsUpdateTask 159 { 160 Q_OBJECT; 161 162 public: 163 164 /** Constructs update task passing @a comMachine to the base-class. */ 165 UIDetailsUpdateTaskSystem(const CMachine &comMachine, UIExtraDataMetaDefs::DetailsElementOptionTypeSystem fOptions) 166 : UIDetailsUpdateTask(comMachine), m_fOptions(fOptions) {} 167 168 private: 169 170 /** Contains update task body. */ 171 void run(); 172 173 /** Holds the options. */ 174 UIExtraDataMetaDefs::DetailsElementOptionTypeSystem m_fOptions; 175 }; 176 177 /** UIDetailsElementInterface extension for the details-element type 'System'. */ 178 class UIDetailsElementSystem : public UIDetailsElementInterface 179 { 180 Q_OBJECT; 181 182 public: 183 184 /** Constructs details-element object for passed @a pParent set. 185 * @param fOpened brings whether the details-element should be visually opened. */ 186 UIDetailsElementSystem(UIDetailsSet *pParent, bool fOpened) 187 : UIDetailsElementInterface(pParent, DetailsElementType_System, fOpened) {} 188 189 private: 190 191 /** Creates update task for this element. */ 192 virtual UITask *createUpdateTask() /* override */; 193 }; 194 195 196 /** UITask extension used as update task for the details-element type 'Display'. */ 197 class UIDetailsUpdateTaskDisplay : public UIDetailsUpdateTask 198 { 199 Q_OBJECT; 200 201 public: 202 203 /** Constructs update task passing @a comMachine to the base-class. */ 204 UIDetailsUpdateTaskDisplay(const CMachine &comMachine, UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay fOptions) 205 : UIDetailsUpdateTask(comMachine), m_fOptions(fOptions) {} 206 207 private: 208 209 /** Contains update task body. */ 210 void run(); 211 212 /** Holds the options. */ 213 UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay m_fOptions; 214 }; 215 216 /** UIDetailsElementInterface extension for the details-element type 'Display'. */ 217 class UIDetailsElementDisplay : public UIDetailsElementInterface 218 { 219 Q_OBJECT; 220 221 public: 222 223 /** Constructs details-element object for passed @a pParent set. 224 * @param fOpened brings whether the details-element should be visually opened. */ 225 UIDetailsElementDisplay(UIDetailsSet *pParent, bool fOpened) 226 : UIDetailsElementInterface(pParent, DetailsElementType_Display, fOpened) {} 227 228 private: 229 230 /** Creates update task for this element. */ 231 virtual UITask *createUpdateTask() /* override */; 232 }; 233 234 235 /** UITask extension used as update task for the details-element type 'Storage'. */ 236 class UIDetailsUpdateTaskStorage : public UIDetailsUpdateTask 237 { 238 Q_OBJECT; 239 240 public: 241 242 /** Constructs update task passing @a comMachine to the base-class. */ 243 UIDetailsUpdateTaskStorage(const CMachine &comMachine, UIExtraDataMetaDefs::DetailsElementOptionTypeStorage fOptions) 244 : UIDetailsUpdateTask(comMachine), m_fOptions(fOptions) {} 245 246 private: 247 248 /** Contains update task body. */ 249 void run(); 250 251 /** Holds the options. */ 252 UIExtraDataMetaDefs::DetailsElementOptionTypeStorage m_fOptions; 253 }; 254 255 /** UIDetailsElementInterface extension for the details-element type 'Storage'. */ 256 class UIDetailsElementStorage : public UIDetailsElementInterface 257 { 258 Q_OBJECT; 259 260 public: 261 262 /** Constructs details-element object for passed @a pParent set. 263 * @param fOpened brings whether the details-element should be visually opened. */ 264 UIDetailsElementStorage(UIDetailsSet *pParent, bool fOpened) 265 : UIDetailsElementInterface(pParent, DetailsElementType_Storage, fOpened) {} 266 267 private: 268 269 /** Creates update task for this element. */ 270 virtual UITask *createUpdateTask() /* override */; 271 }; 272 273 274 /** UITask extension used as update task for the details-element type 'Audio'. */ 275 class UIDetailsUpdateTaskAudio : public UIDetailsUpdateTask 276 { 277 Q_OBJECT; 278 279 public: 280 281 /** Constructs update task passing @a comMachine to the base-class. */ 282 UIDetailsUpdateTaskAudio(const CMachine &comMachine, UIExtraDataMetaDefs::DetailsElementOptionTypeAudio fOptions) 283 : UIDetailsUpdateTask(comMachine), m_fOptions(fOptions) {} 284 285 private: 286 287 /** Contains update task body. */ 288 void run(); 289 290 /** Holds the options. */ 291 UIExtraDataMetaDefs::DetailsElementOptionTypeAudio m_fOptions; 292 }; 293 294 /** UIDetailsElementInterface extension for the details-element type 'Audio'. */ 295 class UIDetailsElementAudio : public UIDetailsElementInterface 296 { 297 Q_OBJECT; 298 299 public: 300 301 /** Constructs details-element object for passed @a pParent set. 302 * @param fOpened brings whether the details-element should be visually opened. */ 303 UIDetailsElementAudio(UIDetailsSet *pParent, bool fOpened) 304 : UIDetailsElementInterface(pParent, DetailsElementType_Audio, fOpened) {} 305 306 private: 307 308 /** Creates update task for this element. */ 309 virtual UITask *createUpdateTask() /* override */; 310 }; 311 312 313 /** UITask extension used as update task for the details-element type 'Network'. */ 314 class UIDetailsUpdateTaskNetwork : public UIDetailsUpdateTask 315 { 316 Q_OBJECT; 317 318 public: 319 320 /** Constructs update task passing @a comMachine to the base-class. */ 321 UIDetailsUpdateTaskNetwork(const CMachine &comMachine, UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork fOptions) 322 : UIDetailsUpdateTask(comMachine), m_fOptions(fOptions) {} 323 324 private: 325 326 /** Contains update task body. */ 327 void run(); 328 329 /** Summarizes generic properties. */ 330 static QString summarizeGenericProperties(const CNetworkAdapter &adapter); 331 332 /** Holds the options. */ 333 UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork m_fOptions; 334 }; 335 336 /** UIDetailsElementInterface extension for the details-element type 'Network'. */ 337 class UIDetailsElementNetwork : public UIDetailsElementInterface 338 { 339 Q_OBJECT; 340 341 public: 342 343 /** Constructs details-element object for passed @a pParent set. 344 * @param fOpened brings whether the details-element should be visually opened. */ 345 UIDetailsElementNetwork(UIDetailsSet *pParent, bool fOpened) 346 : UIDetailsElementInterface(pParent, DetailsElementType_Network, fOpened) {} 347 348 private: 349 350 /** Creates update task for this element. */ 351 virtual UITask *createUpdateTask() /* override */; 352 }; 353 354 355 /** UITask extension used as update task for the details-element type 'Serial'. */ 356 class UIDetailsUpdateTaskSerial : public UIDetailsUpdateTask 357 { 358 Q_OBJECT; 359 360 public: 361 362 /** Constructs update task passing @a comMachine to the base-class. */ 363 UIDetailsUpdateTaskSerial(const CMachine &comMachine, UIExtraDataMetaDefs::DetailsElementOptionTypeSerial fOptions) 364 : UIDetailsUpdateTask(comMachine), m_fOptions(fOptions) {} 365 366 private: 367 368 /** Contains update task body. */ 369 void run(); 370 371 /** Holds the options. */ 372 UIExtraDataMetaDefs::DetailsElementOptionTypeSerial m_fOptions; 373 }; 374 375 /** UIDetailsElementInterface extension for the details-element type 'Serial'. */ 376 class UIDetailsElementSerial : public UIDetailsElementInterface 377 { 378 Q_OBJECT; 379 380 public: 381 382 /** Constructs details-element object for passed @a pParent set. 383 * @param fOpened brings whether the details-element should be visually opened. */ 384 UIDetailsElementSerial(UIDetailsSet *pParent, bool fOpened) 385 : UIDetailsElementInterface(pParent, DetailsElementType_Serial, fOpened) {} 386 387 private: 388 389 /** Creates update task for this element. */ 390 virtual UITask *createUpdateTask() /* override */; 391 }; 392 393 394 /** UITask extension used as update task for the details-element type 'USB'. */ 395 class UIDetailsUpdateTaskUSB : public UIDetailsUpdateTask 396 { 397 Q_OBJECT; 398 399 public: 400 401 /** Constructs update task passing @a comMachine to the base-class. */ 402 UIDetailsUpdateTaskUSB(const CMachine &comMachine, UIExtraDataMetaDefs::DetailsElementOptionTypeUsb fOptions) 403 : UIDetailsUpdateTask(comMachine), m_fOptions(fOptions) {} 404 405 private: 406 407 /** Contains update task body. */ 408 void run(); 409 410 /** Holds the options. */ 411 UIExtraDataMetaDefs::DetailsElementOptionTypeUsb m_fOptions; 412 }; 413 414 /** UIDetailsElementInterface extension for the details-element type 'USB'. */ 415 class UIDetailsElementUSB : public UIDetailsElementInterface 416 { 417 Q_OBJECT; 418 419 public: 420 421 /** Constructs details-element object for passed @a pParent set. 422 * @param fOpened brings whether the details-element should be visually opened. */ 423 UIDetailsElementUSB(UIDetailsSet *pParent, bool fOpened) 424 : UIDetailsElementInterface(pParent, DetailsElementType_USB, fOpened) {} 425 426 private: 427 428 /** Creates update task for this element. */ 429 virtual UITask *createUpdateTask() /* override */; 430 }; 431 432 433 /** UITask extension used as update task for the details-element type 'SF'. */ 434 class UIDetailsUpdateTaskSF : public UIDetailsUpdateTask 435 { 436 Q_OBJECT; 437 438 public: 439 440 /** Constructs update task passing @a comMachine to the base-class. */ 441 UIDetailsUpdateTaskSF(const CMachine &comMachine, UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders fOptions) 442 : UIDetailsUpdateTask(comMachine), m_fOptions(fOptions) {} 443 444 private: 445 446 /** Contains update task body. */ 447 void run(); 448 449 /** Holds the options. */ 450 UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders m_fOptions; 451 }; 452 453 /** UIDetailsElementInterface extension for the details-element type 'SF'. */ 454 class UIDetailsElementSF : public UIDetailsElementInterface 455 { 456 Q_OBJECT; 457 458 public: 459 460 /** Constructs details-element object for passed @a pParent set. 461 * @param fOpened brings whether the details-element should be visually opened. */ 462 UIDetailsElementSF(UIDetailsSet *pParent, bool fOpened) 463 : UIDetailsElementInterface(pParent, DetailsElementType_SF, fOpened) {} 464 465 private: 466 467 /** Creates update task for this element. */ 468 virtual UITask *createUpdateTask() /* override */; 469 }; 470 471 472 /** UITask extension used as update task for the details-element type 'UI'. */ 473 class UIDetailsUpdateTaskUI : public UIDetailsUpdateTask 474 { 475 Q_OBJECT; 476 477 public: 478 479 /** Constructs update task passing @a comMachine to the base-class. */ 480 UIDetailsUpdateTaskUI(const CMachine &comMachine, UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface fOptions) 481 : UIDetailsUpdateTask(comMachine), m_fOptions(fOptions) {} 482 483 private: 484 485 /** Contains update task body. */ 486 void run(); 487 488 /** Holds the options. */ 489 UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface m_fOptions; 490 }; 491 492 /** UIDetailsElementInterface extension for the details-element type 'UI'. */ 493 class UIDetailsElementUI : public UIDetailsElementInterface 494 { 495 Q_OBJECT; 496 497 public: 498 499 /** Constructs details-element object for passed @a pParent set. 500 * @param fOpened brings whether the details-element should be visually opened. */ 501 UIDetailsElementUI(UIDetailsSet *pParent, bool fOpened) 502 : UIDetailsElementInterface(pParent, DetailsElementType_UI, fOpened) {} 503 504 private: 505 506 /** Creates update task for this element. */ 507 virtual UITask *createUpdateTask() /* override */; 508 }; 509 510 511 /** UITask extension used as update task for the details-element type 'Description'. */ 512 class UIDetailsUpdateTaskDescription : public UIDetailsUpdateTask 513 { 514 Q_OBJECT; 515 516 public: 517 518 /** Constructs update task passing @a comMachine to the base-class. */ 519 UIDetailsUpdateTaskDescription(const CMachine &comMachine, UIExtraDataMetaDefs::DetailsElementOptionTypeDescription fOptions) 520 : UIDetailsUpdateTask(comMachine), m_fOptions(fOptions) {} 521 522 private: 523 524 /** Contains update task body. */ 525 void run(); 526 527 /** Holds the options. */ 528 UIExtraDataMetaDefs::DetailsElementOptionTypeDescription m_fOptions; 529 }; 530 531 /** UIDetailsElementInterface extension for the details-element type 'Description'. */ 532 class UIDetailsElementDescription : public UIDetailsElementInterface 533 { 534 Q_OBJECT; 535 536 public: 537 538 /** Constructs details-element object for passed @a pParent set. 539 * @param fOpened brings whether the details-element should be visually opened. */ 540 UIDetailsElementDescription(UIDetailsSet *pParent, bool fOpened) 541 : UIDetailsElementInterface(pParent, DetailsElementType_Description, fOpened) {} 542 543 private: 544 545 /** Creates update task for this element. */ 546 virtual UITask *createUpdateTask() /* override */; 547 }; 548 549 #endif /* !FEQT_INCLUDED_SRC_manager_details_UIDetailsElements_h */ 550 60 #endif /* !FEQT_INCLUDED_SRC_manager_details_UIDetailsGenerator_h */
Note:
See TracChangeset
for help on using the changeset viewer.