Merge branch 'master' into thewire_fix_message_display

This commit is contained in:
drbob 2020-03-31 21:23:51 +11:00
commit 3402aa861f
119 changed files with 1809 additions and 1100 deletions

View File

@ -26,6 +26,10 @@
* #define RS_DATA_SERVICE_DEBUG_CACHE 1 * #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 <fstream>
#include <util/rsdir.h> #include <util/rsdir.h>
#include <algorithm> #include <algorithm>
@ -1312,7 +1316,7 @@ int RsDataService::retrieveGxsMsgMetaData(const GxsMsgReq& reqIds, GxsMsgMetaRes
{ {
locked_retrieveMsgMeta(c, metaSet); locked_retrieveMsgMeta(c, metaSet);
#ifdef RS_DATA_SERVICE_DEBUG_CACHE #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 #endif
} }
}else{ }else{
@ -1329,7 +1333,7 @@ int RsDataService::retrieveGxsMsgMetaData(const GxsMsgReq& reqIds, GxsMsgMetaRes
{ {
locked_retrieveMsgMeta(c, metaSet); locked_retrieveMsgMeta(c, metaSet);
#ifdef RS_DATA_SERVICE_DEBUG_CACHE #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 #endif
} }
} }
@ -1343,6 +1347,7 @@ int RsDataService::retrieveGxsMsgMetaData(const GxsMsgReq& reqIds, GxsMsgMetaRes
} }
#ifdef RS_DATA_SERVICE_DEBUG_TIME #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; std::cerr << "RsDataService::retrieveGxsMsgMetaData() " << mDbName << ", Requests: " << reqIds.size() << ", Results: " << resultCount << ", Time: " << timer.duration() << std::endl;
#endif #endif
@ -1413,7 +1418,7 @@ int RsDataService::retrieveGxsGrpMetaData(RsGxsGrpMetaTemporaryMap& grp)
{ {
grp[g->mGroupId] = g; grp[g->mGroupId] = g;
#ifdef RS_DATA_SERVICE_DEBUG_CACHE #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 #endif
} }
valid = c->moveToNext(); valid = c->moveToNext();
@ -1440,14 +1445,14 @@ int RsDataService::retrieveGxsGrpMetaData(RsGxsGrpMetaTemporaryMap& grp)
if(itt != mGrpMetaDataCache.end()) if(itt != mGrpMetaDataCache.end())
{ {
#ifdef RS_DATA_SERVICE_DEBUG_CACHE #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 #endif
grp[mit->first] = itt->second ; grp[mit->first] = itt->second ;
} }
else else
{ {
#ifdef RS_DATA_SERVICE_DEBUG_CACHE #ifdef RS_DATA_SERVICE_DEBUG_CACHE
std::cerr << "Retrieving Grp metadata grpId=" << mit->first ; std::cerr << mDbName << ": Retrieving Grp metadata grpId=" << mit->first ;
#endif #endif
const RsGxsGroupId& grpId = mit->first; const RsGxsGroupId& grpId = mit->first;

View File

@ -3461,20 +3461,32 @@ bool RsGenExchange::exportGroupBase64(
if(groupId.isNull()) return failure("groupId cannot be null"); 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}); const std::list<RsGxsGroupId> groupIds({groupId});
RsTokReqOptions opts; RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA; opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
uint32_t token; uint32_t token;
mDataAccess->requestGroupInfo( mDataAccess->requestGroupInfo( token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds);
token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds);
RsTokenService::GxsRequestStatus wtStatus = mDataAccess->waitToken(token); // provide a sync response: actually wait for the token.
if(wtStatus != RsTokenService::COMPLETE) std::chrono::milliseconds maxWait = std::chrono::milliseconds(10000);
return failure( "waitToken(...) failed with: " + std::chrono::milliseconds checkEvery = std::chrono::milliseconds(100);
std::to_string(wtStatus) );
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; uint8_t* buf = nullptr;
uint32_t size; uint32_t size;
RsGxsGroupId grpId; RsGxsGroupId grpId;
if(!getSerializedGroupData(token, grpId, buf, size)) if(!getSerializedGroupData(token, grpId, buf, size))
return failure("failed retrieving GXS data"); return failure("failed retrieving GXS data");

View File

@ -726,7 +726,7 @@ public:
virtual void setSyncPeriod(const RsGxsGroupId& grpId,uint32_t age_in_secs) ; virtual void setSyncPeriod(const RsGxsGroupId& grpId,uint32_t age_in_secs) ;
virtual bool getGroupNetworkStats(const RsGxsGroupId& grpId,RsGroupNetworkStats& stats); 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); } uint32_t serviceFullType() const { return RsServiceInfo::RsServiceInfoUIn16ToFullServiceId(mServType); }
virtual RsReputationLevel minReputationForForwardingMessages( virtual RsReputationLevel minReputationForForwardingMessages(

View File

@ -30,6 +30,8 @@
* #define DATA_DEBUG 1 * #define DATA_DEBUG 1
**********/ **********/
#define DATA_DEBUG 1
RsGxsDataAccess::RsGxsDataAccess(RsGeneralDataService* ds) : RsGxsDataAccess::RsGxsDataAccess(RsGeneralDataService* ds) :
mDataStore(ds), mDataMutex("RsGxsDataAccess"), mNextToken(0) {} mDataStore(ds), mDataMutex("RsGxsDataAccess"), mNextToken(0) {}

View File

@ -113,8 +113,6 @@ int p3GxsTunnelService::tick()
flush() ; flush() ;
rstime::rs_usleep(1000*500);
return 0 ; return 0 ;
} }

View File

@ -45,11 +45,10 @@ class RsGxsChannels;
extern RsGxsChannels* rsGxsChannels; extern RsGxsChannels* rsGxsChannels;
struct RsGxsChannelGroup : RsSerializable struct RsGxsChannelGroup : RsSerializable, RsGxsGenericGroupData
{ {
RsGxsChannelGroup() : mAutoDownload(false) {} RsGxsChannelGroup() : mAutoDownload(false) {}
RsGroupMetaData mMeta;
std::string mDescription; std::string mDescription;
RsGxsImage mImage; RsGxsImage mImage;
@ -399,6 +398,15 @@ public:
virtual bool subscribeToChannel( const RsGxsGroupId& channelId, virtual bool subscribeToChannel( const RsGxsGroupId& channelId,
bool subscribe ) = 0; 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 * @brief Request remote channels search
* @jsonapi{development} * @jsonapi{development}

View File

@ -164,7 +164,9 @@ struct RsGxsCommentService
virtual bool getRelatedComments( uint32_t token, virtual bool getRelatedComments( uint32_t token,
std::vector<RsGxsComment> &comments ) = 0; std::vector<RsGxsComment> &comments ) = 0;
virtual bool createNewComment(uint32_t &token, RsGxsComment &comment) = 0; virtual bool createNewComment(uint32_t &token, const RsGxsComment &comment) = 0; // async API
virtual bool createComment(RsGxsComment& comment) = 0; // blocking API. Updates comment with new metadata.
virtual bool createNewVote(uint32_t &token, RsGxsVote &vote) = 0; virtual bool createNewVote(uint32_t &token, RsGxsVote &vote) = 0;
virtual bool acknowledgeComment( virtual bool acknowledgeComment(

View File

@ -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) #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 */ /** @brief Forum desciption */
std::string mDescription; std::string mDescription;
@ -222,6 +219,15 @@ public:
*/ */
virtual bool getForumsSummaries(std::list<RsGroupMetaData>& forums) = 0; 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...). * @brief Get forums information (description, thumbnail...).
* Blocking API. * Blocking API.
@ -364,5 +370,5 @@ public:
RS_DEPRECATED_FOR(createMessage) RS_DEPRECATED_FOR(createMessage)
virtual bool createMsg(uint32_t &token, RsGxsForumMsg &msg) = 0; virtual bool createMsg(uint32_t &token, RsGxsForumMsg &msg) = 0;
RS_DEPRECATED_FOR(editForum) RS_DEPRECATED_FOR(editForum)
virtual bool updateGroup(uint32_t &token, RsGxsForumGroup &group) = 0; virtual bool updateGroup(uint32_t &token, const RsGxsForumGroup &group) = 0;
}; };

View File

@ -110,6 +110,12 @@ struct RsGxsChanges : RsEvent
*/ */
struct RsGxsIface 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 * Gxs services should call this for automatic handling of
* changes, send * changes, send

View File

@ -26,6 +26,7 @@
#include <thread> #include <thread>
#include "retroshare/rsgxsiface.h" #include "retroshare/rsgxsiface.h"
#include "retroshare/rsservicecontrol.h"
#include "retroshare/rsreputations.h" #include "retroshare/rsreputations.h"
#include "rsgxsflags.h" #include "rsgxsflags.h"
#include "util/rsdeprecate.h" #include "util/rsdeprecate.h"
@ -38,14 +39,26 @@
* To properly fix the API design many changes with the implied chain reactions * To properly fix the API design many changes with the implied chain reactions
* are necessary, so at this point this workaround seems acceptable. * 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 * @param gxs handle to RsGenExchange instance of service (Usually the
* service class itself) * service class itself)
*/ */
RsGxsIfaceHelper(RsGxsIface& gxs) : RsGxsIfaceHelper(RsGxsIface& gxs) :
mGxs(gxs), mTokenService(*gxs.getTokenService()) {} mGxs(gxs), mTokenService(*gxs.getTokenService()),mMtx("GxsIfaceHelper") {}
~RsGxsIfaceHelper(){} ~RsGxsIfaceHelper(){}
@ -233,30 +246,81 @@ struct RsGxsIfaceHelper
} }
/// @see RsTokenService::requestGroupInfo /// @see RsTokenService::requestGroupInfo
bool requestGroupInfo( uint32_t& token, const RsTokReqOptions& opts, bool requestGroupInfo( uint32_t& token, const RsTokReqOptions& opts, const std::list<RsGxsGroupId> &groupIds, bool high_priority_request = false )
const std::list<RsGxsGroupId> &groupIds ) {
{ return mTokenService.requestGroupInfo(token, 0, opts, groupIds); } 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 /// @see RsTokenService::requestGroupInfo
bool requestGroupInfo(uint32_t& token, const RsTokReqOptions& opts) bool requestGroupInfo(uint32_t& token, const RsTokReqOptions& opts, bool high_priority_request = false)
{ return mTokenService.requestGroupInfo(token, 0, opts); } {
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 /// @see RsTokenService::requestMsgInfo
bool requestMsgInfo( uint32_t& token, bool requestMsgInfo( uint32_t& token,
const RsTokReqOptions& opts, const GxsMsgReq& msgIds ) 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 /// @see RsTokenService::requestMsgInfo
bool requestMsgInfo( bool requestMsgInfo( uint32_t& token, const RsTokReqOptions& opts, const std::list<RsGxsGroupId>& grpIds )
uint32_t& token, const RsTokReqOptions& opts, {
const std::list<RsGxsGroupId>& grpIds ) if(mTokenService.requestMsgInfo(token, 0, opts, grpIds))
{ return 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 /// @see RsTokenService::requestMsgRelatedInfo
bool requestMsgRelatedInfo( bool requestMsgRelatedInfo(
uint32_t& token, const RsTokReqOptions& opts, uint32_t& token, const RsTokReqOptions& opts,
const std::vector<RsGxsGrpMsgIdPair>& msgIds ) 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} * @jsonapi{development}
@ -267,15 +331,50 @@ struct RsGxsIfaceHelper
/// @see RsTokenService::requestServiceStatistic /// @see RsTokenService::requestServiceStatistic
void requestServiceStatistic(uint32_t& token) 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 /// @see RsTokenService::requestGroupStatistic
void requestGroupStatistic(uint32_t& token, const RsGxsGroupId& grpId) bool requestGroupStatistic(uint32_t& token, const RsGxsGroupId& grpId)
{ mTokenService.requestGroupStatistic(token, 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 /// @see RsTokenService::cancelRequest
bool cancelRequest(uint32_t token) bool cancelRequest(uint32_t token)
{ return mTokenService.cancelRequest(token); } {
{
RS_STACK_MUTEX(mMtx);
mActiveTokens.erase(token);
}
return mTokenService.cancelRequest(token);
}
/** /**
* @deprecated * @deprecated
@ -291,14 +390,84 @@ protected:
* @param[in] token token associated to the request caller is waiting for * @param[in] token token associated to the request caller is waiting for
* @param[in] maxWait maximum waiting time in milliseconds * @param[in] maxWait maximum waiting time in milliseconds
* @param[in] checkEvery time in millisecond between status checks * @param[in] checkEvery time in millisecond between status checks
* @param[in] auto_delete_if_unsuccessful delete the request when it fails. This avoid leaving useless pending requests in the queue that would slow down additional calls.
*/ */
RsTokenService::GxsRequestStatus waitToken( RsTokenService::GxsRequestStatus waitToken(
uint32_t token, uint32_t token,
std::chrono::milliseconds maxWait = std::chrono::milliseconds(2000), std::chrono::milliseconds maxWait = std::chrono::milliseconds(20000),
std::chrono::milliseconds checkEvery = std::chrono::milliseconds(20)) std::chrono::milliseconds checkEvery = std::chrono::milliseconds(100),
{ return mTokenService.waitToken(token, maxWait, checkEvery); } bool auto_delete_if_unsuccessful=true)
{
#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);
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);
#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: private:
RsGxsIface& mGxs; RsGxsIface& mGxs;
RsTokenService& mTokenService; 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;
}
}; };

View File

@ -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 struct RsMsgMetaData : RsSerializable
{ {

View File

@ -383,8 +383,9 @@ struct RsIdentityDetails : RsSerializable
/** The Main Interface Class for GXS people identities */ /** The Main Interface Class for GXS people identities */
struct RsIdentity : RsGxsIfaceHelper class RsIdentity: public RsGxsIfaceHelper
{ {
public:
explicit RsIdentity(RsGxsIface& gxs) : RsGxsIfaceHelper(gxs) {} explicit RsIdentity(RsGxsIface& gxs) : RsGxsIfaceHelper(gxs) {}
/** /**

View File

@ -40,9 +40,8 @@ class RsPosted;
*/ */
extern RsPosted* rsPosted; extern RsPosted* rsPosted;
struct RsPostedGroup struct RsPostedGroup: RsGxsGenericGroupData
{ {
RsGroupMetaData mMeta;
std::string mDescription; std::string mDescription;
RsGxsImage mGroupImage; RsGxsImage mGroupImage;
}; };
@ -150,12 +149,20 @@ public:
const std::list<RsGxsGroupId>& boardsIds, const std::list<RsGxsGroupId>& boardsIds,
std::vector<RsPostedGroup>& boardsInfo ) = 0; std::vector<RsPostedGroup>& boardsInfo ) = 0;
virtual bool getBoardsSummaries(std::list<RsGroupMetaData>& groupInfo) =0;
virtual bool getBoardContent( virtual bool getBoardContent(
const RsGxsGroupId& boardId, const RsGxsGroupId& boardId,
const std::set<RsGxsMessageId>& contentsIds, const std::set<RsGxsMessageId>& contentsIds,
std::vector<RsPostedPost>& posts, std::vector<RsPostedPost>& posts,
std::vector<RsGxsComment>& comments ) = 0; 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 }; enum RS_DEPRECATED RankType {TopRankType, HotRankType, NewRankType };
RS_DEPRECATED_FOR(getBoardsInfo) RS_DEPRECATED_FOR(getBoardsInfo)

View File

@ -222,6 +222,7 @@ public:
*/ */
virtual bool cancelRequest(const uint32_t &token) = 0; virtual bool cancelRequest(const uint32_t &token) = 0;
#ifdef TO_REMOVE
/** /**
* Block caller while request is being processed. * Block caller while request is being processed.
* Useful for blocking API implementation. * Useful for blocking API implementation.
@ -231,8 +232,9 @@ public:
*/ */
RsTokenService::GxsRequestStatus waitToken( RsTokenService::GxsRequestStatus waitToken(
uint32_t token, uint32_t token,
std::chrono::milliseconds maxWait = std::chrono::milliseconds(500), std::chrono::milliseconds maxWait = std::chrono::milliseconds(10000),
std::chrono::milliseconds checkEvery = std::chrono::milliseconds(2)) std::chrono::milliseconds checkEvery = std::chrono::milliseconds(20),
bool auto_delete_if_unsuccessful=true)
{ {
#if defined(__ANDROID__) && (__ANDROID_API__ < 24) #if defined(__ANDROID__) && (__ANDROID_API__ < 24)
auto wkStartime = std::chrono::steady_clock::now(); auto wkStartime = std::chrono::steady_clock::now();
@ -241,12 +243,13 @@ LLwaitTokenBeginLabel:
#endif #endif
auto timeout = std::chrono::steady_clock::now() + maxWait; auto timeout = std::chrono::steady_clock::now() + maxWait;
auto st = requestStatus(token); auto st = requestStatus(token);
while( !(st == RsTokenService::FAILED || st >= RsTokenService::COMPLETE) while( !(st == RsTokenService::FAILED || st >= RsTokenService::COMPLETE) && std::chrono::steady_clock::now() < timeout )
&& std::chrono::steady_clock::now() < timeout )
{ {
std::this_thread::sleep_for(checkEvery); std::this_thread::sleep_for(checkEvery);
st = requestStatus(token); st = requestStatus(token);
} }
if(st != RsTokenService::COMPLETE && auto_delete_if_unsuccessful)
cancelRequest(token);
#if defined(__ANDROID__) && (__ANDROID_API__ < 24) #if defined(__ANDROID__) && (__ANDROID_API__ < 24)
/* Work around for very slow/old android devices, we don't expect this /* Work around for very slow/old android devices, we don't expect this
@ -274,6 +277,7 @@ LLwaitTokenBeginLabel:
return st; return st;
} }
#endif
RS_SET_CONTEXT_DEBUG_LEVEL(2) RS_SET_CONTEXT_DEBUG_LEVEL(2)
}; };

View File

@ -1033,18 +1033,35 @@ bool p3GxsChannels::getChannelsSummaries(
return getGroupSummary(token, channels); return getGroupSummary(token, channels);
} }
bool p3GxsChannels::getChannelsInfo( bool p3GxsChannels::getChannelsInfo( const std::list<RsGxsGroupId>& chanIds, std::vector<RsGxsChannelGroup>& channelsInfo )
const std::list<RsGxsGroupId>& chanIds,
std::vector<RsGxsChannelGroup>& channelsInfo )
{ {
uint32_t token; uint32_t token;
RsTokReqOptions opts; RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA; 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(); 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( bool p3GxsChannels::getContentSummaries(
const RsGxsGroupId& channelId, std::vector<RsMsgMetaData>& summaries ) const RsGxsGroupId& channelId, std::vector<RsMsgMetaData>& summaries )
{ {

View File

@ -140,7 +140,7 @@ virtual bool getChannelDownloadDirectory(const RsGxsGroupId &groupId, std::strin
std::vector<RsGxsComment> &msgs ) override std::vector<RsGxsComment> &msgs ) override
{ return mCommentService->getGxsRelatedComments(token, msgs); } { return mCommentService->getGxsRelatedComments(token, msgs); }
virtual bool createNewComment(uint32_t &token, RsGxsComment &msg) override virtual bool createNewComment(uint32_t &token, const RsGxsComment &msg) override
{ {
return mCommentService->createGxsComment(token, msg); return mCommentService->createGxsComment(token, msg);
} }
@ -196,6 +196,9 @@ virtual bool ExtraFileRemove(const RsFileHash &hash);
const RsGxsGroupId& channelId, const RsGxsGroupId& channelId,
std::vector<RsMsgMetaData>& summaries ) override; std::vector<RsMsgMetaData>& summaries ) override;
/// Implementation of @see RsGxsChannels::getChannelStatistics
bool getChannelStatistics(const RsGxsGroupId& channelId,GxsGroupStatistic& stat) override;
/// Implementation of @see RsGxsChannels::createChannelV2 /// Implementation of @see RsGxsChannels::createChannelV2
bool createChannelV2( bool createChannelV2(
const std::string& name, const std::string& description, const std::string& name, const std::string& description,

View File

@ -278,8 +278,12 @@ bool p3GxsCircles::getCirclesSummaries(std::list<RsGroupMetaData>& circles)
uint32_t token; uint32_t token;
RsTokReqOptions opts; RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_GROUP_META; opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
if( !requestGroupInfo(token, opts) if( !requestGroupInfo(token, opts) || waitToken(token) != RsTokenService::COMPLETE )
|| waitToken(token) != RsTokenService::COMPLETE ) return false; {
std::cerr << "Cannot get circles summary. Token queue is overloaded?" << std::endl;
return false;
}
else
return getGroupSummary(token, circles); return getGroupSummary(token, circles);
} }
@ -289,8 +293,12 @@ bool p3GxsCircles::getCirclesInfo( const std::list<RsGxsGroupId>& circlesIds,
uint32_t token; uint32_t token;
RsTokReqOptions opts; RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA; opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
if( !requestGroupInfo(token, opts, circlesIds) if( !requestGroupInfo(token, opts, circlesIds) || waitToken(token) != RsTokenService::COMPLETE )
|| waitToken(token) != RsTokenService::COMPLETE ) return false; {
std::cerr << "Cannot get circle info. Token queue is overloaded?" << std::endl;
return false;
}
else
return getGroupData(token, circlesInfo); return getGroupData(token, circlesInfo);
} }

View File

@ -425,7 +425,7 @@ double p3GxsCommentService::calculateBestScore(int upVotes, int downVotes)
/********************************************************************************************/ /********************************************************************************************/
bool p3GxsCommentService::createGxsComment(uint32_t &token, RsGxsComment &msg) bool p3GxsCommentService::createGxsComment(uint32_t &token, const RsGxsComment &msg)
{ {
#ifdef DEBUG_GXSCOMMON #ifdef DEBUG_GXSCOMMON
std::cerr << "p3GxsCommentService::createGxsComment() GroupId: " << msg.mMeta.mGroupId; std::cerr << "p3GxsCommentService::createGxsComment() GroupId: " << msg.mMeta.mGroupId;

View File

@ -66,7 +66,7 @@ class p3GxsCommentService: public GxsTokenQueue
bool getGxsCommentData(const uint32_t &token, std::vector<RsGxsComment> &msgs); bool getGxsCommentData(const uint32_t &token, std::vector<RsGxsComment> &msgs);
bool getGxsRelatedComments(const uint32_t &token, std::vector<RsGxsComment> &msgs); bool getGxsRelatedComments(const uint32_t &token, std::vector<RsGxsComment> &msgs);
bool createGxsComment(uint32_t &token, RsGxsComment &msg); bool createGxsComment(uint32_t &token, const RsGxsComment &msg);
bool createGxsVote(uint32_t &token, RsGxsVote &msg); bool createGxsVote(uint32_t &token, RsGxsVote &msg);
// Special Acknowledge. // Special Acknowledge.

View File

@ -666,15 +666,22 @@ bool p3GxsForums::getForumsSummaries( std::list<RsGroupMetaData>& forums )
return getGroupSummary(token, forums); return getGroupSummary(token, forums);
} }
bool p3GxsForums::getForumsInfo( bool p3GxsForums::getForumsInfo( const std::list<RsGxsGroupId>& forumIds, std::vector<RsGxsForumGroup>& forumsInfo )
const std::list<RsGxsGroupId>& forumIds,
std::vector<RsGxsForumGroup>& forumsInfo )
{ {
uint32_t token; uint32_t token;
RsTokReqOptions opts; RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA; 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); return getGroupData(token, forumsInfo);
} }
@ -812,7 +819,16 @@ bool p3GxsForums::createGroup(uint32_t &token, RsGxsForumGroup &group)
return true; 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; std::cerr << "p3GxsForums::updateGroup()" << std::endl;

View File

@ -94,6 +94,9 @@ public:
const std::list<RsGxsGroupId>& forumIds, const std::list<RsGxsGroupId>& forumIds,
std::vector<RsGxsForumGroup>& forumsInfo ); std::vector<RsGxsForumGroup>& forumsInfo );
/// Implementation of @see RsGxsForums::getForumStatistics
bool getForumStatistics(const RsGxsGroupId& ForumId,GxsGroupStatistic& stat) override;
/// @see RsGxsForums::getForumMsgMetaData /// @see RsGxsForums::getForumMsgMetaData
virtual bool getForumMsgMetaData(const RsGxsGroupId& forumId, std::vector<RsMsgMetaData>& msg_metas) ; 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) std::string& errMsg = RS_DEFAULT_STORAGE_PARAM(std::string)
) override; ) override;
virtual bool getGroupData(const uint32_t &token, std::vector<RsGxsForumGroup> &groups); /// implementation of rsGxsGorums
virtual bool getMsgData(const uint32_t &token, std::vector<RsGxsForumMsg> &msgs); ///
virtual bool getMsgMetaData(const uint32_t &token, GxsMsgMetaMap& msg_metas); bool getGroupData(const uint32_t &token, std::vector<RsGxsForumGroup> &groups) override;
virtual void setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool read); bool getMsgData(const uint32_t &token, std::vector<RsGxsForumMsg> &msgs) override;
virtual bool createGroup(uint32_t &token, RsGxsForumGroup &group); void setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool read) override;
virtual bool createMsg(uint32_t &token, RsGxsForumMsg &msg); bool createGroup(uint32_t &token, RsGxsForumGroup &group) override;
virtual bool updateGroup(uint32_t &token, RsGxsForumGroup &group); 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: private:

