emergency commit, computer acting up bad!

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5565 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
chrisparker126 2012-09-17 22:08:23 +00:00
parent 4f470090b2
commit eaa7342165
39 changed files with 1835 additions and 2080 deletions

View File

@ -632,9 +632,6 @@ void RsGenExchange::publishGrps()
size = grp->metaData->serial_size();
char mData[size];
grp->metaData->mGroupId = grp->grpId;
// indicate user is admin through local subscribe flag
grp->metaData->mSubscribeFlags = GXS_SERV::GROUP_SUBSCRIBE_ADMIN;
ok = grp->metaData->serialise(mData, size);
grp->meta.setBinData(mData, size);

View File

@ -153,6 +153,13 @@ protected:
*/
bool getMsgData(const uint32_t &token, GxsMsgDataMap& msgItems);
/*!
* @param grpItem
* @deprecated only here to temporarily to testing
*/
void createDummyGroup(RsGxsGrpItem* grpItem);
public:
/*!
@ -259,6 +266,13 @@ private:
void createGroup(RsNxsGrp* grp);
bool createMessage(RsNxsMsg* msg);
/*!
* check meta change is legal
* @return false if meta change is not legal
*/
bool locked_validateGrpMetaChange(GrpLocMetaData&);
private:
RsMutex mGenMtx;

View File

@ -98,7 +98,7 @@ void RsGxsNetService::syncWithPeers()
{
RsGxsGrpMetaData* meta = mit->second;
if(meta->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_MASK)
if(meta->mSubscribeFlags & GXS_SERV::RSGXS_GROUP_SUBSCRIBE_MASK)
grpIds.push_back(mit->first);
}

View File

@ -59,6 +59,8 @@
#define RS_TOKREQ_ANSTYPE_LIST 0x0001
#define RS_TOKREQ_ANSTYPE_SUMMARY 0x0002
#define RS_TOKREQ_ANSTYPE_DATA 0x0003
#define RS_TOKREQ_ANSTYPE_ACK 0x0004
@ -72,7 +74,8 @@ public:
RsTokReqOptionsV2()
{
mOptions = 0;
mStatusFilter = 0; mStatusMask = 0; mSubscribeFilter = 0;
mStatusFilter = 0; mStatusMask = 0; mSubscribeFilter = 0;
mMsgFlagMask = 0; mMsgFlagFilter = 0;
mBefore = 0; mAfter = 0; mReqType = 0;
}
@ -83,6 +86,8 @@ uint32_t mOptions;
uint32_t mStatusFilter;
uint32_t mStatusMask;
uint32_t mMsgFlagMask, mMsgFlagFilter;
uint32_t mReqType;
uint32_t mSubscribeFilter; // Only for Groups.

View File

