Switch PhotoService to use GxsComments

WIP improvements to PhotoService:
 - switch p3photoservice to use gxcommentservice
 - clean out old RsPhotoComment classes
 - redesign PhotoDialog to use standard GxsCommentService classes
 - remove unneeded old Comment classes from GUI
 - fix indenting for PhotoDialog and p3photoservice.h
 - fix layout issue in Extra Widgets for GxsGroupDialog
This commit is contained in:
drbob 2020-02-16 15:21:20 +11:00
parent 01b39bfe63
commit fe62dc1345
16 changed files with 484 additions and 1210 deletions

View file

@ -33,11 +33,10 @@ RsItem *RsGxsPhotoSerialiser::create_item(uint16_t service, uint8_t item_sub_id)
switch(item_sub_id)
{
case RS_PKT_SUBTYPE_PHOTO_COMMENT_ITEM: return new RsGxsPhotoCommentItem() ;
case RS_PKT_SUBTYPE_PHOTO_SHOW_ITEM: return new RsGxsPhotoPhotoItem() ;
case RS_PKT_SUBTYPE_PHOTO_ITEM: return new RsGxsPhotoAlbumItem() ;
default:
return NULL ;
return RsGxsCommentSerialiser::create_item(service,item_sub_id) ;
}
}
@ -68,11 +67,6 @@ void RsGxsPhotoPhotoItem::serial_process(RsGenericSerializer::SerializeJob j,RsG
photo.mThumbnail.serial_process(j, ctx);
}
void RsGxsPhotoCommentItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
{
RsTypeSerializer::serial_process (j,ctx,TLV_TYPE_STR_COMMENT,comment.mComment,"mComment");
RsTypeSerializer::serial_process<uint32_t>(j,ctx,comment.mCommentFlag,"mCommentFlag");
}
void RsGxsPhotoAlbumItem::clear()
{
@ -88,12 +82,6 @@ void RsGxsPhotoAlbumItem::clear()
album.mThumbnail.clear();
}
void RsGxsPhotoCommentItem::clear()
{
comment.mComment.clear();
comment.mCommentFlag = 0;
}
void RsGxsPhotoPhotoItem::clear()
{
photo.mCaption.clear();

View file

@ -26,6 +26,7 @@
#include "rsitems/rsserviceids.h"
#include "rsitems/rsgxsitems.h"
#include "rsitems/rsgxscommentitems.h"
#include "serialiser/rsserial.h"
#include "serialiser/rsserializer.h"
@ -34,7 +35,6 @@
const uint8_t RS_PKT_SUBTYPE_PHOTO_ITEM = 0x02;
const uint8_t RS_PKT_SUBTYPE_PHOTO_SHOW_ITEM = 0x03;
const uint8_t RS_PKT_SUBTYPE_PHOTO_COMMENT_ITEM = 0x04;
class RsGxsPhotoAlbumItem : public RsGxsGrpItem
{
@ -66,24 +66,11 @@ public:
RsPhotoPhoto photo;
};
class RsGxsPhotoCommentItem : public RsGxsMsgItem
class RsGxsPhotoSerialiser : public RsGxsCommentSerialiser
{
public:
RsGxsPhotoCommentItem(): RsGxsMsgItem(RS_SERVICE_GXS_TYPE_PHOTO, RS_PKT_SUBTYPE_PHOTO_COMMENT_ITEM) {}
virtual ~RsGxsPhotoCommentItem() {}
void clear();
virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx);
RsPhotoComment comment;
};
class RsGxsPhotoSerialiser : public RsServiceSerializer
{
public:
RsGxsPhotoSerialiser() :RsServiceSerializer(RS_SERVICE_GXS_TYPE_PHOTO) {}
RsGxsPhotoSerialiser() :RsGxsCommentSerialiser(RS_SERVICE_GXS_TYPE_PHOTO) {}
virtual ~RsGxsPhotoSerialiser() {}
virtual RsItem *create_item(uint16_t service, uint8_t item_sub_id) const;