fix(glossary): handle save errors and improve playlist controls

This commit is contained in:
tri committed 2026-11-07 20:08:28 +07:00
1 parent 3d8f644d8d
commit 309801d059
7 files changed
+204 -33

No files matched your search

+5 -1
View File
@@ -34,6 +34,7 @@ class TranslationService : public QObject
Q_PROPERTY(bool fetchingModels READ isFetchingModels NOTIFY fetchingModelsChanged)
Q_PROPERTY(QVariantList glossaryEntries READ glossaryEntries NOTIFY glossaryChanged)
Q_PROPERTY(QString glossaryDirectory READ glossaryDirectory NOTIFY glossaryChanged)
Q_PROPERTY(QString glossaryError READ glossaryError NOTIFY glossaryErrorChanged)
public:
explicit TranslationService(QObject *parent = nullptr);
@@ -48,6 +49,7 @@ public:
bool isFetchingModels() const;
QVariantList glossaryEntries() const;
QString glossaryDirectory() const;
QString glossaryError() const;
// \a track is an entry of MpvItem::subtitleTracks.
Q_INVOKABLE void translate(const QUrl &videoUrl, const QVariantMap &track, const QString &mediaTitle);
@@ -56,7 +58,7 @@ public:
Q_INVOKABLE void fetchModels();
Q_INVOKABLE void clearError();
Q_INVOKABLE void loadGlossary(const QUrl &videoUrl);
Q_INVOKABLE void saveGlossary(const QVariantList &entries);
Q_INVOKABLE bool saveGlossary(const QVariantList &entries);
Q_INVOKABLE void clearGlossary();
Q_SIGNALS:
@@ -67,6 +69,7 @@ Q_SIGNALS:
void availableModelsChanged();
void fetchingModelsChanged();
void glossaryChanged();
void glossaryErrorChanged();
void translated(const QUrl &subtitleUrl, bool fromCache);
private:
@@ -98,6 +101,7 @@ private:
double m_progress = 0.0;
QString m_statusText;
QString m_errorText;
QString m_glossaryError;
QStringList m_availableModels;
bool m_fetchingModels = false;
GlossaryStore::Glossary m_glossary;