@ -10,7 +10,7 @@ CONFIG += test_voip
# GXS Stuff.
CONFIG += newcache
CONFIG += newservices
#CONFIG += newservices
# Beware: All data of the stripped services are lost
DEFINES *= PQI_DISABLE_TUNNEL
@ -137,7 +137,8 @@ PUBLIC_HEADERS = retroshare/rsblogs.h \
retroshare/rstypes.h \
retroshare/rsdht.h \
retroshare/rsdsdv.h \
retroshare/rsconfig.h
retroshare/rsconfig.h \
retroshare/rsphotoV2.h
HEADERS += plugins/pluginmanager.h \
plugins/dlfcn_win32.h \
serialiser/rspluginitems.h
@ -148,65 +149,7 @@ HEADERS += retroshare/rsgame.h \
retroshare/rsphoto.h
# ################################ Linux ##########################################
linux-*:isEmpty(PREFIX) {
PREFIX = /usr \
}
isEmpty(INC_DIR) {
INC_DIR = $${PREFIX}/include/retroshare/ \
}
isEmpty(LIB_DIR) {
LIB_DIR = $${PREFIX}/lib/ \
}
# These two lines fixe compilation on ubuntu natty. Probably a ubuntu packaging error.
INCLUDEPATH *= /usr/lib/x86_64-linux-gnu/glib-2.0/include/
INCLUDEPATH *= /usr/lib/i386-linux-gnu/glib-2.0/include/
OPENPGPSDK_DIR = ../../openpgpsdk/src
INCLUDEPATH *= $${OPENPGPSDK_DIR} \
../openpgpsdk
DESTDIR = lib
QMAKE_CXXFLAGS *= -Wall \
-D_FILE_OFFSET_BITS=64
QMAKE_CC = g++
SSL_DIR = /usr/include/openssl
UPNP_DIR = /usr/include/upnp
INCLUDEPATH += . \
$${SSL_DIR} \
$${UPNP_DIR}
# gpg files
system(which gpg-error-config >/dev/null 2>&1):INCLUDEPATH += $$system(gpg-error-config --cflags | sed -e "s/-I//g")
else:message(Could not find gpg-error-config on your system, assuming gpg-error.h is in /usr/include)
system(which gpgme-config >/dev/null 2>&1):INCLUDEPATH += $$system(gpgme-config --cflags | sed -e "s/-I//g")
else:message(Could not find gpgme-config on your system, assuming gpgme.h is in /usr/include)
# libupnp implementation files
HEADERS += upnp/UPnPBase.h
SOURCES += upnp/UPnPBase.cpp
# where to put the shared library itself
target.path = $$LIB_DIR
INSTALLS *= target
# where to put the library's interface
include_rsiface.path = $${INC_DIR}
include_rsiface.files = $$PUBLIC_HEADERS
INSTALLS += include_rsiface
# CONFIG += version_detail_bash_script
DEFINES *= UBUNTU
INCLUDEPATH += /usr/include/glib-2.0/ \
/usr/lib/glib-2.0/include
LIBS *= -lgnome-keyring
linux-g++:OBJECTS_DIR = temp/linux-g++/obj
linux-g++-64:OBJECTS_DIR = temp/linux-g++-64/obj
version_detail_bash_script {
QMAKE_EXTRA_TARGETS += write_version_detail
PRE_TARGETDEPS = write_version_detail
write_version_detail.commands = ./version_detail.sh
}
# ################### Cross compilation for windows under Linux ####################
win32-x-g++ {
OBJECTS_DIR = temp/win32xgcc/obj
@ -262,10 +205,10 @@ linux-*:isEmpty(PREFIX) {
# miniupnp implementation files
HEADERS += upnp/upnputil.h
SOURCES += upnp/upnputil.c
UPNPC_DIR = ../../../miniupnpc-1.3
PTHREADS_DIR = ../../../pthreads-w32-2-8-0-release
ZLIB_DIR = ../../../zlib-1.2.3
SSL_DIR = ../../../openssl-1.0.1c
UPNPC_DIR = ../../../lib/miniupnpc-1.3
PTHREADS_DIR = ../../../lib/pthreads-w32-2-8-0-release
ZLIB_DIR = ../../../lib/zlib-1.2.3
SSL_DIR = ../../../OpenSSL
OPENPGPSDK_DIR = ../../openpgpsdk/src
INCLUDEPATH += . \
$${SSL_DIR}/include \
@ -274,7 +217,7 @@ linux-*:isEmpty(PREFIX) {
$${ZLIB_DIR} \
$${OPENPGPSDK_DIR}
newcache {
SQLITE_DIR = ../../../sqlite-autoconf-3071300
SQLITE_DIR = ../../../../Libraries/sqlite/sqlite-autoconf-3070900
INCLUDEPATH += . \
$${SQLITE_DIR}
}

View File

@ -62,9 +62,6 @@
#define RS_TOKREQ_ANSTYPE_LIST 0x0001
#define RS_TOKREQ_ANSTYPE_SUMMARY 0x0002
#define RS_TOKREQ_ANSTYPE_DATA 0x0003
#define RS_TOKREQ_ANSTYPE_ACK 0x0004

View File

@ -30,7 +30,6 @@
#include <string>
#include <list>
#include "rsgxsservice.h"
#include "rsphotoVEG.h"
/* The Main Interface Class - for information about your Peers */
class RsPhotoV2;
@ -42,21 +41,20 @@ extern RsPhotoV2 *rsPhotoV2;
#define RSPHOTO_MODE_OWN 2
#define RSPHOTO_MODE_REMOTE 3
//class RsPhotoThumbnail
//{
// public:
// RsPhotoThumbnail()
// :data(NULL), size(0), type("N/A") { return; }
//
// bool deleteImage();
// bool copyFrom(const RsPhotoThumbnail &nail);
//
// // Holds Thumbnail image.
// uint8_t *data;
// int size;
// std::string type;
//};
class RsPhotoThumbnail
{
public:
RsPhotoThumbnail()
:data(NULL), size(0), type("N/A") { return; }
bool deleteImage();
bool copyFrom(const RsPhotoThumbnail &nail);
// Holds Thumbnail image.
uint8_t *data;
int size;
std::string type;
};
/* If these flags are no set - the Photo inherits values from the Album
*/
@ -76,85 +74,95 @@ extern RsPhotoV2 *rsPhotoV2;
#define RSPHOTO_FLAGS_ATTRIB_AUTHOR 0x1000 // PUSH UP ORDER
#define RSPHOTO_FLAGS_ATTRIB_PHOTO 0x2000 // PUSH UP ORDER.
class RsPhotoPhoto
{
public:
//class RsPhotoPhoto
//{
// public:
//
// RsMsgMetaData mMeta;
//
// RsPhotoPhoto();
//
// // THESE ARE IN THE META DATA.
// //std::string mAlbumId;
// //std::string mId;
// //std::string mTitle; // only used by Album.
// std::string mCaption;
// std::string mDescription;
// std::string mPhotographer;
// std::string mWhere;
// std::string mWhen;
// std::string mOther;
// std::string mCategory;
//
// std::string mHashTags;
//
// uint32_t mSetFlags;
//
// int mOrder;
//
// RsPhotoThumbnail mThumbnail;
//
// int mMode;
//
// // These are not saved.
// std::string path; // if in Mode NEW.
// uint32_t mModFlags;
//};
RsMsgMetaData mMeta;
//class RsPhotoAlbumShare
//{
// public:
//
// uint32_t mShareType;
// std::string mShareGroupId;
// std::string mPublishKey;
// uint32_t mCommentMode;
// uint32_t mResizeMode;
//};
//
//class RsPhotoAlbum
//{
// public:
// RsPhotoAlbum();
//
// RsGroupMetaData mMeta;
//
// // THESE ARE IN THE META DATA.
// //std::string mAlbumId;
// //std::string mTitle; // only used by Album.
//
// std::string mCaption;
// std::string mDescription;
// std::string mPhotographer;
// std::string mWhere;
// std::string mWhen;
// std::string mOther;
// std::string mCategory;
//
// std::string mHashTags;
//
// RsPhotoThumbnail mThumbnail;
//
// int mMode;
//
// std::string mPhotoPath;
// RsPhotoAlbumShare mShareOptions;
//
// // These aren't saved.
// uint32_t mSetFlags;
// uint32_t mModFlags;
//};
RsPhotoPhoto();
// THESE ARE IN THE META DATA.
//std::string mAlbumId;
//std::string mId;
//std::string mTitle; // only used by Album.
std::string mCaption;
std::string mDescription;
std::string mPhotographer;
std::string mWhere;
std::string mWhen;
std::string mOther;
std::string mCategory;
std::string mHashTags;
uint32_t mSetFlags;
int mOrder;
RsPhotoThumbnail mThumbnail;
int mMode;
// These are not saved.
std::string path; // if in Mode NEW.
uint32_t mModFlags;
};
class RsPhotoAlbumShare
{
public:
uint32_t mShareType;
std::string mShareGroupId;
std::string mPublishKey;
uint32_t mCommentMode;
uint32_t mResizeMode;
};
class RsPhotoAlbum
{
public:
RsPhotoAlbum();
RsGroupMetaData mMeta;
// THESE ARE IN THE META DATA.
//std::string mAlbumId;
//std::string mTitle; // only used by Album.
std::string mCaption;
std::string mDescription;
std::string mPhotographer;
std::string mWhere;
std::string mWhen;
std::string mOther;
std::string mCategory;
std::string mHashTags;
RsPhotoThumbnail mThumbnail;
int mMode;
std::string mPhotoPath;
RsPhotoAlbumShare mShareOptions;
// These aren't saved.
uint32_t mSetFlags;
uint32_t mModFlags;
};
class RsPhotoComment
{
public:
RsPhotoComment();
RsMsgMetaData mMeta;
std::string mComment;
uint32_t mCommentFlag;
};
std::ostream &operator<<(std::ostream &out, const RsPhotoPhoto &photo);
std::ostream &operator<<(std::ostream &out, const RsPhotoAlbum &album);
@ -167,136 +175,150 @@ class RsPhotoV2
public:
static const uint32_t FLAG_MSG_TYPE_PHOTO_POST;
static const uint32_t FLAG_MSG_TYPE_PHOTO_COMMENT;
static const uint32_t FLAG_MSG_TYPE_MASK;
RsPhotoV2() { return; }
virtual ~RsPhotoV2() { return; }
RsPhotoV2() { return; }
/*!
* Use to enquire if groups or msgs have changed
* Poll regularly, particularly after a photo submission
* @return true if msgs or groups have changed
*/
virtual bool updated() = 0;
virtual ~RsPhotoV2() { return; }
/*!
*
* @param grpIds
*/
virtual void groupsChanged(std::list<RsGxsGroupId>& grpIds) = 0;
/*!
* Use to enquire if groups or msgs have changed
* Poll regularly, particularly after a photo submission
* @return true if msgs or groups have changed
*/
virtual bool updated() = 0;
/*!
*
* @param msgs
*/
virtual void msgsChanged(GxsMsgIdResult& msgs) = 0;
/*!
*
* @param grpIds
*/
virtual void groupsChanged(std::list<RsGxsGroupId>& grpIds) = 0;
/*!
* To acquire a handle to token service handler
* needed to make requests to the service
* @return handle to token service for this gxs service
*/
virtual RsTokenServiceV2* getTokenService() = 0;
/*!
*
* @param msgs
*/
virtual void msgsChanged(GxsMsgIdResult& msgs) = 0;
/* Generic Lists */
/*!
* To acquire a handle to token service handler
* needed to make requests to the service
* @return handle to token service for this gxs service
*/
virtual RsTokenServiceV2* getTokenService() = 0;
/*!
*
* @param token token to be redeemed for this request
* @param groupIds the ids return for given request token
* @return false if request token is invalid, check token status for error report
*/
virtual bool getGroupList(const uint32_t &token,
std::list<RsGxsGroupId> &groupIds) = 0;
/* Generic Lists */
/*!
* @param token token to be redeemed for this request
* @param msgIds the ids return for given request token
* @return false if request token is invalid, check token status for error report
*/
virtual bool getMsgList(const uint32_t &token,
GxsMsgIdResult &msgIds) = 0;
/*!
*
* @param token token to be redeemed for this request
* @param groupIds the ids return for given request token
* @return false if request token is invalid, check token status for error report
*/
virtual bool getGroupList(const uint32_t &token,
std::list<RsGxsGroupId> &groupIds) = 0;
/* Generic Summary */
/*!
* @param token token to be redeemed for this request
* @param msgIds the ids return for given request token
* @return false if request token is invalid, check token status for error report
*/
virtual bool getMsgList(const uint32_t &token,
GxsMsgIdResult &msgIds) = 0;
/*!
* @param token token to be redeemed for group summary request
* @param groupInfo the ids returned for given request token
* @return false if request token is invalid, check token status for error report
*/
virtual bool getGroupSummary(const uint32_t &token,
std::list<RsGroupMetaData> &groupInfo) = 0;
/* Generic Summary */
/*!
* @param token token to be redeemed for message summary request
* @param msgInfo the message metadata returned for given request token
* @return false if request token is invalid, check token status for error report
*/
virtual bool getMsgSummary(const uint32_t &token,
MsgMetaResult &msgInfo) = 0;
/*!
* @param token token to be redeemed for group summary request
* @param groupInfo the ids returned for given request token
* @return false if request token is invalid, check token status for error report
*/
virtual bool getGroupSummary(const uint32_t &token,
std::list<RsGroupMetaData> &groupInfo) = 0;
/* Specific Service Data */
/*!
* @param token token to be redeemed for message summary request
* @param msgInfo the message metadata returned for given request token
* @return false if request token is invalid, check token status for error report
*/
virtual bool getMsgSummary(const uint32_t &token,
MsgMetaResult &msgInfo) = 0;
/*!
* @param token token to be redeemed for album request
* @param album the album returned for given request token
* @return false if request token is invalid, check token status for error report
*/
virtual bool getAlbum(const uint32_t &token, std::vector<RsPhotoAlbum> &album) = 0;
/* Specific Service Data */
/*!
* @param token token to be redeemed for photo request
* @param photo the photo returned for given request token
* @return false if request token is invalid, check token status for error report
*/
virtual bool getPhoto(const uint32_t &token,
PhotoResult &photo) = 0;
/*!
* @param token token to be redeemed for album request
* @param album the album returned for given request token
* @return false if request token is invalid, check token status for error report
*/
virtual bool getAlbum(const uint32_t &token, std::vector<RsPhotoAlbum> &album) = 0;
/* details are updated in album - to choose Album ID, and storage path */
/*!
* @param token token to be redeemed for photo request
* @param photo the photo returned for given request token
* @return false if request token is invalid, check token status for error report
*/
virtual bool getPhoto(const uint32_t &token,
PhotoResult &photo) = 0;
/*!
* submits album, which returns a token that needs
* to be acknowledge to get album grp id
* @param token token to redeem for acknowledgement
* @param album album to be submitted
*/
virtual bool submitAlbumDetails(uint32_t& token, RsPhotoAlbum &album) = 0;
/* details are updated in album - to choose Album ID, and storage path */
/*!
* submits photo, which returns a token that needs
* to be acknowledge to get photo msg-grp id pair
* @param token token to redeem for acknowledgement
* @param photo photo to be submitted
*/
virtual bool submitPhoto(uint32_t& token, RsPhotoPhoto &photo) = 0;
/*!
* submits album, which returns a token that needs
* to be acknowledge to get album grp id
* @param token token to redeem for acknowledgement
* @param album album to be submitted
*/
virtual bool submitAlbumDetails(uint32_t& token, RsPhotoAlbum &album) = 0;
/*!
* subscribes to group, and returns token which can be used
* to be acknowledged to get group Id
* @param token token to redeem for acknowledgement
* @param grpId the id of the group to subscribe to
*/
virtual bool subscribeToAlbum(uint32_t& token, const RsGxsGroupId& grpId) = 0;
/*!
* submits photo, which returns a token that needs
* to be acknowledged to get photo msg-grp id pair
* @param token token to redeem for acknowledgement
* @param photo photo to be submitted
*/
virtual bool submitPhoto(uint32_t& token, RsPhotoPhoto &photo) = 0;
/*!
* This allows the client service to acknowledge that their msgs has
* been created/modified and retrieve the create/modified msg ids
* @param token the token related to modification/create request
* @param msgIds map of grpid->msgIds of message created/modified
* @return true if token exists false otherwise
*/
virtual bool acknowledgeMsg(const uint32_t& token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId) = 0;
/*!
* submits photo comment, which returns a token that needs
* to be acknowledged to get photo msg-grp id pair
* The mParentId needs to be set to an existing msg for which
* commenting is enabled
* @param token token to redeem for acknowledgement
* @param comment comment to be submitted
*/
virtual bool submitComment(uint32_t& token, RsPhotoComment &photo) = 0;
/*!
* subscribes to group, and returns token which can be used
* to be acknowledged to get group Id
* @param token token to redeem for acknowledgement
* @param grpId the id of the group to subscribe to
*/
virtual bool subscribeToAlbum(uint32_t& token, const RsGxsGroupId& grpId, bool subscribe) = 0;
/*!
* This allows the client service to acknowledge that their msgs has
* been created/modified and retrieve the create/modified msg ids
* @param token the token related to modification/create request
* @param msgIds map of grpid->msgIds of message created/modified
* @return true if token exists false otherwise
*/
virtual bool acknowledgeMsg(const uint32_t& token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId) = 0;
/*!
* This allows the client service to acknowledge that their grps has
* been created/modified and retrieve the create/modified grp ids
* @param token the token related to modification/create request
* @param msgIds vector of ids of groups created/modified
* @return true if token exists false otherwise
*/
virtual bool acknowledgeGrp(const uint32_t& token, RsGxsGroupId& grpId) = 0;
/*!
* This allows the client service to acknowledge that their grps has
* been created/modified and retrieve the create/modified grp ids
* @param token the token related to modification/create request
* @param msgIds vector of ids of groups created/modified
* @return true if token exists false otherwise
*/
virtual bool acknowledgeGrp(const uint32_t& token, RsGxsGroupId& grpId) = 0;
};

View File

@ -30,6 +30,7 @@
#include <string>
#include <list>
#include <retroshare/rsidentityVEG.h>
#include "rsphotoV2.h"
/* The Main Interface Class - for information about your Peers */
class RsPhotoVEG;
@ -41,22 +42,6 @@ extern RsPhotoVEG *rsPhotoVEG;
#define RSPHOTO_MODE_OWN 2
#define RSPHOTO_MODE_REMOTE 3
class RsPhotoThumbnail
{
public:
RsPhotoThumbnail()
:data(NULL), size(0), type("N/A") { return; }
bool deleteImage();
bool copyFrom(const RsPhotoThumbnail &nail);
// Holds Thumbnail image.
uint8_t *data;
int size;
std::string type;
};
/* If these flags are no set - the Photo inherits values from the Album
*/
@ -76,85 +61,6 @@ class RsPhotoThumbnail
#define RSPHOTO_FLAGS_ATTRIB_PHOTO 0x2000 // PUSH UP ORDER.
class RsPhotoPhoto
{
public:
RsMsgMetaData mMeta;
RsPhotoPhoto();
// THESE ARE IN THE META DATA.
//std::string mAlbumId;
//std::string mId;
//std::string mTitle; // only used by Album.
std::string mCaption;
std::string mDescription;
std::string mPhotographer;
std::string mWhere;
std::string mWhen;
std::string mOther;
std::string mCategory;
std::string mHashTags;
uint32_t mSetFlags;
int mOrder;
RsPhotoThumbnail mThumbnail;
int mMode;
// These are not saved.
std::string path; // if in Mode NEW.
uint32_t mModFlags;
};
class RsPhotoAlbumShare
{
public:
uint32_t mShareType;
std::string mShareGroupId;
std::string mPublishKey;
uint32_t mCommentMode;
uint32_t mResizeMode;
};
class RsPhotoAlbum
{
public:
RsPhotoAlbum();
RsGroupMetaData mMeta;
// THESE ARE IN THE META DATA.
//std::string mAlbumId;
//std::string mTitle; // only used by Album.
std::string mCaption;
std::string mDescription;
std::string mPhotographer;
std::string mWhere;
std::string mWhen;
std::string mOther;
std::string mCategory;
std::string mHashTags;
RsPhotoThumbnail mThumbnail;
int mMode;
std::string mPhotoPath;
RsPhotoAlbumShare mShareOptions;
// These aren't saved.
uint32_t mSetFlags;
uint32_t mModFlags;
};
std::ostream &operator<<(std::ostream &out, const RsPhotoPhoto &photo);
std::ostream &operator<<(std::ostream &out, const RsPhotoAlbum &album);

View File

@ -1806,7 +1806,7 @@ RsTurtle *rsTurtle = NULL ;
#include "services/p3blogs.h"
#include "turtle/p3turtle.h"
#define ENABLE_GXS_VEG_SERVICES 1
#define ENABLE_GXS_SERVICES 1
#define ENABLE_GXS_CORE 1
#ifdef ENABLE_GXS_CORE
@ -1816,13 +1816,13 @@ RsTurtle *rsTurtle = NULL ;
#include "gxs/rsgxsnetservice.h"
#endif
#ifdef ENABLE_GXS_VEG_SERVICES
#include "services/p3photoserviceVEG.h"
#include "services/p3wikiserviceVEG.h"
#include "services/p3wireVEG.h"
#include "services/p3idserviceVEG.h"
#include "services/p3forumsVEG.h"
#include "services/p3postedVEG.h"
#ifdef ENABLE_GXS_SERVICES
#include "services/p3photoservice.h"
#include "services/p3wikiservice.h"
#include "services/p3wire.h"
#include "services/p3idservice.h"
#include "services/p3forumsv2.h"
#include "services/p3posted.h"
#endif
#ifndef PQI_DISABLE_TUNNEL
@ -2272,7 +2272,7 @@ int RsServer::StartupRetroShare()
// first prep the core
RsGeneralDataService* photo_ds = new RsDataService("./", "photoV2_db",
RS_SERVICE_GXSV1_TYPE_PHOTO, NULL);
RS_SERVICE_TYPE_PHOTO, NULL);
photo_ds->resetDataStore();
@ -2295,37 +2295,33 @@ int RsServer::StartupRetroShare()
// start up gxs core server
createThread(*mGxsCore);
// create some dummy items
#endif
#ifdef ENABLE_GXS_VEG_SERVICES
#ifdef ENABLE_GXS_SERVICES
// Testing New Cache Services.
p3PhotoServiceVEG *mPhotosVEG = new p3PhotoServiceVEG(RS_SERVICE_VEG_TYPE_PHOTO);
pqih -> addService(mPhotosVEG);
p3PhotoService *mPhotos = new p3PhotoService(RS_SERVICE_TYPE_PHOTO);
pqih -> addService(mPhotos);
// Testing New Cache Services.
p3WikiServiceVEG *mWikisVEG = new p3WikiServiceVEG(RS_SERVICE_VEG_TYPE_WIKI);
pqih -> addService(mWikisVEG);
p3WikiService *mWikis = new p3WikiService(RS_SERVICE_TYPE_WIKI);
pqih -> addService(mWikis);
// Testing New Cache Services.
p3WireVEG *mWireVEG = new p3WireVEG(RS_SERVICE_VEG_TYPE_WIRE);
pqih -> addService(mWireVEG);
p3Wire *mWire = new p3Wire(RS_SERVICE_TYPE_WIRE);
pqih -> addService(mWire);
// Testing New Cache Services.
p3IdServiceVEG *mIdentityVEG = new p3IdServiceVEG(RS_SERVICE_VEG_TYPE_IDENTITY);
pqih -> addService(mIdentityVEG);
p3IdService *mIdentity = new p3IdService(RS_SERVICE_TYPE_IDENTITY);
pqih -> addService(mIdentity);
// Testing New Cache Services.
p3ForumsVEG *mForumsVEG = new p3ForumsVEG(RS_SERVICE_VEG_TYPE_FORUMS);
pqih -> addService(mForumsVEG);
p3ForumsV2 *mForumsV2 = new p3ForumsV2(RS_SERVICE_TYPE_FORUMSV2);
pqih -> addService(mForumsV2);
// Testing New Cache Services.
p3PostedServiceVEG *mPostedVEG = new p3PostedServiceVEG(RS_SERVICE_VEG_TYPE_POSTED);
pqih -> addService(mPostedVEG);
#endif // ENABLE_GXS_VEG_SERVICES
p3PostedService *mPosted = new p3PostedService(RS_SERVICE_TYPE_POSTED);
pqih -> addService(mPosted);
#endif // ENABLE_GXS_SERVICES
#ifndef RS_RELEASE
@ -2586,18 +2582,15 @@ int RsServer::StartupRetroShare()
#ifdef ENABLE_GXS_SERVICES
// Testing of new cache system interfaces.
rsIdentityVEG = mIdentityVEG;
rsPhotoVEG = mPhotosVEG;
rsWikiVEG = mWikisVEG;
rsWireVEG = mWireVEG;
rsForumsVEG = mForumsVEG;
rsPostedVEG = mPostedVEG;
rsIdentity = mIdentity;
rsPhoto = mPhotos;
rsPhotoV2 = mPhotoV2;
rsWiki = mWikis;
rsWire = mWire;
rsForumsV2 = mForumsV2;
rsPosted = mPosted;
#endif // ENABLE_GXS_SERVICES
#ifdef ENABLE_GXS_CORE
rsPhotoV2 = mPhotoV2;
#endif // ENABLE_GXS_CORE
#ifdef RS_USE_BLOGS
rsBlogs = mBlogs;

View File

@ -88,7 +88,7 @@ RsItem* RsGxsPhotoSerialiser::deserialise(void* data, uint32_t* size)
uint32_t rstype = getRsItemId(data);
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
(RS_SERVICE_GXSV1_TYPE_PHOTO != getRsItemService(rstype)))
(RS_SERVICE_TYPE_PHOTO != getRsItemService(rstype)))
{
return NULL; /* wrong type */
}
@ -175,7 +175,7 @@ bool RsGxsPhotoSerialiser::serialiseGxsPhotoAlbumItem(RsGxsPhotoAlbumItem* item,
ok &= SetTlvString(data, tlvsize, &offset, 1, item->album.mWhen);
ok &= SetTlvString(data, tlvsize, &offset, 1, item->album.mWhere);
ok &= SetTlvString(data, tlvsize, &offset, 1, item->album.mThumbnail.type);
RsTlvBinaryData b(RS_SERVICE_GXSV1_TYPE_PHOTO); // TODO, need something more persisitent
RsTlvBinaryData b(RS_SERVICE_TYPE_PHOTO); // TODO, need something more persisitent
b.setBinData(item->album.mThumbnail.data, item->album.mThumbnail.size);
ok &= b.SetTlv(data, tlvsize, &offset);
@ -213,7 +213,7 @@ RsGxsPhotoAlbumItem* RsGxsPhotoSerialiser::deserialiseGxsPhotoAlbumItem(void* da
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
(RS_SERVICE_GXSV1_TYPE_PHOTO != getRsItemService(rstype)) ||
(RS_SERVICE_TYPE_PHOTO != getRsItemService(rstype)) ||
(RS_PKT_SUBTYPE_PHOTO_ITEM != getRsItemSubType(rstype)))
{
#ifdef GXS_PHOTO_SERIAL_DEBUG
@ -251,7 +251,7 @@ RsGxsPhotoAlbumItem* RsGxsPhotoSerialiser::deserialiseGxsPhotoAlbumItem(void* da
ok &= GetTlvString(data, rssize, &offset, 1, item->album.mWhere);
ok &= GetTlvString(data, rssize, &offset, 1, item->album.mThumbnail.type);
RsTlvBinaryData b(RS_SERVICE_GXSV1_TYPE_PHOTO); // TODO, need something more persisitent
RsTlvBinaryData b(RS_SERVICE_TYPE_PHOTO); // TODO, need something more persisitent
ok &= b.GetTlv(data, rssize, &offset);
item->album.mThumbnail.data = (uint8_t*)b.bin_data;
item->album.mThumbnail.size = b.bin_len;
@ -341,7 +341,7 @@ bool RsGxsPhotoSerialiser::serialiseGxsPhotoPhotoItem(RsGxsPhotoPhotoItem* item,
ok &= SetTlvString(data, tlvsize, &offset, 1, item->photo.mWhen);
ok &= SetTlvString(data, tlvsize, &offset, 1, item->photo.mWhere);
ok &= SetTlvString(data, tlvsize, &offset, 1, item->photo.mThumbnail.type);
RsTlvBinaryData b(RS_SERVICE_GXSV1_TYPE_PHOTO); // TODO, need something more persisitent
RsTlvBinaryData b(RS_SERVICE_TYPE_PHOTO); // TODO, need something more persisitent
b.setBinData(item->photo.mThumbnail.data, item->photo.mThumbnail.size);
ok &= b.SetTlv(data, tlvsize, &offset);
@ -379,7 +379,7 @@ RsGxsPhotoPhotoItem* RsGxsPhotoSerialiser::deserialiseGxsPhotoPhotoItem(void* da
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
(RS_SERVICE_GXSV1_TYPE_PHOTO != getRsItemService(rstype)) ||
(RS_SERVICE_TYPE_PHOTO != getRsItemService(rstype)) ||
(RS_PKT_SUBTYPE_PHOTO_SHOW_ITEM != getRsItemSubType(rstype)))
{
#ifdef GXS_PHOTO_SERIAL_DEBUG
@ -415,7 +415,7 @@ RsGxsPhotoPhotoItem* RsGxsPhotoSerialiser::deserialiseGxsPhotoPhotoItem(void* da
ok &= GetTlvString(data, rssize, &offset, 1, item->photo.mWhere);
ok &= GetTlvString(data, rssize, &offset, 1, item->photo.mThumbnail.type);
RsTlvBinaryData b(RS_SERVICE_GXSV1_TYPE_PHOTO); // TODO, need something more persisitent
RsTlvBinaryData b(RS_SERVICE_TYPE_PHOTO); // TODO, need something more persisitent
ok &= b.GetTlv(data, rssize, &offset);
item->photo.mThumbnail.data = (uint8_t*)(b.bin_data);
item->photo.mThumbnail.size = b.bin_len;

View File

@ -68,6 +68,20 @@ public:
RsPhotoPhoto photo;
};
class RsGxsPhotoCommentItem : public RsGxsMsgItem
{
public:
RsGxsPhotoCommentItem(): RsGxsMsgItem(RS_SERVICE_GXSV1_TYPE_PHOTO,
RS_PKT_SUBTYPE_PHOTO_COMMENT_ITEM) { return; }
virtual ~RsGxsPhotoCommentItem() { return; }
void clear();
std::ostream &print(std::ostream &out, uint16_t indent = 0);
RsPhotoComment comment;
};
class RsGxsPhotoSerialiser : public RsSerialType
{
public:
@ -91,6 +105,9 @@ public:
bool serialiseGxsPhotoPhotoItem (RsGxsPhotoPhotoItem *item, void *data, uint32_t *size);
RsGxsPhotoPhotoItem * deserialiseGxsPhotoPhotoItem(void *data, uint32_t *size);
uint32_t sizeGxsPhotoCommentItem(RsGxsPhotoCommentItem *item);
bool serialiseGxsPhotoCommentItem (RsGxsPhotoCommentItem *item, void *data, uint32_t *size);
RsGxsPhotoCommentItem * deserialiseGxsPhotoCommentItem(void *data, uint32_t *size);
};

View File

@ -58,8 +58,8 @@ p3IdService::p3IdService(uint16_t type)
int p3IdService::tick()
{
//std::cerr << "p3IdService::tick()";
//std::cerr << std::endl;
std::cerr << "p3IdService::tick()";
std::cerr << std::endl;
fakeprocessrequests();
// Disable for now.

View File

@ -1,14 +1,12 @@
#include "p3photoserviceV2.h"
#include "serialiser/rsphotov2items.h"
#include "gxs/rsgxsflags.h"
RsPhotoV2 *rsPhotoV2 = NULL;
p3PhotoServiceV2::p3PhotoServiceV2(RsGeneralDataService* gds, RsNetworkExchangeService* nes)
: RsGenExchange(gds, nes, new RsGxsPhotoSerialiser(), RS_SERVICE_GXSV1_TYPE_PHOTO)
: RsGenExchange(gds, nes, new RsGxsPhotoSerialiser(), RS_SERVICE_TYPE_PHOTO)
{
}
bool p3PhotoServiceV2::updated()
@ -148,13 +146,6 @@ bool p3PhotoServiceV2::submitAlbumDetails(uint32_t& token, RsPhotoAlbum& album)
return true;
}
bool p3PhotoServiceV2::subscribeToAlbum(uint32_t &token, const RsGxsGroupId &grpId)
{
RsGenExchange::setGroupSubscribeFlag(token, grpId, GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED);
return true;
}
void p3PhotoServiceV2::notifyChanges(std::vector<RsGxsNotify*>& changes)

View File

@ -94,13 +94,23 @@ public:
*/
bool submitPhoto(uint32_t& token, RsPhotoPhoto &photo);
/*!
* submits photo comment, which returns a token that needs
* to be acknowledged to get photo msg-grp id pair
* The mParentId needs to be set to an existing msg for which
* commenting is enabled
* @param token token to redeem for acknowledgement
* @param comment comment to be submitted
*/
bool submitComment(uint32_t& token, RsPhotoComment &photo);
/*!
* subscribes to group, and returns token which can be used
* to be acknowledged to get group Id
* @param token token to redeem for acknowledgement
* @param grpId the id of the group to subscribe to
*/
bool subscribeToAlbum(uint32_t& token, const RsGxsGroupId& grpId);
bool subscribeToAlbum(uint32_t& token, const RsGxsGroupId& grpId, bool subscribe);
/*!
* This allows the client service to acknowledge that their msgs has

View File

@ -17,9 +17,9 @@ linux-* {
}
win32 {
SSL_DIR = ../../../openssl-1.0.1c
ZLIB_DIR = ../../../zlib-1.2.3
BZIP_DIR = ../../../bzip2-1.0.6
SSL_DIR = ../../../OpenSSL
ZLIB_DIR = ../../../lib/zlib-1.2.3
BZIP_DIR = ../../../lib/bzip2-1.0.6
INCLUDEPATH += $${SSL_DIR}/include $${ZLIB_DIR} $${BZIP_DIR}
}

View File

@ -193,8 +193,8 @@ freebsd-* {
# ###########################################
bitdht {
LIBS += ../../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
PRE_TARGETDEPS *= C:\Development\Rs\v0.5-gxs-b1\libbitdht\libbitdht-build-desktop\lib\libbitdht.a
# Chris version.
#LIBS += ../../libbitdht/libbitdht-build-desktop/lib/libbitdht.a
@ -416,7 +416,8 @@ HEADERS += rshare.h \
gui/groups/CreateGroup.h \
gui/dht/DhtWindow.h \
gui/bwctrl/BwCtrlWindow.h \
gui/GetStartedDialog.h
gui/GetStartedDialog.h \
gui/PhotoShare/PhotoCommentItem.h
@ -520,7 +521,7 @@ FORMS += gui/StartDialog.ui \
gui/dht/DhtWindow.ui \
gui/bwctrl/BwCtrlWindow.ui \
gui/GetStartedDialog.ui \
gui/PhotoShare/PhotoCommentItem.ui
SOURCES += main.cpp \
rshare.cpp \
gui/notifyqt.cpp \
@ -699,7 +700,8 @@ SOURCES += main.cpp \
gui/groups/CreateGroup.cpp \
gui/dht/DhtWindow.cpp \
gui/bwctrl/BwCtrlWindow.cpp \
gui/GetStartedDialog.cpp
gui/GetStartedDialog.cpp \
gui/PhotoShare/PhotoCommentItem.cpp
RESOURCES += gui/images.qrc lang/lang.qrc gui/help/content/content.qrc
@ -862,7 +864,6 @@ SOURCES += gui/unfinished/ApplicationWindow.cpp \
photoshare {
HEADERS += \
gui/PhotoShare/PhotoDialog.h \
gui/PhotoShare/PhotoDrop.h \
gui/PhotoShare/AlbumItem.h \
gui/PhotoShare/AlbumDialog.h \
@ -872,6 +873,7 @@ photoshare {
gui/PhotoShare/PhotoShareItemHolder.h \
gui/PhotoShare/PhotoShare.h \
gui/PhotoShare/PhotoSlideShow.h \
gui/PhotoShare/PhotoDialog.h
FORMS += \
gui/PhotoShare/PhotoItem.ui \
@ -880,7 +882,7 @@ photoshare {
gui/PhotoShare/AlbumDialog.ui \
gui/PhotoShare/AlbumCreateDialog.ui \
gui/PhotoShare/PhotoShare.ui \
gui/PhotoShare/PhotoSlideShow.ui \
gui/PhotoShare/PhotoSlideShow.ui
SOURCES += \
gui/PhotoShare/PhotoItem.cpp \
@ -892,7 +894,7 @@ photoshare {
util/TokenQueueV2.cpp \
gui/PhotoShare/PhotoShareItemHolder.cpp \
gui/PhotoShare/PhotoShare.cpp \
gui/PhotoShare/PhotoSlideShow.cpp \
gui/PhotoShare/PhotoSlideShow.cpp
}

View File

@ -55,7 +55,7 @@ void AlbumItem::setSelected(bool on)
update();
}
RsPhotoAlbum AlbumItem::getAlbum()
const RsPhotoAlbum& AlbumItem::getAlbum()
{
return mAlbum;
}

View File

@ -16,9 +16,9 @@ class AlbumItem : public QWidget, public PhotoShareItem
public:
explicit AlbumItem(const RsPhotoAlbum& album, PhotoShareItemHolder* albumHolder, QWidget *parent = 0);
~AlbumItem();
virtual ~AlbumItem();
RsPhotoAlbum getAlbum();
const RsPhotoAlbum& getAlbum();
bool isSelected() { return mSelected ;}
void setSelected(bool selected);

View File

@ -0,0 +1,14 @@
#include "PhotoCommentItem.h"
#include "ui_PhotoCommentItem.h"
PhotoCommentItem::PhotoCommentItem(QWidget *parent) :
QWidget(parent),
ui(new Ui::PhotoCommentItem)
{
ui->setupUi(this);
}
PhotoCommentItem::~PhotoCommentItem()
{
delete ui;
}

View File

@ -0,0 +1,22 @@
#ifndef PHOTOCOMMENTITEM_H
#define PHOTOCOMMENTITEM_H
#include <QWidget>
namespace Ui {
class PhotoCommentItem;
}
class PhotoCommentItem : public QWidget
{
Q_OBJECT
public:
explicit PhotoCommentItem(QWidget *parent = 0);
~PhotoCommentItem();
private:
Ui::PhotoCommentItem *ui;
};
#endif // PHOTOCOMMENTITEM_H

View File

@ -0,0 +1,21 @@
<ui version="4.0">
<author/>
<comment/>
<exportmacro/>
<class>PhotoCommentItem</class>
<widget class="QWidget" name="PhotoCommentItem">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
</widget>
<pixmapfunction/>
<connections/>
</ui>

View File

@ -1,648 +1,33 @@
/*
* Retroshare Photo Plugin.
*
* Copyright 2012-2012 by Robert Fernie.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License Version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems to "retroshare@lunamutt.com".
*
*/
#include "PhotoDialog.h"
#include <retroshare/rspeers.h>
#include <retroshare/rsphotoV2.h>
#include <gxs/rsgxsflags.h>
#include <iostream>
#include <sstream>
#include <QTimer>
#include <QMessageBox>
#include "AlbumCreateDialog.h"
#include "AlbumItem.h"
#include "PhotoItem.h"
/******
* #define PHOTO_DEBUG 1
*****/
/****************************************************************
* New Photo Display Widget.
*
* 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.
*/
#define IS_ALBUM_ADMIN(subscribeFlags) (subscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN)
#define IS_ALBUM_SUBSCRIBED(subscribeFlags) (subscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED)
/** Constructor */
PhotoDialog::PhotoDialog(QWidget *parent)
: MainPage(parent)
{
ui.setupUi(this);
mAlbumSelected = NULL;
mPhotoSelected = NULL;
mSlideShow = NULL;
mAlbumDialog = NULL;
connect( ui.toolButton_NewAlbum, SIGNAL(clicked()), this, SLOT(createAlbum()));
connect( ui.toolButton_ViewAlbum, SIGNAL(clicked()), this, SLOT(OpenAlbumDialog()));
connect( ui.toolButton_SlideShow, SIGNAL(clicked()), this, SLOT(OpenSlideShow()));
connect( ui.pushButton_YourAlbums, SIGNAL(clicked()), this, SLOT(updateAlbums()));
connect( ui.pushButton_SharedAlbums, SIGNAL(clicked()), this, SLOT(updateAlbums()));
connect( ui.pushButton_SubscribedAlbums, SIGNAL(clicked()), this, SLOT(updateAlbums()));
ui.pushButton_YourAlbums->setChecked(true); // default to your albums view
QTimer *timer = new QTimer(this);
timer->connect(timer, SIGNAL(timeout()), this, SLOT(checkUpdate()));
timer->start(1000);
/* setup TokenQueue */
mPhotoQueue = new TokenQueueV2(rsPhotoV2->getTokenService(), this);
requestAlbumData();
updateAlbums();
}
void PhotoDialog::notifySelection(PhotoShareItem *selection)
{
AlbumItem* aItem;
PhotoItem* pItem;
if((aItem = dynamic_cast<AlbumItem*>(selection)) != NULL)
{
if(mPhotoSelected)
mPhotoSelected->setSelected(false);
clearPhotos();
if(mAlbumSelected == aItem)
{
mAlbumSelected->setSelected(true);
}
else
{
if(mAlbumSelected == NULL)
{
mAlbumSelected = aItem;
}
else
{
mAlbumSelected->setSelected(false);
mAlbumSelected = aItem;
}
mAlbumSelected->setSelected(true);
}
updatePhotos();
}
else if((pItem = dynamic_cast<PhotoItem*>(selection)) != NULL)
{
if(mPhotoSelected == pItem)
{
mPhotoSelected->setSelected(true);
}
else
{
if(mPhotoSelected == NULL)
{
mPhotoSelected = pItem;
}
else
{
mPhotoSelected->setSelected(false);
mPhotoSelected = pItem;
}
mPhotoSelected->setSelected(true);
}
}
else
{
}
}
void PhotoDialog::checkUpdate()
{
/* update */
if (!rsPhotoV2)
return;
if (rsPhotoV2->updated())
{
//insertAlbums();
std::list<std::string> grpIds;
rsPhotoV2->groupsChanged(grpIds);
if(!grpIds.empty())
requestAlbumList(grpIds);
GxsMsgIdResult res;
rsPhotoV2->msgsChanged(res);
if(!res.empty())
requestPhotoList(res);
}
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;
}
std::string albumId = mAlbumSelected->getAlbum().mMeta.mGroupId;
if (mSlideShow)
{
mSlideShow->show();
}
else
{
mSlideShow = new PhotoSlideShow(NULL);
mSlideShow->show();
}
mSlideShow->loadAlbum(albumId);
}
/*************** New Photo Dialog ***************/
void PhotoDialog::createAlbum()
{
AlbumCreateDialog albumCreate(mPhotoQueue, rsPhotoV2, this);
albumCreate.exec();
}
void PhotoDialog::OpenAlbumDialog()
{
if(mAlbumSelected){
if(mAlbumDialog == NULL)
{
mAlbumDialog = new AlbumDialog(mAlbumSelected->getAlbum(), mPhotoQueue, rsPhotoV2);
connect(mAlbumDialog, SIGNAL(destroyed()), this, SLOT(SetDialogClosed()));
mAlbumDialog->show();
}else{
// bring dialog to front
mAlbumDialog->raise();
}
}
return;
}
void PhotoDialog::SetDialogClosed()
{
mAlbumDialog = NULL;
}
/*************** Edit Photo Dialog ***************/
void PhotoDialog::clearAlbums()
{
std::cerr << "PhotoDialog::clearAlbums()" << std::endl;
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
QSetIterator<AlbumItem*> sit(mAlbumItems);
while(sit.hasNext())
{
AlbumItem* item = sit.next();
alayout->removeWidget(item);
item->setParent(NULL);
}
clearPhotos();
}
void PhotoDialog::clearPhotos()
{
std::cerr << "PhotoDialog::clearPhotos()" << std::endl;
mPhotoSelected = NULL;
QLayout *layout = ui.scrollAreaWidgetContents_2->layout();
if(mAlbumSelected)
{
const RsGxsGroupId& id = mAlbumSelected->getAlbum().mMeta.mGroupId;
QSetIterator<PhotoItem*> sit(mPhotoItems[id]);
while(sit.hasNext())
{
PhotoItem* item = sit.next();
layout->removeWidget(item);
item->setParent(NULL);
}
}
}
void PhotoDialog::updateAlbums()
{
clearAlbums();
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
QSetIterator<AlbumItem*> sit(mAlbumItems);
if(ui.pushButton_YourAlbums->isChecked())
{
ui.toolButton_subscribe->setEnabled(false);
ui.toolButton_NewAlbum->setEnabled(true);
ui.toolButton_SlideShow->setEnabled(true);
while(sit.hasNext()){
AlbumItem* item = sit.next();
uint32_t flags = item->getAlbum().mMeta.mSubscribeFlags;
if(IS_ALBUM_ADMIN(flags))
alayout->addWidget(item);
}
}else if(ui.pushButton_SubscribedAlbums->isChecked())
{
ui.toolButton_subscribe->setEnabled(false);
ui.toolButton_NewAlbum->setEnabled(false);
ui.toolButton_SlideShow->setEnabled(true);
while(sit.hasNext()){
AlbumItem* item = sit.next();
uint32_t flags = item->getAlbum().mMeta.mSubscribeFlags;
if(IS_ALBUM_SUBSCRIBED(flags))
alayout->addWidget(item);
}
}else if(ui.pushButton_SharedAlbums->isChecked())
{
ui.toolButton_subscribe->setEnabled(true);
ui.toolButton_NewAlbum->setEnabled(false);
ui.toolButton_SlideShow->setEnabled(false);
while(sit.hasNext()){
AlbumItem* item = sit.next();
uint32_t flags = item->getAlbum().mMeta.mSubscribeFlags;
if(flags == 0)
alayout->addWidget(item);
}
}
}
void PhotoDialog::addAlbum(const RsPhotoAlbum &album)
{
std::cerr << " PhotoDialog::addAlbum() AlbumId: " << album.mMeta.mGroupId << std::endl;
AlbumItem *item = new AlbumItem(album, this, this);
mAlbumItems.insert(item);
clearAlbums();
updateAlbums();
}
void PhotoDialog::addPhoto(const RsPhotoPhoto &photo)
{
std::cerr << "PhotoDialog::addPhoto() AlbumId: " << photo.mMeta.mGroupId;
std::cerr << " PhotoId: " << photo.mMeta.mMsgId;
std::cerr << std::endl;
PhotoItem* item = new PhotoItem(this, photo, this);
const RsGxsGroupId id = photo.mMeta.mGroupId;
mPhotoItems[id].insert(item);
}
void PhotoDialog::subscribeToAlbum()
{
if(mAlbumSelected){
RsGxsGroupId id = mAlbumSelected->getAlbum().mMeta.mGroupId;
uint32_t token;
rsPhotoV2->subscribeToAlbum(token, id);
mPhotoQueue->queueRequest(token, TOKENREQ_GROUPINFO, RS_TOKREQ_ANSTYPE_ACK, 0);
}
}
void PhotoDialog::updatePhotos()
{
clearPhotos();
if(mAlbumSelected)
{
const RsGxsGroupId& grpId = mAlbumSelected->getAlbum().mMeta.mGroupId;
QSetIterator<PhotoItem*> sit(mPhotoItems[grpId]);
while(sit.hasNext())
{
QLayout *layout = ui.scrollAreaWidgetContents_2->layout();
layout->addWidget(sit.next());
}
}
}
/**************************** Request / Response Filling of Data ************************/
void PhotoDialog::requestAlbumList(std::list<std::string>& ids)
{
RsTokReqOptionsV2 opts;
opts.mReqType = GXS_REQUEST_TYPE_GROUP_IDS;
uint32_t token;
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, ids, 0);
}
void PhotoDialog::requestPhotoList(GxsMsgReq& req)
{
RsTokReqOptionsV2 opts;
opts.mReqType = GXS_REQUEST_TYPE_MSG_IDS;
uint32_t token;
mPhotoQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, req, 0);
return;
}
void PhotoDialog::loadAlbumList(const uint32_t &token)
{
std::cerr << "PhotoDialog::loadAlbumList()";
std::cerr << std::endl;
std::list<std::string> albumIds;
rsPhotoV2->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(std::list<RsGxsGroupId> &ids)
{
RsTokReqOptionsV2 opts;
uint32_t token;
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, ids, 0);
}
void PhotoDialog::requestAlbumData()
{
RsTokReqOptionsV2 opts;
uint32_t token;
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, 0);
}
bool PhotoDialog::loadAlbumData(const uint32_t &token)
{
std::cerr << "PhotoDialog::loadAlbumData()";
std::cerr << std::endl;
std::vector<RsPhotoAlbum> albums;
rsPhotoV2->getAlbum(token, albums);
std::vector<RsPhotoAlbum>::iterator vit = albums.begin();
for(; vit != albums.end(); vit++)
{
RsPhotoAlbum& album = *vit;
std::cerr << " PhotoDialog::addAlbum() AlbumId: " << album.mMeta.mGroupId << std::endl;
addAlbum(album);
}
updateAlbums();
return true;
}
void PhotoDialog::requestPhotoList(const std::string &albumId)
{
std::list<RsGxsGroupId> grpIds;
grpIds.push_back(albumId);
RsTokReqOptionsV2 opts;
opts.mReqType = GXS_REQUEST_TYPE_MSG_IDS;
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
uint32_t token;
mPhotoQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, grpIds, 0);
}
void PhotoDialog::acknowledgeGroup(const uint32_t &token)
{
RsGxsGroupId grpId;
rsPhotoV2->acknowledgeGrp(token, grpId);
if(!grpId.empty())
{
std::list<RsGxsGroupId> grpIds;
grpIds.push_back(grpId);
RsTokReqOptionsV2 opts;
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
uint32_t reqToken;
mPhotoQueue->requestGroupInfo(reqToken, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds, 0);
}
}
void PhotoDialog::acknowledgeMessage(const uint32_t &token)
{
std::pair<RsGxsGroupId, RsGxsMessageId> p;
rsPhotoV2->acknowledgeMsg(token, p);
if(!p.first.empty())
{
GxsMsgReq req;
std::vector<RsGxsMessageId> v;
v.push_back(p.second);
req[p.first] = v;
RsTokReqOptionsV2 opts;
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
uint32_t reqToken;
mPhotoQueue->requestMsgInfo(reqToken, RS_TOKREQ_ANSTYPE_DATA, opts, req, 0);
}
}
void PhotoDialog::loadPhotoList(const uint32_t &token)
{
std::cerr << "PhotoDialog::loadPhotoList()";
std::cerr << std::endl;
GxsMsgIdResult res;
rsPhotoV2->getMsgList(token, res);
requestPhotoData(res);
}
void PhotoDialog::requestPhotoData(GxsMsgReq &photoIds)
{
RsTokReqOptionsV2 opts;
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
uint32_t token;
mPhotoQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, photoIds, 0);
}
void PhotoDialog::loadPhotoData(const uint32_t &token)
{
std::cerr << "PhotoDialog::loadPhotoData()";
std::cerr << std::endl;
PhotoResult res;
rsPhotoV2->getPhoto(token, res);
PhotoResult::iterator mit = res.begin();
for(; mit != res.end(); mit++)
{
std::vector<RsPhotoPhoto>& photoV = mit->second;
std::vector<RsPhotoPhoto>::iterator vit = photoV.begin();
for(; vit != photoV.end(); vit++)
{
RsPhotoPhoto& photo = *vit;
addPhoto(photo);
std::cerr << "PhotoDialog::loadPhotoData() AlbumId: " << photo.mMeta.mGroupId;
std::cerr << " PhotoId: " << photo.mMeta.mMsgId;
std::cerr << std::endl;
}
}
updatePhotos();
}
/**************************** Request / Response Filling of Data ************************/
void PhotoDialog::loadRequest(const TokenQueueV2 *queue, const TokenRequestV2 &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;
case RS_TOKREQ_ANSTYPE_ACK:
acknowledgeGroup(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_ACK:
acknowledgeMessage(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 ************************/
#include "PhotoDialog.h"
#include "ui_PhotoDialog.h"
PhotoDialog::PhotoDialog(RsPhotoV2 *rs_photo, const RsPhotoPhoto &photo, QWidget *parent) :
QDialog(parent),
ui(new Ui::PhotoDialog), mRsPhoto(rs_photo), mPhotoQueue(new TokenQueueV2(mRsPhoto->getTokenService(), this)),
mPhotoDetails(photo)
{
ui->setupUi(this);
setAttribute ( Qt::WA_DeleteOnClose, true );
setUp();
}
PhotoDialog::~PhotoDialog()
{
delete ui;
delete mPhotoQueue;
}
void PhotoDialog::setUp()
{
QPixmap qtn;
qtn.loadFromData(mPhotoDetails.mThumbnail.data, mPhotoDetails.mThumbnail.size, mPhotoDetails.mThumbnail.type.c_str());
ui->label_Photo->setPixmap(qtn);
ui->lineEdit_Title->setText(QString::fromStdString(mPhotoDetails.mMeta.mMsgName));
}
void PhotoDialog::loadRequest(const TokenQueueV2 *queue, const TokenRequestV2 &req)
{
}

View File

@ -1,113 +1,37 @@
/*
* Retroshare Photo Plugin.
*
* Copyright 2012-2012 by Robert Fernie.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License Version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems to "retroshare@lunamutt.com".
*
*/
#ifndef MRK_PHOTO_DIALOG_H
#define MRK_PHOTO_DIALOG_H
#include "retroshare-gui/mainpage.h"
#include "ui_PhotoDialog.h"
#include "AlbumCreateDialog.h"
#include "AlbumDialog.h"
#include "AlbumItem.h"
#include "PhotoItem.h"
#include "PhotoSlideShow.h"
#include <retroshare/rsphotoV2.h>
#include <map>
#include "util/TokenQueueV2.h"
#include "PhotoShareItemHolder.h"
class PhotoDialog : public MainPage, public TokenResponseV2, public PhotoShareItemHolder
{
Q_OBJECT
public:
PhotoDialog(QWidget *parent = 0);
void notifySelection(PhotoShareItem* selection);
private slots:
void checkUpdate();
void createAlbum();
void OpenAlbumDialog();
void OpenSlideShow();
void SetDialogClosed();
void updateAlbums();
void subscribeToAlbum();
private:
/* Request Response Functions for loading data */
void requestAlbumList(std::list<std::string>& ids);
void requestAlbumData(std::list<RsGxsGroupId> &ids);
/*!
* request data for all groups
*/
void requestAlbumData();
void requestPhotoList(GxsMsgReq &albumIds);
void requestPhotoList(const std::string &albumId);
void requestPhotoData(GxsMsgReq &photoIds);
void loadAlbumList(const uint32_t &token);
bool loadAlbumData(const uint32_t &token);
void loadPhotoList(const uint32_t &token);
void loadPhotoData(const uint32_t &token);
void loadRequest(const TokenQueueV2 *queue, const TokenRequestV2 &req);
void acknowledgeGroup(const uint32_t &token);
void acknowledgeMessage(const uint32_t &token);
/* Grunt work of setting up the GUI */
void addAlbum(const RsPhotoAlbum &album);
void addPhoto(const RsPhotoPhoto &photo);
void clearAlbums();
void clearPhotos();
void updatePhotos();
private:
AlbumItem* mAlbumSelected;
PhotoItem* mPhotoSelected;
PhotoSlideShow* mSlideShow;
AlbumDialog* mAlbumDialog;
TokenQueueV2 *mPhotoQueue;
/* UI - from Designer */
Ui::PhotoDialog ui;
QSet<AlbumItem*> mAlbumItems;
QMap<RsGxsGroupId, QSet<PhotoItem*> > mPhotoItems;
};
#endif
#ifndef PHOTODIALOG_H
#define PHOTODIALOG_H
#include <QDialog>
#include "retroshare/rsphotoV2.h"
#include "util/TokenQueueV2.h"
namespace Ui {
class PhotoDialog;
}
class PhotoDialog : public QDialog, public TokenResponseV2
{
Q_OBJECT
public:
explicit PhotoDialog(RsPhotoV2* rs_photo, const RsPhotoPhoto& photo, QWidget *parent = 0);
~PhotoDialog();
private slots:
void addComment();
public:
void loadRequest(const TokenQueueV2 *queue, const TokenRequestV2 &req);
private:
void setUp();
private:
Ui::PhotoDialog *ui;
RsPhotoV2* mRsPhoto;
TokenQueueV2* mPhotoQueue;
RsPhotoPhoto mPhotoDetails;
};
#endif // PHOTODIALOG_H

View File

@ -1,195 +1,234 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PhotoDialog</class>
<widget class="QWidget" name="PhotoDialog">
<widget class="QDialog" name="PhotoDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>774</width>
<height>608</height>
<width>516</width>
<height>449</height>
</rect>
</property>
<property name="windowTitle">
<string>Photo Share</string>
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QGroupBox" name="sortGroup">
<property name="checkable">
<bool>false</bool>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="pushButton_YourAlbums">
<property name="text">
<string>Your Albums</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoExclusive">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_SubscribedAlbums">
<property name="text">
<string>Subscribed Albums</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoExclusive">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_SharedAlbums">
<property name="text">
<string>Shared Albums</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="autoExclusive">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QGroupBox" name="albumGroup">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Photo</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_Photo">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>200</width>
<height>300</height>
</size>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>200</height>
</size>
</property>
<property name="title">
<string>Summary</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="1">
<widget class="QLineEdit" name="lineEdit_Title">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Caption</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEdit_Caption">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Where:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEdit_Where">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="lineEdit_When">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Photo Title:</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>When</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QToolButton" name="toolButton_SlideShow">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="toolButton">
<property name="text">
<string>Slide Show</string>
<string>Add Comment</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_ViewAlbum">
<property name="text">
<string>View Album / Add Photos</string>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_subscribe">
<property name="text">
<string>Subscribe To Album</string>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_NewAlbum">
<property name="text">
<string>Create Album</string>
</property>
</widget>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Vertical</enum>
<widget class="QScrollArea" name="scrollArea_2">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
<property name="alignment">
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_2">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>496</width>
<height>69</height>
</rect>
</property>
<property name="alignment">
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
<property name="styleSheet">
<string notr="true">QWidget#scrollAreaWidgetContents{border: none;}</string>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>754</width>
<height>261</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QWidget#scrollAreaWidgetContents{border: none;}</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>139</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
<widget class="QScrollArea" name="scrollArea_2">
<property name="widgetResizable">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_2">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>754</width>
<height>260</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QWidget#scrollAreaWidgetContents{border: none;}</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>426</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>

View File

@ -1,14 +1,716 @@
/*
* Retroshare Photo Plugin.
*
* Copyright 2012-2012 by Robert Fernie.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License Version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems to "retroshare@lunamutt.com".
*
*/
#include "PhotoShare.h"
#include "ui_PhotoShare.h"
PhotoShare::PhotoShare(QWidget *parent) :
QWidget(parent),
ui(new Ui::PhotoShare)
#include <retroshare/rspeers.h>
#include <retroshare/rsphotoV2.h>
#include <gxs/rsgxsflags.h>
#include <iostream>
#include <sstream>
#include <QTimer>
#include <QMessageBox>
#include "AlbumCreateDialog.h"
#include "AlbumItem.h"
#include "PhotoItem.h"
/******
* #define PHOTO_DEBUG 1
*****/
/****************************************************************
* New Photo Display Widget.
*
* 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.
*/
#define IS_ALBUM_ADMIN(subscribeFlags) (subscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN)
#define IS_ALBUM_SUBSCRIBED(subscribeFlags) (subscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED)
#define IS_ALBUM_N_SUBSCR_OR_ADMIN(subscribeFlags) ((subscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_MASK) == 0)
/** Constructor */
PhotoShare::PhotoShare(QWidget *parent)
: MainPage(parent)
{
ui->setupUi(this);
ui.setupUi(this);
mAlbumSelected = NULL;
mPhotoSelected = NULL;
mSlideShow = NULL;
mAlbumDialog = NULL;
mPhotoDialog = NULL;
connect( ui.toolButton_NewAlbum, SIGNAL(clicked()), this, SLOT(createAlbum()));
connect( ui.toolButton_ViewAlbum, SIGNAL(clicked()), this, SLOT(OpenAlbumDialog()));
connect( ui.toolButton_SlideShow, SIGNAL(clicked()), this, SLOT(OpenSlideShow()));
connect( ui.toolButton_subscribe, SIGNAL(clicked()), this, SLOT(subscribeToAlbum()));
connect(ui.toolButton_ViewPhoto, SIGNAL(clicked()), this, SLOT(OpenPhotoDialog()));
connect( ui.pushButton_YourAlbums, SIGNAL(clicked()), this, SLOT(updateAlbums()));
connect( ui.pushButton_SharedAlbums, SIGNAL(clicked()), this, SLOT(updateAlbums()));
connect( ui.pushButton_SubscribedAlbums, SIGNAL(clicked()), this, SLOT(updateAlbums()));
ui.pushButton_YourAlbums->setChecked(true); // default to your albums view
QTimer *timer = new QTimer(this);
timer->connect(timer, SIGNAL(timeout()), this, SLOT(checkUpdate()));
timer->start(1000);
/* setup TokenQueue */
mPhotoQueue = new TokenQueueV2(rsPhotoV2->getTokenService(), this);
requestAlbumData();
updateAlbums();
}
PhotoShare::~PhotoShare()
void PhotoShare::notifySelection(PhotoShareItem *selection)
{
delete ui;
AlbumItem* aItem;
PhotoItem* pItem;
if((aItem = dynamic_cast<AlbumItem*>(selection)) != NULL)
{
if(mPhotoSelected)
mPhotoSelected->setSelected(false);
clearPhotos();
if(mAlbumSelected == aItem)
{
mAlbumSelected->setSelected(true);
}
else
{
if(mAlbumSelected == NULL)
{
mAlbumSelected = aItem;
}
else
{
mAlbumSelected->setSelected(false);
mAlbumSelected = aItem;
}
mAlbumSelected->setSelected(true);
}
updatePhotos();
}
else if((pItem = dynamic_cast<PhotoItem*>(selection)) != NULL)
{
if(mPhotoSelected == pItem)
{
mPhotoSelected->setSelected(true);
}
else
{
if(mPhotoSelected == NULL)
{
mPhotoSelected = pItem;
}
else
{
mPhotoSelected->setSelected(false);
mPhotoSelected = pItem;
}
mPhotoSelected->setSelected(true);
}
}
else
{
}
}
void PhotoShare::checkUpdate()
{
/* update */
if (!rsPhotoV2)
return;
if (rsPhotoV2->updated())
{
//insertAlbums();
std::list<std::string> grpIds;
rsPhotoV2->groupsChanged(grpIds);
if(!grpIds.empty())
requestAlbumList(grpIds);
GxsMsgIdResult res;
rsPhotoV2->msgsChanged(res);
if(!res.empty())
requestPhotoList(res);
}
return;
}
/*************** New Photo Dialog ***************/
void PhotoShare::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;
}
std::string albumId = mAlbumSelected->getAlbum().mMeta.mGroupId;
if (mSlideShow)
{
mSlideShow->show();
}
else
{
mSlideShow = new PhotoSlideShow(NULL);
mSlideShow->show();
}
mSlideShow->loadAlbum(albumId);
}
/*************** New Photo Dialog ***************/
void PhotoShare::createAlbum()
{
AlbumCreateDialog albumCreate(mPhotoQueue, rsPhotoV2, this);
albumCreate.exec();
}
void PhotoShare::OpenAlbumDialog()
{
if(mAlbumSelected){
if(mAlbumDialog == NULL)
{
mAlbumDialog = new AlbumDialog(mAlbumSelected->getAlbum(), mPhotoQueue, rsPhotoV2);
connect(mAlbumDialog, SIGNAL(destroyed()), this, SLOT(SetAlbumDialogClosed()));
mAlbumDialog->show();
}else{
// bring dialog to front
mAlbumDialog->raise();
}
}
return;
}
void PhotoShare::OpenPhotoDialog()
{
if(mPhotoSelected)
{
if(mPhotoDialog == NULL)
{
mPhotoDialog = new PhotoDialog(rsPhotoV2, mPhotoSelected->getPhotoDetails());
connect(mPhotoDialog, SIGNAL(destroyed()), this, SLOT(SetPhotoDialogClosed()));
mPhotoDialog->show();
}
else
{
mPhotoDialog->raise();
}
}
}
void PhotoShare::SetAlbumDialogClosed()
{
mAlbumDialog = NULL;
}
void PhotoShare::SetPhotoDialogClosed()
{
mPhotoDialog = NULL;
}
/*************** Edit Photo Dialog ***************/
void PhotoShare::clearAlbums()
{
std::cerr << "PhotoShare::clearAlbums()" << std::endl;
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
QSetIterator<AlbumItem*> sit(mAlbumItems);
while(sit.hasNext())
{
AlbumItem* item = sit.next();
alayout->removeWidget(item);
item->setParent(NULL);
}
clearPhotos();
// set no albums to be selected
if(mAlbumSelected)
{
mAlbumSelected->setSelected(false);
mAlbumSelected = NULL;
}
}
void PhotoShare::deleteAlbums()
{
std::cerr << "PhotoShare::clearAlbums()" << std::endl;
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
QSetIterator<AlbumItem*> sit(mAlbumItems);
while(sit.hasNext())
{
AlbumItem* item = sit.next();
alayout->removeWidget(item);
delete item;
}
mAlbumItems.clear();
mAlbumSelected = NULL;
}
void PhotoShare::clearPhotos()
{
std::cerr << "PhotoShare::clearPhotos()" << std::endl;
mPhotoSelected = NULL;
QLayout *layout = ui.scrollAreaWidgetContents_2->layout();
if(mAlbumSelected)
{
const RsGxsGroupId& id = mAlbumSelected->getAlbum().mMeta.mGroupId;
QSetIterator<PhotoItem*> sit(mPhotoItems[id]);
while(sit.hasNext())
{
PhotoItem* item = sit.next();
layout->removeWidget(item);
item->setParent(NULL);
}
}
}
void PhotoShare::updateAlbums()
{
clearAlbums();
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
QSetIterator<AlbumItem*> sit(mAlbumItems);
if(ui.pushButton_YourAlbums->isChecked())
{
ui.toolButton_subscribe->setEnabled(false);
ui.toolButton_NewAlbum->setEnabled(true);
ui.toolButton_SlideShow->setEnabled(true);
while(sit.hasNext()){
AlbumItem* item = sit.next();
uint32_t flags = item->getAlbum().mMeta.mSubscribeFlags;
if(IS_ALBUM_ADMIN(flags))
alayout->addWidget(item);
}
}else if(ui.pushButton_SubscribedAlbums->isChecked())
{
ui.toolButton_subscribe->setEnabled(true);
ui.toolButton_subscribe->setText("Unsubscribe From Album");
ui.toolButton_NewAlbum->setEnabled(false);
ui.toolButton_SlideShow->setEnabled(true);
while(sit.hasNext()){
AlbumItem* item = sit.next();
uint32_t flags = item->getAlbum().mMeta.mSubscribeFlags;
if(IS_ALBUM_SUBSCRIBED(flags))
alayout->addWidget(item);
}
}else if(ui.pushButton_SharedAlbums->isChecked())
{
ui.toolButton_subscribe->setEnabled(true);
ui.toolButton_subscribe->setText("Subscribe To Album");
ui.toolButton_NewAlbum->setEnabled(false);
ui.toolButton_SlideShow->setEnabled(false);
while(sit.hasNext()){
AlbumItem* item = sit.next();
uint32_t flags = item->getAlbum().mMeta.mSubscribeFlags;
if(IS_ALBUM_N_SUBSCR_OR_ADMIN(flags))
alayout->addWidget(item);
}
}
}
void PhotoShare::addAlbum(const RsPhotoAlbum &album)
{
std::cerr << " PhotoShare::addAlbum() AlbumId: " << album.mMeta.mGroupId << std::endl;
AlbumItem *item = new AlbumItem(album, this, this);
mAlbumItems.insert(item);
}
void PhotoShare::addPhoto(const RsPhotoPhoto &photo)
{
std::cerr << "PhotoShare::addPhoto() AlbumId: " << photo.mMeta.mGroupId;
std::cerr << " PhotoId: " << photo.mMeta.mMsgId;
std::cerr << std::endl;
PhotoItem* item = new PhotoItem(this, photo, this);
const RsGxsGroupId id = photo.mMeta.mGroupId;
mPhotoItems[id].insert(item);
}
void PhotoShare::subscribeToAlbum()
{
if(mAlbumSelected){
RsGxsGroupId id = mAlbumSelected->getAlbum().mMeta.mGroupId;
uint32_t token;
if(IS_ALBUM_SUBSCRIBED(mAlbumSelected->getAlbum().mMeta.mSubscribeFlags))
rsPhotoV2->subscribeToAlbum(token, id, false);
else if(IS_ALBUM_ADMIN(mAlbumSelected->getAlbum().mMeta.mSubscribeFlags))
return;
else if(IS_ALBUM_N_SUBSCR_OR_ADMIN(
mAlbumSelected->getAlbum().mMeta.mSubscribeFlags))
rsPhotoV2->subscribeToAlbum(token, id, true);
else
return;
mPhotoQueue->queueRequest(token, TOKENREQ_GROUPINFO, RS_TOKREQ_ANSTYPE_ACK, 0);
}
}
void PhotoShare::updatePhotos()
{
clearPhotos();
if(mAlbumSelected)
{
const RsGxsGroupId& grpId = mAlbumSelected->getAlbum().mMeta.mGroupId;
QSetIterator<PhotoItem*> sit(mPhotoItems[grpId]);
while(sit.hasNext())
{
QLayout *layout = ui.scrollAreaWidgetContents_2->layout();
layout->addWidget(sit.next());
}
}
}
/**************************** Request / Response Filling of Data ************************/
void PhotoShare::requestAlbumList(std::list<std::string>& ids)
{
RsTokReqOptionsV2 opts;
opts.mReqType = GXS_REQUEST_TYPE_GROUP_IDS;
uint32_t token;
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, ids, 0);
}
void PhotoShare::requestPhotoList(GxsMsgReq& req)
{
RsTokReqOptionsV2 opts;
opts.mReqType = GXS_REQUEST_TYPE_MSG_IDS;
uint32_t token;
mPhotoQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, req, 0);
return;
}
void PhotoShare::loadAlbumList(const uint32_t &token)
{
std::cerr << "PhotoShare::loadAlbumList()";
std::cerr << std::endl;
std::list<std::string> albumIds;
rsPhotoV2->getGroupList(token, albumIds);
requestAlbumData(albumIds);
clearPhotos();
std::list<std::string>::iterator it;
for(it = albumIds.begin(); it != albumIds.end(); it++)
{
requestPhotoList(*it);
}
}
void PhotoShare::requestAlbumData(std::list<RsGxsGroupId> &ids)
{
RsTokReqOptionsV2 opts;
uint32_t token;
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, ids, 0);
}
void PhotoShare::requestAlbumData()
{
RsTokReqOptionsV2 opts;
uint32_t token;
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, 0);
}
bool PhotoShare::loadAlbumData(const uint32_t &token)
{
deleteAlbums();
std::cerr << "PhotoShare::loadAlbumData()";
std::cerr << std::endl;
std::vector<RsPhotoAlbum> albums;
rsPhotoV2->getAlbum(token, albums);
std::vector<RsPhotoAlbum>::iterator vit = albums.begin();
for(; vit != albums.end(); vit++)
{
RsPhotoAlbum& album = *vit;
std::cerr << " PhotoShare::addAlbum() AlbumId: " << album.mMeta.mGroupId << std::endl;
addAlbum(album);
}
updateAlbums();
return true;
}
void PhotoShare::requestPhotoList(const std::string &albumId)
{
std::list<RsGxsGroupId> grpIds;
grpIds.push_back(albumId);
RsTokReqOptionsV2 opts;
opts.mReqType = GXS_REQUEST_TYPE_MSG_IDS;
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
uint32_t token;
mPhotoQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, grpIds, 0);
}
void PhotoShare::acknowledgeGroup(const uint32_t &token)
{
RsGxsGroupId grpId;
rsPhotoV2->acknowledgeGrp(token, grpId);
if(!grpId.empty())
{
std::list<RsGxsGroupId> grpIds;
grpIds.push_back(grpId);
RsTokReqOptionsV2 opts;
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
uint32_t reqToken;
mPhotoQueue->requestGroupInfo(reqToken, RS_TOKREQ_ANSTYPE_DATA, opts, 0);
}
}
void PhotoShare::acknowledgeMessage(const uint32_t &token)
{
std::pair<RsGxsGroupId, RsGxsMessageId> p;
rsPhotoV2->acknowledgeMsg(token, p);
if(!p.first.empty())
{
GxsMsgReq req;
std::vector<RsGxsMessageId> v;
v.push_back(p.second);
req[p.first] = v;
RsTokReqOptionsV2 opts;
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
uint32_t reqToken;
mPhotoQueue->requestMsgInfo(reqToken, RS_TOKREQ_ANSTYPE_DATA, opts, req, 0);
}
}
void PhotoShare::loadPhotoList(const uint32_t &token)
{
std::cerr << "PhotoShare::loadPhotoList()";
std::cerr << std::endl;
GxsMsgIdResult res;
rsPhotoV2->getMsgList(token, res);
requestPhotoData(res);
}
void PhotoShare::requestPhotoData(GxsMsgReq &photoIds)
{
RsTokReqOptionsV2 opts;
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
uint32_t token;
mPhotoQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, photoIds, 0);
}
void PhotoShare::loadPhotoData(const uint32_t &token)
{
std::cerr << "PhotoShare::loadPhotoData()";
std::cerr << std::endl;
PhotoResult res;
rsPhotoV2->getPhoto(token, res);
PhotoResult::iterator mit = res.begin();
for(; mit != res.end(); mit++)
{
std::vector<RsPhotoPhoto>& photoV = mit->second;
std::vector<RsPhotoPhoto>::iterator vit = photoV.begin();
for(; vit != photoV.end(); vit++)
{
RsPhotoPhoto& photo = *vit;
addPhoto(photo);
std::cerr << "PhotoShare::loadPhotoData() AlbumId: " << photo.mMeta.mGroupId;
std::cerr << " PhotoId: " << photo.mMeta.mMsgId;
std::cerr << std::endl;
}
}
updatePhotos();
}
/**************************** Request / Response Filling of Data ************************/
void PhotoShare::loadRequest(const TokenQueueV2 *queue, const TokenRequestV2 &req)
{
std::cerr << "PhotoShare::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;
case RS_TOKREQ_ANSTYPE_ACK:
acknowledgeGroup(req.mToken);
break;
default:
std::cerr << "PhotoShare::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_ACK:
acknowledgeMessage(req.mToken);
break;
case RS_TOKREQ_ANSTYPE_DATA:
loadPhotoData(req.mToken);
break;
default:
std::cerr << "PhotoShare::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 << "PhotoShare::loadRequest() ERROR: MSG: INVALID ANS TYPE";
std::cerr << std::endl;
break;
}
break;
default:
std::cerr << "PhotoShare::loadRequest() ERROR: INVALID TYPE";
std::cerr << std::endl;
break;
}
}
}
/**************************** Request / Response Filling of Data ************************/

