Пример #1
0
void CondorDatasource::connectToSource() {
    setNetworkError(QString());

    connect(&m_udpSocket, &QUdpSocket::readyRead, this, &CondorDatasource::readPendingDatagrams);
    if(m_udpSocket.bind(QHostAddress::LocalHost, m_port)) {
        setHelpText(QString("Listening to UDP transmissions on port %1. Please run Condor.\nSee config help at http://www.condorsoaring.com/manual/#simkits-and-udp-outputs").arg(m_port));
    } else {
        setNetworkError(QString("Unable to bind to UDP port %1!").arg(m_port));
    }
}
Пример #2
0
void FlightGearDataSource::connectedChanged(bool connected)
{
    if(connected) {
        setNetworkError(QString());
        setHelpText(QString("Connected to FlightGear at %1:%2").arg(tcpClient.hostName()).arg(tcpClient.port()));
        tcpClient.writeLine("data");
    }
}
void QQmlNetwork::startNextDownload()
{
    if (downloadQueue.isEmpty()) {
//        qDebug() << downloadedCount << " " << totalCount << "files downloaded successfully\n";
        emit finished();
        return;
    }
    QUrl url = downloadQueue.dequeue();
    QFileInfo fileInf(url.toString());
    QString fileName = QString("%1%2").arg(m_path).arg(fileInf.fileName());




    setSavedFileName(fileName);
//    qDebug() << fileName;
    output.setFileName(fileName);

    if (output.exists()){
        if(output.remove())
        {
            qDebug() << "removed the old file";
        }
    }



    if (!output.open(QIODevice::WriteOnly)) {
        error("Problem opening save file for download");
        startNextDownload();
        return;
    }

    qDebug() << "GOING TO TRY AND DOWNLOAD " << url;

    QNetworkRequest request(url);
    currentDownload = manager.get(request);

    // FIX ME check for redirection
    connect(&manager,SIGNAL(finished(QNetworkReply*)),this,SLOT(checkRedirection(QNetworkReply*)));

    connect(currentDownload, SIGNAL(downloadProgress(qint64,qint64)), SLOT(downloadProgress(qint64,qint64)));
    connect(currentDownload, SIGNAL(finished()), SLOT(downloadFinished()));
    connect(currentDownload, SIGNAL(readyRead()), SLOT(downloadReadyRead()));
    connect(currentDownload,SIGNAL(error(QNetworkReply::NetworkError)),this,SLOT(setNetworkError(QNetworkReply::NetworkError)));


    downloadTime.start();

}
Пример #4
0
void FlightGearDataSource::connectToSource() {
    setNetworkError(QString());
    tcpClient.setHostName("localhost");
    tcpClient.setPort(5401);
    tcpClient.startConnection();
}
Пример #5
0
void FlightGearDataSource::networkErrorChanged(QString errstring)
{
    setNetworkError(errstring);
}