VirtualBox

Changeset 87572 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Feb 3, 2021 3:23:34 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9871: Network Manager: Extend a set of tree-widget columns for NAT network stuff, reflecting IPv4/v6 prefixes and DHCP status.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/networkmanager/UINetworkManager.cpp

    r87565 r87572  
    7474{
    7575    NATNetworkColumn_Name,
     76    NATNetworkColumn_IPv4,
     77    NATNetworkColumn_IPv6,
     78    NATNetworkColumn_DHCP,
    7679    NATNetworkColumn_Max,
    7780};
     
    233236    /* Compose item fields: */
    234237    setText(NATNetworkColumn_Name, m_strName);
    235 
    236     /* Compose tool-tip: */
     238    setText(NATNetworkColumn_IPv4, m_strPrefixIPv4);
     239    setText(NATNetworkColumn_IPv6, m_strPrefixIPv6);
     240    setText(NATNetworkColumn_DHCP, m_fSupportsDHCP ? tr("Enabled", "DHCP Server") : tr("Disabled", "DHCP Server"));
     241
     242    /* Compose item tool-tip: */
    237243    const QString strTable("<table cellspacing=5>%1</table>");
    238244    const QString strHeader("<tr><td><nobr>%1:&nbsp;</nobr></td><td><nobr>%2</nobr></td></tr>");
     
    324330    {
    325331        const QStringList fields = QStringList()
    326                                    << UINetworkManager::tr("Name");
     332                                   << UINetworkManager::tr("Name")
     333                                   << UINetworkManager::tr("IPv4 Prefix")
     334                                   << UINetworkManager::tr("IPv6 Prefix")
     335                                   << UINetworkManager::tr("DHCP Server");
    327336        m_pTreeWidgetNATNetwork->setHeaderLabels(fields);
    328337    }
     
    680689void UINetworkManagerWidget::sltHandleCurrentTabWidgetIndexChange()
    681690{
     691    /* Adjust tree-widgets first of all: */
     692    sltAdjustTreeWidgets();
     693
    682694    /* Show/hide details area and Apply/Reset buttons: */
    683695    const bool fVisible = m_pActionPool->action(UIActionIndexMN_M_Network_T_Details)->isChecked();
     
    730742    }
    731743
    732 #if 0
    733744    /* Check NAT network tree-widget: */
    734745    if (m_pTreeWidgetNATNetwork)
     
    742753        const int iTotal = m_pTreeWidgetNATNetwork->viewport()->width();
    743754        /* Look for a minimum width hints for non-important columns: */
    744         const int iMinWidth1 = qMax(pItemView->sizeHintForColumn(NATNetworkColumn_Availability), pItemHeader->sectionSizeHint(NATNetworkColumn_Availability));
     755        const int iMinWidth1 = qMax(pItemView->sizeHintForColumn(NATNetworkColumn_IPv4), pItemHeader->sectionSizeHint(NATNetworkColumn_IPv4));
     756        const int iMinWidth2 = qMax(pItemView->sizeHintForColumn(NATNetworkColumn_IPv6), pItemHeader->sectionSizeHint(NATNetworkColumn_IPv6));
     757        const int iMinWidth3 = qMax(pItemView->sizeHintForColumn(NATNetworkColumn_DHCP), pItemHeader->sectionSizeHint(NATNetworkColumn_DHCP));
    745758        /* Propose suitable width hints for non-important columns: */
    746759        const int iWidth1 = iMinWidth1 < iTotal / NATNetworkColumn_Max ? iMinWidth1 : iTotal / NATNetworkColumn_Max;
     760        const int iWidth2 = iMinWidth2 < iTotal / NATNetworkColumn_Max ? iMinWidth2 : iTotal / NATNetworkColumn_Max;
     761        const int iWidth3 = iMinWidth3 < iTotal / NATNetworkColumn_Max ? iMinWidth3 : iTotal / NATNetworkColumn_Max;
    747762        /* Apply the proposal: */
    748         m_pTreeWidgetNATNetwork->setColumnWidth(NATNetworkColumn_Availability, iWidth1);
    749         m_pTreeWidgetNATNetwork->setColumnWidth(NATNetworkColumn_Name, iTotal - iWidth1);
    750     }
    751 #endif
     763        m_pTreeWidgetNATNetwork->setColumnWidth(NATNetworkColumn_IPv4, iWidth1);
     764        m_pTreeWidgetNATNetwork->setColumnWidth(NATNetworkColumn_IPv6, iWidth2);
     765        m_pTreeWidgetNATNetwork->setColumnWidth(NATNetworkColumn_DHCP, iWidth3);
     766        m_pTreeWidgetNATNetwork->setColumnWidth(NATNetworkColumn_Name, iTotal - iWidth1 - iWidth2 - iWidth3);
     767    }
    752768}
    753769
Note: See TracChangeset for help on using the changeset viewer.

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