View File

@ -2,21 +2,98 @@
#define PHOTOSHARE_H
#include <QWidget>
#include <map>
#include "ui_PhotoShare.h"
#include "retroshare/rsphotoV2.h"
#include "retroshare-gui/mainpage.h"
#include "AlbumCreateDialog.h"
#include "AlbumDialog.h"
#include "PhotoDialog.h"
#include "AlbumItem.h"
#include "PhotoItem.h"
#include "PhotoSlideShow.h"
#include "util/TokenQueueV2.h"
#include "PhotoShareItemHolder.h"
namespace Ui {
class PhotoShare;
}
class PhotoShare : public QWidget
class PhotoShare : public MainPage, public TokenResponseV2, public PhotoShareItemHolder
{
Q_OBJECT
Q_OBJECT
public:
explicit PhotoShare(QWidget *parent = 0);
~PhotoShare();
PhotoShare(QWidget *parent = 0);
void notifySelection(PhotoShareItem* selection);
private slots:
void checkUpdate();
void createAlbum();
void OpenAlbumDialog();
void OpenPhotoDialog();
void OpenSlideShow();
void SetAlbumDialogClosed();
void SetPhotoDialogClosed();
void updateAlbums();
void subscribeToAlbum();
private:
/* Request Response Functions for loading data */
void requestAlbumList(std::list<std::string>& ids);
void requestAlbumData(std::list<RsGxsGroupId> &ids);
/*!
* request data for all groups
*/
void requestAlbumData();
void requestPhotoList(GxsMsgReq &albumIds);
void requestPhotoList(const std::string &albumId);
void requestPhotoData(GxsMsgReq &photoIds);
void loadAlbumList(const uint32_t &token);
bool loadAlbumData(const uint32_t &token);
void loadPhotoList(const uint32_t &token);
void loadPhotoData(const uint32_t &token);
void loadRequest(const TokenQueueV2 *queue, const TokenRequestV2 &req);
void acknowledgeGroup(const uint32_t &token);
void acknowledgeMessage(const uint32_t &token);
/* Grunt work of setting up the GUI */
void addAlbum(const RsPhotoAlbum &album);
void addPhoto(const RsPhotoPhoto &photo);
void clearAlbums();
void clearPhotos();
void deleteAlbums();
void updatePhotos();
private:
Ui::PhotoShare *ui;
AlbumItem* mAlbumSelected;
PhotoItem* mPhotoSelected;
PhotoSlideShow* mSlideShow;
AlbumDialog* mAlbumDialog;
PhotoDialog* mPhotoDialog;
TokenQueueV2 *mPhotoQueue;
/* UI - from Designer */
Ui::PhotoShare ui;
QSet<AlbumItem*> mAlbumItems;
QMap<RsGxsGroupId, QSet<PhotoItem*> > mPhotoItems;
};
#endif // PHOTOSHARE_H

