feat(translate): keep translated subtitles next to the video so they load on reopen (#14)

Co-authored-by: Tri Vo Khac <git@trivk.dev>
This commit was merged in pull request #14.
This commit is contained in:
tri authored and tri committed 2026-11-13 22:49:56 +07:00
1 parent b34a01a92f
commit 76b12d6632
13 files changed
+716 -65

No files matched your search

+12 -5
View File
@@ -28,11 +28,18 @@ bool sameLanguage(const QString &a, const QString &b);
int pickAudio(const QList<Track> &tracks, const QStringList &preferredLanguages, int currentId);
// The subtitle to turn on when the file opens. A track in one of \a preferredLanguages
// wins over mpv's own choice \a currentId; without one, \a currentId is kept. When mpv
// chose nothing and \a fallback is set, picks a full (not forced) subtitle in the first
// of \a fallbackLanguages that has one, then one flagged default, then the first one.
// Text subtitles win over bitmap ones in the same step. Returns 0 for no subtitle.
int pickSubtitle(const QList<Track> &tracks, const QStringList &preferredLanguages, const QStringList &fallbackLanguages, int currentId, bool fallback);
// wins over mpv's own choice \a currentId. Next comes \a translationId, the file's
// saved translation, when \a fallback is set; without either, \a currentId is kept.
// When mpv chose nothing and \a fallback is set, picks a full (not forced) subtitle in
// the first of \a fallbackLanguages that has one, then one flagged default, then the
// first one. Text subtitles win over bitmap ones in the same step. Returns 0 for no
// subtitle.
int pickSubtitle(const QList<Track> &tracks,
const QStringList &preferredLanguages,
const QStringList &fallbackLanguages,
int currentId,
bool fallback,
int translationId = 0);
// The subtitle to translate: \a currentId when it is a text subtitle, else a full text
// subtitle in the first of \a sourceLanguages that has one, then one flagged default,