View File

@ -639,25 +639,28 @@ void p3IdService::notifyChanges(std::vector<RsGxsNotify *> &changes)
std::cerr << "p3IdService::notifyChanges() Auto Subscribe to Incoming Groups: " << *git; std::cerr << "p3IdService::notifyChanges() Auto Subscribe to Incoming Groups: " << *git;
std::cerr << std::endl; std::cerr << std::endl;
#endif #endif
if(!rsReputations->isIdentityBanned(RsGxsId(*git))) 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 // notify that a new identity is received, if needed
bool should_subscribe = false;
switch(groupChange->getType()) 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: case RsGxsNotify::TYPE_PUBLISHED:
{ {
auto ev = std::make_shared<RsGxsIdentityEvent>(); auto ev = std::make_shared<RsGxsIdentityEvent>();
ev->mIdentityId = *git; ev->mIdentityId = *git;
ev->mIdentityEventCode = RsGxsIdentityEventCode::UPDATED_IDENTITY; ev->mIdentityEventCode = RsGxsIdentityEventCode::UPDATED_IDENTITY;
rsEvents->postEvent(ev); 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; break;
@ -667,12 +670,23 @@ void p3IdService::notifyChanges(std::vector<RsGxsNotify *> &changes)
ev->mIdentityId = *git; ev->mIdentityId = *git;
ev->mIdentityEventCode = RsGxsIdentityEventCode::NEW_IDENTITY; ev->mIdentityEventCode = RsGxsIdentityEventCode::NEW_IDENTITY;
rsEvents->postEvent(ev); 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; break;
default: default:
break; break;
} }
if(should_subscribe)
{
uint32_t token;
RsGenExchange::subscribeToGroup(token, *git, true);
}
} }
} }
} }

View File

@ -85,7 +85,7 @@ public:
return mCommentService->getGxsRelatedComments(token, msgs); return mCommentService->getGxsRelatedComments(token, msgs);
} }
virtual bool createNewComment(uint32_t &token, RsGxsComment &msg) override virtual bool createNewComment(uint32_t &token, const RsGxsComment &msg) override
{ {
return mCommentService->createGxsComment(token, msg); return mCommentService->createGxsComment(token, msg);
} }

View File

@ -307,8 +307,18 @@ bool p3Posted::getBoardsInfo(
uint32_t token; uint32_t token;
RsTokReqOptions opts; RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA; 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(); return getGroupData(token, groupsInfo) && !groupsInfo.empty();
} }
@ -330,5 +340,72 @@ bool p3Posted::getBoardContent( const RsGxsGroupId& groupId,
return getPostData(token, posts, comments); 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; RsPosted::~RsPosted() = default;
RsGxsPostedEvent::~RsGxsPostedEvent() = default; RsGxsPostedEvent::~RsGxsPostedEvent() = default;

View File

@ -66,6 +66,14 @@ virtual void receiveHelperChanges(std::vector<RsGxsNotify*>& changes)
std::vector<RsPostedPost>& posts, std::vector<RsPostedPost>& posts,
std::vector<RsGxsComment>& comments ) override; 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 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);
virtual bool getPostData(const uint32_t &token, std::vector<RsPostedPost> &posts) { std::vector<RsGxsComment> cmts; return getPostData( token, posts, cmts);} virtual bool getPostData(const uint32_t &token, std::vector<RsPostedPost> &posts) { std::vector<RsGxsComment> cmts; return getPostData( token, posts, cmts);}
@ -96,10 +104,16 @@ virtual void setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgI
std::vector<RsGxsComment> &msgs ) std::vector<RsGxsComment> &msgs )
{ return mCommentService->getGxsRelatedComments(token, msgs); } { return mCommentService->getGxsRelatedComments(token, msgs); }
virtual bool createNewComment(uint32_t &token, RsGxsComment &msg) virtual bool createNewComment(uint32_t &token, const RsGxsComment &msg) override
{ {
return mCommentService->createGxsComment(token, msg); return mCommentService->createGxsComment(token, msg);
} }
virtual bool createComment(RsGxsComment& msg) override
{
uint32_t token;
return mCommentService->createGxsComment(token, msg) && waitToken(token) == RsTokenService::COMPLETE ;
}
virtual bool createNewVote(uint32_t &token, RsGxsVote &msg) virtual bool createNewVote(uint32_t &token, RsGxsVote &msg)
{ {

View File

@ -74,7 +74,6 @@
#define IMAGE_COLLOPEN ":/icons/collections.png" #define IMAGE_COLLOPEN ":/icons/collections.png"
#define IMAGE_EDITSHARE ":/images/edit_16.png" #define IMAGE_EDITSHARE ":/images/edit_16.png"
#define IMAGE_MYFILES ":/icons/svg/folders1.svg" #define IMAGE_MYFILES ":/icons/svg/folders1.svg"
#define IMAGE_REMOVE ":/images/deletemail24.png"
/*define viewType_CB value */ /*define viewType_CB value */
#define VIEW_TYPE_TREE 0 #define VIEW_TYPE_TREE 0
@ -228,7 +227,7 @@ SharedFilesDialog::SharedFilesDialog(RetroshareDirModel *_tree_model,RetroshareD
sendlinkAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Send retroshare Links" ), this ); sendlinkAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Send retroshare Links" ), this );
connect( sendlinkAct , SIGNAL( triggered() ), this, SLOT( sendLinkTo( ) ) ); connect( sendlinkAct , SIGNAL( triggered() ), this, SLOT( sendLinkTo( ) ) );
removeExtraFileAct = new QAction(QIcon(IMAGE_REMOVE), tr( "Stop sharing this file" ), this ); removeExtraFileAct = new QAction(QIcon(), tr( "Stop sharing this file" ), this );
connect( removeExtraFileAct , SIGNAL( triggered() ), this, SLOT( removeExtraFile() ) ); connect( removeExtraFileAct , SIGNAL( triggered() ), this, SLOT( removeExtraFile() ) );
collCreateAct= new QAction(QIcon(IMAGE_COLLCREATE), tr("Create Collection..."), this) ; collCreateAct= new QAction(QIcon(IMAGE_COLLCREATE), tr("Create Collection..."), this) ;

View File

@ -59,6 +59,8 @@
* #define ID_DEBUG 1 * #define ID_DEBUG 1
*****/ *****/
#define QT_BUG_CRASH_IN_TAKECHILD_WORKAROUND 1
// Data Requests. // Data Requests.
#define IDDIALOG_IDLIST 1 #define IDDIALOG_IDLIST 1
#define IDDIALOG_IDDETAILS 2 #define IDDIALOG_IDDETAILS 2
@ -586,6 +588,17 @@ void IdDialog::loadCircles(const std::list<RsGroupMetaData>& groupInfo)
mStateHelper->setActive(CIRCLESDIALOG_GROUPMETA, true); mStateHelper->setActive(CIRCLESDIALOG_GROUPMETA, true);
#ifdef QT_BUG_CRASH_IN_TAKECHILD_WORKAROUND
// These 3 lines are normally not needed. But apparently a bug (in Qt ??) causes Qt to crash when takeChild() is called. If we remove everything from the
// tree widget before updating it, takeChild() is never called, but the all tree is filled again from scratch. This is less efficient obviously, and
// also collapses the tree. Because it is a *temporary* fix, I dont take the effort to save open/collapsed items yet. If we cannot find a proper way to fix
// this, then we'll need to implement the two missing functions to save open/collapsed items.
ui->treeWidget_membership->clear();
mExternalOtherCircleItem = NULL ;
mExternalBelongingCircleItem = NULL ;
#endif
/* add the top level item */ /* add the top level item */
//QTreeWidgetItem *personalCirclesItem = new QTreeWidgetItem(); //QTreeWidgetItem *personalCirclesItem = new QTreeWidgetItem();
//personalCirclesItem->setText(0, tr("Personal Circles")); //personalCirclesItem->setText(0, tr("Personal Circles"));
@ -2106,7 +2119,7 @@ void IdDialog::IdListCustomPopupMenu( QPoint )
{ {
if(own_identities.size() <= 1) if(own_identities.size() <= 1)
{ {
QAction *action = contextMenu->addAction(QIcon(":/images/chat_24.png"), tr("Chat with this person"), this, SLOT(chatIdentity())); QAction *action = contextMenu->addAction(QIcon(":/icons/png/chats.png"), tr("Chat with this person"), this, SLOT(chatIdentity()));
if(own_identities.empty()) if(own_identities.empty())
action->setEnabled(false) ; action->setEnabled(false) ;
@ -2115,7 +2128,7 @@ void IdDialog::IdListCustomPopupMenu( QPoint )
} }
else else
{ {
QMenu *mnu = contextMenu->addMenu(QIcon(":/images/chat_24.png"),tr("Chat with this person as...")) ; QMenu *mnu = contextMenu->addMenu(QIcon(":/icons/png/chats.png"),tr("Chat with this person as...")) ;
for(std::list<RsGxsId>::const_iterator it=own_identities.begin();it!=own_identities.end();++it) for(std::list<RsGxsId>::const_iterator it=own_identities.begin();it!=own_identities.end();++it)
{ {
@ -2132,18 +2145,17 @@ void IdDialog::IdListCustomPopupMenu( QPoint )
} }
} }
} }
if (n_selected_items==1)
contextMenu->addAction(QIcon(":/images/chat_24.png"),tr("Copy identity to clipboard"),this,SLOT(copyRetroshareLink())) ;
// always allow to send messages // always allow to send messages
contextMenu->addAction(QIcon(":/images/mail_new.png"), tr("Send message"), this, SLOT(sendMsg())); contextMenu->addAction(QIcon(":/icons/mail/write-mail.png"), tr("Send message"), this, SLOT(sendMsg()));
contextMenu->addSeparator(); contextMenu->addSeparator();
if(n_is_a_contact == 0) if(n_is_a_contact == 0)
contextMenu->addAction(QIcon(), tr("Add to Contacts"), this, SLOT(addtoContacts())); contextMenu->addAction(QIcon(), tr("Add to Contacts"), this, SLOT(addtoContacts()));
if (n_selected_items==1)
contextMenu->addAction(QIcon(""),tr("Copy identity to clipboard"),this,SLOT(copyRetroshareLink())) ;
if(n_is_not_a_contact == 0) if(n_is_not_a_contact == 0)
contextMenu->addAction(QIcon(":/images/cancel.png"), tr("Remove from Contacts"), this, SLOT(removefromContacts())); contextMenu->addAction(QIcon(":/images/cancel.png"), tr("Remove from Contacts"), this, SLOT(removefromContacts()));
@ -2163,7 +2175,7 @@ void IdDialog::IdListCustomPopupMenu( QPoint )
{ {
contextMenu->addSeparator(); contextMenu->addSeparator();
contextMenu->addAction(QIcon(":/images/chat_24.png"),tr("Copy identity to clipboard"),this,SLOT(copyRetroshareLink())) ; contextMenu->addAction(QIcon(""),tr("Copy identity to clipboard"),this,SLOT(copyRetroshareLink())) ;
contextMenu->addAction(ui->editIdentity); contextMenu->addAction(ui->editIdentity);
contextMenu->addAction(ui->removeIdentity); contextMenu->addAction(ui->removeIdentity);
} }

View File

@ -142,8 +142,6 @@
#define IMAGE_BWGRAPH ":/icons/png/bandwidth.png" #define IMAGE_BWGRAPH ":/icons/png/bandwidth.png"
#define IMAGE_MESSENGER ":/images/rsmessenger48.png" #define IMAGE_MESSENGER ":/images/rsmessenger48.png"
#define IMAGE_COLOR ":/images/highlight.png" #define IMAGE_COLOR ":/images/highlight.png"
#define IMAGE_GAMES ":/images/kgames.png"
#define IMAGE_PHOTO ":/images/lphoto.png"
#define IMAGE_NEWRSCOLLECTION ":/images/library.png" #define IMAGE_NEWRSCOLLECTION ":/images/library.png"
#define IMAGE_ADDSHARE ":/images/directoryadd_24x24_shadow.png" #define IMAGE_ADDSHARE ":/images/directoryadd_24x24_shadow.png"
#define IMAGE_OPTIONS ":/images/settings.png" #define IMAGE_OPTIONS ":/images/settings.png"

View File

@ -48,11 +48,9 @@
/* Images for context menu icons */ /* Images for context menu icons */
#define IMAGE_PEERDETAILS ":/images/info16.png" #define IMAGE_PEERDETAILS ":/images/info16.png"
#define IMAGE_CLEAN_UNUSED ":/images/deletemail24.png"
#define IMAGE_MAKEFRIEND ":/images/user/add_user16.png" #define IMAGE_MAKEFRIEND ":/images/user/add_user16.png"
#define IMAGE_EXPORT ""
#define IMAGE_COPYLINK ":/images/copyrslink.png" #define IMAGE_COPYLINK ":/images/copyrslink.png"
#define IMAGE_MESSAGE ":/images/mail_new.png" #define IMAGE_MESSAGE ":/icons/mail/write-mail.png"
/****** /******
* #define NET_DEBUG 1 * #define NET_DEBUG 1
@ -130,11 +128,11 @@ void NetworkDialog::connectTreeWidgetCostumPopupMenu( QPoint /*point*/ )
return ; return ;
if(peer_id == rsPeers->getGPGOwnId()) if(peer_id == rsPeers->getGPGOwnId())
contextMnu->addAction(QIcon(IMAGE_EXPORT), tr("Export/create a new node"), this, SLOT(on_actionExportKey_activated())); contextMnu->addAction(QIcon(), tr("Export/create a new node"), this, SLOT(on_actionExportKey_activated()));
contextMnu->addAction(QIcon(IMAGE_PEERDETAILS), tr("Profile details..."), this, SLOT(peerdetails())); contextMnu->addAction(QIcon(IMAGE_PEERDETAILS), tr("Profile details..."), this, SLOT(peerdetails()));
contextMnu->addSeparator() ; contextMnu->addSeparator() ;
contextMnu->addAction(QIcon(IMAGE_CLEAN_UNUSED), tr("Remove unused keys..."), this, SLOT(removeUnusedKeys())); contextMnu->addAction(QIcon(), tr("Remove unused keys..."), this, SLOT(removeUnusedKeys()));
contextMnu->exec(QCursor::pos()); contextMnu->exec(QCursor::pos());
} }