View File

@ -1,21 +1,211 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<author/>
<comment/>
<exportmacro/>
<class>PhotoShare</class>
<widget class="QWidget" name="PhotoShare">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
<width>824</width>
<height>569</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QGroupBox" name="sortGroup">
<property name="checkable">
<bool>false</bool>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="pushButton_YourAlbums">
<property name="text">
<string>Your Albums</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoExclusive">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_SubscribedAlbums">
<property name="text">
<string>Subscribed Albums</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoExclusive">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_SharedAlbums">
<property name="text">
<string>Shared Albums</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="autoExclusive">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QToolButton" name="toolButton_SlideShow">
<property name="text">
<string>Slide Show</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_ViewAlbum">
<property name="text">
<string>View Album / Add Photos</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_subscribe">
<property name="text">
<string>Subscribe To Album</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_NewAlbum">
<property name="text">
<string>Create Album</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>804</width>
<height>228</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QWidget#scrollAreaWidgetContents{border: none;}</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>139</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
<widget class="QScrollArea" name="scrollArea_2">
<property name="widgetResizable">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_2">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>804</width>
<height>227</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QWidget#scrollAreaWidgetContents{border: none;}</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>426</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QToolButton" name="toolButton_ViewPhoto">
<property name="text">
<string>View Photo</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<pixmapfunction/>
<resources/>
<connections/>
</ui>

