1 | /* $Id: UIDetailsGenerator.cpp 84790 2020-06-11 10:30:36Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIDetailsGenerator implementation.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2012-2020 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | /* Qt includes: */
|
---|
19 | #include <QApplication>
|
---|
20 | #include <QDir>
|
---|
21 |
|
---|
22 | /* GUI includes: */
|
---|
23 | #include "UIBootOrderEditor.h"
|
---|
24 | #include "UIConverter.h"
|
---|
25 | #include "UIDetailsGenerator.h"
|
---|
26 | #include "UIErrorString.h"
|
---|
27 | #include "UICommon.h"
|
---|
28 |
|
---|
29 | /* COM includes: */
|
---|
30 | #include "COMEnums.h"
|
---|
31 | #include "CAudioAdapter.h"
|
---|
32 | #include "CBooleanFormValue.h"
|
---|
33 | #include "CChoiceFormValue.h"
|
---|
34 | #include "CCloudMachine.h"
|
---|
35 | #include "CForm.h"
|
---|
36 | #include "CFormValue.h"
|
---|
37 | #include "CGraphicsAdapter.h"
|
---|
38 | #include "CMachine.h"
|
---|
39 | #include "CMediumAttachment.h"
|
---|
40 | #include "CNetworkAdapter.h"
|
---|
41 | #include "CProgress.h"
|
---|
42 | #include "CRangedIntegerFormValue.h"
|
---|
43 | #include "CRecordingScreenSettings.h"
|
---|
44 | #include "CRecordingSettings.h"
|
---|
45 | #include "CSerialPort.h"
|
---|
46 | #include "CSharedFolder.h"
|
---|
47 | #include "CStorageController.h"
|
---|
48 | #include "CStringFormValue.h"
|
---|
49 | #include "CSystemProperties.h"
|
---|
50 | #include "CUSBController.h"
|
---|
51 | #include "CUSBDeviceFilter.h"
|
---|
52 | #include "CUSBDeviceFilters.h"
|
---|
53 | #include "CVRDEServer.h"
|
---|
54 |
|
---|
55 | /* VirtualBox interface declarations: */
|
---|
56 | #include <VBox/com/VirtualBox.h>
|
---|
57 |
|
---|
58 |
|
---|
59 | UITextTable UIDetailsGenerator::generateMachineInformationGeneral(CMachine &comMachine,
|
---|
60 | const UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral &fOptions)
|
---|
61 | {
|
---|
62 | UITextTable table;
|
---|
63 |
|
---|
64 | if (comMachine.isNull())
|
---|
65 | return table;
|
---|
66 |
|
---|
67 | if (!comMachine.GetAccessible())
|
---|
68 | {
|
---|
69 | table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString());
|
---|
70 | return table;
|
---|
71 | }
|
---|
72 |
|
---|
73 | /* Name: */
|
---|
74 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_Name)
|
---|
75 | {
|
---|
76 | /* Configure hovering anchor: */
|
---|
77 | const QString strAnchorType = QString("machine_name");
|
---|
78 | const QString strName = comMachine.GetName();
|
---|
79 | table << UITextTableLine(QApplication::translate("UIDetails", "Name", "details (general)"),
|
---|
80 | QString("<a href=#%1,%2>%2</a>")
|
---|
81 | .arg(strAnchorType,
|
---|
82 | strName));
|
---|
83 | }
|
---|
84 |
|
---|
85 | /* Operating system: */
|
---|
86 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_OS)
|
---|
87 | {
|
---|
88 | /* Configure hovering anchor: */
|
---|
89 | const QString strAnchorType = QString("os_type");
|
---|
90 | const QString strOsTypeId = comMachine.GetOSTypeId();
|
---|
91 | table << UITextTableLine(QApplication::translate("UIDetails", "Operating System", "details (general)"),
|
---|
92 | QString("<a href=#%1,%2>%3</a>")
|
---|
93 | .arg(strAnchorType,
|
---|
94 | strOsTypeId,
|
---|
95 | uiCommon().vmGuestOSTypeDescription(strOsTypeId)));
|
---|
96 | }
|
---|
97 |
|
---|
98 | /* Settings file location: */
|
---|
99 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_Location)
|
---|
100 | {
|
---|
101 | /* Configure hovering anchor: */
|
---|
102 | const QString strAnchorType = QString("machine_location");
|
---|
103 | const QString strMachineLocation = comMachine.GetSettingsFilePath();
|
---|
104 | table << UITextTableLine(QApplication::translate("UIDetails", "Settings File Location", "details (general)"),
|
---|
105 | QString("<a href=#%1,%2>%3</a>")
|
---|
106 | .arg(strAnchorType,
|
---|
107 | strMachineLocation,
|
---|
108 | QDir::toNativeSeparators(QFileInfo(strMachineLocation).absolutePath())));
|
---|
109 | }
|
---|
110 |
|
---|
111 | /* Groups: */
|
---|
112 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_Groups)
|
---|
113 | {
|
---|
114 | QStringList groups = comMachine.GetGroups().toList();
|
---|
115 | /* Do not show groups for machine which is in root group only: */
|
---|
116 | if (groups.size() == 1)
|
---|
117 | groups.removeAll("/");
|
---|
118 | /* If group list still not empty: */
|
---|
119 | if (!groups.isEmpty())
|
---|
120 | {
|
---|
121 | /* For every group: */
|
---|
122 | for (int i = 0; i < groups.size(); ++i)
|
---|
123 | {
|
---|
124 | /* Trim first '/' symbol: */
|
---|
125 | QString &strGroup = groups[i];
|
---|
126 | if (strGroup.startsWith("/") && strGroup != "/")
|
---|
127 | strGroup.remove(0, 1);
|
---|
128 | }
|
---|
129 | table << UITextTableLine(QApplication::translate("UIDetails", "Groups", "details (general)"), groups.join(", "));
|
---|
130 | }
|
---|
131 | }
|
---|
132 |
|
---|
133 | return table;
|
---|
134 | }
|
---|
135 |
|
---|
136 | UITextTable UIDetailsGenerator::generateMachineInformationGeneral(CCloudMachine &comCloudMachine,
|
---|
137 | const UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral &)
|
---|
138 | {
|
---|
139 | UITextTable table;
|
---|
140 |
|
---|
141 | if (comCloudMachine.isNull())
|
---|
142 | return table;
|
---|
143 |
|
---|
144 | if (!comCloudMachine.GetAccessible())
|
---|
145 | {
|
---|
146 | table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString());
|
---|
147 | return table;
|
---|
148 | }
|
---|
149 |
|
---|
150 | /* Acquire details form: */
|
---|
151 | CForm comForm = comCloudMachine.GetDetailsForm();
|
---|
152 | /* Ignore cloud machine errors: */
|
---|
153 | if (comCloudMachine.isOk())
|
---|
154 | {
|
---|
155 | /* Common anchor for all fields: */
|
---|
156 | const QString strAnchorType = "cloud";
|
---|
157 |
|
---|
158 | /* For each form value: */
|
---|
159 | const QVector<CFormValue> values = comForm.GetValues();
|
---|
160 | foreach (const CFormValue &comIteratedValue, values)
|
---|
161 | {
|
---|
162 | /* Ignore invisible values: */
|
---|
163 | if (!comIteratedValue.GetVisible())
|
---|
164 | continue;
|
---|
165 |
|
---|
166 | /* Acquire label: */
|
---|
167 | const QString strLabel = comIteratedValue.GetLabel();
|
---|
168 |
|
---|
169 | /* Handle possible value types: */
|
---|
170 | QString strValue;
|
---|
171 | switch (comIteratedValue.GetType())
|
---|
172 | {
|
---|
173 | case KFormValueType_Boolean:
|
---|
174 | {
|
---|
175 | CBooleanFormValue comValue(comIteratedValue);
|
---|
176 | const bool fBool = comValue.GetSelected();
|
---|
177 | strValue = fBool ? QApplication::translate("UIDetails", "Enabled", "details (cloud value)")
|
---|
178 | : QApplication::translate("UIDetails", "Disabled", "details (cloud value)");
|
---|
179 | break;
|
---|
180 | }
|
---|
181 | case KFormValueType_String:
|
---|
182 | {
|
---|
183 | CStringFormValue comValue(comIteratedValue);
|
---|
184 | strValue = comValue.GetString();
|
---|
185 | break;
|
---|
186 | }
|
---|
187 | case KFormValueType_Choice:
|
---|
188 | {
|
---|
189 | AssertMsgFailed(("Aren't we decided to convert all choices to strings?\n"));
|
---|
190 | CChoiceFormValue comValue(comIteratedValue);
|
---|
191 | const QVector<QString> possibleValues = comValue.GetValues();
|
---|
192 | const int iCurrentIndex = comValue.GetSelectedIndex();
|
---|
193 | strValue = possibleValues.value(iCurrentIndex);
|
---|
194 | break;
|
---|
195 | }
|
---|
196 | case KFormValueType_RangedInteger:
|
---|
197 | {
|
---|
198 | CRangedIntegerFormValue comValue(comIteratedValue);
|
---|
199 | strValue = QString("%1 %2")
|
---|
200 | .arg(comValue.GetInteger())
|
---|
201 | .arg(QApplication::translate("UICommon", comValue.GetSuffix().toUtf8().constData()));
|
---|
202 | break;
|
---|
203 | }
|
---|
204 | default:
|
---|
205 | break;
|
---|
206 | }
|
---|
207 |
|
---|
208 | /* Generate table string: */
|
---|
209 | if (comIteratedValue.GetEnabled())
|
---|
210 | table << UITextTableLine(strLabel, QString("<a href=#%1,%2>%3</a>").arg(strAnchorType, strLabel, strValue));
|
---|
211 | else
|
---|
212 | table << UITextTableLine(strLabel, strValue);
|
---|
213 | }
|
---|
214 | }
|
---|
215 |
|
---|
216 | return table;
|
---|
217 | }
|
---|
218 |
|
---|
219 | UITextTable UIDetailsGenerator::generateMachineInformationSystem(CMachine &comMachine,
|
---|
220 | const UIExtraDataMetaDefs::DetailsElementOptionTypeSystem &fOptions)
|
---|
221 | {
|
---|
222 | UITextTable table;
|
---|
223 |
|
---|
224 | if (comMachine.isNull())
|
---|
225 | return table;
|
---|
226 |
|
---|
227 | if (!comMachine.GetAccessible())
|
---|
228 | {
|
---|
229 | table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString());
|
---|
230 | return table;
|
---|
231 | }
|
---|
232 |
|
---|
233 | /* Base memory: */
|
---|
234 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_RAM)
|
---|
235 | {
|
---|
236 | /* Configure hovering anchor: */
|
---|
237 | const QString strAnchorType = QString("base_memory");
|
---|
238 | const int iBaseMemory = comMachine.GetMemorySize();
|
---|
239 | table << UITextTableLine(QApplication::translate("UIDetails", "Base Memory", "details (system)"),
|
---|
240 | QString("<a href=#%1,%2>%3</a>")
|
---|
241 | .arg(strAnchorType)
|
---|
242 | .arg(iBaseMemory)
|
---|
243 | .arg(QApplication::translate("UIDetails", "%1 MB").arg(iBaseMemory)));
|
---|
244 | }
|
---|
245 |
|
---|
246 | /* Processors: */
|
---|
247 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_CPUCount)
|
---|
248 | {
|
---|
249 | const int cCPU = comMachine.GetCPUCount();
|
---|
250 | if (cCPU > 1)
|
---|
251 | table << UITextTableLine(QApplication::translate("UIDetails", "Processors", "details (system)"),
|
---|
252 | QString::number(cCPU));
|
---|
253 | }
|
---|
254 |
|
---|
255 | /* Execution cap: */
|
---|
256 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_CPUExecutionCap)
|
---|
257 | {
|
---|
258 | const int iCPUExecutionCap = comMachine.GetCPUExecutionCap();
|
---|
259 | if (iCPUExecutionCap < 100)
|
---|
260 | table << UITextTableLine(QApplication::translate("UIDetails", "Execution Cap", "details (system)"),
|
---|
261 | QApplication::translate("UIDetails", "%1%", "details").arg(iCPUExecutionCap));
|
---|
262 | }
|
---|
263 |
|
---|
264 | /* Boot order: */
|
---|
265 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_BootOrder)
|
---|
266 | {
|
---|
267 | /* Configure hovering anchor: */
|
---|
268 | const QString strAnchorType = QString("boot_order");
|
---|
269 | const UIBootItemDataList bootItems = loadBootItems(comMachine);
|
---|
270 | table << UITextTableLine(QApplication::translate("UIDetails", "Boot Order", "details (system)"),
|
---|
271 | QString("<a href=#%1,%2>%3</a>")
|
---|
272 | .arg(strAnchorType,
|
---|
273 | bootItemsToSerializedString(bootItems),
|
---|
274 | bootItemsToReadableString(bootItems)));
|
---|
275 | }
|
---|
276 |
|
---|
277 | /* Chipset type: */
|
---|
278 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_ChipsetType)
|
---|
279 | {
|
---|
280 | const KChipsetType enmChipsetType = comMachine.GetChipsetType();
|
---|
281 | if (enmChipsetType == KChipsetType_ICH9)
|
---|
282 | table << UITextTableLine(QApplication::translate("UIDetails", "Chipset Type", "details (system)"),
|
---|
283 | gpConverter->toString(enmChipsetType));
|
---|
284 | }
|
---|
285 |
|
---|
286 | /* EFI: */
|
---|
287 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_Firmware)
|
---|
288 | {
|
---|
289 | switch (comMachine.GetFirmwareType())
|
---|
290 | {
|
---|
291 | case KFirmwareType_EFI:
|
---|
292 | case KFirmwareType_EFI32:
|
---|
293 | case KFirmwareType_EFI64:
|
---|
294 | case KFirmwareType_EFIDUAL:
|
---|
295 | {
|
---|
296 | table << UITextTableLine(QApplication::translate("UIDetails", "EFI", "details (system)"),
|
---|
297 | QApplication::translate("UIDetails", "Enabled", "details (system/EFI)"));
|
---|
298 | break;
|
---|
299 | }
|
---|
300 | default:
|
---|
301 | {
|
---|
302 | // For NLS purpose:
|
---|
303 | QApplication::translate("UIDetails", "Disabled", "details (system/EFI)");
|
---|
304 | break;
|
---|
305 | }
|
---|
306 | }
|
---|
307 | }
|
---|
308 |
|
---|
309 | /* Acceleration: */
|
---|
310 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_Acceleration)
|
---|
311 | {
|
---|
312 | QStringList acceleration;
|
---|
313 | if (uiCommon().virtualBox().GetHost().GetProcessorFeature(KProcessorFeature_HWVirtEx))
|
---|
314 | {
|
---|
315 | /* VT-x/AMD-V: */
|
---|
316 | if (comMachine.GetHWVirtExProperty(KHWVirtExPropertyType_Enabled))
|
---|
317 | {
|
---|
318 | acceleration << QApplication::translate("UIDetails", "VT-x/AMD-V", "details (system)");
|
---|
319 | /* Nested Paging (only when hw virt is enabled): */
|
---|
320 | if (comMachine.GetHWVirtExProperty(KHWVirtExPropertyType_NestedPaging))
|
---|
321 | acceleration << QApplication::translate("UIDetails", "Nested Paging", "details (system)");
|
---|
322 | }
|
---|
323 | }
|
---|
324 | /* PAE/NX: */
|
---|
325 | if (comMachine.GetCPUProperty(KCPUPropertyType_PAE))
|
---|
326 | acceleration << QApplication::translate("UIDetails", "PAE/NX", "details (system)");
|
---|
327 | /* Paravirtualization provider: */
|
---|
328 | switch (comMachine.GetEffectiveParavirtProvider())
|
---|
329 | {
|
---|
330 | case KParavirtProvider_Minimal: acceleration << QApplication::translate("UIDetails", "Minimal Paravirtualization", "details (system)"); break;
|
---|
331 | case KParavirtProvider_HyperV: acceleration << QApplication::translate("UIDetails", "Hyper-V Paravirtualization", "details (system)"); break;
|
---|
332 | case KParavirtProvider_KVM: acceleration << QApplication::translate("UIDetails", "KVM Paravirtualization", "details (system)"); break;
|
---|
333 | default: break;
|
---|
334 | }
|
---|
335 | if (!acceleration.isEmpty())
|
---|
336 | table << UITextTableLine(QApplication::translate("UIDetails", "Acceleration", "details (system)"),
|
---|
337 | acceleration.join(", "));
|
---|
338 | }
|
---|
339 |
|
---|
340 | return table;
|
---|
341 | }
|
---|
342 |
|
---|
343 | UITextTable UIDetailsGenerator::generateMachineInformationDisplay(CMachine &comMachine,
|
---|
344 | const UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay &fOptions)
|
---|
345 | {
|
---|
346 | UITextTable table;
|
---|
347 |
|
---|
348 | if (comMachine.isNull())
|
---|
349 | return table;
|
---|
350 |
|
---|
351 | if (!comMachine.GetAccessible())
|
---|
352 | {
|
---|
353 | table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString());
|
---|
354 | return table;
|
---|
355 | }
|
---|
356 |
|
---|
357 | const CGraphicsAdapter comGraphics = comMachine.GetGraphicsAdapter();
|
---|
358 |
|
---|
359 | /* Video memory: */
|
---|
360 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_VRAM)
|
---|
361 | {
|
---|
362 | /* Configure hovering anchor: */
|
---|
363 | const QString strAnchorType = QString("video_memory");
|
---|
364 | const int iVideoMemory = comGraphics.GetVRAMSize();
|
---|
365 | table << UITextTableLine(QApplication::translate("UIDetails", "Video Memory", "details (display)"),
|
---|
366 | QString("<a href=#%1,%2>%3</a>")
|
---|
367 | .arg(strAnchorType)
|
---|
368 | .arg(iVideoMemory)
|
---|
369 | .arg(QApplication::translate("UIDetails", "%1 MB").arg(iVideoMemory)));
|
---|
370 | }
|
---|
371 |
|
---|
372 | /* Screens: */
|
---|
373 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_ScreenCount)
|
---|
374 | {
|
---|
375 | const int cGuestScreens = comGraphics.GetMonitorCount();
|
---|
376 | if (cGuestScreens > 1)
|
---|
377 | table << UITextTableLine(QApplication::translate("UIDetails", "Screens", "details (display)"),
|
---|
378 | QString::number(cGuestScreens));
|
---|
379 | }
|
---|
380 |
|
---|
381 | /* Scale-factor: */
|
---|
382 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_ScaleFactor)
|
---|
383 | {
|
---|
384 | const QString strScaleFactor = comMachine.GetExtraData(UIExtraDataDefs::GUI_ScaleFactor);
|
---|
385 | {
|
---|
386 | /* Try to convert loaded data to double: */
|
---|
387 | bool fOk = false;
|
---|
388 | double dValue = strScaleFactor.toDouble(&fOk);
|
---|
389 | /* Invent the default value: */
|
---|
390 | if (!fOk || !dValue)
|
---|
391 | dValue = 1.0;
|
---|
392 | /* Append information: */
|
---|
393 | if (dValue != 1.0)
|
---|
394 | table << UITextTableLine(QApplication::translate("UIDetails", "Scale-factor", "details (display)"),
|
---|
395 | QString::number(dValue, 'f', 2));
|
---|
396 | }
|
---|
397 | }
|
---|
398 |
|
---|
399 | /* Graphics Controller: */
|
---|
400 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_GraphicsController)
|
---|
401 | {
|
---|
402 | const QString strAnchorType = QString("graphics_controller_type");
|
---|
403 | const KGraphicsControllerType enmType = comGraphics.GetGraphicsControllerType();
|
---|
404 | table << UITextTableLine(QApplication::translate("UIDetails", "Graphics Controller", "details (display)"),
|
---|
405 | QString("<a href=#%1,%2>%3</a>")
|
---|
406 | .arg(strAnchorType)
|
---|
407 | .arg((int)enmType)
|
---|
408 | .arg(gpConverter->toString(enmType)));
|
---|
409 | }
|
---|
410 |
|
---|
411 | /* Acceleration: */
|
---|
412 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_Acceleration)
|
---|
413 | {
|
---|
414 | QStringList acceleration;
|
---|
415 | /* 3D acceleration: */
|
---|
416 | if (comGraphics.GetAccelerate3DEnabled())
|
---|
417 | acceleration << QApplication::translate("UIDetails", "3D", "details (display)");
|
---|
418 | if (!acceleration.isEmpty())
|
---|
419 | table << UITextTableLine(QApplication::translate("UIDetails", "Acceleration", "details (display)"),
|
---|
420 | acceleration.join(", "));
|
---|
421 | }
|
---|
422 |
|
---|
423 | /* Remote desktop server: */
|
---|
424 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_VRDE)
|
---|
425 | {
|
---|
426 | const CVRDEServer comServer = comMachine.GetVRDEServer();
|
---|
427 | if (!comServer.isNull())
|
---|
428 | {
|
---|
429 | if (comServer.GetEnabled())
|
---|
430 | table << UITextTableLine(QApplication::translate("UIDetails", "Remote Desktop Server Port", "details (display/vrde)"),
|
---|
431 | comServer.GetVRDEProperty("TCP/Ports"));
|
---|
432 | else
|
---|
433 | table << UITextTableLine(QApplication::translate("UIDetails", "Remote Desktop Server", "details (display/vrde)"),
|
---|
434 | QApplication::translate("UIDetails", "Disabled", "details (display/vrde/VRDE server)"));
|
---|
435 | }
|
---|
436 | }
|
---|
437 |
|
---|
438 | /* Recording: */
|
---|
439 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_Recording)
|
---|
440 | {
|
---|
441 | CRecordingSettings comRecordingSettings = comMachine.GetRecordingSettings();
|
---|
442 | if (comRecordingSettings.GetEnabled())
|
---|
443 | {
|
---|
444 | /* For now all screens have the same config: */
|
---|
445 | const CRecordingScreenSettings comRecordingScreen0Settings = comRecordingSettings.GetScreenSettings(0);
|
---|
446 |
|
---|
447 | /** @todo r=andy Refine these texts (wrt audio and/or video). */
|
---|
448 | table << UITextTableLine(QApplication::translate("UIDetails", "Recording File", "details (display/recording)"),
|
---|
449 | comRecordingScreen0Settings.GetFilename());
|
---|
450 | table << UITextTableLine(QApplication::translate("UIDetails", "Recording Attributes", "details (display/recording)"),
|
---|
451 | QApplication::translate("UIDetails", "Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps")
|
---|
452 | .arg(comRecordingScreen0Settings.GetVideoWidth()).arg(comRecordingScreen0Settings.GetVideoHeight())
|
---|
453 | .arg(comRecordingScreen0Settings.GetVideoFPS()).arg(comRecordingScreen0Settings.GetVideoRate()));
|
---|
454 | }
|
---|
455 | else
|
---|
456 | {
|
---|
457 | table << UITextTableLine(QApplication::translate("UIDetails", "Recording", "details (display/recording)"),
|
---|
458 | QApplication::translate("UIDetails", "Disabled", "details (display/recording)"));
|
---|
459 | }
|
---|
460 | }
|
---|
461 |
|
---|
462 | return table;
|
---|
463 | }
|
---|
464 |
|
---|
465 | UITextTable UIDetailsGenerator::generateMachineInformationStorage(CMachine &comMachine,
|
---|
466 | const UIExtraDataMetaDefs::DetailsElementOptionTypeStorage &fOptions,
|
---|
467 | bool fLink /* = true */)
|
---|
468 | {
|
---|
469 | UITextTable table;
|
---|
470 |
|
---|
471 | if (comMachine.isNull())
|
---|
472 | return table;
|
---|
473 |
|
---|
474 | if (!comMachine.GetAccessible())
|
---|
475 | {
|
---|
476 | table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString());
|
---|
477 | return table;
|
---|
478 | }
|
---|
479 |
|
---|
480 | /* Iterate over all the machine controllers: */
|
---|
481 | foreach (const CStorageController &comController, comMachine.GetStorageControllers())
|
---|
482 | {
|
---|
483 | /* Add controller information: */
|
---|
484 | const QString strControllerName = QApplication::translate("UIMachineSettingsStorage", "Controller: %1");
|
---|
485 | table << UITextTableLine(strControllerName.arg(comController.GetName()), QString());
|
---|
486 | /* Populate map (its sorted!): */
|
---|
487 | QMap<StorageSlot, QString> attachmentsMap;
|
---|
488 | foreach (const CMediumAttachment &attachment, comMachine.GetMediumAttachmentsOfController(comController.GetName()))
|
---|
489 | {
|
---|
490 | /* Acquire device type first of all: */
|
---|
491 | const KDeviceType enmDeviceType = attachment.GetType();
|
---|
492 |
|
---|
493 | /* Ignore restricted device types: */
|
---|
494 | if ( ( !(fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeStorage_HardDisks)
|
---|
495 | && enmDeviceType == KDeviceType_HardDisk)
|
---|
496 | || ( !(fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeStorage_OpticalDevices)
|
---|
497 | && enmDeviceType == KDeviceType_DVD)
|
---|
498 | || ( !(fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeStorage_FloppyDevices)
|
---|
499 | && enmDeviceType == KDeviceType_Floppy))
|
---|
500 | continue;
|
---|
501 |
|
---|
502 | /* Prepare current storage slot: */
|
---|
503 | const StorageSlot attachmentSlot(comController.GetBus(), attachment.GetPort(), attachment.GetDevice());
|
---|
504 | AssertMsg(comController.isOk(),
|
---|
505 | ("Unable to acquire controller data: %s\n",
|
---|
506 | UIErrorString::formatRC(comController.lastRC()).toUtf8().constData()));
|
---|
507 | if (!comController.isOk())
|
---|
508 | continue;
|
---|
509 |
|
---|
510 | /* Prepare attachment information: */
|
---|
511 | QString strAttachmentInfo = uiCommon().details(attachment.GetMedium(), false, false);
|
---|
512 | /* That hack makes sure 'Inaccessible' word is always bold: */
|
---|
513 | { // hack
|
---|
514 | const QString strInaccessibleString(UICommon::tr("Inaccessible", "medium"));
|
---|
515 | const QString strBoldInaccessibleString(QString("<b>%1</b>").arg(strInaccessibleString));
|
---|
516 | strAttachmentInfo.replace(strInaccessibleString, strBoldInaccessibleString);
|
---|
517 | } // hack
|
---|
518 |
|
---|
519 | /* Append 'device slot name' with 'device type name' for optical devices only: */
|
---|
520 | QString strDeviceType = enmDeviceType == KDeviceType_DVD
|
---|
521 | ? QApplication::translate("UIDetails", "[Optical Drive]", "details (storage)")
|
---|
522 | : QString();
|
---|
523 | if (!strDeviceType.isNull())
|
---|
524 | strDeviceType.append(' ');
|
---|
525 |
|
---|
526 | /* Insert that attachment information into the map: */
|
---|
527 | if (!strAttachmentInfo.isNull())
|
---|
528 | {
|
---|
529 | /* Configure hovering anchors: */
|
---|
530 | const QString strAnchorType = enmDeviceType == KDeviceType_DVD || enmDeviceType == KDeviceType_Floppy ? QString("mount") :
|
---|
531 | enmDeviceType == KDeviceType_HardDisk ? QString("attach") : QString();
|
---|
532 | const CMedium medium = attachment.GetMedium();
|
---|
533 | const QString strMediumLocation = medium.isNull() ? QString() : medium.GetLocation();
|
---|
534 | if (fLink)
|
---|
535 | attachmentsMap.insert(attachmentSlot,
|
---|
536 | QString("<a href=#%1,%2,%3,%4>%5</a>")
|
---|
537 | .arg(strAnchorType,
|
---|
538 | comController.GetName(),
|
---|
539 | gpConverter->toString(attachmentSlot),
|
---|
540 | strMediumLocation,
|
---|
541 | strDeviceType + strAttachmentInfo));
|
---|
542 | else
|
---|
543 | attachmentsMap.insert(attachmentSlot,
|
---|
544 | QString("%1")
|
---|
545 | .arg(strDeviceType + strAttachmentInfo));
|
---|
546 | }
|
---|
547 | }
|
---|
548 |
|
---|
549 | /* Iterate over the sorted map: */
|
---|
550 | const QList<StorageSlot> storageSlots = attachmentsMap.keys();
|
---|
551 | const QList<QString> storageInfo = attachmentsMap.values();
|
---|
552 | for (int i = 0; i < storageSlots.size(); ++i)
|
---|
553 | table << UITextTableLine(QString(" ") + gpConverter->toString(storageSlots[i]), storageInfo[i]);
|
---|
554 | }
|
---|
555 | if (table.isEmpty())
|
---|
556 | table << UITextTableLine(QApplication::translate("UIDetails", "Not Attached", "details (storage)"), QString());
|
---|
557 |
|
---|
558 | return table;
|
---|
559 | }
|
---|
560 |
|
---|
561 | UITextTable UIDetailsGenerator::generateMachineInformationAudio(CMachine &comMachine,
|
---|
562 | const UIExtraDataMetaDefs::DetailsElementOptionTypeAudio &fOptions)
|
---|
563 | {
|
---|
564 | UITextTable table;
|
---|
565 |
|
---|
566 | if (comMachine.isNull())
|
---|
567 | return table;
|
---|
568 |
|
---|
569 | if (!comMachine.GetAccessible())
|
---|
570 | {
|
---|
571 | table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString());
|
---|
572 | return table;
|
---|
573 | }
|
---|
574 |
|
---|
575 | const CAudioAdapter comAudio = comMachine.GetAudioAdapter();
|
---|
576 | if (comAudio.GetEnabled())
|
---|
577 | {
|
---|
578 | /* Host driver: */
|
---|
579 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeAudio_Driver)
|
---|
580 | {
|
---|
581 | const QString strAnchorType = QString("audio_host_driver_type");
|
---|
582 | const KAudioDriverType enmType = comAudio.GetAudioDriver();
|
---|
583 | table << UITextTableLine(QApplication::translate("UIDetails", "Host Driver", "details (audio)"),
|
---|
584 | QString("<a href=#%1,%2>%3</a>")
|
---|
585 | .arg(strAnchorType)
|
---|
586 | .arg((int)enmType)
|
---|
587 | .arg(gpConverter->toString(enmType)));
|
---|
588 | }
|
---|
589 |
|
---|
590 | /* Controller: */
|
---|
591 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeAudio_Controller)
|
---|
592 | {
|
---|
593 | const QString strAnchorType = QString("audio_controller_type");
|
---|
594 | const KAudioControllerType enmType = comAudio.GetAudioController();
|
---|
595 | table << UITextTableLine(QApplication::translate("UIDetails", "Controller", "details (audio)"),
|
---|
596 | QString("<a href=#%1,%2>%3</a>")
|
---|
597 | .arg(strAnchorType)
|
---|
598 | .arg((int)enmType)
|
---|
599 | .arg(gpConverter->toString(enmType)));
|
---|
600 | }
|
---|
601 |
|
---|
602 | #ifdef VBOX_WITH_AUDIO_INOUT_INFO
|
---|
603 | /* Audio I/O: */
|
---|
604 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeAudio_IO)
|
---|
605 | {
|
---|
606 | table << UITextTableLine(QApplication::translate("UIDetails", "Audio Input", "details (audio)"),
|
---|
607 | comAudio.GetEnabledIn() ?
|
---|
608 | QApplication::translate("UIDetails", "Enabled", "details (audio/input)") :
|
---|
609 | QApplication::translate("UIDetails", "Disabled", "details (audio/input)"));
|
---|
610 | table << UITextTableLine(QApplication::translate("UIDetails", "Audio Output", "details (audio)"),
|
---|
611 | comAudio.GetEnabledOut() ?
|
---|
612 | QApplication::translate("UIDetails", "Enabled", "details (audio/output)") :
|
---|
613 | QApplication::translate("UIDetails", "Disabled", "details (audio/output)"));
|
---|
614 | }
|
---|
615 | #endif /* VBOX_WITH_AUDIO_INOUT_INFO */
|
---|
616 | }
|
---|
617 | else
|
---|
618 | table << UITextTableLine(QApplication::translate("UIDetails", "Disabled", "details (audio)"),
|
---|
619 | QString());
|
---|
620 |
|
---|
621 | return table;
|
---|
622 | }
|
---|
623 |
|
---|
624 | QString summarizeGenericProperties(const CNetworkAdapter &comAdapter)
|
---|
625 | {
|
---|
626 | QVector<QString> names;
|
---|
627 | QVector<QString> props;
|
---|
628 | props = comAdapter.GetProperties(QString(), names);
|
---|
629 | QString strResult;
|
---|
630 | for (int i = 0; i < names.size(); ++i)
|
---|
631 | {
|
---|
632 | strResult += names[i] + "=" + props[i];
|
---|
633 | if (i < names.size() - 1)
|
---|
634 | strResult += ", ";
|
---|
635 | }
|
---|
636 | return strResult;
|
---|
637 | }
|
---|
638 |
|
---|
639 | UITextTable UIDetailsGenerator::generateMachineInformationNetwork(CMachine &comMachine,
|
---|
640 | const UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork &fOptions)
|
---|
641 | {
|
---|
642 | UITextTable table;
|
---|
643 |
|
---|
644 | if (comMachine.isNull())
|
---|
645 | return table;
|
---|
646 |
|
---|
647 | if (!comMachine.GetAccessible())
|
---|
648 | {
|
---|
649 | table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString());
|
---|
650 | return table;
|
---|
651 | }
|
---|
652 |
|
---|
653 | /* Iterate over all the adapters: */
|
---|
654 | const ulong uCount = uiCommon().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(comMachine.GetChipsetType());
|
---|
655 | for (ulong uSlot = 0; uSlot < uCount; ++uSlot)
|
---|
656 | {
|
---|
657 | const QString strAnchorType = QString("network_attachment_type");
|
---|
658 | const CNetworkAdapter comAdapter = comMachine.GetNetworkAdapter(uSlot);
|
---|
659 |
|
---|
660 | /* Skip disabled adapters: */
|
---|
661 | if (!comAdapter.GetEnabled())
|
---|
662 | continue;
|
---|
663 |
|
---|
664 | /* Gather adapter information: */
|
---|
665 | const KNetworkAttachmentType enmAttachmentType = comAdapter.GetAttachmentType();
|
---|
666 | const QString strAttachmentTemplate = gpConverter->toString(comAdapter.GetAdapterType()).replace(QRegExp("\\s\\(.+\\)"), " (<a href=#%1,%2;%3;%4>%5</a>)");
|
---|
667 | QString strAttachmentType;
|
---|
668 | switch (enmAttachmentType)
|
---|
669 | {
|
---|
670 | case KNetworkAttachmentType_NAT:
|
---|
671 | {
|
---|
672 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_NAT)
|
---|
673 | strAttachmentType = strAttachmentTemplate
|
---|
674 | .arg(strAnchorType)
|
---|
675 | .arg(uSlot)
|
---|
676 | .arg((int)KNetworkAttachmentType_NAT)
|
---|
677 | .arg(QString())
|
---|
678 | .arg(gpConverter->toString(KNetworkAttachmentType_NAT));
|
---|
679 | break;
|
---|
680 | }
|
---|
681 | case KNetworkAttachmentType_Bridged:
|
---|
682 | {
|
---|
683 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_BridgetAdapter)
|
---|
684 | {
|
---|
685 | const QString strName = comAdapter.GetBridgedInterface();
|
---|
686 | strAttachmentType = strAttachmentTemplate
|
---|
687 | .arg(strAnchorType)
|
---|
688 | .arg(uSlot)
|
---|
689 | .arg((int)KNetworkAttachmentType_Bridged)
|
---|
690 | .arg(strName)
|
---|
691 | .arg(QApplication::translate("UIDetails", "Bridged Adapter, %1", "details (network)")
|
---|
692 | .arg(strName));
|
---|
693 | }
|
---|
694 | break;
|
---|
695 | }
|
---|
696 | case KNetworkAttachmentType_Internal:
|
---|
697 | {
|
---|
698 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_InternalNetwork)
|
---|
699 | {
|
---|
700 | const QString strName = comAdapter.GetInternalNetwork();
|
---|
701 | strAttachmentType = strAttachmentTemplate
|
---|
702 | .arg(strAnchorType)
|
---|
703 | .arg(uSlot)
|
---|
704 | .arg((int)KNetworkAttachmentType_Internal)
|
---|
705 | .arg(strName)
|
---|
706 | .arg(QApplication::translate("UIDetails", "Internal Network, '%1'", "details (network)")
|
---|
707 | .arg(strName));
|
---|
708 | }
|
---|
709 | break;
|
---|
710 | }
|
---|
711 | case KNetworkAttachmentType_HostOnly:
|
---|
712 | {
|
---|
713 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_HostOnlyAdapter)
|
---|
714 | {
|
---|
715 | const QString strName = comAdapter.GetHostOnlyInterface();
|
---|
716 | strAttachmentType = strAttachmentTemplate
|
---|
717 | .arg(strAnchorType)
|
---|
718 | .arg(uSlot)
|
---|
719 | .arg((int)KNetworkAttachmentType_HostOnly)
|
---|
720 | .arg(strName)
|
---|
721 | .arg(QApplication::translate("UIDetails", "Host-only Adapter, '%1'", "details (network)")
|
---|
722 | .arg(strName));
|
---|
723 | }
|
---|
724 | break;
|
---|
725 | }
|
---|
726 | case KNetworkAttachmentType_Generic:
|
---|
727 | {
|
---|
728 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_GenericDriver)
|
---|
729 | {
|
---|
730 | const QString strName = comAdapter.GetGenericDriver();
|
---|
731 | const QString strGenericDriverProperties(summarizeGenericProperties(comAdapter));
|
---|
732 | strAttachmentType = strGenericDriverProperties.isNull()
|
---|
733 | ? strAttachmentTemplate
|
---|
734 | .arg(strAnchorType)
|
---|
735 | .arg(uSlot)
|
---|
736 | .arg((int)KNetworkAttachmentType_Generic)
|
---|
737 | .arg(strName)
|
---|
738 | .arg(QApplication::translate("UIDetails", "Generic Driver, '%1'", "details (network)")
|
---|
739 | .arg(strName))
|
---|
740 | : strAttachmentTemplate
|
---|
741 | .arg(strAnchorType)
|
---|
742 | .arg(uSlot)
|
---|
743 | .arg((int)KNetworkAttachmentType_Generic)
|
---|
744 | .arg(strName)
|
---|
745 | .arg(QApplication::translate("UIDetails", "Generic Driver, '%1' { %2 }", "details (network)")
|
---|
746 | .arg(strName, strGenericDriverProperties));
|
---|
747 | }
|
---|
748 | break;
|
---|
749 | }
|
---|
750 | case KNetworkAttachmentType_NATNetwork:
|
---|
751 | {
|
---|
752 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_NATNetwork)
|
---|
753 | {
|
---|
754 | const QString strName = comAdapter.GetNATNetwork();
|
---|
755 | strAttachmentType = strAttachmentTemplate
|
---|
756 | .arg(strAnchorType)
|
---|
757 | .arg(uSlot)
|
---|
758 | .arg((int)KNetworkAttachmentType_NATNetwork)
|
---|
759 | .arg(strName)
|
---|
760 | .arg(QApplication::translate("UIDetails", "NAT Network, '%1'", "details (network)")
|
---|
761 | .arg(strName));
|
---|
762 | }
|
---|
763 | break;
|
---|
764 | }
|
---|
765 | default:
|
---|
766 | {
|
---|
767 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_NotAttached)
|
---|
768 | strAttachmentType = strAttachmentTemplate
|
---|
769 | .arg(strAnchorType)
|
---|
770 | .arg(uSlot)
|
---|
771 | .arg((int)enmAttachmentType)
|
---|
772 | .arg(QString())
|
---|
773 | .arg(gpConverter->toString(enmAttachmentType));
|
---|
774 | break;
|
---|
775 | }
|
---|
776 | }
|
---|
777 | if (!strAttachmentType.isNull())
|
---|
778 | table << UITextTableLine(QApplication::translate("UIDetails", "Adapter %1", "details (network)").arg(comAdapter.GetSlot() + 1), strAttachmentType);
|
---|
779 | }
|
---|
780 | if (table.isEmpty())
|
---|
781 | table << UITextTableLine(QApplication::translate("UIDetails", "Disabled", "details (network/adapter)"), QString());
|
---|
782 |
|
---|
783 | return table;
|
---|
784 | }
|
---|
785 |
|
---|
786 | UITextTable UIDetailsGenerator::generateMachineInformationSerial(CMachine &comMachine,
|
---|
787 | const UIExtraDataMetaDefs::DetailsElementOptionTypeSerial &fOptions)
|
---|
788 | {
|
---|
789 | UITextTable table;
|
---|
790 |
|
---|
791 | if (comMachine.isNull())
|
---|
792 | return table;
|
---|
793 |
|
---|
794 | if (!comMachine.GetAccessible())
|
---|
795 | {
|
---|
796 | table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString());
|
---|
797 | return table;
|
---|
798 | }
|
---|
799 |
|
---|
800 | /* Iterate over all the ports: */
|
---|
801 | const ulong uCount = uiCommon().virtualBox().GetSystemProperties().GetSerialPortCount();
|
---|
802 | for (ulong uSlot = 0; uSlot < uCount; ++uSlot)
|
---|
803 | {
|
---|
804 | const CSerialPort comPort = comMachine.GetSerialPort(uSlot);
|
---|
805 |
|
---|
806 | /* Skip disabled adapters: */
|
---|
807 | if (!comPort.GetEnabled())
|
---|
808 | continue;
|
---|
809 |
|
---|
810 | /* Gather port information: */
|
---|
811 | const KPortMode enmMode = comPort.GetHostMode();
|
---|
812 | const QString strModeTemplate = uiCommon().toCOMPortName(comPort.GetIRQ(), comPort.GetIOBase()) + ", ";
|
---|
813 | QString strModeType;
|
---|
814 | switch (enmMode)
|
---|
815 | {
|
---|
816 | case KPortMode_HostPipe:
|
---|
817 | {
|
---|
818 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_HostPipe)
|
---|
819 | strModeType = strModeTemplate + QString("%1 (%2)").arg(gpConverter->toString(enmMode)).arg(QDir::toNativeSeparators(comPort.GetPath()));
|
---|
820 | break;
|
---|
821 | }
|
---|
822 | case KPortMode_HostDevice:
|
---|
823 | {
|
---|
824 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_HostDevice)
|
---|
825 | strModeType = strModeTemplate + QString("%1 (%2)").arg(gpConverter->toString(enmMode)).arg(QDir::toNativeSeparators(comPort.GetPath()));
|
---|
826 | break;
|
---|
827 | }
|
---|
828 | case KPortMode_RawFile:
|
---|
829 | {
|
---|
830 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_RawFile)
|
---|
831 | strModeType = strModeTemplate + QString("%1 (%2)").arg(gpConverter->toString(enmMode)).arg(QDir::toNativeSeparators(comPort.GetPath()));
|
---|
832 | break;
|
---|
833 | }
|
---|
834 | case KPortMode_TCP:
|
---|
835 | {
|
---|
836 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_TCP)
|
---|
837 | strModeType = strModeTemplate + QString("%1 (%2)").arg(gpConverter->toString(enmMode)).arg(QDir::toNativeSeparators(comPort.GetPath()));
|
---|
838 | break;
|
---|
839 | }
|
---|
840 | default:
|
---|
841 | {
|
---|
842 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_Disconnected)
|
---|
843 | strModeType = strModeTemplate + gpConverter->toString(enmMode);
|
---|
844 | break;
|
---|
845 | }
|
---|
846 | }
|
---|
847 | if (!strModeType.isNull())
|
---|
848 | table << UITextTableLine(QApplication::translate("UIDetails", "Port %1", "details (serial)").arg(comPort.GetSlot() + 1), strModeType);
|
---|
849 | }
|
---|
850 | if (table.isEmpty())
|
---|
851 | table << UITextTableLine(QApplication::translate("UIDetails", "Disabled", "details (serial)"), QString());
|
---|
852 |
|
---|
853 | return table;
|
---|
854 | }
|
---|
855 |
|
---|
856 | UITextTable UIDetailsGenerator::generateMachineInformationUSB(CMachine &comMachine,
|
---|
857 | const UIExtraDataMetaDefs::DetailsElementOptionTypeUsb &fOptions)
|
---|
858 | {
|
---|
859 | UITextTable table;
|
---|
860 |
|
---|
861 | if (comMachine.isNull())
|
---|
862 | return table;
|
---|
863 |
|
---|
864 | if (!comMachine.GetAccessible())
|
---|
865 | {
|
---|
866 | table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString());
|
---|
867 | return table;
|
---|
868 | }
|
---|
869 |
|
---|
870 | /* Iterate over all the USB filters: */
|
---|
871 | const CUSBDeviceFilters comFilterObject = comMachine.GetUSBDeviceFilters();
|
---|
872 | if (!comFilterObject.isNull() && comMachine.GetUSBProxyAvailable())
|
---|
873 | {
|
---|
874 | const QString strAnchorType = QString("usb_controller_type");
|
---|
875 | const CUSBControllerVector controllers = comMachine.GetUSBControllers();
|
---|
876 | if (!controllers.isEmpty())
|
---|
877 | {
|
---|
878 | /* USB controllers: */
|
---|
879 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeUsb_Controller)
|
---|
880 | {
|
---|
881 | QStringList controllerInternal;
|
---|
882 | QStringList controllersReadable;
|
---|
883 | foreach (const CUSBController &comController, controllers)
|
---|
884 | {
|
---|
885 | const KUSBControllerType enmType = comController.GetType();
|
---|
886 | controllerInternal << QString::number((int)enmType);
|
---|
887 | controllersReadable << gpConverter->toString(enmType);
|
---|
888 | }
|
---|
889 | table << UITextTableLine(QApplication::translate("UIDetails", "USB Controller", "details (usb)"),
|
---|
890 | QString("<a href=#%1,%2>%3</a>")
|
---|
891 | .arg(strAnchorType)
|
---|
892 | .arg(controllerInternal.join(';'))
|
---|
893 | .arg(controllersReadable.join(", ")));
|
---|
894 | }
|
---|
895 |
|
---|
896 | /* Device filters: */
|
---|
897 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeUsb_DeviceFilters)
|
---|
898 | {
|
---|
899 | const CUSBDeviceFilterVector filters = comFilterObject.GetDeviceFilters();
|
---|
900 | uint uActive = 0;
|
---|
901 | for (int i = 0; i < filters.size(); ++i)
|
---|
902 | if (filters.at(i).GetActive())
|
---|
903 | ++uActive;
|
---|
904 | table << UITextTableLine(QApplication::translate("UIDetails", "Device Filters", "details (usb)"),
|
---|
905 | QApplication::translate("UIDetails", "%1 (%2 active)", "details (usb)").arg(filters.size()).arg(uActive));
|
---|
906 | }
|
---|
907 | }
|
---|
908 | else
|
---|
909 | table << UITextTableLine(QString("<a href=#%1,%2>%3</a>")
|
---|
910 | .arg(strAnchorType)
|
---|
911 | .arg(QString::number((int)KUSBControllerType_Null))
|
---|
912 | .arg(QApplication::translate("UIDetails", "Disabled", "details (usb)")),
|
---|
913 | QString());
|
---|
914 | }
|
---|
915 | else
|
---|
916 | table << UITextTableLine(QApplication::translate("UIDetails", "USB Controller Inaccessible", "details (usb)"), QString());
|
---|
917 |
|
---|
918 | return table;
|
---|
919 | }
|
---|
920 |
|
---|
921 | UITextTable UIDetailsGenerator::generateMachineInformationSharedFolders(CMachine &comMachine,
|
---|
922 | const UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders &fOptions)
|
---|
923 | {
|
---|
924 | Q_UNUSED(fOptions);
|
---|
925 |
|
---|
926 | UITextTable table;
|
---|
927 |
|
---|
928 | if (comMachine.isNull())
|
---|
929 | return table;
|
---|
930 |
|
---|
931 | if (!comMachine.GetAccessible())
|
---|
932 | {
|
---|
933 | table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString());
|
---|
934 | return table;
|
---|
935 | }
|
---|
936 |
|
---|
937 | /* Summary: */
|
---|
938 | const ulong uCount = comMachine.GetSharedFolders().size();
|
---|
939 | if (uCount > 0)
|
---|
940 | table << UITextTableLine(QApplication::translate("UIDetails", "Shared Folders", "details (shared folders)"), QString::number(uCount));
|
---|
941 | else
|
---|
942 | table << UITextTableLine(QApplication::translate("UIDetails", "None", "details (shared folders)"), QString());
|
---|
943 |
|
---|
944 | return table;
|
---|
945 | }
|
---|
946 |
|
---|
947 | UITextTable UIDetailsGenerator::generateMachineInformationUI(CMachine &comMachine,
|
---|
948 | const UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface &fOptions)
|
---|
949 | {
|
---|
950 | UITextTable table;
|
---|
951 |
|
---|
952 | if (comMachine.isNull())
|
---|
953 | return table;
|
---|
954 |
|
---|
955 | if (!comMachine.GetAccessible())
|
---|
956 | {
|
---|
957 | table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString());
|
---|
958 | return table;
|
---|
959 | }
|
---|
960 |
|
---|
961 | #ifndef VBOX_WS_MAC
|
---|
962 | /* Menu-bar: */
|
---|
963 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_MenuBar)
|
---|
964 | {
|
---|
965 | const QString strAnchorType = QString("menu_bar");
|
---|
966 | const QString strMenubarEnabled = comMachine.GetExtraData(UIExtraDataDefs::GUI_MenuBar_Enabled);
|
---|
967 | const bool fEnabled = !( strMenubarEnabled.compare("false", Qt::CaseInsensitive) == 0
|
---|
968 | || strMenubarEnabled.compare("no", Qt::CaseInsensitive) == 0
|
---|
969 | || strMenubarEnabled.compare("off", Qt::CaseInsensitive) == 0
|
---|
970 | || strMenubarEnabled == "0");
|
---|
971 | table << UITextTableLine(QApplication::translate("UIDetails", "Menu-bar", "details (user interface)"),
|
---|
972 | QString("<a href=#%1,%2>%3</a>")
|
---|
973 | .arg(strAnchorType)
|
---|
974 | .arg((int)fEnabled)
|
---|
975 | .arg(fEnabled ? QApplication::translate("UIDetails", "Enabled", "details (user interface/menu-bar)")
|
---|
976 | : QApplication::translate("UIDetails", "Disabled", "details (user interface/menu-bar)")));
|
---|
977 | }
|
---|
978 | #endif /* !VBOX_WS_MAC */
|
---|
979 |
|
---|
980 | /* Status-bar: */
|
---|
981 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_StatusBar)
|
---|
982 | {
|
---|
983 | const QString strAnchorType = QString("status_bar");
|
---|
984 | const QString strStatusbarEnabled = comMachine.GetExtraData(UIExtraDataDefs::GUI_StatusBar_Enabled);
|
---|
985 | const bool fEnabled = !( strStatusbarEnabled.compare("false", Qt::CaseInsensitive) == 0
|
---|
986 | || strStatusbarEnabled.compare("no", Qt::CaseInsensitive) == 0
|
---|
987 | || strStatusbarEnabled.compare("off", Qt::CaseInsensitive) == 0
|
---|
988 | || strStatusbarEnabled == "0");
|
---|
989 | table << UITextTableLine(QApplication::translate("UIDetails", "Status-bar", "details (user interface)"),
|
---|
990 | QString("<a href=#%1,%2>%3</a>")
|
---|
991 | .arg(strAnchorType)
|
---|
992 | .arg((int)fEnabled)
|
---|
993 | .arg(fEnabled ? QApplication::translate("UIDetails", "Enabled", "details (user interface/status-bar)")
|
---|
994 | : QApplication::translate("UIDetails", "Disabled", "details (user interface/status-bar)")));
|
---|
995 | }
|
---|
996 |
|
---|
997 | #ifndef VBOX_WS_MAC
|
---|
998 | /* Mini-toolbar: */
|
---|
999 | if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_MiniToolbar)
|
---|
1000 | {
|
---|
1001 | const QString strAnchorType = QString("mini_toolbar");
|
---|
1002 | const QString strMiniToolbarEnabled = comMachine.GetExtraData(UIExtraDataDefs::GUI_ShowMiniToolBar);
|
---|
1003 | const bool fEnabled = !( strMiniToolbarEnabled.compare("false", Qt::CaseInsensitive) == 0
|
---|
1004 | || strMiniToolbarEnabled.compare("no", Qt::CaseInsensitive) == 0
|
---|
1005 | || strMiniToolbarEnabled.compare("off", Qt::CaseInsensitive) == 0
|
---|
1006 | || strMiniToolbarEnabled == "0");
|
---|
1007 | if (fEnabled)
|
---|
1008 | {
|
---|
1009 | /* Get mini-toolbar position: */
|
---|
1010 | const QString strMiniToolbarPosition = comMachine.GetExtraData(UIExtraDataDefs::GUI_MiniToolBarAlignment);
|
---|
1011 | {
|
---|
1012 | /* Try to convert loaded data to alignment: */
|
---|
1013 | switch (gpConverter->fromInternalString<MiniToolbarAlignment>(strMiniToolbarPosition))
|
---|
1014 | {
|
---|
1015 | case MiniToolbarAlignment_Top:
|
---|
1016 | table << UITextTableLine(QApplication::translate("UIDetails", "Mini-toolbar Position", "details (user interface)"),
|
---|
1017 | QString("<a href=#%1,%2>%3</a>")
|
---|
1018 | .arg(strAnchorType)
|
---|
1019 | .arg((int)MiniToolbarAlignment_Top)
|
---|
1020 | .arg(QApplication::translate("UIDetails", "Top", "details (user interface/mini-toolbar position)")));
|
---|
1021 | break;
|
---|
1022 | case MiniToolbarAlignment_Bottom:
|
---|
1023 | table << UITextTableLine(QApplication::translate("UIDetails", "Mini-toolbar Position", "details (user interface)"),
|
---|
1024 | QString("<a href=#%1,%2>%3</a>")
|
---|
1025 | .arg(strAnchorType)
|
---|
1026 | .arg((int)MiniToolbarAlignment_Bottom)
|
---|
1027 | .arg(QApplication::translate("UIDetails", "Bottom", "details (user interface/mini-toolbar position)")));
|
---|
1028 | break;
|
---|
1029 | default:
|
---|
1030 | break;
|
---|
1031 | }
|
---|
1032 | }
|
---|
1033 | }
|
---|
1034 | else
|
---|
1035 | table << UITextTableLine(QApplication::translate("UIDetails", "Mini-toolbar", "details (user interface)"),
|
---|
1036 | QString("<a href=#%1,%2>%3</a>")
|
---|
1037 | .arg(strAnchorType)
|
---|
1038 | .arg((int)MiniToolbarAlignment_Disabled)
|
---|
1039 | .arg(QApplication::translate("UIDetails", "Disabled", "details (user interface/mini-toolbar)")));
|
---|
1040 | }
|
---|
1041 | #endif /* !VBOX_WS_MAC */
|
---|
1042 |
|
---|
1043 | return table;
|
---|
1044 | }
|
---|
1045 |
|
---|
1046 | UITextTable UIDetailsGenerator::generateMachineInformationDescription(CMachine &comMachine,
|
---|
1047 | const UIExtraDataMetaDefs::DetailsElementOptionTypeDescription &fOptions)
|
---|
1048 | {
|
---|
1049 | Q_UNUSED(fOptions);
|
---|
1050 |
|
---|
1051 | UITextTable table;
|
---|
1052 |
|
---|
1053 | if (comMachine.isNull())
|
---|
1054 | return table;
|
---|
1055 |
|
---|
1056 | if (!comMachine.GetAccessible())
|
---|
1057 | {
|
---|
1058 | table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString());
|
---|
1059 | return table;
|
---|
1060 | }
|
---|
1061 |
|
---|
1062 | /* Summary: */
|
---|
1063 | const QString strDescription = comMachine.GetDescription();
|
---|
1064 | if (!strDescription.isEmpty())
|
---|
1065 | table << UITextTableLine(strDescription, QString());
|
---|
1066 | else
|
---|
1067 | table << UITextTableLine(QApplication::translate("UIDetails", "None", "details (description)"), QString());
|
---|
1068 |
|
---|
1069 | return table;
|
---|
1070 | }
|
---|