View File

@ -14,7 +14,7 @@
#include "IdentityItem.h" #include "IdentityItem.h"
#define IMAGE_MAKEFRIEND ":/images/user/add_user16.png" #define IMAGE_MAKEFRIEND ":/images/user/add_user16.png"
#define IMAGE_CHAT ":/images/chat_24.png" #define IMAGE_CHAT ":/icons/png/chats.png"
IdentityItem *IdentityItem::_selected_node = NULL ; IdentityItem *IdentityItem::_selected_node = NULL ;

View File

@ -458,7 +458,7 @@ void PeopleDialog::iw_AddButtonClickedExt()
} }
else else
{ {
QMenu *mnu = contextMnu.addMenu(QIcon(":/images/chat_24.png"),tr("Chat with this person as...")) ; QMenu *mnu = contextMnu.addMenu(QIcon(":/icons/png/chats.png"),tr("Chat with this person as...")) ;
for(std::list<RsGxsId>::const_iterator it=own_identities.begin();it!=own_identities.end();++it) for(std::list<RsGxsId>::const_iterator it=own_identities.begin();it!=own_identities.end();++it)
{ {
@ -475,15 +475,15 @@ void PeopleDialog::iw_AddButtonClickedExt()
} }
} }
QAction *actionsendmsg = contextMnu.addAction(QIcon(":/images/mail_new.png"), tr("Send message"), this, SLOT(sendMessage())); QAction *actionsendmsg = contextMnu.addAction(QIcon(":/icons/mail/write-mail.png"), tr("Send message"), this, SLOT(sendMessage()));
actionsendmsg->setData( QString::fromStdString(dest->groupInfo().mMeta.mGroupId.toStdString())); actionsendmsg->setData( QString::fromStdString(dest->groupInfo().mMeta.mGroupId.toStdString()));
QAction *actionsendinvite = contextMnu.addAction(QIcon(":/images/mail_new.png"), tr("Send invite"), this, SLOT(sendInvite())); QAction *actionsendinvite = contextMnu.addAction(QIcon(":/icons/mail/write-mail.png"), tr("Send invite"), this, SLOT(sendInvite()));
actionsendinvite->setData( QString::fromStdString(dest->groupInfo().mMeta.mGroupId.toStdString())); actionsendinvite->setData( QString::fromStdString(dest->groupInfo().mMeta.mGroupId.toStdString()));
contextMnu.addSeparator(); contextMnu.addSeparator();
QAction *actionaddcontact = contextMnu.addAction(QIcon(":/images/mail_new.png"), tr("Add to Contacts"), this, SLOT(addtoContacts())); QAction *actionaddcontact = contextMnu.addAction(QIcon(""), tr("Add to Contacts"), this, SLOT(addtoContacts()));
actionaddcontact->setData( QString::fromStdString(dest->groupInfo().mMeta.mGroupId.toStdString())); actionaddcontact->setData( QString::fromStdString(dest->groupInfo().mMeta.mGroupId.toStdString()));
contextMnu.addSeparator(); contextMnu.addSeparator();

View File

@ -28,7 +28,6 @@
#include "ui_PostedCreatePostDialog.h" #include "ui_PostedCreatePostDialog.h"
#include "util/misc.h" #include "util/misc.h"
#include "util/TokenQueue.h"
#include "util/RichTextEdit.h" #include "util/RichTextEdit.h"
#include "gui/feeds/SubFileItem.h" #include "gui/feeds/SubFileItem.h"
#include "util/rsdir.h" #include "util/rsdir.h"
@ -45,9 +44,9 @@
#define VIEW_IMAGE 2 #define VIEW_IMAGE 2
#define VIEW_LINK 3 #define VIEW_LINK 3
PostedCreatePostDialog::PostedCreatePostDialog(TokenQueue* tokenQ, RsPosted *posted, const RsGxsGroupId& grpId, QWidget *parent): PostedCreatePostDialog::PostedCreatePostDialog(RsPosted *posted, const RsGxsGroupId& grpId, QWidget *parent):
QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint), QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint),
mTokenQueue(tokenQ), mPosted(posted), mGrpId(grpId), mPosted(posted), mGrpId(grpId),
ui(new Ui::PostedCreatePostDialog) ui(new Ui::PostedCreatePostDialog)
{ {
ui->setupUi(this); ui->setupUi(this);
@ -176,7 +175,6 @@ void PostedCreatePostDialog::createPost()
uint32_t token; uint32_t token;
mPosted->createPost(token, post); mPosted->createPost(token, post);
// mTokenQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, TOKEN_USER_TYPE_POST);
accept(); accept();
} }

View File

@ -26,8 +26,6 @@
#include "retroshare/rsposted.h" #include "retroshare/rsposted.h"
#include "util/RichTextEdit.h" #include "util/RichTextEdit.h"
class TokenQueue;
namespace Ui { namespace Ui {
class PostedCreatePostDialog; class PostedCreatePostDialog;
} }
@ -41,7 +39,7 @@ public:
* @param tokenQ parent callee token * @param tokenQ parent callee token
* @param posted * @param posted
*/ */
explicit PostedCreatePostDialog(TokenQueue* tokenQ, RsPosted* posted, const RsGxsGroupId& grpId, QWidget *parent = 0); explicit PostedCreatePostDialog(RsPosted* posted, const RsGxsGroupId& grpId, QWidget *parent = 0);
~PostedCreatePostDialog(); ~PostedCreatePostDialog();
private: private:
@ -62,7 +60,6 @@ private:
QString mLink; QString mLink;
QString mNotes; QString mNotes;
TokenQueue* mTokenQueue;
RsPosted* mPosted; RsPosted* mPosted;
RsGxsGroupId mGrpId; RsGxsGroupId mGrpId;

View File

@ -150,14 +150,36 @@ QString PostedDialog::icon(IconType type)
return ""; 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() int PostedDialog::shareKeyType()
@ -180,6 +202,7 @@ QWidget *PostedDialog::createCommentHeaderWidget(const RsGxsGroupId &grpId, cons
return new PostedItem(NULL, 0, grpId, msgId, true, false); 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) void PostedDialog::loadGroupSummaryToken(const uint32_t &token, std::list<RsGroupMetaData> &groupInfo, RsUserdata *&userdata)
{ {
std::vector<RsPostedGroup> groups; 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); const RsPostedGroup *postedGroupData = dynamic_cast<const RsPostedGroup*>(groupData);
if (!postedData) {
std::cerr << "PostedDialog::groupInfoToGroupItemInfo() Failed to cast data to PostedGroupInfoData"; if (!postedGroupData)
std::cerr << std::endl; {
std::cerr << "PostedDialog::groupInfoToGroupItemInfo() Failed to cast data to RsPostedGroup"<< std::endl;
return; return;
} }
QMap<RsGxsGroupId, QString>::const_iterator descriptionIt = postedData->mDescription.find(groupInfo.mGroupId); if(postedGroupData->mGroupImage.mSize > 0)
if (descriptionIt != postedData->mDescription.end()) { {
groupItemInfo.description = descriptionIt.value(); 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); groupItemInfo.description = QString::fromUtf8(postedGroupData->mDescription.c_str());
if (iconIt != postedData->mIcon.end()) {
groupItemInfo.icon = iconIt.value();
}
} }

View File

@ -45,21 +45,23 @@ protected:
virtual QString getHelpString() const ; virtual QString getHelpString() const ;
virtual RetroShareLink::enumType getLinkType() { return RetroShareLink::TYPE_POSTED; } virtual RetroShareLink::enumType getLinkType() { return RetroShareLink::TYPE_POSTED; }
virtual GroupFrameSettings::Type groupFrameSettingsType() { return GroupFrameSettings::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: private:
/* GxsGroupFrameDialog */ /* GxsGroupFrameDialog */
virtual QString text(TextType type); virtual QString text(TextType type);
virtual QString icon(IconType type); virtual QString icon(IconType type);
virtual QString settingsGroupName() { return "PostedDialog"; } virtual QString settingsGroupName() { return "PostedDialog"; }
virtual GxsGroupDialog *createNewGroupDialog(TokenQueue *tokenQueue); virtual GxsGroupDialog *createNewGroupDialog();
virtual GxsGroupDialog *createGroupDialog(TokenQueue *tokenQueue, RsTokenService *tokenService, GxsGroupDialog::Mode mode, RsGxsGroupId groupId); virtual GxsGroupDialog *createGroupDialog(GxsGroupDialog::Mode mode, RsGxsGroupId groupId);
virtual int shareKeyType(); virtual int shareKeyType();
virtual GxsMessageFrameWidget *createMessageFrameWidget(const RsGxsGroupId &groupId); virtual GxsMessageFrameWidget *createMessageFrameWidget(const RsGxsGroupId &groupId);
virtual RsGxsCommentService *getCommentService(); virtual RsGxsCommentService *getCommentService();
virtual QWidget *createCommentHeaderWidget(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId); virtual QWidget *createCommentHeaderWidget(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId);
virtual uint32_t requestGroupSummaryType() { return GXS_REQUEST_TYPE_GROUP_DATA; } // request complete group data 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); void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);
RsEventsHandlerId_t mEventHandlerId; RsEventsHandlerId_t mEventHandlerId;

View File

@ -56,13 +56,13 @@ uint32_t PostedCreateDefaultsFlags = ( GXS_GROUP_DEFAULTS_DISTRIB_PUBLIC |
uint32_t PostedEditEnabledFlags = PostedCreateEnabledFlags; uint32_t PostedEditEnabledFlags = PostedCreateEnabledFlags;
uint32_t PostedEditDefaultsFlags = PostedCreateDefaultsFlags; uint32_t PostedEditDefaultsFlags = PostedCreateDefaultsFlags;
PostedGroupDialog::PostedGroupDialog(TokenQueue *tokenQueue, QWidget *parent) PostedGroupDialog::PostedGroupDialog(QWidget *parent)
: GxsGroupDialog(tokenQueue, PostedCreateEnabledFlags, PostedCreateDefaultsFlags, parent) : GxsGroupDialog(PostedCreateEnabledFlags, PostedCreateDefaultsFlags, parent)
{ {
} }
PostedGroupDialog::PostedGroupDialog(TokenQueue *tokenExternalQueue, RsTokenService *tokenService, Mode mode, RsGxsGroupId groupId, QWidget *parent) PostedGroupDialog::PostedGroupDialog(Mode mode, RsGxsGroupId groupId, QWidget *parent)
: GxsGroupDialog(tokenExternalQueue, tokenService, mode, groupId, PostedEditEnabledFlags, PostedEditDefaultsFlags, 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. // Specific Function.
RsPostedGroup grp; RsPostedGroup grp;
preparePostedGroup(grp, meta); preparePostedGroup(grp, meta);
rsPosted->createGroup(token, grp); if(rsPosted->createBoard(grp))
meta = grp.mMeta;
return true; return true;
} }
bool PostedGroupDialog::service_EditGroup(uint32_t &token, RsGroupMetaData &editedMeta) bool PostedGroupDialog::service_updateGroup(const RsGroupMetaData& editedMeta)
{ {
RsPostedGroup grp; RsPostedGroup grp;
preparePostedGroup(grp, editedMeta); 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 << "PostedGroupDialog::service_EditGroup() submitting changes";
std::cerr << std::endl; std::cerr << std::endl;
rsPosted->updateGroup(token, grp); return rsPosted->editBoard(grp);
return true;
} }
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 << ")"; const RsPostedGroup *pgroup = dynamic_cast<const RsPostedGroup*>(data);
std::cerr << std::endl;
std::vector<RsPostedGroup> groups; if(pgroup == nullptr)
if (!rsPosted->getGroupData(token, groups))
{ {
std::cerr << "PostedGroupDialog::service_loadGroup() Error getting GroupData"; std::cerr << "PostedGroupDialog::service_loadGroup() Error not a RsPostedGroup" << std::endl;
std::cerr << std::endl;
return false;
}
if (groups.size() != 1)
{
std::cerr << "PostedGroupDialog::service_loadGroup() Error Group.size() != 1";
std::cerr << std::endl;
return false; return false;
} }
std::cerr << "PostedGroupDialog::service_loadGroup() Unfinished Loading"; std::cerr << "PostedGroupDialog::service_loadGroup() Unfinished Loading";
std::cerr << std::endl; std::cerr << std::endl;
const RsPostedGroup &group = groups[0]; const RsPostedGroup& group = *pgroup;
groupMetaData = group.mMeta;
description = QString::fromUtf8(group.mDescription.c_str()); description = QString::fromUtf8(group.mDescription.c_str());
if (group.mGroupImage.mData) { if (group.mGroupImage.mData)
{
QPixmap pixmap; QPixmap pixmap;
if (GxsIdDetails::loadPixmapFromData(group.mGroupImage.mData, group.mGroupImage.mSize, pixmap,GxsIdDetails::ORIGINAL)) if (GxsIdDetails::loadPixmapFromData(group.mGroupImage.mData, group.mGroupImage.mSize, pixmap,GxsIdDetails::ORIGINAL))
setLogo(pixmap); setLogo(pixmap);
} else {
setLogo(QPixmap(":/icons/png/posted.png"));
} }
else
setLogo(QPixmap(":/icons/png/posted.png"));
return true; 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;
}

View File

@ -30,15 +30,16 @@ class PostedGroupDialog : public GxsGroupDialog
Q_OBJECT Q_OBJECT
public: public:
PostedGroupDialog(TokenQueue *tokenQueue, QWidget *parent); PostedGroupDialog(QWidget *parent);
PostedGroupDialog(TokenQueue *tokenExternalQueue, RsTokenService *tokenService, Mode mode, RsGxsGroupId groupId, QWidget *parent); PostedGroupDialog(Mode mode, RsGxsGroupId groupId, QWidget *parent);
protected: protected:
virtual void initUi(); void initUi() override;
virtual QPixmap serviceImage(); QPixmap serviceImage() override;
virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta); bool service_createGroup(RsGroupMetaData& meta) override;
virtual bool service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData, QString &description); bool service_loadGroup(const RsGxsGenericGroupData *data,Mode mode, QString &description) override;
virtual bool service_EditGroup(uint32_t &token, RsGroupMetaData &editedMeta); bool service_updateGroup(const RsGroupMetaData& editedMeta) override;
bool service_getGroupData(const RsGxsGroupId& grpId,RsGxsGenericGroupData *& data) override;
private: private:
void preparePostedGroup(RsPostedGroup &group, const RsGroupMetaData &meta); void preparePostedGroup(RsPostedGroup &group, const RsGroupMetaData &meta);

View File

@ -250,7 +250,7 @@ void PostedListWidget::newPost()
return; return;
} }
PostedCreatePostDialog *cp = new PostedCreatePostDialog(mTokenQueue, rsPosted, groupId(), this); PostedCreatePostDialog *cp = new PostedCreatePostDialog(rsPosted, groupId(), this);
cp->show(); cp->show();
/* window will destroy itself! */ /* window will destroy itself! */

View File

@ -223,8 +223,8 @@
<string/> <string/>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../images.qrc"> <iconset resource="../icons.qrc">
<normaloff>:/images/arrow-left.png</normaloff>:/images/arrow-left.png</iconset> <normaloff>:/icons/png/arrow-left.png</normaloff>:/icons/png/arrow-left.png</iconset>
</property> </property>
</widget> </widget>
</item> </item>
@ -244,8 +244,8 @@
<string/> <string/>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../images.qrc"> <iconset resource="../icons.qrc">
<normaloff>:/images/arrow-right.png</normaloff>:/images/arrow-right.png</iconset> <normaloff>:/icons/png/arrow-right.png</normaloff>:/icons/png/arrow-right.png</iconset>
</property> </property>
</widget> </widget>
</item> </item>
@ -512,7 +512,7 @@
<string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; <string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt; &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt; &lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:8pt;&quot;&gt;Description&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:8pt;&quot;&gt;Description&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<property name="textInteractionFlags"> <property name="textInteractionFlags">

