mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-19 11:54:22 -04:00
Removed references to postedVEG from GxsGroupDialog and associated classes and PostedDialog (GUI does not work now but does not crash)
Removed V2 references: TokenQueueV2 and RsTokReqOptionsV2 are now TokenQueue and RsTokReqOptions and renamed file Added initialisation of Posted back end service successfully Added new msg status flags GXS_SERV::MSG_STATUS_UNPROCESSED and ::MSG_STATUS_UNREAD git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5707 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
dcb64f6631
commit
c518bd2f19
44 changed files with 2379 additions and 3761 deletions
|
@ -36,7 +36,7 @@
|
||||||
#include "serialiser/rsnxsitems.h"
|
#include "serialiser/rsnxsitems.h"
|
||||||
#include "gxs/rsgxsdata.h"
|
#include "gxs/rsgxsdata.h"
|
||||||
#include "rsgxs.h"
|
#include "rsgxs.h"
|
||||||
#include "util/retrodb.h"
|
#include "util/contentvalue.h"
|
||||||
|
|
||||||
|
|
||||||
class RsGxsSearchModule {
|
class RsGxsSearchModule {
|
||||||
|
|
|
@ -109,6 +109,7 @@ public:
|
||||||
|
|
||||||
// BELOW HERE IS LOCAL DATA, THAT IS NOT FROM MSG.
|
// BELOW HERE IS LOCAL DATA, THAT IS NOT FROM MSG.
|
||||||
// normally READ / UNREAD flags. LOCAL Data.
|
// normally READ / UNREAD flags. LOCAL Data.
|
||||||
|
|
||||||
uint32_t mMsgStatus;
|
uint32_t mMsgStatus;
|
||||||
time_t mChildTs;
|
time_t mChildTs;
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ RsGxsDataAccess::RsGxsDataAccess(RsGeneralDataService* ds)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool RsGxsDataAccess::requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts,
|
bool RsGxsDataAccess::requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts,
|
||||||
const std::list<std::string> &groupIds)
|
const std::list<std::string> &groupIds)
|
||||||
{
|
{
|
||||||
if(groupIds.empty())
|
if(groupIds.empty())
|
||||||
|
@ -110,7 +110,7 @@ bool RsGxsDataAccess::requestGroupInfo(uint32_t &token, uint32_t ansType, const
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RsGxsDataAccess::requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts)
|
bool RsGxsDataAccess::requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts)
|
||||||
{
|
{
|
||||||
|
|
||||||
GxsRequest* req = NULL;
|
GxsRequest* req = NULL;
|
||||||
|
@ -160,7 +160,7 @@ void RsGxsDataAccess::generateToken(uint32_t &token)
|
||||||
|
|
||||||
|
|
||||||
bool RsGxsDataAccess::requestMsgInfo(uint32_t &token, uint32_t ansType,
|
bool RsGxsDataAccess::requestMsgInfo(uint32_t &token, uint32_t ansType,
|
||||||
const RsTokReqOptionsV2 &opts, const GxsMsgReq &msgIds)
|
const RsTokReqOptions &opts, const GxsMsgReq &msgIds)
|
||||||
{
|
{
|
||||||
|
|
||||||
GxsRequest* req = NULL;
|
GxsRequest* req = NULL;
|
||||||
|
@ -220,7 +220,7 @@ bool RsGxsDataAccess::requestMsgInfo(uint32_t &token, uint32_t ansType,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RsGxsDataAccess::requestMsgInfo(uint32_t &token, uint32_t ansType,
|
bool RsGxsDataAccess::requestMsgInfo(uint32_t &token, uint32_t ansType,
|
||||||
const RsTokReqOptionsV2 &opts, const std::list<RsGxsGroupId>& grpIds)
|
const RsTokReqOptions &opts, const std::list<RsGxsGroupId>& grpIds)
|
||||||
{
|
{
|
||||||
GxsRequest* req = NULL;
|
GxsRequest* req = NULL;
|
||||||
uint32_t reqType = opts.mReqType;
|
uint32_t reqType = opts.mReqType;
|
||||||
|
@ -269,7 +269,7 @@ bool RsGxsDataAccess::requestMsgInfo(uint32_t &token, uint32_t ansType,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RsGxsDataAccess::requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts,
|
bool RsGxsDataAccess::requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts,
|
||||||
const RsGxsGrpMsgIdPair &msgIds)
|
const RsGxsGrpMsgIdPair &msgIds)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -285,7 +285,7 @@ bool RsGxsDataAccess::requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void RsGxsDataAccess::setReq(GxsRequest* req, const uint32_t& token, const uint32_t& ansType, const RsTokReqOptionsV2& opts) const
|
void RsGxsDataAccess::setReq(GxsRequest* req, const uint32_t& token, const uint32_t& ansType, const RsTokReqOptions& opts) const
|
||||||
{
|
{
|
||||||
req->token = token;
|
req->token = token;
|
||||||
req->ansType = ansType;
|
req->ansType = ansType;
|
||||||
|
@ -752,7 +752,7 @@ bool RsGxsDataAccess::getMsgSummary(MsgMetaReq* req)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool RsGxsDataAccess::getMsgList(const GxsMsgReq& msgIds, const RsTokReqOptionsV2& opts, GxsMsgReq& msgIdsOut)
|
bool RsGxsDataAccess::getMsgList(const GxsMsgReq& msgIds, const RsTokReqOptions& opts, GxsMsgReq& msgIdsOut)
|
||||||
{
|
{
|
||||||
GxsMsgMetaResult result;
|
GxsMsgMetaResult result;
|
||||||
|
|
||||||
|
@ -923,7 +923,7 @@ bool RsGxsDataAccess::getMsgRelatedInfo(MsgRelatedInfoReq *req)
|
||||||
std::cerr << "RsGxsDataAccess::getMsgRelatedList()";
|
std::cerr << "RsGxsDataAccess::getMsgRelatedList()";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
const RsTokReqOptionsV2& opts = req->Options;
|
const RsTokReqOptions& opts = req->Options;
|
||||||
|
|
||||||
bool onlyLatestMsgs = false;
|
bool onlyLatestMsgs = false;
|
||||||
bool onlyAllVersions = false;
|
bool onlyAllVersions = false;
|
||||||
|
@ -1216,7 +1216,7 @@ void RsGxsDataAccess::cleanseMsgMetaMap(GxsMsgMetaResult& result)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsGxsDataAccess::filterMsgList(GxsMsgIdResult& msgIds, const RsTokReqOptionsV2& opts,
|
void RsGxsDataAccess::filterMsgList(GxsMsgIdResult& msgIds, const RsTokReqOptions& opts,
|
||||||
const MsgMetaFilter& msgMetas) const
|
const MsgMetaFilter& msgMetas) const
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -1376,7 +1376,7 @@ bool RsGxsDataAccess::disposeOfPublicToken(const uint32_t& token)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RsGxsDataAccess::checkMsgFilter(const RsTokReqOptionsV2& opts, const RsGxsMsgMetaData* meta) const
|
bool RsGxsDataAccess::checkMsgFilter(const RsTokReqOptions& opts, const RsGxsMsgMetaData* meta) const
|
||||||
{
|
{
|
||||||
bool statusMatch = false;
|
bool statusMatch = false;
|
||||||
if (opts.mStatusMask)
|
if (opts.mStatusMask)
|
||||||
|
@ -1434,3 +1434,4 @@ bool RsGxsDataAccess::checkMsgFilter(const RsTokReqOptionsV2& opts, const RsGxsM
|
||||||
|
|
||||||
return statusMatch && flagMatch;
|
return statusMatch && flagMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ public:
|
||||||
* @param groupIds group id to request info for
|
* @param groupIds group id to request info for
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
bool requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts, const std::list<RsGxsGroupId> &groupIds);
|
bool requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<RsGxsGroupId> &groupIds);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Use this to request all group related info
|
* Use this to request all group related info
|
||||||
|
@ -60,7 +60,7 @@ public:
|
||||||
* @param opts Additional option that affect outcome of request. Please see specific services, for valid values
|
* @param opts Additional option that affect outcome of request. Please see specific services, for valid values
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
bool requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts);
|
bool requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Use this to get msg related information, store this value to pole for request completion
|
* Use this to get msg related information, store this value to pole for request completion
|
||||||
|
@ -70,7 +70,7 @@ public:
|
||||||
* @param groupIds The ids of the groups to get, second entry of map empty to query for all msgs
|
* @param groupIds The ids of the groups to get, second entry of map empty to query for all msgs
|
||||||
* @return true if request successful false otherwise
|
* @return true if request successful false otherwise
|
||||||
*/
|
*/
|
||||||
bool requestMsgInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts, const GxsMsgReq& msgIds);
|
bool requestMsgInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const GxsMsgReq& msgIds);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Use this to get msg related information, store this value to pole for request completion
|
* Use this to get msg related information, store this value to pole for request completion
|
||||||
|
@ -80,7 +80,7 @@ public:
|
||||||
* @param groupIds The ids of the groups to get, this retrieve all the msgs info for each grpId in list
|
* @param groupIds The ids of the groups to get, this retrieve all the msgs info for each grpId in list
|
||||||
* @return true if request successful false otherwise
|
* @return true if request successful false otherwise
|
||||||
*/
|
*/
|
||||||
bool requestMsgInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts, const std::list<RsGxsGroupId>& grpIds);
|
bool requestMsgInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<RsGxsGroupId>& grpIds);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* For requesting msgs related to a given msg id within a group
|
* For requesting msgs related to a given msg id within a group
|
||||||
|
@ -90,7 +90,7 @@ public:
|
||||||
* @param groupIds The ids of the groups to get, second entry of map empty to query for all msgs
|
* @param groupIds The ids of the groups to get, second entry of map empty to query for all msgs
|
||||||
* @return true if request successful false otherwise
|
* @return true if request successful false otherwise
|
||||||
*/
|
*/
|
||||||
bool requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts, const RsGxsGrpMsgIdPair &msgIds);
|
bool requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const RsGxsGrpMsgIdPair &msgIds);
|
||||||
|
|
||||||
/* Poll */
|
/* Poll */
|
||||||
uint32_t requestStatus(const uint32_t token);
|
uint32_t requestStatus(const uint32_t token);
|
||||||
|
@ -202,7 +202,7 @@ private:
|
||||||
* @param ansType
|
* @param ansType
|
||||||
* @param opts
|
* @param opts
|
||||||
*/
|
*/
|
||||||
void setReq(GxsRequest* req,const uint32_t &token, const uint32_t& ansType, const RsTokReqOptionsV2 &opts) const;
|
void setReq(GxsRequest* req,const uint32_t &token, const uint32_t& ansType, const RsTokReqOptions &opts) const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Remove request for request queue
|
* Remove request for request queue
|
||||||
|
@ -331,7 +331,7 @@ private:
|
||||||
* @param opts the request options set by user
|
* @param opts the request options set by user
|
||||||
* @param meta The accompanying meta information for msg, ids
|
* @param meta The accompanying meta information for msg, ids
|
||||||
*/
|
*/
|
||||||
void filterMsgList(GxsMsgIdResult& msgIds, const RsTokReqOptionsV2& opts, const MsgMetaFilter& meta) const;
|
void filterMsgList(GxsMsgIdResult& msgIds, const RsTokReqOptions& opts, const MsgMetaFilter& meta) const;
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -341,7 +341,7 @@ private:
|
||||||
* @param meta meta containing currently defined options for msg
|
* @param meta meta containing currently defined options for msg
|
||||||
* @return true if msg meta passes all options
|
* @return true if msg meta passes all options
|
||||||
*/
|
*/
|
||||||
bool checkMsgFilter(const RsTokReqOptionsV2& opts, const RsGxsMsgMetaData* meta) const;
|
bool checkMsgFilter(const RsTokReqOptions& opts, const RsGxsMsgMetaData* meta) const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* This is a filter method which applies the request options to the list of ids
|
* This is a filter method which applies the request options to the list of ids
|
||||||
|
@ -350,7 +350,7 @@ private:
|
||||||
* @param opts the options used to parameterise the id filter
|
* @param opts the options used to parameterise the id filter
|
||||||
* @param msgIdsOut the left overs ids after filter is applied to msgIds
|
* @param msgIdsOut the left overs ids after filter is applied to msgIds
|
||||||
*/
|
*/
|
||||||
bool getMsgList(const GxsMsgReq& msgIds, const RsTokReqOptionsV2& opts, GxsMsgReq& msgIdsOut);
|
bool getMsgList(const GxsMsgReq& msgIds, const RsTokReqOptions& opts, GxsMsgReq& msgIdsOut);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -3,13 +3,22 @@
|
||||||
|
|
||||||
#include "inttypes.h"
|
#include "inttypes.h"
|
||||||
|
|
||||||
// this serves a single point of call for definining grp and msg modes
|
/**
|
||||||
// GXS. These modes say
|
* The GXS_SERV namespace serves a single point of reference for definining grp and msg flags
|
||||||
|
* Declared and defined here are:
|
||||||
|
* - privacy flags which define the level of privacy that can be given \n
|
||||||
|
* to a group
|
||||||
|
* - authentication types which defined types of authentication needed for a given message to
|
||||||
|
* confirm its authenticity
|
||||||
|
* - subscription flags: This used only locally by the peer to subscription status to a \n
|
||||||
|
* a group
|
||||||
|
* -
|
||||||
|
*/
|
||||||
namespace GXS_SERV {
|
namespace GXS_SERV {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** privacy **/
|
/** START privacy **/
|
||||||
|
|
||||||
static const uint32_t FLAG_PRIVACY_MASK = 0x0000000f;
|
static const uint32_t FLAG_PRIVACY_MASK = 0x0000000f;
|
||||||
|
|
||||||
|
@ -22,9 +31,9 @@ namespace GXS_SERV {
|
||||||
// anyone can publish, publish key pair not needed
|
// anyone can publish, publish key pair not needed
|
||||||
static const uint32_t FLAG_PRIVACY_PUBLIC = 0x00000004;
|
static const uint32_t FLAG_PRIVACY_PUBLIC = 0x00000004;
|
||||||
|
|
||||||
/** privacy **/
|
/** END privacy **/
|
||||||
|
|
||||||
/** authentication **/
|
/** START authentication **/
|
||||||
|
|
||||||
static const uint32_t FLAG_AUTHEN_MASK = 0x000000f0;
|
static const uint32_t FLAG_AUTHEN_MASK = 0x000000f0;
|
||||||
|
|
||||||
|
@ -40,10 +49,10 @@ namespace GXS_SERV {
|
||||||
// pgp sign identity
|
// pgp sign identity
|
||||||
static const uint32_t FLAG_AUTHEN_PGP_IDENTITY = 0x00000080;
|
static const uint32_t FLAG_AUTHEN_PGP_IDENTITY = 0x00000080;
|
||||||
|
|
||||||
/** authentication **/
|
/** END authentication **/
|
||||||
|
|
||||||
|
|
||||||
// Subscription Flags. (LOCAL)
|
/** START Subscription Flags. (LOCAL) **/
|
||||||
|
|
||||||
static const uint32_t GROUP_SUBSCRIBE_ADMIN = 0x00000001;
|
static const uint32_t GROUP_SUBSCRIBE_ADMIN = 0x00000001;
|
||||||
|
|
||||||
|
@ -55,6 +64,16 @@ namespace GXS_SERV {
|
||||||
|
|
||||||
static const uint32_t GROUP_SUBSCRIBE_MASK = 0x0000000f;
|
static const uint32_t GROUP_SUBSCRIBE_MASK = 0x0000000f;
|
||||||
|
|
||||||
|
/** END Subscription Flags. (LOCAL) **/
|
||||||
|
|
||||||
|
/** START GXS Msg status flags **/
|
||||||
|
|
||||||
|
static const uint32_t GXS_MSG_STATUS_UNPROCESSED = 0x000000100;
|
||||||
|
|
||||||
|
static const uint32_t GXS_MSG_STATUS_UNREAD = 0x00000200;
|
||||||
|
|
||||||
|
/** END GXS Msg status flags **/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1267,7 +1267,7 @@ NxsTransaction::~NxsTransaction(){
|
||||||
/* Net Manager */
|
/* Net Manager */
|
||||||
|
|
||||||
RsNxsNetMgrImpl::RsNxsNetMgrImpl(p3LinkMgr *lMgr)
|
RsNxsNetMgrImpl::RsNxsNetMgrImpl(p3LinkMgr *lMgr)
|
||||||
: mLinkMgr(lMgr)
|
: mLinkMgr(lMgr), mNxsNetMgrMtx("RsNxsNetMgrImpl")
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1275,6 +1275,7 @@ RsNxsNetMgrImpl::RsNxsNetMgrImpl(p3LinkMgr *lMgr)
|
||||||
|
|
||||||
std::string RsNxsNetMgrImpl::getOwnId()
|
std::string RsNxsNetMgrImpl::getOwnId()
|
||||||
{
|
{
|
||||||
|
RsStackMutex stack(mNxsNetMgrMtx);
|
||||||
return mLinkMgr->getOwnId();
|
return mLinkMgr->getOwnId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1283,7 +1284,10 @@ void RsNxsNetMgrImpl::getOnlineList(std::set<std::string> &ssl_peers)
|
||||||
ssl_peers.clear();
|
ssl_peers.clear();
|
||||||
|
|
||||||
std::list<std::string> pList;
|
std::list<std::string> pList;
|
||||||
|
{
|
||||||
|
RsStackMutex stack(mNxsNetMgrMtx);
|
||||||
mLinkMgr->getOnlineList(pList);
|
mLinkMgr->getOnlineList(pList);
|
||||||
|
}
|
||||||
|
|
||||||
std::list<std::string>::const_iterator lit = pList.begin();
|
std::list<std::string>::const_iterator lit = pList.begin();
|
||||||
|
|
||||||
|
|
|
@ -103,6 +103,7 @@ public:
|
||||||
private:
|
private:
|
||||||
|
|
||||||
p3LinkMgr* mLinkMgr;
|
p3LinkMgr* mLinkMgr;
|
||||||
|
RsMutex mNxsNetMgrMtx;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "gxs/rstokenservice.h"
|
||||||
#include "gxs/rsgds.h"
|
#include "gxs/rsgds.h"
|
||||||
|
|
||||||
class GxsRequest
|
class GxsRequest
|
||||||
|
@ -40,7 +41,7 @@ public:
|
||||||
|
|
||||||
uint32_t ansType;
|
uint32_t ansType;
|
||||||
uint32_t reqType;
|
uint32_t reqType;
|
||||||
RsTokReqOptionsV2 Options;
|
RsTokReqOptions Options;
|
||||||
|
|
||||||
uint32_t status;
|
uint32_t status;
|
||||||
};
|
};
|
||||||
|
|
|
@ -68,10 +68,10 @@
|
||||||
* This class provides useful generic support for GXS style services.
|
* This class provides useful generic support for GXS style services.
|
||||||
* I expect much of this will be incorporated into the base GXS.
|
* I expect much of this will be incorporated into the base GXS.
|
||||||
*/
|
*/
|
||||||
class RsTokReqOptionsV2
|
class RsTokReqOptions
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RsTokReqOptionsV2()
|
RsTokReqOptions()
|
||||||
{
|
{
|
||||||
mOptions = 0;
|
mOptions = 0;
|
||||||
mStatusFilter = 0; mStatusMask = 0; mSubscribeFilter = 0;
|
mStatusFilter = 0; mStatusMask = 0; mSubscribeFilter = 0;
|
||||||
|
@ -86,6 +86,7 @@ uint32_t mOptions;
|
||||||
uint32_t mStatusFilter;
|
uint32_t mStatusFilter;
|
||||||
uint32_t mStatusMask;
|
uint32_t mStatusMask;
|
||||||
|
|
||||||
|
// use
|
||||||
uint32_t mMsgFlagMask, mMsgFlagFilter;
|
uint32_t mMsgFlagMask, mMsgFlagFilter;
|
||||||
|
|
||||||
uint32_t mReqType;
|
uint32_t mReqType;
|
||||||
|
@ -97,6 +98,8 @@ time_t mBefore;
|
||||||
time_t mAfter;
|
time_t mAfter;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
std::ostream &operator<<(std::ostream &out, const RsGroupMetaData &meta);
|
||||||
|
std::ostream &operator<<(std::ostream &out, const RsMsgMetaData &meta);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* A proxy class for requesting generic service data for GXS
|
* A proxy class for requesting generic service data for GXS
|
||||||
|
@ -129,7 +132,7 @@ public:
|
||||||
* @param groupIds group id to request info for
|
* @param groupIds group id to request info for
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
virtual bool requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts, const std::list<RsGxsGroupId> &groupIds) = 0;
|
virtual bool requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<RsGxsGroupId> &groupIds) = 0;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Use this to request all group related info
|
* Use this to request all group related info
|
||||||
|
@ -138,7 +141,7 @@ public:
|
||||||
* @param opts Additional option that affect outcome of request. Please see specific services, for valid values
|
* @param opts Additional option that affect outcome of request. Please see specific services, for valid values
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
virtual bool requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts) = 0;
|
virtual bool requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts) = 0;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Use this to get msg related information, store this value to pole for request completion
|
* Use this to get msg related information, store this value to pole for request completion
|
||||||
|
@ -148,7 +151,7 @@ public:
|
||||||
* @param groupIds The ids of the groups to get, second entry of map empty to query for all msgs
|
* @param groupIds The ids of the groups to get, second entry of map empty to query for all msgs
|
||||||
* @return true if request successful false otherwise
|
* @return true if request successful false otherwise
|
||||||
*/
|
*/
|
||||||
virtual bool requestMsgInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts, const GxsMsgReq& msgIds) = 0;
|
virtual bool requestMsgInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const GxsMsgReq& msgIds) = 0;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Use this to get msg related information, store this value to pole for request completion
|
* Use this to get msg related information, store this value to pole for request completion
|
||||||
|
@ -158,7 +161,7 @@ public:
|
||||||
* @param groupIds The ids of the groups to get, this retrieve all the msgs info for each grpId in list
|
* @param groupIds The ids of the groups to get, this retrieve all the msgs info for each grpId in list
|
||||||
* @return true if request successful false otherwise
|
* @return true if request successful false otherwise
|
||||||
*/
|
*/
|
||||||
virtual bool requestMsgInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts, const std::list<RsGxsGroupId>& msgIds) = 0;
|
virtual bool requestMsgInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<RsGxsGroupId>& msgIds) = 0;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* For requesting msgs related to a given msg id within a group
|
* For requesting msgs related to a given msg id within a group
|
||||||
|
@ -168,7 +171,7 @@ public:
|
||||||
* @param groupIds The ids of the groups to get, second entry of map empty to query for all msgs
|
* @param groupIds The ids of the groups to get, second entry of map empty to query for all msgs
|
||||||
* @return true if request successful false otherwise
|
* @return true if request successful false otherwise
|
||||||
*/
|
*/
|
||||||
virtual bool requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts, const RsGxsGrpMsgIdPair& msgIds) = 0;
|
virtual bool requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const RsGxsGrpMsgIdPair& msgIds) = 0;
|
||||||
|
|
||||||
|
|
||||||
/* Poll */
|
/* Poll */
|
||||||
|
|
|
@ -527,6 +527,7 @@ HEADERS += retroshare/rsgame.h \
|
||||||
serialiser/rsbanlistitems.cc \
|
serialiser/rsbanlistitems.cc \
|
||||||
serialiser/rsbwctrlitems.cc \
|
serialiser/rsbwctrlitems.cc \
|
||||||
serialiser/rstunnelitems.cc
|
serialiser/rstunnelitems.cc
|
||||||
|
|
||||||
SOURCES += services/p3channels.cc \
|
SOURCES += services/p3channels.cc \
|
||||||
services/p3chatservice.cc \
|
services/p3chatservice.cc \
|
||||||
services/p3disc.cc \
|
services/p3disc.cc \
|
||||||
|
@ -603,6 +604,7 @@ HEADERS += retroshare/rsgame.h \
|
||||||
gxs/rsgxsifaceimpl.h \
|
gxs/rsgxsifaceimpl.h \
|
||||||
services/p3posted.h \
|
services/p3posted.h \
|
||||||
retroshare/rsposted.h \
|
retroshare/rsposted.h \
|
||||||
|
serialiser/rsposteditems.h
|
||||||
|
|
||||||
|
|
||||||
SOURCES += serialiser/rsnxsitems.cc \
|
SOURCES += serialiser/rsnxsitems.cc \
|
||||||
|
@ -621,22 +623,23 @@ HEADERS += retroshare/rsgame.h \
|
||||||
gxs/gxssecurity.cc \
|
gxs/gxssecurity.cc \
|
||||||
gxs/rsgxsifaceimpl.cc \
|
gxs/rsgxsifaceimpl.cc \
|
||||||
services/p3posted.cc \
|
services/p3posted.cc \
|
||||||
|
serialiser/rsposteditems.cc
|
||||||
|
|
||||||
# Identity Service
|
# Identity Service
|
||||||
HEADERS += retroshare/rsidentity.h \
|
HEADERS += retroshare/rsidentity.h \
|
||||||
gxs/rsgixs.h \
|
gxs/rsgixs.h \
|
||||||
services/p3idservice.h \
|
services/p3idservice.h \
|
||||||
serialiser/rsgxsiditems.h \
|
serialiser/rsgxsiditems.h
|
||||||
|
|
||||||
SOURCES += services/p3idservice.cc \
|
SOURCES += services/p3idservice.cc
|
||||||
# serialiser/rsgxsiditems.cc \
|
# serialiser/rsgxsiditems.cc \
|
||||||
|
|
||||||
# Wiki Service
|
# Wiki Service
|
||||||
HEADERS += retroshare/rswiki.h \
|
HEADERS += retroshare/rswiki.h \
|
||||||
services/p3wiki.h \
|
services/p3wiki.h \
|
||||||
serialiser/rswikiitems.h \
|
serialiser/rswikiitems.h
|
||||||
|
|
||||||
SOURCES += services/p3wiki.cc \
|
SOURCES += services/p3wiki.cc
|
||||||
# serialiser/rswikiitems.cc \
|
# serialiser/rswikiitems.cc \
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -645,30 +648,20 @@ HEADERS += retroshare/rsgame.h \
|
||||||
HEADERS += services/p3photoserviceV2.h \
|
HEADERS += services/p3photoserviceV2.h \
|
||||||
retroshare/rsphotoVEG.h \
|
retroshare/rsphotoVEG.h \
|
||||||
services/p3gxsserviceVEG.h \
|
services/p3gxsserviceVEG.h \
|
||||||
retroshare/rsidentityVEG.h \
|
|
||||||
services/p3wikiserviceVEG.h \
|
services/p3wikiserviceVEG.h \
|
||||||
retroshare/rswikiVEG.h \
|
retroshare/rswikiVEG.h \
|
||||||
retroshare/rswireVEG.h \
|
retroshare/rswireVEG.h \
|
||||||
services/p3wireVEG.h \
|
services/p3wireVEG.h \
|
||||||
services/p3idserviceVEG.h \
|
|
||||||
retroshare/rsforumsVEG.h \
|
retroshare/rsforumsVEG.h \
|
||||||
services/p3forumsVEG.h \
|
services/p3forumsVEG.h
|
||||||
retroshare/rspostedVEG.h \
|
|
||||||
services/p3postedVEG.h
|
|
||||||
|
|
||||||
# Do I need this?
|
# Do I need this?
|
||||||
#serialiser/rsphotoitemsVEG.h \
|
#serialiser/rsphotoitemsVEG.h \
|
||||||
|
|
||||||
SOURCES += services/p3gxsserviceVEG.cc \
|
SOURCES += services/p3gxsserviceVEG.cc \
|
||||||
services/p3wikiserviceVEG.cc \
|
services/p3wikiserviceVEG.cc \
|
||||||
services/p3wireVEG.cc \
|
services/p3wireVEG.cc \
|
||||||
services/p3idserviceVEG.cc \
|
services/p3forumsVEG.cc
|
||||||
services/p3forumsVEG.cc \
|
|
||||||
services/p3postedVEG.cc
|
|
||||||
|
|
||||||
# Do I need this?
|
# Do I need this?
|
||||||
# serialiser/rsphotoitemsVEG.cc \
|
# serialiser/rsphotoitemsVEG.cc \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
* RetroShare C++ Interface.
|
* RetroShare C++ Interface.
|
||||||
*
|
*
|
||||||
* Copyright 2008-2012 by Robert Fernie.
|
* 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
|
||||||
|
@ -33,10 +33,10 @@
|
||||||
#include "gxs/rstokenservice.h"
|
#include "gxs/rstokenservice.h"
|
||||||
#include "gxs/rsgxsifaceimpl.h"
|
#include "gxs/rsgxsifaceimpl.h"
|
||||||
|
|
||||||
/* The Main Interface Class - for information about your Peers */
|
class RsPosted;
|
||||||
class RsPostedVEG;
|
extern RsPosted *rsPosted;
|
||||||
extern RsPostedVEG *rsPostedVEG;
|
|
||||||
|
|
||||||
|
/* The Main Interface Class - for information about your Peers */
|
||||||
|
|
||||||
class RsPostedGroup
|
class RsPostedGroup
|
||||||
{
|
{
|
||||||
|
@ -45,19 +45,9 @@ class RsPostedGroup
|
||||||
RsPostedGroup() { return; }
|
RsPostedGroup() { return; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class RsPostedMsg
|
//#define RSPOSTED_MSGTYPE_POST 0x0001
|
||||||
{
|
//#define RSPOSTED_MSGTYPE_VOTE 0x0002
|
||||||
public:
|
//#define RSPOSTED_MSGTYPE_COMMENT 0x0004
|
||||||
RsPostedMsg(uint32_t t)
|
|
||||||
:postedType(t) { return; }
|
|
||||||
|
|
||||||
RsMsgMetaData mMeta;
|
|
||||||
uint32_t postedType;
|
|
||||||
};
|
|
||||||
|
|
||||||
#define RSPOSTED_MSGTYPE_POST 0x0001
|
|
||||||
#define RSPOSTED_MSGTYPE_VOTE 0x0002
|
|
||||||
#define RSPOSTED_MSGTYPE_COMMENT 0x0004
|
|
||||||
|
|
||||||
#define RSPOSTED_PERIOD_YEAR 1
|
#define RSPOSTED_PERIOD_YEAR 1
|
||||||
#define RSPOSTED_PERIOD_MONTH 2
|
#define RSPOSTED_PERIOD_MONTH 2
|
||||||
|
@ -70,44 +60,13 @@ class RsPostedMsg
|
||||||
#define RSPOSTED_VIEWMODE_HOT 3
|
#define RSPOSTED_VIEWMODE_HOT 3
|
||||||
#define RSPOSTED_VIEWMODE_COMMENTS 4
|
#define RSPOSTED_VIEWMODE_COMMENTS 4
|
||||||
|
|
||||||
|
class RsPostedPost;
|
||||||
|
class RsPostedComment;
|
||||||
|
class RsPostedVote;
|
||||||
|
|
||||||
class RsPostedPost: public RsPostedMsg
|
typedef std::map<RsGxsGroupId, std::vector<RsPostedPost> > PostedPostResult;
|
||||||
{
|
typedef std::map<RsGxsGroupId, std::vector<RsPostedComment> > PostedCommentResult;
|
||||||
public:
|
typedef std::map<RsGxsGroupId, std::vector<RsPostedVote> > PostedVoteResult;
|
||||||
RsPostedPost(): RsPostedMsg(RSPOSTED_MSGTYPE_POST)
|
|
||||||
{
|
|
||||||
mMeta.mMsgFlags = RSPOSTED_MSGTYPE_POST;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string mLink;
|
|
||||||
std::string mNotes;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class RsPostedVote: public RsPostedMsg
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
RsPostedVote(): RsPostedMsg(RSPOSTED_MSGTYPE_VOTE)
|
|
||||||
{
|
|
||||||
mMeta.mMsgFlags = RSPOSTED_MSGTYPE_VOTE;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class RsPostedComment: public RsPostedMsg
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
RsPostedComment(): RsPostedMsg(RSPOSTED_MSGTYPE_COMMENT)
|
|
||||||
{
|
|
||||||
mMeta.mMsgFlags = RSPOSTED_MSGTYPE_COMMENT;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string mComment;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
std::ostream &operator<<(std::ostream &out, const RsPostedGroup &group);
|
std::ostream &operator<<(std::ostream &out, const RsPostedGroup &group);
|
||||||
std::ostream &operator<<(std::ostream &out, const RsPostedPost &post);
|
std::ostream &operator<<(std::ostream &out, const RsPostedPost &post);
|
||||||
|
@ -119,15 +78,19 @@ class RsPosted : public RsGxsIfaceImpl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
static const uint32_t FLAG_MSGTYPE_POST;
|
||||||
|
static const uint32_t FLAG_MSGTYPE_VOTE;
|
||||||
|
static const uint32_t FLAG_MSGTYPE_COMMENT;
|
||||||
|
|
||||||
|
|
||||||
RsPosted(RsGenExchange* gxs) : RsGxsIfaceImpl(gxs) { return; }
|
RsPosted(RsGenExchange* gxs) : RsGxsIfaceImpl(gxs) { return; }
|
||||||
virtual ~RsPosted() { return; }
|
virtual ~RsPosted() { return; }
|
||||||
|
|
||||||
/* Specific Service Data */
|
/* Specific Service Data */
|
||||||
|
|
||||||
virtual RsTokenService* getToken() = 0;
|
virtual bool getGroup(const uint32_t &token, std::vector<RsPostedGroup> &group) = 0;
|
||||||
virtual bool getGroup(const uint32_t &token, RsPostedGroup &group) = 0;
|
virtual bool getPost(const uint32_t &token, PostedPostResult &post) = 0;
|
||||||
virtual bool getPost(const uint32_t &token, RsPostedPost &post) = 0;
|
virtual bool getComment(const uint32_t &token, PostedCommentResult &comment) = 0;
|
||||||
virtual bool getComment(const uint32_t &token, RsPostedComment &comment) = 0;
|
|
||||||
|
|
||||||
virtual bool submitGroup(uint32_t &token, RsPostedGroup &group) = 0;
|
virtual bool submitGroup(uint32_t &token, RsPostedGroup &group) = 0;
|
||||||
virtual bool submitPost(uint32_t &token, RsPostedPost &post) = 0;
|
virtual bool submitPost(uint32_t &token, RsPostedPost &post) = 0;
|
||||||
|
@ -136,20 +99,48 @@ virtual bool submitComment(uint32_t &token, RsPostedComment &comment) = 0;
|
||||||
|
|
||||||
// Special Ranking Request.
|
// Special Ranking Request.
|
||||||
virtual bool requestRanking(uint32_t &token, RsGxsGroupId groupId) = 0;
|
virtual bool requestRanking(uint32_t &token, RsGxsGroupId groupId) = 0;
|
||||||
virtual bool getRankedPost(const uint32_t &token, RsPostedPost &post) = 0;
|
|
||||||
|
|
||||||
virtual bool extractPostedCache() = 0;
|
|
||||||
|
|
||||||
|
|
||||||
// Control Ranking Calculations.
|
|
||||||
virtual bool setViewMode(uint32_t mode) = 0;
|
|
||||||
virtual bool setViewPeriod(uint32_t period) = 0;
|
|
||||||
virtual bool setViewRange(uint32_t first, uint32_t count) = 0;
|
|
||||||
|
|
||||||
// exposed for testing...
|
|
||||||
virtual float calcPostScore(uint32_t& token, const RsGxsMessageId) = 0;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class RsPostedPost
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RsPostedPost()
|
||||||
|
{
|
||||||
|
mMeta.mMsgFlags = RsPosted::FLAG_MSGTYPE_POST;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
RsMsgMetaData mMeta;
|
||||||
|
std::string mLink;
|
||||||
|
std::string mNotes;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class RsPostedVote
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RsPostedVote()
|
||||||
|
{
|
||||||
|
mMeta.mMsgFlags = RsPosted::FLAG_MSGTYPE_VOTE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
RsMsgMetaData mMeta;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class RsPostedComment
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RsPostedComment()
|
||||||
|
{
|
||||||
|
mMeta.mMsgFlags = RsPosted::FLAG_MSGTYPE_COMMENT;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string mComment;
|
||||||
|
RsMsgMetaData mMeta;
|
||||||
|
};
|
||||||
|
|
||||||
#endif // RSPOSTED_H
|
#endif // RSPOSTED_H
|
||||||
|
|
|
@ -1813,17 +1813,18 @@ RsTurtle *rsTurtle = NULL ;
|
||||||
|
|
||||||
#ifdef ENABLE_GXS_CORE
|
#ifdef ENABLE_GXS_CORE
|
||||||
#include "gxs/gxscoreserver.h"
|
#include "gxs/gxscoreserver.h"
|
||||||
#include "services/p3photoserviceV2.h"
|
|
||||||
#include "gxs/rsdataservice.h"
|
#include "gxs/rsdataservice.h"
|
||||||
#include "gxs/rsgxsnetservice.h"
|
#include "gxs/rsgxsnetservice.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_GXS_SERVICES
|
#ifdef ENABLE_GXS_SERVICES
|
||||||
|
#include "services/p3photoserviceV2.h"
|
||||||
|
#include "services/p3posted.h"
|
||||||
#include "services/p3wikiserviceVEG.h"
|
#include "services/p3wikiserviceVEG.h"
|
||||||
#include "services/p3wireVEG.h"
|
#include "services/p3wireVEG.h"
|
||||||
#include "services/p3idserviceVEG.h"
|
#include "services/p3idserviceVEG.h"
|
||||||
#include "services/p3forumsVEG.h"
|
#include "services/p3forumsVEG.h"
|
||||||
#include "services/p3postedVEG.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef PQI_DISABLE_TUNNEL
|
#ifndef PQI_DISABLE_TUNNEL
|
||||||
|
@ -2266,41 +2267,7 @@ int RsServer::StartupRetroShare()
|
||||||
mPluginsManager->registerClientServices(pqih) ;
|
mPluginsManager->registerClientServices(pqih) ;
|
||||||
mPluginsManager->registerCacheServices() ;
|
mPluginsManager->registerCacheServices() ;
|
||||||
|
|
||||||
#ifdef ENABLE_GXS_CORE
|
|
||||||
|
|
||||||
p3PhotoServiceV2 *mPhotoV2 = NULL;
|
|
||||||
|
|
||||||
// first prep the core
|
|
||||||
|
|
||||||
|
|
||||||
RsDirUtil::checkCreateDirectory(mLinkMgr->getOwnId());
|
|
||||||
RsGeneralDataService* photo_ds = new RsDataService("./" + mLinkMgr->getOwnId() + "/", "photoV2_db",
|
|
||||||
RS_SERVICE_GXSV1_TYPE_PHOTO, NULL);
|
|
||||||
|
|
||||||
photo_ds->resetDataStore();
|
|
||||||
|
|
||||||
// init gxs services
|
|
||||||
mPhotoV2 = new p3PhotoServiceV2(photo_ds, NULL);
|
|
||||||
|
|
||||||
// TODO need net manager
|
|
||||||
RsGxsNetService* photo_ns = new RsGxsNetService(
|
|
||||||
RS_SERVICE_GXSV1_TYPE_PHOTO, photo_ds, new RsNxsNetMgrImpl(mLinkMgr), mPhotoV2);
|
|
||||||
|
|
||||||
|
|
||||||
GxsCoreServer* mGxsCore = new GxsCoreServer();
|
|
||||||
mGxsCore->addService(mPhotoV2);
|
|
||||||
|
|
||||||
// cores read start up servers !
|
|
||||||
|
|
||||||
// start nxs core core server
|
|
||||||
createThread(*photo_ns);
|
|
||||||
|
|
||||||
// start up gxs core server
|
|
||||||
createThread(*mGxsCore);
|
|
||||||
|
|
||||||
pqih->addService(photo_ns);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENABLE_GXS_SERVICES
|
#ifdef ENABLE_GXS_SERVICES
|
||||||
|
|
||||||
|
@ -2316,11 +2283,68 @@ int RsServer::StartupRetroShare()
|
||||||
p3ForumsVEG *mForumsV2 = new p3ForumsVEG(RS_SERVICE_GXSV1_TYPE_FORUMS);
|
p3ForumsVEG *mForumsV2 = new p3ForumsVEG(RS_SERVICE_GXSV1_TYPE_FORUMS);
|
||||||
pqih -> addService(mForumsV2);
|
pqih -> addService(mForumsV2);
|
||||||
|
|
||||||
// Testing New Cache Services.
|
|
||||||
p3PostedServiceVEG *mPosted = new p3PostedServiceVEG(RS_SERVICE_GXSV1_TYPE_POSTED);
|
// TODO: temporary to store GXS service data, remove
|
||||||
pqih -> addService(mPosted);
|
RsDirUtil::checkCreateDirectory(mLinkMgr->getOwnId());
|
||||||
|
|
||||||
|
RsNxsNetMgr* nxsMgr = new RsNxsNetMgrImpl(mLinkMgr);
|
||||||
|
|
||||||
|
/**** Photo service ****/
|
||||||
|
|
||||||
|
p3PhotoServiceV2 *mPhotoV2 = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
RsGeneralDataService* photo_ds = new RsDataService("./" + mLinkMgr->getOwnId() + "/", "photoV2_db",
|
||||||
|
RS_SERVICE_GXSV1_TYPE_PHOTO, NULL);
|
||||||
|
|
||||||
|
photo_ds->resetDataStore(); //TODO: remove, new service data per RS session, for testing
|
||||||
|
|
||||||
|
// init gxs services
|
||||||
|
mPhotoV2 = new p3PhotoServiceV2(photo_ds, NULL);
|
||||||
|
|
||||||
|
// create GXS photo service
|
||||||
|
RsGxsNetService* photo_ns = new RsGxsNetService(
|
||||||
|
RS_SERVICE_GXSV1_TYPE_PHOTO, photo_ds, nxsMgr, mPhotoV2);
|
||||||
|
|
||||||
|
/**** Posted GXS service ****/
|
||||||
|
|
||||||
|
p3Posted *mPosted = NULL;
|
||||||
|
|
||||||
|
RsGeneralDataService* posted_ds = new RsDataService("./" + mLinkMgr->getOwnId()+ "/", "posted_db",
|
||||||
|
RS_SERVICE_GXSV1_TYPE_POSTED);
|
||||||
|
|
||||||
|
posted_ds->resetDataStore(); //TODO: remove, new service data per RS session, for testing
|
||||||
|
|
||||||
|
mPosted = new p3Posted(posted_ds, NULL);
|
||||||
|
|
||||||
|
// create GXS photo service
|
||||||
|
RsGxsNetService* posted_ns = new RsGxsNetService(
|
||||||
|
RS_SERVICE_GXSV1_TYPE_POSTED, posted_ds, nxsMgr, mPosted);
|
||||||
|
|
||||||
|
|
||||||
#endif // ENABLE_GXS_SERVICES
|
#endif // ENABLE_GXS_SERVICES
|
||||||
|
|
||||||
|
#ifdef ENABLE_GXS_CORE
|
||||||
|
|
||||||
|
/*** start up GXS core runner ***/
|
||||||
|
|
||||||
|
GxsCoreServer* mGxsCore = new GxsCoreServer();
|
||||||
|
mGxsCore->addService(mPhotoV2);
|
||||||
|
mGxsCore->addService(mPosted);
|
||||||
|
|
||||||
|
// cores ready start up GXS net servers
|
||||||
|
createThread(*photo_ns);
|
||||||
|
createThread(*posted_ns);
|
||||||
|
|
||||||
|
// now add to p3service
|
||||||
|
pqih->addService(photo_ns);
|
||||||
|
pqih->addService(posted_ns);
|
||||||
|
|
||||||
|
// start up gxs core server
|
||||||
|
createThread(*mGxsCore);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifndef RS_RELEASE
|
#ifndef RS_RELEASE
|
||||||
p3GameLauncher *gameLauncher = new p3GameLauncher(mLinkMgr);
|
p3GameLauncher *gameLauncher = new p3GameLauncher(mLinkMgr);
|
||||||
|
@ -2578,14 +2602,15 @@ int RsServer::StartupRetroShare()
|
||||||
rsForums = mForums;
|
rsForums = mForums;
|
||||||
rsChannels = mChannels;
|
rsChannels = mChannels;
|
||||||
|
|
||||||
rsPhotoV2 = mPhotoV2;
|
|
||||||
#ifdef ENABLE_GXS_SERVICES
|
#ifdef ENABLE_GXS_SERVICES
|
||||||
// Testing of new cache system interfaces.
|
// Testing of new cache system interfaces.
|
||||||
|
|
||||||
rsWikiVEG = mWikis;
|
rsWikiVEG = mWikis;
|
||||||
rsWireVEG = mWire;
|
rsWireVEG = mWire;
|
||||||
rsForumsVEG = mForumsV2;
|
rsForumsVEG = mForumsV2;
|
||||||
rsPostedVEG = mPosted;
|
rsPosted = mPosted;
|
||||||
|
rsPhotoV2 = mPhotoV2;
|
||||||
|
|
||||||
#endif // ENABLE_GXS_SERVICES
|
#endif // ENABLE_GXS_SERVICES
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ class RsGxsMsgMetaData;
|
||||||
|
|
||||||
class RsGroupMetaData
|
class RsGroupMetaData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
RsGroupMetaData()
|
RsGroupMetaData()
|
||||||
{
|
{
|
||||||
|
@ -79,7 +79,8 @@ class RsGroupMetaData
|
||||||
|
|
||||||
class RsMsgMetaData
|
class RsMsgMetaData
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
|
public:
|
||||||
|
|
||||||
RsMsgMetaData()
|
RsMsgMetaData()
|
||||||
{
|
{
|
||||||
|
@ -104,11 +105,15 @@ class RsMsgMetaData
|
||||||
std::string mMsgName;
|
std::string mMsgName;
|
||||||
time_t mPublishTs;
|
time_t mPublishTs;
|
||||||
|
|
||||||
uint32_t mMsgFlags; // Whats this for?
|
/// the first 16 bits for service, last 16 for GXS
|
||||||
|
uint32_t mMsgFlags;
|
||||||
|
|
||||||
// BELOW HERE IS LOCAL DATA, THAT IS NOT FROM MSG.
|
// BELOW HERE IS LOCAL DATA, THAT IS NOT FROM MSG.
|
||||||
// normally READ / UNREAD flags. LOCAL Data.
|
// normally READ / UNREAD flags. LOCAL Data.
|
||||||
|
|
||||||
|
/// the first 16 bits for service, last 16 for GXS
|
||||||
uint32_t mMsgStatus;
|
uint32_t mMsgStatus;
|
||||||
|
|
||||||
time_t mChildTs;
|
time_t mChildTs;
|
||||||
std::string mServiceString; // Service Specific Free-Form extra storage.
|
std::string mServiceString; // Service Specific Free-Form extra storage.
|
||||||
|
|
||||||
|
|
|
@ -1445,23 +1445,23 @@ bool p3GxsDataServiceVEG::fakeprocessrequests()
|
||||||
|
|
||||||
#if 0 // DISABLED AND MOVED TO GXS CODE.
|
#if 0 // DISABLED AND MOVED TO GXS CODE.
|
||||||
|
|
||||||
std::ostream &operator<<(std::ostream &out, const RsGroupMetaData &meta)
|
//std::ostream &operator<<(std::ostream &out, const RsGroupMetaData &meta)
|
||||||
{
|
//{
|
||||||
out << "[ GroupId: " << meta.mGroupId << " Name: " << meta.mGroupName << " ]";
|
// out << "[ GroupId: " << meta.mGroupId << " Name: " << meta.mGroupName << " ]";
|
||||||
return out;
|
// return out;
|
||||||
}
|
//}
|
||||||
|
|
||||||
std::ostream &operator<<(std::ostream &out, const RsMsgMetaData &meta)
|
//std::ostream &operator<<(std::ostream &out, const RsMsgMetaData &meta)
|
||||||
{
|
//{
|
||||||
out << "[ GroupId: " << meta.mGroupId << " MsgId: " << meta.mMsgId;
|
// out << "[ GroupId: " << meta.mGroupId << " MsgId: " << meta.mMsgId;
|
||||||
out << " Name: " << meta.mMsgName;
|
// out << " Name: " << meta.mMsgName;
|
||||||
out << " OrigMsgId: " << meta.mOrigMsgId;
|
// out << " OrigMsgId: " << meta.mOrigMsgId;
|
||||||
out << " ThreadId: " << meta.mThreadId;
|
// out << " ThreadId: " << meta.mThreadId;
|
||||||
out << " ParentId: " << meta.mParentId;
|
// out << " ParentId: " << meta.mParentId;
|
||||||
out << " AuthorId: " << meta.mAuthorId;
|
// out << " AuthorId: " << meta.mAuthorId;
|
||||||
out << " Name: " << meta.mMsgName << " ]";
|
// out << " Name: " << meta.mMsgName << " ]";
|
||||||
return out;
|
// return out;
|
||||||
}
|
//}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -499,7 +499,7 @@ bool p3IdService::cache_start_load()
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t ansType = RS_TOKREQ_ANSTYPE_DATA;
|
uint32_t ansType = RS_TOKREQ_ANSTYPE_DATA;
|
||||||
RsTokReqOptionsV2 opts;
|
RsTokReqOptions opts;
|
||||||
uint32_t token = 0;
|
uint32_t token = 0;
|
||||||
|
|
||||||
RsGenExchange::getTokenService()->requestGroupInfo(token, ansType, opts, groupIds);
|
RsGenExchange::getTokenService()->requestGroupInfo(token, ansType, opts, groupIds);
|
||||||
|
@ -971,7 +971,7 @@ bool p3IdService::background_requestGroups()
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY;
|
uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY;
|
||||||
RsTokReqOptionsV2 opts;
|
RsTokReqOptions opts;
|
||||||
std::list<std::string> groupIds;
|
std::list<std::string> groupIds;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1034,7 +1034,7 @@ bool p3IdService::background_requestNewMessages()
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY;
|
uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY;
|
||||||
RsTokReqOptionsV2 opts;
|
RsTokReqOptions opts;
|
||||||
token = 0;
|
token = 0;
|
||||||
|
|
||||||
/* TODO
|
/* TODO
|
||||||
|
@ -1319,7 +1319,7 @@ bool p3IdService::background_FullCalcRequest()
|
||||||
/* request the summary info from the parents */
|
/* request the summary info from the parents */
|
||||||
uint32_t ansType = RS_TOKREQ_ANSTYPE_DATA;
|
uint32_t ansType = RS_TOKREQ_ANSTYPE_DATA;
|
||||||
uint32_t token = 0;
|
uint32_t token = 0;
|
||||||
RsTokReqOptionsV2 opts;
|
RsTokReqOptions opts;
|
||||||
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
|
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
|
||||||
|
|
||||||
RsGenExchange::getTokenService()->requestMsgInfo(token, ansType, opts, groupIds);
|
RsGenExchange::getTokenService()->requestMsgInfo(token, ansType, opts, groupIds);
|
||||||
|
|
|
@ -1,4 +1,11 @@
|
||||||
#include "p3posted.h"
|
#include "p3posted.h"
|
||||||
|
#include "serialiser/rsposteditems.h"
|
||||||
|
|
||||||
|
const uint32_t RsPosted::FLAG_MSGTYPE_COMMENT = 0x0001;
|
||||||
|
const uint32_t RsPosted::FLAG_MSGTYPE_POST = 0x0002;
|
||||||
|
const uint32_t RsPosted::FLAG_MSGTYPE_VOTE = 0x0004;
|
||||||
|
|
||||||
|
RsPosted *rsPosted = NULL;
|
||||||
|
|
||||||
p3Posted::p3Posted(RsGeneralDataService *gds, RsNetworkExchangeService *nes)
|
p3Posted::p3Posted(RsGeneralDataService *gds, RsNetworkExchangeService *nes)
|
||||||
: RsGenExchange(gds, nes, NULL, RS_SERVICE_GXSV1_TYPE_POSTED), RsPosted(this)
|
: RsGenExchange(gds, nes, NULL, RS_SERVICE_GXSV1_TYPE_POSTED), RsPosted(this)
|
||||||
|
@ -10,39 +17,147 @@ void p3Posted::notifyChanges(std::vector<RsGxsNotify *> &changes)
|
||||||
receiveChanges(changes);
|
receiveChanges(changes);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3Posted::getGroup(const uint32_t &token, RsPostedGroup &group)
|
void p3Posted::service_tick()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3Posted::getPost(const uint32_t &token, RsPostedPost &post)
|
bool p3Posted::getGroup(const uint32_t &token, std::vector<RsPostedGroup> &groups)
|
||||||
{
|
{
|
||||||
|
std::vector<RsGxsGrpItem*> grpData;
|
||||||
|
bool ok = RsGenExchange::getGroupData(token, grpData);
|
||||||
|
|
||||||
|
if(ok)
|
||||||
|
{
|
||||||
|
std::vector<RsGxsGrpItem*>::iterator vit = grpData.begin();
|
||||||
|
|
||||||
|
for(; vit != grpData.end(); vit++)
|
||||||
|
{
|
||||||
|
RsGxsPostedGroupItem* item = dynamic_cast<RsGxsPostedGroupItem*>(*vit);
|
||||||
|
RsPostedGroup grp = item->mGroup;
|
||||||
|
item->mGroup.mMeta = item->meta;
|
||||||
|
grp.mMeta = item->mGroup.mMeta;
|
||||||
|
delete item;
|
||||||
|
groups.push_back(grp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3Posted::getComment(const uint32_t &token, RsPostedComment &comment)
|
bool p3Posted::getPost(const uint32_t &token, PostedPostResult &posts)
|
||||||
{
|
{
|
||||||
|
GxsMsgDataMap msgData;
|
||||||
|
bool ok = RsGenExchange::getMsgData(token, msgData);
|
||||||
|
|
||||||
|
if(ok)
|
||||||
|
{
|
||||||
|
GxsMsgDataMap::iterator mit = msgData.begin();
|
||||||
|
|
||||||
|
for(; mit != msgData.end(); mit++)
|
||||||
|
{
|
||||||
|
RsGxsGroupId grpId = mit->first;
|
||||||
|
std::vector<RsGxsMsgItem*>& msgItems = mit->second;
|
||||||
|
std::vector<RsGxsMsgItem*>::iterator vit = msgItems.begin();
|
||||||
|
|
||||||
|
for(; vit != msgItems.end(); vit++)
|
||||||
|
{
|
||||||
|
RsGxsPostedPostItem* item = dynamic_cast<RsGxsPostedPostItem*>(*vit);
|
||||||
|
|
||||||
|
if(item)
|
||||||
|
{
|
||||||
|
RsPostedPost post = item->mPost;
|
||||||
|
post.mMeta = item->meta;
|
||||||
|
posts[grpId].push_back(post);
|
||||||
|
delete item;
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
std::cerr << "Not a post Item, deleting!" << std::endl;
|
||||||
|
delete *vit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool p3Posted::getComment(const uint32_t &token, PostedCommentResult &comments)
|
||||||
|
{
|
||||||
|
GxsMsgDataMap msgData;
|
||||||
|
bool ok = RsGenExchange::getMsgData(token, msgData);
|
||||||
|
|
||||||
|
if(ok)
|
||||||
|
{
|
||||||
|
GxsMsgDataMap::iterator mit = msgData.begin();
|
||||||
|
|
||||||
|
for(; mit != msgData.end(); mit++)
|
||||||
|
{
|
||||||
|
RsGxsGroupId grpId = mit->first;
|
||||||
|
std::vector<RsGxsMsgItem*>& msgItems = mit->second;
|
||||||
|
std::vector<RsGxsMsgItem*>::iterator vit = msgItems.begin();
|
||||||
|
|
||||||
|
for(; vit != msgItems.end(); vit++)
|
||||||
|
{
|
||||||
|
RsGxsPostedCommentItem* item = dynamic_cast<RsGxsPostedCommentItem*>(*vit);
|
||||||
|
|
||||||
|
if(item)
|
||||||
|
{
|
||||||
|
RsPostedComment comment = item->mComment;
|
||||||
|
comment.mMeta = item->meta;
|
||||||
|
comments[grpId].push_back(comment);
|
||||||
|
delete item;
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
std::cerr << "Not a comment Item, deleting!" << std::endl;
|
||||||
|
delete *vit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3Posted::submitGroup(uint32_t &token, RsPostedGroup &group)
|
bool p3Posted::submitGroup(uint32_t &token, RsPostedGroup &group)
|
||||||
{
|
{
|
||||||
|
RsGxsPostedGroupItem* grpItem = new RsGxsPostedGroupItem();
|
||||||
|
grpItem->mGroup = group;
|
||||||
|
grpItem->meta = group.mMeta;
|
||||||
|
RsGenExchange::publishGroup(token, grpItem);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3Posted::submitPost(uint32_t &token, RsPostedPost &post)
|
bool p3Posted::submitPost(uint32_t &token, RsPostedPost &post)
|
||||||
{
|
{
|
||||||
|
RsGxsPostedPostItem* postItem = new RsGxsPostedPostItem();
|
||||||
|
postItem->mPost = post;
|
||||||
|
postItem->meta = post.mMeta;
|
||||||
|
postItem->meta.mMsgFlags |= FLAG_MSGTYPE_POST;
|
||||||
|
|
||||||
|
RsGenExchange::publishMsg(token, postItem);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3Posted::submitVote(uint32_t &token, RsPostedVote &vote)
|
bool p3Posted::submitVote(uint32_t &token, RsPostedVote &vote)
|
||||||
{
|
{
|
||||||
|
RsGxsPostedVoteItem* voteItem = new RsGxsPostedVoteItem();
|
||||||
|
voteItem->mVote = vote;
|
||||||
|
voteItem->meta = vote.mMeta;
|
||||||
|
voteItem->meta.mMsgFlags |= FLAG_MSGTYPE_POST;
|
||||||
|
|
||||||
|
RsGenExchange::publishMsg(token, voteItem);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3Posted::submitComment(uint32_t &token, RsPostedComment &comment)
|
bool p3Posted::submitComment(uint32_t &token, RsPostedComment &comment)
|
||||||
{
|
{
|
||||||
|
RsGxsPostedCommentItem* commentItem = new RsGxsPostedCommentItem();
|
||||||
|
commentItem->mComment = comment;
|
||||||
|
commentItem->meta = comment.mMeta;
|
||||||
|
commentItem->meta.mMsgFlags |= FLAG_MSGTYPE_COMMENT;
|
||||||
|
|
||||||
|
RsGenExchange::publishMsg(token, commentItem);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Special Ranking Request.
|
// Special Ranking Request.
|
||||||
|
@ -50,36 +165,3 @@ bool p3Posted::requestRanking(uint32_t &token, RsGxsGroupId groupId)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3Posted::getRankedPost(const uint32_t &token, RsPostedPost &post)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
bool p3Posted::extractPostedCache()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Control Ranking Calculations.
|
|
||||||
bool p3Posted::setViewMode(uint32_t mode)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
bool p3Posted::setViewPeriod(uint32_t period)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
bool p3Posted::setViewRange(uint32_t first, uint32_t count)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// exposed for testing...
|
|
||||||
float p3Posted::calcPostScore(uint32_t& token, const RsGxsMessageId)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -22,11 +22,13 @@ protected:
|
||||||
*/
|
*/
|
||||||
void notifyChanges(std::vector<RsGxsNotify*>& changes) ;
|
void notifyChanges(std::vector<RsGxsNotify*>& changes) ;
|
||||||
|
|
||||||
|
void service_tick();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
bool getGroup(const uint32_t &token, RsPostedGroup &group);
|
bool getGroup(const uint32_t &token, std::vector<RsPostedGroup> &group);
|
||||||
bool getPost(const uint32_t &token, RsPostedPost &post) ;
|
bool getPost(const uint32_t &token, PostedPostResult& posts) ;
|
||||||
bool getComment(const uint32_t &token, RsPostedComment &comment) ;
|
bool getComment(const uint32_t &token, PostedCommentResult& comments) ;
|
||||||
|
|
||||||
bool submitGroup(uint32_t &token, RsPostedGroup &group);
|
bool submitGroup(uint32_t &token, RsPostedGroup &group);
|
||||||
bool submitPost(uint32_t &token, RsPostedPost &post);
|
bool submitPost(uint32_t &token, RsPostedPost &post);
|
||||||
|
@ -35,18 +37,12 @@ public:
|
||||||
|
|
||||||
// Special Ranking Request.
|
// Special Ranking Request.
|
||||||
bool requestRanking(uint32_t &token, RsGxsGroupId groupId) ;
|
bool requestRanking(uint32_t &token, RsGxsGroupId groupId) ;
|
||||||
bool getRankedPost(const uint32_t &token, RsPostedPost &post) ;
|
|
||||||
|
|
||||||
bool extractPostedCache() ;
|
|
||||||
|
|
||||||
|
|
||||||
// Control Ranking Calculations.
|
// Control Ranking Calculations.
|
||||||
bool setViewMode(uint32_t mode);
|
// bool setViewMode(uint32_t mode);
|
||||||
bool setViewPeriod(uint32_t period);
|
// bool setViewPeriod(uint32_t period);
|
||||||
bool setViewRange(uint32_t first, uint32_t count);
|
// bool setViewRange(uint32_t first, uint32_t count);
|
||||||
|
|
||||||
// exposed for testing...
|
|
||||||
float calcPostScore(uint32_t& token, const RsGxsMessageId);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // P3POSTED_H
|
#endif // P3POSTED_H
|
||||||
|
|
|
@ -125,12 +125,12 @@ win32 {
|
||||||
|
|
||||||
OBJECTS_DIR = temp/obj
|
OBJECTS_DIR = temp/obj
|
||||||
|
|
||||||
PRE_TARGETDEPS += ../../libretroshare/src/lib/libretroshare.a
|
#PRE_TARGETDEPS += ../../libretroshare/src/lib/libretroshare.a
|
||||||
#PRE_TARGETDEPS += ../../libretroshare/libretroshare-build-desktop/lib/libretroshare.a
|
PRE_TARGETDEPS += ../../libretroshare/libretroshare-build-desktop/lib/libretroshare.a
|
||||||
|
LIBS += ../../libretroshare/libretroshare-build-desktop/lib/libretroshare.a
|
||||||
|
|
||||||
LIBS += ../../libretroshare/src/lib/libretroshare.a
|
LIBS += C:\Development\Rs\v0.5-gxs-b1\openpgpsdk\openpgpsdk-build-desktop\lib\libops.a
|
||||||
LIBS += ../../openpgpsdk/src/lib/libops.a
|
LIBS += C:\Development\Libraries\sqlite\sqlite-autoconf-3070900\.libs\libsqlite3.a
|
||||||
LIBS += ../../../sqlite-autoconf-3070900/.libs/libsqlite3.a
|
|
||||||
LIBS += -L"../../../lib"
|
LIBS += -L"../../../lib"
|
||||||
LIBS += -lssl -lcrypto -lpthreadGC2d -lminiupnpc -lz -lbz2
|
LIBS += -lssl -lcrypto -lpthreadGC2d -lminiupnpc -lz -lbz2
|
||||||
# added after bitdht
|
# added after bitdht
|
||||||
|
@ -194,15 +194,15 @@ freebsd-* {
|
||||||
# ###########################################
|
# ###########################################
|
||||||
|
|
||||||
bitdht {
|
bitdht {
|
||||||
LIBS += ../../libbitdht/src/lib/libbitdht.a
|
#LIBS += ../../libbitdht/src/lib/libbitdht.a
|
||||||
PRE_TARGETDEPS *= ../../libbitdht/src/lib/libbitdht.a
|
#PRE_TARGETDEPS *= ../../libbitdht/src/lib/libbitdht.a
|
||||||
|
|
||||||
#LIBS += C:\Development\Rs\v0.5-gxs-b1\libbitdht\libbitdht-build-desktop\lib\libbitdht.a
|
#LIBS += C:\Development\Rs\v0.5-gxs-b1\libbitdht\libbitdht-build-desktop\lib\libbitdht.a
|
||||||
#PRE_TARGETDEPS *= C:\Development\Rs\v0.5-gxs-b1\libbitdht\libbitdht-build-desktop\lib\libbitdht.a
|
#PRE_TARGETDEPS *= C:\Development\Rs\v0.5-gxs-b1\libbitdht\libbitdht-build-desktop\lib\libbitdht.a
|
||||||
|
|
||||||
# Chris version.
|
# Chris version.
|
||||||
#LIBS += ../../libbitdht/libbitdht-build-desktop/lib/libbitdht.a
|
LIBS += ../../libbitdht/libbitdht-build-desktop/lib/libbitdht.a
|
||||||
#PRE_TARGETDEPS *= ../../libbitdht/libbitdht-build-desktop/lib/libbitdht.a
|
PRE_TARGETDEPS *= ../../libbitdht/libbitdht-build-desktop/lib/libbitdht.a
|
||||||
}
|
}
|
||||||
|
|
||||||
win32 {
|
win32 {
|
||||||
|
@ -871,7 +871,7 @@ photoshare {
|
||||||
gui/PhotoShare/AlbumItem.h \
|
gui/PhotoShare/AlbumItem.h \
|
||||||
gui/PhotoShare/AlbumDialog.h \
|
gui/PhotoShare/AlbumDialog.h \
|
||||||
gui/PhotoShare/AlbumCreateDialog.h \
|
gui/PhotoShare/AlbumCreateDialog.h \
|
||||||
util/TokenQueueV2.h \
|
util/TokenQueue.h \
|
||||||
gui/PhotoShare/PhotoItem.h \
|
gui/PhotoShare/PhotoItem.h \
|
||||||
gui/PhotoShare/PhotoShareItemHolder.h \
|
gui/PhotoShare/PhotoShareItemHolder.h \
|
||||||
gui/PhotoShare/PhotoShare.h \
|
gui/PhotoShare/PhotoShare.h \
|
||||||
|
@ -898,7 +898,7 @@ photoshare {
|
||||||
gui/PhotoShare/AlbumItem.cpp \
|
gui/PhotoShare/AlbumItem.cpp \
|
||||||
gui/PhotoShare/AlbumDialog.cpp \
|
gui/PhotoShare/AlbumDialog.cpp \
|
||||||
gui/PhotoShare/AlbumCreateDialog.cpp \
|
gui/PhotoShare/AlbumCreateDialog.cpp \
|
||||||
util/TokenQueueV2.cpp \
|
util/TokenQueue.cpp \
|
||||||
gui/PhotoShare/PhotoShareItemHolder.cpp \
|
gui/PhotoShare/PhotoShareItemHolder.cpp \
|
||||||
gui/PhotoShare/PhotoShare.cpp \
|
gui/PhotoShare/PhotoShare.cpp \
|
||||||
gui/PhotoShare/PhotoSlideShow.cpp \
|
gui/PhotoShare/PhotoSlideShow.cpp \
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
#include "util/misc.h"
|
#include "util/misc.h"
|
||||||
|
|
||||||
AlbumCreateDialog::AlbumCreateDialog(TokenQueueV2 *photoQueue, RsPhotoV2 *rs_photo, QWidget *parent):
|
AlbumCreateDialog::AlbumCreateDialog(TokenQueue *photoQueue, RsPhotoV2 *rs_photo, QWidget *parent):
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::AlbumCreateDialog), mPhotoQueue(photoQueue), mRsPhoto(rs_photo)
|
ui(new Ui::AlbumCreateDialog), mPhotoQueue(photoQueue), mRsPhoto(rs_photo)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#define ALBUMCREATEDIALOG_H
|
#define ALBUMCREATEDIALOG_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include "util/TokenQueueV2.h"
|
#include "util/TokenQueue.h"
|
||||||
#include "retroshare/rsphotoV2.h"
|
#include "retroshare/rsphotoV2.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
|
@ -15,7 +15,7 @@ class AlbumCreateDialog : public QDialog
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AlbumCreateDialog(TokenQueueV2* photoQueue, RsPhotoV2* rs_photo, QWidget *parent = 0);
|
explicit AlbumCreateDialog(TokenQueue* photoQueue, RsPhotoV2* rs_photo, QWidget *parent = 0);
|
||||||
~AlbumCreateDialog();
|
~AlbumCreateDialog();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -28,7 +28,7 @@ private:
|
||||||
private:
|
private:
|
||||||
Ui::AlbumCreateDialog *ui;
|
Ui::AlbumCreateDialog *ui;
|
||||||
|
|
||||||
TokenQueueV2* mPhotoQueue;
|
TokenQueue* mPhotoQueue;
|
||||||
RsPhotoV2* mRsPhoto;
|
RsPhotoV2* mRsPhoto;
|
||||||
QPixmap mThumbNail;
|
QPixmap mThumbNail;
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include "AlbumDialog.h"
|
#include "AlbumDialog.h"
|
||||||
#include "ui_AlbumDialog.h"
|
#include "ui_AlbumDialog.h"
|
||||||
|
|
||||||
AlbumDialog::AlbumDialog(const RsPhotoAlbum& album, TokenQueueV2* photoQueue, RsPhotoV2* rs_Photo, QWidget *parent) :
|
AlbumDialog::AlbumDialog(const RsPhotoAlbum& album, TokenQueue* photoQueue, RsPhotoV2* rs_Photo, QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
ui(new Ui::AlbumDialog), mPhotoQueue(photoQueue), mRsPhoto(rs_Photo), mAlbum(album), mPhotoSelected(NULL)
|
ui(new Ui::AlbumDialog), mPhotoQueue(photoQueue), mRsPhoto(rs_Photo), mAlbum(album), mPhotoSelected(NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include "retroshare/rsphotoV2.h"
|
#include "retroshare/rsphotoV2.h"
|
||||||
#include "util/TokenQueueV2.h"
|
#include "util/TokenQueue.h"
|
||||||
#include "PhotoShareItemHolder.h"
|
#include "PhotoShareItemHolder.h"
|
||||||
#include "PhotoItem.h"
|
#include "PhotoItem.h"
|
||||||
#include "PhotoDrop.h"
|
#include "PhotoDrop.h"
|
||||||
|
@ -17,7 +17,7 @@ class AlbumDialog : public QWidget, public PhotoShareItemHolder
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AlbumDialog(const RsPhotoAlbum& album, TokenQueueV2* photoQueue, RsPhotoV2* rs_Photo, QWidget *parent = 0);
|
explicit AlbumDialog(const RsPhotoAlbum& album, TokenQueue* photoQueue, RsPhotoV2* rs_Photo, QWidget *parent = 0);
|
||||||
~AlbumDialog();
|
~AlbumDialog();
|
||||||
|
|
||||||
void notifySelection(PhotoShareItem* selection);
|
void notifySelection(PhotoShareItem* selection);
|
||||||
|
@ -34,7 +34,7 @@ private slots:
|
||||||
private:
|
private:
|
||||||
Ui::AlbumDialog *ui;
|
Ui::AlbumDialog *ui;
|
||||||
RsPhotoV2* mRsPhoto;
|
RsPhotoV2* mRsPhoto;
|
||||||
TokenQueueV2* mPhotoQueue;
|
TokenQueue* mPhotoQueue;
|
||||||
RsPhotoAlbum mAlbum;
|
RsPhotoAlbum mAlbum;
|
||||||
PhotoDrop* mPhotoDrop;
|
PhotoDrop* mPhotoDrop;
|
||||||
PhotoItem* mPhotoSelected;
|
PhotoItem* mPhotoSelected;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
PhotoDialog::PhotoDialog(RsPhotoV2 *rs_photo, const RsPhotoPhoto &photo, QWidget *parent) :
|
PhotoDialog::PhotoDialog(RsPhotoV2 *rs_photo, const RsPhotoPhoto &photo, QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::PhotoDialog), mRsPhoto(rs_photo), mPhotoQueue(new TokenQueueV2(mRsPhoto->getTokenService(), this)),
|
ui(new Ui::PhotoDialog), mRsPhoto(rs_photo), mPhotoQueue(new TokenQueue(mRsPhoto->getTokenService(), this)),
|
||||||
mPhotoDetails(photo), mCommentDialog(NULL)
|
mPhotoDetails(photo), mCommentDialog(NULL)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -75,7 +75,7 @@ void PhotoDialog::resetComments()
|
||||||
|
|
||||||
void PhotoDialog::requestComments()
|
void PhotoDialog::requestComments()
|
||||||
{
|
{
|
||||||
RsTokReqOptionsV2 opts;
|
RsTokReqOptions opts;
|
||||||
opts.mMsgFlagMask = RsPhotoV2::FLAG_MSG_TYPE_MASK;
|
opts.mMsgFlagMask = RsPhotoV2::FLAG_MSG_TYPE_MASK;
|
||||||
opts.mMsgFlagFilter = RsPhotoV2::FLAG_MSG_TYPE_PHOTO_COMMENT;
|
opts.mMsgFlagFilter = RsPhotoV2::FLAG_MSG_TYPE_PHOTO_COMMENT;
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ void PhotoDialog::createComment()
|
||||||
|
|
||||||
/*************** message loading **********************/
|
/*************** message loading **********************/
|
||||||
|
|
||||||
void PhotoDialog::loadRequest(const TokenQueueV2 *queue, const TokenRequestV2 &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;
|
||||||
|
@ -177,7 +177,7 @@ void PhotoDialog::loadList(uint32_t token)
|
||||||
{
|
{
|
||||||
GxsMsgReq msgIds;
|
GxsMsgReq msgIds;
|
||||||
mRsPhoto->getMsgList(token, msgIds);
|
mRsPhoto->getMsgList(token, msgIds);
|
||||||
RsTokReqOptionsV2 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;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
#include "retroshare/rsphotoV2.h"
|
#include "retroshare/rsphotoV2.h"
|
||||||
#include "util/TokenQueueV2.h"
|
#include "util/TokenQueue.h"
|
||||||
#include "PhotoCommentItem.h"
|
#include "PhotoCommentItem.h"
|
||||||
#include "AddCommentDialog.h"
|
#include "AddCommentDialog.h"
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ namespace Ui {
|
||||||
class PhotoDialog;
|
class PhotoDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
class PhotoDialog : public QDialog, public TokenResponseV2
|
class PhotoDialog : public QDialog, public TokenResponse
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ private slots:
|
||||||
void createComment();
|
void createComment();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void loadRequest(const TokenQueueV2 *queue, const TokenRequestV2 &req);
|
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||||
private:
|
private:
|
||||||
void setUp();
|
void setUp();
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ private:
|
||||||
Ui::PhotoDialog *ui;
|
Ui::PhotoDialog *ui;
|
||||||
|
|
||||||
RsPhotoV2* mRsPhoto;
|
RsPhotoV2* mRsPhoto;
|
||||||
TokenQueueV2* mPhotoQueue;
|
TokenQueue* mPhotoQueue;
|
||||||
RsPhotoPhoto mPhotoDetails;
|
RsPhotoPhoto mPhotoDetails;
|
||||||
QSet<PhotoCommentItem*> mComments;
|
QSet<PhotoCommentItem*> mComments;
|
||||||
AddCommentDialog* mCommentDialog;
|
AddCommentDialog* mCommentDialog;
|
||||||
|
|
|
@ -96,7 +96,7 @@ PhotoShare::PhotoShare(QWidget *parent)
|
||||||
timer->start(1000);
|
timer->start(1000);
|
||||||
|
|
||||||
/* setup TokenQueue */
|
/* setup TokenQueue */
|
||||||
mPhotoQueue = new TokenQueueV2(rsPhotoV2->getTokenService(), this);
|
mPhotoQueue = new TokenQueue(rsPhotoV2->getTokenService(), this);
|
||||||
requestAlbumData();
|
requestAlbumData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ void PhotoShare::checkUpdate()
|
||||||
rsPhotoV2->groupsChanged(grpIds);
|
rsPhotoV2->groupsChanged(grpIds);
|
||||||
if(!grpIds.empty())
|
if(!grpIds.empty())
|
||||||
{
|
{
|
||||||
RsTokReqOptionsV2 opts;
|
RsTokReqOptions opts;
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
||||||
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds, 0);
|
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds, 0);
|
||||||
|
@ -490,7 +490,7 @@ void PhotoShare::updatePhotos()
|
||||||
|
|
||||||
void PhotoShare::requestAlbumList(std::list<std::string>& ids)
|
void PhotoShare::requestAlbumList(std::list<std::string>& ids)
|
||||||
{
|
{
|
||||||
RsTokReqOptionsV2 opts;
|
RsTokReqOptions opts;
|
||||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_IDS;
|
opts.mReqType = GXS_REQUEST_TYPE_GROUP_IDS;
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, ids, 0);
|
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, ids, 0);
|
||||||
|
@ -498,7 +498,7 @@ void PhotoShare::requestAlbumList(std::list<std::string>& ids)
|
||||||
|
|
||||||
void PhotoShare::requestPhotoList(GxsMsgReq& req)
|
void PhotoShare::requestPhotoList(GxsMsgReq& req)
|
||||||
{
|
{
|
||||||
RsTokReqOptionsV2 opts;
|
RsTokReqOptions opts;
|
||||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_IDS;
|
opts.mReqType = GXS_REQUEST_TYPE_MSG_IDS;
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
mPhotoQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, req, 0);
|
mPhotoQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, req, 0);
|
||||||
|
@ -526,7 +526,7 @@ void PhotoShare::loadAlbumList(const uint32_t &token)
|
||||||
|
|
||||||
void PhotoShare::requestAlbumData(std::list<RsGxsGroupId> &ids)
|
void PhotoShare::requestAlbumData(std::list<RsGxsGroupId> &ids)
|
||||||
{
|
{
|
||||||
RsTokReqOptionsV2 opts;
|
RsTokReqOptions opts;
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
||||||
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, ids, 0);
|
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, ids, 0);
|
||||||
|
@ -534,7 +534,7 @@ void PhotoShare::requestAlbumData(std::list<RsGxsGroupId> &ids)
|
||||||
|
|
||||||
void PhotoShare::requestAlbumData()
|
void PhotoShare::requestAlbumData()
|
||||||
{
|
{
|
||||||
RsTokReqOptionsV2 opts;
|
RsTokReqOptions opts;
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
||||||
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, 0);
|
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, 0);
|
||||||
|
@ -569,7 +569,7 @@ void PhotoShare::requestPhotoList(const std::string &albumId)
|
||||||
|
|
||||||
std::list<RsGxsGroupId> grpIds;
|
std::list<RsGxsGroupId> grpIds;
|
||||||
grpIds.push_back(albumId);
|
grpIds.push_back(albumId);
|
||||||
RsTokReqOptionsV2 opts;
|
RsTokReqOptions opts;
|
||||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_IDS;
|
opts.mReqType = GXS_REQUEST_TYPE_MSG_IDS;
|
||||||
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
|
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
|
@ -587,7 +587,7 @@ void PhotoShare::acknowledgeGroup(const uint32_t &token)
|
||||||
std::list<RsGxsGroupId> grpIds;
|
std::list<RsGxsGroupId> grpIds;
|
||||||
grpIds.push_back(grpId);
|
grpIds.push_back(grpId);
|
||||||
|
|
||||||
RsTokReqOptionsV2 opts;
|
RsTokReqOptions opts;
|
||||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
||||||
uint32_t reqToken;
|
uint32_t reqToken;
|
||||||
mPhotoQueue->requestGroupInfo(reqToken, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds, 0);
|
mPhotoQueue->requestGroupInfo(reqToken, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds, 0);
|
||||||
|
@ -630,7 +630,7 @@ void PhotoShare::loadPhotoList(const uint32_t &token)
|
||||||
|
|
||||||
void PhotoShare::requestPhotoData(GxsMsgReq &photoIds)
|
void PhotoShare::requestPhotoData(GxsMsgReq &photoIds)
|
||||||
{
|
{
|
||||||
RsTokReqOptionsV2 opts;
|
RsTokReqOptions opts;
|
||||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
mPhotoQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, photoIds, 0);
|
mPhotoQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, photoIds, 0);
|
||||||
|
@ -638,7 +638,7 @@ void PhotoShare::requestPhotoData(GxsMsgReq &photoIds)
|
||||||
|
|
||||||
void PhotoShare::requestPhotoData(const std::list<RsGxsGroupId>& grpIds)
|
void PhotoShare::requestPhotoData(const std::list<RsGxsGroupId>& grpIds)
|
||||||
{
|
{
|
||||||
RsTokReqOptionsV2 opts;
|
RsTokReqOptions opts;
|
||||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
mPhotoQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds, 0);
|
mPhotoQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds, 0);
|
||||||
|
@ -677,7 +677,7 @@ void PhotoShare::loadPhotoData(const uint32_t &token)
|
||||||
|
|
||||||
/**************************** Request / Response Filling of Data ************************/
|
/**************************** Request / Response Filling of Data ************************/
|
||||||
|
|
||||||
void PhotoShare::loadRequest(const TokenQueueV2 *queue, const TokenRequestV2 &req)
|
void PhotoShare::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
||||||
{
|
{
|
||||||
std::cerr << "PhotoShare::loadRequest()";
|
std::cerr << "PhotoShare::loadRequest()";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
|
@ -16,14 +16,14 @@
|
||||||
#include "PhotoItem.h"
|
#include "PhotoItem.h"
|
||||||
#include "PhotoSlideShow.h"
|
#include "PhotoSlideShow.h"
|
||||||
|
|
||||||
#include "util/TokenQueueV2.h"
|
#include "util/TokenQueue.h"
|
||||||
#include "PhotoShareItemHolder.h"
|
#include "PhotoShareItemHolder.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class PhotoShare;
|
class PhotoShare;
|
||||||
}
|
}
|
||||||
|
|
||||||
class PhotoShare : public MainPage, public TokenResponseV2, public PhotoShareItemHolder
|
class PhotoShare : public MainPage, public TokenResponse, public PhotoShareItemHolder
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ private:
|
||||||
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 TokenQueueV2 *queue, const TokenRequestV2 &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);
|
||||||
|
@ -91,7 +91,7 @@ private:
|
||||||
AlbumDialog* mAlbumDialog;
|
AlbumDialog* mAlbumDialog;
|
||||||
PhotoDialog* mPhotoDialog;
|
PhotoDialog* mPhotoDialog;
|
||||||
|
|
||||||
TokenQueueV2 *mPhotoQueue;
|
TokenQueue *mPhotoQueue;
|
||||||
|
|
||||||
/* UI - from Designer */
|
/* UI - from Designer */
|
||||||
Ui::PhotoShare ui;
|
Ui::PhotoShare ui;
|
||||||
|
|
|
@ -38,7 +38,7 @@ PhotoSlideShow::PhotoSlideShow(const RsPhotoAlbum& album, QWidget *parent)
|
||||||
connect(ui.pushButton_StartStop, SIGNAL( clicked( void ) ), this, SLOT( StartStop( void ) ) );
|
connect(ui.pushButton_StartStop, SIGNAL( clicked( void ) ), this, SLOT( StartStop( void ) ) );
|
||||||
connect(ui.pushButton_Close, SIGNAL( clicked( void ) ), this, SLOT( closeShow( void ) ) );
|
connect(ui.pushButton_Close, SIGNAL( clicked( void ) ), this, SLOT( closeShow( void ) ) );
|
||||||
|
|
||||||
mPhotoQueue = new TokenQueueV2(rsPhotoV2->getTokenService(), this);
|
mPhotoQueue = new TokenQueue(rsPhotoV2->getTokenService(), this);
|
||||||
|
|
||||||
mRunning = true;
|
mRunning = true;
|
||||||
mShotActive = true;
|
mShotActive = true;
|
||||||
|
@ -215,37 +215,9 @@ void PhotoSlideShow::updateMoveButtons(uint32_t status)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void PhotoSlideShow::clearDialog()
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
ui.lineEdit_Title->setText(QString("title"));
|
|
||||||
ui.lineEdit_Caption->setText(QString("Caption"));
|
|
||||||
ui.lineEdit_Where->setText(QString("Where"));
|
|
||||||
ui.lineEdit_When->setText(QString("When"));
|
|
||||||
|
|
||||||
ui.scrollAreaWidgetContents->clearPhotos();
|
|
||||||
ui.AlbumDrop->clearPhotos();
|
|
||||||
|
|
||||||
/* clean up album image */
|
|
||||||
mAlbumData.mThumbnail.deleteImage();
|
|
||||||
|
|
||||||
RsPhotoAlbum emptyAlbum;
|
|
||||||
mAlbumData = emptyAlbum;
|
|
||||||
|
|
||||||
/* add empty image */
|
|
||||||
PhotoItem *item = new PhotoItem(NULL, mAlbumData);
|
|
||||||
ui.AlbumDrop->addPhotoItem(item);
|
|
||||||
|
|
||||||
mAlbumEdit = false;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void PhotoSlideShow::requestPhotos()
|
void PhotoSlideShow::requestPhotos()
|
||||||
{
|
{
|
||||||
RsTokReqOptionsV2 opts;
|
RsTokReqOptions opts;
|
||||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
std::list<RsGxsGroupId> grpIds;
|
std::list<RsGxsGroupId> grpIds;
|
||||||
|
@ -294,7 +266,7 @@ bool PhotoSlideShow::loadPhotoData(const uint32_t &token)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhotoSlideShow::loadRequest(const TokenQueueV2 *queue, const TokenRequestV2 &req)
|
void PhotoSlideShow::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
||||||
{
|
{
|
||||||
std::cerr << "PhotoSlideShow::loadRequest()";
|
std::cerr << "PhotoSlideShow::loadRequest()";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
|
@ -27,10 +27,10 @@
|
||||||
#include "ui_PhotoSlideShow.h"
|
#include "ui_PhotoSlideShow.h"
|
||||||
|
|
||||||
#include <retroshare/rsphotoV2.h>
|
#include <retroshare/rsphotoV2.h>
|
||||||
#include "util/TokenQueueV2.h"
|
#include "util/TokenQueue.h"
|
||||||
#include "AlbumItem.h"
|
#include "AlbumItem.h"
|
||||||
|
|
||||||
class PhotoSlideShow : public QWidget, public TokenResponseV2
|
class PhotoSlideShow : public QWidget, public TokenResponse
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -38,9 +38,7 @@ public:
|
||||||
PhotoSlideShow(const RsPhotoAlbum& mAlbum, QWidget *parent = 0);
|
PhotoSlideShow(const RsPhotoAlbum& mAlbum, QWidget *parent = 0);
|
||||||
virtual ~PhotoSlideShow();
|
virtual ~PhotoSlideShow();
|
||||||
|
|
||||||
void loadRequest(const TokenQueueV2 *queue, const TokenRequestV2 &req);
|
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||||
|
|
||||||
void clearDialog();
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void showPhotoDetails();
|
void showPhotoDetails();
|
||||||
|
@ -70,7 +68,7 @@ private:
|
||||||
|
|
||||||
RsPhotoAlbum mAlbum;
|
RsPhotoAlbum mAlbum;
|
||||||
|
|
||||||
TokenQueueV2 *mPhotoQueue;
|
TokenQueue *mPhotoQueue;
|
||||||
|
|
||||||
Ui::PhotoSlideShow ui;
|
Ui::PhotoSlideShow ui;
|
||||||
};
|
};
|
||||||
|
|
|
@ -23,8 +23,7 @@
|
||||||
|
|
||||||
#include "PostedComments.h"
|
#include "PostedComments.h"
|
||||||
|
|
||||||
//#include <retroshare/rspeers.h>
|
#include <retroshare/rsposted.h>
|
||||||
#include <retroshare/rspostedVEG.h>
|
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
@ -64,26 +63,10 @@ PostedComments::PostedComments(QWidget *parent)
|
||||||
{
|
{
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
|
|
||||||
#if 0
|
|
||||||
mAddDialog = NULL;
|
|
||||||
mAlbumSelected = NULL;
|
|
||||||
mPhotoSelected = NULL;
|
|
||||||
mSlideShow = NULL;
|
|
||||||
|
|
||||||
connect( ui.toolButton_NewAlbum, SIGNAL(clicked()), this, SLOT(OpenOrShowPhotoAddDialog()));
|
|
||||||
connect( ui.toolButton_EditAlbum, SIGNAL(clicked()), this, SLOT(OpenPhotoEditDialog()));
|
|
||||||
connect( ui.toolButton_SlideShow, SIGNAL(clicked()), this, SLOT(OpenSlideShow()));
|
|
||||||
|
|
||||||
QTimer *timer = new QTimer(this);
|
|
||||||
timer->connect(timer, SIGNAL(timeout()), this, SLOT(checkUpdate()));
|
|
||||||
timer->start(1000);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* setup TokenQueue */
|
/* setup TokenQueue */
|
||||||
//mPhotoQueue = new TokenQueue(rsPhoto, this);
|
//mPhotoQueue = new TokenQueue(rsPhoto, this);
|
||||||
|
|
||||||
ui.treeWidget->setup(rsPostedVEG);
|
ui.treeWidget->setup(rsPosted->getTokenService());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,543 +79,3 @@ void PostedComments::loadComments( std::string threadId )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
|
|
||||||
void PhotoDialog::notifySelection(PhotoItem *item, int ptype)
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::notifySelection() from : " << ptype << " " << item;
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
switch(ptype)
|
|
||||||
{
|
|
||||||
default:
|
|
||||||
case PHOTO_ITEM_TYPE_ALBUM:
|
|
||||||
notifyAlbumSelection(item);
|
|
||||||
break;
|
|
||||||
case PHOTO_ITEM_TYPE_PHOTO:
|
|
||||||
notifyPhotoSelection(item);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void PhotoDialog::notifyAlbumSelection(PhotoItem *item)
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::notifyAlbumSelection() from : " << item;
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
if (mAlbumSelected)
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::notifyAlbumSelection() unselecting old one : " << mAlbumSelected;
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
mAlbumSelected->setSelected(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
mAlbumSelected = item;
|
|
||||||
insertPhotosForSelectedAlbum();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PhotoDialog::notifyPhotoSelection(PhotoItem *item)
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::notifyPhotoSelection() from : " << item;
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
if (mPhotoSelected)
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::notifyPhotoSelection() unselecting old one : " << mPhotoSelected;
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
mPhotoSelected->setSelected(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
mPhotoSelected = item;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PhotoDialog::checkUpdate()
|
|
||||||
{
|
|
||||||
/* update */
|
|
||||||
if (!rsPhoto)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (rsPhoto->updated())
|
|
||||||
{
|
|
||||||
//insertAlbums();
|
|
||||||
requestAlbumList();
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*************** New Photo Dialog ***************/
|
|
||||||
|
|
||||||
void PhotoDialog::OpenSlideShow()
|
|
||||||
{
|
|
||||||
|
|
||||||
// TODO.
|
|
||||||
if (!mAlbumSelected)
|
|
||||||
{
|
|
||||||
// ALERT.
|
|
||||||
int ret = QMessageBox::information(this, tr("PhotoShare"),
|
|
||||||
tr("Please select an album before\n"
|
|
||||||
"requesting to edit it!"),
|
|
||||||
QMessageBox::Ok);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mAlbumSelected->mIsPhoto)
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::OpenPhotoEditDialog() MAJOR ERROR!";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string albumId = mAlbumSelected->mAlbumDetails.mMeta.mGroupId;
|
|
||||||
|
|
||||||
if (mSlideShow)
|
|
||||||
{
|
|
||||||
mSlideShow->show();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mSlideShow = new PhotoSlideShow(NULL);
|
|
||||||
mSlideShow->show();
|
|
||||||
}
|
|
||||||
mSlideShow->loadAlbum(albumId);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*************** New Photo Dialog ***************/
|
|
||||||
|
|
||||||
void PhotoDialog::OpenOrShowPhotoAddDialog()
|
|
||||||
{
|
|
||||||
if (mAddDialog)
|
|
||||||
{
|
|
||||||
mAddDialog->show();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mAddDialog = new PhotoAddDialog(NULL);
|
|
||||||
mAddDialog->show();
|
|
||||||
}
|
|
||||||
mAddDialog->clearDialog();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*************** Edit Photo Dialog ***************/
|
|
||||||
|
|
||||||
void PhotoDialog::OpenPhotoEditDialog()
|
|
||||||
{
|
|
||||||
/* check if we have an album selected */
|
|
||||||
// THE TWO MessageBoxes - should be handled by disabling the Button!.
|
|
||||||
// TODO.
|
|
||||||
if (!mAlbumSelected)
|
|
||||||
{
|
|
||||||
// ALERT.
|
|
||||||
int ret = QMessageBox::information(this, tr("PhotoShare"),
|
|
||||||
tr("Please select an album before\n"
|
|
||||||
"requesting to edit it!"),
|
|
||||||
QMessageBox::Ok);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mAlbumSelected->mIsPhoto)
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::OpenPhotoEditDialog() MAJOR ERROR!";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string albumId = mAlbumSelected->mAlbumDetails.mMeta.mGroupId;
|
|
||||||
#if 0
|
|
||||||
uint32_t flags = mAlbumSelected->mAlbumDetails.mMeta.mGroupFlags;
|
|
||||||
|
|
||||||
if (!(flags & OWN))
|
|
||||||
{
|
|
||||||
// ALERT.
|
|
||||||
int ret = QMessageBox::information(this, tr("PhotoShare"),
|
|
||||||
tr("Cannot Edit Someone Else's Album"),
|
|
||||||
QMessageBox::Ok);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
OpenOrShowPhotoAddDialog();
|
|
||||||
mAddDialog->loadAlbum(albumId);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool PhotoDialog::matchesAlbumFilter(const RsPhotoAlbum &album)
|
|
||||||
{
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
double PhotoDialog::AlbumScore(const RsPhotoAlbum &album)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool PhotoDialog::matchesPhotoFilter(const RsPhotoPhoto &photo)
|
|
||||||
{
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
double PhotoDialog::PhotoScore(const RsPhotoPhoto &photo)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PhotoDialog::insertPhotosForSelectedAlbum()
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::insertPhotosForSelectedAlbum()";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
clearPhotos();
|
|
||||||
|
|
||||||
//std::list<std::string> albumIds;
|
|
||||||
if (mAlbumSelected)
|
|
||||||
{
|
|
||||||
if (mAlbumSelected->mIsPhoto)
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::insertPhotosForSelectedAlbum() MAJOR ERROR!";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string albumId = mAlbumSelected->mAlbumDetails.mMeta.mGroupId;
|
|
||||||
//albumIds.push_back(albumId);
|
|
||||||
|
|
||||||
std::cerr << "PhotoDialog::insertPhotosForSelectedAlbum() AlbumId: " << albumId;
|
|
||||||
std::cerr << std::endl;
|
|
||||||
requestPhotoList(albumId);
|
|
||||||
}
|
|
||||||
//requestPhotoList(albumIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PhotoDialog::clearAlbums()
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::clearAlbums()" << std::endl;
|
|
||||||
|
|
||||||
std::list<PhotoItem *> photoItems;
|
|
||||||
std::list<PhotoItem *>::iterator pit;
|
|
||||||
|
|
||||||
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
|
|
||||||
int count = alayout->count();
|
|
||||||
for(int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
QLayoutItem *litem = alayout->itemAt(i);
|
|
||||||
if (!litem)
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::clearAlbums() missing litem";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
PhotoItem *item = dynamic_cast<PhotoItem *>(litem->widget());
|
|
||||||
if (item)
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::clearAlbums() item: " << item;
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
photoItems.push_back(item);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::clearAlbums() Found Child, which is not a PhotoItem???";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for(pit = photoItems.begin(); pit != photoItems.end(); pit++)
|
|
||||||
{
|
|
||||||
PhotoItem *item = *pit;
|
|
||||||
alayout->removeWidget(item);
|
|
||||||
delete item;
|
|
||||||
}
|
|
||||||
mAlbumSelected = NULL;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void PhotoDialog::clearPhotos()
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::clearPhotos()" << std::endl;
|
|
||||||
|
|
||||||
std::list<PhotoItem *> photoItems;
|
|
||||||
std::list<PhotoItem *>::iterator pit;
|
|
||||||
|
|
||||||
QLayout *alayout = ui.scrollAreaWidgetContents_2->layout();
|
|
||||||
int count = alayout->count();
|
|
||||||
for(int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
QLayoutItem *litem = alayout->itemAt(i);
|
|
||||||
if (!litem)
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::clearPhotos() missing litem";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
PhotoItem *item = dynamic_cast<PhotoItem *>(litem->widget());
|
|
||||||
if (item)
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::clearPhotos() item: " << item;
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
photoItems.push_back(item);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::clearPhotos() Found Child, which is not a PhotoItem???";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for(pit = photoItems.begin(); pit != photoItems.end(); pit++)
|
|
||||||
{
|
|
||||||
PhotoItem *item = *pit;
|
|
||||||
alayout->removeWidget(item);
|
|
||||||
delete item;
|
|
||||||
}
|
|
||||||
|
|
||||||
mPhotoSelected = NULL;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void PhotoDialog::addAlbum(const RsPhotoAlbum &album)
|
|
||||||
{
|
|
||||||
std::cerr << " PhotoDialog::addAlbum() AlbumId: " << album.mMeta.mGroupId << std::endl;
|
|
||||||
|
|
||||||
PhotoItem *item = new PhotoItem(this, album);
|
|
||||||
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
|
|
||||||
alayout->addWidget(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PhotoDialog::addPhoto(const RsPhotoPhoto &photo)
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::addPhoto() AlbumId: " << photo.mMeta.mGroupId;
|
|
||||||
std::cerr << " PhotoId: " << photo.mMeta.mMsgId;
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
RsPhotoAlbum dummyAlbum;
|
|
||||||
dummyAlbum.mSetFlags = 0;
|
|
||||||
|
|
||||||
PhotoItem *item = new PhotoItem(this, photo, dummyAlbum);
|
|
||||||
QLayout *alayout = ui.scrollAreaWidgetContents_2->layout();
|
|
||||||
alayout->addWidget(item);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void PhotoDialog::deletePhotoItem(PhotoItem *item, uint32_t type)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**************************** Request / Response Filling of Data ************************/
|
|
||||||
|
|
||||||
|
|
||||||
void PhotoDialog::requestAlbumList()
|
|
||||||
{
|
|
||||||
|
|
||||||
std::list<std::string> ids;
|
|
||||||
RsTokReqOptions opts;
|
|
||||||
uint32_t token;
|
|
||||||
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, ids, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PhotoDialog::loadAlbumList(const uint32_t &token)
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::loadAlbumList()";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
std::list<std::string> albumIds;
|
|
||||||
rsPhoto->getGroupList(token, albumIds);
|
|
||||||
|
|
||||||
requestAlbumData(albumIds);
|
|
||||||
|
|
||||||
clearPhotos();
|
|
||||||
|
|
||||||
std::list<std::string>::iterator it;
|
|
||||||
for(it = albumIds.begin(); it != albumIds.end(); it++)
|
|
||||||
{
|
|
||||||
requestPhotoList(*it);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PhotoDialog::requestAlbumData(const std::list<std::string> &ids)
|
|
||||||
{
|
|
||||||
RsTokReqOptions opts;
|
|
||||||
uint32_t token;
|
|
||||||
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, ids, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool PhotoDialog::loadAlbumData(const uint32_t &token)
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::loadAlbumData()";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
clearAlbums();
|
|
||||||
|
|
||||||
bool moreData = true;
|
|
||||||
while(moreData)
|
|
||||||
{
|
|
||||||
RsPhotoAlbum album;
|
|
||||||
if (rsPhoto->getAlbum(token, album))
|
|
||||||
{
|
|
||||||
std::cerr << " PhotoDialog::addAlbum() AlbumId: " << album.mMeta.mGroupId << std::endl;
|
|
||||||
|
|
||||||
PhotoItem *item = new PhotoItem(this, album);
|
|
||||||
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
|
|
||||||
alayout->addWidget(item);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
moreData = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PhotoDialog::requestPhotoList(const std::string &albumId)
|
|
||||||
{
|
|
||||||
|
|
||||||
std::list<std::string> ids;
|
|
||||||
ids.push_back(albumId);
|
|
||||||
RsTokReqOptions opts;
|
|
||||||
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
|
|
||||||
uint32_t token;
|
|
||||||
mPhotoQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, ids, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void PhotoDialog::loadPhotoList(const uint32_t &token)
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::loadPhotoList()";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
|
|
||||||
std::list<std::string> photoIds;
|
|
||||||
|
|
||||||
rsPhoto->getMsgList(token, photoIds);
|
|
||||||
requestPhotoData(photoIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PhotoDialog::requestPhotoData(const std::list<std::string> &photoIds)
|
|
||||||
{
|
|
||||||
RsTokReqOptions opts;
|
|
||||||
uint32_t token;
|
|
||||||
mPhotoQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, photoIds, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PhotoDialog::loadPhotoData(const uint32_t &token)
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::loadPhotoData()";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
bool moreData = true;
|
|
||||||
while(moreData)
|
|
||||||
{
|
|
||||||
RsPhotoPhoto photo;
|
|
||||||
|
|
||||||
if (rsPhoto->getPhoto(token, photo))
|
|
||||||
{
|
|
||||||
|
|
||||||
std::cerr << "PhotoDialog::loadPhotoData() AlbumId: " << photo.mMeta.mGroupId;
|
|
||||||
std::cerr << " PhotoId: " << photo.mMeta.mMsgId;
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
addPhoto(photo);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
moreData = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/********************************/
|
|
||||||
|
|
||||||
void PhotoDialog::loadRequest(const TokenQueue *queue, const TokenRequestVEG &req)
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::loadRequest()";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
if (queue == mPhotoQueue)
|
|
||||||
{
|
|
||||||
/* now switch on req */
|
|
||||||
switch(req.mType)
|
|
||||||
{
|
|
||||||
case TOKENREQ_GROUPINFO:
|
|
||||||
switch(req.mAnsType)
|
|
||||||
{
|
|
||||||
case RS_TOKREQ_ANSTYPE_LIST:
|
|
||||||
loadAlbumList(req.mToken);
|
|
||||||
break;
|
|
||||||
case RS_TOKREQ_ANSTYPE_DATA:
|
|
||||||
loadAlbumData(req.mToken);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
std::cerr << "PhotoDialog::loadRequest() ERROR: GROUP: INVALID ANS TYPE";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case TOKENREQ_MSGINFO:
|
|
||||||
switch(req.mAnsType)
|
|
||||||
{
|
|
||||||
case RS_TOKREQ_ANSTYPE_LIST:
|
|
||||||
loadPhotoList(req.mToken);
|
|
||||||
break;
|
|
||||||
//case RS_TOKREQ_ANSTYPE_DATA:
|
|
||||||
// loadPhotoData(req.mToken);
|
|
||||||
// break;
|
|
||||||
default:
|
|
||||||
std::cerr << "PhotoDialog::loadRequest() ERROR: MSG: INVALID ANS TYPE";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case TOKENREQ_MSGRELATEDINFO:
|
|
||||||
switch(req.mAnsType)
|
|
||||||
{
|
|
||||||
case RS_TOKREQ_ANSTYPE_DATA:
|
|
||||||
loadPhotoData(req.mToken);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
std::cerr << "PhotoDialog::loadRequest() ERROR: MSG: INVALID ANS TYPE";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
std::cerr << "PhotoDialog::loadRequest() ERROR: INVALID TYPE";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
//#include "gui/mainpage.h"
|
//#include "gui/mainpage.h"
|
||||||
#include "ui_PostedComments.h"
|
#include "ui_PostedComments.h"
|
||||||
|
|
||||||
#include <retroshare/rspostedVEG.h>
|
#include <retroshare/rsposted.h>
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include "PostedListDialog.h"
|
#include "PostedListDialog.h"
|
||||||
#include "PostedComments.h"
|
#include "PostedComments.h"
|
||||||
|
|
||||||
#include <retroshare/rspostedVEG.h>
|
#include <retroshare/rsposted.h>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
@ -40,21 +40,8 @@
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************
|
/****************************************************************
|
||||||
* New Photo Display Widget.
|
* Posted Dialog
|
||||||
*
|
*
|
||||||
* This has two 'lists'.
|
|
||||||
* Top list shows Albums.
|
|
||||||
* Lower list is photos from the selected Album.
|
|
||||||
*
|
|
||||||
* Notes:
|
|
||||||
* Each Item will be an AlbumItem, which contains a thumbnail & random details.
|
|
||||||
* We will limit Items to < 100. With a 'Filter to see more message.
|
|
||||||
*
|
|
||||||
* Thumbnails will come from Service.
|
|
||||||
* Option to Share albums / pictures onward (if permissions allow).
|
|
||||||
* Option to Download the albums to a specified directory. (is this required if sharing an album?)
|
|
||||||
*
|
|
||||||
* Will introduce a FullScreen SlideShow later... first get basics happening.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PostedDialog::PostedDialog(QWidget *parent)
|
PostedDialog::PostedDialog(QWidget *parent)
|
||||||
|
@ -74,587 +61,6 @@ PostedDialog::PostedDialog(QWidget *parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Constructor */
|
|
||||||
PhotoDialog::PhotoDialog(QWidget *parent)
|
|
||||||
: MainPage(parent)
|
|
||||||
{
|
|
||||||
ui.setupUi(this);
|
|
||||||
|
|
||||||
mAddDialog = NULL;
|
|
||||||
mAlbumSelected = NULL;
|
|
||||||
mPhotoSelected = NULL;
|
|
||||||
mSlideShow = NULL;
|
|
||||||
|
|
||||||
connect( ui.toolButton_NewAlbum, SIGNAL(clicked()), this, SLOT(OpenOrShowPhotoAddDialog()));
|
|
||||||
connect( ui.toolButton_EditAlbum, SIGNAL(clicked()), this, SLOT(OpenPhotoEditDialog()));
|
|
||||||
connect( ui.toolButton_SlideShow, SIGNAL(clicked()), this, SLOT(OpenSlideShow()));
|
|
||||||
|
|
||||||
QTimer *timer = new QTimer(this);
|
|
||||||
timer->connect(timer, SIGNAL(timeout()), this, SLOT(checkUpdate()));
|
|
||||||
timer->start(1000);
|
|
||||||
|
|
||||||
|
|
||||||
/* setup TokenQueue */
|
|
||||||
mPhotoQueue = new TokenQueue(rsPhoto, this);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PhotoDialog::notifySelection(PhotoItem *item, int ptype)
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::notifySelection() from : " << ptype << " " << item;
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
switch(ptype)
|
|
||||||
{
|
|
||||||
default:
|
|
||||||
case PHOTO_ITEM_TYPE_ALBUM:
|
|
||||||
notifyAlbumSelection(item);
|
|
||||||
break;
|
|
||||||
case PHOTO_ITEM_TYPE_PHOTO:
|
|
||||||
notifyPhotoSelection(item);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void PhotoDialog::notifyAlbumSelection(PhotoItem *item)
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::notifyAlbumSelection() from : " << item;
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
if (mAlbumSelected)
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::notifyAlbumSelection() unselecting old one : " << mAlbumSelected;
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
mAlbumSelected->setSelected(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
mAlbumSelected = item;
|
|
||||||
insertPhotosForSelectedAlbum();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PhotoDialog::notifyPhotoSelection(PhotoItem *item)
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::notifyPhotoSelection() from : " << item;
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
if (mPhotoSelected)
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::notifyPhotoSelection() unselecting old one : " << mPhotoSelected;
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
mPhotoSelected->setSelected(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
mPhotoSelected = item;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PhotoDialog::checkUpdate()
|
|
||||||
{
|
|
||||||
/* update */
|
|
||||||
if (!rsPhoto)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (rsPhoto->updated())
|
|
||||||
{
|
|
||||||
//insertAlbums();
|
|
||||||
requestAlbumList();
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*************** New Photo Dialog ***************/
|
|
||||||
|
|
||||||
void PhotoDialog::OpenSlideShow()
|
|
||||||
{
|
|
||||||
|
|
||||||
// TODO.
|
|
||||||
if (!mAlbumSelected)
|
|
||||||
{
|
|
||||||
// ALERT.
|
|
||||||
int ret = QMessageBox::information(this, tr("PhotoShare"),
|
|
||||||
tr("Please select an album before\n"
|
|
||||||
"requesting to edit it!"),
|
|
||||||
QMessageBox::Ok);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mAlbumSelected->mIsPhoto)
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::OpenPhotoEditDialog() MAJOR ERROR!";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string albumId = mAlbumSelected->mAlbumDetails.mMeta.mGroupId;
|
|
||||||
|
|
||||||
if (mSlideShow)
|
|
||||||
{
|
|
||||||
mSlideShow->show();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mSlideShow = new PhotoSlideShow(NULL);
|
|
||||||
mSlideShow->show();
|
|
||||||
}
|
|
||||||
mSlideShow->loadAlbum(albumId);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*************** New Photo Dialog ***************/
|
|
||||||
|
|
||||||
void PhotoDialog::OpenOrShowPhotoAddDialog()
|
|
||||||
{
|
|
||||||
if (mAddDialog)
|
|
||||||
{
|
|
||||||
mAddDialog->show();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mAddDialog = new PhotoAddDialog(NULL);
|
|
||||||
mAddDialog->show();
|
|
||||||
}
|
|
||||||
mAddDialog->clearDialog();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*************** Edit Photo Dialog ***************/
|
|
||||||
|
|
||||||
void PhotoDialog::OpenPhotoEditDialog()
|
|
||||||
{
|
|
||||||
/* check if we have an album selected */
|
|
||||||
// THE TWO MessageBoxes - should be handled by disabling the Button!.
|
|
||||||
// TODO.
|
|
||||||
if (!mAlbumSelected)
|
|
||||||
{
|
|
||||||
// ALERT.
|
|
||||||
int ret = QMessageBox::information(this, tr("PhotoShare"),
|
|
||||||
tr("Please select an album before\n"
|
|
||||||
"requesting to edit it!"),
|
|
||||||
QMessageBox::Ok);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mAlbumSelected->mIsPhoto)
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::OpenPhotoEditDialog() MAJOR ERROR!";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string albumId = mAlbumSelected->mAlbumDetails.mMeta.mGroupId;
|
|
||||||
#if 0
|
|
||||||
uint32_t flags = mAlbumSelected->mAlbumDetails.mMeta.mGroupFlags;
|
|
||||||
|
|
||||||
if (!(flags & OWN))
|
|
||||||
{
|
|
||||||
// ALERT.
|
|
||||||
int ret = QMessageBox::information(this, tr("PhotoShare"),
|
|
||||||
tr("Cannot Edit Someone Else's Album"),
|
|
||||||
QMessageBox::Ok);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
OpenOrShowPhotoAddDialog();
|
|
||||||
mAddDialog->loadAlbum(albumId);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool PhotoDialog::matchesAlbumFilter(const RsPhotoAlbum &album)
|
|
||||||
{
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
double PhotoDialog::AlbumScore(const RsPhotoAlbum &album)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool PhotoDialog::matchesPhotoFilter(const RsPhotoPhoto &photo)
|
|
||||||
{
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
double PhotoDialog::PhotoScore(const RsPhotoPhoto &photo)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PhotoDialog::insertPhotosForSelectedAlbum()
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::insertPhotosForSelectedAlbum()";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
clearPhotos();
|
|
||||||
|
|
||||||
//std::list<std::string> albumIds;
|
|
||||||
if (mAlbumSelected)
|
|
||||||
{
|
|
||||||
if (mAlbumSelected->mIsPhoto)
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::insertPhotosForSelectedAlbum() MAJOR ERROR!";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string albumId = mAlbumSelected->mAlbumDetails.mMeta.mGroupId;
|
|
||||||
//albumIds.push_back(albumId);
|
|
||||||
|
|
||||||
std::cerr << "PhotoDialog::insertPhotosForSelectedAlbum() AlbumId: " << albumId;
|
|
||||||
std::cerr << std::endl;
|
|
||||||
requestPhotoList(albumId);
|
|
||||||
}
|
|
||||||
//requestPhotoList(albumIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PhotoDialog::clearAlbums()
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::clearAlbums()" << std::endl;
|
|
||||||
|
|
||||||
std::list<PhotoItem *> photoItems;
|
|
||||||
std::list<PhotoItem *>::iterator pit;
|
|
||||||
|
|
||||||
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
|
|
||||||
int count = alayout->count();
|
|
||||||
for(int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
QLayoutItem *litem = alayout->itemAt(i);
|
|
||||||
if (!litem)
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::clearAlbums() missing litem";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
PhotoItem *item = dynamic_cast<PhotoItem *>(litem->widget());
|
|
||||||
if (item)
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::clearAlbums() item: " << item;
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
photoItems.push_back(item);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::clearAlbums() Found Child, which is not a PhotoItem???";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for(pit = photoItems.begin(); pit != photoItems.end(); pit++)
|
|
||||||
{
|
|
||||||
PhotoItem *item = *pit;
|
|
||||||
alayout->removeWidget(item);
|
|
||||||
delete item;
|
|
||||||
}
|
|
||||||
mAlbumSelected = NULL;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void PhotoDialog::clearPhotos()
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::clearPhotos()" << std::endl;
|
|
||||||
|
|
||||||
std::list<PhotoItem *> photoItems;
|
|
||||||
std::list<PhotoItem *>::iterator pit;
|
|
||||||
|
|
||||||
QLayout *alayout = ui.scrollAreaWidgetContents_2->layout();
|
|
||||||
int count = alayout->count();
|
|
||||||
for(int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
QLayoutItem *litem = alayout->itemAt(i);
|
|
||||||
if (!litem)
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::clearPhotos() missing litem";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
PhotoItem *item = dynamic_cast<PhotoItem *>(litem->widget());
|
|
||||||
if (item)
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::clearPhotos() item: " << item;
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
photoItems.push_back(item);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::clearPhotos() Found Child, which is not a PhotoItem???";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for(pit = photoItems.begin(); pit != photoItems.end(); pit++)
|
|
||||||
{
|
|
||||||
PhotoItem *item = *pit;
|
|
||||||
alayout->removeWidget(item);
|
|
||||||
delete item;
|
|
||||||
}
|
|
||||||
|
|
||||||
mPhotoSelected = NULL;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void PhotoDialog::addAlbum(const RsPhotoAlbum &album)
|
|
||||||
{
|
|
||||||
std::cerr << " PhotoDialog::addAlbum() AlbumId: " << album.mMeta.mGroupId << std::endl;
|
|
||||||
|
|
||||||
PhotoItem *item = new PhotoItem(this, album);
|
|
||||||
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
|
|
||||||
alayout->addWidget(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PhotoDialog::addPhoto(const RsPhotoPhoto &photo)
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::addPhoto() AlbumId: " << photo.mMeta.mGroupId;
|
|
||||||
std::cerr << " PhotoId: " << photo.mMeta.mMsgId;
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
RsPhotoAlbum dummyAlbum;
|
|
||||||
dummyAlbum.mSetFlags = 0;
|
|
||||||
|
|
||||||
PhotoItem *item = new PhotoItem(this, photo, dummyAlbum);
|
|
||||||
QLayout *alayout = ui.scrollAreaWidgetContents_2->layout();
|
|
||||||
alayout->addWidget(item);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void PhotoDialog::deletePhotoItem(PhotoItem *item, uint32_t type)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**************************** Request / Response Filling of Data ************************/
|
|
||||||
|
|
||||||
|
|
||||||
void PhotoDialog::requestAlbumList()
|
|
||||||
{
|
|
||||||
|
|
||||||
std::list<std::string> ids;
|
|
||||||
RsTokReqOptions opts;
|
|
||||||
uint32_t token;
|
|
||||||
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, ids, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PhotoDialog::loadAlbumList(const uint32_t &token)
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::loadAlbumList()";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
std::list<std::string> albumIds;
|
|
||||||
rsPhoto->getGroupList(token, albumIds);
|
|
||||||
|
|
||||||
requestAlbumData(albumIds);
|
|
||||||
|
|
||||||
clearPhotos();
|
|
||||||
|
|
||||||
std::list<std::string>::iterator it;
|
|
||||||
for(it = albumIds.begin(); it != albumIds.end(); it++)
|
|
||||||
{
|
|
||||||
requestPhotoList(*it);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PhotoDialog::requestAlbumData(const std::list<std::string> &ids)
|
|
||||||
{
|
|
||||||
RsTokReqOptions opts;
|
|
||||||
uint32_t token;
|
|
||||||
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, ids, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool PhotoDialog::loadAlbumData(const uint32_t &token)
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::loadAlbumData()";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
clearAlbums();
|
|
||||||
|
|
||||||
bool moreData = true;
|
|
||||||
while(moreData)
|
|
||||||
{
|
|
||||||
RsPhotoAlbum album;
|
|
||||||
if (rsPhoto->getAlbum(token, album))
|
|
||||||
{
|
|
||||||
std::cerr << " PhotoDialog::addAlbum() AlbumId: " << album.mMeta.mGroupId << std::endl;
|
|
||||||
|
|
||||||
PhotoItem *item = new PhotoItem(this, album);
|
|
||||||
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
|
|
||||||
alayout->addWidget(item);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
moreData = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PhotoDialog::requestPhotoList(const std::string &albumId)
|
|
||||||
{
|
|
||||||
|
|
||||||
std::list<std::string> ids;
|
|
||||||
ids.push_back(albumId);
|
|
||||||
RsTokReqOptions opts;
|
|
||||||
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
|
|
||||||
uint32_t token;
|
|
||||||
mPhotoQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, ids, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void PhotoDialog::loadPhotoList(const uint32_t &token)
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::loadPhotoList()";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
|
|
||||||
std::list<std::string> photoIds;
|
|
||||||
|
|
||||||
rsPhoto->getMsgList(token, photoIds);
|
|
||||||
requestPhotoData(photoIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PhotoDialog::requestPhotoData(const std::list<std::string> &photoIds)
|
|
||||||
{
|
|
||||||
RsTokReqOptions opts;
|
|
||||||
uint32_t token;
|
|
||||||
mPhotoQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, photoIds, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PhotoDialog::loadPhotoData(const uint32_t &token)
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::loadPhotoData()";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
bool moreData = true;
|
|
||||||
while(moreData)
|
|
||||||
{
|
|
||||||
RsPhotoPhoto photo;
|
|
||||||
|
|
||||||
if (rsPhoto->getPhoto(token, photo))
|
|
||||||
{
|
|
||||||
|
|
||||||
std::cerr << "PhotoDialog::loadPhotoData() AlbumId: " << photo.mMeta.mGroupId;
|
|
||||||
std::cerr << " PhotoId: " << photo.mMeta.mMsgId;
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
addPhoto(photo);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
moreData = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/********************************/
|
|
||||||
|
|
||||||
void PhotoDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoDialog::loadRequest()";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
if (queue == mPhotoQueue)
|
|
||||||
{
|
|
||||||
/* now switch on req */
|
|
||||||
switch(req.mType)
|
|
||||||
{
|
|
||||||
case TOKENREQ_GROUPINFO:
|
|
||||||
switch(req.mAnsType)
|
|
||||||
{
|
|
||||||
case RS_TOKREQ_ANSTYPE_LIST:
|
|
||||||
loadAlbumList(req.mToken);
|
|
||||||
break;
|
|
||||||
case RS_TOKREQ_ANSTYPE_DATA:
|
|
||||||
loadAlbumData(req.mToken);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
std::cerr << "PhotoDialog::loadRequest() ERROR: GROUP: INVALID ANS TYPE";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case TOKENREQ_MSGINFO:
|
|
||||||
switch(req.mAnsType)
|
|
||||||
{
|
|
||||||
case RS_TOKREQ_ANSTYPE_LIST:
|
|
||||||
loadPhotoList(req.mToken);
|
|
||||||
break;
|
|
||||||
//case RS_TOKREQ_ANSTYPE_DATA:
|
|
||||||
// loadPhotoData(req.mToken);
|
|
||||||
// break;
|
|
||||||
default:
|
|
||||||
std::cerr << "PhotoDialog::loadRequest() ERROR: MSG: INVALID ANS TYPE";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case TOKENREQ_MSGRELATEDINFO:
|
|
||||||
switch(req.mAnsType)
|
|
||||||
{
|
|
||||||
case RS_TOKREQ_ANSTYPE_DATA:
|
|
||||||
loadPhotoData(req.mToken);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
std::cerr << "PhotoDialog::loadRequest() ERROR: MSG: INVALID ANS TYPE";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
std::cerr << "PhotoDialog::loadRequest() ERROR: INVALID TYPE";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**************************** Request / Response Filling of Data ************************/
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include "retroshare-gui/mainpage.h"
|
#include "retroshare-gui/mainpage.h"
|
||||||
#include "ui_PostedDialog.h"
|
#include "ui_PostedDialog.h"
|
||||||
|
|
||||||
#include <retroshare/rspostedVEG.h>
|
#include <retroshare/rsposted.h>
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
#include "PostedItem.h"
|
#include "PostedItem.h"
|
||||||
|
|
||||||
#include <retroshare/rspostedVEG.h>
|
#include <retroshare/rsposted.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -53,7 +53,7 @@ PostedItem::PostedItem(PostedHolder *parent, const RsPostedPost &post)
|
||||||
//scoreLabel->setText(QString("1140"));
|
//scoreLabel->setText(QString("1140"));
|
||||||
|
|
||||||
// exposed for testing...
|
// exposed for testing...
|
||||||
float score = rsPostedVEG->calcPostScore(post.mMeta);
|
float score = 0;
|
||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
|
|
||||||
QString fromLabelTxt = QString(" Age: ") + QString::number(now - post.mMeta.mPublishTs);
|
QString fromLabelTxt = QString(" Age: ") + QString::number(now - post.mMeta.mPublishTs);
|
||||||
|
@ -62,7 +62,7 @@ PostedItem::PostedItem(PostedHolder *parent, const RsPostedPost &post)
|
||||||
|
|
||||||
uint32_t votes = 0;
|
uint32_t votes = 0;
|
||||||
uint32_t comments = 0;
|
uint32_t comments = 0;
|
||||||
rsPostedVEG->extractPostedCache(post.mMeta.mServiceString, votes, comments);
|
//rsPosted->extractPostedCache(post.mMeta.mServiceString, votes, comments);
|
||||||
scoreLabel->setText(QString::number(votes));
|
scoreLabel->setText(QString::number(votes));
|
||||||
QString commentLabel = QString("Comments: ") + QString::number(comments);
|
QString commentLabel = QString("Comments: ") + QString::number(comments);
|
||||||
commentLabel += QString(" Votes: ") + QString::number(votes);
|
commentLabel += QString(" Votes: ") + QString::number(votes);
|
||||||
|
@ -87,247 +87,3 @@ void PostedItem::loadComments()
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
mParent->requestComments(mThreadId);
|
mParent->requestComments(mThreadId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
|
|
||||||
PhotoItem::PhotoItem(PhotoHolder *parent, const RsPhotoAlbum &album)
|
|
||||||
:QWidget(NULL), mParent(parent), mType(PHOTO_ITEM_TYPE_ALBUM)
|
|
||||||
{
|
|
||||||
setupUi(this);
|
|
||||||
setAttribute ( Qt::WA_DeleteOnClose, true );
|
|
||||||
|
|
||||||
mIsPhoto = false;
|
|
||||||
setDummyText();
|
|
||||||
updateAlbumText(album); // saves: mAlbumDetails = album;
|
|
||||||
updateImage(album.mThumbnail);
|
|
||||||
|
|
||||||
setSelected(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
PhotoItem::PhotoItem(PhotoHolder *parent, const RsPhotoPhoto &photo, const RsPhotoAlbum &album)
|
|
||||||
:QWidget(NULL), mParent(parent), mType(PHOTO_ITEM_TYPE_PHOTO)
|
|
||||||
{
|
|
||||||
setupUi(this);
|
|
||||||
|
|
||||||
setAttribute ( Qt::WA_DeleteOnClose, true );
|
|
||||||
|
|
||||||
mIsPhoto = true;
|
|
||||||
|
|
||||||
setDummyText();
|
|
||||||
updatePhotoText(photo); // saves: mPhotoDetails = photo;
|
|
||||||
updateAlbumText(album); // saves: mAlbumDetails = album;
|
|
||||||
|
|
||||||
updateImage(photo.mThumbnail);
|
|
||||||
|
|
||||||
setSelected(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
PhotoItem::PhotoItem(PhotoHolder *parent, std::string path) // for new photos.
|
|
||||||
:QWidget(NULL), mParent(parent), mType(PHOTO_ITEM_TYPE_NEW)
|
|
||||||
{
|
|
||||||
setupUi(this);
|
|
||||||
|
|
||||||
setAttribute ( Qt::WA_DeleteOnClose, true );
|
|
||||||
|
|
||||||
setDummyText();
|
|
||||||
mIsPhoto = true;
|
|
||||||
|
|
||||||
int width = 120;
|
|
||||||
int height = 120;
|
|
||||||
|
|
||||||
//QPixmap qtn = QPixmap(QString::fromStdString(path)).scaled(width, height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
|
||||||
QPixmap qtn = QPixmap(QString::fromStdString(path)).scaled(width, height, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
|
||||||
imgLabel->setPixmap(qtn);
|
|
||||||
setSelected(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PhotoItem::updateParent(PhotoHolder *parent) // for external construction.
|
|
||||||
{
|
|
||||||
mParent = parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PhotoItem::setDummyText()
|
|
||||||
{
|
|
||||||
titleLabel->setText(QString("Unknown"));
|
|
||||||
fromBoldLabel->setText(QString("By:"));
|
|
||||||
fromLabel->setText(QString("Unknown"));
|
|
||||||
statusBoldLabel->setText(QString("Where:"));
|
|
||||||
statusLabel->setText(QString("Unknown"));
|
|
||||||
dateBoldLabel->setText(QString("When:"));
|
|
||||||
dateLabel->setText(QString("Unknown"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PhotoItem::updateAlbumText(const RsPhotoAlbum &album)
|
|
||||||
{
|
|
||||||
mAlbumDetails = album;
|
|
||||||
mAlbumDetails.mThumbnail.data = 0;
|
|
||||||
updateText();
|
|
||||||
}
|
|
||||||
|
|
||||||
void PhotoItem::updatePhotoText(const RsPhotoPhoto &photo)
|
|
||||||
{
|
|
||||||
// Save new Photo details.
|
|
||||||
mPhotoDetails = photo;
|
|
||||||
mPhotoDetails.mThumbnail.data = 0;
|
|
||||||
updateText();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void PhotoItem::updateText()
|
|
||||||
{
|
|
||||||
// SET Album Values first -> then overwrite with Photo Values.
|
|
||||||
if (mAlbumDetails.mSetFlags & RSPHOTO_FLAGS_ATTRIB_TITLE)
|
|
||||||
{
|
|
||||||
titleLabel->setText(QString::fromUtf8(mAlbumDetails.mMeta.mGroupName.c_str()));
|
|
||||||
}
|
|
||||||
|
|
||||||
// This needs to be fixed!! TODO
|
|
||||||
fromLabel->setText(QString::fromStdString(mAlbumDetails.mMeta.mGroupId));
|
|
||||||
if (mAlbumDetails.mSetFlags & RSPHOTO_FLAGS_ATTRIB_AUTHOR)
|
|
||||||
{
|
|
||||||
// This needs to be fixed!! TODO
|
|
||||||
fromLabel->setText(QString::fromStdString(mAlbumDetails.mMeta.mGroupId));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mAlbumDetails.mSetFlags & RSPHOTO_FLAGS_ATTRIB_WHERE)
|
|
||||||
{
|
|
||||||
statusLabel->setText(QString::fromUtf8(mAlbumDetails.mWhere.c_str()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mAlbumDetails.mSetFlags & RSPHOTO_FLAGS_ATTRIB_WHEN)
|
|
||||||
{
|
|
||||||
dateLabel->setText(QString::fromUtf8(mAlbumDetails.mWhen.c_str()));
|
|
||||||
}
|
|
||||||
|
|
||||||
// NOW Photo Bits.
|
|
||||||
if (mIsPhoto)
|
|
||||||
{
|
|
||||||
if (mPhotoDetails.mSetFlags & RSPHOTO_FLAGS_ATTRIB_TITLE)
|
|
||||||
{
|
|
||||||
titleLabel->setText(QString::fromUtf8(mPhotoDetails.mMeta.mMsgName.c_str()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mPhotoDetails.mSetFlags & RSPHOTO_FLAGS_ATTRIB_AUTHOR)
|
|
||||||
{
|
|
||||||
// This needs to be fixed!! TODO
|
|
||||||
fromLabel->setText(QString::fromStdString(mPhotoDetails.mMeta.mAuthorId));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mPhotoDetails.mSetFlags & RSPHOTO_FLAGS_ATTRIB_WHERE)
|
|
||||||
{
|
|
||||||
statusLabel->setText(QString::fromUtf8(mPhotoDetails.mWhere.c_str()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mPhotoDetails.mSetFlags & RSPHOTO_FLAGS_ATTRIB_WHEN)
|
|
||||||
{
|
|
||||||
dateLabel->setText(QString::fromUtf8(mPhotoDetails.mWhen.c_str()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void PhotoItem::updateImage(const RsPhotoThumbnail &thumbnail)
|
|
||||||
{
|
|
||||||
if (thumbnail.data != NULL)
|
|
||||||
{
|
|
||||||
QPixmap qtn;
|
|
||||||
qtn.loadFromData(thumbnail.data, thumbnail.size, thumbnail.type.c_str());
|
|
||||||
imgLabel->setPixmap(qtn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool PhotoItem::getPhotoThumbnail(RsPhotoThumbnail &nail)
|
|
||||||
{
|
|
||||||
const QPixmap *tmppix = imgLabel->pixmap();
|
|
||||||
|
|
||||||
QByteArray ba;
|
|
||||||
QBuffer buffer(&ba);
|
|
||||||
|
|
||||||
if(!tmppix->isNull())
|
|
||||||
{
|
|
||||||
// send chan image
|
|
||||||
|
|
||||||
buffer.open(QIODevice::WriteOnly);
|
|
||||||
tmppix->save(&buffer, "PNG"); // writes image into ba in PNG format
|
|
||||||
|
|
||||||
RsPhotoThumbnail tmpnail;
|
|
||||||
tmpnail.data = (uint8_t *) ba.data();
|
|
||||||
tmpnail.size = ba.size();
|
|
||||||
|
|
||||||
nail.copyFrom(tmpnail);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
nail.data = NULL;
|
|
||||||
nail.size = 0;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PhotoItem::removeItem()
|
|
||||||
{
|
|
||||||
#ifdef DEBUG_ITEM
|
|
||||||
std::cerr << "PhotoItem::removeItem()";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
#endif
|
|
||||||
hide();
|
|
||||||
if (mParent)
|
|
||||||
{
|
|
||||||
mParent->deletePhotoItem(this, mType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PhotoItem::setSelected(bool on)
|
|
||||||
{
|
|
||||||
mSelected = on;
|
|
||||||
if (mSelected)
|
|
||||||
{
|
|
||||||
mParent->notifySelection(this, mType);
|
|
||||||
frame->setStyleSheet("QFrame#frame{border: 2px solid #55CC55;\nbackground: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #55EE55, stop: 1 #CCCCCC);\nborder-radius: 10px}");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
frame->setStyleSheet("QFrame#frame{border: 2px solid #CCCCCC;\nbackground: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #EEEEEE, stop: 1 #CCCCCC);\nborder-radius: 10px}");
|
|
||||||
}
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool PhotoItem::isSelected()
|
|
||||||
{
|
|
||||||
return mSelected;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PhotoItem::mousePressEvent(QMouseEvent *event)
|
|
||||||
{
|
|
||||||
/* We can be very cunning here?
|
|
||||||
* grab out position.
|
|
||||||
* flag ourselves as selected.
|
|
||||||
* then pass the mousePressEvent up for handling by the parent
|
|
||||||
*/
|
|
||||||
|
|
||||||
QPoint pos = event->pos();
|
|
||||||
|
|
||||||
std::cerr << "PhotoItem::mousePressEvent(" << pos.x() << ", " << pos.y() << ")";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
setSelected(true);
|
|
||||||
|
|
||||||
QWidget::mousePressEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const QPixmap *PhotoItem::getPixmap()
|
|
||||||
{
|
|
||||||
return imgLabel->pixmap();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
#include "ui_PostedItem.h"
|
#include "ui_PostedItem.h"
|
||||||
|
|
||||||
#include <retroshare/rspostedVEG.h>
|
#include <retroshare/rsposted.h>
|
||||||
|
|
||||||
class RsPostedPost;
|
class RsPostedPost;
|
||||||
class PostedItem;
|
class PostedItem;
|
||||||
|
|
|
@ -25,8 +25,7 @@
|
||||||
|
|
||||||
#include "gui/gxs/PostedGroupDialog.h"
|
#include "gui/gxs/PostedGroupDialog.h"
|
||||||
|
|
||||||
//#include <retroshare/rspeers.h>
|
#include <retroshare/rsposted.h>
|
||||||
#include <retroshare/rspostedVEG.h>
|
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
@ -69,7 +68,7 @@ PostedListDialog::PostedListDialog(QWidget *parent)
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
|
|
||||||
/* Setup Queue */
|
/* Setup Queue */
|
||||||
mPostedQueue = new TokenQueueVEG(rsPostedVEG, this);
|
mPostedQueue = new TokenQueue(rsPosted->getTokenService(), this);
|
||||||
|
|
||||||
connect( ui.groupTreeWidget, SIGNAL( treeCustomContextMenuRequested( QPoint ) ), this, SLOT( groupListCustomPopupMenu( QPoint ) ) );
|
connect( ui.groupTreeWidget, SIGNAL( treeCustomContextMenuRequested( QPoint ) ), this, SLOT( groupListCustomPopupMenu( QPoint ) ) );
|
||||||
|
|
||||||
|
@ -144,12 +143,6 @@ void PostedListDialog::groupListCustomPopupMenu( QPoint /*point*/ )
|
||||||
action = contextMnu.addAction(QIcon(":/images/message-mail.png"), tr("Mark all as unread"), this, SLOT(markMsgAsUnreadAll()));
|
action = contextMnu.addAction(QIcon(":/images/message-mail.png"), tr("Mark all as unread"), this, SLOT(markMsgAsUnreadAll()));
|
||||||
//action->setEnabled (!mCurrTopicId.empty () && IS_FORUM_SUBSCRIBED(subscribeFlags));
|
//action->setEnabled (!mCurrTopicId.empty () && IS_FORUM_SUBSCRIBED(subscribeFlags));
|
||||||
|
|
||||||
#ifdef DEBUG_FORUMS
|
|
||||||
contextMnu.addSeparator();
|
|
||||||
action = contextMnu.addAction("Generate mass data", this, SLOT(generateMassData()));
|
|
||||||
action->setEnabled (!mCurrTopicId.empty() && IS_FORUM_SUBSCRIBED(subscribeFlags));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
contextMnu.exec(QCursor::pos());
|
contextMnu.exec(QCursor::pos());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,12 +150,12 @@ void PostedListDialog::updateDisplay()
|
||||||
{
|
{
|
||||||
std::list<std::string> groupIds;
|
std::list<std::string> groupIds;
|
||||||
std::list<std::string>::iterator it;
|
std::list<std::string>::iterator it;
|
||||||
if (!rsPostedVEG)
|
if (!rsPosted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// TODO groupsChanged... HACK XXX.
|
// TODO groupsChanged... HACK XXX.
|
||||||
#if 0
|
#if 0
|
||||||
if ((rsPostedVEG->groupsChanged(groupIds)) || (rsPostedVEG->updated()))
|
if ((rsPosted->groupsChanged(groupIds)) || (rsPosted->updated()))
|
||||||
{
|
{
|
||||||
/* update Forums List */
|
/* update Forums List */
|
||||||
insertGroups();
|
insertGroups();
|
||||||
|
@ -176,7 +169,7 @@ void PostedListDialog::updateDisplay()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (rsPostedVEG->updated())
|
if (rsPosted->updated())
|
||||||
{
|
{
|
||||||
/* update Forums List */
|
/* update Forums List */
|
||||||
insertGroups();
|
insertGroups();
|
||||||
|
@ -244,8 +237,6 @@ void PostedListDialog::sortButtonClicked( QAbstractButton *button )
|
||||||
} else if (button == ui.topSortButton) {
|
} else if (button == ui.topSortButton) {
|
||||||
sortMode = RSPOSTED_VIEWMODE_TOP;
|
sortMode = RSPOSTED_VIEWMODE_TOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
rsPostedVEG->setViewMode(sortMode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -275,7 +266,6 @@ void PostedListDialog::periodChanged( int index )
|
||||||
periodMode = RSPOSTED_PERIOD_YEAR;
|
periodMode = RSPOSTED_PERIOD_YEAR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
rsPostedVEG->setViewPeriod(periodMode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -342,7 +332,7 @@ void PostedListDialog::requestGroupSummary()
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
std::list<std::string> ids;
|
std::list<std::string> ids;
|
||||||
RsTokReqOptionsVEG opts;
|
RsTokReqOptions opts;
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
mPostedQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, ids, POSTEDDIALOG_LISTING);
|
mPostedQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, ids, POSTEDDIALOG_LISTING);
|
||||||
}
|
}
|
||||||
|
@ -353,7 +343,7 @@ void PostedListDialog::loadGroupSummary(const uint32_t &token)
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
std::list<RsGroupMetaData> groupInfo;
|
std::list<RsGroupMetaData> groupInfo;
|
||||||
rsPostedVEG->getGroupSummary(token, groupInfo);
|
rsPosted->getGroupSummary(token, groupInfo);
|
||||||
|
|
||||||
if (groupInfo.size() > 0)
|
if (groupInfo.size() > 0)
|
||||||
{
|
{
|
||||||
|
@ -373,7 +363,7 @@ void PostedListDialog::loadGroupSummary(const uint32_t &token)
|
||||||
|
|
||||||
void PostedListDialog::requestGroupSummary_CurrentForum(const std::string &forumId)
|
void PostedListDialog::requestGroupSummary_CurrentForum(const std::string &forumId)
|
||||||
{
|
{
|
||||||
RsTokReqOptionsVEG opts;
|
RsTokReqOptions opts;
|
||||||
|
|
||||||
std::list<std::string> grpIds;
|
std::list<std::string> grpIds;
|
||||||
grpIds.push_back(forumId);
|
grpIds.push_back(forumId);
|
||||||
|
@ -391,7 +381,7 @@ void PostedListDialog::loadGroupSummary_CurrentForum(const uint32_t &token)
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
std::list<RsGroupMetaData> groupInfo;
|
std::list<RsGroupMetaData> groupInfo;
|
||||||
rsPostedVEG->getGroupSummary(token, groupInfo);
|
rsPosted->getGroupSummary(token, groupInfo);
|
||||||
|
|
||||||
if (groupInfo.size() == 1)
|
if (groupInfo.size() == 1)
|
||||||
{
|
{
|
||||||
|
@ -452,7 +442,7 @@ void PostedListDialog::loadCurrentForumThreads(const std::string &forumId)
|
||||||
|
|
||||||
void PostedListDialog::requestGroupThreadData_InsertThreads(const std::string &groupId)
|
void PostedListDialog::requestGroupThreadData_InsertThreads(const std::string &groupId)
|
||||||
{
|
{
|
||||||
RsTokReqOptionsVEG opts;
|
RsTokReqOptions opts;
|
||||||
|
|
||||||
opts.mOptions = RS_TOKREQOPT_MSG_THREAD | RS_TOKREQOPT_MSG_LATEST;
|
opts.mOptions = RS_TOKREQOPT_MSG_THREAD | RS_TOKREQOPT_MSG_LATEST;
|
||||||
|
|
||||||
|
@ -466,7 +456,7 @@ void PostedListDialog::requestGroupThreadData_InsertThreads(const std::string &g
|
||||||
//mPostedQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds, POSTEDDIALOG_INSERTTHREADS);
|
//mPostedQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds, POSTEDDIALOG_INSERTTHREADS);
|
||||||
|
|
||||||
// Do specific Posted Request....
|
// Do specific Posted Request....
|
||||||
if (rsPostedVEG->requestRanking(token, groupId))
|
if (rsPosted->requestRanking(token, groupId))
|
||||||
{
|
{
|
||||||
// get the Queue to handle response.
|
// get the Queue to handle response.
|
||||||
mPostedQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_DATA, POSTEDDIALOG_INSERTTHREADS);
|
mPostedQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_DATA, POSTEDDIALOG_INSERTTHREADS);
|
||||||
|
@ -484,9 +474,9 @@ void PostedListDialog::loadGroupThreadData_InsertThreads(const uint32_t &token)
|
||||||
{
|
{
|
||||||
RsPostedPost post;
|
RsPostedPost post;
|
||||||
// Old Format.
|
// Old Format.
|
||||||
//if (rsPostedVEG->getPost(token, post))
|
//if ()
|
||||||
|
|
||||||
if (rsPostedVEG->getRankedPost(token, post))
|
if (/*rsPosted->getPost(token, post)*/false)
|
||||||
{
|
{
|
||||||
std::cerr << "PostedListDialog::loadGroupThreadData_InsertThreads() MsgId: " << post.mMeta.mMsgId;
|
std::cerr << "PostedListDialog::loadGroupThreadData_InsertThreads() MsgId: " << post.mMeta.mMsgId;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
@ -559,7 +549,7 @@ void PostedListDialog::clearPosts()
|
||||||
/*********************** **** **** **** ***********************/
|
/*********************** **** **** **** ***********************/
|
||||||
/*********************** **** **** **** ***********************/
|
/*********************** **** **** **** ***********************/
|
||||||
|
|
||||||
void PostedListDialog::loadRequest(const TokenQueueVEG *queue, const TokenRequestVEG &req)
|
void PostedListDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
||||||
{
|
{
|
||||||
std::cerr << "PostedListDialog::loadRequest() UserType: " << req.mUserType;
|
std::cerr << "PostedListDialog::loadRequest() UserType: " << req.mUserType;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
@ -600,78 +590,11 @@ void PostedListDialog::loadRequest(const TokenQueueVEG *queue, const TokenReques
|
||||||
void PostedListDialog::groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo)
|
void PostedListDialog::groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo)
|
||||||
{
|
{
|
||||||
|
|
||||||
groupItemInfo.id = QString::fromStdString(groupInfo.mGroupId);
|
|
||||||
groupItemInfo.name = QString::fromUtf8(groupInfo.mGroupName.c_str());
|
|
||||||
//groupItemInfo.description = QString::fromUtf8(groupInfo.forumDesc);
|
|
||||||
groupItemInfo.popularity = groupInfo.mPop;
|
|
||||||
groupItemInfo.lastpost = QDateTime::fromTime_t(groupInfo.mLastPost);
|
|
||||||
|
|
||||||
if (groupInfo.mGroupFlags & RS_DISTRIB_AUTHEN_REQ) {
|
|
||||||
groupItemInfo.name += " (" + tr("AUTHD") + ")";
|
|
||||||
groupItemInfo.icon = QIcon(IMAGE_FORUMAUTHD);
|
|
||||||
} else {
|
|
||||||
groupItemInfo.icon = QIcon(IMAGE_FORUM);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PostedListDialog::insertGroupData(const std::list<RsGroupMetaData> &groupList)
|
void PostedListDialog::insertGroupData(const std::list<RsGroupMetaData> &groupList)
|
||||||
{
|
{
|
||||||
std::list<RsGroupMetaData>::const_iterator it;
|
|
||||||
|
|
||||||
QList<GroupItemInfo> adminList;
|
|
||||||
QList<GroupItemInfo> subList;
|
|
||||||
QList<GroupItemInfo> popList;
|
|
||||||
QList<GroupItemInfo> otherList;
|
|
||||||
std::multimap<uint32_t, GroupItemInfo> popMap;
|
|
||||||
|
|
||||||
for (it = groupList.begin(); it != groupList.end(); it++) {
|
|
||||||
/* sort it into Publish (Own), Subscribed, Popular and Other */
|
|
||||||
uint32_t flags = it->mSubscribeFlags;
|
|
||||||
|
|
||||||
GroupItemInfo groupItemInfo;
|
|
||||||
groupInfoToGroupItemInfo(*it, groupItemInfo);
|
|
||||||
|
|
||||||
if (flags & RSGXS_GROUP_SUBSCRIBE_ADMIN) {
|
|
||||||
adminList.push_back(groupItemInfo);
|
|
||||||
} else if (flags & RSGXS_GROUP_SUBSCRIBE_SUBSCRIBED) {
|
|
||||||
/* subscribed forum */
|
|
||||||
subList.push_back(groupItemInfo);
|
|
||||||
} else {
|
|
||||||
/* rate the others by popularity */
|
|
||||||
popMap.insert(std::make_pair(it->mPop, groupItemInfo));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* iterate backwards through popMap - take the top 5 or 10% of list */
|
|
||||||
uint32_t popCount = 5;
|
|
||||||
if (popCount < popMap.size() / 10)
|
|
||||||
{
|
|
||||||
popCount = popMap.size() / 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t i = 0;
|
|
||||||
uint32_t popLimit = 0;
|
|
||||||
std::multimap<uint32_t, GroupItemInfo>::reverse_iterator rit;
|
|
||||||
for(rit = popMap.rbegin(); ((rit != popMap.rend()) && (i < popCount)); rit++, i++) ;
|
|
||||||
if (rit != popMap.rend()) {
|
|
||||||
popLimit = rit->first;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (rit = popMap.rbegin(); rit != popMap.rend(); rit++) {
|
|
||||||
if (rit->second.popularity < (int) popLimit) {
|
|
||||||
otherList.append(rit->second);
|
|
||||||
} else {
|
|
||||||
popList.append(rit->second);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* now we can add them in as a tree! */
|
|
||||||
ui.groupTreeWidget->fillGroupItems(yourTopics, adminList);
|
|
||||||
ui.groupTreeWidget->fillGroupItems(subscribedTopics, subList);
|
|
||||||
ui.groupTreeWidget->fillGroupItems(popularTopics, popList);
|
|
||||||
ui.groupTreeWidget->fillGroupItems(otherTopics, otherList);
|
|
||||||
|
|
||||||
// updateMessageSummaryList("");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************************/
|
/**************************************************************************************/
|
||||||
|
|
|
@ -27,18 +27,18 @@
|
||||||
#include "retroshare-gui/mainpage.h"
|
#include "retroshare-gui/mainpage.h"
|
||||||
#include "ui_PostedListDialog.h"
|
#include "ui_PostedListDialog.h"
|
||||||
|
|
||||||
#include <retroshare/rspostedVEG.h>
|
#include <retroshare/rsposted.h>
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include "gui/Posted/PostedItem.h"
|
#include "gui/Posted/PostedItem.h"
|
||||||
#include "gui/common/GroupTreeWidget.h"
|
#include "gui/common/GroupTreeWidget.h"
|
||||||
|
|
||||||
#include "util/TokenQueueVEG.h"
|
#include "util/TokenQueue.h"
|
||||||
|
|
||||||
#include "retroshare-gui/RsAutoUpdatePage.h"
|
#include "retroshare-gui/RsAutoUpdatePage.h"
|
||||||
|
|
||||||
class PostedListDialog : public RsAutoUpdatePage, public PostedHolder, public TokenResponseVEG
|
class PostedListDialog : public RsAutoUpdatePage, public PostedHolder, public TokenResponse
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ void loadGroupThreadData_InsertThreads(const uint32_t &token);
|
||||||
void insertGroupData(const std::list<RsGroupMetaData> &groupList);
|
void insertGroupData(const std::list<RsGroupMetaData> &groupList);
|
||||||
void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo);
|
void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo);
|
||||||
|
|
||||||
void loadRequest(const TokenQueueVEG *queue, const TokenRequestVEG &req);
|
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||||
|
|
||||||
|
|
||||||
QTreeWidgetItem *yourTopics;
|
QTreeWidgetItem *yourTopics;
|
||||||
|
@ -103,7 +103,7 @@ void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &
|
||||||
bool mThreadLoading;
|
bool mThreadLoading;
|
||||||
std::string mCurrTopicId;
|
std::string mCurrTopicId;
|
||||||
|
|
||||||
TokenQueueVEG *mPostedQueue;
|
TokenQueue *mPostedQueue;
|
||||||
|
|
||||||
/* UI - from Designer */
|
/* UI - from Designer */
|
||||||
Ui::PostedListDialog ui;
|
Ui::PostedListDialog ui;
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
#define GXSCOMMENTS_LOADTHREAD 1
|
#define GXSCOMMENTS_LOADTHREAD 1
|
||||||
|
|
||||||
// Temporarily make this specific.
|
// Temporarily make this specific.
|
||||||
#include "retroshare/rspostedVEG.h"
|
#include "retroshare/rsposted.h"
|
||||||
|
|
||||||
|
|
||||||
GxsCommentTreeWidget::GxsCommentTreeWidget(QWidget *parent)
|
GxsCommentTreeWidget::GxsCommentTreeWidget(QWidget *parent)
|
||||||
|
@ -46,10 +46,10 @@ GxsCommentTreeWidget::GxsCommentTreeWidget(QWidget *parent)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsCommentTreeWidget::setup(RsTokenServiceVEG *service)
|
void GxsCommentTreeWidget::setup(RsTokenService *service)
|
||||||
{
|
{
|
||||||
mRsService = service;
|
mRsService = service;
|
||||||
mTokenQueue = new TokenQueueVEG(service, this);
|
mTokenQueue = new TokenQueue(service, this);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -72,11 +72,11 @@ void GxsCommentTreeWidget::service_requestComments(std::string threadId)
|
||||||
std::cerr << "GxsCommentTreeWidget::service_requestComments(" << threadId << ")";
|
std::cerr << "GxsCommentTreeWidget::service_requestComments(" << threadId << ")";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
RsTokReqOptionsVEG opts;
|
RsTokReqOptions opts;
|
||||||
|
|
||||||
opts.mOptions = RS_TOKREQOPT_MSG_THREAD | RS_TOKREQOPT_MSG_LATEST;
|
opts.mOptions = RS_TOKREQOPT_MSG_THREAD | RS_TOKREQOPT_MSG_LATEST;
|
||||||
opts.mFlagsFilter = RSPOSTED_MSGTYPE_COMMENT;
|
// opts.mFlagsFilter = RSPOSTED_MSGTYPE_COMMENT;
|
||||||
opts.mFlagsMask = RSPOSTED_MSGTYPE_COMMENT;
|
// opts.mFlagsMask = RSPOSTED_MSGTYPE_COMMENT;
|
||||||
|
|
||||||
std::list<std::string> msgIds;
|
std::list<std::string> msgIds;
|
||||||
msgIds.push_back(threadId);
|
msgIds.push_back(threadId);
|
||||||
|
@ -84,7 +84,7 @@ void GxsCommentTreeWidget::service_requestComments(std::string threadId)
|
||||||
mThreadId = threadId;
|
mThreadId = threadId;
|
||||||
|
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
mTokenQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, GXSCOMMENTS_LOADTHREAD);
|
// mTokenQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, GXSCOMMENTS_LOADTHREAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -211,49 +211,49 @@ void GxsCommentTreeWidget::service_loadThread(const uint32_t &token)
|
||||||
std::cerr << "GxsCommentTreeWidget::service_loadThread() ERROR must be overloaded!";
|
std::cerr << "GxsCommentTreeWidget::service_loadThread() ERROR must be overloaded!";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
RsPostedComment comment;
|
// RsPostedComment comment;
|
||||||
while(rsPostedVEG->getComment(token, comment))
|
// while(rsPosted->getComment(token, comment))
|
||||||
{
|
// {
|
||||||
/* convert to a QTreeWidgetItem */
|
// /* convert to a QTreeWidgetItem */
|
||||||
std::cerr << "GxsCommentTreeWidget::service_loadThread() Got Comment: " << comment;
|
// std::cerr << "GxsCommentTreeWidget::service_loadThread() Got Comment: " << comment;
|
||||||
std::cerr << std::endl;
|
// std::cerr << std::endl;
|
||||||
|
|
||||||
QTreeWidgetItem *item = new QTreeWidgetItem();
|
// QTreeWidgetItem *item = new QTreeWidgetItem();
|
||||||
QString text;
|
// QString text;
|
||||||
|
|
||||||
{
|
// {
|
||||||
QDateTime qtime;
|
// QDateTime qtime;
|
||||||
qtime.setTime_t(comment.mMeta.mPublishTs);
|
// qtime.setTime_t(comment.mMeta.mPublishTs);
|
||||||
|
|
||||||
text = qtime.toString("yyyy-MM-dd hh:mm:ss");
|
// text = qtime.toString("yyyy-MM-dd hh:mm:ss");
|
||||||
item->setText(PCITEM_COLUMN_DATE, text);
|
// item->setText(PCITEM_COLUMN_DATE, text);
|
||||||
}
|
// }
|
||||||
|
|
||||||
text = QString::fromUtf8(comment.mComment.c_str());
|
// text = QString::fromUtf8(comment.mComment.c_str());
|
||||||
item->setText(PCITEM_COLUMN_COMMENT, text);
|
// item->setText(PCITEM_COLUMN_COMMENT, text);
|
||||||
|
|
||||||
text = QString::fromUtf8(comment.mMeta.mAuthorId.c_str());
|
// text = QString::fromUtf8(comment.mMeta.mAuthorId.c_str());
|
||||||
if (text.isEmpty())
|
// if (text.isEmpty())
|
||||||
{
|
// {
|
||||||
item->setText(PCITEM_COLUMN_AUTHOR, tr("Anonymous"));
|
// item->setText(PCITEM_COLUMN_AUTHOR, tr("Anonymous"));
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
item->setText(PCITEM_COLUMN_AUTHOR, text);
|
// item->setText(PCITEM_COLUMN_AUTHOR, text);
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
text = QString::fromUtf8(comment.mMeta.mMsgId.c_str());
|
// text = QString::fromUtf8(comment.mMeta.mMsgId.c_str());
|
||||||
item->setText(PCITEM_COLUMN_MSGID, text);
|
// item->setText(PCITEM_COLUMN_MSGID, text);
|
||||||
|
|
||||||
text = QString::fromUtf8(comment.mMeta.mParentId.c_str());
|
// text = QString::fromUtf8(comment.mMeta.mParentId.c_str());
|
||||||
item->setText(PCITEM_COLUMN_PARENTID, text);
|
// item->setText(PCITEM_COLUMN_PARENTID, text);
|
||||||
|
|
||||||
text = QString::fromUtf8(comment.mMeta.mServiceString.c_str());
|
// text = QString::fromUtf8(comment.mMeta.mServiceString.c_str());
|
||||||
item->setText(PCITEM_COLUMN_SERVSTRING, text);
|
// item->setText(PCITEM_COLUMN_SERVSTRING, text);
|
||||||
|
|
||||||
addItem(comment.mMeta.mMsgId, comment.mMeta.mParentId, item);
|
// addItem(comment.mMeta.mMsgId, comment.mMeta.mParentId, item);
|
||||||
}
|
// }
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -286,7 +286,7 @@ QTreeWidgetItem *GxsCommentTreeWidget::service_createMissingItem(std::string par
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GxsCommentTreeWidget::loadRequest(const TokenQueueVEG *queue, const TokenRequestVEG &req)
|
void GxsCommentTreeWidget::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
||||||
{
|
{
|
||||||
std::cerr << "GxsCommentTreeWidget::loadRequest() UserType: " << req.mUserType;
|
std::cerr << "GxsCommentTreeWidget::loadRequest() UserType: " << req.mUserType;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
#include <QTreeWidget>
|
#include <QTreeWidget>
|
||||||
|
|
||||||
#include "util/TokenQueueVEG.h"
|
#include "util/TokenQueue.h"
|
||||||
|
|
||||||
/* indicies for search results item columns SR_ = Search Result */
|
/* indicies for search results item columns SR_ = Search Result */
|
||||||
#define SR_NAME_COL 0
|
#define SR_NAME_COL 0
|
||||||
|
@ -39,17 +39,17 @@
|
||||||
|
|
||||||
#define SR_ROLE_LOCAL Qt::UserRole
|
#define SR_ROLE_LOCAL Qt::UserRole
|
||||||
|
|
||||||
class GxsCommentTreeWidget : public QTreeWidget, public TokenResponseVEG
|
class GxsCommentTreeWidget : public QTreeWidget, public TokenResponse
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GxsCommentTreeWidget(QWidget *parent = 0);
|
GxsCommentTreeWidget(QWidget *parent = 0);
|
||||||
void setup(RsTokenServiceVEG *service);
|
void setup(RsTokenService *service);
|
||||||
|
|
||||||
void requestComments(std::string threadId);
|
void requestComments(std::string threadId);
|
||||||
|
|
||||||
void loadRequest(const TokenQueueVEG *queue, const TokenRequestVEG &req);
|
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@ -73,8 +73,8 @@ protected:
|
||||||
std::map<std::string, QTreeWidgetItem *> mLoadingMap;
|
std::map<std::string, QTreeWidgetItem *> mLoadingMap;
|
||||||
std::multimap<std::string, QTreeWidgetItem *> mPendingInsertMap;
|
std::multimap<std::string, QTreeWidgetItem *> mPendingInsertMap;
|
||||||
|
|
||||||
TokenQueueVEG *mTokenQueue;
|
TokenQueue *mTokenQueue;
|
||||||
RsTokenServiceVEG *mRsService;
|
RsTokenService *mRsService;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//virtual QMimeData * mimeData ( const QList<QTreeWidgetItem *> items ) const;
|
//virtual QMimeData * mimeData ( const QList<QTreeWidgetItem *> items ) const;
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "util/misc.h"
|
#include "util/misc.h"
|
||||||
#include "GxsGroupDialog.h"
|
#include "GxsGroupDialog.h"
|
||||||
#include "gui/common/PeerDefs.h"
|
#include "gui/common/PeerDefs.h"
|
||||||
|
#include "gxs/rsgxsflags.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
@ -31,17 +32,31 @@
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
// Control of Publish Signatures.
|
||||||
|
#define RSGXS_GROUP_SIGN_PUBLISH_MASK 0x000000ff
|
||||||
|
#define RSGXS_GROUP_SIGN_PUBLISH_ENCRYPTED 0x00000001
|
||||||
|
#define RSGXS_GROUP_SIGN_PUBLISH_ALLSIGNED 0x00000002
|
||||||
|
#define RSGXS_GROUP_SIGN_PUBLISH_THREADHEAD 0x00000004
|
||||||
|
#define RSGXS_GROUP_SIGN_PUBLISH_NONEREQ 0x00000008
|
||||||
|
|
||||||
|
// Author Signature.
|
||||||
|
#define RSGXS_GROUP_SIGN_AUTHOR_MASK 0x0000ff00
|
||||||
|
#define RSGXS_GROUP_SIGN_AUTHOR_GPG 0x00000100
|
||||||
|
#define RSGXS_GROUP_SIGN_AUTHOR_REQUIRED 0x00000200
|
||||||
|
#define RSGXS_GROUP_SIGN_AUTHOR_IFNOPUBSIGN 0x00000400
|
||||||
|
#define RSGXS_GROUP_SIGN_AUTHOR_NONE 0x00000800
|
||||||
|
|
||||||
#define GXSGROUP_NEWGROUPID 1
|
#define GXSGROUP_NEWGROUPID 1
|
||||||
#define GXSGROUP_LOADGROUP 2
|
#define GXSGROUP_LOADGROUP 2
|
||||||
|
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
GxsGroupDialog::GxsGroupDialog(RsTokenServiceVEG *service, QWidget *parent)
|
GxsGroupDialog::GxsGroupDialog(RsTokenService *service, QWidget *parent)
|
||||||
: QDialog(parent), mRsService(service)
|
: QDialog(parent), mRsService(service)
|
||||||
{
|
{
|
||||||
/* Invoke the Qt Designer generated object setup routine */
|
/* Invoke the Qt Designer generated object setup routine */
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
|
|
||||||
mTokenQueue = new TokenQueueVEG(service, this);
|
mTokenQueue = new TokenQueue(service, this);
|
||||||
|
|
||||||
// connect up the buttons.
|
// connect up the buttons.
|
||||||
connect( ui.cancelButton, SIGNAL( clicked ( bool ) ), this, SLOT( cancelDialog( ) ) );
|
connect( ui.cancelButton, SIGNAL( clicked ( bool ) ), this, SLOT( cancelDialog( ) ) );
|
||||||
|
@ -289,7 +304,7 @@ void GxsGroupDialog::existingGroup(std::string groupId, uint32_t mode)
|
||||||
|
|
||||||
/* request data */
|
/* request data */
|
||||||
{
|
{
|
||||||
RsTokReqOptionsVEG opts;
|
RsTokReqOptions opts;
|
||||||
|
|
||||||
std::list<std::string> grpIds;
|
std::list<std::string> grpIds;
|
||||||
grpIds.push_back(groupId);
|
grpIds.push_back(groupId);
|
||||||
|
@ -391,7 +406,7 @@ void GxsGroupDialog::createGroup()
|
||||||
meta.mSignFlags = getGroupSignFlags();
|
meta.mSignFlags = getGroupSignFlags();
|
||||||
|
|
||||||
// These ones shouldn't be needed here - but will be used, until we have fully functional backend.
|
// These ones shouldn't be needed here - but will be used, until we have fully functional backend.
|
||||||
meta.mSubscribeFlags = RSGXS_GROUP_SUBSCRIBE_ADMIN;
|
meta.mSubscribeFlags = GXS_SERV::GROUP_SUBSCRIBE_ADMIN;
|
||||||
meta.mPublishTs = time(NULL);
|
meta.mPublishTs = time(NULL);
|
||||||
|
|
||||||
if (service_CreateGroup(token, meta))
|
if (service_CreateGroup(token, meta))
|
||||||
|
@ -528,19 +543,7 @@ void GxsGroupDialog::addGroupLogo()
|
||||||
|
|
||||||
void GxsGroupDialog::sendShareList(std::string groupId)
|
void GxsGroupDialog::sendShareList(std::string groupId)
|
||||||
{
|
{
|
||||||
if (!mRsService)
|
|
||||||
{
|
|
||||||
std::cerr << "GxsGroupDialog::sendShareList() GXS Service not active";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ui.pubKeyShare_cb->isChecked())
|
|
||||||
{
|
|
||||||
std::list<std::string> shareList;
|
|
||||||
ui.keyShareList->selectedSslIds(shareList, false);
|
|
||||||
mRsService->groupShareKeys(groupId, shareList);
|
|
||||||
}
|
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -566,7 +569,6 @@ void GxsGroupDialog::loadNewGroupId(const uint32_t &token)
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
std::list<RsGroupMetaData> groupInfo;
|
std::list<RsGroupMetaData> groupInfo;
|
||||||
mRsService->getGroupSummary(token, groupInfo);
|
|
||||||
|
|
||||||
if (groupInfo.size() == 1)
|
if (groupInfo.size() == 1)
|
||||||
{
|
{
|
||||||
|
@ -605,7 +607,7 @@ void GxsGroupDialog::service_loadExistingGroup(const uint32_t &token)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GxsGroupDialog::loadRequest(const TokenQueueVEG *queue, const TokenRequestVEG &req)
|
void GxsGroupDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
||||||
{
|
{
|
||||||
std::cerr << "GxsGroupDialog::loadRequest() UserType: " << req.mUserType;
|
std::cerr << "GxsGroupDialog::loadRequest() UserType: " << req.mUserType;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
#include "ui_GxsGroupDialog.h"
|
#include "ui_GxsGroupDialog.h"
|
||||||
|
|
||||||
#include "util/TokenQueueVEG.h"
|
#include "util/TokenQueue.h"
|
||||||
|
|
||||||
|
|
||||||
/********
|
/********
|
||||||
|
@ -90,12 +90,12 @@ public:
|
||||||
#define GXS_GROUP_DIALOG_SHOW_MODE 2
|
#define GXS_GROUP_DIALOG_SHOW_MODE 2
|
||||||
#define GXS_GROUP_DIALOG_EDIT_MODE 3
|
#define GXS_GROUP_DIALOG_EDIT_MODE 3
|
||||||
|
|
||||||
class GxsGroupDialog : public QDialog, public TokenResponseVEG
|
class GxsGroupDialog : public QDialog, public TokenResponse
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GxsGroupDialog(RsTokenServiceVEG *service, QWidget *parent = 0);
|
GxsGroupDialog(RsTokenService *service, QWidget *parent = 0);
|
||||||
|
|
||||||
void setFlags(uint32_t enabledFlags, uint32_t readonlyFlags, uint32_t defaultFlags);
|
void setFlags(uint32_t enabledFlags, uint32_t readonlyFlags, uint32_t defaultFlags);
|
||||||
void setMode(uint32_t mode);
|
void setMode(uint32_t mode);
|
||||||
|
@ -105,7 +105,7 @@ public:
|
||||||
void existingGroup(std::string groupId, uint32_t mode);
|
void existingGroup(std::string groupId, uint32_t mode);
|
||||||
|
|
||||||
// Callback for all Loads.
|
// Callback for all Loads.
|
||||||
virtual void loadRequest(const TokenQueueVEG *queue, const TokenRequestVEG &req);
|
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||||
|
|
||||||
|
|
||||||
// Functions that can be overloaded for specific stuff.
|
// Functions that can be overloaded for specific stuff.
|
||||||
|
@ -159,8 +159,8 @@ private:
|
||||||
|
|
||||||
QPixmap picture;
|
QPixmap picture;
|
||||||
|
|
||||||
RsTokenServiceVEG *mRsService;
|
RsTokenService *mRsService;
|
||||||
TokenQueueVEG *mTokenQueue;
|
TokenQueue *mTokenQueue;
|
||||||
|
|
||||||
uint32_t mMode;
|
uint32_t mMode;
|
||||||
|
|
||||||
|
|
|
@ -21,11 +21,11 @@
|
||||||
|
|
||||||
#include "PostedGroupDialog.h"
|
#include "PostedGroupDialog.h"
|
||||||
|
|
||||||
#include <retroshare/rspostedVEG.h>
|
#include <retroshare/rsposted.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
PostedGroupDialog::PostedGroupDialog(QWidget *parent)
|
PostedGroupDialog::PostedGroupDialog(QWidget *parent)
|
||||||
:GxsGroupDialog(rsPostedVEG, parent)
|
:GxsGroupDialog(rsPosted->getTokenService(), parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
// To start with we only have open forums - with distribution controls.
|
// To start with we only have open forums - with distribution controls.
|
||||||
|
@ -70,7 +70,7 @@ bool PostedGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMetaDa
|
||||||
grp.mMeta = meta;
|
grp.mMeta = meta;
|
||||||
//grp.mDescription = std::string(desc.toUtf8());
|
//grp.mDescription = std::string(desc.toUtf8());
|
||||||
|
|
||||||
rsPostedVEG->submitGroup(token, grp, true);
|
rsPosted->submitGroup(token, grp);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ void PostedGroupDialog::service_loadExistingGroup(const uint32_t &token)
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
RsPostedGroup group;
|
RsPostedGroup group;
|
||||||
if (!rsPostedVEG->getGroup(token, group))
|
if (!rsPosted->getGroup(token, group))
|
||||||
{
|
{
|
||||||
std::cerr << "PostedGroupDialog::service_loadExistingGroup() ERROR Getting Group";
|
std::cerr << "PostedGroupDialog::service_loadExistingGroup() ERROR Getting Group";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
|
@ -86,10 +86,6 @@ ApplicationWindow::ApplicationWindow(QWidget* parent, Qt::WFlags flags)
|
||||||
//ui.stackPages->add(statisticDialog = new StatisticDialog(ui.stackPages),
|
//ui.stackPages->add(statisticDialog = new StatisticDialog(ui.stackPages),
|
||||||
// createPageAction(QIcon(IMAGE_STATISTIC), tr("Statistics"), grp));
|
// createPageAction(QIcon(IMAGE_STATISTIC), tr("Statistics"), grp));
|
||||||
|
|
||||||
//PhotoDialog *photoDialog = NULL;
|
|
||||||
//ui.stackPages->add(photoDialog = new PhotoDialog(ui.stackPages),
|
|
||||||
// createPageAction(QIcon(IMAGE_PHOTO), tr("Photo View"), grp));
|
|
||||||
|
|
||||||
//GamesDialog *gamesDialog = NULL;
|
//GamesDialog *gamesDialog = NULL;
|
||||||
//ui.stackPages->add(gamesDialog = new GamesDialog(ui.stackPages),
|
//ui.stackPages->add(gamesDialog = new GamesDialog(ui.stackPages),
|
||||||
// createPageAction(QIcon(IMAGE_GAMES), tr("Games Launcher"), grp));
|
// createPageAction(QIcon(IMAGE_GAMES), tr("Games Launcher"), grp));
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "util/TokenQueueV2.h"
|
#include "util/TokenQueue.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
@ -32,13 +32,13 @@
|
||||||
*****/
|
*****/
|
||||||
|
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
TokenQueueV2::TokenQueueV2(RsTokenService *service, TokenResponseV2 *resp)
|
TokenQueue::TokenQueue(RsTokenService *service, TokenResponse *resp)
|
||||||
:QWidget(NULL), mService(service), mResponder(resp)
|
:QWidget(NULL), mService(service), mResponder(resp)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TokenQueueV2::requestGroupInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptionsV2 &opts, std::list<RsGxsGroupId>& ids, uint32_t usertype)
|
bool TokenQueue::requestGroupInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts, std::list<RsGxsGroupId>& ids, uint32_t usertype)
|
||||||
{
|
{
|
||||||
uint32_t basictype = TOKENREQ_GROUPINFO;
|
uint32_t basictype = TOKENREQ_GROUPINFO;
|
||||||
mService->requestGroupInfo(token, anstype, opts, ids);
|
mService->requestGroupInfo(token, anstype, opts, ids);
|
||||||
|
@ -48,7 +48,7 @@ bool TokenQueueV2::requestGroupInfo(uint32_t &token, uint32_t anstype, const RsT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TokenQueueV2::requestGroupInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptionsV2 &opts, uint32_t usertype)
|
bool TokenQueue::requestGroupInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts, uint32_t usertype)
|
||||||
{
|
{
|
||||||
uint32_t basictype = TOKENREQ_GROUPINFO;
|
uint32_t basictype = TOKENREQ_GROUPINFO;
|
||||||
mService->requestGroupInfo(token, anstype, opts);
|
mService->requestGroupInfo(token, anstype, opts);
|
||||||
|
@ -57,7 +57,7 @@ bool TokenQueueV2::requestGroupInfo(uint32_t &token, uint32_t anstype, const RsT
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TokenQueueV2::requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptionsV2 &opts, const GxsMsgReq& ids, uint32_t usertype)
|
bool TokenQueue::requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts, const GxsMsgReq& ids, uint32_t usertype)
|
||||||
{
|
{
|
||||||
uint32_t basictype = TOKENREQ_MSGINFO;
|
uint32_t basictype = TOKENREQ_MSGINFO;
|
||||||
mService->requestMsgInfo(token, anstype, opts, ids);
|
mService->requestMsgInfo(token, anstype, opts, ids);
|
||||||
|
@ -67,7 +67,7 @@ bool TokenQueueV2::requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTok
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TokenQueueV2::requestMsgRelatedInfo(uint32_t &token, const RsTokReqOptionsV2 &opts, const RsGxsGrpMsgIdPair &msgId, uint32_t usertype)
|
bool TokenQueue::requestMsgRelatedInfo(uint32_t &token, const RsTokReqOptions &opts, const RsGxsGrpMsgIdPair &msgId, uint32_t usertype)
|
||||||
{
|
{
|
||||||
uint32_t basictype = TOKENREQ_MSGINFO;
|
uint32_t basictype = TOKENREQ_MSGINFO;
|
||||||
uint32_t anstype = RS_TOKREQ_ANSTYPE_LIST; // always a list answer
|
uint32_t anstype = RS_TOKREQ_ANSTYPE_LIST; // always a list answer
|
||||||
|
@ -78,7 +78,7 @@ bool TokenQueueV2::requestMsgRelatedInfo(uint32_t &token, const RsTokReqOptionsV
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TokenQueueV2::requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptionsV2 &opts,
|
bool TokenQueue::requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts,
|
||||||
const std::list<RsGxsGroupId> &grpIds, uint32_t usertype)
|
const std::list<RsGxsGroupId> &grpIds, uint32_t usertype)
|
||||||
{
|
{
|
||||||
uint32_t basictype = TOKENREQ_MSGINFO;
|
uint32_t basictype = TOKENREQ_MSGINFO;
|
||||||
|
@ -89,13 +89,13 @@ bool TokenQueueV2::requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTok
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TokenQueueV2::queueRequest(uint32_t token, uint32_t basictype, uint32_t anstype, uint32_t usertype)
|
void TokenQueue::queueRequest(uint32_t token, uint32_t basictype, uint32_t anstype, uint32_t usertype)
|
||||||
{
|
{
|
||||||
std::cerr << "TokenQueueV2::queueRequest() Token: " << token << " Type: " << basictype;
|
std::cerr << "TokenQueue::queueRequest() Token: " << token << " Type: " << basictype;
|
||||||
std::cerr << " AnsType: " << anstype << " UserType: " << usertype;
|
std::cerr << " AnsType: " << anstype << " UserType: " << usertype;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
TokenRequestV2 req;
|
TokenRequest req;
|
||||||
req.mToken = token;
|
req.mToken = token;
|
||||||
req.mType = basictype;
|
req.mType = basictype;
|
||||||
req.mAnsType = anstype;
|
req.mAnsType = anstype;
|
||||||
|
@ -113,7 +113,7 @@ void TokenQueueV2::queueRequest(uint32_t token, uint32_t basictype, uint32_t ans
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TokenQueueV2::doPoll(float dt)
|
void TokenQueue::doPoll(float dt)
|
||||||
{
|
{
|
||||||
/* single shot poll */
|
/* single shot poll */
|
||||||
//mTrigger->singlesshot(dt * 1000);
|
//mTrigger->singlesshot(dt * 1000);
|
||||||
|
@ -121,11 +121,11 @@ void TokenQueueV2::doPoll(float dt)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TokenQueueV2::pollRequests()
|
void TokenQueue::pollRequests()
|
||||||
{
|
{
|
||||||
double pollPeriod = 1.0; // max poll period.
|
double pollPeriod = 1.0; // max poll period.
|
||||||
|
|
||||||
TokenRequestV2 req;
|
TokenRequest req;
|
||||||
|
|
||||||
if(mRequests.size() > 0){
|
if(mRequests.size() > 0){
|
||||||
req = mRequests.front();
|
req = mRequests.front();
|
||||||
|
@ -148,7 +148,7 @@ void TokenQueueV2::pollRequests()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TokenQueueV2::checkForRequest(uint32_t token)
|
bool TokenQueue::checkForRequest(uint32_t token)
|
||||||
{
|
{
|
||||||
/* check token */
|
/* check token */
|
||||||
uint32_t status = mService->requestStatus(token);
|
uint32_t status = mService->requestStatus(token);
|
||||||
|
@ -157,9 +157,9 @@ bool TokenQueueV2::checkForRequest(uint32_t token)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TokenQueueV2::loadRequest(const TokenRequestV2 &req)
|
void TokenQueue::loadRequest(const TokenRequest &req)
|
||||||
{
|
{
|
||||||
std::cerr << "TokenQueueV2::loadRequest(): ";
|
std::cerr << "TokenQueue::loadRequest(): ";
|
||||||
std::cerr << "Token: " << req.mToken << " Type: " << req.mType;
|
std::cerr << "Token: " << req.mToken << " Type: " << req.mType;
|
||||||
std::cerr << " AnsType: " << req.mAnsType << " UserType: " << req.mUserType;
|
std::cerr << " AnsType: " << req.mAnsType << " UserType: " << req.mUserType;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
@ -170,12 +170,12 @@ void TokenQueueV2::loadRequest(const TokenRequestV2 &req)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TokenQueueV2::cancelRequest(const uint32_t token)
|
bool TokenQueue::cancelRequest(const uint32_t token)
|
||||||
{
|
{
|
||||||
/* cancel at lower level first */
|
/* cancel at lower level first */
|
||||||
mService->cancelRequest(token);
|
mService->cancelRequest(token);
|
||||||
|
|
||||||
std::list<TokenRequestV2>::iterator it;
|
std::list<TokenRequest>::iterator it;
|
||||||
|
|
||||||
for(it = mRequests.begin(); it != mRequests.end(); it++)
|
for(it = mRequests.begin(); it != mRequests.end(); it++)
|
||||||
{
|
{
|
||||||
|
@ -183,14 +183,14 @@ bool TokenQueueV2::cancelRequest(const uint32_t token)
|
||||||
{
|
{
|
||||||
mRequests.erase(it);
|
mRequests.erase(it);
|
||||||
|
|
||||||
std::cerr << "TokenQueueV2::cancelRequest() Cleared Request: " << token;
|
std::cerr << "TokenQueue::cancelRequest() Cleared Request: " << token;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cerr << "TokenQueueV2::cancelRequest() Failed to Find Request: " << token;
|
std::cerr << "TokenQueue::cancelRequest() Failed to Find Request: " << token;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
return false;
|
return false;
|
|
@ -41,9 +41,9 @@
|
||||||
#define TOKENREQ_MSGRELATEDINFO 3
|
#define TOKENREQ_MSGRELATEDINFO 3
|
||||||
|
|
||||||
|
|
||||||
class TokenQueueV2;
|
class TokenQueue;
|
||||||
|
|
||||||
class TokenRequestV2
|
class TokenRequest
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
uint32_t mToken;
|
uint32_t mToken;
|
||||||
|
@ -54,12 +54,12 @@ class TokenRequestV2
|
||||||
struct timeval mPollTs;
|
struct timeval mPollTs;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TokenResponseV2
|
class TokenResponse
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//virtual ~TokenResponse() { return; }
|
//virtual ~TokenResponse() { return; }
|
||||||
// These Functions are overloaded to get results out.
|
// These Functions are overloaded to get results out.
|
||||||
virtual void loadRequest(const TokenQueueV2 *queue, const TokenRequestV2 &req) = 0;
|
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,12 +67,12 @@ class TokenResponseV2
|
||||||
* An important thing to note is that all requests are stacked (so FIFO)
|
* An important thing to note is that all requests are stacked (so FIFO)
|
||||||
* This is to prevent overlapped loads on GXS UIs
|
* This is to prevent overlapped loads on GXS UIs
|
||||||
*/
|
*/
|
||||||
class TokenQueueV2: public QWidget
|
class TokenQueue: public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TokenQueueV2(RsTokenService *service, TokenResponseV2 *resp);
|
TokenQueue(RsTokenService *service, TokenResponse *resp);
|
||||||
|
|
||||||
/* generic handling of token / response update behaviour */
|
/* generic handling of token / response update behaviour */
|
||||||
|
|
||||||
|
@ -81,25 +81,25 @@ public:
|
||||||
* @token the token to be redeem is assigned here
|
* @token the token to be redeem is assigned here
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
bool requestGroupInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptionsV2 &opts,
|
bool requestGroupInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts,
|
||||||
std::list<RsGxsGroupId>& ids, uint32_t usertype);
|
std::list<RsGxsGroupId>& ids, uint32_t usertype);
|
||||||
|
|
||||||
|
|
||||||
bool requestGroupInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptionsV2 &opts, uint32_t usertype);
|
bool requestGroupInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts, uint32_t usertype);
|
||||||
|
|
||||||
bool requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptionsV2 &opts,
|
bool requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts,
|
||||||
const std::list<RsGxsGroupId>& grpIds, uint32_t usertype);
|
const std::list<RsGxsGroupId>& grpIds, uint32_t usertype);
|
||||||
|
|
||||||
bool requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptionsV2 &opts,
|
bool requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts,
|
||||||
const GxsMsgReq& grpIds, uint32_t usertype);
|
const GxsMsgReq& grpIds, uint32_t usertype);
|
||||||
|
|
||||||
bool requestMsgRelatedInfo(uint32_t &token, const RsTokReqOptionsV2 &opts, const RsGxsGrpMsgIdPair& msgId, uint32_t usertype);
|
bool requestMsgRelatedInfo(uint32_t &token, const RsTokReqOptions &opts, const RsGxsGrpMsgIdPair& msgId, uint32_t usertype);
|
||||||
|
|
||||||
bool cancelRequest(const uint32_t token);
|
bool cancelRequest(const uint32_t token);
|
||||||
|
|
||||||
void queueRequest(uint32_t token, uint32_t basictype, uint32_t anstype, uint32_t usertype);
|
void queueRequest(uint32_t token, uint32_t basictype, uint32_t anstype, uint32_t usertype);
|
||||||
bool checkForRequest(uint32_t token);
|
bool checkForRequest(uint32_t token);
|
||||||
void loadRequest(const TokenRequestV2 &req);
|
void loadRequest(const TokenRequest &req);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void doPoll(float dt);
|
void doPoll(float dt);
|
||||||
|
@ -109,10 +109,10 @@ private slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/* Info for Data Requests */
|
/* Info for Data Requests */
|
||||||
std::list<TokenRequestV2> mRequests;
|
std::list<TokenRequest> mRequests;
|
||||||
|
|
||||||
RsTokenService *mService;
|
RsTokenService *mService;
|
||||||
TokenResponseV2 *mResponder;
|
TokenResponse *mResponder;
|
||||||
|
|
||||||
QTimer *mTrigger;
|
QTimer *mTrigger;
|
||||||
};
|
};
|
Loading…
Add table
Add a link
Reference in a new issue