[vlc-commits] [Git][videolan/vlc][master] 12 commits: qt: don't register MLAlbum for QML usage

Steve Lhomme (@robUx4) gitlab at videolan.org
Tue Apr 23 06:59:24 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
86947d17 by Prince Gupta at 2024-04-23T06:26:28+00:00
qt: don't register MLAlbum for QML usage

its never directly used in QML

- - - - -
be020d53 by Prince Gupta at 2024-04-23T06:26:28+00:00
qt: don't inherit from QObject in MLAlbum

- - - - -
8765d6fa by Prince Gupta at 2024-04-23T06:26:28+00:00
qt: remove unused functions

- - - - -
0d379add by Prince Gupta at 2024-04-23T06:26:28+00:00
qt: don't register MLArtist for QML

- - - - -
170ba958 by Prince Gupta at 2024-04-23T06:26:28+00:00
qt: don't inherit from QObject in MLArtist

- - - - -
1a3b4423 by Prince Gupta at 2024-04-23T06:26:28+00:00
qt: remove unused includes

- - - - -
0a19e0b1 by Prince Gupta at 2024-04-23T06:26:28+00:00
qt: remove unused functions in MLArtist

- - - - -
c9c8c820 by Prince Gupta at 2024-04-23T06:26:28+00:00
qt: don't register MLAlbumTrack for qml

- - - - -
5a4a20f8 by Prince Gupta at 2024-04-23T06:26:28+00:00
qt: don't inherit from QObject in MLAlbumTrack

- - - - -
7849c1d9 by Prince Gupta at 2024-04-23T06:26:28+00:00
qt: remove unused includes and defines from mlalbumtrack.hpp

- - - - -
1e863d03 by Prince Gupta at 2024-04-23T06:26:28+00:00
qt: remove unused member variable from MLAlbumTrack

- - - - -
dfc16c85 by Prince Gupta at 2024-04-23T06:26:28+00:00
qt: fix identation in mlalbumtrack

- - - - -


7 changed files:

- modules/gui/qt/maininterface/mainui.cpp
- modules/gui/qt/medialibrary/mlalbum.cpp
- modules/gui/qt/medialibrary/mlalbum.hpp
- modules/gui/qt/medialibrary/mlalbumtrack.cpp
- modules/gui/qt/medialibrary/mlalbumtrack.hpp
- modules/gui/qt/medialibrary/mlartist.cpp
- modules/gui/qt/medialibrary/mlartist.hpp


Changes:

=====================================
modules/gui/qt/maininterface/mainui.cpp
=====================================
@@ -364,11 +364,6 @@ void MainUI::registerQMLTypes()
         qmlRegisterType<MLFoldersModel>( uri, versionMajor, versionMinor, "MLFolderModel");
         qmlRegisterType<MLRecentsModel>( uri, versionMajor, versionMinor, "MLRecentModel" );
 
-        //expose base object, they aren't instanciable from QML side
-        registerAnonymousType<MLAlbum>(uri, versionMajor);
-        registerAnonymousType<MLArtist>(uri, versionMajor);
-        registerAnonymousType<MLAlbumTrack>(uri, versionMajor);
-
         qmlRegisterType<PlaylistListContextMenu>( uri, versionMajor, versionMinor, "PlaylistListContextMenu" );
         qmlRegisterType<PlaylistMediaContextMenu>( uri, versionMajor, versionMinor, "PlaylistMediaContextMenu" );
 


=====================================
modules/gui/qt/medialibrary/mlalbum.cpp
=====================================
@@ -20,9 +20,8 @@
 
 #include "util/vlctick.hpp"
 
-MLAlbum::MLAlbum(const vlc_ml_album_t *_data, QObject *_parent)
-    : QObject( _parent )
-    , MLItem        ( MLItemId( _data->i_id, VLC_ML_PARENT_ALBUM ) )
+MLAlbum::MLAlbum(const vlc_ml_album_t *_data)
+    : MLItem        ( MLItemId( _data->i_id, VLC_ML_PARENT_ALBUM ) )
     , m_title       ( QString::fromUtf8( _data->psz_title ) )
     , m_releaseYear ( _data->i_year )
     , m_shortSummary( QString::fromUtf8( _data->psz_summary ) )
@@ -69,20 +68,3 @@ VLCTick MLAlbum::getDuration() const
 {
     return VLCTick::fromMS(m_duration);
 }
-
-QString MLAlbum::getPresName() const
-{
-    return m_title;
-}
-
-QString MLAlbum::getPresImage() const
-{
-    return m_cover;
-}
-
-QString MLAlbum::getPresInfo() const
-{
-    return m_shortSummary;
-}
-
-


=====================================
modules/gui/qt/medialibrary/mlalbum.hpp
=====================================
@@ -18,7 +18,6 @@
 
 #pragma once
 
-#include <QObject>
 #include <QString>
 #include <QList>
 #include <memory>
@@ -27,12 +26,10 @@
 
 class VLCTick;
 