View File

@ -32,7 +32,7 @@
#include <retroshare/rsiface.h>
#include "gui/PhotoShare/PhotoDialog.h"
#include "gui/PhotoShare/PhotoShare.h"
// THESE HAVE TO BE CONVERTED TO VEG FORMAT
#if USE_VEG_SERVICE
@ -104,9 +104,9 @@ ApplicationWindow::ApplicationWindow(QWidget* parent, Qt::WFlags flags)
createPageAction(QIcon(IMAGE_LIBRARY), tr("Identities"), grp));
#endif
PhotoDialog *photoDialog = NULL;
ui.stackPages->add(photoDialog = new PhotoDialog(ui.stackPages),
createPageAction(QIcon(IMAGE_PHOTO), tr("Photo View"), grp));
PhotoShare *photoShare = NULL;
ui.stackPages->add(photoShare = new PhotoShare(ui.stackPages),
createPageAction(QIcon(IMAGE_PHOTO), tr("Photo Share"), grp));
// THESE HAVE TO BE CONVERTED TO VEG FORMAT
#if USE_VEG_SERVICE

View File

@ -66,6 +66,16 @@ bool TokenQueueV2::requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTok
return true;
}
bool TokenQueueV2::requestMsgRelatedInfo(uint32_t &token, const RsTokReqOptionsV2 &opts, const std::list<RsGxsGroupId> &grpIds, uint32_t usertype)
{
uint32_t basictype = TOKENREQ_MSGINFO;
uint32_t anstype = RS_TOKREQ_ANSTYPE_LIST; // always a list answer
mService->requestMsgRelatedInfo(token, anstype, opts, ids);
queueRequest(token, basictype, anstype, usertype);
return true;
}
bool TokenQueueV2::requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptionsV2 &opts,
const std::list<RsGxsGroupId> &grpIds, uint32_t usertype)
@ -143,7 +153,9 @@ void TokenQueueV2::pollRequests()
bool TokenQueueV2::checkForRequest(uint32_t token)
{
/* check token */
return (RsTokenServiceV2::GXS_REQUEST_STATUS_COMPLETE == mService->requestStatus(token));
uint32_t status = mService->requestStatus(token);
return ( (RsTokenServiceV2::GXS_REQUEST_STATUS_FAILED == status) ||
(RsTokenServiceV2::GXS_REQUEST_STATUS_COMPLETE == status) );
}

