[vlc-devel] [PATCH 2/4] qt: medialib: remove items clone()

Romain Vimont rom1v at videolabs.io
Fri Dec 18 13:53:34 UTC 2020


List model items are never cloned.
---
 modules/gui/qt/medialibrary/mlalbum.cpp       | 20 ------------------
 modules/gui/qt/medialibrary/mlalbum.hpp       |  5 -----
 modules/gui/qt/medialibrary/mlalbumtrack.cpp  | 21 -------------------
 modules/gui/qt/medialibrary/mlalbumtrack.hpp  |  4 ----
 modules/gui/qt/medialibrary/mlartist.cpp      | 18 ----------------
 modules/gui/qt/medialibrary/mlartist.hpp      |  4 ----
 modules/gui/qt/medialibrary/mlgenre.cpp       | 17 ---------------
 modules/gui/qt/medialibrary/mlgenre.hpp       |  4 ----
 .../gui/qt/medialibrary/mlrecentsmodel.cpp    |  5 -----
 .../gui/qt/medialibrary/mlrecentsmodel.hpp    |  2 --
 modules/gui/qt/medialibrary/mlurlmodel.cpp    |  4 ----
 modules/gui/qt/medialibrary/mlurlmodel.hpp    |  2 --
 modules/gui/qt/medialibrary/mlvideo.cpp       | 18 ----------------
 modules/gui/qt/medialibrary/mlvideo.hpp       |  4 ----
 14 files changed, 128 deletions(-)

diff --git a/modules/gui/qt/medialibrary/mlalbum.cpp b/modules/gui/qt/medialibrary/mlalbum.cpp
index 6a80648b33..b9edaa2d8d 100644
--- a/modules/gui/qt/medialibrary/mlalbum.cpp
+++ b/modules/gui/qt/medialibrary/mlalbum.cpp
@@ -55,21 +55,6 @@ MLAlbum::MLAlbum(vlc_medialibrary_t* _ml, const vlc_ml_album_t *_data, QObject *
     }
 }
 
-//private ctor for cloning
-MLAlbum::MLAlbum(const MLAlbum& _album, QObject *_parent)
-    : QObject( _parent )
-    , MLItem        ( _album.getId() )
-    , m_ml          ( _album.m_ml )
-    , m_title       ( _album.m_title )
-    , m_releaseYear ( _album.m_releaseYear )
-    , m_shortSummary( _album.m_shortSummary )
-    , m_cover       ( _album.m_cover )
-    , m_mainArtist  ( _album.m_mainArtist )
-    , m_nbTracks    ( _album.m_nbTracks )
-    , m_duration    ( _album.m_duration )
-{
-}
-
 QString MLAlbum::getTitle() const
 {
     return m_title;
@@ -111,11 +96,6 @@ QString MLAlbum::getDurationShort() const
     return m_durationShort;
 }
 
-MLAlbum *MLAlbum::clone(QObject *parent) const
-{
-    return new MLAlbum(*this, parent);
-}
-
 QString MLAlbum::getPresName() const
 {
     return m_title;
diff --git a/modules/gui/qt/medialibrary/mlalbum.hpp b/modules/gui/qt/medialibrary/mlalbum.hpp
index a53ffaaf5a..6abba39cde 100644
--- a/modules/gui/qt/medialibrary/mlalbum.hpp
+++ b/modules/gui/qt/medialibrary/mlalbum.hpp
@@ -47,16 +47,11 @@ public:
     QString getDuration() const;
     QString getDurationShort() const;
 
-    MLAlbum* clone(QObject *parent = nullptr) const;
-
     Q_INVOKABLE QString getPresName() const;
     Q_INVOKABLE QString getPresImage() const;
     Q_INVOKABLE QString getPresInfo() const;
 
 private:
-    //private ctor for cloning
-    MLAlbum(const MLAlbum &_album, QObject *_parent = nullptr);
-
     vlc_medialibrary_t* m_ml;
 
     QString m_title;
diff --git a/modules/gui/qt/medialibrary/mlalbumtrack.cpp b/modules/gui/qt/medialibrary/mlalbumtrack.cpp
index 1bc1d600cb..ba3a32bb3a 100644
--- a/modules/gui/qt/medialibrary/mlalbumtrack.cpp
+++ b/modules/gui/qt/medialibrary/mlalbumtrack.cpp
@@ -82,21 +82,6 @@ MLAlbumTrack::MLAlbumTrack(vlc_medialibrary_t* _ml, const vlc_ml_media_t *_data,
     }
 }
 
