![]() |
Cockatrice 2026-10-19-Development-3.1.2-beta.2
A virtual tabletop for multiplayer card games
|
Functions | |
| bool | copyDirectoryRecursively (const QString &sourceDir, const QString &destDir) |
Recursively copies sourceDir into destDir, creating it as needed. | |
| bool | createBackupSessionDir (const QString &backupRoot, QString *sessionDirOut) |
Creates a fresh timestamped session directory under backupRoot. | |
| bool | backupAtRiskPaths (const QStringList &sourcePaths, const QString &backupRoot, QStringList *backupLocationsOut, QString *sessionDirOut=nullptr) |
| Copies several at-risk paths into a single timestamped session directory. | |
| qint64 | estimateBackupSize (const QStringList &sourcePaths, qint64 capBytes=MAX_AUTO_BACKUP_BYTES) |
Estimates the total bytes that backing up sourcePaths would copy. | |
| QString | defaultBackupRoot () |
| Default backup root guaranteed to live outside the install directory. | |
| QStringList | listBackupSessions (const QString &backupRoot) |
Lists existing backup session directories under backupRoot, newest first. | |
| QString | findRecentCoveringBackupSession (const QString &backupRoot, const QStringList &sourcePaths, int maxAgeHours=24) |
Returns the newest non-empty session covering sourcePaths, regardless of completeness. | |
| QString | findRecentUsableBackupSession (const QString &backupRoot, const QStringList &sourcePaths, int maxAgeHours=24) |
Returns the newest session that is non-empty, complete and covering sourcePaths, or empty. | |
| bool | isBackupSessionComplete (const QString &sessionDir) |
Reports whether sessionDir holds a complete backup. | |
| void | pruneOldBackupSessions (const QString &backupRoot, int keepCount=5) |
Deletes oldest sessions keeping only the newest keepCount ones. Empty sessions are junk from failed attempts and are always removed, so they can never evict a good session from the kept set. | |
| QStringList | listSessionBackupLocations (const QString &sessionDir) |
| Lists the backup targets inside an existing session directory. | |
| bool | sessionCoversSources (const QString &sessionDir, const QStringList &sourcePaths) |
Reports whether sessionDir was recorded as covering all of sourcePaths. | |
Variables | |
| constexpr qint64 | MAX_AUTO_BACKUP_BYTES = 200LL * 1024 * 1024 |
| Above this total, the client skips the automatic startup backup and asks for a manual copy. Kept small on purpose: the copy runs synchronously on the UI thread at startup. | |
| bool UserDataBackup::backupAtRiskPaths | ( | const QStringList & | sourcePaths, |
| const QString & | backupRoot, | ||
| QStringList * | backupLocationsOut, | ||
| QString * | sessionDirOut = nullptr ) |
Copies several at-risk paths into a single timestamped session directory.
| sourcePaths | files or directories holding user data; missing entries are skipped. |
| backupRoot | directory OUTSIDE the install tree that will hold timestamped backups. |
| backupLocationsOut | receives one entry per source that produced a backup target (including partial copies). |
| sessionDirOut | optionally receives the shared session directory; set to empty when nothing was backed up (all sources missing, or every copy failed outright). |
backupLocationsOut means a partial backup exists. When nothing at all could be salvaged the session directory is removed again, so a failed attempt never leaves an empty session behind that would block retries. Completeness is recorded with a marker file; see isBackupSessionComplete(). | bool UserDataBackup::copyDirectoryRecursively | ( | const QString & | sourceDir, |
| const QString & | destDir ) |
Recursively copies sourceDir into destDir, creating it as needed.
| bool UserDataBackup::createBackupSessionDir | ( | const QString & | backupRoot, |
| QString * | sessionDirOut ) |
Creates a fresh timestamped session directory under backupRoot.
| backupRoot | directory OUTSIDE the install tree that will hold timestamped backups. |
| sessionDirOut | receives the created directory on success. |
| QString UserDataBackup::defaultBackupRoot | ( | ) |
Default backup root guaranteed to live outside the install directory.
| qint64 UserDataBackup::estimateBackupSize | ( | const QStringList & | sourcePaths, |
| qint64 | capBytes = MAX_AUTO_BACKUP_BYTES ) |
Estimates the total bytes that backing up sourcePaths would copy.
| capBytes | stop counting once the total exceeds this; the returned value is then at least capBytes (used to skip the scan early on huge trees). Missing entries contribute 0. Best effort only. |
| QString UserDataBackup::findRecentCoveringBackupSession | ( | const QString & | backupRoot, |
| const QStringList & | sourcePaths, | ||
| int | maxAgeHours = 24 ) |
Returns the newest non-empty session covering sourcePaths, regardless of completeness.
Used as a fallback pointer when a fresh copy fails entirely, so the dialog can still point at salvaged content. Completeness is left to the caller to report.
| QString UserDataBackup::findRecentUsableBackupSession | ( | const QString & | backupRoot, |
| const QStringList & | sourcePaths, | ||
| int | maxAgeHours = 24 ) |
Returns the newest session that is non-empty, complete and covering sourcePaths, or empty.
An incomplete newest session (partial failure) or one covering a different source set does not block reuse of an older good session.
| bool UserDataBackup::isBackupSessionComplete | ( | const QString & | sessionDir | ) |
Reports whether sessionDir holds a complete backup.
| QStringList UserDataBackup::listBackupSessions | ( | const QString & | backupRoot | ) |
Lists existing backup session directories under backupRoot, newest first.
| QStringList UserDataBackup::listSessionBackupLocations | ( | const QString & | sessionDir | ) |
Lists the backup targets inside an existing session directory.
| void UserDataBackup::pruneOldBackupSessions | ( | const QString & | backupRoot, |
| int | keepCount ) |
Deletes oldest sessions keeping only the newest keepCount ones. Empty sessions are junk from failed attempts and are always removed, so they can never evict a good session from the kept set.
| bool UserDataBackup::sessionCoversSources | ( | const QString & | sessionDir, |
| const QStringList & | sourcePaths ) |
Reports whether sessionDir was recorded as covering all of sourcePaths.
sourcePaths (normalized via QDir::cleanPath, case-insensitive on Windows/macOS). Sessions without a readable manifest return false so a changed source set always triggers a fresh copy instead of reusing a backup that may not cover it.
|
constexpr |
Above this total, the client skips the automatic startup backup and asks for a manual copy. Kept small on purpose: the copy runs synchronously on the UI thread at startup.