View File

@ -29,6 +29,7 @@
#include <QLineEdit> #include <QLineEdit>
#include <QMessageBox> #include <QMessageBox>
#include <QDesktopWidget>
#include <iostream> #include <iostream>
@ -47,6 +48,10 @@ StartDialog::StartDialog(QWidget *parent)
Settings->loadWidgetInformation(this); Settings->loadWidgetInformation(this);
/* Put the Login dialog in the screen center */
const QRect screen = QApplication::desktop()->screenGeometry();
this->move( screen.center() - this->rect().center() );
/* get all available pgp private certificates.... /* get all available pgp private certificates....
* mark last one as default. * mark last one as default.
*/ */

View File

@ -34,7 +34,7 @@
#include "util/TokenQueue.h" #include "util/TokenQueue.h"
#define IMAGE_WIRE ":/images/kgames.png" #define IMAGE_WIRE ":/icons/wire.png"
class WireDialog : public MainPage, public TokenResponse, public PulseHolder, public WireGroupHolder class WireDialog : public MainPage, public TokenResponse, public PulseHolder, public WireGroupHolder
{ {

View File

@ -89,7 +89,7 @@ void WireGroupDialog::initUi()
QPixmap WireGroupDialog::serviceImage() QPixmap WireGroupDialog::serviceImage()
{ {
return QPixmap(":/images/wire_create_64.png"); return QPixmap(":/icons/wire-circle.png");
} }
void WireGroupDialog::prepareWireGroup(RsWireGroup &group, const RsGroupMetaData &meta) void WireGroupDialog::prepareWireGroup(RsWireGroup &group, const RsGroupMetaData &meta)

View File

@ -231,8 +231,8 @@
<string>&lt;&lt;</string> <string>&lt;&lt;</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="Wiki_images.qrc"> <iconset resource="../icons.qrc">
<normaloff>:/images/arrow-left.png</normaloff>:/images/arrow-left.png</iconset> <normaloff>:/icons/png/arrow-left.png</normaloff>:/icons/png/arrow-left.png</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
<size> <size>
@ -260,8 +260,8 @@
<string>&gt;&gt;</string> <string>&gt;&gt;</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="Wiki_images.qrc"> <iconset resource="../icons.qrc">
<normaloff>:/images/arrow-right.png</normaloff>:/images/arrow-right.png</iconset> <normaloff>:/icons/png/arrow-right.png</normaloff>:/icons/png/arrow-right.png</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
<size> <size>

View File

@ -1,7 +1,5 @@
<RCC> <RCC>
<qresource prefix="/"> <qresource prefix="/">
<file>images/arrow-left.png</file>
<file>images/arrow-right.png</file>
<file>images/addpage.png</file> <file>images/addpage.png</file>
<file>images/editpage.png</file> <file>images/editpage.png</file>
<file>images/reload.png</file> <file>images/reload.png</file>

View File

@ -93,8 +93,8 @@ ChatLobbyDialog::ChatLobbyDialog(const ChatLobbyId& lid, QWidget *parent, Qt::Wi
voteNegativeAct = new QAction(QIcon(":/icons/png/thumbs-down.png"), tr("Ban this person (Sets negative opinion)"), this); voteNegativeAct = new QAction(QIcon(":/icons/png/thumbs-down.png"), tr("Ban this person (Sets negative opinion)"), this);
voteNeutralAct = new QAction(QIcon(":/icons/png/thumbs-neutral.png"), tr("Give neutral opinion"), this); voteNeutralAct = new QAction(QIcon(":/icons/png/thumbs-neutral.png"), tr("Give neutral opinion"), this);
votePositiveAct = new QAction(QIcon(":/icons/png/thumbs-up.png"), tr("Give positive opinion"), this); votePositiveAct = new QAction(QIcon(":/icons/png/thumbs-up.png"), tr("Give positive opinion"), this);
distantChatAct = new QAction(QIcon(":/images/chat_24.png"), tr("Start private chat"), this); distantChatAct = new QAction(QIcon(":/icons/png/chats.png"), tr("Start private chat"), this);
sendMessageAct = new QAction(QIcon(":/images/mail_new.png"), tr("Send Message"), this); sendMessageAct = new QAction(QIcon(":/icons/mail/write-mail.png"), tr("Send Message"), this);
showInPeopleAct = new QAction(QIcon(), tr("Show author in people tab"), this); showInPeopleAct = new QAction(QIcon(), tr("Show author in people tab"), this);
QActionGroup *sortgrp = new QActionGroup(this); QActionGroup *sortgrp = new QActionGroup(this);

View File

@ -65,8 +65,8 @@
#define IMAGE_EXPORTFRIEND ":/images/user/friend_suggestion16.png" #define IMAGE_EXPORTFRIEND ":/images/user/friend_suggestion16.png"
#define IMAGE_ADDFRIEND ":/images/user/add_user16.png" #define IMAGE_ADDFRIEND ":/images/user/add_user16.png"
#define IMAGE_FRIENDINFO ":/images/info16.png" #define IMAGE_FRIENDINFO ":/images/info16.png"
#define IMAGE_CHAT ":/images/chat_24.png" #define IMAGE_CHAT ":/icons/png/chats.png"
#define IMAGE_MSG ":/images/mail_new.png" #define IMAGE_MSG ":/icons/mail/write-mail.png"
#define IMAGE_CONNECT ":/images/connect_friend.png" #define IMAGE_CONNECT ":/images/connect_friend.png"
#define IMAGE_COPYLINK ":/images/copyrslink.png" #define IMAGE_COPYLINK ":/images/copyrslink.png"
#define IMAGE_GROUP16 ":/images/user/group16.png" #define IMAGE_GROUP16 ":/images/user/group16.png"

View File

@ -63,8 +63,8 @@
#define IMAGE_EXPORTFRIEND ":/images/user/friend_suggestion16.png" #define IMAGE_EXPORTFRIEND ":/images/user/friend_suggestion16.png"
#define IMAGE_ADDFRIEND ":/images/user/add_user16.png" #define IMAGE_ADDFRIEND ":/images/user/add_user16.png"
#define IMAGE_FRIENDINFO ":/images/info16.png" #define IMAGE_FRIENDINFO ":/images/info16.png"
#define IMAGE_CHAT ":/images/chat_24.png" #define IMAGE_CHAT ":/icons/png/chats.png"
#define IMAGE_MSG ":/images/mail_new.png" #define IMAGE_MSG ":/icons/mail/write-mail.png"
#define IMAGE_CONNECT ":/images/connect_friend.png" #define IMAGE_CONNECT ":/images/connect_friend.png"
#define IMAGE_COPYLINK ":/images/copyrslink.png" #define IMAGE_COPYLINK ":/images/copyrslink.png"
#define IMAGE_GROUP16 ":/images/user/group16.png" #define IMAGE_GROUP16 ":/images/user/group16.png"

View File

@ -182,6 +182,19 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>

View File

@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>565</width> <width>643</width>
<height>209</height> <height>209</height>
</rect> </rect>
</property> </property>
@ -171,8 +171,8 @@
<string>Write a quick Message</string> <string>Write a quick Message</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../images.qrc"> <iconset resource="../icons.qrc">
<normaloff>:/images/message-mail.png</normaloff>:/images/message-mail.png</iconset> <normaloff>:/icons/mail/write-mail.png</normaloff>:/icons/mail/write-mail.png</iconset>
</property> </property>
<property name="checkable"> <property name="checkable">
<bool>false</bool> <bool>false</bool>
@ -203,8 +203,8 @@
<string>Write Message</string> <string>Write Message</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../images.qrc"> <iconset resource="../icons.qrc">
<normaloff>:/images/mail_send.png</normaloff>:/images/mail_send.png</iconset> <normaloff>:/icons/mail/write-mail.png</normaloff>:/icons/mail/write-mail.png</iconset>
</property> </property>
<property name="toolButtonStyle"> <property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum> <enum>Qt::ToolButtonTextBesideIcon</enum>
@ -235,8 +235,8 @@
<string>Start Chat</string> <string>Start Chat</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../images.qrc"> <iconset resource="../icons.qrc">
<normaloff>:/images/chat.png</normaloff>:/images/chat.png</iconset> <normaloff>:/icons/png/chats.png</normaloff>:/icons/png/chats.png</iconset>
</property> </property>
<property name="toolButtonStyle"> <property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum> <enum>Qt::ToolButtonTextBesideIcon</enum>

View File

@ -116,7 +116,7 @@ void GxsChannelPostItem::setup()
mCloseOnRead = false; mCloseOnRead = false;
/* clear ui */ /* clear ui */
ui->titleLabel->setText(tr("Loading")); ui->titleLabel->setText(tr("Loading..."));
ui->datetimelabel->clear(); ui->datetimelabel->clear();
ui->filelabel->clear(); ui->filelabel->clear();
ui->newCommentLabel->hide(); ui->newCommentLabel->hide();

View File

@ -59,7 +59,7 @@ void GxsForumGroupItem::setup()
setAttribute(Qt::WA_DeleteOnClose, true); setAttribute(Qt::WA_DeleteOnClose, true);
/* clear ui */ /* clear ui */
ui->nameLabel->setText(tr("Loading")); ui->nameLabel->setText(tr("Loading..."));
ui->titleLabel->clear(); ui->titleLabel->clear();
ui->descLabel->clear(); ui->descLabel->clear();

View File

@ -97,7 +97,7 @@ void GxsForumMsgItem::setup()
mCloseOnRead = false; mCloseOnRead = false;
/* clear ui */ /* clear ui */
ui->titleLabel->setText(tr("Loading")); ui->titleLabel->setText(tr("Loading..."));
ui->subjectLabel->clear(); ui->subjectLabel->clear();
ui->timestamplabel->clear(); ui->timestamplabel->clear();
ui->parentNameLabel->clear(); ui->parentNameLabel->clear();

View File

@ -159,8 +159,8 @@
<string>Send Message</string> <string>Send Message</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../images.qrc"> <iconset resource="../icons.qrc">
<normaloff>:/images/mail_new.png</normaloff>:/images/mail_new.png</iconset> <normaloff>:/icons/mail/write-mail.png</normaloff>:/icons/mail/write-mail.png</iconset>
</property> </property>
<property name="toolButtonStyle"> <property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum> <enum>Qt::ToolButtonTextBesideIcon</enum>
@ -188,8 +188,8 @@
<string>Start Chat</string> <string>Start Chat</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../images.qrc"> <iconset resource="../icons.qrc">
<normaloff>:/images/chat_24.png</normaloff>:/images/chat_24.png</iconset> <normaloff>:/icons/png/chats.png</normaloff>:/icons/png/chats.png</iconset>
</property> </property>
<property name="toolButtonStyle"> <property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum> <enum>Qt::ToolButtonTextBesideIcon</enum>

View File

@ -60,7 +60,7 @@ void PostedGroupItem::setup()
setAttribute(Qt::WA_DeleteOnClose, true); setAttribute(Qt::WA_DeleteOnClose, true);
/* clear ui */ /* clear ui */
ui->nameLabel->setText(tr("Loading")); ui->nameLabel->setText(tr("Loading..."));
ui->titleLabel->clear(); ui->titleLabel->clear();
ui->descLabel->clear(); ui->descLabel->clear();

View File

@ -307,7 +307,7 @@ void GxsCommentTreeWidget::banUser()
void GxsCommentTreeWidget::makeComment() void GxsCommentTreeWidget::makeComment()
{ {
GxsCreateCommentDialog pcc(mTokenQueue, mCommentService, std::make_pair(mGroupId,mLatestMsgId), mLatestMsgId, this); GxsCreateCommentDialog pcc(mCommentService, std::make_pair(mGroupId,mLatestMsgId), mLatestMsgId, this);
pcc.exec(); pcc.exec();
} }
@ -316,7 +316,7 @@ void GxsCommentTreeWidget::replyToComment()
RsGxsGrpMsgIdPair msgId; RsGxsGrpMsgIdPair msgId;
msgId.first = mGroupId; msgId.first = mGroupId;
msgId.second = mCurrentCommentMsgId; msgId.second = mCurrentCommentMsgId;
GxsCreateCommentDialog pcc(mTokenQueue, mCommentService, msgId, mLatestMsgId, this); GxsCreateCommentDialog pcc(mCommentService, msgId, mLatestMsgId, this);
pcc.loadComment(mCurrentCommentText, mCurrentCommentAuthor, mCurrentCommentAuthorId); pcc.loadComment(mCurrentCommentText, mCurrentCommentAuthor, mCurrentCommentAuthorId);
pcc.exec(); pcc.exec();

View File

@ -26,20 +26,16 @@
#include <QMessageBox> #include <QMessageBox>
#include <iostream> #include <iostream>
GxsCreateCommentDialog::GxsCreateCommentDialog(TokenQueue *tokQ, RsGxsCommentService *service, GxsCreateCommentDialog::GxsCreateCommentDialog(RsGxsCommentService *service, const RsGxsGrpMsgIdPair &parentId, const RsGxsMessageId& threadId, QWidget *parent) :
const RsGxsGrpMsgIdPair &parentId, const RsGxsMessageId& threadId, QWidget *parent) :
QDialog(parent), QDialog(parent),
ui(new Ui::GxsCreateCommentDialog), mTokenQueue(tokQ), mCommentService(service), mParentId(parentId), mThreadId(threadId) ui(new Ui::GxsCreateCommentDialog), mCommentService(service), mParentId(parentId), mThreadId(threadId)
{ {
ui->setupUi(this); ui->setupUi(this);
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(createComment())); connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(createComment()));
connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(close())); connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(close()));
/* fill in the available OwnIds for signing */ /* fill in the available OwnIds for signing */
ui->idChooser->loadIds(IDCHOOSER_ID_REQUIRED, RsGxsId()); ui->idChooser->loadIds(IDCHOOSER_ID_REQUIRED, RsGxsId());
} }
void GxsCreateCommentDialog::loadComment(const QString &msgText, const QString &msgAuthor, const RsGxsId &msgAuthorId) void GxsCreateCommentDialog::loadComment(const QString &msgText, const QString &msgAuthor, const RsGxsId &msgAuthorId)
@ -80,9 +76,9 @@ void GxsCreateCommentDialog::createComment()
std::cerr << "ThreadId : " << comment.mMeta.mThreadId << std::endl; std::cerr << "ThreadId : " << comment.mMeta.mThreadId << std::endl;
std::cerr << "ParentId : " << comment.mMeta.mParentId << std::endl; std::cerr << "ParentId : " << comment.mMeta.mParentId << std::endl;
RsGxsId authorId; RsGxsId authorId;
switch (ui->idChooser->getChosenId(authorId)) { switch (ui->idChooser->getChosenId(authorId))
{
case GxsIdChooser::KnowId: case GxsIdChooser::KnowId:
case GxsIdChooser::UnKnowId: case GxsIdChooser::UnKnowId:
comment.mMeta.mAuthorId = authorId; comment.mMeta.mAuthorId = authorId;
@ -96,17 +92,12 @@ void GxsCreateCommentDialog::createComment()
std::cerr << "GxsCreateCommentDialog::createComment() ERROR GETTING AuthorId!"; std::cerr << "GxsCreateCommentDialog::createComment() ERROR GETTING AuthorId!";
std::cerr << std::endl; std::cerr << std::endl;
int ret = QMessageBox::information(this, tr("Comment Signing Error"), QMessageBox::information(this, tr("Comment Signing Error"), tr("You need to create an Identity\n" "before you can comment"), QMessageBox::Ok);
tr("You need to create an Identity\n"
"before you can comment"),
QMessageBox::Ok);
Q_UNUSED(ret)
return; return;
}//switch (ui->idChooser->getChosenId(authorId)) }
uint32_t token; uint32_t token;
mCommentService->createNewComment(token, comment); mCommentService->createComment(comment);
mTokenQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, 0);
close(); close();
} }

View File

@ -36,8 +36,7 @@ class GxsCreateCommentDialog : public QDialog
Q_OBJECT Q_OBJECT
public: public:
explicit GxsCreateCommentDialog(TokenQueue* tokQ, RsGxsCommentService *service, explicit GxsCreateCommentDialog(RsGxsCommentService *service, const RsGxsGrpMsgIdPair& parentId, const RsGxsMessageId& threadId, QWidget *parent = 0);
const RsGxsGrpMsgIdPair& parentId, const RsGxsMessageId& threadId, QWidget *parent = 0);
~GxsCreateCommentDialog(); ~GxsCreateCommentDialog();
void loadComment(const QString &msgText, const QString &msgAuthor, const RsGxsId &msgAuthorId); void loadComment(const QString &msgText, const QString &msgAuthor, const RsGxsId &msgAuthorId);
@ -47,7 +46,6 @@ private slots:
private: private:
Ui::GxsCreateCommentDialog *ui; Ui::GxsCreateCommentDialog *ui;
TokenQueue *mTokenQueue;
RsGxsCommentService *mCommentService; RsGxsCommentService *mCommentService;
RsGxsGrpMsgIdPair mParentId; RsGxsGrpMsgIdPair mParentId;

View File