-MLAlbumTrack::MLAlbumTrack(const MLAlbumTrack &albumtrack, QObject *_parent)
-    : QObject( _parent )
-    , MLItem         ( albumtrack.getId() )
-    , m_title        ( albumtrack.m_title )
-    , m_albumTitle   ( albumtrack.m_albumTitle )
-    , m_artist       ( albumtrack.m_artist )
-    , m_cover        ( albumtrack.m_cover )
-    , m_trackNumber  ( albumtrack.m_trackNumber )
-    , m_discNumber   ( albumtrack.m_discNumber )
-    , m_duration     ( albumtrack.m_duration )
-    , m_durationShort( albumtrack.m_durationShort )
-    , m_mrl          ( albumtrack.m_mrl )
-{
-}
-
 QString MLAlbumTrack::getTitle() const
 {
     return m_title;
@@ -141,9 +126,3 @@ QString MLAlbumTrack::getMRL() const
 {
     return m_mrl;
 }
-
-MLAlbumTrack *MLAlbumTrack::clone(QObject *parent) const
-{
-    return new MLAlbumTrack(*this, parent);
-}
-
diff --git a/modules/gui/qt/medialibrary/mlalbumtrack.hpp b/modules/gui/qt/medialibrary/mlalbumtrack.hpp
index 709ea266c8..7cda00f081 100644
--- a/modules/gui/qt/medialibrary/mlalbumtrack.hpp
+++ b/modules/gui/qt/medialibrary/mlalbumtrack.hpp
@@ -48,11 +48,7 @@ public:
     QString getDurationShort() const;
     QString getMRL() const;
 
-    MLAlbumTrack* clone(QObject *parent = nullptr) const;
-
 private:
-    MLAlbumTrack(const MLAlbumTrack& albumtrack, QObject *_parent = nullptr);
-
     QString m_title;
     QString m_albumTitle;
     QString m_artist;
diff --git a/modules/gui/qt/medialibrary/mlartist.cpp b/modules/gui/qt/medialibrary/mlartist.cpp
index af40f2018e..14f3c493ed 100644
--- a/modules/gui/qt/medialibrary/mlartist.cpp
+++ b/modules/gui/qt/medialibrary/mlartist.cpp
@@ -31,18 +31,6 @@ MLArtist::MLArtist(const vlc_ml_artist_t* _data, QObject *_parent)
     assert( _data );
 }
 
-MLArtist::MLArtist(const MLArtist &artist, QObject *_parent)
-    : QObject(_parent)
-    , MLItem    ( artist.getId() )
-    , m_name    ( artist.m_name )
-    , m_shortBio( artist.m_shortBio )
-    , m_cover   ( artist.m_cover )
-    , m_nbAlbums( artist.m_nbAlbums )
-    , m_nbTracks( artist.m_nbTracks )
-{
-
-}
-
 QString MLArtist::getName() const
 {
     return m_name;
@@ -69,12 +57,6 @@ unsigned int MLArtist::getNbTracks() const
     return m_nbTracks;
 }
 
