VirtualBox

Ignore:
Timestamp:
Jan 15, 2021 1:09:39 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9871: Network Manager: Reworking details widget to behave and be located more unconditionally.

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

Legend:

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

    r87232 r87271  
    441441    /* Save the setting: */
    442442    gEDataManager->setHostNetworkManagerDetailsExpanded(fVisible);
    443     /* Show/hide details area and Apply button: */
    444     if (m_pDetailsWidgetHostNetwork)
    445         m_pDetailsWidgetHostNetwork->setVisible(fVisible);
     443    /* Show/hide details area and Apply/Reset buttons: */
     444    switch (m_pTabWidget->currentIndex())
     445    {
     446        case TabWidgetIndex_HostNetwork:
     447        {
     448            if (m_pDetailsWidgetHostNetwork)
     449                m_pDetailsWidgetHostNetwork->setVisible(fVisible);
     450            break;
     451        }
     452    }
    446453    /* Notify external listeners: */
    447454    emit sigDetailsVisibilityChanged(fVisible);
     455}
     456
     457void UINetworkManagerWidget::sltHandleCurrentTabWidgetIndexChange()
     458{
     459    /* Show/hide details area and Apply/Reset buttons: */
     460    const bool fVisible = m_pActionPool->action(UIActionIndexMN_M_Network_T_Details)->isChecked();
     461    switch (m_pTabWidget->currentIndex())
     462    {
     463        case TabWidgetIndex_HostNetwork:
     464        {
     465            if (m_pDetailsWidgetHostNetwork)
     466                m_pDetailsWidgetHostNetwork->setVisible(fVisible);
     467            break;
     468        }
     469    }
    448470}
    449471
     
    543565                if (!comServer.isOk())
    544566                    msgCenter().cannotSaveDHCPServerParameter(comServer, this);
     567                else
    545568                {
    546569                    /* Update interface in the tree: */
     
    570593    /* Update actions availability: */
    571594    m_pActionPool->action(UIActionIndexMN_M_Network_S_Remove)->setEnabled(pItem);
    572     m_pActionPool->action(UIActionIndexMN_M_Network_T_Details)->setEnabled(pItem);
    573595
    574596    /* Check host network details-widget: */
     
    783805        if (m_fShowToolbar)
    784806            prepareToolBar();
     807
    785808        /* Prepare tab-widget: */
    786809        prepareTabWidget();
     810
     811        /* Prepare details widgets: */
     812        prepareDetailsWidgetHostNetwork();
    787813    }
    788814}
     
    790816void UINetworkManagerWidget::prepareToolBar()
    791817{
    792     /* Create toolbar: */
     818    /* Prepare toolbar: */
    793819    m_pToolBar = new QIToolBar(parentWidget());
    794820    if (m_pToolBar)
    795821    {
    796         /* Configure toolbar: */
    797822        const int iIconMetric = (int)(QApplication::style()->pixelMetric(QStyle::PM_LargeIconSize));
    798823        m_pToolBar->setIconSize(QSize(iIconMetric, iIconMetric));
    799824        m_pToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    800 
    801         /* Add toolbar actions: */
    802825        m_pToolBar->addAction(m_pActionPool->action(UIActionIndexMN_M_Network_S_Create));
    803826        m_pToolBar->addSeparator();
     
    825848    if (m_pTabWidget)
    826849    {
     850        connect(m_pTabWidget, &QITabWidget::currentChanged,
     851                this, &UINetworkManagerWidget::sltHandleCurrentTabWidgetIndexChange);
     852
    827853        prepareTabHostNetwork();
    828854
     
    841867        m_pLayoutHostNetwork = new QVBoxLayout(m_pTabHostNetwork);
    842868        if (m_pLayoutHostNetwork)
    843         {
    844869            prepareTreeWidgetHostNetwork();
    845             prepareDetailsWidgetHostNetwork();
    846         }
    847870
    848871        /* Add into tab-widget: */
     
    882905{
    883906    /* Prepare host network details-widget: */
    884     m_pDetailsWidgetHostNetwork = new UIDetailsWidgetHostNetwork(m_enmEmbedding, m_pTabHostNetwork);
     907    m_pDetailsWidgetHostNetwork = new UIDetailsWidgetHostNetwork(m_enmEmbedding, this);
    885908    if (m_pDetailsWidgetHostNetwork)
    886909    {
     
    895918
    896919        /* Add into layout: */
    897         m_pLayoutHostNetwork->addWidget(m_pDetailsWidgetHostNetwork);
     920        layout()->addWidget(m_pDetailsWidgetHostNetwork);
    898921    }
    899922}
  • trunk/src/VBox/Frontends/VirtualBox/src/networkmanager/UINetworkManager.h

    r87232 r87271  
    113113    /** @name Tree-widget stuff.
    114114      * @{ */
     115        /** Handles current tab-widget's index change. */
     116        void sltHandleCurrentTabWidgetIndexChange();
     117
    115118        /** Handles command to adjust tree-widget. */
    116119        void sltAdjustTreeWidgets();
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