VirtualBox

Changeset 87232 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jan 13, 2021 11:00:34 AM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9871: Network Manager: More cleanup.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/networkmanager
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/networkmanager/UIDetailsWidgetHostNetwork.h

    r87219 r87232  
    3939
    4040
    41 /** Host Network Manager: Host Network Interface data structure. */
     41/** Network Manager: Host Network Interface data structure. */
    4242struct UIDataHostNetworkInterface
    4343{
     
    8989
    9090
    91 /** Host Network Manager: DHCP Server data structure. */
     91/** Network Manager: DHCP Server data structure. */
    9292struct UIDataDHCPServer
    9393{
     
    131131
    132132
    133 /** Host Network Manager: Host network data structure. */
     133/** Network Manager: Host network data structure. */
    134134struct UIDataHostNetwork
    135135{
     
    161161
    162162
    163 /** Host Network Manager: Host network details-widget. */
     163/** Network Manager: Host network details-widget. */
    164164class UIDetailsWidgetHostNetwork : public QIWithRetranslateUI<QWidget>
    165165{
  • trunk/src/VBox/Frontends/VirtualBox/src/networkmanager/UINetworkManager.cpp

    r87220 r87232  
    4848
    4949
     50/** Tab-widget indexes. */
     51enum TabWidgetIndex
     52{
     53    TabWidgetIndex_HostNetwork,
     54};
     55
     56
    5057/** Host network tree-widget column indexes. */
    5158enum HostNetworkColumn
     
    267274    switch (m_pTabWidget->currentIndex())
    268275    {
    269         case 0:
    270         {
    271             sltHandleCurrentItemChangeHostNetwork();
    272             break;
    273         }
    274         default:
    275             break;
     276        case TabWidgetIndex_HostNetwork: sltHandleCurrentItemChangeHostNetwork(); break;
     277        default: break;
    276278    }
    277279}
     
    285287    switch (m_pTabWidget->currentIndex())
    286288    {
    287         case 0:
    288         {
    289             sltApplyDetailsChangesHostNetwork();
    290             break;
    291         }
    292         default:
    293             break;
     289        case TabWidgetIndex_HostNetwork: sltApplyDetailsChangesHostNetwork(); break;
     290        default: break;
    294291    }
    295292}
     
    297294void UINetworkManagerWidget::sltCreateHostNetwork()
    298295{
     296    /* For host networks only: */
     297    if (m_pTabWidget->currentIndex() != TabWidgetIndex_HostNetwork)
     298        return;
     299
    299300    /* Get host for further activities: */
    300301    CHost comHost = uiCommon().host();
     
    341342            UIDataHostNetwork data;
    342343            loadHostNetwork(comInterface, data);
    343             createItemForNetworkHost(data, true);
     344            createItemForHostNetwork(data, true);
    344345
    345346            /* Adjust tree-widgets: */
     
    351352void UINetworkManagerWidget::sltRemoveHostNetwork()
    352353{
     354    /* For host networks only: */
     355    if (m_pTabWidget->currentIndex() != TabWidgetIndex_HostNetwork)
     356        return;
     357
    353358    /* Check host network tree-widget: */
    354359    AssertMsgReturnVoid(m_pTreeWidgetHostNetwork, ("Host network tree-widget isn't created!\n"));
     
    542547                    UIDataHostNetwork data;
    543548                    loadHostNetwork(comInterface, data);
    544                     updateItemForNetworkHost(data, true, pChangedItem);
     549                    updateItemForHostNetwork(data, true, pChangedItem);
    545550
    546551                    /* Make sure current item fetched: */
     
    573578    if (pItem)
    574579        m_pDetailsWidgetHostNetwork->setData(*pItem);
     580    /* Otherwise => clear details: */
    575581    else
    576     {
    577         /* Otherwise => clear details and close the area: */
    578582        m_pDetailsWidgetHostNetwork->setData(UIDataHostNetwork());
    579         sltToggleDetailsVisibility(false);
    580     }
    581583}
    582584
     
    717719            UIDataHostNetwork data;
    718720            loadHostNetwork(comInterface, data);
    719             updateItemForNetworkHost(data, true, pItem);
     721            updateItemForHostNetwork(data, true, pItem);
    720722
    721723            /* Make sure current item fetched: */
     
    845847
    846848        /* Add into tab-widget: */
    847         m_pTabWidget->addTab(m_pTabHostNetwork, QString());
     849        m_pTabWidget->insertTab(TabWidgetIndex_HostNetwork, m_pTabHostNetwork, QString());
    848850    }
    849851}
     
    933935                UIDataHostNetwork data;
    934936                loadHostNetwork(comInterface, data);
    935                 createItemForNetworkHost(data, false);
     937                createItemForHostNetwork(data, false);
    936938            }
    937939
     
    10031005}
    10041006
    1005 void UINetworkManagerWidget::createItemForNetworkHost(const UIDataHostNetwork &data, bool fChooseItem)
     1007void UINetworkManagerWidget::createItemForHostNetwork(const UIDataHostNetwork &data, bool fChooseItem)
    10061008{
    10071009    /* Create new item: */
     
    10201022}
    10211023
    1022 void UINetworkManagerWidget::updateItemForNetworkHost(const UIDataHostNetwork &data, bool fChooseItem, UIItemHostNetwork *pItem)
     1024void UINetworkManagerWidget::updateItemForHostNetwork(const UIDataHostNetwork &data, bool fChooseItem, UIItemHostNetwork *pItem)
    10231025{
    10241026    /* Update passed item: */
  • trunk/src/VBox/Frontends/VirtualBox/src/networkmanager/UINetworkManager.h

    r87220 r87232  
    161161      * @{ */
    162162        /** Creates a new host network tree-widget item on the basis of passed @a data, @a fChooseItem if requested. */
    163         void createItemForNetworkHost(const UIDataHostNetwork &data, bool fChooseItem);
     163        void createItemForHostNetwork(const UIDataHostNetwork &data, bool fChooseItem);
    164164        /** Updates passed host network tree-widget item on the basis of passed @a data, @a fChooseItem if requested. */
    165         void updateItemForNetworkHost(const UIDataHostNetwork &data, bool fChooseItem, UIItemHostNetwork *pItem);
     165        void updateItemForHostNetwork(const UIDataHostNetwork &data, bool fChooseItem, UIItemHostNetwork *pItem);
    166166    /** @} */
    167167
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