Added Rs photo v2 item serialisation test, fixed subsequent bugs

Reactivated Photodialog. almost completed integration, publishing and item storage working, 
but data retrieval algorithm needs to be changed (request flags need to be translated, based on update call rather than client assumption)
fixed bug in rsgenexchange notification. 
Added LGPL notices


git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5387 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
chrisparker126 2012-08-06 21:00:38 +00:00
parent 3948234310
commit a715947046
35 changed files with 916 additions and 350 deletions

View file

@ -476,9 +476,9 @@ void PhotoAddDialog::loadAlbum(const std::string &albumId)
clearDialog();
mAlbumEdit = true;
RsTokReqOptions opts;
RsTokReqOptionsV2 opts;
uint32_t token;
std::list<RsGxsGroupId> albumIds;
std::list<RsGxsGroupId> albumIds;
albumIds.push_back(albumId);
// We need both Album and Photo Data.
@ -493,27 +493,28 @@ bool PhotoAddDialog::loadPhotoData(const uint32_t &token)
std::cerr << "PhotoAddDialog::loadPhotoData()";
std::cerr << std::endl;
bool moreData = true;
while(moreData)
{
PhotoResult res;
RsPhotoPhoto photo;
if (rsPhotoV2->getPhoto(token, res))
{
std::cerr << "PhotoDialog::addAddPhoto() AlbumId: " << photo.mMeta.mGroupId;
std::cerr << " PhotoId: " << photo.mMeta.mMsgId;
std::cerr << std::endl;
PhotoResult res;
rsPhotoV2->getPhoto(token, res);
PhotoResult::iterator mit = res.begin();
for(; mit != res.end(); mit++)
{
std::vector<RsPhotoPhoto>& photoV = mit->second;
std::vector<RsPhotoPhoto>::iterator vit = photoV.begin();
for(; vit != photoV.end(); vit++)
{
RsPhotoPhoto& photo = *vit;
PhotoItem *item = new PhotoItem(NULL, photo, mAlbumData);
ui.scrollAreaWidgetContents->addPhotoItem(item);
std::cerr << "PhotoAddDialog::loadPhotoData() AlbumId: " << photo.mMeta.mGroupId;
std::cerr << " PhotoId: " << photo.mMeta.mMsgId;
std::cerr << std::endl;
}
}
PhotoItem *item = new PhotoItem(NULL, photo, mAlbumData);
ui.scrollAreaWidgetContents->addPhotoItem(item);
}
else
{
moreData = false;
}
}
return true;
}
@ -521,32 +522,32 @@ bool PhotoAddDialog::loadAlbumData(const uint32_t &token)
{
std::cerr << "PhotoAddDialog::loadAlbumData()";
std::cerr << std::endl;
bool moreData = true;
while(moreData)
{
std::vector<RsPhotoAlbum> albums;
RsPhotoAlbum album;
if (rsPhotoV2->getAlbum(token, albums))
{
std::cerr << " PhotoAddDialog::loadAlbumData() AlbumId: " << album.mMeta.mGroupId << std::endl;
updateAlbumDetails(album);
RsTokReqOptions opts;
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
uint32_t token;
std::list<std::string> albumIds;
albumIds.push_back(album.mMeta.mGroupId);
GxsMsgReq req;
req[album.mMeta.mGroupId] = std::vector<RsGxsMessageId>();
mPhotoQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, req, 0);
}
else
{
moreData = false;
}
}
return true;
std::vector<RsPhotoAlbum> albums;
rsPhotoV2->getAlbum(token, albums);
std::vector<RsPhotoAlbum>::iterator vit = albums.begin();
GxsMsgReq req;
for(; vit != albums.end(); vit++)
{
RsPhotoAlbum& album = *vit;
std::cerr << "PhotoAddDialog::loadAlbumData() AlbumId: " << album.mMeta.mGroupId << std::endl;
//updateAlbumDetails(album);
uint32_t token;
std::list<std::string> albumIds;
albumIds.push_back(album.mMeta.mGroupId);
req[album.mMeta.mGroupId] = std::vector<RsGxsMessageId>();
}
RsTokReqOptionsV2 opts;
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
uint32_t t;
mPhotoQueue->requestMsgInfo(t, RS_TOKREQ_ANSTYPE_DATA, opts, req, 0);
return true;
}
bool PhotoAddDialog::loadCreatedAlbum(const uint32_t &token)

View file

