diff 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
line wrap: on
line diff
--- a/src/gui/pages/anime_list.cc	Fri Nov 07 15:28:22 2025 -0500
+++ b/src/gui/pages/anime_list.cc	Fri Nov 07 15:40:56 2025 -0500
@@ -76,8 +76,14 @@
 
 bool AnimeListPageSortFilter::lessThan(const QModelIndex &l, const QModelIndex &r) const
 {
-	/* TODO obey session.config.anime_list.highlighted_anime_above_others;
-	 * need to add a huge bias towards unavailable anime */
+	if (session.config.anime_list.highlighted_anime_above_others) {
+		QVariant left = sourceModel()->data(l, Qt::UserRole + 1);
+		QVariant right = sourceModel()->data(r, Qt::UserRole + 1);
+
+		if (left.toInt() && !right.toInt())
+			return 1;
+	}
+
 	QVariant left = sourceModel()->data(l, sortRole());
 	QVariant right = sourceModel()->data(r, sortRole());
 
@@ -192,6 +198,8 @@
 				default: return data(index, Qt::DisplayRole);
 			}
 			break;
+		case Qt::UserRole + 1:
+			return !!Library::db.GetAnimeFolder(list[index.row()].GetId());
 		case Qt::TextAlignmentRole:
 			switch (index.column()) {
 				case AL_TITLE: