当前位置: 首页>>代码示例>>C++>>正文


C++ CConsole::GetGuest方法代码示例

本文整理汇总了C++中CConsole::GetGuest方法的典型用法代码示例。如果您正苦于以下问题:C++ CConsole::GetGuest方法的具体用法?C++ CConsole::GetGuest怎么用?C++ CConsole::GetGuest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CConsole的用法示例。


在下文中一共展示了CConsole::GetGuest方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: refreshStatistics

void UIVMInformationDialog::refreshStatistics()
{
    /* Skip for inactive session: */
    if (m_session.isNull())
        return;

    /* Prepare templates: */
    QString strTable = "<table width=100% cellspacing=1 cellpadding=0>%1</table>";
    QString strHeader = "<tr><td width=22><img width=16 height=16 src='%1'></td>"
                        "<td colspan=2><nobr><b>%2</b></nobr></td></tr>";
    QString strParagraph = "<tr><td colspan=3></td></tr>";
    QString strResult;

    /* Get current machine: */
    CMachine m = m_session.GetMachine();

    /* Runtime Information: */
    {
        /* Get current console: */
        CConsole console = m_session.GetConsole();

        ULONG cGuestScreens = m.GetMonitorCount();
        QVector<QString> aResolutions(cGuestScreens);
        for (ULONG iScreen = 0; iScreen < cGuestScreens; ++iScreen)
        {
            /* Determine resolution: */
            ULONG uWidth = 0;
            ULONG uHeight = 0;
            ULONG uBpp = 0;
            LONG xOrigin = 0;
            LONG yOrigin = 0;
            KGuestMonitorStatus monitorStatus = KGuestMonitorStatus_Enabled;
            console.GetDisplay().GetScreenResolution(iScreen, uWidth, uHeight, uBpp, xOrigin, yOrigin, monitorStatus);
            QString strResolution = QString("%1x%2").arg(uWidth).arg(uHeight);
            if (uBpp)
                strResolution += QString("x%1").arg(uBpp);
            strResolution += QString(" @%1,%2").arg(xOrigin).arg(yOrigin);
            if (monitorStatus == KGuestMonitorStatus_Disabled)
            {
                strResolution += QString(" ");
                strResolution += QString(VBoxGlobal::tr("off", "guest monitor status"));
            }
            aResolutions[iScreen] = strResolution;
        }

        /* Calculate uptime: */
        uint32_t uUpSecs = (RTTimeProgramSecTS() / 5) * 5;
        char szUptime[32];
        uint32_t uUpDays = uUpSecs / (60 * 60 * 24);
        uUpSecs -= uUpDays * 60 * 60 * 24;
        uint32_t uUpHours = uUpSecs / (60 * 60);
        uUpSecs -= uUpHours * 60 * 60;
        uint32_t uUpMins  = uUpSecs / 60;
        uUpSecs -= uUpMins * 60;
        RTStrPrintf(szUptime, sizeof(szUptime), "%dd %02d:%02d:%02d",
                    uUpDays, uUpHours, uUpMins, uUpSecs);
        QString strUptime = QString(szUptime);

        /* Determine clipboard mode: */
        QString strClipboardMode = gpConverter->toString(m.GetClipboardMode());
        /* Determine Drag&Drop mode: */
        QString strDnDMode = gpConverter->toString(m.GetDnDMode());

        /* Deterine virtualization attributes: */
        CMachineDebugger debugger = console.GetDebugger();
        QString strVirtualization = debugger.GetHWVirtExEnabled() ?
            VBoxGlobal::tr("Active", "details report (VT-x/AMD-V)") :
            VBoxGlobal::tr("Inactive", "details report (VT-x/AMD-V)");
        QString strNestedPaging = debugger.GetHWVirtExNestedPagingEnabled() ?
            VBoxGlobal::tr("Active", "details report (Nested Paging)") :
            VBoxGlobal::tr("Inactive", "details report (Nested Paging)");
        QString strUnrestrictedExecution = debugger.GetHWVirtExUXEnabled() ?
            VBoxGlobal::tr("Active", "details report (Unrestricted Execution)") :
            VBoxGlobal::tr("Inactive", "details report (Unrestricted Execution)");
        QString strParavirtProvider = gpConverter->toString(m.GetEffectiveParavirtProvider());

        /* Guest information: */
        CGuest guest = console.GetGuest();
        QString strGAVersion = guest.GetAdditionsVersion();
        if (strGAVersion.isEmpty())
            strGAVersion = tr("Not Detected", "guest additions");
        else
        {
            ULONG uRevision = guest.GetAdditionsRevision();
            if (uRevision != 0)
                strGAVersion += QString(" r%1").arg(uRevision);
        }
        QString strOSType = guest.GetOSTypeId();
        if (strOSType.isEmpty())
            strOSType = tr("Not Detected", "guest os type");
        else
            strOSType = vboxGlobal().vmGuestOSTypeDescription(strOSType);

        /* VRDE information: */
        int iVRDEPort = console.GetVRDEServerInfo().GetPort();
        QString strVRDEInfo = (iVRDEPort == 0 || iVRDEPort == -1)?
            tr("Not Available", "details report (VRDE server port)") :
            QString("%1").arg(iVRDEPort);

        /* Searching for longest string: */
//.........这里部分代码省略.........
开发者ID:pombredanne,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:101,代码来源:UIVMInformationDialog.cpp


注:本文中的CConsole::GetGuest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。