mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Merge pull request #1833 from csoler/v0.6-FT4
added auto delete active token feature to RsGxsIfaceHelper
This commit is contained in:
commit
512b18a572
@ -26,6 +26,10 @@
|
||||
* #define RS_DATA_SERVICE_DEBUG_CACHE 1
|
||||
****/
|
||||
|
||||
#define RS_DATA_SERVICE_DEBUG 1
|
||||
#define RS_DATA_SERVICE_DEBUG_TIME 1
|
||||
#define RS_DATA_SERVICE_DEBUG_CACHE 1
|
||||
|
||||
#include <fstream>
|
||||
#include <util/rsdir.h>
|
||||
#include <algorithm>
|
||||
@ -1312,7 +1316,7 @@ int RsDataService::retrieveGxsMsgMetaData(const GxsMsgReq& reqIds, GxsMsgMetaRes
|
||||
{
|
||||
locked_retrieveMsgMeta(c, metaSet);
|
||||
#ifdef RS_DATA_SERVICE_DEBUG_CACHE
|
||||
std::cerr << "Retrieving (all) Msg metadata grpId=" << grpId << ", " << std::dec << metaSet.size() << " messages" << std::endl;
|
||||
std::cerr << mDbName << ": Retrieving (all) Msg metadata grpId=" << grpId << ", " << std::dec << metaSet.size() << " messages" << std::endl;
|
||||
#endif
|
||||
}
|
||||
}else{
|
||||
@ -1329,7 +1333,7 @@ int RsDataService::retrieveGxsMsgMetaData(const GxsMsgReq& reqIds, GxsMsgMetaRes
|
||||
{
|
||||
locked_retrieveMsgMeta(c, metaSet);
|
||||
#ifdef RS_DATA_SERVICE_DEBUG_CACHE
|
||||
std::cerr << "Retrieving Msg metadata grpId=" << grpId << ", " << std::dec << metaSet.size() << " messages" << std::endl;
|
||||
std::cerr << mDbName << ": Retrieving Msg metadata grpId=" << grpId << ", " << std::dec << metaSet.size() << " messages" << std::endl;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -1343,6 +1347,7 @@ int RsDataService::retrieveGxsMsgMetaData(const GxsMsgReq& reqIds, GxsMsgMetaRes
|
||||
}
|
||||
|
||||
#ifdef RS_DATA_SERVICE_DEBUG_TIME
|
||||
if(mDbName==std::string("gxsforums_db"))
|
||||
std::cerr << "RsDataService::retrieveGxsMsgMetaData() " << mDbName << ", Requests: " << reqIds.size() << ", Results: " << resultCount << ", Time: " << timer.duration() << std::endl;
|
||||
#endif
|
||||
|
||||
@ -1413,7 +1418,7 @@ int RsDataService::retrieveGxsGrpMetaData(RsGxsGrpMetaTemporaryMap& grp)
|
||||
{
|
||||
grp[g->mGroupId] = g;
|
||||
#ifdef RS_DATA_SERVICE_DEBUG_CACHE
|
||||
std::cerr << (void *)this << ": Retrieving (all) Grp metadata grpId=" << g->mGroupId << std::endl;
|
||||
std::cerr << (void *)this << " " << mDbName << ": Retrieving (all) Grp metadata grpId=" << g->mGroupId << std::endl;
|
||||
#endif
|
||||
}
|
||||
valid = c->moveToNext();
|
||||
@ -1440,14 +1445,14 @@ int RsDataService::retrieveGxsGrpMetaData(RsGxsGrpMetaTemporaryMap& grp)
|
||||
if(itt != mGrpMetaDataCache.end())
|
||||
{
|
||||
#ifdef RS_DATA_SERVICE_DEBUG_CACHE
|
||||
std::cerr << "Retrieving Grp metadata grpId=" << mit->first << " from cache!" << std::endl;
|
||||
std::cerr << mDbName << ": Retrieving Grp metadata grpId=" << mit->first << " from cache!" << std::endl;
|
||||
#endif
|
||||
grp[mit->first] = itt->second ;
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef RS_DATA_SERVICE_DEBUG_CACHE
|
||||
std::cerr << "Retrieving Grp metadata grpId=" << mit->first ;
|
||||
std::cerr << mDbName << ": Retrieving Grp metadata grpId=" << mit->first ;
|
||||
#endif
|
||||
|
||||
const RsGxsGroupId& grpId = mit->first;
|
||||
|
@ -3461,20 +3461,32 @@ bool RsGenExchange::exportGroupBase64(
|
||||
|
||||
if(groupId.isNull()) return failure("groupId cannot be null");
|
||||
|
||||
// We have no blocking API here, so we need to make a blocking request manually.
|
||||
const std::list<RsGxsGroupId> groupIds({groupId});
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
||||
uint32_t token;
|
||||
mDataAccess->requestGroupInfo(
|
||||
token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds);
|
||||
RsTokenService::GxsRequestStatus wtStatus = mDataAccess->waitToken(token);
|
||||
if(wtStatus != RsTokenService::COMPLETE)
|
||||
return failure( "waitToken(...) failed with: " +
|
||||
std::to_string(wtStatus) );
|
||||
mDataAccess->requestGroupInfo( token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds);
|
||||
|
||||
// provide a sync response: actually wait for the token.
|
||||
std::chrono::milliseconds maxWait = std::chrono::milliseconds(10000);
|
||||
std::chrono::milliseconds checkEvery = std::chrono::milliseconds(100);
|
||||
|
||||
auto timeout = std::chrono::steady_clock::now() + maxWait; // wait for 10 secs at most
|
||||
auto st = mDataAccess->requestStatus(token);
|
||||
|
||||
while( !(st == RsTokenService::FAILED || st >= RsTokenService::COMPLETE) && std::chrono::steady_clock::now() < timeout )
|
||||
{
|
||||
std::this_thread::sleep_for(checkEvery);
|
||||
st = mDataAccess->requestStatus(token);
|
||||
}
|
||||
if(st != RsTokenService::COMPLETE)
|
||||
return failure( "waitToken(...) failed with: " + std::to_string(st) );
|
||||
|
||||
uint8_t* buf = nullptr;
|
||||
uint32_t size;
|
||||
RsGxsGroupId grpId;
|
||||
|
||||
if(!getSerializedGroupData(token, grpId, buf, size))
|
||||
return failure("failed retrieving GXS data");
|
||||
|
||||
|
@ -726,7 +726,7 @@ public:
|
||||
virtual void setSyncPeriod(const RsGxsGroupId& grpId,uint32_t age_in_secs) ;
|
||||
virtual bool getGroupNetworkStats(const RsGxsGroupId& grpId,RsGroupNetworkStats& stats);
|
||||
|
||||
uint16_t serviceType() const { return mServType ; }
|
||||
uint16_t serviceType() const override { return mServType ; }
|
||||
uint32_t serviceFullType() const { return RsServiceInfo::RsServiceInfoUIn16ToFullServiceId(mServType); }
|
||||
|
||||
virtual RsReputationLevel minReputationForForwardingMessages(
|
||||
|
@ -30,6 +30,8 @@
|
||||
* #define DATA_DEBUG 1
|
||||
**********/
|
||||
|
||||
#define DATA_DEBUG 1
|
||||
|
||||
RsGxsDataAccess::RsGxsDataAccess(RsGeneralDataService* ds) :
|
||||
mDataStore(ds), mDataMutex("RsGxsDataAccess"), mNextToken(0) {}
|
||||
|
||||
|
@ -45,11 +45,10 @@ class RsGxsChannels;
|
||||
extern RsGxsChannels* rsGxsChannels;
|
||||
|
||||
|
||||
struct RsGxsChannelGroup : RsSerializable
|
||||
struct RsGxsChannelGroup : RsSerializable, RsGxsGenericGroupData
|
||||
{
|
||||
RsGxsChannelGroup() : mAutoDownload(false) {}
|
||||
|
||||
RsGroupMetaData mMeta;
|
||||
std::string mDescription;
|
||||
RsGxsImage mImage;
|
||||
|
||||
@ -399,6 +398,15 @@ public:
|
||||
virtual bool subscribeToChannel( const RsGxsGroupId& channelId,
|
||||
bool subscribe ) = 0;
|
||||
|
||||
/**
|
||||
* \brief Retrieve statistics about the given channel
|
||||
* @jsonapi{development}
|
||||
* \param[in] channelId Id of the channel group
|
||||
* \param[out] stat Statistics structure
|
||||
* \return
|
||||
*/
|
||||
virtual bool getChannelStatistics(const RsGxsGroupId& channelId,GxsGroupStatistic& stat) =0;
|
||||
|
||||
/**
|
||||
* @brief Request remote channels search
|
||||
* @jsonapi{development}
|
||||
|
@ -54,11 +54,8 @@ static const uint32_t RS_GXS_FORUM_MSG_FLAGS_MODERATED = 0x00000001;
|
||||
#define IS_FORUM_MSG_MODERATION(flags) (flags & RS_GXS_FORUM_MSG_FLAGS_MODERATED)
|
||||
|
||||
|
||||
struct RsGxsForumGroup : RsSerializable
|
||||
struct RsGxsForumGroup : RsSerializable, RsGxsGenericGroupData
|
||||
{
|
||||
/** Forum GXS metadata */
|
||||
RsGroupMetaData mMeta;
|
||||
|
||||
/** @brief Forum desciption */
|
||||
std::string mDescription;
|
||||
|
||||
@ -222,6 +219,15 @@ public:
|
||||
*/
|
||||
virtual bool getForumsSummaries(std::list<RsGroupMetaData>& forums) = 0;
|
||||
|
||||
/**
|
||||
* @brief returns statistics about a particular forum
|
||||
* @jsonapi{development}
|
||||
* @param[in] forumId Id of the forum
|
||||
* @param[out] stat statistics struct
|
||||
* @return false when the object doesn't exist or when the timeout is reached requesting the data
|
||||
*/
|
||||
virtual bool getForumStatistics(const RsGxsGroupId& forumId,GxsGroupStatistic& stat)=0;
|
||||
|
||||
/**
|
||||
* @brief Get forums information (description, thumbnail...).
|
||||
* Blocking API.
|
||||
@ -364,5 +370,5 @@ public:
|
||||
RS_DEPRECATED_FOR(createMessage)
|
||||
virtual bool createMsg(uint32_t &token, RsGxsForumMsg &msg) = 0;
|
||||
RS_DEPRECATED_FOR(editForum)
|
||||
virtual bool updateGroup(uint32_t &token, RsGxsForumGroup &group) = 0;
|
||||
virtual bool updateGroup(uint32_t &token, const RsGxsForumGroup &group) = 0;
|
||||
};
|
||||
|
@ -110,6 +110,12 @@ struct RsGxsChanges : RsEvent
|
||||
*/
|
||||
struct RsGxsIface
|
||||
{
|
||||
/*!
|
||||
* \brief serviceType
|
||||
* \return The 16-bits service type. See @serialiser/rsserviceids.h
|
||||
*/
|
||||
virtual uint16_t serviceType() const =0;
|
||||
|
||||
/*!
|
||||
* Gxs services should call this for automatic handling of
|
||||
* changes, send
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <thread>
|
||||
|
||||
#include "retroshare/rsgxsiface.h"
|
||||
#include "retroshare/rsservicecontrol.h"
|
||||
#include "retroshare/rsreputations.h"
|
||||
#include "rsgxsflags.h"
|
||||
#include "util/rsdeprecate.h"
|
||||
@ -38,14 +39,26 @@
|
||||
* To properly fix the API design many changes with the implied chain reactions
|
||||
* are necessary, so at this point this workaround seems acceptable.
|
||||
*/
|
||||
struct RsGxsIfaceHelper
|
||||
|
||||
enum class TokenRequestType: uint8_t
|
||||
{
|
||||
GROUP_INFO = 0x01,
|
||||
MSG_INFO = 0x02,
|
||||
MSG_RELATED_INFO = 0x03,
|
||||
GROUP_STATISTICS = 0x04,
|
||||
SERVICE_STATISTICS = 0x05,
|
||||
NO_KILL_TYPE = 0x06,
|
||||
};
|
||||
|
||||
class RsGxsIfaceHelper
|
||||
{
|
||||
public:
|
||||
/*!
|
||||
* @param gxs handle to RsGenExchange instance of service (Usually the
|
||||
* service class itself)
|
||||
*/
|
||||
RsGxsIfaceHelper(RsGxsIface& gxs) :
|
||||
mGxs(gxs), mTokenService(*gxs.getTokenService()) {}
|
||||
mGxs(gxs), mTokenService(*gxs.getTokenService()),mMtx("GxsIfaceHelper") {}
|
||||
|
||||
~RsGxsIfaceHelper(){}
|
||||
|
||||
@ -233,30 +246,81 @@ struct RsGxsIfaceHelper
|
||||
}
|
||||
|
||||
/// @see RsTokenService::requestGroupInfo
|
||||
bool requestGroupInfo( uint32_t& token, const RsTokReqOptions& opts,
|
||||
const std::list<RsGxsGroupId> &groupIds )
|
||||
{ return mTokenService.requestGroupInfo(token, 0, opts, groupIds); }
|
||||
bool requestGroupInfo( uint32_t& token, const RsTokReqOptions& opts, const std::list<RsGxsGroupId> &groupIds, bool high_priority_request = false )
|
||||
{
|
||||
cancelActiveRequestTokens(TokenRequestType::GROUP_INFO);
|
||||
|
||||
if( mTokenService.requestGroupInfo(token, 0, opts, groupIds))
|
||||
{
|
||||
RS_STACK_MUTEX(mMtx);
|
||||
mActiveTokens[token]=high_priority_request? (TokenRequestType::NO_KILL_TYPE) : (TokenRequestType::GROUP_INFO);
|
||||
locked_dumpTokens();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/// @see RsTokenService::requestGroupInfo
|
||||
bool requestGroupInfo(uint32_t& token, const RsTokReqOptions& opts)
|
||||
{ return mTokenService.requestGroupInfo(token, 0, opts); }
|
||||
bool requestGroupInfo(uint32_t& token, const RsTokReqOptions& opts, bool high_priority_request = false)
|
||||
{
|
||||
cancelActiveRequestTokens(TokenRequestType::GROUP_INFO);
|
||||
|
||||
if( mTokenService.requestGroupInfo(token, 0, opts))
|
||||
{
|
||||
RS_STACK_MUTEX(mMtx);
|
||||
mActiveTokens[token]=high_priority_request? (TokenRequestType::NO_KILL_TYPE) : (TokenRequestType::GROUP_INFO);
|
||||
locked_dumpTokens();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/// @see RsTokenService::requestMsgInfo
|
||||
bool requestMsgInfo( uint32_t& token,
|
||||
const RsTokReqOptions& opts, const GxsMsgReq& msgIds )
|
||||
{ return mTokenService.requestMsgInfo(token, 0, opts, msgIds); }
|
||||
{
|
||||
if(mTokenService.requestMsgInfo(token, 0, opts, msgIds))
|
||||
{
|
||||
RS_STACK_MUTEX(mMtx);
|
||||
mActiveTokens[token]=TokenRequestType::MSG_INFO;
|
||||
locked_dumpTokens();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/// @see RsTokenService::requestMsgInfo
|
||||
bool requestMsgInfo(
|
||||
uint32_t& token, const RsTokReqOptions& opts,
|
||||
const std::list<RsGxsGroupId>& grpIds )
|
||||
{ return mTokenService.requestMsgInfo(token, 0, opts, grpIds); }
|
||||
bool requestMsgInfo( uint32_t& token, const RsTokReqOptions& opts, const std::list<RsGxsGroupId>& grpIds )
|
||||
{
|
||||
if(mTokenService.requestMsgInfo(token, 0, opts, grpIds))
|
||||
{
|
||||
RS_STACK_MUTEX(mMtx);
|
||||
mActiveTokens[token]=TokenRequestType::MSG_INFO;
|
||||
locked_dumpTokens();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/// @see RsTokenService::requestMsgRelatedInfo
|
||||
bool requestMsgRelatedInfo(
|
||||
uint32_t& token, const RsTokReqOptions& opts,
|
||||
const std::vector<RsGxsGrpMsgIdPair>& msgIds )
|
||||
{ return mTokenService.requestMsgRelatedInfo(token, 0, opts, msgIds); }
|
||||
{
|
||||
if( mTokenService.requestMsgRelatedInfo(token, 0, opts, msgIds))
|
||||
{
|
||||
RS_STACK_MUTEX(mMtx);
|
||||
mActiveTokens[token]=TokenRequestType::MSG_RELATED_INFO;
|
||||
locked_dumpTokens();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @jsonapi{development}
|
||||
@ -267,14 +331,50 @@ struct RsGxsIfaceHelper
|
||||
|
||||
/// @see RsTokenService::requestServiceStatistic
|
||||
void requestServiceStatistic(uint32_t& token)
|
||||
{ mTokenService.requestServiceStatistic(token); }
|
||||
{
|
||||
mTokenService.requestServiceStatistic(token);
|
||||
|
||||
RS_STACK_MUTEX(mMtx);
|
||||
mActiveTokens[token]=TokenRequestType::SERVICE_STATISTICS;
|
||||
|
||||
locked_dumpTokens();
|
||||
}
|
||||
|
||||
/// @see RsTokenService::requestGroupStatistic
|
||||
void requestGroupStatistic(uint32_t& token, const RsGxsGroupId& grpId)
|
||||
{ mTokenService.requestGroupStatistic(token, grpId); }
|
||||
bool requestGroupStatistic(uint32_t& token, const RsGxsGroupId& grpId)
|
||||
{
|
||||
mTokenService.requestGroupStatistic(token, grpId);
|
||||
|
||||
RS_STACK_MUTEX(mMtx);
|
||||
mActiveTokens[token]=TokenRequestType::GROUP_STATISTICS;
|
||||
locked_dumpTokens();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cancelActiveRequestTokens(TokenRequestType type)
|
||||
{
|
||||
RS_STACK_MUTEX(mMtx);
|
||||
for(auto it = mActiveTokens.begin();it!=mActiveTokens.end();)
|
||||
if(it->second == type)
|
||||
{
|
||||
mTokenService.cancelRequest(it->first);
|
||||
it = mActiveTokens.erase(it);
|
||||
}
|
||||
else
|
||||
++it;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// @see RsTokenService::cancelRequest
|
||||
bool cancelRequest(uint32_t token) { return mTokenService.cancelRequest(token); }
|
||||
bool cancelRequest(uint32_t token)
|
||||
{
|
||||
{
|
||||
RS_STACK_MUTEX(mMtx);
|
||||
mActiveTokens.erase(token);
|
||||
}
|
||||
return mTokenService.cancelRequest(token);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
@ -294,19 +394,80 @@ protected:
|
||||
*/
|
||||
RsTokenService::GxsRequestStatus waitToken(
|
||||
uint32_t token,
|
||||
std::chrono::milliseconds maxWait = std::chrono::milliseconds(2000),
|
||||
std::chrono::milliseconds checkEvery = std::chrono::milliseconds(20),
|
||||
std::chrono::milliseconds maxWait = std::chrono::milliseconds(20000),
|
||||
std::chrono::milliseconds checkEvery = std::chrono::milliseconds(100),
|
||||
bool auto_delete_if_unsuccessful=true)
|
||||
{
|
||||
RsTokenService::GxsRequestStatus res = mTokenService.waitToken(token, maxWait, checkEvery);
|
||||
#if defined(__ANDROID__) && (__ANDROID_API__ < 24)
|
||||
auto wkStartime = std::chrono::steady_clock::now();
|
||||
int maxWorkAroundCnt = 10;
|
||||
LLwaitTokenBeginLabel:
|
||||
#endif
|
||||
auto timeout = std::chrono::steady_clock::now() + maxWait;
|
||||
auto st = requestStatus(token);
|
||||
|
||||
if(res != RsTokenService::COMPLETE && auto_delete_if_unsuccessful)
|
||||
while( !(st == RsTokenService::FAILED || st >= RsTokenService::COMPLETE) && std::chrono::steady_clock::now() < timeout )
|
||||
{
|
||||
std::this_thread::sleep_for(checkEvery);
|
||||
st = requestStatus(token);
|
||||
}
|
||||
if(st != RsTokenService::COMPLETE && auto_delete_if_unsuccessful)
|
||||
cancelRequest(token);
|
||||
|
||||
return res;
|
||||
#if defined(__ANDROID__) && (__ANDROID_API__ < 24)
|
||||
/* Work around for very slow/old android devices, we don't expect this
|
||||
* to be necessary on newer devices. If it take unreasonably long
|
||||
* something worser is already happening elsewere and we return anyway.
|
||||
*/
|
||||
if( st > RsTokenService::FAILED && st < RsTokenService::COMPLETE
|
||||
&& maxWorkAroundCnt-- > 0 )
|
||||
{
|
||||
maxWait *= 10;
|
||||
checkEvery *= 3;
|
||||
Dbg3() << __PRETTY_FUNCTION__ << " Slow Android device "
|
||||
<< " workaround st: " << st
|
||||
<< " maxWorkAroundCnt: " << maxWorkAroundCnt
|
||||
<< " maxWait: " << maxWait.count()
|
||||
<< " checkEvery: " << checkEvery.count() << std::endl;
|
||||
goto LLwaitTokenBeginLabel;
|
||||
}
|
||||
Dbg3() << __PRETTY_FUNCTION__ << " lasted: "
|
||||
<< std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||
std::chrono::steady_clock::now() - wkStartime ).count()
|
||||
<< "ms" << std::endl;
|
||||
|
||||
#endif
|
||||
|
||||
{
|
||||
RS_STACK_MUTEX(mMtx);
|
||||
mActiveTokens.erase(token);
|
||||
}
|
||||
|
||||
return st;
|
||||
}
|
||||
|
||||
private:
|
||||
RsGxsIface& mGxs;
|
||||
RsTokenService& mTokenService;
|
||||
RsMutex mMtx;
|
||||
|
||||
std::map<uint32_t,TokenRequestType> mActiveTokens;
|
||||
|
||||
void locked_dumpTokens()
|
||||
{
|
||||
uint16_t service_id = mGxs.serviceType();
|
||||
|
||||
uint32_t count[7] = {0};
|
||||
|
||||
std::cerr << "Service 0x0" << std::hex << service_id
|
||||
<< " (" << rsServiceControl->getServiceName(RsServiceInfo::RsServiceInfoUIn16ToFullServiceId(service_id))
|
||||
<< ") this=0x" << (void*)this << ") Active tokens (per type): " ;
|
||||
|
||||
for(auto& it: mActiveTokens) // let's count how many token of each type we've got.
|
||||
++count[static_cast<int>(it.second)];
|
||||
|
||||
for(uint32_t i=0;i<7;++i)
|
||||
std::cerr /* << i << ":" */ << count[i] << " ";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
};
|
||||
|
@ -118,8 +118,15 @@ struct RsGroupMetaData : RsSerializable
|
||||
}
|
||||
};
|
||||
|
||||
// This is the parent class of all interface-level GXS group data. Derived classes
|
||||
// will include service-specific information, such as icon, description, etc
|
||||
|
||||
struct RsGxsGenericGroupData
|
||||
{
|
||||
virtual ~RsGxsGenericGroupData() = default; // making the type polymorphic
|
||||
|
||||
RsGroupMetaData mMeta;
|
||||
};
|
||||
|
||||
struct RsMsgMetaData : RsSerializable
|
||||
{
|
||||
|
@ -383,8 +383,9 @@ struct RsIdentityDetails : RsSerializable
|
||||
|
||||
|
||||
/** The Main Interface Class for GXS people identities */
|
||||
struct RsIdentity : RsGxsIfaceHelper
|
||||
class RsIdentity: public RsGxsIfaceHelper
|
||||
{
|
||||
public:
|
||||
explicit RsIdentity(RsGxsIface& gxs) : RsGxsIfaceHelper(gxs) {}
|
||||
|
||||
/**
|
||||
|
@ -40,9 +40,8 @@ class RsPosted;
|
||||
*/
|
||||
extern RsPosted* rsPosted;
|
||||
|
||||
struct RsPostedGroup
|
||||
struct RsPostedGroup: RsGxsGenericGroupData
|
||||
{
|
||||
RsGroupMetaData mMeta;
|
||||
std::string mDescription;
|
||||
RsGxsImage mGroupImage;
|
||||
};
|
||||
@ -150,12 +149,20 @@ public:
|
||||
const std::list<RsGxsGroupId>& boardsIds,
|
||||
std::vector<RsPostedGroup>& boardsInfo ) = 0;
|
||||
|
||||
virtual bool getBoardsSummaries(std::list<RsGroupMetaData>& groupInfo) =0;
|
||||
|
||||
virtual bool getBoardContent(
|
||||
const RsGxsGroupId& boardId,
|
||||
const std::set<RsGxsMessageId>& contentsIds,
|
||||
std::vector<RsPostedPost>& posts,
|
||||
std::vector<RsGxsComment>& comments ) = 0;
|
||||
|
||||
virtual bool editBoard(RsPostedGroup& board) =0;
|
||||
|
||||
virtual bool createBoard(RsPostedGroup& board) =0;
|
||||
|
||||
virtual bool getBoardStatistics(const RsGxsGroupId& boardId,GxsGroupStatistic& stat) =0;
|
||||
|
||||
enum RS_DEPRECATED RankType {TopRankType, HotRankType, NewRankType };
|
||||
|
||||
RS_DEPRECATED_FOR(getBoardsInfo)
|
||||
|
@ -222,6 +222,7 @@ public:
|
||||
*/
|
||||
virtual bool cancelRequest(const uint32_t &token) = 0;
|
||||
|
||||
#ifdef TO_REMOVE
|
||||
/**
|
||||
* Block caller while request is being processed.
|
||||
* Useful for blocking API implementation.
|
||||
@ -231,8 +232,8 @@ public:
|
||||
*/
|
||||
RsTokenService::GxsRequestStatus waitToken(
|
||||
uint32_t token,
|
||||
std::chrono::milliseconds maxWait = std::chrono::milliseconds(500),
|
||||
std::chrono::milliseconds checkEvery = std::chrono::milliseconds(2),
|
||||
std::chrono::milliseconds maxWait = std::chrono::milliseconds(10000),
|
||||
std::chrono::milliseconds checkEvery = std::chrono::milliseconds(20),
|
||||
bool auto_delete_if_unsuccessful=true)
|
||||
{
|
||||
#if defined(__ANDROID__) && (__ANDROID_API__ < 24)
|
||||
@ -276,6 +277,7 @@ LLwaitTokenBeginLabel:
|
||||
|
||||
return st;
|
||||
}
|
||||
#endif
|
||||
|
||||
RS_SET_CONTEXT_DEBUG_LEVEL(2)
|
||||
};
|
||||
|
@ -1033,18 +1033,35 @@ bool p3GxsChannels::getChannelsSummaries(
|
||||
return getGroupSummary(token, channels);
|
||||
}
|
||||
|
||||
bool p3GxsChannels::getChannelsInfo(
|
||||
const std::list<RsGxsGroupId>& chanIds,
|
||||
std::vector<RsGxsChannelGroup>& channelsInfo )
|
||||
bool p3GxsChannels::getChannelsInfo( const std::list<RsGxsGroupId>& chanIds, std::vector<RsGxsChannelGroup>& channelsInfo )
|
||||
{
|
||||
uint32_t token;
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
||||
if( !requestGroupInfo(token, opts, chanIds)
|
||||
|| waitToken(token) != RsTokenService::COMPLETE ) return false;
|
||||
|
||||
if(chanIds.empty())
|
||||
{
|
||||
if( !requestGroupInfo(token, opts) || waitToken(token) != RsTokenService::COMPLETE )
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !requestGroupInfo(token, opts, chanIds) || waitToken(token) != RsTokenService::COMPLETE )
|
||||
return false;
|
||||
}
|
||||
|
||||
return getGroupData(token, channelsInfo) && !channelsInfo.empty();
|
||||
}
|
||||
|
||||
bool p3GxsChannels::getChannelStatistics(const RsGxsGroupId& channelId,GxsGroupStatistic& stat)
|
||||
{
|
||||
uint32_t token;
|
||||
if(!RsGxsIfaceHelper::requestGroupStatistic(token, channelId) || waitToken(token) != RsTokenService::COMPLETE)
|
||||
return false;
|
||||
|
||||
return RsGenExchange::getGroupStatistic(token,stat);
|
||||
}
|
||||
|
||||
bool p3GxsChannels::getContentSummaries(
|
||||
const RsGxsGroupId& channelId, std::vector<RsMsgMetaData>& summaries )
|
||||
{
|
||||
|
@ -196,6 +196,9 @@ virtual bool ExtraFileRemove(const RsFileHash &hash);
|
||||
const RsGxsGroupId& channelId,
|
||||
std::vector<RsMsgMetaData>& summaries ) override;
|
||||
|
||||
/// Implementation of @see RsGxsChannels::getChannelStatistics
|
||||
bool getChannelStatistics(const RsGxsGroupId& channelId,GxsGroupStatistic& stat) override;
|
||||
|
||||
/// Implementation of @see RsGxsChannels::createChannelV2
|
||||
bool createChannelV2(
|
||||
const std::string& name, const std::string& description,
|
||||
|
@ -666,15 +666,22 @@ bool p3GxsForums::getForumsSummaries( std::list<RsGroupMetaData>& forums )
|
||||
return getGroupSummary(token, forums);
|
||||
}
|
||||
|
||||
bool p3GxsForums::getForumsInfo(
|
||||
const std::list<RsGxsGroupId>& forumIds,
|
||||
std::vector<RsGxsForumGroup>& forumsInfo )
|
||||
bool p3GxsForums::getForumsInfo( const std::list<RsGxsGroupId>& forumIds, std::vector<RsGxsForumGroup>& forumsInfo )
|
||||
{
|
||||
uint32_t token;
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
||||
if( !requestGroupInfo(token, opts, forumIds)
|
||||
|| waitToken(token,std::chrono::milliseconds(5000)) != RsTokenService::COMPLETE ) return false;
|
||||
|
||||
if(forumIds.empty())
|
||||
{
|
||||
if( !requestGroupInfo(token, opts) || waitToken(token,std::chrono::milliseconds(5000)) != RsTokenService::COMPLETE )
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !requestGroupInfo(token, opts, forumIds, forumIds.size()==1) || waitToken(token,std::chrono::milliseconds(5000)) != RsTokenService::COMPLETE )
|
||||
return false;
|
||||
}
|
||||
return getGroupData(token, forumsInfo);
|
||||
}
|
||||
|
||||
@ -812,7 +819,16 @@ bool p3GxsForums::createGroup(uint32_t &token, RsGxsForumGroup &group)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool p3GxsForums::updateGroup(uint32_t &token, RsGxsForumGroup &group)
|
||||
bool p3GxsForums::getForumStatistics(const RsGxsGroupId& ForumId,GxsGroupStatistic& stat)
|
||||
{
|
||||
uint32_t token;
|
||||
if(!RsGxsIfaceHelper::requestGroupStatistic(token, ForumId) || waitToken(token) != RsTokenService::COMPLETE)
|
||||
return false;
|
||||
|
||||
return RsGenExchange::getGroupStatistic(token,stat);
|
||||
}
|
||||
|
||||
bool p3GxsForums::updateGroup(uint32_t &token, const RsGxsForumGroup &group)
|
||||
{
|
||||
std::cerr << "p3GxsForums::updateGroup()" << std::endl;
|
||||
|
||||
|
@ -94,6 +94,9 @@ public:
|
||||
const std::list<RsGxsGroupId>& forumIds,
|
||||
std::vector<RsGxsForumGroup>& forumsInfo );
|
||||
|
||||
/// Implementation of @see RsGxsForums::getForumStatistics
|
||||
bool getForumStatistics(const RsGxsGroupId& ForumId,GxsGroupStatistic& stat) override;
|
||||
|
||||
/// @see RsGxsForums::getForumMsgMetaData
|
||||
virtual bool getForumMsgMetaData(const RsGxsGroupId& forumId, std::vector<RsMsgMetaData>& msg_metas) ;
|
||||
|
||||
@ -125,13 +128,16 @@ public:
|
||||
std::string& errMsg = RS_DEFAULT_STORAGE_PARAM(std::string)
|
||||
) override;
|
||||
|
||||
virtual bool getGroupData(const uint32_t &token, std::vector<RsGxsForumGroup> &groups);
|
||||
virtual bool getMsgData(const uint32_t &token, std::vector<RsGxsForumMsg> &msgs);
|
||||
virtual bool getMsgMetaData(const uint32_t &token, GxsMsgMetaMap& msg_metas);
|
||||
virtual void setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool read);
|
||||
virtual bool createGroup(uint32_t &token, RsGxsForumGroup &group);
|
||||
virtual bool createMsg(uint32_t &token, RsGxsForumMsg &msg);
|
||||
virtual bool updateGroup(uint32_t &token, RsGxsForumGroup &group);
|
||||
/// implementation of rsGxsGorums
|
||||
///
|
||||
bool getGroupData(const uint32_t &token, std::vector<RsGxsForumGroup> &groups) override;
|
||||
bool getMsgData(const uint32_t &token, std::vector<RsGxsForumMsg> &msgs) override;
|
||||
void setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool read) override;
|
||||
bool createGroup(uint32_t &token, RsGxsForumGroup &group) override;
|
||||
bool createMsg(uint32_t &token, RsGxsForumMsg &msg) override;
|
||||
bool updateGroup(uint32_t &token, const RsGxsForumGroup &group) override;
|
||||
|
||||
bool getMsgMetaData(const uint32_t &token, GxsMsgMetaMap& msg_metas) ;
|
||||
|
||||
private:
|
||||
|
||||
|
@ -639,25 +639,28 @@ void p3IdService::notifyChanges(std::vector<RsGxsNotify *> &changes)
|
||||
std::cerr << "p3IdService::notifyChanges() Auto Subscribe to Incoming Groups: " << *git;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
if(!rsReputations->isIdentityBanned(RsGxsId(*git)))
|
||||
{
|
||||
uint32_t token;
|
||||
RsGenExchange::subscribeToGroup(token, *git, true);
|
||||
|
||||
// also time_stamp the key that this group represents
|
||||
|
||||
timeStampKey(RsGxsId(*git),RsIdentityUsage(serviceType(),RsIdentityUsage::IDENTITY_DATA_UPDATE)) ;
|
||||
|
||||
// notify that a new identity is received, if needed
|
||||
|
||||
bool should_subscribe = false;
|
||||
|
||||
switch(groupChange->getType())
|
||||
{
|
||||
case RsGxsNotify::TYPE_PROCESSED: break ; // Happens when the group is subscribed. This is triggered by RsGenExchange::subscribeToGroup, so better not
|
||||
// call it again from here!!
|
||||
|
||||
case RsGxsNotify::TYPE_PUBLISHED:
|
||||
{
|
||||
auto ev = std::make_shared<RsGxsIdentityEvent>();
|
||||
ev->mIdentityId = *git;
|
||||
ev->mIdentityEventCode = RsGxsIdentityEventCode::UPDATED_IDENTITY;
|
||||
rsEvents->postEvent(ev);
|
||||
|
||||
// also time_stamp the key that this group represents
|
||||
timeStampKey(RsGxsId(*git),RsIdentityUsage(serviceType(),RsIdentityUsage::IDENTITY_DATA_UPDATE)) ;
|
||||
should_subscribe = true;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -667,12 +670,23 @@ void p3IdService::notifyChanges(std::vector<RsGxsNotify *> &changes)
|
||||
ev->mIdentityId = *git;
|
||||
ev->mIdentityEventCode = RsGxsIdentityEventCode::NEW_IDENTITY;
|
||||
rsEvents->postEvent(ev);
|
||||
|
||||
// also time_stamp the key that this group represents
|
||||
timeStampKey(RsGxsId(*git),RsIdentityUsage(serviceType(),RsIdentityUsage::IDENTITY_DATA_UPDATE)) ;
|
||||
should_subscribe = true;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if(should_subscribe)
|
||||
{
|
||||
uint32_t token;
|
||||
RsGenExchange::subscribeToGroup(token, *git, true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -307,8 +307,18 @@ bool p3Posted::getBoardsInfo(
|
||||
uint32_t token;
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
||||
if( !requestGroupInfo(token, opts, boardsIds)
|
||||
|| waitToken(token) != RsTokenService::COMPLETE ) return false;
|
||||
|
||||
if(boardsIds.empty())
|
||||
{
|
||||
if( !requestGroupInfo(token, opts) || waitToken(token) != RsTokenService::COMPLETE )
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !requestGroupInfo(token, opts, boardsIds) || waitToken(token) != RsTokenService::COMPLETE )
|
||||
return false;
|
||||
}
|
||||
|
||||
return getGroupData(token, groupsInfo) && !groupsInfo.empty();
|
||||
}
|
||||
|
||||
@ -330,5 +340,72 @@ bool p3Posted::getBoardContent( const RsGxsGroupId& groupId,
|
||||
return getPostData(token, posts, comments);
|
||||
}
|
||||
|
||||
bool p3Posted::getBoardsSummaries(std::list<RsGroupMetaData>& boards )
|
||||
{
|
||||
uint32_t token;
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
|
||||
if( !requestGroupInfo(token, opts) || waitToken(token) != RsTokenService::COMPLETE ) return false;
|
||||
|
||||
return getGroupSummary(token, boards);
|
||||
}
|
||||
|
||||
bool p3Posted::getBoardStatistics(const RsGxsGroupId& boardId,GxsGroupStatistic& stat)
|
||||
{
|
||||
uint32_t token;
|
||||
if(!RsGxsIfaceHelper::requestGroupStatistic(token, boardId) || waitToken(token) != RsTokenService::COMPLETE)
|
||||
return false;
|
||||
|
||||
return RsGenExchange::getGroupStatistic(token,stat);
|
||||
}
|
||||
|
||||
bool p3Posted::createBoard(RsPostedGroup& board)
|
||||
{
|
||||
uint32_t token;
|
||||
if(!createGroup(token, board))
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << "Error! Failed creating group." << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(waitToken(token,std::chrono::milliseconds(5000)) != RsTokenService::COMPLETE)
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << "Error! GXS operation failed." << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!RsGenExchange::getPublishedGroupMeta(token, board.mMeta))
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << "Error! Failure getting updated " << " group data." << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool p3Posted::editBoard(RsPostedGroup& board)
|
||||
{
|
||||
uint32_t token;
|
||||
if(!updateGroup(token, board))
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << " Error! Failed updating group." << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(waitToken(token) != RsTokenService::COMPLETE)
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << " Error! GXS operation failed." << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!RsGenExchange::getPublishedGroupMeta(token, board.mMeta))
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << " Error! Failure getting updated " << " group data." << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
RsPosted::~RsPosted() = default;
|
||||
RsGxsPostedEvent::~RsGxsPostedEvent() = default;
|
||||
|
@ -66,6 +66,14 @@ virtual void receiveHelperChanges(std::vector<RsGxsNotify*>& changes)
|
||||
std::vector<RsPostedPost>& posts,
|
||||
std::vector<RsGxsComment>& comments ) override;
|
||||
|
||||
bool getBoardsSummaries(std::list<RsGroupMetaData>& groupInfo) override;
|
||||
|
||||
bool getBoardStatistics(const RsGxsGroupId& boardId,GxsGroupStatistic& stat) override;
|
||||
|
||||
bool editBoard(RsPostedGroup& board) override;
|
||||
|
||||
bool createBoard(RsPostedGroup& board) override;
|
||||
|
||||
virtual bool getGroupData(const uint32_t &token, std::vector<RsPostedGroup> &groups);
|
||||
virtual bool getPostData(const uint32_t &token, std::vector<RsPostedPost> &posts, std::vector<RsGxsComment> &cmts);
|
||||
virtual bool getPostData(const uint32_t &token, std::vector<RsPostedPost> &posts) { std::vector<RsGxsComment> cmts; return getPostData( token, posts, cmts);}
|
||||
|
@ -150,14 +150,36 @@ QString PostedDialog::icon(IconType type)
|
||||
return "";
|
||||
}
|
||||
|
||||
GxsGroupDialog *PostedDialog::createNewGroupDialog(TokenQueue *tokenQueue)
|
||||
bool PostedDialog::getGroupData(std::list<RsGxsGenericGroupData*>& groupInfo)
|
||||
{
|
||||
return new PostedGroupDialog(tokenQueue, this);
|
||||
std::vector<RsPostedGroup> groups;
|
||||
|
||||
// request all group infos at once
|
||||
|
||||
if(! rsPosted->getBoardsInfo(std::list<RsGxsGroupId>(),groups))
|
||||
return false;
|
||||
|
||||
/* Save groups to fill icons and description */
|
||||
|
||||
for (auto& group: groups)
|
||||
groupInfo.push_back(new RsPostedGroup(group));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
GxsGroupDialog *PostedDialog::createGroupDialog(TokenQueue *tokenQueue, RsTokenService *tokenService, GxsGroupDialog::Mode mode, RsGxsGroupId groupId)
|
||||
bool PostedDialog::getGroupStatistics(const RsGxsGroupId& groupId,GxsGroupStatistic& stat)
|
||||
{
|
||||
return new PostedGroupDialog(tokenQueue, tokenService, mode, groupId, this);
|
||||
return rsPosted->getBoardStatistics(groupId,stat);
|
||||
}
|
||||
|
||||
GxsGroupDialog *PostedDialog::createNewGroupDialog()
|
||||
{
|
||||
return new PostedGroupDialog(this);
|
||||
}
|
||||
|
||||
GxsGroupDialog *PostedDialog::createGroupDialog(GxsGroupDialog::Mode mode, RsGxsGroupId groupId)
|
||||
{
|
||||
return new PostedGroupDialog(mode, groupId, this);
|
||||
}
|
||||
|
||||
int PostedDialog::shareKeyType()
|
||||
@ -180,6 +202,7 @@ QWidget *PostedDialog::createCommentHeaderWidget(const RsGxsGroupId &grpId, cons
|
||||
return new PostedItem(NULL, 0, grpId, msgId, true, false);
|
||||
}
|
||||
|
||||
#ifdef TO_REMOVE
|
||||
void PostedDialog::loadGroupSummaryToken(const uint32_t &token, std::list<RsGroupMetaData> &groupInfo, RsUserdata *&userdata)
|
||||
{
|
||||
std::vector<RsPostedGroup> groups;
|
||||
@ -205,25 +228,28 @@ void PostedDialog::loadGroupSummaryToken(const uint32_t &token, std::list<RsGrou
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void PostedDialog::groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo, const RsUserdata *userdata)
|
||||
void PostedDialog::groupInfoToGroupItemInfo(const RsGxsGenericGroupData *groupData, GroupItemInfo &groupItemInfo)
|
||||
{
|
||||
GxsGroupFrameDialog::groupInfoToGroupItemInfo(groupInfo, groupItemInfo, userdata);
|
||||
GxsGroupFrameDialog::groupInfoToGroupItemInfo(groupData, groupItemInfo);
|
||||
|
||||
const PostedGroupInfoData *postedData = dynamic_cast<const PostedGroupInfoData*>(userdata);
|
||||
if (!postedData) {
|
||||
std::cerr << "PostedDialog::groupInfoToGroupItemInfo() Failed to cast data to PostedGroupInfoData";
|
||||
std::cerr << std::endl;
|
||||
const RsPostedGroup *postedGroupData = dynamic_cast<const RsPostedGroup*>(groupData);
|
||||
|
||||
if (!postedGroupData)
|
||||
{
|
||||
std::cerr << "PostedDialog::groupInfoToGroupItemInfo() Failed to cast data to RsPostedGroup"<< std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
QMap<RsGxsGroupId, QString>::const_iterator descriptionIt = postedData->mDescription.find(groupInfo.mGroupId);
|
||||
if (descriptionIt != postedData->mDescription.end()) {
|
||||
groupItemInfo.description = descriptionIt.value();
|
||||
}
|
||||
if(postedGroupData->mGroupImage.mSize > 0)
|
||||
{
|
||||
QPixmap image;
|
||||
GxsIdDetails::loadPixmapFromData(postedGroupData->mGroupImage.mData, postedGroupData->mGroupImage.mSize, image,GxsIdDetails::ORIGINAL);
|
||||
groupItemInfo.icon = image;
|
||||
}
|
||||
else
|
||||
groupItemInfo.icon = QIcon(":icons/png/postedlinks.png");
|
||||
|
||||
QMap<RsGxsGroupId, QIcon>::const_iterator iconIt = postedData->mIcon.find(groupInfo.mGroupId);
|
||||
if (iconIt != postedData->mIcon.end()) {
|
||||
groupItemInfo.icon = iconIt.value();
|
||||
}
|
||||
groupItemInfo.description = QString::fromUtf8(postedGroupData->mDescription.c_str());
|
||||
}
|
||||
|
@ -45,21 +45,23 @@ protected:
|
||||
virtual QString getHelpString() const ;
|
||||
virtual RetroShareLink::enumType getLinkType() { return RetroShareLink::TYPE_POSTED; }
|
||||
virtual GroupFrameSettings::Type groupFrameSettingsType() { return GroupFrameSettings::Posted; }
|
||||
virtual void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo, const RsUserdata *userdata);
|
||||
|
||||
void groupInfoToGroupItemInfo(const RsGxsGenericGroupData *groupData, GroupItemInfo &groupItemInfo) override;
|
||||
bool getGroupData(std::list<RsGxsGenericGroupData*>& groupInfo) override;
|
||||
bool getGroupStatistics(const RsGxsGroupId& groupId,GxsGroupStatistic& stat) override;
|
||||
|
||||
private:
|
||||
/* GxsGroupFrameDialog */
|
||||
virtual QString text(TextType type);
|
||||
virtual QString icon(IconType type);
|
||||
virtual QString settingsGroupName() { return "PostedDialog"; }
|
||||
virtual GxsGroupDialog *createNewGroupDialog(TokenQueue *tokenQueue);
|
||||
virtual GxsGroupDialog *createGroupDialog(TokenQueue *tokenQueue, RsTokenService *tokenService, GxsGroupDialog::Mode mode, RsGxsGroupId groupId);
|
||||
virtual GxsGroupDialog *createNewGroupDialog();
|
||||
virtual GxsGroupDialog *createGroupDialog(GxsGroupDialog::Mode mode, RsGxsGroupId groupId);
|
||||
virtual int shareKeyType();
|
||||
virtual GxsMessageFrameWidget *createMessageFrameWidget(const RsGxsGroupId &groupId);
|
||||
virtual RsGxsCommentService *getCommentService();
|
||||
virtual QWidget *createCommentHeaderWidget(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId);
|
||||
virtual uint32_t requestGroupSummaryType() { return GXS_REQUEST_TYPE_GROUP_DATA; } // request complete group data
|
||||
virtual void loadGroupSummaryToken(const uint32_t &token, std::list<RsGroupMetaData> &groupInfo, RsUserdata* &userdata);
|
||||
|
||||
void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);
|
||||
RsEventsHandlerId_t mEventHandlerId;
|
||||
|
@ -56,13 +56,13 @@ uint32_t PostedCreateDefaultsFlags = ( GXS_GROUP_DEFAULTS_DISTRIB_PUBLIC |
|
||||
uint32_t PostedEditEnabledFlags = PostedCreateEnabledFlags;
|
||||
uint32_t PostedEditDefaultsFlags = PostedCreateDefaultsFlags;
|
||||
|
||||
PostedGroupDialog::PostedGroupDialog(TokenQueue *tokenQueue, QWidget *parent)
|
||||
: GxsGroupDialog(tokenQueue, PostedCreateEnabledFlags, PostedCreateDefaultsFlags, parent)
|
||||
PostedGroupDialog::PostedGroupDialog(QWidget *parent)
|
||||
: GxsGroupDialog(PostedCreateEnabledFlags, PostedCreateDefaultsFlags, parent)
|
||||
{
|
||||
}
|
||||
|
||||
PostedGroupDialog::PostedGroupDialog(TokenQueue *tokenExternalQueue, RsTokenService *tokenService, Mode mode, RsGxsGroupId groupId, QWidget *parent)
|
||||
: GxsGroupDialog(tokenExternalQueue, tokenService, mode, groupId, PostedEditEnabledFlags, PostedEditDefaultsFlags, parent)
|
||||
PostedGroupDialog::PostedGroupDialog(Mode mode, RsGxsGroupId groupId, QWidget *parent)
|
||||
: GxsGroupDialog(mode, groupId, PostedEditEnabledFlags, PostedEditDefaultsFlags, parent)
|
||||
{
|
||||
}
|
||||
|
||||
@ -112,18 +112,19 @@ void PostedGroupDialog::preparePostedGroup(RsPostedGroup &group, const RsGroupMe
|
||||
}
|
||||
}
|
||||
|
||||
bool PostedGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta)
|
||||
bool PostedGroupDialog::service_createGroup(RsGroupMetaData& meta)
|
||||
{
|
||||
// Specific Function.
|
||||
RsPostedGroup grp;
|
||||
preparePostedGroup(grp, meta);
|
||||
|
||||
rsPosted->createGroup(token, grp);
|
||||
if(rsPosted->createBoard(grp))
|
||||
meta = grp.mMeta;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PostedGroupDialog::service_EditGroup(uint32_t &token, RsGroupMetaData &editedMeta)
|
||||
bool PostedGroupDialog::service_updateGroup(const RsGroupMetaData& editedMeta)
|
||||
{
|
||||
RsPostedGroup grp;
|
||||
preparePostedGroup(grp, editedMeta);
|
||||
@ -131,45 +132,48 @@ bool PostedGroupDialog::service_EditGroup(uint32_t &token, RsGroupMetaData &edit
|
||||
std::cerr << "PostedGroupDialog::service_EditGroup() submitting changes";
|
||||
std::cerr << std::endl;
|
||||
|
||||
rsPosted->updateGroup(token, grp);
|
||||
return true;
|
||||
return rsPosted->editBoard(grp);
|
||||
}
|
||||
|
||||
bool PostedGroupDialog::service_loadGroup(uint32_t token, Mode /*mode*/, RsGroupMetaData& groupMetaData, QString &description)
|
||||
bool PostedGroupDialog::service_loadGroup(const RsGxsGenericGroupData *data, Mode mode, QString& description)
|
||||
{
|
||||
std::cerr << "PostedGroupDialog::service_loadGroup(" << token << ")";
|
||||
std::cerr << std::endl;
|
||||
const RsPostedGroup *pgroup = dynamic_cast<const RsPostedGroup*>(data);
|
||||
|
||||
std::vector<RsPostedGroup> groups;
|
||||
if (!rsPosted->getGroupData(token, groups))
|
||||
if(pgroup == nullptr)
|
||||
{
|
||||
std::cerr << "PostedGroupDialog::service_loadGroup() Error getting GroupData";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (groups.size() != 1)
|
||||
{
|
||||
std::cerr << "PostedGroupDialog::service_loadGroup() Error Group.size() != 1";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "PostedGroupDialog::service_loadGroup() Error not a RsPostedGroup" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
std::cerr << "PostedGroupDialog::service_loadGroup() Unfinished Loading";
|
||||
std::cerr << std::endl;
|
||||
|
||||
const RsPostedGroup &group = groups[0];
|
||||
groupMetaData = group.mMeta;
|
||||
const RsPostedGroup& group = *pgroup;
|
||||
description = QString::fromUtf8(group.mDescription.c_str());
|
||||
|
||||
if (group.mGroupImage.mData) {
|
||||
if (group.mGroupImage.mData)
|
||||
{
|
||||
QPixmap pixmap;
|
||||
if (GxsIdDetails::loadPixmapFromData(group.mGroupImage.mData, group.mGroupImage.mSize, pixmap,GxsIdDetails::ORIGINAL))
|
||||
setLogo(pixmap);
|
||||
|
||||
} else {
|
||||
setLogo(QPixmap(":/icons/png/posted.png"));
|
||||
}
|
||||
else
|
||||
setLogo(QPixmap(":/icons/png/posted.png"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PostedGroupDialog::service_getGroupData(const RsGxsGroupId& grpId,RsGxsGenericGroupData *& data)
|
||||
{
|
||||
std::vector<RsPostedGroup> boardsInfo ;
|
||||
|
||||
if( rsPosted->getBoardsInfo(std::list<RsGxsGroupId>({grpId}),boardsInfo) && boardsInfo.size() == 1)
|
||||
{
|
||||
data = new RsPostedGroup(boardsInfo[0]);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
||||
}
|
||||
|
@ -30,15 +30,16 @@ class PostedGroupDialog : public GxsGroupDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PostedGroupDialog(TokenQueue *tokenQueue, QWidget *parent);
|
||||
PostedGroupDialog(TokenQueue *tokenExternalQueue, RsTokenService *tokenService, Mode mode, RsGxsGroupId groupId, QWidget *parent);
|
||||
PostedGroupDialog(QWidget *parent);
|
||||
PostedGroupDialog(Mode mode, RsGxsGroupId groupId, QWidget *parent);
|
||||
|
||||
protected:
|
||||
virtual void initUi();
|
||||
virtual QPixmap serviceImage();
|
||||
virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta);
|
||||
virtual bool service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData, QString &description);
|
||||
virtual bool service_EditGroup(uint32_t &token, RsGroupMetaData &editedMeta);
|
||||
void initUi() override;
|
||||
QPixmap serviceImage() override;
|
||||
bool service_createGroup(RsGroupMetaData& meta) override;
|
||||
bool service_loadGroup(const RsGxsGenericGroupData *data,Mode mode, QString &description) override;
|
||||
bool service_updateGroup(const RsGroupMetaData& editedMeta) override;
|
||||
bool service_getGroupData(const RsGxsGroupId& grpId,RsGxsGenericGroupData *& data) override;
|
||||
|
||||
private:
|
||||
void preparePostedGroup(RsPostedGroup &group, const RsGroupMetaData &meta);
|
||||
|
@ -116,7 +116,7 @@ void GxsChannelPostItem::setup()
|
||||
mCloseOnRead = false;
|
||||
|
||||
/* clear ui */
|
||||
ui->titleLabel->setText(tr("Loading"));
|
||||
ui->titleLabel->setText(tr("Loading..."));
|
||||
ui->datetimelabel->clear();
|
||||
ui->filelabel->clear();
|
||||
ui->newCommentLabel->hide();
|
||||
|
@ -59,7 +59,7 @@ void GxsForumGroupItem::setup()
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
|
||||
/* clear ui */
|
||||
ui->nameLabel->setText(tr("Loading"));
|
||||
ui->nameLabel->setText(tr("Loading..."));
|
||||
ui->titleLabel->clear();
|
||||
ui->descLabel->clear();
|
||||
|
||||
|
@ -97,7 +97,7 @@ void GxsForumMsgItem::setup()
|
||||
mCloseOnRead = false;
|
||||
|
||||
/* clear ui */
|
||||
ui->titleLabel->setText(tr("Loading"));
|
||||
ui->titleLabel->setText(tr("Loading..."));
|
||||
ui->subjectLabel->clear();
|
||||
ui->timestamplabel->clear();
|
||||
ui->parentNameLabel->clear();
|
||||
|
@ -60,7 +60,7 @@ void PostedGroupItem::setup()
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
|
||||
/* clear ui */
|
||||
ui->nameLabel->setText(tr("Loading"));
|
||||
ui->nameLabel->setText(tr("Loading..."));
|
||||
ui->titleLabel->clear();
|
||||
ui->descLabel->clear();
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#include "util/misc.h"
|
||||
#include "util/DateTime.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
#include "GxsGroupDialog.h"
|
||||
#include "gui/common/PeerDefs.h"
|
||||
#include "gui/RetroShareLink.h"
|
||||
@ -63,25 +64,21 @@
|
||||
#define GXSGROUP_INTERNAL_LOADGROUP 3
|
||||
|
||||
/** Constructor */
|
||||
GxsGroupDialog::GxsGroupDialog(TokenQueue *tokenExternalQueue, uint32_t enableFlags, uint32_t defaultFlags, QWidget *parent)
|
||||
: QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint), mTokenService(NULL), mExternalTokenQueue(tokenExternalQueue), mInternalTokenQueue(NULL), mGrpMeta(), mMode(MODE_CREATE), mEnabledFlags(enableFlags), mReadonlyFlags(0), mDefaultsFlags(defaultFlags)
|
||||
GxsGroupDialog::GxsGroupDialog(uint32_t enableFlags, uint32_t defaultFlags, QWidget *parent)
|
||||
: QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint), mGrpMeta(), mMode(MODE_CREATE), mEnabledFlags(enableFlags), mReadonlyFlags(0), mDefaultsFlags(defaultFlags)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
mInternalTokenQueue = NULL;
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
GxsGroupDialog::GxsGroupDialog(TokenQueue *tokenExternalQueue, RsTokenService *tokenService, Mode mode, RsGxsGroupId groupId, uint32_t enableFlags, uint32_t defaultFlags, QWidget *parent)
|
||||
: QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint), mTokenService(NULL), mExternalTokenQueue(tokenExternalQueue), mInternalTokenQueue(NULL), mGrpMeta(), mMode(mode), mEnabledFlags(enableFlags), mReadonlyFlags(0), mDefaultsFlags(defaultFlags)
|
||||
GxsGroupDialog::GxsGroupDialog(Mode mode, RsGxsGroupId groupId, uint32_t enableFlags, uint32_t defaultFlags, QWidget *parent)
|
||||
: QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint), mGrpMeta(), mMode(mode), mEnabledFlags(enableFlags), mReadonlyFlags(0), mDefaultsFlags(defaultFlags)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
mTokenService = tokenService;
|
||||
mInternalTokenQueue = new TokenQueue(tokenService, this);
|
||||
mGrpMeta.mGroupId = groupId;
|
||||
|
||||
init();
|
||||
@ -90,9 +87,6 @@ GxsGroupDialog::GxsGroupDialog(TokenQueue *tokenExternalQueue, RsTokenService *t
|
||||
GxsGroupDialog::~GxsGroupDialog()
|
||||
{
|
||||
Settings->saveWidgetInformation(this);
|
||||
if (mInternalTokenQueue) {
|
||||
delete(mInternalTokenQueue);
|
||||
}
|
||||
}
|
||||
|
||||
void GxsGroupDialog::init()
|
||||
@ -179,6 +173,9 @@ void GxsGroupDialog::showEvent(QShowEvent*)
|
||||
setWindowIcon(serviceWindowIcon());
|
||||
|
||||
initUi();
|
||||
|
||||
if(!mGrpMeta.mGroupId.isNull() && mGrpMeta.mPublishTs == 0) // group not actually loaded yet
|
||||
loadGroup(mGrpMeta.mGroupId);
|
||||
}
|
||||
|
||||
void GxsGroupDialog::setUiText(UiType uiType, const QString &text)
|
||||
@ -237,7 +234,6 @@ void GxsGroupDialog::initMode()
|
||||
ui.stackedWidget->setCurrentIndex(1);
|
||||
mReadonlyFlags = 0xffffffff; // Force all to readonly.
|
||||
ui.buttonBox->setStandardButtons(QDialogButtonBox::Close);
|
||||
requestGroup(mGrpMeta.mGroupId);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -246,7 +242,6 @@ void GxsGroupDialog::initMode()
|
||||
ui.stackedWidget->setCurrentIndex(0);
|
||||
ui.buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||
ui.buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Submit Group Changes"));
|
||||
requestGroup(mGrpMeta.mGroupId);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -596,14 +591,7 @@ void GxsGroupDialog::editGroup()
|
||||
std::cerr << "GxsGroupDialog::editGroup() calling service_EditGroup";
|
||||
std::cerr << std::endl;
|
||||
|
||||
uint32_t token;
|
||||
if (service_EditGroup(token, newMeta))
|
||||
{
|
||||
// get the Queue to handle response.
|
||||
if(mExternalTokenQueue != NULL)
|
||||
mExternalTokenQueue->queueRequest(token, TOKENREQ_GROUPINFO, RS_TOKREQ_ANSTYPE_ACK, GXSGROUP_NEWGROUPID);
|
||||
}
|
||||
else
|
||||
if (!service_updateGroup(newMeta))
|
||||
{
|
||||
std::cerr << "GxsGroupDialog::editGroup() ERROR";
|
||||
std::cerr << std::endl;
|
||||
@ -676,7 +664,6 @@ void GxsGroupDialog::createGroup()
|
||||
return; //Don't add a empty name!!
|
||||
}
|
||||
|
||||
uint32_t token;
|
||||
RsGroupMetaData meta;
|
||||
QString reason;
|
||||
if (!prepareGroupMetaData(meta, reason))
|
||||
@ -686,11 +673,16 @@ void GxsGroupDialog::createGroup()
|
||||
return; //Don't add with invalid circle.
|
||||
}
|
||||
|
||||
if (service_CreateGroup(token, meta))
|
||||
if (service_createGroup(meta))
|
||||
{
|
||||
// get the Queue to handle response.
|
||||
// now update the UI
|
||||
#warning Missing code here!
|
||||
#ifdef TODO
|
||||
//
|
||||
// get the Queue to handle response. What is this for?
|
||||
if(mExternalTokenQueue != NULL)
|
||||
mExternalTokenQueue->queueRequest(token, TOKENREQ_GROUPINFO, RS_TOKREQ_ANSTYPE_ACK, GXSGROUP_NEWGROUPID);
|
||||
#endif
|
||||
}
|
||||
|
||||
close();
|
||||
@ -984,6 +976,40 @@ void GxsGroupDialog::filterComboBoxChanged(int i)
|
||||
Loading Group.
|
||||
***********************************************************************************/
|
||||
|
||||
void GxsGroupDialog::loadGroup(const RsGxsGroupId& grpId)
|
||||
{
|
||||
RsThread::async([this,grpId]()
|
||||
{
|
||||
RsGxsGenericGroupData *groupData;
|
||||
|
||||
if(!service_getGroupData(grpId,groupData))
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << " failed to collect group info " << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
RsQThreadUtils::postToObject( [this,groupData]()
|
||||
{
|
||||
/* Here it goes any code you want to be executed on the Qt Gui
|
||||
* thread, for example to update the data model with new information
|
||||
* after a blocking call to RetroShare API complete, note that
|
||||
* Qt::QueuedConnection is important!
|
||||
*/
|
||||
|
||||
mGrpMeta = groupData->mMeta;
|
||||
|
||||
QString description;
|
||||
|
||||
if (service_loadGroup(groupData, mMode, description))
|
||||
updateFromExistingMeta(description);
|
||||
|
||||
delete groupData;
|
||||
|
||||
}, this );
|
||||
});
|
||||
}
|
||||
|
||||
#ifdef TO_REMOVE
|
||||
void GxsGroupDialog::requestGroup(const RsGxsGroupId &groupId)
|
||||
{
|
||||
RsTokReqOptions opts;
|
||||
@ -1032,3 +1058,4 @@ void GxsGroupDialog::loadRequest(const TokenQueue *queue, const TokenRequest &re
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -108,7 +108,7 @@ public:
|
||||
* The long term plan is perhap logic structure (i.e. code) will be moved into each GXS \n
|
||||
* service for better customisation of group creation, or perhaps not!
|
||||
*/
|
||||
class GxsGroupDialog : public QDialog, public TokenResponse
|
||||
class GxsGroupDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -131,15 +131,12 @@ public:
|
||||
|
||||
/*!
|
||||
* Constructs a GxsGroupDialog for creating group
|
||||
* @param tokenQueue This should be the TokenQueue of the (parent) service
|
||||
* in order to receive acknowledgement of group creation, if set to NULL with create mode \n
|
||||
* creation will not happen
|
||||
* @param enableFlags This determines what options are enabled such as Icon, Description, publish type and key sharing
|
||||
* @param defaultFlags This deter
|
||||
* @param parent The parent dialog
|
||||
* @param mode
|
||||
*/
|
||||
GxsGroupDialog(TokenQueue* tokenQueue, uint32_t enableFlags, uint32_t defaultFlags, QWidget *parent = NULL);
|
||||
GxsGroupDialog(uint32_t enableFlags, uint32_t defaultFlags, QWidget *parent = NULL);
|
||||
|
||||
/*!
|
||||
* Contructs a GxsGroupDialog for display a group or editing
|
||||
@ -147,15 +144,12 @@ public:
|
||||
* @param mode This determines whether the dialog starts in show or edit mode (Edit not supported yet)
|
||||
* @param parent
|
||||
*/
|
||||
GxsGroupDialog(TokenQueue *tokenExternalQueue, RsTokenService *tokenService, Mode mode, RsGxsGroupId groupId, uint32_t enableFlags, uint32_t defaultFlags, QWidget *parent = NULL);
|
||||
GxsGroupDialog(Mode mode, RsGxsGroupId groupId, uint32_t enableFlags, uint32_t defaultFlags, QWidget *parent = NULL);
|
||||
|
||||
~GxsGroupDialog();
|
||||
|
||||
uint32_t mode() { return mMode; }
|
||||
|
||||
// overloaded from TokenResponse
|
||||
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||
|
||||
private:
|
||||
void newGroup();
|
||||
void init();
|
||||
@ -191,24 +185,37 @@ protected:
|
||||
void setUiToolTip(UiType uiType, const QString &text);
|
||||
void setUiText (UiType uiType, const QString &text);
|
||||
|
||||
/*!
|
||||
* It is up to the service to retrieve its own group data, which derives from RsGxsGenericGroupData. That data will be passed down
|
||||
* to the service itself for specific tasks.
|
||||
* \param grpId Id of the group to retrieve
|
||||
* \param data Generic group data for this group. /!\ The pointer should be deleted by the client when released.
|
||||
* \return True if everything does fine.
|
||||
*/
|
||||
virtual bool service_getGroupData(const RsGxsGroupId& grpId,RsGxsGenericGroupData *& data) = 0;
|
||||
|
||||
/*!
|
||||
* It is up to the service to do the actual group creation
|
||||
* Service can also modify initial meta going into group
|
||||
* @param token This should be set to the token retrieved
|
||||
* @param meta The deriving GXS service should set their grp meta to this value
|
||||
*/
|
||||
virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta) = 0;
|
||||
virtual bool service_createGroup(RsGroupMetaData& meta) = 0;
|
||||
|
||||
/*!
|
||||
* It is up to the service to do the actual group editing
|
||||
* @param token This should be set to the token retrieved
|
||||
* @param meta The deriving GXS service should set their grp meta to this value
|
||||
*/
|
||||
virtual bool service_EditGroup(uint32_t &token, RsGroupMetaData &editedMeta) = 0;
|
||||
virtual bool service_updateGroup(const RsGroupMetaData& editedMeta) = 0;
|
||||
|
||||
// To be overloaded by users.
|
||||
// use Token to retrieve from service, fill in metaData.
|
||||
virtual bool service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData, QString &description) = 0;
|
||||
/*!
|
||||
* Should be overloaded by the service in order to extract meaningful information from the group data (that is usually group-specific).
|
||||
* One of them however, common to all groups is the description. So it is returned by this method so that the GxsGroupDialog updates it.
|
||||
* \param data Generic group data, to be dynamic_cast by the client to specific service-level group data
|
||||
* \param mode Editing mode (?)
|
||||
* \param description Description string for the group. Common to all services, but still present in the service-specific data part.
|
||||
* \return
|
||||
*/
|
||||
virtual bool service_loadGroup(const RsGxsGenericGroupData *data, Mode mode, QString &description) = 0;
|
||||
|
||||
/*!
|
||||
* This returns a group logo from the ui \n
|
||||
@ -270,8 +277,7 @@ private:
|
||||
void loadNewGroupId(const uint32_t &token);
|
||||
|
||||
// loading existing Groups.
|
||||
void requestGroup(const RsGxsGroupId &groupId);
|
||||
void loadGroup(uint32_t token);
|
||||
void loadGroup(const RsGxsGroupId &groupId);
|
||||
void updateFromExistingMeta(const QString &description);
|
||||
|
||||
bool prepareGroupMetaData(RsGroupMetaData &meta, QString &reason);
|
||||
|
@ -33,6 +33,8 @@
|
||||
#include "gui/notifyqt.h"
|
||||
#include "gui/common/UIStateHelper.h"
|
||||
#include "gui/common/UserNotify.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
#include "retroshare/rsgxsifacetypes.h"
|
||||
#include "GxsCommentDialog.h"
|
||||
|
||||
//#define DEBUG_GROUPFRAMEDIALOG
|
||||
@ -86,8 +88,6 @@ GxsGroupFrameDialog::GxsGroupFrameDialog(RsGxsIfaceHelper *ifaceImpl, QWidget *p
|
||||
|
||||
/* Setup Queue */
|
||||
mInterface = ifaceImpl;
|
||||
mTokenService = mInterface->getTokenService();
|
||||
mTokenQueue = new TokenQueue(mInterface->getTokenService(), this);
|
||||
|
||||
/* Setup UI helper */
|
||||
mStateHelper = new UIStateHelper(this);
|
||||
@ -125,7 +125,6 @@ GxsGroupFrameDialog::~GxsGroupFrameDialog()
|
||||
// save settings
|
||||
processSettings(false);
|
||||
|
||||
delete(mTokenQueue);
|
||||
delete(ui);
|
||||
}
|
||||
|
||||
@ -134,7 +133,9 @@ void GxsGroupFrameDialog::getGroupList(std::map<RsGxsGroupId, RsGroupMetaData> &
|
||||
group_list = mCachedGroupMetas ;
|
||||
|
||||
if(group_list.empty())
|
||||
requestGroupSummary();
|
||||
updateGroupSummary();
|
||||
else
|
||||
std::cerr << "************** Using cached GroupMetaData" << std::endl;
|
||||
}
|
||||
void GxsGroupFrameDialog::initUi()
|
||||
{
|
||||
@ -168,20 +169,20 @@ void GxsGroupFrameDialog::initUi()
|
||||
connect(NotifyQt::getInstance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
|
||||
settingsChanged();
|
||||
}
|
||||
|
||||
mInitialized = true;
|
||||
}
|
||||
|
||||
void GxsGroupFrameDialog::showEvent(QShowEvent *event)
|
||||
{
|
||||
if (!mInitialized) {
|
||||
if (!mInitialized )
|
||||
{
|
||||
/* Problem: virtual methods cannot be used in constructor */
|
||||
mInitialized = true;
|
||||
|
||||
initUi();
|
||||
}
|
||||
|
||||
updateDisplay(true);
|
||||
|
||||
// RsGxsUpdateBroadcastPage::showEvent(event);
|
||||
updateDisplay( mCachedGroupMetas.empty() );
|
||||
}
|
||||
|
||||
void GxsGroupFrameDialog::processSettings(bool load)
|
||||
@ -242,7 +243,7 @@ void GxsGroupFrameDialog::setHideTabBarWithOneTab(bool hideTabBarWithOneTab)
|
||||
void GxsGroupFrameDialog::updateDisplay(bool complete)
|
||||
{
|
||||
if(complete) // || !getGrpIds().empty() || !getGrpIdsMeta().empty()) {
|
||||
requestGroupSummary(); /* Update group list */
|
||||
updateGroupSummary(); /* Update group list */
|
||||
|
||||
updateSearchResults() ;
|
||||
}
|
||||
@ -546,7 +547,8 @@ void GxsGroupFrameDialog::restoreGroupKeys(void)
|
||||
|
||||
void GxsGroupFrameDialog::newGroup()
|
||||
{
|
||||
GxsGroupDialog *dialog = createNewGroupDialog(mTokenQueue);
|
||||
GxsGroupDialog *dialog = createNewGroupDialog();
|
||||
|
||||
if (!dialog) {
|
||||
return;
|
||||
}
|
||||
@ -573,8 +575,6 @@ void GxsGroupFrameDialog::groupSubscribe(bool subscribe)
|
||||
|
||||
uint32_t token;
|
||||
mInterface->subscribeToGroup(token, mGroupId, subscribe);
|
||||
// Replaced by meta data changed
|
||||
// mTokenQueue->queueRequest(token, 0, RS_TOKREQ_ANSTYPE_ACK, TOKEN_TYPE_SUBSCRIBE_CHANGE);
|
||||
}
|
||||
|
||||
void GxsGroupFrameDialog::showGroupDetails()
|
||||
@ -583,7 +583,7 @@ void GxsGroupFrameDialog::showGroupDetails()
|
||||
return;
|
||||
}
|
||||
|
||||
GxsGroupDialog *dialog = createGroupDialog(mTokenQueue, mInterface->getTokenService(), GxsGroupDialog::MODE_SHOW, mGroupId);
|
||||
GxsGroupDialog *dialog = createGroupDialog(GxsGroupDialog::MODE_SHOW, mGroupId);
|
||||
if (!dialog) {
|
||||
return;
|
||||
}
|
||||
@ -598,7 +598,7 @@ void GxsGroupFrameDialog::editGroupDetails()
|
||||
return;
|
||||
}
|
||||
|
||||
GxsGroupDialog *dialog = createGroupDialog(mTokenQueue, mInterface->getTokenService(), GxsGroupDialog::MODE_EDIT, mGroupId);
|
||||
GxsGroupDialog *dialog = createGroupDialog(GxsGroupDialog::MODE_EDIT, mGroupId);
|
||||
if (!dialog) {
|
||||
return;
|
||||
}
|
||||
@ -896,16 +896,16 @@ void GxsGroupFrameDialog::messageTabWaitingChanged(QWidget *widget)
|
||||
}
|
||||
|
||||
///***** INSERT GROUP LISTS *****/
|
||||
void GxsGroupFrameDialog::groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo, const RsUserdata */*userdata*/)
|
||||
void GxsGroupFrameDialog::groupInfoToGroupItemInfo(const RsGxsGenericGroupData *groupInfo, GroupItemInfo &groupItemInfo)
|
||||
{
|
||||
groupItemInfo.id = QString::fromStdString(groupInfo.mGroupId.toStdString());
|
||||
groupItemInfo.name = QString::fromUtf8(groupInfo.mGroupName.c_str());
|
||||
groupItemInfo.popularity = groupInfo.mPop;
|
||||
groupItemInfo.lastpost = QDateTime::fromTime_t(groupInfo.mLastPost);
|
||||
groupItemInfo.subscribeFlags = groupInfo.mSubscribeFlags;
|
||||
groupItemInfo.publishKey = IS_GROUP_PUBLISHER(groupInfo.mSubscribeFlags) ;
|
||||
groupItemInfo.adminKey = IS_GROUP_ADMIN(groupInfo.mSubscribeFlags) ;
|
||||
groupItemInfo.max_visible_posts = groupInfo.mVisibleMsgCount ;
|
||||
groupItemInfo.id = QString::fromStdString(groupInfo->mMeta.mGroupId.toStdString());
|
||||
groupItemInfo.name = QString::fromUtf8(groupInfo->mMeta.mGroupName.c_str());
|
||||
groupItemInfo.popularity = groupInfo->mMeta.mPop;
|
||||
groupItemInfo.lastpost = QDateTime::fromTime_t(groupInfo->mMeta.mLastPost);
|
||||
groupItemInfo.subscribeFlags = groupInfo->mMeta.mSubscribeFlags;
|
||||
groupItemInfo.publishKey = IS_GROUP_PUBLISHER(groupInfo->mMeta.mSubscribeFlags) ;
|
||||
groupItemInfo.adminKey = IS_GROUP_ADMIN(groupInfo->mMeta.mSubscribeFlags) ;
|
||||
groupItemInfo.max_visible_posts = groupInfo->mMeta.mVisibleMsgCount ;
|
||||
|
||||
#if TOGXS
|
||||
if (groupInfo.mGroupFlags & RS_DISTRIB_AUTHEN_REQ) {
|
||||
@ -919,7 +919,7 @@ void GxsGroupFrameDialog::groupInfoToGroupItemInfo(const RsGroupMetaData &groupI
|
||||
}
|
||||
}
|
||||
|
||||
void GxsGroupFrameDialog::insertGroupsData(const std::map<RsGxsGroupId,RsGroupMetaData> &groupList, const RsUserdata *userdata)
|
||||
void GxsGroupFrameDialog::insertGroupsData(const std::list<RsGxsGenericGroupData*>& groupList)
|
||||
{
|
||||
if (!mInitialized) {
|
||||
return;
|
||||
@ -933,54 +933,40 @@ void GxsGroupFrameDialog::insertGroupsData(const std::map<RsGxsGroupId,RsGroupMe
|
||||
QList<GroupItemInfo> otherList;
|
||||
std::multimap<uint32_t, GroupItemInfo> popMap;
|
||||
|
||||
for (auto it = groupList.begin(); it != groupList.end(); ++it) {
|
||||
for (auto& g:groupList)
|
||||
{
|
||||
/* sort it into Publish (Own), Subscribed, Popular and Other */
|
||||
uint32_t flags = it->second.mSubscribeFlags;
|
||||
uint32_t flags = g->mMeta.mSubscribeFlags;
|
||||
|
||||
GroupItemInfo groupItemInfo;
|
||||
groupInfoToGroupItemInfo(it->second, groupItemInfo, userdata);
|
||||
groupInfoToGroupItemInfo(g, groupItemInfo);
|
||||
|
||||
if (IS_GROUP_SUBSCRIBED(flags))
|
||||
{
|
||||
if (IS_GROUP_ADMIN(flags))
|
||||
{
|
||||
adminList.push_back(groupItemInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* subscribed group */
|
||||
subList.push_back(groupItemInfo);
|
||||
}
|
||||
subList.push_back(groupItemInfo); /* subscribed group */
|
||||
}
|
||||
else
|
||||
{
|
||||
//popMap.insert(std::make_pair(it->mPop, groupItemInfo)); /* rate the others by popularity */
|
||||
popMap.insert(std::make_pair(it->second.mLastPost, groupItemInfo)); /* rate the others by time of last post */
|
||||
}
|
||||
{
|
||||
popMap.insert(std::make_pair(g->mMeta.mLastPost, groupItemInfo)); /* rate the others by time of last post */
|
||||
}
|
||||
}
|
||||
|
||||
/* iterate backwards through popMap - take the top 5 or 10% of list */
|
||||
uint32_t popCount = 5;
|
||||
if (popCount < popMap.size() / 10)
|
||||
{
|
||||
popCount = popMap.size() / 10;
|
||||
}
|
||||
|
||||
uint32_t i = 0;
|
||||
std::multimap<uint32_t, GroupItemInfo>::reverse_iterator rit;
|
||||
//uint32_t popLimit = 0;
|
||||
//for(rit = popMap.rbegin(); ((rit != popMap.rend()) && (i < popCount)); ++rit, ++i) ;
|
||||
//if (rit != popMap.rend()) {
|
||||
// popLimit = rit->first;
|
||||
//}
|
||||
|
||||
for (rit = popMap.rbegin(); rit != popMap.rend(); ++rit,++i) {
|
||||
//if (rit->second.popularity > (int) popLimit) {
|
||||
for (rit = popMap.rbegin(); rit != popMap.rend(); ++rit,++i)
|
||||
if(i < popCount)
|
||||
popList.append(rit->second);
|
||||
else
|
||||
otherList.append(rit->second);
|
||||
}
|
||||
|
||||
/* now we can add them in as a tree! */
|
||||
ui->groupTreeWidget->fillGroupItems(mYourGroups, adminList);
|
||||
@ -995,9 +981,8 @@ void GxsGroupFrameDialog::insertGroupsData(const std::map<RsGxsGroupId,RsGroupMe
|
||||
mInFill = false;
|
||||
|
||||
/* Re-fill group */
|
||||
if (!ui->groupTreeWidget->activateId(QString::fromStdString(mGroupId.toStdString()), true)) {
|
||||
if (!ui->groupTreeWidget->activateId(QString::fromStdString(mGroupId.toStdString()), true))
|
||||
mGroupId.clear();
|
||||
}
|
||||
|
||||
updateMessageSummaryList(RsGxsGroupId());
|
||||
}
|
||||
@ -1008,7 +993,8 @@ void GxsGroupFrameDialog::updateMessageSummaryList(RsGxsGroupId groupId)
|
||||
return;
|
||||
}
|
||||
|
||||
if (groupId.isNull()) {
|
||||
if (groupId.isNull())
|
||||
{
|
||||
QTreeWidgetItem *items[2] = { mYourGroups, mSubscribedGroups };
|
||||
for (int item = 0; item < 2; ++item) {
|
||||
int child;
|
||||
@ -1016,22 +1002,73 @@ void GxsGroupFrameDialog::updateMessageSummaryList(RsGxsGroupId groupId)
|
||||
for (child = 0; child < childCount; ++child) {
|
||||
QTreeWidgetItem *childItem = items[item]->child(child);
|
||||
QString childId = ui->groupTreeWidget->itemId(childItem);
|
||||
if (childId.isEmpty()) {
|
||||
if (childId.isEmpty())
|
||||
continue;
|
||||
}
|
||||
|
||||
requestGroupStatistics(RsGxsGroupId(childId.toLatin1().constData()));
|
||||
updateGroupStatistics(RsGxsGroupId(childId.toLatin1().constData()));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
requestGroupStatistics(groupId);
|
||||
}
|
||||
else
|
||||
updateGroupStatistics(groupId);
|
||||
}
|
||||
|
||||
/*********************** **** **** **** ***********************/
|
||||
/** Request / Response of Data ********************************/
|
||||
/*********************** **** **** **** ***********************/
|
||||
|
||||
void GxsGroupFrameDialog::updateGroupSummary()
|
||||
{
|
||||
RsThread::async([this]()
|
||||
{
|
||||
std::list<RsGxsGenericGroupData*> groupInfo;
|
||||
|
||||
if(!getGroupData(groupInfo))
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << " failed to collect group info " << std::endl;
|
||||
return;
|
||||
}
|
||||
if(groupInfo.empty())
|
||||
return;
|
||||
|
||||
RsQThreadUtils::postToObject( [this,groupInfo]()
|
||||
{
|
||||
/* Here it goes any code you want to be executed on the Qt Gui
|
||||
* thread, for example to update the data model with new information
|
||||
* after a blocking call to RetroShare API complete, note that
|
||||
* Qt::QueuedConnection is important!
|
||||
*/
|
||||
|
||||
insertGroupsData(groupInfo);
|
||||
updateSearchResults();
|
||||
|
||||
mStateHelper->setLoading(TOKEN_TYPE_GROUP_SUMMARY, false);
|
||||
|
||||
if (!mNavigatePendingGroupId.isNull()) {
|
||||
/* Navigate pending */
|
||||
navigate(mNavigatePendingGroupId, mNavigatePendingMsgId);
|
||||
|
||||
mNavigatePendingGroupId.clear();
|
||||
mNavigatePendingMsgId.clear();
|
||||
}
|
||||
|
||||
// update the local cache in order to avoid re-asking the data when the UI wants it (this happens on ::show() for instance)
|
||||
|
||||
mCachedGroupMetas.clear();
|
||||
|
||||
// now delete the data that is not used anymore
|
||||
|
||||
for(auto& g:groupInfo)
|
||||
{
|
||||
mCachedGroupMetas[g->mMeta.mGroupId] = g->mMeta;
|
||||
delete g;
|
||||
}
|
||||
|
||||
}, this );
|
||||
});
|
||||
}
|
||||
|
||||
#ifdef TO_REMOVE
|
||||
void GxsGroupFrameDialog::requestGroupSummary()
|
||||
{
|
||||
mStateHelper->setLoading(TOKEN_TYPE_GROUP_SUMMARY, true);
|
||||
@ -1056,37 +1093,14 @@ void GxsGroupFrameDialog::loadGroupSummaryToken(const uint32_t &token, std::list
|
||||
mInterface->getGroupSummary(token, groupInfo);
|
||||
}
|
||||
|
||||
void GxsGroupFrameDialog::loadGroupSummary(const uint32_t &token)
|
||||
void GxsGroupFrameDialog::loadGroupSummary(const std::list<RsGxsGenericGroupData*>& groupInfo)
|
||||
{
|
||||
#ifdef DEBUG_GROUPFRAMEDIALOG
|
||||
std::cerr << "GxsGroupFrameDialog::loadGroupSummary()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
std::list<RsGroupMetaData> groupInfo;
|
||||
RsUserdata *userdata = NULL;
|
||||
loadGroupSummaryToken(token, groupInfo, userdata);
|
||||
|
||||
mCachedGroupMetas.clear();
|
||||
for(auto it(groupInfo.begin());it!=groupInfo.end();++it)
|
||||
mCachedGroupMetas[(*it).mGroupId] = *it;
|
||||
|
||||
insertGroupsData(mCachedGroupMetas, userdata);
|
||||
updateSearchResults();
|
||||
|
||||
mStateHelper->setLoading(TOKEN_TYPE_GROUP_SUMMARY, false);
|
||||
|
||||
if (userdata) {
|
||||
delete(userdata);
|
||||
}
|
||||
|
||||
if (!mNavigatePendingGroupId.isNull()) {
|
||||
/* Navigate pending */
|
||||
navigate(mNavigatePendingGroupId, mNavigatePendingMsgId);
|
||||
|
||||
mNavigatePendingGroupId.clear();
|
||||
mNavigatePendingMsgId.clear();
|
||||
}
|
||||
}
|
||||
|
||||
/*********************** **** **** **** ***********************/
|
||||
@ -1145,17 +1159,44 @@ void GxsGroupFrameDialog::loadGroupSummary(const uint32_t &token)
|
||||
|
||||
// setValid(true);
|
||||
//}
|
||||
#endif
|
||||
|
||||
/*********************** **** **** **** ***********************/
|
||||
/*********************** **** **** **** ***********************/
|
||||
|
||||
void GxsGroupFrameDialog::requestGroupStatistics(const RsGxsGroupId &groupId)
|
||||
void GxsGroupFrameDialog::updateGroupStatistics(const RsGxsGroupId &groupId)
|
||||
{
|
||||
uint32_t token;
|
||||
mTokenService->requestGroupStatistic(token, groupId);
|
||||
mTokenQueue->queueRequest(token, 0, RS_TOKREQ_ANSTYPE_ACK, TOKEN_TYPE_STATISTICS);
|
||||
RsThread::async([this,groupId]()
|
||||
{
|
||||
GxsGroupStatistic stats;
|
||||
|
||||
if(! getGroupStatistics(groupId, stats))
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << " failed to collect group statistics for group " << groupId << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
RsQThreadUtils::postToObject( [this,stats]()
|
||||
{
|
||||
/* Here it goes any code you want to be executed on the Qt Gui
|
||||
* thread, for example to update the data model with new information
|
||||
* after a blocking call to RetroShare API complete, note that
|
||||
* Qt::QueuedConnection is important!
|
||||
*/
|
||||
|
||||
QTreeWidgetItem *item = ui->groupTreeWidget->getItemFromId(QString::fromStdString(stats.mGrpId.toStdString()));
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
ui->groupTreeWidget->setUnreadCount(item, mCountChildMsgs ? (stats.mNumThreadMsgsUnread + stats.mNumChildMsgsUnread) : stats.mNumThreadMsgsUnread);
|
||||
|
||||
getUserNotify()->updateIcon();
|
||||
|
||||
}, this );
|
||||
});
|
||||
}
|
||||
|
||||
#ifdef TO_REMOVE
|
||||
void GxsGroupFrameDialog::loadGroupStatistics(const uint32_t &token)
|
||||
{
|
||||
GxsGroupStatistic stats;
|
||||
@ -1186,9 +1227,9 @@ void GxsGroupFrameDialog::loadRequest(const TokenQueue *queue, const TokenReques
|
||||
/* now switch on req */
|
||||
switch(req.mUserType)
|
||||
{
|
||||
case TOKEN_TYPE_GROUP_SUMMARY:
|
||||
loadGroupSummary(req.mToken);
|
||||
break;
|
||||
// case TOKEN_TYPE_GROUP_SUMMARY:
|
||||
// loadGroupSummary(req.mToken);
|
||||
// break;
|
||||
|
||||
// case TOKEN_TYPE_SUBSCRIBE_CHANGE:
|
||||
// acknowledgeSubscribeChange(req.mToken);
|
||||
@ -1208,6 +1249,7 @@ void GxsGroupFrameDialog::loadRequest(const TokenQueue *queue, const TokenReques
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
TurtleRequestId GxsGroupFrameDialog::distantSearch(const QString& search_string) // this should be overloaded in the child class
|
||||
{
|
||||
|
@ -44,7 +44,7 @@ class UIStateHelper;
|
||||
struct RsGxsCommentService;
|
||||
class GxsCommentDialog;
|
||||
|
||||
class GxsGroupFrameDialog : public MainPage, public TokenResponse
|
||||
class GxsGroupFrameDialog : public MainPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -76,9 +76,6 @@ public:
|
||||
|
||||
bool navigate(const RsGxsGroupId &groupId, const RsGxsMessageId& msgId);
|
||||
|
||||
// Callback for all Loads.
|
||||
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||
|
||||
virtual QString getHelpString() const =0;
|
||||
|
||||
virtual void getGroupList(std::map<RsGxsGroupId,RsGroupMetaData> &groups) ;
|
||||
@ -93,12 +90,18 @@ protected:
|
||||
bool getCurrentGroupName(QString& name);
|
||||
virtual RetroShareLink::enumType getLinkType() = 0;
|
||||
virtual GroupFrameSettings::Type groupFrameSettingsType() { return GroupFrameSettings::Nothing; }
|
||||
virtual void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo, const RsUserdata *userdata);
|
||||
virtual void groupInfoToGroupItemInfo(const RsGxsGenericGroupData *groupInfo, GroupItemInfo &groupItemInfo);
|
||||
virtual void checkRequestGroup(const RsGxsGroupId& /* grpId */) {} // overload this one in order to retrieve full group data when the group is browsed
|
||||
|
||||
void updateMessageSummaryList(RsGxsGroupId groupId);
|
||||
void updateGroupStatistics(const RsGxsGroupId &groupId);
|
||||
|
||||
virtual const std::set<TurtleRequestId> getSearchRequests() const { return std::set<TurtleRequestId>(); } // overload this for subclasses that provide distant search
|
||||
|
||||
// These two need to be overloaded by subsclasses, possibly calling the blocking API, since they are used asynchroneously.
|
||||
|
||||
virtual bool getGroupData(std::list<RsGxsGenericGroupData*>& groupInfo) =0;
|
||||
virtual bool getGroupStatistics(const RsGxsGroupId& groupId,GxsGroupStatistic& stat) =0;
|
||||
private slots:
|
||||
void todo();
|
||||
|
||||
@ -145,8 +148,8 @@ private:
|
||||
virtual QString settingsGroupName() = 0;
|
||||
virtual TurtleRequestId distantSearch(const QString& search_string) ;
|
||||
|
||||
virtual GxsGroupDialog *createNewGroupDialog(TokenQueue *tokenQueue) = 0;
|
||||
virtual GxsGroupDialog *createGroupDialog(TokenQueue *tokenQueue, RsTokenService *tokenService, GxsGroupDialog::Mode mode, RsGxsGroupId groupId) = 0;
|
||||
virtual GxsGroupDialog *createNewGroupDialog() = 0;
|
||||
virtual GxsGroupDialog *createGroupDialog(GxsGroupDialog::Mode mode, RsGxsGroupId groupId) = 0;
|
||||
virtual int shareKeyType() = 0;
|
||||
virtual GxsMessageFrameWidget *createMessageFrameWidget(const RsGxsGroupId &groupId) = 0;
|
||||
virtual void groupTreeCustomActions(RsGxsGroupId /*grpId*/, int /*subscribeFlags*/, QList<QAction*> &/*actions*/) {}
|
||||
@ -162,12 +165,13 @@ private:
|
||||
void processSettings(bool load);
|
||||
|
||||
// New Request/Response Loading Functions.
|
||||
void insertGroupsData(const std::map<RsGxsGroupId, RsGroupMetaData> &groupList, const RsUserdata *userdata);
|
||||
void insertGroupsData(const std::list<RsGxsGenericGroupData *> &groupList);
|
||||
|
||||
//void requestGroupSummary();
|
||||
void updateGroupSummary();
|
||||
void loadGroupSummary(const std::list<RsGxsGenericGroupData *> &groupInfo);
|
||||
|
||||
void requestGroupSummary();
|
||||
void loadGroupSummary(const uint32_t &token);
|
||||
virtual uint32_t requestGroupSummaryType() { return GXS_REQUEST_TYPE_GROUP_META; } // request only meta data
|
||||
virtual void loadGroupSummaryToken(const uint32_t &token, std::list<RsGroupMetaData> &groupInfo, RsUserdata* &userdata); // use with requestGroupSummaryType
|
||||
|
||||
void requestGroupStatistics(const RsGxsGroupId &groupId);
|
||||
void loadGroupStatistics(const uint32_t &token);
|
||||
@ -195,8 +199,6 @@ private:
|
||||
QString mSettingsName;
|
||||
RsGxsGroupId mGroupId;
|
||||
RsGxsIfaceHelper *mInterface;
|
||||
RsTokenService *mTokenService;
|
||||
TokenQueue *mTokenQueue;
|
||||
GxsMessageFrameWidget *mMessageWidget;
|
||||
|
||||
QTreeWidgetItem *mYourGroups;
|
||||
|
@ -935,7 +935,7 @@ QPixmap GxsIdDetails::drawIdentIcon( QString hash, quint16 width, bool rotate)
|
||||
|
||||
QString GxsIdDetails::getLoadingText(const RsGxsId &id)
|
||||
{
|
||||
return QString("%1... %2").arg(QApplication::translate("GxsIdDetails", "Loading"), QString::fromStdString(id.toStdString().substr(0, 5)));
|
||||
return QString("%1... %2").arg(QApplication::translate("GxsIdDetails", "Loading..."), QString::fromStdString(id.toStdString().substr(0, 5)));
|
||||
}
|
||||
|
||||
QString GxsIdDetails::getFailedText(const RsGxsId &id)
|
||||
|
@ -50,7 +50,7 @@ GxsMessageFramePostWidget::~GxsMessageFramePostWidget()
|
||||
|
||||
void GxsMessageFramePostWidget::groupIdChanged()
|
||||
{
|
||||
mGroupName = groupId().isNull () ? "" : tr("Loading");
|
||||
mGroupName = groupId().isNull () ? "" : tr("Loading...");
|
||||
groupNameChanged(mGroupName);
|
||||
|
||||
emit groupChanged(this);
|
||||
|
@ -36,15 +36,15 @@
|
||||
#include "gui/common/GroupTreeWidget.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
|
||||
class GxsChannelGroupInfoData : public RsUserdata
|
||||
{
|
||||
public:
|
||||
GxsChannelGroupInfoData() : RsUserdata() {}
|
||||
|
||||
public:
|
||||
QMap<RsGxsGroupId, QIcon> mIcon;
|
||||
QMap<RsGxsGroupId, QString> mDescription;
|
||||
};
|
||||
// class GxsChannelGroupInfoData : public RsUserdata
|
||||
// {
|
||||
// public:
|
||||
// GxsChannelGroupInfoData() : RsUserdata() {}
|
||||
//
|
||||
// public:
|
||||
// QMap<RsGxsGroupId, QIcon> mIcon;
|
||||
// QMap<RsGxsGroupId, QString> mDescription;
|
||||
// };
|
||||
|
||||
/** Constructor */
|
||||
GxsChannelDialog::GxsChannelDialog(QWidget *parent)
|
||||
@ -181,14 +181,14 @@ QString GxsChannelDialog::icon(IconType type)
|
||||
return "";
|
||||
}
|
||||
|
||||
GxsGroupDialog *GxsChannelDialog::createNewGroupDialog(TokenQueue *tokenQueue)
|
||||
GxsGroupDialog *GxsChannelDialog::createNewGroupDialog()
|
||||
{
|
||||
return new GxsChannelGroupDialog(tokenQueue, this);
|
||||
return new GxsChannelGroupDialog(this);
|
||||
}
|
||||
|
||||
GxsGroupDialog *GxsChannelDialog::createGroupDialog(TokenQueue *tokenQueue, RsTokenService *tokenService, GxsGroupDialog::Mode mode, RsGxsGroupId groupId)
|
||||
GxsGroupDialog *GxsChannelDialog::createGroupDialog(GxsGroupDialog::Mode mode, RsGxsGroupId groupId)
|
||||
{
|
||||
return new GxsChannelGroupDialog(tokenQueue, tokenService, mode, groupId, this);
|
||||
return new GxsChannelGroupDialog(mode, groupId, this);
|
||||
}
|
||||
|
||||
int GxsChannelDialog::shareKeyType()
|
||||
@ -344,6 +344,29 @@ void GxsChannelDialog::toggleAutoDownload()
|
||||
});
|
||||
}
|
||||
|
||||
bool GxsChannelDialog::getGroupStatistics(const RsGxsGroupId& groupId,GxsGroupStatistic& stat)
|
||||
{
|
||||
return rsGxsChannels->getChannelStatistics(groupId,stat);
|
||||
}
|
||||
|
||||
bool GxsChannelDialog::getGroupData(std::list<RsGxsGenericGroupData*>& groupInfo)
|
||||
{
|
||||
std::vector<RsGxsChannelGroup> groups;
|
||||
|
||||
// request all group infos at once
|
||||
|
||||
if(! rsGxsChannels->getChannelsInfo(std::list<RsGxsGroupId>(),groups))
|
||||
return false;
|
||||
|
||||
/* Save groups to fill icons and description */
|
||||
|
||||
for (auto& group: groups)
|
||||
groupInfo.push_back(new RsGxsChannelGroup(group));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef TO_REMOVE
|
||||
void GxsChannelDialog::loadGroupSummaryToken(const uint32_t &token, std::list<RsGroupMetaData> &groupInfo, RsUserdata *&userdata)
|
||||
{
|
||||
std::vector<RsGxsChannelGroup> groups;
|
||||
@ -369,27 +392,30 @@ void GxsChannelDialog::loadGroupSummaryToken(const uint32_t &token, std::list<Rs
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void GxsChannelDialog::groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo, const RsUserdata *userdata)
|
||||
void GxsChannelDialog::groupInfoToGroupItemInfo(const RsGxsGenericGroupData *groupData, GroupItemInfo &groupItemInfo)
|
||||
{
|
||||
GxsGroupFrameDialog::groupInfoToGroupItemInfo(groupInfo, groupItemInfo, userdata);
|
||||
GxsGroupFrameDialog::groupInfoToGroupItemInfo(groupData, groupItemInfo);
|
||||
|
||||
const GxsChannelGroupInfoData *channelData = dynamic_cast<const GxsChannelGroupInfoData*>(userdata);
|
||||
if (!channelData) {
|
||||
std::cerr << "GxsChannelDialog::groupInfoToGroupItemInfo() Failed to cast data to GxsChannelGroupInfoData";
|
||||
std::cerr << std::endl;
|
||||
const RsGxsChannelGroup *channelGroupData = dynamic_cast<const RsGxsChannelGroup*>(groupData);
|
||||
|
||||
if (!channelGroupData)
|
||||
{
|
||||
std::cerr << "GxsChannelDialog::groupInfoToGroupItemInfo() Failed to cast data to GxsChannelGroupInfoData"<< std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
QMap<RsGxsGroupId, QString>::const_iterator descriptionIt = channelData->mDescription.find(groupInfo.mGroupId);
|
||||
if (descriptionIt != channelData->mDescription.end()) {
|
||||
groupItemInfo.description = descriptionIt.value();
|
||||
if(channelGroupData->mImage.mSize > 0)
|
||||
{
|
||||
QPixmap image;
|
||||
GxsIdDetails::loadPixmapFromData(channelGroupData->mImage.mData, channelGroupData->mImage.mSize, image,GxsIdDetails::ORIGINAL);
|
||||
groupItemInfo.icon = image;
|
||||
}
|
||||
else
|
||||
groupItemInfo.icon = QIcon(":icons/png/channel.png");
|
||||
|
||||
QMap<RsGxsGroupId, QIcon>::const_iterator iconIt = channelData->mIcon.find(groupInfo.mGroupId);
|
||||
if (iconIt != channelData->mIcon.end()) {
|
||||
groupItemInfo.icon = iconIt.value();
|
||||
}
|
||||
groupItemInfo.description = QString::fromUtf8(channelGroupData->mDescription.c_str());
|
||||
}
|
||||
|
||||
TurtleRequestId GxsChannelDialog::distantSearch(const QString& search_string)
|
||||
|
@ -43,17 +43,22 @@ public:
|
||||
|
||||
protected:
|
||||
/* GxsGroupFrameDialog */
|
||||
virtual RetroShareLink::enumType getLinkType() { return RetroShareLink::TYPE_CHANNEL; }
|
||||
virtual GroupFrameSettings::Type groupFrameSettingsType() { return GroupFrameSettings::Channel; }
|
||||
virtual QString getHelpString() const ;
|
||||
virtual void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo, const RsUserdata *userdata);
|
||||
virtual bool getDistantSearchResults(TurtleRequestId id, std::map<RsGxsGroupId,RsGxsGroupSummary>& group_infos);
|
||||
virtual const std::set<TurtleRequestId> getSearchRequests() const override { return mSearchResults ; }
|
||||
|
||||
virtual TurtleRequestId distantSearch(const QString& search_string) ;
|
||||
virtual void checkRequestGroup(const RsGxsGroupId& grpId) ;
|
||||
|
||||
virtual UserNotify *createUserNotify(QObject *parent) override;
|
||||
// Implementation of some abstract methods in GxsGroupFrameDialog
|
||||
|
||||
virtual QString getHelpString() const override;
|
||||
GroupFrameSettings::Type groupFrameSettingsType() override { return GroupFrameSettings::Channel; }
|
||||
RetroShareLink::enumType getLinkType() override { return RetroShareLink::TYPE_CHANNEL; }
|
||||
void groupInfoToGroupItemInfo(const RsGxsGenericGroupData *groupData, GroupItemInfo &groupItemInfo) override;
|
||||
const std::set<TurtleRequestId> getSearchRequests() const override { return mSearchResults ; }
|
||||
UserNotify *createUserNotify(QObject *parent) override;
|
||||
bool getGroupData(std::list<RsGxsGenericGroupData*>& groupInfo) override;
|
||||
bool getGroupStatistics(const RsGxsGroupId& groupId,GxsGroupStatistic& stat) override;
|
||||
|
||||
private slots:
|
||||
void toggleAutoDownload();
|
||||
void setDefaultDirectory();
|
||||
@ -65,15 +70,14 @@ private:
|
||||
virtual QString text(TextType type);
|
||||
virtual QString icon(IconType type);
|
||||
virtual QString settingsGroupName() { return "ChannelDialog"; }
|
||||
virtual GxsGroupDialog *createNewGroupDialog(TokenQueue *tokenQueue);
|
||||
virtual GxsGroupDialog *createGroupDialog(TokenQueue *tokenQueue, RsTokenService *tokenService, GxsGroupDialog::Mode mode, RsGxsGroupId groupId);
|
||||
virtual GxsGroupDialog *createNewGroupDialog();
|
||||
virtual GxsGroupDialog *createGroupDialog(GxsGroupDialog::Mode mode, RsGxsGroupId groupId);
|
||||
virtual int shareKeyType();
|
||||
virtual GxsMessageFrameWidget *createMessageFrameWidget(const RsGxsGroupId &groupId);
|
||||
virtual void groupTreeCustomActions(RsGxsGroupId grpId, int subscribeFlags, QList<QAction*> &actions);
|
||||
virtual RsGxsCommentService *getCommentService();
|
||||
virtual QWidget *createCommentHeaderWidget(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId);
|
||||
virtual uint32_t requestGroupSummaryType() { return GXS_REQUEST_TYPE_GROUP_DATA; } // request complete group data
|
||||
virtual void loadGroupSummaryToken(const uint32_t &token, std::list<RsGroupMetaData> &groupInfo, RsUserdata* &userdata);
|
||||
|
||||
void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);
|
||||
|
||||
|
@ -59,15 +59,15 @@ const uint32_t ChannelCreateDefaultsFlags = ( GXS_GROUP_DEFAULTS_DISTRIB_PUBLIC
|
||||
const uint32_t ChannelEditEnabledFlags = ChannelCreateEnabledFlags;
|
||||
const uint32_t ChannelEditDefaultsFlags = ChannelCreateDefaultsFlags;
|
||||
|
||||
GxsChannelGroupDialog::GxsChannelGroupDialog(TokenQueue *tokenQueue, QWidget *parent)
|
||||
: GxsGroupDialog(tokenQueue, ChannelCreateEnabledFlags, ChannelCreateDefaultsFlags, parent)
|
||||
GxsChannelGroupDialog::GxsChannelGroupDialog(QWidget *parent)
|
||||
: GxsGroupDialog(ChannelCreateEnabledFlags, ChannelCreateDefaultsFlags, parent)
|
||||
{
|
||||
ui.commentGroupBox->setEnabled(false); // These are here because comments_allowed are actually not used yet, so the group will not be changed by the setting and when
|
||||
ui.comments_allowed->setChecked(true); // the group info is displayed it will therefore be set to "disabled" in all cases although it is enabled.
|
||||
}
|
||||
|
||||
GxsChannelGroupDialog::GxsChannelGroupDialog(TokenQueue *tokenExternalQueue, RsTokenService *tokenService, Mode mode, RsGxsGroupId groupId, QWidget *parent)
|
||||
: GxsGroupDialog(tokenExternalQueue, tokenService, mode, groupId, ChannelEditEnabledFlags, ChannelEditDefaultsFlags, parent)
|
||||
GxsChannelGroupDialog::GxsChannelGroupDialog(Mode mode, RsGxsGroupId groupId, QWidget *parent)
|
||||
: GxsGroupDialog(mode, groupId, ChannelEditEnabledFlags, ChannelEditDefaultsFlags, parent)
|
||||
{
|
||||
ui.commentGroupBox->setEnabled(false); // These are here because comments_allowed are actually not used yet, so the group will not be changed by the setting and when
|
||||
ui.comments_allowed->setChecked(true); // the group info is displayed it will therefore be set to "disabled" in all cases although it is enabled.
|
||||
@ -129,17 +129,19 @@ void GxsChannelGroupDialog::prepareChannelGroup(RsGxsChannelGroup &group, const
|
||||
}
|
||||
}
|
||||
|
||||
bool GxsChannelGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta)
|
||||
bool GxsChannelGroupDialog::service_createGroup(RsGroupMetaData& meta)
|
||||
{
|
||||
// Specific Function.
|
||||
RsGxsChannelGroup grp;
|
||||
prepareChannelGroup(grp, meta);
|
||||
|
||||
rsGxsChannels->createGroup(token, grp);
|
||||
rsGxsChannels->createChannel(grp);
|
||||
|
||||
meta = grp.mMeta;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GxsChannelGroupDialog::service_EditGroup(uint32_t &token, RsGroupMetaData &editedMeta)
|
||||
bool GxsChannelGroupDialog::service_updateGroup(const RsGroupMetaData& editedMeta)
|
||||
{
|
||||
RsGxsChannelGroup grp;
|
||||
prepareChannelGroup(grp, editedMeta);
|
||||
@ -147,44 +149,42 @@ bool GxsChannelGroupDialog::service_EditGroup(uint32_t &token, RsGroupMetaData &
|
||||
std::cerr << "GxsChannelGroupDialog::service_EditGroup() submitting changes";
|
||||
std::cerr << std::endl;
|
||||
|
||||
rsGxsChannels->updateGroup(token, grp);
|
||||
return true;
|
||||
return rsGxsChannels->editChannel(grp);
|
||||
}
|
||||
|
||||
bool GxsChannelGroupDialog::service_loadGroup(uint32_t token, Mode /*mode*/, RsGroupMetaData& groupMetaData, QString &description)
|
||||
bool GxsChannelGroupDialog::service_loadGroup(const RsGxsGenericGroupData *data, Mode /*mode*/, QString& description)
|
||||
{
|
||||
std::cerr << "GxsChannelGroupDialog::service_loadGroup(" << token << ")";
|
||||
std::cerr << std::endl;
|
||||
const RsGxsChannelGroup *pgroup = dynamic_cast<const RsGxsChannelGroup*>(data);
|
||||
|
||||
std::vector<RsGxsChannelGroup> groups;
|
||||
if (!rsGxsChannels->getGroupData(token, groups))
|
||||
if (!pgroup)
|
||||
{
|
||||
std::cerr << "GxsChannelGroupDialog::service_loadGroup() Error getting GroupData";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "GxsChannelGroupDialog::service_loadGroup() Error supplied generic group data is not a RsGxsChannelGroup" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (groups.size() != 1)
|
||||
{
|
||||
std::cerr << "GxsChannelGroupDialog::service_loadGroup() Error Group.size() != 1";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
std::cerr << "GxsChannelsGroupDialog::service_loadGroup() Unfinished Loading";
|
||||
std::cerr << std::endl;
|
||||
|
||||
const RsGxsChannelGroup &group = groups[0];
|
||||
groupMetaData = group.mMeta;
|
||||
const RsGxsChannelGroup& group = *pgroup;
|
||||
description = QString::fromUtf8(group.mDescription.c_str());
|
||||
|
||||
if (group.mImage.mData) {
|
||||
QPixmap pixmap;
|
||||
|
||||
if (GxsIdDetails::loadPixmapFromData(group.mImage.mData, group.mImage.mSize,pixmap,GxsIdDetails::ORIGINAL)) {
|
||||
if (GxsIdDetails::loadPixmapFromData(group.mImage.mData, group.mImage.mSize,pixmap,GxsIdDetails::ORIGINAL))
|
||||
setLogo(pixmap);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GxsChannelGroupDialog::service_getGroupData(const RsGxsGroupId& grpId,RsGxsGenericGroupData *& data)
|
||||
{
|
||||
std::vector<RsGxsChannelGroup> forumsInfo ;
|
||||
|
||||
if( rsGxsChannels->getChannelsInfo(std::list<RsGxsGroupId>({grpId}),forumsInfo) && forumsInfo.size() == 1)
|
||||
{
|
||||
data = new RsGxsChannelGroup(forumsInfo[0]);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
||||
}
|
||||
|
@ -29,15 +29,16 @@ class GxsChannelGroupDialog : public GxsGroupDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GxsChannelGroupDialog(TokenQueue *tokenQueue, QWidget *parent);
|
||||
GxsChannelGroupDialog(TokenQueue *tokenExternalQueue, RsTokenService *tokenService, Mode mode, RsGxsGroupId groupId, QWidget *parent = NULL);
|
||||
GxsChannelGroupDialog(QWidget *parent);
|
||||
GxsChannelGroupDialog(Mode mode, RsGxsGroupId groupId, QWidget *parent = NULL);
|
||||
|
||||
protected:
|
||||
virtual void initUi();
|
||||
virtual QPixmap serviceImage();
|
||||
virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta);
|
||||
virtual bool service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData, QString &description);
|
||||
virtual bool service_EditGroup(uint32_t &token, RsGroupMetaData &editedMeta);
|
||||
void initUi() override;
|
||||
QPixmap serviceImage() override;
|
||||
bool service_createGroup(RsGroupMetaData &meta) override;
|
||||
bool service_loadGroup(const RsGxsGenericGroupData *data,Mode mode, QString& description) override;
|
||||
bool service_updateGroup(const RsGroupMetaData& editedMeta) override;
|
||||
bool service_getGroupData(const RsGxsGroupId& grpId,RsGxsGenericGroupData *& data) override;
|
||||
|
||||
private:
|
||||
void prepareChannelGroup(RsGxsChannelGroup &group, const RsGroupMetaData &meta);
|
||||
|
@ -58,15 +58,15 @@ const uint32_t ForumCreateDefaultsFlags = ( GXS_GROUP_DEFAULTS_DISTRIB_PUBLIC
|
||||
const uint32_t ForumEditEnabledFlags = ForumCreateEnabledFlags;
|
||||
const uint32_t ForumEditDefaultsFlags = ForumCreateDefaultsFlags;
|
||||
|
||||
GxsForumGroupDialog::GxsForumGroupDialog(TokenQueue *tokenQueue, QWidget *parent)
|
||||
: GxsGroupDialog(tokenQueue, ForumCreateEnabledFlags, ForumCreateDefaultsFlags, parent)
|
||||
GxsForumGroupDialog::GxsForumGroupDialog(QWidget *parent)
|
||||
: GxsGroupDialog(ForumCreateEnabledFlags, ForumCreateDefaultsFlags, parent)
|
||||
{
|
||||
ui.pubKeyShare_cb->setEnabled(true) ;
|
||||
ui.label_2->setToolTip(tr("<p>Put one of your identities here to allow others to send feedback and also have moderator rights on the forum. You may as well leave that field blank and keep the forum anonymously administrated.</p>"));
|
||||
}
|
||||
|
||||
GxsForumGroupDialog::GxsForumGroupDialog(TokenQueue *tokenExternalQueue, RsTokenService *tokenService, Mode mode, RsGxsGroupId groupId, QWidget *parent)
|
||||
: GxsGroupDialog(tokenExternalQueue, tokenService, mode, groupId, ForumEditEnabledFlags, ForumEditDefaultsFlags, parent)
|
||||
GxsForumGroupDialog::GxsForumGroupDialog(Mode mode, RsGxsGroupId groupId, QWidget *parent)
|
||||
: GxsGroupDialog(mode, groupId, ForumEditEnabledFlags, ForumEditDefaultsFlags, parent)
|
||||
{
|
||||
ui.pubKeyShare_cb->setEnabled(true) ;
|
||||
}
|
||||
@ -99,7 +99,7 @@ QPixmap GxsForumGroupDialog::serviceImage()
|
||||
return QPixmap(":/icons/png/forums.png");
|
||||
}
|
||||
|
||||
bool GxsForumGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta)
|
||||
bool GxsForumGroupDialog::service_createGroup(RsGroupMetaData& meta)
|
||||
{
|
||||
// Specific Function.
|
||||
RsGxsForumGroup grp;
|
||||
@ -107,11 +107,16 @@ bool GxsForumGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMeta
|
||||
grp.mDescription = getDescription().toUtf8().constData();
|
||||
getSelectedModerators(grp.mAdminList.ids);
|
||||
|
||||
rsGxsForums->createGroup(token, grp);
|
||||
return true;
|
||||
if(rsGxsForums->createForum(grp))
|
||||
{
|
||||
meta = grp.mMeta;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GxsForumGroupDialog::service_EditGroup(uint32_t &token, RsGroupMetaData &editedMeta)
|
||||
bool GxsForumGroupDialog::service_updateGroup(const RsGroupMetaData& editedMeta)
|
||||
{
|
||||
RsGxsForumGroup grp(mGroupData); // start again from cached information. That allows to keep the pinned posts for instance.
|
||||
|
||||
@ -125,44 +130,45 @@ bool GxsForumGroupDialog::service_EditGroup(uint32_t &token, RsGroupMetaData &ed
|
||||
std::cerr << "GxsForumGroupDialog::service_EditGroup() submitting changes";
|
||||
std::cerr << std::endl;
|
||||
|
||||
rsGxsForums->updateGroup(token, grp);
|
||||
return true;
|
||||
return rsGxsForums->editForum(grp);
|
||||
}
|
||||
|
||||
bool GxsForumGroupDialog::service_loadGroup(uint32_t token, Mode /*mode*/, RsGroupMetaData& groupMetaData, QString &description)
|
||||
bool GxsForumGroupDialog::service_loadGroup(const RsGxsGenericGroupData *data, Mode /*mode*/, QString &description)
|
||||
{
|
||||
std::cerr << "GxsForumGroupDialog::service_loadGroup(" << token << ")";
|
||||
std::cerr << std::endl;
|
||||
const RsGxsForumGroup *pgroup = dynamic_cast<const RsGxsForumGroup*>(data);
|
||||
|
||||
std::vector<RsGxsForumGroup> groups;
|
||||
|
||||
if (!rsGxsForums->getGroupData(token, groups))
|
||||
if (!pgroup)
|
||||
{
|
||||
std::cerr << "GxsForumGroupDialog::service_loadGroup() Error getting GroupData";
|
||||
std::cerr << std::endl;
|
||||
RsErr() << "GxsForumGroupDialog::service_loadGroup() supplied generic group is not a RsGxsForumGroup"<< std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (groups.size() != 1)
|
||||
{
|
||||
std::cerr << "GxsForumGroupDialog::service_loadGroup() Error Group.size() != 1";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
std::cerr << "GxsForumsGroupDialog::service_loadGroup() Unfinished Loading";
|
||||
std::cerr << std::endl;
|
||||
|
||||
// Information handled by GxsGroupDialog. description should rather be handled here in the service part!
|
||||
|
||||
groupMetaData = groups[0].mMeta;
|
||||
description = QString::fromUtf8(groups[0].mDescription.c_str());
|
||||
description = QString::fromUtf8(pgroup->mDescription.c_str());
|
||||
|
||||
// Local information. Description should be handled here.
|
||||
|
||||
setSelectedModerators(groups[0].mAdminList.ids);
|
||||
setSelectedModerators(pgroup->mAdminList.ids);
|
||||
|
||||
mGroupData = groups[0]; // keeps the private information
|
||||
mGroupData = *pgroup; // keeps the private information
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GxsForumGroupDialog::service_getGroupData(const RsGxsGroupId& grpId,RsGxsGenericGroupData *& data)
|
||||
{
|
||||
std::vector<RsGxsForumGroup> forumsInfo ;
|
||||
|
||||
if( rsGxsForums->getForumsInfo(std::list<RsGxsGroupId>({grpId}),forumsInfo) && forumsInfo.size() == 1)
|
||||
{
|
||||
data = new RsGxsForumGroup(forumsInfo[0]);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -29,15 +29,16 @@ class GxsForumGroupDialog : public GxsGroupDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GxsForumGroupDialog(TokenQueue *tokenQueue, QWidget *parent);
|
||||
GxsForumGroupDialog(TokenQueue *tokenExternalQueue, RsTokenService *tokenService, Mode mode, RsGxsGroupId groupId, QWidget *parent);
|
||||
GxsForumGroupDialog(QWidget *parent);
|
||||
GxsForumGroupDialog(Mode mode, RsGxsGroupId groupId, QWidget *parent);
|
||||
|
||||
protected:
|
||||
virtual void initUi();
|
||||
virtual QPixmap serviceImage();
|
||||
virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta);
|
||||
virtual bool service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData, QString &description);
|
||||
virtual bool service_EditGroup(uint32_t &token, RsGroupMetaData &editedMeta);
|
||||
void initUi() override;
|
||||
QPixmap serviceImage() override;
|
||||
bool service_createGroup(RsGroupMetaData& meta) override;
|
||||
bool service_loadGroup(const RsGxsGenericGroupData *data,Mode mode, QString &description) override;
|
||||
bool service_updateGroup(const RsGroupMetaData& editedMeta) override;
|
||||
bool service_getGroupData(const RsGxsGroupId& grpId,RsGxsGenericGroupData *& data) override;
|
||||
|
||||
private:
|
||||
RsGxsForumGroup mGroupData;
|
||||
|
@ -392,11 +392,10 @@ void GxsForumThreadWidget::blank()
|
||||
|
||||
//mThreadModel->clear();
|
||||
|
||||
#ifdef SUSPENDED_CODE
|
||||
mStateHelper->setWidgetEnabled(ui->newthreadButton, false);
|
||||
mStateHelper->setWidgetEnabled(ui->previousButton, false);
|
||||
mStateHelper->setWidgetEnabled(ui->nextButton, false);
|
||||
#endif
|
||||
|
||||
ui->versions_CB->hide();
|
||||
}
|
||||
|
||||
@ -870,8 +869,28 @@ static QString getDurationString(uint32_t days)
|
||||
}
|
||||
}
|
||||
|
||||
void GxsForumThreadWidget::updateForumDescription()
|
||||
void GxsForumThreadWidget::setForumDescriptionLoading()
|
||||
{
|
||||
ui->postText->setText(tr("<b>Loading...<b>"));
|
||||
}
|
||||
|
||||
void GxsForumThreadWidget::clearForumDescription()
|
||||
{
|
||||
ui->postText->clear();
|
||||
}
|
||||
|
||||
void GxsForumThreadWidget::updateForumDescription(bool success)
|
||||
{
|
||||
if(!success)
|
||||
{
|
||||
QString forum_description = QString("<b>ERROR:</b> Forum could not be loaded. Database might be in heavy use. Please try later.");
|
||||
ui->postText->setText(forum_description);
|
||||
mStateHelper->setWidgetEnabled(ui->newthreadButton, false);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
std::cerr << "Updating forum description" << std::endl;
|
||||
if (!mThreadId.isNull())
|
||||
return;
|
||||
|
||||
@ -1083,6 +1102,19 @@ void GxsForumThreadWidget::insertMessage()
|
||||
// markMsgAsRead();
|
||||
}
|
||||
|
||||
void GxsForumThreadWidget::setMessageLoadingError(const QString& error)
|
||||
{
|
||||
ui->time_label->setText(QString(""));
|
||||
ui->by_label->setId(RsGxsId());
|
||||
ui->lineRight->show();
|
||||
ui->lineLeft->show();
|
||||
ui->by_text_label->show();
|
||||
ui->by_label->show();
|
||||
ui->threadTreeWidget->setFocus();
|
||||
|
||||
ui->postText->setText(error);
|
||||
}
|
||||
|
||||
void GxsForumThreadWidget::insertMessageData(const RsGxsForumMsg &msg)
|
||||
{
|
||||
/* As some time has elapsed since request - check that this is still the current msg.
|
||||
@ -1445,7 +1477,7 @@ void GxsForumThreadWidget::async_msg_action(const MsgMethod &action)
|
||||
|
||||
if(!rsGxsForums->getForumContent(groupId(),msgs_to_request,msgs))
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << " failed to retrieve forum group info for forum " << groupId() << std::endl;
|
||||
std::cerr << __PRETTY_FUNCTION__ << " failed to retrieve forum message info for forum " << groupId() << " and thread " << mThreadId << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1697,6 +1729,8 @@ void GxsForumThreadWidget::updateGroupData()
|
||||
// ui->threadTreeWidget->selectionModel()->reset();
|
||||
// mThreadProxyModel->clear();
|
||||
|
||||
setForumDescriptionLoading();
|
||||
|
||||
RsThread::async([this]()
|
||||
{
|
||||
// 1 - get message data from p3GxsForums
|
||||
@ -1705,41 +1739,41 @@ void GxsForumThreadWidget::updateGroupData()
|
||||
std::vector<RsGxsForumGroup> groups;
|
||||
|
||||
forumIds.push_back(groupId());
|
||||
bool success = false;
|
||||
|
||||
if(!rsGxsForums->getForumsInfo(forumIds,groups))
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << " failed to retrieve forum group info for forum " << groupId() << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if(groups.size() != 1)
|
||||
{
|
||||
else if(groups.size() != 1)
|
||||
std::cerr << __PRETTY_FUNCTION__ << " obtained more than one group info for forum " << groupId() << std::endl;
|
||||
return;
|
||||
}
|
||||
else
|
||||
success = true;
|
||||
|
||||
// 2 - sort the messages into a proper hierarchy
|
||||
|
||||
RsGxsForumGroup *group = new RsGxsForumGroup(groups[0]); // we use a pointer in order to avoid group deletion while we're in the thread.
|
||||
|
||||
// 3 - update the model in the UI thread.
|
||||
|
||||
RsQThreadUtils::postToObject( [group,this]()
|
||||
if(success)
|
||||
{
|
||||
/* Here it goes any code you want to be executed on the Qt Gui
|
||||
// 2 - sort the messages into a proper hierarchy
|
||||
|
||||
RsGxsForumGroup group(groups[0]); // we use a copy to share the object in order to avoid group deletion while we're in the thread.
|
||||
|
||||
// 3 - update the model in the UI thread.
|
||||
|
||||
RsQThreadUtils::postToObject( [group,this]()
|
||||
{
|
||||
/* Here it goes any code you want to be executed on the Qt Gui
|
||||
* thread, for example to update the data model with new information
|
||||
* after a blocking call to RetroShare API complete */
|
||||
|
||||
mForumGroup = *group;
|
||||
delete group;
|
||||
mForumGroup = group;
|
||||
mThreadId.clear();
|
||||
|
||||
ui->threadTreeWidget->setColumnHidden(RsGxsForumModel::COLUMN_THREAD_DISTRIBUTION, !IS_GROUP_PGP_KNOWN_AUTHED(mForumGroup.mMeta.mSignFlags) && !(IS_GROUP_PGP_AUTHED(mForumGroup.mMeta.mSignFlags)));
|
||||
ui->subscribeToolButton->setHidden(IS_GROUP_SUBSCRIBED(mForumGroup.mMeta.mSubscribeFlags)) ;
|
||||
ui->threadTreeWidget->setColumnHidden(RsGxsForumModel::COLUMN_THREAD_DISTRIBUTION, !IS_GROUP_PGP_KNOWN_AUTHED(mForumGroup.mMeta.mSignFlags) && !(IS_GROUP_PGP_AUTHED(mForumGroup.mMeta.mSignFlags)));
|
||||
ui->subscribeToolButton->setHidden(IS_GROUP_SUBSCRIBED(mForumGroup.mMeta.mSubscribeFlags)) ;
|
||||
|
||||
updateForumDescription();
|
||||
|
||||
}, this );
|
||||
updateForumDescription(true);
|
||||
|
||||
}, this );
|
||||
}
|
||||
else
|
||||
RsQThreadUtils::postToObject( [this]() { updateForumDescription(false); },this);
|
||||
});
|
||||
}
|
||||
|
||||
@ -1757,17 +1791,18 @@ void GxsForumThreadWidget::updateMessageData(const RsGxsMessageId& msgId)
|
||||
std::vector<RsGxsForumMsg> msgs;
|
||||
|
||||
msgs_to_request.insert(msgId);
|
||||
QString error_string;
|
||||
|
||||
if(!rsGxsForums->getForumContent(groupId(),msgs_to_request,msgs))
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << " failed to retrieve forum group info for forum " << groupId() << std::endl;
|
||||
return;
|
||||
std::cerr << __PRETTY_FUNCTION__ << " failed to retrieve message info for forum " << groupId() << " and MsgId " << msgId << std::endl;
|
||||
error_string = tr("Failed to retrieve this message. Is the database currently overloaded?");
|
||||
}
|
||||
|
||||
if(msgs.empty())
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << " no posts for msgId " << msgId << ". Database corruption?" << std::endl;
|
||||
return;
|
||||
error_string = tr("No data for this message. Is the database corrupted?");
|
||||
}
|
||||
if(msgs.size() > 1)
|
||||
{
|
||||
@ -1775,26 +1810,32 @@ void GxsForumThreadWidget::updateMessageData(const RsGxsMessageId& msgId)
|
||||
std::cerr << "Messages are:" << std::endl;
|
||||
for(auto it(msgs.begin());it!=msgs.end();++it)
|
||||
std::cerr << (*it).mMeta << std::endl;
|
||||
|
||||
error_string = tr("More than one entry for this message. Is the database corrupted?");
|
||||
}
|
||||
|
||||
// 2 - sort the messages into a proper hierarchy
|
||||
|
||||
RsGxsForumMsg *msg = new RsGxsForumMsg(msgs[0]);
|
||||
|
||||
// 3 - update the model in the UI thread.
|
||||
|
||||
RsQThreadUtils::postToObject( [msg,this]()
|
||||
if(error_string.isNull())
|
||||
{
|
||||
/* Here it goes any code you want to be executed on the Qt Gui
|
||||
// 2 - sort the messages into a proper hierarchy
|
||||
|
||||
RsGxsForumMsg msg(msgs[0]);
|
||||
|
||||
// 3 - update the model in the UI thread.
|
||||
|
||||
RsQThreadUtils::postToObject( [msg,this]()
|
||||
{
|
||||
/* Here it goes any code you want to be executed on the Qt Gui
|
||||
* thread, for example to update the data model with new information
|
||||
* after a blocking call to RetroShare API complete */
|
||||
|
||||
insertMessageData(*msg);
|
||||
insertMessageData(msg);
|
||||
|
||||
delete msg;
|
||||
ui->threadTreeWidget->setColumnHidden(RsGxsForumModel::COLUMN_THREAD_DISTRIBUTION, !IS_GROUP_PGP_KNOWN_AUTHED(mForumGroup.mMeta.mSignFlags) && !(IS_GROUP_PGP_AUTHED(mForumGroup.mMeta.mSignFlags)));
|
||||
ui->subscribeToolButton->setHidden(IS_GROUP_SUBSCRIBED(mForumGroup.mMeta.mSubscribeFlags)) ;
|
||||
}, this );
|
||||
ui->threadTreeWidget->setColumnHidden(RsGxsForumModel::COLUMN_THREAD_DISTRIBUTION, !IS_GROUP_PGP_KNOWN_AUTHED(mForumGroup.mMeta.mSignFlags) && !(IS_GROUP_PGP_AUTHED(mForumGroup.mMeta.mSignFlags)));
|
||||
ui->subscribeToolButton->setHidden(IS_GROUP_SUBSCRIBED(mForumGroup.mMeta.mSubscribeFlags)) ;
|
||||
}, this );
|
||||
}
|
||||
else
|
||||
RsQThreadUtils::postToObject( [error_string,this](){ setMessageLoadingError(error_string); } );
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -92,6 +92,7 @@ protected:
|
||||
/* GxsMessageFrameWidget */
|
||||
virtual void setAllMessagesReadDo(bool read, uint32_t &token);
|
||||
|
||||
void setMessageLoadingError(const QString& error);
|
||||
private slots:
|
||||
/** Create the context popup menu and it's submenus */
|
||||
void threadListCustomPopupMenu(QPoint point);
|
||||
@ -170,11 +171,14 @@ private:
|
||||
static void loadAuthorIdCallback(GxsIdDetailsType type, const RsIdentityDetails &details, QObject *object, const QVariant &/*data*/);
|
||||
|
||||
void updateMessageData(const RsGxsMessageId& msgId);
|
||||
void updateForumDescription();
|
||||
void updateForumDescription(bool success);
|
||||
|
||||
void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);
|
||||
|
||||
private:
|
||||
void setForumDescriptionLoading();
|
||||
void clearForumDescription();
|
||||
|
||||
RsGxsGroupId mLastForumID;
|
||||
RsGxsMessageId mThreadId;
|
||||
RsGxsMessageId mOrigThreadId;
|
||||
|
@ -80,6 +80,26 @@ GxsForumsDialog::~GxsForumsDialog()
|
||||
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||
}
|
||||
|
||||
bool GxsForumsDialog::getGroupData(std::list<RsGxsGenericGroupData*>& groupInfo)
|
||||
{
|
||||
std::vector<RsGxsForumGroup> groups;
|
||||
|
||||
if(! rsGxsForums->getForumsInfo(std::list<RsGxsGroupId>(),groups))
|
||||
return false;
|
||||
|
||||
for (auto& group: groups)
|
||||
groupInfo.push_back(new RsGxsForumGroup(group));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GxsForumsDialog::getGroupStatistics(const RsGxsGroupId& groupId,GxsGroupStatistic& stat)
|
||||
{
|
||||
return rsGxsForums->getForumStatistics(groupId,stat);
|
||||
}
|
||||
|
||||
|
||||
|
||||
QString GxsForumsDialog::getHelpString() const
|
||||
{
|
||||
QString hlp_str = tr(
|
||||
@ -167,14 +187,14 @@ QString GxsForumsDialog::icon(IconType type)
|
||||
return "";
|
||||
}
|
||||
|
||||
GxsGroupDialog *GxsForumsDialog::createNewGroupDialog(TokenQueue *tokenQueue)
|
||||
GxsGroupDialog *GxsForumsDialog::createNewGroupDialog()
|
||||
{
|
||||
return new GxsForumGroupDialog(tokenQueue, this);
|
||||
return new GxsForumGroupDialog(this);
|
||||
}
|
||||
|
||||
GxsGroupDialog *GxsForumsDialog::createGroupDialog(TokenQueue *tokenQueue, RsTokenService *tokenService, GxsGroupDialog::Mode mode, RsGxsGroupId groupId)
|
||||
GxsGroupDialog *GxsForumsDialog::createGroupDialog(GxsGroupDialog::Mode mode, RsGxsGroupId groupId)
|
||||
{
|
||||
return new GxsForumGroupDialog(tokenQueue, tokenService, mode, groupId, this);
|
||||
return new GxsForumGroupDialog(mode, groupId, this);
|
||||
}
|
||||
|
||||
int GxsForumsDialog::shareKeyType()
|
||||
@ -187,6 +207,7 @@ GxsMessageFrameWidget *GxsForumsDialog::createMessageFrameWidget(const RsGxsGrou
|
||||
return new GxsForumThreadWidget(groupId);
|
||||
}
|
||||
|
||||
#ifdef TO_REMOVE
|
||||
void GxsForumsDialog::loadGroupSummaryToken(const uint32_t &token, std::list<RsGroupMetaData> &groupInfo, RsUserdata *&userdata)
|
||||
{
|
||||
std::vector<RsGxsForumGroup> groups;
|
||||
@ -206,8 +227,30 @@ void GxsForumsDialog::loadGroupSummaryToken(const uint32_t &token, std::list<RsG
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void GxsForumsDialog::groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo, const RsUserdata *userdata)
|
||||
void GxsForumsDialog::groupInfoToGroupItemInfo(const RsGxsGenericGroupData *groupData, GroupItemInfo &groupItemInfo)
|
||||
{
|
||||
GxsGroupFrameDialog::groupInfoToGroupItemInfo(groupData, groupItemInfo);
|
||||
|
||||
const RsGxsForumGroup *forumGroupData = dynamic_cast<const RsGxsForumGroup*>(groupData);
|
||||
|
||||
if (!forumGroupData)
|
||||
{
|
||||
std::cerr << "GxsChannelDialog::groupInfoToGroupItemInfo() Failed to cast data to GxsChannelGroupInfoData"<< std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
groupItemInfo.description = QString::fromUtf8(forumGroupData->mDescription.c_str());
|
||||
|
||||
if(IS_GROUP_ADMIN(groupData->mMeta.mSubscribeFlags))
|
||||
groupItemInfo.icon = QIcon(":icons/png/forums.png");
|
||||
else if ((IS_GROUP_PGP_AUTHED(groupData->mMeta.mSignFlags)) || (IS_GROUP_MESSAGE_TRACKING(groupData->mMeta.mSignFlags)) )
|
||||
groupItemInfo.icon = QIcon(":icons/png/forums-signed.png");
|
||||
}
|
||||
|
||||
#ifdef TO_REMOVE
|
||||
void ::groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo, const RsUserdata *userdata)
|
||||
{
|
||||
GxsGroupFrameDialog::groupInfoToGroupItemInfo(groupInfo, groupItemInfo, userdata);
|
||||
|
||||
@ -229,3 +272,4 @@ void GxsForumsDialog::groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo,
|
||||
groupItemInfo.icon = QIcon(":icons/png/forums-signed.png");
|
||||
|
||||
}
|
||||
#endif
|
||||
|
@ -40,24 +40,27 @@ public:
|
||||
void shareInMessage(const RsGxsGroupId& forum_id, const QList<RetroShareLink>& file_link) ;
|
||||
|
||||
protected:
|
||||
virtual UserNotify *createUserNotify(QObject *parent) override;
|
||||
|
||||
virtual QString getHelpString() const ;
|
||||
virtual RetroShareLink::enumType getLinkType() { return RetroShareLink::TYPE_FORUM; }
|
||||
virtual GroupFrameSettings::Type groupFrameSettingsType() { return GroupFrameSettings::Forum; }
|
||||
virtual void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo, const RsUserdata *userdata);
|
||||
|
||||
UserNotify *createUserNotify(QObject *parent) override;
|
||||
bool getGroupData(std::list<RsGxsGenericGroupData*>& groupInfo) override;
|
||||
bool getGroupStatistics(const RsGxsGroupId& groupId,GxsGroupStatistic& stat) override;
|
||||
void groupInfoToGroupItemInfo(const RsGxsGenericGroupData *groupData, GroupItemInfo &groupItemInfo) override;
|
||||
|
||||
private:
|
||||
/* GxsGroupFrameDialog */
|
||||
virtual QString text(TextType type);
|
||||
virtual QString icon(IconType type);
|
||||
virtual QString settingsGroupName() { return "ForumsDialog"; }
|
||||
virtual GxsGroupDialog *createNewGroupDialog(TokenQueue *tokenQueue);
|
||||
virtual GxsGroupDialog *createGroupDialog(TokenQueue *tokenQueue, RsTokenService *tokenService, GxsGroupDialog::Mode mode, RsGxsGroupId groupId);
|
||||
virtual int shareKeyType();
|
||||
virtual GxsMessageFrameWidget *createMessageFrameWidget(const RsGxsGroupId &groupId);
|
||||
virtual uint32_t requestGroupSummaryType() { return GXS_REQUEST_TYPE_GROUP_DATA; } // request complete group data
|
||||
virtual void loadGroupSummaryToken(const uint32_t &token, std::list<RsGroupMetaData> &groupInfo, RsUserdata* &userdata);
|
||||
QString text(TextType type)override ;
|
||||
QString icon(IconType type)override ;
|
||||
QString settingsGroupName() override { return "ForumsDialog"; }
|
||||
|
||||
GxsGroupDialog *createNewGroupDialog() override;
|
||||
GxsGroupDialog *createGroupDialog(GxsGroupDialog::Mode mode, RsGxsGroupId groupId) override;
|
||||
|
||||
int shareKeyType() override;
|
||||
GxsMessageFrameWidget *createMessageFrameWidget(const RsGxsGroupId &groupId) override;
|
||||
uint32_t requestGroupSummaryType() override { return GXS_REQUEST_TYPE_GROUP_DATA; } // request complete group data
|
||||
|
||||
void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user