mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-27 00:19:25 -05:00
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:
parent
4f470090b2
commit
eaa7342165
@ -632,9 +632,6 @@ void RsGenExchange::publishGrps()
|
|||||||
size = grp->metaData->serial_size();
|
size = grp->metaData->serial_size();
|
||||||
char mData[size];
|
char mData[size];
|
||||||
grp->metaData->mGroupId = grp->grpId;
|
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);
|
ok = grp->metaData->serialise(mData, size);
|
||||||
grp->meta.setBinData(mData, size);
|
grp->meta.setBinData(mData, size);
|
||||||
|
|
||||||
|
@ -153,6 +153,13 @@ protected:
|
|||||||
*/
|
*/
|
||||||
bool getMsgData(const uint32_t &token, GxsMsgDataMap& msgItems);
|
bool getMsgData(const uint32_t &token, GxsMsgDataMap& msgItems);
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @param grpItem
|
||||||
|
* @deprecated only here to temporarily to testing
|
||||||
|
*/
|
||||||
|
void createDummyGroup(RsGxsGrpItem* grpItem);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -259,6 +266,13 @@ private:
|
|||||||
void createGroup(RsNxsGrp* grp);
|
void createGroup(RsNxsGrp* grp);
|
||||||
bool createMessage(RsNxsMsg* msg);
|
bool createMessage(RsNxsMsg* msg);
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* check meta change is legal
|
||||||
|
* @return false if meta change is not legal
|
||||||
|
*/
|
||||||
|
bool locked_validateGrpMetaChange(GrpLocMetaData&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
RsMutex mGenMtx;
|
RsMutex mGenMtx;
|
||||||
|
@ -98,7 +98,7 @@ void RsGxsNetService::syncWithPeers()
|
|||||||
{
|
{
|
||||||
RsGxsGrpMetaData* meta = mit->second;
|
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);
|
grpIds.push_back(mit->first);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,6 +59,8 @@
|
|||||||
#define RS_TOKREQ_ANSTYPE_LIST 0x0001
|
#define RS_TOKREQ_ANSTYPE_LIST 0x0001
|
||||||
#define RS_TOKREQ_ANSTYPE_SUMMARY 0x0002
|
#define RS_TOKREQ_ANSTYPE_SUMMARY 0x0002
|
||||||
#define RS_TOKREQ_ANSTYPE_DATA 0x0003
|
#define RS_TOKREQ_ANSTYPE_DATA 0x0003
|
||||||
|
#define RS_TOKREQ_ANSTYPE_ACK 0x0004
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -73,6 +75,7 @@ RsTokReqOptionsV2()
|
|||||||
{
|
{
|
||||||
mOptions = 0;
|
mOptions = 0;
|
||||||
mStatusFilter = 0; mStatusMask = 0; mSubscribeFilter = 0;
|
mStatusFilter = 0; mStatusMask = 0; mSubscribeFilter = 0;
|
||||||
|
mMsgFlagMask = 0; mMsgFlagFilter = 0;
|
||||||
mBefore = 0; mAfter = 0; mReqType = 0;
|
mBefore = 0; mAfter = 0; mReqType = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,6 +86,8 @@ uint32_t mOptions;
|
|||||||
uint32_t mStatusFilter;
|
uint32_t mStatusFilter;
|
||||||
uint32_t mStatusMask;
|
uint32_t mStatusMask;
|
||||||
|
|
||||||
|
uint32_t mMsgFlagMask, mMsgFlagFilter;
|
||||||
|
|
||||||
uint32_t mReqType;
|
uint32_t mReqType;
|
||||||
|
|
||||||
uint32_t mSubscribeFilter; // Only for Groups.
|
uint32_t mSubscribeFilter; // Only for Groups.
|
||||||
|
@ -10,7 +10,7 @@ CONFIG += test_voip
|
|||||||
|
|
||||||
# GXS Stuff.
|
# GXS Stuff.
|
||||||
CONFIG += newcache
|
CONFIG += newcache
|
||||||
CONFIG += newservices
|
#CONFIG += newservices
|
||||||
|
|
||||||
# Beware: All data of the stripped services are lost
|
# Beware: All data of the stripped services are lost
|
||||||
DEFINES *= PQI_DISABLE_TUNNEL
|
DEFINES *= PQI_DISABLE_TUNNEL
|
||||||
@ -137,7 +137,8 @@ PUBLIC_HEADERS = retroshare/rsblogs.h \
|
|||||||
retroshare/rstypes.h \
|
retroshare/rstypes.h \
|
||||||
retroshare/rsdht.h \
|
retroshare/rsdht.h \
|
||||||
retroshare/rsdsdv.h \
|
retroshare/rsdsdv.h \
|
||||||
retroshare/rsconfig.h
|
retroshare/rsconfig.h \
|
||||||
|
retroshare/rsphotoV2.h
|
||||||
HEADERS += plugins/pluginmanager.h \
|
HEADERS += plugins/pluginmanager.h \
|
||||||
plugins/dlfcn_win32.h \
|
plugins/dlfcn_win32.h \
|
||||||
serialiser/rspluginitems.h
|
serialiser/rspluginitems.h
|
||||||
@ -148,64 +149,6 @@ HEADERS += retroshare/rsgame.h \
|
|||||||
retroshare/rsphoto.h
|
retroshare/rsphoto.h
|
||||||
|
|
||||||
# ################################ Linux ##########################################
|
# ################################ 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 ####################
|
# ################### Cross compilation for windows under Linux ####################
|
||||||
win32-x-g++ {
|
win32-x-g++ {
|
||||||
@ -262,10 +205,10 @@ linux-*:isEmpty(PREFIX) {
|
|||||||
# miniupnp implementation files
|
# miniupnp implementation files
|
||||||
HEADERS += upnp/upnputil.h
|
HEADERS += upnp/upnputil.h
|
||||||
SOURCES += upnp/upnputil.c
|
SOURCES += upnp/upnputil.c
|
||||||
UPNPC_DIR = ../../../miniupnpc-1.3
|
UPNPC_DIR = ../../../lib/miniupnpc-1.3
|
||||||
PTHREADS_DIR = ../../../pthreads-w32-2-8-0-release
|
PTHREADS_DIR = ../../../lib/pthreads-w32-2-8-0-release
|
||||||
ZLIB_DIR = ../../../zlib-1.2.3
|
ZLIB_DIR = ../../../lib/zlib-1.2.3
|
||||||
SSL_DIR = ../../../openssl-1.0.1c
|
SSL_DIR = ../../../OpenSSL
|
||||||
OPENPGPSDK_DIR = ../../openpgpsdk/src
|
OPENPGPSDK_DIR = ../../openpgpsdk/src
|
||||||
INCLUDEPATH += . \
|
INCLUDEPATH += . \
|
||||||
$${SSL_DIR}/include \
|
$${SSL_DIR}/include \
|
||||||
@ -274,7 +217,7 @@ linux-*:isEmpty(PREFIX) {
|
|||||||
$${ZLIB_DIR} \
|
$${ZLIB_DIR} \
|
||||||
$${OPENPGPSDK_DIR}
|
$${OPENPGPSDK_DIR}
|
||||||
newcache {
|
newcache {
|
||||||
SQLITE_DIR = ../../../sqlite-autoconf-3071300
|
SQLITE_DIR = ../../../../Libraries/sqlite/sqlite-autoconf-3070900
|
||||||
INCLUDEPATH += . \
|
INCLUDEPATH += . \
|
||||||
$${SQLITE_DIR}
|
$${SQLITE_DIR}
|
||||||
}
|
}
|
||||||
|
@ -62,9 +62,6 @@
|
|||||||
|
|
||||||
#define RS_TOKREQ_ANSTYPE_LIST 0x0001
|
#define RS_TOKREQ_ANSTYPE_LIST 0x0001
|
||||||
#define RS_TOKREQ_ANSTYPE_SUMMARY 0x0002
|
#define RS_TOKREQ_ANSTYPE_SUMMARY 0x0002
|
||||||
#define RS_TOKREQ_ANSTYPE_DATA 0x0003
|
|
||||||
#define RS_TOKREQ_ANSTYPE_ACK 0x0004
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include "rsgxsservice.h"
|
#include "rsgxsservice.h"
|
||||||
#include "rsphotoVEG.h"
|
|
||||||
|
|
||||||
/* The Main Interface Class - for information about your Peers */
|
/* The Main Interface Class - for information about your Peers */
|
||||||
class RsPhotoV2;
|
class RsPhotoV2;
|
||||||
@ -42,21 +41,20 @@ extern RsPhotoV2 *rsPhotoV2;
|
|||||||
#define RSPHOTO_MODE_OWN 2
|
#define RSPHOTO_MODE_OWN 2
|
||||||
#define RSPHOTO_MODE_REMOTE 3
|
#define RSPHOTO_MODE_REMOTE 3
|
||||||
|
|
||||||
//class RsPhotoThumbnail
|
class RsPhotoThumbnail
|
||||||
//{
|
{
|
||||||
// public:
|
public:
|
||||||
// RsPhotoThumbnail()
|
RsPhotoThumbnail()
|
||||||
// :data(NULL), size(0), type("N/A") { return; }
|
: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;
|
|
||||||
//};
|
|
||||||
|
|
||||||
|
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
|
/* 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_AUTHOR 0x1000 // PUSH UP ORDER
|
||||||
#define RSPHOTO_FLAGS_ATTRIB_PHOTO 0x2000 // PUSH UP ORDER.
|
#define RSPHOTO_FLAGS_ATTRIB_PHOTO 0x2000 // PUSH UP ORDER.
|
||||||
|
|
||||||
|
class RsPhotoPhoto
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
//class RsPhotoPhoto
|
RsMsgMetaData mMeta;
|
||||||
//{
|
|
||||||
// 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
|
RsPhotoPhoto();
|
||||||
//{
|
|
||||||
// public:
|
// THESE ARE IN THE META DATA.
|
||||||
//
|
//std::string mAlbumId;
|
||||||
// uint32_t mShareType;
|
//std::string mId;
|
||||||
// std::string mShareGroupId;
|
//std::string mTitle; // only used by Album.
|
||||||
// std::string mPublishKey;
|
std::string mCaption;
|
||||||
// uint32_t mCommentMode;
|
std::string mDescription;
|
||||||
// uint32_t mResizeMode;
|
std::string mPhotographer;
|
||||||
//};
|
std::string mWhere;
|
||||||
//
|
std::string mWhen;
|
||||||
//class RsPhotoAlbum
|
std::string mOther;
|
||||||
//{
|
std::string mCategory;
|
||||||
// public:
|
|
||||||
// RsPhotoAlbum();
|
std::string mHashTags;
|
||||||
//
|
|
||||||
// RsGroupMetaData mMeta;
|
uint32_t mSetFlags;
|
||||||
//
|
|
||||||
// // THESE ARE IN THE META DATA.
|
int mOrder;
|
||||||
// //std::string mAlbumId;
|
|
||||||
// //std::string mTitle; // only used by Album.
|
RsPhotoThumbnail mThumbnail;
|
||||||
//
|
|
||||||
// std::string mCaption;
|
int mMode;
|
||||||
// std::string mDescription;
|
|
||||||
// std::string mPhotographer;
|
// These are not saved.
|
||||||
// std::string mWhere;
|
std::string path; // if in Mode NEW.
|
||||||
// std::string mWhen;
|
uint32_t mModFlags;
|
||||||
// std::string mOther;
|
};
|
||||||
// std::string mCategory;
|
|
||||||
//
|
class RsPhotoAlbumShare
|
||||||
// std::string mHashTags;
|
{
|
||||||
//
|
public:
|
||||||
// RsPhotoThumbnail mThumbnail;
|
|
||||||
//
|
uint32_t mShareType;
|
||||||
// int mMode;
|
std::string mShareGroupId;
|
||||||
//
|
std::string mPublishKey;
|
||||||
// std::string mPhotoPath;
|
uint32_t mCommentMode;
|
||||||
// RsPhotoAlbumShare mShareOptions;
|
uint32_t mResizeMode;
|
||||||
//
|
};
|
||||||
// // These aren't saved.
|
|
||||||
// uint32_t mSetFlags;
|
class RsPhotoAlbum
|
||||||
// uint32_t mModFlags;
|
{
|
||||||
//};
|
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 RsPhotoPhoto &photo);
|
||||||
std::ostream &operator<<(std::ostream &out, const RsPhotoAlbum &album);
|
std::ostream &operator<<(std::ostream &out, const RsPhotoAlbum &album);
|
||||||
@ -167,6 +175,10 @@ class RsPhotoV2
|
|||||||
|
|
||||||
public:
|
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; }
|
RsPhotoV2() { return; }
|
||||||
|
|
||||||
@ -264,19 +276,29 @@ public:
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
* submits photo, which returns a token that needs
|
* submits photo, which returns a token that needs
|
||||||
* to be acknowledge to get photo msg-grp id pair
|
* to be acknowledged to get photo msg-grp id pair
|
||||||
* @param token token to redeem for acknowledgement
|
* @param token token to redeem for acknowledgement
|
||||||
* @param photo photo to be submitted
|
* @param photo photo to be submitted
|
||||||
*/
|
*/
|
||||||
virtual bool submitPhoto(uint32_t& token, RsPhotoPhoto &photo) = 0;
|
virtual bool submitPhoto(uint32_t& token, RsPhotoPhoto &photo) = 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
|
* subscribes to group, and returns token which can be used
|
||||||
* to be acknowledged to get group Id
|
* to be acknowledged to get group Id
|
||||||
* @param token token to redeem for acknowledgement
|
* @param token token to redeem for acknowledgement
|
||||||
* @param grpId the id of the group to subscribe to
|
* @param grpId the id of the group to subscribe to
|
||||||
*/
|
*/
|
||||||
virtual bool subscribeToAlbum(uint32_t& token, const RsGxsGroupId& grpId) = 0;
|
virtual bool subscribeToAlbum(uint32_t& token, const RsGxsGroupId& grpId, bool subscribe) = 0;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* This allows the client service to acknowledge that their msgs has
|
* This allows the client service to acknowledge that their msgs has
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <retroshare/rsidentityVEG.h>
|
#include <retroshare/rsidentityVEG.h>
|
||||||
|
#include "rsphotoV2.h"
|
||||||
|
|
||||||
/* The Main Interface Class - for information about your Peers */
|
/* The Main Interface Class - for information about your Peers */
|
||||||
class RsPhotoVEG;
|
class RsPhotoVEG;
|
||||||
@ -41,22 +42,6 @@ extern RsPhotoVEG *rsPhotoVEG;
|
|||||||
#define RSPHOTO_MODE_OWN 2
|
#define RSPHOTO_MODE_OWN 2
|
||||||
#define RSPHOTO_MODE_REMOTE 3
|
#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
|
/* 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.
|
#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 RsPhotoPhoto &photo);
|
||||||
std::ostream &operator<<(std::ostream &out, const RsPhotoAlbum &album);
|
std::ostream &operator<<(std::ostream &out, const RsPhotoAlbum &album);
|
||||||
|
|
||||||
|
@ -1806,7 +1806,7 @@ RsTurtle *rsTurtle = NULL ;
|
|||||||
#include "services/p3blogs.h"
|
#include "services/p3blogs.h"
|
||||||
#include "turtle/p3turtle.h"
|
#include "turtle/p3turtle.h"
|
||||||
|
|
||||||
#define ENABLE_GXS_VEG_SERVICES 1
|
#define ENABLE_GXS_SERVICES 1
|
||||||
#define ENABLE_GXS_CORE 1
|
#define ENABLE_GXS_CORE 1
|
||||||
|
|
||||||
#ifdef ENABLE_GXS_CORE
|
#ifdef ENABLE_GXS_CORE
|
||||||
@ -1816,13 +1816,13 @@ RsTurtle *rsTurtle = NULL ;
|
|||||||
#include "gxs/rsgxsnetservice.h"
|
#include "gxs/rsgxsnetservice.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_GXS_VEG_SERVICES
|
#ifdef ENABLE_GXS_SERVICES
|
||||||
#include "services/p3photoserviceVEG.h"
|
#include "services/p3photoservice.h"
|
||||||
#include "services/p3wikiserviceVEG.h"
|
#include "services/p3wikiservice.h"
|
||||||
#include "services/p3wireVEG.h"
|
#include "services/p3wire.h"
|
||||||
#include "services/p3idserviceVEG.h"
|
#include "services/p3idservice.h"
|
||||||
#include "services/p3forumsVEG.h"
|
#include "services/p3forumsv2.h"
|
||||||
#include "services/p3postedVEG.h"
|
#include "services/p3posted.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef PQI_DISABLE_TUNNEL
|
#ifndef PQI_DISABLE_TUNNEL
|
||||||
@ -2272,7 +2272,7 @@ int RsServer::StartupRetroShare()
|
|||||||
// first prep the core
|
// first prep the core
|
||||||
|
|
||||||
RsGeneralDataService* photo_ds = new RsDataService("./", "photoV2_db",
|
RsGeneralDataService* photo_ds = new RsDataService("./", "photoV2_db",
|
||||||
RS_SERVICE_GXSV1_TYPE_PHOTO, NULL);
|
RS_SERVICE_TYPE_PHOTO, NULL);
|
||||||
|
|
||||||
photo_ds->resetDataStore();
|
photo_ds->resetDataStore();
|
||||||
|
|
||||||
@ -2295,37 +2295,33 @@ int RsServer::StartupRetroShare()
|
|||||||
// start up gxs core server
|
// start up gxs core server
|
||||||
createThread(*mGxsCore);
|
createThread(*mGxsCore);
|
||||||
|
|
||||||
|
|
||||||
// create some dummy items
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_GXS_VEG_SERVICES
|
#ifdef ENABLE_GXS_SERVICES
|
||||||
// Testing New Cache Services.
|
// Testing New Cache Services.
|
||||||
p3PhotoServiceVEG *mPhotosVEG = new p3PhotoServiceVEG(RS_SERVICE_VEG_TYPE_PHOTO);
|
p3PhotoService *mPhotos = new p3PhotoService(RS_SERVICE_TYPE_PHOTO);
|
||||||
pqih -> addService(mPhotosVEG);
|
pqih -> addService(mPhotos);
|
||||||
|
|
||||||
// Testing New Cache Services.
|
// Testing New Cache Services.
|
||||||
p3WikiServiceVEG *mWikisVEG = new p3WikiServiceVEG(RS_SERVICE_VEG_TYPE_WIKI);
|
p3WikiService *mWikis = new p3WikiService(RS_SERVICE_TYPE_WIKI);
|
||||||
pqih -> addService(mWikisVEG);
|
pqih -> addService(mWikis);
|
||||||
|
|
||||||
// Testing New Cache Services.
|
// Testing New Cache Services.
|
||||||
p3WireVEG *mWireVEG = new p3WireVEG(RS_SERVICE_VEG_TYPE_WIRE);
|
p3Wire *mWire = new p3Wire(RS_SERVICE_TYPE_WIRE);
|
||||||
pqih -> addService(mWireVEG);
|
pqih -> addService(mWire);
|
||||||
|
|
||||||
// Testing New Cache Services.
|
// Testing New Cache Services.
|
||||||
p3IdServiceVEG *mIdentityVEG = new p3IdServiceVEG(RS_SERVICE_VEG_TYPE_IDENTITY);
|
p3IdService *mIdentity = new p3IdService(RS_SERVICE_TYPE_IDENTITY);
|
||||||
pqih -> addService(mIdentityVEG);
|
pqih -> addService(mIdentity);
|
||||||
|
|
||||||
// Testing New Cache Services.
|
// Testing New Cache Services.
|
||||||
p3ForumsVEG *mForumsVEG = new p3ForumsVEG(RS_SERVICE_VEG_TYPE_FORUMS);
|
p3ForumsV2 *mForumsV2 = new p3ForumsV2(RS_SERVICE_TYPE_FORUMSV2);
|
||||||
pqih -> addService(mForumsVEG);
|
pqih -> addService(mForumsV2);
|
||||||
|
|
||||||
// Testing New Cache Services.
|
// Testing New Cache Services.
|
||||||
p3PostedServiceVEG *mPostedVEG = new p3PostedServiceVEG(RS_SERVICE_VEG_TYPE_POSTED);
|
p3PostedService *mPosted = new p3PostedService(RS_SERVICE_TYPE_POSTED);
|
||||||
pqih -> addService(mPostedVEG);
|
pqih -> addService(mPosted);
|
||||||
#endif // ENABLE_GXS_VEG_SERVICES
|
#endif // ENABLE_GXS_SERVICES
|
||||||
|
|
||||||
|
|
||||||
#ifndef RS_RELEASE
|
#ifndef RS_RELEASE
|
||||||
@ -2586,18 +2582,15 @@ int RsServer::StartupRetroShare()
|
|||||||
|
|
||||||
#ifdef ENABLE_GXS_SERVICES
|
#ifdef ENABLE_GXS_SERVICES
|
||||||
// Testing of new cache system interfaces.
|
// Testing of new cache system interfaces.
|
||||||
rsIdentityVEG = mIdentityVEG;
|
rsIdentity = mIdentity;
|
||||||
rsPhotoVEG = mPhotosVEG;
|
rsPhoto = mPhotos;
|
||||||
rsWikiVEG = mWikisVEG;
|
rsPhotoV2 = mPhotoV2;
|
||||||
rsWireVEG = mWireVEG;
|
rsWiki = mWikis;
|
||||||
rsForumsVEG = mForumsVEG;
|
rsWire = mWire;
|
||||||
rsPostedVEG = mPostedVEG;
|
rsForumsV2 = mForumsV2;
|
||||||
|
rsPosted = mPosted;
|
||||||
#endif // ENABLE_GXS_SERVICES
|
#endif // ENABLE_GXS_SERVICES
|
||||||
|
|
||||||
#ifdef ENABLE_GXS_CORE
|
|
||||||
rsPhotoV2 = mPhotoV2;
|
|
||||||
#endif // ENABLE_GXS_CORE
|
|
||||||
|
|
||||||
#ifdef RS_USE_BLOGS
|
#ifdef RS_USE_BLOGS
|
||||||
rsBlogs = mBlogs;
|
rsBlogs = mBlogs;
|
||||||
|
@ -88,7 +88,7 @@ RsItem* RsGxsPhotoSerialiser::deserialise(void* data, uint32_t* size)
|
|||||||
uint32_t rstype = getRsItemId(data);
|
uint32_t rstype = getRsItemId(data);
|
||||||
|
|
||||||
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
|
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
|
||||||
(RS_SERVICE_GXSV1_TYPE_PHOTO != getRsItemService(rstype)))
|
(RS_SERVICE_TYPE_PHOTO != getRsItemService(rstype)))
|
||||||
{
|
{
|
||||||
return NULL; /* wrong type */
|
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.mWhen);
|
||||||
ok &= SetTlvString(data, tlvsize, &offset, 1, item->album.mWhere);
|
ok &= SetTlvString(data, tlvsize, &offset, 1, item->album.mWhere);
|
||||||
ok &= SetTlvString(data, tlvsize, &offset, 1, item->album.mThumbnail.type);
|
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);
|
b.setBinData(item->album.mThumbnail.data, item->album.mThumbnail.size);
|
||||||
ok &= b.SetTlv(data, tlvsize, &offset);
|
ok &= b.SetTlv(data, tlvsize, &offset);
|
||||||
|
|
||||||
@ -213,7 +213,7 @@ RsGxsPhotoAlbumItem* RsGxsPhotoSerialiser::deserialiseGxsPhotoAlbumItem(void* da
|
|||||||
|
|
||||||
|
|
||||||
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
|
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)))
|
(RS_PKT_SUBTYPE_PHOTO_ITEM != getRsItemSubType(rstype)))
|
||||||
{
|
{
|
||||||
#ifdef GXS_PHOTO_SERIAL_DEBUG
|
#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.mWhere);
|
||||||
ok &= GetTlvString(data, rssize, &offset, 1, item->album.mThumbnail.type);
|
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);
|
ok &= b.GetTlv(data, rssize, &offset);
|
||||||
item->album.mThumbnail.data = (uint8_t*)b.bin_data;
|
item->album.mThumbnail.data = (uint8_t*)b.bin_data;
|
||||||
item->album.mThumbnail.size = b.bin_len;
|
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.mWhen);
|
||||||
ok &= SetTlvString(data, tlvsize, &offset, 1, item->photo.mWhere);
|
ok &= SetTlvString(data, tlvsize, &offset, 1, item->photo.mWhere);
|
||||||
ok &= SetTlvString(data, tlvsize, &offset, 1, item->photo.mThumbnail.type);
|
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);
|
b.setBinData(item->photo.mThumbnail.data, item->photo.mThumbnail.size);
|
||||||
ok &= b.SetTlv(data, tlvsize, &offset);
|
ok &= b.SetTlv(data, tlvsize, &offset);
|
||||||
|
|
||||||
@ -379,7 +379,7 @@ RsGxsPhotoPhotoItem* RsGxsPhotoSerialiser::deserialiseGxsPhotoPhotoItem(void* da
|
|||||||
|
|
||||||
|
|
||||||
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
|
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)))
|
(RS_PKT_SUBTYPE_PHOTO_SHOW_ITEM != getRsItemSubType(rstype)))
|
||||||
{
|
{
|
||||||
#ifdef GXS_PHOTO_SERIAL_DEBUG
|
#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.mWhere);
|
||||||
ok &= GetTlvString(data, rssize, &offset, 1, item->photo.mThumbnail.type);
|
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);
|
ok &= b.GetTlv(data, rssize, &offset);
|
||||||
item->photo.mThumbnail.data = (uint8_t*)(b.bin_data);
|
item->photo.mThumbnail.data = (uint8_t*)(b.bin_data);
|
||||||
item->photo.mThumbnail.size = b.bin_len;
|
item->photo.mThumbnail.size = b.bin_len;
|
||||||
|
@ -68,6 +68,20 @@ public:
|
|||||||
RsPhotoPhoto photo;
|
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
|
class RsGxsPhotoSerialiser : public RsSerialType
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -91,6 +105,9 @@ public:
|
|||||||
bool serialiseGxsPhotoPhotoItem (RsGxsPhotoPhotoItem *item, void *data, uint32_t *size);
|
bool serialiseGxsPhotoPhotoItem (RsGxsPhotoPhotoItem *item, void *data, uint32_t *size);
|
||||||
RsGxsPhotoPhotoItem * deserialiseGxsPhotoPhotoItem(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);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -58,8 +58,8 @@ p3IdService::p3IdService(uint16_t type)
|
|||||||
|
|
||||||
int p3IdService::tick()
|
int p3IdService::tick()
|
||||||
{
|
{
|
||||||
//std::cerr << "p3IdService::tick()";
|
std::cerr << "p3IdService::tick()";
|
||||||
//std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
fakeprocessrequests();
|
fakeprocessrequests();
|
||||||
// Disable for now.
|
// Disable for now.
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
#include "p3photoserviceV2.h"
|
#include "p3photoserviceV2.h"
|
||||||
#include "serialiser/rsphotov2items.h"
|
#include "serialiser/rsphotov2items.h"
|
||||||
#include "gxs/rsgxsflags.h"
|
|
||||||
|
|
||||||
RsPhotoV2 *rsPhotoV2 = NULL;
|
RsPhotoV2 *rsPhotoV2 = NULL;
|
||||||
|
|
||||||
p3PhotoServiceV2::p3PhotoServiceV2(RsGeneralDataService* gds, RsNetworkExchangeService* nes)
|
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()
|
bool p3PhotoServiceV2::updated()
|
||||||
@ -148,13 +146,6 @@ bool p3PhotoServiceV2::submitAlbumDetails(uint32_t& token, RsPhotoAlbum& album)
|
|||||||
return true;
|
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)
|
void p3PhotoServiceV2::notifyChanges(std::vector<RsGxsNotify*>& changes)
|
||||||
|
@ -94,13 +94,23 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool submitPhoto(uint32_t& token, RsPhotoPhoto &photo);
|
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
|
* subscribes to group, and returns token which can be used
|
||||||
* to be acknowledged to get group Id
|
* to be acknowledged to get group Id
|
||||||
* @param token token to redeem for acknowledgement
|
* @param token token to redeem for acknowledgement
|
||||||
* @param grpId the id of the group to subscribe to
|
* @param grpId the id of the group to subscribe to
|
||||||
*/
|
*/
|
||||||
bool subscribeToAlbum(uint32_t& token, const RsGxsGroupId& grpId);
|
bool subscribeToAlbum(uint32_t& token, const RsGxsGroupId& grpId, bool subscribe);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* This allows the client service to acknowledge that their msgs has
|
* This allows the client service to acknowledge that their msgs has
|
||||||
|
@ -17,9 +17,9 @@ linux-* {
|
|||||||
}
|
}
|
||||||
|
|
||||||
win32 {
|
win32 {
|
||||||
SSL_DIR = ../../../openssl-1.0.1c
|
SSL_DIR = ../../../OpenSSL
|
||||||
ZLIB_DIR = ../../../zlib-1.2.3
|
ZLIB_DIR = ../../../lib/zlib-1.2.3
|
||||||
BZIP_DIR = ../../../bzip2-1.0.6
|
BZIP_DIR = ../../../lib/bzip2-1.0.6
|
||||||
|
|
||||||
INCLUDEPATH += $${SSL_DIR}/include $${ZLIB_DIR} $${BZIP_DIR}
|
INCLUDEPATH += $${SSL_DIR}/include $${ZLIB_DIR} $${BZIP_DIR}
|
||||||
}
|
}
|
||||||
|
@ -193,8 +193,8 @@ freebsd-* {
|
|||||||
# ###########################################
|
# ###########################################
|
||||||
|
|
||||||
bitdht {
|
bitdht {
|
||||||
LIBS += ../../libbitdht/src/lib/libbitdht.a
|
LIBS += C:\Development\Rs\v0.5-gxs-b1\libbitdht\libbitdht-build-desktop\lib\libbitdht.a
|
||||||
PRE_TARGETDEPS *= ../../libbitdht/src/lib/libbitdht.a
|
PRE_TARGETDEPS *= C:\Development\Rs\v0.5-gxs-b1\libbitdht\libbitdht-build-desktop\lib\libbitdht.a
|
||||||
|
|
||||||
# Chris version.
|
# Chris version.
|
||||||
#LIBS += ../../libbitdht/libbitdht-build-desktop/lib/libbitdht.a
|
#LIBS += ../../libbitdht/libbitdht-build-desktop/lib/libbitdht.a
|
||||||
@ -416,7 +416,8 @@ HEADERS += rshare.h \
|
|||||||
gui/groups/CreateGroup.h \
|
gui/groups/CreateGroup.h \
|
||||||
gui/dht/DhtWindow.h \
|
gui/dht/DhtWindow.h \
|
||||||
gui/bwctrl/BwCtrlWindow.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/dht/DhtWindow.ui \
|
||||||
gui/bwctrl/BwCtrlWindow.ui \
|
gui/bwctrl/BwCtrlWindow.ui \
|
||||||
gui/GetStartedDialog.ui \
|
gui/GetStartedDialog.ui \
|
||||||
|
gui/PhotoShare/PhotoCommentItem.ui
|
||||||
SOURCES += main.cpp \
|
SOURCES += main.cpp \
|
||||||
rshare.cpp \
|
rshare.cpp \
|
||||||
gui/notifyqt.cpp \
|
gui/notifyqt.cpp \
|
||||||
@ -699,7 +700,8 @@ SOURCES += main.cpp \
|
|||||||
gui/groups/CreateGroup.cpp \
|
gui/groups/CreateGroup.cpp \
|
||||||
gui/dht/DhtWindow.cpp \
|
gui/dht/DhtWindow.cpp \
|
||||||
gui/bwctrl/BwCtrlWindow.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
|
RESOURCES += gui/images.qrc lang/lang.qrc gui/help/content/content.qrc
|
||||||
@ -862,7 +864,6 @@ SOURCES += gui/unfinished/ApplicationWindow.cpp \
|
|||||||
photoshare {
|
photoshare {
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
gui/PhotoShare/PhotoDialog.h \
|
|
||||||
gui/PhotoShare/PhotoDrop.h \
|
gui/PhotoShare/PhotoDrop.h \
|
||||||
gui/PhotoShare/AlbumItem.h \
|
gui/PhotoShare/AlbumItem.h \
|
||||||
gui/PhotoShare/AlbumDialog.h \
|
gui/PhotoShare/AlbumDialog.h \
|
||||||
@ -872,6 +873,7 @@ photoshare {
|
|||||||
gui/PhotoShare/PhotoShareItemHolder.h \
|
gui/PhotoShare/PhotoShareItemHolder.h \
|
||||||
gui/PhotoShare/PhotoShare.h \
|
gui/PhotoShare/PhotoShare.h \
|
||||||
gui/PhotoShare/PhotoSlideShow.h \
|
gui/PhotoShare/PhotoSlideShow.h \
|
||||||
|
gui/PhotoShare/PhotoDialog.h
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
gui/PhotoShare/PhotoItem.ui \
|
gui/PhotoShare/PhotoItem.ui \
|
||||||
@ -880,7 +882,7 @@ photoshare {
|
|||||||
gui/PhotoShare/AlbumDialog.ui \
|
gui/PhotoShare/AlbumDialog.ui \
|
||||||
gui/PhotoShare/AlbumCreateDialog.ui \
|
gui/PhotoShare/AlbumCreateDialog.ui \
|
||||||
gui/PhotoShare/PhotoShare.ui \
|
gui/PhotoShare/PhotoShare.ui \
|
||||||
gui/PhotoShare/PhotoSlideShow.ui \
|
gui/PhotoShare/PhotoSlideShow.ui
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
gui/PhotoShare/PhotoItem.cpp \
|
gui/PhotoShare/PhotoItem.cpp \
|
||||||
@ -892,7 +894,7 @@ photoshare {
|
|||||||
util/TokenQueueV2.cpp \
|
util/TokenQueueV2.cpp \
|
||||||
gui/PhotoShare/PhotoShareItemHolder.cpp \
|
gui/PhotoShare/PhotoShareItemHolder.cpp \
|
||||||
gui/PhotoShare/PhotoShare.cpp \
|
gui/PhotoShare/PhotoShare.cpp \
|
||||||
gui/PhotoShare/PhotoSlideShow.cpp \
|
gui/PhotoShare/PhotoSlideShow.cpp
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ void AlbumItem::setSelected(bool on)
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
RsPhotoAlbum AlbumItem::getAlbum()
|
const RsPhotoAlbum& AlbumItem::getAlbum()
|
||||||
{
|
{
|
||||||
return mAlbum;
|
return mAlbum;
|
||||||
}
|
}
|
||||||
|
@ -16,9 +16,9 @@ class AlbumItem : public QWidget, public PhotoShareItem
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AlbumItem(const RsPhotoAlbum& album, PhotoShareItemHolder* albumHolder, QWidget *parent = 0);
|
explicit AlbumItem(const RsPhotoAlbum& album, PhotoShareItemHolder* albumHolder, QWidget *parent = 0);
|
||||||
~AlbumItem();
|
virtual ~AlbumItem();
|
||||||
|
|
||||||
RsPhotoAlbum getAlbum();
|
const RsPhotoAlbum& getAlbum();
|
||||||
|
|
||||||
bool isSelected() { return mSelected ;}
|
bool isSelected() { return mSelected ;}
|
||||||
void setSelected(bool selected);
|
void setSelected(bool selected);
|
||||||
|
14
retroshare-gui/src/gui/PhotoShare/PhotoCommentItem.cpp
Normal file
14
retroshare-gui/src/gui/PhotoShare/PhotoCommentItem.cpp
Normal 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;
|
||||||
|
}
|
22
retroshare-gui/src/gui/PhotoShare/PhotoCommentItem.h
Normal file
22
retroshare-gui/src/gui/PhotoShare/PhotoCommentItem.h
Normal 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
|
21
retroshare-gui/src/gui/PhotoShare/PhotoCommentItem.ui
Normal file
21
retroshare-gui/src/gui/PhotoShare/PhotoCommentItem.ui
Normal 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>
|
@ -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 "PhotoDialog.h"
|
||||||
|
#include "ui_PhotoDialog.h"
|
||||||
|
|
||||||
#include <retroshare/rspeers.h>
|
PhotoDialog::PhotoDialog(RsPhotoV2 *rs_photo, const RsPhotoPhoto &photo, QWidget *parent) :
|
||||||
#include <retroshare/rsphotoV2.h>
|
QDialog(parent),
|
||||||
#include <gxs/rsgxsflags.h>
|
ui(new Ui::PhotoDialog), mRsPhoto(rs_photo), mPhotoQueue(new TokenQueueV2(mRsPhoto->getTokenService(), this)),
|
||||||
|
mPhotoDetails(photo)
|
||||||
|
|
||||||
#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);
|
ui->setupUi(this);
|
||||||
|
setAttribute ( Qt::WA_DeleteOnClose, true );
|
||||||
mAlbumSelected = NULL;
|
setUp();
|
||||||
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)
|
PhotoDialog::~PhotoDialog()
|
||||||
{
|
{
|
||||||
|
delete ui;
|
||||||
AlbumItem* aItem;
|
delete mPhotoQueue;
|
||||||
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::setUp()
|
||||||
void PhotoDialog::checkUpdate()
|
|
||||||
{
|
{
|
||||||
/* update */
|
QPixmap qtn;
|
||||||
if (!rsPhotoV2)
|
qtn.loadFromData(mPhotoDetails.mThumbnail.data, mPhotoDetails.mThumbnail.size, mPhotoDetails.mThumbnail.type.c_str());
|
||||||
return;
|
ui->label_Photo->setPixmap(qtn);
|
||||||
|
ui->lineEdit_Title->setText(QString::fromStdString(mPhotoDetails.mMeta.mMsgName));
|
||||||
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)
|
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 ************************/
|
|
||||||
|
|
||||||
|
@ -1,113 +1,37 @@
|
|||||||
/*
|
#ifndef PHOTODIALOG_H
|
||||||
* Retroshare Photo Plugin.
|
#define PHOTODIALOG_H
|
||||||
*
|
|
||||||
* 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 <QDialog>
|
||||||
|
#include "retroshare/rsphotoV2.h"
|
||||||
#include "util/TokenQueueV2.h"
|
#include "util/TokenQueueV2.h"
|
||||||
#include "PhotoShareItemHolder.h"
|
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class PhotoDialog;
|
||||||
|
}
|
||||||
|
|
||||||
class PhotoDialog : public MainPage, public TokenResponseV2, public PhotoShareItemHolder
|
class PhotoDialog : public QDialog, public TokenResponseV2
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PhotoDialog(QWidget *parent = 0);
|
explicit PhotoDialog(RsPhotoV2* rs_photo, const RsPhotoPhoto& photo, QWidget *parent = 0);
|
||||||
|
~PhotoDialog();
|
||||||
void notifySelection(PhotoShareItem* selection);
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void checkUpdate();
|
void addComment();
|
||||||
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);
|
|
||||||
|
|
||||||
|
public:
|
||||||
void loadRequest(const TokenQueueV2 *queue, const TokenRequestV2 &req);
|
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:
|
private:
|
||||||
|
void setUp();
|
||||||
|
private:
|
||||||
|
Ui::PhotoDialog *ui;
|
||||||
|
|
||||||
|
RsPhotoV2* mRsPhoto;
|
||||||
AlbumItem* mAlbumSelected;
|
TokenQueueV2* mPhotoQueue;
|
||||||
PhotoItem* mPhotoSelected;
|
RsPhotoPhoto mPhotoDetails;
|
||||||
PhotoSlideShow* mSlideShow;
|
|
||||||
AlbumDialog* mAlbumDialog;
|
|
||||||
|
|
||||||
TokenQueueV2 *mPhotoQueue;
|
|
||||||
|
|
||||||
/* UI - from Designer */
|
|
||||||
Ui::PhotoDialog ui;
|
|
||||||
|
|
||||||
QSet<AlbumItem*> mAlbumItems;
|
|
||||||
QMap<RsGxsGroupId, QSet<PhotoItem*> > mPhotoItems;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif // PHOTODIALOG_H
|
||||||
|
|
||||||
|
@ -1,144 +1,164 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>PhotoDialog</class>
|
<class>PhotoDialog</class>
|
||||||
<widget class="QWidget" name="PhotoDialog">
|
<widget class="QDialog" name="PhotoDialog">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>774</width>
|
<width>516</width>
|
||||||
<height>608</height>
|
<height>449</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Photo Share</string>
|
<string>Dialog</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
<item>
|
<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>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">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_5">
|
<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">
|
<property name="text">
|
||||||
<string/>
|
<string>TextLabel</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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">
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
@ -146,15 +166,35 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>139</width>
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Add Comment</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</item>
|
||||||
</widget>
|
<item>
|
||||||
<widget class="QScrollArea" name="scrollArea_2">
|
<widget class="QScrollArea" name="scrollArea_2">
|
||||||
<property name="widgetResizable">
|
<property name="widgetResizable">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@ -167,8 +207,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>754</width>
|
<width>496</width>
|
||||||
<height>260</height>
|
<height>69</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
@ -176,14 +216,14 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_2">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>426</width>
|
<width>20</width>
|
||||||
<height>20</height>
|
<height>40</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
@ -191,7 +231,6 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -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 "PhotoShare.h"
|
||||||
#include "ui_PhotoShare.h"
|
#include "ui_PhotoShare.h"
|
||||||
|
|
||||||
PhotoShare::PhotoShare(QWidget *parent) :
|
#include <retroshare/rspeers.h>
|
||||||
QWidget(parent),
|
#include <retroshare/rsphotoV2.h>
|
||||||
ui(new Ui::PhotoShare)
|
#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 ************************/
|
||||||
|
|
||||||
|
@ -2,21 +2,98 @@
|
|||||||
#define PHOTOSHARE_H
|
#define PHOTOSHARE_H
|
||||||
|
|
||||||
#include <QWidget>
|
#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 {
|
namespace Ui {
|
||||||
class PhotoShare;
|
class PhotoShare;
|
||||||
}
|
}
|
||||||
|
|
||||||
class PhotoShare : public QWidget
|
class PhotoShare : public MainPage, public TokenResponseV2, public PhotoShareItemHolder
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit PhotoShare(QWidget *parent = 0);
|
PhotoShare(QWidget *parent = 0);
|
||||||
~PhotoShare();
|
|
||||||
|
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:
|
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
|
#endif // PHOTOSHARE_H
|
||||||
|
@ -1,21 +1,211 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<author/>
|
|
||||||
<comment/>
|
|
||||||
<exportmacro/>
|
|
||||||
<class>PhotoShare</class>
|
<class>PhotoShare</class>
|
||||||
<widget class="QWidget" name="PhotoShare">
|
<widget class="QWidget" name="PhotoShare">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>400</width>
|
<width>824</width>
|
||||||
<height>300</height>
|
<height>569</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</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>
|
</widget>
|
||||||
<pixmapfunction/>
|
</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>
|
||||||
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
#include <retroshare/rsiface.h>
|
#include <retroshare/rsiface.h>
|
||||||
|
|
||||||
#include "gui/PhotoShare/PhotoDialog.h"
|
#include "gui/PhotoShare/PhotoShare.h"
|
||||||
|
|
||||||
// THESE HAVE TO BE CONVERTED TO VEG FORMAT
|
// THESE HAVE TO BE CONVERTED TO VEG FORMAT
|
||||||
#if USE_VEG_SERVICE
|
#if USE_VEG_SERVICE
|
||||||
@ -104,9 +104,9 @@ ApplicationWindow::ApplicationWindow(QWidget* parent, Qt::WFlags flags)
|
|||||||
createPageAction(QIcon(IMAGE_LIBRARY), tr("Identities"), grp));
|
createPageAction(QIcon(IMAGE_LIBRARY), tr("Identities"), grp));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PhotoDialog *photoDialog = NULL;
|
PhotoShare *photoShare = NULL;
|
||||||
ui.stackPages->add(photoDialog = new PhotoDialog(ui.stackPages),
|
ui.stackPages->add(photoShare = new PhotoShare(ui.stackPages),
|
||||||
createPageAction(QIcon(IMAGE_PHOTO), tr("Photo View"), grp));
|
createPageAction(QIcon(IMAGE_PHOTO), tr("Photo Share"), grp));
|
||||||
|
|
||||||
// THESE HAVE TO BE CONVERTED TO VEG FORMAT
|
// THESE HAVE TO BE CONVERTED TO VEG FORMAT
|
||||||
#if USE_VEG_SERVICE
|
#if USE_VEG_SERVICE
|
||||||
|
@ -66,6 +66,16 @@ bool TokenQueueV2::requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTok
|
|||||||
return true;
|
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,
|
bool TokenQueueV2::requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptionsV2 &opts,
|
||||||
const std::list<RsGxsGroupId> &grpIds, uint32_t usertype)
|
const std::list<RsGxsGroupId> &grpIds, uint32_t usertype)
|
||||||
@ -143,7 +153,9 @@ void TokenQueueV2::pollRequests()
|
|||||||
bool TokenQueueV2::checkForRequest(uint32_t token)
|
bool TokenQueueV2::checkForRequest(uint32_t token)
|
||||||
{
|
{
|
||||||
/* check 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) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -93,6 +93,7 @@ public:
|
|||||||
bool requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptionsV2 &opts,
|
bool requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptionsV2 &opts,
|
||||||
const GxsMsgReq& grpIds, uint32_t usertype);
|
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);
|
bool cancelRequest(const uint32_t token);
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ Menu *CreateMenuStructure(NotifyTxt *notify)
|
|||||||
|
|
||||||
MenuList *search = new MenuListSearch(notify);
|
MenuList *search = new MenuListSearch(notify);
|
||||||
MenuList *searchlist = new MenuListSearchList(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_REMOVE, new MenuOpSearchDelete());
|
||||||
search->addMenuItem(MENU_SEARCH_KEY_VIEW, searchlist);
|
search->addMenuItem(MENU_SEARCH_KEY_VIEW, searchlist);
|
||||||
searchlist->addMenuItem(MENU_SEARCH_KEY_DOWNLOAD, new MenuOpSearchListDownload());
|
searchlist->addMenuItem(MENU_SEARCH_KEY_DOWNLOAD, new MenuOpSearchListDownload());
|
||||||
@ -362,17 +362,11 @@ int MenuListSearch::removeSearch(std::string strSearchId)
|
|||||||
it = mSearchIds.find(strSearchId);
|
it = mSearchIds.find(strSearchId);
|
||||||
if (it != mSearchIds.end())
|
if (it != mSearchIds.end())
|
||||||
{
|
{
|
||||||
|
/* cleanup local maps */
|
||||||
|
|
||||||
/* cancel search */
|
/* cancel search */
|
||||||
// CAN'T DO!!!
|
|
||||||
|
|
||||||
/* clear results from Notify Collector */
|
/* clear results from Notify Collector */
|
||||||
mNotify->clearSearchId(it->second);
|
|
||||||
|
|
||||||
/* cleanup local maps */
|
|
||||||
mSearchIds.erase(it);
|
|
||||||
|
|
||||||
/* cleanup terms maps (TODO) */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
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.
|
std::string search = input.substr(0, input.size() - 1); // remove \n.
|
||||||
uint32_t searchId = (uint32_t) rsTurtle->turtleSearch(search);
|
uint32_t searchId = (uint32_t) rsTurtle->turtleSearch(search);
|
||||||
mNotify->collectSearchResults(searchId);
|
|
||||||
|
|
||||||
/* store request in parent */
|
/* store request in parent */
|
||||||
MenuListSearch *ms = dynamic_cast<MenuListSearch *>(parent());
|
MenuListSearch *ms = dynamic_cast<MenuListSearch *>(parent());
|
||||||
@ -652,7 +645,7 @@ int MenuListShared::getEntryDesc(int idx, std::string &desc)
|
|||||||
rsFiles->getSharedDirectories(dirs);
|
rsFiles->getSharedDirectories(dirs);
|
||||||
std::list<SharedDirInfo>::iterator it;
|
std::list<SharedDirInfo>::iterator it;
|
||||||
std::string shareflag;
|
std::string shareflag;
|
||||||
int i=0;
|
unsigned int i=0;
|
||||||
for (it = dirs.begin(); (i < idx) && (it != dirs.end()); it++, i++);
|
for (it = dirs.begin(); (i < idx) && (it != dirs.end()); it++, i++);
|
||||||
if (it != dirs.end())
|
if (it != dirs.end())
|
||||||
{
|
{
|
||||||
@ -682,7 +675,7 @@ int MenuListShared::unshareSelected()
|
|||||||
std::list<SharedDirInfo> dirs;
|
std::list<SharedDirInfo> dirs;
|
||||||
rsFiles->getSharedDirectories(dirs);
|
rsFiles->getSharedDirectories(dirs);
|
||||||
std::list<SharedDirInfo>::iterator it;
|
std::list<SharedDirInfo>::iterator it;
|
||||||
int i=0;
|
unsigned int i=0;
|
||||||
for (it = dirs.begin(); (i < mSelectIdx) && (it != dirs.end()); it++, i++);
|
for (it = dirs.begin(); (i < mSelectIdx) && (it != dirs.end()); it++, i++);
|
||||||
if (it != dirs.end())
|
if (it != dirs.end())
|
||||||
{
|
{
|
||||||
@ -703,7 +696,7 @@ int MenuListShared::toggleFlagSelected(uint32_t shareflags)
|
|||||||
std::list<SharedDirInfo> dirs;
|
std::list<SharedDirInfo> dirs;
|
||||||
rsFiles->getSharedDirectories(dirs);
|
rsFiles->getSharedDirectories(dirs);
|
||||||
std::list<SharedDirInfo>::iterator it;
|
std::list<SharedDirInfo>::iterator it;
|
||||||
int i=0;
|
unsigned int i=0;
|
||||||
for (it = dirs.begin(); (i < mSelectIdx) && (it != dirs.end()); it++, i++);
|
for (it = dirs.begin(); (i < mSelectIdx) && (it != dirs.end()); it++, i++);
|
||||||
if (it != dirs.end())
|
if (it != dirs.end())
|
||||||
{
|
{
|
||||||
|
@ -230,15 +230,8 @@ void NotifyTxt::notifyTurtleSearchResult(uint32_t search_id,const std::list<Turt
|
|||||||
it = mSearchResults.find(search_id);
|
it = mSearchResults.find(search_id);
|
||||||
if (it == mSearchResults.end())
|
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 */
|
/* new entry */
|
||||||
//mSearchResults[search_id] = found_files;
|
mSearchResults[search_id] = found_files;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,42 +288,15 @@ int NotifyTxt::getSearchResultCount(uint32_t id)
|
|||||||
return it->second.size();
|
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)
|
int NotifyTxt::clearSearchId(uint32_t searchId)
|
||||||
{
|
{
|
||||||
std::cerr << "NotifyTxt::clearSearchId(" << searchId << ")";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
RsStackMutex stack(mNotifyMtx); /****** LOCKED *****/
|
RsStackMutex stack(mNotifyMtx); /****** LOCKED *****/
|
||||||
|
|
||||||
std::map<uint32_t, std::list<TurtleFileInfo> >::iterator it;
|
std::map<uint32_t, std::list<TurtleFileInfo> >::iterator it;
|
||||||
it = mSearchResults.find(searchId);
|
it = mSearchResults.find(searchId);
|
||||||
if (it == mSearchResults.end())
|
if (it == mSearchResults.end())
|
||||||
{
|
{
|
||||||
std::cerr << "NotifyTxt::clearSearchId() ERROR Id not there";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -388,7 +388,7 @@ int main(int argc, char **argv)
|
|||||||
if (enableRpc)
|
if (enableRpc)
|
||||||
{
|
{
|
||||||
/* Build RPC Server */
|
/* Build RPC Server */
|
||||||
RpcMediator *med = CreateRpcSystem(ssh, notify);
|
RpcMediator *med = CreateRpcSystem(ssh);
|
||||||
ssh->setRpcSystem(med);
|
ssh->setRpcSystem(med);
|
||||||
ssh->setSleepPeriods(0.01, 0.1);
|
ssh->setSleepPeriods(0.01, 0.1);
|
||||||
}
|
}
|
||||||
|
@ -134,10 +134,12 @@ void protobuf_AssignDesc_core_2eproto() {
|
|||||||
sizeof(Person));
|
sizeof(Person));
|
||||||
Person_Relationship_descriptor_ = Person_descriptor_->enum_type(0);
|
Person_Relationship_descriptor_ = Person_descriptor_->enum_type(0);
|
||||||
File_descriptor_ = file->message_type(4);
|
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, name_),
|
||||||
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(File, hash_),
|
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(File, hash_),
|
||||||
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(File, size_),
|
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_ =
|
File_reflection_ =
|
||||||
new ::google::protobuf::internal::GeneratedMessageReflection(
|
new ::google::protobuf::internal::GeneratedMessageReflection(
|
||||||
@ -281,39 +283,39 @@ void protobuf_AddDesc_core_2eproto() {
|
|||||||
GOOGLE_PROTOBUF_VERIFY_VERSION;
|
GOOGLE_PROTOBUF_VERIFY_VERSION;
|
||||||
|
|
||||||
::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
|
::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"
|
"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"
|
"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\023\n"
|
"\000\022\017\n\013NO_IMPL_YET\020\001\022\021\n\rINVALID_QUERY\020\002\022\013\n"
|
||||||
"\017PARTIAL_SUCCESS\020\003\022\013\n\007SUCCESS\020\004\022\013\n\007READM"
|
"\007SUCCESS\020\003\022\013\n\007READMSG\020\004\")\n\006IpAddr\022\016\n\004add"
|
||||||
"SG\020\005\")\n\006IpAddr\022\016\n\004addr\030\001 \002(\t:\000\022\017\n\004port\030\002"
|
"r\030\001 \002(\t:\000\022\017\n\004port\030\002 \002(\r:\0010\"\303\001\n\010Location\022"
|
||||||
" \002(\r:\0010\"\303\001\n\010Location\022\016\n\006ssl_id\030\001 \002(\t\022\020\n\010"
|
"\016\n\006ssl_id\030\001 \002(\t\022\020\n\010location\030\002 \002(\t\022&\n\tloc"
|
||||||
"location\030\002 \002(\t\022&\n\tlocaladdr\030\003 \002(\0132\023.rsct"
|
"aladdr\030\003 \002(\0132\023.rsctrl.core.IpAddr\022$\n\007ext"
|
||||||
"rl.core.IpAddr\022$\n\007extaddr\030\004 \002(\0132\023.rsctrl"
|
"addr\030\004 \002(\0132\023.rsctrl.core.IpAddr\022\r\n\005state"
|
||||||
".core.IpAddr\022\r\n\005state\030\005 \002(\r\"8\n\nStateFlag"
|
"\030\005 \002(\r\"8\n\nStateFlags\022\n\n\006ONLINE\020\001\022\r\n\tCONN"
|
||||||
"s\022\n\n\006ONLINE\020\001\022\r\n\tCONNECTED\020\002\022\017\n\013UNREACHA"
|
"ECTED\020\002\022\017\n\013UNREACHABLE\020\004\"\340\001\n\006Person\022\016\n\006g"
|
||||||
"BLE\020\004\"\340\001\n\006Person\022\016\n\006gpg_id\030\001 \002(\t\022\014\n\004name"
|
"pg_id\030\001 \002(\t\022\014\n\004name\030\002 \002(\t\0222\n\010relation\030\003 "
|
||||||
"\030\002 \002(\t\0222\n\010relation\030\003 \002(\0162 .rsctrl.core.P"
|
"\002(\0162 .rsctrl.core.Person.Relationship\022(\n"
|
||||||
"erson.Relationship\022(\n\tlocations\030\004 \003(\0132\025."
|
"\tlocations\030\004 \003(\0132\025.rsctrl.core.Location\""
|
||||||
"rsctrl.core.Location\"Z\n\014Relationship\022\n\n\006"
|
"Z\n\014Relationship\022\n\n\006FRIEND\020\001\022\032\n\026FRIEND_OF"
|
||||||
"FRIEND\020\001\022\032\n\026FRIEND_OF_MANY_FRIENDS\020\002\022\025\n\021"
|
"_MANY_FRIENDS\020\002\022\025\n\021FRIEND_OF_FRIENDS\020\003\022\013"
|
||||||
"FRIEND_OF_FRIENDS\020\003\022\013\n\007UNKNOWN\020\004\"0\n\004File"
|
"\n\007UNKNOWN\020\004\"M\n\004File\022\014\n\004name\030\001 \002(\t\022\014\n\004has"
|
||||||
"\022\014\n\004name\030\001 \002(\t\022\014\n\004hash\030\002 \002(\t\022\014\n\004size\030\003 \002"
|
"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"
|
||||||
"(\004\"f\n\003Dir\022\014\n\004name\030\001 \002(\t\022\014\n\004path\030\002 \002(\t\022!\n"
|
"vail\030\005 \001(\t\"f\n\003Dir\022\014\n\004name\030\001 \002(\t\022\014\n\004path\030"
|
||||||
"\007subdirs\030\003 \003(\0132\020.rsctrl.core.Dir\022 \n\005file"
|
"\002 \002(\t\022!\n\007subdirs\030\003 \003(\0132\020.rsctrl.core.Dir"
|
||||||
"s\030\004 \003(\0132\021.rsctrl.core.File\"\372\001\n\014SystemSta"
|
"\022 \n\005files\030\004 \003(\0132\021.rsctrl.core.File\"\372\001\n\014S"
|
||||||
"tus\0225\n\nnet_status\030\001 \002(\0162!.rsctrl.core.Sy"
|
"ystemStatus\0225\n\nnet_status\030\001 \002(\0162!.rsctrl"
|
||||||
"stemStatus.NetCode\022\013\n\003msg\030\002 \001(\t\"\245\001\n\007NetC"
|
".core.SystemStatus.NetCode\022\013\n\003msg\030\002 \001(\t\""
|
||||||
"ode\022\017\n\013BAD_UNKNOWN\020\000\022\017\n\013BAD_OFFLINE\020\001\022\016\n"
|
"\245\001\n\007NetCode\022\017\n\013BAD_UNKNOWN\020\000\022\017\n\013BAD_OFFL"
|
||||||
"\nBAD_NATSYM\020\002\022\021\n\rBAD_NODHT_NAT\020\003\022\023\n\017WARN"
|
"INE\020\001\022\016\n\nBAD_NATSYM\020\002\022\021\n\rBAD_NODHT_NAT\020\003"
|
||||||
"ING_RESTART\020\004\022\022\n\016WARNING_NATTED\020\005\022\021\n\rWAR"
|
"\022\023\n\017WARNING_RESTART\020\004\022\022\n\016WARNING_NATTED\020"
|
||||||
"NING_NODHT\020\006\022\010\n\004GOOD\020\007\022\017\n\013ADV_FORWARD\020\010\""
|
"\005\022\021\n\rWARNING_NODHT\020\006\022\010\n\004GOOD\020\007\022\017\n\013ADV_FO"
|
||||||
"3\n\tBandwidth\022\n\n\002up\030\001 \002(\002\022\014\n\004down\030\002 \002(\002\022\014"
|
"RWARD\020\010\"3\n\tBandwidth\022\n\n\002up\030\001 \002(\002\022\014\n\004down"
|
||||||
"\n\004name\030\003 \001(\t\":\n\014BandwidthSet\022*\n\nbandwidt"
|
"\030\002 \002(\002\022\014\n\004name\030\003 \001(\t\":\n\014BandwidthSet\022*\n\n"
|
||||||
"hs\030\001 \003(\0132\026.rsctrl.core.Bandwidth*\027\n\013Exte"
|
"bandwidths\030\001 \003(\0132\026.rsctrl.core.Bandwidth"
|
||||||
"nsionId\022\010\n\004CORE\020\000*M\n\tPackageId\022\t\n\005PEERS\020"
|
"*\027\n\013ExtensionId\022\010\n\004CORE\020\000*6\n\tPackageId\022\t"
|
||||||
"\001\022\n\n\006SYSTEM\020\002\022\010\n\004CHAT\020\003\022\n\n\006SEARCH\020\004\022\t\n\005F"
|
"\n\005PEERS\020\001\022\n\n\006SYSTEM\020\002\022\010\n\004CHAT\020\003\022\010\n\003GXS\020\350"
|
||||||
"ILES\020\005\022\010\n\003GXS\020\350\007", 1296);
|
"\007", 1281);
|
||||||
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
|
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
|
||||||
"core.proto", &protobuf_RegisterTypes);
|
"core.proto", &protobuf_RegisterTypes);
|
||||||
Status::default_instance_ = new Status();
|
Status::default_instance_ = new Status();
|
||||||
@ -366,8 +368,6 @@ bool PackageId_IsValid(int value) {
|
|||||||
case 1:
|
case 1:
|
||||||
case 2:
|
case 2:
|
||||||
case 3:
|
case 3:
|
||||||
case 4:
|
|
||||||
case 5:
|
|
||||||
case 1000:
|
case 1000:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
@ -389,7 +389,6 @@ bool Status_StatusCode_IsValid(int value) {
|
|||||||
case 2:
|
case 2:
|
||||||
case 3:
|
case 3:
|
||||||
case 4:
|
case 4:
|
||||||
case 5:
|
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
@ -400,7 +399,6 @@ bool Status_StatusCode_IsValid(int value) {
|
|||||||
const Status_StatusCode Status::FAILED;
|
const Status_StatusCode Status::FAILED;
|
||||||
const Status_StatusCode Status::NO_IMPL_YET;
|
const Status_StatusCode Status::NO_IMPL_YET;
|
||||||
const Status_StatusCode Status::INVALID_QUERY;
|
const Status_StatusCode Status::INVALID_QUERY;
|
||||||
const Status_StatusCode Status::PARTIAL_SUCCESS;
|
|
||||||
const Status_StatusCode Status::SUCCESS;
|
const Status_StatusCode Status::SUCCESS;
|
||||||
const Status_StatusCode Status::READMSG;
|
const Status_StatusCode Status::READMSG;
|
||||||
const Status_StatusCode Status::StatusCode_MIN;
|
const Status_StatusCode Status::StatusCode_MIN;
|
||||||
@ -1784,6 +1782,8 @@ void Person::Swap(Person* other) {
|
|||||||
const int File::kNameFieldNumber;
|
const int File::kNameFieldNumber;
|
||||||
const int File::kHashFieldNumber;
|
const int File::kHashFieldNumber;
|
||||||
const int File::kSizeFieldNumber;
|
const int File::kSizeFieldNumber;
|
||||||
|
const int File::kPathFieldNumber;
|
||||||
|
const int File::kAvailFieldNumber;
|
||||||
#endif // !_MSC_VER
|
#endif // !_MSC_VER
|
||||||
|
|
||||||
File::File()
|
File::File()
|
||||||
@ -1804,7 +1804,9 @@ void File::SharedCtor() {
|
|||||||
_cached_size_ = 0;
|
_cached_size_ = 0;
|
||||||
name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
|
name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
|
||||||
hash_ = 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_));
|
::memset(_has_bits_, 0, sizeof(_has_bits_));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1819,6 +1821,12 @@ void File::SharedDtor() {
|
|||||||
if (hash_ != &::google::protobuf::internal::kEmptyString) {
|
if (hash_ != &::google::protobuf::internal::kEmptyString) {
|
||||||
delete hash_;
|
delete hash_;
|
||||||
}
|
}
|
||||||
|
if (path_ != &::google::protobuf::internal::kEmptyString) {
|
||||||
|
delete path_;
|
||||||
|
}
|
||||||
|
if (avail_ != &::google::protobuf::internal::kEmptyString) {
|
||||||
|
delete avail_;
|
||||||
|
}
|
||||||
if (this != default_instance_) {
|
if (this != default_instance_) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1855,7 +1863,17 @@ void File::Clear() {
|
|||||||
hash_->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_));
|
::memset(_has_bits_, 0, sizeof(_has_bits_));
|
||||||
mutable_unknown_fields()->Clear();
|
mutable_unknown_fields()->Clear();
|
||||||
@ -1900,18 +1918,52 @@ bool File::MergePartialFromCodedStream(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// required uint64 size = 3;
|
// required int64 size = 3;
|
||||||
case 3: {
|
case 3: {
|
||||||
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
|
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
|
||||||
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
|
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
|
||||||
parse_size:
|
parse_size:
|
||||||
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
|
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_)));
|
input, &size_)));
|
||||||
set_has_size();
|
set_has_size();
|
||||||
} else {
|
} else {
|
||||||
goto handle_uninterpreted;
|
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;
|
if (input->ExpectAtEnd()) return true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1952,9 +2004,27 @@ void File::SerializeWithCachedSizes(
|
|||||||
2, this->hash(), output);
|
2, this->hash(), output);
|
||||||
}
|
}
|
||||||
|
|
||||||
// required uint64 size = 3;
|
// required int64 size = 3;
|
||||||
if (has_size()) {
|
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()) {
|
if (!unknown_fields().empty()) {
|
||||||
@ -1985,9 +2055,29 @@ void File::SerializeWithCachedSizes(
|
|||||||
2, this->hash(), target);
|
2, this->hash(), target);
|
||||||
}
|
}
|
||||||
|
|
||||||
// required uint64 size = 3;
|
// required int64 size = 3;
|
||||||
if (has_size()) {
|
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()) {
|
if (!unknown_fields().empty()) {
|
||||||
@ -2015,13 +2105,27 @@ int File::ByteSize() const {
|
|||||||
this->hash());
|
this->hash());
|
||||||
}
|
}
|
||||||
|
|
||||||
// required uint64 size = 3;
|
// required int64 size = 3;
|
||||||
if (has_size()) {
|
if (has_size()) {
|
||||||
total_size += 1 +
|
total_size += 1 +
|
||||||
::google::protobuf::internal::WireFormatLite::UInt64Size(
|
::google::protobuf::internal::WireFormatLite::Int64Size(
|
||||||
this->size());
|
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()) {
|
if (!unknown_fields().empty()) {
|
||||||
total_size +=
|
total_size +=
|
||||||
@ -2058,6 +2162,12 @@ void File::MergeFrom(const File& from) {
|
|||||||
if (from.has_size()) {
|
if (from.has_size()) {
|
||||||
set_size(from.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());
|
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
|
||||||
}
|
}
|
||||||
@ -2085,6 +2195,8 @@ void File::Swap(File* other) {
|
|||||||
std::swap(name_, other->name_);
|
std::swap(name_, other->name_);
|
||||||
std::swap(hash_, other->hash_);
|
std::swap(hash_, other->hash_);
|
||||||
std::swap(size_, other->size_);
|
std::swap(size_, other->size_);
|
||||||
|
std::swap(path_, other->path_);
|
||||||
|
std::swap(avail_, other->avail_);
|
||||||
std::swap(_has_bits_[0], other->_has_bits_[0]);
|
std::swap(_has_bits_[0], other->_has_bits_[0]);
|
||||||
_unknown_fields_.Swap(&other->_unknown_fields_);
|
_unknown_fields_.Swap(&other->_unknown_fields_);
|
||||||
std::swap(_cached_size_, other->_cached_size_);
|
std::swap(_cached_size_, other->_cached_size_);
|
||||||
|
@ -25,13 +25,6 @@ const ::google::protobuf::Descriptor* ResponseSystemStatus_descriptor_ = NULL;
|
|||||||
const ::google::protobuf::internal::GeneratedMessageReflection*
|
const ::google::protobuf::internal::GeneratedMessageReflection*
|
||||||
ResponseSystemStatus_reflection_ = NULL;
|
ResponseSystemStatus_reflection_ = NULL;
|
||||||
const ::google::protobuf::EnumDescriptor* ResponseSystemStatus_NetCode_descriptor_ = 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* RequestMsgIds_descriptor_ = NULL;
|
||||||
const ::google::protobuf::EnumDescriptor* ResponseMsgIds_descriptor_ = NULL;
|
const ::google::protobuf::EnumDescriptor* ResponseMsgIds_descriptor_ = NULL;
|
||||||
|
|
||||||
@ -78,37 +71,6 @@ void protobuf_AssignDesc_system_2eproto() {
|
|||||||
::google::protobuf::MessageFactory::generated_factory(),
|
::google::protobuf::MessageFactory::generated_factory(),
|
||||||
sizeof(ResponseSystemStatus));
|
sizeof(ResponseSystemStatus));
|
||||||
ResponseSystemStatus_NetCode_descriptor_ = ResponseSystemStatus_descriptor_->enum_type(0);
|
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);
|
RequestMsgIds_descriptor_ = file->enum_type(0);
|
||||||
ResponseMsgIds_descriptor_ = file->enum_type(1);
|
ResponseMsgIds_descriptor_ = file->enum_type(1);
|
||||||
}
|
}
|
||||||
@ -127,10 +89,6 @@ void protobuf_RegisterTypes(const ::std::string&) {
|
|||||||
RequestSystemStatus_descriptor_, &RequestSystemStatus::default_instance());
|
RequestSystemStatus_descriptor_, &RequestSystemStatus::default_instance());
|
||||||
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
|
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
|
||||||
ResponseSystemStatus_descriptor_, &ResponseSystemStatus::default_instance());
|
ResponseSystemStatus_descriptor_, &ResponseSystemStatus::default_instance());
|
||||||
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
|
|
||||||
RequestSystemQuit_descriptor_, &RequestSystemQuit::default_instance());
|
|
||||||
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
|
|
||||||
ResponseSystemQuit_descriptor_, &ResponseSystemQuit::default_instance());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
@ -140,10 +98,6 @@ void protobuf_ShutdownFile_system_2eproto() {
|
|||||||
delete RequestSystemStatus_reflection_;
|
delete RequestSystemStatus_reflection_;
|
||||||
delete ResponseSystemStatus::default_instance_;
|
delete ResponseSystemStatus::default_instance_;
|
||||||
delete ResponseSystemStatus_reflection_;
|
delete ResponseSystemStatus_reflection_;
|
||||||
delete RequestSystemQuit::default_instance_;
|
|
||||||
delete RequestSystemQuit_reflection_;
|
|
||||||
delete ResponseSystemQuit::default_instance_;
|
|
||||||
delete ResponseSystemQuit_reflection_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void protobuf_AddDesc_system_2eproto() {
|
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"
|
"\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"
|
"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"
|
"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"
|
"\010*.\n\rRequestMsgIds\022\035\n\031MsgId_RequestSyste"
|
||||||
"(\0162).rsctrl.system.RequestSystemQuit.Qui"
|
"mStatus\020\001*0\n\016ResponseMsgIds\022\036\n\032MsgId_Res"
|
||||||
"tCode\".\n\010QuitCode\022\021\n\rCLOSE_CHANNEL\020\001\022\017\n\013"
|
"ponseSystemStatus\020\001", 539);
|
||||||
"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);
|
|
||||||
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
|
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
|
||||||
"system.proto", &protobuf_RegisterTypes);
|
"system.proto", &protobuf_RegisterTypes);
|
||||||
RequestSystemStatus::default_instance_ = new RequestSystemStatus();
|
RequestSystemStatus::default_instance_ = new RequestSystemStatus();
|
||||||
ResponseSystemStatus::default_instance_ = new ResponseSystemStatus();
|
ResponseSystemStatus::default_instance_ = new ResponseSystemStatus();
|
||||||
RequestSystemQuit::default_instance_ = new RequestSystemQuit();
|
|
||||||
ResponseSystemQuit::default_instance_ = new ResponseSystemQuit();
|
|
||||||
RequestSystemStatus::default_instance_->InitAsDefaultInstance();
|
RequestSystemStatus::default_instance_->InitAsDefaultInstance();
|
||||||
ResponseSystemStatus::default_instance_->InitAsDefaultInstance();
|
ResponseSystemStatus::default_instance_->InitAsDefaultInstance();
|
||||||
RequestSystemQuit::default_instance_->InitAsDefaultInstance();
|
|
||||||
ResponseSystemQuit::default_instance_->InitAsDefaultInstance();
|
|
||||||
::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_system_2eproto);
|
::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_system_2eproto);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,7 +145,6 @@ const ::google::protobuf::EnumDescriptor* RequestMsgIds_descriptor() {
|
|||||||
bool RequestMsgIds_IsValid(int value) {
|
bool RequestMsgIds_IsValid(int value) {
|
||||||
switch(value) {
|
switch(value) {
|
||||||
case 1:
|
case 1:
|
||||||
case 2:
|
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
@ -215,7 +158,6 @@ const ::google::protobuf::EnumDescriptor* ResponseMsgIds_descriptor() {
|
|||||||
bool ResponseMsgIds_IsValid(int value) {
|
bool ResponseMsgIds_IsValid(int value) {
|
||||||
switch(value) {
|
switch(value) {
|
||||||
case 1:
|
case 1:
|
||||||
case 2:
|
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
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)
|
// @@protoc_insertion_point(namespace_scope)
|
||||||
|
|
||||||
} // namespace system
|
} // namespace system
|
||||||
|
@ -86,11 +86,6 @@ int RpcProtoSystem::processMsg(uint32_t chan_id, uint32_t msg_id, uint32_t req_i
|
|||||||
case rsctrl::system::MsgId_RequestSystemStatus:
|
case rsctrl::system::MsgId_RequestSystemStatus:
|
||||||
processSystemStatus(chan_id, msg_id, req_id, msg);
|
processSystemStatus(chan_id, msg_id, req_id, msg);
|
||||||
break;
|
break;
|
||||||
#if 0
|
|
||||||
case rsctrl::system::MsgId_RequestSystemQuit:
|
|
||||||
processSystemQuit(chan_id, msg_id, req_id, msg);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
std::cerr << "RpcProtoSystem::processMsg() ERROR should never get here";
|
std::cerr << "RpcProtoSystem::processMsg() ERROR should never get here";
|
||||||
std::cerr << std::endl;
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,11 +43,6 @@ void RpcMediator::reset(uint32_t chan_id)
|
|||||||
mServer->reset(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()
|
int RpcMediator::tick()
|
||||||
{
|
{
|
||||||
|
@ -63,16 +63,11 @@ void RpcServer::reset(uint32_t chan_id)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RpcServer::error(uint32_t chan_id, std::string msg)
|
|
||||||
{
|
|
||||||
return mMediator->error(chan_id, msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
int RpcServer::addService(RpcService *service)
|
int RpcServer::addService(RpcService *service)
|
||||||
{
|
{
|
||||||
RsStackMutex stack(mRpcMtx); /********** LOCKED MUTEX ***************/
|
RsStackMutex stack(mRpcMtx); /********** LOCKED MUTEX ***************/
|
||||||
|
|
||||||
service->setRpcServer(this);
|
|
||||||
mAllServices.push_back(service);
|
mAllServices.push_back(service);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -27,12 +27,10 @@
|
|||||||
#include "rpc/proto/rpcprotopeers.h"
|
#include "rpc/proto/rpcprotopeers.h"
|
||||||
#include "rpc/proto/rpcprotosystem.h"
|
#include "rpc/proto/rpcprotosystem.h"
|
||||||
#include "rpc/proto/rpcprotochat.h"
|
#include "rpc/proto/rpcprotochat.h"
|
||||||
#include "rpc/proto/rpcprotosearch.h"
|
|
||||||
#include "rpc/proto/rpcprotofiles.h"
|
|
||||||
|
|
||||||
#include "rpc/rpcecho.h"
|
#include "rpc/rpcecho.h"
|
||||||
|
|
||||||
RpcMediator *CreateRpcSystem(RpcComms *comms, NotifyTxt *notify)
|
RpcMediator *CreateRpcSystem(RpcComms *comms)
|
||||||
{
|
{
|
||||||
RpcMediator *med = new RpcMediator(comms);
|
RpcMediator *med = new RpcMediator(comms);
|
||||||
RpcServer *server = new RpcServer(med);
|
RpcServer *server = new RpcServer(med);
|
||||||
@ -47,12 +45,6 @@ RpcMediator *CreateRpcSystem(RpcComms *comms, NotifyTxt *notify)
|
|||||||
RpcProtoChat *chat = new RpcProtoChat(1);
|
RpcProtoChat *chat = new RpcProtoChat(1);
|
||||||
server->addService(chat);
|
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. */
|
/* Finally an Echo Service - which will echo back any unprocesses commands. */
|
||||||
RpcEcho *echo = new RpcEcho(1);
|
RpcEcho *echo = new RpcEcho(1);
|
||||||
server->addService(echo);
|
server->addService(echo);
|
||||||
|
Loading…
Reference in New Issue
Block a user