* @brief Reads the prior-run flag, updates the streak counter, and arms the new run. */
| 93 | * @brief Reads the prior-run flag, updates the streak counter, and arms the new run. |
| 94 | */ |
| 95 | void Misc::CrashTracker::markStartup() |
| 96 | { |
| 97 | const bool wasRunning = m_settings.value(kKeyRunning, false).toBool(); |
| 98 | if (wasRunning) { |
| 99 | m_previousRunCrashed = true; |
| 100 | m_consecutiveCrashes = m_settings.value(kKeyConsecutive, 0).toInt() + 1; |
| 101 | m_lastCheckpoint = m_settings.value(kKeyCheckpoint, QString()).toString(); |
| 102 | m_lastCrashAt = QDateTime::currentDateTimeUtc().toString(Qt::ISODate); |
| 103 | m_settings.setValue(kKeyConsecutive, m_consecutiveCrashes); |
| 104 | m_settings.setValue(kKeyLastCrash, m_lastCrashAt); |
| 105 | } else { |
| 106 | m_previousRunCrashed = false; |
| 107 | m_consecutiveCrashes = 0; |
| 108 | m_settings.setValue(kKeyConsecutive, 0); |
| 109 | } |
| 110 | |
| 111 | m_settings.setValue(kKeyRunning, true); |
| 112 | m_settings.setValue(kKeyCheckpoint, QStringLiteral("startup")); |
| 113 | m_settings.sync(); |
| 114 | } |
| 115 | |
| 116 | /** |
| 117 | * @brief Clears the running flag and resets the consecutive-crash counter. |