本文整理汇总了C++中Attachment::setAlbumID方法的典型用法代码示例。如果您正苦于以下问题:C++ Attachment::setAlbumID方法的具体用法?C++ Attachment::setAlbumID怎么用?C++ Attachment::setAlbumID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Attachment
的用法示例。
在下文中一共展示了Attachment::setAlbumID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadHistory
int VKontakte::loadHistory(QString idUser) // Загрузка истории переписки //
{
if( checkAccessToken() == true )
{
QUrlQuery request("https://api.vk.com/method/messages.getHistory?access_token=" + access_token);
request.addQueryItem("user_id", idUser);
request.addQueryItem("count","50");
request.addQueryItem("version", "5.37");
QString urlString = request.toString();
QUrl url(urlString);
QByteArray answer = GET(url);
if(answer.isEmpty())
{
qDebug() << "Пустой ответ в VKonatkte::loadHistory";
return 0x000002;
}
QVariantList messageList = parse(answer).toMap().value("response").toList();
history.clear();
for(int i = 0; i < messageList.size(); i++)
{
QVariantMap message = messageList[i].toMap();
QString id = message.value("id").toString();
QString from_id = message.value("from_id").toString();
QString text_message = message.value("body").toString();
QString date = message.value("date").toString();
QString state = message.value("read_state").toString();
QList< QPair<QString, Attachment> > listAttachments;
QVariantList attachments = message.value("attachments").toList();
for(int j = 0; j < attachments.size(); j++)
{
QVariantMap attachment = attachments[j].toMap();
QString type = attachment.value("type").toString();
Attachment attach;
if(type == "photo")
{
QVariantMap photo = attachment.value("photo").toMap();
QString photo_id = photo.value("id").toString();
QString album_id = photo.value("album_id").toString();
QString owner_id = photo.value("owner_id").toString();
QString photo_75 = photo.value("photo_75").toString();
QString photo_130 = photo.value("photo_130").toString();
QString photo_1280 = photo.value("photo_1280").toString();
QString photo_width = photo.value("width").toString();
QString photo_height = photo.value("height").toString();
QString date = photo.value("date").toString();
QUrl url_photo(photo_75);
QByteArray photo_src = GET(url_photo);
QImage img = QImage::fromData(photo_src);
img.save("messages_photo/"+id+".jpg");
photo_75 = "messages_photo/"+id+".jpg";
attach.setID(photo_id);
attach.setAlbumID(album_id);
attach.setOwnerID(owner_id);
attach.setPhoto75(photo_75);
attach.setPhoto130(photo_130);
attach.setPhoto1280(photo_1280);
attach.setPhotoWidth(photo_width);
attach.setPhotoHeight(photo_height);
attach.setType(type);
}
listAttachments.append( qMakePair(type, attach) );
}
User from_user;
from_user = users[from_id];
//qDebug() << ">>>" << from_user.id() << " >:\n" << "type: "+type << "\n" <<"src: "+src << endl;
Message msg;
msg.setFrom(from_user).setText(text_message).setDate(date).setState(state).setAttachment(listAttachments);
history[ date.toInt() ] = msg;
}
}
else
{
return 0x000001;
//.........这里部分代码省略.........