- Timestamp:
- Jun 9, 2017 9:42:36 AM (8 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/selector
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISnapshotDetailsWidget.cpp
r67307 r67308 37 37 # include "UIConverter.h" 38 38 # include "UIDesktopWidgetWatchdog.h" 39 # include "UIExtraDataDefs.h"40 39 # include "UIIconPool.h" 41 40 # include "UISnapshotDetailsWidget.h" … … 65 64 66 65 66 /** QWiget extension providing GUI with snapshot details elements. */ 67 class UISnapshotDetailsElement : public QWidget 68 { 69 Q_OBJECT; 70 71 public: 72 73 /** Constructs details element passing @a pParent to the base-class. */ 74 UISnapshotDetailsElement(QWidget *pParent = 0); 75 76 /** Returns underlying text-document. */ 77 QTextDocument *document() const; 78 79 /** Defines text-document text. */ 80 void setText(const QString &strText); 81 82 /** Returns the minimum size-hint. */ 83 QSize minimumSizeHint() const; 84 85 private: 86 87 /** Prepares all. */ 88 void prepare(); 89 90 /** Holds the text-edit interface instance. */ 91 QTextEdit *m_pTextEdit; 92 }; 93 94 67 95 /** QWiget extension providing GUI with snapshot screenshot viewer widget. */ 68 96 class UIScreenshotViewer : public QIWithRetranslateUI2<QWidget> … … 128 156 bool m_fZoomMode; 129 157 }; 158 159 160 /********************************************************************************************************************************* 161 * Class UISnapshotDetailsElement implementation. * 162 *********************************************************************************************************************************/ 163 164 UISnapshotDetailsElement::UISnapshotDetailsElement(QWidget *pParent /* = 0 */) 165 : QWidget(pParent) 166 , m_pTextEdit(0) 167 { 168 /* Prepare: */ 169 prepare(); 170 } 171 172 QTextDocument *UISnapshotDetailsElement::document() const 173 { 174 /* Pass to private object: */ 175 return m_pTextEdit->document(); 176 } 177 178 void UISnapshotDetailsElement::setText(const QString &strText) 179 { 180 /* Pass to private object: */ 181 m_pTextEdit->setText(strText); 182 /* Update the layout: */ 183 updateGeometry(); 184 } 185 186 QSize UISnapshotDetailsElement::minimumSizeHint() const 187 { 188 /* Calculate minimum size-hint on the basis of margin, text-document ideal width and size: */ 189 const int iDocumentMargin = (int)m_pTextEdit->document()->documentMargin(); 190 const int iIdealWidth = (int)m_pTextEdit->document()->idealWidth() + 2 * iDocumentMargin; 191 QSize size = m_pTextEdit->document()->size().toSize(); 192 size += QSize(2 * iDocumentMargin, 2 * iDocumentMargin); 193 return QSize(iIdealWidth, size.height()); 194 } 195 196 void UISnapshotDetailsElement::prepare() 197 { 198 /* Create layout: */ 199 new QHBoxLayout(this); 200 AssertPtrReturnVoid(layout()); 201 { 202 /* Configure layout: */ 203 layout()->setContentsMargins(0, 0, 0, 0); 204 205 /* Create text-browser if requested, text-edit otherwise: */ 206 m_pTextEdit = new QTextEdit; 207 AssertPtrReturnVoid(m_pTextEdit); 208 { 209 /* Configure that we have: */ 210 m_pTextEdit->setReadOnly(true); 211 m_pTextEdit->setFocusPolicy(Qt::NoFocus); 212 m_pTextEdit->setFrameShape(QFrame::NoFrame); 213 m_pTextEdit->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); 214 m_pTextEdit->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); 215 m_pTextEdit->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); 216 217 /* Add into layout: */ 218 layout()->addWidget(m_pTextEdit); 219 } 220 } 221 } 130 222 131 223 … … 323 415 , m_pLabelDescription(0), m_pBrowserDescription(0) 324 416 , m_pLayoutDetails(0) 325 , m_p BrowserDetails(0)417 , m_pScrollAreaDetails(0) 326 418 { 327 419 /* Prepare: */ … … 396 488 397 489 /* Rebuild the details report: */ 398 m_pBrowserDetails->setText(detailsReport(comMachine)); 490 foreach (const DetailsElementType &enmType, m_details.keys()) 491 m_details.value(enmType)->setText(detailsReport(comMachine, enmType)); 399 492 } 400 493 else … … 408 501 // call but on setText(QString()) and even setText("") as well. 409 502 // Nice way to oversmart itself.. 410 m_pBrowserDetails->setText("<empty>"); 503 foreach (const DetailsElementType &enmType, m_details.keys()) 504 m_details.value(enmType)->setText("<empty>"); 411 505 } 412 506 } … … 577 671 void UISnapshotDetailsWidget::prepareTabDetails() 578 672 { 579 /* Create widget itself: */ 580 QWidget *pWidget = new QWidget; 581 AssertPtrReturnVoid(pWidget); 582 { 583 /* Create 'Details' layout: */ 584 m_pLayoutDetails = new QVBoxLayout(pWidget); 585 AssertPtrReturnVoid(m_pLayoutDetails); 586 { 587 /* Create details browser: */ 588 m_pBrowserDetails = new QTextEdit; 589 AssertPtrReturnVoid(m_pBrowserDetails); 590 { 591 /* Configure browser: */ 592 m_pBrowserDetails->setReadOnly(true); 593 m_pBrowserDetails->setFrameShadow(QFrame::Plain); 594 m_pBrowserDetails->setFrameShape(QFrame::NoFrame); 595 m_pBrowserDetails->viewport()->setAutoFillBackground(false); 596 QSizePolicy policy(QSizePolicy::Expanding, QSizePolicy::Expanding); 597 policy.setHorizontalStretch(1); 598 m_pBrowserDetails->setSizePolicy(policy); 599 m_pBrowserDetails->setFocus(); 600 /* Determine icon metric: */ 601 const QStyle *pStyle = QApplication::style(); 602 const int iIconMetric = pStyle->pixelMetric(QStyle::PM_SmallIconSize); 603 const QSize iconSize = QSize(iIconMetric, iIconMetric); 604 /* Register DetailsElementType icons in the m_pBrowserDetails document: */ 605 // WORKAROUND: 606 // Unfortunatelly we can't just enumerate types within 607 // cycle since they have exceptions like 'parallel' case. 608 QList<DetailsElementType> types; 609 types << DetailsElementType_General 610 << DetailsElementType_System 611 << DetailsElementType_Preview 612 << DetailsElementType_Display 613 << DetailsElementType_Storage 614 << DetailsElementType_Audio 615 << DetailsElementType_Network 616 << DetailsElementType_Serial 673 /* Create details scroll-area: */ 674 m_pScrollAreaDetails = new QScrollArea; 675 AssertPtrReturnVoid(m_pScrollAreaDetails); 676 { 677 /* Configure browser: */ 678 m_pScrollAreaDetails->setWidgetResizable(true); 679 m_pScrollAreaDetails->setFrameShadow(QFrame::Plain); 680 m_pScrollAreaDetails->setFrameShape(QFrame::NoFrame); 681 m_pScrollAreaDetails->viewport()->setAutoFillBackground(false); 682 683 /* Create details widget: */ 684 QWidget *pWidgetDetails = new QWidget; 685 AssertPtrReturnVoid(pWidgetDetails); 686 { 687 /* Create 'Details' layout: */ 688 m_pLayoutDetails = new QGridLayout(pWidgetDetails); 689 AssertPtrReturnVoid(m_pLayoutDetails); 690 { 691 /* Configure layout: */ 692 m_pLayoutDetails->setSpacing(5); 693 694 /* Create 'General' element: */ 695 m_details[DetailsElementType_General] = createDetailsElement(DetailsElementType_General); 696 AssertPtrReturnVoid(m_details[DetailsElementType_General]); 697 m_pLayoutDetails->addWidget(m_details[DetailsElementType_General], 0, 0); 698 699 /* Create 'System' element: */ 700 m_details[DetailsElementType_System] = createDetailsElement(DetailsElementType_System); 701 AssertPtrReturnVoid(m_details[DetailsElementType_System]); 702 m_pLayoutDetails->addWidget(m_details[DetailsElementType_System], 1, 0); 703 704 /* Create 'Display' element: */ 705 m_details[DetailsElementType_Display] = createDetailsElement(DetailsElementType_Display); 706 AssertPtrReturnVoid(m_details[DetailsElementType_Display]); 707 m_pLayoutDetails->addWidget(m_details[DetailsElementType_Display], 2, 0); 708 709 /* Create 'Storage' element: */ 710 m_details[DetailsElementType_Storage] = createDetailsElement(DetailsElementType_Storage); 711 AssertPtrReturnVoid(m_details[DetailsElementType_Storage]); 712 m_pLayoutDetails->addWidget(m_details[DetailsElementType_Storage], 3, 0); 713 714 /* Create 'Audio' element: */ 715 m_details[DetailsElementType_Audio] = createDetailsElement(DetailsElementType_Audio); 716 AssertPtrReturnVoid(m_details[DetailsElementType_Audio]); 717 m_pLayoutDetails->addWidget(m_details[DetailsElementType_Audio], 4, 0); 718 719 /* Create 'Network' element: */ 720 m_details[DetailsElementType_Network] = createDetailsElement(DetailsElementType_Network); 721 AssertPtrReturnVoid(m_details[DetailsElementType_Network]); 722 m_pLayoutDetails->addWidget(m_details[DetailsElementType_Network], 5, 0); 723 724 /* Create 'Serial' element: */ 725 m_details[DetailsElementType_Serial] = createDetailsElement(DetailsElementType_Serial); 726 AssertPtrReturnVoid(m_details[DetailsElementType_Serial]); 727 m_pLayoutDetails->addWidget(m_details[DetailsElementType_Serial], 6, 0); 728 617 729 #ifdef VBOX_WITH_PARALLEL_PORTS 618 << DetailsElementType_Parallel 730 /* Create 'Parallel' element: */ 731 m_details[DetailsElementType_Parallel] = createDetailsElement(DetailsElementType_Parallel); 732 AssertPtrReturnVoid(m_details[DetailsElementType_Parallel]); 733 m_pLayoutDetails->addWidget(m_details[DetailsElementType_Parallel], 7, 0); 619 734 #endif 620 << DetailsElementType_USB 621 << DetailsElementType_SF 622 << DetailsElementType_UI 623 << DetailsElementType_Description; 624 foreach (const DetailsElementType &enmType, types) 625 m_pBrowserDetails->document()->addResource( 626 QTextDocument::ImageResource, 627 QUrl(QString("details://%1").arg(gpConverter->toInternalString(enmType))), 628 QVariant(gpConverter->toIcon(enmType).pixmap(iconSize))); 629 630 /* Add into layout: */ 631 m_pLayoutDetails->addWidget(m_pBrowserDetails); 632 } 735 736 /* Create 'USB' element: */ 737 m_details[DetailsElementType_USB] = createDetailsElement(DetailsElementType_USB); 738 AssertPtrReturnVoid(m_details[DetailsElementType_USB]); 739 m_pLayoutDetails->addWidget(m_details[DetailsElementType_USB], 8, 0); 740 741 /* Create 'SF' element: */ 742 m_details[DetailsElementType_SF] = createDetailsElement(DetailsElementType_SF); 743 AssertPtrReturnVoid(m_details[DetailsElementType_SF]); 744 m_pLayoutDetails->addWidget(m_details[DetailsElementType_SF], 9, 0); 745 } 746 747 /* Add to scroll-area: */ 748 m_pScrollAreaDetails->setWidget(pWidgetDetails); 749 pWidgetDetails->setAutoFillBackground(false); 633 750 } 634 751 635 752 /* Add to tab-widget: */ 636 m_pTabWidget->addTab(pWidget, QString()); 637 } 753 m_pTabWidget->addTab(m_pScrollAreaDetails, QString()); 754 } 755 } 756 757 /* static */ 758 UISnapshotDetailsElement *UISnapshotDetailsWidget::createDetailsElement(DetailsElementType enmType) 759 { 760 /* Create element: */ 761 UISnapshotDetailsElement *pElement = new UISnapshotDetailsElement; 762 AssertPtrReturn(pElement, 0); 763 { 764 /* Configure element: */ 765 switch (enmType) 766 { 767 default: 768 pElement->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum); 769 break; 770 } 771 772 /* Register DetailsElementType icon in the element text-document: */ 773 const int iIconMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize); 774 const QSize iconSize = QSize(iIconMetric, iIconMetric); 775 pElement->document()->addResource( 776 QTextDocument::ImageResource, 777 QUrl(QString("details://%1").arg(gpConverter->toInternalString(enmType))), 778 QVariant(gpConverter->toIcon(enmType).pixmap(iconSize))); 779 } 780 /* Return element: */ 781 return pElement; 638 782 } 639 783 … … 728 872 } 729 873 730 QString UISnapshotDetailsWidget::detailsReport(const CMachine &comMachine )874 QString UISnapshotDetailsWidget::detailsReport(const CMachine &comMachine, DetailsElementType enmType) 731 875 { 732 876 /* Details templates: */ 733 877 static const char *sTableTpl = 734 878 "<table border=0 cellspacing=1 cellpadding=0 style='white-space:pre'>%1</table>"; 735 static const char *sSectionBoldTpl =879 static const char *sSectionBoldTpl1 = 736 880 "<tr>" 737 881 "<td width=%3 rowspan=%1 align=left><img src='%2'></td>" 738 882 "<td colspan=3><nobr><b>%4</b></nobr></td>" 739 883 "</tr>" 740 "%5" 741 "<tr>" 742 "<td colspan=3><font size=1> </font></td>" 743 "</tr>"; 884 "%5"; 744 885 static const char *sSectionItemTpl1 = 745 886 "<tr><td><nobr><i>%1</i></nobr></td><td/><td/></tr>"; … … 750 891 751 892 /* Use the const ref on the basis of implicit QString constructor: */ 752 const QString &strSectionTpl = sSectionBoldTpl ;893 const QString &strSectionTpl = sSectionBoldTpl1; 753 894 754 895 /* Determine icon metric: */ … … 758 899 /* Compose report: */ 759 900 QString strReport; 760 /* General: */ 761 { 762 /* Name, OS Type: */ 763 int iRowCount = 2; 764 QString strItem = QString(sSectionItemTpl2).arg(tr("Name", "details report"), 765 comMachine.GetName()) 766 + QString(sSectionItemTpl2).arg(tr("OS Type", "details report"), 767 vboxGlobal().vmGuestOSTypeDescription(comMachine.GetOSTypeId())); 768 769 /* Group(s)? */ 770 const QStringList &groups = comMachine.GetGroups().toList(); 771 if ( groups.size() > 1 772 || (groups.size() > 0 && groups.at(0) != "/")) 773 { 901 switch (enmType) 902 { 903 case DetailsElementType_General: 904 { 905 /* Name, OS Type: */ 906 int iRowCount = 2; 907 QString strItem = QString(sSectionItemTpl2).arg(tr("Name", "details report"), 908 comMachine.GetName()) 909 + QString(sSectionItemTpl2).arg(tr("OS Type", "details report"), 910 vboxGlobal().vmGuestOSTypeDescription(comMachine.GetOSTypeId())); 911 912 /* Group(s)? */ 913 const QStringList &groups = comMachine.GetGroups().toList(); 914 if ( groups.size() > 1 915 || (groups.size() > 0 && groups.at(0) != "/")) 916 { 917 ++iRowCount; 918 strItem += QString(sSectionItemTpl2).arg(tr("Group(s)", "details report"), 919 groups.join(", ")); 920 } 921 922 /* Append report: */ 923 strReport += strSectionTpl 924 .arg(1 + iRowCount) /* rows */ 925 .arg("details://general", /* icon */ 926 QString::number(iIconArea), /* icon area */ 927 tr("General", "details report"), /* title */ 928 strItem /* items */); 929 930 break; 931 } 932 case DetailsElementType_System: 933 { 934 /* Base Memory, Processor(s): */ 935 int iRowCount = 2; 936 QString strItem = QString(sSectionItemTpl2).arg(tr("Base Memory", "details report"), 937 tr("<nobr>%1 MB</nobr>", "details report") 938 .arg(QString::number(comMachine.GetMemorySize()))) 939 + QString(sSectionItemTpl2).arg(tr("Processor(s)", "details report"), 940 tr("<nobr>%1</nobr>", "details report") 941 .arg(QString::number(comMachine.GetCPUCount()))); 942 943 /* Execution Cap? */ 944 ULONG uExecutionCap = comMachine.GetCPUExecutionCap(); 945 if (uExecutionCap < 100) 946 { 947 ++iRowCount; 948 strItem += QString(sSectionItemTpl2).arg(tr("Execution Cap", "details report"), 949 tr("<nobr>%1%</nobr>", "details report") 950 .arg(comMachine.GetCPUExecutionCap())); 951 } 952 953 /* Boot Order: */ 774 954 ++iRowCount; 775 strItem += QString(sSectionItemTpl2).arg(tr("Group(s)", "details report"), 776 groups.join(", ")); 777 } 778 779 /* Append report: */ 780 strReport += strSectionTpl 781 .arg(2 + iRowCount) /* rows */ 782 .arg("details://general", /* icon */ 783 QString::number(iIconArea), /* icon area */ 784 tr("General", "details report"), /* title */ 785 strItem /* items */); 786 } 787 /* System: */ 788 { 789 /* Base Memory, Processor(s): */ 790 int iRowCount = 2; 791 QString strItem = QString(sSectionItemTpl2).arg(tr("Base Memory", "details report"), 792 tr("<nobr>%1 MB</nobr>", "details report") 793 .arg(QString::number(comMachine.GetMemorySize()))) 794 + QString(sSectionItemTpl2).arg(tr("Processor(s)", "details report"), 795 tr("<nobr>%1</nobr>", "details report") 796 .arg(QString::number(comMachine.GetCPUCount()))); 797 798 /* Execution Cap? */ 799 ULONG uExecutionCap = comMachine.GetCPUExecutionCap(); 800 if (uExecutionCap < 100) 801 { 955 QStringList bootOrder; 956 for (ulong i = 1; i <= vboxGlobal().virtualBox().GetSystemProperties().GetMaxBootPosition(); ++i) 957 { 958 const KDeviceType enmDevice = comMachine.GetBootOrder(i); 959 if (enmDevice != KDeviceType_Null) 960 bootOrder << gpConverter->toString(enmDevice); 961 } 962 if (bootOrder.isEmpty()) 963 bootOrder << gpConverter->toString(KDeviceType_Null); 964 strItem += QString(sSectionItemTpl2).arg(tr("Boot Order", "details report"), 965 bootOrder.join(", ")); 966 967 #ifdef VBOX_WITH_FULL_DETAILS_REPORT 968 969 /* Acquire BIOS Settings: */ 970 const CBIOSSettings &comBiosSettings = comMachine.GetBIOSSettings(); 971 972 /* ACPI: */ 802 973 ++iRowCount; 803 strItem += QString(sSectionItemTpl2).arg(tr("Execution Cap", "details report"), 804 tr("<nobr>%1%</nobr>", "details report") 805 .arg(comMachine.GetCPUExecutionCap())); 806 } 807 808 /* Boot Order: */ 809 ++iRowCount; 810 QStringList bootOrder; 811 for (ulong i = 1; i <= vboxGlobal().virtualBox().GetSystemProperties().GetMaxBootPosition(); ++i) 812 { 813 const KDeviceType enmDevice = comMachine.GetBootOrder(i); 814 if (enmDevice != KDeviceType_Null) 815 bootOrder << gpConverter->toString(enmDevice); 816 } 817 if (bootOrder.isEmpty()) 818 bootOrder << gpConverter->toString(KDeviceType_Null); 819 strItem += QString(sSectionItemTpl2).arg(tr("Boot Order", "details report"), 820 bootOrder.join(", ")); 821 822 #ifdef VBOX_WITH_FULL_DETAILS_REPORT 823 824 /* Acquire BIOS Settings: */ 825 const CBIOSSettings &comBiosSettings = comMachine.GetBIOSSettings(); 826 827 /* ACPI: */ 828 ++iRowCount; 829 const QString strAcpi = comBiosSettings.GetACPIEnabled() 830 ? tr("Enabled", "details report (ACPI)") 831 : tr("Disabled", "details report (ACPI)"); 832 strItem += QString(sSectionItemTpl2).arg(tr("ACPI", "details report"), strAcpi); 833 834 /* I/O APIC: */ 835 ++iRowCount; 836 const QString strIoapic = comBiosSettings.GetIOAPICEnabled() 837 ? tr("Enabled", "details report (I/O APIC)") 838 : tr("Disabled", "details report (I/O APIC)"); 839 strItem += QString(sSectionItemTpl2).arg(tr("I/O APIC", "details report"), strIoapic); 840 841 /* PAE/NX: */ 842 ++iRowCount; 843 const QString strPae = comMachine.GetCPUProperty(KCPUPropertyType_PAE) 844 ? tr("Enabled", "details report (PAE/NX)") 845 : tr("Disabled", "details report (PAE/NX)"); 846 strItem += QString(sSectionItemTpl2).arg(tr("PAE/NX", "details report"), strPae); 974 const QString strAcpi = comBiosSettings.GetACPIEnabled() 975 ? tr("Enabled", "details report (ACPI)") 976 : tr("Disabled", "details report (ACPI)"); 977 strItem += QString(sSectionItemTpl2).arg(tr("ACPI", "details report"), strAcpi); 978 979 /* I/O APIC: */ 980 ++iRowCount; 981 const QString strIoapic = comBiosSettings.GetIOAPICEnabled() 982 ? tr("Enabled", "details report (I/O APIC)") 983 : tr("Disabled", "details report (I/O APIC)"); 984 strItem += QString(sSectionItemTpl2).arg(tr("I/O APIC", "details report"), strIoapic); 985 986 /* PAE/NX: */ 987 ++iRowCount; 988 const QString strPae = comMachine.GetCPUProperty(KCPUPropertyType_PAE) 989 ? tr("Enabled", "details report (PAE/NX)") 990 : tr("Disabled", "details report (PAE/NX)"); 991 strItem += QString(sSectionItemTpl2).arg(tr("PAE/NX", "details report"), strPae); 847 992 848 993 #endif /* VBOX_WITH_FULL_DETAILS_REPORT */ 849 994 850 /* VT-x/AMD-V availability: */ 851 const bool fVTxAMDVSupported = vboxGlobal().host().GetProcessorFeature(KProcessorFeature_HWVirtEx); 852 if (fVTxAMDVSupported) 853 { 854 /* VT-x/AMD-V: */ 995 /* VT-x/AMD-V availability: */ 996 const bool fVTxAMDVSupported = vboxGlobal().host().GetProcessorFeature(KProcessorFeature_HWVirtEx); 997 if (fVTxAMDVSupported) 998 { 999 /* VT-x/AMD-V: */ 1000 ++iRowCount; 1001 const QString strVirt = comMachine.GetHWVirtExProperty(KHWVirtExPropertyType_Enabled) 1002 ? tr("Enabled", "details report (VT-x/AMD-V)") 1003 : tr("Disabled", "details report (VT-x/AMD-V)"); 1004 strItem += QString(sSectionItemTpl2).arg(tr("VT-x/AMD-V", "details report"), strVirt); 1005 1006 /* Nested Paging: */ 1007 ++iRowCount; 1008 const QString strNested = comMachine.GetHWVirtExProperty(KHWVirtExPropertyType_NestedPaging) 1009 ? tr("Enabled", "details report (Nested Paging)") 1010 : tr("Disabled", "details report (Nested Paging)"); 1011 strItem += QString(sSectionItemTpl2).arg(tr("Nested Paging", "details report"), strNested); 1012 } 1013 1014 /* Paravirtualization Interface: */ 855 1015 ++iRowCount; 856 const QString strVirt = comMachine.GetHWVirtExProperty(KHWVirtExPropertyType_Enabled) 857 ? tr("Enabled", "details report (VT-x/AMD-V)") 858 : tr("Disabled", "details report (VT-x/AMD-V)"); 859 strItem += QString(sSectionItemTpl2).arg(tr("VT-x/AMD-V", "details report"), strVirt); 860 861 /* Nested Paging: */ 1016 const QString strParavirtProvider = gpConverter->toString(comMachine.GetParavirtProvider()); 1017 strItem += QString(sSectionItemTpl2).arg(tr("Paravirtualization Interface", "details report"), strParavirtProvider); 1018 1019 /* Append report: */ 1020 strReport += strSectionTpl 1021 .arg(1 + iRowCount) /* rows */ 1022 .arg("details://system", /* icon */ 1023 QString::number(iIconArea), /* icon area */ 1024 tr("System", "details report"), /* title */ 1025 strItem); /* items */ 1026 1027 break; 1028 } 1029 case DetailsElementType_Display: 1030 { 1031 /* Video Memory: */ 1032 int iRowCount = 1; 1033 QString strItem = QString(sSectionItemTpl2).arg(tr("Video Memory", "details report"), 1034 tr("<nobr>%1 MB</nobr>", "details report") 1035 .arg(QString::number(comMachine.GetVRAMSize()))); 1036 1037 /* Screens? */ 1038 const int cGuestScreens = comMachine.GetMonitorCount(); 1039 if (cGuestScreens > 1) 1040 { 1041 ++iRowCount; 1042 strItem += QString(sSectionItemTpl2).arg(tr("Screens", "details report"), 1043 QString::number(cGuestScreens)); 1044 } 1045 1046 /* 3D Acceleration: */ 862 1047 ++iRowCount; 863 const QString strNested = comMachine.GetHWVirtExProperty(KHWVirtExPropertyType_NestedPaging) 864 ? tr("Enabled", "details report (Nested Paging)") 865 : tr("Disabled", "details report (Nested Paging)"); 866 strItem += QString(sSectionItemTpl2).arg(tr("Nested Paging", "details report"), strNested); 867 } 868 869 /* Paravirtualization Interface: */ 870 ++iRowCount; 871 const QString strParavirtProvider = gpConverter->toString(comMachine.GetParavirtProvider()); 872 strItem += QString(sSectionItemTpl2).arg(tr("Paravirtualization Interface", "details report"), strParavirtProvider); 873 874 /* Append report: */ 875 strReport += strSectionTpl 876 .arg(2 + iRowCount) /* rows */ 877 .arg("details://system", /* icon */ 878 QString::number(iIconArea), /* icon area */ 879 tr("System", "details report"), /* title */ 880 strItem); /* items */ 881 } 882 /* Display: */ 883 { 884 /* Video Memory: */ 885 int iRowCount = 1; 886 QString strItem = QString(sSectionItemTpl2).arg(tr("Video Memory", "details report"), 887 tr("<nobr>%1 MB</nobr>", "details report") 888 .arg(QString::number(comMachine.GetVRAMSize()))); 889 890 /* Screens? */ 891 const int cGuestScreens = comMachine.GetMonitorCount(); 892 if (cGuestScreens > 1) 893 { 1048 QString strAcc3d = comMachine.GetAccelerate3DEnabled() && vboxGlobal().is3DAvailable() 1049 ? tr("Enabled", "details report (3D Acceleration)") 1050 : tr("Disabled", "details report (3D Acceleration)"); 1051 strItem += QString(sSectionItemTpl2).arg(tr("3D Acceleration", "details report"), strAcc3d); 1052 1053 #ifdef VBOX_WITH_VIDEOHWACCEL 1054 /* 2D Video Acceleration: */ 894 1055 ++iRowCount; 895 strItem += QString(sSectionItemTpl2).arg(tr("Screens", "details report"), 896 QString::number(cGuestScreens)); 897 } 898 899 /* 3D Acceleration: */ 900 ++iRowCount; 901 QString strAcc3d = comMachine.GetAccelerate3DEnabled() && vboxGlobal().is3DAvailable() 902 ? tr("Enabled", "details report (3D Acceleration)") 903 : tr("Disabled", "details report (3D Acceleration)"); 904 strItem += QString(sSectionItemTpl2).arg(tr("3D Acceleration", "details report"), strAcc3d); 905 906 #ifdef VBOX_WITH_VIDEOHWACCEL 907 /* 2D Video Acceleration: */ 908 ++iRowCount; 909 QString strAcc2dVideo = comMachine.GetAccelerate2DVideoEnabled() 910 ? tr("Enabled", "details report (2D Video Acceleration)") 911 : tr("Disabled", "details report (2D Video Acceleration)"); 912 strItem += QString(sSectionItemTpl2).arg(tr("2D Video Acceleration", "details report"), strAcc2dVideo); 1056 QString strAcc2dVideo = comMachine.GetAccelerate2DVideoEnabled() 1057 ? tr("Enabled", "details report (2D Video Acceleration)") 1058 : tr("Disabled", "details report (2D Video Acceleration)"); 1059 strItem += QString(sSectionItemTpl2).arg(tr("2D Video Acceleration", "details report"), strAcc2dVideo); 913 1060 #endif 914 1061 915 /* Remote Desktop Server: */ 916 const CVRDEServer comServer = comMachine.GetVRDEServer(); 917 if (!comServer.isNull()) 918 { 919 ++iRowCount; 920 if (comServer.GetEnabled()) 921 strItem += QString(sSectionItemTpl2).arg(tr("Remote Desktop Server Port", "details report (VRDE Server)"), 922 comServer.GetVRDEProperty("TCP/Ports")); 1062 /* Remote Desktop Server: */ 1063 const CVRDEServer comServer = comMachine.GetVRDEServer(); 1064 if (!comServer.isNull()) 1065 { 1066 ++iRowCount; 1067 if (comServer.GetEnabled()) 1068 strItem += QString(sSectionItemTpl2).arg(tr("Remote Desktop Server Port", "details report (VRDE Server)"), 1069 comServer.GetVRDEProperty("TCP/Ports")); 1070 else 1071 strItem += QString(sSectionItemTpl2).arg(tr("Remote Desktop Server", "details report (VRDE Server)"), 1072 tr("Disabled", "details report (VRDE Server)")); 1073 } 1074 1075 /* Append report: */ 1076 strReport += strSectionTpl 1077 .arg(1 + iRowCount) /* rows */ 1078 .arg("details://display", /* icon */ 1079 QString::number(iIconArea), /* icon area */ 1080 tr("Display", "details report"), /* title */ 1081 strItem); /* items */ 1082 1083 break; 1084 } 1085 case DetailsElementType_Storage: 1086 { 1087 /* Nothing: */ 1088 int iRowCount = 0; 1089 QString strItem; 1090 1091 /* Iterate over the all machine controllers: */ 1092 foreach (const CStorageController &comController, comMachine.GetStorageControllers()) 1093 { 1094 /* Add controller information: */ 1095 ++iRowCount; 1096 const QString strControllerName = QApplication::translate("UIMachineSettingsStorage", "Controller: %1"); 1097 strItem += QString(sSectionItemTpl3).arg(strControllerName.arg(comController.GetName())); 1098 1099 /* Populate sorted map with attachments information: */ 1100 QMap<StorageSlot,QString> attachmentsMap; 1101 foreach (const CMediumAttachment &comAttachment, comMachine.GetMediumAttachmentsOfController(comController.GetName())) 1102 { 1103 /* Prepare current storage slot: */ 1104 const StorageSlot attachmentSlot(comController.GetBus(), comAttachment.GetPort(), comAttachment.GetDevice()); 1105 // TODO: Fix that NLS bug one day.. 1106 /* Append 'device slot name' with 'device type name' for optical devices only: */ 1107 QString strDeviceType = comAttachment.GetType() == KDeviceType_DVD ? tr("(Optical Drive)") : QString(); 1108 if (!strDeviceType.isNull()) 1109 strDeviceType.prepend(' '); 1110 /* Prepare current medium object: */ 1111 const CMedium &medium = comAttachment.GetMedium(); 1112 /* Prepare information about current medium & attachment: */ 1113 QString strAttachmentInfo = !comAttachment.isOk() 1114 ? QString() 1115 : QString(sSectionItemTpl2) 1116 .arg(QString(" ") + 1117 gpConverter->toString(StorageSlot(comController.GetBus(), 1118 comAttachment.GetPort(), 1119 comAttachment.GetDevice())) + strDeviceType) 1120 .arg(vboxGlobal().details(medium, false)); 1121 /* Insert that attachment into map: */ 1122 if (!strAttachmentInfo.isNull()) 1123 attachmentsMap.insert(attachmentSlot, strAttachmentInfo); 1124 } 1125 1126 /* Iterate over the sorted map with attachments information: */ 1127 QMapIterator<StorageSlot, QString> it(attachmentsMap); 1128 while (it.hasNext()) 1129 { 1130 /* Add controller information: */ 1131 it.next(); 1132 ++iRowCount; 1133 strItem += it.value(); 1134 } 1135 } 1136 1137 /* Handle side-case: */ 1138 if (strItem.isNull()) 1139 { 1140 ++iRowCount; 1141 strItem = QString(sSectionItemTpl1).arg(tr("Not Attached", "details report (Storage)")); 1142 } 1143 1144 /* Append report: */ 1145 strReport += strSectionTpl 1146 .arg(1 + iRowCount) /* rows */ 1147 .arg("details://storage", /* icon */ 1148 QString::number(iIconArea), /* icon area */ 1149 tr("Storage", "details report"), /* title */ 1150 strItem); /* items */ 1151 1152 break; 1153 } 1154 case DetailsElementType_Audio: 1155 { 1156 /* Nothing: */ 1157 int iRowCount = 0; 1158 QString strItem; 1159 1160 /* Host Driver, Controller? */ 1161 const CAudioAdapter &comAudio = comMachine.GetAudioAdapter(); 1162 if (comAudio.GetEnabled()) 1163 { 1164 iRowCount += 2; 1165 strItem = QString(sSectionItemTpl2).arg(tr("Host Driver", "details report (audio)"), 1166 gpConverter->toString(comAudio.GetAudioDriver())) 1167 + QString(sSectionItemTpl2).arg(tr("Controller", "details report (audio)"), 1168 gpConverter->toString(comAudio.GetAudioController())); 1169 } 923 1170 else 924 strItem += QString(sSectionItemTpl2).arg(tr("Remote Desktop Server", "details report (VRDE Server)"), 925 tr("Disabled", "details report (VRDE Server)")); 926 } 927 928 /* Append report: */ 929 strReport += strSectionTpl 930 .arg(2 + iRowCount) /* rows */ 931 .arg("details://display", /* icon */ 932 QString::number(iIconArea), /* icon area */ 933 tr("Display", "details report"), /* title */ 934 strItem); /* items */ 935 } 936 /* Storage: */ 937 { 938 /* Nothing: */ 939 int iRowCount = 0; 940 QString strItem; 941 942 /* Iterate over the all machine controllers: */ 943 foreach (const CStorageController &comController, comMachine.GetStorageControllers()) 944 { 945 /* Add controller information: */ 946 ++iRowCount; 947 const QString strControllerName = QApplication::translate("UIMachineSettingsStorage", "Controller: %1"); 948 strItem += QString(sSectionItemTpl3).arg(strControllerName.arg(comController.GetName())); 949 950 /* Populate sorted map with attachments information: */ 951 QMap<StorageSlot,QString> attachmentsMap; 952 foreach (const CMediumAttachment &comAttachment, comMachine.GetMediumAttachmentsOfController(comController.GetName())) 953 { 954 /* Prepare current storage slot: */ 955 const StorageSlot attachmentSlot(comController.GetBus(), comAttachment.GetPort(), comAttachment.GetDevice()); 956 // TODO: Fix that NLS bug one day.. 957 /* Append 'device slot name' with 'device type name' for optical devices only: */ 958 QString strDeviceType = comAttachment.GetType() == KDeviceType_DVD ? tr("(Optical Drive)") : QString(); 959 if (!strDeviceType.isNull()) 960 strDeviceType.prepend(' '); 961 /* Prepare current medium object: */ 962 const CMedium &medium = comAttachment.GetMedium(); 963 /* Prepare information about current medium & attachment: */ 964 QString strAttachmentInfo = !comAttachment.isOk() 965 ? QString() 966 : QString(sSectionItemTpl2) 967 .arg(QString(" ") + 968 gpConverter->toString(StorageSlot(comController.GetBus(), 969 comAttachment.GetPort(), 970 comAttachment.GetDevice())) + strDeviceType) 971 .arg(vboxGlobal().details(medium, false)); 972 /* Insert that attachment into map: */ 973 if (!strAttachmentInfo.isNull()) 974 attachmentsMap.insert(attachmentSlot, strAttachmentInfo); 975 } 976 977 /* Iterate over the sorted map with attachments information: */ 978 QMapIterator<StorageSlot, QString> it(attachmentsMap); 979 while (it.hasNext()) 980 { 981 /* Add controller information: */ 982 it.next(); 1171 { 983 1172 ++iRowCount; 984 strItem += it.value(); 985 } 986 } 987 988 /* Handle side-case: */ 989 if (strItem.isNull()) 990 { 991 ++iRowCount; 992 strItem = QString(sSectionItemTpl1).arg(tr("Not Attached", "details report (Storage)")); 993 } 994 995 /* Append report: */ 996 strReport += strSectionTpl 997 .arg(2 + iRowCount) /* rows */ 998 .arg("details://storage", /* icon */ 999 QString::number(iIconArea), /* icon area */ 1000 tr("Storage", "details report"), /* title */ 1001 strItem); /* items */ 1002 } 1003 /* Audio: */ 1004 { 1005 /* Nothing: */ 1006 int iRowCount = 0; 1007 QString strItem; 1008 1009 /* Host Driver, Controller? */ 1010 const CAudioAdapter &comAudio = comMachine.GetAudioAdapter(); 1011 if (comAudio.GetEnabled()) 1012 { 1013 iRowCount += 2; 1014 strItem = QString(sSectionItemTpl2).arg(tr("Host Driver", "details report (audio)"), 1015 gpConverter->toString(comAudio.GetAudioDriver())) 1016 + QString(sSectionItemTpl2).arg(tr("Controller", "details report (audio)"), 1017 gpConverter->toString(comAudio.GetAudioController())); 1018 } 1019 else 1020 { 1021 ++iRowCount; 1022 strItem = QString(sSectionItemTpl1).arg(tr("Disabled", "details report (audio)")); 1023 } 1024 1025 /* Append report: */ 1026 strReport += strSectionTpl 1027 .arg(2 + iRowCount) /* rows */ 1028 .arg("details://audio", /* icon */ 1029 QString::number(iIconArea), /* icon area */ 1030 tr("Audio", "details report"), /* title */ 1031 strItem); /* items */ 1032 } 1033 /* Network: */ 1034 { 1035 /* Nothing: */ 1036 int iRowCount = 0; 1037 QString strItem; 1038 1039 /* Enumerate all the network adapters (up to acquired/limited count): */ 1040 const ulong iCount = vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(comMachine.GetChipsetType()); 1041 for (ulong iSlot = 0; iSlot < iCount; ++iSlot) 1042 { 1043 /* Get current network adapter: */ 1044 const CNetworkAdapter &comNetwork = comMachine.GetNetworkAdapter(iSlot); 1045 if (comNetwork.GetEnabled()) 1046 { 1047 /* Determine attachment type: */ 1048 const KNetworkAttachmentType enmType = comNetwork.GetAttachmentType(); 1049 QString attType = gpConverter->toString(comNetwork.GetAdapterType()) 1050 .replace(QRegExp("\\s\\(.+\\)"), " (%1)"); 1051 /* Don't use the adapter type string for types that have 1052 * an additional symbolic network/interface name field, 1053 * use this name instead: */ 1054 switch (enmType) 1173 strItem = QString(sSectionItemTpl1).arg(tr("Disabled", "details report (audio)")); 1174 } 1175 1176 /* Append report: */ 1177 strReport += strSectionTpl 1178 .arg(1 + iRowCount) /* rows */ 1179 .arg("details://audio", /* icon */ 1180 QString::number(iIconArea), /* icon area */ 1181 tr("Audio", "details report"), /* title */ 1182 strItem); /* items */ 1183 1184 break; 1185 } 1186 case DetailsElementType_Network: 1187 { 1188 /* Nothing: */ 1189 int iRowCount = 0; 1190 QString strItem; 1191 1192 /* Enumerate all the network adapters (up to acquired/limited count): */ 1193 const ulong iCount = vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(comMachine.GetChipsetType()); 1194 for (ulong iSlot = 0; iSlot < iCount; ++iSlot) 1195 { 1196 /* Get current network adapter: */ 1197 const CNetworkAdapter &comNetwork = comMachine.GetNetworkAdapter(iSlot); 1198 if (comNetwork.GetEnabled()) 1055 1199 { 1056 case KNetworkAttachmentType_Bridged: 1057 attType = attType.arg(tr("Bridged adapter, %1", "details report (network)") 1058 .arg(comNetwork.GetBridgedInterface())); 1059 break; 1060 case KNetworkAttachmentType_Internal: 1061 attType = attType.arg(tr("Internal network, '%1'", "details report (network)") 1062 .arg(comNetwork.GetInternalNetwork())); 1063 break; 1064 case KNetworkAttachmentType_HostOnly: 1065 attType = attType.arg(tr("Host-only adapter, '%1'", "details report (network)") 1066 .arg(comNetwork.GetHostOnlyInterface())); 1067 break; 1068 case KNetworkAttachmentType_Generic: 1069 attType = attType.arg(tr("Generic, '%1'", "details report (network)") 1070 .arg(comNetwork.GetGenericDriver())); 1071 break; 1072 case KNetworkAttachmentType_NATNetwork: 1073 attType = attType.arg(tr("NAT network, '%1'", "details report (network)") 1074 .arg(comNetwork.GetNATNetwork())); 1075 break; 1076 default: 1077 attType = attType.arg(gpConverter->toString(enmType)); 1078 break; 1200 /* Determine attachment type: */ 1201 const KNetworkAttachmentType enmType = comNetwork.GetAttachmentType(); 1202 QString attType = gpConverter->toString(comNetwork.GetAdapterType()) 1203 .replace(QRegExp("\\s\\(.+\\)"), " (%1)"); 1204 /* Don't use the adapter type string for types that have 1205 * an additional symbolic network/interface name field, 1206 * use this name instead: */ 1207 switch (enmType) 1208 { 1209 case KNetworkAttachmentType_Bridged: 1210 attType = attType.arg(tr("Bridged adapter, %1", "details report (network)") 1211 .arg(comNetwork.GetBridgedInterface())); 1212 break; 1213 case KNetworkAttachmentType_Internal: 1214 attType = attType.arg(tr("Internal network, '%1'", "details report (network)") 1215 .arg(comNetwork.GetInternalNetwork())); 1216 break; 1217 case KNetworkAttachmentType_HostOnly: 1218 attType = attType.arg(tr("Host-only adapter, '%1'", "details report (network)") 1219 .arg(comNetwork.GetHostOnlyInterface())); 1220 break; 1221 case KNetworkAttachmentType_Generic: 1222 attType = attType.arg(tr("Generic, '%1'", "details report (network)") 1223 .arg(comNetwork.GetGenericDriver())); 1224 break; 1225 case KNetworkAttachmentType_NATNetwork: 1226 attType = attType.arg(tr("NAT network, '%1'", "details report (network)") 1227 .arg(comNetwork.GetNATNetwork())); 1228 break; 1229 default: 1230 attType = attType.arg(gpConverter->toString(enmType)); 1231 break; 1232 } 1233 /* Here goes the record: */ 1234 ++iRowCount; 1235 strItem += QString(sSectionItemTpl2).arg(tr("Adapter %1", "details report (network)") 1236 .arg(comNetwork.GetSlot() + 1), 1237 attType); 1079 1238 } 1080 /* Here goes the record: */ 1239 } 1240 1241 /* Handle side-case: */ 1242 if (strItem.isNull()) 1243 { 1081 1244 ++iRowCount; 1082 strItem += QString(sSectionItemTpl2).arg(tr("Adapter %1", "details report (network)") 1083 .arg(comNetwork.GetSlot() + 1), 1084 attType); 1085 } 1086 } 1087 1088 /* Handle side-case: */ 1089 if (strItem.isNull()) 1090 { 1091 ++iRowCount; 1092 strItem = QString(sSectionItemTpl1).arg(tr("Disabled", "details report (network)")); 1093 } 1094 1095 /* Append report: */ 1096 strReport += strSectionTpl 1097 .arg(2 + iRowCount) /* rows */ 1098 .arg("details://network", /* icon */ 1099 QString::number(iIconArea), /* icon area */ 1100 tr("Network", "details report"), /* title */ 1101 strItem); /* items */ 1102 } 1103 /* Serial Ports: */ 1104 { 1105 /* Nothing: */ 1106 int iRowCount = 0; 1107 QString strItem; 1108 1109 /* Enumerate all the serial ports (up to acquired/limited count): */ 1110 const ulong iCount = vboxGlobal().virtualBox().GetSystemProperties().GetSerialPortCount(); 1111 for (ulong iSlot = 0; iSlot < iCount; ++iSlot) 1112 { 1113 /* Get current serial port: */ 1114 const CSerialPort &comSerial = comMachine.GetSerialPort(iSlot); 1115 if (comSerial.GetEnabled()) 1116 { 1117 /* Determine port mode: */ 1118 const KPortMode enmMode = comSerial.GetHostMode(); 1119 /* Compose the data: */ 1120 QString strData = vboxGlobal().toCOMPortName(comSerial.GetIRQ(), comSerial.GetIOBase()) + ", "; 1121 if ( enmMode == KPortMode_HostPipe 1122 || enmMode == KPortMode_HostDevice 1123 || enmMode == KPortMode_TCP 1124 || enmMode == KPortMode_RawFile) 1125 strData += QString("%1 (<nobr>%2</nobr>)").arg(gpConverter->toString(enmMode)) 1126 .arg(QDir::toNativeSeparators(comSerial.GetPath())); 1127 else 1128 strData += gpConverter->toString(enmMode); 1129 /* Here goes the record: */ 1245 strItem = QString(sSectionItemTpl1).arg(tr("Disabled", "details report (network)")); 1246 } 1247 1248 /* Append report: */ 1249 strReport += strSectionTpl 1250 .arg(1 + iRowCount) /* rows */ 1251 .arg("details://network", /* icon */ 1252 QString::number(iIconArea), /* icon area */ 1253 tr("Network", "details report"), /* title */ 1254 strItem); /* items */ 1255 1256 break; 1257 } 1258 case DetailsElementType_Serial: 1259 { 1260 /* Nothing: */ 1261 int iRowCount = 0; 1262 QString strItem; 1263 1264 /* Enumerate all the serial ports (up to acquired/limited count): */ 1265 const ulong iCount = vboxGlobal().virtualBox().GetSystemProperties().GetSerialPortCount(); 1266 for (ulong iSlot = 0; iSlot < iCount; ++iSlot) 1267 { 1268 /* Get current serial port: */ 1269 const CSerialPort &comSerial = comMachine.GetSerialPort(iSlot); 1270 if (comSerial.GetEnabled()) 1271 { 1272 /* Determine port mode: */ 1273 const KPortMode enmMode = comSerial.GetHostMode(); 1274 /* Compose the data: */ 1275 QString strData = vboxGlobal().toCOMPortName(comSerial.GetIRQ(), comSerial.GetIOBase()) + ", "; 1276 if ( enmMode == KPortMode_HostPipe 1277 || enmMode == KPortMode_HostDevice 1278 || enmMode == KPortMode_TCP 1279 || enmMode == KPortMode_RawFile) 1280 strData += QString("%1 (<nobr>%2</nobr>)").arg(gpConverter->toString(enmMode)) 1281 .arg(QDir::toNativeSeparators(comSerial.GetPath())); 1282 else 1283 strData += gpConverter->toString(enmMode); 1284 /* Here goes the record: */ 1285 ++iRowCount; 1286 strItem += QString(sSectionItemTpl2).arg(tr("Port %1", "details report (serial ports)") 1287 .arg(comSerial.GetSlot() + 1), 1288 strData); 1289 } 1290 } 1291 1292 /* Handle side-case: */ 1293 if (strItem.isNull()) 1294 { 1130 1295 ++iRowCount; 1131 strItem += QString(sSectionItemTpl2).arg(tr("Port %1", "details report (serial ports)") 1132 .arg(comSerial.GetSlot() + 1), 1133 strData); 1134 } 1135 } 1136 1137 /* Handle side-case: */ 1138 if (strItem.isNull()) 1139 { 1140 ++iRowCount; 1141 strItem = QString(sSectionItemTpl1).arg(tr("Disabled", "details report (serial ports)")); 1142 } 1143 1144 /* Append report: */ 1145 strReport += strSectionTpl 1146 .arg(2 + iRowCount) /* rows */ 1147 .arg("details://serialPorts", /* icon */ 1148 QString::number(iIconArea), /* icon area */ 1149 tr("Serial Ports", "details report"), /* title */ 1150 strItem); /* items */ 1151 } 1296 strItem = QString(sSectionItemTpl1).arg(tr("Disabled", "details report (serial ports)")); 1297 } 1298 1299 /* Append report: */ 1300 strReport += strSectionTpl 1301 .arg(1 + iRowCount) /* rows */ 1302 .arg("details://serialPorts", /* icon */ 1303 QString::number(iIconArea), /* icon area */ 1304 tr("Serial Ports", "details report"), /* title */ 1305 strItem); /* items */ 1306 1307 break; 1308 } 1152 1309 #ifdef VBOX_WITH_PARALLEL_PORTS 1153 /* Parallel Ports: */ 1154 { 1155 /* Nothing: */ 1156 int iRowCount = 0; 1157 QString strItem; 1158 1159 /* Enumerate all the serial ports (up to acquired/limited count): */ 1160 const ulong iCount = vboxGlobal().virtualBox().GetSystemProperties().GetParallelPortCount(); 1161 for (ulong iSlot = 0; iSlot < iCount; ++iSlot) 1162 { 1163 /* Get current parallel port: */ 1164 const CParallelPort &comParallel = comMachine.GetParallelPort(iSlot); 1165 if (comParallel.GetEnabled()) 1166 { 1167 /* Compose the data: */ 1168 QString strData = toLPTPortName(comParallel.GetIRQ(), comParallel.GetIOBase()) 1169 + QString(" (<nobr>%1</nobr>)").arg(QDir::toNativeSeparators(comParallel.GetPath())); 1170 /* Here goes the record: */ 1310 case DetailsElementType_Parallel: 1311 { 1312 /* Nothing: */ 1313 int iRowCount = 0; 1314 QString strItem; 1315 1316 /* Enumerate all the serial ports (up to acquired/limited count): */ 1317 const ulong iCount = vboxGlobal().virtualBox().GetSystemProperties().GetParallelPortCount(); 1318 for (ulong iSlot = 0; iSlot < iCount; ++iSlot) 1319 { 1320 /* Get current parallel port: */ 1321 const CParallelPort &comParallel = comMachine.GetParallelPort(iSlot); 1322 if (comParallel.GetEnabled()) 1323 { 1324 /* Compose the data: */ 1325 QString strData = toLPTPortName(comParallel.GetIRQ(), comParallel.GetIOBase()) 1326 + QString(" (<nobr>%1</nobr>)").arg(QDir::toNativeSeparators(comParallel.GetPath())); 1327 /* Here goes the record: */ 1328 ++iRowCount; 1329 strItem += QString(sSectionItemTpl2).arg(tr("Port %1", "details report (parallel ports)") 1330 .arg(comParallel.GetSlot() + 1), 1331 strData); 1332 } 1333 } 1334 1335 /* Handle side-case: */ 1336 if (strItem.isNull()) 1337 { 1171 1338 ++iRowCount; 1172 strItem += QString(sSectionItemTpl2).arg(tr("Port %1", "details report (parallel ports)") 1173 .arg(comParallel.GetSlot() + 1), 1174 strData); 1175 } 1176 } 1177 1178 /* Handle side-case: */ 1179 if (strItem.isNull()) 1180 { 1181 ++iRowCount; 1182 strItem = QString(sSectionItemTpl1).arg(tr("Disabled", "details report (parallel ports)")); 1183 } 1184 1185 /* Append report: */ 1186 strReport += strSectionTpl 1187 .arg(2 + iRowCount) /* rows */ 1188 .arg("details://parallelPorts", /* icon */ 1189 QString::number(iIconArea), /* icon area */ 1190 tr("Parallel Ports", "details report"), /* title */ 1191 strItem); /* items */ 1192 } 1339 strItem = QString(sSectionItemTpl1).arg(tr("Disabled", "details report (parallel ports)")); 1340 } 1341 1342 /* Append report: */ 1343 strReport += strSectionTpl 1344 .arg(1 + iRowCount) /* rows */ 1345 .arg("details://parallelPorts", /* icon */ 1346 QString::number(iIconArea), /* icon area */ 1347 tr("Parallel Ports", "details report"), /* title */ 1348 strItem); /* items */ 1349 1350 break; 1351 } 1193 1352 #endif /* VBOX_WITH_PARALLEL_PORTS */ 1194 /* USB: */ 1195 { 1196 /* Acquire USB filters object: */ 1197 const CUSBDeviceFilters &comFilters = comMachine.GetUSBDeviceFilters(); 1198 if ( !comFilters.isNull() 1199 && comMachine.GetUSBProxyAvailable()) 1200 { 1201 /* Device Filters: */ 1353 case DetailsElementType_USB: 1354 { 1355 /* Acquire USB filters object: */ 1356 const CUSBDeviceFilters &comFilters = comMachine.GetUSBDeviceFilters(); 1357 if ( !comFilters.isNull() 1358 && comMachine.GetUSBProxyAvailable()) 1359 { 1360 /* Device Filters: */ 1361 int iRowCount = 1; 1362 QString strItem; 1363 1364 /* The USB controller may be unavailable (i.e. in VirtualBox OSE): */ 1365 if (!comMachine.GetUSBControllers().isEmpty()) 1366 { 1367 /* Acquire USB filters: */ 1368 const CUSBDeviceFilterVector &filterVector = comFilters.GetDeviceFilters(); 1369 /* Calculate the amount of active filters: */ 1370 uint cActive = 0; 1371 foreach (const CUSBDeviceFilter &comFilter, filterVector) 1372 if (comFilter.GetActive()) 1373 ++cActive; 1374 /* Here goes the record: */ 1375 strItem = QString(sSectionItemTpl2).arg(tr("Device Filters", "details report (USB)"), 1376 tr("%1 (%2 active)", "details report (USB)") 1377 .arg(filterVector.size()).arg(cActive)); 1378 } 1379 1380 /* Handle side-case: */ 1381 if (strItem.isNull()) 1382 strItem = QString(sSectionItemTpl1).arg(tr("Disabled", "details report (USB)")); 1383 1384 /* Append report: */ 1385 strReport += strSectionTpl 1386 .arg(1 + iRowCount) /* rows */ 1387 .arg("details://usb", /* icon */ 1388 QString::number(iIconArea), /* icon area */ 1389 tr("USB", "details report"), /* title */ 1390 strItem); /* items */ 1391 } 1392 1393 break; 1394 } 1395 case DetailsElementType_SF: 1396 { 1397 /* Shared Folders: */ 1202 1398 int iRowCount = 1; 1203 1399 QString strItem; 1204 1400 1205 /* The USB controller may be unavailable (i.e. in VirtualBox OSE): */ 1206 if (!comMachine.GetUSBControllers().isEmpty()) 1207 { 1208 /* Acquire USB filters: */ 1209 const CUSBDeviceFilterVector &filterVector = comFilters.GetDeviceFilters(); 1210 /* Calculate the amount of active filters: */ 1211 uint cActive = 0; 1212 foreach (const CUSBDeviceFilter &comFilter, filterVector) 1213 if (comFilter.GetActive()) 1214 ++cActive; 1215 /* Here goes the record: */ 1216 strItem = QString(sSectionItemTpl2).arg(tr("Device Filters", "details report (USB)"), 1217 tr("%1 (%2 active)", "details report (USB)") 1218 .arg(filterVector.size()).arg(cActive)); 1219 } 1220 1221 /* Handle side-case: */ 1222 if (strItem.isNull()) 1223 strItem = QString(sSectionItemTpl1).arg(tr("Disabled", "details report (USB)")); 1401 /* Acquire shared folders count: */ 1402 const ulong iCount = comMachine.GetSharedFolders().size(); 1403 if (iCount > 0) 1404 strItem = QString(sSectionItemTpl2).arg(tr("Shared Folders", "details report (shared folders)"), 1405 QString::number(iCount)); 1406 else 1407 strItem = QString(sSectionItemTpl1).arg(tr("None", "details report (shared folders)")); 1224 1408 1225 1409 /* Append report: */ 1226 1410 strReport += strSectionTpl 1227 .arg( 2+ iRowCount) /* rows */1228 .arg("details:// usb", /* icon */1411 .arg(1 + iRowCount) /* rows */ 1412 .arg("details://sharedFolders", /* icon */ 1229 1413 QString::number(iIconArea), /* icon area */ 1230 tr(" USB", "details report"), /* title */1414 tr("Shared Folders", "details report"), /* title */ 1231 1415 strItem); /* items */ 1232 } 1233 } 1234 /* Shared Folders: */ 1235 { 1236 /* Shared Folders: */ 1237 int iRowCount = 1; 1238 QString strItem; 1239 1240 /* Acquire shared folders count: */ 1241 const ulong iCount = comMachine.GetSharedFolders().size(); 1242 if (iCount > 0) 1243 strItem = QString(sSectionItemTpl2).arg(tr("Shared Folders", "details report (shared folders)"), 1244 QString::number(iCount)); 1245 else 1246 strItem = QString(sSectionItemTpl1).arg(tr("None", "details report (shared folders)")); 1247 1248 /* Append report: */ 1249 strReport += strSectionTpl 1250 .arg(2 + iRowCount) /* rows */ 1251 .arg("details://sharedFolders", /* icon */ 1252 QString::number(iIconArea), /* icon area */ 1253 tr("Shared Folders", "details report"), /* title */ 1254 strItem); /* items */ 1416 1417 break; 1418 } 1419 default: 1420 break; 1255 1421 } 1256 1422 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISnapshotDetailsWidget.h
r67306 r67308 24 24 /* GUI includes: */ 25 25 #include "QIWithRetranslateUI.h" 26 #include "UIExtraDataDefs.h" 26 27 27 28 /* COM includes: */ … … 32 33 class QLabel; 33 34 class QLineEdit; 35 class QScrollArea; 34 36 class QStackedLayout; 35 37 class QTabWidget; 36 38 class QTextEdit; 37 class QVBoxLayout;38 39 class QWidget; 40 class UISnapshotDetailsElement; 39 41 40 42 … … 119 121 void prepareTabDetails(); 120 122 123 /** Creates details element of passed @a enmType. */ 124 static UISnapshotDetailsElement *createDetailsElement(DetailsElementType enmType); 125 121 126 /** Loads snapshot data. */ 122 127 void loadSnapshotData(); … … 126 131 127 132 /** Returns a details report on a given @a comMachine. */ 128 QString detailsReport(const CMachine &comMachine );133 QString detailsReport(const CMachine &comMachine, DetailsElementType enmType); 129 134 130 135 /** Holds the snapshot object to load data from. */ … … 169 174 170 175 /** Holds the 'Details' layout instance. */ 171 Q VBoxLayout *m_pLayoutDetails;176 QGridLayout *m_pLayoutDetails; 172 177 173 /** Holds the description editor instance. */ 174 QTextEdit *m_pBrowserDetails; 178 /** Holds the details scroll-area instance. */ 179 QScrollArea *m_pScrollAreaDetails; 180 181 /** Holds the details element map. */ 182 QMap<DetailsElementType, UISnapshotDetailsElement*> m_details; 175 183 }; 176 184
Note:
See TracChangeset
for help on using the changeset viewer.