[vlc-commits] [Git][videolan/vlc][master] 4 commits: qt: add sorting by tracks number in artist model
Steve Lhomme (@robUx4)
gitlab at videolan.org
Thu Aug 31 09:09:05 UTC 2023
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
e7e09d89 by Prince Gupta at 2023-08-31T08:32:27+00:00
qt: add sorting by tracks number in artist model
- - - - -
b0f2cc8e by Prince Gupta at 2023-08-31T08:32:27+00:00
qt: fix sorting by artist name
- - - - -
a6cdabde by Prince Gupta at 2023-08-31T08:32:27+00:00
qml: show sort menu with artist view
- - - - -
f80c6dad by Prince Gupta at 2023-08-31T08:32:27+00:00
qt: fix sorting in genre view
- - - - -
6 changed files:
- modules/gui/qt/medialibrary/mlartistmodel.cpp
- modules/gui/qt/medialibrary/mlgenremodel.cpp
- modules/gui/qt/medialibrary/mlgenremodel.hpp
- modules/gui/qt/medialibrary/qml/MusicAllArtists.qml
- modules/gui/qt/medialibrary/qml/MusicArtistsDisplay.qml
- modules/gui/qt/medialibrary/qml/MusicGenres.qml
Changes:
=====================================
modules/gui/qt/medialibrary/mlartistmodel.cpp
=====================================
@@ -19,7 +19,8 @@
#include "mlartistmodel.hpp"
QHash<QByteArray, vlc_ml_sorting_criteria_t> MLArtistModel::M_names_to_criteria = {
- {"title", VLC_ML_SORTING_ALPHA},
+ {"name", VLC_ML_SORTING_ALPHA},
+ {"nb_tracks", VLC_ML_SORTING_TRACKNUMBER},
};
MLArtistModel::MLArtistModel(QObject *parent)
=====================================
modules/gui/qt/medialibrary/mlgenremodel.cpp
=====================================
@@ -40,7 +40,7 @@ static const int MLGENREMODEL_COVER_BLUR = 4;
//-------------------------------------------------------------------------------------------------
QHash<QByteArray, vlc_ml_sorting_criteria_t> MLGenreModel::M_names_to_criteria = {
- {"title", VLC_ML_SORTING_ALPHA}
+ {"name", VLC_ML_SORTING_ALPHA}
};
MLGenreModel::MLGenreModel(QObject *parent)
@@ -137,6 +137,11 @@ vlc_ml_sorting_criteria_t MLGenreModel::nameToCriteria(QByteArray name) const
return M_names_to_criteria.value(name, VLC_ML_SORTING_DEFAULT);
}
+QByteArray MLGenreModel::criteriaToName(vlc_ml_sorting_criteria_t criteria) const
+{
+ return M_names_to_criteria.key(criteria, "");
+}
+
QString MLGenreModel::getCover(MLGenre * genre) const
{
return ml()->customCover()->get(genre->getId()
=====================================
modules/gui/qt/medialibrary/mlgenremodel.hpp
=====================================
@@ -67,6 +67,7 @@ private:
void onVlcMlEvent(const MLEvent &event) override;
vlc_ml_sorting_criteria_t roleToCriteria(int role) const override;
vlc_ml_sorting_criteria_t nameToCriteria(QByteArray name) const override;
+ QByteArray criteriaToName(vlc_ml_sorting_criteria_t criteria) const override;
QString getCover(MLGenre * genre) const;
=====================================
modules/gui/qt/medialibrary/qml/MusicAllArtists.qml
=====================================
@@ -36,6 +36,11 @@ MainInterface.MainViewLoader {
signal requestArtistAlbumView(int reason)
+ property var sortModel: [
+ { text: I18n.qtr("Alphabetic"), criteria: "name" },
+ { text: I18n.qtr("Tracks Count"), criteria: "nb_tracks" }
+ ]
+
model: MLArtistModel {
id: artistModel
ml: MediaLib
=====================================
modules/gui/qt/medialibrary/qml/MusicArtistsDisplay.qml
=====================================
@@ -34,6 +34,10 @@ Widgets.PageLoader {
property MLModel model
+ property var sortModel: !!stackViewItem && ("sortModel" in stackViewItem)
+ ? stackViewItem.sortModel
+ : null
+
pageModel: [{
name: "all",
component: allArtistsComponent
=====================================
modules/gui/qt/medialibrary/qml/MusicGenres.qml
=====================================
@@ -35,7 +35,7 @@ MainInterface.MainViewLoader {
// Properties
property var sortModel: [
- { text: I18n.qtr("Alphabetic"), criteria: "title" }
+ { text: I18n.qtr("Alphabetic"), criteria: "name" }
]
readonly property var currentIndex: Helpers.get(currentItem, "currentIndex", - 1)
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/5ba34ec3ae591d75656cb5b2fe046dd0197118a6...f80c6dadb581d3c329cbd1e3354aa2af5896392d
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/5ba34ec3ae591d75656cb5b2fe046dd0197118a6...f80c6dadb581d3c329cbd1e3354aa2af5896392d
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