VirtualBox

Changeset 81094 in vbox


Ignore:
Timestamp:
Oct 1, 2019 11:34:45 AM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
133703
Message:

FE/Qt: bugref:9510. Some refactoring

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIInformationRuntime.cpp

    r81074 r81094  
    8787    void updateUpTime();
    8888    void updateTitleRow();
     89    void updateOSTypeRow();
     90    void updateVirtualizationInfo();
    8991
    9092    /** Searches the table for the @p item of enmLine and replaces its text. if not found inserts a new
     
    324326}
    325327
    326 void UIRuntimeInfoWidget::updateGAsVersion()
    327 {
    328     CGuest guest = m_console.GetGuest();
    329     QString strGAVersion = guest.GetAdditionsVersion();
    330     if (strGAVersion.isEmpty())
    331         strGAVersion = m_strNotDetected;
     328void UIRuntimeInfoWidget::updateOSTypeRow()
     329{
     330   QString strOSType = m_console.GetGuest().GetOSTypeId();
     331    if (strOSType.isEmpty())
     332        strOSType = m_strNotDetected;
    332333    else
    333     {
    334         ULONG uRevision = guest.GetAdditionsRevision();
    335         if (uRevision != 0)
    336             strGAVersion += QString(" r%1").arg(uRevision);
    337     }
    338    updateInfoRow(InfoRow_GuestAdditions, QString("%1:").arg(m_strGuestAdditionsLabel), strGAVersion);
    339 }
    340 
    341 void UIRuntimeInfoWidget::updateVRDE()
    342 {
    343     int iVRDEPort = m_console.GetVRDEServerInfo().GetPort();
    344     QString strVRDEInfo = (iVRDEPort == 0 || iVRDEPort == -1) ?
    345         m_strNotAvailable : QString("%1").arg(iVRDEPort);
    346    updateInfoRow(InfoRow_RemoteDesktop, QString("%1:").arg(m_strRemoteDesktopLabel), strVRDEInfo);
    347 }
    348 
    349 void UIRuntimeInfoWidget::updateClipboardMode(KClipboardMode enmMode /* = KClipboardMode_Max */)
    350 {
    351     if (enmMode == KClipboardMode_Max)
    352         updateInfoRow(InfoRow_ClipboardMode, QString("%1:").arg(m_strClipboardModeLabel),
    353                       gpConverter->toString(m_machine.GetClipboardMode()));
    354     else
    355         updateInfoRow(InfoRow_ClipboardMode, QString("%1:").arg(m_strClipboardModeLabel),
    356                       gpConverter->toString(enmMode));
    357 }
    358 
    359 void UIRuntimeInfoWidget::updateDnDMode(KDnDMode enmMode /* = KDnDMode_Max */)
    360 {
    361     if (enmMode == KDnDMode_Max)
    362         updateInfoRow(InfoRow_DnDMode, QString("%1:").arg(m_strDragAndDropLabel),
    363                   gpConverter->toString(m_machine.GetDnDMode()));
    364     else
    365         updateInfoRow(InfoRow_DnDMode, QString("%1:").arg(m_strDragAndDropLabel),
    366                       gpConverter->toString(enmMode));
    367 }
    368 
    369 void UIRuntimeInfoWidget::updateInfoRow(InfoRow enmLine, const QString &strColumn0, const QString &strColumn1)
    370 {
    371     QTableWidgetItem *pItem = 0;
    372     for (int i = 0; i < rowCount() && !pItem; ++i)
    373     {
    374         pItem = item(i, 1);
    375         if (!pItem)
    376             continue;
    377         if (pItem->type() != enmLine)
    378             pItem = 0;
    379     }
    380     if (!pItem)
    381         insertInfoRow(enmLine, strColumn0, strColumn1);
    382     else
    383         pItem->setText(strColumn1);
    384 }
    385 
    386 void UIRuntimeInfoWidget::createInfoRows()
    387 {
    388     clear();
    389     setRowCount(0);
    390     setColumnCount(2);
    391     updateTitleRow();
    392     updateScreenInfo();
    393     updateUpTime();
     334        strOSType = uiCommon().vmGuestOSTypeDescription(strOSType);
     335   updateInfoRow(InfoRow_GuestOSType, QString("%1:").arg(m_strGuestOSTypeLabel), strOSType);
     336}
     337
     338void UIRuntimeInfoWidget::updateVirtualizationInfo()
     339{
    394340
    395341    /* Determine virtualization attributes: */
     
    420366    QString strNestedPaging = debugger.GetHWVirtExNestedPagingEnabled() ?
    421367        m_strActive : m_strInactive;
    422 
    423368    QString strUnrestrictedExecution = debugger.GetHWVirtExUXEnabled() ?
    424369        m_strActive : m_strInactive;
    425 
    426370    QString strParavirtProvider = gpConverter->toString(m_machine.GetEffectiveParavirtProvider());
    427371
    428     QString strOSType = m_console.GetGuest().GetOSTypeId();
    429     if (strOSType.isEmpty())
    430         strOSType = m_strNotDetected;
     372    updateInfoRow(InfoRow_ExecutionEngine, QString("%1:").arg(m_strExcutionEngineLabel), strExecutionEngine);
     373    updateInfoRow(InfoRow_NestedPaging, QString("%1:").arg(m_strNestedPagingLabel), strNestedPaging);
     374    updateInfoRow(InfoRow_UnrestrictedExecution, QString("%1:").arg(m_strUnrestrictedExecutionLabel), strUnrestrictedExecution);
     375    updateInfoRow(InfoRow_Paravirtualization, QString("%1:").arg(m_strParavirtualizationLabel), strParavirtProvider);
     376
     377}
     378
     379void UIRuntimeInfoWidget::updateGAsVersion()
     380{
     381    CGuest guest = m_console.GetGuest();
     382    QString strGAVersion = guest.GetAdditionsVersion();
     383    if (strGAVersion.isEmpty())
     384        strGAVersion = m_strNotDetected;
    431385    else
    432         strOSType = uiCommon().vmGuestOSTypeDescription(strOSType);
    433 
     386    {
     387        ULONG uRevision = guest.GetAdditionsRevision();
     388        if (uRevision != 0)
     389            strGAVersion += QString(" r%1").arg(uRevision);
     390    }
     391   updateInfoRow(InfoRow_GuestAdditions, QString("%1:").arg(m_strGuestAdditionsLabel), strGAVersion);
     392}
     393
     394void UIRuntimeInfoWidget::updateVRDE()
     395{
     396    int iVRDEPort = m_console.GetVRDEServerInfo().GetPort();
     397    QString strVRDEInfo = (iVRDEPort == 0 || iVRDEPort == -1) ?
     398        m_strNotAvailable : QString("%1").arg(iVRDEPort);
     399   updateInfoRow(InfoRow_RemoteDesktop, QString("%1:").arg(m_strRemoteDesktopLabel), strVRDEInfo);
     400}
     401
     402void UIRuntimeInfoWidget::updateClipboardMode(KClipboardMode enmMode /* = KClipboardMode_Max */)
     403{
     404    if (enmMode == KClipboardMode_Max)
     405        updateInfoRow(InfoRow_ClipboardMode, QString("%1:").arg(m_strClipboardModeLabel),
     406                      gpConverter->toString(m_machine.GetClipboardMode()));
     407    else
     408        updateInfoRow(InfoRow_ClipboardMode, QString("%1:").arg(m_strClipboardModeLabel),
     409                      gpConverter->toString(enmMode));
     410}
     411
     412void UIRuntimeInfoWidget::updateDnDMode(KDnDMode enmMode /* = KDnDMode_Max */)
     413{
     414    if (enmMode == KDnDMode_Max)
     415        updateInfoRow(InfoRow_DnDMode, QString("%1:").arg(m_strDragAndDropLabel),
     416                  gpConverter->toString(m_machine.GetDnDMode()));
     417    else
     418        updateInfoRow(InfoRow_DnDMode, QString("%1:").arg(m_strDragAndDropLabel),
     419                      gpConverter->toString(enmMode));
     420}
     421
     422void UIRuntimeInfoWidget::updateInfoRow(InfoRow enmLine, const QString &strColumn0, const QString &strColumn1)
     423{
     424    QTableWidgetItem *pItem = 0;
     425    for (int i = 0; i < rowCount() && !pItem; ++i)
     426    {
     427        pItem = item(i, 1);
     428        if (!pItem)
     429            continue;
     430        if (pItem->type() != enmLine)
     431            pItem = 0;
     432    }
     433    if (!pItem)
     434        insertInfoRow(enmLine, strColumn0, strColumn1);
     435    else
     436        pItem->setText(strColumn1);
     437}
     438
     439void UIRuntimeInfoWidget::createInfoRows()
     440{
     441    clear();
     442    setRowCount(0);
     443    setColumnCount(2);
     444    updateTitleRow();
     445    updateScreenInfo();
     446    updateUpTime();
    434447    updateClipboardMode();
    435448    updateDnDMode();
    436     insertInfoRow(InfoRow_ExecutionEngine, QString("%1:").arg(m_strExcutionEngineLabel), strExecutionEngine);
    437     insertInfoRow(InfoRow_NestedPaging, QString("%1:").arg(m_strNestedPagingLabel), strNestedPaging);
    438     insertInfoRow(InfoRow_UnrestrictedExecution, QString("%1:").arg(m_strUnrestrictedExecutionLabel), strUnrestrictedExecution);
    439     insertInfoRow(InfoRow_Paravirtualization, QString("%1:").arg(m_strParavirtualizationLabel), strParavirtProvider);
     449    updateVirtualizationInfo();
    440450    updateGAsVersion();
    441     insertInfoRow(InfoRow_GuestOSType, QString("%1:").arg(m_strGuestOSTypeLabel), strOSType);
     451    updateOSTypeRow();
    442452    updateVRDE();
    443453    resizeColumnToContents(1);
Note: See TracChangeset for help on using the changeset viewer.

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