From 57570b38df9e1b31bbb1fae1335b126075cdab69 Mon Sep 17 00:00:00 2001 From: Bionus Date: Tue, 23 Jan 2024 11:00:01 +0100 Subject: [PATCH] feat: add setting to disable blacklist warning pop-up (fix #3088) --- src/gui/src/settings/options-window.cpp | 2 ++ src/gui/src/settings/options-window.ui | 33 ++++++++++++++++--------- src/gui/src/tabs/search-tab.cpp | 12 +++++---- 3 files changed, 31 insertions(+), 16 deletions(-) diff --git a/src/gui/src/settings/options-window.cpp b/src/gui/src/settings/options-window.cpp index 069cc25cf..2d2bb7dbe 100644 --- a/src/gui/src/settings/options-window.cpp +++ b/src/gui/src/settings/options-window.cpp @@ -182,6 +182,7 @@ OptionsWindow::OptionsWindow(Profile *profile, ThemeLoader *themeLoader, QWidget // Blacklist ui->textBlacklist->setPlainText(profile->getBlacklist().toString()); + ui->checkWarnBlacklisted->setChecked(settings->value("warnblacklisted", true).toBool()); ui->checkDownloadBlacklisted->setChecked(settings->value("downloadblacklist", false).toBool()); new SearchSyntaxHighlighter(false, ui->textBlacklist->document()); @@ -1159,6 +1160,7 @@ void OptionsWindow::save() blacklist.add(tags.trimmed().split(' ', Qt::SkipEmptyParts)); } m_profile->setBlacklistedTags(blacklist); + settings->setValue("warnblacklisted", ui->checkWarnBlacklisted->isChecked()); settings->setValue("downloadblacklist", ui->checkDownloadBlacklisted->isChecked()); // Ignored tags diff --git a/src/gui/src/settings/options-window.ui b/src/gui/src/settings/options-window.ui index 21644581b..07e01e35d 100644 --- a/src/gui/src/settings/options-window.ui +++ b/src/gui/src/settings/options-window.ui @@ -5007,21 +5007,16 @@ - Ignore images containing a blacklisted tag + Hide images containing a blacklisted tag from results - - - - true - - + - Images containing a blacklisted tag will not be displayed in the results if this box is checked. Else, a confirmation will be asked before showing one of these images. + Warn before opening images containing a blacklisted tag - + true @@ -6049,8 +6044,24 @@ 263 - 498 - 291 + 718 + 325 + + + + + checkHideBlacklisted + toggled(bool) + checkWarnBlacklisted + setDisabled(bool) + + + 523 + 507 + + + 515 + 522 diff --git a/src/gui/src/tabs/search-tab.cpp b/src/gui/src/tabs/search-tab.cpp index 95b6ac78c..881485aee 100644 --- a/src/gui/src/tabs/search-tab.cpp +++ b/src/gui/src/tabs/search-tab.cpp @@ -1089,11 +1089,13 @@ void SearchTab::openImage(int id) const QSharedPointer &image = m_images.at(id); - QStringList detected = m_profile->getBlacklist().match(image->tokens(m_profile)); - if (!detected.isEmpty()) { - const int reply = QMessageBox::question(parentWidget(), tr("Blacklist"), tr("%n tag figuring in the blacklist detected in this image: %1. Do you want to display it anyway?", "", detected.size()).arg(detected.join(", ")), QMessageBox::Yes | QMessageBox::No); - if (reply == QMessageBox::No) { - return; + if (m_settings->value("warnblacklisted", true).toBool()) { + QStringList detected = m_profile->getBlacklist().match(image->tokens(m_profile)); + if (!detected.isEmpty()) { + const int reply = QMessageBox::question(parentWidget(), tr("Blacklist"), tr("%n tag figuring in the blacklist detected in this image: %1. Do you want to display it anyway?", "", detected.size()).arg(detected.join(", ")), QMessageBox::Yes | QMessageBox::No); + if (reply == QMessageBox::No) { + return; + } } }