VirtualBox

Changeset 92821 in vbox


Ignore:
Timestamp:
Dec 8, 2021 2:54:01 PM (3 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10168: Network Manager: Initial implementation for new host-only networking UI for macOS.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp

    r92811 r92821  
    13411341}
    13421342
     1343bool UIMessageCenter::confirmHostOnlyNetworkRemoval(const QString &strName, QWidget *pParent /* = 0 */) const
     1344{
     1345    return questionBinary(pParent, MessageType_Question,
     1346                          tr("<p>Do you want to remove the host-only network <nobr><b>%1</b>?</nobr></p>"
     1347                             "<p>If this network is in use by one or more virtual "
     1348                             "machine network adapters these adapters will no longer be "
     1349                             "usable until you correct their settings by either choosing "
     1350                             "a different network name or a different adapter attachment "
     1351                             "type.</p>")
     1352                             .arg(strName),
     1353                          0 /* auto-confirm id */,
     1354                          tr("Remove") /* ok button text */,
     1355                          QString() /* cancel button text */,
     1356                          false /* ok button by default? */);
     1357}
     1358
    13431359bool UIMessageCenter::confirmNATNetworkRemoval(const QString &strName, QWidget *pParent /* = 0*/) const
    13441360{
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h

    r92811 r92821  
    358358        bool confirmCloudNetworkRemoval(const QString &strName, QWidget *pParent = 0) const;
    359359        bool confirmHostNetworkInterfaceRemoval(const QString &strName, QWidget *pParent = 0) const;
     360        bool confirmHostOnlyNetworkRemoval(const QString &strName, QWidget *pParent = 0) const;
    360361        bool confirmNATNetworkRemoval(const QString &strName, QWidget *pParent = 0) const;
    361362    /** @} */
  • trunk/src/VBox/Frontends/VirtualBox/src/networkmanager/UIDetailsWidgetHostNetwork.cpp

    r92811 r92821  
    4343    : QIWithRetranslateUI<QWidget>(pParent)
    4444    , m_enmEmbedding(enmEmbedding)
     45#ifdef VBOX_WS_MAC
     46    , m_pLabelName(0)
     47    , m_pEditorName(0)
     48    , m_pLabelMask(0)
     49    , m_pEditorMask(0)
     50    , m_pLabelLBnd(0)
     51    , m_pEditorLBnd(0)
     52    , m_pLabelUBnd(0)
     53    , m_pEditorUBnd(0)
     54    , m_pButtonBox(0)
     55#else /* !VBOX_WS_MAC */
    4556    , m_pTabWidget(0)
    4657    , m_pButtonAutomatic(0)
     
    5768    , m_pLabelDHCPUpperAddress(0), m_pEditorDHCPUpperAddress(0)
    5869    , m_pButtonBoxServer(0)
     70#endif /* !VBOX_WS_MAC */
    5971{
    6072    prepare();
    6173}
    6274
     75#ifdef VBOX_WS_MAC
     76void UIDetailsWidgetHostNetwork::setData(const UIDataHostNetwork &data,
     77                                         const QStringList &busyNames /* = QStringList() */)
     78#else /* !VBOX_WS_MAC */
    6379void UIDetailsWidgetHostNetwork::setData(const UIDataHostNetwork &data)
     80#endif /* !VBOX_WS_MAC */
    6481{
    6582    /* Cache old/new data: */
    6683    m_oldData = data;
    6784    m_newData = m_oldData;
    68 
     85#ifdef VBOX_WS_MAC
     86    m_busyNames = busyNames;
     87#endif /* VBOX_WS_MAC */
     88
     89#ifdef VBOX_WS_MAC
     90    /* Load data: */
     91    loadData();
     92#else /* !VBOX_WS_MAC */
    6993    /* Load 'Interface' data: */
    7094    loadDataForInterface();
    7195    /* Load 'DHCP server' data: */
    7296    loadDataForDHCPServer();
     97#endif /* !VBOX_WS_MAC */
    7398}
    7499
    75100bool UIDetailsWidgetHostNetwork::revalidate() const
    76101{
     102#ifdef VBOX_WS_MAC
     103    /* Make sure network name isn't empty: */
     104    if (m_newData.m_strName.isEmpty())
     105    {
     106        UINotificationMessage::warnAboutNoNameSpecified(m_oldData.m_strName);
     107        return false;
     108    }
     109    else
     110    {
     111        /* Make sure item names are unique: */
     112        if (m_busyNames.contains(m_newData.m_strName))
     113        {
     114            UINotificationMessage::warnAboutNameAlreadyBusy(m_newData.m_strName);
     115            return false;
     116        }
     117    }
     118
     119    /* Make sure mask isn't empty: */
     120    if (m_newData.m_strMask.isEmpty())
     121    {
     122        UINotificationMessage::warnAboutInvalidIPv4Mask(m_newData.m_strMask);
     123        return false;
     124    }
     125    /* Make sure lower bound isn't empty: */
     126    if (m_newData.m_strLBnd.isEmpty())
     127    {
     128        UINotificationMessage::warnAboutInvalidDHCPServerLowerAddress(m_newData.m_strLBnd);
     129        return false;
     130    }
     131    /* Make sure upper bound isn't empty: */
     132    if (m_newData.m_strUBnd.isEmpty())
     133    {
     134        UINotificationMessage::warnAboutInvalidDHCPServerUpperAddress(m_newData.m_strUBnd);
     135        return false;
     136    }
     137
     138#else /* !VBOX_WS_MAC */
     139
    77140    /* Validate 'Interface' tab content: */
    78141    if (   m_newData.m_interface.m_fDHCPEnabled
     
    148211        return false;
    149212    }
     213#endif /* !VBOX_WS_MAC */
    150214
    151215    /* True by default: */
     
    167231//               m_newData.m_dhcpserver.m_strUpperAddress.toUtf8().constData());
    168232
     233#ifdef VBOX_WS_MAC
     234    /* Update 'Apply' / 'Reset' button states: */
     235    if (m_pButtonBox)
     236    {
     237        m_pButtonBox->button(QDialogButtonBox::Cancel)->setEnabled(m_oldData != m_newData);
     238        m_pButtonBox->button(QDialogButtonBox::Ok)->setEnabled(m_oldData != m_newData);
     239    }
     240#else /* !VBOX_WS_MAC */
    169241    /* Update 'Apply' / 'Reset' button states: */
    170242    if (m_pButtonBoxInterface)
     
    178250        m_pButtonBoxServer->button(QDialogButtonBox::Ok)->setEnabled(m_oldData != m_newData);
    179251    }
     252#endif /* !VBOX_WS_MAC */
    180253
    181254    /* Notify listeners as well: */
     
    185258void UIDetailsWidgetHostNetwork::retranslateUi()
    186259{
     260#ifdef VBOX_WS_MAC
     261    if (m_pLabelName)
     262        m_pLabelName->setText(tr("&Name:"));
     263    if (m_pEditorName)
     264        m_pEditorName->setToolTip(tr("Holds the name for this network."));
     265    if (m_pLabelMask)
     266        m_pLabelMask->setText(tr("&Mask:"));
     267    if (m_pEditorMask)
     268        m_pEditorMask->setToolTip(tr("Holds the mask for this network."));
     269    if (m_pLabelLBnd)
     270        m_pLabelLBnd->setText(tr("&Lower Bound:"));
     271    if (m_pEditorLBnd)
     272        m_pEditorLBnd->setToolTip(tr("Holds the lower address bound for this network."));
     273    if (m_pLabelUBnd)
     274        m_pLabelUBnd->setText(tr("&Upper Bound:"));
     275    if (m_pEditorUBnd)
     276        m_pEditorUBnd->setToolTip(tr("Holds the upper address bound for this network."));
     277    if (m_pButtonBox)
     278    {
     279        m_pButtonBox->button(QDialogButtonBox::Cancel)->setText(tr("Reset"));
     280        m_pButtonBox->button(QDialogButtonBox::Ok)->setText(tr("Apply"));
     281        m_pButtonBox->button(QDialogButtonBox::Cancel)->setShortcut(Qt::Key_Escape);
     282        m_pButtonBox->button(QDialogButtonBox::Ok)->setShortcut(QString("Ctrl+Return"));
     283        m_pButtonBox->button(QDialogButtonBox::Cancel)->setStatusTip(tr("Reset changes in current network details"));
     284        m_pButtonBox->button(QDialogButtonBox::Ok)->setStatusTip(tr("Apply changes in current network details"));
     285        m_pButtonBox->button(QDialogButtonBox::Cancel)->
     286            setToolTip(tr("Reset Changes (%1)").arg(m_pButtonBox->button(QDialogButtonBox::Cancel)->shortcut().toString()));
     287        m_pButtonBox->button(QDialogButtonBox::Ok)->
     288            setToolTip(tr("Apply Changes (%1)").arg(m_pButtonBox->button(QDialogButtonBox::Ok)->shortcut().toString()));
     289    }
     290
     291#else /* !VBOX_WS_MAC */
     292
    187293    /* Translate tab-widget: */
    188294    if (m_pTabWidget)
     
    262368            setToolTip(tr("Apply Changes (%1)").arg(m_pButtonBoxServer->button(QDialogButtonBox::Ok)->shortcut().toString()));
    263369    }
    264 }
     370#endif /* !VBOX_WS_MAC */
     371}
     372
     373#ifdef VBOX_WS_MAC
     374void UIDetailsWidgetHostNetwork::sltTextChangedName(const QString &strText)
     375{
     376    m_newData.m_strName = strText;
     377    updateButtonStates();
     378}
     379
     380void UIDetailsWidgetHostNetwork::sltTextChangedMask(const QString &strText)
     381{
     382    m_newData.m_strMask = strText;
     383    updateButtonStates();
     384}
     385
     386void UIDetailsWidgetHostNetwork::sltTextChangedLBnd(const QString &strText)
     387{
     388    m_newData.m_strLBnd = strText;
     389    updateButtonStates();
     390}
     391
     392void UIDetailsWidgetHostNetwork::sltTextChangedUBnd(const QString &strText)
     393{
     394    m_newData.m_strUBnd = strText;
     395    updateButtonStates();
     396}
     397
     398#else /* !VBOX_WS_MAC */
    265399
    266400void UIDetailsWidgetHostNetwork::sltToggledButtonAutomatic(bool fChecked)
     
    332466    updateButtonStates();
    333467}
     468#endif /* !VBOX_WS_MAC */
    334469
    335470void UIDetailsWidgetHostNetwork::sltHandleButtonBoxClick(QAbstractButton *pButton)
    336471{
     472#ifdef VBOX_WS_MAC
     473    /* Make sure button-box exists: */
     474    if (!m_pButtonBox)
     475        return;
     476
     477    /* Disable buttons first of all: */
     478    m_pButtonBox->button(QDialogButtonBox::Cancel)->setEnabled(false);
     479    m_pButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
     480
     481    /* Compare with known buttons: */
     482    if (   pButton == m_pButtonBox->button(QDialogButtonBox::Cancel))
     483        emit sigDataChangeRejected();
     484    else
     485    if (   pButton == m_pButtonBox->button(QDialogButtonBox::Ok))
     486        emit sigDataChangeAccepted();
     487
     488#else /* !VBOX_WS_MAC */
     489
    337490    /* Make sure button-boxes exist: */
    338491    if (!m_pButtonBoxInterface || !m_pButtonBoxServer)
     
    353506        || pButton == m_pButtonBoxServer->button(QDialogButtonBox::Ok))
    354507        emit sigDataChangeAccepted();
     508#endif /* !VBOX_WS_MAC */
    355509}
    356510
     
    369523void UIDetailsWidgetHostNetwork::prepareThis()
    370524{
     525#ifdef VBOX_WS_MAC
     526    /* Create layout: */
     527    QGridLayout *pLayout = new QGridLayout(this);
     528    if (pLayout)
     529    {
     530        // really macOS only:
     531        pLayout->setSpacing(10);
     532        pLayout->setContentsMargins(10, 10, 10, 10);
     533
     534        /* Prepare options: */
     535        prepareOptions();
     536    }
     537
     538#else /* !VBOX_WS_MAC */
     539
    371540    /* Create layout: */
    372541    new QVBoxLayout(this);
     
    379548        prepareTabWidget();
    380549    }
    381 }
     550#endif /* !VBOX_WS_MAC */
     551}
     552
     553#ifdef VBOX_WS_MAC
     554void UIDetailsWidgetHostNetwork::prepareOptions()
     555{
     556    /* Acquire layout: */
     557    QGridLayout *pLayout = static_cast<QGridLayout*>(layout());
     558    if (pLayout)
     559    {
     560        /* Prepare name label: */
     561        m_pLabelName = new QLabel(this);
     562        if (m_pLabelName)
     563        {
     564            m_pLabelName->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
     565            pLayout->addWidget(m_pLabelName, 0, 0);
     566        }
     567        /* Prepare name editor: */
     568        m_pEditorName = new QILineEdit(this);
     569        if (m_pEditorName)
     570        {
     571            m_pLabelName->setBuddy(m_pEditorName);
     572            connect(m_pEditorName, &QLineEdit::textChanged,
     573                    this, &UIDetailsWidgetHostNetwork::sltTextChangedName);
     574
     575            pLayout->addWidget(m_pEditorName, 0, 1);
     576        }
     577
     578        /* Prepare mask label: */
     579        m_pLabelMask = new QLabel(this);
     580        if (m_pLabelMask)
     581        {
     582            m_pLabelMask->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
     583            pLayout->addWidget(m_pLabelMask, 1, 0);
     584        }
     585        /* Prepare mask editor: */
     586        m_pEditorMask = new QILineEdit(this);
     587        if (m_pEditorMask)
     588        {
     589            m_pLabelMask->setBuddy(m_pEditorMask);
     590            connect(m_pEditorMask, &QLineEdit::textChanged,
     591                    this, &UIDetailsWidgetHostNetwork::sltTextChangedMask);
     592
     593            pLayout->addWidget(m_pEditorMask, 1, 1);
     594        }
     595
     596        /* Prepare lower bound label: */
     597        m_pLabelLBnd = new QLabel(this);
     598        if (m_pLabelLBnd)
     599        {
     600            m_pLabelLBnd->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
     601            pLayout->addWidget(m_pLabelLBnd, 2, 0);
     602        }
     603        /* Prepare lower bound editor: */
     604        m_pEditorLBnd = new QILineEdit(this);
     605        if (m_pEditorLBnd)
     606        {
     607            m_pLabelLBnd->setBuddy(m_pEditorLBnd);
     608            connect(m_pEditorLBnd, &QLineEdit::textChanged,
     609                    this, &UIDetailsWidgetHostNetwork::sltTextChangedLBnd);
     610
     611            pLayout->addWidget(m_pEditorLBnd, 2, 1);
     612        }
     613
     614        /* Prepare upper bound label: */
     615        m_pLabelUBnd = new QLabel(this);
     616        if (m_pLabelUBnd)
     617        {
     618            m_pLabelUBnd->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
     619            pLayout->addWidget(m_pLabelUBnd, 3, 0);
     620        }
     621        /* Prepare upper bound editor: */
     622        m_pEditorUBnd = new QILineEdit(this);
     623        if (m_pEditorUBnd)
     624        {
     625            m_pLabelUBnd->setBuddy(m_pEditorUBnd);
     626            connect(m_pEditorUBnd, &QLineEdit::textChanged,
     627                    this, &UIDetailsWidgetHostNetwork::sltTextChangedUBnd);
     628
     629            pLayout->addWidget(m_pEditorUBnd, 3, 1);
     630        }
     631
     632        /* If parent embedded into stack: */
     633        if (m_enmEmbedding == EmbedTo_Stack)
     634        {
     635            /* Prepare button-box: */
     636            m_pButtonBox = new QIDialogButtonBox(this);
     637            if (m_pButtonBox)
     638            {
     639                m_pButtonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok);
     640                connect(m_pButtonBox, &QIDialogButtonBox::clicked, this, &UIDetailsWidgetHostNetwork::sltHandleButtonBoxClick);
     641
     642                pLayout->addWidget(m_pButtonBox, 4, 0, 1, 2);
     643            }
     644        }
     645    }
     646}
     647
     648#else /* !VBOX_WS_MAC */
    382649
    383650void UIDetailsWidgetHostNetwork::prepareTabWidget()
     
    7621029    }
    7631030}
     1031#endif /* !VBOX_WS_MAC */
     1032
     1033#ifdef VBOX_WS_MAC
     1034void UIDetailsWidgetHostNetwork::loadData()
     1035{
     1036    /* Check whether network exists and configurable: */
     1037    const bool fIsNetworkExists = m_newData.m_fExists;
     1038
     1039    /* Toggle network fields availability: */
     1040    if (m_pLabelName)
     1041        m_pLabelName->setEnabled(fIsNetworkExists);
     1042    if (m_pEditorName)
     1043        m_pEditorName->setEnabled(fIsNetworkExists);
     1044    if (m_pLabelMask)
     1045        m_pLabelMask->setEnabled(fIsNetworkExists);
     1046    if (m_pEditorMask)
     1047        m_pEditorMask->setEnabled(fIsNetworkExists);
     1048    if (m_pLabelLBnd)
     1049        m_pLabelLBnd->setEnabled(fIsNetworkExists);
     1050    if (m_pEditorLBnd)
     1051        m_pEditorLBnd->setEnabled(fIsNetworkExists);
     1052    if (m_pLabelUBnd)
     1053        m_pLabelUBnd->setEnabled(fIsNetworkExists);
     1054    if (m_pEditorUBnd)
     1055        m_pEditorUBnd->setEnabled(fIsNetworkExists);
     1056
     1057    /* Load network fields: */
     1058    if (m_pEditorName)
     1059        m_pEditorName->setText(m_newData.m_strName);
     1060    if (m_pEditorMask)
     1061        m_pEditorMask->setText(m_newData.m_strMask);
     1062    if (m_pEditorLBnd)
     1063        m_pEditorLBnd->setText(m_newData.m_strLBnd);
     1064    if (m_pEditorUBnd)
     1065        m_pEditorUBnd->setText(m_newData.m_strUBnd);
     1066}
     1067
     1068#else /* !VBOX_WS_MAC */
    7641069
    7651070void UIDetailsWidgetHostNetwork::loadDataForInterface()
     
    8761181    }
    8771182}
     1183#endif /* !VBOX_WS_MAC */
  • trunk/src/VBox/Frontends/VirtualBox/src/networkmanager/UIDetailsWidgetHostNetwork.h

    r92811 r92821  
    3838class QITabWidget;
    3939
     40
     41#ifdef VBOX_WS_MAC
     42/** Network Manager: Host network data structure. */
     43struct UIDataHostNetwork
     44{
     45    /** Constructs data. */
     46    UIDataHostNetwork()
     47        : m_fExists(false)
     48        , m_strName(QString())
     49        , m_strMask(QString())
     50        , m_strLBnd(QString())
     51        , m_strUBnd(QString())
     52    {}
     53
     54    /** Returns whether the @a other passed data is equal to this one. */
     55    bool equal(const UIDataHostNetwork &other) const
     56    {
     57        return true
     58               && (m_fExists == other.m_fExists)
     59               && (m_strName == other.m_strName)
     60               && (m_strMask == other.m_strMask)
     61               && (m_strLBnd == other.m_strLBnd)
     62               && (m_strUBnd == other.m_strUBnd)
     63               ;
     64    }
     65
     66    /** Returns whether the @a other passed data is equal to this one. */
     67    bool operator==(const UIDataHostNetwork &other) const { return equal(other); }
     68    /** Returns whether the @a other passed data is different from this one. */
     69    bool operator!=(const UIDataHostNetwork &other) const { return !equal(other); }
     70
     71    /** Holds this interface is not NULL. */
     72    bool     m_fExists;
     73    /** Holds network name. */
     74    QString  m_strName;
     75    /** Holds network mask. */
     76    QString  m_strMask;
     77    /** Holds lower bound. */
     78    QString  m_strLBnd;
     79    /** Holds upper bound. */
     80    QString  m_strUBnd;
     81};
     82
     83#else /* !VBOX_WS_MAC */
    4084
    4185/** Network Manager: Host Network Interface data structure. */
     
    161205    UIDataDHCPServer            m_dhcpserver;
    162206};
     207#endif /* !VBOX_WS_MAC */
    163208
    164209
     
    186231    /** Returns the host network data. */
    187232    const UIDataHostNetwork &data() const { return m_newData; }
     233#ifdef VBOX_WS_MAC
     234    /** Defines the host network @a data.
     235      * @param  busyNames  Holds the list of names busy by other networks. */
     236    void setData(const UIDataHostNetwork &data,
     237                 const QStringList &busyNames = QStringList());
     238#else /* !VBOX_WS_MAC */
    188239    /** Defines the host network @a data. */
    189240    void setData(const UIDataHostNetwork &data);
     241#endif /* !VBOX_WS_MAC */
    190242
    191243    /** @name Change handling stuff.
     
    207259    /** @name Change handling stuff.
    208260      * @{ */
     261#ifdef VBOX_WS_MAC
     262        /** Handles network name text change. */
     263        void sltTextChangedName(const QString &strText);
     264        /** Handles network mask text change. */
     265        void sltTextChangedMask(const QString &strText);
     266        /** Handles network lower bound text change. */
     267        void sltTextChangedLBnd(const QString &strText);
     268        /** Handles network upper bound text change. */
     269        void sltTextChangedUBnd(const QString &strText);
     270
     271#else /* !VBOX_WS_MAC */
     272
    209273        /** Handles interface automatic configuration choice change. */
    210274        void sltToggledButtonAutomatic(bool fChecked);
     
    230294        /** Handles DHCP server upper address text change. */
    231295        void sltTextChangedUpperAddress(const QString &strText);
     296#endif /* !VBOX_WS_MAC */
    232297
    233298        /** Handles button-box button click. */
     
    243308        /** Prepares this. */
    244309        void prepareThis();
     310#ifdef VBOX_WS_MAC
     311        /** Prepares options. */
     312        void prepareOptions();
     313#else /* !VBOX_WS_MAC */
    245314        /** Prepares tab-widget. */
    246315        void prepareTabWidget();
     
    249318        /** Prepares 'DHCP server' tab. */
    250319        void prepareTabDHCPServer();
     320#endif /* !VBOX_WS_MAC */
    251321    /** @} */
    252322
    253323    /** @name Loading stuff.
    254324      * @{ */
     325#ifdef VBOX_WS_MAC
     326        /** Loads data. */
     327        void loadData();
     328#else /* !VBOX_WS_MAC */
    255329        /** Loads interface data. */
    256330        void loadDataForInterface();
    257331        /** Loads server data. */
    258332        void loadDataForDHCPServer();
     333#endif /* !VBOX_WS_MAC */
    259334    /** @} */
    260335
     
    269344        UIDataHostNetwork  m_newData;
    270345
     346#ifndef VBOX_WS_MAC
    271347        /** Holds the tab-widget. */
    272348        QITabWidget *m_pTabWidget;
    273     /** @} */
     349#endif /* !VBOX_WS_MAC */
     350    /** @} */
     351
     352#ifdef VBOX_WS_MAC
     353    /** @name Network variables.
     354      * @{ */
     355        /** Holds the name label. */
     356        QLabel       *m_pLabelName;
     357        /** Holds the name editor. */
     358        QILineEdit   *m_pEditorName;
     359
     360        /** Holds the mask label. */
     361        QLabel       *m_pLabelMask;
     362        /** Holds the mask editor. */
     363        QILineEdit   *m_pEditorMask;
     364
     365        /** Holds the lower bound label. */
     366        QLabel       *m_pLabelLBnd;
     367        /** Holds the lower bound editor. */
     368        QILineEdit   *m_pEditorLBnd;
     369
     370        /** Holds the upper bound label. */
     371        QLabel       *m_pLabelUBnd;
     372        /** Holds the upper bound editor. */
     373        QILineEdit   *m_pEditorUBnd;
     374
     375        /** Holds the button-box instance. */
     376        QIDialogButtonBox *m_pButtonBox;
     377
     378        /** Holds the list of names busy by other networks. */
     379        QStringList  m_busyNames;
     380    /** @} */
     381
     382#else /* !VBOX_WS_MAC */
    274383
    275384    /** @name Interface variables.
     
    333442        QIDialogButtonBox *m_pButtonBoxServer;
    334443    /** @} */
     444#endif /* !VBOX_WS_MAC */
    335445};
    336446
  • trunk/src/VBox/Frontends/VirtualBox/src/networkmanager/UINetworkManager.cpp

    r92811 r92821  
    4747#include "CDHCPServer.h"
    4848#include "CHost.h"
    49 #include "CHostNetworkInterface.h"
     49#ifdef VBOX_WS_MAC
     50# include "CHostOnlyNetwork.h"
     51#else
     52# include "CHostNetworkInterface.h"
     53#endif
    5054#include "CNATNetwork.h"
    5155
     
    6266};
    6367
     68
     69#ifdef VBOX_WS_MAC
     70/** Host network tree-widget column indexes. */
     71enum HostNetworkColumn
     72{
     73    HostNetworkColumn_Name,
     74    HostNetworkColumn_Mask,
     75    HostNetworkColumn_LBnd,
     76    HostNetworkColumn_UBnd,
     77    HostNetworkColumn_Max,
     78};
     79
     80#else /* !VBOX_WS_MAC */
    6481
    6582/** Host network tree-widget column indexes. */
     
    7289    HostNetworkColumn_Max,
    7390};
     91#endif /* !VBOX_WS_MAC */
    7492
    7593
     
    105123    void updateFields();
    106124
     125#ifdef VBOX_WS_MAC
     126    /** Returns item name. */
     127    QString name() const { return m_strName; }
     128#else
    107129    /** Returns item name. */
    108130    QString name() const { return m_interface.m_strName; }
     131#endif
    109132
    110133private:
    111134
     135#ifndef VBOX_WS_MAC
    112136    /** Returns CIDR for a passed @a strMask. */
    113137    static int maskToCidr(const QString &strMask);
     138#endif
    114139};
    115140
     
    161186void UIItemHostNetwork::updateFields()
    162187{
     188#ifdef VBOX_WS_MAC
     189    /* Compose item fields: */
     190    setText(HostNetworkColumn_Name, m_strName);
     191    setText(HostNetworkColumn_Mask, m_strMask);
     192    setText(HostNetworkColumn_LBnd, m_strLBnd);
     193    setText(HostNetworkColumn_UBnd, m_strUBnd);
     194
     195    /* Compose item tool-tip: */
     196    const QString strTable("<table cellspacing=5>%1</table>");
     197    const QString strHeader("<tr><td><nobr>%1:&nbsp;</nobr></td><td><nobr>%2</nobr></td></tr>");
     198    QString strToolTip;
     199
     200    /* Network information: */
     201    strToolTip += strHeader.arg(tr("Name"), m_strName);
     202    strToolTip += strHeader.arg(tr("Mask"), m_strMask);
     203    strToolTip += strHeader.arg(tr("Lower Bound"), m_strLBnd);
     204    strToolTip += strHeader.arg(tr("Upper Bound"), m_strUBnd);
     205
     206#else /* !VBOX_WS_MAC */
     207
    163208    /* Compose item fields: */
    164209    setText(HostNetworkColumn_Name, m_interface.m_strName);
     
    224269                                       m_dhcpserver.m_strUpperAddress);
    225270    }
     271#endif /* !VBOX_WS_MAC */
    226272
    227273    /* Assign tool-tip finally: */
     
    229275}
    230276
     277#ifndef VBOX_WS_MAC
    231278/* static */
    232279int UIItemHostNetwork::maskToCidr(const QString &strMask)
     
    259306    return iCidr;
    260307}
     308#endif /* !VBOX_WS_MAC */
    261309
    262310
     
    387435    if (m_pTreeWidgetHostNetwork)
    388436    {
     437#ifdef VBOX_WS_MAC
     438        const QStringList fields = QStringList()
     439                                   << UINetworkManager::tr("Name")
     440                                   << UINetworkManager::tr("Mask")
     441                                   << UINetworkManager::tr("Lower Bound")
     442                                   << UINetworkManager::tr("Upper Bound");
     443#else /* !VBOX_WS_MAC */
    389444        const QStringList fields = QStringList()
    390445                                   << UINetworkManager::tr("Name")
     
    392447                                   << UINetworkManager::tr("IPv6 Prefix")
    393448                                   << UINetworkManager::tr("DHCP Server");
     449#endif /* !VBOX_WS_MAC */
    394450        m_pTreeWidgetHostNetwork->setHeaderLabels(fields);
    395451    }
     
    471527        return;
    472528
     529    /* Check host network tree-widget: */
     530    AssertMsgReturnVoid(m_pTreeWidgetHostNetwork, ("Host network tree-widget isn't created!\n"));
     531
     532#ifdef VBOX_WS_MAC
     533    /* Compose a set of busy names: */
     534    QSet<QString> names;
     535    for (int i = 0; i < m_pTreeWidgetHostNetwork->topLevelItemCount(); ++i)
     536        names << qobject_cast<UIItemHostNetwork*>(m_pTreeWidgetHostNetwork->childItem(i))->name();
     537    /* Compose a map of busy indexes: */
     538    QMap<int, bool> presence;
     539    const QString strNameTemplate("HostNetwork%1");
     540    const QRegExp regExp(strNameTemplate.arg("([\\d]*)"));
     541    foreach (const QString &strName, names)
     542        if (regExp.indexIn(strName) != -1)
     543            presence[regExp.cap(1).toInt()] = true;
     544    /* Search for a minimum index: */
     545    int iMinimumIndex = 0;
     546    for (int i = 0; !presence.isEmpty() && i <= presence.lastKey() + 1; ++i)
     547        if (!presence.contains(i))
     548        {
     549            iMinimumIndex = i;
     550            break;
     551        }
     552    /* Compose resulting index and name: */
     553    const QString strNetworkName = strNameTemplate.arg(iMinimumIndex == 0 ? QString() : QString::number(iMinimumIndex));
     554
     555    /* Compose new item data: */
     556    UIDataHostNetwork oldData;
     557    oldData.m_fExists = true;
     558    oldData.m_strName = strNetworkName;
     559
     560    /* Get VirtualBox for further activities: */
     561    CVirtualBox comVBox = uiCommon().virtualBox();
     562
     563    /* Create network: */
     564    CHostOnlyNetwork comNetwork = comVBox.CreateHostOnlyNetwork(oldData.m_strName);
     565    CHostOnlyNetwork comNetworkBase = comNetwork;
     566
     567    /* Show error message if necessary: */
     568    if (!comVBox.isOk())
     569        UINotificationMessage::cannotCreateHostOnlyNetwork(comVBox);
     570    else
     571    {
     572        /* Save host network name: */
     573        if (comNetwork.isOk())
     574            comNetwork.SetNetworkName(oldData.m_strName);
     575
     576        /* Show error message if necessary: */
     577        if (!comNetwork.isOk())
     578            UINotificationMessage::cannotChangeHostOnlyNetworkParameter(comNetwork);
     579
     580        /* Add network to the tree: */
     581        UIDataHostNetwork newData;
     582        loadHostNetwork(comNetworkBase, newData);
     583        createItemForHostNetwork(newData, true);
     584
     585        /* Adjust tree-widgets: */
     586        sltAdjustTreeWidgets();
     587    }
     588
     589#else /* !VBOX_WS_MAC */
     590
    473591    /* Get host for further activities: */
    474592    CHost comHost = uiCommon().host();
     
    481599            this, &UINetworkManagerWidget::sigHandleHostOnlyNetworkInterfaceCreated);
    482600    gpNotificationCenter->append(pNotification);
    483 }
    484 
     601#endif /* !VBOX_WS_MAC */
     602}
     603
     604#ifndef VBOX_WS_MAC
    485605void UINetworkManagerWidget::sigHandleHostOnlyNetworkInterfaceCreated(const CHostNetworkInterface &comInterface)
    486606{
     
    514634    }
    515635}
     636#endif  /* !VBOX_WS_MAC */
    516637
    517638void UINetworkManagerWidget::sltRemoveHostNetwork()
     
    527648    UIItemHostNetwork *pItem = static_cast<UIItemHostNetwork*>(m_pTreeWidgetHostNetwork->currentItem());
    528649    AssertMsgReturnVoid(pItem, ("Current item must not be null!\n"));
     650
     651#ifdef VBOX_WS_MAC
     652
     653    /* Get network name: */
     654    const QString strNetworkName(pItem->name());
     655
     656    /* Confirm host network removal: */
     657    if (!msgCenter().confirmHostOnlyNetworkRemoval(strNetworkName, this))
     658        return;
     659
     660    /* Get VirtualBox for further activities: */
     661    CVirtualBox comVBox = uiCommon().virtualBox();
     662
     663    /* Find corresponding network: */
     664    const CHostOnlyNetwork &comNetwork = comVBox.FindHostOnlyNetworkByName(strNetworkName);
     665
     666    /* Show error message if necessary: */
     667    if (!comVBox.isOk() || comNetwork.isNull())
     668        UINotificationMessage::cannotFindHostOnlyNetwork(comVBox, strNetworkName);
     669    else
     670    {
     671        /* Remove network finally: */
     672        comVBox.RemoveHostOnlyNetwork(comNetwork);
     673
     674        /* Show error message if necessary: */
     675        if (!comVBox.isOk())
     676            UINotificationMessage::cannotRemoveHostOnlyNetwork(comVBox, strNetworkName);
     677        else
     678        {
     679            /* Move selection to somewhere else: */
     680            if (m_pTreeWidgetHostNetwork->itemBelow(pItem))
     681                m_pTreeWidgetHostNetwork->setCurrentItem(m_pTreeWidgetHostNetwork->itemBelow(pItem));
     682            else if (m_pTreeWidgetHostNetwork->itemAbove(pItem))
     683                m_pTreeWidgetHostNetwork->setCurrentItem(m_pTreeWidgetHostNetwork->itemAbove(pItem));
     684            else
     685                m_pTreeWidgetHostNetwork->setCurrentItem(0);
     686
     687            /* Remove interface from the tree: */
     688            delete pItem;
     689
     690            /* Adjust tree-widgets: */
     691            sltAdjustTreeWidgets();
     692        }
     693    }
     694
     695#else /* !VBOX_WS_MAC */
    529696
    530697    /* Get interface name: */
     
    583750        }
    584751    }
    585 }
    586 
     752#endif /* !VBOX_WS_MAC */
     753}
     754
     755#ifndef VBOX_WS_MAC
    587756void UINetworkManagerWidget::sigHandleHostOnlyNetworkInterfaceRemoved(const QString &strInterfaceName)
    588757{
     
    609778    sltAdjustTreeWidgets();
    610779}
     780#endif /* !VBOX_WS_MAC */
    611781
    612782void UINetworkManagerWidget::sltCreateNATNetwork()
     
    9701140        /* Calculate the total tree-widget width: */
    9711141        const int iTotal = m_pTreeWidgetHostNetwork->viewport()->width();
     1142#ifdef VBOX_WS_MAC
     1143        /* Look for a minimum width hints for non-important columns: */
     1144        const int iMinWidth1 = qMax(pItemView->sizeHintForColumn(HostNetworkColumn_Mask), pItemHeader->sectionSizeHint(HostNetworkColumn_Mask));
     1145        const int iMinWidth2 = qMax(pItemView->sizeHintForColumn(HostNetworkColumn_LBnd), pItemHeader->sectionSizeHint(HostNetworkColumn_LBnd));
     1146        const int iMinWidth3 = qMax(pItemView->sizeHintForColumn(HostNetworkColumn_UBnd), pItemHeader->sectionSizeHint(HostNetworkColumn_UBnd));
     1147#else /* !VBOX_WS_MAC */
    9721148        /* Look for a minimum width hints for non-important columns: */
    9731149        const int iMinWidth1 = qMax(pItemView->sizeHintForColumn(HostNetworkColumn_IPv4), pItemHeader->sectionSizeHint(HostNetworkColumn_IPv4));
    9741150        const int iMinWidth2 = qMax(pItemView->sizeHintForColumn(HostNetworkColumn_IPv6), pItemHeader->sectionSizeHint(HostNetworkColumn_IPv6));
    9751151        const int iMinWidth3 = qMax(pItemView->sizeHintForColumn(HostNetworkColumn_DHCP), pItemHeader->sectionSizeHint(HostNetworkColumn_DHCP));
     1152#endif /* !VBOX_WS_MAC */
    9761153        /* Propose suitable width hints for non-important columns: */
    9771154        const int iWidth1 = iMinWidth1 < iTotal / HostNetworkColumn_Max ? iMinWidth1 : iTotal / HostNetworkColumn_Max;
     
    9791156        const int iWidth3 = iMinWidth3 < iTotal / HostNetworkColumn_Max ? iMinWidth3 : iTotal / HostNetworkColumn_Max;
    9801157        /* Apply the proposal: */
     1158#ifdef VBOX_WS_MAC
     1159        m_pTreeWidgetHostNetwork->setColumnWidth(HostNetworkColumn_Mask, iWidth1);
     1160        m_pTreeWidgetHostNetwork->setColumnWidth(HostNetworkColumn_LBnd, iWidth2);
     1161        m_pTreeWidgetHostNetwork->setColumnWidth(HostNetworkColumn_UBnd, iWidth3);
     1162#else /* !VBOX_WS_MAC */
    9811163        m_pTreeWidgetHostNetwork->setColumnWidth(HostNetworkColumn_IPv4, iWidth1);
    9821164        m_pTreeWidgetHostNetwork->setColumnWidth(HostNetworkColumn_IPv6, iWidth2);
    9831165        m_pTreeWidgetHostNetwork->setColumnWidth(HostNetworkColumn_DHCP, iWidth3);
     1166#endif /* !VBOX_WS_MAC */
    9841167        m_pTreeWidgetHostNetwork->setColumnWidth(HostNetworkColumn_Name, iTotal - iWidth1 - iWidth2 - iWidth3);
    9851168    }
     
    10941277        UIDataHostNetwork oldData = *pItem;
    10951278        UIDataHostNetwork newData = m_pDetailsWidgetHostNetwork->data();
     1279
     1280#ifdef VBOX_WS_MAC
     1281        /* Get VirtualBox for further activities: */
     1282        CVirtualBox comVBox = uiCommon().virtualBox();
     1283
     1284        /* Find corresponding network: */
     1285        CHostOnlyNetwork comNetwork = comVBox.FindHostOnlyNetworkByName(oldData.m_strName);
     1286        CHostOnlyNetwork comNetworkBase = comNetwork;
     1287
     1288        /* Show error message if necessary: */
     1289        if (!comVBox.isOk() || comNetwork.isNull())
     1290            UINotificationMessage::cannotFindHostOnlyNetwork(comVBox, oldData.m_strName);
     1291        else
     1292        {
     1293            /* Save host network name: */
     1294            if (comNetwork.isOk() && newData.m_strName != oldData.m_strName)
     1295                comNetwork.SetNetworkName(newData.m_strName);
     1296            /* Save host network mask: */
     1297            if (comNetwork.isOk() && newData.m_strMask != oldData.m_strMask)
     1298                comNetwork.SetNetworkMask(newData.m_strMask);
     1299            /* Save host network lower bound: */
     1300            if (comNetwork.isOk() && newData.m_strLBnd != oldData.m_strLBnd)
     1301                comNetwork.SetLowerIP(newData.m_strLBnd);
     1302            /* Save host network upper bound: */
     1303            if (comNetwork.isOk() && newData.m_strUBnd != oldData.m_strUBnd)
     1304                comNetwork.SetUpperIP(newData.m_strUBnd);
     1305
     1306            /* Show error message if necessary: */
     1307            if (!comNetwork.isOk())
     1308                UINotificationMessage::cannotChangeHostOnlyNetworkParameter(comNetwork);
     1309
     1310            /* Update network in the tree: */
     1311            UIDataHostNetwork data;
     1312            loadHostNetwork(comNetworkBase, data);
     1313            updateItemForHostNetwork(data, true, pItem);
     1314
     1315            /* Make sure current item fetched: */
     1316            sltHandleCurrentItemChangeHostNetwork();
     1317
     1318            /* Adjust tree-widgets: */
     1319            sltAdjustTreeWidgets();
     1320        }
     1321
     1322#else /* !VBOX_WS_MAC */
    10961323
    10971324        /* Get host for further activities: */
     
    12031430            }
    12041431        }
     1432#endif /* !VBOX_WS_MAC */
    12051433    }
    12061434
     
    18172045    m_pTreeWidgetHostNetwork->clear();
    18182046
     2047#ifdef VBOX_WS_MAC
     2048    /* Get VirtualBox for further activities: */
     2049    const CVirtualBox comVBox = uiCommon().virtualBox();
     2050
     2051    /* Get networks for further activities: */
     2052    const QVector<CHostOnlyNetwork> networks = comVBox.GetHostOnlyNetworks();
     2053
     2054    /* Show error message if necessary: */
     2055    if (!comVBox.isOk())
     2056        UINotificationMessage::cannotAcquireVirtualBoxParameter(comVBox);
     2057    else
     2058    {
     2059        /* For each host network => load it to the tree: */
     2060        foreach (const CHostOnlyNetwork &comNetwork, networks)
     2061        {
     2062            UIDataHostNetwork data;
     2063            loadHostNetwork(comNetwork, data);
     2064            createItemForHostNetwork(data, false);
     2065        }
     2066
     2067        /* Choose the 1st item as current initially: */
     2068        m_pTreeWidgetHostNetwork->setCurrentItem(m_pTreeWidgetHostNetwork->topLevelItem(0));
     2069        sltHandleCurrentItemChangeHostNetwork();
     2070
     2071        /* Adjust tree-widgets: */
     2072        sltAdjustTreeWidgets();
     2073    }
     2074
     2075#else /* !VBOX_WS_MAC */
     2076
    18192077    /* Get host for further activities: */
    18202078    const CHost comHost = uiCommon().host();
     
    18442102        sltAdjustTreeWidgets();
    18452103    }
    1846 }
     2104#endif /* !VBOX_WS_MAC */
     2105}
     2106
     2107#ifdef VBOX_WS_MAC
     2108void UINetworkManagerWidget::loadHostNetwork(const CHostOnlyNetwork &comNetwork, UIDataHostNetwork &data)
     2109{
     2110    /* Gather network settings: */
     2111    if (comNetwork.isNotNull())
     2112        data.m_fExists = true;
     2113    if (comNetwork.isOk())
     2114        data.m_strName = comNetwork.GetNetworkName();
     2115    if (comNetwork.isOk())
     2116        data.m_strMask = comNetwork.GetNetworkMask();
     2117    if (comNetwork.isOk())
     2118        data.m_strLBnd = comNetwork.GetLowerIP();
     2119    if (comNetwork.isOk())
     2120        data.m_strUBnd = comNetwork.GetUpperIP();
     2121
     2122    /* Show error message if necessary: */
     2123    if (!comNetwork.isOk())
     2124        UINotificationMessage::cannotAcquireHostOnlyNetworkParameter(comNetwork);
     2125}
     2126
     2127#else /* !VBOX_WS_MAC */
    18472128
    18482129void UINetworkManagerWidget::loadHostNetwork(const CHostNetworkInterface &comInterface, UIDataHostNetwork &data)
     
    19052186    }
    19062187}
     2188#endif /* !VBOX_WS_MAC */
    19072189
    19082190void UINetworkManagerWidget::loadNATNetworks()
     
    21992481}
    22002482
     2483#ifdef VBOX_WS_MAC
     2484QStringList UINetworkManagerWidget::busyNamesHost() const
     2485{
     2486    QStringList names;
     2487    for (int i = 0; i < m_pTreeWidgetHostNetwork->topLevelItemCount(); ++i)
     2488    {
     2489        UIItemHostNetwork *pItem = qobject_cast<UIItemHostNetwork*>(m_pTreeWidgetHostNetwork->childItem(i));
     2490        const QString strItemName(pItem->name());
     2491        if (!strItemName.isEmpty() && !names.contains(strItemName))
     2492            names << strItemName;
     2493    }
     2494    return names;
     2495}
     2496#endif /* VBOX_WS_MAC */
     2497
    22012498QStringList UINetworkManagerWidget::busyNamesNAT() const
    22022499{
  • trunk/src/VBox/Frontends/VirtualBox/src/networkmanager/UINetworkManager.h

    r92810 r92821  
    3131/* Forward declarations: */
    3232class CCloudNetwork;
     33#ifdef VBOX_WS_MAC
     34class CHostOnlyNetwork;
     35#else
    3336class CHostNetworkInterface;
     37#endif
    3438class CNATNetwork;
    3539class QAbstractButton;
     
    116120        /** Handles command to create host network. */
    117121        void sltCreateHostNetwork();
     122#ifndef VBOX_WS_MAC
    118123        /** Handles signal about host network @a comInterface created. */
    119124        void sigHandleHostOnlyNetworkInterfaceCreated(const CHostNetworkInterface &comInterface);
     125#endif
    120126        /** Handles command to remove host network. */
    121127        void sltRemoveHostNetwork();
     128#ifndef VBOX_WS_MAC
    122129        /** Handles signal about host network interface by the name of @a strInterfaceName was removed. */
    123130        void sigHandleHostOnlyNetworkInterfaceRemoved(const QString &strInterfaceName);
     131#endif
    124132
    125133        /** Handles command to create NAT network. */
     
    211219        /** Loads host networks. */
    212220        void loadHostNetworks();
     221#ifdef VBOX_WS_MAC
     222        /** Loads host @a comNetwork data to passed @a data container. */
     223        void loadHostNetwork(const CHostOnlyNetwork &comNetwork, UIDataHostNetwork &data);
     224#else
    213225        /** Loads host @a comInterface data to passed @a data container. */
    214226        void loadHostNetwork(const CHostNetworkInterface &comInterface, UIDataHostNetwork &data);
     227#endif
    215228
    216229        /** Loads NAT networks. */
     
    248261        void updateItemForCloudNetwork(const UIDataCloudNetwork &data, bool fChooseItem, UIItemCloudNetwork *pItem);
    249262
     263#ifdef VBOX_WS_MAC
     264        /** Returns a list of busy host network names. */
     265        QStringList busyNamesHost() const;
     266#endif
    250267        /** Returns a list of busy NAT network names. */
    251268        QStringList busyNamesNAT() const;
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp

    r92815 r92821  
    5050#include "CGraphicsAdapter.h"
    5151#include "CHostNetworkInterface.h"
     52#include "CHostOnlyNetwork.h"
    5253#include "CMediumAttachment.h"
    5354#include "CNATNetwork.h"
     
    688689
    689690/* static */
     691void UINotificationMessage::cannotAcquireHostOnlyNetworkParameter(const CHostOnlyNetwork &comNetwork)
     692{
     693    createMessage(
     694        QApplication::translate("UIMessageCenter", "Host only network failure ..."),
     695        QApplication::translate("UIMessageCenter", "Failed to acquire host only network parameter.") +
     696        UIErrorString::formatErrorInfo(comNetwork));
     697}
     698
     699/* static */
    690700void UINotificationMessage::cannotAcquireNATNetworkParameter(const CNATNetwork &comNetwork)
    691701{
     
    832842        QApplication::translate("UIMessageCenter", "Failed to change host network interface parameter.") +
    833843        UIErrorString::formatErrorInfo(comInterface));
     844}
     845
     846/* static */
     847void UINotificationMessage::cannotChangeHostOnlyNetworkParameter(const CHostOnlyNetwork &comNetwork)
     848{
     849    createMessage(
     850        QApplication::translate("UIMessageCenter", "Host only network failure ..."),
     851        QApplication::translate("UIMessageCenter", "Failed to change host only network parameter.") +
     852        UIErrorString::formatErrorInfo(comNetwork));
    834853}
    835854
     
    10891108
    10901109/* static */
     1110void UINotificationMessage::cannotFindHostOnlyNetwork(const CVirtualBox &comVBox, const QString &strNetworkName)
     1111{
     1112    createMessage(
     1113        QApplication::translate("UIMessageCenter", "Can't find host only network ..."),
     1114        QApplication::translate("UIMessageCenter", "Unable to find the host only network <b>%1</b>.")
     1115                                                   .arg(strNetworkName) +
     1116        UIErrorString::formatErrorInfo(comVBox));
     1117}
     1118
     1119/* static */
    10911120void UINotificationMessage::cannotFindNATNetwork(const CVirtualBox &comVBox, const QString &strNetworkName)
    10921121{
     
    11331162        QApplication::translate("UIMessageCenter", "Can't remove cloud network ..."),
    11341163        QApplication::translate("UIMessageCenter", "Failed to remove the cloud network <b>%1</b>.")
     1164                                                   .arg(strNetworkName) +
     1165        UIErrorString::formatErrorInfo(comVBox));
     1166}
     1167
     1168/* static */
     1169void UINotificationMessage::cannotCreateHostOnlyNetwork(const CVirtualBox &comVBox)
     1170{
     1171    createMessage(
     1172        QApplication::translate("UIMessageCenter", "Can't create host only network ..."),
     1173        QApplication::translate("UIMessageCenter", "Failed to create a host only network.") +
     1174        UIErrorString::formatErrorInfo(comVBox));
     1175}
     1176
     1177/* static */
     1178void UINotificationMessage::cannotRemoveHostOnlyNetwork(const CVirtualBox &comVBox, const QString &strNetworkName)
     1179{
     1180    createMessage(
     1181        QApplication::translate("UIMessageCenter", "Can't remove host only network ..."),
     1182        QApplication::translate("UIMessageCenter", "Failed to remove the host only network <b>%1</b>.")
    11351183                                                   .arg(strNetworkName) +
    11361184        UIErrorString::formatErrorInfo(comVBox));
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h

    r92815 r92821  
    291291          * @param  comInterface  Brings the object parameter get acquired from. */
    292292        static void cannotAcquireHostNetworkInterfaceParameter(const CHostNetworkInterface &comInterface);
     293        /** Notifies about inability to acquire IHostOnlyNetwork parameter.
     294          * @param  comNetwork  Brings the object parameter get acquired from. */
     295        static void cannotAcquireHostOnlyNetworkParameter(const CHostOnlyNetwork &comNetwork);
    293296        /** Notifies about inability to acquire INATNetwork parameter.
    294297          * @param  comNetwork  Brings the object parameter get acquired from. */
     
    342345          * @param  comInterface  Brings the object parameter being changed for. */
    343346        static void cannotChangeHostNetworkInterfaceParameter(const CHostNetworkInterface &comInterface);
     347        /** Notifies about inability to change IHostOnlyNetwork parameter.
     348          * @param  comNetwork  Brings the object parameter being changed for. */
     349        static void cannotChangeHostOnlyNetworkParameter(const CHostOnlyNetwork &comNetwork);
    344350        /** Notifies about inability to change INATNetwork parameter.
    345351          * @param  comNetwork  Brings the object parameter being changed for. */
     
    435441          * @param  strInterfaceName  Brings interface name. */
    436442        static void cannotFindHostNetworkInterface(const CHost &comHost, const QString &strInterfaceName);
     443        /** Notifies about inability to find host only network.
     444          * @param  comVBox         Brings the common VBox object being search through.
     445          * @param  strNetworkName  Brings interface name. */
     446        static void cannotFindHostOnlyNetwork(const CVirtualBox &comVBox, const QString &strNetworkName);
    437447        /** Notifies about inability to find NAT network.
    438448          * @param  comVBox         Brings common VBox object being search through.
     
    454464          * @param  strNetworkName  Brings the network name. */
    455465        static void cannotRemoveCloudNetwork(const CVirtualBox &comVBox, const QString &strNetworkName);
     466        /** Notifies about inability to create host only network.
     467          * @param  comVBox  Brings common VBox object trying to create host only network. */
     468        static void cannotCreateHostOnlyNetwork(const CVirtualBox &comVBox);
     469        /** Notifies about inability to remove host only network.
     470          * @param  comVBox         Brings common VBox object trying to remove host only network.
     471          * @param  strNetworkName  Brings the network name. */
     472        static void cannotRemoveHostOnlyNetwork(const CVirtualBox &comVBox, const QString &strNetworkName);
    456473        /** Notifies about inability to create NAT network.
    457474          * @param  comVBox  Brings common VBox object trying to create NAT network. */
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