comparison src/gui/pages/anime_list.cc @ 400:2f4dc1580b84

anime_list: kind of properly display highlighted anime above others ...
author Paper <paper@tflc.us>
date Fri, 07 Nov 2025 15:40:56 -0500
parents a0bc3ae5164a
children
comparison
equal deleted inserted replaced
399:a0bc3ae5164a 400:2f4dc1580b84
74 { 74 {
75 } 75 }
76 76
77 bool AnimeListPageSortFilter::lessThan(const QModelIndex &l, const QModelIndex &r) const 77 bool AnimeListPageSortFilter::lessThan(const QModelIndex &l, const QModelIndex &r) const
78 { 78 {
79 /* TODO obey session.config.anime_list.highlighted_anime_above_others; 79 if (session.config.anime_list.highlighted_anime_above_others) {
80 * need to add a huge bias towards unavailable anime */ 80 QVariant left = sourceModel()->data(l, Qt::UserRole + 1);
81 QVariant right = sourceModel()->data(r, Qt::UserRole + 1);
82
83 if (left.toInt() && !right.toInt())
84 return 1;
85 }
86
81 QVariant left = sourceModel()->data(l, sortRole()); 87 QVariant left = sourceModel()->data(l, sortRole());
82 QVariant right = sourceModel()->data(r, sortRole()); 88 QVariant right = sourceModel()->data(r, sortRole());
83 89
84 switch (left.userType()) { 90 switch (left.userType()) {
85 case QMetaType::Int: 91 case QMetaType::Int:
190 case AL_AVG_SCORE: return list[index.row()].GetAudienceScore(); 196 case AL_AVG_SCORE: return list[index.row()].GetAudienceScore();
191 case AL_UPDATED: return QVariant::fromValue(list[index.row()].GetUserTimeUpdated()); 197 case AL_UPDATED: return QVariant::fromValue(list[index.row()].GetUserTimeUpdated());
192 default: return data(index, Qt::DisplayRole); 198 default: return data(index, Qt::DisplayRole);
193 } 199 }
194 break; 200 break;
201 case Qt::UserRole + 1:
202 return !!Library::db.GetAnimeFolder(list[index.row()].GetId());
195 case Qt::TextAlignmentRole: 203 case Qt::TextAlignmentRole:
196 switch (index.column()) { 204 switch (index.column()) {
197 case AL_TITLE: 205 case AL_TITLE:
198 case AL_NOTES: return QVariant(Qt::AlignLeft | Qt::AlignVCenter); 206 case AL_NOTES: return QVariant(Qt::AlignLeft | Qt::AlignVCenter);
199 case AL_PROGRESS: 207 case AL_PROGRESS: