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