mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
minor changes in ComicVineDialog
This commit is contained in:
parent
9795f514e7
commit
5ef8df423b
@ -107,9 +107,10 @@ void ComicVineDialog::goNext()
|
|||||||
{
|
{
|
||||||
showLoading();
|
showLoading();
|
||||||
comicVineClient->search(volumeSearchString);
|
comicVineClient->search(volumeSearchString);
|
||||||
|
status = AutoSearching;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = Volume;
|
mode = Volume;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -119,8 +120,8 @@ void ComicVineDialog::goNext()
|
|||||||
showLoading();
|
showLoading();
|
||||||
|
|
||||||
comicVineClient->search(title);
|
comicVineClient->search(title);
|
||||||
|
status = AutoSearching;
|
||||||
status = SingleComicInSeries;
|
mode = SingleComicInList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (content->currentWidget() == searchSingleComic) {
|
else if (content->currentWidget() == searchSingleComic) {
|
||||||
@ -147,8 +148,8 @@ void ComicVineDialog::show()
|
|||||||
showLoading();
|
showLoading();
|
||||||
|
|
||||||
comicVineClient->search(title);
|
comicVineClient->search(title);
|
||||||
|
status = AutoSearching;
|
||||||
status = SingleComic;
|
mode = SingleComic;
|
||||||
}else if(comics.length()>1)
|
}else if(comics.length()>1)
|
||||||
{
|
{
|
||||||
titleHeader->setSubTitle(tr("%1 comics selected").arg(comics.length()));
|
titleHeader->setSubTitle(tr("%1 comics selected").arg(comics.length()));
|
||||||
@ -177,29 +178,32 @@ void ComicVineDialog::debugClientResults(const QString & string)
|
|||||||
{
|
{
|
||||||
ResponseParser p;
|
ResponseParser p;
|
||||||
p.loadJSONResponse(string);
|
p.loadJSONResponse(string);
|
||||||
|
QMessageBox::information(0,"Result", QString("Number of results : %1").arg(p.getNumResults()));
|
||||||
QString debug = QString("%1 \n %2").arg(p.getNumResults()).arg(string);
|
if(p.responseError())
|
||||||
|
QMessageBox::critical(0,"Error from ComicVine", "-");
|
||||||
QMessageBox::information(0,"-Response-", debug);
|
else
|
||||||
|
|
||||||
switch(status)
|
|
||||||
{
|
{
|
||||||
case SingleComic:
|
switch(mode)
|
||||||
|
{
|
||||||
|
case SingleComic: case SingleComicInList:
|
||||||
|
if(p.getNumResults() == 0)
|
||||||
showSearchSingleComic();
|
showSearchSingleComic();
|
||||||
|
else
|
||||||
|
showSelectComic();
|
||||||
break;
|
break;
|
||||||
case Volume:
|
case Volume:
|
||||||
|
if(p.getNumResults() == 0)
|
||||||
showSearchVolume();
|
showSearchVolume();
|
||||||
break;
|
else
|
||||||
case SingleComicInSeries:
|
showSelectVolume();
|
||||||
showSearchSingleComic();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ComicVineDialog::showSeriesQuestion()
|
void ComicVineDialog::showSeriesQuestion()
|
||||||
{
|
{
|
||||||
|
status = AskingForInfo;
|
||||||
content->setCurrentWidget(seriesQuestion);
|
content->setCurrentWidget(seriesQuestion);
|
||||||
backButton->setHidden(true);
|
backButton->setHidden(true);
|
||||||
skipButton->setHidden(true);
|
skipButton->setHidden(true);
|
||||||
@ -210,6 +214,7 @@ void ComicVineDialog::showSeriesQuestion()
|
|||||||
|
|
||||||
void ComicVineDialog::showSearchSingleComic()
|
void ComicVineDialog::showSearchSingleComic()
|
||||||
{
|
{
|
||||||
|
status = AskingForInfo;
|
||||||
content->setCurrentWidget(searchSingleComic);
|
content->setCurrentWidget(searchSingleComic);
|
||||||
backButton->setHidden(true);
|
backButton->setHidden(true);
|
||||||
skipButton->setHidden(true);
|
skipButton->setHidden(true);
|
||||||
@ -220,13 +225,14 @@ void ComicVineDialog::showSearchSingleComic()
|
|||||||
|
|
||||||
void ComicVineDialog::showSearchVolume()
|
void ComicVineDialog::showSearchVolume()
|
||||||
{
|
{
|
||||||
|
status = AskingForInfo;
|
||||||
content->setCurrentWidget(searchVolume);
|
content->setCurrentWidget(searchVolume);
|
||||||
backButton->setHidden(true);
|
backButton->setHidden(true);
|
||||||
nextButton->setHidden(true);
|
nextButton->setHidden(true);
|
||||||
searchButton->setVisible(true);
|
searchButton->setVisible(true);
|
||||||
closeButton->setVisible(true);
|
closeButton->setVisible(true);
|
||||||
|
|
||||||
if (status == SingleComicInSeries)
|
if (mode == SingleComicInList)
|
||||||
skipButton->setVisible(true);
|
skipButton->setVisible(true);
|
||||||
else
|
else
|
||||||
skipButton->setHidden(true);
|
skipButton->setHidden(true);
|
||||||
@ -237,6 +243,11 @@ void ComicVineDialog::showSelectVolume()
|
|||||||
content->setCurrentWidget(selectVolume);
|
content->setCurrentWidget(selectVolume);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ComicVineDialog::showSelectComic()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void ComicVineDialog::showLoading()
|
void ComicVineDialog::showLoading()
|
||||||
{
|
{
|
||||||
content->setCurrentIndex(0);
|
content->setCurrentIndex(0);
|
||||||
@ -249,7 +260,7 @@ void ComicVineDialog::showLoading()
|
|||||||
|
|
||||||
void ComicVineDialog::search()
|
void ComicVineDialog::search()
|
||||||
{
|
{
|
||||||
switch (status) {
|
switch (mode) {
|
||||||
case Volume:
|
case Volume:
|
||||||
launchSearchVolume();
|
launchSearchVolume();
|
||||||
break;
|
break;
|
||||||
|
@ -44,17 +44,25 @@ protected slots:
|
|||||||
void launchSearchVolume();
|
void launchSearchVolume();
|
||||||
void launchSearchComic();
|
void launchSearchComic();
|
||||||
void showSelectVolume();
|
void showSelectVolume();
|
||||||
|
void showSelectComic();
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
enum ScrapperMode
|
||||||
|
{
|
||||||
|
SingleComic, //the scrapper has been opened for a single comic
|
||||||
|
Volume, //the scrapper is trying to get comics info for a whole volume
|
||||||
|
SingleComicInList //the scrapper has been opened for a list of unrelated comics
|
||||||
|
};
|
||||||
|
|
||||||
enum ScrapperStatus
|
enum ScrapperStatus
|
||||||
{
|
{
|
||||||
SingleComic,
|
AutoSearching,
|
||||||
Volume,
|
AskingForInfo,
|
||||||
SingleComicInSeries,
|
|
||||||
SelectingComic,
|
SelectingComic,
|
||||||
SelectingSeries
|
SelectingSeries
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ScrapperMode mode;
|
||||||
ScrapperStatus status;
|
ScrapperStatus status;
|
||||||
|
|
||||||
ComicVineClient * comicVineClient;
|
ComicVineClient * comicVineClient;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user