diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-03-26 11:43:00 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-03-26 11:43:00 +0900 |
commit | e7e9330d665c1d8d2391707d27019a7f454cbcdf (patch) | |
tree | ed33b8a454bb14fcc4bc0d26d81c2d5f1618955b /jobs | |
parent | 7a2e843dde6b78aabab05811d3f481176537098e (diff) | |
download | libquotient-e7e9330d665c1d8d2391707d27019a7f454cbcdf.tar.gz libquotient-e7e9330d665c1d8d2391707d27019a7f454cbcdf.zip |
Introduce JoinStates (QFlags<JoinState>)
This required to change numeric values for JoinState enum; so anybody
who relied on them being 0-based and/or contiguous, beware.
Diffstat (limited to 'jobs')
-rw-r--r-- | jobs/syncjob.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/jobs/syncjob.cpp b/jobs/syncjob.cpp index 6b3f3acf..ed579f12 100644 --- a/jobs/syncjob.cpp +++ b/jobs/syncjob.cpp @@ -74,13 +74,14 @@ BaseJob::Status SyncData::parseJson(const QJsonDocument &data) accountData.fromJson(json); QJsonObject rooms = json.value("rooms").toObject(); - for (size_t i = 0; i < JoinStateStrings.size(); ++i) + JoinStates::Int ii = 1; // ii is used to make a JoinState value + for (size_t i = 0; i < JoinStateStrings.size(); ++i, ii <<= 1) { const auto rs = rooms.value(JoinStateStrings[i]).toObject(); // We have a Qt container on the right and an STL one on the left roomData.reserve(static_cast<size_t>(rs.size())); for(auto roomIt = rs.begin(); roomIt != rs.end(); ++roomIt) - roomData.emplace_back(roomIt.key(), JoinState(i), + roomData.emplace_back(roomIt.key(), JoinState(ii), roomIt.value().toObject()); } qCDebug(PROFILER) << "*** SyncData::parseJson(): batch with" |