VirtualBox

Changeset 32460 in vbox


Ignore:
Timestamp:
Sep 13, 2010 5:03:51 PM (14 years ago)
Author:
vboxsync
Message:

FE/Qt: 1900: Create GUI support for NAT forwarding: Input mask for IP address.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/vm/VBoxVMSettingsPortForwardingDlg.cpp

    r31563 r32460  
    5252    QValidator::State validate(QString &strInput, int & /* iPos */) const
    5353    {
     54        QString strStringToValidate(strInput);
     55        strStringToValidate.remove(' ');
    5456        QString strDot("\\.");
    5557        QString strDigits("(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]?|0)");
    5658        QRegExp intRegExp(QString("^(%1?(%2(%1?(%2(%1?(%2%1?)?)?)?)?)?)?$").arg(strDigits).arg(strDot));
    5759        uint uNetwork, uMask;
    58         if (strInput.isEmpty() || RTCidrStrToIPv4(strInput.toLatin1().constData(), &uNetwork, &uMask) == VINF_SUCCESS)
     60        if (strStringToValidate == "..." || RTCidrStrToIPv4(strStringToValidate.toLatin1().constData(), &uNetwork, &uMask) == VINF_SUCCESS)
    5961            return QValidator::Acceptable;
    60         else if (intRegExp.indexIn(strInput) != -1)
     62        else if (intRegExp.indexIn(strStringToValidate) != -1)
    6163            return QValidator::Intermediate;
    6264        else
     
    140142        setAlignment(Qt::AlignCenter);
    141143        setValidator(new IPValidator(this));
     144        setInputMask("000.000.000.000");
    142145    }
    143146
     
    151154    IpData ip() const
    152155    {
    153         return text();
     156        return text() == "..." ? QString() : text();
    154157    }
    155158};
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