Changeset 77428 in vbox
- Timestamp:
- Feb 22, 2019 11:38:37 AM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 128991
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 2 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r77427 r77428 1053 1053 src/manager/details/UIDetailsElement.cpp \ 1054 1054 src/manager/details/UIDetailsElements.cpp \ 1055 src/manager/details/UIDetailsGenerator.cpp \1056 1055 src/manager/details/UIMachinePreview.cpp \ 1057 1056 src/manager/tools/UITools.cpp \ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElements.cpp
r77427 r77428 23 23 /* GUI includes: */ 24 24 #include "UIDetailsElements.h" 25 #include "UIDetailsGenerator.h"26 25 #include "UIDetailsModel.h" 27 26 #include "UIMachinePreview.h" … … 51 50 #include "CMedium.h" 52 51 52 53 53 UIDetailsUpdateTask::UIDetailsUpdateTask(const CMachine &machine) 54 54 : UITask(UITask::Type_DetailsPopulation) … … 229 229 return; 230 230 231 /* Generate the table: */ 232 UITextTable table = UIDetailsGenerator::generateMachineInformationGeneral(comMachine, m_fOptions); 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: */ 233 277 setProperty("table", QVariant::fromValue(table)); 234 278 } … … 248 292 249 293 /* Prepare table: */ 250 UITextTable table = UIDetailsGenerator::generateMachineInformationSystem(comMachine, m_fOptions); 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 251 405 /* Save the table as property: */ 252 406 setProperty("table", QVariant::fromValue(table)); … … 267 421 268 422 /* Prepare table: */ 269 UITextTable table = UIDetailsGenerator::generateMachineInformationDisplay(comMachine, m_fOptions); 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()); 270 523 271 524 /* Save the table as property: */ … … 287 540 288 541 /* Prepare table: */ 289 UITextTable table = UIDetailsGenerator::generateMachineInformationStorage(comMachine, m_fOptions); 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()); 290 622 291 623 /* Save the table as property: */ … … 307 639 308 640 /* Prepare table: */ 309 UITextTable table = UIDetailsGenerator::generateMachineInformationAudio(comMachine, m_fOptions); 310 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()); 311 681 312 682 /* Save the table as property: */ … … 318 688 return new UIDetailsUpdateTaskAudio(machine(), model()->optionsAudio()); 319 689 } 690 320 691 321 692 void UIDetailsUpdateTaskNetwork::run() … … 327 698 328 699 /* Prepare table: */ 329 UITextTable table = UIDetailsGenerator::generateMachineInformationNetwork(comMachine, m_fOptions); 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()); 330 777 331 778 /* Save the table as property: */ … … 337 784 return new UIDetailsUpdateTaskNetwork(machine(), model()->optionsNetwork()); 338 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 339 803 340 804 void UIDetailsUpdateTaskSerial::run() … … 346 810 347 811 /* Prepare table: */ 348 UITextTable table = UIDetailsGenerator::generateMachineInformationSerial(comMachine, m_fOptions); 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 349 873 /* Save the table as property: */ 350 874 setProperty("table", QVariant::fromValue(table)); … … 355 879 return new UIDetailsUpdateTaskSerial(machine(), model()->optionsSerial()); 356 880 } 881 357 882 358 883 void UIDetailsUpdateTaskUSB::run() … … 364 889 365 890 /* Prepare table: */ 366 UITextTable table = UIDetailsGenerator::generateMachineInformationUSB(comMachine, m_fOptions); 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()); 367 933 368 934 /* Save the table as property: */ … … 384 950 385 951 /* Prepare table: */ 386 UITextTable table = UIDetailsGenerator::generateMachineInformationSharedFolders(comMachine, m_fOptions); 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()); 387 966 388 967 /* Save the table as property: */ … … 404 983 405 984 /* Prepare table: */ 406 UITextTable table = UIDetailsGenerator::generateMachineInformationUI(comMachine, m_fOptions); 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()); 407 1063 408 1064 /* Save the table as property: */ … … 424 1080 425 1081 /* Prepare table: */ 426 UITextTable table = UIDetailsGenerator::generateMachineInformationDetails(comMachine, m_fOptions); 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()); 427 1096 428 1097 /* Save the table as property: */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElements.h
r77427 r77428 327 327 void run(); 328 328 329 /** Summarizes generic properties. */ 330 static QString summarizeGenericProperties(const CNetworkAdapter &adapter); 331 329 332 /** Holds the options. */ 330 333 UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork m_fOptions; … … 545 548 546 549 #endif /* !FEQT_INCLUDED_SRC_manager_details_UIDetailsElements_h */ 550
Note:
See TracChangeset
for help on using the changeset viewer.