VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDetailsGenerator.cpp@ 86275

Last change on this file since 86275 was 86275, checked in by vboxsync, 4 years ago

FE/Qt: bugref:9653: UIDetailsElement & UIDetailsGenerator: Rework cloud VM details element & generator to be able to use IStringFormValue::getClipboardString to acquire full value name for tool-tip and copy needs.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
  • Property svn:mergeinfo set to (toggle deleted branches)
    /branches/VBox-3.0/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemMachine.cpp58652,​70973
    /branches/VBox-3.2/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemMachine.cpp66309,​66318
    /branches/VBox-4.0/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemMachine.cpp70873
    /branches/VBox-4.1/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemMachine.cpp74233
    /branches/VBox-4.2/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElement.cpp91503-91504,​91506-91508,​91510,​91514-91515,​91521
    /branches/VBox-4.3/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElement.cpp91223
    /branches/VBox-4.3/trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElement.cpp91223
    /branches/dsen/gui/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemMachine.cpp79076-79078,​79089,​79109-79110,​79112-79113,​79127-79130,​79134,​79141,​79151,​79155,​79157-79159,​79193,​79197
    /branches/dsen/gui2/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElement.cpp79562-79569,​79572-79573,​79578,​79581-79582,​79590-79591,​79598-79599,​79602-79603,​79605-79606,​79632,​79635,​79637,​79644
    /branches/dsen/gui3/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElement.cpp79645-79692
    /trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemMachine.cpp79225,​79271
