feat: load the user's mpv.conf
This commit is contained in:
1 parent
fe2f159660
commit
6b5742b2ca
11 files changed
+298
-6
No files matched your search
@@ -29,6 +29,13 @@ class MpvItem : public MpvAbstractItem
|
||||
// In seconds; applied to both subtitles so a translation stays in sync with its source.
|
||||
Q_PROPERTY(double subtitleDelay READ subtitleDelay WRITE setSubtitleDelay NOTIFY subtitleDelayChanged)
|
||||
|
||||
// Load the user's mpv.conf when mpv starts. Must be set before the item is shown.
|
||||
Q_PROPERTY(bool loadUserConfig READ loadUserConfig WRITE setLoadUserConfig NOTIFY loadUserConfigChanged)
|
||||
Q_PROPERTY(QString userConfigDir READ userConfigDir CONSTANT)
|
||||
// The mpv.conf files that were loaded, and the options in them that were ignored.
|
||||
Q_PROPERTY(QStringList loadedUserConfigFiles READ loadedUserConfigFiles NOTIFY userConfigApplied)
|
||||
Q_PROPERTY(QStringList skippedUserOptions READ skippedUserOptions NOTIFY userConfigApplied)
|
||||
|
||||
public:
|
||||
explicit MpvItem(QQuickItem *parent = nullptr);
|
||||
~MpvItem() override = default;
|
||||
@@ -48,6 +55,11 @@ public:
|
||||
void setSecondarySubtitleId(int id);
|
||||
double subtitleDelay() const;
|
||||
void setSubtitleDelay(double seconds);
|
||||
bool loadUserConfig() const;
|
||||
void setLoadUserConfig(bool load);
|
||||
QString userConfigDir() const;
|
||||
QStringList loadedUserConfigFiles() const;
|
||||
QStringList skippedUserOptions() const;
|
||||
|
||||
Q_INVOKABLE void loadFile(const QUrl &url);
|
||||
Q_INVOKABLE void togglePause();
|
||||
@@ -69,11 +81,15 @@ Q_SIGNALS:
|
||||
void fileLoadedChanged();
|
||||
void subtitleTracksChanged();
|
||||
void subtitleDelayChanged();
|
||||
void loadUserConfigChanged();
|
||||
// mpv.conf was queued for loading; options set after this take precedence over it.
|
||||
void userConfigApplied();
|
||||
|
||||
private:
|
||||
void onPropertyChanged(const QString &property, const QVariant &value);
|
||||
void setFileLoaded(bool loaded);
|
||||
void updateTracks(const QVariantList &trackList);
|
||||
void applyUserConfig();
|
||||
|
||||
bool m_ready = false;
|
||||
QUrl m_pendingUrl;
|
||||
@@ -89,4 +105,7 @@ private:
|
||||
double m_subtitleDelay = 0.0;
|
||||
// File added by showSecondarySubtitleFile() that should become secondary once mpv lists it.
|
||||
QString m_pendingSecondaryPath;
|
||||
bool m_loadUserConfig = false;
|
||||
QStringList m_loadedUserConfigFiles;
|
||||
QStringList m_skippedUserOptions;
|
||||
};
|
||||
Reference in new issue
Block a user