- Timestamp:
- Jun 1, 2017 2:33:45 PM (8 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/globals
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r66673 r67212 966 966 } 967 967 968 /** 969 * Returns a details report on a given VM represented as a HTML table. 970 * 971 * @param aMachine Machine to create a report for. 972 * @param aWithLinks @c true if section titles should be hypertext links. 973 */ 974 QString VBoxGlobal::detailsReport (const CMachine &aMachine, bool aWithLinks) 975 { 976 /* Details templates */ 968 QString VBoxGlobal::detailsReport(const CMachine &comMachine, bool fWithLinks) 969 { 970 /* Details templates: */ 977 971 static const char *sTableTpl = 978 972 "<table border=0 cellspacing=1 cellpadding=0>%1</table>"; 979 973 static const char *sSectionHrefTpl = 980 "<tr><td width= 22 rowspan=%1 align=left><img width=16 height=16 src='%2'></td>"974 "<tr><td width=%7 rowspan=%1 align=left><img width=%6 height=%6 src='%2'></td>" 981 975 "<td colspan=3><b><a href='%3'><nobr>%4</nobr></a></b></td></tr>" 982 976 "%5" 983 977 "<tr><td colspan=3><font size=1> </font></td></tr>"; 984 978 static const char *sSectionBoldTpl = 985 "<tr><td width= 22 rowspan=%1 align=left><img width=16 height=16 src='%2'></td>"979 "<tr><td width=%7 rowspan=%1 align=left><img width=%6 height=%6 src='%2'></td>" 986 980 "<td colspan=3><!-- %3 --><b><nobr>%4</nobr></b></td></tr>" 987 981 "%5" … … 994 988 "<tr><td width=40%><nobr>%1</nobr></td><td/><td/></tr>"; 995 989 996 const QString §ionTpl = aWithLinks ? sSectionHrefTpl : sSectionBoldTpl; 997 998 /* Compose details report */ 999 QString report; 1000 1001 /* General */ 1002 { 1003 QString item = QString (sSectionItemTpl2).arg (tr ("Name", "details report"), 1004 aMachine.GetName()) 1005 + QString (sSectionItemTpl2).arg (tr ("OS Type", "details report"), 1006 vmGuestOSTypeDescription (aMachine.GetOSTypeId())); 1007 1008 report += sectionTpl 1009 .arg (2 + 2) /* rows */ 1010 .arg (":/machine_16px.png", /* icon */ 1011 "#general", /* link */ 1012 tr ("General", "details report"), /* title */ 1013 item); /* items */ 1014 } 1015 1016 /* System */ 1017 { 990 /* Do we want the links? */ 991 const QString &strSectionTpl = fWithLinks ? sSectionHrefTpl : sSectionBoldTpl; 992 993 /* Determine icon metric: */ 994 const QStyle *pStyle = QApplication::style(); 995 const int iIconMetric = pStyle->pixelMetric(QStyle::PM_SmallIconSize); 996 const int iIndentMetric = iIconMetric * 1.375; 997 998 /* Compose details report: */ 999 QString strReport; 1000 1001 /* General: */ 1002 { 1003 /* Name, OS Type: */ 1004 int iRowCount = 2; 1005 QString strItem = QString(sSectionItemTpl2).arg(tr("Name", "details report"), 1006 comMachine.GetName()) 1007 + QString(sSectionItemTpl2).arg(tr("OS Type", "details report"), 1008 vmGuestOSTypeDescription(comMachine.GetOSTypeId())); 1009 1010 /* Group(s)? */ 1011 const QStringList &groups = comMachine.GetGroups().toList(); 1012 if ( groups.size() > 1 1013 || groups.size() > 0 && groups.at(0) != "/") 1014 { 1015 ++iRowCount; 1016 strItem += QString(sSectionItemTpl2).arg(tr("Group(s)", "details report"), 1017 groups.join(", ")); 1018 } 1019 1020 /* Append report: */ 1021 strReport += strSectionTpl 1022 .arg(2 + iRowCount) /* rows */ 1023 .arg(":/machine_16px.png", /* icon */ 1024 "#general", /* link */ 1025 tr("General", "details report"), /* title */ 1026 strItem, /* items */ 1027 QString::number(iIconMetric), 1028 QString::number(iIndentMetric)); 1029 } 1030 1031 /* System: */ 1032 { 1033 /* Base Memory, Processor(s): */ 1034 int iRowCount = 2; 1035 QString strItem = QString(sSectionItemTpl2).arg(tr("Base Memory", "details report"), 1036 tr("<nobr>%1 MB</nobr>", "details report") 1037 .arg(QString::number(comMachine.GetMemorySize()))) 1038 + QString(sSectionItemTpl2).arg(tr("Processor(s)", "details report"), 1039 tr("<nobr>%1</nobr>", "details report") 1040 .arg(QString::number(comMachine.GetCPUCount()))); 1041 1042 /* Execution Cap? */ 1043 ULONG uExecutionCap = comMachine.GetCPUExecutionCap(); 1044 if (uExecutionCap < 100) 1045 { 1046 ++iRowCount; 1047 strItem += QString(sSectionItemTpl2).arg(tr("Execution Cap", "details report"), 1048 tr("<nobr>%1%</nobr>", "details report") 1049 .arg(comMachine.GetCPUExecutionCap())); 1050 } 1051 1052 /* Boot Order: */ 1053 ++iRowCount; 1054 QStringList bootOrder; 1055 for (ulong i = 1; i <= m_vbox.GetSystemProperties().GetMaxBootPosition(); ++i) 1056 { 1057 const KDeviceType enmDevice = comMachine.GetBootOrder(i); 1058 if (enmDevice != KDeviceType_Null) 1059 bootOrder << gpConverter->toString(enmDevice); 1060 } 1061 if (bootOrder.isEmpty()) 1062 bootOrder << gpConverter->toString(KDeviceType_Null); 1063 strItem += QString(sSectionItemTpl2).arg(tr("Boot Order", "details report"), 1064 bootOrder.join(", ")); 1065 1018 1066 #ifdef VBOX_WITH_FULL_DETAILS_REPORT 1019 /* BIOS Settings holder */ 1020 CBIOSSettings biosSettings = aMachine.GetBIOSSettings(); 1067 1068 /* Acquire BIOS Settings: */ 1069 const CBIOSSettings &comBiosSettings = comMachine.GetBIOSSettings(); 1070 1071 /* ACPI: */ 1072 ++iRowCount; 1073 const QString strAcpi = comBiosSettings.GetACPIEnabled() 1074 ? tr("Enabled", "details report (ACPI)") 1075 : tr("Disabled", "details report (ACPI)"); 1076 strItem += QString(sSectionItemTpl2).arg(tr("ACPI", "details report"), strAcpi); 1077 1078 /* I/O APIC: */ 1079 ++iRowCount; 1080 const QString strIoapic = comBiosSettings.GetIOAPICEnabled() 1081 ? tr("Enabled", "details report (I/O APIC)") 1082 : tr("Disabled", "details report (I/O APIC)"); 1083 strItem += QString(sSectionItemTpl2).arg(tr("I/O APIC", "details report"), strIoapic); 1084 1085 /* PAE/NX: */ 1086 ++iRowCount; 1087 const QString strPae = comMachine.GetCPUProperty(KCPUPropertyType_PAE) 1088 ? tr("Enabled", "details report (PAE/NX)") 1089 : tr("Disabled", "details report (PAE/NX)"); 1090 strItem += QString(sSectionItemTpl2).arg(tr("PAE/NX", "details report"), strPae); 1091 1021 1092 #endif /* VBOX_WITH_FULL_DETAILS_REPORT */ 1022 1093 1023 /* System details row count: */1024 int iRowCount = 2; /* Memory & CPU details rows initially. */1025 1026 /* Boot order */1027 QString bootOrder;1028 for (ulong i = 1; i <= m_vbox.GetSystemProperties().GetMaxBootPosition(); ++ i)1029 {1030 KDeviceType device = aMachine.GetBootOrder (i);1031 if (device == KDeviceType_Null)1032 continue;1033 if (!bootOrder.isEmpty())1034 bootOrder += ", ";1035 bootOrder += gpConverter->toString (device);1036 }1037 if (bootOrder.isEmpty())1038 bootOrder = gpConverter->toString (KDeviceType_Null);1039 1040 iRowCount += 1; /* Boot-order row. */1041 1042 #ifdef VBOX_WITH_FULL_DETAILS_REPORT1043 /* ACPI */1044 QString acpi = biosSettings.GetACPIEnabled()1045 ? tr ("Enabled", "details report (ACPI)")1046 : tr ("Disabled", "details report (ACPI)");1047 1048 /* I/O APIC */1049 QString ioapic = biosSettings.GetIOAPICEnabled()1050 ? tr ("Enabled", "details report (I/O APIC)")1051 : tr ("Disabled", "details report (I/O APIC)");1052 1053 /* PAE/NX */1054 QString pae = aMachine.GetCpuProperty(KCpuPropertyType_PAE)1055 ? tr ("Enabled", "details report (PAE/NX)")1056 : tr ("Disabled", "details report (PAE/NX)");1057 1058 iRowCount += 3; /* Full report rows. */1059 #endif /* VBOX_WITH_FULL_DETAILS_REPORT */1060 1061 /* VT-x/AMD-V */1062 QString virt = aMachine.GetHWVirtExProperty(KHWVirtExPropertyType_Enabled)1063 ? tr ("Enabled", "details report (VT-x/AMD-V)")1064 : tr ("Disabled", "details report (VT-x/AMD-V)");1065 1066 /* Nested Paging */1067 QString nested = aMachine.GetHWVirtExProperty(KHWVirtExPropertyType_NestedPaging)1068 ? tr ("Enabled", "details report (Nested Paging)")1069 : tr ("Disabled", "details report (Nested Paging)");1070 1071 1094 /* VT-x/AMD-V availability: */ 1072 bool fVTxAMDVSupported = host().GetProcessorFeature(KProcessorFeature_HWVirtEx); 1073 1095 const bool fVTxAMDVSupported = host().GetProcessorFeature(KProcessorFeature_HWVirtEx); 1074 1096 if (fVTxAMDVSupported) 1075 iRowCount += 2; /* VT-x/AMD-V items. */ 1097 { 1098 /* VT-x/AMD-V: */ 1099 ++iRowCount; 1100 const QString strVirt = comMachine.GetHWVirtExProperty(KHWVirtExPropertyType_Enabled) 1101 ? tr("Enabled", "details report (VT-x/AMD-V)") 1102 : tr("Disabled", "details report (VT-x/AMD-V)"); 1103 strItem += QString(sSectionItemTpl2).arg(tr("VT-x/AMD-V", "details report"), strVirt); 1104 1105 /* Nested Paging: */ 1106 ++iRowCount; 1107 const QString strNested = comMachine.GetHWVirtExProperty(KHWVirtExPropertyType_NestedPaging) 1108 ? tr("Enabled", "details report (Nested Paging)") 1109 : tr("Disabled", "details report (Nested Paging)"); 1110 strItem += QString(sSectionItemTpl2).arg(tr("Nested Paging", "details report"), strNested); 1111 } 1076 1112 1077 1113 /* Paravirtualization Interface: */ 1078 const QString strParavirtProvider = gpConverter->toString(aMachine.GetParavirtProvider()); 1079 1080 iRowCount += 1; /* Paravirtualization Interface. */ 1081 1082 QString item = QString (sSectionItemTpl2).arg (tr ("Base Memory", "details report"), 1083 tr ("<nobr>%1 MB</nobr>", "details report")) 1084 .arg (aMachine.GetMemorySize()) 1085 + QString (sSectionItemTpl2).arg (tr ("Processor(s)", "details report"), 1086 tr ("<nobr>%1</nobr>", "details report")) 1087 .arg (aMachine.GetCPUCount()) 1088 + QString (sSectionItemTpl2).arg (tr ("Execution Cap", "details report"), 1089 tr ("<nobr>%1%</nobr>", "details report")) 1090 .arg (aMachine.GetCPUExecutionCap()) 1091 + QString (sSectionItemTpl2).arg (tr ("Boot Order", "details report"), bootOrder) 1092 #ifdef VBOX_WITH_FULL_DETAILS_REPORT 1093 + QString (sSectionItemTpl2).arg (tr ("ACPI", "details report"), acpi) 1094 + QString (sSectionItemTpl2).arg (tr ("I/O APIC", "details report"), ioapic) 1095 + QString (sSectionItemTpl2).arg (tr ("PAE/NX", "details report"), pae) 1096 #endif /* VBOX_WITH_FULL_DETAILS_REPORT */ 1097 ; 1098 1099 if (fVTxAMDVSupported) 1100 item += QString (sSectionItemTpl2).arg (tr ("VT-x/AMD-V", "details report"), virt) 1101 + QString (sSectionItemTpl2).arg (tr ("Nested Paging", "details report"), nested); 1102 1103 item += QString(sSectionItemTpl2).arg(tr("Paravirtualization Interface", "details report"), strParavirtProvider); 1104 1105 report += sectionTpl 1106 .arg (2 + iRowCount) /* rows */ 1107 .arg (":/chipset_16px.png", /* icon */ 1108 "#system", /* link */ 1109 tr ("System", "details report"), /* title */ 1110 item); /* items */ 1111 } 1112 1113 /* Display */ 1114 { 1115 /* Rows including section header and footer */ 1116 int rows = 2; 1117 1118 /* Video tab */ 1119 QString item = QString(sSectionItemTpl2) 1120 .arg(tr ("Video Memory", "details report"), 1121 tr ("<nobr>%1 MB</nobr>", "details report")) 1122 .arg(aMachine.GetVRAMSize()); 1123 ++rows; 1124 1125 int cGuestScreens = aMachine.GetMonitorCount(); 1114 ++iRowCount; 1115 const QString strParavirtProvider = gpConverter->toString(comMachine.GetParavirtProvider()); 1116 strItem += QString(sSectionItemTpl2).arg(tr("Paravirtualization Interface", "details report"), strParavirtProvider); 1117 1118 /* Append report: */ 1119 strReport += strSectionTpl 1120 .arg(2 + iRowCount) /* rows */ 1121 .arg(":/chipset_16px.png", /* icon */ 1122 "#system", /* link */ 1123 tr("System", "details report"), /* title */ 1124 strItem, /* items */ 1125 QString::number(iIconMetric), 1126 QString::number(iIndentMetric)); 1127 } 1128 1129 /* Display: */ 1130 { 1131 /* Video Memory: */ 1132 int iRowCount = 1; 1133 QString strItem = QString(sSectionItemTpl2).arg(tr("Video Memory", "details report"), 1134 tr("<nobr>%1 MB</nobr>", "details report") 1135 .arg(QString::number(comMachine.GetVRAMSize()))); 1136 1137 /* Screens? */ 1138 const int cGuestScreens = comMachine.GetMonitorCount(); 1126 1139 if (cGuestScreens > 1) 1127 1140 { 1128 item += QString(sSectionItemTpl2) 1129 .arg(tr("Screens", "details report")) 1130 .arg(cGuestScreens); 1131 ++rows; 1132 } 1133 1134 QString acc3d = aMachine.GetAccelerate3DEnabled() && is3DAvailable() 1135 ? tr ("Enabled", "details report (3D Acceleration)") 1136 : tr ("Disabled", "details report (3D Acceleration)"); 1137 1138 item += QString(sSectionItemTpl2) 1139 .arg(tr("3D Acceleration", "details report"), acc3d); 1140 ++rows; 1141 ++iRowCount; 1142 strItem += QString(sSectionItemTpl2).arg(tr("Screens", "details report"), 1143 QString::number(cGuestScreens)); 1144 } 1145 1146 /* 3D Acceleration: */ 1147 ++iRowCount; 1148 QString strAcc3d = comMachine.GetAccelerate3DEnabled() && is3DAvailable() 1149 ? tr("Enabled", "details report (3D Acceleration)") 1150 : tr("Disabled", "details report (3D Acceleration)"); 1151 strItem += QString(sSectionItemTpl2).arg(tr("3D Acceleration", "details report"), strAcc3d); 1141 1152 1142 1153 #ifdef VBOX_WITH_VIDEOHWACCEL 1143 QString acc2dVideo = aMachine.GetAccelerate2DVideoEnabled() 1144 ? tr ("Enabled", "details report (2D Video Acceleration)") 1145 : tr ("Disabled", "details report (2D Video Acceleration)"); 1146 1147 item += QString (sSectionItemTpl2) 1148 .arg (tr ("2D Video Acceleration", "details report"), acc2dVideo); 1149 ++ rows; 1154 /* 2D Video Acceleration: */ 1155 ++iRowCount; 1156 QString strAcc2dVideo = comMachine.GetAccelerate2DVideoEnabled() 1157 ? tr("Enabled", "details report (2D Video Acceleration)") 1158 : tr("Disabled", "details report (2D Video Acceleration)"); 1159 strItem += QString(sSectionItemTpl2).arg(tr("2D Video Acceleration", "details report"), strAcc2dVideo); 1150 1160 #endif 1151 1161 1152 /* VRDP tab*/1153 CVRDEServer srv = aMachine.GetVRDEServer();1154 if (! srv.isNull())1155 { 1156 if (srv.GetEnabled())1157 item += QString (sSectionItemTpl2)1158 .arg (tr ("Remote Desktop Server Port", "details report (VRDE Server)"))1159 .arg (srv.GetVRDEProperty("TCP/Ports"));1162 /* Remote Desktop Server: */ 1163 const CVRDEServer comServer = comMachine.GetVRDEServer(); 1164 if (!comServer.isNull()) 1165 { 1166 ++iRowCount; 1167 if (comServer.GetEnabled()) 1168 strItem += QString(sSectionItemTpl2).arg(tr("Remote Desktop Server Port", "details report (VRDE Server)"), 1169 comServer.GetVRDEProperty("TCP/Ports")); 1160 1170 else 1161 item += QString (sSectionItemTpl2)1162 .arg (tr ("Remote Desktop Server", "details report (VRDE Server)"))1163 .arg (tr ("Disabled", "details report (VRDE Server)"));1164 ++ rows; 1165 }1166 1167 report += sectionTpl1168 .arg (rows) /* rows*/1169 .arg (":/vrdp_16px.png", /* icon*/1170 "#display", /* link*/1171 tr ("Display", "details report"), /* title*/1172 item); /* items */1173 }1174 1175 /* Storage */ 1176 {1177 /* Rows including section header and footer */1178 int rows = 2;1179 1180 QString item;1171 strItem += QString(sSectionItemTpl2).arg(tr("Remote Desktop Server", "details report (VRDE Server)"), 1172 tr("Disabled", "details report (VRDE Server)")); 1173 } 1174 1175 /* Append report: */ 1176 strReport += strSectionTpl 1177 .arg(2 + iRowCount) /* rows */ 1178 .arg(":/vrdp_16px.png", /* icon */ 1179 "#display", /* link */ 1180 tr("Display", "details report"), /* title */ 1181 strItem, /* items */ 1182 QString::number(iIconMetric), 1183 QString::number(iIndentMetric)); 1184 } 1185 1186 /* Storage: */ 1187 { 1188 /* Nothing: */ 1189 int iRowCount = 0; 1190 QString strItem; 1181 1191 1182 1192 /* Iterate over the all machine controllers: */ 1183 CStorageControllerVector controllers = aMachine.GetStorageControllers(); 1184 for (int i = 0; i < controllers.size(); ++i) 1185 { 1186 /* Get current controller: */ 1187 const CStorageController &controller = controllers[i]; 1193 foreach (const CStorageController &comController, comMachine.GetStorageControllers()) 1194 { 1188 1195 /* Add controller information: */ 1189 QString strControllerName = QApplication::translate("UIMachineSettingsStorage", "Controller: %1");1190 item += QString(sSectionItemTpl3).arg(strControllerName.arg(controller.GetName()));1191 ++ rows;1196 ++iRowCount; 1197 const QString strControllerName = QApplication::translate("UIMachineSettingsStorage", "Controller: %1"); 1198 strItem += QString(sSectionItemTpl3).arg(strControllerName.arg(comController.GetName())); 1192 1199 1193 1200 /* Populate sorted map with attachments information: */ 1194 1201 QMap<StorageSlot,QString> attachmentsMap; 1195 CMediumAttachmentVector attachments = aMachine.GetMediumAttachmentsOfController(controller.GetName()); 1196 for (int j = 0; j < attachments.size(); ++j) 1202 foreach (const CMediumAttachment &comAttachment, comMachine.GetMediumAttachmentsOfController(comController.GetName())) 1197 1203 { 1198 /* Get current attachment: */1199 const CMediumAttachment &attachment = attachments[j];1200 1204 /* Prepare current storage slot: */ 1201 StorageSlot attachmentSlot(controller.GetBus(), attachment.GetPort(), attachment.GetDevice()); 1205 const StorageSlot attachmentSlot(comController.GetBus(), comAttachment.GetPort(), comAttachment.GetDevice()); 1206 // TODO: Fix that NLS bug one day.. 1202 1207 /* Append 'device slot name' with 'device type name' for optical devices only: */ 1203 QString strDeviceType = attachment.GetType() == KDeviceType_DVD ? tr("(Optical Drive)") : QString();1208 QString strDeviceType = comAttachment.GetType() == KDeviceType_DVD ? tr("(Optical Drive)") : QString(); 1204 1209 if (!strDeviceType.isNull()) 1205 1210 strDeviceType.prepend(' '); 1206 1211 /* Prepare current medium object: */ 1207 const CMedium &medium = attachment.GetMedium();1212 const CMedium &medium = comAttachment.GetMedium(); 1208 1213 /* Prepare information about current medium & attachment: */ 1209 QString strAttachmentInfo = !attachment.isOk() ? QString() : 1210 QString(sSectionItemTpl2) 1214 QString strAttachmentInfo = !comAttachment.isOk() 1215 ? QString() 1216 : QString(sSectionItemTpl2) 1211 1217 .arg(QString(" ") + 1212 gpConverter->toString(StorageSlot(co ntroller.GetBus(),1213 attachment.GetPort(),1214 attachment.GetDevice())) + strDeviceType)1218 gpConverter->toString(StorageSlot(comController.GetBus(), 1219 comAttachment.GetPort(), 1220 comAttachment.GetDevice())) + strDeviceType) 1215 1221 .arg(details(medium, false)); 1216 1222 /* Insert that attachment into map: */ … … 1220 1226 1221 1227 /* Iterate over the sorted map with attachments information: */ 1222 QMapIterator<StorageSlot, QString> it(attachmentsMap);1228 QMapIterator<StorageSlot, QString> it(attachmentsMap); 1223 1229 while (it.hasNext()) 1224 1230 { 1225 1231 /* Add controller information: */ 1226 1232 it.next(); 1227 item += it.value();1228 ++rows;1233 ++iRowCount; 1234 strItem += it.value(); 1229 1235 } 1230 1236 } 1231 1237 1232 if (item.isNull()) 1233 { 1234 item = QString (sSectionItemTpl1) 1235 .arg (tr ("Not Attached", "details report (Storage)")); 1236 ++ rows; 1237 } 1238 1239 report += sectionTpl 1240 .arg (rows) /* rows */ 1241 .arg (":/hd_16px.png", /* icon */ 1242 "#storage", /* link */ 1243 tr ("Storage", "details report"), /* title */ 1244 item); /* items */ 1245 } 1246 1247 /* Audio */ 1248 { 1249 QString item; 1250 1251 CAudioAdapter audio = aMachine.GetAudioAdapter(); 1252 int rows = audio.GetEnabled() ? 3 : 2; 1253 if (audio.GetEnabled()) 1254 item = QString (sSectionItemTpl2) 1255 .arg (tr ("Host Driver", "details report (audio)"), 1256 gpConverter->toString (audio.GetAudioDriver())) + 1257 QString (sSectionItemTpl2) 1258 .arg (tr ("Controller", "details report (audio)"), 1259 gpConverter->toString (audio.GetAudioController())); 1238 /* Handle side-case: */ 1239 if (strItem.isNull()) 1240 { 1241 ++iRowCount; 1242 strItem = QString(sSectionItemTpl1).arg(tr("Not Attached", "details report (Storage)")); 1243 } 1244 1245 /* Append report: */ 1246 strReport += strSectionTpl 1247 .arg(2 + iRowCount) /* rows */ 1248 .arg(":/hd_16px.png", /* icon */ 1249 "#storage", /* link */ 1250 tr("Storage", "details report"), /* title */ 1251 strItem, /* items */ 1252 QString::number(iIconMetric), 1253 QString::number(iIndentMetric)); 1254 } 1255 1256 /* Audio: */ 1257 { 1258 /* Nothing: */ 1259 int iRowCount = 0; 1260 QString strItem; 1261 1262 /* Host Driver, Controller? */ 1263 const CAudioAdapter &comAudio = comMachine.GetAudioAdapter(); 1264 if (comAudio.GetEnabled()) 1265 { 1266 iRowCount += 2; 1267 strItem = QString(sSectionItemTpl2).arg(tr("Host Driver", "details report (audio)"), 1268 gpConverter->toString(comAudio.GetAudioDriver())) 1269 + QString(sSectionItemTpl2).arg(tr("Controller", "details report (audio)"), 1270 gpConverter->toString(comAudio.GetAudioController())); 1271 } 1260 1272 else 1261 item = QString (sSectionItemTpl1) 1262 .arg (tr ("Disabled", "details report (audio)")); 1263 1264 report += sectionTpl 1265 .arg (rows + 1) /* rows */ 1266 .arg (":/sound_16px.png", /* icon */ 1267 "#audio", /* link */ 1268 tr ("Audio", "details report"), /* title */ 1269 item); /* items */ 1270 } 1271 1272 /* Network */ 1273 { 1274 QString item; 1275 1276 ulong count = m_vbox.GetSystemProperties().GetMaxNetworkAdapters(aMachine.GetChipsetType()); 1277 int rows = 2; /* including section header and footer */ 1278 for (ulong slot = 0; slot < count; slot ++) 1279 { 1280 CNetworkAdapter adapter = aMachine.GetNetworkAdapter (slot); 1281 if (adapter.GetEnabled()) 1273 { 1274 ++iRowCount; 1275 strItem = QString(sSectionItemTpl1).arg(tr("Disabled", "details report (audio)")); 1276 } 1277 1278 /* Append report: */ 1279 strReport += strSectionTpl 1280 .arg(2 + iRowCount) /* rows */ 1281 .arg(":/sound_16px.png", /* icon */ 1282 "#audio", /* link */ 1283 tr("Audio", "details report"), /* title */ 1284 strItem, /* items */ 1285 QString::number(iIconMetric), 1286 QString::number(iIndentMetric)); 1287 } 1288 1289 /* Network: */ 1290 { 1291 /* Nothing: */ 1292 int iRowCount = 0; 1293 QString strItem; 1294 1295 /* Enumerate all the network adapters (up to acquired/limited count): */ 1296 const ulong iCount = m_vbox.GetSystemProperties().GetMaxNetworkAdapters(comMachine.GetChipsetType()); 1297 for (ulong iSlot = 0; iSlot < iCount; ++iSlot) 1298 { 1299 /* Get current network adapter: */ 1300 const CNetworkAdapter &comNetwork = comMachine.GetNetworkAdapter(iSlot); 1301 if (comNetwork.GetEnabled()) 1282 1302 { 1283 KNetworkAttachmentType type = adapter.GetAttachmentType(); 1284 QString attType = gpConverter->toString (adapter.GetAdapterType()) 1285 .replace (QRegExp ("\\s\\(.+\\)"), " (%1)"); 1286 /* don't use the adapter type string for types that have 1287 * an additional symbolic network/interface name field, use 1288 * this name instead */ 1289 if (type == KNetworkAttachmentType_Bridged) 1290 attType = attType.arg (tr ("Bridged adapter, %1", 1291 "details report (network)").arg (adapter.GetBridgedInterface())); 1292 else if (type == KNetworkAttachmentType_Internal) 1293 attType = attType.arg (tr ("Internal network, '%1'", 1294 "details report (network)").arg (adapter.GetInternalNetwork())); 1295 else if (type == KNetworkAttachmentType_HostOnly) 1296 attType = attType.arg (tr ("Host-only adapter, '%1'", 1297 "details report (network)").arg (adapter.GetHostOnlyInterface())); 1298 else if (type == KNetworkAttachmentType_Generic) 1299 attType = attType.arg (tr ("Generic, '%1'", 1300 "details report (network)").arg (adapter.GetGenericDriver())); 1301 else if (type == KNetworkAttachmentType_NATNetwork) 1302 attType = attType.arg (tr ("NAT network, '%1'", 1303 "details report (network)").arg (adapter.GetNATNetwork())); 1303 /* Determine attachment type: */ 1304 const KNetworkAttachmentType enmType = comNetwork.GetAttachmentType(); 1305 QString attType = gpConverter->toString(comNetwork.GetAdapterType()) 1306 .replace(QRegExp("\\s\\(.+\\)"), " (%1)"); 1307 /* Don't use the adapter type string for types that have 1308 * an additional symbolic network/interface name field, 1309 * use this name instead: */ 1310 switch (enmType) 1311 { 1312 case KNetworkAttachmentType_Bridged: 1313 attType = attType.arg(tr("Bridged adapter, %1", "details report (network)") 1314 .arg(comNetwork.GetBridgedInterface())); 1315 break; 1316 case KNetworkAttachmentType_Internal: 1317 attType = attType.arg(tr("Internal network, '%1'", "details report (network)") 1318 .arg(comNetwork.GetInternalNetwork())); 1319 break; 1320 case KNetworkAttachmentType_HostOnly: 1321 attType = attType.arg(tr("Host-only adapter, '%1'", "details report (network)") 1322 .arg(comNetwork.GetHostOnlyInterface())); 1323 break; 1324 case KNetworkAttachmentType_Generic: 1325 attType = attType.arg(tr("Generic, '%1'", "details report (network)") 1326 .arg(comNetwork.GetGenericDriver())); 1327 break; 1328 case KNetworkAttachmentType_NATNetwork: 1329 attType = attType.arg(tr("NAT network, '%1'", "details report (network)") 1330 .arg(comNetwork.GetNATNetwork())); 1331 break; 1332 default: 1333 attType = attType.arg(gpConverter->toString(enmType)); 1334 break; 1335 } 1336 /* Here goes the record: */ 1337 ++iRowCount; 1338 strItem += QString(sSectionItemTpl2).arg(tr("Adapter %1", "details report (network)") 1339 .arg(comNetwork.GetSlot() + 1), 1340 attType); 1341 } 1342 } 1343 1344 /* Handle side-case: */ 1345 if (strItem.isNull()) 1346 { 1347 ++iRowCount; 1348 strItem = QString(sSectionItemTpl1).arg(tr("Disabled", "details report (network)")); 1349 } 1350 1351 /* Append report: */ 1352 strReport += strSectionTpl 1353 .arg(2 + iRowCount) /* rows */ 1354 .arg(":/nw_16px.png", /* icon */ 1355 "#network", /* link */ 1356 tr("Network", "details report"), /* title */ 1357 strItem, /* items */ 1358 QString::number(iIconMetric), 1359 QString::number(iIndentMetric)); 1360 } 1361 1362 /* Serial Ports: */ 1363 { 1364 /* Nothing: */ 1365 int iRowCount = 0; 1366 QString strItem; 1367 1368 /* Enumerate all the serial ports (up to acquired/limited count): */ 1369 const ulong iCount = m_vbox.GetSystemProperties().GetSerialPortCount(); 1370 for (ulong iSlot = 0; iSlot < iCount; ++iSlot) 1371 { 1372 /* Get current serial port: */ 1373 const CSerialPort &comSerial = comMachine.GetSerialPort(iSlot); 1374 if (comSerial.GetEnabled()) 1375 { 1376 /* Determine port mode: */ 1377 const KPortMode enmMode = comSerial.GetHostMode(); 1378 /* Compose the data: */ 1379 QString strData = toCOMPortName(comSerial.GetIRQ(), comSerial.GetIOBase()) + ", "; 1380 if ( enmMode == KPortMode_HostPipe 1381 || enmMode == KPortMode_HostDevice 1382 || enmMode == KPortMode_TCP 1383 || enmMode == KPortMode_RawFile) 1384 strData += QString("%1 (<nobr>%2</nobr>)").arg(gpConverter->toString(enmMode)) 1385 .arg(QDir::toNativeSeparators(comSerial.GetPath())); 1304 1386 else 1305 attType = attType.arg (gpConverter->toString (type)); 1306 1307 item += QString (sSectionItemTpl2) 1308 .arg (tr ("Adapter %1", "details report (network)") 1309 .arg (adapter.GetSlot() + 1)) 1310 .arg (attType); 1311 ++ rows; 1387 strData += gpConverter->toString(enmMode); 1388 /* Here goes the record: */ 1389 ++iRowCount; 1390 strItem += QString(sSectionItemTpl2).arg(tr("Port %1", "details report (serial ports)") 1391 .arg(comSerial.GetSlot() + 1), 1392 strData); 1312 1393 } 1313 1394 } 1314 if (item.isNull()) 1315 { 1316 item = QString (sSectionItemTpl1) 1317 .arg (tr ("Disabled", "details report (network)")); 1318 ++ rows; 1319 } 1320 1321 report += sectionTpl 1322 .arg (rows) /* rows */ 1323 .arg (":/nw_16px.png", /* icon */ 1324 "#network", /* link */ 1325 tr ("Network", "details report"), /* title */ 1326 item); /* items */ 1327 } 1328 1329 /* Serial Ports */ 1330 { 1331 QString item; 1332 1333 ulong count = m_vbox.GetSystemProperties().GetSerialPortCount(); 1334 int rows = 2; /* including section header and footer */ 1335 for (ulong slot = 0; slot < count; slot ++) 1336 { 1337 CSerialPort port = aMachine.GetSerialPort (slot); 1338 if (port.GetEnabled()) 1395 1396 /* Handle side-case: */ 1397 if (strItem.isNull()) 1398 { 1399 ++iRowCount; 1400 strItem = QString(sSectionItemTpl1).arg(tr("Disabled", "details report (serial ports)")); 1401 } 1402 1403 /* Append report: */ 1404 strReport += strSectionTpl 1405 .arg(2 + iRowCount) /* rows */ 1406 .arg(":/serial_port_16px.png", /* icon */ 1407 "#serialPorts", /* link */ 1408 tr("Serial Ports", "details report"), /* title */ 1409 strItem, /* items */ 1410 QString::number(iIconMetric), 1411 QString::number(iIndentMetric)); 1412 } 1413 1414 /* Parallel Ports: */ 1415 { 1416 /* Nothing: */ 1417 int iRowCount = 0; 1418 QString strItem; 1419 1420 /* Enumerate all the serial ports (up to acquired/limited count): */ 1421 const ulong iCount = m_vbox.GetSystemProperties().GetParallelPortCount(); 1422 for (ulong iSlot = 0; iSlot < iCount; ++iSlot) 1423 { 1424 /* Get current parallel port: */ 1425 const CParallelPort &comParallel = comMachine.GetParallelPort(iSlot); 1426 if (comParallel.GetEnabled()) 1339 1427 { 1340 KPortMode mode = port.GetHostMode(); 1341 QString data = 1342 toCOMPortName (port.GetIRQ(), port.GetIOBase()) + ", "; 1343 if (mode == KPortMode_HostPipe || 1344 mode == KPortMode_HostDevice || 1345 mode == KPortMode_TCP || 1346 mode == KPortMode_RawFile) 1347 data += QString ("%1 (<nobr>%2</nobr>)") 1348 .arg (gpConverter->toString (mode)) 1349 .arg (QDir::toNativeSeparators (port.GetPath())); 1350 else 1351 data += gpConverter->toString (mode); 1352 1353 item += QString (sSectionItemTpl2) 1354 .arg (tr ("Port %1", "details report (serial ports)") 1355 .arg (port.GetSlot() + 1)) 1356 .arg (data); 1357 ++ rows; 1428 /* Compose the data: */ 1429 QString strData = toLPTPortName(comParallel.GetIRQ(), comParallel.GetIOBase()) 1430 + QString(" (<nobr>%1</nobr>)").arg(QDir::toNativeSeparators(comParallel.GetPath())); 1431 /* Here goes the record: */ 1432 ++iRowCount; 1433 strItem += QString(sSectionItemTpl2).arg(tr("Port %1", "details report (parallel ports)") 1434 .arg(comParallel.GetSlot() + 1), 1435 strData); 1358 1436 } 1359 1437 } 1360 if (item.isNull()) 1361 { 1362 item = QString (sSectionItemTpl1) 1363 .arg (tr ("Disabled", "details report (serial ports)")); 1364 ++ rows; 1365 } 1366 1367 report += sectionTpl 1368 .arg (rows) /* rows */ 1369 .arg (":/serial_port_16px.png", /* icon */ 1370 "#serialPorts", /* link */ 1371 tr ("Serial Ports", "details report"), /* title */ 1372 item); /* items */ 1373 } 1374 1375 /* Parallel Ports */ 1376 { 1377 QString item; 1378 1379 ulong count = m_vbox.GetSystemProperties().GetParallelPortCount(); 1380 int rows = 2; /* including section header and footer */ 1381 for (ulong slot = 0; slot < count; slot ++) 1382 { 1383 CParallelPort port = aMachine.GetParallelPort (slot); 1384 if (port.GetEnabled()) 1438 1439 /* Handle side-case: */ 1440 if (strItem.isNull()) 1441 { 1442 ++iRowCount; 1443 strItem = QString(sSectionItemTpl1).arg(tr("Disabled", "details report (parallel ports)")); 1444 } 1445 1446 /* Temporary disabled: */ 1447 const QString dummy = strSectionTpl /* strReport += strSectionTpl */ 1448 .arg(2 + iRowCount) /* rows */ 1449 .arg(":/parallel_port_16px.png", /* icon */ 1450 "#parallelPorts", /* link */ 1451 tr("Parallel Ports", "details report"), /* title */ 1452 strItem, /* items */ 1453 QString::number(iIconMetric), 1454 QString::number(iIndentMetric)); 1455 Q_UNUSED(dummy); 1456 } 1457 1458 /* USB */ 1459 { 1460 /* Acquire USB filters object: */ 1461 const CUSBDeviceFilters &comFilters = comMachine.GetUSBDeviceFilters(); 1462 if ( !comFilters.isNull() 1463 && comMachine.GetUSBProxyAvailable()) 1464 { 1465 /* Device Filters: */ 1466 int iRowCount = 1; 1467 QString strItem; 1468 1469 /* The USB controller may be unavailable (i.e. in VirtualBox OSE): */ 1470 if (!comMachine.GetUSBControllers().isEmpty()) 1385 1471 { 1386 QString data = 1387 toLPTPortName (port.GetIRQ(), port.GetIOBase()) + 1388 QString (" (<nobr>%1</nobr>)") 1389 .arg (QDir::toNativeSeparators (port.GetPath())); 1390 1391 item += QString (sSectionItemTpl2) 1392 .arg (tr ("Port %1", "details report (parallel ports)") 1393 .arg (port.GetSlot() + 1)) 1394 .arg (data); 1395 ++ rows; 1472 /* Acquire USB filters: */ 1473 const CUSBDeviceFilterVector &filterVector = comFilters.GetDeviceFilters(); 1474 /* Calculate the amount of active filters: */ 1475 uint cActive = 0; 1476 foreach (const CUSBDeviceFilter &comFilter, filterVector) 1477 if (comFilter.GetActive()) 1478 ++cActive; 1479 /* Here goes the record: */ 1480 strItem = QString(sSectionItemTpl2).arg(tr("Device Filters", "details report (USB)"), 1481 tr("%1 (%2 active)", "details report (USB)") 1482 .arg(filterVector.size()).arg(cActive)); 1396 1483 } 1397 } 1398 if (item.isNull()) 1399 { 1400 item = QString (sSectionItemTpl1) 1401 .arg (tr ("Disabled", "details report (parallel ports)")); 1402 ++ rows; 1403 } 1404 1405 /* Temporary disabled */ 1406 QString dummy = sectionTpl /* report += sectionTpl */ 1407 .arg (rows) /* rows */ 1408 .arg (":/parallel_port_16px.png", /* icon */ 1409 "#parallelPorts", /* link */ 1410 tr ("Parallel Ports", "details report"), /* title */ 1411 item); /* items */ 1412 } 1413 1414 /* USB */ 1415 { 1416 QString item; 1417 1418 CUSBDeviceFilters flts = aMachine.GetUSBDeviceFilters(); 1419 if ( !flts.isNull() 1420 && aMachine.GetUSBProxyAvailable()) 1421 { 1422 /* The USB controller may be unavailable (i.e. in VirtualBox OSE): */ 1423 if (aMachine.GetUSBControllers().isEmpty()) 1424 item = QString(sSectionItemTpl1).arg(tr("Disabled", "details report (USB)")); 1425 else 1426 { 1427 CUSBDeviceFilterVector coll = flts.GetDeviceFilters(); 1428 uint active = 0; 1429 for (int i = 0; i < coll.size(); ++i) 1430 if (coll[i].GetActive()) 1431 active ++; 1432 1433 item = QString (sSectionItemTpl2) 1434 .arg (tr ("Device Filters", "details report (USB)"), 1435 tr ("%1 (%2 active)", "details report (USB)") 1436 .arg (coll.size()).arg (active)); 1437 } 1438 1439 report += sectionTpl 1440 .arg (2 + 1) /* rows */ 1441 .arg (":/usb_16px.png", /* icon */ 1442 "#usb", /* link */ 1443 tr ("USB", "details report"), /* title */ 1444 item); /* items */ 1484 1485 /* Handle side-case: */ 1486 if (strItem.isNull()) 1487 strItem = QString(sSectionItemTpl1).arg(tr("Disabled", "details report (USB)")); 1488 1489 /* Append report: */ 1490 strReport += strSectionTpl 1491 .arg(2 + iRowCount) /* rows */ 1492 .arg(":/usb_16px.png", /* icon */ 1493 "#usb", /* link */ 1494 tr("USB", "details report"), /* title */ 1495 strItem, /* items */ 1496 QString::number(iIconMetric), 1497 QString::number(iIndentMetric)); 1445 1498 } 1446 1499 } … … 1448 1501 /* Shared Folders */ 1449 1502 { 1450 QString item;1451 1452 ulong count = aMachine.GetSharedFolders().size();1453 if (count > 0) 1454 {1455 item = QString (sSectionItemTpl2)1456 .arg (tr ("Shared Folders", "details report (shared folders)"))1457 .arg (count);1458 }1503 /* Shared Folders: */ 1504 int iRowCount = 1; 1505 QString strItem; 1506 1507 /* Acquire shared folders count: */ 1508 const ulong iCount = comMachine.GetSharedFolders().size(); 1509 if (iCount > 0) 1510 strItem = QString(sSectionItemTpl2).arg(tr("Shared Folders", "details report (shared folders)"), 1511 QString::number(iCount)); 1459 1512 else 1460 item = QString (sSectionItemTpl1) 1461 .arg (tr ("None", "details report (shared folders)")); 1462 1463 report += sectionTpl 1464 .arg (2 + 1) /* rows */ 1465 .arg (":/sf_16px.png", /* icon */ 1466 "#sfolders", /* link */ 1467 tr ("Shared Folders", "details report"), /* title */ 1468 item); /* items */ 1469 } 1470 1471 return QString (sTableTpl). arg (report); 1513 strItem = QString(sSectionItemTpl1).arg(tr("None", "details report (shared folders)")); 1514 1515 /* Append report: */ 1516 strReport += strSectionTpl 1517 .arg(2 + iRowCount) /* rows */ 1518 .arg(":/sf_16px.png", /* icon */ 1519 "#sfolders", /* link */ 1520 tr("Shared Folders", "details report"), /* title */ 1521 strItem, /* items */ 1522 QString::number(iIconMetric), 1523 QString::number(iIndentMetric)); 1524 } 1525 1526 /* Compose full report: */ 1527 return QString(sTableTpl).arg(strReport); 1472 1528 } 1473 1529 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
r66662 r67212 311 311 QString toolTip(const CHostVideoInputDevice &webcam) const; 312 312 313 QString detailsReport (const CMachine &aMachine, bool aWithLinks); 313 /** Returns a details report on a given VM represented as a HTML table. 314 * @param comMachine Brings the machine object to create a report for. 315 * @param fWithLinks Brings @c true if section titles should be hypertext links. */ 316 QString detailsReport(const CMachine &comMachine, bool fWithLinks); 314 317 315 318 /* VirtualBox helpers */
Note:
See TracChangeset
for help on using the changeset viewer.