[vlc-devel] [PATCH 4/4] qt: medialib: remove QObject from MLVideo
Romain Vimont
rom1v at videolabs.io
Fri Dec 18 13:53:36 UTC 2020
MLVideo instances are created from a QThreadPool thread. As a
consequence, as a QObject, each one live (by default) in this separate
thread.
The behavior of dynamic properties or signals/slots would be confusing,
so do not inherit QObject.
---
modules/gui/qt/maininterface/mainui.cpp | 1 -
modules/gui/qt/medialibrary/mlvideo.cpp | 5 ++---
modules/gui/qt/medialibrary/mlvideo.hpp | 6 ++----
3 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/modules/gui/qt/maininterface/mainui.cpp b/modules/gui/qt/maininterface/mainui.cpp
index 962e0f91e4..a91dcd6c8a 100644
--- a/modules/gui/qt/maininterface/mainui.cpp
+++ b/modules/gui/qt/maininterface/mainui.cpp
@@ -182,7 +182,6 @@ void MainUI::registerQMLTypes()
registerAnonymousType<MLArtist>("org.videolan.medialib", 1);
registerAnonymousType<MLAlbumTrack>("org.videolan.medialib", 1);
registerAnonymousType<MLGenre>("org.videolan.medialib", 1);
- registerAnonymousType<MLVideo>("org.videolan.medialib", 1);
qmlRegisterType<AlbumContextMenu>( "org.videolan.medialib", 0, 1, "AlbumContextMenu" );
qmlRegisterType<ArtistContextMenu>( "org.videolan.medialib", 0, 1, "ArtistContextMenu" );
diff --git a/modules/gui/qt/medialibrary/mlvideo.cpp b/modules/gui/qt/medialibrary/mlvideo.cpp
index acedfd8f9b..10bb975e75 100644
--- a/modules/gui/qt/medialibrary/mlvideo.cpp
+++ b/modules/gui/qt/medialibrary/mlvideo.cpp
@@ -72,9 +72,8 @@ unsigned int AudioDescription::getSampleRate() const
return m_sampleRate;
}
-MLVideo::MLVideo(vlc_medialibrary_t* ml, const vlc_ml_media_t* data, QObject* parent)
- : QObject( parent )
- , MLItem( MLItemId( data->i_id, VLC_ML_PARENT_UNKNOWN ) )
+MLVideo::MLVideo(vlc_medialibrary_t* ml, const vlc_ml_media_t* data)
+ : MLItem( MLItemId( data->i_id, VLC_ML_PARENT_UNKNOWN ) )
, m_ml( ml )
, m_title( QString::fromUtf8( data->psz_title ) )
, m_thumbnail( QString::fromUtf8( data->thumbnails[VLC_ML_THUMBNAIL_SMALL].psz_mrl ) )
diff --git a/modules/gui/qt/medialibrary/mlvideo.hpp b/modules/gui/qt/medialibrary/mlvideo.hpp
index 58d105c3d3..604b17a37a 100644
--- a/modules/gui/qt/medialibrary/mlvideo.hpp
+++ b/modules/gui/qt/medialibrary/mlvideo.hpp
@@ -85,12 +85,10 @@ private:
Q_DECLARE_METATYPE(AudioDescription)
-class MLVideo : public QObject, public MLItem
+class MLVideo : public MLItem
{
- Q_OBJECT
-
public:
- MLVideo(vlc_medialibrary_t *ml, const vlc_ml_media_t *data, QObject *parent = nullptr);
+ MLVideo(vlc_medialibrary_t *ml, const vlc_ml_media_t *data);
QString getTitle() const;
QString getThumbnail();
--
2.29.2
More information about the vlc-devel
mailing list