-class MLAlbum : public QObject, public MLItem
+class MLAlbum : public MLItem
 {
-    Q_OBJECT
-
 public:
-    MLAlbum(const vlc_ml_album_t *_data, QObject *_parent = nullptr);
+    MLAlbum(const vlc_ml_album_t *_data);
 
     QString getTitle() const;
     unsigned int getReleaseYear() const;
@@ -42,10 +39,6 @@ public:
     unsigned int getNbTracks() const;
     VLCTick getDuration() const;
 
-    Q_INVOKABLE QString getPresName() const;
-    Q_INVOKABLE QString getPresImage() const;
-    Q_INVOKABLE QString getPresInfo() const;
-
 private:
     QString m_title;
     unsigned int m_releaseYear;


=====================================
modules/gui/qt/medialibrary/mlalbumtrack.cpp
=====================================
@@ -21,9 +21,8 @@
 #include "mlhelper.hpp"
 #include "util/vlctick.hpp"
 
-MLAlbumTrack::MLAlbumTrack(vlc_medialibrary_t* _ml, const vlc_ml_media_t *_data, QObject *_parent )
-    : QObject( _parent )
-    , MLItem       ( MLItemId( _data->i_id, VLC_ML_PARENT_UNKNOWN ) )
+MLAlbumTrack::MLAlbumTrack(vlc_medialibrary_t* _ml, const vlc_ml_media_t *_data)
+    : MLItem       ( MLItemId( _data->i_id, VLC_ML_PARENT_UNKNOWN ) )
     , m_title      ( QString::fromUtf8( _data->psz_title ) )
     , m_trackNumber( _data->album_track.i_track_nb )
     , m_discNumber ( _data->album_track.i_disc_nb )
@@ -51,14 +50,14 @@ MLAlbumTrack::MLAlbumTrack(vlc_medialibrary_t* _ml, const vlc_ml_media_t *_data,
     {
         ml_unique_ptr<vlc_ml_album_t> album(vlc_ml_get_album(_ml, _data->album_track.i_album_id));
         if (album)
-             m_albumTitle =  album->psz_title;
+            m_albumTitle =  album->psz_title;
     }
 
     if ( _data->album_track.i_artist_id != 0 )
     {
         ml_unique_ptr<vlc_ml_artist_t> artist(vlc_ml_get_artist(_ml, _data->album_track.i_artist_id));
         if (artist)
-             m_artist =  artist->psz_name;
+            m_artist =  artist->psz_name;
     }
 }
 


=====================================
modules/gui/qt/medialibrary/mlalbumtrack.hpp
=====================================
@@ -18,26 +18,18 @@
 
 #pragma once
 
-#include <QObject>
 #include <QString>
-#include <memory>
 
-#include "mlhelper.hpp"
+#include <vlc_media_library.h>
+
 #include "mlqmltypes.hpp"
 
 class VLCTick;
 
-extern "C" {
-    struct vlc_medialibrary_t;
-    typedef struct vlc_ml_media_t vlc_ml_media_t;
-};
-
-class MLAlbumTrack : public QObject, public MLItem
+class MLAlbumTrack : public MLItem
 {
-    Q_OBJECT
-
 public:
-    MLAlbumTrack(vlc_medialibrary_t *_ml, const vlc_ml_media_t *_data, QObject *_parent = nullptr);
+    MLAlbumTrack(vlc_medialibrary_t *_ml, const vlc_ml_media_t *_data);
 
     QString getTitle() const;
     QString getAlbumTitle() const;
@@ -57,6 +49,4 @@ private:
     unsigned int m_discNumber;
     int64_t m_duration;
     QString m_mrl;
-
-   ml_unique_ptr<vlc_ml_media_t> m_data;
 };


=====================================
modules/gui/qt/medialibrary/mlartist.cpp
=====================================
@@ -19,9 +19,8 @@
 #include <cassert>
 #include "mlartist.hpp"
 
-MLArtist::MLArtist(const vlc_ml_artist_t* _data, QObject *_parent)
-    : QObject(_parent)
-    , MLItem    ( MLItemId( _data->i_id, VLC_ML_PARENT_ARTIST ) )
+MLArtist::MLArtist(const vlc_ml_artist_t* _data)
+    : MLItem    ( MLItemId( _data->i_id, VLC_ML_PARENT_ARTIST ) )
     , m_name    ( QString::fromUtf8( _data->psz_name ) )
     , m_shortBio( QString::fromUtf8( _data->psz_shortbio ) )
     , m_cover   ( QString::fromUtf8( _data->thumbnails[VLC_ML_THUMBNAIL_SMALL].psz_mrl ) )
@@ -56,19 +55,3 @@ unsigned int MLArtist::getNbTracks() const
 {
     return m_nbTracks;
 }
-
-QString MLArtist::getPresName() const
-{
-    return m_name;
-}
-
-QString MLArtist::getPresImage() const
-{
-    return m_cover;
-}
-
-QString MLArtist::getPresInfo() const
-{
-    return m_shortBio;
-}
-


=====================================
modules/gui/qt/medialibrary/mlartist.hpp
=====================================
@@ -19,24 +19,15 @@
 #ifndef MLARTIST_HPP
 #define MLARTIST_HPP
 
-#include <QObject>
 #include <QString>
-#include <memory>
 
-#include "mlalbum.hpp"
 #include "mlhelper.hpp"
 #include "mlqmltypes.hpp"
 
-extern "C" {
-    typedef struct vlc_ml_artist_t vlc_ml_artist_t;
-};
-
-class MLArtist : public QObject, public MLItem
+class MLArtist : public MLItem
 {
-    Q_OBJECT
-
 public:
-    MLArtist(const vlc_ml_artist_t *_data, QObject *_parent = nullptr);
+    MLArtist(const vlc_ml_artist_t *_data);
 
     QString getName() const;
     QString getShortBio() const;
@@ -44,10 +35,6 @@ public:
     unsigned int getNbAlbums() const;
     unsigned int getNbTracks() const;
 
-    Q_INVOKABLE QString getPresName() const;
-    Q_INVOKABLE QString getPresImage() const;
-    Q_INVOKABLE QString getPresInfo() const;
-
 private:
     QString m_name;
     QString m_shortBio;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/ad28b9f96d39023260f513cf2d7b531568d656ca...dfc16c8578d9e235cec8ae36bf169df48670d6ca

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/ad28b9f96d39023260f513cf2d7b531568d656ca...dfc16c8578d9e235cec8ae36bf169df48670d6ca
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