Upload a report without visual dialogs (e.g. from command line)
| 2065 | |
| 2066 | // Upload a report without visual dialogs (e.g. from command line) |
| 2067 | int VulkanCapsViewer::uploadReportNonVisual(int deviceIndex, QString submitter, QString comment) |
| 2068 | { |
| 2069 | VulkanDeviceInfo device = vulkanGPUs[deviceIndex]; |
| 2070 | |
| 2071 | if (vulkanGPUs[deviceIndex].hasFeaturModifyingTool) { |
| 2072 | qWarning() << "Feature modifying tool detected, upload disabled"; |
| 2073 | return -4; |
| 2074 | } |
| 2075 | |
| 2076 | QString message; |
| 2077 | bool dbstatus = database.checkServerConnection(message); |
| 2078 | if (!dbstatus) |
| 2079 | { |
| 2080 | qWarning() << "Database unreachable"; |
| 2081 | return -1; |
| 2082 | } |
| 2083 | |
| 2084 | int reportId = database.getReportId(device); |
| 2085 | if (reportId > -1) |
| 2086 | { |
| 2087 | qWarning() << "Device already present in database"; |
| 2088 | return -2; |
| 2089 | } |
| 2090 | |
| 2091 | QJsonObject reportJson; |
| 2092 | reportToJson(submitter, comment, reportJson); |
| 2093 | if (database.uploadReport(reportJson, message)) |
| 2094 | { |
| 2095 | qInfo() << "Report successfully submitted. Thanks for your contribution!"; |
| 2096 | return 0; |
| 2097 | } |
| 2098 | else |
| 2099 | { |
| 2100 | qInfo() << "The report could not be uploaded : \n" << message; |
| 2101 | return -3; |
| 2102 | } |
| 2103 | } |
| 2104 | |
| 2105 | void VulkanCapsViewer::setReportState(ReportState state) |
| 2106 | { |
no test coverage detected