| 129 | } |
| 130 | |
| 131 | bool VulkanDatabase::uploadReport(QJsonObject json, QString& message) |
| 132 | { |
| 133 | manager = new QNetworkAccessManager(nullptr); |
| 134 | QHttpMultiPart* multiPart = new QHttpMultiPart(QHttpMultiPart::FormDataType); |
| 135 | QHttpPart httpPart; |
| 136 | httpPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"data\"; filename=\"vulkanreport.json\"")); |
| 137 | QJsonDocument doc(json); |
| 138 | httpPart.setBody(doc.toJson()); |
| 139 | multiPart->append(httpPart); |
| 140 | QUrl qurl(databaseUrl + "api/v4/uploadreport.php"); |
| 141 | QNetworkRequest request(qurl); |
| 142 | QNetworkReply* reply = manager->post(request, multiPart); |
| 143 | multiPart->setParent(reply); |
| 144 | QEventLoop loop; |
| 145 | connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); |
| 146 | loop.exec(QEventLoop::ExcludeUserInputEvents); |
| 147 | bool result = false; |
| 148 | if (reply->error() == QNetworkReply::NoError) |
| 149 | { |
| 150 | result = true; |
| 151 | } |
| 152 | else { |
| 153 | message = reply->errorString(); |
| 154 | result = false; |
| 155 | } |
| 156 | delete(manager); |
| 157 | return result; |
| 158 | } |
| 159 | |
| 160 | // Checks if the report stored in the database can be updated with missing data from the local report |
| 161 | bool VulkanDatabase::checkCanUpdateReport(VulkanDeviceInfo& device, int reportId) |
no test coverage detected