void WindowMain::setsDownloadFinished() { QNetworkReply *reply = static_cast<QNetworkReply *>(sender()); importer->readSetsFromByteArray(reply->readAll()); reply->deleteLater(); updateSetList(); }
void WindowMain::actLoadSetsFile() { QFileDialog dialog(this, tr("Load sets file")); dialog.setFileMode(QFileDialog::ExistingFile); dialog.setNameFilter("Sets XML file (*.xml)"); if (!dialog.exec()) return; QString fileName = dialog.selectedFiles().at(0); importer->readSetsFromFile(fileName); updateSetList(); }
void WindowMain::setsDownloadFinished() { QNetworkReply *reply = static_cast<QNetworkReply *>(sender()); QNetworkReply::NetworkError errorCode = reply->error(); if (errorCode == QNetworkReply::NoError) { if (importer->readSetsFromByteArray(reply->readAll())) updateSetList(); else QMessageBox::critical(this, tr("Error"), tr("The file was retrieved successfully, but it does not contain any sets data.")); } else QMessageBox::critical(this, tr("Error"), tr("Network error: %1.").arg(reply->errorString())); reply->deleteLater(); }
void WindowMain::actLoadSetsFile() { QFileDialog dialog(this, tr("Load sets file")); dialog.setFileMode(QFileDialog::ExistingFile); dialog.setNameFilter("Sets XML file (*.xml)"); if (!dialog.exec()) return; QString fileName = dialog.selectedFiles().at(0); if (importer->readSetsFromFile(fileName)) updateSetList(); else QMessageBox::critical(this, tr("Error"), tr("This file does not contain any sets data.")); }