diff --git a/CHANGELOG.md b/CHANGELOG.md index 41b4774d..dc8db020 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ Version counting is based on semantic versioning (Major.Feature.Patch) * Add system info to the help/about dialog to help reporting bugs. * Fix selection when clicking on a folder in search mode. * Fix defaul value for manga/comic mode in folders. +* Add an edit for filtering series results returned by Comic Vine. ## 9.8.2 ### YACReaderLibrary diff --git a/YACReaderLibrary/comic_vine/comic_vine_dialog.cpp b/YACReaderLibrary/comic_vine/comic_vine_dialog.cpp index 825ea147..f7d37921 100644 --- a/YACReaderLibrary/comic_vine/comic_vine_dialog.cpp +++ b/YACReaderLibrary/comic_vine/comic_vine_dialog.cpp @@ -39,6 +39,13 @@ ComicVineDialog::ComicVineDialog(QWidget *parent) doConnections(); } +void ComicVineDialog::closeEvent(QCloseEvent *event) +{ + QDialog::closeEvent(event); + + clearState(); +} + void ComicVineDialog::doLayout() { setStyleSheet("" @@ -117,6 +124,8 @@ void ComicVineDialog::doConnections() void ComicVineDialog::goNext() { + clearState(); + // if (content->currentWidget() == seriesQuestionWidget) { if (seriesQuestionWidget->getYes()) { @@ -167,6 +176,8 @@ void ComicVineDialog::goNext() void ComicVineDialog::goBack() { + clearState(); + switch (status) { case SelectingSeries: if (mode == Volume) @@ -722,6 +733,11 @@ void ComicVineDialog::goToNextComic() titleHeader->setSubTitle(tr("comic %1 of %2 - %3").arg(currentIndex + 1).arg(comics.length()).arg(title)); } +void ComicVineDialog::clearState() +{ + selectVolumeWidget->clearFilter(); +} + void ComicVineDialog::showLoading(const QString &message) { content->setCurrentIndex(0); diff --git a/YACReaderLibrary/comic_vine/comic_vine_dialog.h b/YACReaderLibrary/comic_vine/comic_vine_dialog.h index 8088e82e..9ea4b7f1 100644 --- a/YACReaderLibrary/comic_vine/comic_vine_dialog.h +++ b/YACReaderLibrary/comic_vine/comic_vine_dialog.h @@ -33,7 +33,7 @@ public: QSize minimumSizeHint() const override; void getComicsInfo(QList> matchingInfo, int count, const QString &publisher); void getComicInfo(const QString &comicId, int count, const QString &publisher); - + void closeEvent(QCloseEvent *event) override; signals: public slots: @@ -63,6 +63,7 @@ protected slots: void goToNextComic(); private: + void clearState(); QString getCharacters(const QVariant &json_characters); QMultiMap getAuthors(const QVariant &json_authors); QPair getFirstStoryArcIdAndName(const QVariant &json_story_arcs); diff --git a/YACReaderLibrary/comic_vine/select_volume.cpp b/YACReaderLibrary/comic_vine/select_volume.cpp index 0282208b..76915488 100644 --- a/YACReaderLibrary/comic_vine/select_volume.cpp +++ b/YACReaderLibrary/comic_vine/select_volume.cpp @@ -12,8 +12,10 @@ #include #include #include +#include #include "scraper_tableview.h" +#include "scraper_lineedit.h" #include "volumes_model.h" #include "comic_vine_client.h" @@ -26,6 +28,7 @@ SelectVolume::SelectVolume(QWidget *parent) : ScraperSelector(parent), model(0) { proxyModel = new QSortFilterProxyModel; + proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive); QString labelStylesheet = "QLabel {color:white; font-size:12px;font-family:Arial;}"; @@ -36,6 +39,7 @@ SelectVolume::SelectVolume(QWidget *parent) QWidget *leftWidget = new QWidget; auto left = new QVBoxLayout; auto content = new QGridLayout; + auto top = new QHBoxLayout; // widgets cover = new QLabel(); @@ -47,12 +51,14 @@ SelectVolume::SelectVolume(QWidget *parent) tableVolumes = new ScraperTableView(); tableVolumes->setSortingEnabled(true); -#if QT_VERSION >= 0x050000 tableVolumes->horizontalHeader()->setSectionsClickable(true); -#else - tableVolumes->horizontalHeader()->setClickable(true); -#endif - // tableVolumes->horizontalHeader()->setSortIndicatorShown(false); + + filterEdit = new ScraperLineEdit(tr("Filter:")); + filterEdit->setMaximumWidth(200); + filterEdit->setClearButtonEnabled(true); + + connect(filterEdit, &QLineEdit::textChanged, proxyModel, &QSortFilterProxyModel::setFilterFixedString); + connect(tableVolumes->horizontalHeader(), &QHeaderView::sectionClicked, [=](int index) { tableVolumes->horizontalHeader()->sortIndicatorSection() == index ? tableVolumes->sortByColumn(index, tableVolumes->horizontalHeader()->sortIndicatorOrder() == Qt::AscendingOrder ? Qt::DescendingOrder : Qt::AscendingOrder) : tableVolumes->sortByColumn(index, Qt::AscendingOrder); }); @@ -61,6 +67,10 @@ SelectVolume::SelectVolume(QWidget *parent) paginator->setCustomLabel(tr("volumes")); + top->addWidget(label); + top->addStretch(); + top->addWidget(filterEdit); + left->addWidget(cover); left->addWidget(detailLabel, 1); leftWidget->setMaximumWidth(180); @@ -76,7 +86,7 @@ SelectVolume::SelectVolume(QWidget *parent) content->setRowStretch(0, 1); l->addSpacing(15); - l->addWidget(label); + l->addLayout(top); l->addSpacing(5); l->addLayout(content); @@ -111,6 +121,11 @@ void SelectVolume::load(const QString &json, const QString &searchString) ScraperSelector::load(json, searchString); } +void SelectVolume::clearFilter() +{ + filterEdit->clear(); +} + SelectVolume::~SelectVolume() { } void SelectVolume::loadVolumeInfo(const QModelIndex &omi) diff --git a/YACReaderLibrary/comic_vine/select_volume.h b/YACReaderLibrary/comic_vine/select_volume.h index 8bdbe625..e6e00d00 100644 --- a/YACReaderLibrary/comic_vine/select_volume.h +++ b/YACReaderLibrary/comic_vine/select_volume.h @@ -11,6 +11,7 @@ class QSortFilterProxyModel; class ScraperScrollLabel; class ScraperTableView; +class ScraperLineEdit; class SelectVolume : public ScraperSelector { @@ -18,6 +19,7 @@ class SelectVolume : public ScraperSelector public: SelectVolume(QWidget *parent = nullptr); void load(const QString &json, const QString &searchString) override; + void clearFilter(); virtual ~SelectVolume(); public slots: @@ -34,6 +36,7 @@ private: ScraperTableView *tableVolumes; VolumesModel *model; QSortFilterProxyModel *proxyModel; + ScraperLineEdit *filterEdit; }; #endif // SELECT_VOLUME_H diff --git a/custom_widgets/whats_new_dialog.cpp b/custom_widgets/whats_new_dialog.cpp index b638e573..d616b45e 100644 --- a/custom_widgets/whats_new_dialog.cpp +++ b/custom_widgets/whats_new_dialog.cpp @@ -69,7 +69,8 @@ YACReader::WhatsNewDialog::WhatsNewDialog(QWidget *parent) " • Use a scale effect in the comics grids on mouse over.
" " • Fix selection when clicking on a folder in search mode.
" " • Add system info to the help/about dialog to help reporting bugs.
" - " • Fix defaul value for manga/comic mode in folders..
" + " • Fix defaul value for manga/comic mode in folders.
" + " • Add an edit for filtering series results returned by Comic Vine.
" "
" "I hope you enjoy the new update. Please, if you like YACReader consider to become a patron in Patreon or donate some money using Pay-Pal and help keeping the project alive. Remember that there is an iOS version available in the Apple App Store."); QFont textLabelFont("Arial", 15, QFont::Light);