View File

@ -93,6 +93,7 @@ public:
bool requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptionsV2 &opts,
const GxsMsgReq& grpIds, uint32_t usertype);
bool requestMsgRelatedInfo(uint32_t &token, const RsTokReqOptionsV2 &opts, const std::list<RsGxsGroupId>& grpIds, uint32_t usertype);
bool cancelRequest(const uint32_t token);

View File

@ -84,7 +84,7 @@ Menu *CreateMenuStructure(NotifyTxt *notify)
MenuList *search = new MenuListSearch(notify);
MenuList *searchlist = new MenuListSearchList(notify);
search->addMenuItem(MENU_SEARCH_KEY_ADD, new MenuOpSearchNew(notify));
search->addMenuItem(MENU_SEARCH_KEY_ADD, new MenuOpSearchNew());
//search->addMenuItem(MENU_SEARCH_KEY_REMOVE, new MenuOpSearchDelete());
search->addMenuItem(MENU_SEARCH_KEY_VIEW, searchlist);
searchlist->addMenuItem(MENU_SEARCH_KEY_DOWNLOAD, new MenuOpSearchListDownload());
@ -362,17 +362,11 @@ int MenuListSearch::removeSearch(std::string strSearchId)
it = mSearchIds.find(strSearchId);
if (it != mSearchIds.end())
{
/* cleanup local maps */
/* cancel search */
// CAN'T DO!!!
/* clear results from Notify Collector */
mNotify->clearSearchId(it->second);
/* cleanup local maps */
mSearchIds.erase(it);
/* cleanup terms maps (TODO) */
}
return 1;
@ -398,7 +392,6 @@ uint32_t MenuOpSearchNew::process_lines(std::string input)
std::string search = input.substr(0, input.size() - 1); // remove \n.
uint32_t searchId = (uint32_t) rsTurtle->turtleSearch(search);
mNotify->collectSearchResults(searchId);
/* store request in parent */
MenuListSearch *ms = dynamic_cast<MenuListSearch *>(parent());
@ -652,7 +645,7 @@ int MenuListShared::getEntryDesc(int idx, std::string &desc)
rsFiles->getSharedDirectories(dirs);
std::list<SharedDirInfo>::iterator it;
std::string shareflag;
int i=0;
unsigned int i=0;
for (it = dirs.begin(); (i < idx) && (it != dirs.end()); it++, i++);
if (it != dirs.end())
{
@ -682,7 +675,7 @@ int MenuListShared::unshareSelected()
std::list<SharedDirInfo> dirs;
rsFiles->getSharedDirectories(dirs);
std::list<SharedDirInfo>::iterator it;
int i=0;
unsigned int i=0;
for (it = dirs.begin(); (i < mSelectIdx) && (it != dirs.end()); it++, i++);
if (it != dirs.end())
{
@ -703,7 +696,7 @@ int MenuListShared::toggleFlagSelected(uint32_t shareflags)
std::list<SharedDirInfo> dirs;
rsFiles->getSharedDirectories(dirs);
std::list<SharedDirInfo>::iterator it;
int i=0;
unsigned int i=0;
for (it = dirs.begin(); (i < mSelectIdx) && (it != dirs.end()); it++, i++);
if (it != dirs.end())
{

View File

@ -230,15 +230,8 @@ void NotifyTxt::notifyTurtleSearchResult(uint32_t search_id,const std::list<Turt
it = mSearchResults.find(search_id);
if (it == mSearchResults.end())
{
std::cerr << "NotifyTxt::notifyTurtleSearchResult() " << found_files.size();
std::cerr << "ERROR: new results for Id: " << search_id;
std::cerr << std::endl;
std::cerr << "But list not installed...";
std::cerr << " DROPPING SEARCH RESULTS";
std::cerr << std::endl;
/* new entry */
//mSearchResults[search_id] = found_files;
mSearchResults[search_id] = found_files;
return;
}
@ -295,42 +288,15 @@ int NotifyTxt::getSearchResultCount(uint32_t id)
return it->second.size();
}
// only collect results for selected searches.
// will drop others.
int NotifyTxt::collectSearchResults(uint32_t searchId)
{
std::cerr << "NotifyTxt::collectSearchResult(" << searchId << ")";
std::cerr << std::endl;
RsStackMutex stack(mNotifyMtx); /****** LOCKED *****/
std::map<uint32_t, std::list<TurtleFileInfo> >::iterator it;
it = mSearchResults.find(searchId);
if (it == mSearchResults.end())
{
std::list<TurtleFileInfo> emptyList;
mSearchResults[searchId] = emptyList;
return 1;
}
std::cerr << "NotifyTxt::collectSearchResult() ERROR Id exists";
std::cerr << std::endl;
return 1;
}
int NotifyTxt::clearSearchId(uint32_t searchId)
{
std::cerr << "NotifyTxt::clearSearchId(" << searchId << ")";
std::cerr << std::endl;
RsStackMutex stack(mNotifyMtx); /****** LOCKED *****/
std::map<uint32_t, std::list<TurtleFileInfo> >::iterator it;
it = mSearchResults.find(searchId);
if (it == mSearchResults.end())
{
std::cerr << "NotifyTxt::clearSearchId() ERROR Id not there";
std::cerr << std::endl;
return 0;
}

View File

@ -388,7 +388,7 @@ int main(int argc, char **argv)
if (enableRpc)
{
/* Build RPC Server */
RpcMediator *med = CreateRpcSystem(ssh, notify);
RpcMediator *med = CreateRpcSystem(ssh);
ssh->setRpcSystem(med);
ssh->setSleepPeriods(0.01, 0.1);
}

View File

@ -134,10 +134,12 @@ void protobuf_AssignDesc_core_2eproto() {
sizeof(Person));
Person_Relationship_descriptor_ = Person_descriptor_->enum_type(0);
File_descriptor_ = file->message_type(4);
static const int File_offsets_[3] = {
static const int File_offsets_[5] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(File, name_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(File, hash_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(File, size_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(File, path_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(File, avail_),
};
File_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
@ -281,39 +283,39 @@ void protobuf_AddDesc_core_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
"\n\ncore.proto\022\013rsctrl.core\"\260\001\n\006Status\022,\n\004"
"\n\ncore.proto\022\013rsctrl.core\"\233\001\n\006Status\022,\n\004"
"code\030\001 \002(\0162\036.rsctrl.core.Status.StatusCo"
"de\022\013\n\003msg\030\002 \001(\t\"k\n\nStatusCode\022\n\n\006FAILED\020"
"\000\022\017\n\013NO_IMPL_YET\020\001\022\021\n\rINVALID_QUERY\020\002\022\023\n"
"\017PARTIAL_SUCCESS\020\003\022\013\n\007SUCCESS\020\004\022\013\n\007READM"
"SG\020\005\")\n\006IpAddr\022\016\n\004addr\030\001 \002(\t:\000\022\017\n\004port\030\002"
" \002(\r:\0010\"\303\001\n\010Location\022\016\n\006ssl_id\030\001 \002(\t\022\020\n\010"
"location\030\002 \002(\t\022&\n\tlocaladdr\030\003 \002(\0132\023.rsct"
"rl.core.IpAddr\022$\n\007extaddr\030\004 \002(\0132\023.rsctrl"
".core.IpAddr\022\r\n\005state\030\005 \002(\r\"8\n\nStateFlag"
"s\022\n\n\006ONLINE\020\001\022\r\n\tCONNECTED\020\002\022\017\n\013UNREACHA"
"BLE\020\004\"\340\001\n\006Person\022\016\n\006gpg_id\030\001 \002(\t\022\014\n\004name"
"\030\002 \002(\t\0222\n\010relation\030\003 \002(\0162 .rsctrl.core.P"
"erson.Relationship\022(\n\tlocations\030\004 \003(\0132\025."
"rsctrl.core.Location\"Z\n\014Relationship\022\n\n\006"
"FRIEND\020\001\022\032\n\026FRIEND_OF_MANY_FRIENDS\020\002\022\025\n\021"
"FRIEND_OF_FRIENDS\020\003\022\013\n\007UNKNOWN\020\004\"0\n\004File"
"\022\014\n\004name\030\001 \002(\t\022\014\n\004hash\030\002 \002(\t\022\014\n\004size\030\003 \002"
"(\004\"f\n\003Dir\022\014\n\004name\030\001 \002(\t\022\014\n\004path\030\002 \002(\t\022!\n"
"\007subdirs\030\003 \003(\0132\020.rsctrl.core.Dir\022 \n\005file"
"s\030\004 \003(\0132\021.rsctrl.core.File\"\372\001\n\014SystemSta"
"tus\0225\n\nnet_status\030\001 \002(\0162!.rsctrl.core.Sy"
"stemStatus.NetCode\022\013\n\003msg\030\002 \001(\t\"\245\001\n\007NetC"
"ode\022\017\n\013BAD_UNKNOWN\020\000\022\017\n\013BAD_OFFLINE\020\001\022\016\n"
"\nBAD_NATSYM\020\002\022\021\n\rBAD_NODHT_NAT\020\003\022\023\n\017WARN"
"ING_RESTART\020\004\022\022\n\016WARNING_NATTED\020\005\022\021\n\rWAR"
"NING_NODHT\020\006\022\010\n\004GOOD\020\007\022\017\n\013ADV_FORWARD\020\010\""
"3\n\tBandwidth\022\n\n\002up\030\001 \002(\002\022\014\n\004down\030\002 \002(\002\022\014"
"\n\004name\030\003 \001(\t\":\n\014BandwidthSet\022*\n\nbandwidt"
"hs\030\001 \003(\0132\026.rsctrl.core.Bandwidth*\027\n\013Exte"
"nsionId\022\010\n\004CORE\020\000*M\n\tPackageId\022\t\n\005PEERS\020"
"\001\022\n\n\006SYSTEM\020\002\022\010\n\004CHAT\020\003\022\n\n\006SEARCH\020\004\022\t\n\005F"
"ILES\020\005\022\010\n\003GXS\020\350\007", 1296);
"de\022\013\n\003msg\030\002 \001(\t\"V\n\nStatusCode\022\n\n\006FAILED\020"
"\000\022\017\n\013NO_IMPL_YET\020\001\022\021\n\rINVALID_QUERY\020\002\022\013\n"
"\007SUCCESS\020\003\022\013\n\007READMSG\020\004\")\n\006IpAddr\022\016\n\004add"
"r\030\001 \002(\t:\000\022\017\n\004port\030\002 \002(\r:\0010\"\303\001\n\010Location\022"
"\016\n\006ssl_id\030\001 \002(\t\022\020\n\010location\030\002 \002(\t\022&\n\tloc"
"aladdr\030\003 \002(\0132\023.rsctrl.core.IpAddr\022$\n\007ext"
"addr\030\004 \002(\0132\023.rsctrl.core.IpAddr\022\r\n\005state"
"\030\005 \002(\r\"8\n\nStateFlags\022\n\n\006ONLINE\020\001\022\r\n\tCONN"
"ECTED\020\002\022\017\n\013UNREACHABLE\020\004\"\340\001\n\006Person\022\016\n\006g"
"pg_id\030\001 \002(\t\022\014\n\004name\030\002 \002(\t\0222\n\010relation\030\003 "
"\002(\0162 .rsctrl.core.Person.Relationship\022(\n"
"\tlocations\030\004 \003(\0132\025.rsctrl.core.Location\""
"Z\n\014Relationship\022\n\n\006FRIEND\020\001\022\032\n\026FRIEND_OF"
"_MANY_FRIENDS\020\002\022\025\n\021FRIEND_OF_FRIENDS\020\003\022\013"
"\n\007UNKNOWN\020\004\"M\n\004File\022\014\n\004name\030\001 \002(\t\022\014\n\004has"
"h\030\002 \002(\t\022\014\n\004size\030\003 \002(\003\022\014\n\004path\030\004 \001(\t\022\r\n\005a"
"vail\030\005 \001(\t\"f\n\003Dir\022\014\n\004name\030\001 \002(\t\022\014\n\004path\030"
"\002 \002(\t\022!\n\007subdirs\030\003 \003(\0132\020.rsctrl.core.Dir"
"\022 \n\005files\030\004 \003(\0132\021.rsctrl.core.File\"\372\001\n\014S"
"ystemStatus\0225\n\nnet_status\030\001 \002(\0162!.rsctrl"
".core.SystemStatus.NetCode\022\013\n\003msg\030\002 \001(\t\""
"\245\001\n\007NetCode\022\017\n\013BAD_UNKNOWN\020\000\022\017\n\013BAD_OFFL"
"INE\020\001\022\016\n\nBAD_NATSYM\020\002\022\021\n\rBAD_NODHT_NAT\020\003"
"\022\023\n\017WARNING_RESTART\020\004\022\022\n\016WARNING_NATTED\020"
"\005\022\021\n\rWARNING_NODHT\020\006\022\010\n\004GOOD\020\007\022\017\n\013ADV_FO"
"RWARD\020\010\"3\n\tBandwidth\022\n\n\002up\030\001 \002(\002\022\014\n\004down"
"\030\002 \002(\002\022\014\n\004name\030\003 \001(\t\":\n\014BandwidthSet\022*\n\n"
"bandwidths\030\001 \003(\0132\026.rsctrl.core.Bandwidth"
"*\027\n\013ExtensionId\022\010\n\004CORE\020\000*6\n\tPackageId\022\t"
"\n\005PEERS\020\001\022\n\n\006SYSTEM\020\002\022\010\n\004CHAT\020\003\022\010\n\003GXS\020\350"
"\007", 1281);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"core.proto", &protobuf_RegisterTypes);
Status::default_instance_ = new Status();
@ -366,8 +368,6 @@ bool PackageId_IsValid(int value) {
case 1:
case 2:
case 3:
case 4:
case 5:
case 1000:
return true;
default:
@ -389,7 +389,6 @@ bool Status_StatusCode_IsValid(int value) {
case 2:
case 3:
case 4:
case 5:
return true;
default:
return false;
@ -400,7 +399,6 @@ bool Status_StatusCode_IsValid(int value) {
const Status_StatusCode Status::FAILED;
const Status_StatusCode Status::NO_IMPL_YET;
const Status_StatusCode Status::INVALID_QUERY;
const Status_StatusCode Status::PARTIAL_SUCCESS;
const Status_StatusCode Status::SUCCESS;
const Status_StatusCode Status::READMSG;
const Status_StatusCode Status::StatusCode_MIN;
@ -1784,6 +1782,8 @@ void Person::Swap(Person* other) {
const int File::kNameFieldNumber;
const int File::kHashFieldNumber;
const int File::kSizeFieldNumber;
const int File::kPathFieldNumber;
const int File::kAvailFieldNumber;
#endif // !_MSC_VER
File::File()
@ -1804,7 +1804,9 @@ void File::SharedCtor() {
_cached_size_ = 0;
name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
hash_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
size_ = GOOGLE_ULONGLONG(0);
size_ = GOOGLE_LONGLONG(0);
path_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
avail_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
@ -1819,6 +1821,12 @@ void File::SharedDtor() {
if (hash_ != &::google::protobuf::internal::kEmptyString) {
delete hash_;
}
if (path_ != &::google::protobuf::internal::kEmptyString) {
delete path_;
}
if (avail_ != &::google::protobuf::internal::kEmptyString) {
delete avail_;
}
if (this != default_instance_) {
}
}
@ -1855,7 +1863,17 @@ void File::Clear() {
hash_->clear();
}
}
size_ = GOOGLE_ULONGLONG(0);
size_ = GOOGLE_LONGLONG(0);
if (has_path()) {
if (path_ != &::google::protobuf::internal::kEmptyString) {
path_->clear();
}
}
if (has_avail()) {
if (avail_ != &::google::protobuf::internal::kEmptyString) {
avail_->clear();
}
}
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
@ -1900,18 +1918,52 @@ bool File::MergePartialFromCodedStream(
break;
}
// required uint64 size = 3;
// required int64 size = 3;
case 3: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_size:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>(
input, &size_)));
set_has_size();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(34)) goto parse_path;
break;
}
// optional string path = 4;
case 4: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_path:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_path()));
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->path().data(), this->path().length(),
::google::protobuf::internal::WireFormat::PARSE);
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(42)) goto parse_avail;
break;
}
// optional string avail = 5;
case 5: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_avail:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_avail()));
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->avail().data(), this->avail().length(),
::google::protobuf::internal::WireFormat::PARSE);
} else {
goto handle_uninterpreted;
}
if (input->ExpectAtEnd()) return true;
break;
}
@ -1952,9 +2004,27 @@ void File::SerializeWithCachedSizes(
2, this->hash(), output);
}
// required uint64 size = 3;
// required int64 size = 3;
if (has_size()) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(3, this->size(), output);
::google::protobuf::internal::WireFormatLite::WriteInt64(3, this->size(), output);
}
// optional string path = 4;
if (has_path()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->path().data(), this->path().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
::google::protobuf::internal::WireFormatLite::WriteString(
4, this->path(), output);
}
// optional string avail = 5;
if (has_avail()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->avail().data(), this->avail().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
::google::protobuf::internal::WireFormatLite::WriteString(
5, this->avail(), output);
}
if (!unknown_fields().empty()) {
@ -1985,9 +2055,29 @@ void File::SerializeWithCachedSizes(
2, this->hash(), target);
}
// required uint64 size = 3;
// required int64 size = 3;
if (has_size()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(3, this->size(), target);
target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(3, this->size(), target);
}
// optional string path = 4;
if (has_path()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->path().data(), this->path().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
4, this->path(), target);
}
// optional string avail = 5;
if (has_avail()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->avail().data(), this->avail().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
5, this->avail(), target);
}
if (!unknown_fields().empty()) {
@ -2015,13 +2105,27 @@ int File::ByteSize() const {
this->hash());
}
// required uint64 size = 3;
// required int64 size = 3;
if (has_size()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
::google::protobuf::internal::WireFormatLite::Int64Size(
this->size());
}
// optional string path = 4;
if (has_path()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->path());
}
// optional string avail = 5;
if (has_avail()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->avail());
}
}
if (!unknown_fields().empty()) {
total_size +=
@ -2058,6 +2162,12 @@ void File::MergeFrom(const File& from) {
if (from.has_size()) {
set_size(from.size());
}
if (from.has_path()) {
set_path(from.path());
}
if (from.has_avail()) {
set_avail(from.avail());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
@ -2085,6 +2195,8 @@ void File::Swap(File* other) {
std::swap(name_, other->name_);
std::swap(hash_, other->hash_);
std::swap(size_, other->size_);
std::swap(path_, other->path_);
std::swap(avail_, other->avail_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);

View File

@ -25,13 +25,6 @@ const ::google::protobuf::Descriptor* ResponseSystemStatus_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
ResponseSystemStatus_reflection_ = NULL;
const ::google::protobuf::EnumDescriptor* ResponseSystemStatus_NetCode_descriptor_ = NULL;
const ::google::protobuf::Descriptor* RequestSystemQuit_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
RequestSystemQuit_reflection_ = NULL;
const ::google::protobuf::EnumDescriptor* RequestSystemQuit_QuitCode_descriptor_ = NULL;
const ::google::protobuf::Descriptor* ResponseSystemQuit_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
ResponseSystemQuit_reflection_ = NULL;
const ::google::protobuf::EnumDescriptor* RequestMsgIds_descriptor_ = NULL;
const ::google::protobuf::EnumDescriptor* ResponseMsgIds_descriptor_ = NULL;
@ -78,37 +71,6 @@ void protobuf_AssignDesc_system_2eproto() {
::google::protobuf::MessageFactory::generated_factory(),
sizeof(ResponseSystemStatus));
ResponseSystemStatus_NetCode_descriptor_ = ResponseSystemStatus_descriptor_->enum_type(0);
RequestSystemQuit_descriptor_ = file->message_type(2);
static const int RequestSystemQuit_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RequestSystemQuit, quit_code_),
};
RequestSystemQuit_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
RequestSystemQuit_descriptor_,
RequestSystemQuit::default_instance_,
RequestSystemQuit_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RequestSystemQuit, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RequestSystemQuit, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(RequestSystemQuit));
RequestSystemQuit_QuitCode_descriptor_ = RequestSystemQuit_descriptor_->enum_type(0);
ResponseSystemQuit_descriptor_ = file->message_type(3);
static const int ResponseSystemQuit_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ResponseSystemQuit, status_),
};
ResponseSystemQuit_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
ResponseSystemQuit_descriptor_,
ResponseSystemQuit::default_instance_,
ResponseSystemQuit_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ResponseSystemQuit, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ResponseSystemQuit, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(ResponseSystemQuit));
RequestMsgIds_descriptor_ = file->enum_type(0);
ResponseMsgIds_descriptor_ = file->enum_type(1);
}
@ -127,10 +89,6 @@ void protobuf_RegisterTypes(const ::std::string&) {
RequestSystemStatus_descriptor_, &RequestSystemStatus::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
ResponseSystemStatus_descriptor_, &ResponseSystemStatus::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
RequestSystemQuit_descriptor_, &RequestSystemQuit::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
ResponseSystemQuit_descriptor_, &ResponseSystemQuit::default_instance());
}
} // namespace
@ -140,10 +98,6 @@ void protobuf_ShutdownFile_system_2eproto() {
delete RequestSystemStatus_reflection_;
delete ResponseSystemStatus::default_instance_;
delete ResponseSystemStatus_reflection_;
delete RequestSystemQuit::default_instance_;
delete RequestSystemQuit_reflection_;
delete ResponseSystemQuit::default_instance_;
delete ResponseSystemQuit_reflection_;
}
void protobuf_AddDesc_system_2eproto() {
@ -165,25 +119,15 @@ void protobuf_AddDesc_system_2eproto() {
"\016\n\nBAD_NATSYM\020\002\022\021\n\rBAD_NODHT_NAT\020\003\022\023\n\017WA"
"RNING_RESTART\020\004\022\022\n\016WARNING_NATTED\020\005\022\021\n\rW"
"ARNING_NODHT\020\006\022\010\n\004GOOD\020\007\022\017\n\013ADV_FORWARD\020"
"\010\"\201\001\n\021RequestSystemQuit\022<\n\tquit_code\030\001 \002"
"(\0162).rsctrl.system.RequestSystemQuit.Qui"
"tCode\".\n\010QuitCode\022\021\n\rCLOSE_CHANNEL\020\001\022\017\n\013"
"SHUTDOWN_RS\020\002\"9\n\022ResponseSystemQuit\022#\n\006s"
"tatus\030\001 \002(\0132\023.rsctrl.core.Status*K\n\rRequ"
"estMsgIds\022\035\n\031MsgId_RequestSystemStatus\020\001"
"\022\033\n\027MsgId_RequestSystemQuit\020\002*N\n\016Respons"
"eMsgIds\022\036\n\032MsgId_ResponseSystemStatus\020\001\022"
"\034\n\030MsgId_ResponseSystemQuit\020\002", 789);
"\010*.\n\rRequestMsgIds\022\035\n\031MsgId_RequestSyste"
"mStatus\020\001*0\n\016ResponseMsgIds\022\036\n\032MsgId_Res"
"ponseSystemStatus\020\001", 539);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"system.proto", &protobuf_RegisterTypes);
RequestSystemStatus::default_instance_ = new RequestSystemStatus();
ResponseSystemStatus::default_instance_ = new ResponseSystemStatus();
RequestSystemQuit::default_instance_ = new RequestSystemQuit();
ResponseSystemQuit::default_instance_ = new ResponseSystemQuit();
RequestSystemStatus::default_instance_->InitAsDefaultInstance();
ResponseSystemStatus::default_instance_->InitAsDefaultInstance();
RequestSystemQuit::default_instance_->InitAsDefaultInstance();
ResponseSystemQuit::default_instance_->InitAsDefaultInstance();
::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_system_2eproto);
}
@ -201,7 +145,6 @@ const ::google::protobuf::EnumDescriptor* RequestMsgIds_descriptor() {
bool RequestMsgIds_IsValid(int value) {
switch(value) {
case 1:
case 2:
return true;
default:
return false;
@ -215,7 +158,6 @@ const ::google::protobuf::EnumDescriptor* ResponseMsgIds_descriptor() {
bool ResponseMsgIds_IsValid(int value) {
switch(value) {
case 1:
case 2:
return true;
default:
return false;
@ -803,457 +745,6 @@ void ResponseSystemStatus::Swap(ResponseSystemStatus* other) {
}
// ===================================================================
const ::google::protobuf::EnumDescriptor* RequestSystemQuit_QuitCode_descriptor() {
protobuf_AssignDescriptorsOnce();
return RequestSystemQuit_QuitCode_descriptor_;
}
bool RequestSystemQuit_QuitCode_IsValid(int value) {
switch(value) {
case 1:
case 2:
return true;
default:
return false;
}
}
#ifndef _MSC_VER
const RequestSystemQuit_QuitCode RequestSystemQuit::CLOSE_CHANNEL;
const RequestSystemQuit_QuitCode RequestSystemQuit::SHUTDOWN_RS;
const RequestSystemQuit_QuitCode RequestSystemQuit::QuitCode_MIN;
const RequestSystemQuit_QuitCode RequestSystemQuit::QuitCode_MAX;
const int RequestSystemQuit::QuitCode_ARRAYSIZE;
#endif // _MSC_VER
#ifndef _MSC_VER
const int RequestSystemQuit::kQuitCodeFieldNumber;
#endif // !_MSC_VER
RequestSystemQuit::RequestSystemQuit()
: ::google::protobuf::Message() {
SharedCtor();
}
void RequestSystemQuit::InitAsDefaultInstance() {
}
RequestSystemQuit::RequestSystemQuit(const RequestSystemQuit& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
}
void RequestSystemQuit::SharedCtor() {
_cached_size_ = 0;
quit_code_ = 1;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
RequestSystemQuit::~RequestSystemQuit() {
SharedDtor();
}
void RequestSystemQuit::SharedDtor() {
if (this != default_instance_) {
}
}
void RequestSystemQuit::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* RequestSystemQuit::descriptor() {
protobuf_AssignDescriptorsOnce();
return RequestSystemQuit_descriptor_;
}
const RequestSystemQuit& RequestSystemQuit::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_system_2eproto(); return *default_instance_;
}
RequestSystemQuit* RequestSystemQuit::default_instance_ = NULL;
RequestSystemQuit* RequestSystemQuit::New() const {
return new RequestSystemQuit;
}
void RequestSystemQuit::Clear() {
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
quit_code_ = 1;
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool RequestSystemQuit::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
::google::protobuf::uint32 tag;
while ((tag = input->ReadTag()) != 0) {
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// required .rsctrl.system.RequestSystemQuit.QuitCode quit_code = 1;
case 1: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
int value;
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
input, &value)));
if (::rsctrl::system::RequestSystemQuit_QuitCode_IsValid(value)) {
set_quit_code(static_cast< ::rsctrl::system::RequestSystemQuit_QuitCode >(value));
} else {
mutable_unknown_fields()->AddVarint(1, value);
}
} else {
goto handle_uninterpreted;
}
if (input->ExpectAtEnd()) return true;
break;
}
default: {
handle_uninterpreted:
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
return true;
#undef DO_
}
void RequestSystemQuit::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// required .rsctrl.system.RequestSystemQuit.QuitCode quit_code = 1;
if (has_quit_code()) {
::google::protobuf::internal::WireFormatLite::WriteEnum(
1, this->quit_code(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
}
::google::protobuf::uint8* RequestSystemQuit::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// required .rsctrl.system.RequestSystemQuit.QuitCode quit_code = 1;
if (has_quit_code()) {
target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
1, this->quit_code(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
}
int RequestSystemQuit::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// required .rsctrl.system.RequestSystemQuit.QuitCode quit_code = 1;
if (has_quit_code()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::EnumSize(this->quit_code());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void RequestSystemQuit::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const RequestSystemQuit* source =
::google::protobuf::internal::dynamic_cast_if_available<const RequestSystemQuit*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void RequestSystemQuit::MergeFrom(const RequestSystemQuit& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_quit_code()) {
set_quit_code(from.quit_code());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void RequestSystemQuit::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void RequestSystemQuit::CopyFrom(const RequestSystemQuit& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool RequestSystemQuit::IsInitialized() const {
if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false;
return true;
}
void RequestSystemQuit::Swap(RequestSystemQuit* other) {
if (other != this) {
std::swap(quit_code_, other->quit_code_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata RequestSystemQuit::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = RequestSystemQuit_descriptor_;
metadata.reflection = RequestSystemQuit_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int ResponseSystemQuit::kStatusFieldNumber;
#endif // !_MSC_VER
ResponseSystemQuit::ResponseSystemQuit()
: ::google::protobuf::Message() {
SharedCtor();
}
void ResponseSystemQuit::InitAsDefaultInstance() {
status_ = const_cast< ::rsctrl::core::Status*>(&::rsctrl::core::Status::default_instance());
}
ResponseSystemQuit::ResponseSystemQuit(const ResponseSystemQuit& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
}
void ResponseSystemQuit::SharedCtor() {
_cached_size_ = 0;
status_ = NULL;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
ResponseSystemQuit::~ResponseSystemQuit() {
SharedDtor();
}
void ResponseSystemQuit::SharedDtor() {
if (this != default_instance_) {
delete status_;
}
}
void ResponseSystemQuit::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* ResponseSystemQuit::descriptor() {
protobuf_AssignDescriptorsOnce();
return ResponseSystemQuit_descriptor_;
}
const ResponseSystemQuit& ResponseSystemQuit::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_system_2eproto(); return *default_instance_;
}
ResponseSystemQuit* ResponseSystemQuit::default_instance_ = NULL;
ResponseSystemQuit* ResponseSystemQuit::New() const {
return new ResponseSystemQuit;
}
void ResponseSystemQuit::Clear() {
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (has_status()) {
if (status_ != NULL) status_->::rsctrl::core::Status::Clear();
}
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool ResponseSystemQuit::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
::google::protobuf::uint32 tag;
while ((tag = input->ReadTag()) != 0) {
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// required .rsctrl.core.Status status = 1;
case 1: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_status()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectAtEnd()) return true;
break;
}
default: {
handle_uninterpreted:
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
return true;
#undef DO_
}
void ResponseSystemQuit::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// required .rsctrl.core.Status status = 1;
if (has_status()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, this->status(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
}
::google::protobuf::uint8* ResponseSystemQuit::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// required .rsctrl.core.Status status = 1;
if (has_status()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
1, this->status(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
}
int ResponseSystemQuit::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// required .rsctrl.core.Status status = 1;
if (has_status()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->status());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void ResponseSystemQuit::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const ResponseSystemQuit* source =
::google::protobuf::internal::dynamic_cast_if_available<const ResponseSystemQuit*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void ResponseSystemQuit::MergeFrom(const ResponseSystemQuit& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_status()) {
mutable_status()->::rsctrl::core::Status::MergeFrom(from.status());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void ResponseSystemQuit::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void ResponseSystemQuit::CopyFrom(const ResponseSystemQuit& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool ResponseSystemQuit::IsInitialized() const {
if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false;
if (has_status()) {
if (!this->status().IsInitialized()) return false;
}
return true;
}
void ResponseSystemQuit::Swap(ResponseSystemQuit* other) {
if (other != this) {
std::swap(status_, other->status_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata ResponseSystemQuit::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = ResponseSystemQuit_descriptor_;
metadata.reflection = ResponseSystemQuit_reflection_;
return metadata;
}
// @@protoc_insertion_point(namespace_scope)
} // namespace system

View File

@ -86,11 +86,6 @@ int RpcProtoSystem::processMsg(uint32_t chan_id, uint32_t msg_id, uint32_t req_i
case rsctrl::system::MsgId_RequestSystemStatus:
processSystemStatus(chan_id, msg_id, req_id, msg);
break;
#if 0
case rsctrl::system::MsgId_RequestSystemQuit:
processSystemQuit(chan_id, msg_id, req_id, msg);
break;
#endif
default:
std::cerr << "RpcProtoSystem::processMsg() ERROR should never get here";
std::cerr << std::endl;
@ -216,71 +211,3 @@ int RpcProtoSystem::processSystemStatus(uint32_t chan_id, uint32_t msg_id, uint3
}
int RpcProtoSystem::processSystemQuit(uint32_t chan_id, uint32_t msg_id, uint32_t req_id, const std::string &msg)
{
std::cerr << "RpcProtoSystem::processSystemQuit()";
std::cerr << std::endl;
// parse msg.
rsctrl::system::RequestSystemQuit req;
if (!req.ParseFromString(msg))
{
std::cerr << "RpcProtoSystem::processSystemQuit() ERROR ParseFromString()";
std::cerr << std::endl;
return 0;
}
// NO Options... so go straight to answer.
// response.
rsctrl::system::ResponseSystemQuit resp;
bool success = true;
switch(req.quit_code())
{
default:
case rsctrl::system::RequestSystemQuit::CLOSE_CHANNEL:
{
RpcServer *server = getRpcServer();
server->error(chan_id, "CLOSE_CHANNEL");
break;
}
case rsctrl::system::RequestSystemQuit::SHUTDOWN_RS:
{
rsicontrol->rsGlobalShutDown();
break;
}
}
if (success)
{
rsctrl::core::Status *status = resp.mutable_status();
status->set_code(rsctrl::core::Status::SUCCESS);
}
else
{
rsctrl::core::Status *status = resp.mutable_status();
status->set_code(rsctrl::core::Status::FAILED);
status->set_msg("Unknown ERROR");
}
std::string outmsg;
if (!resp.SerializeToString(&outmsg))
{
std::cerr << "RpcProtoSystem::processSystemQuit() ERROR SerialiseToString()";
std::cerr << std::endl;
return 0;
}
// Correctly Name Message.
uint32_t out_msg_id = constructMsgId(rsctrl::core::CORE, rsctrl::core::SYSTEM,
rsctrl::system::MsgId_ResponseSystemQuit, true);
// queue it.
queueResponse(chan_id, out_msg_id, req_id, outmsg);
return 1;
}

View File

@ -43,11 +43,6 @@ void RpcMediator::reset(uint32_t chan_id)
mServer->reset(chan_id);
}
int RpcMediator::error(uint32_t chan_id, std::string msg)
{
return mComms->error(chan_id, msg);
}
int RpcMediator::tick()
{

View File

@ -63,16 +63,11 @@ void RpcServer::reset(uint32_t chan_id)
return;
}
int RpcServer::error(uint32_t chan_id, std::string msg)
{
return mMediator->error(chan_id, msg);
}
int RpcServer::addService(RpcService *service)
{
RsStackMutex stack(mRpcMtx); /********** LOCKED MUTEX ***************/
service->setRpcServer(this);
mAllServices.push_back(service);
return 1;

View File

@ -27,12 +27,10 @@
#include "rpc/proto/rpcprotopeers.h"
#include "rpc/proto/rpcprotosystem.h"
#include "rpc/proto/rpcprotochat.h"
#include "rpc/proto/rpcprotosearch.h"
#include "rpc/proto/rpcprotofiles.h"
#include "rpc/rpcecho.h"
RpcMediator *CreateRpcSystem(RpcComms *comms, NotifyTxt *notify)
RpcMediator *CreateRpcSystem(RpcComms *comms)
{
RpcMediator *med = new RpcMediator(comms);
RpcServer *server = new RpcServer(med);
@ -47,12 +45,6 @@ RpcMediator *CreateRpcSystem(RpcComms *comms, NotifyTxt *notify)
RpcProtoChat *chat = new RpcProtoChat(1);
server->addService(chat);
RpcProtoSearch *search = new RpcProtoSearch(1, notify);
server->addService(search);
RpcProtoFiles *files = new RpcProtoFiles(1);
server->addService(files);
/* Finally an Echo Service - which will echo back any unprocesses commands. */
RpcEcho *echo = new RpcEcho(1);
server->addService(echo);