void RemoteDBMgr::getDBAsync()
{
- if (db.isEmpty()) {
+ if (db.isEmpty() && !processing) {
QSettings settings(this);
netAM.get(QNetworkRequest(QUrl(settings.value("baseUrl",
"http://mercury.wipsl.com/irwi/").toString() + "db/db.xml")));
void RemoteDBMgr::dbDownloadFinished(QNetworkReply *reply)
{
- if (reply->error() == QNetworkReply::NoError) {
+ if (processing = (reply->error() == QNetworkReply::NoError)) {
QByteArray ba = reply->readAll();
QBuffer buf(&ba);
buf.open(QIODevice::ReadOnly);
emit dbReady(&db);
}
}
+ processing = false;
}
void RemoteDBMgr::parse(QDomDocument &doc)
for (int i = 0; i < models.size(); ++i) {
QDomElement modelEl = models.at(i).toElement();
if (!modelEl.isNull()) {
- if (modelEl.hasAttribute("id")
- && modelEl.hasAttribute("name")
+ if (modelEl.hasAttribute("name")
&& modelEl.hasAttribute("rating")
&& modelEl.hasAttribute("vote_count")) {
remotes << new Remote(modelEl.attribute("name"),
- modelEl.attribute("id"),
+ mfgEl.attribute("id"),
modelEl.attribute("rating").toInt(),
modelEl.attribute("vote_count").toInt());
}