@ -23,6 +23,7 @@
#include "util/misc.h" #include "util/misc.h"
#include "util/DateTime.h" #include "util/DateTime.h"
#include "util/qtthreadsutils.h"
#include "GxsGroupDialog.h" #include "GxsGroupDialog.h"
#include "gui/common/PeerDefs.h" #include "gui/common/PeerDefs.h"
#include "gui/RetroShareLink.h" #include "gui/RetroShareLink.h"
@ -63,25 +64,21 @@
#define GXSGROUP_INTERNAL_LOADGROUP 3 #define GXSGROUP_INTERNAL_LOADGROUP 3
/** Constructor */ /** Constructor */
GxsGroupDialog::GxsGroupDialog(TokenQueue *tokenExternalQueue, uint32_t enableFlags, uint32_t defaultFlags, QWidget *parent) GxsGroupDialog::GxsGroupDialog(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) : 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 */ /* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this); ui.setupUi(this);
mInternalTokenQueue = NULL;
init(); init();
} }
GxsGroupDialog::GxsGroupDialog(TokenQueue *tokenExternalQueue, RsTokenService *tokenService, Mode mode, RsGxsGroupId groupId, uint32_t enableFlags, uint32_t defaultFlags, QWidget *parent) GxsGroupDialog::GxsGroupDialog(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) : 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 */ /* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this); ui.setupUi(this);
mTokenService = tokenService;
mInternalTokenQueue = new TokenQueue(tokenService, this);
mGrpMeta.mGroupId = groupId; mGrpMeta.mGroupId = groupId;
init(); init();
@ -90,9 +87,6 @@ GxsGroupDialog::GxsGroupDialog(TokenQueue *tokenExternalQueue, RsTokenService *t
GxsGroupDialog::~GxsGroupDialog() GxsGroupDialog::~GxsGroupDialog()
{ {
Settings->saveWidgetInformation(this); Settings->saveWidgetInformation(this);
if (mInternalTokenQueue) {
delete(mInternalTokenQueue);
}
} }
void GxsGroupDialog::init() void GxsGroupDialog::init()
@ -179,6 +173,9 @@ void GxsGroupDialog::showEvent(QShowEvent*)
setWindowIcon(serviceWindowIcon()); setWindowIcon(serviceWindowIcon());
initUi(); initUi();
if(!mGrpMeta.mGroupId.isNull() && mGrpMeta.mPublishTs == 0) // group not actually loaded yet
loadGroup(mGrpMeta.mGroupId);
} }
void GxsGroupDialog::setUiText(UiType uiType, const QString &text) void GxsGroupDialog::setUiText(UiType uiType, const QString &text)
@ -237,7 +234,6 @@ void GxsGroupDialog::initMode()
ui.stackedWidget->setCurrentIndex(1); ui.stackedWidget->setCurrentIndex(1);
mReadonlyFlags = 0xffffffff; // Force all to readonly. mReadonlyFlags = 0xffffffff; // Force all to readonly.
ui.buttonBox->setStandardButtons(QDialogButtonBox::Close); ui.buttonBox->setStandardButtons(QDialogButtonBox::Close);
requestGroup(mGrpMeta.mGroupId);
} }
break; break;
@ -246,7 +242,6 @@ void GxsGroupDialog::initMode()
ui.stackedWidget->setCurrentIndex(0); ui.stackedWidget->setCurrentIndex(0);
ui.buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); ui.buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
ui.buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Submit Group Changes")); ui.buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Submit Group Changes"));
requestGroup(mGrpMeta.mGroupId);
} }
break; break;
} }
@ -596,14 +591,7 @@ void GxsGroupDialog::editGroup()
std::cerr << "GxsGroupDialog::editGroup() calling service_EditGroup"; std::cerr << "GxsGroupDialog::editGroup() calling service_EditGroup";
std::cerr << std::endl; std::cerr << std::endl;
uint32_t token; if (!service_updateGroup(newMeta))
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
{ {
std::cerr << "GxsGroupDialog::editGroup() ERROR"; std::cerr << "GxsGroupDialog::editGroup() ERROR";
std::cerr << std::endl; std::cerr << std::endl;
@ -676,7 +664,6 @@ void GxsGroupDialog::createGroup()
return; //Don't add a empty name!! return; //Don't add a empty name!!
} }
uint32_t token;
RsGroupMetaData meta; RsGroupMetaData meta;
QString reason; QString reason;
if (!prepareGroupMetaData(meta, reason)) if (!prepareGroupMetaData(meta, reason))
@ -686,11 +673,16 @@ void GxsGroupDialog::createGroup()
return; //Don't add with invalid circle. 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) if(mExternalTokenQueue != NULL)
mExternalTokenQueue->queueRequest(token, TOKENREQ_GROUPINFO, RS_TOKREQ_ANSTYPE_ACK, GXSGROUP_NEWGROUPID); mExternalTokenQueue->queueRequest(token, TOKENREQ_GROUPINFO, RS_TOKREQ_ANSTYPE_ACK, GXSGROUP_NEWGROUPID);
#endif
} }
close(); close();
@ -984,6 +976,40 @@ void GxsGroupDialog::filterComboBoxChanged(int i)
Loading Group. 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) void GxsGroupDialog::requestGroup(const RsGxsGroupId &groupId)
{ {
RsTokReqOptions opts; RsTokReqOptions opts;
@ -1032,3 +1058,4 @@ void GxsGroupDialog::loadRequest(const TokenQueue *queue, const TokenRequest &re
} }
} }
} }
#endif

View File

@ -108,7 +108,7 @@ public:
* The long term plan is perhap logic structure (i.e. code) will be moved into each GXS \n * 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! * service for better customisation of group creation, or perhaps not!
*/ */
class GxsGroupDialog : public QDialog, public TokenResponse class GxsGroupDialog : public QDialog
{ {
Q_OBJECT Q_OBJECT
@ -131,15 +131,12 @@ public:
/*! /*!
* Constructs a GxsGroupDialog for creating group * 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 enableFlags This determines what options are enabled such as Icon, Description, publish type and key sharing
* @param defaultFlags This deter * @param defaultFlags This deter
* @param parent The parent dialog * @param parent The parent dialog
* @param mode * @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 * 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 mode This determines whether the dialog starts in show or edit mode (Edit not supported yet)
* @param parent * @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(); ~GxsGroupDialog();
uint32_t mode() { return mMode; } uint32_t mode() { return mMode; }
// overloaded from TokenResponse
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
private: private:
void newGroup(); void newGroup();
void init(); void init();
@ -191,24 +185,37 @@ protected:
void setUiToolTip(UiType uiType, const QString &text); void setUiToolTip(UiType uiType, const QString &text);
void setUiText (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 * It is up to the service to do the actual group creation
* Service can also modify initial meta going into group * 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 * @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 * 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 * @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. * Should be overloaded by the service in order to extract meaningful information from the group data (that is usually group-specific).
virtual bool service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData, QString &description) = 0; * 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 * This returns a group logo from the ui \n
@ -270,8 +277,7 @@ private:
void loadNewGroupId(const uint32_t &token); void loadNewGroupId(const uint32_t &token);
// loading existing Groups. // loading existing Groups.
void requestGroup(const RsGxsGroupId &groupId); void loadGroup(const RsGxsGroupId &groupId);
void loadGroup(uint32_t token);
void updateFromExistingMeta(const QString &description); void updateFromExistingMeta(const QString &description);
bool prepareGroupMetaData(RsGroupMetaData &meta, QString &reason); bool prepareGroupMetaData(RsGroupMetaData &meta, QString &reason);

View File

@ -33,6 +33,8 @@
#include "gui/notifyqt.h" #include "gui/notifyqt.h"
#include "gui/common/UIStateHelper.h" #include "gui/common/UIStateHelper.h"
#include "gui/common/UserNotify.h" #include "gui/common/UserNotify.h"
#include "util/qtthreadsutils.h"
#include "retroshare/rsgxsifacetypes.h"
#include "GxsCommentDialog.h" #include "GxsCommentDialog.h"
//#define DEBUG_GROUPFRAMEDIALOG //#define DEBUG_GROUPFRAMEDIALOG
@ -86,8 +88,6 @@ GxsGroupFrameDialog::GxsGroupFrameDialog(RsGxsIfaceHelper *ifaceImpl, QWidget *p
/* Setup Queue */ /* Setup Queue */
mInterface = ifaceImpl; mInterface = ifaceImpl;
mTokenService = mInterface->getTokenService();
mTokenQueue = new TokenQueue(mInterface->getTokenService(), this);
/* Setup UI helper */ /* Setup UI helper */
mStateHelper = new UIStateHelper(this); mStateHelper = new UIStateHelper(this);
@ -125,7 +125,6 @@ GxsGroupFrameDialog::~GxsGroupFrameDialog()
// save settings // save settings
processSettings(false); processSettings(false);
delete(mTokenQueue);
delete(ui); delete(ui);
} }
@ -134,7 +133,9 @@ void GxsGroupFrameDialog::getGroupList(std::map<RsGxsGroupId, RsGroupMetaData> &
group_list = mCachedGroupMetas ; group_list = mCachedGroupMetas ;
if(group_list.empty()) if(group_list.empty())
requestGroupSummary(); updateGroupSummary();
else
std::cerr << "************** Using cached GroupMetaData" << std::endl;
} }
void GxsGroupFrameDialog::initUi() void GxsGroupFrameDialog::initUi()
{ {
@ -168,20 +169,20 @@ void GxsGroupFrameDialog::initUi()
connect(NotifyQt::getInstance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged())); connect(NotifyQt::getInstance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
settingsChanged(); settingsChanged();
} }
mInitialized = true;
} }
void GxsGroupFrameDialog::showEvent(QShowEvent *event) void GxsGroupFrameDialog::showEvent(QShowEvent *event)
{ {
if (!mInitialized) { if (!mInitialized )
{
/* Problem: virtual methods cannot be used in constructor */ /* Problem: virtual methods cannot be used in constructor */
mInitialized = true;
initUi(); initUi();
} }
updateDisplay(true); updateDisplay( mCachedGroupMetas.empty() );
// RsGxsUpdateBroadcastPage::showEvent(event);
} }
void GxsGroupFrameDialog::processSettings(bool load) void GxsGroupFrameDialog::processSettings(bool load)
@ -242,7 +243,7 @@ void GxsGroupFrameDialog::setHideTabBarWithOneTab(bool hideTabBarWithOneTab)
void GxsGroupFrameDialog::updateDisplay(bool complete) void GxsGroupFrameDialog::updateDisplay(bool complete)
{ {
if(complete) // || !getGrpIds().empty() || !getGrpIdsMeta().empty()) { if(complete) // || !getGrpIds().empty() || !getGrpIdsMeta().empty()) {
requestGroupSummary(); /* Update group list */ updateGroupSummary(); /* Update group list */
updateSearchResults() ; updateSearchResults() ;
} }
@ -546,7 +547,8 @@ void GxsGroupFrameDialog::restoreGroupKeys(void)
void GxsGroupFrameDialog::newGroup() void GxsGroupFrameDialog::newGroup()
{ {
GxsGroupDialog *dialog = createNewGroupDialog(mTokenQueue); GxsGroupDialog *dialog = createNewGroupDialog();
if (!dialog) { if (!dialog) {
return; return;
} }
@ -573,8 +575,6 @@ void GxsGroupFrameDialog::groupSubscribe(bool subscribe)
uint32_t token; uint32_t token;
mInterface->subscribeToGroup(token, mGroupId, subscribe); 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() void GxsGroupFrameDialog::showGroupDetails()
@ -583,7 +583,7 @@ void GxsGroupFrameDialog::showGroupDetails()
return; return;
} }
GxsGroupDialog *dialog = createGroupDialog(mTokenQueue, mInterface->getTokenService(), GxsGroupDialog::MODE_SHOW, mGroupId); GxsGroupDialog *dialog = createGroupDialog(GxsGroupDialog::MODE_SHOW, mGroupId);
if (!dialog) { if (!dialog) {
return; return;
} }
@ -598,7 +598,7 @@ void GxsGroupFrameDialog::editGroupDetails()
return; return;
} }
GxsGroupDialog *dialog = createGroupDialog(mTokenQueue, mInterface->getTokenService(), GxsGroupDialog::MODE_EDIT, mGroupId); GxsGroupDialog *dialog = createGroupDialog(GxsGroupDialog::MODE_EDIT, mGroupId);
if (!dialog) { if (!dialog) {
return; return;
} }
@ -896,16 +896,16 @@ void GxsGroupFrameDialog::messageTabWaitingChanged(QWidget *widget)
} }
///***** INSERT GROUP LISTS *****/ ///***** 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.id = QString::fromStdString(groupInfo->mMeta.mGroupId.toStdString());
groupItemInfo.name = QString::fromUtf8(groupInfo.mGroupName.c_str()); groupItemInfo.name = QString::fromUtf8(groupInfo->mMeta.mGroupName.c_str());
groupItemInfo.popularity = groupInfo.mPop; groupItemInfo.popularity = groupInfo->mMeta.mPop;
groupItemInfo.lastpost = QDateTime::fromTime_t(groupInfo.mLastPost); groupItemInfo.lastpost = QDateTime::fromTime_t(groupInfo->mMeta.mLastPost);
groupItemInfo.subscribeFlags = groupInfo.mSubscribeFlags; groupItemInfo.subscribeFlags = groupInfo->mMeta.mSubscribeFlags;
groupItemInfo.publishKey = IS_GROUP_PUBLISHER(groupInfo.mSubscribeFlags) ; groupItemInfo.publishKey = IS_GROUP_PUBLISHER(groupInfo->mMeta.mSubscribeFlags) ;
groupItemInfo.adminKey = IS_GROUP_ADMIN(groupInfo.mSubscribeFlags) ; groupItemInfo.adminKey = IS_GROUP_ADMIN(groupInfo->mMeta.mSubscribeFlags) ;
groupItemInfo.max_visible_posts = groupInfo.mVisibleMsgCount ; groupItemInfo.max_visible_posts = groupInfo->mMeta.mVisibleMsgCount ;
#if TOGXS #if TOGXS
if (groupInfo.mGroupFlags & RS_DISTRIB_AUTHEN_REQ) { 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) { if (!mInitialized) {
return; return;
@ -933,57 +933,44 @@ void GxsGroupFrameDialog::insertGroupsData(const std::map<RsGxsGroupId,RsGroupMe
QList<GroupItemInfo> otherList; QList<GroupItemInfo> otherList;
std::multimap<uint32_t, GroupItemInfo> popMap; 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 */ /* sort it into Publish (Own), Subscribed, Popular and Other */
uint32_t flags = it->second.mSubscribeFlags; uint32_t flags = g->mMeta.mSubscribeFlags;
GroupItemInfo groupItemInfo; GroupItemInfo groupItemInfo;
groupInfoToGroupItemInfo(it->second, groupItemInfo, userdata); groupInfoToGroupItemInfo(g, groupItemInfo);
if (IS_GROUP_SUBSCRIBED(flags)) if (IS_GROUP_SUBSCRIBED(flags))
{ {
if (IS_GROUP_ADMIN(flags)) if (IS_GROUP_ADMIN(flags))
{
adminList.push_back(groupItemInfo); adminList.push_back(groupItemInfo);
else
subList.push_back(groupItemInfo); /* subscribed group */
} }
else else
{ {
/* subscribed group */ popMap.insert(std::make_pair(g->mMeta.mLastPost, groupItemInfo)); /* rate the others by time of last post */
subList.push_back(groupItemInfo);
}
}
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 */
} }
} }
/* iterate backwards through popMap - take the top 5 or 10% of list */ /* iterate backwards through popMap - take the top 5 or 10% of list */
uint32_t popCount = 5; uint32_t popCount = 5;
if (popCount < popMap.size() / 10) if (popCount < popMap.size() / 10)
{
popCount = popMap.size() / 10; popCount = popMap.size() / 10;
}
uint32_t i = 0; uint32_t i = 0;
std::multimap<uint32_t, GroupItemInfo>::reverse_iterator rit; 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) { for (rit = popMap.rbegin(); rit != popMap.rend(); ++rit,++i)
//if (rit->second.popularity > (int) popLimit) {
if(i < popCount) if(i < popCount)
popList.append(rit->second); popList.append(rit->second);
else else
otherList.append(rit->second); otherList.append(rit->second);
}
/* now we can add them in as a tree! */ /* now we can add them in as a tree! */
ui->groupTreeWidget->fillGroupItems(mYourGroups, adminList); ui->groupTreeWidget->fillGroupItems(mYourGroups, adminList);
mYourGroups->setText(2, QString::number(mYourGroups->childCount()));
ui->groupTreeWidget->fillGroupItems(mSubscribedGroups, subList); ui->groupTreeWidget->fillGroupItems(mSubscribedGroups, subList);
mSubscribedGroups->setText(2, QString::number(mSubscribedGroups->childCount())); // 1 COLUMN_UNREAD 2 COLUMN_POPULARITY mSubscribedGroups->setText(2, QString::number(mSubscribedGroups->childCount())); // 1 COLUMN_UNREAD 2 COLUMN_POPULARITY
ui->groupTreeWidget->fillGroupItems(mPopularGroups, popList); ui->groupTreeWidget->fillGroupItems(mPopularGroups, popList);
@ -994,9 +981,8 @@ void GxsGroupFrameDialog::insertGroupsData(const std::map<RsGxsGroupId,RsGroupMe
mInFill = false; mInFill = false;
/* Re-fill group */ /* Re-fill group */
if (!ui->groupTreeWidget->activateId(QString::fromStdString(mGroupId.toStdString()), true)) { if (!ui->groupTreeWidget->activateId(QString::fromStdString(mGroupId.toStdString()), true))
mGroupId.clear(); mGroupId.clear();
}
updateMessageSummaryList(RsGxsGroupId()); updateMessageSummaryList(RsGxsGroupId());
} }
@ -1007,7 +993,8 @@ void GxsGroupFrameDialog::updateMessageSummaryList(RsGxsGroupId groupId)
return; return;
} }
if (groupId.isNull()) { if (groupId.isNull())
{
QTreeWidgetItem *items[2] = { mYourGroups, mSubscribedGroups }; QTreeWidgetItem *items[2] = { mYourGroups, mSubscribedGroups };
for (int item = 0; item < 2; ++item) { for (int item = 0; item < 2; ++item) {
int child; int child;
@ -1015,22 +1002,73 @@ void GxsGroupFrameDialog::updateMessageSummaryList(RsGxsGroupId groupId)
for (child = 0; child < childCount; ++child) { for (child = 0; child < childCount; ++child) {
QTreeWidgetItem *childItem = items[item]->child(child); QTreeWidgetItem *childItem = items[item]->child(child);
QString childId = ui->groupTreeWidget->itemId(childItem); QString childId = ui->groupTreeWidget->itemId(childItem);
if (childId.isEmpty()) { if (childId.isEmpty())
continue; continue;
}
requestGroupStatistics(RsGxsGroupId(childId.toLatin1().constData())); updateGroupStatistics(RsGxsGroupId(childId.toLatin1().constData()));
} }
} }
} else {
requestGroupStatistics(groupId);
} }
else
updateGroupStatistics(groupId);
} }
/*********************** **** **** **** ***********************/ /*********************** **** **** **** ***********************/
/** Request / Response of Data ********************************/ /** 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() void GxsGroupFrameDialog::requestGroupSummary()
{ {
mStateHelper->setLoading(TOKEN_TYPE_GROUP_SUMMARY, true); mStateHelper->setLoading(TOKEN_TYPE_GROUP_SUMMARY, true);
@ -1055,37 +1093,14 @@ void GxsGroupFrameDialog::loadGroupSummaryToken(const uint32_t &token, std::list
mInterface->getGroupSummary(token, groupInfo); mInterface->getGroupSummary(token, groupInfo);
} }
void GxsGroupFrameDialog::loadGroupSummary(const uint32_t &token) void GxsGroupFrameDialog::loadGroupSummary(const std::list<RsGxsGenericGroupData*>& groupInfo)
{ {
#ifdef DEBUG_GROUPFRAMEDIALOG #ifdef DEBUG_GROUPFRAMEDIALOG
std::cerr << "GxsGroupFrameDialog::loadGroupSummary()"; std::cerr << "GxsGroupFrameDialog::loadGroupSummary()";
std::cerr << std::endl; std::cerr << std::endl;
#endif #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();
}
} }
/*********************** **** **** **** ***********************/ /*********************** **** **** **** ***********************/
@ -1144,17 +1159,44 @@ void GxsGroupFrameDialog::loadGroupSummary(const uint32_t &token)
// setValid(true); // setValid(true);
//} //}
#endif
/*********************** **** **** **** ***********************/ /*********************** **** **** **** ***********************/
/*********************** **** **** **** ***********************/ /*********************** **** **** **** ***********************/
void GxsGroupFrameDialog::requestGroupStatistics(const RsGxsGroupId &groupId) void GxsGroupFrameDialog::updateGroupStatistics(const RsGxsGroupId &groupId)
{ {
uint32_t token; RsThread::async([this,groupId]()
mTokenService->requestGroupStatistic(token, groupId); {
mTokenQueue->queueRequest(token, 0, RS_TOKREQ_ANSTYPE_ACK, TOKEN_TYPE_STATISTICS); 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) void GxsGroupFrameDialog::loadGroupStatistics(const uint32_t &token)
{ {
GxsGroupStatistic stats; GxsGroupStatistic stats;
@ -1185,9 +1227,9 @@ void GxsGroupFrameDialog::loadRequest(const TokenQueue *queue, const TokenReques
/* now switch on req */ /* now switch on req */
switch(req.mUserType) switch(req.mUserType)
{ {
case TOKEN_TYPE_GROUP_SUMMARY: // case TOKEN_TYPE_GROUP_SUMMARY:
loadGroupSummary(req.mToken); // loadGroupSummary(req.mToken);
break; // break;
// case TOKEN_TYPE_SUBSCRIBE_CHANGE: // case TOKEN_TYPE_SUBSCRIBE_CHANGE:
// acknowledgeSubscribeChange(req.mToken); // acknowledgeSubscribeChange(req.mToken);
@ -1207,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 TurtleRequestId GxsGroupFrameDialog::distantSearch(const QString& search_string) // this should be overloaded in the child class
{ {

View File

@ -44,7 +44,7 @@ class UIStateHelper;
struct RsGxsCommentService; struct RsGxsCommentService;
class GxsCommentDialog; class GxsCommentDialog;
class GxsGroupFrameDialog : public MainPage, public TokenResponse class GxsGroupFrameDialog : public MainPage
{ {
Q_OBJECT Q_OBJECT
@ -76,9 +76,6 @@ public:
bool navigate(const RsGxsGroupId &groupId, const RsGxsMessageId& msgId); 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 QString getHelpString() const =0;
virtual void getGroupList(std::map<RsGxsGroupId,RsGroupMetaData> &groups) ; virtual void getGroupList(std::map<RsGxsGroupId,RsGroupMetaData> &groups) ;
@ -93,12 +90,18 @@ protected:
bool getCurrentGroupName(QString& name); bool getCurrentGroupName(QString& name);
virtual RetroShareLink::enumType getLinkType() = 0; virtual RetroShareLink::enumType getLinkType() = 0;
virtual GroupFrameSettings::Type groupFrameSettingsType() { return GroupFrameSettings::Nothing; } 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 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 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 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: private slots:
void todo(); void todo();
@ -145,8 +148,8 @@ private:
virtual QString settingsGroupName() = 0; virtual QString settingsGroupName() = 0;
virtual TurtleRequestId distantSearch(const QString& search_string) ; virtual TurtleRequestId distantSearch(const QString& search_string) ;
virtual GxsGroupDialog *createNewGroupDialog(TokenQueue *tokenQueue) = 0; virtual GxsGroupDialog *createNewGroupDialog() = 0;
virtual GxsGroupDialog *createGroupDialog(TokenQueue *tokenQueue, RsTokenService *tokenService, GxsGroupDialog::Mode mode, RsGxsGroupId groupId) = 0; virtual GxsGroupDialog *createGroupDialog(GxsGroupDialog::Mode mode, RsGxsGroupId groupId) = 0;
virtual int shareKeyType() = 0; virtual int shareKeyType() = 0;
virtual GxsMessageFrameWidget *createMessageFrameWidget(const RsGxsGroupId &groupId) = 0; virtual GxsMessageFrameWidget *createMessageFrameWidget(const RsGxsGroupId &groupId) = 0;
virtual void groupTreeCustomActions(RsGxsGroupId /*grpId*/, int /*subscribeFlags*/, QList<QAction*> &/*actions*/) {} virtual void groupTreeCustomActions(RsGxsGroupId /*grpId*/, int /*subscribeFlags*/, QList<QAction*> &/*actions*/) {}
@ -162,12 +165,13 @@ private:
void processSettings(bool load); void processSettings(bool load);
// New Request/Response Loading Functions. // 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 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 requestGroupStatistics(const RsGxsGroupId &groupId);
void loadGroupStatistics(const uint32_t &token); void loadGroupStatistics(const uint32_t &token);
@ -195,8 +199,6 @@ private:
QString mSettingsName; QString mSettingsName;
RsGxsGroupId mGroupId; RsGxsGroupId mGroupId;
RsGxsIfaceHelper *mInterface; RsGxsIfaceHelper *mInterface;
RsTokenService *mTokenService;
TokenQueue *mTokenQueue;
GxsMessageFrameWidget *mMessageWidget; GxsMessageFrameWidget *mMessageWidget;
QTreeWidgetItem *mYourGroups; QTreeWidgetItem *mYourGroups;

View File

@ -285,7 +285,7 @@ void GxsIdChooser::loadPrivateIds()
QString str = tr("Create new Identity"); QString str = tr("Create new Identity");
QString id = ""; QString id = "";
addItem(QIcon(":/images/identity/identity_create_32.png"), str, id); addItem(QIcon(":/icons/png/add-identity.png"), str, id);
setItemData(count() - 1, QString("%1_%2").arg(TYPE_CREATE_ID).arg(str), ROLE_SORT); setItemData(count() - 1, QString("%1_%2").arg(TYPE_CREATE_ID).arg(str), ROLE_SORT);
setItemData(count() - 1, TYPE_CREATE_ID, ROLE_TYPE); setItemData(count() - 1, TYPE_CREATE_ID, ROLE_TYPE);

View File

@ -935,7 +935,7 @@ QPixmap GxsIdDetails::drawIdentIcon( QString hash, quint16 width, bool rotate)
QString GxsIdDetails::getLoadingText(const RsGxsId &id) 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) QString GxsIdDetails::getFailedText(const RsGxsId &id)

View File

@ -249,13 +249,13 @@ void GxsIdTreeItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem
if(id.isNull()) if(id.isNull())
{ {
str = tr("[Notification]"); str = tr("[Notification]");
icon = QIcon(":/icons/logo_128.png"); icon = QIcon(":/icons/notification.png");
} }
else if(! computeNameIconAndComment(id,str,icon,comment)) else if(! computeNameIconAndComment(id,str,icon,comment))
if(mReloadPeriod > 3) if(mReloadPeriod > 3)
{ {
str = tr("[Unknown]"); str = tr("[Unknown]");
icon = QIcon(); icon = QIcon(":/icons/anonymous.png");
} }
else else
{ {

View File

@ -50,7 +50,7 @@ GxsMessageFramePostWidget::~GxsMessageFramePostWidget()
void GxsMessageFramePostWidget::groupIdChanged() void GxsMessageFramePostWidget::groupIdChanged()
{ {
mGroupName = groupId().isNull () ? "" : tr("Loading"); mGroupName = groupId().isNull () ? "" : tr("Loading...");
groupNameChanged(mGroupName); groupNameChanged(mGroupName);
emit groupChanged(this); emit groupChanged(this);

View File

@ -36,15 +36,15 @@
#include "gui/common/GroupTreeWidget.h" #include "gui/common/GroupTreeWidget.h"
#include "util/qtthreadsutils.h" #include "util/qtthreadsutils.h"
class GxsChannelGroupInfoData : public RsUserdata // class GxsChannelGroupInfoData : public RsUserdata
{ // {
public: // public:
GxsChannelGroupInfoData() : RsUserdata() {} // GxsChannelGroupInfoData() : RsUserdata() {}
//
public: // public:
QMap<RsGxsGroupId, QIcon> mIcon; // QMap<RsGxsGroupId, QIcon> mIcon;
QMap<RsGxsGroupId, QString> mDescription; // QMap<RsGxsGroupId, QString> mDescription;
}; // };
/** Constructor */ /** Constructor */
GxsChannelDialog::GxsChannelDialog(QWidget *parent) GxsChannelDialog::GxsChannelDialog(QWidget *parent)
@ -165,13 +165,13 @@ QString GxsChannelDialog::icon(IconType type)
case ICON_NEW: case ICON_NEW:
return ":/icons/png/add.png"; return ":/icons/png/add.png";
case ICON_YOUR_GROUP: case ICON_YOUR_GROUP:
return ":/icons/png/channel.png"; return "";
case ICON_SUBSCRIBED_GROUP: case ICON_SUBSCRIBED_GROUP:
return ":/icons/png/channel-subscribed.png"; return "";
case ICON_POPULAR_GROUP: case ICON_POPULAR_GROUP:
return ":/icons/png/channel-popular.png"; return "";
case ICON_OTHER_GROUP: case ICON_OTHER_GROUP:
return ":/icons/png/channel-other.png"; return "";
case ICON_SEARCH: case ICON_SEARCH:
return ":/images/find.png"; return ":/images/find.png";
case ICON_DEFAULT: case ICON_DEFAULT:
@ -181,14 +181,14 @@ QString GxsChannelDialog::icon(IconType type)
return ""; 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() 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) void GxsChannelDialog::loadGroupSummaryToken(const uint32_t &token, std::list<RsGroupMetaData> &groupInfo, RsUserdata *&userdata)
{ {
std::vector<RsGxsChannelGroup> groups; 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); const RsGxsChannelGroup *channelGroupData = dynamic_cast<const RsGxsChannelGroup*>(groupData);
if (!channelData) {
std::cerr << "GxsChannelDialog::groupInfoToGroupItemInfo() Failed to cast data to GxsChannelGroupInfoData"; if (!channelGroupData)
std::cerr << std::endl; {
std::cerr << "GxsChannelDialog::groupInfoToGroupItemInfo() Failed to cast data to GxsChannelGroupInfoData"<< std::endl;
return; return;
} }
QMap<RsGxsGroupId, QString>::const_iterator descriptionIt = channelData->mDescription.find(groupInfo.mGroupId); if(channelGroupData->mImage.mSize > 0)
if (descriptionIt != channelData->mDescription.end()) { {
groupItemInfo.description = descriptionIt.value(); 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); groupItemInfo.description = QString::fromUtf8(channelGroupData->mDescription.c_str());
if (iconIt != channelData->mIcon.end()) {
groupItemInfo.icon = iconIt.value();
}
} }
TurtleRequestId GxsChannelDialog::distantSearch(const QString& search_string) TurtleRequestId GxsChannelDialog::distantSearch(const QString& search_string)

View File

@ -43,17 +43,22 @@ public:
protected: protected:
/* GxsGroupFrameDialog */ /* 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 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 TurtleRequestId distantSearch(const QString& search_string) ;
virtual void checkRequestGroup(const RsGxsGroupId& grpId) ; 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: private slots:
void toggleAutoDownload(); void toggleAutoDownload();
void setDefaultDirectory(); void setDefaultDirectory();
@ -65,15 +70,14 @@ private:
virtual QString text(TextType type); virtual QString text(TextType type);
virtual QString icon(IconType type); virtual QString icon(IconType type);
virtual QString settingsGroupName() { return "ChannelDialog"; } virtual QString settingsGroupName() { return "ChannelDialog"; }
virtual GxsGroupDialog *createNewGroupDialog(TokenQueue *tokenQueue); virtual GxsGroupDialog *createNewGroupDialog();
virtual GxsGroupDialog *createGroupDialog(TokenQueue *tokenQueue, RsTokenService *tokenService, GxsGroupDialog::Mode mode, RsGxsGroupId groupId); virtual GxsGroupDialog *createGroupDialog(GxsGroupDialog::Mode mode, RsGxsGroupId groupId);
virtual int shareKeyType(); virtual int shareKeyType();
virtual GxsMessageFrameWidget *createMessageFrameWidget(const RsGxsGroupId &groupId); virtual GxsMessageFrameWidget *createMessageFrameWidget(const RsGxsGroupId &groupId);
virtual void groupTreeCustomActions(RsGxsGroupId grpId, int subscribeFlags, QList<QAction*> &actions); virtual void groupTreeCustomActions(RsGxsGroupId grpId, int subscribeFlags, QList<QAction*> &actions);
virtual RsGxsCommentService *getCommentService(); virtual RsGxsCommentService *getCommentService();
virtual QWidget *createCommentHeaderWidget(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId); virtual QWidget *createCommentHeaderWidget(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId);
virtual uint32_t requestGroupSummaryType() { return GXS_REQUEST_TYPE_GROUP_DATA; } // request complete group data 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); void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);

View File

@ -59,15 +59,15 @@ const uint32_t ChannelCreateDefaultsFlags = ( GXS_GROUP_DEFAULTS_DISTRIB_PUBLIC
const uint32_t ChannelEditEnabledFlags = ChannelCreateEnabledFlags; const uint32_t ChannelEditEnabledFlags = ChannelCreateEnabledFlags;
const uint32_t ChannelEditDefaultsFlags = ChannelCreateDefaultsFlags; const uint32_t ChannelEditDefaultsFlags = ChannelCreateDefaultsFlags;
GxsChannelGroupDialog::GxsChannelGroupDialog(TokenQueue *tokenQueue, QWidget *parent) GxsChannelGroupDialog::GxsChannelGroupDialog(QWidget *parent)
: GxsGroupDialog(tokenQueue, ChannelCreateEnabledFlags, ChannelCreateDefaultsFlags, 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.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. 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) GxsChannelGroupDialog::GxsChannelGroupDialog(Mode mode, RsGxsGroupId groupId, QWidget *parent)
: GxsGroupDialog(tokenExternalQueue, tokenService, mode, groupId, ChannelEditEnabledFlags, ChannelEditDefaultsFlags, 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.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. 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. // Specific Function.
RsGxsChannelGroup grp; RsGxsChannelGroup grp;
prepareChannelGroup(grp, meta); prepareChannelGroup(grp, meta);
rsGxsChannels->createGroup(token, grp); rsGxsChannels->createChannel(grp);
meta = grp.mMeta;
return true; return true;
} }
bool GxsChannelGroupDialog::service_EditGroup(uint32_t &token, RsGroupMetaData &editedMeta) bool GxsChannelGroupDialog::service_updateGroup(const RsGroupMetaData& editedMeta)
{ {
RsGxsChannelGroup grp; RsGxsChannelGroup grp;
prepareChannelGroup(grp, editedMeta); prepareChannelGroup(grp, editedMeta);
@ -147,44 +149,42 @@ bool GxsChannelGroupDialog::service_EditGroup(uint32_t &token, RsGroupMetaData &
std::cerr << "GxsChannelGroupDialog::service_EditGroup() submitting changes"; std::cerr << "GxsChannelGroupDialog::service_EditGroup() submitting changes";
std::cerr << std::endl; std::cerr << std::endl;
rsGxsChannels->updateGroup(token, grp); return rsGxsChannels->editChannel(grp);
return true;
} }
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 << ")"; const RsGxsChannelGroup *pgroup = dynamic_cast<const RsGxsChannelGroup*>(data);
std::cerr << std::endl;
std::vector<RsGxsChannelGroup> groups; if (!pgroup)
if (!rsGxsChannels->getGroupData(token, groups))
{ {
std::cerr << "GxsChannelGroupDialog::service_loadGroup() Error getting GroupData"; std::cerr << "GxsChannelGroupDialog::service_loadGroup() Error supplied generic group data is not a RsGxsChannelGroup" << std::endl;
std::cerr << std::endl;
return false; return false;
} }
if (groups.size() != 1) const RsGxsChannelGroup& group = *pgroup;
{
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;
description = QString::fromUtf8(group.mDescription.c_str()); description = QString::fromUtf8(group.mDescription.c_str());
if (group.mImage.mData) { if (group.mImage.mData) {
QPixmap pixmap; 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); setLogo(pixmap);
} }
}
return true; 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;
}

View File

@ -29,15 +29,16 @@ class GxsChannelGroupDialog : public GxsGroupDialog
Q_OBJECT Q_OBJECT
public: public:
GxsChannelGroupDialog(TokenQueue *tokenQueue, QWidget *parent); GxsChannelGroupDialog(QWidget *parent);
GxsChannelGroupDialog(TokenQueue *tokenExternalQueue, RsTokenService *tokenService, Mode mode, RsGxsGroupId groupId, QWidget *parent = NULL); GxsChannelGroupDialog(Mode mode, RsGxsGroupId groupId, QWidget *parent = NULL);
protected: protected:
virtual void initUi(); void initUi() override;
virtual QPixmap serviceImage(); QPixmap serviceImage() override;
virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta); bool service_createGroup(RsGroupMetaData &meta) override;
virtual bool service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData, QString &description); bool service_loadGroup(const RsGxsGenericGroupData *data,Mode mode, QString& description) override;
virtual bool service_EditGroup(uint32_t &token, RsGroupMetaData &editedMeta); bool service_updateGroup(const RsGroupMetaData& editedMeta) override;
bool service_getGroupData(const RsGxsGroupId& grpId,RsGxsGenericGroupData *& data) override;
private: private:
void prepareChannelGroup(RsGxsChannelGroup &group, const RsGroupMetaData &meta); void prepareChannelGroup(RsGxsChannelGroup &group, const RsGroupMetaData &meta);

View File

@ -58,15 +58,15 @@ const uint32_t ForumCreateDefaultsFlags = ( GXS_GROUP_DEFAULTS_DISTRIB_PUBLIC
const uint32_t ForumEditEnabledFlags = ForumCreateEnabledFlags; const uint32_t ForumEditEnabledFlags = ForumCreateEnabledFlags;
const uint32_t ForumEditDefaultsFlags = ForumCreateDefaultsFlags; const uint32_t ForumEditDefaultsFlags = ForumCreateDefaultsFlags;
GxsForumGroupDialog::GxsForumGroupDialog(TokenQueue *tokenQueue, QWidget *parent) GxsForumGroupDialog::GxsForumGroupDialog(QWidget *parent)
: GxsGroupDialog(tokenQueue, ForumCreateEnabledFlags, ForumCreateDefaultsFlags, parent) : GxsGroupDialog(ForumCreateEnabledFlags, ForumCreateDefaultsFlags, parent)
{ {
ui.pubKeyShare_cb->setEnabled(true) ; 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>")); 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) GxsForumGroupDialog::GxsForumGroupDialog(Mode mode, RsGxsGroupId groupId, QWidget *parent)
: GxsGroupDialog(tokenExternalQueue, tokenService, mode, groupId, ForumEditEnabledFlags, ForumEditDefaultsFlags, parent) : GxsGroupDialog(mode, groupId, ForumEditEnabledFlags, ForumEditDefaultsFlags, parent)
{ {
ui.pubKeyShare_cb->setEnabled(true) ; ui.pubKeyShare_cb->setEnabled(true) ;
} }
@ -99,7 +99,7 @@ QPixmap GxsForumGroupDialog::serviceImage()
return QPixmap(":/icons/png/forums.png"); return QPixmap(":/icons/png/forums.png");
} }
bool GxsForumGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta) bool GxsForumGroupDialog::service_createGroup(RsGroupMetaData& meta)
{ {
// Specific Function. // Specific Function.
RsGxsForumGroup grp; RsGxsForumGroup grp;
@ -107,11 +107,16 @@ bool GxsForumGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMeta
grp.mDescription = getDescription().toUtf8().constData(); grp.mDescription = getDescription().toUtf8().constData();
getSelectedModerators(grp.mAdminList.ids); getSelectedModerators(grp.mAdminList.ids);
rsGxsForums->createGroup(token, grp); if(rsGxsForums->createForum(grp))
{
meta = grp.mMeta;
return true; 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. 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 << "GxsForumGroupDialog::service_EditGroup() submitting changes";
std::cerr << std::endl; std::cerr << std::endl;
rsGxsForums->updateGroup(token, grp); return rsGxsForums->editForum(grp);
return true;
} }
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 << ")"; const RsGxsForumGroup *pgroup = dynamic_cast<const RsGxsForumGroup*>(data);
std::cerr << std::endl;
std::vector<RsGxsForumGroup> groups; if (!pgroup)
if (!rsGxsForums->getGroupData(token, groups))
{ {
std::cerr << "GxsForumGroupDialog::service_loadGroup() Error getting GroupData"; RsErr() << "GxsForumGroupDialog::service_loadGroup() supplied generic group is not a RsGxsForumGroup"<< std::endl;
std::cerr << std::endl;
return false; 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! // Information handled by GxsGroupDialog. description should rather be handled here in the service part!
groupMetaData = groups[0].mMeta; description = QString::fromUtf8(pgroup->mDescription.c_str());
description = QString::fromUtf8(groups[0].mDescription.c_str());
// Local information. Description should be handled here. // 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; 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;
}

View File

@ -29,15 +29,16 @@ class GxsForumGroupDialog : public GxsGroupDialog
Q_OBJECT Q_OBJECT
public: public:
GxsForumGroupDialog(TokenQueue *tokenQueue, QWidget *parent); GxsForumGroupDialog(QWidget *parent);
GxsForumGroupDialog(TokenQueue *tokenExternalQueue, RsTokenService *tokenService, Mode mode, RsGxsGroupId groupId, QWidget *parent); GxsForumGroupDialog(Mode mode, RsGxsGroupId groupId, QWidget *parent);
protected: protected:
virtual void initUi(); void initUi() override;
virtual QPixmap serviceImage(); QPixmap serviceImage() override;
virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta); bool service_createGroup(RsGroupMetaData& meta) override;
virtual bool service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData, QString &description); bool service_loadGroup(const RsGxsGenericGroupData *data,Mode mode, QString &description) override;
virtual bool service_EditGroup(uint32_t &token, RsGroupMetaData &editedMeta); bool service_updateGroup(const RsGroupMetaData& editedMeta) override;
bool service_getGroupData(const RsGxsGroupId& grpId,RsGxsGenericGroupData *& data) override;
private: private:
RsGxsForumGroup mGroupData; RsGxsForumGroup mGroupData;

View File

@ -348,7 +348,6 @@ QVariant RsGxsForumModel::headerData(int section, Qt::Orientation /*orientation*
case COLUMN_THREAD_TITLE: return tr("Title"); case COLUMN_THREAD_TITLE: return tr("Title");
case COLUMN_THREAD_DATE: return tr("Date"); case COLUMN_THREAD_DATE: return tr("Date");
case COLUMN_THREAD_AUTHOR: return tr("Author"); case COLUMN_THREAD_AUTHOR: return tr("Author");
case COLUMN_THREAD_DISTRIBUTION: return tr("Distribution");
default: default:
return QVariant(); return QVariant();
} }
@ -356,7 +355,7 @@ QVariant RsGxsForumModel::headerData(int section, Qt::Orientation /*orientation*
if(role == Qt::DecorationRole) if(role == Qt::DecorationRole)
switch(section) switch(section)
{ {
case COLUMN_THREAD_DISTRIBUTION: return QIcon(":/icons/flag_green.png"); case COLUMN_THREAD_DISTRIBUTION: return QIcon(":/icons/flag-green.png");
case COLUMN_THREAD_READ: return QIcon(":/images/message-state-read.png"); case COLUMN_THREAD_READ: return QIcon(":/images/message-state-read.png");
default: default:
return QVariant(); return QVariant();

View File

@ -59,8 +59,9 @@
//#define DEBUG_FORUMS //#define DEBUG_FORUMS
/* Images for context menu icons */ /* Images for context menu icons */
#define IMAGE_MESSAGE ":/images/mail_new.png" #define IMAGE_MESSAGE ":/icons/mail/compose.png"
#define IMAGE_MESSAGEREPLY ":/images/mail_reply.png" #define IMAGE_REPLY ":/icons/mail/reply.png"
#define IMAGE_MESSAGEREPLY ":/icons/mail/write-mail.png"
#define IMAGE_MESSAGEEDIT ":/images/edit_16.png" #define IMAGE_MESSAGEEDIT ":/images/edit_16.png"
#define IMAGE_MESSAGEREMOVE ":/images/mail_delete.png" #define IMAGE_MESSAGEREMOVE ":/images/mail_delete.png"
#define IMAGE_DOWNLOAD ":/images/start.png" #define IMAGE_DOWNLOAD ":/images/start.png"
@ -391,11 +392,10 @@ void GxsForumThreadWidget::blank()
//mThreadModel->clear(); //mThreadModel->clear();
#ifdef SUSPENDED_CODE
mStateHelper->setWidgetEnabled(ui->newthreadButton, false); mStateHelper->setWidgetEnabled(ui->newthreadButton, false);
mStateHelper->setWidgetEnabled(ui->previousButton, false); mStateHelper->setWidgetEnabled(ui->previousButton, false);
mStateHelper->setWidgetEnabled(ui->nextButton, false); mStateHelper->setWidgetEnabled(ui->nextButton, false);
#endif
ui->versions_CB->hide(); ui->versions_CB->hide();
} }
@ -580,7 +580,7 @@ void GxsForumThreadWidget::threadListCustomPopupMenu(QPoint /*point*/)
QAction *pinUpPostAct = new QAction(QIcon(IMAGE_PINPOST), (is_pinned?tr("Un-pin this post"):tr("Pin this post up")), &contextMnu); QAction *pinUpPostAct = new QAction(QIcon(IMAGE_PINPOST), (is_pinned?tr("Un-pin this post"):tr("Pin this post up")), &contextMnu);
connect(pinUpPostAct , SIGNAL(triggered()), this, SLOT(togglePinUpPost())); connect(pinUpPostAct , SIGNAL(triggered()), this, SLOT(togglePinUpPost()));
QAction *replyAct = new QAction(QIcon(IMAGE_MESSAGEREPLY), tr("Reply"), &contextMnu); QAction *replyAct = new QAction(QIcon(IMAGE_REPLY), tr("Reply"), &contextMnu);
connect(replyAct, SIGNAL(triggered()), this, SLOT(replytoforummessage())); connect(replyAct, SIGNAL(triggered()), this, SLOT(replytoforummessage()));
QAction *replyauthorAct = new QAction(QIcon(IMAGE_MESSAGEREPLY), tr("Reply to author with private message"), &contextMnu); QAction *replyauthorAct = new QAction(QIcon(IMAGE_MESSAGEREPLY), tr("Reply to author with private message"), &contextMnu);
@ -869,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()) if (!mThreadId.isNull())
return; return;
@ -1082,6 +1102,19 @@ void GxsForumThreadWidget::insertMessage()
// markMsgAsRead(); // 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) void GxsForumThreadWidget::insertMessageData(const RsGxsForumMsg &msg)
{ {
/* As some time has elapsed since request - check that this is still the current msg. /* As some time has elapsed since request - check that this is still the current msg.
@ -1444,7 +1477,7 @@ void GxsForumThreadWidget::async_msg_action(const MsgMethod &action)
if(!rsGxsForums->getForumContent(groupId(),msgs_to_request,msgs)) 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; return;
} }
@ -1696,6 +1729,8 @@ void GxsForumThreadWidget::updateGroupData()
// ui->threadTreeWidget->selectionModel()->reset(); // ui->threadTreeWidget->selectionModel()->reset();
// mThreadProxyModel->clear(); // mThreadProxyModel->clear();
setForumDescriptionLoading();
RsThread::async([this]() RsThread::async([this]()
{ {
// 1 - get message data from p3GxsForums // 1 - get message data from p3GxsForums
@ -1704,22 +1739,20 @@ void GxsForumThreadWidget::updateGroupData()
std::vector<RsGxsForumGroup> groups; std::vector<RsGxsForumGroup> groups;
forumIds.push_back(groupId()); forumIds.push_back(groupId());
bool success = false;
if(!rsGxsForums->getForumsInfo(forumIds,groups)) if(!rsGxsForums->getForumsInfo(forumIds,groups))
{
std::cerr << __PRETTY_FUNCTION__ << " failed to retrieve forum group info for forum " << groupId() << std::endl; std::cerr << __PRETTY_FUNCTION__ << " failed to retrieve forum group info for forum " << groupId() << std::endl;
return; else if(groups.size() != 1)
}
if(groups.size() != 1)
{
std::cerr << __PRETTY_FUNCTION__ << " obtained more than one group info for forum " << groupId() << std::endl; std::cerr << __PRETTY_FUNCTION__ << " obtained more than one group info for forum " << groupId() << std::endl;
return; else
} success = true;
if(success)
{
// 2 - sort the messages into a proper hierarchy // 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. 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. // 3 - update the model in the UI thread.
@ -1729,16 +1762,18 @@ void GxsForumThreadWidget::updateGroupData()
* thread, for example to update the data model with new information * thread, for example to update the data model with new information
* after a blocking call to RetroShare API complete */ * after a blocking call to RetroShare API complete */
mForumGroup = *group; mForumGroup = group;
delete 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->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->subscribeToolButton->setHidden(IS_GROUP_SUBSCRIBED(mForumGroup.mMeta.mSubscribeFlags)) ;
updateForumDescription(); updateForumDescription(true);
}, this ); }, this );
}
else
RsQThreadUtils::postToObject( [this]() { updateForumDescription(false); },this);
}); });
} }
@ -1756,17 +1791,18 @@ void GxsForumThreadWidget::updateMessageData(const RsGxsMessageId& msgId)
std::vector<RsGxsForumMsg> msgs; std::vector<RsGxsForumMsg> msgs;
msgs_to_request.insert(msgId); msgs_to_request.insert(msgId);
QString error_string;
if(!rsGxsForums->getForumContent(groupId(),msgs_to_request,msgs)) 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 message info for forum " << groupId() << " and MsgId " << msgId << std::endl;
return; error_string = tr("Failed to retrieve this message. Is the database currently overloaded?");
} }
if(msgs.empty()) if(msgs.empty())
{ {
std::cerr << __PRETTY_FUNCTION__ << " no posts for msgId " << msgId << ". Database corruption?" << std::endl; 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) if(msgs.size() > 1)
{ {
@ -1774,11 +1810,15 @@ void GxsForumThreadWidget::updateMessageData(const RsGxsMessageId& msgId)
std::cerr << "Messages are:" << std::endl; std::cerr << "Messages are:" << std::endl;
for(auto it(msgs.begin());it!=msgs.end();++it) for(auto it(msgs.begin());it!=msgs.end();++it)
std::cerr << (*it).mMeta << std::endl; std::cerr << (*it).mMeta << std::endl;
error_string = tr("More than one entry for this message. Is the database corrupted?");
} }
if(error_string.isNull())
{
// 2 - sort the messages into a proper hierarchy // 2 - sort the messages into a proper hierarchy
RsGxsForumMsg *msg = new RsGxsForumMsg(msgs[0]); RsGxsForumMsg msg(msgs[0]);
// 3 - update the model in the UI thread. // 3 - update the model in the UI thread.
@ -1788,12 +1828,14 @@ void GxsForumThreadWidget::updateMessageData(const RsGxsMessageId& msgId)
* thread, for example to update the data model with new information * thread, for example to update the data model with new information
* after a blocking call to RetroShare API complete */ * 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->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->subscribeToolButton->setHidden(IS_GROUP_SUBSCRIBED(mForumGroup.mMeta.mSubscribeFlags)) ;
}, this ); }, this );
}
else
RsQThreadUtils::postToObject( [error_string,this](){ setMessageLoadingError(error_string); } );
}); });
} }

