[vlc-commits] [Git][videolan/vlc][master] 4 commits: qt: add `PlaylistItem::preparsed()`
Felix Paul Kühne (@fkuehne)
gitlab at videolan.org
Sun Jan 5 15:30:52 UTC 2025
Felix Paul Kühne pushed to branch master at VideoLAN / VLC
Commits:
ae3e36da by Fatih Uzunoglu at 2025-01-05T15:08:55+00:00
qt: add `PlaylistItem::preparsed()`
- - - - -
d9e833b9 by Fatih Uzunoglu at 2025-01-05T15:08:55+00:00
qt: add preparsed role to PlaylistListModel
- - - - -
5bbfecd0 by Fatih Uzunoglu at 2025-01-05T15:08:55+00:00
qml: load artwork only after item is preparsed in PlaylistDelegate
As otherwise we load placeholder image just before the artwork url
becomes available, this does not look good because often time the
item gets preparsed quickly.
- - - - -
6a0e895e by Fatih Uzunoglu at 2025-01-05T15:08:55+00:00
qml: load placeholder image if the item is not preparsed for a while in PlaylistDelegate
- - - - -
5 changed files:
- modules/gui/qt/playlist/playlist_item.cpp
- modules/gui/qt/playlist/playlist_item.hpp
- modules/gui/qt/playlist/playlist_model.cpp
- modules/gui/qt/playlist/playlist_model.hpp
- modules/gui/qt/playlist/qml/PlaylistDelegate.qml
Changes:
=====================================
modules/gui/qt/playlist/playlist_item.cpp
=====================================
@@ -95,6 +95,12 @@ PlaylistItem::operator bool() const
return d && d->item.get();
}
+bool PlaylistItem::preparsed() const {
+ if (const auto item = inputItem())
+ return input_item_IsPreparsed(item);
+ return false;
+}
+
//}
//}
=====================================
modules/gui/qt/playlist/playlist_item.hpp
=====================================
@@ -60,6 +60,8 @@ public:
operator bool() const;
+ bool preparsed() const;
+
vlc_playlist_item_t *raw() const {
return d ? d->item.get() : nullptr;
}
=====================================
modules/gui/qt/playlist/playlist_model.cpp
=====================================
@@ -278,6 +278,7 @@ QHash<int, QByteArray>
PlaylistListModel::roleNames() const
{
return {
+ { PreparsedRole, "preparsed" },
{ TitleRole, "title" },
{ DurationRole, "duration" },
{ IsCurrentRole, "isCurrent" },
@@ -492,6 +493,8 @@ PlaylistListModel::data(const QModelIndex &index, int role) const
return d->m_items[row].getArtwork();
case UrlRole:
return d->m_items[row].getUrl();
+ case PlaylistListModel::PreparsedRole:
+ return d->m_items[row].preparsed();
default:
return {};
}
=====================================
modules/gui/qt/playlist/playlist_model.hpp
=====================================
@@ -50,7 +50,8 @@ public:
ArtistRole,
AlbumRole,
ArtworkRole,
- UrlRole
+ UrlRole,
+ PreparsedRole
};
PlaylistListModel(QObject *parent = nullptr);
=====================================
modules/gui/qt/playlist/qml/PlaylistDelegate.qml
=====================================
@@ -161,15 +161,26 @@ T.Control {
anchors.fill: parent
fillMode: Image.PreserveAspectFit
- source: (model?.artwork.toString()) ? VLCAccessImage.uri(model.artwork) : VLCStyle.noArtAlbumCover
+ source: model.preparsed ? targetSource : ""
visible: !statusIcon.visible
asynchronous: true
+ readonly property url targetSource: (model?.artwork.toString()) ? VLCAccessImage.uri(model.artwork) : VLCStyle.noArtAlbumCover
+
onStatusChanged: {
if (source !== VLCStyle.noArtAlbumCover && status === Image.Error)
source = VLCStyle.noArtAlbumCover
}
+ Timer {
+ running: (artwork.status === Image.Null)
+ interval: VLCStyle.duration_long
+ onTriggered: {
+ // Remove the preparse guard, enough time has passed:
+ artwork.source = Qt.binding(() => { return artwork.targetSource; })
+ }
+ }
+
Widgets.DefaultShadow {
anchors.centerIn: parent
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/5af36667946f5bd2da3bd4633b650e6b9cb59f05...6a0e895e6ba6c49acd547ee95b3c3d3e549b92b6
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/5af36667946f5bd2da3bd4633b650e6b9cb59f05...6a0e895e6ba6c49acd547ee95b3c3d3e549b92b6
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list