Also show left duration on EntryDelegates if it's been set in the player

This commit is contained in:
Bart De Vries 2021-07-14 19:35:41 +02:00
parent 9621919310
commit 35cfb14e1f
3 changed files with 10 additions and 1 deletions

View File

@ -363,6 +363,11 @@ QString Enclosure::formattedDuration() const
return m_kformat.formatDuration(m_duration * 1000);
}
QString Enclosure::formattedLeftDuration() const
{
return m_kformat.formatDuration(duration() * 1000 - playPosition());
}
QString Enclosure::formattedPlayPosition() const
{
return m_kformat.formatDuration(m_playposition);

View File

@ -32,6 +32,7 @@ class Enclosure : public QObject
Q_PROPERTY(QString formattedDownloadSize READ formattedDownloadSize NOTIFY downloadProgressChanged)
Q_PROPERTY(QString path READ path CONSTANT)
Q_PROPERTY(qint64 playPosition READ playPosition WRITE setPlayPosition NOTIFY playPositionChanged)
Q_PROPERTY(QString formattedLeftDuration READ formattedLeftDuration NOTIFY playPositionChanged)
Q_PROPERTY(QString formattedPlayPosition READ formattedPlayPosition NOTIFY playPositionChanged);
Q_PROPERTY(qint64 duration READ duration WRITE setDuration NOTIFY durationChanged)
Q_PROPERTY(QString formattedDuration READ formattedDuration NOTIFY durationChanged)
@ -62,6 +63,7 @@ public:
qint64 sizeOnDisk() const;
QString formattedSize() const;
QString formattedDuration() const;
QString formattedLeftDuration() const;
QString formattedPlayPosition() const;
QString formattedDownloadSize() const;

View File

@ -159,7 +159,9 @@ Kirigami.SwipeListItem {
Layout.fillWidth: true
}
Controls.Label {
text: entry.enclosure.formattedDuration
text: (SettingsManager.toggleRemainingTime)
? "-" + entry.enclosure.formattedLeftDuration
: entry.enclosure.formattedDuration
elide: Text.ElideRight
font: Kirigami.Theme.smallFont
opacity: 0.7