| 53 | } |
| 54 | |
| 55 | QList<UpdateInfo> UpdatesProcessor::readUpdates(uint lastReadId) |
| 56 | { |
| 57 | QList<UpdateInfo> updates; |
| 58 | |
| 59 | QXmlStreamReader xmlReader(_reply->readAll()); |
| 60 | |
| 61 | if (xmlReader.readNextStartElement()) { |
| 62 | if (xmlReader.name() == "updates") { |
| 63 | readUpdates(&updates, &xmlReader); |
| 64 | QList<UpdateInfo>::iterator it = updates.begin(); |
| 65 | while (it != updates.end()) { |
| 66 | UpdateInfo updateInfo = *it; |
| 67 | if (!updateInfo.softwareVersion.isEmpty() && !isVersionMatches(updateInfo.softwareVersion, &kCurVersion)) { |
| 68 | updates.removeAll(updateInfo); |
| 69 | } else if (updateInfo.id <= lastReadId) { |
| 70 | updates.removeAll(updateInfo); |
| 71 | } else { |
| 72 | it++; |
| 73 | } |
| 74 | } |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | return updates; |
| 79 | } |
| 80 | |
| 81 | bool UpdatesProcessor::isVersionMatches(const QString &predicate, const AppVersion *version) |
| 82 | { |
no test coverage detected