Mercurial > minori
changeset 399:a0bc3ae5164a default tip
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 | 650a9159a0e7 |
| children | |
| files | src/core/filesystem.cc src/gui/pages/anime_list.cc |
| diffstat | 2 files changed, 24 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/core/filesystem.cc Fri Nov 07 14:32:11 2025 -0500 +++ b/src/core/filesystem.cc Fri Nov 07 15:28:22 2025 -0500 @@ -61,7 +61,7 @@ } /* ------------------------------------------------------------------------ */ -/* Ehhhhh */ +/* This is the "base class" for basically every watcher. */ class Watcher : public IWatcher { public: @@ -80,8 +80,8 @@ /* ------------------------------------------------------------------------ */ /* Filesystem watcher. - * This is the portable version for non-Windows (of which the Windows - * specific version hasn't been written yet... TODO) */ + * This is the portable version for non-Windows; however, pretty much + * every implementation should be based on this in some shape or form. */ /* We can't use std::recursive_directory_iterator! @@ -177,8 +177,16 @@ bool recursive_; }; +/* There does actually exist an API in Qt to do file system watching. + * However, it is of little use for us, since it + * a) isn't recursive + * b) requires constant conversion to and from QString, which takes + * up valuable system resources + * c) uses signals etc. that are a pain in the ass to use in an + * event-processing logic like we do here. */ + #ifdef WIN32 -/* On Windows, we can ask the OS whether the folder has changed or not. +/* On Windows, we can ask the OS whether the directory tree has changed or not. * This is great for us! */ class Win32Watcher : public StdFilesystemWatcher { public: @@ -228,6 +236,11 @@ bool first_; }; +/* I think "Vista" is actually a misnomer, MSDN says that ReadDirectoryChangesW + * has existed since Windows XP. + * + * Anyway, this is a version that doesn't need to keep the whole directory + * tree in-memory if it is available. */ class Win32WatcherVista : public Win32Watcher { public: Win32WatcherVista(void *opaque, const std::filesystem::path &path, IWatcher::EventHandler handler, bool recursive)
--- a/src/gui/pages/anime_list.cc Fri Nov 07 14:32:11 2025 -0500 +++ b/src/gui/pages/anime_list.cc Fri Nov 07 15:28:22 2025 -0500 @@ -76,6 +76,8 @@ 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 */ QVariant left = sourceModel()->data(l, sortRole()); QVariant right = sourceModel()->data(r, sortRole()); @@ -174,6 +176,11 @@ default: return ""; } break; + case Qt::ForegroundRole: + if (session.config.anime_list.highlight_anime_if_available && Library::db.GetAnimeFolder(list[index.row()].GetId())) + /* Did we have a global palette state? Lol */ + return QPalette().color(QPalette::Highlight); + break; case Qt::UserRole: switch (index.column()) { case AL_PROGRESS: return list[index.row()].GetUserProgress();
