From 8b4b586acc6677274df77d349ac586b93bd468d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Thu, 18 Aug 2022 14:35:25 +0200 Subject: [PATCH] Show the automatic volume text that is going to be used in comic vine dialog The user can chose to use it or edit it before starting the search. --- YACReaderLibrary/comic_vine/comic_vine_dialog.cpp | 12 ++++-------- YACReaderLibrary/comic_vine/comic_vine_dialog.h | 2 +- YACReaderLibrary/comic_vine/search_volume.cpp | 7 ++++++- YACReaderLibrary/comic_vine/search_volume.h | 3 ++- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/YACReaderLibrary/comic_vine/comic_vine_dialog.cpp b/YACReaderLibrary/comic_vine/comic_vine_dialog.cpp index a1782495..825ea147 100644 --- a/YACReaderLibrary/comic_vine/comic_vine_dialog.cpp +++ b/YACReaderLibrary/comic_vine/comic_vine_dialog.cpp @@ -123,13 +123,7 @@ void ComicVineDialog::goNext() QString volumeSearchString = comics[0].getParentFolderName(); mode = Volume; - if (volumeSearchString.isEmpty()) - showSearchVolume(); - else { - status = AutoSearching; - showLoading(tr("Looking for volume...")); - searchVolume(volumeSearchString); - } + showSearchVolume(volumeSearchString); } else { status = AutoSearching; mode = SingleComicInList; @@ -340,8 +334,10 @@ void ComicVineDialog::showSearchSingleComic() toggleSkipButton(); } -void ComicVineDialog::showSearchVolume() +void ComicVineDialog::showSearchVolume(const QString &volume) { + searchVolumeWidget->setVolumeInfo(volume); + status = AskingForInfo; content->setCurrentWidget(searchVolumeWidget); backButton->setHidden(true); diff --git a/YACReaderLibrary/comic_vine/comic_vine_dialog.h b/YACReaderLibrary/comic_vine/comic_vine_dialog.h index cba75d4d..8088e82e 100644 --- a/YACReaderLibrary/comic_vine/comic_vine_dialog.h +++ b/YACReaderLibrary/comic_vine/comic_vine_dialog.h @@ -46,7 +46,7 @@ protected slots: // show widget methods void showSeriesQuestion(); void showSearchSingleComic(); - void showSearchVolume(); + void showSearchVolume(const QString &volume = ""); void showLoading(const QString &message = ""); void search(); void searchVolume(const QString &v, int page = 1); diff --git a/YACReaderLibrary/comic_vine/search_volume.cpp b/YACReaderLibrary/comic_vine/search_volume.cpp index f56bd5b5..0e7fc11c 100644 --- a/YACReaderLibrary/comic_vine/search_volume.cpp +++ b/YACReaderLibrary/comic_vine/search_volume.cpp @@ -30,7 +30,12 @@ void SearchVolume::clean() volumeEdit->clear(); } -QString SearchVolume::getVolumeInfo() +void SearchVolume::setVolumeInfo(const QString &volume) +{ + volumeEdit->setText(volume); +} + +QString SearchVolume::getVolumeInfo() const { return volumeEdit->text(); } diff --git a/YACReaderLibrary/comic_vine/search_volume.h b/YACReaderLibrary/comic_vine/search_volume.h index 8343e129..49cc0f38 100644 --- a/YACReaderLibrary/comic_vine/search_volume.h +++ b/YACReaderLibrary/comic_vine/search_volume.h @@ -11,8 +11,9 @@ class SearchVolume : public QWidget public: SearchVolume(QWidget *parent = nullptr); void clean(); + void setVolumeInfo(const QString &volume); public slots: - QString getVolumeInfo(); + QString getVolumeInfo() const; private: ScraperLineEdit *volumeEdit;