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