Created
May 16, 2015 15:06
-
-
Save v-kolesnikov/5949826d4300642fb7f4 to your computer and use it in GitHub Desktop.
gistmanager.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void GistManager::gistsReceive() | |
{ | |
QNetworkReply *reply = qobject_cast<QNetworkReply *>(sender()); | |
if (!reply) { | |
return; | |
} | |
QJsonParseError parser; | |
QJsonDocument jsonReply = QJsonDocument::fromJson(reply->readAll(), &parser); | |
if (parser.error != QJsonParseError::NoError) { | |
emit apiError(parser.errorString()); | |
return; | |
} | |
for (auto it : jsonReply.array()) { | |
QJsonObject jsonGist = it.toObject(); | |
m_gists << new GistItem(jsonGist); | |
} | |
emit gistsUpdated(); | |
reply->deleteLater(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment