Update the data in photoitems

Update PhotoItem members
 - remove excessive fields in Photo
 - add RsGxsFile to Photo
 - update ShareMode for Album
 - renamed photo.mThumbnail to mLowResImage
Update Photo GUI
 - enable setting of AlbumExtra parameters.
 - added data for Ordering of photos
 - stop showing duplicates in PhotoSlideShow
This commit is contained in:
drbob 2020-03-07 00:13:25 +11:00
parent 70d1d65cbf
commit 88f76c5fbb
17 changed files with 272 additions and 339 deletions

View file

@ -43,6 +43,13 @@ struct RsGxsFile : RsSerializable
RS_SERIAL_PROCESS(mHash);
RS_SERIAL_PROCESS(mSize);
}
void clear()
{
mName.clear();
mHash.clear();
mSize = 0;
}
};
struct RsGxsImage : RsSerializable

View file

@ -34,110 +34,57 @@
class RsPhoto;
extern RsPhoto *rsPhoto;
/******************* NEW STUFF FOR NEW CACHE SYSTEM *********/
#define RSPHOTO_MODE_NEW 1
#define RSPHOTO_MODE_OWN 2
#define RSPHOTO_MODE_REMOTE 3
/* If these flags are no set - the Photo inherits values from the Album
*/
#define RSPHOTO_FLAGS_ATTRIB_TITLE 0x0001
#define RSPHOTO_FLAGS_ATTRIB_CAPTION 0x0002
#define RSPHOTO_FLAGS_ATTRIB_DESC 0x0004
#define RSPHOTO_FLAGS_ATTRIB_PHOTOGRAPHER 0x0008
#define RSPHOTO_FLAGS_ATTRIB_WHERE 0x0010
#define RSPHOTO_FLAGS_ATTRIB_WHEN 0x0020
#define RSPHOTO_FLAGS_ATTRIB_OTHER 0x0040
#define RSPHOTO_FLAGS_ATTRIB_CATEGORY 0x0080
#define RSPHOTO_FLAGS_ATTRIB_HASHTAGS 0x0100
#define RSPHOTO_FLAGS_ATTRIB_ORDER 0x0200
#define RSPHOTO_FLAGS_ATTRIB_THUMBNAIL 0x0400
#define RSPHOTO_FLAGS_ATTRIB_MODE 0x0800
#define RSPHOTO_FLAGS_ATTRIB_AUTHOR 0x1000 // PUSH UP ORDER
#define RSPHOTO_FLAGS_ATTRIB_PHOTO 0x2000 // PUSH UP ORDER.
class RsPhotoPhoto
{
public:
public:
RsMsgMetaData mMeta;
RsMsgMetaData mMeta;
RsPhotoPhoto();
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;
// V2 PhotoMsg - keep it simple.
// mMeta.mTitle used for Photo Caption.
// mDescription optional field for addtional notes.
// mLowResImage - < 50k jpg of image.
// mPhotoFile - transfer details for original photo.
std::string mDescription;
uint32_t mOrder;
RsGxsImage mLowResImage;
RsGxsFile mPhotoFile;
std::string mHashTags;
uint32_t mSetFlags;
int mOrder;
RsGxsImage mThumbnail;
int mMode;
// These are not saved.
std::string path; // if in Mode NEW.
uint32_t mModFlags;
// These are not saved.
std::string mPath; // if New photo
};
class RsPhotoAlbumShare
{
public:
uint32_t mShareType;
std::string mShareGroupId;
std::string mPublishKey;
uint32_t mCommentMode;
uint32_t mResizeMode;
};
#define RSPHOTO_SHAREMODE_LOWRESONLY (1)
#define RSPHOTO_SHAREMODE_ORIGINAL (2)
#define RSPHOTO_SHAREMODE_DUP_ORIGINAL (3)
#define RSPHOTO_SHAREMODE_DUP_200K (4)
#define RSPHOTO_SHAREMODE_DUP_1M (5)
class RsPhotoAlbum
{
public:
RsPhotoAlbum();
public:
RsPhotoAlbum();
RsGroupMetaData mMeta;
RsGroupMetaData mMeta;
// THESE ARE IN THE META DATA.
//std::string mAlbumId;
//std::string mTitle; // only used by Album.
// V2 Album - keep it simple.
// mMeta.mTitle.
uint32_t mShareMode;
std::string mCaption;
std::string mDescription;
std::string mPhotographer;
std::string mWhere;
std::string mWhen;
std::string mOther;
std::string mCategory;
std::string mCaption;
std::string mDescription;
std::string mPhotographer;
std::string mWhere;
std::string mWhen;
std::string mHashTags;
RsGxsImage mThumbnail;
RsGxsImage mThumbnail;
int mMode;
std::string mPhotoPath;
RsPhotoAlbumShare mShareOptions;
// These aren't saved.
uint32_t mSetFlags;
uint32_t mModFlags;
// Below is not saved.
bool mAutoDownload;
};
std::ostream &operator<<(std::ostream &out, const RsPhotoPhoto &photo);
std::ostream &operator<<(std::ostream &out, const RsPhotoAlbum &album);
@ -145,14 +92,7 @@ typedef std::map<RsGxsGroupId, std::vector<RsPhotoPhoto> > PhotoResult;
class RsPhoto: public RsGxsIfaceHelper, public RsGxsCommentService
{
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;
explicit RsPhoto(RsGxsIface &gxs) : RsGxsIfaceHelper(gxs) { return; }
virtual ~RsPhoto() { return; }

View file

@ -42,55 +42,44 @@ RsItem *RsGxsPhotoSerialiser::create_item(uint16_t service, uint8_t item_sub_id)
void RsGxsPhotoAlbumItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
{
RsTypeSerializer::serial_process<uint32_t>(j,ctx,TLV_TYPE_UINT32_PARAM,album.mShareMode,"mShareMode");
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_CAPTION, album.mCaption, "mCaption");
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_CATEGORY, album.mCategory, "mCategory");
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_DESCR, album.mDescription, "mDescription");
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_HASH_TAG, album.mHashTags, "mHashTags");
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_MSG, album.mOther, "mOther");
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_PATH, album.mPhotoPath, "mPhotoPath");
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_NAME, album.mPhotographer, "mPhotographer");
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_DATE, album.mWhen, "mWhen");
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_LOCATION, album.mWhere, "mWhere");
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_DATE, album.mWhen, "mWhen");
album.mThumbnail.serial_process(j, ctx);
}
void RsGxsPhotoPhotoItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
{
RsTypeSerializer::serial_process(j, ctx, TLV_TYPE_STR_CAPTION, photo.mCaption, "mCaption");
RsTypeSerializer::serial_process(j, ctx, TLV_TYPE_STR_CATEGORY, photo.mCategory, "mCategory");
RsTypeSerializer::serial_process(j, ctx, TLV_TYPE_STR_DESCR, photo.mDescription, "mDescription");
RsTypeSerializer::serial_process(j, ctx, TLV_TYPE_STR_HASH_TAG, photo.mHashTags, "mHashTags");
RsTypeSerializer::serial_process(j, ctx, TLV_TYPE_STR_MSG, photo.mOther, "mOther");
RsTypeSerializer::serial_process(j, ctx, TLV_TYPE_STR_PIC_AUTH, photo.mPhotographer, "mPhotographer");
RsTypeSerializer::serial_process(j, ctx, TLV_TYPE_STR_DATE, photo.mWhen, "mWhen");
RsTypeSerializer::serial_process(j, ctx, TLV_TYPE_STR_LOCATION, photo.mWhere, "mWhere");
photo.mThumbnail.serial_process(j, ctx);
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_DESCR, photo.mDescription, "mDescription");
RsTypeSerializer::serial_process<uint32_t>(j,ctx,TLV_TYPE_UINT32_PARAM,photo.mOrder,"mOrder");
photo.mLowResImage.serial_process(j, ctx);
photo.mPhotoFile.serial_process(j, ctx);
}
void RsGxsPhotoAlbumItem::clear()
{
album.mShareMode = RSPHOTO_SHAREMODE_LOWRESONLY;
album.mCaption.clear();
album.mCategory.clear();
album.mDescription.clear();
album.mHashTags.clear();
album.mOther.clear();
album.mPhotoPath.clear();
album.mPhotographer.clear();
album.mWhen.clear();
album.mWhere.clear();
album.mWhen.clear();
album.mThumbnail.clear();
// not saved
album.mAutoDownload = false;
}
void RsGxsPhotoPhotoItem::clear()
{
photo.mCaption.clear();
photo.mCategory.clear();
photo.mDescription.clear();
photo.mHashTags.clear();
photo.mOther.clear();
photo.mPhotographer.clear();
photo.mWhen.clear();
photo.mWhere.clear();
photo.mThumbnail.clear();
photo.mOrder = 0;
photo.mLowResImage.clear();
photo.mPhotoFile.clear();
// not saved
photo.mPath.clear();
}

View file

@ -25,19 +25,14 @@
RsPhoto *rsPhoto = NULL;
const uint32_t RsPhoto::FLAG_MSG_TYPE_MASK = 0x000f;
const uint32_t RsPhoto::FLAG_MSG_TYPE_PHOTO_POST = 0x0001;
const uint32_t RsPhoto::FLAG_MSG_TYPE_PHOTO_COMMENT = 0x0002;
RsPhotoPhoto::RsPhotoPhoto()
:mSetFlags(0), mOrder(0), mMode(0), mModFlags(0)
:mOrder(0)
{
return;
}
RsPhotoAlbum::RsPhotoAlbum()
:mMode(0), mSetFlags(0), mModFlags(0)
:mShareMode(RSPHOTO_SHAREMODE_LOWRESONLY), mAutoDownload(false)
{
return;
}