mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-16 10:01:14 -04:00
Added cleanup code for GXS services in rsinit (services now based in GXS_phase1 folder in .retroshare/ folder
disabled msg synchronisation by default through compilation #define (use GXS_ENABLE_MSG_SYNC to enable message sync) Finally removed v2 suffix from all photo components and filenames (please edit your libretroshare.pro file accordingly) git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5883 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
da39d1de77
commit
744a78b140
20 changed files with 2202 additions and 2179 deletions
|
@ -86,6 +86,8 @@ void RsGxsNetService::syncWithPeers()
|
||||||
sendItem(grp);
|
sendItem(grp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef GXS_ENABLE_SYNC_MSGS
|
||||||
std::map<RsGxsGroupId, RsGxsGrpMetaData* > grpMeta;
|
std::map<RsGxsGroupId, RsGxsGrpMetaData* > grpMeta;
|
||||||
mDataStore->retrieveGxsGrpMetaData(grpMeta);
|
mDataStore->retrieveGxsGrpMetaData(grpMeta);
|
||||||
|
|
||||||
|
@ -123,6 +125,7 @@ void RsGxsNetService::syncWithPeers()
|
||||||
sendItem(msg);
|
sendItem(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RsGxsNetService::loadList(std::list<RsItem*>& load)
|
bool RsGxsNetService::loadList(std::list<RsItem*>& load)
|
||||||
|
|
|
@ -32,8 +32,8 @@
|
||||||
#include "rsgxsservice.h"
|
#include "rsgxsservice.h"
|
||||||
|
|
||||||
/* The Main Interface Class - for information about your Peers */
|
/* The Main Interface Class - for information about your Peers */
|
||||||
class RsPhotoV2;
|
class RsPhoto;
|
||||||
extern RsPhotoV2 *rsPhotoV2;
|
extern RsPhoto *rsPhoto;
|
||||||
|
|
||||||
/******************* NEW STUFF FOR NEW CACHE SYSTEM *********/
|
/******************* NEW STUFF FOR NEW CACHE SYSTEM *********/
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ typedef std::map<RsGxsGroupId, std::vector<RsPhotoPhoto> > PhotoResult;
|
||||||
typedef std::map<RsGxsGroupId, std::vector<RsPhotoComment> > PhotoCommentResult;
|
typedef std::map<RsGxsGroupId, std::vector<RsPhotoComment> > PhotoCommentResult;
|
||||||
typedef std::map<RsGxsGrpMsgIdPair, std::vector<RsPhotoComment> > PhotoRelatedCommentResult;
|
typedef std::map<RsGxsGrpMsgIdPair, std::vector<RsPhotoComment> > PhotoRelatedCommentResult;
|
||||||
|
|
||||||
class RsPhotoV2
|
class RsPhoto
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -186,9 +186,9 @@ public:
|
||||||
static const uint32_t FLAG_MSG_TYPE_MASK;
|
static const uint32_t FLAG_MSG_TYPE_MASK;
|
||||||
|
|
||||||
|
|
||||||
RsPhotoV2() { return; }
|
RsPhoto() { return; }
|
||||||
|
|
||||||
virtual ~RsPhotoV2() { return; }
|
virtual ~RsPhoto() { return; }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Use to enquire if groups or msgs have changed
|
* Use to enquire if groups or msgs have changed
|
|
@ -1827,7 +1827,7 @@ RsTurtle *rsTurtle = NULL ;
|
||||||
#include "services/p3idservice.h"
|
#include "services/p3idservice.h"
|
||||||
#include "services/p3wiki.h"
|
#include "services/p3wiki.h"
|
||||||
#include "services/p3posted.h"
|
#include "services/p3posted.h"
|
||||||
#include "services/p3photoserviceV2.h"
|
#include "services/p3photoservice.h"
|
||||||
#include "services/p3gxsforums.h"
|
#include "services/p3gxsforums.h"
|
||||||
|
|
||||||
// Not too many to convert now!
|
// Not too many to convert now!
|
||||||
|
@ -2278,9 +2278,28 @@ int RsServer::StartupRetroShare()
|
||||||
mPluginsManager->registerCacheServices() ;
|
mPluginsManager->registerCacheServices() ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef ENABLE_GXS_SERVICES
|
#ifdef ENABLE_GXS_SERVICES
|
||||||
|
|
||||||
|
// The idea is that if priorGxsDir is non
|
||||||
|
// empty and matches an exist directory location
|
||||||
|
// the given ssl user id then this directory is cleaned
|
||||||
|
// and deleted
|
||||||
|
std::string priorGxsDir = "./" + mLinkMgr->getOwnId() + "/", currGxsDir = RsInitConfig::configDir + "/GXS_phase1";
|
||||||
|
bool cleanUpGxsDir = false;
|
||||||
|
|
||||||
|
if(!priorGxsDir.empty())
|
||||||
|
cleanUpGxsDir = RsDirUtil::checkDirectory(priorGxsDir);
|
||||||
|
|
||||||
|
std::list<std::string> filesToKeep;
|
||||||
|
bool cleanUpSuccess = RsDirUtil::cleanupDirectory(priorGxsDir, filesToKeep);
|
||||||
|
|
||||||
|
if(!cleanUpSuccess)
|
||||||
|
std::cerr << "RsInit::StartupRetroShare() Clean up of Old Gxs Dir Failed!";
|
||||||
|
else
|
||||||
|
rmdir(priorGxsDir.c_str());
|
||||||
|
|
||||||
|
RsDirUtil::checkCreateDirectory(currGxsDir);
|
||||||
|
|
||||||
// Testing New Cache Services.
|
// Testing New Cache Services.
|
||||||
//p3WikiServiceVEG *mWikis = new p3WikiServiceVEG(RS_SERVICE_GXSV1_TYPE_WIKI);
|
//p3WikiServiceVEG *mWikis = new p3WikiServiceVEG(RS_SERVICE_GXSV1_TYPE_WIKI);
|
||||||
//pqih -> addService(mWikis);
|
//pqih -> addService(mWikis);
|
||||||
|
@ -2295,7 +2314,7 @@ int RsServer::StartupRetroShare()
|
||||||
|
|
||||||
|
|
||||||
// TODO: temporary to store GXS service data, remove
|
// TODO: temporary to store GXS service data, remove
|
||||||
RsDirUtil::checkCreateDirectory(mLinkMgr->getOwnId());
|
RsDirUtil::checkCreateDirectory(currGxsDir);
|
||||||
|
|
||||||
RsNxsNetMgr* nxsMgr = new RsNxsNetMgrImpl(mLinkMgr);
|
RsNxsNetMgr* nxsMgr = new RsNxsNetMgrImpl(mLinkMgr);
|
||||||
|
|
||||||
|
@ -2303,7 +2322,7 @@ int RsServer::StartupRetroShare()
|
||||||
|
|
||||||
p3IdService *mGxsIdService = NULL;
|
p3IdService *mGxsIdService = NULL;
|
||||||
|
|
||||||
RsGeneralDataService* gxsid_ds = new RsDataService("./" + mLinkMgr->getOwnId() + "/", "gxsid_db",
|
RsGeneralDataService* gxsid_ds = new RsDataService(currGxsDir + "/", "gxsid_db",
|
||||||
RS_SERVICE_GXSV1_TYPE_GXSID, NULL);
|
RS_SERVICE_GXSV1_TYPE_GXSID, NULL);
|
||||||
|
|
||||||
gxsid_ds->resetDataStore();
|
gxsid_ds->resetDataStore();
|
||||||
|
@ -2338,27 +2357,27 @@ int RsServer::StartupRetroShare()
|
||||||
RsGenExchange::setAuthenPolicyFlag(flag, photoAuthenPolicy,
|
RsGenExchange::setAuthenPolicyFlag(flag, photoAuthenPolicy,
|
||||||
RsGenExchange::GRP_OPTION_BITS);
|
RsGenExchange::GRP_OPTION_BITS);
|
||||||
|
|
||||||
p3PhotoServiceV2 *mPhotoV2 = NULL;
|
p3PhotoService *mPhoto = NULL;
|
||||||
|
|
||||||
|
|
||||||
RsGeneralDataService* photo_ds = new RsDataService("./" + mLinkMgr->getOwnId() + "/", "photoV2_db",
|
RsGeneralDataService* photo_ds = new RsDataService(currGxsDir + "/", "photoV2_db",
|
||||||
RS_SERVICE_GXSV1_TYPE_PHOTO, NULL);
|
RS_SERVICE_GXSV1_TYPE_PHOTO, NULL);
|
||||||
|
|
||||||
photo_ds->resetDataStore(); //TODO: remove, new service data per RS session, for testing
|
photo_ds->resetDataStore(); //TODO: remove, new service data per RS session, for testing
|
||||||
|
|
||||||
|
|
||||||
// init gxs services
|
// init gxs services
|
||||||
mPhotoV2 = new p3PhotoServiceV2(photo_ds, NULL, mGxsIdService, photoAuthenPolicy);
|
mPhoto = new p3PhotoService(photo_ds, NULL, mGxsIdService, photoAuthenPolicy);
|
||||||
|
|
||||||
// create GXS photo service
|
// create GXS photo service
|
||||||
RsGxsNetService* photo_ns = new RsGxsNetService(
|
RsGxsNetService* photo_ns = new RsGxsNetService(
|
||||||
RS_SERVICE_GXSV1_TYPE_PHOTO, photo_ds, nxsMgr, mPhotoV2);
|
RS_SERVICE_GXSV1_TYPE_PHOTO, photo_ds, nxsMgr, mPhoto);
|
||||||
|
|
||||||
/**** Posted GXS service ****/
|
/**** Posted GXS service ****/
|
||||||
|
|
||||||
p3Posted *mPosted = NULL;
|
p3Posted *mPosted = NULL;
|
||||||
|
|
||||||
RsGeneralDataService* posted_ds = new RsDataService("./" + mLinkMgr->getOwnId()+ "/", "posted_db",
|
RsGeneralDataService* posted_ds = new RsDataService(currGxsDir + "/", "posted_db",
|
||||||
RS_SERVICE_GXSV1_TYPE_POSTED);
|
RS_SERVICE_GXSV1_TYPE_POSTED);
|
||||||
|
|
||||||
posted_ds->resetDataStore(); //TODO: remove, new service data per RS session, for testing
|
posted_ds->resetDataStore(); //TODO: remove, new service data per RS session, for testing
|
||||||
|
@ -2374,7 +2393,7 @@ int RsServer::StartupRetroShare()
|
||||||
|
|
||||||
p3Wiki *mWiki = NULL;
|
p3Wiki *mWiki = NULL;
|
||||||
|
|
||||||
RsGeneralDataService* wiki_ds = new RsDataService("./" + mLinkMgr->getOwnId()+ "/", "wiki_db",
|
RsGeneralDataService* wiki_ds = new RsDataService(currGxsDir + "/", "wiki_db",
|
||||||
RS_SERVICE_GXSV1_TYPE_WIKI);
|
RS_SERVICE_GXSV1_TYPE_WIKI);
|
||||||
|
|
||||||
wiki_ds->resetDataStore(); //TODO: remove, new service data per RS session, for testing
|
wiki_ds->resetDataStore(); //TODO: remove, new service data per RS session, for testing
|
||||||
|
@ -2389,7 +2408,7 @@ int RsServer::StartupRetroShare()
|
||||||
|
|
||||||
p3GxsForums *mGxsForums = NULL;
|
p3GxsForums *mGxsForums = NULL;
|
||||||
|
|
||||||
RsGeneralDataService* gxsforums_ds = new RsDataService("./" + mLinkMgr->getOwnId()+ "/", "gxsforums_db",
|
RsGeneralDataService* gxsforums_ds = new RsDataService(currGxsDir + "/", "gxsforums_db",
|
||||||
RS_SERVICE_GXSV1_TYPE_FORUMS);
|
RS_SERVICE_GXSV1_TYPE_FORUMS);
|
||||||
|
|
||||||
gxsforums_ds->resetDataStore(); //TODO: remove, new service data per RS session, for testing
|
gxsforums_ds->resetDataStore(); //TODO: remove, new service data per RS session, for testing
|
||||||
|
@ -2411,12 +2430,12 @@ int RsServer::StartupRetroShare()
|
||||||
//mGxsCore->addService(mGxsIdService);
|
//mGxsCore->addService(mGxsIdService);
|
||||||
#if ENABLE_OTHER_GXS_SERVICES
|
#if ENABLE_OTHER_GXS_SERVICES
|
||||||
createThread(*mGxsIdService);
|
createThread(*mGxsIdService);
|
||||||
createThread(*mPhotoV2);
|
createThread(*mPhoto);
|
||||||
createThread(*mPosted);
|
createThread(*mPosted);
|
||||||
createThread(*mWiki);
|
createThread(*mWiki);
|
||||||
createThread(*mGxsForums);
|
createThread(*mGxsForums);
|
||||||
//
|
//
|
||||||
// mGxsCore->addService(mPhotoV2);
|
// mGxsCore->addService(mPhoto);
|
||||||
// mGxsCore->addService(mPosted);
|
// mGxsCore->addService(mPosted);
|
||||||
// mGxsCore->addService(mWiki);
|
// mGxsCore->addService(mWiki);
|
||||||
#endif
|
#endif
|
||||||
|
@ -2707,7 +2726,7 @@ int RsServer::StartupRetroShare()
|
||||||
#if ENABLE_OTHER_GXS_SERVICES
|
#if ENABLE_OTHER_GXS_SERVICES
|
||||||
rsWiki = mWiki;
|
rsWiki = mWiki;
|
||||||
rsPosted = mPosted;
|
rsPosted = mPosted;
|
||||||
rsPhotoV2 = mPhotoV2;
|
rsPhoto = mPhoto;
|
||||||
rsGxsForums = mGxsForums;
|
rsGxsForums = mGxsForums;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "rsphotov2items.h"
|
#include "rsphotoitems.h"
|
||||||
#include "serialiser/rstlvbase.h"
|
#include "serialiser/rstlvbase.h"
|
||||||
#include "serialiser/rsbaseserial.h"
|
#include "serialiser/rsbaseserial.h"
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
#include "serialiser/rstlvtypes.h"
|
#include "serialiser/rstlvtypes.h"
|
||||||
|
|
||||||
#include "rsgxsitems.h"
|
#include "rsgxsitems.h"
|
||||||
#include "retroshare/rsphotoV2.h"
|
#include "retroshare/rsphoto.h"
|
||||||
|
|
||||||
const uint8_t RS_PKT_SUBTYPE_PHOTO_ITEM = 0x02;
|
const uint8_t RS_PKT_SUBTYPE_PHOTO_ITEM = 0x02;
|
||||||
const uint8_t RS_PKT_SUBTYPE_PHOTO_SHOW_ITEM = 0x03;
|
const uint8_t RS_PKT_SUBTYPE_PHOTO_SHOW_ITEM = 0x03;
|
|
@ -1,388 +1,388 @@
|
||||||
#include "p3photoserviceV2.h"
|
#include "p3photoservice.h"
|
||||||
#include "serialiser/rsphotov2items.h"
|
#include "serialiser/rsphotoitems.h"
|
||||||
#include "gxs/rsgxsflags.h"
|
#include "gxs/rsgxsflags.h"
|
||||||
|
|
||||||
RsPhotoV2 *rsPhotoV2 = NULL;
|
RsPhoto *rsPhoto = NULL;
|
||||||
|
|
||||||
|
|
||||||
const uint32_t RsPhotoV2::FLAG_MSG_TYPE_MASK = 0x000f;
|
const uint32_t RsPhoto::FLAG_MSG_TYPE_MASK = 0x000f;
|
||||||
const uint32_t RsPhotoV2::FLAG_MSG_TYPE_PHOTO_POST = 0x0001;
|
const uint32_t RsPhoto::FLAG_MSG_TYPE_PHOTO_POST = 0x0001;
|
||||||
const uint32_t RsPhotoV2::FLAG_MSG_TYPE_PHOTO_COMMENT = 0x0002;
|
const uint32_t RsPhoto::FLAG_MSG_TYPE_PHOTO_COMMENT = 0x0002;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool RsPhotoThumbnail::copyFrom(const RsPhotoThumbnail &nail)
|
bool RsPhotoThumbnail::copyFrom(const RsPhotoThumbnail &nail)
|
||||||
{
|
{
|
||||||
if (data)
|
if (data)
|
||||||
{
|
{
|
||||||
deleteImage();
|
deleteImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!nail.data) || (nail.size == 0))
|
if ((!nail.data) || (nail.size == 0))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
size = nail.size;
|
size = nail.size;
|
||||||
type = nail.type;
|
type = nail.type;
|
||||||
data = (uint8_t *) malloc(size);
|
data = (uint8_t *) malloc(size);
|
||||||
memcpy(data, nail.data, size);
|
memcpy(data, nail.data, size);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RsPhotoThumbnail::deleteImage()
|
bool RsPhotoThumbnail::deleteImage()
|
||||||
{
|
{
|
||||||
if (data)
|
if (data)
|
||||||
{
|
{
|
||||||
free(data);
|
free(data);
|
||||||
data = NULL;
|
data = NULL;
|
||||||
size = 0;
|
size = 0;
|
||||||
type.clear();
|
type.clear();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
RsPhotoPhoto::RsPhotoPhoto()
|
RsPhotoPhoto::RsPhotoPhoto()
|
||||||
:mSetFlags(0), mOrder(0), mMode(0), mModFlags(0)
|
:mSetFlags(0), mOrder(0), mMode(0), mModFlags(0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RsPhotoAlbum::RsPhotoAlbum()
|
RsPhotoAlbum::RsPhotoAlbum()
|
||||||
:mMode(0), mSetFlags(0), mModFlags(0)
|
:mMode(0), mSetFlags(0), mModFlags(0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RsPhotoComment::RsPhotoComment()
|
RsPhotoComment::RsPhotoComment()
|
||||||
: mComment(""), mCommentFlag(0) {
|
: mComment(""), mCommentFlag(0) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RsPhotoComment::RsPhotoComment(const RsGxsPhotoCommentItem &comment)
|
RsPhotoComment::RsPhotoComment(const RsGxsPhotoCommentItem &comment)
|
||||||
: mComment(""), mCommentFlag(0) {
|
: mComment(""), mCommentFlag(0) {
|
||||||
|
|
||||||
*this = comment.comment;
|
*this = comment.comment;
|
||||||
(*this).mMeta = comment.meta;
|
(*this).mMeta = comment.meta;
|
||||||
|
|
||||||
}
|
}
|
||||||
std::ostream &operator<<(std::ostream &out, const RsPhotoPhoto &photo)
|
std::ostream &operator<<(std::ostream &out, const RsPhotoPhoto &photo)
|
||||||
{
|
{
|
||||||
out << "RsPhotoPhoto [ ";
|
out << "RsPhotoPhoto [ ";
|
||||||
out << "Title: " << photo.mMeta.mMsgName;
|
out << "Title: " << photo.mMeta.mMsgName;
|
||||||
out << "]";
|
out << "]";
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::ostream &operator<<(std::ostream &out, const RsPhotoAlbum &album)
|
std::ostream &operator<<(std::ostream &out, const RsPhotoAlbum &album)
|
||||||
{
|
{
|
||||||
out << "RsPhotoAlbum [ ";
|
out << "RsPhotoAlbum [ ";
|
||||||
out << "Title: " << album.mMeta.mGroupName;
|
out << "Title: " << album.mMeta.mGroupName;
|
||||||
out << "]";
|
out << "]";
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
p3PhotoServiceV2::p3PhotoServiceV2(RsGeneralDataService* gds, RsNetworkExchangeService* nes, RsGixs* gixs,
|
p3PhotoService::p3PhotoService(RsGeneralDataService* gds, RsNetworkExchangeService* nes, RsGixs* gixs,
|
||||||
uint32_t authenPolicy)
|
uint32_t authenPolicy)
|
||||||
: RsGenExchange(gds, nes, new RsGxsPhotoSerialiser(), RS_SERVICE_GXSV1_TYPE_PHOTO, gixs, authenPolicy),
|
: RsGenExchange(gds, nes, new RsGxsPhotoSerialiser(), RS_SERVICE_GXSV1_TYPE_PHOTO, gixs, authenPolicy),
|
||||||
mPhotoMutex(std::string("Photo Mutex"))
|
mPhotoMutex(std::string("Photo Mutex"))
|
||||||
{
|
{
|
||||||
|
|
||||||
// create dummy grps
|
// create dummy grps
|
||||||
|
|
||||||
RsGxsPhotoAlbumItem* item1 = new RsGxsPhotoAlbumItem(), *item2 = new RsGxsPhotoAlbumItem();
|
RsGxsPhotoAlbumItem* item1 = new RsGxsPhotoAlbumItem(), *item2 = new RsGxsPhotoAlbumItem();
|
||||||
|
|
||||||
item1->meta.mGroupName = "Dummy Album 1";
|
item1->meta.mGroupName = "Dummy Album 1";
|
||||||
item1->meta.mGroupFlags = GXS_SERV::FLAG_PRIVACY_RESTRICTED;
|
item1->meta.mGroupFlags = GXS_SERV::FLAG_PRIVACY_RESTRICTED;
|
||||||
item1->album.mCaption = "Dummy 1";
|
item1->album.mCaption = "Dummy 1";
|
||||||
item2->meta.mGroupName = "Dummy Album 2";
|
item2->meta.mGroupName = "Dummy Album 2";
|
||||||
item2->meta.mGroupFlags = GXS_SERV::FLAG_PRIVACY_RESTRICTED;
|
item2->meta.mGroupFlags = GXS_SERV::FLAG_PRIVACY_RESTRICTED;
|
||||||
item2->album.mCaption = "Dummy 2";
|
item2->album.mCaption = "Dummy 2";
|
||||||
|
|
||||||
createDummyGroup(item1);
|
createDummyGroup(item1);
|
||||||
createDummyGroup(item2);
|
createDummyGroup(item2);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3PhotoServiceV2::updated()
|
bool p3PhotoService::updated()
|
||||||
{
|
{
|
||||||
RsStackMutex stack(mPhotoMutex);
|
RsStackMutex stack(mPhotoMutex);
|
||||||
|
|
||||||
bool changed = (!mGroupChange.empty() || !mMsgChange.empty());
|
bool changed = (!mGroupChange.empty() || !mMsgChange.empty());
|
||||||
|
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void p3PhotoServiceV2::service_tick()
|
void p3PhotoService::service_tick()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void p3PhotoServiceV2::groupsChanged(std::list<RsGxsGroupId>& grpIds)
|
void p3PhotoService::groupsChanged(std::list<RsGxsGroupId>& grpIds)
|
||||||
{
|
{
|
||||||
RsStackMutex stack(mPhotoMutex);
|
RsStackMutex stack(mPhotoMutex);
|
||||||
|
|
||||||
while(!mGroupChange.empty())
|
while(!mGroupChange.empty())
|
||||||
{
|
{
|
||||||
RsGxsGroupChange* gc = mGroupChange.back();
|
RsGxsGroupChange* gc = mGroupChange.back();
|
||||||
std::list<RsGxsGroupId>& gList = gc->grpIdList;
|
std::list<RsGxsGroupId>& gList = gc->grpIdList;
|
||||||
std::list<RsGxsGroupId>::iterator lit = gList.begin();
|
std::list<RsGxsGroupId>::iterator lit = gList.begin();
|
||||||
for(; lit != gList.end(); lit++)
|
for(; lit != gList.end(); lit++)
|
||||||
grpIds.push_back(*lit);
|
grpIds.push_back(*lit);
|
||||||
|
|
||||||
mGroupChange.pop_back();
|
mGroupChange.pop_back();
|
||||||
delete gc;
|
delete gc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void p3PhotoServiceV2::msgsChanged(
|
void p3PhotoService::msgsChanged(
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >& msgs)
|
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >& msgs)
|
||||||
{
|
{
|
||||||
RsStackMutex stack(mPhotoMutex);
|
RsStackMutex stack(mPhotoMutex);
|
||||||
|
|
||||||
while(!mMsgChange.empty())
|
while(!mMsgChange.empty())
|
||||||
{
|
{
|
||||||
RsGxsMsgChange* mc = mMsgChange.back();
|
RsGxsMsgChange* mc = mMsgChange.back();
|
||||||
msgs = mc->msgChangeMap;
|
msgs = mc->msgChangeMap;
|
||||||
mMsgChange.pop_back();
|
mMsgChange.pop_back();
|
||||||
delete mc;
|
delete mc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
RsTokenService* p3PhotoServiceV2::getTokenService() {
|
RsTokenService* p3PhotoService::getTokenService() {
|
||||||
|
|
||||||
return RsGenExchange::getTokenService();
|
return RsGenExchange::getTokenService();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool p3PhotoServiceV2::getGroupList(const uint32_t& token,
|
bool p3PhotoService::getGroupList(const uint32_t& token,
|
||||||
std::list<RsGxsGroupId>& groupIds)
|
std::list<RsGxsGroupId>& groupIds)
|
||||||
{
|
{
|
||||||
return RsGenExchange::getGroupList(token, groupIds);
|
return RsGenExchange::getGroupList(token, groupIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool p3PhotoServiceV2::getMsgList(const uint32_t& token,
|
bool p3PhotoService::getMsgList(const uint32_t& token,
|
||||||
GxsMsgIdResult& msgIds)
|
GxsMsgIdResult& msgIds)
|
||||||
{
|
{
|
||||||
|
|
||||||
return RsGenExchange::getMsgList(token, msgIds);
|
return RsGenExchange::getMsgList(token, msgIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool p3PhotoServiceV2::getGroupSummary(const uint32_t& token,
|
bool p3PhotoService::getGroupSummary(const uint32_t& token,
|
||||||
std::list<RsGroupMetaData>& groupInfo)
|
std::list<RsGroupMetaData>& groupInfo)
|
||||||
{
|
{
|
||||||
return RsGenExchange::getGroupMeta(token, groupInfo);
|
return RsGenExchange::getGroupMeta(token, groupInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool p3PhotoServiceV2::getMsgSummary(const uint32_t& token,
|
bool p3PhotoService::getMsgSummary(const uint32_t& token,
|
||||||
MsgMetaResult& msgInfo)
|
MsgMetaResult& msgInfo)
|
||||||
{
|
{
|
||||||
return RsGenExchange::getMsgMeta(token, msgInfo);
|
return RsGenExchange::getMsgMeta(token, msgInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool p3PhotoServiceV2::getAlbum(const uint32_t& token, std::vector<RsPhotoAlbum>& albums)
|
bool p3PhotoService::getAlbum(const uint32_t& token, std::vector<RsPhotoAlbum>& albums)
|
||||||
{
|
{
|
||||||
std::vector<RsGxsGrpItem*> grpData;
|
std::vector<RsGxsGrpItem*> grpData;
|
||||||
bool ok = RsGenExchange::getGroupData(token, grpData);
|
bool ok = RsGenExchange::getGroupData(token, grpData);
|
||||||
|
|
||||||
if(ok)
|
if(ok)
|
||||||
{
|
{
|
||||||
std::vector<RsGxsGrpItem*>::iterator vit = grpData.begin();
|
std::vector<RsGxsGrpItem*>::iterator vit = grpData.begin();
|
||||||
|
|
||||||
for(; vit != grpData.end(); vit++)
|
for(; vit != grpData.end(); vit++)
|
||||||
{
|
{
|
||||||
RsGxsPhotoAlbumItem* item = dynamic_cast<RsGxsPhotoAlbumItem*>(*vit);
|
RsGxsPhotoAlbumItem* item = dynamic_cast<RsGxsPhotoAlbumItem*>(*vit);
|
||||||
RsPhotoAlbum album = item->album;
|
RsPhotoAlbum album = item->album;
|
||||||
item->album.mMeta = item->meta;
|
item->album.mMeta = item->meta;
|
||||||
album.mMeta = item->album.mMeta;
|
album.mMeta = item->album.mMeta;
|
||||||
delete item;
|
delete item;
|
||||||
albums.push_back(album);
|
albums.push_back(album);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool p3PhotoServiceV2::getPhoto(const uint32_t& token, PhotoResult& photos)
|
bool p3PhotoService::getPhoto(const uint32_t& token, PhotoResult& photos)
|
||||||
{
|
{
|
||||||
GxsMsgDataMap msgData;
|
GxsMsgDataMap msgData;
|
||||||
bool ok = RsGenExchange::getMsgData(token, msgData);
|
bool ok = RsGenExchange::getMsgData(token, msgData);
|
||||||
|
|
||||||
if(ok)
|
if(ok)
|
||||||
{
|
{
|
||||||
GxsMsgDataMap::iterator mit = msgData.begin();
|
GxsMsgDataMap::iterator mit = msgData.begin();
|
||||||
|
|
||||||
for(; mit != msgData.end(); mit++)
|
for(; mit != msgData.end(); mit++)
|
||||||
{
|
{
|
||||||
RsGxsGroupId grpId = mit->first;
|
RsGxsGroupId grpId = mit->first;
|
||||||
std::vector<RsGxsMsgItem*>& msgItems = mit->second;
|
std::vector<RsGxsMsgItem*>& msgItems = mit->second;
|
||||||
std::vector<RsGxsMsgItem*>::iterator vit = msgItems.begin();
|
std::vector<RsGxsMsgItem*>::iterator vit = msgItems.begin();
|
||||||
|
|
||||||
for(; vit != msgItems.end(); vit++)
|
for(; vit != msgItems.end(); vit++)
|
||||||
{
|
{
|
||||||
RsGxsPhotoPhotoItem* item = dynamic_cast<RsGxsPhotoPhotoItem*>(*vit);
|
RsGxsPhotoPhotoItem* item = dynamic_cast<RsGxsPhotoPhotoItem*>(*vit);
|
||||||
|
|
||||||
if(item)
|
if(item)
|
||||||
{
|
{
|
||||||
RsPhotoPhoto photo = item->photo;
|
RsPhotoPhoto photo = item->photo;
|
||||||
photo.mMeta = item->meta;
|
photo.mMeta = item->meta;
|
||||||
photos[grpId].push_back(photo);
|
photos[grpId].push_back(photo);
|
||||||
delete item;
|
delete item;
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
std::cerr << "Not a photo Item, deleting!" << std::endl;
|
std::cerr << "Not a photo Item, deleting!" << std::endl;
|
||||||
delete *vit;
|
delete *vit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3PhotoServiceV2::getPhotoComment(const uint32_t &token, PhotoCommentResult &comments)
|
bool p3PhotoService::getPhotoComment(const uint32_t &token, PhotoCommentResult &comments)
|
||||||
{
|
{
|
||||||
GxsMsgDataMap msgData;
|
GxsMsgDataMap msgData;
|
||||||
bool ok = RsGenExchange::getMsgData(token, msgData);
|
bool ok = RsGenExchange::getMsgData(token, msgData);
|
||||||
|
|
||||||
if(ok)
|
if(ok)
|
||||||
{
|
{
|
||||||
GxsMsgDataMap::iterator mit = msgData.begin();
|
GxsMsgDataMap::iterator mit = msgData.begin();
|
||||||
|
|
||||||
for(; mit != msgData.end(); mit++)
|
for(; mit != msgData.end(); mit++)
|
||||||
{
|
{
|
||||||
RsGxsGroupId grpId = mit->first;
|
RsGxsGroupId grpId = mit->first;
|
||||||
std::vector<RsGxsMsgItem*>& msgItems = mit->second;
|
std::vector<RsGxsMsgItem*>& msgItems = mit->second;
|
||||||
std::vector<RsGxsMsgItem*>::iterator vit = msgItems.begin();
|
std::vector<RsGxsMsgItem*>::iterator vit = msgItems.begin();
|
||||||
|
|
||||||
for(; vit != msgItems.end(); vit++)
|
for(; vit != msgItems.end(); vit++)
|
||||||
{
|
{
|
||||||
RsGxsPhotoCommentItem* item = dynamic_cast<RsGxsPhotoCommentItem*>(*vit);
|
RsGxsPhotoCommentItem* item = dynamic_cast<RsGxsPhotoCommentItem*>(*vit);
|
||||||
|
|
||||||
if(item)
|
if(item)
|
||||||
{
|
{
|
||||||
RsPhotoComment comment = item->comment;
|
RsPhotoComment comment = item->comment;
|
||||||
comment.mMeta = item->meta;
|
comment.mMeta = item->meta;
|
||||||
comments[grpId].push_back(comment);
|
comments[grpId].push_back(comment);
|
||||||
delete item;
|
delete item;
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
std::cerr << "Not a comment Item, deleting!" << std::endl;
|
std::cerr << "Not a comment Item, deleting!" << std::endl;
|
||||||
delete *vit;
|
delete *vit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
RsPhotoComment& RsPhotoComment::operator=(const RsGxsPhotoCommentItem& comment)
|
RsPhotoComment& RsPhotoComment::operator=(const RsGxsPhotoCommentItem& comment)
|
||||||
{
|
{
|
||||||
*this = comment.comment;
|
*this = comment.comment;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3PhotoServiceV2::getPhotoRelatedComment(const uint32_t &token, PhotoRelatedCommentResult &comments)
|
bool p3PhotoService::getPhotoRelatedComment(const uint32_t &token, PhotoRelatedCommentResult &comments)
|
||||||
{
|
{
|
||||||
|
|
||||||
return RsGenExchange::getMsgRelatedDataT<RsGxsPhotoCommentItem, RsPhotoComment>(token, comments);
|
return RsGenExchange::getMsgRelatedDataT<RsGxsPhotoCommentItem, RsPhotoComment>(token, comments);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3PhotoServiceV2::submitAlbumDetails(uint32_t& token, RsPhotoAlbum& album)
|
bool p3PhotoService::submitAlbumDetails(uint32_t& token, RsPhotoAlbum& album)
|
||||||
{
|
{
|
||||||
RsGxsPhotoAlbumItem* albumItem = new RsGxsPhotoAlbumItem();
|
RsGxsPhotoAlbumItem* albumItem = new RsGxsPhotoAlbumItem();
|
||||||
albumItem->album = album;
|
albumItem->album = album;
|
||||||
albumItem->meta = album.mMeta;
|
albumItem->meta = album.mMeta;
|
||||||
RsGenExchange::publishGroup(token, albumItem);
|
RsGenExchange::publishGroup(token, albumItem);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void p3PhotoServiceV2::notifyChanges(std::vector<RsGxsNotify*>& changes)
|
void p3PhotoService::notifyChanges(std::vector<RsGxsNotify*>& changes)
|
||||||
{
|
{
|
||||||
|
|
||||||
RsStackMutex stack(mPhotoMutex);
|
RsStackMutex stack(mPhotoMutex);
|
||||||
|
|
||||||
std::vector<RsGxsNotify*>::iterator vit = changes.begin();
|
std::vector<RsGxsNotify*>::iterator vit = changes.begin();
|
||||||
|
|
||||||
for(; vit != changes.end(); vit++)
|
for(; vit != changes.end(); vit++)
|
||||||
{
|
{
|
||||||
RsGxsNotify* n = *vit;
|
RsGxsNotify* n = *vit;
|
||||||
RsGxsGroupChange* gc;
|
RsGxsGroupChange* gc;
|
||||||
RsGxsMsgChange* mc;
|
RsGxsMsgChange* mc;
|
||||||
if((mc = dynamic_cast<RsGxsMsgChange*>(n)) != NULL)
|
if((mc = dynamic_cast<RsGxsMsgChange*>(n)) != NULL)
|
||||||
{
|
{
|
||||||
mMsgChange.push_back(mc);
|
mMsgChange.push_back(mc);
|
||||||
}
|
}
|
||||||
else if((gc = dynamic_cast<RsGxsGroupChange*>(n)) != NULL)
|
else if((gc = dynamic_cast<RsGxsGroupChange*>(n)) != NULL)
|
||||||
{
|
{
|
||||||
mGroupChange.push_back(gc);
|
mGroupChange.push_back(gc);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
delete n;
|
delete n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3PhotoServiceV2::submitPhoto(uint32_t& token, RsPhotoPhoto& photo)
|
bool p3PhotoService::submitPhoto(uint32_t& token, RsPhotoPhoto& photo)
|
||||||
{
|
{
|
||||||
RsGxsPhotoPhotoItem* photoItem = new RsGxsPhotoPhotoItem();
|
RsGxsPhotoPhotoItem* photoItem = new RsGxsPhotoPhotoItem();
|
||||||
photoItem->photo = photo;
|
photoItem->photo = photo;
|
||||||
photoItem->meta = photo.mMeta;
|
photoItem->meta = photo.mMeta;
|
||||||
photoItem->meta.mMsgFlags = FLAG_MSG_TYPE_PHOTO_POST;
|
photoItem->meta.mMsgFlags = FLAG_MSG_TYPE_PHOTO_POST;
|
||||||
|
|
||||||
RsGenExchange::publishMsg(token, photoItem);
|
RsGenExchange::publishMsg(token, photoItem);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3PhotoServiceV2::submitComment(uint32_t &token, RsPhotoComment &comment)
|
bool p3PhotoService::submitComment(uint32_t &token, RsPhotoComment &comment)
|
||||||
{
|
{
|
||||||
RsGxsPhotoCommentItem* commentItem = new RsGxsPhotoCommentItem();
|
RsGxsPhotoCommentItem* commentItem = new RsGxsPhotoCommentItem();
|
||||||
commentItem->comment = comment;
|
commentItem->comment = comment;
|
||||||
commentItem->meta = comment.mMeta;
|
commentItem->meta = comment.mMeta;
|
||||||
commentItem->meta.mMsgFlags = FLAG_MSG_TYPE_PHOTO_COMMENT;
|
commentItem->meta.mMsgFlags = FLAG_MSG_TYPE_PHOTO_COMMENT;
|
||||||
|
|
||||||
RsGenExchange::publishMsg(token, commentItem);
|
RsGenExchange::publishMsg(token, commentItem);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3PhotoServiceV2::acknowledgeMsg(const uint32_t& token,
|
bool p3PhotoService::acknowledgeMsg(const uint32_t& token,
|
||||||
std::pair<RsGxsGroupId, RsGxsMessageId>& msgId)
|
std::pair<RsGxsGroupId, RsGxsMessageId>& msgId)
|
||||||
{
|
{
|
||||||
return RsGenExchange::acknowledgeTokenMsg(token, msgId);
|
return RsGenExchange::acknowledgeTokenMsg(token, msgId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool p3PhotoServiceV2::acknowledgeGrp(const uint32_t& token,
|
bool p3PhotoService::acknowledgeGrp(const uint32_t& token,
|
||||||
RsGxsGroupId& grpId)
|
RsGxsGroupId& grpId)
|
||||||
{
|
{
|
||||||
return RsGenExchange::acknowledgeTokenGrp(token, grpId);
|
return RsGenExchange::acknowledgeTokenGrp(token, grpId);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3PhotoServiceV2::subscribeToAlbum(uint32_t &token, const RsGxsGroupId &grpId, bool subscribe)
|
bool p3PhotoService::subscribeToAlbum(uint32_t &token, const RsGxsGroupId &grpId, bool subscribe)
|
||||||
{
|
{
|
||||||
if(subscribe)
|
if(subscribe)
|
||||||
RsGenExchange::setGroupSubscribeFlags(token, grpId, GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED, GXS_SERV::GROUP_SUBSCRIBE_MASK);
|
RsGenExchange::setGroupSubscribeFlags(token, grpId, GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED, GXS_SERV::GROUP_SUBSCRIBE_MASK);
|
||||||
else
|
else
|
||||||
RsGenExchange::setGroupSubscribeFlags(token, grpId, 0, GXS_SERV::GROUP_SUBSCRIBE_MASK);
|
RsGenExchange::setGroupSubscribeFlags(token, grpId, 0, GXS_SERV::GROUP_SUBSCRIBE_MASK);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,148 +1,148 @@
|
||||||
#ifndef P3PHOTOSERVICEV2_H
|
#ifndef P3PHOTOSERVICEV2_H
|
||||||
#define P3PHOTOSERVICEV2_H
|
#define P3PHOTOSERVICEV2_H
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* libretroshare/src/retroshare: rsphoto.h
|
* libretroshare/src/retroshare: rsphoto.h
|
||||||
*
|
*
|
||||||
* RetroShare C++ Interface.
|
* RetroShare C++ Interface.
|
||||||
*
|
*
|
||||||
* Copyright 2008-2012 by Robert Fernie, Christopher Evi-Parker
|
* Copyright 2008-2012 by Robert Fernie, Christopher Evi-Parker
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Library General Public
|
* modify it under the terms of the GNU Library General Public
|
||||||
* License Version 2 as published by the Free Software Foundation.
|
* License Version 2 as published by the Free Software Foundation.
|
||||||
*
|
*
|
||||||
* This library is distributed in the hope that it will be useful,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Library General Public License for more details.
|
* Library General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Library General Public
|
* You should have received a copy of the GNU Library General Public
|
||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||||
* USA.
|
* USA.
|
||||||
*
|
*
|
||||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "gxs/rsgenexchange.h"
|
#include "gxs/rsgenexchange.h"
|
||||||
#include "retroshare/rsphotoV2.h"
|
#include "retroshare/rsphoto.h"
|
||||||
|
|
||||||
class p3PhotoServiceV2 : public RsPhotoV2, public RsGenExchange
|
class p3PhotoService : public RsPhoto, public RsGenExchange
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
p3PhotoServiceV2(RsGeneralDataService* gds, RsNetworkExchangeService* nes, RsGixs* gixs,
|
p3PhotoService(RsGeneralDataService* gds, RsNetworkExchangeService* nes, RsGixs* gixs,
|
||||||
uint32_t authenPolicy);
|
uint32_t authenPolicy);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @return true if a change has occured
|
* @return true if a change has occured
|
||||||
*/
|
*/
|
||||||
bool updated();
|
bool updated();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void service_tick();
|
void service_tick();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void notifyChanges(std::vector<RsGxsNotify*>& changes);
|
void notifyChanges(std::vector<RsGxsNotify*>& changes);
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** Requests **/
|
/** Requests **/
|
||||||
|
|
||||||
void groupsChanged(std::list<RsGxsGroupId>& grpIds);
|
void groupsChanged(std::list<RsGxsGroupId>& grpIds);
|
||||||
|
|
||||||
|
|
||||||
void msgsChanged(std::map<RsGxsGroupId,
|
void msgsChanged(std::map<RsGxsGroupId,
|
||||||
std::vector<RsGxsMessageId> >& msgs);
|
std::vector<RsGxsMessageId> >& msgs);
|
||||||
|
|
||||||
RsTokenService* getTokenService();
|
RsTokenService* getTokenService();
|
||||||
|
|
||||||
bool getGroupList(const uint32_t &token,
|
bool getGroupList(const uint32_t &token,
|
||||||
std::list<RsGxsGroupId> &groupIds);
|
std::list<RsGxsGroupId> &groupIds);
|
||||||
bool getMsgList(const uint32_t &token,
|
bool getMsgList(const uint32_t &token,
|
||||||
GxsMsgIdResult& msgIds);
|
GxsMsgIdResult& msgIds);
|
||||||
|
|
||||||
/* Generic Summary */
|
/* Generic Summary */
|
||||||
bool getGroupSummary(const uint32_t &token,
|
bool getGroupSummary(const uint32_t &token,
|
||||||
std::list<RsGroupMetaData> &groupInfo);
|
std::list<RsGroupMetaData> &groupInfo);
|
||||||
|
|
||||||
bool getMsgSummary(const uint32_t &token,
|
bool getMsgSummary(const uint32_t &token,
|
||||||
MsgMetaResult &msgInfo);
|
MsgMetaResult &msgInfo);
|
||||||
|
|
||||||
/* Specific Service Data */
|
/* Specific Service Data */
|
||||||
bool getAlbum(const uint32_t &token, std::vector<RsPhotoAlbum> &albums);
|
bool getAlbum(const uint32_t &token, std::vector<RsPhotoAlbum> &albums);
|
||||||
bool getPhoto(const uint32_t &token, PhotoResult &photos);
|
bool getPhoto(const uint32_t &token, PhotoResult &photos);
|
||||||
bool getPhotoComment(const uint32_t &token, PhotoCommentResult &comments);
|
bool getPhotoComment(const uint32_t &token, PhotoCommentResult &comments);
|
||||||
bool getPhotoRelatedComment(const uint32_t &token, PhotoRelatedCommentResult &comments);
|
bool getPhotoRelatedComment(const uint32_t &token, PhotoRelatedCommentResult &comments);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** Modifications **/
|
/** Modifications **/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* submits album, which returns a token that needs
|
* submits album, which returns a token that needs
|
||||||
* to be acknowledge to get album grp id
|
* to be acknowledge to get album grp id
|
||||||
* @param token token to redeem for acknowledgement
|
* @param token token to redeem for acknowledgement
|
||||||
* @param album album to be submitted
|
* @param album album to be submitted
|
||||||
*/
|
*/
|
||||||
bool submitAlbumDetails(uint32_t& token, RsPhotoAlbum &album);
|
bool submitAlbumDetails(uint32_t& token, RsPhotoAlbum &album);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* submits photo, which returns a token that needs
|
* submits photo, which returns a token that needs
|
||||||
* to be acknowledge to get photo msg-grp id pair
|
* to be acknowledge to get photo msg-grp id pair
|
||||||
* @param token token to redeem for acknowledgement
|
* @param token token to redeem for acknowledgement
|
||||||
* @param photo photo to be submitted
|
* @param photo photo to be submitted
|
||||||
*/
|
*/
|
||||||
bool submitPhoto(uint32_t& token, RsPhotoPhoto &photo);
|
bool submitPhoto(uint32_t& token, RsPhotoPhoto &photo);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* submits photo comment, which returns a token that needs
|
* submits photo comment, which returns a token that needs
|
||||||
* to be acknowledged to get photo msg-grp id pair
|
* to be acknowledged to get photo msg-grp id pair
|
||||||
* The mParentId needs to be set to an existing msg for which
|
* The mParentId needs to be set to an existing msg for which
|
||||||
* commenting is enabled
|
* commenting is enabled
|
||||||
* @param token token to redeem for acknowledgement
|
* @param token token to redeem for acknowledgement
|
||||||
* @param comment comment to be submitted
|
* @param comment comment to be submitted
|
||||||
*/
|
*/
|
||||||
bool submitComment(uint32_t& token, RsPhotoComment &photo);
|
bool submitComment(uint32_t& token, RsPhotoComment &photo);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* subscribes to group, and returns token which can be used
|
* subscribes to group, and returns token which can be used
|
||||||
* to be acknowledged to get group Id
|
* to be acknowledged to get group Id
|
||||||
* @param token token to redeem for acknowledgement
|
* @param token token to redeem for acknowledgement
|
||||||
* @param grpId the id of the group to subscribe to
|
* @param grpId the id of the group to subscribe to
|
||||||
*/
|
*/
|
||||||
bool subscribeToAlbum(uint32_t& token, const RsGxsGroupId& grpId, bool subscribe);
|
bool subscribeToAlbum(uint32_t& token, const RsGxsGroupId& grpId, bool subscribe);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* This allows the client service to acknowledge that their msgs has
|
* This allows the client service to acknowledge that their msgs has
|
||||||
* been created/modified and retrieve the create/modified msg ids
|
* been created/modified and retrieve the create/modified msg ids
|
||||||
* @param token the token related to modification/create request
|
* @param token the token related to modification/create request
|
||||||
* @param msgIds map of grpid->msgIds of message created/modified
|
* @param msgIds map of grpid->msgIds of message created/modified
|
||||||
* @return true if token exists false otherwise
|
* @return true if token exists false otherwise
|
||||||
*/
|
*/
|
||||||
bool acknowledgeMsg(const uint32_t& token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId);
|
bool acknowledgeMsg(const uint32_t& token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* This allows the client service to acknowledge that their grps has
|
* This allows the client service to acknowledge that their grps has
|
||||||
* been created/modified and retrieve the create/modified grp ids
|
* been created/modified and retrieve the create/modified grp ids
|
||||||
* @param token the token related to modification/create request
|
* @param token the token related to modification/create request
|
||||||
* @param msgIds vector of ids of groups created/modified
|
* @param msgIds vector of ids of groups created/modified
|
||||||
* @return true if token exists false otherwise
|
* @return true if token exists false otherwise
|
||||||
*/
|
*/
|
||||||
bool acknowledgeGrp(const uint32_t& token, RsGxsGroupId& grpId);
|
bool acknowledgeGrp(const uint32_t& token, RsGxsGroupId& grpId);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
std::vector<RsGxsGroupChange*> mGroupChange;
|
std::vector<RsGxsGroupChange*> mGroupChange;
|
||||||
std::vector<RsGxsMsgChange*> mMsgChange;
|
std::vector<RsGxsMsgChange*> mMsgChange;
|
||||||
|
|
||||||
RsMutex mPhotoMutex;
|
RsMutex mPhotoMutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // P3PHOTOSERVICEV2_H
|
#endif // P3PHOTOSERVICEV2_H
|
|
@ -1,190 +1,190 @@
|
||||||
#include <QBuffer>
|
#include <QBuffer>
|
||||||
|
|
||||||
#include "AlbumCreateDialog.h"
|
#include "AlbumCreateDialog.h"
|
||||||
#include "ui_AlbumCreateDialog.h"
|
#include "ui_AlbumCreateDialog.h"
|
||||||
|
|
||||||
#include "util/misc.h"
|
#include "util/misc.h"
|
||||||
#include "gxs/rsgxsflags.h"
|
#include "gxs/rsgxsflags.h"
|
||||||
|
|
||||||
AlbumCreateDialog::AlbumCreateDialog(TokenQueue *photoQueue, RsPhotoV2 *rs_photo, QWidget *parent):
|
AlbumCreateDialog::AlbumCreateDialog(TokenQueue *photoQueue, RsPhoto *rs_photo, QWidget *parent):
|
||||||
QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint),
|
QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint),
|
||||||
ui(new Ui::AlbumCreateDialog), mPhotoQueue(photoQueue), mRsPhoto(rs_photo), mPhotoSelected(NULL)
|
ui(new Ui::AlbumCreateDialog), mPhotoQueue(photoQueue), mRsPhoto(rs_photo), mPhotoSelected(NULL)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
ui->headerFrame->setHeaderImage(QPixmap(":/images/album_create_64.png"));
|
ui->headerFrame->setHeaderImage(QPixmap(":/images/album_create_64.png"));
|
||||||
ui->headerFrame->setHeaderText(tr("Create Album"));
|
ui->headerFrame->setHeaderText(tr("Create Album"));
|
||||||
|
|
||||||
|
|
||||||
#if QT_VERSION >= 0x040700
|
#if QT_VERSION >= 0x040700
|
||||||
ui->lineEdit_Title_2->setPlaceholderText(tr("Untitle Album"));
|
ui->lineEdit_Title_2->setPlaceholderText(tr("Untitle Album"));
|
||||||
ui->lineEdit_Caption_2->setPlaceholderText(tr("Say something about this album..."));
|
ui->lineEdit_Caption_2->setPlaceholderText(tr("Say something about this album..."));
|
||||||
//ui->textEdit_Description->setPlaceholderText(tr("Say something about this album...")) ;
|
//ui->textEdit_Description->setPlaceholderText(tr("Say something about this album...")) ;
|
||||||
ui->lineEdit_Where->setPlaceholderText(tr("Where were this taken?"));
|
ui->lineEdit_Where->setPlaceholderText(tr("Where were this taken?"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ui->backButton->hide();
|
ui->backButton->hide();
|
||||||
|
|
||||||
connect(ui->publishButton, SIGNAL(clicked()), this, SLOT(publishAlbum()));
|
connect(ui->publishButton, SIGNAL(clicked()), this, SLOT(publishAlbum()));
|
||||||
connect(ui->AlbumThumbNail, SIGNAL(clicked()), this, SLOT(addAlbumThumbnail()));
|
connect(ui->AlbumThumbNail, SIGNAL(clicked()), this, SLOT(addAlbumThumbnail()));
|
||||||
|
|
||||||
connect(ui->addphotosButton, SIGNAL(clicked()),this, SLOT(changePage()));
|
connect(ui->addphotosButton, SIGNAL(clicked()),this, SLOT(changePage()));
|
||||||
connect(ui->backButton, SIGNAL(clicked()),this, SLOT(backPage()));
|
connect(ui->backButton, SIGNAL(clicked()),this, SLOT(backPage()));
|
||||||
|
|
||||||
|
|
||||||
mPhotoDrop = ui->scrollAreaWidgetContents;
|
mPhotoDrop = ui->scrollAreaWidgetContents;
|
||||||
mPhotoDrop->setPhotoItemHolder(this);
|
mPhotoDrop->setPhotoItemHolder(this);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AlbumCreateDialog::~AlbumCreateDialog()
|
AlbumCreateDialog::~AlbumCreateDialog()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PUBLIC_INDEX 0
|
#define PUBLIC_INDEX 0
|
||||||
#define RESTRICTED_INDEX 1
|
#define RESTRICTED_INDEX 1
|
||||||
#define PRIVATE_INDEX 2
|
#define PRIVATE_INDEX 2
|
||||||
|
|
||||||
void AlbumCreateDialog::publishAlbum()
|
void AlbumCreateDialog::publishAlbum()
|
||||||
{
|
{
|
||||||
// get fields for album to publish, publish and then exit dialog
|
// get fields for album to publish, publish and then exit dialog
|
||||||
RsPhotoAlbum album;
|
RsPhotoAlbum album;
|
||||||
|
|
||||||
album.mCaption = ui->lineEdit_Caption_2->text().toStdString();
|
album.mCaption = ui->lineEdit_Caption_2->text().toStdString();
|
||||||
album.mPhotographer = ui->lineEdit_Photographer->text().toStdString();
|
album.mPhotographer = ui->lineEdit_Photographer->text().toStdString();
|
||||||
album.mMeta.mGroupName = ui->lineEdit_Title_2->text().toStdString();
|
album.mMeta.mGroupName = ui->lineEdit_Title_2->text().toStdString();
|
||||||
album.mDescription = ui->textEdit_Description->toPlainText().toStdString();
|
album.mDescription = ui->textEdit_Description->toPlainText().toStdString();
|
||||||
album.mWhere = ui->lineEdit_Where->text().toStdString();
|
album.mWhere = ui->lineEdit_Where->text().toStdString();
|
||||||
album.mPhotographer = ui->lineEdit_Photographer->text().toStdString();
|
album.mPhotographer = ui->lineEdit_Photographer->text().toStdString();
|
||||||
getAlbumThumbnail(album.mThumbnail);
|
getAlbumThumbnail(album.mThumbnail);
|
||||||
|
|
||||||
|
|
||||||
int currIndex = ui->privacyComboBox->currentIndex();
|
int currIndex = ui->privacyComboBox->currentIndex();
|
||||||
|
|
||||||
switch(currIndex)
|
switch(currIndex)
|
||||||
{
|
{
|
||||||
case PUBLIC_INDEX:
|
case PUBLIC_INDEX:
|
||||||
album.mMeta.mGroupFlags |= GXS_SERV::FLAG_PRIVACY_PUBLIC;
|
album.mMeta.mGroupFlags |= GXS_SERV::FLAG_PRIVACY_PUBLIC;
|
||||||
break;
|
break;
|
||||||
case RESTRICTED_INDEX:
|
case RESTRICTED_INDEX:
|
||||||
album.mMeta.mGroupFlags |= GXS_SERV::FLAG_PRIVACY_RESTRICTED;
|
album.mMeta.mGroupFlags |= GXS_SERV::FLAG_PRIVACY_RESTRICTED;
|
||||||
break;
|
break;
|
||||||
case PRIVATE_INDEX:
|
case PRIVATE_INDEX:
|
||||||
album.mMeta.mGroupFlags |= GXS_SERV::FLAG_PRIVACY_PRIVATE;
|
album.mMeta.mGroupFlags |= GXS_SERV::FLAG_PRIVACY_PRIVATE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
mRsPhoto->submitAlbumDetails(token, album);
|
mRsPhoto->submitAlbumDetails(token, album);
|
||||||
mPhotoQueue->queueRequest(token, TOKENREQ_GROUPINFO, RS_TOKREQ_ANSTYPE_ACK, 0);
|
mPhotoQueue->queueRequest(token, TOKENREQ_GROUPINFO, RS_TOKREQ_ANSTYPE_ACK, 0);
|
||||||
|
|
||||||
publishPhotos();
|
publishPhotos();
|
||||||
|
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlbumCreateDialog::publishPhotos()
|
void AlbumCreateDialog::publishPhotos()
|
||||||
{
|
{
|
||||||
// get fields for album to publish, publish and then exit dialog
|
// get fields for album to publish, publish and then exit dialog
|
||||||
RsPhotoAlbum album;
|
RsPhotoAlbum album;
|
||||||
|
|
||||||
QSet<PhotoItem*> photos;
|
QSet<PhotoItem*> photos;
|
||||||
|
|
||||||
mPhotoDrop->getPhotos(photos);
|
mPhotoDrop->getPhotos(photos);
|
||||||
|
|
||||||
QSetIterator<PhotoItem*> sit(photos);
|
QSetIterator<PhotoItem*> sit(photos);
|
||||||
|
|
||||||
while(sit.hasNext())
|
while(sit.hasNext())
|
||||||
{
|
{
|
||||||
PhotoItem* item = sit.next();
|
PhotoItem* item = sit.next();
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
RsPhotoPhoto photo = item->getPhotoDetails();
|
RsPhotoPhoto photo = item->getPhotoDetails();
|
||||||
photo.mMeta.mGroupId = album.mMeta.mGroupId;
|
photo.mMeta.mGroupId = album.mMeta.mGroupId;
|
||||||
mRsPhoto->submitPhoto(token, photo);
|
mRsPhoto->submitPhoto(token, photo);
|
||||||
mPhotoQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, 0);
|
mPhotoQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AlbumCreateDialog::getAlbumThumbnail(RsPhotoThumbnail &nail)
|
bool AlbumCreateDialog::getAlbumThumbnail(RsPhotoThumbnail &nail)
|
||||||
{
|
{
|
||||||
const QPixmap *tmppix = &mThumbNail;
|
const QPixmap *tmppix = &mThumbNail;
|
||||||
|
|
||||||
QByteArray ba;
|
QByteArray ba;
|
||||||
QBuffer buffer(&ba);
|
QBuffer buffer(&ba);
|
||||||
|
|
||||||
if(!tmppix->isNull())
|
if(!tmppix->isNull())
|
||||||
{
|
{
|
||||||
// send chan image
|
// send chan image
|
||||||
|
|
||||||
buffer.open(QIODevice::WriteOnly);
|
buffer.open(QIODevice::WriteOnly);
|
||||||
tmppix->save(&buffer, "PNG"); // writes image into ba in PNG format
|
tmppix->save(&buffer, "PNG"); // writes image into ba in PNG format
|
||||||
|
|
||||||
RsPhotoThumbnail tmpnail;
|
RsPhotoThumbnail tmpnail;
|
||||||
tmpnail.data = (uint8_t *) ba.data();
|
tmpnail.data = (uint8_t *) ba.data();
|
||||||
tmpnail.size = ba.size();
|
tmpnail.size = ba.size();
|
||||||
|
|
||||||
nail.copyFrom(tmpnail);
|
nail.copyFrom(tmpnail);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
nail.data = NULL;
|
nail.data = NULL;
|
||||||
nail.size = 0;
|
nail.size = 0;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlbumCreateDialog::addAlbumThumbnail()
|
void AlbumCreateDialog::addAlbumThumbnail()
|
||||||
{
|
{
|
||||||
QPixmap img = misc::getOpenThumbnailedPicture(this, tr("Load Album Thumbnail"), 128, 128);
|
QPixmap img = misc::getOpenThumbnailedPicture(this, tr("Load Album Thumbnail"), 128, 128);
|
||||||
|
|
||||||
if (img.isNull())
|
if (img.isNull())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mThumbNail = img;
|
mThumbNail = img;
|
||||||
|
|
||||||
// to show the selected
|
// to show the selected
|
||||||
ui->AlbumThumbNail->setIcon(mThumbNail);
|
ui->AlbumThumbNail->setIcon(mThumbNail);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlbumCreateDialog::changePage()
|
void AlbumCreateDialog::changePage()
|
||||||
{
|
{
|
||||||
int nextPage = ui->stackedWidget->currentIndex() + 1;
|
int nextPage = ui->stackedWidget->currentIndex() + 1;
|
||||||
if (nextPage >= ui->stackedWidget->count())
|
if (nextPage >= ui->stackedWidget->count())
|
||||||
nextPage = 0;
|
nextPage = 0;
|
||||||
ui->stackedWidget->setCurrentIndex(nextPage);
|
ui->stackedWidget->setCurrentIndex(nextPage);
|
||||||
|
|
||||||
ui->backButton->show();
|
ui->backButton->show();
|
||||||
ui->addphotosButton->hide();
|
ui->addphotosButton->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlbumCreateDialog::backPage()
|
void AlbumCreateDialog::backPage()
|
||||||
{
|
{
|
||||||
int nextPage = ui->stackedWidget->currentIndex() - 1;
|
int nextPage = ui->stackedWidget->currentIndex() - 1;
|
||||||
if (nextPage >= ui->stackedWidget->count())
|
if (nextPage >= ui->stackedWidget->count())
|
||||||
nextPage = 0;
|
nextPage = 0;
|
||||||
ui->stackedWidget->setCurrentIndex(nextPage);
|
ui->stackedWidget->setCurrentIndex(nextPage);
|
||||||
|
|
||||||
ui->backButton->hide();
|
ui->backButton->hide();
|
||||||
ui->addphotosButton->show();
|
ui->addphotosButton->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlbumCreateDialog::notifySelection(PhotoShareItem *selection)
|
void AlbumCreateDialog::notifySelection(PhotoShareItem *selection)
|
||||||
{
|
{
|
||||||
|
|
||||||
PhotoItem* pItem = dynamic_cast<PhotoItem*>(selection);
|
PhotoItem* pItem = dynamic_cast<PhotoItem*>(selection);
|
||||||
|
|
||||||
if(mPhotoSelected == NULL)
|
if(mPhotoSelected == NULL)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mPhotoSelected->setSelected(false);
|
mPhotoSelected->setSelected(false);
|
||||||
mPhotoSelected = pItem;
|
mPhotoSelected = pItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
mPhotoSelected->setSelected(true);
|
mPhotoSelected->setSelected(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,50 +1,51 @@
|
||||||
#ifndef ALBUMCREATEDIALOG_H
|
#ifndef ALBUMCREATEDIALOG_H
|
||||||
#define ALBUMCREATEDIALOG_H
|
#define ALBUMCREATEDIALOG_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include "util/TokenQueue.h"
|
#include "util/TokenQueue.h"
|
||||||
#include "retroshare/rsphotoV2.h"
|
#include "retroshare/rsphoto.h"
|
||||||
#include "PhotoShareItemHolder.h"
|
#include "retroshare/rsphoto.h"
|
||||||
#include "PhotoItem.h"
|
#include "PhotoShareItemHolder.h"
|
||||||
#include "PhotoDrop.h"
|
#include "PhotoItem.h"
|
||||||
|
#include "PhotoDrop.h"
|
||||||
namespace Ui {
|
|
||||||
class AlbumCreateDialog;
|
namespace Ui {
|
||||||
}
|
class AlbumCreateDialog;
|
||||||
|
}
|
||||||
|
|
||||||
class AlbumCreateDialog : public QDialog, public PhotoShareItemHolder
|
|
||||||
{
|
class AlbumCreateDialog : public QDialog, public PhotoShareItemHolder
|
||||||
Q_OBJECT
|
{
|
||||||
|
Q_OBJECT
|
||||||
public:
|
|
||||||
explicit AlbumCreateDialog(TokenQueue* photoQueue, RsPhotoV2* rs_photo, QWidget *parent = 0);
|
public:
|
||||||
~AlbumCreateDialog();
|
explicit AlbumCreateDialog(TokenQueue* photoQueue, RsPhoto* rs_photo, QWidget *parent = 0);
|
||||||
|
~AlbumCreateDialog();
|
||||||
void notifySelection(PhotoShareItem* selection);
|
|
||||||
|
void notifySelection(PhotoShareItem* selection);
|
||||||
|
|
||||||
private slots:
|
|
||||||
void publishAlbum();
|
private slots:
|
||||||
void publishPhotos();
|
void publishAlbum();
|
||||||
void addAlbumThumbnail();
|
void publishPhotos();
|
||||||
void changePage();
|
void addAlbumThumbnail();
|
||||||
void backPage();
|
void changePage();
|
||||||
|
void backPage();
|
||||||
|
|
||||||
private:
|
|
||||||
|
private:
|
||||||
bool getAlbumThumbnail(RsPhotoThumbnail &nail);
|
|
||||||
private:
|
bool getAlbumThumbnail(RsPhotoThumbnail &nail);
|
||||||
Ui::AlbumCreateDialog *ui;
|
private:
|
||||||
|
Ui::AlbumCreateDialog *ui;
|
||||||
TokenQueue* mPhotoQueue;
|
|
||||||
RsPhotoV2* mRsPhoto;
|
TokenQueue* mPhotoQueue;
|
||||||
QPixmap mThumbNail;
|
RsPhoto* mRsPhoto;
|
||||||
PhotoDrop* mPhotoDrop;
|
QPixmap mThumbNail;
|
||||||
PhotoItem* mPhotoSelected;
|
PhotoDrop* mPhotoDrop;
|
||||||
};
|
PhotoItem* mPhotoSelected;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // ALBUMCREATEDIALOG_H
|
|
||||||
|
#endif // ALBUMCREATEDIALOG_H
|
||||||
|
|
|
@ -1,112 +1,112 @@
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
|
|
||||||
#include "AlbumDialog.h"
|
#include "AlbumDialog.h"
|
||||||
#include "ui_AlbumDialog.h"
|
#include "ui_AlbumDialog.h"
|
||||||
#include "gxs/rsgxsflags.h"
|
#include "gxs/rsgxsflags.h"
|
||||||
|
|
||||||
AlbumDialog::AlbumDialog(const RsPhotoAlbum& album, TokenQueue* photoQueue, RsPhotoV2* rs_Photo, QWidget *parent) :
|
AlbumDialog::AlbumDialog(const RsPhotoAlbum& album, TokenQueue* photoQueue, RsPhoto* rs_Photo, QWidget *parent) :
|
||||||
QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint),
|
QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint),
|
||||||
ui(new Ui::AlbumDialog), mRsPhoto(rs_Photo), mPhotoQueue(photoQueue), mAlbum(album), mPhotoSelected(NULL)
|
ui(new Ui::AlbumDialog), mRsPhoto(rs_Photo), mPhotoQueue(photoQueue), mAlbum(album), mPhotoSelected(NULL)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
ui->headerFrame->setHeaderImage(QPixmap(":/images/kview_64.png"));
|
ui->headerFrame->setHeaderImage(QPixmap(":/images/kview_64.png"));
|
||||||
ui->headerFrame->setHeaderText(tr("Album"));
|
ui->headerFrame->setHeaderText(tr("Album"));
|
||||||
|
|
||||||
connect(ui->pushButton_PublishPhotos, SIGNAL(clicked()), this, SLOT(updateAlbumPhotos()));
|
connect(ui->pushButton_PublishPhotos, SIGNAL(clicked()), this, SLOT(updateAlbumPhotos()));
|
||||||
connect(ui->pushButton_DeletePhoto, SIGNAL(clicked()), this, SLOT(deletePhoto()));
|
connect(ui->pushButton_DeletePhoto, SIGNAL(clicked()), this, SLOT(deletePhoto()));
|
||||||
|
|
||||||
mPhotoDrop = ui->scrollAreaWidgetContents;
|
mPhotoDrop = ui->scrollAreaWidgetContents;
|
||||||
|
|
||||||
if(!(mAlbum.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN))
|
if(!(mAlbum.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN))
|
||||||
{
|
{
|
||||||
ui->scrollAreaPhotos->setEnabled(false);
|
ui->scrollAreaPhotos->setEnabled(false);
|
||||||
ui->pushButton_DeletePhoto->setEnabled(false);
|
ui->pushButton_DeletePhoto->setEnabled(false);
|
||||||
}
|
}
|
||||||
mPhotoDrop->setPhotoItemHolder(this);
|
mPhotoDrop->setPhotoItemHolder(this);
|
||||||
|
|
||||||
setUp();
|
setUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AlbumDialog::setUp()
|
void AlbumDialog::setUp()
|
||||||
{
|
{
|
||||||
ui->lineEdit_Title->setText(QString::fromStdString(mAlbum.mMeta.mGroupName));
|
ui->lineEdit_Title->setText(QString::fromStdString(mAlbum.mMeta.mGroupName));
|
||||||
ui->lineEdit_Caption->setText(QString::fromStdString(mAlbum.mCaption));
|
ui->lineEdit_Caption->setText(QString::fromStdString(mAlbum.mCaption));
|
||||||
ui->lineEdit_Category->setText(QString::fromStdString(mAlbum.mCategory));
|
ui->lineEdit_Category->setText(QString::fromStdString(mAlbum.mCategory));
|
||||||
ui->lineEdit_Identity->setText(QString::fromStdString(mAlbum.mMeta.mAuthorId));
|
ui->lineEdit_Identity->setText(QString::fromStdString(mAlbum.mMeta.mAuthorId));
|
||||||
ui->lineEdit_Where->setText(QString::fromStdString(mAlbum.mWhere));
|
ui->lineEdit_Where->setText(QString::fromStdString(mAlbum.mWhere));
|
||||||
ui->textEdit_description->setText(QString::fromStdString(mAlbum.mDescription));
|
ui->textEdit_description->setText(QString::fromStdString(mAlbum.mDescription));
|
||||||
|
|
||||||
|
|
||||||
QPixmap qtn;
|
QPixmap qtn;
|
||||||
qtn.loadFromData(mAlbum.mThumbnail.data, mAlbum.mThumbnail.size, mAlbum.mThumbnail.type.c_str());
|
qtn.loadFromData(mAlbum.mThumbnail.data, mAlbum.mThumbnail.size, mAlbum.mThumbnail.type.c_str());
|
||||||
|
|
||||||
if(mAlbum.mThumbnail.size != 0)
|
if(mAlbum.mThumbnail.size != 0)
|
||||||
{
|
{
|
||||||
ui->label_thumbNail->setPixmap(qtn);
|
ui->label_thumbNail->setPixmap(qtn);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// display a default Album icon when album has no Thumbnail
|
// display a default Album icon when album has no Thumbnail
|
||||||
ui->label_thumbNail->setPixmap(QPixmap(":/images/album_default_128.png"));
|
ui->label_thumbNail->setPixmap(QPixmap(":/images/album_default_128.png"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlbumDialog::updateAlbumPhotos(){
|
void AlbumDialog::updateAlbumPhotos(){
|
||||||
|
|
||||||
QSet<PhotoItem*> photos;
|
QSet<PhotoItem*> photos;
|
||||||
|
|
||||||
mPhotoDrop->getPhotos(photos);
|
mPhotoDrop->getPhotos(photos);
|
||||||
|
|
||||||
QSetIterator<PhotoItem*> sit(photos);
|
QSetIterator<PhotoItem*> sit(photos);
|
||||||
|
|
||||||
while(sit.hasNext())
|
while(sit.hasNext())
|
||||||
{
|
{
|
||||||
PhotoItem* item = sit.next();
|
PhotoItem* item = sit.next();
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
RsPhotoPhoto photo = item->getPhotoDetails();
|
RsPhotoPhoto photo = item->getPhotoDetails();
|
||||||
photo.mMeta.mGroupId = mAlbum.mMeta.mGroupId;
|
photo.mMeta.mGroupId = mAlbum.mMeta.mGroupId;
|
||||||
mRsPhoto->submitPhoto(token, photo);
|
mRsPhoto->submitPhoto(token, photo);
|
||||||
mPhotoQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, 0);
|
mPhotoQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, 0);
|
||||||
}
|
}
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlbumDialog::deletePhoto(){
|
void AlbumDialog::deletePhoto(){
|
||||||
|
|
||||||
if(mPhotoSelected)
|
if(mPhotoSelected)
|
||||||
{
|
{
|
||||||
mPhotoSelected->setSelected(false);
|
mPhotoSelected->setSelected(false);
|
||||||
mPhotoDrop->deletePhoto(mPhotoSelected);
|
mPhotoDrop->deletePhoto(mPhotoSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlbumDialog::editPhoto()
|
void AlbumDialog::editPhoto()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AlbumDialog::~AlbumDialog()
|
AlbumDialog::~AlbumDialog()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlbumDialog::notifySelection(PhotoShareItem *selection)
|
void AlbumDialog::notifySelection(PhotoShareItem *selection)
|
||||||
{
|
{
|
||||||
|
|
||||||
PhotoItem* pItem = dynamic_cast<PhotoItem*>(selection);
|
PhotoItem* pItem = dynamic_cast<PhotoItem*>(selection);
|
||||||
|
|
||||||
if(mPhotoSelected == NULL)
|
if(mPhotoSelected == NULL)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mPhotoSelected->setSelected(false);
|
mPhotoSelected->setSelected(false);
|
||||||
mPhotoSelected = pItem;
|
mPhotoSelected = pItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
mPhotoSelected->setSelected(true);
|
mPhotoSelected->setSelected(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,43 +1,43 @@
|
||||||
#ifndef ALBUMDIALOG_H
|
#ifndef ALBUMDIALOG_H
|
||||||
#define ALBUMDIALOG_H
|
#define ALBUMDIALOG_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include "retroshare/rsphotoV2.h"
|
#include "retroshare/rsphoto.h"
|
||||||
#include "util/TokenQueue.h"
|
#include "util/TokenQueue.h"
|
||||||
#include "PhotoShareItemHolder.h"
|
#include "PhotoShareItemHolder.h"
|
||||||
#include "PhotoItem.h"
|
#include "PhotoItem.h"
|
||||||
#include "PhotoDrop.h"
|
#include "PhotoDrop.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class AlbumDialog;
|
class AlbumDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
class AlbumDialog : public QDialog, public PhotoShareItemHolder
|
class AlbumDialog : public QDialog, public PhotoShareItemHolder
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AlbumDialog(const RsPhotoAlbum& album, TokenQueue* photoQueue, RsPhotoV2* rs_Photo, QWidget *parent = 0);
|
explicit AlbumDialog(const RsPhotoAlbum& album, TokenQueue* photoQueue, RsPhoto* rs_Photo, QWidget *parent = 0);
|
||||||
~AlbumDialog();
|
~AlbumDialog();
|
||||||
|
|
||||||
void notifySelection(PhotoShareItem* selection);
|
void notifySelection(PhotoShareItem* selection);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void setUp();
|
void setUp();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void updateAlbumPhotos();
|
void updateAlbumPhotos();
|
||||||
void deletePhoto();
|
void deletePhoto();
|
||||||
void editPhoto();
|
void editPhoto();
|
||||||
private:
|
private:
|
||||||
Ui::AlbumDialog *ui;
|
Ui::AlbumDialog *ui;
|
||||||
RsPhotoV2* mRsPhoto;
|
RsPhoto* mRsPhoto;
|
||||||
TokenQueue* mPhotoQueue;
|
TokenQueue* mPhotoQueue;
|
||||||
RsPhotoAlbum mAlbum;
|
RsPhotoAlbum mAlbum;
|
||||||
PhotoDrop* mPhotoDrop;
|
PhotoDrop* mPhotoDrop;
|
||||||
PhotoItem* mPhotoSelected;
|
PhotoItem* mPhotoSelected;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ALBUMDIALOG_H
|
#endif // ALBUMDIALOG_H
|
||||||
|
|
|
@ -1,38 +1,38 @@
|
||||||
#ifndef ALBUMITEM_H
|
#ifndef ALBUMITEM_H
|
||||||
#define ALBUMITEM_H
|
#define ALBUMITEM_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
#include "retroshare/rsphotoV2.h"
|
#include "retroshare/rsphoto.h"
|
||||||
#include "PhotoShareItemHolder.h"
|
#include "PhotoShareItemHolder.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class AlbumItem;
|
class AlbumItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
class AlbumItem : public QWidget, public PhotoShareItem
|
class AlbumItem : public QWidget, public PhotoShareItem
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AlbumItem(const RsPhotoAlbum& album, PhotoShareItemHolder* albumHolder, QWidget *parent = 0);
|
explicit AlbumItem(const RsPhotoAlbum& album, PhotoShareItemHolder* albumHolder, QWidget *parent = 0);
|
||||||
virtual ~AlbumItem();
|
virtual ~AlbumItem();
|
||||||
|
|
||||||
const RsPhotoAlbum& getAlbum();
|
const RsPhotoAlbum& getAlbum();
|
||||||
|
|
||||||
bool isSelected() { return mSelected ;}
|
bool isSelected() { return mSelected ;}
|
||||||
void setSelected(bool selected);
|
void setSelected(bool selected);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void mousePressEvent(QMouseEvent *event);
|
void mousePressEvent(QMouseEvent *event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setUp();
|
void setUp();
|
||||||
private:
|
private:
|
||||||
Ui::AlbumItem *ui;
|
Ui::AlbumItem *ui;
|
||||||
RsPhotoAlbum mAlbum;
|
RsPhotoAlbum mAlbum;
|
||||||
PhotoShareItemHolder* mAlbumHolder;
|
PhotoShareItemHolder* mAlbumHolder;
|
||||||
bool mSelected;
|
bool mSelected;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ALBUMITEM_H
|
#endif // ALBUMITEM_H
|
||||||
|
|
|
@ -1,29 +1,29 @@
|
||||||
#ifndef PHOTOCOMMENTITEM_H
|
#ifndef PHOTOCOMMENTITEM_H
|
||||||
#define PHOTOCOMMENTITEM_H
|
#define PHOTOCOMMENTITEM_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include "retroshare/rsphotoV2.h"
|
#include "retroshare/rsphoto.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class PhotoCommentItem;
|
class PhotoCommentItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
class PhotoCommentItem : public QWidget
|
class PhotoCommentItem : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit PhotoCommentItem(const RsPhotoComment& comment, QWidget *parent = 0);
|
explicit PhotoCommentItem(const RsPhotoComment& comment, QWidget *parent = 0);
|
||||||
~PhotoCommentItem();
|
~PhotoCommentItem();
|
||||||
|
|
||||||
const RsPhotoComment& getComment();
|
const RsPhotoComment& getComment();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void setUp();
|
void setUp();
|
||||||
private:
|
private:
|
||||||
Ui::PhotoCommentItem *ui;
|
Ui::PhotoCommentItem *ui;
|
||||||
RsPhotoComment mComment;
|
RsPhotoComment mComment;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PHOTOCOMMENTITEM_H
|
#endif // PHOTOCOMMENTITEM_H
|
||||||
|
|
|
@ -1,237 +1,237 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include "PhotoDialog.h"
|
#include "PhotoDialog.h"
|
||||||
#include "ui_PhotoDialog.h"
|
#include "ui_PhotoDialog.h"
|
||||||
#include "retroshare/rsidentity.h"
|
#include "retroshare/rsidentity.h"
|
||||||
#include "AddCommentDialog.h"
|
#include "AddCommentDialog.h"
|
||||||
|
|
||||||
PhotoDialog::PhotoDialog(RsPhotoV2 *rs_photo, const RsPhotoPhoto &photo, QWidget *parent) :
|
PhotoDialog::PhotoDialog(RsPhoto *rs_photo, const RsPhotoPhoto &photo, QWidget *parent) :
|
||||||
QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint),
|
QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint),
|
||||||
ui(new Ui::PhotoDialog), mRsPhoto(rs_photo), mPhotoQueue(new TokenQueue(mRsPhoto->getTokenService(), this)),
|
ui(new Ui::PhotoDialog), mRsPhoto(rs_photo), mPhotoQueue(new TokenQueue(mRsPhoto->getTokenService(), this)),
|
||||||
mPhotoDetails(photo)
|
mPhotoDetails(photo)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setAttribute ( Qt::WA_DeleteOnClose, true );
|
setAttribute ( Qt::WA_DeleteOnClose, true );
|
||||||
|
|
||||||
connect(ui->pushButton_AddComment, SIGNAL(clicked()), this, SLOT(createComment()));
|
connect(ui->pushButton_AddComment, SIGNAL(clicked()), this, SLOT(createComment()));
|
||||||
connect(ui->pushButton_AddCommentDlg, SIGNAL(clicked()), this, SLOT(addComment()));
|
connect(ui->pushButton_AddCommentDlg, SIGNAL(clicked()), this, SLOT(addComment()));
|
||||||
connect(ui->fullscreenButton, SIGNAL(clicked()),this, SLOT(setFullScreen()));
|
connect(ui->fullscreenButton, SIGNAL(clicked()),this, SLOT(setFullScreen()));
|
||||||
|
|
||||||
#if QT_VERSION >= 0x040700
|
#if QT_VERSION >= 0x040700
|
||||||
ui->lineEdit->setPlaceholderText(tr("Write a comment...")) ;
|
ui->lineEdit->setPlaceholderText(tr("Write a comment...")) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
setUp();
|
setUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
PhotoDialog::~PhotoDialog()
|
PhotoDialog::~PhotoDialog()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
delete mPhotoQueue;
|
delete mPhotoQueue;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhotoDialog::setUp()
|
void PhotoDialog::setUp()
|
||||||
{
|
{
|
||||||
QPixmap qtn;
|
QPixmap qtn;
|
||||||
qtn.loadFromData(mPhotoDetails.mThumbnail.data, mPhotoDetails.mThumbnail.size, mPhotoDetails.mThumbnail.type.c_str());
|
qtn.loadFromData(mPhotoDetails.mThumbnail.data, mPhotoDetails.mThumbnail.size, mPhotoDetails.mThumbnail.type.c_str());
|
||||||
ui->label_Photo->setPixmap(qtn);
|
ui->label_Photo->setPixmap(qtn);
|
||||||
ui->lineEdit_Title->setText(QString::fromStdString(mPhotoDetails.mMeta.mMsgName));
|
ui->lineEdit_Title->setText(QString::fromStdString(mPhotoDetails.mMeta.mMsgName));
|
||||||
|
|
||||||
requestComments();
|
requestComments();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhotoDialog::addComment()
|
void PhotoDialog::addComment()
|
||||||
{
|
{
|
||||||
AddCommentDialog dlg(this);
|
AddCommentDialog dlg(this);
|
||||||
if (dlg.exec() == QDialog::Accepted) {
|
if (dlg.exec() == QDialog::Accepted) {
|
||||||
RsPhotoComment comment;
|
RsPhotoComment comment;
|
||||||
comment.mComment = dlg.getComment().toUtf8().constData();
|
comment.mComment = dlg.getComment().toUtf8().constData();
|
||||||
|
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
comment.mMeta.mGroupId = mPhotoDetails.mMeta.mGroupId;
|
comment.mMeta.mGroupId = mPhotoDetails.mMeta.mGroupId;
|
||||||
comment.mMeta.mParentId = mPhotoDetails.mMeta.mOrigMsgId;
|
comment.mMeta.mParentId = mPhotoDetails.mMeta.mOrigMsgId;
|
||||||
mRsPhoto->submitComment(token, comment);
|
mRsPhoto->submitComment(token, comment);
|
||||||
mPhotoQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, 0);
|
mPhotoQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhotoDialog::clearComments()
|
void PhotoDialog::clearComments()
|
||||||
{
|
{
|
||||||
//QLayout* l = ui->scrollAreaWidgetContents->layout();
|
//QLayout* l = ui->scrollAreaWidgetContents->layout();
|
||||||
QSetIterator<PhotoCommentItem*> sit(mComments);
|
QSetIterator<PhotoCommentItem*> sit(mComments);
|
||||||
while(sit.hasNext())
|
while(sit.hasNext())
|
||||||
{
|
{
|
||||||
PhotoCommentItem* item = sit.next();
|
PhotoCommentItem* item = sit.next();
|
||||||
ui->verticalLayout->removeWidget(item);
|
ui->verticalLayout->removeWidget(item);
|
||||||
item->setParent(NULL);
|
item->setParent(NULL);
|
||||||
delete item;
|
delete item;
|
||||||
}
|
}
|
||||||
|
|
||||||
mComments.clear();
|
mComments.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhotoDialog::resetComments()
|
void PhotoDialog::resetComments()
|
||||||
{
|
{
|
||||||
QSetIterator<PhotoCommentItem*> sit(mComments);
|
QSetIterator<PhotoCommentItem*> sit(mComments);
|
||||||
//QLayout* l = ui->scrollAreaWidgetContents->layout();
|
//QLayout* l = ui->scrollAreaWidgetContents->layout();
|
||||||
while(sit.hasNext())
|
while(sit.hasNext())
|
||||||
{
|
{
|
||||||
PhotoCommentItem* item = sit.next();
|
PhotoCommentItem* item = sit.next();
|
||||||
ui->verticalLayout->insertWidget(0,item);
|
ui->verticalLayout->insertWidget(0,item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhotoDialog::requestComments()
|
void PhotoDialog::requestComments()
|
||||||
{
|
{
|
||||||
RsTokReqOptions opts;
|
RsTokReqOptions opts;
|
||||||
opts.mMsgFlagMask = RsPhotoV2::FLAG_MSG_TYPE_MASK;
|
opts.mMsgFlagMask = RsPhoto::FLAG_MSG_TYPE_MASK;
|
||||||
opts.mMsgFlagFilter = RsPhotoV2::FLAG_MSG_TYPE_PHOTO_COMMENT;
|
opts.mMsgFlagFilter = RsPhoto::FLAG_MSG_TYPE_PHOTO_COMMENT;
|
||||||
|
|
||||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_IDS;
|
opts.mReqType = GXS_REQUEST_TYPE_MSG_IDS;
|
||||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_RELATED_DATA;
|
opts.mReqType = GXS_REQUEST_TYPE_MSG_RELATED_DATA;
|
||||||
opts.mOptions = RS_TOKREQOPT_MSG_PARENT | RS_TOKREQOPT_MSG_LATEST;
|
opts.mOptions = RS_TOKREQOPT_MSG_PARENT | RS_TOKREQOPT_MSG_LATEST;
|
||||||
RsGxsGrpMsgIdPair msgId;
|
RsGxsGrpMsgIdPair msgId;
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
msgId.first = mPhotoDetails.mMeta.mGroupId;
|
msgId.first = mPhotoDetails.mMeta.mGroupId;
|
||||||
msgId.second = mPhotoDetails.mMeta.mMsgId;
|
msgId.second = mPhotoDetails.mMeta.mMsgId;
|
||||||
std::vector<RsGxsGrpMsgIdPair> msgIdV;
|
std::vector<RsGxsGrpMsgIdPair> msgIdV;
|
||||||
msgIdV.push_back(msgId);
|
msgIdV.push_back(msgId);
|
||||||
mPhotoQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIdV, 0);
|
mPhotoQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIdV, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhotoDialog::createComment()
|
void PhotoDialog::createComment()
|
||||||
{
|
{
|
||||||
RsPhotoComment comment;
|
RsPhotoComment comment;
|
||||||
QString commentString = ui->lineEdit->text();
|
QString commentString = ui->lineEdit->text();
|
||||||
|
|
||||||
comment.mComment = commentString.toUtf8().constData();
|
comment.mComment = commentString.toUtf8().constData();
|
||||||
|
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
comment.mMeta.mGroupId = mPhotoDetails.mMeta.mGroupId;
|
comment.mMeta.mGroupId = mPhotoDetails.mMeta.mGroupId;
|
||||||
comment.mMeta.mParentId = mPhotoDetails.mMeta.mOrigMsgId;
|
comment.mMeta.mParentId = mPhotoDetails.mMeta.mOrigMsgId;
|
||||||
mRsPhoto->submitComment(token, comment);
|
mRsPhoto->submitComment(token, comment);
|
||||||
mPhotoQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, 0);
|
mPhotoQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, 0);
|
||||||
|
|
||||||
ui->lineEdit->clear();
|
ui->lineEdit->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************** message loading **********************/
|
/*************** message loading **********************/
|
||||||
|
|
||||||
void PhotoDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
void PhotoDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
||||||
{
|
{
|
||||||
std::cerr << "PhotoShare::loadRequest()";
|
std::cerr << "PhotoShare::loadRequest()";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
if (queue == mPhotoQueue)
|
if (queue == mPhotoQueue)
|
||||||
{
|
{
|
||||||
/* now switch on req */
|
/* now switch on req */
|
||||||
switch(req.mType)
|
switch(req.mType)
|
||||||
{
|
{
|
||||||
case TOKENREQ_MSGINFO:
|
case TOKENREQ_MSGINFO:
|
||||||
{
|
{
|
||||||
switch(req.mAnsType)
|
switch(req.mAnsType)
|
||||||
{
|
{
|
||||||
case RS_TOKREQ_ANSTYPE_DATA:
|
case RS_TOKREQ_ANSTYPE_DATA:
|
||||||
loadComment(req.mToken);
|
loadComment(req.mToken);
|
||||||
break;
|
break;
|
||||||
case RS_TOKREQ_ANSTYPE_LIST:
|
case RS_TOKREQ_ANSTYPE_LIST:
|
||||||
loadList(req.mToken);
|
loadList(req.mToken);
|
||||||
break;
|
break;
|
||||||
case RS_TOKREQ_ANSTYPE_ACK:
|
case RS_TOKREQ_ANSTYPE_ACK:
|
||||||
acknowledgeComment(req.mToken);
|
acknowledgeComment(req.mToken);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
std::cerr << "PhotoShare::loadRequest() ERROR: MSG INVALID TYPE";
|
std::cerr << "PhotoShare::loadRequest() ERROR: MSG INVALID TYPE";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
std::cerr << "PhotoShare::loadRequest() ERROR: INVALID TYPE";
|
std::cerr << "PhotoShare::loadRequest() ERROR: INVALID TYPE";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhotoDialog::loadComment(uint32_t token)
|
void PhotoDialog::loadComment(uint32_t token)
|
||||||
{
|
{
|
||||||
|
|
||||||
clearComments();
|
clearComments();
|
||||||
|
|
||||||
PhotoRelatedCommentResult results;
|
PhotoRelatedCommentResult results;
|
||||||
mRsPhoto->getPhotoRelatedComment(token, results);
|
mRsPhoto->getPhotoRelatedComment(token, results);
|
||||||
|
|
||||||
PhotoRelatedCommentResult::iterator mit = results.begin();
|
PhotoRelatedCommentResult::iterator mit = results.begin();
|
||||||
|
|
||||||
for(; mit != results.end(); mit++)
|
for(; mit != results.end(); mit++)
|
||||||
{
|
{
|
||||||
const std::vector<RsPhotoComment>& commentV = mit->second;
|
const std::vector<RsPhotoComment>& commentV = mit->second;
|
||||||
std::vector<RsPhotoComment>::const_iterator vit = commentV.begin();
|
std::vector<RsPhotoComment>::const_iterator vit = commentV.begin();
|
||||||
|
|
||||||
for(; vit != commentV.end(); vit++)
|
for(; vit != commentV.end(); vit++)
|
||||||
{
|
{
|
||||||
addComment(*vit);
|
addComment(*vit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resetComments();
|
resetComments();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhotoDialog::loadList(uint32_t token)
|
void PhotoDialog::loadList(uint32_t token)
|
||||||
{
|
{
|
||||||
GxsMsgReq msgIds;
|
GxsMsgReq msgIds;
|
||||||
mRsPhoto->getMsgList(token, msgIds);
|
mRsPhoto->getMsgList(token, msgIds);
|
||||||
RsTokReqOptions opts;
|
RsTokReqOptions opts;
|
||||||
|
|
||||||
// just use data as no need to worry about getting comments
|
// just use data as no need to worry about getting comments
|
||||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||||
uint32_t reqToken;
|
uint32_t reqToken;
|
||||||
mPhotoQueue->requestMsgInfo(reqToken, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, 0);
|
mPhotoQueue->requestMsgInfo(reqToken, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhotoDialog::addComment(const RsPhotoComment &comment)
|
void PhotoDialog::addComment(const RsPhotoComment &comment)
|
||||||
{
|
{
|
||||||
PhotoCommentItem* item = new PhotoCommentItem(comment);
|
PhotoCommentItem* item = new PhotoCommentItem(comment);
|
||||||
mComments.insert(item);
|
mComments.insert(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhotoDialog::acknowledgeComment(uint32_t token)
|
void PhotoDialog::acknowledgeComment(uint32_t token)
|
||||||
{
|
{
|
||||||
RsGxsGrpMsgIdPair msgId;
|
RsGxsGrpMsgIdPair msgId;
|
||||||
mRsPhoto->acknowledgeMsg(token, msgId);
|
mRsPhoto->acknowledgeMsg(token, msgId);
|
||||||
|
|
||||||
if(msgId.first.empty() || msgId.second.empty()){
|
if(msgId.first.empty() || msgId.second.empty()){
|
||||||
|
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
requestComments();
|
requestComments();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhotoDialog::setFullScreen()
|
void PhotoDialog::setFullScreen()
|
||||||
{
|
{
|
||||||
if (!isFullScreen()) {
|
if (!isFullScreen()) {
|
||||||
// hide menu & toolbars
|
// hide menu & toolbars
|
||||||
|
|
||||||
#ifdef Q_WS_X11
|
#ifdef Q_WS_X11
|
||||||
show();
|
show();
|
||||||
raise();
|
raise();
|
||||||
setWindowState( windowState() | Qt::WindowFullScreen );
|
setWindowState( windowState() | Qt::WindowFullScreen );
|
||||||
#else
|
#else
|
||||||
setWindowState( windowState() | Qt::WindowFullScreen );
|
setWindowState( windowState() | Qt::WindowFullScreen );
|
||||||
show();
|
show();
|
||||||
raise();
|
raise();
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
setWindowState( windowState() ^ Qt::WindowFullScreen );
|
setWindowState( windowState() ^ Qt::WindowFullScreen );
|
||||||
show();
|
show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,62 +1,62 @@
|
||||||
#ifndef PHOTODIALOG_H
|
#ifndef PHOTODIALOG_H
|
||||||
#define PHOTODIALOG_H
|
#define PHOTODIALOG_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
#include "retroshare/rsphotoV2.h"
|
#include "retroshare/rsphoto.h"
|
||||||
#include "util/TokenQueue.h"
|
#include "util/TokenQueue.h"
|
||||||
#include "PhotoCommentItem.h"
|
#include "PhotoCommentItem.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class PhotoDialog;
|
class PhotoDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
class PhotoDialog : public QDialog, public TokenResponse
|
class PhotoDialog : public QDialog, public TokenResponse
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit PhotoDialog(RsPhotoV2* rs_photo, const RsPhotoPhoto& photo, QWidget *parent = 0);
|
explicit PhotoDialog(RsPhoto* rs_photo, const RsPhotoPhoto& photo, QWidget *parent = 0);
|
||||||
~PhotoDialog();
|
~PhotoDialog();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void addComment();
|
void addComment();
|
||||||
void createComment();
|
void createComment();
|
||||||
void setFullScreen();
|
void setFullScreen();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||||
private:
|
private:
|
||||||
void setUp();
|
void setUp();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* clears comments
|
* clears comments
|
||||||
* and places them back in dialog
|
* and places them back in dialog
|
||||||
*/
|
*/
|
||||||
void resetComments();
|
void resetComments();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Request comments
|
* Request comments
|
||||||
*/
|
*/
|
||||||
void requestComments();
|
void requestComments();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Simply removes comments but doesn't place them back in dialog
|
* Simply removes comments but doesn't place them back in dialog
|
||||||
*/
|
*/
|
||||||
void clearComments();
|
void clearComments();
|
||||||
|
|
||||||
void acknowledgeComment(uint32_t token);
|
void acknowledgeComment(uint32_t token);
|
||||||
void loadComment(uint32_t token);
|
void loadComment(uint32_t token);
|
||||||
void loadList(uint32_t token);
|
void loadList(uint32_t token);
|
||||||
void addComment(const RsPhotoComment& comment);
|
void addComment(const RsPhotoComment& comment);
|
||||||
private:
|
private:
|
||||||
Ui::PhotoDialog *ui;
|
Ui::PhotoDialog *ui;
|
||||||
|
|
||||||
RsPhotoV2* mRsPhoto;
|
RsPhoto* mRsPhoto;
|
||||||
TokenQueue* mPhotoQueue;
|
TokenQueue* mPhotoQueue;
|
||||||
RsPhotoPhoto mPhotoDetails;
|
RsPhotoPhoto mPhotoDetails;
|
||||||
QSet<PhotoCommentItem*> mComments;
|
QSet<PhotoCommentItem*> mComments;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PHOTODIALOG_H
|
#endif // PHOTODIALOG_H
|
||||||
|
|
|
@ -1,52 +1,52 @@
|
||||||
#ifndef PHOTOITEM_H
|
#ifndef PHOTOITEM_H
|
||||||
#define PHOTOITEM_H
|
#define PHOTOITEM_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include "PhotoShareItemHolder.h"
|
#include "PhotoShareItemHolder.h"
|
||||||
#include "retroshare/rsphotoV2.h"
|
#include "retroshare/rsphoto.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class PhotoItem;
|
class PhotoItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
class PhotoItem : public QWidget, public PhotoShareItem
|
class PhotoItem : public QWidget, public PhotoShareItem
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
PhotoItem(PhotoShareItemHolder *holder, const RsPhotoPhoto& photo, QWidget* parent = 0);
|
PhotoItem(PhotoShareItemHolder *holder, const RsPhotoPhoto& photo, QWidget* parent = 0);
|
||||||
PhotoItem(PhotoShareItemHolder *holder, const QString& path, QWidget* parent = 0); // for new photos.
|
PhotoItem(PhotoShareItemHolder *holder, const QString& path, QWidget* parent = 0); // for new photos.
|
||||||
~PhotoItem();
|
~PhotoItem();
|
||||||
void setSelected(bool selected);
|
void setSelected(bool selected);
|
||||||
bool isSelected(){ return mSelected; }
|
bool isSelected(){ return mSelected; }
|
||||||
const RsPhotoPhoto& getPhotoDetails();
|
const RsPhotoPhoto& getPhotoDetails();
|
||||||
bool getPhotoThumbnail(RsPhotoThumbnail &nail);
|
bool getPhotoThumbnail(RsPhotoThumbnail &nail);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void mousePressEvent(QMouseEvent *event);
|
void mousePressEvent(QMouseEvent *event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateImage(const RsPhotoThumbnail &thumbnail);
|
void updateImage(const RsPhotoThumbnail &thumbnail);
|
||||||
void setUp();
|
void setUp();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void setTitle();
|
void setTitle();
|
||||||
void setPhotoGrapher();
|
void setPhotoGrapher();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::PhotoItem *ui;
|
Ui::PhotoItem *ui;
|
||||||
|
|
||||||
QPixmap mThumbNail;
|
QPixmap mThumbNail;
|
||||||
|
|
||||||
QPixmap getPixmap() { return mThumbNail; }
|
QPixmap getPixmap() { return mThumbNail; }
|
||||||
|
|
||||||
bool mSelected;
|
bool mSelected;
|
||||||
RsPhotoPhoto mPhotoDetails;
|
RsPhotoPhoto mPhotoDetails;
|
||||||
PhotoShareItemHolder* mHolder;
|
PhotoShareItemHolder* mHolder;
|
||||||
|
|
||||||
QLabel *mTitleLabel, *mPhotoGrapherLabel;
|
QLabel *mTitleLabel, *mPhotoGrapherLabel;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PHOTOITEM_H
|
#endif // PHOTOITEM_H
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,97 +1,97 @@
|
||||||
#ifndef PHOTOSHARE_H
|
#ifndef PHOTOSHARE_H
|
||||||
#define PHOTOSHARE_H
|
#define PHOTOSHARE_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include "ui_PhotoShare.h"
|
#include "ui_PhotoShare.h"
|
||||||
|
|
||||||
#include "retroshare/rsphotoV2.h"
|
#include "retroshare/rsphoto.h"
|
||||||
#include "retroshare-gui/mainpage.h"
|
#include "retroshare-gui/mainpage.h"
|
||||||
|
|
||||||
#include "AlbumCreateDialog.h"
|
#include "AlbumCreateDialog.h"
|
||||||
#include "AlbumDialog.h"
|
#include "AlbumDialog.h"
|
||||||
#include "PhotoDialog.h"
|
#include "PhotoDialog.h"
|
||||||
|
|
||||||
#include "AlbumItem.h"
|
#include "AlbumItem.h"
|
||||||
#include "PhotoItem.h"
|
#include "PhotoItem.h"
|
||||||
#include "PhotoSlideShow.h"
|
#include "PhotoSlideShow.h"
|
||||||
|
|
||||||
#include "util/TokenQueue.h"
|
#include "util/TokenQueue.h"
|
||||||
#include "PhotoShareItemHolder.h"
|
#include "PhotoShareItemHolder.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class PhotoShare;
|
class PhotoShare;
|
||||||
}
|
}
|
||||||
|
|
||||||
class PhotoShare : public MainPage, public TokenResponse, public PhotoShareItemHolder
|
class PhotoShare : public MainPage, public TokenResponse, public PhotoShareItemHolder
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PhotoShare(QWidget *parent = 0);
|
PhotoShare(QWidget *parent = 0);
|
||||||
|
|
||||||
void notifySelection(PhotoShareItem* selection);
|
void notifySelection(PhotoShareItem* selection);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void checkUpdate();
|
void checkUpdate();
|
||||||
void createAlbum();
|
void createAlbum();
|
||||||
void OpenAlbumDialog();
|
void OpenAlbumDialog();
|
||||||
void OpenPhotoDialog();
|
void OpenPhotoDialog();
|
||||||
void OpenSlideShow();
|
void OpenSlideShow();
|
||||||
void updateAlbums();
|
void updateAlbums();
|
||||||
void subscribeToAlbum();
|
void subscribeToAlbum();
|
||||||
void deleteAlbum(const RsGxsGroupId&);
|
void deleteAlbum(const RsGxsGroupId&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/* Request Response Functions for loading data */
|
/* Request Response Functions for loading data */
|
||||||
void requestAlbumList(std::list<std::string>& ids);
|
void requestAlbumList(std::list<std::string>& ids);
|
||||||
void requestAlbumData(std::list<RsGxsGroupId> &ids);
|
void requestAlbumData(std::list<RsGxsGroupId> &ids);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* request data for all groups
|
* request data for all groups
|
||||||
*/
|
*/
|
||||||
void requestAlbumData();
|
void requestAlbumData();
|
||||||
void requestPhotoList(GxsMsgReq &albumIds);
|
void requestPhotoList(GxsMsgReq &albumIds);
|
||||||
void requestPhotoList(const std::string &albumId);
|
void requestPhotoList(const std::string &albumId);
|
||||||
void requestPhotoData(GxsMsgReq &photoIds);
|
void requestPhotoData(GxsMsgReq &photoIds);
|
||||||
void requestPhotoData(const std::list<RsGxsGroupId> &grpIds);
|
void requestPhotoData(const std::list<RsGxsGroupId> &grpIds);
|
||||||
|
|
||||||
void loadAlbumList(const uint32_t &token);
|
void loadAlbumList(const uint32_t &token);
|
||||||
bool loadAlbumData(const uint32_t &token);
|
bool loadAlbumData(const uint32_t &token);
|
||||||
void loadPhotoList(const uint32_t &token);
|
void loadPhotoList(const uint32_t &token);
|
||||||
void loadPhotoData(const uint32_t &token);
|
void loadPhotoData(const uint32_t &token);
|
||||||
|
|
||||||
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||||
|
|
||||||
void acknowledgeGroup(const uint32_t &token);
|
void acknowledgeGroup(const uint32_t &token);
|
||||||
void acknowledgeMessage(const uint32_t &token);
|
void acknowledgeMessage(const uint32_t &token);
|
||||||
|
|
||||||
/* Grunt work of setting up the GUI */
|
/* Grunt work of setting up the GUI */
|
||||||
|
|
||||||
void addAlbum(const RsPhotoAlbum &album);
|
void addAlbum(const RsPhotoAlbum &album);
|
||||||
void addPhoto(const RsPhotoPhoto &photo);
|
void addPhoto(const RsPhotoPhoto &photo);
|
||||||
|
|
||||||
void clearAlbums();
|
void clearAlbums();
|
||||||
void clearPhotos();
|
void clearPhotos();
|
||||||
void deleteAlbums();
|
void deleteAlbums();
|
||||||
/*!
|
/*!
|
||||||
* Fills up photo ui with photos held in mPhotoItems (current groups photos)
|
* Fills up photo ui with photos held in mPhotoItems (current groups photos)
|
||||||
*/
|
*/
|
||||||
void updatePhotos();
|
void updatePhotos();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AlbumItem* mAlbumSelected;
|
AlbumItem* mAlbumSelected;
|
||||||
PhotoItem* mPhotoSelected;
|
PhotoItem* mPhotoSelected;
|
||||||
|
|
||||||
|
|
||||||
TokenQueue *mPhotoQueue;
|
TokenQueue *mPhotoQueue;
|
||||||
|
|
||||||
/* UI - from Designer */
|
/* UI - from Designer */
|
||||||
Ui::PhotoShare ui;
|
Ui::PhotoShare ui;
|
||||||
|
|
||||||
QSet<AlbumItem*> mAlbumItems;
|
QSet<AlbumItem*> mAlbumItems;
|
||||||
QSet<PhotoItem*> mPhotoItems; // the current album selected
|
QSet<PhotoItem*> mPhotoItems; // the current album selected
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PHOTOSHARE_H
|
#endif // PHOTOSHARE_H
|
||||||
|
|
|
@ -39,7 +39,7 @@ PhotoSlideShow::PhotoSlideShow(const RsPhotoAlbum& album, QWidget *parent)
|
||||||
connect(ui.pushButton_Close, SIGNAL( clicked( void ) ), this, SLOT( closeShow( void ) ) );
|
connect(ui.pushButton_Close, SIGNAL( clicked( void ) ), this, SLOT( closeShow( void ) ) );
|
||||||
connect(ui.fullscreenButton, SIGNAL(clicked()),this, SLOT(setFullScreen()));
|
connect(ui.fullscreenButton, SIGNAL(clicked()),this, SLOT(setFullScreen()));
|
||||||
|
|
||||||
mPhotoQueue = new TokenQueue(rsPhotoV2->getTokenService(), this);
|
mPhotoQueue = new TokenQueue(rsPhoto->getTokenService(), this);
|
||||||
|
|
||||||
mRunning = true;
|
mRunning = true;
|
||||||
mShotActive = true;
|
mShotActive = true;
|
||||||
|
@ -236,7 +236,7 @@ bool PhotoSlideShow::loadPhotoData(const uint32_t &token)
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
PhotoResult res;
|
PhotoResult res;
|
||||||
rsPhotoV2->getPhoto(token, res);
|
rsPhoto->getPhoto(token, res);
|
||||||
PhotoResult::iterator mit = res.begin();
|
PhotoResult::iterator mit = res.begin();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
#include "ui_PhotoSlideShow.h"
|
#include "ui_PhotoSlideShow.h"
|
||||||
|
|
||||||
#include <retroshare/rsphotoV2.h>
|
#include <retroshare/rsphoto.h>
|
||||||
#include "util/TokenQueue.h"
|
#include "util/TokenQueue.h"
|
||||||
#include "AlbumItem.h"
|
#include "AlbumItem.h"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue