Mercurial > minori
changeset 400:2f4dc1580b84 default tip
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 | |
| files | src/gui/dialog/settings/application.cc src/gui/pages/anime_list.cc |
| diffstat | 2 files changed, 13 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gui/dialog/settings/application.cc Fri Nov 07 15:28:22 2025 -0500 +++ b/src/gui/dialog/settings/application.cc Fri Nov 07 15:40:56 2025 -0500 @@ -112,7 +112,8 @@ } { - /* Hopefully I made this easy to read... */ + /* Hopefully I made this easy to read... + * TODO: Call into the anime list page and tell it to re-sort everything. */ QCheckBox *hl_above_anime_box = new QCheckBox(tr("Display highlighted anime above others"), appearance_group_box); hl_above_anime_box->setCheckState(highlighted_anime_above_others ? Qt::Checked : Qt::Unchecked); @@ -120,7 +121,7 @@ hl_above_anime_box->setContentsMargins(10, 0, 0, 0); connect(hl_above_anime_box, &QCheckBox::stateChanged, this, - [this](int state) { highlight_anime_if_available = !(state == Qt::Unchecked); }); + [this](int state) { highlighted_anime_above_others = !(state == Qt::Unchecked); }); { /* This is here because the above checkbox actually depends on it to be checked. */
--- 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:
