Replace AudioManager::timeString by KFormat::formatDuration

This commit is contained in:
Bart De Vries 2021-05-28 16:42:12 +02:00
parent 13b59adb29
commit 4d4859a698
3 changed files with 18 additions and 10 deletions

View File

@ -7,9 +7,12 @@
import QtQuick 2.14
import QtQuick.Controls 2.14 as Controls
import QtQuick.Layouts 1.14
import org.kde.kirigami 2.14 as Kirigami
import QtMultimedia 5.15
import QtGraphicalEffects 1.15
import org.kde.kirigami 2.14 as Kirigami
import org.kde.kcoreaddons 1.0 as KCoreAddons
import org.kde.kasts 1.0
Kirigami.SwipeListItem {
@ -76,7 +79,7 @@ Kirigami.SwipeListItem {
}
Controls.Label {
id: supertitle
text: (!isQueue && entry.queueStatus ? "· " : "") + entry.updated.toLocaleDateString(Qt.locale(), Locale.NarrowFormat) + (entry.enclosure ? ( entry.enclosure.size !== 0 ? " · " + Math.floor(entry.enclosure.size / (1024 * 1024)) + "MB" : "") : "" )
text: (!isQueue && entry.queueStatus ? "· " : "") + entry.updated.toLocaleDateString(Qt.locale(), Locale.NarrowFormat) + (entry.enclosure ? ( entry.enclosure.size !== 0 ? " · " + KCoreAddons.Format.formatByteSize(entry.enclosure.size) : "") : "" )
Layout.fillWidth: true
elide: Text.ElideRight
font: Kirigami.Theme.smallFont
@ -97,7 +100,7 @@ Kirigami.SwipeListItem {
Component {
id: subtitle
Controls.Label {
text: AudioManager.timeString(entry.enclosure.duration * 1000)
text: KCoreAddons.Format.formatDuration(entry.enclosure.duration * 1000)
Layout.fillWidth: true
elide: Text.ElideRight
font: Kirigami.Theme.smallFont
@ -119,7 +122,7 @@ Kirigami.SwipeListItem {
id: playProgress
RowLayout {
Controls.Label {
text: AudioManager.timeString(entry.enclosure.playPosition)
text: KCoreAddons.Format.formatDuration(entry.enclosure.playPosition)
elide: Text.ElideRight
font: Kirigami.Theme.smallFont
opacity: entry.read ? 0.4 : 0.7
@ -132,7 +135,7 @@ Kirigami.SwipeListItem {
opacity: entry.read ? 0.6 : 1
}
Controls.Label {
text: AudioManager.timeString(entry.enclosure.duration * 1000)
text: KCoreAddons.Format.formatDuration(entry.enclosure.duration * 1000)
elide: Text.ElideRight
font: Kirigami.Theme.smallFont
opacity: entry.read ? 0.4 : 0.7

View File

@ -9,7 +9,9 @@ import QtQuick.Controls 2.14 as Controls
import QtQuick.Layouts 1.14
import QtMultimedia 5.15
import QtGraphicalEffects 1.15
import org.kde.kirigami 2.14 as Kirigami
import org.kde.kcoreaddons 1.0 as KCoreAddons
import org.kde.kasts 1.0
@ -150,7 +152,7 @@ Kirigami.Page {
Layout.fillWidth: true
Controls.Label {
padding: Kirigami.Units.largeSpacing
text: AudioManager.timeString(AudioManager.position)
text: KCoreAddons.Format.formatDuration(AudioManager.position)
}
Item {
Layout.fillWidth: true
@ -164,8 +166,8 @@ Kirigami.Page {
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
text: (SettingsManager.toggleRemainingTime) ?
"-" + AudioManager.timeString(AudioManager.duration-AudioManager.position)
: AudioManager.timeString(AudioManager.duration)
"-" + KCoreAddons.Format.formatDuration(AudioManager.duration-AudioManager.position)
: KCoreAddons.Format.formatDuration(AudioManager.duration)
}
MouseArea {

View File

@ -8,8 +8,11 @@
import QtQuick 2.14
import QtQuick.Controls 2.14 as Controls
import QtQuick.Layouts 1.2
import org.kde.kirigami 2.13 as Kirigami
import QtMultimedia 5.15
import org.kde.kirigami 2.13 as Kirigami
import org.kde.kcoreaddons 1.0 as KCoreAddons
import org.kde.kasts 1.0
Kirigami.ScrollablePage {
@ -61,7 +64,7 @@ Kirigami.ScrollablePage {
Controls.Label {
Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter
text: i18np("1 episode", "%1 episodes", queueModel.rowCount()) + " · " + i18n("Time left") + ": " + AudioManager.timeString(queueModel.timeLeft)
text: i18np("1 episode", "%1 episodes", queueModel.rowCount()) + " · " + i18n("Time left") + ": " + KCoreAddons.Format.formatDuration(queueModel.timeLeft)
}
Kirigami.Separator {
Layout.fillWidth: true