View File

@ -92,6 +92,7 @@ protected:
/* GxsMessageFrameWidget */ /* GxsMessageFrameWidget */
virtual void setAllMessagesReadDo(bool read, uint32_t &token); virtual void setAllMessagesReadDo(bool read, uint32_t &token);
void setMessageLoadingError(const QString& error);
private slots: private slots:
/** Create the context popup menu and it's submenus */ /** Create the context popup menu and it's submenus */
void threadListCustomPopupMenu(QPoint point); void threadListCustomPopupMenu(QPoint point);
@ -170,11 +171,14 @@ private:
static void loadAuthorIdCallback(GxsIdDetailsType type, const RsIdentityDetails &details, QObject *object, const QVariant &/*data*/); static void loadAuthorIdCallback(GxsIdDetailsType type, const RsIdentityDetails &details, QObject *object, const QVariant &/*data*/);
void updateMessageData(const RsGxsMessageId& msgId); void updateMessageData(const RsGxsMessageId& msgId);
void updateForumDescription(); void updateForumDescription(bool success);
void handleEvent_main_thread(std::shared_ptr<const RsEvent> event); void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);
private: private:
void setForumDescriptionLoading();
void clearForumDescription();
RsGxsGroupId mLastForumID; RsGxsGroupId mLastForumID;
RsGxsMessageId mThreadId; RsGxsMessageId mThreadId;
RsGxsMessageId mOrigThreadId; RsGxsMessageId mOrigThreadId;

