diff options
author | Arno <arno@disconnect.de> | 2025-05-02 23:51:57 +0200 |
---|---|---|
committer | Arno <arno@disconnect.de> | 2025-05-02 23:51:57 +0200 |
commit | 88a80f8fb94ad10a9162ff340e392e79a7103fa3 (patch) | |
tree | 384bad3475df860f5b56e0b0bdfedd00732153ee /archivebrowser.cpp | |
parent | a45737e852c207d02f1dd06227de7916baa290c1 (diff) | |
download | SheMov-88a80f8fb94ad10a9162ff340e392e79a7103fa3.tar.gz SheMov-88a80f8fb94ad10a9162ff340e392e79a7103fa3.tar.bz2 SheMov-88a80f8fb94ad10a9162ff340e392e79a7103fa3.zip |
Add exclusion genre filters to ArchiveBrowser
Don't show excluded genres in ArchiveBrowser. To make this work, revamp
the filtering login in ArchiveBrowserModelProxy.
Diffstat (limited to 'archivebrowser.cpp')
-rw-r--r-- | archivebrowser.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/archivebrowser.cpp b/archivebrowser.cpp index 281c2fa..9234dbb 100644 --- a/archivebrowser.cpp +++ b/archivebrowser.cpp @@ -56,6 +56,7 @@ ArchiveBrowser::ArchiveBrowser(QWidget *parent) : QWidget(parent), mSelectedSize mQualityFilter = new QComboBox; toolBar->addWidget(mQualityFilter); setupQualityFilter(); + toolBar->addSeparator(); QStringList genres = mModel->availableGenres(); std::sort(genres.begin(), genres.end()); QActionGroup *gDataAG = new QActionGroup(this); @@ -72,6 +73,20 @@ ArchiveBrowser::ArchiveBrowser(QWidget *parent) : QWidget(parent), mSelectedSize genreMenu->addActions(gDataAG->actions()); genreA->setMenu(genreMenu); toolBar->addAction(genreA); + QActionGroup *gDataExcludedAG = new QActionGroup(this); + gDataExcludedAG->setExclusive(false); + for(const QString &g : std::as_const(genres)){ + QAction *a = new QAction(g, this); + a->setCheckable(true); + gDataExcludedAG->addAction(a); + connect(a, &QAction::triggered, a, [=] { mProxy->toggleExcludedGenre(a); }); + } + QIcon excludedGenreIcon = Helper::icon(Qt::transparent, qApp->palette().color(QPalette::Text), 'E', true, false); + QAction *excludedGenreA = new QAction(excludedGenreIcon, tr("Filter genres"), this); + QMenu *excludedGenreMenu = new QMenu; + excludedGenreMenu->addActions(gDataExcludedAG->actions()); + excludedGenreA->setMenu(excludedGenreMenu); + toolBar->addAction(excludedGenreA); toolBar->addSeparator(); mSizeFilter = new QCheckBox(tr("Filter by size")); connect(mSizeFilter, &QCheckBox::checkStateChanged, mProxy, &ArchiveBrowserModelProxy::setSizeFilter); |