File size: 51.0 KB
Line 
1/* $Id: UIDetailsGenerator.cpp 86275 2020-09-24 20:04:03Z 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
59UITextTable 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
136UITextTable 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 /* Generate value: */
169 const QString strValue = generateFormValueInformation(comIteratedValue);
170
171 /* Generate table string: */
172 table << UITextTableLine(strLabel, QString("<a href=#%1,%2>%3</a>").arg(strAnchorType, strLabel, strValue));
173 }
174 }
175
176 return table;
177}
178
179QString UIDetailsGenerator::generateFormValueInformation(const CFormValue &comFormValue, bool fFull /* = false */)
180{
181 /* Handle possible form value types: */
182 QString strResult;
183 switch (comFormValue.GetType())
184 {
185 case KFormValueType_Boolean:
186 {
187 CBooleanFormValue comValue(comFormValue);
188 const bool fBool = comValue.GetSelected();
189 strResult = fBool ? QApplication::translate("UIDetails", "Enabled", "details (cloud value)")
190 : QApplication::translate("UIDetails", "Disabled", "details (cloud value)");
191 break;
192 }
193 case KFormValueType_String:
194 {
195 CStringFormValue comValue(comFormValue);
196 const QString strValue = comValue.GetString();
197 const QString strClipboardValue = comValue.GetClipboardString();
198 strResult = fFull && !strClipboardValue.isEmpty() ? strClipboardValue : strValue;
199 break;
200 }
201 case KFormValueType_Choice:
202 {
203 AssertMsgFailed(("Aren't we decided to convert all choices to strings?\n"));
204 CChoiceFormValue comValue(comFormValue);
205 const QVector<QString> possibleValues = comValue.GetValues();
206 const int iCurrentIndex = comValue.GetSelectedIndex();
207 strResult = possibleValues.value(iCurrentIndex);
208 break;
209 }
210 case KFormValueType_RangedInteger:
211 {
212 CRangedIntegerFormValue comValue(comFormValue);
213 strResult = QString("%1 %2")
214 .arg(comValue.GetInteger())
215 .arg(QApplication::translate("UICommon", comValue.GetSuffix().toUtf8().constData()));
216 break;
217 }
218 default:
219 break;
220 }
221 /* Return result: */
222 return strResult;
223}
224
225UITextTable UIDetailsGenerator::generateMachineInformationSystem(CMachine &comMachine,
226 const UIExtraDataMetaDefs::DetailsElementOptionTypeSystem &fOptions)
227{
228 UITextTable table;
229
230 if (comMachine.isNull())
231 return table;
232
233 if (!comMachine.GetAccessible())
234 {
235 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString());
236 return table;
237 }
238
239 /* Base memory: */
240 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_RAM)
241 {
242 /* Configure hovering anchor: */
243 const QString strAnchorType = QString("base_memory");
244 const int iBaseMemory = comMachine.GetMemorySize();
245 table << UITextTableLine(QApplication::translate("UIDetails", "Base Memory", "details (system)"),
246 QString("<a href=#%1,%2>%3</a>")
247 .arg(strAnchorType)
248 .arg(iBaseMemory)
249 .arg(QApplication::translate("UIDetails", "%1 MB").arg(iBaseMemory)));
250 }
251
252 /* Processors: */
253 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_CPUCount)
254 {
255 const int cCPU = comMachine.GetCPUCount();
256 if (cCPU > 1)
257 table << UITextTableLine(QApplication::translate("UIDetails", "Processors", "details (system)"),
258 QString::number(cCPU));
259 }
260
261 /* Execution cap: */
262 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_CPUExecutionCap)
263 {
264 const int iCPUExecutionCap = comMachine.GetCPUExecutionCap();
265 if (iCPUExecutionCap < 100)
266 table << UITextTableLine(QApplication::translate("UIDetails", "Execution Cap", "details (system)"),
267 QApplication::translate("UIDetails", "%1%", "details").arg(iCPUExecutionCap));
268 }
269
270 /* Boot order: */
271 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_BootOrder)
272 {
273 /* Configure hovering anchor: */
274 const QString strAnchorType = QString("boot_order");
275 const UIBootItemDataList bootItems = loadBootItems(comMachine);
276 table << UITextTableLine(QApplication::translate("UIDetails", "Boot Order", "details (system)"),
277 QString("<a href=#%1,%2>%3</a>")
278 .arg(strAnchorType,
279 bootItemsToSerializedString(bootItems),
280 bootItemsToReadableString(bootItems)));
281 }
282
283 /* Chipset type: */
284 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_ChipsetType)
285 {
286 const KChipsetType enmChipsetType = comMachine.GetChipsetType();
287 if (enmChipsetType == KChipsetType_ICH9)
288 table << UITextTableLine(QApplication::translate("UIDetails", "Chipset Type", "details (system)"),
289 gpConverter->toString(enmChipsetType));
290 }
291
292 /* EFI: */
293 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_Firmware)
294 {
295 switch (comMachine.GetFirmwareType())
296 {
297 case KFirmwareType_EFI:
298 case KFirmwareType_EFI32:
299 case KFirmwareType_EFI64:
300 case KFirmwareType_EFIDUAL:
301 {
302 table << UITextTableLine(QApplication::translate("UIDetails", "EFI", "details (system)"),
303 QApplication::translate("UIDetails", "Enabled", "details (system/EFI)"));
304 break;
305 }
306 default:
307 {
308 // For NLS purpose:
309 QApplication::translate("UIDetails", "Disabled", "details (system/EFI)");
310 break;
311 }
312 }
313 }
314
315 /* Acceleration: */
316 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_Acceleration)
317 {
318 QStringList acceleration;
319 if (uiCommon().virtualBox().GetHost().GetProcessorFeature(KProcessorFeature_HWVirtEx))
320 {
321 /* VT-x/AMD-V: */
322 if (comMachine.GetHWVirtExProperty(KHWVirtExPropertyType_Enabled))
323 {
324 acceleration << QApplication::translate("UIDetails", "VT-x/AMD-V", "details (system)");
325 /* Nested Paging (only when hw virt is enabled): */
326 if (comMachine.GetHWVirtExProperty(KHWVirtExPropertyType_NestedPaging))
327 acceleration << QApplication::translate("UIDetails", "Nested Paging", "details (system)");
328 }
329 }
330 /* PAE/NX: */
331 if (comMachine.GetCPUProperty(KCPUPropertyType_PAE))
332 acceleration << QApplication::translate("UIDetails", "PAE/NX", "details (system)");
333 /* Paravirtualization provider: */
334 switch (comMachine.GetEffectiveParavirtProvider())
335 {
336 case KParavirtProvider_Minimal: acceleration << QApplication::translate("UIDetails", "Minimal Paravirtualization", "details (system)"); break;
337 case KParavirtProvider_HyperV: acceleration << QApplication::translate("UIDetails", "Hyper-V Paravirtualization", "details (system)"); break;
338 case KParavirtProvider_KVM: acceleration << QApplication::translate("UIDetails", "KVM Paravirtualization", "details (system)"); break;
339 default: break;
340 }
341 if (!acceleration.isEmpty())
342 table << UITextTableLine(QApplication::translate("UIDetails", "Acceleration", "details (system)"),
343 acceleration.join(", "));
344 }
345
346 return table;
347}
348
349UITextTable UIDetailsGenerator::generateMachineInformationDisplay(CMachine &comMachine,
350 const UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay &fOptions)
351{
352 UITextTable table;
353
354 if (comMachine.isNull())
355 return table;
356
357 if (!comMachine.GetAccessible())
358 {
359 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString());
360 return table;
361 }
362
363 const CGraphicsAdapter comGraphics = comMachine.GetGraphicsAdapter();
364
365 /* Video memory: */
366 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_VRAM)
367 {
368 /* Configure hovering anchor: */
369 const QString strAnchorType = QString("video_memory");
370 const int iVideoMemory = comGraphics.GetVRAMSize();
371 table << UITextTableLine(QApplication::translate("UIDetails", "Video Memory", "details (display)"),
372 QString("<a href=#%1,%2>%3</a>")
373 .arg(strAnchorType)
374 .arg(iVideoMemory)
375 .arg(QApplication::translate("UIDetails", "%1 MB").arg(iVideoMemory)));
376 }
377
378 /* Screens: */
379 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_ScreenCount)
380 {
381 const int cGuestScreens = comGraphics.GetMonitorCount();
382 if (cGuestScreens > 1)
383 table << UITextTableLine(QApplication::translate("UIDetails", "Screens", "details (display)"),
384 QString::number(cGuestScreens));
385 }
386
387 /* Scale-factor: */
388 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_ScaleFactor)
389 {
390 const QString strScaleFactor = comMachine.GetExtraData(UIExtraDataDefs::GUI_ScaleFactor);
391 {
392 /* Try to convert loaded data to double: */
393 bool fOk = false;
394 double dValue = strScaleFactor.toDouble(&fOk);
395 /* Invent the default value: */
396 if (!fOk || !dValue)
397 dValue = 1.0;
398 /* Append information: */
399 if (dValue != 1.0)
400 table << UITextTableLine(QApplication::translate("UIDetails", "Scale-factor", "details (display)"),
401 QString::number(dValue, 'f', 2));
402 }
403 }
404
405 /* Graphics Controller: */
406 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_GraphicsController)
407 {
408 const QString strAnchorType = QString("graphics_controller_type");
409 const KGraphicsControllerType enmType = comGraphics.GetGraphicsControllerType();
410 table << UITextTableLine(QApplication::translate("UIDetails", "Graphics Controller", "details (display)"),
411 QString("<a href=#%1,%2>%3</a>")
412 .arg(strAnchorType)
413 .arg((int)enmType)
414 .arg(gpConverter->toString(enmType)));
415 }
416
417 /* Acceleration: */
418 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_Acceleration)
419 {
420 QStringList acceleration;
421 /* 3D acceleration: */
422 if (comGraphics.GetAccelerate3DEnabled())
423 acceleration << QApplication::translate("UIDetails", "3D", "details (display)");
424 if (!acceleration.isEmpty())
425 table << UITextTableLine(QApplication::translate("UIDetails", "Acceleration", "details (display)"),
426 acceleration.join(", "));
427 }
428
429 /* Remote desktop server: */
430 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_VRDE)
431 {
432 const CVRDEServer comServer = comMachine.GetVRDEServer();
433 if (!comServer.isNull())
434 {
435 if (comServer.GetEnabled())
436 table << UITextTableLine(QApplication::translate("UIDetails", "Remote Desktop Server Port", "details (display/vrde)"),
437 comServer.GetVRDEProperty("TCP/Ports"));
438 else
439 table << UITextTableLine(QApplication::translate("UIDetails", "Remote Desktop Server", "details (display/vrde)"),
440 QApplication::translate("UIDetails", "Disabled", "details (display/vrde/VRDE server)"));
441 }
442 }
443
444 /* Recording: */
445 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_Recording)
446 {
447 CRecordingSettings comRecordingSettings = comMachine.GetRecordingSettings();
448 if (comRecordingSettings.GetEnabled())
449 {
450 /* For now all screens have the same config: */
451 const CRecordingScreenSettings comRecordingScreen0Settings = comRecordingSettings.GetScreenSettings(0);
452
453 /** @todo r=andy Refine these texts (wrt audio and/or video). */
454 table << UITextTableLine(QApplication::translate("UIDetails", "Recording File", "details (display/recording)"),
455 comRecordingScreen0Settings.GetFilename());
456 table << UITextTableLine(QApplication::translate("UIDetails", "Recording Attributes", "details (display/recording)"),
457 QApplication::translate("UIDetails", "Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps")
458 .arg(comRecordingScreen0Settings.GetVideoWidth()).arg(comRecordingScreen0Settings.GetVideoHeight())
459 .arg(comRecordingScreen0Settings.GetVideoFPS()).arg(comRecordingScreen0Settings.GetVideoRate()));
460 }
461 else
462 {
463 table << UITextTableLine(QApplication::translate("UIDetails", "Recording", "details (display/recording)"),
464 QApplication::translate("UIDetails", "Disabled", "details (display/recording)"));
465 }
466 }
467
468 return table;
469}
470
471UITextTable UIDetailsGenerator::generateMachineInformationStorage(CMachine &comMachine,
472 const UIExtraDataMetaDefs::DetailsElementOptionTypeStorage &fOptions,
473 bool fLink /* = true */)
474{
475 UITextTable table;
476
477 if (comMachine.isNull())
478 return table;
479
480 if (!comMachine.GetAccessible())
481 {
482 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString());
483 return table;
484 }
485
486 /* Iterate over all the machine controllers: */
487 foreach (const CStorageController &comController, comMachine.GetStorageControllers())
488 {
489 /* Add controller information: */
490 const QString strControllerName = QApplication::translate("UIMachineSettingsStorage", "Controller: %1");
491 table << UITextTableLine(strControllerName.arg(comController.GetName()), QString());
492 /* Populate map (its sorted!): */
493 QMap<StorageSlot, QString> attachmentsMap;
494 foreach (const CMediumAttachment &attachment, comMachine.GetMediumAttachmentsOfController(comController.GetName()))
495 {
496 /* Acquire device type first of all: */
497 const KDeviceType enmDeviceType = attachment.GetType();
498
499 /* Ignore restricted device types: */
500 if ( ( !(fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeStorage_HardDisks)
501 && enmDeviceType == KDeviceType_HardDisk)
502 || ( !(fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeStorage_OpticalDevices)
503 && enmDeviceType == KDeviceType_DVD)
504 || ( !(fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeStorage_FloppyDevices)
505 && enmDeviceType == KDeviceType_Floppy))
506 continue;
507
508 /* Prepare current storage slot: */
509 const StorageSlot attachmentSlot(comController.GetBus(), attachment.GetPort(), attachment.GetDevice());
510 AssertMsg(comController.isOk(),
511 ("Unable to acquire controller data: %s\n",
512 UIErrorString::formatRC(comController.lastRC()).toUtf8().constData()));
513 if (!comController.isOk())
514 continue;
515
516 /* Prepare attachment information: */
517 QString strAttachmentInfo = uiCommon().details(attachment.GetMedium(), false, false);
518 /* That hack makes sure 'Inaccessible' word is always bold: */
519 { // hack
520 const QString strInaccessibleString(UICommon::tr("Inaccessible", "medium"));
521 const QString strBoldInaccessibleString(QString("<b>%1</b>").arg(strInaccessibleString));
522 strAttachmentInfo.replace(strInaccessibleString, strBoldInaccessibleString);
523 } // hack
524
525 /* Append 'device slot name' with 'device type name' for optical devices only: */
526 QString strDeviceType = enmDeviceType == KDeviceType_DVD
527 ? QApplication::translate("UIDetails", "[Optical Drive]", "details (storage)")
528 : QString();
529 if (!strDeviceType.isNull())
530 strDeviceType.append(' ');
531
532 /* Insert that attachment information into the map: */
533 if (!strAttachmentInfo.isNull())
534 {
535 /* Configure hovering anchors: */
536 const QString strAnchorType = enmDeviceType == KDeviceType_DVD || enmDeviceType == KDeviceType_Floppy ? QString("mount") :
537 enmDeviceType == KDeviceType_HardDisk ? QString("attach") : QString();
538 const CMedium medium = attachment.GetMedium();
539 const QString strMediumLocation = medium.isNull() ? QString() : medium.GetLocation();
540 if (fLink)
541 attachmentsMap.insert(attachmentSlot,
542 QString("<a href=#%1,%2,%3,%4>%5</a>")
543 .arg(strAnchorType,
544 comController.GetName(),
545 gpConverter->toString(attachmentSlot),
546 strMediumLocation,
547 strDeviceType + strAttachmentInfo));
548 else
549 attachmentsMap.insert(attachmentSlot,
550 QString("%1")
551 .arg(strDeviceType + strAttachmentInfo));
552 }
553 }
554
555 /* Iterate over the sorted map: */
556 const QList<StorageSlot> storageSlots = attachmentsMap.keys();
557 const QList<QString> storageInfo = attachmentsMap.values();
558 for (int i = 0; i < storageSlots.size(); ++i)
559 table << UITextTableLine(QString(" ") + gpConverter->toString(storageSlots[i]), storageInfo[i]);
560 }
561 if (table.isEmpty())
562 table << UITextTableLine(QApplication::translate("UIDetails", "Not Attached", "details (storage)"), QString());
563
564 return table;
565}
566
567UITextTable UIDetailsGenerator::generateMachineInformationAudio(CMachine &comMachine,
568 const UIExtraDataMetaDefs::DetailsElementOptionTypeAudio &fOptions)
569{
570 UITextTable table;
571
572 if (comMachine.isNull())
573 return table;
574
575 if (!comMachine.GetAccessible())
576 {
577 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString());
578 return table;
579 }
580
581 const CAudioAdapter comAudio = comMachine.GetAudioAdapter();
582 if (comAudio.GetEnabled())
583 {
584 /* Host driver: */
585 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeAudio_Driver)
586 {
587 const QString strAnchorType = QString("audio_host_driver_type");
588 const KAudioDriverType enmType = comAudio.GetAudioDriver();
589 table << UITextTableLine(QApplication::translate("UIDetails", "Host Driver", "details (audio)"),
590 QString("<a href=#%1,%2>%3</a>")
591 .arg(strAnchorType)
592 .arg((int)enmType)
593 .arg(gpConverter->toString(enmType)));
594 }
595
596 /* Controller: */
597 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeAudio_Controller)
598 {
599 const QString strAnchorType = QString("audio_controller_type");
600 const KAudioControllerType enmType = comAudio.GetAudioController();
601 table << UITextTableLine(QApplication::translate("UIDetails", "Controller", "details (audio)"),
602 QString("<a href=#%1,%2>%3</a>")
603 .arg(strAnchorType)
604 .arg((int)enmType)
605 .arg(gpConverter->toString(enmType)));
606 }
607
608#ifdef VBOX_WITH_AUDIO_INOUT_INFO
609 /* Audio I/O: */
610 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeAudio_IO)
611 {
612 table << UITextTableLine(QApplication::translate("UIDetails", "Audio Input", "details (audio)"),
613 comAudio.GetEnabledIn() ?
614 QApplication::translate("UIDetails", "Enabled", "details (audio/input)") :
615 QApplication::translate("UIDetails", "Disabled", "details (audio/input)"));
616 table << UITextTableLine(QApplication::translate("UIDetails", "Audio Output", "details (audio)"),
617 comAudio.GetEnabledOut() ?
618 QApplication::translate("UIDetails", "Enabled", "details (audio/output)") :
619 QApplication::translate("UIDetails", "Disabled", "details (audio/output)"));
620 }
621#endif /* VBOX_WITH_AUDIO_INOUT_INFO */
622 }
623 else
624 table << UITextTableLine(QApplication::translate("UIDetails", "Disabled", "details (audio)"),
625 QString());
626
627 return table;
628}
629
630QString summarizeGenericProperties(const CNetworkAdapter &comAdapter)
631{
632 QVector<QString> names;
633 QVector<QString> props;
634 props = comAdapter.GetProperties(QString(), names);
635 QString strResult;
636 for (int i = 0; i < names.size(); ++i)
637 {
638 strResult += names[i] + "=" + props[i];
639 if (i < names.size() - 1)
640 strResult += ", ";
641 }
642 return strResult;
643}
644
645UITextTable UIDetailsGenerator::generateMachineInformationNetwork(CMachine &comMachine,
646 const UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork &fOptions)
647{
648 UITextTable table;
649
650 if (comMachine.isNull())
651 return table;
652
653 if (!comMachine.GetAccessible())
654 {
655 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString());
656 return table;
657 }
658
659 /* Iterate over all the adapters: */
660 const ulong uCount = uiCommon().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(comMachine.GetChipsetType());
661 for (ulong uSlot = 0; uSlot < uCount; ++uSlot)
662 {
663 const QString strAnchorType = QString("network_attachment_type");
664 const CNetworkAdapter comAdapter = comMachine.GetNetworkAdapter(uSlot);
665
666 /* Skip disabled adapters: */
667 if (!comAdapter.GetEnabled())
668 continue;
669
670 /* Gather adapter information: */
671 const KNetworkAttachmentType enmAttachmentType = comAdapter.GetAttachmentType();
672 const QString strAttachmentTemplate = gpConverter->toString(comAdapter.GetAdapterType()).replace(QRegExp("\\s\\(.+\\)"), " (<a href=#%1,%2;%3;%4>%5</a>)");
673 QString strAttachmentType;
674 switch (enmAttachmentType)
675 {
676 case KNetworkAttachmentType_NAT:
677 {
678 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_NAT)
679 strAttachmentType = strAttachmentTemplate
680 .arg(strAnchorType)
681 .arg(uSlot)
682 .arg((int)KNetworkAttachmentType_NAT)
683 .arg(QString())
684 .arg(gpConverter->toString(KNetworkAttachmentType_NAT));
685 break;
686 }
687 case KNetworkAttachmentType_Bridged:
688 {
689 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_BridgetAdapter)
690 {
691 const QString strName = comAdapter.GetBridgedInterface();
692 strAttachmentType = strAttachmentTemplate
693 .arg(strAnchorType)
694 .arg(uSlot)
695 .arg((int)KNetworkAttachmentType_Bridged)
696 .arg(strName)
697 .arg(QApplication::translate("UIDetails", "Bridged Adapter, %1", "details (network)")
698 .arg(strName));
699 }
700 break;
701 }
702 case KNetworkAttachmentType_Internal:
703 {
704 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_InternalNetwork)
705 {
706 const QString strName = comAdapter.GetInternalNetwork();
707 strAttachmentType = strAttachmentTemplate
708 .arg(strAnchorType)
709 .arg(uSlot)
710 .arg((int)KNetworkAttachmentType_Internal)
711 .arg(strName)
712 .arg(QApplication::translate("UIDetails", "Internal Network, '%1'", "details (network)")
713 .arg(strName));
714 }
715 break;
716 }
717 case KNetworkAttachmentType_HostOnly:
718 {
719 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_HostOnlyAdapter)
720 {
721 const QString strName = comAdapter.GetHostOnlyInterface();
722 strAttachmentType = strAttachmentTemplate
723 .arg(strAnchorType)
724 .arg(uSlot)
725 .arg((int)KNetworkAttachmentType_HostOnly)
726 .arg(strName)
727 .arg(QApplication::translate("UIDetails", "Host-only Adapter, '%1'", "details (network)")
728 .arg(strName));
729 }
730 break;
731 }
732 case KNetworkAttachmentType_Generic:
733 {
734 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_GenericDriver)
735 {
736 const QString strName = comAdapter.GetGenericDriver();
737 const QString strGenericDriverProperties(summarizeGenericProperties(comAdapter));
738 strAttachmentType = strGenericDriverProperties.isNull()
739 ? strAttachmentTemplate
740 .arg(strAnchorType)
741 .arg(uSlot)
742 .arg((int)KNetworkAttachmentType_Generic)
743 .arg(strName)
744 .arg(QApplication::translate("UIDetails", "Generic Driver, '%1'", "details (network)")
745 .arg(strName))
746 : strAttachmentTemplate
747 .arg(strAnchorType)
748 .arg(uSlot)
749 .arg((int)KNetworkAttachmentType_Generic)
750 .arg(strName)
751 .arg(QApplication::translate("UIDetails", "Generic Driver, '%1' { %2 }", "details (network)")
752 .arg(strName, strGenericDriverProperties));
753 }
754 break;
755 }
756 case KNetworkAttachmentType_NATNetwork:
757 {
758 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_NATNetwork)
759 {
760 const QString strName = comAdapter.GetNATNetwork();
761 strAttachmentType = strAttachmentTemplate
762 .arg(strAnchorType)
763 .arg(uSlot)
764 .arg((int)KNetworkAttachmentType_NATNetwork)
765 .arg(strName)
766 .arg(QApplication::translate("UIDetails", "NAT Network, '%1'", "details (network)")
767 .arg(strName));
768 }
769 break;
770 }
771 default:
772 {
773 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_NotAttached)
774 strAttachmentType = strAttachmentTemplate
775 .arg(strAnchorType)
776 .arg(uSlot)
777 .arg((int)enmAttachmentType)
778 .arg(QString())
779 .arg(gpConverter->toString(enmAttachmentType));
780 break;
781 }
782 }
783 if (!strAttachmentType.isNull())
784 table << UITextTableLine(QApplication::translate("UIDetails", "Adapter %1", "details (network)").arg(comAdapter.GetSlot() + 1), strAttachmentType);
785 }
786 if (table.isEmpty())
787 table << UITextTableLine(QApplication::translate("UIDetails", "Disabled", "details (network/adapter)"), QString());
788
789 return table;
790}
791
792UITextTable UIDetailsGenerator::generateMachineInformationSerial(CMachine &comMachine,
793 const UIExtraDataMetaDefs::DetailsElementOptionTypeSerial &fOptions)
794{
795 UITextTable table;
796
797 if (comMachine.isNull())
798 return table;
799
800 if (!comMachine.GetAccessible())
801 {
802 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString());
803 return table;
804 }
805
806 /* Iterate over all the ports: */
807 const ulong uCount = uiCommon().virtualBox().GetSystemProperties().GetSerialPortCount();
808 for (ulong uSlot = 0; uSlot < uCount; ++uSlot)
809 {
810 const CSerialPort comPort = comMachine.GetSerialPort(uSlot);
811
812 /* Skip disabled adapters: */
813 if (!comPort.GetEnabled())
814 continue;
815
816 /* Gather port information: */
817 const KPortMode enmMode = comPort.GetHostMode();
818 const QString strModeTemplate = uiCommon().toCOMPortName(comPort.GetIRQ(), comPort.GetIOBase()) + ", ";
819 QString strModeType;
820 switch (enmMode)
821 {
822 case KPortMode_HostPipe:
823 {
824 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_HostPipe)
825 strModeType = strModeTemplate + QString("%1 (%2)").arg(gpConverter->toString(enmMode)).arg(QDir::toNativeSeparators(comPort.GetPath()));
826 break;
827 }
828 case KPortMode_HostDevice:
829 {
830 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_HostDevice)
831 strModeType = strModeTemplate + QString("%1 (%2)").arg(gpConverter->toString(enmMode)).arg(QDir::toNativeSeparators(comPort.GetPath()));
832 break;
833 }
834 case KPortMode_RawFile:
835 {
836 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_RawFile)
837 strModeType = strModeTemplate + QString("%1 (%2)").arg(gpConverter->toString(enmMode)).arg(QDir::toNativeSeparators(comPort.GetPath()));
838 break;
839 }
840 case KPortMode_TCP:
841 {
842 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_TCP)
843 strModeType = strModeTemplate + QString("%1 (%2)").arg(gpConverter->toString(enmMode)).arg(QDir::toNativeSeparators(comPort.GetPath()));
844 break;
845 }
846 default:
847 {
848 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_Disconnected)
849 strModeType = strModeTemplate + gpConverter->toString(enmMode);
850 break;
851 }
852 }
853 if (!strModeType.isNull())
854 table << UITextTableLine(QApplication::translate("UIDetails", "Port %1", "details (serial)").arg(comPort.GetSlot() + 1), strModeType);
855 }
856 if (table.isEmpty())
857 table << UITextTableLine(QApplication::translate("UIDetails", "Disabled", "details (serial)"), QString());
858
859 return table;
860}
861
862UITextTable UIDetailsGenerator::generateMachineInformationUSB(CMachine &comMachine,
863 const UIExtraDataMetaDefs::DetailsElementOptionTypeUsb &fOptions)
864{
865 UITextTable table;
866
867 if (comMachine.isNull())
868 return table;
869
870 if (!comMachine.GetAccessible())
871 {
872 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString());
873 return table;
874 }
875
876 /* Iterate over all the USB filters: */
877 const CUSBDeviceFilters comFilterObject = comMachine.GetUSBDeviceFilters();
878 if (!comFilterObject.isNull() && comMachine.GetUSBProxyAvailable())
879 {
880 const QString strAnchorType = QString("usb_controller_type");
881 const CUSBControllerVector controllers = comMachine.GetUSBControllers();
882 if (!controllers.isEmpty())
883 {
884 /* USB controllers: */
885 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeUsb_Controller)
886 {
887 QStringList controllerInternal;
888 QStringList controllersReadable;
889 foreach (const CUSBController &comController, controllers)
890 {
891 const KUSBControllerType enmType = comController.GetType();
892 controllerInternal << QString::number((int)enmType);
893 controllersReadable << gpConverter->toString(enmType);
894 }
895 table << UITextTableLine(QApplication::translate("UIDetails", "USB Controller", "details (usb)"),
896 QString("<a href=#%1,%2>%3</a>")
897 .arg(strAnchorType)
898 .arg(controllerInternal.join(';'))
899 .arg(controllersReadable.join(", ")));
900 }
901
902 /* Device filters: */
903 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeUsb_DeviceFilters)
904 {
905 const CUSBDeviceFilterVector filters = comFilterObject.GetDeviceFilters();
906 uint uActive = 0;
907 for (int i = 0; i < filters.size(); ++i)
908 if (filters.at(i).GetActive())
909 ++uActive;
910 table << UITextTableLine(QApplication::translate("UIDetails", "Device Filters", "details (usb)"),
911 QApplication::translate("UIDetails", "%1 (%2 active)", "details (usb)").arg(filters.size()).arg(uActive));
912 }
913 }
914 else
915 table << UITextTableLine(QString("<a href=#%1,%2>%3</a>")
916 .arg(strAnchorType)
917 .arg(QString::number((int)KUSBControllerType_Null))
918 .arg(QApplication::translate("UIDetails", "Disabled", "details (usb)")),
919 QString());
920 }
921 else
922 table << UITextTableLine(QApplication::translate("UIDetails", "USB Controller Inaccessible", "details (usb)"), QString());
923
924 return table;
925}
926
927UITextTable UIDetailsGenerator::generateMachineInformationSharedFolders(CMachine &comMachine,
928 const UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders &fOptions)
929{
930 Q_UNUSED(fOptions);
931
932 UITextTable table;
933
934 if (comMachine.isNull())
935 return table;
936
937 if (!comMachine.GetAccessible())
938 {
939 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString());
940 return table;
941 }
942
943 /* Summary: */
944 const ulong uCount = comMachine.GetSharedFolders().size();
945 if (uCount > 0)
946 table << UITextTableLine(QApplication::translate("UIDetails", "Shared Folders", "details (shared folders)"), QString::number(uCount));
947 else
948 table << UITextTableLine(QApplication::translate("UIDetails", "None", "details (shared folders)"), QString());
949
950 return table;
951}
952
953UITextTable UIDetailsGenerator::generateMachineInformationUI(CMachine &comMachine,
954 const UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface &fOptions)
955{
956 UITextTable table;
957
958 if (comMachine.isNull())
959 return table;
960
961 if (!comMachine.GetAccessible())
962 {
963 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString());
964 return table;
965 }
966
967 /* Visual state: */
968 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_VisualState)
969 {
970 const QString strAnchorType = QString("visual_state");
971 const QString strEnabledFullscreen = comMachine.GetExtraData(UIExtraDataDefs::GUI_Fullscreen);
972 const QString strEnabledSeamless = comMachine.GetExtraData(UIExtraDataDefs::GUI_Seamless);
973 const QString strEnabledScale = comMachine.GetExtraData(UIExtraDataDefs::GUI_Scale);
974 UIVisualStateType enmType = UIVisualStateType_Normal;
975 if ( strEnabledFullscreen.compare("true", Qt::CaseInsensitive) == 0
976 || strEnabledFullscreen.compare("yes", Qt::CaseInsensitive) == 0
977 || strEnabledFullscreen.compare("on", Qt::CaseInsensitive) == 0
978 || strEnabledFullscreen == "1")
979 enmType = UIVisualStateType_Fullscreen;
980 else
981 if ( strEnabledSeamless.compare("true", Qt::CaseInsensitive) == 0
982 || strEnabledSeamless.compare("yes", Qt::CaseInsensitive) == 0
983 || strEnabledSeamless.compare("on", Qt::CaseInsensitive) == 0
984 || strEnabledSeamless == "1")
985 enmType = UIVisualStateType_Seamless;
986 else
987 if ( strEnabledScale.compare("true", Qt::CaseInsensitive) == 0
988 || strEnabledScale.compare("yes", Qt::CaseInsensitive) == 0
989 || strEnabledScale.compare("on", Qt::CaseInsensitive) == 0
990 || strEnabledScale == "1")
991 enmType = UIVisualStateType_Scale;
992 const QString strVisualState = gpConverter->toString(enmType);
993 table << UITextTableLine(QApplication::translate("UIDetails", "Visual State", "details (user interface)"),
994 QString("<a href=#%1,%2>%3</a>")
995 .arg(strAnchorType)
996 .arg(enmType)
997 .arg(strVisualState));
998 }
999
1000#ifndef VBOX_WS_MAC
1001 /* Menu-bar: */
1002 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_MenuBar)
1003 {
1004 const QString strAnchorType = QString("menu_bar");
1005 const QString strMenubarEnabled = comMachine.GetExtraData(UIExtraDataDefs::GUI_MenuBar_Enabled);
1006 const bool fEnabled = !( strMenubarEnabled.compare("false", Qt::CaseInsensitive) == 0
1007 || strMenubarEnabled.compare("no", Qt::CaseInsensitive) == 0
1008 || strMenubarEnabled.compare("off", Qt::CaseInsensitive) == 0
1009 || strMenubarEnabled == "0");
1010 table << UITextTableLine(QApplication::translate("UIDetails", "Menu-bar", "details (user interface)"),
1011 QString("<a href=#%1,%2>%3</a>")
1012 .arg(strAnchorType)
1013 .arg((int)fEnabled)
1014 .arg(fEnabled ? QApplication::translate("UIDetails", "Enabled", "details (user interface/menu-bar)")
1015 : QApplication::translate("UIDetails", "Disabled", "details (user interface/menu-bar)")));
1016 }
1017#endif /* !VBOX_WS_MAC */
1018
1019 /* Status-bar: */
1020 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_StatusBar)
1021 {
1022 const QString strAnchorType = QString("status_bar");
1023 const QString strStatusbarEnabled = comMachine.GetExtraData(UIExtraDataDefs::GUI_StatusBar_Enabled);
1024 const bool fEnabled = !( strStatusbarEnabled.compare("false", Qt::CaseInsensitive) == 0
1025 || strStatusbarEnabled.compare("no", Qt::CaseInsensitive) == 0
1026 || strStatusbarEnabled.compare("off", Qt::CaseInsensitive) == 0
1027 || strStatusbarEnabled == "0");
1028 table << UITextTableLine(QApplication::translate("UIDetails", "Status-bar", "details (user interface)"),
1029 QString("<a href=#%1,%2>%3</a>")
1030 .arg(strAnchorType)
1031 .arg((int)fEnabled)
1032 .arg(fEnabled ? QApplication::translate("UIDetails", "Enabled", "details (user interface/status-bar)")
1033 : QApplication::translate("UIDetails", "Disabled", "details (user interface/status-bar)")));
1034 }
1035
1036#ifndef VBOX_WS_MAC
1037 /* Mini-toolbar: */
1038 if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_MiniToolbar)
1039 {
1040 const QString strAnchorType = QString("mini_toolbar");
1041 const QString strMiniToolbarEnabled = comMachine.GetExtraData(UIExtraDataDefs::GUI_ShowMiniToolBar);
1042 const bool fEnabled = !( strMiniToolbarEnabled.compare("false", Qt::CaseInsensitive) == 0
1043 || strMiniToolbarEnabled.compare("no", Qt::CaseInsensitive) == 0
1044 || strMiniToolbarEnabled.compare("off", Qt::CaseInsensitive) == 0
1045 || strMiniToolbarEnabled == "0");
1046 if (fEnabled)
1047 {
1048 /* Get mini-toolbar position: */
1049 const QString strMiniToolbarPosition = comMachine.GetExtraData(UIExtraDataDefs::GUI_MiniToolBarAlignment);
1050 {
1051 /* Try to convert loaded data to alignment: */
1052 switch (gpConverter->fromInternalString<MiniToolbarAlignment>(strMiniToolbarPosition))
1053 {
1054 case MiniToolbarAlignment_Top:
1055 table << UITextTableLine(QApplication::translate("UIDetails", "Mini-toolbar Position", "details (user interface)"),
1056 QString("<a href=#%1,%2>%3</a>")
1057 .arg(strAnchorType)
1058 .arg((int)MiniToolbarAlignment_Top)
1059 .arg(QApplication::translate("UIDetails", "Top", "details (user interface/mini-toolbar position)")));
1060 break;
1061 case MiniToolbarAlignment_Bottom:
1062 table << UITextTableLine(QApplication::translate("UIDetails", "Mini-toolbar Position", "details (user interface)"),
1063 QString("<a href=#%1,%2>%3</a>")
1064 .arg(strAnchorType)
1065 .arg((int)MiniToolbarAlignment_Bottom)
1066 .arg(QApplication::translate("UIDetails", "Bottom", "details (user interface/mini-toolbar position)")));
1067 break;
1068 default:
1069 break;
1070 }
1071 }
1072 }
1073 else
1074 table << UITextTableLine(QApplication::translate("UIDetails", "Mini-toolbar", "details (user interface)"),
1075 QString("<a href=#%1,%2>%3</a>")
1076 .arg(strAnchorType)
1077 .arg((int)MiniToolbarAlignment_Disabled)
1078 .arg(QApplication::translate("UIDetails", "Disabled", "details (user interface/mini-toolbar)")));
1079 }
1080#endif /* !VBOX_WS_MAC */
1081
1082 return table;
1083}
1084
1085UITextTable UIDetailsGenerator::generateMachineInformationDescription(CMachine &comMachine,
1086 const UIExtraDataMetaDefs::DetailsElementOptionTypeDescription &fOptions)
1087{
1088 Q_UNUSED(fOptions);
1089
1090 UITextTable table;
1091
1092 if (comMachine.isNull())
1093 return table;
1094
1095 if (!comMachine.GetAccessible())
1096 {
1097 table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString());
1098 return table;
1099 }
1100
1101 /* Summary: */
1102 const QString strDescription = comMachine.GetDescription();
1103 if (!strDescription.isEmpty())
1104 table << UITextTableLine(strDescription, QString());
1105 else
1106 table << UITextTableLine(QApplication::translate("UIDetails", "None", "details (description)"), QString());
1107
1108 return table;
1109}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette