comparison src/gui/pages/anime_list.cc @ 399:a0bc3ae5164a

anime_list: actually obey "highlight anime if they are available"
author Paper <paper@tflc.us>
date Fri, 07 Nov 2025 15:28:22 -0500
parents f7bb2978de48
children 2f4dc1580b84
comparison
equal deleted inserted replaced
398:650a9159a0e7 399:a0bc3ae5164a
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;
80 * need to add a huge bias towards unavailable anime */
79 QVariant left = sourceModel()->data(l, sortRole()); 81 QVariant left = sourceModel()->data(l, sortRole());
80 QVariant right = sourceModel()->data(r, sortRole()); 82 QVariant right = sourceModel()->data(r, sortRole());
81 83
82 switch (left.userType()) { 84 switch (left.userType()) {
83 case QMetaType::Int: 85 case QMetaType::Int:
172 } 174 }
173 case AL_NOTES: return Strings::ToQString(list[index.row()].GetUserNotes()); 175 case AL_NOTES: return Strings::ToQString(list[index.row()].GetUserNotes());
174 default: return ""; 176 default: return "";
175 } 177 }
176 break; 178 break;
179 case Qt::ForegroundRole:
180 if (session.config.anime_list.highlight_anime_if_available && Library::db.GetAnimeFolder(list[index.row()].GetId()))
181 /* Did we have a global palette state? Lol */
182 return QPalette().color(QPalette::Highlight);
183 break;
177 case Qt::UserRole: 184 case Qt::UserRole:
178 switch (index.column()) { 185 switch (index.column()) {
179 case AL_PROGRESS: return list[index.row()].GetUserProgress(); 186 case AL_PROGRESS: return list[index.row()].GetUserProgress();
180 case AL_SCORE: return list[index.row()].GetUserScore(); 187 case AL_SCORE: return list[index.row()].GetUserScore();
181 case AL_TYPE: return static_cast<int>(list[index.row()].GetFormat()); 188 case AL_TYPE: return static_cast<int>(list[index.row()].GetFormat());