-MLArtist *MLArtist::clone(QObject *parent) const
-{
-    return new MLArtist(*this, parent);
-}
-
-
 QString MLArtist::getPresName() const
 {
     return m_name;
diff --git a/modules/gui/qt/medialibrary/mlartist.hpp b/modules/gui/qt/medialibrary/mlartist.hpp
index f69b6837c6..da493760fd 100644
--- a/modules/gui/qt/medialibrary/mlartist.hpp
+++ b/modules/gui/qt/medialibrary/mlartist.hpp
@@ -47,15 +47,11 @@ public:
     unsigned int getNbAlbums() const;
     unsigned int getNbTracks() const;
 
-    MLArtist* clone(QObject *parent = nullptr) const;
-
     Q_INVOKABLE QString getPresName() const;
     Q_INVOKABLE QString getPresImage() const;
     Q_INVOKABLE QString getPresInfo() const;
 
 private:
-    MLArtist(const MLArtist &artist, QObject *_parent = nullptr);
-
     QString m_name;
     QString m_shortBio;
     QString m_cover;
diff --git a/modules/gui/qt/medialibrary/mlgenre.cpp b/modules/gui/qt/medialibrary/mlgenre.cpp
index 9506e9017e..c9aae9112b 100644
--- a/modules/gui/qt/medialibrary/mlgenre.cpp
+++ b/modules/gui/qt/medialibrary/mlgenre.cpp
@@ -221,16 +221,6 @@ MLGenre::MLGenre(vlc_medialibrary_t* ml, const vlc_ml_genre_t *_data, QObject *_
     connect(this, &MLGenre::askGenerateCover, this, &MLGenre::generateThumbnail);
 }
 
-MLGenre::MLGenre(const MLGenre &genre, QObject *_parent)
-    : QObject(_parent)
-    , MLItem    ( genre.getId() )
-    , m_ml      ( genre.m_ml )
-    , m_name    ( genre.m_name )
-    , m_nbTracks( genre.m_nbTracks )
-{
-
-}
-
 MLGenre::~MLGenre()
 {
     if (m_coverTask) {
@@ -268,13 +258,6 @@ void MLGenre::setCover(QString cover)
     //TODO store in media library
 }
 
-MLGenre *MLGenre::clone(QObject *parent) const
-{
-    return new MLGenre(*this, parent);
-}
-
-
-
 void MLGenre::generateThumbnail()
 {
     if (!m_coverTask && m_cover.isNull()) {
diff --git a/modules/gui/qt/medialibrary/mlgenre.hpp b/modules/gui/qt/medialibrary/mlgenre.hpp
index 01057408b8..16ba8927e9 100644
--- a/modules/gui/qt/medialibrary/mlgenre.hpp
+++ b/modules/gui/qt/medialibrary/mlgenre.hpp
@@ -47,8 +47,6 @@ public:
 
     void setCover(QString cover);
 
-    MLGenre* clone(QObject *parent = nullptr) const;
-
 signals:
     void askGenerateCover( QPrivateSignal ) const;
 
@@ -56,8 +54,6 @@ private slots:
     void generateThumbnail();
 
 private:
-    MLGenre( const MLGenre& genre, QObject *_parent = nullptr);
-
     vlc_medialibrary_t* m_ml;
 
     QString m_name;
diff --git a/modules/gui/qt/medialibrary/mlrecentsmodel.cpp b/modules/gui/qt/medialibrary/mlrecentsmodel.cpp
index 4351b0c0f2..e4c675ce34 100644
--- a/modules/gui/qt/medialibrary/mlrecentsmodel.cpp
+++ b/modules/gui/qt/medialibrary/mlrecentsmodel.cpp
@@ -33,11 +33,6 @@ MLRecentMedia::MLRecentMedia( const MLRecentMedia& media )
 {
 }
 
-MLRecentMedia* MLRecentMedia::clone() const {
-    return new MLRecentMedia( *this );
-}
-
-
 MLRecentsModel::MLRecentsModel( QObject* parent )
     : MLBaseModel( parent )
 {
diff --git a/modules/gui/qt/medialibrary/mlrecentsmodel.hpp b/modules/gui/qt/medialibrary/mlrecentsmodel.hpp
index 60190e2035..378097b2ae 100644
--- a/modules/gui/qt/medialibrary/mlrecentsmodel.hpp
+++ b/modules/gui/qt/medialibrary/mlrecentsmodel.hpp
@@ -41,8 +41,6 @@ public:
     inline QUrl getUrl() const { return m_url; }
     inline QDateTime getLastPlayedDate() const { return m_lastPlayedDate; }
 
-    MLRecentMedia *clone() const;
-
 private:
     QUrl m_url;
     QDateTime m_lastPlayedDate;
diff --git a/modules/gui/qt/medialibrary/mlurlmodel.cpp b/modules/gui/qt/medialibrary/mlurlmodel.cpp
index d21a4b26d1..b0ad992554 100644
--- a/modules/gui/qt/medialibrary/mlurlmodel.cpp
+++ b/modules/gui/qt/medialibrary/mlurlmodel.cpp
@@ -122,10 +122,6 @@ QString MLUrl::getLastPlayedDate() const
     return m_lastPlayedDate;
 }
 
-MLUrl *MLUrl::clone() const {
-    return new MLUrl( *this );
-}
-
 ListCacheLoader<std::unique_ptr<MLItem>> *
 MLUrlModel::createLoader() const
 {
diff --git a/modules/gui/qt/medialibrary/mlurlmodel.hpp b/modules/gui/qt/medialibrary/mlurlmodel.hpp
index 859b76feb3..c5ae51bd66 100644
--- a/modules/gui/qt/medialibrary/mlurlmodel.hpp
+++ b/modules/gui/qt/medialibrary/mlurlmodel.hpp
@@ -39,8 +39,6 @@ public:
     QString getUrl() const;
     QString getLastPlayedDate() const;
 
-    MLUrl *clone() const;
-
 private:
     QString m_url;
     QString m_lastPlayedDate;
diff --git a/modules/gui/qt/medialibrary/mlvideo.cpp b/modules/gui/qt/medialibrary/mlvideo.cpp
index e5bc1239f6..cd87a96c11 100644
--- a/modules/gui/qt/medialibrary/mlvideo.cpp
+++ b/modules/gui/qt/medialibrary/mlvideo.cpp
@@ -141,19 +141,6 @@ MLVideo::MLVideo(vlc_medialibrary_t* ml, const vlc_ml_media_t* data, QObject* pa
         m_resolution = "720p";  
     }
 
-MLVideo::MLVideo(const MLVideo& video, QObject* parent)
-    : QObject( parent )
-    , MLItem( video.getId() )
-    , m_ml( video.m_ml )
-    , m_title( video.m_title )
-    , m_thumbnail( video.m_thumbnail )
-    , m_duration( video.m_duration )
-    , m_mrl( video.m_mrl )
-    , m_progress( video.m_progress )
-    , m_playCount( video.m_playCount )
-{
-}
-
 void MLVideo::onMlEvent( void* data, const vlc_ml_event_t* event )
 {
     auto self = static_cast<MLVideo*>(data);
@@ -250,8 +237,3 @@ QObjectList MLVideo::getAudioDesc() const
 {
     return m_audioDesc;
 }
-
-MLVideo*MLVideo::clone(QObject* parent) const
-{
-    return new MLVideo(*this, parent);
-}
diff --git a/modules/gui/qt/medialibrary/mlvideo.hpp b/modules/gui/qt/medialibrary/mlvideo.hpp
index 58b1b056f0..50c0712d74 100644
--- a/modules/gui/qt/medialibrary/mlvideo.hpp
+++ b/modules/gui/qt/medialibrary/mlvideo.hpp
@@ -100,11 +100,7 @@ public:
     QObjectList getAudioDesc() const;
     QObjectList getVideoDesc() const;
 
-    MLVideo* clone(QObject* parent = nullptr) const;
-
 private:
-    MLVideo(const MLVideo& video, QObject* parent = nullptr);
-
     static void onMlEvent( void* data, const vlc_ml_event_t* event );
     void onMlEvent( const vlc_ml_event_t* event );
 
-- 
2.29.2



More information about the vlc-devel mailing list