void UIInformationItem::setText(const UITextTable &text) const { /* Clear text: */ m_text.clear(); /* For each line of the passed table: */ foreach (const UITextTableLine &line, text) { /* Lines: */ const QString strLeftLine = line.string1(); const QString strRightLine = line.string2(); /* If 2nd line is NOT empty: */ if (!strRightLine.isEmpty()) { /* Take both lines 'as is': */ m_text << UITextTableLine(strLeftLine, strRightLine); } /* If 2nd line is empty: */ else { /* Parse the 1st one to sub-lines: */ QStringList subLines = strLeftLine.split(QRegExp("\\n")); /* Parse sub-lines: */ foreach (const QString &strSubLine, subLines) m_text << UITextTableLine(strSubLine, QString()); } } /* Update text-layout: */ updateTextLayout(); }
void UIGraphicsTextPane::setText(const UITextTable &text) { /* Clear text: */ m_text.clear(); /* For each the line of the passed table: */ foreach (const UITextTableLine &line, text) { /* Lines: */ QString strLeftLine = line.first; QString strRightLine = line.second; /* If 2nd line is NOT empty: */ if (!strRightLine.isEmpty()) { /* Take both lines 'as is': */ m_text << UITextTableLine(strLeftLine, strRightLine); } /* If 2nd line is empty: */ else { /* Parse the 1st one to sub-lines: */ QStringList subLines = strLeftLine.split(QRegExp("\\n")); foreach (const QString &strSubLine, subLines) m_text << UITextTableLine(strSubLine, QString()); } }
void UIGInformationUpdateTaskGeneral::run() { /* Acquire corresponding machine: */ CMachine machine = property("machine").value<CMachine>(); if (machine.isNull()) return; /* Prepare table: */ UITextTable table; /* Gather information: */ if (machine.GetAccessible()) { /* Machine name: */ table << UITextTableLine(QApplication::translate("UIGInformation", "Name", "details (general)"), machine.GetName()); /* Operating system type: */ table << UITextTableLine(QApplication::translate("UIGInformation", "Operating System", "details (general)"), vboxGlobal().vmGuestOSTypeDescription(machine.GetOSTypeId())); /* Get groups: */ QStringList groups = machine.GetGroups().toList(); /* Do not show groups for machine which is in root group only: */ if (groups.size() == 1) groups.removeAll("/"); /* If group list still not empty: */ if (!groups.isEmpty()) { /* For every group: */ for (int i = 0; i < groups.size(); ++i) { /* Trim first '/' symbol: */ QString &strGroup = groups[i]; if (strGroup.startsWith("/") && strGroup != "/") strGroup.remove(0, 1); } table << UITextTableLine(QApplication::translate("UIGInformation", "Groups", "details (general)"), groups.join(", ")); } } else table << UITextTableLine(QApplication::translate("UIGInformation", "Information Inaccessible", "details"), QString()); /* Save the table as property: */ setProperty("table", QVariant::fromValue(table)); }
void UIGInformationUpdateTaskStorage::run() { /* Acquire corresponding machine: */ CMachine machine = property("machine").value<CMachine>(); if (machine.isNull()) return; /* Prepare table: */ UITextTable table; /* Gather information: */ if (machine.GetAccessible()) { /* Iterate over all the machine controllers: */ bool fSomeInfo = false; foreach (const CStorageController &controller, machine.GetStorageControllers()) { /* Add controller information: */ QString strControllerName = QApplication::translate("UIMachineSettingsStorage", "Controller: %1"); table << UITextTableLine(strControllerName.arg(controller.GetName()), QString()); fSomeInfo = true; /* Populate map (its sorted!): */ QMap<StorageSlot, QString> attachmentsMap; foreach (const CMediumAttachment &attachment, machine.GetMediumAttachmentsOfController(controller.GetName())) { /* Prepare current storage slot: */ StorageSlot attachmentSlot(controller.GetBus(), attachment.GetPort(), attachment.GetDevice()); AssertMsg(controller.isOk(), ("Unable to acquire controller data: %s\n", msgCenter().formatRC(controller.lastRC()).toAscii().constData())); if (!controller.isOk()) continue; /* Prepare attachment information: */ QString strAttachmentInfo = vboxGlobal().details(attachment.GetMedium(), false, false); /* That temporary hack makes sure 'Inaccessible' word is always bold: */ { // hack QString strInaccessibleString(VBoxGlobal::tr("Inaccessible", "medium")); QString strBoldInaccessibleString(QString("<b>%1</b>").arg(strInaccessibleString)); strAttachmentInfo.replace(strInaccessibleString, strBoldInaccessibleString); } // hack /* Append 'device slot name' with 'device type name' for optical devices only: */ KDeviceType deviceType = attachment.GetType(); QString strDeviceType = deviceType == KDeviceType_DVD ? QApplication::translate("UIGInformation", "[Optical Drive]", "details (storage)") : QString(); if (!strDeviceType.isNull()) strDeviceType.append(' '); /* Insert that attachment information into the map: */ if (!strAttachmentInfo.isNull()) { /* Configure hovering anchors: */ const QString strAnchorType = deviceType == KDeviceType_DVD || deviceType == KDeviceType_Floppy ? QString("mount") : deviceType == KDeviceType_HardDisk ? QString("attach") : QString(); const CMedium medium = attachment.GetMedium(); const QString strMediumLocation = medium.isNull() ? QString() : medium.GetLocation(); attachmentsMap.insert(attachmentSlot, QString("<a href=#%1,%2,%3,%4>%5</a>") .arg(strAnchorType, controller.GetName(), gpConverter->toString(attachmentSlot), strMediumLocation, strDeviceType + strAttachmentInfo)); } } /* Iterate over the sorted map: */ QList<StorageSlot> storageSlots = attachmentsMap.keys(); QList<QString> storageInfo = attachmentsMap.values(); for (int i = 0; i < storageSlots.size(); ++i) table << UITextTableLine(QString(" ") + gpConverter->toString(storageSlots[i]), storageInfo[i]); } if (!fSomeInfo) table << UITextTableLine(QApplication::translate("UIGInformation", "Not Attached", "details (storage)"), QString()); }
void UIGInformationUpdateTaskDisplay::run() { /* Acquire corresponding machine: */ CMachine machine = property("machine").value<CMachine>(); if (machine.isNull()) return; /* Prepare table: */ UITextTable table; /* Gather information: */ if (machine.GetAccessible()) { /* Video memory: */ table << UITextTableLine(QApplication::translate("UIGInformation", "Video Memory", "details (display)"), QApplication::translate("UIGInformation", "%1 MB", "details").arg(machine.GetVRAMSize())); /* Screen count: */ int cGuestScreens = machine.GetMonitorCount(); if (cGuestScreens > 1) table << UITextTableLine(QApplication::translate("UIGInformation", "Screens", "details (display)"), QString::number(cGuestScreens)); /* Get scale-factor value: */ const QString strScaleFactor = machine.GetExtraData(UIExtraDataDefs::GUI_ScaleFactor); { /* Try to convert loaded data to double: */ bool fOk = false; double dValue = strScaleFactor.toDouble(&fOk); /* Invent the default value: */ if (!fOk || !dValue) dValue = 1.0; /* Append information: */ if (dValue != 1.0) table << UITextTableLine(QApplication::translate("UIGInformation", "Scale-factor", "details (display)"), QString::number(dValue, 'f', 2)); } #ifdef Q_WS_MAC /* Get 'Unscaled HiDPI Video Output' mode value: */ const QString strUnscaledHiDPIMode = machine.GetExtraData(UIExtraDataDefs::GUI_HiDPI_UnscaledOutput); { /* Try to convert loaded data to bool: */ const bool fEnabled = strUnscaledHiDPIMode.compare("true", Qt::CaseInsensitive) == 0 || strUnscaledHiDPIMode.compare("yes", Qt::CaseInsensitive) == 0 || strUnscaledHiDPIMode.compare("on", Qt::CaseInsensitive) == 0 || strUnscaledHiDPIMode == "1"; /* Append information: */ if (fEnabled) table << UITextTableLine(QApplication::translate("UIGInformation", "Unscaled HiDPI Video Output", "details (display)"), QApplication::translate("UIGInformation", "Enabled", "details (display/Unscaled HiDPI Video Output)")); } #endif /* Q_WS_MAC */ QStringList acceleration; #ifdef VBOX_WITH_VIDEOHWACCEL /* 2D acceleration: */ if (machine.GetAccelerate2DVideoEnabled()) acceleration << QApplication::translate("UIGInformation", "2D Video", "details (display)"); #endif /* VBOX_WITH_VIDEOHWACCEL */ /* 3D acceleration: */ if (machine.GetAccelerate3DEnabled()) acceleration << QApplication::translate("UIGInformation", "3D", "details (display)"); if (!acceleration.isEmpty()) table << UITextTableLine(QApplication::translate("UIGInformation", "Acceleration", "details (display)"), acceleration.join(", ")); /* VRDE info: */ CVRDEServer srv = machine.GetVRDEServer(); if (!srv.isNull()) { if (srv.GetEnabled()) table << UITextTableLine(QApplication::translate("UIGInformation", "Remote Desktop Server Port", "details (display/vrde)"), srv.GetVRDEProperty("TCP/Ports")); else table << UITextTableLine(QApplication::translate("UIGInformation", "Remote Desktop Server", "details (display/vrde)"), QApplication::translate("UIGInformation", "Disabled", "details (display/vrde/VRDE server)")); } /* Video Capture info: */ if (machine.GetVideoCaptureEnabled()) { table << UITextTableLine(QApplication::translate("UIGInformation", "Video Capture File", "details (display/video capture)"), machine.GetVideoCaptureFile()); table << UITextTableLine(QApplication::translate("UIGInformation", "Video Capture Attributes", "details (display/video capture)"), QApplication::translate("UIGInformation", "Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps") .arg(machine.GetVideoCaptureWidth()).arg(machine.GetVideoCaptureHeight()) .arg(machine.GetVideoCaptureFPS()).arg(machine.GetVideoCaptureRate())); } else { table << UITextTableLine(QApplication::translate("UIGInformation", "Video Capture", "details (display/video capture)"), QApplication::translate("UIGInformation", "Disabled", "details (display/video capture)")); } } else table << UITextTableLine(QApplication::translate("UIGInformation", "Information Inaccessible", "details"), QString()); /* Save the table as property: */ setProperty("table", QVariant::fromValue(table)); }
void UIGInformationUpdateTaskSystem::run() { /* Acquire corresponding machine: */ CMachine machine = property("machine").value<CMachine>(); if (machine.isNull()) return; /* Prepare table: */ UITextTable table; /* Gather information: */ if (machine.GetAccessible()) { /* Base memory: */ table << UITextTableLine(QApplication::translate("UIGInformation", "Base Memory", "details (system)"), QApplication::translate("UIGInformation", "%1 MB", "details").arg(machine.GetMemorySize())); /* CPU count: */ int cCPU = machine.GetCPUCount(); if (cCPU > 1) table << UITextTableLine(QApplication::translate("UIGInformation", "Processors", "details (system)"), QString::number(cCPU)); /* CPU execution cap: */ int iCPUExecCap = machine.GetCPUExecutionCap(); if (iCPUExecCap < 100) table << UITextTableLine(QApplication::translate("UIGInformation", "Execution Cap", "details (system)"), QApplication::translate("UIGInformation", "%1%", "details").arg(iCPUExecCap)); /* Boot-order: */ QStringList bootOrder; for (ulong i = 1; i <= vboxGlobal().virtualBox().GetSystemProperties().GetMaxBootPosition(); ++i) { KDeviceType device = machine.GetBootOrder(i); if (device == KDeviceType_Null) continue; bootOrder << gpConverter->toString(device); } if (bootOrder.isEmpty()) bootOrder << gpConverter->toString(KDeviceType_Null); table << UITextTableLine(QApplication::translate("UIGInformation", "Boot Order", "details (system)"), bootOrder.join(", ")); /* Acceleration: */ QStringList acceleration; if (vboxGlobal().virtualBox().GetHost().GetProcessorFeature(KProcessorFeature_HWVirtEx)) { /* VT-x/AMD-V: */ if (machine.GetHWVirtExProperty(KHWVirtExPropertyType_Enabled)) { acceleration << QApplication::translate("UIGInformation", "VT-x/AMD-V", "details (system)"); /* Nested Paging (only when hw virt is enabled): */ if (machine.GetHWVirtExProperty(KHWVirtExPropertyType_NestedPaging)) acceleration << QApplication::translate("UIGInformation", "Nested Paging", "details (system)"); } } if (machine.GetCPUProperty(KCPUPropertyType_PAE)) acceleration << QApplication::translate("UIGInformation", "PAE/NX", "details (system)"); switch (machine.GetEffectiveParavirtProvider()) { case KParavirtProvider_Minimal: acceleration << QApplication::translate("UIGInformation", "Minimal Paravirtualization", "details (system)"); break; case KParavirtProvider_HyperV: acceleration << QApplication::translate("UIGInformation", "Hyper-V Paravirtualization", "details (system)"); break; case KParavirtProvider_KVM: acceleration << QApplication::translate("UIGInformation", "KVM Paravirtualization", "details (system)"); break; default: break; } if (!acceleration.isEmpty()) table << UITextTableLine(QApplication::translate("UIGInformation", "Acceleration", "details (system)"), acceleration.join(", ")); } else table << UITextTableLine(QApplication::translate("UIGInformation", "Information Inaccessible", "details"), QString()); /* Save the table as property: */ setProperty("table", QVariant::fromValue(table)); }