@ -431,7 +431,7 @@ void PhotoDialog::requestAlbumList()
{
std::list<std::string> ids;
RsTokReqOptions opts;
RsTokReqOptionsV2 opts;
uint32_t token;
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, ids, 0);
}
@ -454,13 +454,12 @@ void PhotoDialog::loadAlbumList(const uint32_t &token)
{
requestPhotoList(*it);
}
}
void PhotoDialog::requestAlbumData(std::list<std::string> &ids)
{
RsTokReqOptions opts;
RsTokReqOptionsV2 opts;
uint32_t token;
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, ids, 0);
}
@ -473,25 +472,21 @@ bool PhotoDialog::loadAlbumData(const uint32_t &token)
clearAlbums();
bool moreData = true;
while(moreData)
{
RsPhotoAlbum album;
std::vector<RsPhotoAlbum> albums;
if (rsPhotoV2->getAlbum(token, albums))
{
std::cerr << " PhotoDialog::addAlbum() AlbumId: " << album.mMeta.mGroupId << std::endl;
std::vector<RsPhotoAlbum> albums;
rsPhotoV2->getAlbum(token, albums);
PhotoItem *item = new PhotoItem(this, album);
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
alayout->addWidget(item);
}
else
{
moreData = false;
}
}
std::vector<RsPhotoAlbum>::iterator vit = albums.begin();
for(; vit != albums.end(); vit++)
{
RsPhotoAlbum& album = *vit;
std::cerr << " PhotoDialog::addAlbum() AlbumId: " << album.mMeta.mGroupId << std::endl;
PhotoItem *item = new PhotoItem(this, album);
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
alayout->addWidget(item);
}
return true;
}
@ -499,10 +494,9 @@ bool PhotoDialog::loadAlbumData(const uint32_t &token)
void PhotoDialog::requestPhotoList(const std::string &albumId)
{
std::list<std::string> ids;
GxsMsgReq req;
req[albumId] = std::vector<RsGxsMessageId>();
RsTokReqOptions opts;
RsTokReqOptionsV2 opts;
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
uint32_t token;
mPhotoQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, req, 0);
@ -527,7 +521,7 @@ void PhotoDialog::loadPhotoList(const uint32_t &token)
void PhotoDialog::requestPhotoData(GxsMsgReq &photoIds)
{
RsTokReqOptions opts;
RsTokReqOptionsV2 opts;
uint32_t token;
mPhotoQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, photoIds, 0);
}
@ -538,25 +532,25 @@ void PhotoDialog::loadPhotoData(const uint32_t &token)
std::cerr << "PhotoDialog::loadPhotoData()";
std::cerr << std::endl;
bool moreData = true;
while(moreData)
{
RsPhotoPhoto photo;
PhotoResult res;
if (rsPhotoV2->getPhoto(token, res))
{
PhotoResult res;
rsPhotoV2->getPhoto(token, res);
PhotoResult::iterator mit = res.begin();
std::cerr << "PhotoDialog::loadPhotoData() AlbumId: " << photo.mMeta.mGroupId;
std::cerr << " PhotoId: " << photo.mMeta.mMsgId;
std::cerr << std::endl;
addPhoto(photo);
}
else
{
moreData = false;
}
}
for(; mit != res.end(); mit++)
{
std::vector<RsPhotoPhoto>& photoV = mit->second;
std::vector<RsPhotoPhoto>::iterator vit = photoV.begin();
for(; vit != photoV.end(); vit++)
{
RsPhotoPhoto& photo = *vit;
addPhoto(photo);
std::cerr << "PhotoDialog::loadPhotoData() AlbumId: " << photo.mMeta.mGroupId;
std::cerr << " PhotoId: " << photo.mMeta.mMsgId;
std::cerr << std::endl;
}
}
}

View file

