VirtualBox

Ignore:
Timestamp:
Sep 19, 2013 3:17:43 PM (11 years ago)
Author:
vboxsync
Message:

Main/NetworkAdapter+Machine+Appliance+SystemProperties+Medium+Console+Settings+IDL: make NAT networking a separate network attachment type which improves the user experience, store the necessary settings, plus changing the design of the methods which will move images and entire VMs, they lacked a progress object
Frontends/VirtualBox: adapted fully, can configure NAT networks with proper drop down list support
Frontends/VBoxManage: also supports NAT networks completely, and adds the long missing code to list intnets

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendCOM.cpp

    r48537 r48538  
    77
    88/*
    9  * Copyright (C) 2012 Oracle Corporation
     9 * Copyright (C) 2012-2013 Oracle Corporation
    1010 *
    1111 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    290290        case KNetworkAttachmentType_HostOnly: return QApplication::translate("VBoxGlobal", "Host-only Adapter", "NetworkAttachmentType");
    291291        case KNetworkAttachmentType_Generic:  return QApplication::translate("VBoxGlobal", "Generic Driver", "NetworkAttachmentType");
     292        case KNetworkAttachmentType_NATNetwork:  return QApplication::translate("VBoxGlobal", "NAT Network", "NetworkAttachmentType");
    292293        default: AssertMsgFailed(("No text for %d", type)); break;
    293294    }
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp

    r48534 r48538  
    13971397                    attType = attType.arg (tr ("Generic, '%1'",
    13981398                        "details report (network)").arg (adapter.GetGenericDriver()));
     1399                else if (type == KNetworkAttachmentType_NATNetwork)
     1400                    attType = attType.arg (tr ("NAT network, '%1'",
     1401                        "details report (network)").arg (adapter.GetNATNetwork()));
    13991402                else
    14001403                    attType = attType.arg (gpConverter->toString (type));
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElements.cpp

    r48314 r48538  
    677677                            break;
    678678                        }
     679                        case KNetworkAttachmentType_NATNetwork:
     680                        {
     681                            strAttachmentType = strAttachmentType.arg(QApplication::translate("UIGDetails", "NAT Network, '%1'", "details (network)")
     682                                                                      .arg(adapter.GetNATNetwork()));
     683                            break;
     684                        }
    679685                        default:
    680686                        {
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp

    r47944 r48538  
    77
    88/*
    9  * Copyright (C) 2008-2012 Oracle Corporation
     9 * Copyright (C) 2008-2013 Oracle Corporation
    1010 *
    1111 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    3030#include "CNATEngine.h"
    3131#include "CHostNetworkInterface.h"
     32#include "CNATNetwork.h"
    3233
    3334/* Other VBox includes: */
     
    142143            adapterData.m_strGenericProperties = m_pGenericPropertiesTextEdit->toPlainText();
    143144            break;
     145        case KNetworkAttachmentType_NATNetwork:
     146            adapterData.m_strNATNetworkName = alternativeName();
     147            break;
    144148        default:
    145149            break;
     
    211215            {
    212216                message.second << tr("No generic driver is currently selected.");
     217                fPass = false;
     218            }
     219            break;
     220        }
     221        case KNetworkAttachmentType_NATNetwork:
     222        {
     223            if (alternativeName().isNull())
     224            {
     225                message.second << tr("No NAT network name is currently specified.");
    213226                fPass = false;
    214227            }
     
    289302        case KNetworkAttachmentType_Generic:
    290303            strResult = m_strGenericDriverName;
     304            break;
     305        case KNetworkAttachmentType_NATNetwork:
     306            strResult = m_strNATNetworkName;
    291307            break;
    292308        default:
     
    420436            break;
    421437        }
     438        case KNetworkAttachmentType_NATNetwork:
     439        {
     440            m_pAdapterNameCombo->setWhatsThis(tr("Enter the name of the NAT network that this network card "
     441                                                 "will be connected to. You can create and remove adapters "
     442                                                 "using the global network settings in the virtual machine "
     443                                                 "manager window."));
     444            m_pAdapterNameCombo->setEditable(true);
     445            break;
     446        }
    422447        default:
    423448        {
     
    480505                    emit sigTabUpdated();
    481506            }
     507            break;
     508        }
     509        case KNetworkAttachmentType_NATNetwork:
     510        {
     511            QString newName(m_pAdapterNameCombo->itemData(m_pAdapterNameCombo->currentIndex()).toString() == QString(pEmptyItemCode) ||
     512                            m_pAdapterNameCombo->currentText().isEmpty() ? QString() : m_pAdapterNameCombo->currentText());
     513            if (m_strNATNetworkName != newName)
     514                m_strNATNetworkName = newName;
    482515            break;
    483516        }
     
    560593        m_pAttachmentTypeComboBox->insertItem(iAttachmentTypeIndex, gpConverter->toString(KNetworkAttachmentType_Generic));
    561594        m_pAttachmentTypeComboBox->setItemData(iAttachmentTypeIndex, KNetworkAttachmentType_Generic);
     595        m_pAttachmentTypeComboBox->setItemData(iAttachmentTypeIndex, m_pAttachmentTypeComboBox->itemText(iAttachmentTypeIndex), Qt::ToolTipRole);
     596        ++iAttachmentTypeIndex;
     597        m_pAttachmentTypeComboBox->insertItem(iAttachmentTypeIndex, gpConverter->toString(KNetworkAttachmentType_NATNetwork));
     598        m_pAttachmentTypeComboBox->setItemData(iAttachmentTypeIndex, KNetworkAttachmentType_NATNetwork);
    562599        m_pAttachmentTypeComboBox->setItemData(iAttachmentTypeIndex, m_pAttachmentTypeComboBox->itemText(iAttachmentTypeIndex), Qt::ToolTipRole);
    563600        ++iAttachmentTypeIndex;
     
    659696            m_pAdapterNameCombo->insertItems(0, m_pParent->genericDriverList());
    660697            break;
     698        case KNetworkAttachmentType_NATNetwork:
     699            m_pAdapterNameCombo->insertItems(0, m_pParent->natNetworkList());
     700            break;
    661701        default:
    662702            break;
     
    670710            case KNetworkAttachmentType_Bridged:
    671711            case KNetworkAttachmentType_HostOnly:
     712            case KNetworkAttachmentType_NATNetwork:
    672713            {
    673714                /* If adapter list is empty => add 'Not selected' item: */
     
    706747        case KNetworkAttachmentType_HostOnly:
    707748        case KNetworkAttachmentType_Generic:
     749        case KNetworkAttachmentType_NATNetwork:
    708750        {
    709751            m_pAdapterNameCombo->setCurrentIndex(position(m_pAdapterNameCombo, alternativeName()));
     
    770812    refreshHostInterfaceList();
    771813    refreshGenericDriverList(true);
     814    refreshNATNetworkList();
    772815
    773816    /* For each network adapter: */
     
    917960                                updateGenericProperties(adapter, adapterData.m_strGenericProperties);
    918961                                break;
     962                            case KNetworkAttachmentType_NATNetwork:
     963                                adapter.SetNATNetwork(adapterData.m_strNATNetworkName);
     964                                break;
    919965                            default:
    920966                                break;
     
    10911137}
    10921138
     1139void UIMachineSettingsNetworkPage::refreshNATNetworkList()
     1140{
     1141    /* Reload NAT network list: */
     1142    m_natNetworkList.clear();
     1143    const CNATNetworkVector &nws = vboxGlobal().virtualBox().GetNATNetworks();
     1144    for (int i = 0; i < nws.size(); ++i)
     1145    {
     1146        const CNATNetwork &nw = nws[i];
     1147        m_natNetworkList << nw.GetNetworkName();
     1148    }
     1149}
     1150
    10931151/* static */
    10941152QStringList UIMachineSettingsNetworkPage::otherInternalNetworkList()
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.h

    r47944 r48538  
    66
    77/*
    8  * Copyright (C) 2008-2012 Oracle Corporation
     8 * Copyright (C) 2008-2013 Oracle Corporation
    99 *
    1010 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    4444        , m_strGenericDriverName(QString())
    4545        , m_strGenericProperties(QString())
     46        , m_strNATNetworkName(QString())
    4647        , m_strMACAddress(QString())
    4748        , m_fCableConnected(false)
     
    6061               (m_strGenericDriverName == other.m_strGenericDriverName) &&
    6162               (m_strGenericProperties == other.m_strGenericProperties) &&
     63               (m_strNATNetworkName == other.m_strNATNetworkName) &&
    6264               (m_strMACAddress == other.m_strMACAddress) &&
    6365               (m_fCableConnected == other.m_fCableConnected) &&
     
    7880    QString m_strGenericDriverName;
    7981    QString m_strGenericProperties;
     82    QString m_strNATNetworkName;
    8083    QString m_strMACAddress;
    8184    bool m_fCableConnected;
     
    165168    QString m_strHostInterfaceName;
    166169    QString m_strGenericDriverName;
     170    QString m_strNATNetworkName;
    167171    UIPortForwardingDataList m_portForwardingRules;
    168172};
     
    186190    /* Generic driver list: */
    187191    const QStringList& genericDriverList() const { return m_genericDriverList; }
     192    /* NAT network list: */
     193    const QStringList& natNetworkList() const { return m_natNetworkList; }
    188194
    189195protected:
     
    225231    void refreshHostInterfaceList();
    226232    void refreshGenericDriverList(bool fFullRefresh = false);
     233    void refreshNATNetworkList();
    227234
    228235    /* Various static stuff: */
     
    240247    QStringList m_hostInterfaceList;
    241248    QStringList m_genericDriverList;
     249    QStringList m_natNetworkList;
    242250
    243251    /* Cache: */
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