MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / finished

Method finished

lib/QSimpleUpdater/src/Downloader.cpp:212–238  ·  view source on GitHub ↗

* @brief Called when the download finishes. * * Renames the partial file, emits @c downloadFinished(), and triggers the * install flow. */

Source from the content-addressed store, hash-verified

210 * install flow.
211 */
212void Downloader::finished()
213{
214 if (!m_reply || m_reply->error() != QNetworkReply::NoError) {
215 QFile::remove(m_downloadDir.filePath(m_fileName + PARTIAL_DOWN));
216 if (m_reply) {
217 m_reply->deleteLater();
218 m_reply = nullptr;
219 }
220 return;
221 }
222
223 // Flush any data not yet delivered through downloadProgress
224 saveFile(0, 0);
225
226 // Rename file
227 QFile::rename(m_downloadDir.filePath(m_fileName + PARTIAL_DOWN),
228 m_downloadDir.filePath(m_fileName));
229
230 // Notify application
231 emit downloadFinished(m_url, m_downloadDir.filePath(m_fileName));
232
233 // Install the update
234 m_reply->deleteLater();
235 m_reply = nullptr;
236 installUpdate();
237 setVisible(false);
238}
239
240/**
241 * @brief Opens the downloaded file using the system's default handler.

Callers

nothing calls this directly

Calls 2

errorMethod · 0.80
filePathMethod · 0.45

Tested by

no test coverage detected