View File

@ -95,7 +95,7 @@
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../icons.qrc"> <iconset resource="../icons.qrc">
<normaloff>:/icons/png/add.png</normaloff>:/icons/png/add.png</iconset> <normaloff>:/icons/mail/compose.png</normaloff>:/icons/mail/compose.png</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
<size> <size>
@ -264,7 +264,7 @@
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../icons.qrc"> <iconset resource="../icons.qrc">
<normaloff>:/icons/global_switch_on_128.png</normaloff>:/icons/global_switch_on_128.png</iconset> <normaloff>:/icons/png/download.png</normaloff>:/icons/png/download.png</iconset>
</property> </property>
<property name="autoRaise"> <property name="autoRaise">
<bool>true</bool> <bool>true</bool>
@ -289,8 +289,8 @@
<string notr="true"/> <string notr="true"/>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../images.qrc"> <iconset resource="../icons.qrc">
<normaloff>:/images/replymailall24-hover.png</normaloff>:/images/replymailall24-hover.png</iconset> <normaloff>:/icons/mail/reply.png</normaloff>:/icons/mail/reply.png</iconset>
</property> </property>
<property name="toolButtonStyle"> <property name="toolButtonStyle">
<enum>Qt::ToolButtonIconOnly</enum> <enum>Qt::ToolButtonIconOnly</enum>
@ -376,8 +376,8 @@
<string/> <string/>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../images.qrc"> <iconset resource="../icons.qrc">
<normaloff>:/images/back.png</normaloff>:/images/back.png</iconset> <normaloff>:/icons/png/arrow-left.png</normaloff>:/icons/png/arrow-left.png</iconset>
</property> </property>
<property name="autoRaise"> <property name="autoRaise">
<bool>true</bool> <bool>true</bool>
@ -417,8 +417,8 @@
<string/> <string/>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../images.qrc"> <iconset resource="../icons.qrc">
<normaloff>:/images/forward.png</normaloff>:/images/forward.png</iconset> <normaloff>:/icons/png/arrow-right.png</normaloff>:/icons/png/arrow-right.png</iconset>
</property> </property>
<property name="autoRaise"> <property name="autoRaise">
<bool>true</bool> <bool>true</bool>
@ -471,8 +471,11 @@
<string notr="true"/> <string notr="true"/>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../images.qrc"> <iconset resource="../icons.qrc">
<normaloff>:/images/start.png</normaloff>:/images/start.png</iconset> <normaloff>:/icons/png/next-unread.png</normaloff>:/icons/png/next-unread.png</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
@ -524,6 +527,16 @@
</action> </action>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget>
<class>LineEditClear</class>
<extends>QLineEdit</extends>
<header>gui/common/LineEditClear.h</header>
</customwidget>
<customwidget>
<class>RSTextBrowser</class>
<extends>QTextBrowser</extends>
<header>gui/common/RSTextBrowser.h</header>
</customwidget>
<customwidget> <customwidget>
<class>SubscribeToolButton</class> <class>SubscribeToolButton</class>
<extends>QToolButton</extends> <extends>QToolButton</extends>
@ -534,16 +547,6 @@
<extends>QLabel</extends> <extends>QLabel</extends>
<header>gui/gxs/GxsIdLabel.h</header> <header>gui/gxs/GxsIdLabel.h</header>
</customwidget> </customwidget>
<customwidget>
<class>LineEditClear</class>
<extends>QLineEdit</extends>
<header location="global">gui/common/LineEditClear.h</header>
</customwidget>
<customwidget>
<class>RSTextBrowser</class>
<extends>QTextBrowser</extends>
<header>gui/common/RSTextBrowser.h</header>
</customwidget>
<customwidget> <customwidget>
<class>ElidedLabel</class> <class>ElidedLabel</class>
<extends>QLabel</extends> <extends>QLabel</extends>

