[vlc-devel] [PATCH 2/3] qt: move default member initialisation in header for MLBaseModel for uniformity
Romain Vimont
rom1v at videolabs.io
Thu Dec 17 12:44:48 UTC 2020
LGTM, I prefer that way (less boilerplate).
On Thu, Dec 17, 2020 at 01:32:49PM +0100, Pierre Lamot wrote:
> ---
> modules/gui/qt/medialibrary/mlbasemodel.cpp | 5 -----
> modules/gui/qt/medialibrary/mlbasemodel.hpp | 8 ++++----
> 2 files changed, 4 insertions(+), 9 deletions(-)
>
> diff --git a/modules/gui/qt/medialibrary/mlbasemodel.cpp b/modules/gui/qt/medialibrary/mlbasemodel.cpp
> index 794b82198f..4549dacb57 100644
> --- a/modules/gui/qt/medialibrary/mlbasemodel.cpp
> +++ b/modules/gui/qt/medialibrary/mlbasemodel.cpp
> @@ -27,16 +27,11 @@ static constexpr ssize_t COUNT_UNINITIALIZED =
>
> MLBaseModel::MLBaseModel(QObject *parent)
> : QAbstractListModel(parent)
> - , m_ml(nullptr)
> , m_ml_event_handle( nullptr, [this](vlc_ml_event_callback_t* cb ) {
> assert( m_ml != nullptr );
> vlc_ml_event_unregister_callback( m_ml, cb );
> })
> - , m_need_reset( false )
> {
> - m_sort = VLC_ML_SORTING_DEFAULT;
> - m_sort_desc = false;
> -
> connect( this, &MLBaseModel::resetRequested, this, &MLBaseModel::onResetRequested );
> }
>
> diff --git a/modules/gui/qt/medialibrary/mlbasemodel.hpp b/modules/gui/qt/medialibrary/mlbasemodel.hpp
> index faef1c188a..d1057ac6b1 100644
> --- a/modules/gui/qt/medialibrary/mlbasemodel.hpp
> +++ b/modules/gui/qt/medialibrary/mlbasemodel.hpp
> @@ -142,15 +142,15 @@ public:
> protected:
> MLItemId m_parent;
>
> - vlc_medialibrary_t* m_ml;
> + vlc_medialibrary_t* m_ml = nullptr;
(oh ok, you did it in this patch) ;)
> MediaLib* m_mediaLib = nullptr;
> QString m_search_pattern;
> - vlc_ml_sorting_criteria_t m_sort;
> - bool m_sort_desc;
> + vlc_ml_sorting_criteria_t m_sort = VLC_ML_SORTING_DEFAULT;
> + bool m_sort_desc = false;
>
> std::unique_ptr<vlc_ml_event_callback_t,
> std::function<void(vlc_ml_event_callback_t*)>> m_ml_event_handle;
> - bool m_need_reset;
> + bool m_need_reset = false;
>
> mutable std::unique_ptr<ListCache<std::unique_ptr<MLItem>>> m_cache;
> };
> --
> 2.25.1
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
More information about the vlc-devel
mailing list