Exemplo n.º 1
0
/* public ***********************************************/
Dialog::Dialog(QWidget *parent) :
QDialog(parent),
  ui_(new Ui::Dialog), Server_(0), Client_(0) {
    LOG << "Dialog init.";

    ui_->setupUi(this);

    QNetworkInterface *inter = new QNetworkInterface();
    QList<QHostAddress> list;
    list = inter->allAddresses();
    QString hostname = "";
    for (int i = 0; i < list.size(); ++i) {
        QHostAddress tmp(list.at(i).toIPv4Address());
        if (tmp.toString().compare("127.0.0.1") && tmp.toString().compare("0.0.0.0"))
            hostname = tmp.toString();
    }

//    ui_->serverIPEdit->setText(hostname);
    ui_->serverIPEdit->setText("127.0.0.1");
    ui_->serverPortEdit->setText("11111");
    ui_->serverMsgEdit->setText("Hello");
//    ui_->serverFileEdit->setText("/home/dn/yabss.crt");

    ui_->clientIPEdit->setText("127.0.0.1");
    ui_->clientPortEdit->setText("11111");
    ui_->clientFileWidget->hide();
//    ui_->recieveFileEdit->setText("/tmp/");

}
Exemplo n.º 2
0
void getMyIP() {
    QNetworkInterface *qni = new QNetworkInterface();
    QList<QHostAddress> ips;
    QList<QString> ipstr;
    QString str;
    ips = qni->allAddresses();
    for (int i = 0; i < ips.size(); i++)
    {
        str = ips.at(i).toString();
        qDebug() << i << " : " << str;
    }
}
Exemplo n.º 3
0
bool MythCoreContext::Init(void)
{
    if (!d)
    {
        VERBOSE(VB_IMPORTANT, LOC_ERR + "Init() Out-of-memory");
        return false;
    }

    if (d->m_appBinaryVersion != MYTH_BINARY_VERSION)
    {
        VERBOSE(VB_GENERAL, QString("Application binary version (%1) does not "
                                    "match libraries (%2)")
                                    .arg(d->m_appBinaryVersion)
                                    .arg(MYTH_BINARY_VERSION));

        QString warning = QObject::tr(
            "This application is not compatible "
            "with the installed MythTV libraries. "
            "Please recompile after a make distclean");
        VERBOSE(VB_IMPORTANT, warning);

        return false;
    }

    has_ipv6 = false;

    // If any of the IPs on any interfaces look like IPv6 addresses, assume IPv6
    // is available
    QNetworkInterface interface;
    QList<QHostAddress> IpList = interface.allAddresses();
    for (int i = 0; i < IpList.size(); i++)
    {
        if (IpList.at(i).toString().contains(":"))
            has_ipv6 = true;
    };


    return true;
}
Exemplo n.º 4
0
void MyApp::on_actLocalIp_triggered()
{
    QNetworkInterface *test = new QNetworkInterface();
    qDebug()<<test->allAddresses();
}