1 | /* $Id: UIDetailsGenerator.cpp 103803 2024-03-12 11:15:18Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIDetailsGenerator implementation.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2012-2023 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | /* Qt includes: */
|
---|
29 | #include <QApplication>
|
---|
30 | #include <QDir>
|
---|
31 | #include <QRegularExpression>
|
---|
32 |
|
---|
33 | /* GUI includes: */
|
---|
34 | #include "UIBootOrderEditor.h"
|
---|
35 | #include "UICommon.h"
|
---|
36 | #include "UIConverter.h"
|
---|
37 | #include "UIDetailsGenerator.h"
|
---|
38 | #include "UIErrorString.h"
|
---|
39 | #include "UIGlobalSession.h"
|
---|
40 | #include "UIGuestOSType.h"
|
---|
41 | #include "UIMedium.h"
|
---|
42 | #include "UITranslator.h"
|
---|
43 |
|
---|
44 | /* COM includes: */
|
---|
45 | #include "CAudioAdapter.h"
|
---|
46 | #include "CAudioSettings.h"
|
---|
47 | #include "CBooleanFormValue.h"
|
---|
48 | #include "CChoiceFormValue.h"
|
---|
49 | #include "CCloudMachine.h"
|
---|
50 | #include "CConsole.h"
|
---|
51 | #include "CFirmwareSettings.h"
|
---|
52 | #include "CForm.h"
|
---|
53 | #include "CFormValue.h"
|
---|
54 | #include "CGraphicsAdapter.h"
|
---|
55 | #include "CGuest.h"
|
---|
56 | #include "CMachine.h"
|
---|
57 | #include "CMediumAttachment.h"
|
---|
58 | #include "CNetworkAdapter.h"
|
---|
59 | #include "CNvramStore.h"
|
---|
60 | #include "CPlatform.h"
|
---|
61 | #include "CPlatformX86.h"
|
---|
62 | #include "CPlatformProperties.h"
|
---|
63 | #include "CProgress.h"
|
---|
64 | #include "CRangedIntegerFormValue.h"
|
---|
65 | #include "CRangedInteger64FormValue.h"
|
---|
66 | #include "CRecordingScreenSettings.h"
|
---|
67 | #include "CRecordingSettings.h"
|
---|
68 | #include "CSerialPort.h"
|
---|
69 | #include "CSharedFolder.h"
|
---|
70 | #include "CStorageController.h"
|
---|
71 | #include "CStringFormValue.h"
|
---|
72 | #include "CTrustedPlatformModule.h"
|
---|
73 | #include "CUefiVariableStore.h"
|
---|
74 | #include "CUSBController.h"
|
---|
75 | #include "CUSBDevice.h"
|
---|
76 | #include "CUSBDeviceFilter.h"
|
---|
77 | #include "CUSBDeviceFilters.h"
|
---|
78 | #include "CVRDEServer.h"
|
---|
79 |
|
---|
80 | /* VirtualBox interface declarations: */
|
---|
81 | #include <iprt/time.h>
|
---|
82 | #include <VBox/com/VirtualBox.h>
|
---|
83 |
|
---|
84 |
|
---|
85 | const QString UIDetailsGenerator::e_strTableRow1 = QString("<tr><td colspan='2'><nobr><b>%1</b></nobr></td></tr>");
|
---|
86 | const QString UIDetailsGenerator::e_strTableRow2 = QString("<tr><td><nobr>%1:</nobr></td><td><nobr>%2</nobr></td></tr>");
|
---|
87 | const QString UIDetailsGenerator::e_strTableRow3 = QString("<tr><td><nobr> %1:</nobr></td><td><nobr>%2</nobr></td></tr>");
|
---|
88 |
|
---|
89 |
|
---|
90 | UITextTable UIDetailsGenerator::generateMachineInformationGeneral(CMachine &comMachine,
|
---|
91 | const UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral &fOptions)
|
---|
92 | {
|
---|
93 | UITextTable table;
|
---|
94 |
|
---|
95 | if (comMachine.isNull())
|
---|
96 | return table;
|
---|
97 |
|
---|
98 | if (!comMachine.GetAccessible())
|
---|
99 | {
|
---|
100 | table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString());
|
---|
101 | return table;
|
---|
102 | }
|
---|
103 |
|
---|
104 | /* Name: */
|
---|
105 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_Name)
|
---|
106 | {
|
---|
107 | /* Configure hovering anchor: */
|
---|
108 | const QString strAnchorType = QString("machine_name");
|
---|
109 | const QString strName = comMachine.GetName();
|
---|
110 | table << UITextTableLine(QApplication::translate("UIDetails", "Name", "details (general)"),
|
---|
111 | QString("<a href=#%1,%2>%2</a>")
|
---|
112 | .arg(strAnchorType,
|
---|
113 | strName));
|
---|
114 | }
|
---|
115 |
|
---|
116 | /* Operating system: */
|
---|
117 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_OS)
|
---|
118 | {
|
---|
119 | /* Configure hovering anchor: */
|
---|
120 | const QString strAnchorType = QString("os_type");
|
---|
121 | const QString strOsTypeId = comMachine.GetOSTypeId();
|
---|
122 | table << UITextTableLine(QApplication::translate("UIDetails", "Operating System", "details (general)"),
|
---|
123 | QString("<a href=#%1,%2>%3</a>")
|
---|
124 | .arg(strAnchorType,
|
---|
125 | strOsTypeId,
|
---|
126 | gpGlobalSession->guestOSTypeManager().getDescription(strOsTypeId)));
|
---|
127 | }
|
---|
128 |
|
---|
129 | /* Settings file location: */
|
---|
130 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_Location)
|
---|
131 | {
|
---|
132 | /* Configure hovering anchor: */
|
---|
133 | const QString strAnchorType = QString("machine_location");
|
---|
134 | const QString strMachineLocation = comMachine.GetSettingsFilePath();
|
---|
135 | table << UITextTableLine(QApplication::translate("UIDetails", "Settings File Location", "details (general)"),
|
---|
136 | QString("<a href=#%1,%2>%3</a>")
|
---|
137 | .arg(strAnchorType,
|
---|
138 | strMachineLocation,
|
---|
139 | QDir::toNativeSeparators(QFileInfo(strMachineLocation).absolutePath())));
|
---|
140 | }
|
---|
141 |
|
---|
142 | /* Groups: */
|
---|
143 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_Groups)
|
---|
144 | {
|
---|
145 | QStringList groups = comMachine.GetGroups().toList();
|
---|
146 | /* Do not show groups for machine which is in root group only: */
|
---|
147 | if (groups.size() == 1)
|
---|
148 | groups.removeAll("/");
|
---|
149 | /* If group list still not empty: */
|
---|
150 | if (!groups.isEmpty())
|
---|
151 | {
|
---|
152 | /* For every group: */
|
---|
153 | for (int i = 0; i < groups.size(); ++i)
|
---|
154 | {
|
---|
155 | /* Trim first '/' symbol: */
|
---|
156 | QString &strGroup = groups[i];
|
---|
157 | if (strGroup.startsWith("/") && strGroup != "/")
|
---|
158 | strGroup.remove(0, 1);
|
---|
159 | }
|
---|
160 | table << UITextTableLine(QApplication::translate("UIDetails", "Groups", "details (general)"), groups.join(", "));
|
---|
161 | }
|
---|
162 | }
|
---|
163 |
|
---|
164 | return table;
|
---|
165 | }
|
---|
166 |
|
---|
167 | UITextTable UIDetailsGenerator::generateMachineInformationGeneral(CCloudMachine &comCloudMachine,
|
---|
168 | const UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral &)
|
---|
169 | {
|
---|
170 | UITextTable table;
|
---|
171 |
|
---|
172 | if (comCloudMachine.isNull())
|
---|
173 | return table;
|
---|
174 |
|
---|
175 | if (!comCloudMachine.GetAccessible())
|
---|
176 | {
|
---|
177 | table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString());
|
---|
178 | return table;
|
---|
179 | }
|
---|
180 |
|
---|
181 | /* Acquire details form: */
|
---|
182 | CForm comForm = comCloudMachine.GetDetailsForm();
|
---|
183 | /* Ignore cloud machine errors: */
|
---|
184 | if (comCloudMachine.isOk())
|
---|
185 | {
|
---|
186 | /* Common anchor for all fields: */
|
---|
187 | const QString strAnchorType = "cloud";
|
---|
188 |
|
---|
189 | /* For each form value: */
|
---|
190 | const QVector<CFormValue> values = comForm.GetValues();
|
---|
191 | foreach (const CFormValue &comIteratedValue, values)
|
---|
192 | {
|
---|
193 | /* Ignore invisible values: */
|
---|
194 | if (!comIteratedValue.GetVisible())
|
---|
195 | continue;
|
---|
196 |
|
---|
197 | /* Acquire label: */
|
---|
198 | const QString strLabel = comIteratedValue.GetLabel();
|
---|
199 | /* Generate value: */
|
---|
200 | const QString strValue = generateFormValueInformation(comIteratedValue);
|
---|
201 |
|
---|
202 | /* Generate table string: */
|
---|
203 | table << UITextTableLine(strLabel, QString("<a href=#%1,%2>%3</a>").arg(strAnchorType, strLabel, strValue));
|
---|
204 | }
|
---|
205 | }
|
---|
206 |
|
---|
207 | return table;
|
---|
208 | }
|
---|
209 |
|
---|
210 | QString UIDetailsGenerator::generateFormValueInformation(const CFormValue &comFormValue, bool fFull /* = false */)
|
---|
211 | {
|
---|
212 | /* Handle possible form value types: */
|
---|
213 | QString strResult;
|
---|
214 | switch (comFormValue.GetType())
|
---|
215 | {
|
---|
216 | case KFormValueType_Boolean:
|
---|
217 | {
|
---|
218 | CBooleanFormValue comValue(comFormValue);
|
---|
219 | const bool fBool = comValue.GetSelected();
|
---|
220 | strResult = fBool ? QApplication::translate("UIDetails", "Enabled", "details (cloud value)")
|
---|
221 | : QApplication::translate("UIDetails", "Disabled", "details (cloud value)");
|
---|
222 | break;
|
---|
223 | }
|
---|
224 | case KFormValueType_String:
|
---|
225 | {
|
---|
226 | CStringFormValue comValue(comFormValue);
|
---|
227 | const QString strValue = comValue.GetString();
|
---|
228 | const QString strClipboardValue = comValue.GetClipboardString();
|
---|
229 | strResult = fFull && !strClipboardValue.isEmpty() ? strClipboardValue : strValue;
|
---|
230 | break;
|
---|
231 | }
|
---|
232 | case KFormValueType_Choice:
|
---|
233 | {
|
---|
234 | AssertMsgFailed(("Aren't we decided to convert all choices to strings?\n"));
|
---|
235 | CChoiceFormValue comValue(comFormValue);
|
---|
236 | const QVector<QString> possibleValues = comValue.GetValues();
|
---|
237 | const int iCurrentIndex = comValue.GetSelectedIndex();
|
---|
238 | strResult = possibleValues.value(iCurrentIndex);
|
---|
239 | break;
|
---|
240 | }
|
---|
241 | case KFormValueType_RangedInteger:
|
---|
242 | {
|
---|
243 | CRangedIntegerFormValue comValue(comFormValue);
|
---|
244 | strResult = QString("%1 %2")
|
---|
245 | .arg(comValue.GetInteger())
|
---|
246 | .arg(QApplication::translate("UICommon", comValue.GetSuffix().toUtf8().constData()));
|
---|
247 | break;
|
---|
248 | }
|
---|
249 | case KFormValueType_RangedInteger64:
|
---|
250 | {
|
---|
251 | CRangedInteger64FormValue comValue(comFormValue);
|
---|
252 | strResult = QString("%1 %2")
|
---|
253 | .arg(comValue.GetInteger())
|
---|
254 | .arg(QApplication::translate("UICommon", comValue.GetSuffix().toUtf8().constData()));
|
---|
255 | break;
|
---|
256 | }
|
---|
257 | default:
|
---|
258 | break;
|
---|
259 | }
|
---|
260 | /* Return result: */
|
---|
261 | return strResult;
|
---|
262 | }
|
---|
263 |
|
---|
264 | UITextTable UIDetailsGenerator::generateMachineInformationSystem(CMachine &comMachine,
|
---|
265 | const UIExtraDataMetaDefs::DetailsElementOptionTypeSystem &fOptions)
|
---|
266 | {
|
---|
267 | UITextTable table;
|
---|
268 |
|
---|
269 | if (comMachine.isNull())
|
---|
270 | return table;
|
---|
271 |
|
---|
272 | if (!comMachine.GetAccessible())
|
---|
273 | {
|
---|
274 | table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString());
|
---|
275 | return table;
|
---|
276 | }
|
---|
277 |
|
---|
278 | /* Base memory: */
|
---|
279 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_RAM)
|
---|
280 | {
|
---|
281 | /* Configure hovering anchor: */
|
---|
282 | const QString strAnchorType = QString("base_memory");
|
---|
283 | const int iBaseMemory = comMachine.GetMemorySize();
|
---|
284 | table << UITextTableLine(QApplication::translate("UIDetails", "Base Memory", "details (system)"),
|
---|
285 | QString("<a href=#%1,%2>%3</a>")
|
---|
286 | .arg(strAnchorType)
|
---|
287 | .arg(iBaseMemory)
|
---|
288 | .arg(QApplication::translate("UIDetails", "%1 MB").arg(iBaseMemory)));
|
---|
289 | }
|
---|
290 |
|
---|
291 | /* Processors: */
|
---|
292 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_CPUCount)
|
---|
293 | {
|
---|
294 | const int cCPU = comMachine.GetCPUCount();
|
---|
295 | if (cCPU > 1)
|
---|
296 | table << UITextTableLine(QApplication::translate("UIDetails", "Processors", "details (system)"),
|
---|
297 | QString::number(cCPU));
|
---|
298 | }
|
---|
299 |
|
---|
300 | /* Execution cap: */
|
---|
301 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_CPUExecutionCap)
|
---|
302 | {
|
---|
303 | const int iCPUExecutionCap = comMachine.GetCPUExecutionCap();
|
---|
304 | if (iCPUExecutionCap < 100)
|
---|
305 | table << UITextTableLine(QApplication::translate("UIDetails", "Execution Cap", "details (system)"),
|
---|
306 | QApplication::translate("UIDetails", "%1%", "details").arg(iCPUExecutionCap));
|
---|
307 | }
|
---|
308 |
|
---|
309 | /* Boot order: */
|
---|
310 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_BootOrder)
|
---|
311 | {
|
---|
312 | /* Configure hovering anchor: */
|
---|
313 | const QString strAnchorType = QString("boot_order");
|
---|
314 | const UIBootItemDataList bootItems = loadBootItems(comMachine);
|
---|
315 | table << UITextTableLine(QApplication::translate("UIDetails", "Boot Order", "details (system)"),
|
---|
316 | QString("<a href=#%1,%2>%3</a>")
|
---|
317 | .arg(strAnchorType,
|
---|
318 | bootItemsToSerializedString(bootItems),
|
---|
319 | bootItemsToReadableString(bootItems)));
|
---|
320 | }
|
---|
321 |
|
---|
322 | /* Chipset type: */
|
---|
323 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_ChipsetType)
|
---|
324 | {
|
---|
325 | CPlatform comPlatform = comMachine.GetPlatform();
|
---|
326 | const KChipsetType enmChipsetType = comPlatform.GetChipsetType();
|
---|
327 | if (enmChipsetType == KChipsetType_ICH9)
|
---|
328 | table << UITextTableLine(QApplication::translate("UIDetails", "Chipset Type", "details (system)"),
|
---|
329 | gpConverter->toString(enmChipsetType));
|
---|
330 | }
|
---|
331 |
|
---|
332 | /* TPM type: */
|
---|
333 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_TpmType)
|
---|
334 | {
|
---|
335 | CTrustedPlatformModule comModule = comMachine.GetTrustedPlatformModule();
|
---|
336 | const KTpmType enmTpmType = comModule.GetType();
|
---|
337 | if (enmTpmType != KTpmType_None)
|
---|
338 | table << UITextTableLine(QApplication::translate("UIDetails", "TPM Type", "details (system)"),
|
---|
339 | gpConverter->toString(enmTpmType));
|
---|
340 | }
|
---|
341 |
|
---|
342 | /* EFI: */
|
---|
343 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_Firmware)
|
---|
344 | {
|
---|
345 | CFirmwareSettings comFirmwareSettings = comMachine.GetFirmwareSettings();
|
---|
346 | switch (comFirmwareSettings.GetFirmwareType())
|
---|
347 | {
|
---|
348 | case KFirmwareType_EFI:
|
---|
349 | case KFirmwareType_EFI32:
|
---|
350 | case KFirmwareType_EFI64:
|
---|
351 | case KFirmwareType_EFIDUAL:
|
---|
352 | {
|
---|
353 | table << UITextTableLine(QApplication::translate("UIDetails", "EFI", "details (system)"),
|
---|
354 | QApplication::translate("UIDetails", "Enabled", "details (system/EFI)"));
|
---|
355 | break;
|
---|
356 | }
|
---|
357 | default:
|
---|
358 | {
|
---|
359 | // For NLS purpose:
|
---|
360 | QApplication::translate("UIDetails", "Disabled", "details (system/EFI)");
|
---|
361 | break;
|
---|
362 | }
|
---|
363 | }
|
---|
364 | }
|
---|
365 |
|
---|
366 | /* Secure Boot: */
|
---|
367 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_SecureBoot)
|
---|
368 | {
|
---|
369 | CNvramStore comStoreLvl1 = comMachine.GetNonVolatileStore();
|
---|
370 | if (comStoreLvl1.isNotNull())
|
---|
371 | {
|
---|
372 | CUefiVariableStore comStoreLvl2 = comStoreLvl1.GetUefiVariableStore();
|
---|
373 | /// @todo this comStoreLvl2.isNotNull() will never work for
|
---|
374 | /// now since VM reference is immutable in Details pane
|
---|
375 | if ( comStoreLvl2.isNotNull()
|
---|
376 | && comStoreLvl2.GetSecureBootEnabled())
|
---|
377 | {
|
---|
378 | table << UITextTableLine(QApplication::translate("UIDetails", "Secure Boot", "details (system)"),
|
---|
379 | QApplication::translate("UIDetails", "Enabled", "details (system/secure boot)"));
|
---|
380 | }
|
---|
381 | }
|
---|
382 | }
|
---|
383 |
|
---|
384 | /* Acceleration: */
|
---|
385 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_Acceleration)
|
---|
386 | {
|
---|
387 | const CPlatform comPlatform = comMachine.GetPlatform();
|
---|
388 | switch (comPlatform.GetArchitecture())
|
---|
389 | {
|
---|
390 | case KPlatformArchitecture_x86:
|
---|
391 | {
|
---|
392 | CPlatformX86 comPlatformX86 = comPlatform.GetX86();
|
---|
393 | QStringList acceleration;
|
---|
394 | if (gpGlobalSession->virtualBox().GetHost().GetProcessorFeature(KProcessorFeature_HWVirtEx))
|
---|
395 | {
|
---|
396 | /* Nested Paging: */
|
---|
397 | if (comPlatformX86.GetHWVirtExProperty(KHWVirtExPropertyType_NestedPaging))
|
---|
398 | acceleration << QApplication::translate("UIDetails", "Nested Paging", "details (system)");
|
---|
399 | }
|
---|
400 | /* Nested VT-x/AMD-V: */
|
---|
401 | if (comPlatformX86.GetCPUProperty(KCPUPropertyTypeX86_HWVirt))
|
---|
402 | acceleration << QApplication::translate("UIDetails", "Nested VT-x/AMD-V", "details (system)");
|
---|
403 | /* PAE/NX: */
|
---|
404 | if (comPlatformX86.GetCPUProperty(KCPUPropertyTypeX86_PAE))
|
---|
405 | acceleration << QApplication::translate("UIDetails", "PAE/NX", "details (system)");
|
---|
406 |
|
---|
407 | /* Paravirtualization provider: */
|
---|
408 | switch (comMachine.GetEffectiveParavirtProvider())
|
---|
409 | {
|
---|
410 | case KParavirtProvider_Minimal: acceleration << QApplication::translate("UIDetails", "Minimal Paravirtualization", "details (system)"); break;
|
---|
411 | case KParavirtProvider_HyperV: acceleration << QApplication::translate("UIDetails", "Hyper-V Paravirtualization", "details (system)"); break;
|
---|
412 | case KParavirtProvider_KVM: acceleration << QApplication::translate("UIDetails", "KVM Paravirtualization", "details (system)"); break;
|
---|
413 | default: break;
|
---|
414 | }
|
---|
415 | if (!acceleration.isEmpty())
|
---|
416 | table << UITextTableLine(QApplication::translate("UIDetails", "Acceleration", "details (system)"),
|
---|
417 | acceleration.join(", "));
|
---|
418 | break;
|
---|
419 | }
|
---|
420 |
|
---|
421 | #ifdef VBOX_WITH_VIRT_ARMV8
|
---|
422 | case KPlatformArchitecture_ARM:
|
---|
423 | {
|
---|
424 | /** @todo BUGBUG ARM stuff goes here. */
|
---|
425 | break;
|
---|
426 | }
|
---|
427 | #endif
|
---|
428 |
|
---|
429 | default:
|
---|
430 | break;
|
---|
431 | }
|
---|
432 | }
|
---|
433 |
|
---|
434 | return table;
|
---|
435 | }
|
---|
436 |
|
---|
437 | UITextTable UIDetailsGenerator::generateMachineInformationDisplay(CMachine &comMachine,
|
---|
438 | const UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay &fOptions)
|
---|
439 | {
|
---|
440 | UITextTable table;
|
---|
441 |
|
---|
442 | if (comMachine.isNull())
|
---|
443 | return table;
|
---|
444 |
|
---|
445 | if (!comMachine.GetAccessible())
|
---|
446 | {
|
---|
447 | table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString());
|
---|
448 | return table;
|
---|
449 | }
|
---|
450 |
|
---|
451 | const CGraphicsAdapter comGraphics = comMachine.GetGraphicsAdapter();
|
---|
452 |
|
---|
453 | /* Video memory: */
|
---|
454 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_VRAM)
|
---|
455 | {
|
---|
456 | /* Configure hovering anchor: */
|
---|
457 | const QString strAnchorType = QString("video_memory");
|
---|
458 | const int iVideoMemory = comGraphics.GetVRAMSize();
|
---|
459 | table << UITextTableLine(QApplication::translate("UIDetails", "Video Memory", "details (display)"),
|
---|
460 | QString("<a href=#%1,%2>%3</a>")
|
---|
461 | .arg(strAnchorType)
|
---|
462 | .arg(iVideoMemory)
|
---|
463 | .arg(QApplication::translate("UIDetails", "%1 MB").arg(iVideoMemory)));
|
---|
464 | }
|
---|
465 |
|
---|
466 | /* Screens: */
|
---|
467 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_ScreenCount)
|
---|
468 | {
|
---|
469 | const int cGuestScreens = comGraphics.GetMonitorCount();
|
---|
470 | if (cGuestScreens > 1)
|
---|
471 | table << UITextTableLine(QApplication::translate("UIDetails", "Screens", "details (display)"),
|
---|
472 | QString::number(cGuestScreens));
|
---|
473 | }
|
---|
474 |
|
---|
475 | /* Scale-factor: */
|
---|
476 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_ScaleFactor)
|
---|
477 | {
|
---|
478 | const QString strScaleFactor = comMachine.GetExtraData(UIExtraDataDefs::GUI_ScaleFactor);
|
---|
479 | {
|
---|
480 | /* Try to convert loaded data to double: */
|
---|
481 | bool fOk = false;
|
---|
482 | double dValue = strScaleFactor.toDouble(&fOk);
|
---|
483 | /* Invent the default value: */
|
---|
484 | if (!fOk || !dValue)
|
---|
485 | dValue = 1.0;
|
---|
486 | /* Append information: */
|
---|
487 | if (dValue != 1.0)
|
---|
488 | table << UITextTableLine(QApplication::translate("UIDetails", "Scale-factor", "details (display)"),
|
---|
489 | QString::number(dValue, 'f', 2));
|
---|
490 | }
|
---|
491 | }
|
---|
492 |
|
---|
493 | /* Graphics Controller: */
|
---|
494 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_GraphicsController)
|
---|
495 | {
|
---|
496 | const QString strAnchorType = QString("graphics_controller_type");
|
---|
497 | const KGraphicsControllerType enmType = comGraphics.GetGraphicsControllerType();
|
---|
498 | table << UITextTableLine(QApplication::translate("UIDetails", "Graphics Controller", "details (display)"),
|
---|
499 | QString("<a href=#%1,%2>%3</a>")
|
---|
500 | .arg(strAnchorType)
|
---|
501 | .arg((int)enmType)
|
---|
502 | .arg(gpConverter->toString(enmType)));
|
---|
503 | }
|
---|
504 |
|
---|
505 | /* Acceleration: */
|
---|
506 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_Acceleration)
|
---|
507 | {
|
---|
508 | QStringList acceleration;
|
---|
509 | /* 3D acceleration: */
|
---|
510 | if (comGraphics.GetAccelerate3DEnabled())
|
---|
511 | acceleration << QApplication::translate("UIDetails", "3D", "details (display)");
|
---|
512 | if (!acceleration.isEmpty())
|
---|
513 | table << UITextTableLine(QApplication::translate("UIDetails", "Acceleration", "details (display)"),
|
---|
514 | acceleration.join(", "));
|
---|
515 | }
|
---|
516 |
|
---|
517 | /* Remote desktop server: */
|
---|
518 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_VRDE)
|
---|
519 | {
|
---|
520 | const CVRDEServer comServer = comMachine.GetVRDEServer();
|
---|
521 | if (!comServer.isNull())
|
---|
522 | {
|
---|
523 | if (comServer.GetEnabled())
|
---|
524 | table << UITextTableLine(QApplication::translate("UIDetails", "Remote Desktop Server Port", "details (display/vrde)"),
|
---|
525 | comServer.GetVRDEProperty("TCP/Ports"));
|
---|
526 | else
|
---|
527 | table << UITextTableLine(QApplication::translate("UIDetails", "Remote Desktop Server", "details (display/vrde)"),
|
---|
528 | QApplication::translate("UIDetails", "Disabled", "details (display/vrde/VRDE server)"));
|
---|
529 | }
|
---|
530 | }
|
---|
531 |
|
---|
532 | /* Recording: */
|
---|
533 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_Recording)
|
---|
534 | {
|
---|
535 | CRecordingSettings comRecordingSettings = comMachine.GetRecordingSettings();
|
---|
536 | if (comRecordingSettings.GetEnabled())
|
---|
537 | {
|
---|
538 | /* For now all screens have the same config: */
|
---|
539 | const CRecordingScreenSettings comRecordingScreen0Settings = comRecordingSettings.GetScreenSettings(0);
|
---|
540 |
|
---|
541 | /** @todo r=andy Refine these texts (wrt audio and/or video). */
|
---|
542 | table << UITextTableLine(QApplication::translate("UIDetails", "Recording File", "details (display/recording)"),
|
---|
543 | comRecordingScreen0Settings.GetFilename());
|
---|
544 | table << UITextTableLine(QApplication::translate("UIDetails", "Recording Attributes", "details (display/recording)"),
|
---|
545 | QApplication::translate("UIDetails", "Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps")
|
---|
546 | .arg(comRecordingScreen0Settings.GetVideoWidth()).arg(comRecordingScreen0Settings.GetVideoHeight())
|
---|
547 | .arg(comRecordingScreen0Settings.GetVideoFPS()).arg(comRecordingScreen0Settings.GetVideoRate()));
|
---|
548 | }
|
---|
549 | else
|
---|
550 | {
|
---|
551 | table << UITextTableLine(QApplication::translate("UIDetails", "Recording", "details (display/recording)"),
|
---|
552 | QApplication::translate("UIDetails", "Disabled", "details (display/recording)"));
|
---|
553 | }
|
---|
554 | }
|
---|
555 |
|
---|
556 | return table;
|
---|
557 | }
|
---|
558 |
|
---|
559 | UITextTable UIDetailsGenerator::generateMachineInformationStorage(CMachine &comMachine,
|
---|
560 | const UIExtraDataMetaDefs::DetailsElementOptionTypeStorage &fOptions,
|
---|
561 | bool fLink /* = true */)
|
---|
562 | {
|
---|
563 | UITextTable table;
|
---|
564 |
|
---|
565 | if (comMachine.isNull())
|
---|
566 | return table;
|
---|
567 |
|
---|
568 | if (!comMachine.GetAccessible())
|
---|
569 | {
|
---|
570 | table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString());
|
---|
571 | return table;
|
---|
572 | }
|
---|
573 |
|
---|
574 | /* Iterate over all the machine controllers: */
|
---|
575 | foreach (const CStorageController &comController, comMachine.GetStorageControllers())
|
---|
576 | {
|
---|
577 | /* Add controller information: */
|
---|
578 | const QString strControllerName = QApplication::translate("UIMachineSettingsStorage", "Controller: %1");
|
---|
579 | table << UITextTableLine(strControllerName.arg(comController.GetName()), QString());
|
---|
580 | /* Populate map (its sorted!): */
|
---|
581 | QMap<StorageSlot, QString> attachmentsMap;
|
---|
582 | foreach (const CMediumAttachment &attachment, comMachine.GetMediumAttachmentsOfController(comController.GetName()))
|
---|
583 | {
|
---|
584 | /* Acquire device type first of all: */
|
---|
585 | const KDeviceType enmDeviceType = attachment.GetType();
|
---|
586 |
|
---|
587 | /* Ignore restricted device types: */
|
---|
588 | if ( ( !(fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeStorage_HardDisks)
|
---|
589 | && enmDeviceType == KDeviceType_HardDisk)
|
---|
590 | || ( !(fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeStorage_OpticalDevices)
|
---|
591 | && enmDeviceType == KDeviceType_DVD)
|
---|
592 | || ( !(fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeStorage_FloppyDevices)
|
---|
593 | && enmDeviceType == KDeviceType_Floppy))
|
---|
594 | continue;
|
---|
595 |
|
---|
596 | /* Prepare current storage slot: */
|
---|
597 | const StorageSlot attachmentSlot(comController.GetBus(), attachment.GetPort(), attachment.GetDevice());
|
---|
598 | AssertMsg(comController.isOk(),
|
---|
599 | ("Unable to acquire controller data: %s\n",
|
---|
600 | UIErrorString::formatRC(comController.lastRC()).toUtf8().constData()));
|
---|
601 | if (!comController.isOk())
|
---|
602 | continue;
|
---|
603 |
|
---|
604 | /* Prepare attachment information: */
|
---|
605 | QString strAttachmentInfo = uiCommon().storageDetails(attachment.GetMedium(), false, false);
|
---|
606 | /* That hack makes sure 'Inaccessible' word is always bold: */
|
---|
607 | { // hack
|
---|
608 | const QString strInaccessibleString(UICommon::tr("Inaccessible", "medium"));
|
---|
609 | const QString strBoldInaccessibleString(QString("<b>%1</b>").arg(strInaccessibleString));
|
---|
610 | strAttachmentInfo.replace(strInaccessibleString, strBoldInaccessibleString);
|
---|
611 | } // hack
|
---|
612 |
|
---|
613 | /* Append 'device slot name' with 'device type name' for optical devices only: */
|
---|
614 | QString strDeviceType = enmDeviceType == KDeviceType_DVD
|
---|
615 | ? QApplication::translate("UIDetails", "[Optical Drive]", "details (storage)")
|
---|
616 | : QString();
|
---|
617 | if (!strDeviceType.isNull())
|
---|
618 | strDeviceType.append(' ');
|
---|
619 |
|
---|
620 | /* Insert that attachment information into the map: */
|
---|
621 | if (!strAttachmentInfo.isNull())
|
---|
622 | {
|
---|
623 | /* Configure hovering anchors: */
|
---|
624 | const QString strAnchorType = enmDeviceType == KDeviceType_DVD || enmDeviceType == KDeviceType_Floppy ? QString("mount") :
|
---|
625 | enmDeviceType == KDeviceType_HardDisk ? QString("attach") : QString();
|
---|
626 | const CMedium medium = attachment.GetMedium();
|
---|
627 | const QString strMediumLocation = medium.isNull() ? QString() : medium.GetLocation();
|
---|
628 | if (fLink)
|
---|
629 | attachmentsMap.insert(attachmentSlot,
|
---|
630 | QString("<a href=#%1,%2,%3,%4>%5</a>")
|
---|
631 | .arg(strAnchorType,
|
---|
632 | comController.GetName(),
|
---|
633 | gpConverter->toString(attachmentSlot),
|
---|
634 | strMediumLocation,
|
---|
635 | strDeviceType + strAttachmentInfo));
|
---|
636 | else
|
---|
637 | attachmentsMap.insert(attachmentSlot,
|
---|
638 | QString("%1")
|
---|
639 | .arg(strDeviceType + strAttachmentInfo));
|
---|
640 | }
|
---|
641 | }
|
---|
642 |
|
---|
643 | /* Iterate over the sorted map: */
|
---|
644 | const QList<StorageSlot> storageSlots = attachmentsMap.keys();
|
---|
645 | const QList<QString> storageInfo = attachmentsMap.values();
|
---|
646 | for (int i = 0; i < storageSlots.size(); ++i)
|
---|
647 | table << UITextTableLine(QString(" ") + gpConverter->toString(storageSlots[i]), storageInfo[i]);
|
---|
648 | }
|
---|
649 | if (table.isEmpty())
|
---|
650 | table << UITextTableLine(QApplication::translate("UIDetails", "Not Attached", "details (storage)"), QString());
|
---|
651 |
|
---|
652 | return table;
|
---|
653 | }
|
---|
654 |
|
---|
655 | UITextTable UIDetailsGenerator::generateMachineInformationAudio(CMachine &comMachine,
|
---|
656 | const UIExtraDataMetaDefs::DetailsElementOptionTypeAudio &fOptions)
|
---|
657 | {
|
---|
658 | UITextTable table;
|
---|
659 |
|
---|
660 | if (comMachine.isNull())
|
---|
661 | return table;
|
---|
662 |
|
---|
663 | if (!comMachine.GetAccessible())
|
---|
664 | {
|
---|
665 | table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString());
|
---|
666 | return table;
|
---|
667 | }
|
---|
668 |
|
---|
669 | const CAudioSettings comAudioSettings = comMachine.GetAudioSettings();
|
---|
670 | const CAudioAdapter comAdapter = comAudioSettings.GetAdapter();
|
---|
671 | if (comAdapter.GetEnabled())
|
---|
672 | {
|
---|
673 | /* Host driver: */
|
---|
674 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeAudio_Driver)
|
---|
675 | {
|
---|
676 | const QString strAnchorType = QString("audio_host_driver_type");
|
---|
677 | const KAudioDriverType enmType = comAdapter.GetAudioDriver();
|
---|
678 | table << UITextTableLine(QApplication::translate("UIDetails", "Host Driver", "details (audio)"),
|
---|
679 | QString("<a href=#%1,%2>%3</a>")
|
---|
680 | .arg(strAnchorType)
|
---|
681 | .arg((int)enmType)
|
---|
682 | .arg(gpConverter->toString(enmType)));
|
---|
683 | }
|
---|
684 |
|
---|
685 | /* Controller: */
|
---|
686 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeAudio_Controller)
|
---|
687 | {
|
---|
688 | const QString strAnchorType = QString("audio_controller_type");
|
---|
689 | const KAudioControllerType enmType = comAdapter.GetAudioController();
|
---|
690 | table << UITextTableLine(QApplication::translate("UIDetails", "Controller", "details (audio)"),
|
---|
691 | QString("<a href=#%1,%2>%3</a>")
|
---|
692 | .arg(strAnchorType)
|
---|
693 | .arg((int)enmType)
|
---|
694 | .arg(gpConverter->toString(enmType)));
|
---|
695 | }
|
---|
696 |
|
---|
697 | #ifdef VBOX_WITH_AUDIO_INOUT_INFO
|
---|
698 | /* Audio I/O: */
|
---|
699 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeAudio_IO)
|
---|
700 | {
|
---|
701 | table << UITextTableLine(QApplication::translate("UIDetails", "Audio Input", "details (audio)"),
|
---|
702 | comAdapter.GetEnabledIn() ?
|
---|
703 | QApplication::translate("UIDetails", "Enabled", "details (audio/input)") :
|
---|
704 | QApplication::translate("UIDetails", "Disabled", "details (audio/input)"));
|
---|
705 | table << UITextTableLine(QApplication::translate("UIDetails", "Audio Output", "details (audio)"),
|
---|
706 | comAdapter.GetEnabledOut() ?
|
---|
707 | QApplication::translate("UIDetails", "Enabled", "details (audio/output)") :
|
---|
708 | QApplication::translate("UIDetails", "Disabled", "details (audio/output)"));
|
---|
709 | }
|
---|
710 | #endif /* VBOX_WITH_AUDIO_INOUT_INFO */
|
---|
711 | }
|
---|
712 | else
|
---|
713 | table << UITextTableLine(QApplication::translate("UIDetails", "Disabled", "details (audio)"),
|
---|
714 | QString());
|
---|
715 |
|
---|
716 | return table;
|
---|
717 | }
|
---|
718 |
|
---|
719 | UITextTable UIDetailsGenerator::generateMachineInformationNetwork(CMachine &comMachine,
|
---|
720 | const UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork &fOptions)
|
---|
721 | {
|
---|
722 | UITextTable table;
|
---|
723 |
|
---|
724 | if (comMachine.isNull())
|
---|
725 | return table;
|
---|
726 |
|
---|
727 | if (!comMachine.GetAccessible())
|
---|
728 | {
|
---|
729 | table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString());
|
---|
730 | return table;
|
---|
731 | }
|
---|
732 |
|
---|
733 | /* Iterate over all the adapters: */
|
---|
734 | CPlatform comPlatform = comMachine.GetPlatform();
|
---|
735 | const KPlatformArchitecture enmArch = comPlatform.GetArchitecture();
|
---|
736 | const KChipsetType enmChipsetType = comPlatform.GetChipsetType();
|
---|
737 | CPlatformProperties comProperties = gpGlobalSession->virtualBox().GetPlatformProperties(enmArch);
|
---|
738 | const ulong cMaxNetworkAdapters = comProperties.GetMaxNetworkAdapters(enmChipsetType);
|
---|
739 | for (ulong uSlot = 0; uSlot < cMaxNetworkAdapters; ++uSlot)
|
---|
740 | {
|
---|
741 | const QString strAnchorType = QString("network_attachment_type");
|
---|
742 | const CNetworkAdapter comAdapter = comMachine.GetNetworkAdapter(uSlot);
|
---|
743 |
|
---|
744 | /* Skip disabled adapters: */
|
---|
745 | if (!comAdapter.GetEnabled())
|
---|
746 | continue;
|
---|
747 |
|
---|
748 | /* Gather adapter information: */
|
---|
749 | const KNetworkAttachmentType enmAttachmentType = comAdapter.GetAttachmentType();
|
---|
750 | const QString strAttachmentTemplate = gpConverter->toString(comAdapter.GetAdapterType()).replace(QRegularExpression("\\s\\(.+\\)"),
|
---|
751 | " (<a href=#%1,%2;%3;%4>%5</a>)");
|
---|
752 | QString strAttachmentType;
|
---|
753 | switch (enmAttachmentType)
|
---|
754 | {
|
---|
755 | case KNetworkAttachmentType_NAT:
|
---|
756 | {
|
---|
757 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_NAT)
|
---|
758 | strAttachmentType = strAttachmentTemplate
|
---|
759 | .arg(strAnchorType)
|
---|
760 | .arg(uSlot)
|
---|
761 | .arg((int)KNetworkAttachmentType_NAT)
|
---|
762 | .arg(QString())
|
---|
763 | .arg(gpConverter->toString(KNetworkAttachmentType_NAT));
|
---|
764 | break;
|
---|
765 | }
|
---|
766 | case KNetworkAttachmentType_Bridged:
|
---|
767 | {
|
---|
768 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_BridgedAdapter)
|
---|
769 | {
|
---|
770 | const QString strName = comAdapter.GetBridgedInterface();
|
---|
771 | strAttachmentType = strAttachmentTemplate
|
---|
772 | .arg(strAnchorType)
|
---|
773 | .arg(uSlot)
|
---|
774 | .arg((int)KNetworkAttachmentType_Bridged)
|
---|
775 | .arg(strName)
|
---|
776 | .arg(QApplication::translate("UIDetails", "Bridged Adapter, %1", "details (network)")
|
---|
777 | .arg(strName));
|
---|
778 | }
|
---|
779 | break;
|
---|
780 | }
|
---|
781 | case KNetworkAttachmentType_Internal:
|
---|
782 | {
|
---|
783 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_InternalNetwork)
|
---|
784 | {
|
---|
785 | const QString strName = comAdapter.GetInternalNetwork();
|
---|
786 | strAttachmentType = strAttachmentTemplate
|
---|
787 | .arg(strAnchorType)
|
---|
788 | .arg(uSlot)
|
---|
789 | .arg((int)KNetworkAttachmentType_Internal)
|
---|
790 | .arg(strName)
|
---|
791 | .arg(QApplication::translate("UIDetails", "Internal Network, '%1'", "details (network)")
|
---|
792 | .arg(strName));
|
---|
793 | }
|
---|
794 | break;
|
---|
795 | }
|
---|
796 | case KNetworkAttachmentType_HostOnly:
|
---|
797 | {
|
---|
798 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_HostOnlyAdapter)
|
---|
799 | {
|
---|
800 | const QString strName = comAdapter.GetHostOnlyInterface();
|
---|
801 | strAttachmentType = strAttachmentTemplate
|
---|
802 | .arg(strAnchorType)
|
---|
803 | .arg(uSlot)
|
---|
804 | .arg((int)KNetworkAttachmentType_HostOnly)
|
---|
805 | .arg(strName)
|
---|
806 | .arg(QApplication::translate("UIDetails", "Host-only Adapter, '%1'", "details (network)")
|
---|
807 | .arg(strName));
|
---|
808 | }
|
---|
809 | break;
|
---|
810 | }
|
---|
811 | #ifdef VBOX_WITH_VMNET
|
---|
812 | case KNetworkAttachmentType_HostOnlyNetwork:
|
---|
813 | {
|
---|
814 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_HostOnlyNetwork)
|
---|
815 | {
|
---|
816 | const QString strName = comAdapter.GetHostOnlyNetwork();
|
---|
817 | strAttachmentType = strAttachmentTemplate
|
---|
818 | .arg(strAnchorType)
|
---|
819 | .arg(uSlot)
|
---|
820 | .arg((int)KNetworkAttachmentType_HostOnly)
|
---|
821 | .arg(strName)
|
---|
822 | .arg(QApplication::translate("UIDetails", "Host-only Network, '%1'", "details (network)")
|
---|
823 | .arg(strName));
|
---|
824 | }
|
---|
825 | break;
|
---|
826 | }
|
---|
827 | #endif /* VBOX_WITH_VMNET */
|
---|
828 | case KNetworkAttachmentType_Generic:
|
---|
829 | {
|
---|
830 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_GenericDriver)
|
---|
831 | {
|
---|
832 | const QString strName = comAdapter.GetGenericDriver();
|
---|
833 | const QString strGenericDriverProperties(summarizeGenericProperties(comAdapter));
|
---|
834 | strAttachmentType = strGenericDriverProperties.isNull()
|
---|
835 | ? strAttachmentTemplate
|
---|
836 | .arg(strAnchorType)
|
---|
837 | .arg(uSlot)
|
---|
838 | .arg((int)KNetworkAttachmentType_Generic)
|
---|
839 | .arg(strName)
|
---|
840 | .arg(QApplication::translate("UIDetails", "Generic Driver, '%1'", "details (network)")
|
---|
841 | .arg(strName))
|
---|
842 | : strAttachmentTemplate
|
---|
843 | .arg(strAnchorType)
|
---|
844 | .arg(uSlot)
|
---|
845 | .arg((int)KNetworkAttachmentType_Generic)
|
---|
846 | .arg(strName)
|
---|
847 | .arg(QApplication::translate("UIDetails", "Generic Driver, '%1' { %2 }", "details (network)")
|
---|
848 | .arg(strName, strGenericDriverProperties));
|
---|
849 | }
|
---|
850 | break;
|
---|
851 | }
|
---|
852 | case KNetworkAttachmentType_NATNetwork:
|
---|
853 | {
|
---|
854 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_NATNetwork)
|
---|
855 | {
|
---|
856 | const QString strName = comAdapter.GetNATNetwork();
|
---|
857 | strAttachmentType = strAttachmentTemplate
|
---|
858 | .arg(strAnchorType)
|
---|
859 | .arg(uSlot)
|
---|
860 | .arg((int)KNetworkAttachmentType_NATNetwork)
|
---|
861 | .arg(strName)
|
---|
862 | .arg(QApplication::translate("UIDetails", "NAT Network, '%1'", "details (network)")
|
---|
863 | .arg(strName));
|
---|
864 | }
|
---|
865 | break;
|
---|
866 | }
|
---|
867 | default:
|
---|
868 | {
|
---|
869 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_NotAttached)
|
---|
870 | strAttachmentType = strAttachmentTemplate
|
---|
871 | .arg(strAnchorType)
|
---|
872 | .arg(uSlot)
|
---|
873 | .arg((int)enmAttachmentType)
|
---|
874 | .arg(QString())
|
---|
875 | .arg(gpConverter->toString(enmAttachmentType));
|
---|
876 | break;
|
---|
877 | }
|
---|
878 | }
|
---|
879 | if (!strAttachmentType.isNull())
|
---|
880 | table << UITextTableLine(QApplication::translate("UIDetails", "Adapter %1", "details (network)").arg(comAdapter.GetSlot() + 1), strAttachmentType);
|
---|
881 | }
|
---|
882 | if (table.isEmpty())
|
---|
883 | table << UITextTableLine(QApplication::translate("UIDetails", "Disabled", "details (network/adapter)"), QString());
|
---|
884 |
|
---|
885 | return table;
|
---|
886 | }
|
---|
887 |
|
---|
888 | UITextTable UIDetailsGenerator::generateMachineInformationSerial(CMachine &comMachine,
|
---|
889 | const UIExtraDataMetaDefs::DetailsElementOptionTypeSerial &fOptions)
|
---|
890 | {
|
---|
891 | UITextTable table;
|
---|
892 |
|
---|
893 | if (comMachine.isNull())
|
---|
894 | return table;
|
---|
895 |
|
---|
896 | if (!comMachine.GetAccessible())
|
---|
897 | {
|
---|
898 | table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString());
|
---|
899 | return table;
|
---|
900 | }
|
---|
901 |
|
---|
902 | /* Iterate over all the ports: */
|
---|
903 | CPlatform comPlatform = comMachine.GetPlatform();
|
---|
904 | const KPlatformArchitecture enmArch = comPlatform.GetArchitecture();
|
---|
905 | CPlatformProperties comProperties = gpGlobalSession->virtualBox().GetPlatformProperties(enmArch);
|
---|
906 | const ulong cMaxSerialPorts = comProperties.GetSerialPortCount();
|
---|
907 | for (ulong uSlot = 0; uSlot < cMaxSerialPorts; ++uSlot)
|
---|
908 | {
|
---|
909 | const CSerialPort comPort = comMachine.GetSerialPort(uSlot);
|
---|
910 |
|
---|
911 | /* Skip disabled adapters: */
|
---|
912 | if (!comPort.GetEnabled())
|
---|
913 | continue;
|
---|
914 |
|
---|
915 | /* Gather port information: */
|
---|
916 | const KPortMode enmMode = comPort.GetHostMode();
|
---|
917 | const QString strModeTemplate = UITranslator::toCOMPortName(comPort.GetIRQ(), comPort.GetIOAddress()) + ", ";
|
---|
918 | QString strModeType;
|
---|
919 | switch (enmMode)
|
---|
920 | {
|
---|
921 | case KPortMode_HostPipe:
|
---|
922 | {
|
---|
923 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_HostPipe)
|
---|
924 | strModeType = strModeTemplate + QString("%1 (%2)").arg(gpConverter->toString(enmMode)).arg(QDir::toNativeSeparators(comPort.GetPath()));
|
---|
925 | break;
|
---|
926 | }
|
---|
927 | case KPortMode_HostDevice:
|
---|
928 | {
|
---|
929 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_HostDevice)
|
---|
930 | strModeType = strModeTemplate + QString("%1 (%2)").arg(gpConverter->toString(enmMode)).arg(QDir::toNativeSeparators(comPort.GetPath()));
|
---|
931 | break;
|
---|
932 | }
|
---|
933 | case KPortMode_RawFile:
|
---|
934 | {
|
---|
935 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_RawFile)
|
---|
936 | strModeType = strModeTemplate + QString("%1 (%2)").arg(gpConverter->toString(enmMode)).arg(QDir::toNativeSeparators(comPort.GetPath()));
|
---|
937 | break;
|
---|
938 | }
|
---|
939 | case KPortMode_TCP:
|
---|
940 | {
|
---|
941 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_TCP)
|
---|
942 | strModeType = strModeTemplate + QString("%1 (%2)").arg(gpConverter->toString(enmMode)).arg(QDir::toNativeSeparators(comPort.GetPath()));
|
---|
943 | break;
|
---|
944 | }
|
---|
945 | default:
|
---|
946 | {
|
---|
947 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_Disconnected)
|
---|
948 | strModeType = strModeTemplate + gpConverter->toString(enmMode);
|
---|
949 | break;
|
---|
950 | }
|
---|
951 | }
|
---|
952 | if (!strModeType.isNull())
|
---|
953 | table << UITextTableLine(QApplication::translate("UIDetails", "Port %1", "details (serial)").arg(comPort.GetSlot() + 1), strModeType);
|
---|
954 | }
|
---|
955 | if (table.isEmpty())
|
---|
956 | table << UITextTableLine(QApplication::translate("UIDetails", "Disabled", "details (serial)"), QString());
|
---|
957 |
|
---|
958 | return table;
|
---|
959 | }
|
---|
960 |
|
---|
961 | UITextTable UIDetailsGenerator::generateMachineInformationUSB(CMachine &comMachine,
|
---|
962 | const UIExtraDataMetaDefs::DetailsElementOptionTypeUsb &fOptions)
|
---|
963 | {
|
---|
964 | UITextTable table;
|
---|
965 |
|
---|
966 | if (comMachine.isNull())
|
---|
967 | return table;
|
---|
968 |
|
---|
969 | if (!comMachine.GetAccessible())
|
---|
970 | {
|
---|
971 | table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString());
|
---|
972 | return table;
|
---|
973 | }
|
---|
974 |
|
---|
975 | /* Iterate over all the USB filters: */
|
---|
976 | const CUSBDeviceFilters comFilterObject = comMachine.GetUSBDeviceFilters();
|
---|
977 | if (!comFilterObject.isNull() && comMachine.GetUSBProxyAvailable())
|
---|
978 | {
|
---|
979 | const QString strAnchorType = QString("usb_controller_type");
|
---|
980 | const CUSBControllerVector controllers = comMachine.GetUSBControllers();
|
---|
981 | if (!controllers.isEmpty())
|
---|
982 | {
|
---|
983 | /* USB controllers: */
|
---|
984 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeUsb_Controller)
|
---|
985 | {
|
---|
986 | QStringList controllerInternal;
|
---|
987 | QStringList controllersReadable;
|
---|
988 | foreach (const CUSBController &comController, controllers)
|
---|
989 | {
|
---|
990 | const KUSBControllerType enmType = comController.GetType();
|
---|
991 | controllerInternal << QString::number((int)enmType);
|
---|
992 | controllersReadable << gpConverter->toString(enmType);
|
---|
993 | }
|
---|
994 | table << UITextTableLine(QApplication::translate("UIDetails", "USB Controller", "details (usb)"),
|
---|
995 | QString("<a href=#%1,%2>%3</a>")
|
---|
996 | .arg(strAnchorType)
|
---|
997 | .arg(controllerInternal.join(';'))
|
---|
998 | .arg(controllersReadable.join(", ")));
|
---|
999 | }
|
---|
1000 |
|
---|
1001 | /* Device filters: */
|
---|
1002 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeUsb_DeviceFilters)
|
---|
1003 | {
|
---|
1004 | const CUSBDeviceFilterVector filters = comFilterObject.GetDeviceFilters();
|
---|
1005 | uint uActive = 0;
|
---|
1006 | for (int i = 0; i < filters.size(); ++i)
|
---|
1007 | if (filters.at(i).GetActive())
|
---|
1008 | ++uActive;
|
---|
1009 | table << UITextTableLine(QApplication::translate("UIDetails", "Device Filters", "details (usb)"),
|
---|
1010 | QApplication::translate("UIDetails", "%1 (%2 active)", "details (usb)").arg(filters.size()).arg(uActive));
|
---|
1011 | }
|
---|
1012 | }
|
---|
1013 | else
|
---|
1014 | table << UITextTableLine(QString("<a href=#%1,%2>%3</a>")
|
---|
1015 | .arg(strAnchorType)
|
---|
1016 | .arg(QString::number((int)KUSBControllerType_Null))
|
---|
1017 | .arg(QApplication::translate("UIDetails", "Disabled", "details (usb)")),
|
---|
1018 | QString());
|
---|
1019 | }
|
---|
1020 | else
|
---|
1021 | table << UITextTableLine(QApplication::translate("UIDetails", "USB Controller Inaccessible", "details (usb)"), QString());
|
---|
1022 |
|
---|
1023 | return table;
|
---|
1024 | }
|
---|
1025 |
|
---|
1026 | UITextTable UIDetailsGenerator::generateMachineInformationSharedFolders(CMachine &comMachine,
|
---|
1027 | const UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders &fOptions)
|
---|
1028 | {
|
---|
1029 | Q_UNUSED(fOptions);
|
---|
1030 |
|
---|
1031 | UITextTable table;
|
---|
1032 |
|
---|
1033 | if (comMachine.isNull())
|
---|
1034 | return table;
|
---|
1035 |
|
---|
1036 | if (!comMachine.GetAccessible())
|
---|
1037 | {
|
---|
1038 | table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString());
|
---|
1039 | return table;
|
---|
1040 | }
|
---|
1041 |
|
---|
1042 | /* Summary: */
|
---|
1043 | const ulong uCount = comMachine.GetSharedFolders().size();
|
---|
1044 | if (uCount > 0)
|
---|
1045 | table << UITextTableLine(QApplication::translate("UIDetails", "Shared Folders", "details (shared folders)"), QString::number(uCount));
|
---|
1046 | else
|
---|
1047 | table << UITextTableLine(QApplication::translate("UIDetails", "None", "details (shared folders)"), QString());
|
---|
1048 |
|
---|
1049 | return table;
|
---|
1050 | }
|
---|
1051 |
|
---|
1052 | UITextTable UIDetailsGenerator::generateMachineInformationUI(CMachine &comMachine,
|
---|
1053 | const UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface &fOptions)
|
---|
1054 | {
|
---|
1055 | UITextTable table;
|
---|
1056 |
|
---|
1057 | if (comMachine.isNull())
|
---|
1058 | return table;
|
---|
1059 |
|
---|
1060 | if (!comMachine.GetAccessible())
|
---|
1061 | {
|
---|
1062 | table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString());
|
---|
1063 | return table;
|
---|
1064 | }
|
---|
1065 |
|
---|
1066 | /* Visual state: */
|
---|
1067 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_VisualState)
|
---|
1068 | {
|
---|
1069 | const QString strAnchorType = QString("visual_state");
|
---|
1070 | const QString strEnabledFullscreen = comMachine.GetExtraData(UIExtraDataDefs::GUI_Fullscreen);
|
---|
1071 | const QString strEnabledSeamless = comMachine.GetExtraData(UIExtraDataDefs::GUI_Seamless);
|
---|
1072 | const QString strEnabledScale = comMachine.GetExtraData(UIExtraDataDefs::GUI_Scale);
|
---|
1073 | UIVisualStateType enmType = UIVisualStateType_Normal;
|
---|
1074 | if ( strEnabledFullscreen.compare("true", Qt::CaseInsensitive) == 0
|
---|
1075 | || strEnabledFullscreen.compare("yes", Qt::CaseInsensitive) == 0
|
---|
1076 | || strEnabledFullscreen.compare("on", Qt::CaseInsensitive) == 0
|
---|
1077 | || strEnabledFullscreen == "1")
|
---|
1078 | enmType = UIVisualStateType_Fullscreen;
|
---|
1079 | else
|
---|
1080 | if ( strEnabledSeamless.compare("true", Qt::CaseInsensitive) == 0
|
---|
1081 | || strEnabledSeamless.compare("yes", Qt::CaseInsensitive) == 0
|
---|
1082 | || strEnabledSeamless.compare("on", Qt::CaseInsensitive) == 0
|
---|
1083 | || strEnabledSeamless == "1")
|
---|
1084 | enmType = UIVisualStateType_Seamless;
|
---|
1085 | else
|
---|
1086 | if ( strEnabledScale.compare("true", Qt::CaseInsensitive) == 0
|
---|
1087 | || strEnabledScale.compare("yes", Qt::CaseInsensitive) == 0
|
---|
1088 | || strEnabledScale.compare("on", Qt::CaseInsensitive) == 0
|
---|
1089 | || strEnabledScale == "1")
|
---|
1090 | enmType = UIVisualStateType_Scale;
|
---|
1091 | const QString strVisualState = gpConverter->toString(enmType);
|
---|
1092 | table << UITextTableLine(QApplication::translate("UIDetails", "Visual State", "details (user interface)"),
|
---|
1093 | QString("<a href=#%1,%2>%3</a>")
|
---|
1094 | .arg(strAnchorType)
|
---|
1095 | .arg(enmType)
|
---|
1096 | .arg(strVisualState));
|
---|
1097 | }
|
---|
1098 |
|
---|
1099 | #ifndef VBOX_WS_MAC
|
---|
1100 | /* Menu-bar: */
|
---|
1101 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_MenuBar)
|
---|
1102 | {
|
---|
1103 | const QString strAnchorType = QString("menu_bar");
|
---|
1104 | const QString strMenubarEnabled = comMachine.GetExtraData(UIExtraDataDefs::GUI_MenuBar_Enabled);
|
---|
1105 | const bool fEnabled = !( strMenubarEnabled.compare("false", Qt::CaseInsensitive) == 0
|
---|
1106 | || strMenubarEnabled.compare("no", Qt::CaseInsensitive) == 0
|
---|
1107 | || strMenubarEnabled.compare("off", Qt::CaseInsensitive) == 0
|
---|
1108 | || strMenubarEnabled == "0");
|
---|
1109 | table << UITextTableLine(QApplication::translate("UIDetails", "Menu-bar", "details (user interface)"),
|
---|
1110 | QString("<a href=#%1,%2>%3</a>")
|
---|
1111 | .arg(strAnchorType)
|
---|
1112 | .arg((int)fEnabled)
|
---|
1113 | .arg(fEnabled ? QApplication::translate("UIDetails", "Enabled", "details (user interface/menu-bar)")
|
---|
1114 | : QApplication::translate("UIDetails", "Disabled", "details (user interface/menu-bar)")));
|
---|
1115 | }
|
---|
1116 | #endif /* !VBOX_WS_MAC */
|
---|
1117 |
|
---|
1118 | /* Status-bar: */
|
---|
1119 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_StatusBar)
|
---|
1120 | {
|
---|
1121 | const QString strAnchorType = QString("status_bar");
|
---|
1122 | const QString strStatusbarEnabled = comMachine.GetExtraData(UIExtraDataDefs::GUI_StatusBar_Enabled);
|
---|
1123 | const bool fEnabled = !( strStatusbarEnabled.compare("false", Qt::CaseInsensitive) == 0
|
---|
1124 | || strStatusbarEnabled.compare("no", Qt::CaseInsensitive) == 0
|
---|
1125 | || strStatusbarEnabled.compare("off", Qt::CaseInsensitive) == 0
|
---|
1126 | || strStatusbarEnabled == "0");
|
---|
1127 | table << UITextTableLine(QApplication::translate("UIDetails", "Status-bar", "details (user interface)"),
|
---|
1128 | QString("<a href=#%1,%2>%3</a>")
|
---|
1129 | .arg(strAnchorType)
|
---|
1130 | .arg((int)fEnabled)
|
---|
1131 | .arg(fEnabled ? QApplication::translate("UIDetails", "Enabled", "details (user interface/status-bar)")
|
---|
1132 | : QApplication::translate("UIDetails", "Disabled", "details (user interface/status-bar)")));
|
---|
1133 | }
|
---|
1134 |
|
---|
1135 | #ifndef VBOX_WS_MAC
|
---|
1136 | /* Mini-toolbar: */
|
---|
1137 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_MiniToolbar)
|
---|
1138 | {
|
---|
1139 | const QString strAnchorType = QString("mini_toolbar");
|
---|
1140 | const QString strMiniToolbarEnabled = comMachine.GetExtraData(UIExtraDataDefs::GUI_ShowMiniToolBar);
|
---|
1141 | const bool fEnabled = !( strMiniToolbarEnabled.compare("false", Qt::CaseInsensitive) == 0
|
---|
1142 | || strMiniToolbarEnabled.compare("no", Qt::CaseInsensitive) == 0
|
---|
1143 | || strMiniToolbarEnabled.compare("off", Qt::CaseInsensitive) == 0
|
---|
1144 | || strMiniToolbarEnabled == "0");
|
---|
1145 | if (fEnabled)
|
---|
1146 | {
|
---|
1147 | /* Get mini-toolbar position: */
|
---|
1148 | const QString strMiniToolbarPosition = comMachine.GetExtraData(UIExtraDataDefs::GUI_MiniToolBarAlignment);
|
---|
1149 | {
|
---|
1150 | /* Try to convert loaded data to alignment: */
|
---|
1151 | switch (gpConverter->fromInternalString<MiniToolbarAlignment>(strMiniToolbarPosition))
|
---|
1152 | {
|
---|
1153 | case MiniToolbarAlignment_Top:
|
---|
1154 | table << UITextTableLine(QApplication::translate("UIDetails", "Mini-toolbar Position", "details (user interface)"),
|
---|
1155 | QString("<a href=#%1,%2>%3</a>")
|
---|
1156 | .arg(strAnchorType)
|
---|
1157 | .arg((int)MiniToolbarAlignment_Top)
|
---|
1158 | .arg(QApplication::translate("UIDetails", "Top", "details (user interface/mini-toolbar position)")));
|
---|
1159 | break;
|
---|
1160 | case MiniToolbarAlignment_Bottom:
|
---|
1161 | table << UITextTableLine(QApplication::translate("UIDetails", "Mini-toolbar Position", "details (user interface)"),
|
---|
1162 | QString("<a href=#%1,%2>%3</a>")
|
---|
1163 | .arg(strAnchorType)
|
---|
1164 | .arg((int)MiniToolbarAlignment_Bottom)
|
---|
1165 | .arg(QApplication::translate("UIDetails", "Bottom", "details (user interface/mini-toolbar position)")));
|
---|
1166 | break;
|
---|
1167 | default:
|
---|
1168 | break;
|
---|
1169 | }
|
---|
1170 | }
|
---|
1171 | }
|
---|
1172 | else
|
---|
1173 | table << UITextTableLine(QApplication::translate("UIDetails", "Mini-toolbar", "details (user interface)"),
|
---|
1174 | QString("<a href=#%1,%2>%3</a>")
|
---|
1175 | .arg(strAnchorType)
|
---|
1176 | .arg((int)MiniToolbarAlignment_Disabled)
|
---|
1177 | .arg(QApplication::translate("UIDetails", "Disabled", "details (user interface/mini-toolbar)")));
|
---|
1178 | }
|
---|
1179 | #endif /* !VBOX_WS_MAC */
|
---|
1180 |
|
---|
1181 | return table;
|
---|
1182 | }
|
---|
1183 |
|
---|
1184 | UITextTable UIDetailsGenerator::generateMachineInformationDescription(CMachine &comMachine,
|
---|
1185 | const UIExtraDataMetaDefs::DetailsElementOptionTypeDescription &fOptions)
|
---|
1186 | {
|
---|
1187 | Q_UNUSED(fOptions);
|
---|
1188 |
|
---|
1189 | UITextTable table;
|
---|
1190 |
|
---|
1191 | if (comMachine.isNull())
|
---|
1192 | return table;
|
---|
1193 |
|
---|
1194 | if (!comMachine.GetAccessible())
|
---|
1195 | {
|
---|
1196 | table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString());
|
---|
1197 | return table;
|
---|
1198 | }
|
---|
1199 |
|
---|
1200 | /* Summary: */
|
---|
1201 | const QString strDescription = comMachine.GetDescription();
|
---|
1202 | if (!strDescription.isEmpty())
|
---|
1203 | table << UITextTableLine(strDescription, QString());
|
---|
1204 | else
|
---|
1205 | table << UITextTableLine(QApplication::translate("UIDetails", "None", "details (description)"), QString());
|
---|
1206 |
|
---|
1207 | return table;
|
---|
1208 | }
|
---|
1209 |
|
---|
1210 | void UIDetailsGenerator::acquireHardDiskStatusInfo(CMachine &comMachine, QString &strInfo,
|
---|
1211 | bool &fAttachmentsPresent)
|
---|
1212 | {
|
---|
1213 | /* Enumerate all the controllers: */
|
---|
1214 | foreach (const CStorageController &comController, comMachine.GetStorageControllers())
|
---|
1215 | {
|
---|
1216 | /* Enumerate all the attachments: */
|
---|
1217 | QString strAttData;
|
---|
1218 | foreach (const CMediumAttachment &comAttachment, comMachine.GetMediumAttachmentsOfController(comController.GetName()))
|
---|
1219 | {
|
---|
1220 | /* Skip unrelated attachments: */
|
---|
1221 | if (comAttachment.GetType() != KDeviceType_HardDisk)
|
---|
1222 | continue;
|
---|
1223 | /* Append attachment data: */
|
---|
1224 | strAttData += e_strTableRow3
|
---|
1225 | .arg(gpConverter->toString(StorageSlot(comController.GetBus(), comAttachment.GetPort(), comAttachment.GetDevice())))
|
---|
1226 | .arg(UIMedium(comAttachment.GetMedium(), UIMediumDeviceType_HardDisk).location());
|
---|
1227 | fAttachmentsPresent = true;
|
---|
1228 | }
|
---|
1229 | /* Append controller data: */
|
---|
1230 | if (!strAttData.isNull())
|
---|
1231 | strInfo += e_strTableRow1.arg(comController.GetName()) + strAttData;
|
---|
1232 | }
|
---|
1233 | }
|
---|
1234 |
|
---|
1235 | void UIDetailsGenerator::acquireOpticalDiskStatusInfo(CMachine &comMachine, QString &strInfo,
|
---|
1236 | bool &fAttachmentsPresent, bool &fAttachmentsMounted)
|
---|
1237 | {
|
---|
1238 | /* Enumerate all the controllers: */
|
---|
1239 | foreach (const CStorageController &comController, comMachine.GetStorageControllers())
|
---|
1240 | {
|
---|
1241 | QString strAttData;
|
---|
1242 | /* Enumerate all the attachments: */
|
---|
1243 | foreach (const CMediumAttachment &comAttachment, comMachine.GetMediumAttachmentsOfController(comController.GetName()))
|
---|
1244 | {
|
---|
1245 | /* Skip unrelated attachments: */
|
---|
1246 | if (comAttachment.GetType() != KDeviceType_DVD)
|
---|
1247 | continue;
|
---|
1248 | /* Append attachment data: */
|
---|
1249 | UIMedium vboxMedium(comAttachment.GetMedium(), UIMediumDeviceType_DVD);
|
---|
1250 | strAttData += e_strTableRow3
|
---|
1251 | .arg(gpConverter->toString(StorageSlot(comController.GetBus(), comAttachment.GetPort(), comAttachment.GetDevice())))
|
---|
1252 | .arg(vboxMedium.isNull() || vboxMedium.isHostDrive() ? vboxMedium.name() : vboxMedium.location());
|
---|
1253 | fAttachmentsPresent = true;
|
---|
1254 | if (!vboxMedium.isNull())
|
---|
1255 | fAttachmentsMounted = true;
|
---|
1256 | }
|
---|
1257 | /* Append controller data: */
|
---|
1258 | if (!strAttData.isNull())
|
---|
1259 | strInfo += e_strTableRow1.arg(comController.GetName()) + strAttData;
|
---|
1260 | }
|
---|
1261 | }
|
---|
1262 |
|
---|
1263 | void UIDetailsGenerator::acquireFloppyDiskStatusInfo(CMachine &comMachine, QString &strInfo,
|
---|
1264 | bool &fAttachmentsPresent, bool &fAttachmentsMounted)
|
---|
1265 | {
|
---|
1266 | /* Enumerate all the controllers: */
|
---|
1267 | foreach (const CStorageController &comController, comMachine.GetStorageControllers())
|
---|
1268 | {
|
---|
1269 | QString strAttData;
|
---|
1270 | /* Enumerate all the attachments: */
|
---|
1271 | foreach (const CMediumAttachment &comAttachment, comMachine.GetMediumAttachmentsOfController(comController.GetName()))
|
---|
1272 | {
|
---|
1273 | /* Skip unrelated attachments: */
|
---|
1274 | if (comAttachment.GetType() != KDeviceType_Floppy)
|
---|
1275 | continue;
|
---|
1276 | /* Append attachment data: */
|
---|
1277 | UIMedium vboxMedium(comAttachment.GetMedium(), UIMediumDeviceType_Floppy);
|
---|
1278 | strAttData += e_strTableRow3
|
---|
1279 | .arg(gpConverter->toString(StorageSlot(comController.GetBus(), comAttachment.GetPort(), comAttachment.GetDevice())))
|
---|
1280 | .arg(vboxMedium.isNull() || vboxMedium.isHostDrive() ? vboxMedium.name() : vboxMedium.location());
|
---|
1281 | fAttachmentsPresent = true;
|
---|
1282 | if (!vboxMedium.isNull())
|
---|
1283 | fAttachmentsMounted = true;
|
---|
1284 | }
|
---|
1285 | /* Append controller data: */
|
---|
1286 | if (!strAttData.isNull())
|
---|
1287 | strInfo += e_strTableRow1.arg(comController.GetName()) + strAttData;
|
---|
1288 | }
|
---|
1289 | }
|
---|
1290 |
|
---|
1291 | void UIDetailsGenerator::acquireAudioStatusInfo(CMachine &comMachine, QString &strInfo,
|
---|
1292 | bool &fAudioEnabled, bool &fEnabledOutput, bool &fEnabledInput)
|
---|
1293 | {
|
---|
1294 | /* Get audio settings & adapter: */
|
---|
1295 | const CAudioSettings comAudioSettings = comMachine.GetAudioSettings();
|
---|
1296 | const CAudioAdapter comAdapter = comAudioSettings.GetAdapter();
|
---|
1297 | fAudioEnabled = comAdapter.GetEnabled();
|
---|
1298 | if (fAudioEnabled)
|
---|
1299 | {
|
---|
1300 | fEnabledOutput = comAdapter.GetEnabledOut();
|
---|
1301 | fEnabledInput = comAdapter.GetEnabledIn();
|
---|
1302 | strInfo = QString(e_strTableRow2).arg(QApplication::translate("UIDetails", "Audio Output", "details (audio)"),
|
---|
1303 | fEnabledOutput ?
|
---|
1304 | QApplication::translate("UIDetails", "Enabled", "details (audio/output)") :
|
---|
1305 | QApplication::translate("UIDetails", "Disabled", "details (audio/output)"))
|
---|
1306 | + QString(e_strTableRow2).arg(QApplication::translate("UIDetails", "Audio Input", "details (audio)"),
|
---|
1307 | fEnabledInput ?
|
---|
1308 | QApplication::translate("UIDetails", "Enabled", "details (audio/input)") :
|
---|
1309 | QApplication::translate("UIDetails", "Disabled", "details (audio/input)"));
|
---|
1310 | }
|
---|
1311 | }
|
---|
1312 |
|
---|
1313 | void UIDetailsGenerator::acquireNetworkStatusInfo(CMachine &comMachine, QString &strInfo,
|
---|
1314 | bool &fAdaptersPresent, bool &fCablesDisconnected)
|
---|
1315 | {
|
---|
1316 | /* Determine max amount of network adapters: */
|
---|
1317 | CPlatform comPlatform = comMachine.GetPlatform();
|
---|
1318 | const KPlatformArchitecture enmArch = comPlatform.GetArchitecture();
|
---|
1319 | const KChipsetType enmChipsetType = comPlatform.GetChipsetType();
|
---|
1320 | CPlatformProperties comProperties = gpGlobalSession->virtualBox().GetPlatformProperties(enmArch);
|
---|
1321 | const ulong cMaxNetworkAdapters = comProperties.GetMaxNetworkAdapters(enmChipsetType);
|
---|
1322 |
|
---|
1323 | /* Gather adapter properties: */
|
---|
1324 | RTTIMESPEC time;
|
---|
1325 | uint64_t u64Now = RTTimeSpecGetNano(RTTimeNow(&time));
|
---|
1326 | QString strFlags, strCount;
|
---|
1327 | LONG64 iTimestamp;
|
---|
1328 | comMachine.GetGuestProperty("/VirtualBox/GuestInfo/Net/Count", strCount, iTimestamp, strFlags);
|
---|
1329 | bool fPropsValid = (u64Now - iTimestamp < UINT64_C(60000000000)); /* timeout beacon */
|
---|
1330 | QStringList ipList, macList;
|
---|
1331 | if (fPropsValid)
|
---|
1332 | {
|
---|
1333 | const ulong cAdapters = qMin(strCount.toULong(), cMaxNetworkAdapters);
|
---|
1334 | for (ulong i = 0; i < cAdapters; ++i)
|
---|
1335 | {
|
---|
1336 | ipList << comMachine.GetGuestPropertyValue(QString("/VirtualBox/GuestInfo/Net/%1/V4/IP").arg(i));
|
---|
1337 | macList << comMachine.GetGuestPropertyValue(QString("/VirtualBox/GuestInfo/Net/%1/MAC").arg(i));
|
---|
1338 | }
|
---|
1339 | }
|
---|
1340 |
|
---|
1341 | /* Enumerate up to cMaxNetworkAdapters adapters: */
|
---|
1342 | for (ulong uSlot = 0; uSlot < cMaxNetworkAdapters; ++uSlot)
|
---|
1343 | {
|
---|
1344 | const CNetworkAdapter &comAdapter = comMachine.GetNetworkAdapter(uSlot);
|
---|
1345 | if (comMachine.isOk() && !comAdapter.isNull() && comAdapter.GetEnabled())
|
---|
1346 | {
|
---|
1347 | fAdaptersPresent = true;
|
---|
1348 | QString strGuestIp;
|
---|
1349 | if (fPropsValid)
|
---|
1350 | {
|
---|
1351 | const QString strGuestMac = comAdapter.GetMACAddress();
|
---|
1352 | const int iIp = macList.indexOf(strGuestMac);
|
---|
1353 | if (iIp >= 0)
|
---|
1354 | strGuestIp = ipList.at(iIp);
|
---|
1355 | }
|
---|
1356 | /* Check if the adapter's cable is connected: */
|
---|
1357 | const bool fCableConnected = comAdapter.GetCableConnected();
|
---|
1358 | if (fCablesDisconnected && fCableConnected)
|
---|
1359 | fCablesDisconnected = false;
|
---|
1360 | /* Append adapter data: */
|
---|
1361 | strInfo += e_strTableRow1
|
---|
1362 | .arg(QApplication::translate("UIIndicatorsPool", "Adapter %1 (%2)", "Network tooltip")
|
---|
1363 | .arg(uSlot + 1).arg(gpConverter->toString(comAdapter.GetAttachmentType())));
|
---|
1364 | if (!strGuestIp.isEmpty())
|
---|
1365 | strInfo += e_strTableRow3
|
---|
1366 | .arg(QApplication::translate("UIIndicatorsPool", "IP", "Network tooltip"), strGuestIp);
|
---|
1367 | strInfo += e_strTableRow3
|
---|
1368 | .arg(QApplication::translate("UIIndicatorsPool", "Cable", "Network tooltip"))
|
---|
1369 | .arg(fCableConnected ?
|
---|
1370 | QApplication::translate("UIIndicatorsPool", "Connected", "cable (Network tooltip)") :
|
---|
1371 | QApplication::translate("UIIndicatorsPool", "Disconnected", "cable (Network tooltip)"));
|
---|
1372 | }
|
---|
1373 | }
|
---|
1374 | }
|
---|
1375 |
|
---|
1376 | void UIDetailsGenerator::acquireUsbStatusInfo(CMachine &comMachine, CConsole &comConsole,
|
---|
1377 | QString &strInfo, bool &fUsbEnabled)
|
---|
1378 | {
|
---|
1379 | /* Check whether there is at least one USB controller with an available proxy: */
|
---|
1380 | fUsbEnabled = !comMachine.GetUSBDeviceFilters().isNull()
|
---|
1381 | && !comMachine.GetUSBControllers().isEmpty()
|
---|
1382 | && comMachine.GetUSBProxyAvailable();
|
---|
1383 | if (fUsbEnabled)
|
---|
1384 | {
|
---|
1385 | /* Enumerate all the USB devices: */
|
---|
1386 | foreach (const CUSBDevice &comUsbDevice, comConsole.GetUSBDevices())
|
---|
1387 | strInfo += e_strTableRow1.arg(uiCommon().usbDetails(comUsbDevice));
|
---|
1388 | /* Handle 'no-usb-devices' case: */
|
---|
1389 | if (strInfo.isNull())
|
---|
1390 | strInfo = e_strTableRow1
|
---|
1391 | .arg(QApplication::translate("UIIndicatorsPool", "No USB devices attached", "USB tooltip"));
|
---|
1392 | }
|
---|
1393 | }
|
---|
1394 |
|
---|
1395 | void UIDetailsGenerator::acquireSharedFoldersStatusInfo(CMachine &comMachine, CConsole &comConsole, CGuest &comGuest,
|
---|
1396 | QString &strInfo, bool &fFoldersPresent)
|
---|
1397 | {
|
---|
1398 | /* Enumerate all the folders: */
|
---|
1399 | QMap<QString, QString> folders;
|
---|
1400 | foreach (const CSharedFolder &comPermanentFolder, comMachine.GetSharedFolders())
|
---|
1401 | folders.insert(comPermanentFolder.GetName(), comPermanentFolder.GetHostPath());
|
---|
1402 | foreach (const CSharedFolder &comTemporaryFolder, comConsole.GetSharedFolders())
|
---|
1403 | folders.insert(comTemporaryFolder.GetName(), comTemporaryFolder.GetHostPath());
|
---|
1404 | fFoldersPresent = !folders.isEmpty();
|
---|
1405 |
|
---|
1406 | /* Append attachment data: */
|
---|
1407 | for (QMap<QString, QString>::const_iterator it = folders.constBegin(); it != folders.constEnd(); ++it)
|
---|
1408 | {
|
---|
1409 | /* Select slashes depending on the OS type: */
|
---|
1410 | if (UIGuestOSTypeManager::isDOSType(comGuest.GetOSTypeId()))
|
---|
1411 | strInfo += e_strTableRow2.arg(QString("<b>\\\\vboxsvr\\%1</b>").arg(it.key()), it.value());
|
---|
1412 | else
|
---|
1413 | strInfo += e_strTableRow2.arg(QString("<b>%1</b>").arg(it.key()), it.value());
|
---|
1414 | }
|
---|
1415 |
|
---|
1416 | /* Handle 'no-folders' case: */
|
---|
1417 | if (!fFoldersPresent)
|
---|
1418 | strInfo = e_strTableRow1
|
---|
1419 | .arg(QApplication::translate("UIIndicatorsPool", "No shared folders", "Shared folders tooltip"));
|
---|
1420 | }
|
---|
1421 |
|
---|
1422 | void UIDetailsGenerator::acquireDisplayStatusInfo(CMachine &comMachine, QString &strInfo,
|
---|
1423 | bool &fAcceleration3D)
|
---|
1424 | {
|
---|
1425 | /* Get graphics adapter: */
|
---|
1426 | CGraphicsAdapter comGraphics = comMachine.GetGraphicsAdapter();
|
---|
1427 |
|
---|
1428 | /* Video Memory: */
|
---|
1429 | const ULONG uVRAMSize = comGraphics.GetVRAMSize();
|
---|
1430 | const QString strVRAMSize = UICommon::tr("<nobr>%1 MB</nobr>", "details report").arg(uVRAMSize);
|
---|
1431 | strInfo += e_strTableRow2
|
---|
1432 | .arg(QApplication::translate("UIIndicatorsPool", "Video memory", "Display tooltip"), strVRAMSize);
|
---|
1433 |
|
---|
1434 | /* Monitor Count: */
|
---|
1435 | const ULONG uMonitorCount = comGraphics.GetMonitorCount();
|
---|
1436 | if (uMonitorCount > 1)
|
---|
1437 | {
|
---|
1438 | const QString strMonitorCount = QString::number(uMonitorCount);
|
---|
1439 | strInfo += e_strTableRow2
|
---|
1440 | .arg(QApplication::translate("UIIndicatorsPool", "Screens", "Display tooltip"), strMonitorCount);
|
---|
1441 | }
|
---|
1442 |
|
---|
1443 | /* 3D acceleration: */
|
---|
1444 | fAcceleration3D = comGraphics.GetAccelerate3DEnabled();
|
---|
1445 | if (fAcceleration3D)
|
---|
1446 | {
|
---|
1447 | const QString strAcceleration3D = fAcceleration3D
|
---|
1448 | ? UICommon::tr("Enabled", "details report (3D Acceleration)")
|
---|
1449 | : UICommon::tr("Disabled", "details report (3D Acceleration)");
|
---|
1450 | strInfo += e_strTableRow2
|
---|
1451 | .arg(QApplication::translate("UIIndicatorsPool", "3D acceleration", "Display tooltip"), strAcceleration3D);
|
---|
1452 | }
|
---|
1453 | }
|
---|
1454 |
|
---|
1455 | void UIDetailsGenerator::acquireRecordingStatusInfo(CMachine &comMachine, QString &strInfo,
|
---|
1456 | bool &fRecordingEnabled)
|
---|
1457 | {
|
---|
1458 | /* Get recording settings: */
|
---|
1459 | CRecordingSettings comRecordingSettings = comMachine.GetRecordingSettings();
|
---|
1460 | fRecordingEnabled = comRecordingSettings.GetEnabled();
|
---|
1461 | if (fRecordingEnabled)
|
---|
1462 | {
|
---|
1463 | /* For now all screens have the same config: */
|
---|
1464 | CRecordingScreenSettings comRecordingScreen0Settings = comRecordingSettings.GetScreenSettings(0);
|
---|
1465 | const bool fVideoEnabled = comRecordingScreen0Settings.IsFeatureEnabled(KRecordingFeature_Video);
|
---|
1466 | const bool fAudioEnabled = comRecordingScreen0Settings.IsFeatureEnabled(KRecordingFeature_Audio);
|
---|
1467 |
|
---|
1468 | /* Compose tool-tip: */
|
---|
1469 | QString strToolTip;
|
---|
1470 | if (fVideoEnabled && fAudioEnabled)
|
---|
1471 | strToolTip = QApplication::translate("UIIndicatorsPool", "Video/audio recording file", "Recording tooltip");
|
---|
1472 | else if (fAudioEnabled)
|
---|
1473 | strToolTip = QApplication::translate("UIIndicatorsPool", "Audio recording file", "Recording tooltip");
|
---|
1474 | else if (fVideoEnabled)
|
---|
1475 | strToolTip = QApplication::translate("UIIndicatorsPool", "Video recording file", "Recording tooltip");
|
---|
1476 | strInfo += e_strTableRow2
|
---|
1477 | .arg(strToolTip)
|
---|
1478 | .arg(comRecordingScreen0Settings.GetFilename());
|
---|
1479 | }
|
---|
1480 | /* Handle 'no-recording' case: */
|
---|
1481 | else
|
---|
1482 | {
|
---|
1483 | strInfo += e_strTableRow1
|
---|
1484 | .arg(QApplication::translate("UIIndicatorsPool", "Recording disabled", "Recording tooltip"));
|
---|
1485 | }
|
---|
1486 | }
|
---|
1487 |
|
---|
1488 | void UIDetailsGenerator::acquireFeaturesStatusInfo(CMachine &comMachine, QString &strInfo,
|
---|
1489 | KVMExecutionEngine &enmEngine,
|
---|
1490 | bool fNestedPagingEnabled, bool fUxEnabled,
|
---|
1491 | KParavirtProvider enmProvider)
|
---|
1492 | {
|
---|
1493 | /* VT-x/AMD-V feature: */
|
---|
1494 | QString strExecutionEngine;
|
---|
1495 | switch (enmEngine)
|
---|
1496 | {
|
---|
1497 | case KVMExecutionEngine_Interpreter:
|
---|
1498 | strExecutionEngine = "IEM (Interpreter)"; /* no translation */
|
---|
1499 | break;
|
---|
1500 | case KVMExecutionEngine_Recompiler:
|
---|
1501 | strExecutionEngine = "IEM (Recompiler)"; /* no translation */
|
---|
1502 | break;
|
---|
1503 | case KVMExecutionEngine_HwVirt:
|
---|
1504 | strExecutionEngine = "VT-x/AMD-V"; /* no translation */
|
---|
1505 | break;
|
---|
1506 | case KVMExecutionEngine_NativeApi:
|
---|
1507 | strExecutionEngine = "native API"; /* no translation */
|
---|
1508 | break;
|
---|
1509 | default:
|
---|
1510 | AssertFailed();
|
---|
1511 | enmEngine = KVMExecutionEngine_NotSet;
|
---|
1512 | RT_FALL_THRU();
|
---|
1513 | case KVMExecutionEngine_NotSet:
|
---|
1514 | strExecutionEngine = UICommon::tr("not set", "details report (execution engine)");
|
---|
1515 | break;
|
---|
1516 | }
|
---|
1517 |
|
---|
1518 | /* Nested Paging feature: */
|
---|
1519 | const QString strNestedPaging = fNestedPagingEnabled
|
---|
1520 | ? UICommon::tr("Active", "details report (Nested Paging)")
|
---|
1521 | : UICommon::tr("Inactive", "details report (Nested Paging)");
|
---|
1522 |
|
---|
1523 | /* Unrestricted Execution feature: */
|
---|
1524 | const QString strUnrestrictExec = fUxEnabled
|
---|
1525 | ? UICommon::tr("Active", "details report (Unrestricted Execution)")
|
---|
1526 | : UICommon::tr("Inactive", "details report (Unrestricted Execution)");
|
---|
1527 |
|
---|
1528 | /* CPU Execution Cap feature: */
|
---|
1529 | const QString strCPUExecCap = QString::number(comMachine.GetCPUExecutionCap());
|
---|
1530 |
|
---|
1531 | /* Paravirtualization feature: */
|
---|
1532 | const QString strParavirt = gpConverter->toString(enmProvider);
|
---|
1533 |
|
---|
1534 | /* Compose tool-tip: */
|
---|
1535 | strInfo += e_strTableRow2.arg(UICommon::tr("Execution engine", "details report"), strExecutionEngine);
|
---|
1536 | strInfo += e_strTableRow2.arg(UICommon::tr("Nested Paging"), strNestedPaging);
|
---|
1537 | strInfo += e_strTableRow2.arg(UICommon::tr("Unrestricted Execution"), strUnrestrictExec);
|
---|
1538 | strInfo += e_strTableRow2.arg(UICommon::tr("Execution Cap", "details report"), strCPUExecCap);
|
---|
1539 | strInfo += e_strTableRow2.arg(UICommon::tr("Paravirtualization Interface", "details report"), strParavirt);
|
---|
1540 |
|
---|
1541 | /* Add CPU count optional info: */
|
---|
1542 | const int cCpuCount = comMachine.GetCPUCount();
|
---|
1543 | if (cCpuCount > 1)
|
---|
1544 | strInfo += e_strTableRow2.arg(UICommon::tr("Processors", "details report"), QString::number(cCpuCount));
|
---|
1545 | }
|
---|
1546 |
|
---|
1547 | QString UIDetailsGenerator::summarizeGenericProperties(const CNetworkAdapter &comAdapter)
|
---|
1548 | {
|
---|
1549 | QVector<QString> names;
|
---|
1550 | QVector<QString> props;
|
---|
1551 | props = comAdapter.GetProperties(QString(), names);
|
---|
1552 | QString strResult;
|
---|
1553 | for (int i = 0; i < names.size(); ++i)
|
---|
1554 | {
|
---|
1555 | strResult += names[i] + "=" + props[i];
|
---|
1556 | if (i < names.size() - 1)
|
---|
1557 | strResult += ", ";
|
---|
1558 | }
|
---|
1559 | return strResult;
|
---|
1560 | }
|
---|