View File

@ -80,6 +80,26 @@ GxsForumsDialog::~GxsForumsDialog()
rsEvents->unregisterEventsHandler(mEventHandlerId); 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 GxsForumsDialog::getHelpString() const
{ {
QString hlp_str = tr( QString hlp_str = tr(
@ -151,13 +171,13 @@ QString GxsForumsDialog::icon(IconType type)
case ICON_NEW: case ICON_NEW:
return ":/icons/png/add.png"; return ":/icons/png/add.png";
case ICON_YOUR_GROUP: case ICON_YOUR_GROUP:
return ":/icons/png/feedreader.png"; return "";
case ICON_SUBSCRIBED_GROUP: case ICON_SUBSCRIBED_GROUP:
return ":/icons/png/feed-subscribed.png"; return "";
case ICON_POPULAR_GROUP: case ICON_POPULAR_GROUP:
return ":/icons/png/feed-popular.png"; return "";
case ICON_OTHER_GROUP: case ICON_OTHER_GROUP:
return ":/icons/png/feed-other.png"; return "";
case ICON_SEARCH: case ICON_SEARCH:
return ":/images/find.png"; return ":/images/find.png";
case ICON_DEFAULT: case ICON_DEFAULT:
@ -167,14 +187,14 @@ QString GxsForumsDialog::icon(IconType type)
return ""; 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() int GxsForumsDialog::shareKeyType()
@ -187,6 +207,7 @@ GxsMessageFrameWidget *GxsForumsDialog::createMessageFrameWidget(const RsGxsGrou
return new GxsForumThreadWidget(groupId); return new GxsForumThreadWidget(groupId);
} }
#ifdef TO_REMOVE
void GxsForumsDialog::loadGroupSummaryToken(const uint32_t &token, std::list<RsGroupMetaData> &groupInfo, RsUserdata *&userdata) void GxsForumsDialog::loadGroupSummaryToken(const uint32_t &token, std::list<RsGroupMetaData> &groupInfo, RsUserdata *&userdata)
{ {
std::vector<RsGxsForumGroup> groups; 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); GxsGroupFrameDialog::groupInfoToGroupItemInfo(groupInfo, groupItemInfo, userdata);
@ -229,3 +272,4 @@ void GxsForumsDialog::groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo,
groupItemInfo.icon = QIcon(":icons/png/forums-signed.png"); groupItemInfo.icon = QIcon(":icons/png/forums-signed.png");
} }
#endif

View File

@ -40,24 +40,27 @@ public:
void shareInMessage(const RsGxsGroupId& forum_id, const QList<RetroShareLink>& file_link) ; void shareInMessage(const RsGxsGroupId& forum_id, const QList<RetroShareLink>& file_link) ;
protected: protected:
virtual UserNotify *createUserNotify(QObject *parent) override;
virtual QString getHelpString() const ; virtual QString getHelpString() const ;
virtual RetroShareLink::enumType getLinkType() { return RetroShareLink::TYPE_FORUM; } virtual RetroShareLink::enumType getLinkType() { return RetroShareLink::TYPE_FORUM; }
virtual GroupFrameSettings::Type groupFrameSettingsType() { return GroupFrameSettings::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: private:
/* GxsGroupFrameDialog */ /* GxsGroupFrameDialog */
virtual QString text(TextType type); QString text(TextType type)override ;
virtual QString icon(IconType type); QString icon(IconType type)override ;
virtual QString settingsGroupName() { return "ForumsDialog"; } QString settingsGroupName() override { return "ForumsDialog"; }
virtual GxsGroupDialog *createNewGroupDialog(TokenQueue *tokenQueue);
virtual GxsGroupDialog *createGroupDialog(TokenQueue *tokenQueue, RsTokenService *tokenService, GxsGroupDialog::Mode mode, RsGxsGroupId groupId); GxsGroupDialog *createNewGroupDialog() override;
virtual int shareKeyType(); GxsGroupDialog *createGroupDialog(GxsGroupDialog::Mode mode, RsGxsGroupId groupId) override;
virtual GxsMessageFrameWidget *createMessageFrameWidget(const RsGxsGroupId &groupId);
virtual uint32_t requestGroupSummaryType() { return GXS_REQUEST_TYPE_GROUP_DATA; } // request complete group data int shareKeyType() override;
virtual void loadGroupSummaryToken(const uint32_t &token, std::list<RsGroupMetaData> &groupInfo, RsUserdata* &userdata); 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); void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);

View File

@ -14,7 +14,7 @@
<string>RetroShare Help</string> <string>RetroShare Help</string>
</property> </property>
<property name="windowIcon"> <property name="windowIcon">
<iconset resource="../../images.qrc"> <iconset>
<normaloff>:/images/help.png</normaloff>:/images/help.png</iconset> <normaloff>:/images/help.png</normaloff>:/images/help.png</iconset>
</property> </property>
<property name="autoFillBackground"> <property name="autoFillBackground">
@ -25,7 +25,16 @@
<property name="spacing"> <property name="spacing">
<number>6</number> <number>6</number>
</property> </property>
<property name="margin"> <property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number> <number>9</number>
</property> </property>
<item> <item>
@ -58,7 +67,16 @@
<enum>QFrame::Raised</enum> <enum>QFrame::Raised</enum>
</property> </property>
<layout class="QGridLayout"> <layout class="QGridLayout">
<property name="margin"> <property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number> <number>9</number>
</property> </property>
<property name="spacing"> <property name="spacing">
@ -69,7 +87,16 @@
<property name="spacing"> <property name="spacing">
<number>6</number> <number>6</number>
</property> </property>
<property name="margin"> <property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
@ -171,7 +198,16 @@
<property name="spacing"> <property name="spacing">
<number>6</number> <number>6</number>
</property> </property>
<property name="margin"> <property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
@ -238,7 +274,7 @@
<string>RetroShare Help</string> <string>RetroShare Help</string>
</property> </property>
<property name="windowIcon"> <property name="windowIcon">
<iconset resource="../../images.qrc"> <iconset>
<normaloff>:/images/help.png</normaloff>:/images/help.png</iconset> <normaloff>:/images/help.png</normaloff>:/images/help.png</iconset>
</property> </property>
<attribute name="title"> <attribute name="title">
@ -248,7 +284,16 @@
<property name="spacing"> <property name="spacing">
<number>6</number> <number>6</number>
</property> </property>
<property name="margin"> <property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number> <number>6</number>
</property> </property>
<item> <item>
@ -297,7 +342,16 @@
<string>Search</string> <string>Search</string>
</attribute> </attribute>
<layout class="QGridLayout"> <layout class="QGridLayout">
<property name="margin"> <property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number> <number>6</number>
</property> </property>
<property name="spacing"> <property name="spacing">
@ -308,7 +362,16 @@
<property name="spacing"> <property name="spacing">
<number>6</number> <number>6</number>
</property> </property>
<property name="margin"> <property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
@ -445,8 +508,8 @@
</widget> </widget>
<action name="actionBack"> <action name="actionBack">
<property name="icon"> <property name="icon">
<iconset resource="../../images.qrc"> <iconset resource="../../icons.qrc">
<normaloff>:/images/back.png</normaloff>:/images/back.png</iconset> <normaloff>:/icons/png/arrow-left.png</normaloff>:/icons/png/arrow-left.png</iconset>
</property> </property>
<property name="text"> <property name="text">
<string>Back</string> <string>Back</string>
@ -460,8 +523,8 @@
</action> </action>
<action name="actionForward"> <action name="actionForward">
<property name="icon"> <property name="icon">
<iconset resource="../../images.qrc"> <iconset resource="../../icons.qrc">
<normaloff>:/images/forward.png</normaloff>:/images/forward.png</iconset> <normaloff>:/icons/png/arrow-right.png</normaloff>:/icons/png/arrow-right.png</iconset>
</property> </property>
<property name="text"> <property name="text">
<string>Forward</string> <string>Forward</string>
@ -475,8 +538,8 @@
</action> </action>
<action name="actionHome"> <action name="actionHome">
<property name="icon"> <property name="icon">
<iconset resource="../../images.qrc"> <iconset resource="../../icons.qrc">
<normaloff>:/images/gohome.png</normaloff>:/images/gohome.png</iconset> <normaloff>:/icons/png/home.png</normaloff>:/icons/png/home.png</iconset>
</property> </property>
<property name="text"> <property name="text">
<string>Home</string> <string>Home</string>
@ -514,8 +577,8 @@
</action> </action>
<action name="actionClose"> <action name="actionClose">
<property name="icon"> <property name="icon">
<iconset resource="../../images.qrc"> <iconset resource="../../icons.qrc">
<normaloff>:/images/exit_24x24.png</normaloff>:/images/exit_24x24.png</iconset> <normaloff>:/icons/png/exit2.png</normaloff>:/icons/png/exit2.png</iconset>
</property> </property>
<property name="text"> <property name="text">
<string>Close</string> <string>Close</string>
@ -551,6 +614,7 @@
</tabstops> </tabstops>
<resources> <resources>
<include location="../../images.qrc"/> <include location="../../images.qrc"/>
<include location="../../icons.qrc"/>
</resources> </resources>
<connections> <connections>
<connection> <connection>

View File

@ -56,6 +56,7 @@
<file>icons/question.png</file> <file>icons/question.png</file>
<file>icons/plugins_128.png</file> <file>icons/plugins_128.png</file>
<file>icons/png/add.png</file> <file>icons/png/add.png</file>
<file>icons/png/add-identity.png</file>
<file>icons/png/anonymous.png</file> <file>icons/png/anonymous.png</file>
<file>icons/png/attach-image.png</file> <file>icons/png/attach-image.png</file>
<file>icons/png/attach.png</file> <file>icons/png/attach.png</file>
@ -73,9 +74,6 @@
<file>icons/png/exit.png</file> <file>icons/png/exit.png</file>
<file>icons/png/feedreader-notify.png</file> <file>icons/png/feedreader-notify.png</file>
<file>icons/png/feedreader.png</file> <file>icons/png/feedreader.png</file>
<file>icons/png/feed-other.png</file>
<file>icons/png/feed-popular.png</file>
<file>icons/png/feed-subscribed.png</file>
<file>icons/png/filesharing-notify.png</file> <file>icons/png/filesharing-notify.png</file>
<file>icons/png/filesharing.png</file> <file>icons/png/filesharing.png</file>
<file>icons/png/font.png</file> <file>icons/png/font.png</file>
@ -243,9 +241,6 @@
<file>icons/yandex.png</file> <file>icons/yandex.png</file>
<file>icons/png/markdown-mark.png</file> <file>icons/png/markdown-mark.png</file>
<file>icons/png/channel.png</file> <file>icons/png/channel.png</file>
<file>icons/png/channel-other.png</file>
<file>icons/png/channel-popular.png</file>
<file>icons/png/channel-subscribed.png</file>
<file>icons/png/circles-black.png</file> <file>icons/png/circles-black.png</file>
<file>icons/png/circles-gray.png</file> <file>icons/png/circles-gray.png</file>
<file>icons/png/circles-notify.png</file> <file>icons/png/circles-notify.png</file>
@ -299,6 +294,9 @@
<file>icons/png/add-file.png</file> <file>icons/png/add-file.png</file>
<file>icons/png/add-image.png</file> <file>icons/png/add-image.png</file>
<file>icons/png/attachements.png</file> <file>icons/png/attachements.png</file>
<file>icons/png/arrow-right.png</file>
<file>icons/png/arrow-left.png</file>
<file>icons/png/next-unread.png</file>
<file>icons/mail/compose.png</file> <file>icons/mail/compose.png</file>
<file>icons/mail/delete.png</file> <file>icons/mail/delete.png</file>
<file>icons/mail/tags.png</file> <file>icons/mail/tags.png</file>
@ -311,6 +309,7 @@
<file>icons/mail/reply.png</file> <file>icons/mail/reply.png</file>
<file>icons/mail/reply-all.png</file> <file>icons/mail/reply-all.png</file>
<file>icons/mail/attach24.png</file> <file>icons/mail/attach24.png</file>
<file>icons/mail/write-mail.png</file>
<file>icons/textedit/align.png</file> <file>icons/textedit/align.png</file>
<file>icons/textedit/font-decrease.png</file> <file>icons/textedit/font-decrease.png</file>
<file>icons/textedit/smile.png</file> <file>icons/textedit/smile.png</file>
@ -318,5 +317,8 @@
<file>icons/textedit/code.png</file> <file>icons/textedit/code.png</file>
<file>icons/fullscreen.png</file> <file>icons/fullscreen.png</file>
<file>icons/fullscreen-exit.png</file> <file>icons/fullscreen-exit.png</file>
<file>icons/notification.png</file>
<file>icons/wire.png</file>
<file>icons/wire-circle.png</file>
</qresource> </qresource>
</RCC> </RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 560 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 962 B

After

Width:  |  Height:  |  Size: 962 B

View File

Before

Width:  |  Height:  |  Size: 944 B

After

Width:  |  Height:  |  Size: 944 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -56,8 +56,6 @@
<file>images/list_bullet_arrow.png</file> <file>images/list_bullet_arrow.png</file>
<file>images/rc_combined.png</file> <file>images/rc_combined.png</file>
<file>images/combobox_arrow.png</file> <file>images/combobox_arrow.png</file>
<file>images/arrow-left.png</file>
<file>images/arrow-right.png</file>
<file>help/authors.html</file> <file>help/authors.html</file>
<file>help/licence.html</file> <file>help/licence.html</file>
<file>help/thanks.html</file> <file>help/thanks.html</file>
@ -81,7 +79,6 @@
<file>images/avatarstatus-bg-away-70.png</file> <file>images/avatarstatus-bg-away-70.png</file>
<file>images/avatarstatus-bg-busy-70.png</file> <file>images/avatarstatus-bg-busy-70.png</file>
<file>images/avatarstatus-bg-offline-70.png</file> <file>images/avatarstatus-bg-offline-70.png</file>
<file>images/back.png</file>
<file>images/configure.png</file> <file>images/configure.png</file>
<file>images/copyrslink.png</file> <file>images/copyrslink.png</file>
<file>images/contacts24.png</file> <file>images/contacts24.png</file>
@ -117,18 +114,14 @@
<file>images/add-share24.png</file> <file>images/add-share24.png</file>
<file>images/avatar_background.png</file> <file>images/avatar_background.png</file>
<file>images/button_cancel.png</file> <file>images/button_cancel.png</file>
<file>images/calendar.png</file>
<file>images/chat.png</file> <file>images/chat.png</file>
<file>images/chat_24.png</file> <file>images/chat_24.png</file>
<file>images/cancel.png</file> <file>images/cancel.png</file>
<file>images/close-down.png</file> <file>images/close-down.png</file>
<file>images/close_normal.png</file> <file>images/close_normal.png</file>
<file>images/contact_new128.png</file>
<file>images/copy.png</file> <file>images/copy.png</file>
<file>images/delete.png</file> <file>images/delete.png</file>
<file>images/deleteall.png</file> <file>images/deleteall.png</file>
<file>images/deletemail-pressed.png</file>
<file>images/deletemail24.png</file>
<file>images/directoryadd_24x24_shadow.png</file> <file>images/directoryadd_24x24_shadow.png</file>
<file>images/directoryremove_24x24_shadow.png</file> <file>images/directoryremove_24x24_shadow.png</file>
<file>images/directoryselect_24x24_shadow.png</file> <file>images/directoryselect_24x24_shadow.png</file>
@ -197,15 +190,12 @@
<file>images/folder-outbox.png</file> <file>images/folder-outbox.png</file>
<file>images/folder-sent.png</file> <file>images/folder-sent.png</file>
<file>images/folder-trash.png</file> <file>images/folder-trash.png</file>
<file>images/forward.png</file>
<file>images/kgames.png</file>
<file>images/go-down.png</file> <file>images/go-down.png</file>
<file>images/go-top.png</file> <file>images/go-top.png</file>
<file>images/go-up.png</file> <file>images/go-up.png</file>
<file>images/go-bottom.png</file> <file>images/go-bottom.png</file>
<file>images/graph-area.png</file> <file>images/graph-area.png</file>
<file>images/graph-line.png</file> <file>images/graph-line.png</file>
<file>images/gohome.png</file>
<file>images/gpgp_key_generate.png</file> <file>images/gpgp_key_generate.png</file>
<file>images/hide_toolbox_frame.png</file> <file>images/hide_toolbox_frame.png</file>
<file>images/hide_frame.png</file> <file>images/hide_frame.png</file>
@ -246,17 +236,8 @@
<file>images/logo/logo_info.png</file> <file>images/logo/logo_info.png</file>
<file>images/logo/logo_splash.png</file> <file>images/logo/logo_splash.png</file>
<file>images/logo/logo_web_nobackground.png</file> <file>images/logo/logo_web_nobackground.png</file>
<file>images/mail-message-new.png</file>
<file>images/mail-signed.png</file> <file>images/mail-signed.png</file>
<file>images/mail-signature-unknown.png</file> <file>images/mail-signature-unknown.png</file>
<file>images/mail_delete.png</file>
<file>images/mail_get.png</file>
<file>images/mail_reply.png</file>
<file>images/mail_replyall.png</file>
<file>images/mail_forward.png</file>
<file>images/mail_send.png</file>
<file>images/mail_new.png</file>
<file>images/mail_send24.png</file>
<file>images/mailforward24-hover.png</file> <file>images/mailforward24-hover.png</file>
<file>images/message-mail.png</file> <file>images/message-mail.png</file>
<file>images/message-mail-read.png</file> <file>images/message-mail-read.png</file>
@ -276,7 +257,6 @@
<file>images/mute-off-16.png</file> <file>images/mute-off-16.png</file>
<file>images/mute-on-16.png</file> <file>images/mute-on-16.png</file>
<file>images/new-mail-alert.png</file> <file>images/new-mail-alert.png</file>
<file>images/new_forum16.png</file>
<file>images/newmsg.png</file> <file>images/newmsg.png</file>
<file>images/no_avatar_70.png</file> <file>images/no_avatar_70.png</file>
<file>images/no_avatar_background.png</file> <file>images/no_avatar_background.png</file>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 323 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 304 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Some files were not shown because too many files have changed in this diff Show More