void ZDvidBufferReader::read(const QString &url, bool outputingUrl) { if (outputingUrl) { qDebug() << url; } m_buffer.clear(); #if defined(_ENABLE_LIBDVIDCPP_) // qDebug() << "Using libdvidcpp"; ZDvidTarget target; target.setFromUrl(url.toStdString()); if (target.isValid()) { try { libdvid::DVIDNodeService service( target.getAddressWithPort(), target.getUuid()); std::string endPoint = ZDvidUrl::GetEndPoint(url.toStdString()); libdvid::BinaryDataPtr data = service.custom_request( endPoint, libdvid::BinaryDataPtr(), libdvid::GET, m_tryingCompress); m_buffer.append(data->get_data().c_str(), data->length()); m_status = READ_OK; } catch (std::exception &e) { std::cout << e.what() << std::endl; m_status = READ_FAILED; } } else { startReading(); m_networkReply = m_networkManager->get(QNetworkRequest(url)); connect(m_networkReply, SIGNAL(finished()), this, SLOT(finishReading())); connect(m_networkReply, SIGNAL(readyRead()), this, SLOT(readBuffer())); connect(m_networkReply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(handleError(QNetworkReply::NetworkError))); waitForReading(); } #else startReading(); m_networkReply = m_networkManager->get(QNetworkRequest(url)); connect(m_networkReply, SIGNAL(finished()), this, SLOT(finishReading())); connect(m_networkReply, SIGNAL(readyRead()), this, SLOT(readBuffer())); connect(m_networkReply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(handleError(QNetworkReply::NetworkError))); waitForReading(); #endif }
void ZDvidDialog::setServer(int index) { ZDvidTarget dvidTarget = m_dvidRepo[index]; ui->addressLineEdit->setText(dvidTarget.getAddress().c_str()); ui->portSpinBox->setValue(dvidTarget.getPort()); ui->uuidLineEdit->setText(dvidTarget.getUuid().c_str()); ui->infoLabel->setText(dvidTarget.getComment().c_str()); ui->bodyLineEdit->setText(dvidTarget.getBodyLabelName().c_str()); ui->grayScalelineEdit->setText(dvidTarget.getGrayScaleName().c_str()); ui->labelBlockLineEdit->setText(dvidTarget.getLabelBlockName().c_str()); ui->tileLineEdit->setText(dvidTarget.getMultiscale2dName().c_str()); ui->addressLineEdit->setReadOnly(index > 0); ui->portSpinBox->setReadOnly(index > 0); ui->uuidLineEdit->setReadOnly(index > 0); // ui->bodyLineEdit->setReadOnly(index > 0); }