mirror of
https://github.com/YACReader/yacreader
synced 2025-07-27 01:15:07 -04:00
getting most of the info from comic vine
This commit is contained in:
@ -29,12 +29,13 @@ void VolumeComicsModel::load(const QString & json)
|
||||
}
|
||||
else
|
||||
{
|
||||
int numResults = sc.property("number_of_total_results").toString().toInt(); //fix to weird behaviour using hasNext
|
||||
QScriptValueIterator it(sc.property("results"));
|
||||
//bool test;
|
||||
QScriptValue resultsValue;
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
if(it.flags() & QScriptValue::SkipInEnumeration)
|
||||
continue;
|
||||
resultsValue = it.value();
|
||||
QString issueNumber = resultsValue.property("issue_number").toString();
|
||||
QString name = resultsValue.property("name").toString();
|
||||
@ -42,10 +43,7 @@ void VolumeComicsModel::load(const QString & json)
|
||||
QString id = resultsValue.property("id").toString();
|
||||
QStringList l;
|
||||
l << issueNumber << name << coverURL << id;
|
||||
//test = name.isEmpty() && year.isEmpty() && numIssues.isEmpty() && url.isEmpty();
|
||||
if(numResults > 0)
|
||||
_data.push_back(l);
|
||||
numResults--;
|
||||
_data.push_back(l);
|
||||
}
|
||||
|
||||
qSort(_data.begin(),_data.end(),lessThan);
|
||||
|
@ -141,7 +141,17 @@ QModelIndex VolumesModel::index(int row, int column, const QModelIndex &parent)
|
||||
|
||||
QString VolumesModel::getVolumeId(const QModelIndex &index) const
|
||||
{
|
||||
return _data[index.row()][ID];
|
||||
return _data[index.row()][ID];
|
||||
}
|
||||
|
||||
int VolumesModel::getNumIssues(const QModelIndex &index) const
|
||||
{
|
||||
return _data[index.row()][ISSUES].toInt();
|
||||
}
|
||||
|
||||
QString VolumesModel::getPublisher(const QModelIndex &index) const
|
||||
{
|
||||
return _data[index.row()][PUBLISHER];
|
||||
}
|
||||
|
||||
QString VolumesModel::getCoverURL(const QModelIndex &index) const
|
||||
|
@ -23,6 +23,8 @@ public:
|
||||
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
|
||||
|
||||
QString getVolumeId(const QModelIndex & index) const;
|
||||
int getNumIssues(const QModelIndex & index) const;
|
||||
QString getPublisher(const QModelIndex & index) const;
|
||||
QString getCoverURL(const QModelIndex & index) const;
|
||||
|
||||
signals:
|
||||
|
Reference in New Issue
Block a user