mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Merge pull request #1831 from drbob/thewire_fix_message_display
TheWire fixup up display of messages
This commit is contained in:
commit
25467dda9f
@ -4412,7 +4412,7 @@ void RsGxsNetService::handleRecvSyncMessage(RsNxsSyncMsgReqItem *item,bool item_
|
|||||||
if(details.mReputation.mOverallReputationLevel < minReputationForForwardingMessages(grpMeta->mSignFlags, details.mFlags))
|
if(details.mReputation.mOverallReputationLevel < minReputationForForwardingMessages(grpMeta->mSignFlags, details.mFlags))
|
||||||
{
|
{
|
||||||
#ifdef NXS_NET_DEBUG_0
|
#ifdef NXS_NET_DEBUG_0
|
||||||
GXSNETDEBUG_PG(item->PeerId(),item->grpId) << " not sending item ID " << (*vit)->mMsgId << ", because the author is flags " << std::hex << details.mFlags << std::dec << " and reputation level " << details.mReputation.mOverallReputationLevel << std::endl;
|
GXSNETDEBUG_PG(item->PeerId(),item->grpId) << " not sending item ID " << (*vit)->mMsgId << ", because the author is flags " << std::hex << details.mFlags << std::dec << " and reputation level " << (int) details.mReputation.mOverallReputationLevel << std::endl;
|
||||||
#endif
|
#endif
|
||||||
continue ;
|
continue ;
|
||||||
}
|
}
|
||||||
|
@ -62,13 +62,10 @@ public:
|
|||||||
#define RSPHOTO_SHAREMODE_DUP_200K (4)
|
#define RSPHOTO_SHAREMODE_DUP_200K (4)
|
||||||
#define RSPHOTO_SHAREMODE_DUP_1M (5)
|
#define RSPHOTO_SHAREMODE_DUP_1M (5)
|
||||||
|
|
||||||
class RsPhotoAlbum
|
struct RsPhotoAlbum: RsGxsGenericGroupData
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
RsPhotoAlbum();
|
RsPhotoAlbum();
|
||||||
|
|
||||||
RsGroupMetaData mMeta;
|
|
||||||
|
|
||||||
// V2 Album - keep it simple.
|
// V2 Album - keep it simple.
|
||||||
// mMeta.mTitle.
|
// mMeta.mTitle.
|
||||||
uint32_t mShareMode;
|
uint32_t mShareMode;
|
||||||
@ -221,7 +218,29 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual bool acknowledgeGrp(const uint32_t& token, RsGxsGroupId& grpId) = 0;
|
virtual bool acknowledgeGrp(const uint32_t& token, RsGxsGroupId& grpId) = 0;
|
||||||
|
|
||||||
|
// Blocking versions.
|
||||||
|
/*!
|
||||||
|
* request to create a new album. Blocks until process completes.
|
||||||
|
* @param album album to be submitted
|
||||||
|
* @return true if created false otherwise
|
||||||
|
*/
|
||||||
|
virtual bool createAlbum(RsPhotoAlbum &album) = 0;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* request to update an existing album. Blocks until process completes.
|
||||||
|
* @param album album to be submitted
|
||||||
|
* @return true if created false otherwise
|
||||||
|
*/
|
||||||
|
virtual bool updateAlbum(const RsPhotoAlbum &album) = 0;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* retrieve albums based in groupIds.
|
||||||
|
* @param groupIds the ids to fetch.
|
||||||
|
* @param albums vector to be filled by request.
|
||||||
|
* @return true is successful, false otherwise.
|
||||||
|
*/
|
||||||
|
virtual bool getAlbums(const std::list<RsGxsGroupId> &groupIds,
|
||||||
|
std::vector<RsPhotoAlbum> &albums) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,22 +69,17 @@ class CollectionRef
|
|||||||
std::string CollectionId;
|
std::string CollectionId;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct RsWikiCollection: RsGxsGenericGroupData
|
||||||
class RsWikiCollection
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
RsGroupMetaData mMeta;
|
|
||||||
|
|
||||||
std::string mDescription;
|
std::string mDescription;
|
||||||
std::string mCategory;
|
std::string mCategory;
|
||||||
|
|
||||||
std::string mHashTags;
|
std::string mHashTags;
|
||||||
|
|
||||||
//std::map<std::string, CollectionRef> linkReferences;
|
// std::map<std::string, CollectionRef> linkReferences;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class RsWikiSnapshot
|
class RsWikiSnapshot
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -129,6 +124,11 @@ virtual bool submitComment(uint32_t &token, RsWikiComment &comment) = 0;
|
|||||||
|
|
||||||
virtual bool updateCollection(uint32_t &token, RsWikiCollection &collection) = 0;
|
virtual bool updateCollection(uint32_t &token, RsWikiCollection &collection) = 0;
|
||||||
|
|
||||||
|
// Blocking Interfaces.
|
||||||
|
virtual bool createCollection(RsWikiCollection &collection) = 0;
|
||||||
|
virtual bool updateCollection(const RsWikiCollection &collection) = 0;
|
||||||
|
virtual bool getCollections(const std::list<RsGxsGroupId> groupIds, std::vector<RsWikiCollection> &groups) = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -34,16 +34,13 @@
|
|||||||
class RsWire;
|
class RsWire;
|
||||||
extern RsWire *rsWire;
|
extern RsWire *rsWire;
|
||||||
|
|
||||||
class RsWireGroup
|
struct RsWireGroup: RsGxsGenericGroupData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
RsGroupMetaData mMeta;
|
|
||||||
std::string mDescription;
|
std::string mDescription;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* RsWire - is intended to be a Twitter clone - but fully decentralised.
|
* RsWire - is intended to be a Twitter clone - but fully decentralised.
|
||||||
*
|
*
|
||||||
@ -154,6 +151,11 @@ virtual bool getPulseData(const uint32_t &token, std::vector<RsWirePulse> &pulse
|
|||||||
virtual bool createGroup(uint32_t &token, RsWireGroup &group) = 0;
|
virtual bool createGroup(uint32_t &token, RsWireGroup &group) = 0;
|
||||||
virtual bool createPulse(uint32_t &token, RsWirePulse &pulse) = 0;
|
virtual bool createPulse(uint32_t &token, RsWirePulse &pulse) = 0;
|
||||||
|
|
||||||
|
// Blocking Interfaces.
|
||||||
|
virtual bool createGroup(RsWireGroup &group) = 0;
|
||||||
|
virtual bool updateGroup(const RsWireGroup &group) = 0;
|
||||||
|
virtual bool getGroups(const std::list<RsGxsGroupId> grpIds, std::vector<RsWireGroup> &groups) = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1376,6 +1376,8 @@ int RsServer::StartupRetroShare()
|
|||||||
mPhoto, mPhoto->getServiceInfo(),
|
mPhoto, mPhoto->getServiceInfo(),
|
||||||
mReputations, mGxsCircles,mGxsIdService,
|
mReputations, mGxsCircles,mGxsIdService,
|
||||||
pgpAuxUtils);
|
pgpAuxUtils);
|
||||||
|
|
||||||
|
mPhoto->setNetworkExchangeService(photo_ns);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef RS_USE_WIRE
|
#ifdef RS_USE_WIRE
|
||||||
@ -1391,6 +1393,8 @@ int RsServer::StartupRetroShare()
|
|||||||
mWire, mWire->getServiceInfo(),
|
mWire, mWire->getServiceInfo(),
|
||||||
mReputations, mGxsCircles,mGxsIdService,
|
mReputations, mGxsCircles,mGxsIdService,
|
||||||
pgpAuxUtils);
|
pgpAuxUtils);
|
||||||
|
|
||||||
|
mWire->setNetworkExchangeService(wire_ns);
|
||||||
#endif
|
#endif
|
||||||
// now add to p3service
|
// now add to p3service
|
||||||
pqih->addService(gxsid_ns, true);
|
pqih->addService(gxsid_ns, true);
|
||||||
|
@ -317,3 +317,38 @@ bool p3PhotoService::subscribeToAlbum(uint32_t &token, const RsGxsGroupId &grpId
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Blocking versions =============================================================
|
||||||
|
|
||||||
|
bool p3PhotoService::createAlbum(RsPhotoAlbum &album)
|
||||||
|
{
|
||||||
|
uint32_t token;
|
||||||
|
return submitAlbumDetails(token, album) && waitToken(token) == RsTokenService::COMPLETE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool p3PhotoService::updateAlbum(const RsPhotoAlbum &album)
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool p3PhotoService::getAlbums(const std::list<RsGxsGroupId> &groupIds,
|
||||||
|
std::vector<RsPhotoAlbum> &albums)
|
||||||
|
{
|
||||||
|
uint32_t token;
|
||||||
|
RsTokReqOptions opts;
|
||||||
|
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
||||||
|
|
||||||
|
if (groupIds.empty())
|
||||||
|
{
|
||||||
|
if (!requestGroupInfo(token, opts) || waitToken(token) != RsTokenService::COMPLETE )
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!requestGroupInfo(token, opts, groupIds) || waitToken(token) != RsTokenService::COMPLETE )
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return getAlbum(token, albums) && !albums.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -109,6 +109,13 @@ public:
|
|||||||
return acknowledgeMsg(token, msgId);
|
return acknowledgeMsg(token, msgId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Blocking versions.
|
||||||
|
virtual bool createComment(RsGxsComment &msg) override
|
||||||
|
{
|
||||||
|
uint32_t token;
|
||||||
|
return mCommentService->createGxsComment(token, msg) && waitToken(token) == RsTokenService::COMPLETE;
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** Modifications **/
|
/** Modifications **/
|
||||||
@ -165,6 +172,29 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool acknowledgeGrp(const uint32_t& token, RsGxsGroupId& grpId);
|
bool acknowledgeGrp(const uint32_t& token, RsGxsGroupId& grpId);
|
||||||
|
|
||||||
|
// Blocking versions.
|
||||||
|
/*!
|
||||||
|
* request to create a new album. Blocks until process completes.
|
||||||
|
* @param album album to be submitted
|
||||||
|
* @return true if created false otherwise
|
||||||
|
*/
|
||||||
|
virtual bool createAlbum(RsPhotoAlbum &album) override;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* request to update an existing album. Blocks until process completes.
|
||||||
|
* @param album album to be submitted
|
||||||
|
* @return true if created false otherwise
|
||||||
|
*/
|
||||||
|
virtual bool updateAlbum(const RsPhotoAlbum &album) override;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* retrieve albums based in groupIds.
|
||||||
|
* @param groupIds the ids to fetch.
|
||||||
|
* @param albums vector to be filled by request.
|
||||||
|
* @return true is successful, false otherwise.
|
||||||
|
*/
|
||||||
|
virtual bool getAlbums(const std::list<RsGxsGroupId> &groupIds,
|
||||||
|
std::vector<RsPhotoAlbum> &albums) override;
|
||||||
private:
|
private:
|
||||||
p3GxsCommentService* mCommentService;
|
p3GxsCommentService* mCommentService;
|
||||||
|
|
||||||
|
@ -323,6 +323,38 @@ bool p3Wiki::updateCollection(uint32_t &token, RsWikiCollection &group)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Blocking Interfaces.
|
||||||
|
bool p3Wiki::createCollection(RsWikiCollection &group)
|
||||||
|
{
|
||||||
|
uint32_t token;
|
||||||
|
return submitCollection(token, group) && waitToken(token) == RsTokenService::COMPLETE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool p3Wiki::updateCollection(const RsWikiCollection &group)
|
||||||
|
{
|
||||||
|
uint32_t token;
|
||||||
|
RsWikiCollection update(group);
|
||||||
|
return updateCollection(token, update) && waitToken(token) == RsTokenService::COMPLETE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool p3Wiki::getCollections(const std::list<RsGxsGroupId> groupIds, std::vector<RsWikiCollection> &groups)
|
||||||
|
{
|
||||||
|
uint32_t token;
|
||||||
|
RsTokReqOptions opts;
|
||||||
|
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
||||||
|
|
||||||
|
if (groupIds.empty())
|
||||||
|
{
|
||||||
|
if (!requestGroupInfo(token, opts) || waitToken(token) != RsTokenService::COMPLETE )
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!requestGroupInfo(token, opts, groupIds) || waitToken(token) != RsTokenService::COMPLETE )
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return getCollections(token, groups) && !groups.empty();
|
||||||
|
}
|
||||||
|
|
||||||
std::ostream &operator<<(std::ostream &out, const RsWikiCollection &group)
|
std::ostream &operator<<(std::ostream &out, const RsWikiCollection &group)
|
||||||
{
|
{
|
||||||
|
@ -56,17 +56,22 @@ public:
|
|||||||
virtual void service_tick();
|
virtual void service_tick();
|
||||||
|
|
||||||
/* Specific Service Data */
|
/* Specific Service Data */
|
||||||
virtual bool getCollections(const uint32_t &token, std::vector<RsWikiCollection> &collections);
|
virtual bool getCollections(const uint32_t &token, std::vector<RsWikiCollection> &collections) override;
|
||||||
virtual bool getSnapshots(const uint32_t &token, std::vector<RsWikiSnapshot> &snapshots);
|
virtual bool getSnapshots(const uint32_t &token, std::vector<RsWikiSnapshot> &snapshots) override;
|
||||||
virtual bool getComments(const uint32_t &token, std::vector<RsWikiComment> &comments);
|
virtual bool getComments(const uint32_t &token, std::vector<RsWikiComment> &comments) override;
|
||||||
|
|
||||||
virtual bool getRelatedSnapshots(const uint32_t &token, std::vector<RsWikiSnapshot> &snapshots);
|
virtual bool getRelatedSnapshots(const uint32_t &token, std::vector<RsWikiSnapshot> &snapshots) override;
|
||||||
|
|
||||||
virtual bool submitCollection(uint32_t &token, RsWikiCollection &collection);
|
virtual bool submitCollection(uint32_t &token, RsWikiCollection &collection) override;
|
||||||
virtual bool submitSnapshot(uint32_t &token, RsWikiSnapshot &snapshot);
|
virtual bool submitSnapshot(uint32_t &token, RsWikiSnapshot &snapshot) override;
|
||||||
virtual bool submitComment(uint32_t &token, RsWikiComment &comment);
|
virtual bool submitComment(uint32_t &token, RsWikiComment &comment) override;
|
||||||
|
|
||||||
virtual bool updateCollection(uint32_t &token, RsWikiCollection &collection);
|
virtual bool updateCollection(uint32_t &token, RsWikiCollection &collection) override;
|
||||||
|
|
||||||
|
// Blocking Interfaces.
|
||||||
|
virtual bool createCollection(RsWikiCollection &collection) override;
|
||||||
|
virtual bool updateCollection(const RsWikiCollection &collection) override;
|
||||||
|
virtual bool getCollections(const std::list<RsGxsGroupId> groupIds, std::vector<RsWikiCollection> &groups) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -64,11 +64,14 @@ uint32_t p3Wire::wireAuthenPolicy()
|
|||||||
|
|
||||||
// Edits generally need an authors signature.
|
// Edits generally need an authors signature.
|
||||||
|
|
||||||
|
// Wire requires all TopLevel (Orig/Reply) msgs to be signed with both PUBLISH & AUTHOR.
|
||||||
|
// Reply References need to be signed by Author.
|
||||||
flag = GXS_SERV::MSG_AUTHEN_ROOT_PUBLISH_SIGN | GXS_SERV::MSG_AUTHEN_CHILD_AUTHOR_SIGN;
|
flag = GXS_SERV::MSG_AUTHEN_ROOT_PUBLISH_SIGN | GXS_SERV::MSG_AUTHEN_CHILD_AUTHOR_SIGN;
|
||||||
|
flag |= GXS_SERV::MSG_AUTHEN_ROOT_AUTHOR_SIGN;
|
||||||
RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PUBLIC_GRP_BITS);
|
RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PUBLIC_GRP_BITS);
|
||||||
|
|
||||||
flag |= GXS_SERV::MSG_AUTHEN_ROOT_AUTHOR_SIGN;
|
// expect the requirements to be the same for RESTRICTED / PRIVATE groups too.
|
||||||
flag |= GXS_SERV::MSG_AUTHEN_CHILD_PUBLISH_SIGN;
|
// This needs to be worked through / fully evaluated.
|
||||||
RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::RESTRICTED_GRP_BITS);
|
RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::RESTRICTED_GRP_BITS);
|
||||||
RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PRIVATE_GRP_BITS);
|
RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PRIVATE_GRP_BITS);
|
||||||
|
|
||||||
@ -205,6 +208,38 @@ bool p3Wire::createPulse(uint32_t &token, RsWirePulse &pulse)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Blocking Interfaces.
|
||||||
|
bool p3Wire::createGroup(RsWireGroup &group)
|
||||||
|
{
|
||||||
|
uint32_t token;
|
||||||
|
return createGroup(token, group) && waitToken(token) == RsTokenService::COMPLETE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool p3Wire::updateGroup(const RsWireGroup &group)
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool p3Wire::getGroups(const std::list<RsGxsGroupId> groupIds, std::vector<RsWireGroup> &groups)
|
||||||
|
{
|
||||||
|
uint32_t token;
|
||||||
|
RsTokReqOptions opts;
|
||||||
|
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
||||||
|
|
||||||
|
if (groupIds.empty())
|
||||||
|
{
|
||||||
|
if (!requestGroupInfo(token, opts) || waitToken(token) != RsTokenService::COMPLETE )
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!requestGroupInfo(token, opts, groupIds) || waitToken(token) != RsTokenService::COMPLETE )
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return getGroupData(token, groups) && !groups.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
std::ostream &operator<<(std::ostream &out, const RsWireGroup &group)
|
std::ostream &operator<<(std::ostream &out, const RsWireGroup &group)
|
||||||
{
|
{
|
||||||
|
@ -50,11 +50,16 @@ public:
|
|||||||
virtual RsTokenService* getTokenService();
|
virtual RsTokenService* getTokenService();
|
||||||
|
|
||||||
/* Specific Service Data */
|
/* Specific Service Data */
|
||||||
virtual bool getGroupData(const uint32_t &token, std::vector<RsWireGroup> &groups);
|
virtual bool getGroupData(const uint32_t &token, std::vector<RsWireGroup> &groups) override;
|
||||||
virtual bool getPulseData(const uint32_t &token, std::vector<RsWirePulse> &pulses);
|
virtual bool getPulseData(const uint32_t &token, std::vector<RsWirePulse> &pulses) override;
|
||||||
|
|
||||||
virtual bool createGroup(uint32_t &token, RsWireGroup &group);
|
virtual bool createGroup(uint32_t &token, RsWireGroup &group) override;
|
||||||
virtual bool createPulse(uint32_t &token, RsWirePulse &pulse);
|
virtual bool createPulse(uint32_t &token, RsWirePulse &pulse) override;
|
||||||
|
|
||||||
|
// Blocking Interfaces.
|
||||||
|
virtual bool createGroup(RsWireGroup &group) override;
|
||||||
|
virtual bool updateGroup(const RsWireGroup &group) override;
|
||||||
|
virtual bool getGroups(const std::list<RsGxsGroupId> grpIds, std::vector<RsWireGroup> &groups) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void generateDummyData();
|
virtual void generateDummyData();
|
||||||
|
@ -62,13 +62,13 @@ uint32_t AlbumCreateDefaultsFlags = ( GXS_GROUP_DEFAULTS_DISTRIB_PUBLIC |
|
|||||||
uint32_t AlbumEditEnabledFlags = AlbumCreateEnabledFlags;
|
uint32_t AlbumEditEnabledFlags = AlbumCreateEnabledFlags;
|
||||||
uint32_t AlbumEditDefaultsFlags = AlbumCreateDefaultsFlags;
|
uint32_t AlbumEditDefaultsFlags = AlbumCreateDefaultsFlags;
|
||||||
|
|
||||||
AlbumGroupDialog::AlbumGroupDialog(TokenQueue *tokenQueue, QWidget *parent)
|
AlbumGroupDialog::AlbumGroupDialog(QWidget *parent)
|
||||||
: GxsGroupDialog(tokenQueue, AlbumCreateEnabledFlags, AlbumCreateDefaultsFlags, parent)
|
: GxsGroupDialog(AlbumCreateEnabledFlags, AlbumCreateDefaultsFlags, parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
AlbumGroupDialog::AlbumGroupDialog(TokenQueue *tokenExternalQueue, RsTokenService *tokenService, Mode mode, RsGxsGroupId groupId, QWidget *parent)
|
AlbumGroupDialog::AlbumGroupDialog(Mode mode, RsGxsGroupId groupId, QWidget *parent)
|
||||||
: GxsGroupDialog(tokenExternalQueue, tokenService, mode, groupId, AlbumEditEnabledFlags, AlbumEditDefaultsFlags, parent)
|
: GxsGroupDialog(mode, groupId, AlbumEditEnabledFlags, AlbumEditDefaultsFlags, parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,54 +129,44 @@ void AlbumGroupDialog::prepareAlbumGroup(RsPhotoAlbum &group, const RsGroupMetaD
|
|||||||
group.mWhen = mAlbumExtra->getWhen();
|
group.mWhen = mAlbumExtra->getWhen();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AlbumGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta)
|
bool AlbumGroupDialog::service_createGroup(RsGroupMetaData &meta)
|
||||||
{
|
{
|
||||||
// Specific Function.
|
// Specific Function.
|
||||||
RsPhotoAlbum grp;
|
RsPhotoAlbum grp;
|
||||||
prepareAlbumGroup(grp, meta);
|
prepareAlbumGroup(grp, meta);
|
||||||
|
|
||||||
rsPhoto->submitAlbumDetails(token, grp);
|
bool success = rsPhoto->createAlbum(grp);
|
||||||
return true;
|
// TODO createAlbum should refresh groupId or GroupObj.
|
||||||
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AlbumGroupDialog::service_EditGroup(uint32_t &token, RsGroupMetaData &editedMeta)
|
bool AlbumGroupDialog::service_updateGroup(const RsGroupMetaData &editedMeta)
|
||||||
{
|
{
|
||||||
RsPhotoAlbum grp;
|
RsPhotoAlbum grp;
|
||||||
prepareAlbumGroup(grp, editedMeta);
|
prepareAlbumGroup(grp, editedMeta);
|
||||||
|
|
||||||
std::cerr << "AlbumGroupDialog::service_EditGroup() submitting changes";
|
std::cerr << "AlbumGroupDialog::service_updateGroup() submitting changes";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
// TODO: no interface here, yet.
|
bool success = rsPhoto->updateAlbum(grp);
|
||||||
// rsPhoto->updateGroup(token, grp);
|
// TODO updateAlbum should refresh groupId or GroupObj.
|
||||||
return true;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AlbumGroupDialog::service_loadGroup(uint32_t token, Mode /*mode*/, RsGroupMetaData& groupMetaData, QString &description)
|
bool AlbumGroupDialog::service_loadGroup(const RsGxsGenericGroupData *data, Mode /*mode*/, QString &description)
|
||||||
{
|
{
|
||||||
std::cerr << "AlbumGroupDialog::service_loadGroup(" << token << ")";
|
std::cerr << "AlbumGroupDialog::service_loadGroup()";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
std::vector<RsPhotoAlbum> groups;
|
const RsPhotoAlbum *pgroup = dynamic_cast<const RsPhotoAlbum*>(data);
|
||||||
if (!rsPhoto->getAlbum(token, groups))
|
|
||||||
|
if(pgroup == nullptr)
|
||||||
{
|
{
|
||||||
std::cerr << "AlbumGroupDialog::service_loadGroup() Error getting GroupData";
|
std::cerr << "AlbumGroupDialog::service_loadGroup() Error not a RsPhotoAlbum" << std::endl;
|
||||||
std::cerr << std::endl;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (groups.size() != 1)
|
const RsPhotoAlbum& group = *pgroup;
|
||||||
{
|
|
||||||
std::cerr << "AlbumGroupDialog::service_loadGroup() Error Group.size() != 1";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::cerr << "AlbumGroupDialog::service_loadGroup() Unfinished Loading";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
const RsPhotoAlbum &group = groups[0];
|
|
||||||
groupMetaData = group.mMeta;
|
|
||||||
description = QString::fromUtf8(group.mDescription.c_str());
|
description = QString::fromUtf8(group.mDescription.c_str());
|
||||||
|
|
||||||
if (group.mThumbnail.mData) {
|
if (group.mThumbnail.mData) {
|
||||||
@ -197,3 +187,29 @@ bool AlbumGroupDialog::service_loadGroup(uint32_t token, Mode /*mode*/, RsGroupM
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AlbumGroupDialog::service_getGroupData(const RsGxsGroupId& grpId,RsGxsGenericGroupData *& data)
|
||||||
|
{
|
||||||
|
std::cerr << "AlbumGroupDialog::service_getGroupData(" << grpId << ")";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
std::list<RsGxsGroupId> groupIds({grpId});
|
||||||
|
std::vector<RsPhotoAlbum> groups;
|
||||||
|
if (!rsPhoto->getAlbums(groupIds, groups))
|
||||||
|
{
|
||||||
|
std::cerr << "AlbumGroupDialog::service_getGroupData() Error getting GroupData";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (groups.size() != 1)
|
||||||
|
{
|
||||||
|
std::cerr << "AlbumGroupDialog::service_getGroupData() Error Group.size() != 1";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
data = new RsPhotoAlbum(groups[0]);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -32,15 +32,16 @@ class AlbumGroupDialog : public GxsGroupDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AlbumGroupDialog(TokenQueue *tokenQueue, QWidget *parent);
|
AlbumGroupDialog(QWidget *parent);
|
||||||
AlbumGroupDialog(TokenQueue *tokenExternalQueue, RsTokenService *tokenService, Mode mode, RsGxsGroupId groupId, QWidget *parent);
|
AlbumGroupDialog(Mode mode, RsGxsGroupId groupId, QWidget *parent);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void initUi();
|
virtual void initUi() override;
|
||||||
virtual QPixmap serviceImage();
|
virtual QPixmap serviceImage() override;
|
||||||
virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta);
|
virtual bool service_createGroup(RsGroupMetaData &meta) override;
|
||||||
virtual bool service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData, QString &description);
|
virtual bool service_updateGroup(const RsGroupMetaData &editedMeta) override;
|
||||||
virtual bool service_EditGroup(uint32_t &token, RsGroupMetaData &editedMeta);
|
virtual bool service_loadGroup(const RsGxsGenericGroupData *data, Mode mode, QString &description) override;
|
||||||
|
virtual bool service_getGroupData(const RsGxsGroupId &grpId, RsGxsGenericGroupData *&data) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void prepareAlbumGroup(RsPhotoAlbum &group, const RsGroupMetaData &meta);
|
void prepareAlbumGroup(RsPhotoAlbum &group, const RsGroupMetaData &meta);
|
||||||
|
@ -233,7 +233,7 @@ void PhotoShare::OpenSlideShow()
|
|||||||
|
|
||||||
void PhotoShare::createAlbum()
|
void PhotoShare::createAlbum()
|
||||||
{
|
{
|
||||||
AlbumGroupDialog albumCreate(mPhotoQueue, this);
|
AlbumGroupDialog albumCreate(this);
|
||||||
albumCreate.exec();
|
albumCreate.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,7 +246,7 @@ void PhotoShare::OpenViewEditAlbumDialog()
|
|||||||
if (canEdit) {
|
if (canEdit) {
|
||||||
mode = GxsGroupDialog::MODE_EDIT;
|
mode = GxsGroupDialog::MODE_EDIT;
|
||||||
}
|
}
|
||||||
AlbumGroupDialog agDialog(mPhotoQueue, rsPhoto->getTokenService(), mode, album.mMeta.mGroupId, this);
|
AlbumGroupDialog agDialog(mode, album.mMeta.mGroupId, this);
|
||||||
agDialog.exec();
|
agDialog.exec();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,8 @@ void PulseAddDialog::setReplyTo(RsWirePulse &pulse, std::string &groupName)
|
|||||||
mReplyGroupName = groupName;
|
mReplyGroupName = groupName;
|
||||||
|
|
||||||
{
|
{
|
||||||
PulseDetails *details = new PulseDetails(NULL, pulse, groupName, true);
|
std::map<rstime_t, RsWirePulse *> replies;
|
||||||
|
PulseDetails *details = new PulseDetails(NULL, &pulse, groupName, replies);
|
||||||
// add extra widget into layout.
|
// add extra widget into layout.
|
||||||
QVBoxLayout *vbox = new QVBoxLayout();
|
QVBoxLayout *vbox = new QVBoxLayout();
|
||||||
vbox->addWidget(details);
|
vbox->addWidget(details);
|
||||||
|
@ -31,12 +31,14 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
PulseDetails::PulseDetails(PulseHolder *actions, RsWirePulse &pulse, std::string &groupName, bool is_original)
|
PulseDetails::PulseDetails(PulseHolder *actions, RsWirePulse *pulse, std::string &groupName,
|
||||||
:QWidget(NULL), mActions(actions), mPulse(pulse), mGroupName(groupName), mIsOriginal(is_original)
|
std::map<rstime_t, RsWirePulse *> replies)
|
||||||
|
:QWidget(NULL), mActions(actions), mPulse(*pulse), mGroupName(groupName)
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
setAttribute ( Qt::WA_DeleteOnClose, true );
|
setAttribute ( Qt::WA_DeleteOnClose, true );
|
||||||
setup();
|
setup();
|
||||||
|
addReplies(replies);
|
||||||
}
|
}
|
||||||
|
|
||||||
PulseDetails::PulseDetails(PulseHolder *actions,
|
PulseDetails::PulseDetails(PulseHolder *actions,
|
||||||
@ -46,7 +48,7 @@ PulseDetails::PulseDetails(PulseHolder *actions,
|
|||||||
RsGxsId &parentAuthorId,
|
RsGxsId &parentAuthorId,
|
||||||
rstime_t &parentPublishTs,
|
rstime_t &parentPublishTs,
|
||||||
std::string &parentPulseText)
|
std::string &parentPulseText)
|
||||||
:QWidget(NULL), mActions(actions), mPulse(), mGroupName(parentGroupName), mIsOriginal(false)
|
:QWidget(NULL), mActions(actions), mPulse(), mGroupName(parentGroupName)
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
setAttribute ( Qt::WA_DeleteOnClose, true );
|
setAttribute ( Qt::WA_DeleteOnClose, true );
|
||||||
@ -60,6 +62,15 @@ PulseDetails::PulseDetails(PulseHolder *actions,
|
|||||||
setup();
|
setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PulseDetails::setBackground(QString color)
|
||||||
|
{
|
||||||
|
QWidget *tocolor = this;
|
||||||
|
QPalette p = tocolor->palette();
|
||||||
|
p.setColor(tocolor->backgroundRole(), QColor(color));
|
||||||
|
tocolor->setPalette(p);
|
||||||
|
tocolor->setAutoFillBackground(true);
|
||||||
|
}
|
||||||
|
|
||||||
void PulseDetails::setup()
|
void PulseDetails::setup()
|
||||||
{
|
{
|
||||||
connect(toolButton_expand, SIGNAL(clicked()), this, SLOT(toggle()));
|
connect(toolButton_expand, SIGNAL(clicked()), this, SLOT(toggle()));
|
||||||
@ -77,6 +88,47 @@ void PulseDetails::setup()
|
|||||||
// label_icon->setText();
|
// label_icon->setText();
|
||||||
textBrowser->setPlainText(QString::fromStdString(mPulse.mPulseText));
|
textBrowser->setPlainText(QString::fromStdString(mPulse.mPulseText));
|
||||||
frame_expand->setVisible(false);
|
frame_expand->setVisible(false);
|
||||||
|
|
||||||
|
label_replies->setText("");
|
||||||
|
frame_replies->setVisible(false);
|
||||||
|
mHasReplies = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PulseDetails::addReplies(std::map<rstime_t, RsWirePulse *> replies)
|
||||||
|
{
|
||||||
|
if (replies.size() == 0)
|
||||||
|
{
|
||||||
|
// do nothing.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (replies.size() == 1)
|
||||||
|
{
|
||||||
|
label_replies->setText("1 reply");
|
||||||
|
}
|
||||||
|
else if (replies.size() > 1)
|
||||||
|
{
|
||||||
|
label_replies->setText(QString("%1 replies").arg(replies.size()));
|
||||||
|
}
|
||||||
|
|
||||||
|
// add extra widgets into layout.
|
||||||
|
QLayout *vbox = frame_replies->layout();
|
||||||
|
mHasReplies = true;
|
||||||
|
|
||||||
|
std::map<rstime_t, RsWirePulse *> emptyReplies;
|
||||||
|
std::map<rstime_t, RsWirePulse *>::reverse_iterator it;
|
||||||
|
for (it = replies.rbegin(); it != replies.rend(); it++)
|
||||||
|
{
|
||||||
|
// add Ref as child reply.
|
||||||
|
PulseDetails *pd = new PulseDetails(mActions,
|
||||||
|
it->second->mRefGroupId,
|
||||||
|
it->second->mRefGroupName,
|
||||||
|
it->second->mRefOrigMsgId,
|
||||||
|
it->second->mRefAuthorId,
|
||||||
|
it->second->mRefPublishTs,
|
||||||
|
it->second->mRefPulseText);
|
||||||
|
pd->setBackground("goldenrod");
|
||||||
|
vbox->addWidget(pd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -86,10 +138,14 @@ void PulseDetails::toggle()
|
|||||||
// switch to minimal view.
|
// switch to minimal view.
|
||||||
label_summary->setVisible(true);
|
label_summary->setVisible(true);
|
||||||
frame_expand->setVisible(false);
|
frame_expand->setVisible(false);
|
||||||
|
frame_replies->setVisible(false);
|
||||||
} else {
|
} else {
|
||||||
// switch to expanded view.
|
// switch to expanded view.
|
||||||
label_summary->setVisible(false);
|
label_summary->setVisible(false);
|
||||||
frame_expand->setVisible(true);
|
frame_expand->setVisible(true);
|
||||||
|
if (mHasReplies) {
|
||||||
|
frame_replies->setVisible(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,8 @@ class PulseDetails : public QWidget, private Ui::PulseDetails
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PulseDetails(PulseHolder *actions, RsWirePulse &pulse, std::string &groupName, bool is_original);
|
PulseDetails(PulseHolder *actions, RsWirePulse *pulse, std::string &groupName,
|
||||||
|
std::map<rstime_t, RsWirePulse *> replies);
|
||||||
|
|
||||||
// when Reply parent....
|
// when Reply parent....
|
||||||
PulseDetails(PulseHolder *actions,
|
PulseDetails(PulseHolder *actions,
|
||||||
@ -44,6 +45,8 @@ public:
|
|||||||
|
|
||||||
void setup();
|
void setup();
|
||||||
|
|
||||||
|
void setBackground(QString color);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void toggle();
|
void toggle();
|
||||||
void follow();
|
void follow();
|
||||||
@ -51,12 +54,13 @@ private slots:
|
|||||||
void reply();
|
void reply();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void addReplies(std::map<rstime_t, RsWirePulse *> replies);
|
||||||
QString getSummary();
|
QString getSummary();
|
||||||
|
|
||||||
PulseHolder *mActions;
|
PulseHolder *mActions;
|
||||||
RsWirePulse mPulse;
|
RsWirePulse mPulse;
|
||||||
std::string mGroupName;
|
std::string mGroupName;
|
||||||
bool mIsOriginal;
|
bool mHasReplies;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -6,14 +6,14 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>750</width>
|
<width>807</width>
|
||||||
<height>166</height>
|
<height>231</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
@ -47,9 +47,9 @@
|
|||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="GxsIdLabel" name="label_idName">
|
<widget class="QLabel" name="label_replies">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>idLabel</string>
|
<string># replies</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -69,7 +69,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_summary">
|
<widget class="QLabel" name="label_summary">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Summary Text/ date</string>
|
<string>Summary Text</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -92,7 +92,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_date">
|
<widget class="QLabel" name="label_date">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>TextLabel</string>
|
<string>DateTime 02/02/20</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -134,6 +134,13 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="GxsIdLabel" name="label_idName">
|
||||||
|
<property name="text">
|
||||||
|
<string>idLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_icon">
|
<widget class="QLabel" name="label_icon">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
@ -171,6 +178,57 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_4">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Preferred</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>30</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QFrame" name="frame_replies">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Replies</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
|
@ -44,40 +44,42 @@ PulseItem::PulseItem(PulseHolder *holder, std::string path)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PulseItem::PulseItem(PulseHolder *holder, RsWirePulse &pulse, RsWireGroup &group)
|
PulseItem::PulseItem(PulseHolder *holder, RsWirePulse *pulse_ptr, RsWireGroup *group_ptr, std::map<rstime_t, RsWirePulse *> replies)
|
||||||
:QWidget(NULL), mHolder(holder), mType(0)
|
:QWidget(NULL), mHolder(holder), mPulse(*pulse_ptr), mType(0)
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
setAttribute ( Qt::WA_DeleteOnClose, true );
|
setAttribute ( Qt::WA_DeleteOnClose, true );
|
||||||
QWidget *pulse_widget = widget_parent; // default msg goes into widget_parent.
|
QWidget *pulse_widget = widget_parent; // default msg goes into widget_parent.
|
||||||
|
|
||||||
/* if it is a reply */
|
/* if it is a reply */
|
||||||
if (pulse.mPulseType & WIRE_PULSE_TYPE_REPLY_MSG) {
|
if (mPulse.mPulseType & WIRE_PULSE_TYPE_REPLY_MSG) {
|
||||||
|
|
||||||
std::cerr << "Installing Reply Msg";
|
std::cerr << "Installing Reply Msg";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
std::cerr << "GroupID: " << pulse.mRefGroupId;
|
std::cerr << "GroupID: " << mPulse.mRefGroupId;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
std::cerr << "GroupName: " << pulse.mRefGroupName;
|
std::cerr << "GroupName: " << mPulse.mRefGroupName;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
std::cerr << "OrigMsgId: " << pulse.mRefOrigMsgId;
|
std::cerr << "OrigMsgId: " << mPulse.mRefOrigMsgId;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
std::cerr << "AuthorId: " << pulse.mRefAuthorId;
|
std::cerr << "AuthorId: " << mPulse.mRefAuthorId;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
std::cerr << "PublishTs: " << pulse.mRefPublishTs;
|
std::cerr << "PublishTs: " << mPulse.mRefPublishTs;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
std::cerr << "PulseText: " << pulse.mRefPulseText;
|
std::cerr << "PulseText: " << mPulse.mRefPulseText;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
// fill in the parent.
|
// fill in the parent.
|
||||||
PulseDetails *parent = new PulseDetails(
|
PulseDetails *parent = new PulseDetails(
|
||||||
mHolder,
|
mHolder,
|
||||||
pulse.mRefGroupId,
|
mPulse.mRefGroupId,
|
||||||
pulse.mRefGroupName,
|
mPulse.mRefGroupName,
|
||||||
pulse.mRefOrigMsgId,
|
mPulse.mRefOrigMsgId,
|
||||||
pulse.mRefAuthorId,
|
mPulse.mRefAuthorId,
|
||||||
pulse.mRefPublishTs,
|
mPulse.mRefPublishTs,
|
||||||
pulse.mRefPulseText);
|
mPulse.mRefPulseText);
|
||||||
|
|
||||||
|
parent->setBackground("sienna");
|
||||||
|
|
||||||
// add extra widget into layout.
|
// add extra widget into layout.
|
||||||
QVBoxLayout *vbox = new QVBoxLayout();
|
QVBoxLayout *vbox = new QVBoxLayout();
|
||||||
@ -88,45 +90,8 @@ PulseItem::PulseItem(PulseHolder *holder, RsWirePulse &pulse, RsWireGroup &group
|
|||||||
// if its a reply, the real msg goes into reply slot.
|
// if its a reply, the real msg goes into reply slot.
|
||||||
pulse_widget = widget_reply;
|
pulse_widget = widget_reply;
|
||||||
}
|
}
|
||||||
else if (pulse.mPulseType & WIRE_PULSE_TYPE_REPLY_REFERENCE)
|
else
|
||||||
{
|
{
|
||||||
// THIS IS A FAKE ONE... LEAVE IN UNTIL ITS HANDLED ELSEWHERE.
|
|
||||||
// NB: PARENT PublishTS and AuthorID appear wrong...
|
|
||||||
|
|
||||||
std::cerr << "Installing Ref Msg";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
std::cerr << "GroupID: " << pulse.mRefGroupId;
|
|
||||||
std::cerr << std::endl;
|
|
||||||
std::cerr << "GroupName: " << pulse.mRefGroupName;
|
|
||||||
std::cerr << std::endl;
|
|
||||||
std::cerr << "OrigMsgId: " << pulse.mRefOrigMsgId;
|
|
||||||
std::cerr << std::endl;
|
|
||||||
std::cerr << "AuthorId: " << pulse.mRefAuthorId;
|
|
||||||
std::cerr << std::endl;
|
|
||||||
std::cerr << "PublishTs: " << pulse.mRefPublishTs;
|
|
||||||
std::cerr << std::endl;
|
|
||||||
std::cerr << "PulseText: " << pulse.mRefPulseText;
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
// fill in the parent.
|
|
||||||
PulseDetails *parent = new PulseDetails(
|
|
||||||
mHolder,
|
|
||||||
pulse.mRefGroupId,
|
|
||||||
pulse.mRefGroupName,
|
|
||||||
pulse.mRefOrigMsgId,
|
|
||||||
pulse.mRefAuthorId,
|
|
||||||
pulse.mRefPublishTs,
|
|
||||||
pulse.mRefPulseText);
|
|
||||||
|
|
||||||
// add extra widget into layout.
|
|
||||||
QVBoxLayout *vbox = new QVBoxLayout();
|
|
||||||
vbox->addWidget(parent);
|
|
||||||
vbox->setContentsMargins(0,0,0,0);
|
|
||||||
widget_reply->setLayout(vbox);
|
|
||||||
|
|
||||||
// if its a REF, the real msg goes into parent slot.
|
|
||||||
pulse_widget = widget_parent;
|
|
||||||
} else {
|
|
||||||
// ORIGINAL PULSE.
|
// ORIGINAL PULSE.
|
||||||
// hide widget_reply, as it will be empty.
|
// hide widget_reply, as it will be empty.
|
||||||
widget_reply->setVisible(false);
|
widget_reply->setVisible(false);
|
||||||
@ -135,7 +100,7 @@ PulseItem::PulseItem(PulseHolder *holder, RsWirePulse &pulse, RsWireGroup &group
|
|||||||
{
|
{
|
||||||
std::cerr << "Adding Main Message";
|
std::cerr << "Adding Main Message";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
PulseDetails *details = new PulseDetails(mHolder, pulse, group.mMeta.mGroupName, true);
|
PulseDetails *details = new PulseDetails(mHolder, &mPulse, group_ptr->mMeta.mGroupName, replies);
|
||||||
|
|
||||||
// add extra widget into layout.
|
// add extra widget into layout.
|
||||||
QVBoxLayout *vbox = new QVBoxLayout();
|
QVBoxLayout *vbox = new QVBoxLayout();
|
||||||
@ -144,10 +109,13 @@ PulseItem::PulseItem(PulseHolder *holder, RsWirePulse &pulse, RsWireGroup &group
|
|||||||
vbox->setContentsMargins(0,0,0,0);
|
vbox->setContentsMargins(0,0,0,0);
|
||||||
pulse_widget->setLayout(vbox);
|
pulse_widget->setLayout(vbox);
|
||||||
pulse_widget->setVisible(true);
|
pulse_widget->setVisible(true);
|
||||||
// details->toggle();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rstime_t PulseItem::publishTs()
|
||||||
|
{
|
||||||
|
return mPulse.mMeta.mPublishTs;
|
||||||
|
}
|
||||||
|
|
||||||
void PulseItem::removeItem()
|
void PulseItem::removeItem()
|
||||||
{
|
{
|
||||||
@ -178,6 +146,8 @@ void PulseItem::mousePressEvent(QMouseEvent *event)
|
|||||||
setSelected(true);
|
setSelected(true);
|
||||||
|
|
||||||
QWidget::mousePressEvent(event);
|
QWidget::mousePressEvent(event);
|
||||||
|
|
||||||
|
mHolder->notifyPulseSelection(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
const QPixmap *PulseItem::getPixmap()
|
const QPixmap *PulseItem::getPixmap()
|
||||||
|
@ -32,7 +32,7 @@ class PulseHolder
|
|||||||
public:
|
public:
|
||||||
virtual ~PulseHolder() {}
|
virtual ~PulseHolder() {}
|
||||||
virtual void deletePulseItem(PulseItem *, uint32_t ptype) = 0;
|
virtual void deletePulseItem(PulseItem *, uint32_t ptype) = 0;
|
||||||
virtual void notifySelection(PulseItem *item, int ptype) = 0;
|
virtual void notifyPulseSelection(PulseItem *item) = 0;
|
||||||
|
|
||||||
// Actions.
|
// Actions.
|
||||||
virtual void follow(RsGxsGroupId &groupId) = 0;
|
virtual void follow(RsGxsGroupId &groupId) = 0;
|
||||||
@ -47,8 +47,9 @@ class PulseItem : public QWidget, private Ui::PulseItem
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
PulseItem(PulseHolder *holder, std::string url);
|
PulseItem(PulseHolder *holder, std::string url);
|
||||||
PulseItem(PulseHolder *holder, RsWirePulse &pulse, RsWireGroup &group);
|
PulseItem(PulseHolder *holder, RsWirePulse *pulse_ptr, RsWireGroup *group_ptr, std::map<rstime_t, RsWirePulse *> replies);
|
||||||
|
|
||||||
|
rstime_t publishTs();
|
||||||
void removeItem();
|
void removeItem();
|
||||||
|
|
||||||
void setSelected(bool on);
|
void setSelected(bool on);
|
||||||
|
@ -25,6 +25,18 @@
|
|||||||
<string notr="true"/>
|
<string notr="true"/>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QFrame" name="frame">
|
<widget class="QFrame" name="frame">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -52,6 +64,21 @@ border-radius: 10px}</string>
|
|||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Raised</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
@ -81,7 +108,7 @@ border-radius: 10px}</string>
|
|||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>10</width>
|
<width>10</width>
|
||||||
<height>40</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
@ -93,8 +120,8 @@ border-radius: 10px}</string>
|
|||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>50</width>
|
<width>30</width>
|
||||||
<height>20</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
@ -113,8 +140,8 @@ border-radius: 10px}</string>
|
|||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>50</width>
|
<width>30</width>
|
||||||
<height>20</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
@ -127,7 +154,7 @@ border-radius: 10px}</string>
|
|||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>10</width>
|
<width>10</width>
|
||||||
<height>40</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
|
@ -37,10 +37,20 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define GROUP_SET_ALL (0)
|
||||||
|
#define GROUP_SET_OWN (1)
|
||||||
|
#define GROUP_SET_SUBSCRIBED (2)
|
||||||
|
#define GROUP_SET_AUTO (3)
|
||||||
|
#define GROUP_SET_RECOMMENDED (4)
|
||||||
|
#define GROUP_SET_OTHERS (5)
|
||||||
|
|
||||||
|
|
||||||
|
#define WIRE_TOKEN_TYPE_SUBSCRIBE_CHANGE 1
|
||||||
|
|
||||||
|
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
WireDialog::WireDialog(QWidget *parent)
|
WireDialog::WireDialog(QWidget *parent)
|
||||||
: MainPage(parent)
|
: MainPage(parent), mGroupSet(GROUP_SET_ALL)
|
||||||
{
|
{
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
|
|
||||||
@ -52,6 +62,8 @@ WireDialog::WireDialog(QWidget *parent)
|
|||||||
connect( ui.pushButton_Post, SIGNAL(clicked()), this, SLOT(createPulse()));
|
connect( ui.pushButton_Post, SIGNAL(clicked()), this, SLOT(createPulse()));
|
||||||
connect( ui.toolButton_refresh, SIGNAL(clicked()), this, SLOT(refreshGroups()));
|
connect( ui.toolButton_refresh, SIGNAL(clicked()), this, SLOT(refreshGroups()));
|
||||||
|
|
||||||
|
connect(ui.comboBox_groupSet, SIGNAL(currentIndexChanged(int)), this, SLOT(selectGroupSet(int)));
|
||||||
|
|
||||||
QTimer *timer = new QTimer(this);
|
QTimer *timer = new QTimer(this);
|
||||||
timer->connect(timer, SIGNAL(timeout()), this, SLOT(checkUpdate()));
|
timer->connect(timer, SIGNAL(timeout()), this, SLOT(checkUpdate()));
|
||||||
timer->start(1000);
|
timer->start(1000);
|
||||||
@ -67,12 +79,6 @@ void WireDialog::refreshGroups()
|
|||||||
requestGroupData();
|
requestGroupData();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WireDialog::addItem(QWidget *item)
|
|
||||||
{
|
|
||||||
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
|
|
||||||
alayout->addWidget(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void WireDialog::addGroup(QWidget *item)
|
void WireDialog::addGroup(QWidget *item)
|
||||||
{
|
{
|
||||||
@ -81,19 +87,11 @@ void WireDialog::addGroup(QWidget *item)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// PulseHolder interface.
|
// PulseHolder interface.
|
||||||
void WireDialog::deletePulseItem(PulseItem *item, uint32_t type)
|
void WireDialog::deletePulseItem(PulseItem * /* item */, uint32_t /* type */)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WireDialog::notifySelection(PulseItem *item, int ptype)
|
|
||||||
{
|
|
||||||
std::cerr << "WireDialog::notifySelection() from : " << ptype << " " << item;
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
notifyPulseSelection(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Actions from PulseHolder.
|
// Actions from PulseHolder.
|
||||||
void WireDialog::follow(RsGxsGroupId &groupId)
|
void WireDialog::follow(RsGxsGroupId &groupId)
|
||||||
@ -148,9 +146,6 @@ void WireDialog::reply(RsWirePulse &pulse, std::string &groupName)
|
|||||||
|
|
||||||
void WireDialog::notifyPulseSelection(PulseItem *item)
|
void WireDialog::notifyPulseSelection(PulseItem *item)
|
||||||
{
|
{
|
||||||
std::cerr << "WireDialog::notifyPulseSelection() from : " << item;
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
if (mPulseSelected)
|
if (mPulseSelected)
|
||||||
{
|
{
|
||||||
std::cerr << "WireDialog::notifyPulseSelection() unselecting old one : " << mPulseSelected;
|
std::cerr << "WireDialog::notifyPulseSelection() unselecting old one : " << mPulseSelected;
|
||||||
@ -158,11 +153,42 @@ void WireDialog::notifyPulseSelection(PulseItem *item)
|
|||||||
|
|
||||||
mPulseSelected->setSelected(false);
|
mPulseSelected->setSelected(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
mPulseSelected = item;
|
mPulseSelected = item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void WireDialog::subscribe(RsGxsGroupId &groupId)
|
||||||
|
{
|
||||||
|
uint32_t token;
|
||||||
|
rsWire->subscribeToGroup(token, groupId, true);
|
||||||
|
mWireQueue->queueRequest(token, TOKENREQ_GROUPINFO, RS_TOKREQ_ANSTYPE_ACK, WIRE_TOKEN_TYPE_SUBSCRIBE_CHANGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WireDialog::unsubscribe(RsGxsGroupId &groupId)
|
||||||
|
{
|
||||||
|
uint32_t token;
|
||||||
|
rsWire->subscribeToGroup(token, groupId, false);
|
||||||
|
mWireQueue->queueRequest(token, TOKENREQ_GROUPINFO, RS_TOKREQ_ANSTYPE_ACK, WIRE_TOKEN_TYPE_SUBSCRIBE_CHANGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WireDialog::notifyGroupSelection(WireGroupItem *item)
|
||||||
|
{
|
||||||
|
std::cerr << "WireDialog::notifyGroupSelection() from : " << item;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
if (mGroupSelected)
|
||||||
|
{
|
||||||
|
std::cerr << "WireDialog::notifyGroupSelection() unselecting old one : " << mGroupSelected;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
mGroupSelected->setSelected(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
mGroupSelected = item;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void WireDialog::checkUpdate()
|
void WireDialog::checkUpdate()
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
@ -180,7 +206,7 @@ void WireDialog::checkUpdate()
|
|||||||
|
|
||||||
void WireDialog::createGroup()
|
void WireDialog::createGroup()
|
||||||
{
|
{
|
||||||
WireGroupDialog wireCreate(mWireQueue, this);
|
WireGroupDialog wireCreate(this);
|
||||||
wireCreate.exec();
|
wireCreate.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,22 +233,55 @@ void WireDialog::createPulse()
|
|||||||
mAddDialog->show();
|
mAddDialog->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WireDialog::addPulse(RsWirePulse &pulse, RsWireGroup &group)
|
void WireDialog::addPulse(RsWirePulse *pulse, RsWireGroup *group,
|
||||||
|
std::map<rstime_t, RsWirePulse *> replies)
|
||||||
{
|
{
|
||||||
std::cerr << "WireDialog::addPulse() GroupId : " << pulse.mMeta.mGroupId;
|
std::cerr << "WireDialog::addPulse() GroupId : " << pulse->mMeta.mGroupId;
|
||||||
std::cerr << " MsgId : " << pulse.mMeta.mGroupId;
|
std::cerr << " OrigMsgId : " << pulse->mMeta.mOrigMsgId;
|
||||||
|
std::cerr << " Replies : " << replies.size();
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
QWidget *item = new PulseItem(this, pulse, group);
|
PulseItem *pulseItem = new PulseItem(this, pulse, group, replies);
|
||||||
addItem(item);
|
|
||||||
|
/* ensure its a boxlayout */
|
||||||
|
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
|
||||||
|
QBoxLayout *boxlayout = dynamic_cast<QBoxLayout *>(alayout);
|
||||||
|
if (boxlayout == NULL) {
|
||||||
|
std::cerr << "WireDialog::addPulse() ERROR not boxlayout, inserting at end";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
alayout->addWidget(pulseItem);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* iterate through layout, and insert at the correct time */
|
||||||
|
for(int i = 0; i < alayout->count(); i++)
|
||||||
|
{
|
||||||
|
QLayoutItem *layoutItem = boxlayout->itemAt(i);
|
||||||
|
PulseItem *pitem = dynamic_cast<PulseItem *>(layoutItem->widget());
|
||||||
|
if (pitem != NULL)
|
||||||
|
{
|
||||||
|
if (pitem->publishTs() < pulseItem->publishTs())
|
||||||
|
{
|
||||||
|
std::cerr << "WireDialog::addPulse() Inserting at index: " << i;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
/* insert at this index */
|
||||||
|
boxlayout->insertWidget(i, pulseItem);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// last item.
|
||||||
|
std::cerr << "WireDialog::addPulse() Inserting at end";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
boxlayout->addWidget(pulseItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WireDialog::addGroup(RsWireGroup &group)
|
void WireDialog::addGroup(const RsWireGroup &group)
|
||||||
{
|
{
|
||||||
std::cerr << "WireDialog::addGroup() GroupId : " << group.mMeta.mGroupId;
|
std::cerr << "WireDialog::addGroup() GroupId : " << group.mMeta.mGroupId;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
addGroup(new WireGroupItem(group));
|
addGroup(new WireGroupItem(this, group));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WireDialog::deletePulses()
|
void WireDialog::deletePulses()
|
||||||
@ -261,11 +320,6 @@ void WireDialog::deleteGroups()
|
|||||||
std::cerr << "WireDialog::deleteGroups()";
|
std::cerr << "WireDialog::deleteGroups()";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
mAllGroups.clear();
|
|
||||||
mOwnGroups.clear();
|
|
||||||
ui.groupChooser->clear();
|
|
||||||
|
|
||||||
|
|
||||||
QLayout *alayout = ui.scrollAreaWidgetContents_groups->layout();
|
QLayout *alayout = ui.scrollAreaWidgetContents_groups->layout();
|
||||||
QLayoutItem *item;
|
QLayoutItem *item;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@ -294,6 +348,10 @@ void WireDialog::deleteGroups()
|
|||||||
|
|
||||||
void WireDialog::updateGroups(std::vector<RsWireGroup>& groups)
|
void WireDialog::updateGroups(std::vector<RsWireGroup>& groups)
|
||||||
{
|
{
|
||||||
|
mAllGroups.clear();
|
||||||
|
mOwnGroups.clear();
|
||||||
|
ui.groupChooser->clear();
|
||||||
|
|
||||||
std::vector<RsWireGroup>::const_iterator it;
|
std::vector<RsWireGroup>::const_iterator it;
|
||||||
for(it = groups.begin(); it != groups.end(); it++) {
|
for(it = groups.begin(); it != groups.end(); it++) {
|
||||||
// save list of all groups.
|
// save list of all groups.
|
||||||
@ -310,8 +368,62 @@ void WireDialog::updateGroups(std::vector<RsWireGroup>& groups)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// LOAD DATA...............................................
|
void WireDialog::selectGroupSet(int index)
|
||||||
|
{
|
||||||
|
std::cerr << "WireDialog::selectGroupSet(" << index << ")";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
mGroupSet = index;
|
||||||
|
if (mGroupSet < 0) {
|
||||||
|
mGroupSet = GROUP_SET_ALL;
|
||||||
|
}
|
||||||
|
showGroups();
|
||||||
|
}
|
||||||
|
|
||||||
|
void WireDialog::showGroups()
|
||||||
|
{
|
||||||
|
deleteGroups();
|
||||||
|
deletePulses();
|
||||||
|
|
||||||
|
/* depends on the comboBox */
|
||||||
|
std::map<RsGxsGroupId, RsWireGroup>::const_iterator it;
|
||||||
|
for (it = mAllGroups.begin(); it != mAllGroups.end(); it++)
|
||||||
|
{
|
||||||
|
bool add = (mGroupSet == GROUP_SET_ALL);
|
||||||
|
if (it->second.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN) {
|
||||||
|
if (mGroupSet == GROUP_SET_OWN) {
|
||||||
|
add = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (it->second.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED) {
|
||||||
|
if (mGroupSet == GROUP_SET_SUBSCRIBED) {
|
||||||
|
add = true;
|
||||||
|
}
|
||||||
|
if (mGroupSet == GROUP_SET_AUTO) {
|
||||||
|
add = true;
|
||||||
|
}
|
||||||
|
if (mGroupSet == GROUP_SET_RECOMMENDED) {
|
||||||
|
add = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (mGroupSet == GROUP_SET_OTHERS) {
|
||||||
|
add = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (add) {
|
||||||
|
addGroup(it->second);
|
||||||
|
// request data.
|
||||||
|
std::list<RsGxsGroupId> grpIds;
|
||||||
|
grpIds.push_back(it->second.mMeta.mGroupId);
|
||||||
|
requestPulseData(grpIds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// LOAD DATA...............................................
|
||||||
|
|
||||||
void WireDialog::requestGroupData()
|
void WireDialog::requestGroupData()
|
||||||
{
|
{
|
||||||
@ -329,29 +441,12 @@ bool WireDialog::loadGroupData(const uint32_t &token)
|
|||||||
std::cerr << "WireDialog::loadGroupData()";
|
std::cerr << "WireDialog::loadGroupData()";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
deleteGroups();
|
|
||||||
deletePulses();
|
|
||||||
|
|
||||||
std::vector<RsWireGroup> groups;
|
std::vector<RsWireGroup> groups;
|
||||||
rsWire->getGroupData(token, groups);
|
rsWire->getGroupData(token, groups);
|
||||||
|
|
||||||
std::vector<RsWireGroup>::iterator vit = groups.begin();
|
|
||||||
|
|
||||||
for(; vit != groups.end(); ++vit)
|
|
||||||
{
|
|
||||||
RsWireGroup& group = *vit;
|
|
||||||
|
|
||||||
std::cerr << " WireDialog::addGroup() GroupId: " << group.mMeta.mGroupId << std::endl;
|
|
||||||
|
|
||||||
addGroup(group);
|
|
||||||
|
|
||||||
std::list<RsGxsGroupId> grpIds;
|
|
||||||
grpIds.push_back(group.mMeta.mGroupId);
|
|
||||||
requestPulseData(grpIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
// save list of groups.
|
// save list of groups.
|
||||||
updateGroups(groups);
|
updateGroups(groups);
|
||||||
|
showGroups();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -367,43 +462,168 @@ void WireDialog::requestPulseData(const std::list<RsGxsGroupId>& grpIds)
|
|||||||
mWireQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds, 0);
|
mWireQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* LoadPulseData...
|
||||||
|
*
|
||||||
|
* group into threads, using std::map<RsGxsMessageId, PulseReplySet>
|
||||||
|
* then sort by publishTS, using std::map<time, PulseOrderedReply>
|
||||||
|
* then add into gui.
|
||||||
|
* - use pointers to avoid copying everywhere.
|
||||||
|
*
|
||||||
|
* should we mutex Groups, or copy so we don't lose a pointer?
|
||||||
|
* should be fine, as mAllGroups only modified from loadData calls.
|
||||||
|
******
|
||||||
|
*
|
||||||
|
* NB: Potentially, this should be changed to use GXS to do the bulk of the work.
|
||||||
|
* - request Top-Level Msgs, sorted by PublishTS.
|
||||||
|
* - Insert into GUI.
|
||||||
|
* - for each request children Msg, and fill in "replies"
|
||||||
|
*
|
||||||
|
* This needs sorted option on GXS Data fetch.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class PulseReplySet
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PulseReplySet() : group(NULL), msg(NULL) {}
|
||||||
|
PulseReplySet(RsWirePulse *m, RsWireGroup *g)
|
||||||
|
: group(g), msg(m) {}
|
||||||
|
|
||||||
|
RsWireGroup *group;
|
||||||
|
RsWirePulse *msg;
|
||||||
|
std::map<RsGxsMessageId, RsWirePulse *> replies; // orig ID -> replies.
|
||||||
|
};
|
||||||
|
|
||||||
|
class PulseOrderedReply
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PulseOrderedReply() : group(NULL), msg(NULL) {}
|
||||||
|
PulseOrderedReply(RsWirePulse *m, RsWireGroup *g)
|
||||||
|
: group(g), msg(m) {}
|
||||||
|
|
||||||
|
RsWireGroup *group;
|
||||||
|
RsWirePulse *msg;
|
||||||
|
std::map<rstime_t, RsWirePulse *> replies; // publish -> replies.
|
||||||
|
};
|
||||||
|
|
||||||
bool WireDialog::loadPulseData(const uint32_t &token)
|
bool WireDialog::loadPulseData(const uint32_t &token)
|
||||||
{
|
{
|
||||||
std::cerr << "WireDialog::loadPulseData()";
|
std::cerr << "WireDialog::loadPulseData()";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
// clearPulses();
|
|
||||||
|
|
||||||
std::vector<RsWirePulse> pulses;
|
std::vector<RsWirePulse> pulses;
|
||||||
rsWire->getPulseData(token, pulses);
|
rsWire->getPulseData(token, pulses);
|
||||||
|
|
||||||
|
std::list<RsWirePulse *> references;
|
||||||
|
std::map<RsGxsMessageId, PulseReplySet> pulseGrouping;
|
||||||
|
|
||||||
std::vector<RsWirePulse>::iterator vit = pulses.begin();
|
std::vector<RsWirePulse>::iterator vit = pulses.begin();
|
||||||
for(; vit != pulses.end(); vit++)
|
for(; vit != pulses.end(); vit++)
|
||||||
{
|
{
|
||||||
RsWirePulse& pulse = *vit;
|
RsWirePulse& pulse = *vit;
|
||||||
|
if (pulse.mPulseType & WIRE_PULSE_TYPE_REPLY_REFERENCE)
|
||||||
RsGxsGroupId &gid = pulse.mMeta.mGroupId;
|
|
||||||
std::map<RsGxsGroupId, RsWireGroup>::iterator mit = mAllGroups.find(gid);
|
|
||||||
if (mit != mAllGroups.end())
|
|
||||||
{
|
{
|
||||||
RsWireGroup &group = mit->second;
|
// store references to add in later.
|
||||||
addPulse(pulse, group);
|
std::cerr << "WireDialog::loadPulseData() REF: GroupId: " << pulse.mMeta.mGroupId;
|
||||||
std::cerr << "WireDialog::loadPulseData() GroupId: " << pulse.mMeta.mGroupId;
|
|
||||||
std::cerr << " PulseId: " << pulse.mMeta.mMsgId;
|
std::cerr << " PulseId: " << pulse.mMeta.mMsgId;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
references.push_back(&pulse);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cerr << "WireDialog::loadPulseData() ERROR Missing GroupId: " << pulse.mMeta.mGroupId;
|
RsGxsGroupId &gid = pulse.mMeta.mGroupId;
|
||||||
std::cerr << " PulseId: " << pulse.mMeta.mMsgId;
|
std::map<RsGxsGroupId, RsWireGroup>::iterator git = mAllGroups.find(gid);
|
||||||
std::cerr << std::endl;
|
if (git != mAllGroups.end())
|
||||||
|
{
|
||||||
|
RsWireGroup &group = git->second;
|
||||||
|
std::cerr << "WireDialog::loadPulseData() MSG: GroupId: " << pulse.mMeta.mGroupId;
|
||||||
|
std::cerr << " PulseId: " << pulse.mMeta.mMsgId;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
// install into pulseGrouping.
|
||||||
|
pulseGrouping[pulse.mMeta.mOrigMsgId] = PulseReplySet(&pulse, &group);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cerr << "WireDialog::loadPulseData() ERROR Missing GroupId: " << pulse.mMeta.mGroupId;
|
||||||
|
std::cerr << " PulseId: " << pulse.mMeta.mMsgId;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// updatePulses();
|
// add references.
|
||||||
|
std::list<RsWirePulse *>::iterator lrit;
|
||||||
|
for(lrit = references.begin(); lrit != references.end(); lrit++)
|
||||||
|
{
|
||||||
|
std::map<RsGxsMessageId, PulseReplySet>::iterator pgit;
|
||||||
|
pgit = pulseGrouping.find((*lrit)->mMeta.mThreadId);
|
||||||
|
if (pgit != pulseGrouping.end())
|
||||||
|
{
|
||||||
|
// install into reply map.
|
||||||
|
// TODO handle Edits / Latest MSGS.
|
||||||
|
std::map<RsGxsMessageId, RsWirePulse *>::iterator rmit;
|
||||||
|
rmit = pgit->second.replies.find((*lrit)->mMeta.mOrigMsgId);
|
||||||
|
if (rmit == pgit->second.replies.end())
|
||||||
|
{
|
||||||
|
std::cerr << "WireDialog::loadPulseData() Installing REF: " << (*lrit)->mMeta.mOrigMsgId;
|
||||||
|
std::cerr << " to threadId: " << (*lrit)->mMeta.mThreadId;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
pgit->second.replies[(*lrit)->mMeta.mOrigMsgId] = (*lrit);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cerr << "WireDialog::loadPulseData() ERROR Duplicate reply REF: " << (*lrit)->mMeta.mOrigMsgId;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// no original msg for REF.
|
||||||
|
std::cerr << "WireDialog::loadPulseData() ERROR No matching ThreadId REF: " << (*lrit)->mMeta.mThreadId;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
references.clear();
|
||||||
|
|
||||||
|
// sort by publish time.
|
||||||
|
std::map<rstime_t, PulseOrderedReply> pulseOrdering;
|
||||||
|
std::map<RsGxsMessageId, PulseReplySet>::iterator pgit;
|
||||||
|
for(pgit = pulseGrouping.begin(); pgit != pulseGrouping.end(); pgit++)
|
||||||
|
{
|
||||||
|
PulseOrderedReply &msg = pulseOrdering[pgit->second.msg->mMeta.mPublishTs] =
|
||||||
|
PulseOrderedReply(pgit->second.msg, pgit->second.group);
|
||||||
|
std::map<RsGxsMessageId, RsWirePulse *>::iterator rmit;
|
||||||
|
for(rmit = pgit->second.replies.begin();
|
||||||
|
rmit != pgit->second.replies.end(); rmit++)
|
||||||
|
{
|
||||||
|
msg.replies[rmit->second->mMeta.mPublishTs] = rmit->second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// now add to the GUI.
|
||||||
|
std::map<rstime_t, PulseOrderedReply>::reverse_iterator poit;
|
||||||
|
for (poit = pulseOrdering.rbegin(); poit != pulseOrdering.rend(); poit++)
|
||||||
|
{
|
||||||
|
// add into GUI should insert at correct time point, amongst all other ones.
|
||||||
|
addPulse(poit->second.msg, poit->second.group, poit->second.replies);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WireDialog::acknowledgeGroup(const uint32_t &token, const uint32_t &userType)
|
||||||
|
{
|
||||||
|
/* reload groups */
|
||||||
|
std::cerr << "WireDialog::acknowledgeGroup(usertype: " << userType << ")";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
RsGxsGroupId grpId;
|
||||||
|
rsWire->acknowledgeGrp(token, grpId);
|
||||||
|
|
||||||
|
refreshGroups();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************** Request / Response Filling of Data ************************/
|
/**************************** Request / Response Filling of Data ************************/
|
||||||
|
|
||||||
@ -426,9 +646,9 @@ void WireDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
|||||||
case RS_TOKREQ_ANSTYPE_DATA:
|
case RS_TOKREQ_ANSTYPE_DATA:
|
||||||
loadGroupData(req.mToken);
|
loadGroupData(req.mToken);
|
||||||
break;
|
break;
|
||||||
// case RS_TOKREQ_ANSTYPE_ACK:
|
case RS_TOKREQ_ANSTYPE_ACK:
|
||||||
// acknowledgeGroup(req.mToken);
|
acknowledgeGroup(req.mToken, req.mUserType);
|
||||||
// break;
|
break;
|
||||||
default:
|
default:
|
||||||
std::cerr << "WireDialog::loadRequest() ERROR: GROUP: INVALID ANS TYPE";
|
std::cerr << "WireDialog::loadRequest() ERROR: GROUP: INVALID ANS TYPE";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
@ -29,13 +29,14 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include "gui/TheWire/PulseItem.h"
|
#include "gui/TheWire/PulseItem.h"
|
||||||
|
#include "gui/TheWire/WireGroupItem.h"
|
||||||
#include "gui/TheWire/PulseAddDialog.h"
|
#include "gui/TheWire/PulseAddDialog.h"
|
||||||
|
|
||||||
#include "util/TokenQueue.h"
|
#include "util/TokenQueue.h"
|
||||||
|
|
||||||
#define IMAGE_WIRE ":/icons/wire.png"
|
#define IMAGE_WIRE ":/icons/wire.png"
|
||||||
|
|
||||||
class WireDialog : public MainPage, public TokenResponse, public PulseHolder
|
class WireDialog : public MainPage, public TokenResponse, public PulseHolder, public WireGroupHolder
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -48,13 +49,17 @@ public:
|
|||||||
|
|
||||||
// PulseHolder interface.
|
// PulseHolder interface.
|
||||||
virtual void deletePulseItem(PulseItem *, uint32_t type);
|
virtual void deletePulseItem(PulseItem *, uint32_t type);
|
||||||
virtual void notifySelection(PulseItem *item, int ptype);
|
virtual void notifyPulseSelection(PulseItem *item);
|
||||||
|
|
||||||
virtual void follow(RsGxsGroupId &groupId);
|
virtual void follow(RsGxsGroupId &groupId);
|
||||||
virtual void rate(RsGxsId &authorId);
|
virtual void rate(RsGxsId &authorId);
|
||||||
virtual void reply(RsWirePulse &pulse, std::string &groupName);
|
virtual void reply(RsWirePulse &pulse, std::string &groupName);
|
||||||
|
|
||||||
void notifyPulseSelection(PulseItem *item);
|
|
||||||
|
// WireGroupHolder interface.
|
||||||
|
virtual void subscribe(RsGxsGroupId &groupId);
|
||||||
|
virtual void unsubscribe(RsGxsGroupId &groupId);
|
||||||
|
virtual void notifyGroupSelection(WireGroupItem *item);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
@ -62,31 +67,38 @@ private slots:
|
|||||||
void createPulse();
|
void createPulse();
|
||||||
void checkUpdate();
|
void checkUpdate();
|
||||||
void refreshGroups();
|
void refreshGroups();
|
||||||
|
void selectGroupSet(int index);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void addItem(QWidget *item);
|
|
||||||
void addGroup(QWidget *item);
|
void addGroup(QWidget *item);
|
||||||
|
|
||||||
void addPulse(RsWirePulse &pulse, RsWireGroup &group);
|
void addPulse(RsWirePulse *pulse, RsWireGroup *group,
|
||||||
void addGroup(RsWireGroup &group);
|
std::map<rstime_t, RsWirePulse *> replies);
|
||||||
|
|
||||||
|
void addGroup(const RsWireGroup &group);
|
||||||
|
|
||||||
void deletePulses();
|
void deletePulses();
|
||||||
void deleteGroups();
|
void deleteGroups();
|
||||||
|
void showGroups();
|
||||||
void updateGroups(std::vector<RsWireGroup> &groups);
|
void updateGroups(std::vector<RsWireGroup> &groups);
|
||||||
|
|
||||||
// Loading Data.
|
// Loading Data.
|
||||||
void requestGroupData();
|
void requestGroupData();
|
||||||
bool loadGroupData(const uint32_t &token);
|
bool loadGroupData(const uint32_t &token);
|
||||||
|
void acknowledgeGroup(const uint32_t &token, const uint32_t &userType);
|
||||||
|
|
||||||
void requestPulseData(const std::list<RsGxsGroupId>& grpIds);
|
void requestPulseData(const std::list<RsGxsGroupId>& grpIds);
|
||||||
bool loadPulseData(const uint32_t &token);
|
bool loadPulseData(const uint32_t &token);
|
||||||
|
|
||||||
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||||
|
|
||||||
|
int mGroupSet;
|
||||||
|
|
||||||
PulseAddDialog *mAddDialog;
|
PulseAddDialog *mAddDialog;
|
||||||
|
|
||||||
PulseItem *mPulseSelected;
|
PulseItem *mPulseSelected;
|
||||||
|
WireGroupItem *mGroupSelected;
|
||||||
|
|
||||||
TokenQueue *mWireQueue;
|
TokenQueue *mWireQueue;
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>567</width>
|
<width>434</width>
|
||||||
<height>412</height>
|
<height>412</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -234,7 +234,7 @@
|
|||||||
<widget class="QFrame" name="frame">
|
<widget class="QFrame" name="frame">
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>200</width>
|
<width>400</width>
|
||||||
<height>16777215</height>
|
<height>16777215</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@ -270,7 +270,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>129</width>
|
<width>262</width>
|
||||||
<height>416</height>
|
<height>416</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -296,7 +296,12 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1">
|
<item row="3" column="1">
|
||||||
<widget class="QComboBox" name="comboBox_3">
|
<widget class="QComboBox" name="comboBox_groupSet">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>All</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Yourself</string>
|
<string>Yourself</string>
|
||||||
|
@ -56,13 +56,13 @@ uint32_t WireCreateDefaultsFlags = ( GXS_GROUP_DEFAULTS_DISTRIB_PUBLIC |
|
|||||||
uint32_t WireEditEnabledFlags = WireCreateEnabledFlags;
|
uint32_t WireEditEnabledFlags = WireCreateEnabledFlags;
|
||||||
uint32_t WireEditDefaultsFlags = WireCreateDefaultsFlags;
|
uint32_t WireEditDefaultsFlags = WireCreateDefaultsFlags;
|
||||||
|
|
||||||
WireGroupDialog::WireGroupDialog(TokenQueue *tokenQueue, QWidget *parent)
|
WireGroupDialog::WireGroupDialog(QWidget *parent)
|
||||||
: GxsGroupDialog(tokenQueue, WireCreateEnabledFlags, WireCreateDefaultsFlags, parent)
|
: GxsGroupDialog(WireCreateEnabledFlags, WireCreateDefaultsFlags, parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
WireGroupDialog::WireGroupDialog(TokenQueue *tokenExternalQueue, RsTokenService *tokenService, Mode mode, RsGxsGroupId groupId, QWidget *parent)
|
WireGroupDialog::WireGroupDialog(Mode mode, RsGxsGroupId groupId, QWidget *parent)
|
||||||
: GxsGroupDialog(tokenExternalQueue, tokenService, mode, groupId, WireEditEnabledFlags, WireEditDefaultsFlags, parent)
|
: GxsGroupDialog(mode, groupId, WireEditEnabledFlags, WireEditDefaultsFlags, parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,54 +115,43 @@ void WireGroupDialog::prepareWireGroup(RsWireGroup &group, const RsGroupMetaData
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WireGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta)
|
bool WireGroupDialog::service_createGroup(RsGroupMetaData &meta)
|
||||||
{
|
{
|
||||||
// Specific Function.
|
|
||||||
RsWireGroup grp;
|
RsWireGroup grp;
|
||||||
prepareWireGroup(grp, meta);
|
prepareWireGroup(grp, meta);
|
||||||
|
|
||||||
rsWire->createGroup(token, grp);
|
bool success = rsWire->createGroup(grp);
|
||||||
return true;
|
// TODO createGroup should refresh groupId or Data
|
||||||
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WireGroupDialog::service_EditGroup(uint32_t &token, RsGroupMetaData &editedMeta)
|
bool WireGroupDialog::service_updateGroup(const RsGroupMetaData &editedMeta)
|
||||||
{
|
{
|
||||||
RsWireGroup grp;
|
RsWireGroup grp;
|
||||||
prepareWireGroup(grp, editedMeta);
|
prepareWireGroup(grp, editedMeta);
|
||||||
|
|
||||||
std::cerr << "WireGroupDialog::service_EditGroup() submitting changes";
|
std::cerr << "WireGroupDialog::service_updateGroup() submitting changes";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
// TODO: no interface here, yet.
|
bool success = rsWire->updateGroup(grp);
|
||||||
// rsWire->updateGroup(token, grp);
|
// TODO updateGroup should refresh groupId or Data
|
||||||
return true;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WireGroupDialog::service_loadGroup(uint32_t token, Mode /*mode*/, RsGroupMetaData& groupMetaData, QString &description)
|
bool WireGroupDialog::service_loadGroup(const RsGxsGenericGroupData *data, Mode mode, QString &description)
|
||||||
{
|
{
|
||||||
std::cerr << "WireGroupDialog::service_loadGroup(" << token << ")";
|
std::cerr << "WireGroupDialog::service_loadGroup()";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
std::vector<RsWireGroup> groups;
|
const RsWireGroup *pgroup = dynamic_cast<const RsWireGroup*>(data);
|
||||||
if (!rsWire->getGroupData(token, groups))
|
if (pgroup == nullptr)
|
||||||
{
|
{
|
||||||
std::cerr << "WireGroupDialog::service_loadGroup() Error getting GroupData";
|
std::cerr << "WireGroupDialog::service_loadGroup() Error not a RsWireGroup";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (groups.size() != 1)
|
const RsWireGroup &group = *pgroup;
|
||||||
{
|
|
||||||
std::cerr << "WireGroupDialog::service_loadGroup() Error Group.size() != 1";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::cerr << "WireGroupDialog::service_loadGroup() Unfinished Loading";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
const RsWireGroup &group = groups[0];
|
|
||||||
groupMetaData = group.mMeta;
|
|
||||||
description = QString::fromUtf8(group.mDescription.c_str());
|
description = QString::fromUtf8(group.mDescription.c_str());
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@ -178,3 +167,28 @@ bool WireGroupDialog::service_loadGroup(uint32_t token, Mode /*mode*/, RsGroupMe
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool WireGroupDialog::service_getGroupData(const RsGxsGroupId &grpId, RsGxsGenericGroupData *&data)
|
||||||
|
{
|
||||||
|
std::cerr << "WireGroupDialog::service_getGroupData(" << grpId << ")";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
std::list<RsGxsGroupId> groupIds({grpId});
|
||||||
|
std::vector<RsWireGroup> groups;
|
||||||
|
if (!rsWire->getGroups(groupIds, groups))
|
||||||
|
{
|
||||||
|
std::cerr << "WireGroupDialog::service_loadGroup() Error getting GroupData";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (groups.size() != 1)
|
||||||
|
{
|
||||||
|
std::cerr << "WireGroupDialog::service_loadGroup() Error Group.size() != 1";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
data = new RsWireGroup(groups[0]);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@ -29,15 +29,16 @@ class WireGroupDialog : public GxsGroupDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
WireGroupDialog(TokenQueue *tokenQueue, QWidget *parent);
|
WireGroupDialog(QWidget *parent);
|
||||||
WireGroupDialog(TokenQueue *tokenExternalQueue, RsTokenService *tokenService, Mode mode, RsGxsGroupId groupId, QWidget *parent);
|
WireGroupDialog(Mode mode, RsGxsGroupId groupId, QWidget *parent);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void initUi();
|
virtual void initUi() override;
|
||||||
virtual QPixmap serviceImage();
|
virtual QPixmap serviceImage() override;
|
||||||
virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta);
|
virtual bool service_createGroup(RsGroupMetaData &meta) override;
|
||||||
virtual bool service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData, QString &description);
|
virtual bool service_updateGroup(const RsGroupMetaData &editedMeta) override;
|
||||||
virtual bool service_EditGroup(uint32_t &token, RsGroupMetaData &editedMeta);
|
virtual bool service_loadGroup(const RsGxsGenericGroupData *data, Mode mode, QString &description) override;
|
||||||
|
virtual bool service_getGroupData(const RsGxsGroupId &grpId, RsGxsGenericGroupData *&data) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void prepareWireGroup(RsWireGroup &group, const RsGroupMetaData &meta);
|
void prepareWireGroup(RsWireGroup &group, const RsGroupMetaData &meta);
|
||||||
|
@ -30,8 +30,8 @@
|
|||||||
|
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
|
|
||||||
WireGroupItem::WireGroupItem(RsWireGroup grp)
|
WireGroupItem::WireGroupItem(WireGroupHolder *holder, const RsWireGroup &grp)
|
||||||
:QWidget(NULL), mGroup(grp), mType(0)
|
:QWidget(NULL), mHolder(holder), mGroup(grp)
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
setAttribute ( Qt::WA_DeleteOnClose, true );
|
setAttribute ( Qt::WA_DeleteOnClose, true );
|
||||||
@ -42,10 +42,31 @@ WireGroupItem::WireGroupItem(RsWireGroup grp)
|
|||||||
void WireGroupItem::setup()
|
void WireGroupItem::setup()
|
||||||
{
|
{
|
||||||
label_groupName->setText(QString::fromStdString(mGroup.mMeta.mGroupName));
|
label_groupName->setText(QString::fromStdString(mGroup.mMeta.mGroupName));
|
||||||
// label_authorId->setText(mGroup.mMeta.mAuthorId);
|
label_authorId->setId(mGroup.mMeta.mAuthorId);
|
||||||
frame_details->setVisible(false);
|
frame_details->setVisible(false);
|
||||||
|
|
||||||
connect(toolButton_show, SIGNAL(clicked()), this, SLOT(show()));
|
connect(toolButton_show, SIGNAL(clicked()), this, SLOT(show()));
|
||||||
|
connect(toolButton_subscribe, SIGNAL(clicked()), this, SLOT(subscribe()));
|
||||||
|
setGroupSet();
|
||||||
|
}
|
||||||
|
|
||||||
|
void WireGroupItem::setGroupSet()
|
||||||
|
{
|
||||||
|
if (mGroup.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN) {
|
||||||
|
toolButton_type->setText("Own");
|
||||||
|
toolButton_subscribe->setText("N/A");
|
||||||
|
toolButton_subscribe->setEnabled(false);
|
||||||
|
}
|
||||||
|
else if (mGroup.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED)
|
||||||
|
{
|
||||||
|
toolButton_type->setText("Subcribed");
|
||||||
|
toolButton_subscribe->setText("Unsubcribe");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
toolButton_type->setText("Other");
|
||||||
|
toolButton_subscribe->setText("Subcribe");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WireGroupItem::show()
|
void WireGroupItem::show()
|
||||||
@ -53,12 +74,24 @@ void WireGroupItem::show()
|
|||||||
frame_details->setVisible(!frame_details->isVisible());
|
frame_details->setVisible(!frame_details->isVisible());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WireGroupItem::subscribe()
|
||||||
|
{
|
||||||
|
if (mGroup.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED)
|
||||||
|
{
|
||||||
|
mHolder->unsubscribe(mGroup.mMeta.mGroupId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mHolder->subscribe(mGroup.mMeta.mGroupId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void WireGroupItem::removeItem()
|
void WireGroupItem::removeItem()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void WireGroupItem::setSelected(bool on)
|
void WireGroupItem::setSelected(bool /* on */)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,12 +27,22 @@
|
|||||||
|
|
||||||
class WireGroupItem;
|
class WireGroupItem;
|
||||||
|
|
||||||
|
class WireGroupHolder
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~WireGroupHolder() {}
|
||||||
|
virtual void subscribe(RsGxsGroupId &groupId) = 0;
|
||||||
|
virtual void unsubscribe(RsGxsGroupId &groupId) = 0;
|
||||||
|
|
||||||
|
virtual void notifyGroupSelection(WireGroupItem *item) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
class WireGroupItem : public QWidget, private Ui::WireGroupItem
|
class WireGroupItem : public QWidget, private Ui::WireGroupItem
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
WireGroupItem(RsWireGroup grp);
|
WireGroupItem(WireGroupHolder *holder, const RsWireGroup &grp);
|
||||||
|
|
||||||
void removeItem();
|
void removeItem();
|
||||||
|
|
||||||
@ -43,15 +53,17 @@ public:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void show();
|
void show();
|
||||||
|
void subscribe();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void mousePressEvent(QMouseEvent *event);
|
void mousePressEvent(QMouseEvent *event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setup();
|
void setup();
|
||||||
|
void setGroupSet();
|
||||||
|
|
||||||
|
WireGroupHolder *mHolder;
|
||||||
RsWireGroup mGroup;
|
RsWireGroup mGroup;
|
||||||
uint32_t mType;
|
|
||||||
bool mSelected;
|
bool mSelected;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="toolButton_2">
|
<widget class="QToolButton" name="toolButton_type">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Type</string>
|
<string>Type</string>
|
||||||
</property>
|
</property>
|
||||||
@ -71,7 +71,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_authorId">
|
<widget class="GxsIdLabel" name="label_authorId">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string> GxsIdLabel</string>
|
<string> GxsIdLabel</string>
|
||||||
</property>
|
</property>
|
||||||
@ -91,7 +91,7 @@
|
|||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="toolButton">
|
<widget class="QToolButton" name="toolButton_subscribe">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Sub/Un</string>
|
<string>Sub/Un</string>
|
||||||
</property>
|
</property>
|
||||||
@ -105,6 +105,13 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>GxsIdLabel</class>
|
||||||
|
<extends>QLabel</extends>
|
||||||
|
<header>gui/gxs/GxsIdLabel.h</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
@ -181,7 +181,7 @@ void WikiDialog::OpenOrShowAddGroupDialog()
|
|||||||
|
|
||||||
void WikiDialog::newGroup()
|
void WikiDialog::newGroup()
|
||||||
{
|
{
|
||||||
WikiGroupDialog cf(mWikiQueue, this);
|
WikiGroupDialog cf(this);
|
||||||
cf.exec ();
|
cf.exec ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,7 +195,7 @@ void WikiDialog::showGroupDetails()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
WikiGroupDialog cf(mWikiQueue, rsWiki->getTokenService(), GxsGroupDialog::MODE_SHOW, groupId, this);
|
WikiGroupDialog cf(GxsGroupDialog::MODE_SHOW, groupId, this);
|
||||||
cf.exec ();
|
cf.exec ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,7 +209,7 @@ void WikiDialog::editGroupDetails()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
WikiGroupDialog cf(mWikiQueue, rsWiki->getTokenService(), GxsGroupDialog::MODE_EDIT, groupId, this);
|
WikiGroupDialog cf(GxsGroupDialog::MODE_EDIT, groupId, this);
|
||||||
cf.exec ();
|
cf.exec ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,13 +54,13 @@ uint32_t WikiCreateDefaultsFlags = ( GXS_GROUP_DEFAULTS_DISTRIB_PUBLIC |
|
|||||||
uint32_t WikiEditDefaultsFlags = WikiCreateDefaultsFlags;
|
uint32_t WikiEditDefaultsFlags = WikiCreateDefaultsFlags;
|
||||||
uint32_t WikiEditEnabledFlags = WikiCreateEnabledFlags;
|
uint32_t WikiEditEnabledFlags = WikiCreateEnabledFlags;
|
||||||
|
|
||||||
WikiGroupDialog::WikiGroupDialog(TokenQueue *tokenQueue, QWidget *parent)
|
WikiGroupDialog::WikiGroupDialog(QWidget *parent)
|
||||||
:GxsGroupDialog(tokenQueue, WikiCreateEnabledFlags, WikiCreateDefaultsFlags, parent)
|
:GxsGroupDialog(WikiCreateEnabledFlags, WikiCreateDefaultsFlags, parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
WikiGroupDialog::WikiGroupDialog(TokenQueue *tokenExternalQueue, RsTokenService *tokenService, Mode mode, RsGxsGroupId groupId, QWidget *parent)
|
WikiGroupDialog::WikiGroupDialog(Mode mode, RsGxsGroupId groupId, QWidget *parent)
|
||||||
:GxsGroupDialog(tokenExternalQueue, tokenService, mode, groupId, WikiEditEnabledFlags, WikiEditDefaultsFlags, parent)
|
:GxsGroupDialog(mode, groupId, WikiEditEnabledFlags, WikiEditDefaultsFlags, parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,40 +90,62 @@ QPixmap WikiGroupDialog::serviceImage()
|
|||||||
return QPixmap(":/icons/png/wiki.png");
|
return QPixmap(":/icons/png/wiki.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WikiGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta)
|
|
||||||
|
bool WikiGroupDialog::service_createGroup(RsGroupMetaData &meta)
|
||||||
{
|
{
|
||||||
// Specific Function.
|
|
||||||
RsWikiCollection grp;
|
RsWikiCollection grp;
|
||||||
grp.mMeta = meta;
|
grp.mMeta = meta;
|
||||||
grp.mDescription = getDescription().toStdString();
|
grp.mDescription = getDescription().toStdString();
|
||||||
std::cerr << "WikiGroupDialog::service_CreateGroup() storing to Queue";
|
|
||||||
|
std::cerr << "WikiGroupDialog::service_CreateGroup()";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
rsWiki->submitCollection(token, grp);
|
bool success = rsWiki->createCollection(grp);
|
||||||
|
// createCollection should refresh groupId or data
|
||||||
return true;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WikiGroupDialog::service_EditGroup(uint32_t &token, RsGroupMetaData &editedMeta)
|
bool WikiGroupDialog::service_updateGroup(const RsGroupMetaData &editedMeta)
|
||||||
{
|
{
|
||||||
RsWikiCollection grp;
|
RsWikiCollection grp;
|
||||||
grp.mMeta = editedMeta;
|
grp.mMeta = editedMeta;
|
||||||
grp.mDescription = getDescription().toStdString();
|
grp.mDescription = getDescription().toStdString();
|
||||||
|
|
||||||
std::cerr << "WikiGroupDialog::service_EditGroup() submitting changes.";
|
std::cerr << "WikiGroupDialog::service_updateGroup() submitting changes.";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
rsWiki->updateCollection(token, grp);
|
bool success = rsWiki->updateCollection(grp);
|
||||||
|
// updateCollection should refresh groupId or data
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool WikiGroupDialog::service_loadGroup(const RsGxsGenericGroupData *data, Mode mode, QString &description)
|
||||||
|
{
|
||||||
|
std::cerr << "WikiGroupDialog::service_loadGroup()";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
const RsWikiCollection *pgroup = dynamic_cast<const RsWikiCollection *>(data);
|
||||||
|
if (pgroup == nullptr)
|
||||||
|
{
|
||||||
|
std::cerr << "WikiGroupDialog::service_loadGroup() Error not a RsWikiCollection";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const RsWikiCollection &group = *pgroup;
|
||||||
|
description = QString::fromUtf8(group.mDescription.c_str());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WikiGroupDialog::service_loadGroup(uint32_t token, Mode /*mode*/, RsGroupMetaData& groupMetaData, QString &description)
|
bool WikiGroupDialog::service_getGroupData(const RsGxsGroupId &groupId, RsGxsGenericGroupData *&data)
|
||||||
{
|
{
|
||||||
std::cerr << "WikiGroupDialog::service_loadGroup(" << token << ")";
|
std::cerr << "WikiGroupDialog::service_getGroupData(" << groupId << ")";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
std::list<RsGxsGroupId> groupIds({groupId});
|
||||||
std::vector<RsWikiCollection> groups;
|
std::vector<RsWikiCollection> groups;
|
||||||
if (!rsWiki->getCollections(token, groups))
|
if (!rsWiki->getCollections(groupIds, groups))
|
||||||
{
|
{
|
||||||
std::cerr << "WikiGroupDialog::service_loadGroup() Error getting GroupData";
|
std::cerr << "WikiGroupDialog::service_loadGroup() Error getting GroupData";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
@ -137,11 +159,7 @@ bool WikiGroupDialog::service_loadGroup(uint32_t token, Mode /*mode*/, RsGroupMe
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cerr << "WikisGroupDialog::service_loadGroup() Unfinished Loading";
|
data = new RsWikiCollection(groups[0]);
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
groupMetaData = groups[0].mMeta;
|
|
||||||
description = QString::fromUtf8(groups[0].mDescription.c_str());
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,15 +29,16 @@ class WikiGroupDialog : public GxsGroupDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
WikiGroupDialog(TokenQueue *tokenQueue, QWidget *parent);
|
WikiGroupDialog(QWidget *parent);
|
||||||
WikiGroupDialog(TokenQueue *tokenExternalQueue, RsTokenService *tokenService, Mode mode, RsGxsGroupId groupId, QWidget *parent = NULL);
|
WikiGroupDialog(Mode mode, RsGxsGroupId groupId, QWidget *parent = NULL);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void initUi();
|
virtual void initUi() override;
|
||||||
virtual QPixmap serviceImage();
|
virtual QPixmap serviceImage() override;
|
||||||
virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta);
|
virtual bool service_createGroup(RsGroupMetaData &meta) override;
|
||||||
virtual bool service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData, QString &description);
|
virtual bool service_updateGroup(const RsGroupMetaData &editedMeta) override;
|
||||||
virtual bool service_EditGroup(uint32_t &token, RsGroupMetaData& groupMetaData);
|
virtual bool service_loadGroup(const RsGxsGenericGroupData *data, Mode mode, QString &description) override;
|
||||||
|
virtual bool service_getGroupData(const RsGxsGroupId &groupId, RsGxsGenericGroupData *&data) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -38,10 +38,10 @@ signals:
|
|||||||
protected:
|
protected:
|
||||||
void mousePressEvent(QMouseEvent* event);
|
void mousePressEvent(QMouseEvent* event);
|
||||||
|
|
||||||
void enterEvent(QEvent *ev) override { setStyleSheet("QLabel { border: 2px solid #039bd5; }");}
|
void enterEvent(QEvent * /* ev */ ) override { setStyleSheet("QLabel { border: 2px solid #039bd5; }");}
|
||||||
|
|
||||||
void leaveEvent(QEvent *ev) override { setStyleSheet("QLabel { border: 2px solid #CCCCCC; border-radius: 3px; }");}
|
void leaveEvent(QEvent * /* ev */ ) override { setStyleSheet("QLabel { border: 2px solid #CCCCCC; border-radius: 3px; }");}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CLICKABLELABEL_H
|
#endif // CLICKABLELABEL_H
|
||||||
|
Loading…
Reference in New Issue
Block a user