Ejemplo n.º 1
0
static HostComboBox *LocalServerIP6()
{
    HostComboBox *gc = new HostComboBox("BackendServerIP6");
    gc->setLabel(QObject::tr("IPv6 address"));
    QList<QHostAddress> list = ServerPool::DefaultListenIPv6();
    QList<QHostAddress>::iterator it;
    for (it = list.begin(); it != list.end(); ++it)
    {
        gc->addSelection((*it).toString(), (*it).toString());
    }

#if defined(QT_NO_IPV6)
    gc->setEnabled(false);
    gc->setValue("");
#else
    if (list.isEmpty())
    {
        gc->setEnabled(false);
        gc->setValue("");
    }
    else if (list.contains(QHostAddress("::1")))
        gc->setValue("::1");
#endif
        
    gc->setHelpText(QObject::tr("Enter the IPv6 address of this machine. "
                    "Use an externally accessible address (ie, not "
                    "::1) if you are going to be running a frontend "
                    "on a different machine than this one."));
    return gc;
}
Ejemplo n.º 2
0
static HostComboBox *LocalServerIP6()
{
    HostComboBox *gc = new HostComboBox("BackendServerIP6");
    gc->setLabel(QObject::tr("IPv6 address"));
    QList<QHostAddress> list = QNetworkInterface::allAddresses();
    QList<QHostAddress>::iterator it;
    for (it = list.begin(); it != list.end(); ++it)
    {
        if ((*it).protocol() == QAbstractSocket::IPv6Protocol)
            gc->addSelection((*it).toString(), (*it).toString());
    }

#if defined(QT_NO_IPV6)
    gc->setEnabled(false);
    gc->setValue("");
#else
    if (list.isEmpty())
    {
        gc->setEnabled(false);
        gc->setValue("");
    }
    else
    {
        // Allow ability to have no value set, this disable IPv6
        gc->addSelection("");
        if (list.contains(QHostAddress("::1")))
            gc->setValue("::1");
    }
#endif

    gc->setHelpText(QObject::tr("Enter the IPv6 address of this machine. "
                    "Use an externally accessible address (ie, not "
                    "::1) if you are going to be running a frontend "
                    "on a different machine than this one."));
    return gc;
}