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

Method applyRecovery

app/src/Misc/CrashTracker.cpp:157–190  ·  view source on GitHub ↗

* @brief Applies one of the recovery actions; the user is expected to restart afterwards. */

Source from the content-addressed store, hash-verified

155 * @brief Applies one of the recovery actions; the user is expected to restart afterwards.
156 */
157void Misc::CrashTracker::applyRecovery(int action)
158{
159 switch (action) {
160 case ResetGraphicsBackend:
161 m_settings.setValue(QStringLiteral("App/GraphicsBackend"), 0);
162 m_settings.remove(QStringLiteral("App/GraphicsBackendPending"));
163 break;
164 case SkipLastProject:
165 m_settings.remove(QStringLiteral("project_file_path"));
166 break;
167 case ResetAllPreferences: {
168 QVariantMap preserved;
169 const QStringList groups{QStringLiteral("licensing"), QStringLiteral("trial")};
170 for (const QString& group : groups) {
171 m_settings.beginGroup(group);
172 const QStringList keys = m_settings.allKeys();
173 for (const QString& key : keys)
174 preserved.insert(group + QLatin1Char('/') + key, m_settings.value(key));
175
176 m_settings.endGroup();
177 }
178
179 m_settings.clear();
180 for (auto it = preserved.constBegin(); it != preserved.constEnd(); ++it)
181 m_settings.setValue(it.key(), it.value());
182
183 break;
184 }
185 default:
186 break;
187 }
188
189 acknowledge();
190}

Callers

nothing calls this directly

Calls 4

keyMethod · 0.80
removeMethod · 0.45
valueMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected