mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
fixed json loading in VolumesModel
This commit is contained in:
parent
95612284ac
commit
9938167a90
@ -27,7 +27,8 @@ void VolumesModel::load(const QString &json)
|
|||||||
{
|
{
|
||||||
int numResults = sc.property("number_of_total_results").toString().toInt(); //fix to weird behaviour using hasNext
|
int numResults = sc.property("number_of_total_results").toString().toInt(); //fix to weird behaviour using hasNext
|
||||||
QScriptValueIterator it(sc.property("results"));
|
QScriptValueIterator it(sc.property("results"));
|
||||||
while (numResults > 0) {
|
bool test;
|
||||||
|
while (it.hasNext()) {
|
||||||
it.next();
|
it.next();
|
||||||
QString numIssues = it.value().property("count_of_issues").toString();
|
QString numIssues = it.value().property("count_of_issues").toString();
|
||||||
QString year = it.value().property("start_year").toString();
|
QString year = it.value().property("start_year").toString();
|
||||||
@ -36,6 +37,8 @@ void VolumesModel::load(const QString &json)
|
|||||||
QString url = it.value().property("image").property("screen_url").toString();
|
QString url = it.value().property("image").property("screen_url").toString();
|
||||||
QStringList & l = *(new QStringList);
|
QStringList & l = *(new QStringList);
|
||||||
l << name << year << numIssues << publisher << url;
|
l << name << year << numIssues << publisher << url;
|
||||||
|
test = name.isEmpty() && year.isEmpty() && numIssues.isEmpty() && url.isEmpty();
|
||||||
|
if(numResults>0 && !test)
|
||||||
_data.push_back(&l);
|
_data.push_back(&l);
|
||||||
numResults--;
|
numResults--;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user