Exemple #1
0
bool OptionsDialog::eventFilter(QObject *object, QEvent *event)
{
    if(object == ui->proxyIp && event->type() == QEvent::FocusOut)
    {
        // Check proxyIP for a valid IPv4/IPv6 address
        CService addr;
        if(!LookupNumeric(ui->proxyIp->text().toStdString().c_str(), addr))
        {
            ui->proxyIp->setValid(false);
            fProxyIpValid = false;
            ui->statusLabel->setStyleSheet("QLabel { color: red; }");
            ui->statusLabel->setText(tr("The supplied proxy address is invalid."));
            emit proxyIpValid(false);
        }
        else
        {
            fProxyIpValid = true;
            ui->statusLabel->clear();
            emit proxyIpValid(true);
        }
    }
    return QDialog::eventFilter(object, event);
}
bool OptionsDialog::eventFilter(QObject *object, QEvent *event)
{
    if(event->type() == QEvent::FocusOut)
    {
        if(object == ui->proxyIp)
        {
            CService addr;
            /* Check proxyIp for a valid IPv4/IPv6 address and emit the proxyIpValid signal */
            emit proxyIpValid(ui->proxyIp, LookupNumeric(ui->proxyIp->text().toStdString().c_str(), addr));
        }

        if(object == ui->torIp)
        {
            CService addr;
            /* Check proxyIp for a valid IPv4/IPv6 address and emit the torIpValid signal */
            emit torIpValid(ui->torIp, LookupNumeric(ui->torIp->text().toStdString().c_str(), addr));
        }
    }
    return QWidget::eventFilter(object, event);
}