@ -244,7 +244,7 @@ void PhotoSlideShow::loadAlbum(const std::string &albumId)
/* much like main load fns */
clearDialog();
RsTokReqOptions opts;
RsTokReqOptionsV2 opts;
uint32_t token;
std::list<std::string> albumIds;
albumIds.push_back(albumId);
@ -261,31 +261,34 @@ bool PhotoSlideShow::loadPhotoData(const uint32_t &token)
std::cerr << "PhotoSlideShow::loadPhotoData()";
std::cerr << std::endl;
bool moreData = true;
while(moreData)
{
RsPhotoPhoto photo;
PhotoResult res;
if (rsPhotoV2->getPhoto(token, res))
{
RsPhotoPhoto *ptr = new RsPhotoPhoto;
*ptr = photo;
ptr->mThumbnail.data = 0;
ptr->mThumbnail.copyFrom(photo.mThumbnail);
PhotoResult res;
rsPhotoV2->getPhoto(token, res);
PhotoResult::iterator mit = res.begin();
mPhotos[photo.mMeta.mMsgId] = ptr;
mPhotoOrder[ptr->mOrder] = photo.mMeta.mMsgId;
std::cerr << "PhotoSlideShow::addAddPhoto() AlbumId: " << photo.mMeta.mGroupId;
std::cerr << " PhotoId: " << photo.mMeta.mMsgId;
std::cerr << std::endl;
}
else
{
moreData = false;
}
}
for(; mit != res.end(); mit++)
{
std::vector<RsPhotoPhoto>& photoV = mit->second;
std::vector<RsPhotoPhoto>::iterator vit = photoV.begin();
for(; vit != photoV.end(); vit++)
{
RsPhotoPhoto& photo = *vit;
RsPhotoPhoto *ptr = new RsPhotoPhoto;
*ptr = photo;
ptr->mThumbnail.data = 0;
ptr->mThumbnail.copyFrom(photo.mThumbnail);
mPhotos[photo.mMeta.mMsgId] = ptr;
mPhotoOrder[ptr->mOrder] = photo.mMeta.mMsgId;
std::cerr << "PhotoSlideShow::addAddPhoto() AlbumId: " << photo.mMeta.mGroupId;
std::cerr << " PhotoId: " << photo.mMeta.mMsgId;
std::cerr << std::endl;
}
}
// Load and Start.
loadImage();
@ -299,30 +302,30 @@ bool PhotoSlideShow::loadAlbumData(const uint32_t &token)
std::cerr << "PhotoSlideShow::loadAlbumData()";
std::cerr << std::endl;
bool moreData = true;
while(moreData)
{
RsPhotoAlbum album;
std::vector<RsPhotoAlbum> res;
if (rsPhotoV2->getAlbum(token, res))
{
std::cerr << " PhotoSlideShow::loadAlbumData() AlbumId: " << album.mMeta.mGroupId << std::endl;
//updateAlbumDetails(album);
std::vector<RsPhotoAlbum> albums;
rsPhotoV2->getAlbum(token, albums);
RsTokReqOptions opts;
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
uint32_t token;
std::list<std::string> albumIds;
albumIds.push_back(album.mMeta.mGroupId);
GxsMsgReq req;
req[album.mMeta.mGroupId] = std::vector<RsGxsMessageId>();
mPhotoQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, req, 0);
}
else
{
moreData = false;
}
}
std::vector<RsPhotoAlbum>::iterator vit = albums.begin();
GxsMsgReq req;
for(; vit != albums.end(); vit++)
{
RsPhotoAlbum& album = *vit;
std::cerr << " PhotoSlideShow::loadAlbumData() AlbumId: " << album.mMeta.mGroupId << std::endl;
//updateAlbumDetails(album);
uint32_t token;
std::list<std::string> albumIds;
albumIds.push_back(album.mMeta.mGroupId);
req[album.mMeta.mGroupId] = std::vector<RsGxsMessageId>();
}
RsTokReqOptionsV2 opts;
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
uint32_t t;
mPhotoQueue->requestMsgInfo(t, RS_TOKREQ_ANSTYPE_DATA, opts, req, 0);
return true;
}

View file

@ -32,7 +32,7 @@
#include <retroshare/rsiface.h>
//#include "gui/PhotoShare/PhotoDialog.h"
#include "gui/PhotoShare/PhotoDialog.h"
#include "gui/WikiPoos/WikiDialog.h"
#include "gui/TheWire/WireDialog.h"
#include "gui/Identity/IdDialog.h"
@ -97,9 +97,9 @@ ApplicationWindow::ApplicationWindow(QWidget* parent, Qt::WFlags flags)
ui.stackPages->add(idDialog = new IdDialog(ui.stackPages),
createPageAction(QIcon(IMAGE_LIBRARY), tr("Identities"), grp));
//PhotoDialog *photoDialog = NULL;
//ui.stackPages->add(photoDialog = new PhotoDialog(ui.stackPages),
// createPageAction(QIcon(IMAGE_PHOTO), tr("Photo View"), grp));
PhotoDialog *photoDialog = NULL;
ui.stackPages->add(photoDialog = new PhotoDialog(ui.stackPages),
createPageAction(QIcon(IMAGE_PHOTO), tr("Photo View"), grp));
WikiDialog *wikiDialog = NULL;
ui.stackPages->add(wikiDialog = new WikiDialog(ui.stackPages),