From 5f67710f1636f2b958e7223ba4bb4f17b0296e1f Mon Sep 17 00:00:00 2001 From: Phenom Date: Thu, 3 Dec 2020 10:58:59 +0100 Subject: [PATCH 01/17] Fix RsGxsDataAccess req delete when failed. --- libretroshare/src/gxs/rsgxsdataaccess.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libretroshare/src/gxs/rsgxsdataaccess.cc b/libretroshare/src/gxs/rsgxsdataaccess.cc index 60ad7339b..cd4f80af9 100644 --- a/libretroshare/src/gxs/rsgxsdataaccess.cc +++ b/libretroshare/src/gxs/rsgxsdataaccess.cc @@ -833,8 +833,8 @@ void RsGxsDataAccess::processRequests() } else { - req->status = FAILED; mPublicToken[req->token] = FAILED; + delete req;//req belongs to no one now #ifdef DATA_DEBUG RsDbg() << " Request failed. Marking as FAILED." << std::endl; #endif From ec32ec99834844c0865c5265cea65fa5a67aacaf Mon Sep 17 00:00:00 2001 From: Phenom Date: Mon, 30 Nov 2020 09:08:29 +0100 Subject: [PATCH 02/17] Add ability to manage canceled token in Gxs. --- libretroshare/src/gxs/gxstokenqueue.cc | 9 +-- libretroshare/src/gxs/gxstokenqueue.h | 10 ++- libretroshare/src/gxs/rsgxsdataaccess.cc | 12 ++-- libretroshare/src/gxstrans/p3gxstrans.cc | 8 ++- libretroshare/src/gxstrans/p3gxstrans.h | 26 ++++---- libretroshare/src/services/p3gxschannels.cc | 8 ++- libretroshare/src/services/p3gxschannels.h | 15 ++--- libretroshare/src/services/p3gxscircles.cc | 33 +++++----- libretroshare/src/services/p3gxscircles.h | 69 +++++++++++---------- libretroshare/src/services/p3gxscommon.cc | 11 ++-- libretroshare/src/services/p3gxscommon.h | 3 +- libretroshare/src/services/p3idservice.cc | 54 ++++++++-------- libretroshare/src/services/p3idservice.h | 7 ++- libretroshare/src/services/p3postbase.cc | 8 ++- libretroshare/src/services/p3postbase.h | 9 +-- 15 files changed, 154 insertions(+), 128 deletions(-) diff --git a/libretroshare/src/gxs/gxstokenqueue.cc b/libretroshare/src/gxs/gxstokenqueue.cc index c9eb8ef92..227ea33fc 100644 --- a/libretroshare/src/gxs/gxstokenqueue.cc +++ b/libretroshare/src/gxs/gxstokenqueue.cc @@ -50,9 +50,10 @@ void GxsTokenQueue::checkRequests() for(it = mQueue.begin(); it != mQueue.end();) { uint32_t token = it->mToken; - uint32_t status = mGenExchange->getTokenService()->requestStatus(token); + it->mStatus = mGenExchange->getTokenService()->requestStatus(token); - if (status == RsTokenService::COMPLETE) + if ( it->mStatus == RsTokenService::COMPLETE + || it->mStatus == RsTokenService::CANCELLED ) { toload.push_back(*it); it = mQueue.erase(it); @@ -64,7 +65,7 @@ void GxsTokenQueue::checkRequests() #endif ++it; } - else if (status == RsTokenService::FAILED) + else if (it->mStatus == RsTokenService::FAILED) { // maybe we should do alternative callback? std::cerr << __PRETTY_FUNCTION__ << " ERROR Request Failed! " @@ -87,7 +88,7 @@ void GxsTokenQueue::checkRequests() { for(it = toload.begin(); it != toload.end(); ++it) { - handleResponse(it->mToken, it->mReqType); + handleResponse(it->mToken, it->mReqType, it->mStatus); } } } diff --git a/libretroshare/src/gxs/gxstokenqueue.h b/libretroshare/src/gxs/gxstokenqueue.h index c6c32262e..e4445c44a 100644 --- a/libretroshare/src/gxs/gxstokenqueue.h +++ b/libretroshare/src/gxs/gxstokenqueue.h @@ -23,19 +23,22 @@ #define R_GXS_TOKEN_QUEUE_H #include "gxs/rsgenexchange.h" +#include "retroshare/rsservicecontrol.h" #include "util/rsthreads.h" struct GxsTokenQueueItem { +public: GxsTokenQueueItem(const uint32_t token, const uint32_t req_type) : - mToken(token), mReqType(req_type) {} + mToken(token), mReqType(req_type), mStatus(RsTokenService::PENDING) {} - GxsTokenQueueItem(): mToken(0), mReqType(0) {} + GxsTokenQueueItem(): mToken(0), mReqType(0), mStatus(RsTokenService::PENDING) {} uint32_t mToken; uint32_t mReqType; + RsTokenService::GxsRequestStatus mStatus; }; @@ -54,7 +57,8 @@ public: protected: /// This must be overloaded to complete the functionality. - virtual void handleResponse(uint32_t token, uint32_t req_type) = 0; + virtual void handleResponse(uint32_t token, uint32_t req_type + , RsTokenService::GxsRequestStatus status) = 0; private: RsGenExchange *mGenExchange; diff --git a/libretroshare/src/gxs/rsgxsdataaccess.cc b/libretroshare/src/gxs/rsgxsdataaccess.cc index 3c97e065c..7fda35a62 100644 --- a/libretroshare/src/gxs/rsgxsdataaccess.cc +++ b/libretroshare/src/gxs/rsgxsdataaccess.cc @@ -693,10 +693,10 @@ bool RsGxsDataAccess::getServiceStatistic(const uint32_t &token, GxsServiceStati } GxsRequest* RsGxsDataAccess::locked_retrieveCompletedRequest(const uint32_t& token) { - auto it = mCompletedRequests.find(token) ; + auto it = mCompletedRequests.find(token) ; - if(it == mCompletedRequests.end()) - return nullptr; + if(it == mCompletedRequests.end()) + return nullptr; return it->second; } @@ -720,6 +720,7 @@ void RsGxsDataAccess::processRequests() { if(now > mRequestQueue.begin()->second->reqTime + MAX_REQUEST_AGE) { + mPublicToken[mRequestQueue.begin()->second->token] = CANCELLED; delete mRequestQueue.begin()->second; mRequestQueue.erase(mRequestQueue.begin()); continue; @@ -1024,7 +1025,7 @@ bool RsGxsDataAccess::getMsgMetaDataList( const GxsMsgReq& msgIds, const RsTokRe for(meta_it = result.begin(); meta_it != result.end(); ++meta_it) { - const RsGxsGroupId& grpId = meta_it->first; + //const RsGxsGroupId& grpId = meta_it->first; //auto& filter( metaFilter[grpId] ); // does the initialization of metaFilter[grpId] and avoids further O(log(n)) calls @@ -1122,8 +1123,7 @@ bool RsGxsDataAccess::getMsgMetaDataList( const GxsMsgReq& msgIds, const RsTokRe for(uint32_t i=0;imParentId.isNull()) diff --git a/libretroshare/src/gxstrans/p3gxstrans.cc b/libretroshare/src/gxstrans/p3gxstrans.cc index e3566b05a..354cf812f 100644 --- a/libretroshare/src/gxstrans/p3gxstrans.cc +++ b/libretroshare/src/gxstrans/p3gxstrans.cc @@ -137,11 +137,15 @@ void p3GxsTrans::registerGxsTransClient( mServClients[serviceType] = service; } -void p3GxsTrans::handleResponse(uint32_t token, uint32_t req_type) +void p3GxsTrans::handleResponse(uint32_t token, uint32_t req_type + , RsTokenService::GxsRequestStatus status) { #ifdef DEBUG_GXSTRANS - std::cout << "p3GxsTrans::handleResponse(" << token << ", " << req_type << ")" << std::endl; + std::cout << "p3GxsTrans::handleResponse(" << token << ", " << req_type << ", " << status << ")" << std::endl; #endif + if (status != RsTokenService::COMPLETE) + return; //For now, only manage Complete request + bool changed = false ; switch (req_type) diff --git a/libretroshare/src/gxstrans/p3gxstrans.h b/libretroshare/src/gxstrans/p3gxstrans.h index 307492281..688a9cd22 100644 --- a/libretroshare/src/gxstrans/p3gxstrans.h +++ b/libretroshare/src/gxstrans/p3gxstrans.h @@ -159,7 +159,7 @@ public: GxsTransClient* service ); /// @see RsGenExchange::getServiceInfo() - virtual RsServiceInfo getServiceInfo() { return RsServiceInfo( RS_SERVICE_TYPE_GXS_TRANS, "GXS Mails", 0, 1, 0, 1 ); } + virtual RsServiceInfo getServiceInfo() override { return RsServiceInfo( RS_SERVICE_TYPE_GXS_TRANS, "GXS Mails", 0, 1, 0, 1 ); } static const uint32_t GXS_STORAGE_PERIOD = 15*86400; // 15 days. static const uint32_t GXS_SYNC_PERIOD = 15*86400; @@ -230,30 +230,32 @@ private: inMap mIncomingQueue; RsMutex mIngoingMutex; - /// @see GxsTokenQueue::handleResponse(uint32_t token, uint32_t req_type) - virtual void handleResponse(uint32_t token, uint32_t req_type); + /// @see GxsTokenQueue::handleResponse(uint32_t token, uint32_t req_type + /// , RsTokenService::GxsRequestStatus status) + virtual void handleResponse(uint32_t token, uint32_t req_type + , RsTokenService::GxsRequestStatus status) override; /// @see RsGenExchange::service_tick() - virtual void service_tick(); + virtual void service_tick() override; /// @see RsGenExchange::service_CreateGroup(...) RsGenExchange::ServiceCreate_Return service_CreateGroup( - RsGxsGrpItem* grpItem, RsTlvSecurityKeySet& ); + RsGxsGrpItem* grpItem, RsTlvSecurityKeySet& ) override; /// @see RsGenExchange::notifyChanges(std::vector &changes) - void notifyChanges(std::vector &changes); + void notifyChanges(std::vector &changes) override; /// @see p3Config::setupSerialiser() - virtual RsSerialiser* setupSerialiser(); + virtual RsSerialiser* setupSerialiser() override; /// @see p3Config::saveList(bool &cleanup, std::list&) - virtual bool saveList(bool &cleanup, std::list&saveList); + virtual bool saveList(bool &cleanup, std::list&saveList) override; /// @see p3Config::saveDone() - void saveDone(); + void saveDone() override; /// @see p3Config::loadList(std::list&) - virtual bool loadList(std::list& loadList); + virtual bool loadList(std::list& loadList) override; /// Request groups list to GXS backend. Async method. bool requestGroupsData(const std::list* groupIds = NULL); @@ -325,9 +327,9 @@ private: // Overloaded from RsGenExchange. - bool acceptNewMessage(const RsGxsMsgMetaData *msgMeta, uint32_t size) ; + bool acceptNewMessage(const RsGxsMsgMetaData *msgMeta, uint32_t size) override; - GxsTransIntegrityCleanupThread *mCleanupThread ; + GxsTransIntegrityCleanupThread *mCleanupThread ; // statistics of the load across all groups, per user. diff --git a/libretroshare/src/services/p3gxschannels.cc b/libretroshare/src/services/p3gxschannels.cc index a69ddc8f6..1abc1f0e2 100644 --- a/libretroshare/src/services/p3gxschannels.cc +++ b/libretroshare/src/services/p3gxschannels.cc @@ -1130,12 +1130,14 @@ void p3GxsChannels::handleUnprocessedPost(const RsGxsChannelPost &msg) // Overloaded from GxsTokenQueue for Request callbacks. -void p3GxsChannels::handleResponse(uint32_t token, uint32_t req_type) +void p3GxsChannels::handleResponse(uint32_t token, uint32_t req_type + , RsTokenService::GxsRequestStatus status) { #ifdef GXSCHANNELS_DEBUG - std::cerr << "p3GxsChannels::handleResponse(" << token << "," << req_type << ")"; - std::cerr << std::endl; + std::cerr << "p3GxsChannels::handleResponse(" << token << "," << req_type << "," << status << ")" << std::endl; #endif // GXSCHANNELS_DEBUG + if (status != RsTokenService::COMPLETE) + return; //For now, only manage Complete request // stuff. switch(req_type) diff --git a/libretroshare/src/services/p3gxschannels.h b/libretroshare/src/services/p3gxschannels.h index e353881e2..98955254a 100644 --- a/libretroshare/src/services/p3gxschannels.h +++ b/libretroshare/src/services/p3gxschannels.h @@ -172,15 +172,15 @@ virtual bool getChannelDownloadDirectory(const RsGxsGroupId &groupId, std::strin // Overloaded from RsGxsIface. -virtual bool subscribeToGroup(uint32_t &token, const RsGxsGroupId &groupId, bool subscribe); +virtual bool subscribeToGroup(uint32_t &token, const RsGxsGroupId &groupId, bool subscribe) override; // Set Statuses. virtual void setMessageProcessedStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool processed); -virtual void setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool read); +virtual void setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool read) override; // File Interface - virtual bool ExtraFileHash(const std::string& path); -virtual bool ExtraFileRemove(const RsFileHash &hash); + virtual bool ExtraFileHash(const std::string& path) override; +virtual bool ExtraFileRemove(const RsFileHash &hash) override; /// Implementation of @see RsGxsChannels::getChannelsSummaries @@ -271,7 +271,7 @@ virtual bool ExtraFileRemove(const RsFileHash &hash); bool subscribe ) override; /// @see RsGxsChannels - virtual bool markRead(const RsGxsGrpMsgIdPair& msgId, bool read); + virtual bool markRead(const RsGxsGrpMsgIdPair& msgId, bool read) override; /// @see RsGxsChannels bool exportChannelLink( @@ -289,7 +289,7 @@ virtual bool ExtraFileRemove(const RsFileHash &hash); ) override; virtual bool shareChannelKeys( - const RsGxsGroupId& channelId, const std::set& peers ); + const RsGxsGroupId& channelId, const std::set& peers ) override; /// Implementation of @see RsGxsChannels::createChannel RS_DEPRECATED_FOR(createChannelV2) @@ -310,7 +310,8 @@ virtual bool ExtraFileRemove(const RsFileHash &hash); protected: // Overloaded from GxsTokenQueue for Request callbacks. - virtual void handleResponse(uint32_t token, uint32_t req_type); + virtual void handleResponse(uint32_t token, uint32_t req_type + , RsTokenService::GxsRequestStatus status) override; private: diff --git a/libretroshare/src/services/p3gxscircles.cc b/libretroshare/src/services/p3gxscircles.cc index 8eca7e3be..d943667cd 100644 --- a/libretroshare/src/services/p3gxscircles.cc +++ b/libretroshare/src/services/p3gxscircles.cc @@ -434,13 +434,13 @@ bool p3GxsCircles::revokeIdsFromCircle( const std::set& identities, con return false; } - // /!\ AVOID calling circleGrp.mInvitedMembers.erase(identities.begin(),identities.end()), because it is not the same set. Consequently - // STL code would corrupt the structure of mInvitedMembers. + // /!\ AVOID calling circleGrp.mInvitedMembers.erase(identities.begin(),identities.end()), because it is not the same set. Consequently + // STL code would corrupt the structure of mInvitedMembers. - std::set new_invited_members; - for(auto& gxs_id: circleGrp.mInvitedMembers) - if(identities.find(gxs_id) == identities.end()) - new_invited_members.insert(gxs_id); + std::set new_invited_members; + for(auto& gxs_id: circleGrp.mInvitedMembers) + if(identities.find(gxs_id) == identities.end()) + new_invited_members.insert(gxs_id); circleGrp.mInvitedMembers = new_invited_members; @@ -585,8 +585,8 @@ void p3GxsCircles::notifyChanges(std::vector &changes) std::cerr << std::endl; #endif - p3Notify *notify = RsServer::notify(); - std::set circles_to_reload; + //p3Notify *notify = RsServer::notify(); + std::set circles_to_reload; for(auto it = changes.begin(); it != changes.end(); ++it) { @@ -1505,8 +1505,8 @@ bool p3GxsCircles::locked_checkCircleCacheForMembershipUpdate(RsGxsCircleCache& { rstime_t now = time(NULL) ; - if(cache.mStatus < CircleEntryCacheStatus::UPDATING) - return false; + if(cache.mStatus < CircleEntryCacheStatus::UPDATING) + return false; if(cache.mLastUpdatedMembershipTS + GXS_CIRCLE_DELAY_TO_FORCE_MEMBERSHIP_UPDATE < now) { @@ -1559,8 +1559,8 @@ bool p3GxsCircles::locked_checkCircleCacheForAutoSubscribe(RsGxsCircleCache& cac return false; } - if(cache.mStatus < CircleEntryCacheStatus::UPDATING) - return false; + if(cache.mStatus < CircleEntryCacheStatus::UPDATING) + return false; /* if we appear in the group - then autosubscribe, and mark as processed. This also applies if we're the group admin */ @@ -1702,12 +1702,15 @@ bool p3GxsCircles::service_checkIfGroupIsStillUsed(const RsGxsGrpMetaData& meta) //====================================================================================// // Overloaded from GxsTokenQueue for Request callbacks. -void p3GxsCircles::handleResponse(uint32_t token, uint32_t req_type) +void p3GxsCircles::handleResponse(uint32_t token, uint32_t req_type + , RsTokenService::GxsRequestStatus status) { #ifdef DEBUG_CIRCLES - std::cerr << "p3GxsCircles::handleResponse(" << token << "," << req_type << ")"; - std::cerr << std::endl; + std::cerr << "p3GxsCircles::handleResponse(" << token << "," << req_type << "," << status << ")" << std::endl; #endif // DEBUG_CIRCLES + if (status != RsTokenService::COMPLETE) + return; //For now, only manage Complete request + // stuff. switch(req_type) diff --git a/libretroshare/src/services/p3gxscircles.h b/libretroshare/src/services/p3gxscircles.h index 178ec2aaf..305a3a1b9 100644 --- a/libretroshare/src/services/p3gxscircles.h +++ b/libretroshare/src/services/p3gxscircles.h @@ -250,10 +250,10 @@ public: bool revokeIdsFromCircle( const std::set& identities, const RsGxsCircleId& circleId ) override; - /// @see RsGxsCircles + /// @see RsGxsCircles bool getCircleRequest(const RsGxsGroupId& circleId, - const RsGxsMessageId& msgId, - RsGxsCircleMsg& msg) override; + const RsGxsMessageId& msgId, + RsGxsCircleMsg& msg) override; /// @see RsGxsCircles bool exportCircleLink( @@ -270,58 +270,59 @@ public: std::string& errMsg = RS_DEFAULT_STORAGE_PARAM(std::string) ) override; - virtual bool getCircleDetails(const RsGxsCircleId &id, RsGxsCircleDetails &details) override; - virtual bool getCircleExternalIdList(std::set &circleIds) override; + virtual bool getCircleDetails(const RsGxsCircleId &id, RsGxsCircleDetails &details) override; + virtual bool getCircleExternalIdList(std::set &circleIds) override; - virtual bool isLoaded(const RsGxsCircleId &circleId) override; - virtual bool loadCircle(const RsGxsCircleId &circleId) override; + virtual bool isLoaded(const RsGxsCircleId &circleId) override; + virtual bool loadCircle(const RsGxsCircleId &circleId) override; - virtual int canSend(const RsGxsCircleId &circleId, const RsPgpId &id, bool &should_encrypt) override; - virtual int canReceive(const RsGxsCircleId &circleId, const RsPgpId &id) override; - - virtual bool recipients(const RsGxsCircleId &circleId, std::list &friendlist) override; - virtual bool recipients(const RsGxsCircleId &circleId, const RsGxsGroupId& dest_group, std::list &gxs_ids) override; - virtual bool isRecipient(const RsGxsCircleId &circleId, const RsGxsGroupId& destination_group, const RsGxsId& id) override; + virtual int canSend(const RsGxsCircleId &circleId, const RsPgpId &id, bool &should_encrypt) override; + virtual int canReceive(const RsGxsCircleId &circleId, const RsPgpId &id) override; + + virtual bool recipients(const RsGxsCircleId &circleId, std::list &friendlist) override; + virtual bool recipients(const RsGxsCircleId &circleId, const RsGxsGroupId& dest_group, std::list &gxs_ids) override; + virtual bool isRecipient(const RsGxsCircleId &circleId, const RsGxsGroupId& destination_group, const RsGxsId& id) override; - virtual bool getGroupData(const uint32_t &token, std::vector &groups) override; - virtual bool getMsgData(const uint32_t &token, std::vector &msgs) override; - virtual void createGroup(uint32_t& token, RsGxsCircleGroup &group) override; - virtual void updateGroup(uint32_t &token, RsGxsCircleGroup &group) override; + virtual bool getGroupData(const uint32_t &token, std::vector &groups) override; + virtual bool getMsgData(const uint32_t &token, std::vector &msgs) override; + virtual void createGroup(uint32_t& token, RsGxsCircleGroup &group) override; + virtual void updateGroup(uint32_t &token, RsGxsCircleGroup &group) override; - virtual bool service_checkIfGroupIsStillUsed(const RsGxsGrpMetaData& meta) override; + virtual bool service_checkIfGroupIsStillUsed(const RsGxsGrpMetaData& meta) override; + + /* membership management for external circles */ + + virtual bool requestCircleMembership(const RsGxsId &own_gxsid, const RsGxsCircleId& circle_id) override; + virtual bool cancelCircleMembership(const RsGxsId &own_gxsid, const RsGxsCircleId& circle_id) override; - /* membership management for external circles */ - - virtual bool requestCircleMembership(const RsGxsId &own_gxsid, const RsGxsCircleId& circle_id) override; - virtual bool cancelCircleMembership(const RsGxsId &own_gxsid, const RsGxsCircleId& circle_id) override; - /**********************************************/ - // needed for background processing. - virtual void service_tick() override; + // needed for background processing. + virtual void service_tick() override; protected: - // overloads p3Config - virtual bool saveList(bool &cleanup, std::list&saveList) override; - virtual bool loadList(std::list& loadList) override; - virtual RsSerialiser *setupSerialiser() override; + // overloads p3Config + virtual bool saveList(bool &cleanup, std::list&saveList) override; + virtual bool loadList(std::list& loadList) override; + virtual RsSerialiser *setupSerialiser() override; - bool pushCircleMembershipRequest(const RsGxsId& own_gxsid, const RsGxsCircleId& circle_id, RsGxsCircleSubscriptionType request_type) ; + bool pushCircleMembershipRequest(const RsGxsId& own_gxsid, const RsGxsCircleId& circle_id, RsGxsCircleSubscriptionType request_type) ; static uint32_t circleAuthenPolicy(); /** Notifications **/ - virtual void notifyChanges(std::vector& changes) override; + virtual void notifyChanges(std::vector& changes) override; /** Overloaded to add PgpIdHash to Group Definition **/ - virtual ServiceCreate_Return service_CreateGroup(RsGxsGrpItem* grpItem, RsTlvSecurityKeySet& keySet) override; + virtual ServiceCreate_Return service_CreateGroup(RsGxsGrpItem* grpItem, RsTlvSecurityKeySet& keySet) override; // Overloaded from GxsTokenQueue for Request callbacks. - virtual void handleResponse(uint32_t token, uint32_t req_type) override; + virtual void handleResponse(uint32_t token, uint32_t req_type + , RsTokenService::GxsRequestStatus status) override; // Overloaded from RsTickEvent. - virtual void handle_event(uint32_t event_type, const std::string &elabel) override; + virtual void handle_event(uint32_t event_type, const std::string &elabel) override; private: diff --git a/libretroshare/src/services/p3gxscommon.cc b/libretroshare/src/services/p3gxscommon.cc index 38f6f3cc0..7c37bd6aa 100644 --- a/libretroshare/src/services/p3gxscommon.cc +++ b/libretroshare/src/services/p3gxscommon.cc @@ -199,7 +199,7 @@ bool p3GxsCommentService::getGxsCommentData(const uint32_t &token, std::vectorfirst; + //RsGxsGroupId grpId = mit->first; std::vector& msgItems = mit->second; std::vector::iterator vit = msgItems.begin(); @@ -697,12 +697,15 @@ bool p3GxsCommentService::acknowledgeVote(const uint32_t& token, RsGxsGrpMsgIdPa // Overloaded from GxsTokenQueue for Request callbacks. -void p3GxsCommentService::handleResponse(uint32_t token, uint32_t req_type) +void p3GxsCommentService::handleResponse(uint32_t token, uint32_t req_type + , RsTokenService::GxsRequestStatus status) { #ifdef DEBUG_GXSCOMMON - std::cerr << "p3GxsCommentService::handleResponse(" << token << "," << req_type << ")"; - std::cerr << std::endl; + std::cerr << "p3GxsCommentService::handleResponse(" << token << "," << req_type << "," << status << ")" << std::endl; #endif + if (status != RsTokenService::COMPLETE) + return; //For now, only manage Complete request + // stuff. switch(req_type) diff --git a/libretroshare/src/services/p3gxscommon.h b/libretroshare/src/services/p3gxscommon.h index 4b25c826e..fb51a0d30 100644 --- a/libretroshare/src/services/p3gxscommon.h +++ b/libretroshare/src/services/p3gxscommon.h @@ -82,7 +82,8 @@ static double calculateBestScore(int upVotes, int downVotes); protected: // Overloaded from GxsTokenQueue for Request callbacks. -virtual void handleResponse(uint32_t token, uint32_t req_type); + virtual void handleResponse(uint32_t token, uint32_t req_type + , RsTokenService::GxsRequestStatus status) override; private: diff --git a/libretroshare/src/services/p3idservice.cc b/libretroshare/src/services/p3idservice.cc index b48a25abd..8c3b18ec5 100644 --- a/libretroshare/src/services/p3idservice.cc +++ b/libretroshare/src/services/p3idservice.cc @@ -151,27 +151,26 @@ RsIdentity* rsIdentity = nullptr; /******************* Startup / Tick ******************************************/ /********************************************************************************/ -p3IdService::p3IdService( - RsGeneralDataService *gds, RsNetworkExchangeService *nes, - PgpAuxUtils *pgpUtils ) : - RsGxsIdExchange( gds, nes, new RsGxsIdSerialiser(), - RS_SERVICE_GXS_TYPE_GXSID, idAuthenPolicy() ), - RsIdentity(static_cast(*this)), GxsTokenQueue(this), - RsTickEvent(), mKeyCache(GXSID_MAX_CACHE_SIZE, "GxsIdKeyCache"), - mIdMtx("p3IdService"), mNes(nes), mPgpUtils(pgpUtils) +p3IdService::p3IdService( RsGeneralDataService *gds + , RsNetworkExchangeService *nes + , PgpAuxUtils *pgpUtils ) + : RsGxsIdExchange( gds, nes, new RsGxsIdSerialiser(), + RS_SERVICE_GXS_TYPE_GXSID, idAuthenPolicy() ) + , RsIdentity(static_cast(*this)) + , GxsTokenQueue(this), RsTickEvent(), p3Config() + , mKeyCache(GXSID_MAX_CACHE_SIZE, "GxsIdKeyCache") + , mBgSchedule_Active(false), mBgSchedule_Mode(0) + , mIdMtx("p3IdService"), mNes(nes), mPgpUtils(pgpUtils) + , mLastConfigUpdate(0), mOwnIdsLoaded(false) + , mAutoAddFriendsIdentitiesAsContacts(true) /*default*/ + , mMaxKeepKeysBanned(MAX_KEEP_KEYS_BANNED_DEFAULT) { - mBgSchedule_Mode = 0; - mBgSchedule_Active = false; - mLastKeyCleaningTime = time(NULL) - int(MAX_DELAY_BEFORE_CLEANING * 0.9) ; - mLastConfigUpdate = 0 ; - mOwnIdsLoaded = false ; - mAutoAddFriendsIdentitiesAsContacts = true; // default - mMaxKeepKeysBanned = MAX_KEEP_KEYS_BANNED_DEFAULT; + mLastKeyCleaningTime = time(NULL) - int(MAX_DELAY_BEFORE_CLEANING * 0.9) ; // Kick off Cache Testing, + Others. + RsTickEvent::schedule_now(GXSID_EVENT_CACHEOWNIDS);//First Thing to do RsTickEvent::schedule_in(GXSID_EVENT_PGPHASH, PGPHASH_PERIOD); RsTickEvent::schedule_in(GXSID_EVENT_REPUTATION, REPUTATION_PERIOD); - RsTickEvent::schedule_now(GXSID_EVENT_CACHEOWNIDS); //RsTickEvent::schedule_in(GXSID_EVENT_CACHETEST, CACHETEST_PERIOD); @@ -4427,7 +4426,7 @@ void p3IdService::generateDummy_OwnIds() /* grab all the gpg ids... and make some ids */ - RsPgpId ownId = mPgpUtils->getPGPOwnId(); + /*RsPgpId ownId = */mPgpUtils->getPGPOwnId(); #if 0 // generate some ownIds. @@ -4643,36 +4642,37 @@ void p3IdService::checkPeerForIdentities() // Overloaded from GxsTokenQueue for Request callbacks. -void p3IdService::handleResponse(uint32_t token, uint32_t req_type) +void p3IdService::handleResponse(uint32_t token, uint32_t req_type + , RsTokenService::GxsRequestStatus status) { #ifdef DEBUG_IDS - std::cerr << "p3IdService::handleResponse(" << token << "," << req_type << ")"; - std::cerr << std::endl; + std::cerr << "p3IdService::handleResponse(" << token << "," << req_type << "," << status << ")" << std::endl; #endif // DEBUG_IDS // stuff. switch(req_type) { case GXSIDREQ_CACHEOWNIDS: - cache_load_ownids(token); + if (status == RsTokenService::COMPLETE) cache_load_ownids(token); + if (status == RsTokenService::CANCELLED) RsTickEvent::schedule_now(GXSID_EVENT_CACHEOWNIDS);//Cancelled by time-out so ask a new time break; case GXSIDREQ_CACHELOAD: - cache_load_for_token(token); + if (status == RsTokenService::COMPLETE) cache_load_for_token(token); break; case GXSIDREQ_PGPHASH: - pgphash_handlerequest(token); + if (status == RsTokenService::COMPLETE) pgphash_handlerequest(token); break; case GXSIDREQ_RECOGN: - recogn_handlerequest(token); + if (status == RsTokenService::COMPLETE) recogn_handlerequest(token); break; case GXSIDREQ_CACHETEST: - cachetest_handlerequest(token); + if (status == RsTokenService::COMPLETE) cachetest_handlerequest(token); break; case GXSIDREQ_OPINION: - opinion_handlerequest(token); + if (status == RsTokenService::COMPLETE) opinion_handlerequest(token); break; case GXSIDREQ_SERIALIZE_TO_MEMORY: - handle_get_serialized_grp(token); + if (status == RsTokenService::COMPLETE) handle_get_serialized_grp(token); break; default: std::cerr << "p3IdService::handleResponse() Unknown Request Type: " diff --git a/libretroshare/src/services/p3idservice.h b/libretroshare/src/services/p3idservice.h index 9f9e03d17..2dc5e29b2 100644 --- a/libretroshare/src/services/p3idservice.h +++ b/libretroshare/src/services/p3idservice.h @@ -407,8 +407,9 @@ protected: // Overloads RsGxsGenExchange virtual bool acceptNewGroup(const RsGxsGrpMetaData *grpMeta) override ; - // Overloaded from GxsTokenQueue for Request callbacks. - virtual void handleResponse(uint32_t token, uint32_t req_type) override; + // Overloaded from GxsTokenQueue for Request callbacks. + virtual void handleResponse(uint32_t token, uint32_t req_type + , RsTokenService::GxsRequestStatus status) override; // Overloaded from RsTickEvent. virtual void handle_event(uint32_t event_type, const std::string &elabel) override; @@ -561,7 +562,7 @@ private: void cleanUnusedKeys() ; void slowIndicateConfigChanged() ; - virtual void timeStampKey(const RsGxsId& id, const RsIdentityUsage& reason) ; + virtual void timeStampKey(const RsGxsId& id, const RsIdentityUsage& reason) override; rstime_t locked_getLastUsageTS(const RsGxsId& gxs_id); std::string genRandomId(int len = 20); diff --git a/libretroshare/src/services/p3postbase.cc b/libretroshare/src/services/p3postbase.cc index 5585b256d..dd4d9f684 100644 --- a/libretroshare/src/services/p3postbase.cc +++ b/libretroshare/src/services/p3postbase.cc @@ -849,12 +849,14 @@ bool p3PostBase::background_cleanup() // Overloaded from GxsTokenQueue for Request callbacks. -void p3PostBase::handleResponse(uint32_t token, uint32_t req_type) +void p3PostBase::handleResponse(uint32_t token, uint32_t req_type + , RsTokenService::GxsRequestStatus status) { #ifdef POSTBASE_DEBUG - std::cerr << "p3PostBase::handleResponse(" << token << "," << req_type << ")"; - std::cerr << std::endl; + std::cerr << "p3PostBase::handleResponse(" << token << "," << req_type << "," << status << ")" << std::endl; #endif + if (status != RsTokenService::COMPLETE) + return; //For now, only manage Complete request // stuff. switch(req_type) diff --git a/libretroshare/src/services/p3postbase.h b/libretroshare/src/services/p3postbase.h index 864d57206..3c2f5f67f 100644 --- a/libretroshare/src/services/p3postbase.h +++ b/libretroshare/src/services/p3postbase.h @@ -70,17 +70,18 @@ public: p3PostBase(RsGeneralDataService *gds, RsNetworkExchangeService *nes, RsGixs* gixs, RsSerialType* serviceSerialiser, uint16_t serviceType); - virtual void service_tick() override; + virtual void service_tick() override; protected: - virtual void notifyChanges(std::vector& changes) override; + virtual void notifyChanges(std::vector& changes) override; // Overloaded from GxsTokenQueue for Request callbacks. - virtual void handleResponse(uint32_t token, uint32_t req_type) override; + virtual void handleResponse(uint32_t token, uint32_t req_type + , RsTokenService::GxsRequestStatus status) override; // Overloaded from RsTickEvent. - virtual void handle_event(uint32_t event_type, const std::string &elabel) override; + virtual void handle_event(uint32_t event_type, const std::string &elabel) override; // overloads p3Config virtual RsSerialiser* setupSerialiser() override; // @see p3Config::setupSerialiser() From 39a89dd2a97cab3f2566403c959b8677caebeaf2 Mon Sep 17 00:00:00 2001 From: defnax Date: Sun, 10 Jan 2021 19:20:17 +0100 Subject: [PATCH 03/17] Added to show the message length on Composer and Message Widget --- .../src/gui/msgs/MessageComposer.cpp | 39 +++++++++++++++++++ retroshare-gui/src/gui/msgs/MessageComposer.h | 6 +++ retroshare-gui/src/gui/msgs/MessageWidget.cpp | 14 +++++++ retroshare-gui/src/gui/msgs/MessageWidget.h | 1 + retroshare-gui/src/gui/msgs/MessageWidget.ui | 23 ++++++++++- 5 files changed, 82 insertions(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/msgs/MessageComposer.cpp b/retroshare-gui/src/gui/msgs/MessageComposer.cpp index 1662ab2a8..9bc754637 100644 --- a/retroshare-gui/src/gui/msgs/MessageComposer.cpp +++ b/retroshare-gui/src/gui/msgs/MessageComposer.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -94,6 +95,8 @@ #define STYLE_NORMAL "QLineEdit#%1 { border : none; }" #define STYLE_FAIL "QLineEdit#%1 { border : none; color : red; }" +static const uint32_t MAX_ALLOWED_GXS_MESSAGE_SIZE = 199000; + class MessageItemDelegate : public QItemDelegate { public: @@ -213,6 +216,8 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WindowFlags flags) connect(ui.friendSelectionWidget, SIGNAL(doubleClicked(int,QString)), this, SLOT(addTo())); connect(ui.friendSelectionWidget, SIGNAL(itemSelectionChanged()), this, SLOT(friendSelectionChanged())); + connect(ui.msgText, SIGNAL(textChanged()), this, SLOT(checkLength())); + /* hide the Tree +/- */ ui.msgFileList -> setRootIsDecorated( false ); @@ -352,6 +357,15 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WindowFlags flags) /* set focus to subject */ ui.titleEdit->setFocus(); + infoLabel = new QLabel( "", this ); + statusBar()->addPermanentWidget(infoLabel); + + lineLabel = new QLabel( "", this ); + statusBar()->addPermanentWidget(lineLabel); + + lengthLabel = new QLabel( "", this ); + statusBar()->addPermanentWidget(lengthLabel); + // create tag menu TagsMenu *menu = new TagsMenu (tr("Tags"), this); connect(menu, SIGNAL(aboutToShow()), this, SLOT(tagAboutToShow())); @@ -2853,3 +2867,28 @@ void MessageComposer::sendInvite(const RsGxsId &to, bool autoSend) /* window will destroy itself! */ } +void MessageComposer::checkLength() +{ + QString text; + RsHtml::optimizeHtml(ui.msgText, text); + std::wstring msg = text.toStdWString(); + int charlength = msg.length(); + int charRemains = MAX_ALLOWED_GXS_MESSAGE_SIZE - msg.length(); + + text = tr("Message Size: %1").arg(misc::friendlyUnit(charlength)); + lengthLabel->setText(text); + + lineLabel->setText("|"); + + if(charRemains >= 0) { + text = tr("It remains %1 characters after HTML conversion.").arg(charRemains); + infoLabel->setStyleSheet("QStatusBar QLabel#infoLabel { }"); + }else{ + text = tr("Warning: This message is too big of %1 characters after HTML conversion.").arg((0-charRemains)); + infoLabel->setStyleSheet("QStatusBar QLabel#infoLabel {color: red; font: bold; }"); + } + + //ui.actionSend->setEnabled(charRemains>=0); + + infoLabel->setText(text); +} diff --git a/retroshare-gui/src/gui/msgs/MessageComposer.h b/retroshare-gui/src/gui/msgs/MessageComposer.h index c5ffb51e7..e8b947273 100644 --- a/retroshare-gui/src/gui/msgs/MessageComposer.h +++ b/retroshare-gui/src/gui/msgs/MessageComposer.h @@ -168,6 +168,8 @@ private slots: static QString inviteMessage(); + void checkLength(); + private: static QString buildReplyHeader(const MessageInfo &msgInfo); @@ -257,6 +259,10 @@ private: RSTreeWidgetItemCompareRole *m_compareRole; QCompleter *m_completer; + QLabel *infoLabel; + QLabel *lengthLabel; + QLabel *lineLabel; + /** Qt Designer generated object */ Ui::MessageComposer ui; diff --git a/retroshare-gui/src/gui/msgs/MessageWidget.cpp b/retroshare-gui/src/gui/msgs/MessageWidget.cpp index 3d92fbe9a..9b671129f 100644 --- a/retroshare-gui/src/gui/msgs/MessageWidget.cpp +++ b/retroshare-gui/src/gui/msgs/MessageWidget.cpp @@ -509,6 +509,7 @@ void MessageWidget::fill(const std::string &msgId) ui.msgText->resetImagesStatus(false); clearTagLabels(); + checkLength(); ui.inviteFrame->hide(); ui.expandFilesButton->setChecked(false); @@ -690,6 +691,7 @@ void MessageWidget::fill(const std::string &msgId) ui.filesSize->setText(QString(misc::friendlyUnit(msgInfo.size))); showTagLabels(); + checkLength(); currMsgFlags = msgInfo.msgflags; } @@ -903,3 +905,15 @@ void MessageWidget::viewSource() delete dialog; } + +void MessageWidget::checkLength() +{ + QString text; + RsHtml::optimizeHtml(ui.msgText, text); + std::wstring msg = text.toStdWString(); + int charlength = msg.length(); + + text = tr("%1 (%2) ").arg(charlength).arg(misc::friendlyUnit(charlength)); + + ui.sizeLabel->setText(text); +} \ No newline at end of file diff --git a/retroshare-gui/src/gui/msgs/MessageWidget.h b/retroshare-gui/src/gui/msgs/MessageWidget.h index 2bd630cb3..5acf627f6 100644 --- a/retroshare-gui/src/gui/msgs/MessageWidget.h +++ b/retroshare-gui/src/gui/msgs/MessageWidget.h @@ -86,6 +86,7 @@ private slots: void loadImagesAlways(); void buttonStyle(); void viewSource(); + void checkLength(); private: void clearTagLabels(); diff --git a/retroshare-gui/src/gui/msgs/MessageWidget.ui b/retroshare-gui/src/gui/msgs/MessageWidget.ui index 24373dedb..c781dc5d1 100644 --- a/retroshare-gui/src/gui/msgs/MessageWidget.ui +++ b/retroshare-gui/src/gui/msgs/MessageWidget.ui @@ -621,7 +621,7 @@ 0 - 0 + 3 0 @@ -682,6 +682,27 @@ + + + + Qt::Vertical + + + + + + + Message Size: + + + + + + + Size + + + From 44fc3ea50c967a1f82cc719c52312264f9707c8c Mon Sep 17 00:00:00 2001 From: defnax Date: Mon, 11 Jan 2021 21:31:42 +0100 Subject: [PATCH 04/17] Disable the Send button when the limit is exceeded --- .../src/gui/msgs/MessageComposer.cpp | 25 +++++++++++-------- retroshare-gui/src/gui/msgs/MessageComposer.h | 2 ++ retroshare-gui/src/gui/settings/NotifyPage.ui | 2 +- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/retroshare-gui/src/gui/msgs/MessageComposer.cpp b/retroshare-gui/src/gui/msgs/MessageComposer.cpp index 9bc754637..2be5efb35 100644 --- a/retroshare-gui/src/gui/msgs/MessageComposer.cpp +++ b/retroshare-gui/src/gui/msgs/MessageComposer.cpp @@ -393,7 +393,7 @@ void MessageComposer::updateCells(int,int) { int rowCount = ui.recipientWidget->rowCount(); int row; - bool has_gxs = false ; + has_gxs = false ; for (row = 0; row < rowCount; ++row) { @@ -410,6 +410,7 @@ void MessageComposer::updateCells(int,int) ui.respond_to_CB->show(); ui.distantFrame->show(); ui.fromLabel->show(); + checkLength(); } else { @@ -2880,15 +2881,17 @@ void MessageComposer::checkLength() lineLabel->setText("|"); - if(charRemains >= 0) { - text = tr("It remains %1 characters after HTML conversion.").arg(charRemains); - infoLabel->setStyleSheet("QStatusBar QLabel#infoLabel { }"); - }else{ - text = tr("Warning: This message is too big of %1 characters after HTML conversion.").arg((0-charRemains)); - infoLabel->setStyleSheet("QStatusBar QLabel#infoLabel {color: red; font: bold; }"); + if(has_gxs) { + if(charRemains >= 0) { + text = tr("It remains %1 characters after HTML conversion.").arg(charRemains); + }else{ + text = tr("Warning: This message is too big of %1 characters after HTML conversion.").arg((0-charRemains)); + } + ui.actionSend->setEnabled(charRemains>=0); + infoLabel->setText(text); + } + else { + infoLabel->setText(""); + ui.actionSend->setEnabled(true); } - - //ui.actionSend->setEnabled(charRemains>=0); - - infoLabel->setText(text); } diff --git a/retroshare-gui/src/gui/msgs/MessageComposer.h b/retroshare-gui/src/gui/msgs/MessageComposer.h index e8b947273..a5f6d773c 100644 --- a/retroshare-gui/src/gui/msgs/MessageComposer.h +++ b/retroshare-gui/src/gui/msgs/MessageComposer.h @@ -263,6 +263,8 @@ private: QLabel *lengthLabel; QLabel *lineLabel; + bool has_gxs; + /** Qt Designer generated object */ Ui::MessageComposer ui; diff --git a/retroshare-gui/src/gui/settings/NotifyPage.ui b/retroshare-gui/src/gui/settings/NotifyPage.ui index 64807a235..8237b8c3a 100755 --- a/retroshare-gui/src/gui/settings/NotifyPage.ui +++ b/retroshare-gui/src/gui/settings/NotifyPage.ui @@ -18,7 +18,7 @@ - Log + Activity From 480a99b9bbe85d871b5ab01567f3a0414763d3f2 Mon Sep 17 00:00:00 2001 From: Phenom Date: Thu, 14 Jan 2021 12:41:02 +0100 Subject: [PATCH 05/17] Fix Distant Chat Avatar Status Update --- .../src/gui/common/AvatarWidget.cpp | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/retroshare-gui/src/gui/common/AvatarWidget.cpp b/retroshare-gui/src/gui/common/AvatarWidget.cpp index 5cd9f5d79..59d358679 100644 --- a/retroshare-gui/src/gui/common/AvatarWidget.cpp +++ b/retroshare-gui/src/gui/common/AvatarWidget.cpp @@ -224,14 +224,22 @@ void AvatarWidget::refreshStatus() status = statusInfo.status ; } else if(mId.isDistantChatId()) - { - DistantChatPeerInfo dcpinfo ; + { + DistantChatPeerInfo dcpinfo ; - if(rsMsgs->getDistantChatStatus(mId.toDistantChatId(),dcpinfo)) - status = dcpinfo.status ; - else - std::cerr << "(EE) cannot get distant chat status for ID=" << mId.toDistantChatId() << std::endl; - } + if(rsMsgs->getDistantChatStatus(mId.toDistantChatId(),dcpinfo)) + { + switch (dcpinfo.status) + { + case RS_DISTANT_CHAT_STATUS_CAN_TALK : status = RS_STATUS_ONLINE ; break; + case RS_DISTANT_CHAT_STATUS_UNKNOWN : // Fall-through + case RS_DISTANT_CHAT_STATUS_TUNNEL_DN : // Fall-through + case RS_DISTANT_CHAT_STATUS_REMOTELY_CLOSED : status = RS_STATUS_OFFLINE; + } + } + else + std::cerr << "(EE) cannot get distant chat status for ID=" << mId.toDistantChatId() << std::endl; + } else { std::cerr << "Unhandled chat id type in AvatarWidget::refreshStatus()" << std::endl; From 4e7411362ebcde19164980f2e42892bcad8c821c Mon Sep 17 00:00:00 2001 From: Phenom Date: Thu, 14 Jan 2021 12:51:52 +0100 Subject: [PATCH 06/17] Fix default LogScale in BandwidthStatsWidget --- retroshare-gui/src/gui/statistics/BandwidthStatsWidget.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.cpp b/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.cpp index 58a1afefc..56ac1645c 100644 --- a/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.cpp +++ b/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.cpp @@ -49,6 +49,7 @@ BandwidthStatsWidget::BandwidthStatsWidget(QWidget *parent) ui.bwgraph_BW->resetFlags(RSGraphWidget::RSGRAPH_FLAGS_LEGEND_CUMULATED) ; updateUnitSelection(0); + toggleLogScale(ui.logScale_CB->checkState() == Qt::Checked);//Update bwgraph_BW with default logScale_CB state defined in ui file. // Setup connections From a86f4092989edffa485c2a8412f8edf72a01395c Mon Sep 17 00:00:00 2001 From: Phenom Date: Fri, 15 Jan 2021 11:48:20 +0100 Subject: [PATCH 07/17] Fix MainWindow Destructor delete order. --- retroshare-gui/src/gui/MainWindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/MainWindow.cpp b/retroshare-gui/src/gui/MainWindow.cpp index ea9e9d8df..85b571f2f 100644 --- a/retroshare-gui/src/gui/MainWindow.cpp +++ b/retroshare-gui/src/gui/MainWindow.cpp @@ -376,8 +376,8 @@ MainWindow::~MainWindow() delete toasterDisable; delete sysTrayStatus; delete trayIcon; + delete notifyMenu;//notifyMenu belongs to trayMenu delete trayMenu; - delete notifyMenu; #ifdef MESSENGER_WINDOW MessengerWindow::releaseInstance(); #endif From bfb1159ca026ffb3a88706c93703d3a54996d5cc Mon Sep 17 00:00:00 2001 From: Phenom Date: Fri, 15 Jan 2021 12:04:02 +0100 Subject: [PATCH 08/17] Fix RSElidedItemDelegate --- .../src/gui/common/RSElidedItemDelegate.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/retroshare-gui/src/gui/common/RSElidedItemDelegate.cpp b/retroshare-gui/src/gui/common/RSElidedItemDelegate.cpp index 3fa95f898..63ebb8ce4 100644 --- a/retroshare-gui/src/gui/common/RSElidedItemDelegate.cpp +++ b/retroshare-gui/src/gui/common/RSElidedItemDelegate.cpp @@ -202,7 +202,7 @@ void RSElidedItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem & moOption.decorationPosition = QStyleOptionViewItem::Left; moOption.decorationSize = QSize(); moOption.displayAlignment = Qt::AlignLeft | Qt::AlignTop; - moOption.features=0; + moOption.features=QStyleOptionViewItem::ViewItemFeatures(); moOption.font = QFont(); moOption.icon = QIcon(); moOption.index = QModelIndex(); @@ -217,7 +217,8 @@ void RSElidedItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem & moOption.palette = QPalette(); moOption.styleObject = nullptr; } - QStyledItemDelegate::paint(&moPnt, moOption, QModelIndex()); + //QStyledItemDelegate::paint(&moPnt, moOption, QModelIndex(index));//This update option now. + ownStyle->drawControl(QStyle::CE_ItemViewItem, &moOption, &moPnt, widget); //// But these lines doesn't works. { @@ -300,9 +301,9 @@ void RSElidedItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem & { QStyleOptionViewItem tstOption = option; // Reduce rect to get this item bg color external and base internal - tstOption.rect.adjust(3,3,-6,-6); + tstOption.rect.adjust(2,2,-2,-2); // To draw with base for debug purpose - QStyledItemDelegate::paint(painter, tstOption, index); + RSStyledItemDelegate::paint(painter, tstOption, index); } #endif @@ -379,6 +380,10 @@ void RSElidedItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem & QTextLayout textLayout(ownOption.text, painter->font()); QTextOption to = textLayout.textOption(); + const int textHMargin = ownStyle->pixelMetric(QStyle::PM_FocusFrameHMargin, nullptr, widget) + 1; + const int textVMargin = ownStyle->pixelMetric(QStyle::PM_FocusFrameVMargin, nullptr, widget) + 1; + textRect = textRect.adjusted(textHMargin, textVMargin, -textHMargin, -textVMargin); // remove width padding + StyledElidedLabel::paintElidedLine(painter,ownOption.text,textRect,ownOption.font,ownOption.displayAlignment,to.wrapMode()&QTextOption::WordWrap,mPaintRoundedRect); } painter->restore(); @@ -393,7 +398,9 @@ bool RSElidedItemDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, QMouseEvent *ev = static_cast(event); if (ev) { if (ev->buttons()==Qt::LeftButton) { +#ifdef DEBUG_EID_PAINT QVariant var = index.data(); +#endif if (index.data().type() == QVariant::String) { QString text = index.data().toString(); if (!text.isEmpty()) { @@ -417,6 +424,9 @@ bool RSElidedItemDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, ownOption.fontMetrics = QFontMetrics(font); } QRect textRect = ownStyle->subElementRect(QStyle::SE_ItemViewItemText, &ownOption, widget); + const int textHMargin = ownStyle->pixelMetric(QStyle::PM_FocusFrameHMargin, nullptr, widget) + 1; + const int textVMargin = ownStyle->pixelMetric(QStyle::PM_FocusFrameVMargin, nullptr, widget) + 1; + textRect = textRect.adjusted(textHMargin, textVMargin, -textHMargin, -textVMargin); // remove width padding QTextLayout textLayout(text, ownOption.font); QTextOption to = textLayout.textOption(); From 8ee8e68b614d671864965554f5fb91660f5cc346 Mon Sep 17 00:00:00 2001 From: Phenom Date: Fri, 15 Jan 2021 21:50:59 +0100 Subject: [PATCH 09/17] Fix RsPostedPostsModel::handleEvent_main_thread --- .../src/gui/Posted/PostedPostsModel.cpp | 82 ++++++++++--------- 1 file changed, 42 insertions(+), 40 deletions(-) diff --git a/retroshare-gui/src/gui/Posted/PostedPostsModel.cpp b/retroshare-gui/src/gui/Posted/PostedPostsModel.cpp index 89a29eec4..0f0420f20 100644 --- a/retroshare-gui/src/gui/Posted/PostedPostsModel.cpp +++ b/retroshare-gui/src/gui/Posted/PostedPostsModel.cpp @@ -72,55 +72,57 @@ void RsPostedPostsModel::handleEvent_main_thread(std::shared_ptr switch(e->mPostedEventCode) { - case RsPostedEventCode::UPDATED_MESSAGE: - case RsPostedEventCode::READ_STATUS_CHANGED: - case RsPostedEventCode::MESSAGE_VOTES_UPDATED: - case RsPostedEventCode::NEW_MESSAGE: - { - // Normally we should just emit dataChanged() on the index of the data that has changed: - // - // We need to update the data! + case RsPostedEventCode::UPDATED_MESSAGE: + case RsPostedEventCode::READ_STATUS_CHANGED: + case RsPostedEventCode::MESSAGE_VOTES_UPDATED: + case RsPostedEventCode::NEW_MESSAGE: + { + // Normally we should just emit dataChanged() on the index of the data that has changed: + // + // We need to update the data! - if(e->mPostedGroupId == mPostedGroup.mMeta.mGroupId) - RsThread::async([this, e]() - { - // 1 - get message data from p3GxsChannels + RsGxsPostedEvent E(*e); - std::vector posts; - std::vector comments; - std::vector votes; - - if(!rsPosted->getBoardContent(mPostedGroup.mMeta.mGroupId,std::set{ e->mPostedMsgId }, posts,comments,votes)) + if(E.mPostedGroupId == mPostedGroup.mMeta.mGroupId) + RsThread::async([this, E]() { - std::cerr << __PRETTY_FUNCTION__ << " failed to retrieve channel message data for channel/msg " << e->mPostedGroupId << "/" << e->mPostedMsgId << std::endl; - return; - } + // 1 - get message data from p3GxsChannels - // 2 - update the model in the UI thread. + std::vector posts; + std::vector comments; + std::vector votes; - RsQThreadUtils::postToObject( [posts,comments,votes,this]() - { - for(uint32_t i=0;igetBoardContent(mPostedGroup.mMeta.mGroupId,std::set{ E.mPostedMsgId }, posts,comments,votes)) { - // linear search. Not good at all, but normally this is for a single post. - - for(uint32_t j=0;j Date: Fri, 15 Jan 2021 22:29:44 +0100 Subject: [PATCH 10/17] Fix Compil with Photo Service CONFIG+=gxsphotoshare --- libretroshare/src/services/p3photoservice.cc | 2 +- libretroshare/src/services/p3photoservice.h | 43 ++++++++++++-------- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/libretroshare/src/services/p3photoservice.cc b/libretroshare/src/services/p3photoservice.cc index 1547e5a7d..24e9d90b6 100644 --- a/libretroshare/src/services/p3photoservice.cc +++ b/libretroshare/src/services/p3photoservice.cc @@ -322,7 +322,7 @@ bool p3PhotoService::createAlbum(RsPhotoAlbum &album) return submitAlbumDetails(token, album) && waitToken(token) == RsTokenService::COMPLETE; } -bool p3PhotoService::updateAlbum(const RsPhotoAlbum &album) +bool p3PhotoService::updateAlbum(const RsPhotoAlbum &/*album*/) { // TODO return false; diff --git a/libretroshare/src/services/p3photoservice.h b/libretroshare/src/services/p3photoservice.h index c8056e46a..f540d4f66 100644 --- a/libretroshare/src/services/p3photoservice.h +++ b/libretroshare/src/services/p3photoservice.h @@ -31,7 +31,7 @@ class p3PhotoService : public RsGenExchange, public RsPhoto public: p3PhotoService(RsGeneralDataService* gds, RsNetworkExchangeService* nes, RsGixs* gixs); - virtual RsServiceInfo getServiceInfo(); + virtual RsServiceInfo getServiceInfo() override; static uint32_t photoAuthenPolicy(); @@ -40,38 +40,38 @@ public: /*! * @return true if a change has occured */ - bool updated(); + bool updated() override; /*! * */ - void service_tick(); + void service_tick() override; protected: - void notifyChanges(std::vector& changes); + void notifyChanges(std::vector& changes) override; public: /** Requests **/ - void groupsChanged(std::list& grpIds); + void groupsChanged(std::list& grpIds) override; - void msgsChanged(GxsMsgIdResult& msgs); + void msgsChanged(GxsMsgIdResult& msgs) override; - RsTokenService* getTokenService(); + RsTokenService* getTokenService() override; - bool getGroupList(const uint32_t &token, std::list &groupIds); - bool getMsgList(const uint32_t &token, GxsMsgIdResult& msgIds); + bool getGroupList(const uint32_t &token, std::list &groupIds) override; + bool getMsgList(const uint32_t &token, GxsMsgIdResult& msgIds) override; /* Generic Summary */ - bool getGroupSummary(const uint32_t &token, std::list &groupInfo); + bool getGroupSummary(const uint32_t &token, std::list &groupInfo) override; - bool getMsgSummary(const uint32_t &token, MsgMetaResult &msgInfo); + bool getMsgSummary(const uint32_t &token, MsgMetaResult &msgInfo) override; /* Specific Service Data */ - bool getAlbum(const uint32_t &token, std::vector &albums); - bool getPhoto(const uint32_t &token, PhotoResult &photos); + bool getAlbum(const uint32_t &token, std::vector &albums) override; + bool getPhoto(const uint32_t &token, PhotoResult &photos) override; public: /* Comment service - Provide RsGxsCommentService - redirect to p3GxsCommentService */ @@ -109,6 +109,13 @@ public: return acknowledgeMsg(token, msgId); } + //Not currently used + virtual bool setCommentAsRead(uint32_t& /*token*/,const RsGxsGroupId& /*gid*/,const RsGxsMessageId& /*comment_msg_id*/) override + { + return true; + } + + // Blocking versions. virtual bool createComment(RsGxsComment &msg) override { @@ -126,7 +133,7 @@ public: * @param token token to redeem for acknowledgement * @param album album to be submitted */ - bool submitAlbumDetails(uint32_t& token, RsPhotoAlbum &album); + bool submitAlbumDetails(uint32_t& token, RsPhotoAlbum &album) override; /*! * submits photo, which returns a token that needs @@ -134,7 +141,7 @@ public: * @param token token to redeem for acknowledgement * @param photo photo to be submitted */ - bool submitPhoto(uint32_t& token, RsPhotoPhoto &photo); + bool submitPhoto(uint32_t& token, RsPhotoPhoto &photo) override; /*! * submits photo comment, which returns a token that needs @@ -152,7 +159,7 @@ public: * @param token token to redeem for acknowledgement * @param grpId the id of the group to subscribe to */ - bool subscribeToAlbum(uint32_t& token, const RsGxsGroupId& grpId, bool subscribe); + bool subscribeToAlbum(uint32_t& token, const RsGxsGroupId& grpId, bool subscribe) override; /*! * This allows the client service to acknowledge that their msgs has @@ -161,7 +168,7 @@ public: * @param msgIds map of grpid->msgIds of message created/modified * @return true if token exists false otherwise */ - bool acknowledgeMsg(const uint32_t& token, std::pair& msgId); + bool acknowledgeMsg(const uint32_t& token, std::pair& msgId) override; /*! * This allows the client service to acknowledge that their grps has @@ -170,7 +177,7 @@ public: * @param msgIds vector of ids of groups created/modified * @return true if token exists false otherwise */ - bool acknowledgeGrp(const uint32_t& token, RsGxsGroupId& grpId); + bool acknowledgeGrp(const uint32_t& token, RsGxsGroupId& grpId) override; // Blocking versions. /*! From 17f32db68721f66cce9e09ee540f60c5221877dc Mon Sep 17 00:00:00 2001 From: defnax Date: Sat, 16 Jan 2021 12:42:33 +0100 Subject: [PATCH 11/17] Added Dark theme for the graphframe * Added Dark theme for the graphframe * Added Combobox for switch * Added for other graphs the settings * Added fix by phenom for get stored the configs for the statistics pages * Removed uneeded line from the toolbar * New icon for Identities stats page --- retroshare-gui/src/gui/MainWindow.cpp | 1 + .../src/gui/common/RSGraphWidget.cpp | 33 +++- retroshare-gui/src/gui/common/RSGraphWidget.h | 14 +- retroshare-gui/src/gui/icons.qrc | 1 + retroshare-gui/src/gui/icons/identities.png | Bin 0 -> 3837 bytes retroshare-gui/src/gui/statistics/BWGraph.cpp | 2 +- .../gui/statistics/BandwidthGraphWindow.cpp | 21 +++ .../src/gui/statistics/BandwidthGraphWindow.h | 1 + .../gui/statistics/BandwidthGraphWindow.ui | 145 +++++++++++---- .../gui/statistics/BandwidthStatsWidget.cpp | 54 ++++++ .../src/gui/statistics/BandwidthStatsWidget.h | 7 + .../gui/statistics/BandwidthStatsWidget.ui | 16 +- .../src/gui/statistics/DhtWindow.ui | 2 +- .../gui/statistics/GlobalRouterStatistics.cpp | 7 +- .../gui/statistics/GlobalRouterStatistics.ui | 166 +++++++++--------- .../gui/statistics/GxsTransportStatistics.ui | 4 +- .../src/gui/statistics/RttStatistics.cpp | 7 + .../src/gui/statistics/StatisticsWindow.cpp | 2 +- .../src/gui/statistics/StatisticsWindow.ui | 18 +- .../gui/statistics/TurtleRouterStatistics.cpp | 13 +- .../gui/statistics/TurtleRouterStatistics.ui | 49 +++--- retroshare-gui/src/gui/statistics/dhtgraph.h | 8 + .../src/gui/statistics/turtlegraph.h | 11 +- 23 files changed, 409 insertions(+), 173 deletions(-) create mode 100644 retroshare-gui/src/gui/icons/identities.png diff --git a/retroshare-gui/src/gui/MainWindow.cpp b/retroshare-gui/src/gui/MainWindow.cpp index 85b571f2f..4092334b5 100644 --- a/retroshare-gui/src/gui/MainWindow.cpp +++ b/retroshare-gui/src/gui/MainWindow.cpp @@ -378,6 +378,7 @@ MainWindow::~MainWindow() delete trayIcon; delete notifyMenu;//notifyMenu belongs to trayMenu delete trayMenu; + StatisticsWindow::releaseInstance(); #ifdef MESSENGER_WINDOW MessengerWindow::releaseInstance(); #endif diff --git a/retroshare-gui/src/gui/common/RSGraphWidget.cpp b/retroshare-gui/src/gui/common/RSGraphWidget.cpp index 5b9740b0b..dab0645c4 100644 --- a/retroshare-gui/src/gui/common/RSGraphWidget.cpp +++ b/retroshare-gui/src/gui/common/RSGraphWidget.cpp @@ -345,7 +345,11 @@ void RSGraphWidget::paintEvent(QPaintEvent *) _painter->setRenderHint(QPainter::TextAntialiasing); /* Fill in the background */ - _painter->fillRect(_rec, QBrush(BACK_COLOR)); + if (_flags & RSGRAPH_FLAGS_DARK_STYLE){ + _painter->fillRect(_rec, QBrush(BACK_COLOR_DARK)); + }else { + _painter->fillRect(_rec, QBrush(BACK_COLOR)); + } _painter->drawRect(_rec); /* Paint the scale */ @@ -649,10 +653,17 @@ void RSGraphWidget::paintScale1() QString text = _source->displayValue(scale) ; - _painter->setPen(SCALE_COLOR); - _painter->drawText(QPointF(SCALE_WIDTH*fact - QFontMetricsF(font()).width(text) - 4*fact, pos+0.4*FS), text); - _painter->setPen(GRID_COLOR); - _painter->drawLine(QPointF(SCALE_WIDTH*fact, pos), QPointF(_rec.width(), pos)); + if (_flags & RSGRAPH_FLAGS_DARK_STYLE){ + _painter->setPen(SCALE_COLOR_DARK); + _painter->drawText(QPointF(SCALE_WIDTH*fact - QFontMetricsF(font()).width(text) - 4*fact, pos+0.4*FS), text); + _painter->setPen(GRID_COLOR_DARK); + _painter->drawLine(QPointF(SCALE_WIDTH*fact, pos), QPointF(_rec.width(), pos)); + }else{ + _painter->setPen(SCALE_COLOR); + _painter->drawText(QPointF(SCALE_WIDTH*fact - QFontMetricsF(font()).width(text) - 4*fact, pos+0.4*FS), text); + _painter->setPen(GRID_COLOR); + _painter->drawLine(QPointF(SCALE_WIDTH*fact, pos), QPointF(_rec.width(), pos)); + } } /* Draw vertical separator */ @@ -675,8 +686,10 @@ void RSGraphWidget::paintScale2() int seconds = (_rec.width()-i)/_time_scale ; // pixels / (pixels per second) => seconds QString text = QString::number(seconds)+ " secs"; - - _painter->setPen(SCALE_COLOR); + if (_flags & RSGRAPH_FLAGS_DARK_STYLE) + _painter->setPen(SCALE_COLOR_DARK); + else + _painter->setPen(SCALE_COLOR); _painter->drawText(QPointF(i, _rec.height()-0.5*FS), text); } } @@ -743,8 +756,10 @@ void RSGraphWidget::paintLegend() _painter->setPen(pen); _painter->drawLine(QPointF(SCALE_WIDTH*fact+10.0*fact, pos+FS/3), QPointF(SCALE_WIDTH*fact+30.0*fact, pos+FS/3)); _painter->setPen(oldPen); - - _painter->setPen(SCALE_COLOR); + if (_flags & RSGRAPH_FLAGS_DARK_STYLE) + _painter->setPen(SCALE_COLOR_DARK); + else + _painter->setPen(SCALE_COLOR); _painter->drawText(QPointF(SCALE_WIDTH *fact+ 40*fact,pos + 0.5*FS), text) ; ++j ; diff --git a/retroshare-gui/src/gui/common/RSGraphWidget.h b/retroshare-gui/src/gui/common/RSGraphWidget.h index beefe314c..210402b12 100644 --- a/retroshare-gui/src/gui/common/RSGraphWidget.h +++ b/retroshare-gui/src/gui/common/RSGraphWidget.h @@ -36,11 +36,14 @@ #define MINUSER_SCALE 2000 /** 2000 users is the minimum scale */ #define SCROLL_STEP 4 /** Horizontal change on graph update */ -#define BACK_COLOR Qt::white -#define SCALE_COLOR Qt::black -#define GRID_COLOR Qt::lightGray -#define RSDHT_COLOR Qt::magenta -#define ALLDHT_COLOR Qt::yellow +#define BACK_COLOR Qt::white +#define SCALE_COLOR Qt::black +#define GRID_COLOR Qt::lightGray +#define BACK_COLOR_DARK Qt::black +#define SCALE_COLOR_DARK Qt::green +#define GRID_COLOR_DARK Qt::darkGreen +#define RSDHT_COLOR Qt::magenta +#define ALLDHT_COLOR Qt::yellow struct ZeroInitFloat { @@ -145,6 +148,7 @@ public: static const uint32_t RSGRAPH_FLAGS_LEGEND_CUMULATED = 0x0040 ;// show the total in the legend rather than current values static const uint32_t RSGRAPH_FLAGS_PAINT_STYLE_DOTS = 0x0080 ;// use dots static const uint32_t RSGRAPH_FLAGS_LEGEND_INTEGER = 0x0100 ;// use integer number in the legend, and move the lines to match integers + static const uint32_t RSGRAPH_FLAGS_DARK_STYLE = 0x0200 ;// darkstyle graph /** Bandwidth graph style. */ enum GraphStyle diff --git a/retroshare-gui/src/gui/icons.qrc b/retroshare-gui/src/gui/icons.qrc index 6996ce50d..32c57e037 100644 --- a/retroshare-gui/src/gui/icons.qrc +++ b/retroshare-gui/src/gui/icons.qrc @@ -53,6 +53,7 @@ icons/gmail.png icons/help_128.png icons/help_64.png + icons/identities.png icons/information_128.png icons/internet_128.png icons/invite64.png diff --git a/retroshare-gui/src/gui/icons/identities.png b/retroshare-gui/src/gui/icons/identities.png new file mode 100644 index 0000000000000000000000000000000000000000..779f73b36ba8c617903ae37e46d6e8f8032b0340 GIT binary patch literal 3837 zcmVn?cBVdpUM2zA#Mu7qkR!{`p zU0B$2UjFEwy_l;`t|UpqxS*5cfM;S5r-3qVrT2v7&i2F^xv_-LD|+m9xOcY*c5 zCJ~Rd+EkY#6rBJhMJ=J%;j@5RAmEZYoxoN!F>F8+M2AbZn4)L|ASvoOz+zw#FwA9h z((x_uBJjM3$F{g_OfD3(03<~nhvxLfXl;5iu@iV6O$?vAZA>}}QUH>o)&O?`^?>BE zIr$=h*MJ8_JocX3#tfvO1RyEuOyDly61Q!!iPwP#L_GG6+lC}52mwfndJ%9hFw<>Y z9O4~dsffq^>9!%R3P4iSF~D+Qfon#%%PYXmA|7jW%K%pdAStRJxCvMSL>)JvusDMD zK0Gesu`Z`8cU%CHqSgUV0n;6=xbWEy+#uqyO-@$om;fY2^#S(*w^RH*d%F<8L%`i4 z9_x0ZLPrFkxAiZejo^7?XA^Lx6MX~O?g}JDod;~gbG{MkfNlDFXDhZv07+3LU>R^L zUdT6#03HGE5b>BTjCT7i+Jpa zm4#X=07+4+fwe%5Wrce5rGbhsuB!8Bh?=@TN2!AuR<-4e@ z`ke7)O$GbtP}lW_+a{z$AhEY|BpX^zHYX{wc8ftgeslRoE^(K&}C{2?t*j+QZw}d?lM}-nbBP|T>KcnDi-G# z5izli##1ljs;YHnZcppWlo3E*pTE^e4H4fl8ZLf}36)2Uo98A)5&@EQ`Xh|l_ID1* zV~yTgn`(c8bP?cAqoqGQ_2uGoei0JrYUQnIw?SKz(OXmc^f&?N+p^RfDS3pynHy*9 zFlvy8Nn+A=CLdjIR0Q?9Z~Kud0xZVhcz0EVco zD%d@c1}(EjehP_h`04{ABFHQNeJeJ@*}db-47W!fc``Qmo%Tbb%ZLaj>pt#bU<5Gy z=?8Cq*bVx<=f*^EP2XR71fZuEdr6+fO70@KqHijB-w04g;qJickqbQ{XwG!iF#2S5 z^%cNuyX-QL1d%Z?dL~p&17FB(g9@KSm;Q8+Q3O4{?mHPY%QmBoAo<|rpTLN-pnM|u z!@YkK0$LlPc?axy8IJCE&(1<7DS}aFLZ~9u6+OO|p=ZnWT8GR_PuT=G_c55Pz_3_< z=L1L*M90EObKtx`!MMw`*F26Vb0nzMecsaq)ZyNi>lzal!nuEdvK*&9eLy^ zpx1RtNm2yu$B7_--VaDN0q(Z{C!7nXn0f+*s#76$6TD|Kbz$}|&E02|t`6Avyfbz6 zCD8@@--pp>La<+RFdKM1DS)$`w@jy`98SG4zcPlO0b?$K#@CJCJHera%^k5hQC;ELn^u*+5FomC-~7$)O3fogAo0m z^<^4icfps`FSqmY?W=wnNsIIhaXwm&#~o=(@uJi_cd4W-Ew-47G)c z=q_aHbou|d+_N<%=r{AF`mU#04IU)Hv zlM%pKs%zl1+qASUtC_G6!Y4w*qdAQU-165mthXT#td~|F8p5lZWna4tIJ>ZK($68_z@}r9u7rSlLmWkcB)7`IZpSK&j@5Ga zoWLJ}iB~vNSFs`o_WA+mV&JeDAlZIeZ7;)5&w9zGnqNC$NbZE%4^yLBG&-6M*}vUc z0hFEWSXBT-P6FAlB|oHL&8$ZpG$=b&Enhe(fXy=65oFE~J#L2*dy#zF+Cq=i$iDTm zh{sw0XBOGHv4Y22HIy1(NkXiw|1#Mi58-E_A&NiL0=-Ma-UTjn%@`M%@yRQ0o6wKw zQG+RMX7Pu1K(7GS1Gm~C&WM%dIA z7G6v1Jf`3CK=_Y+f9)p#5sz)b#N5EAhuvFVI8@o&US<3ye`$wUz2KR?FQw{+8;$~7 zzq5FOr$<&c958W+RH*#8bA!?ez)*zQ+A_&&1{~(4&rIyC;4i&r;7i8|K*VF81Fsn= z_h45QPd2!>&%{teO-yHJv%zLJRJBj6n*Z;CFQ*%cdC;g)w|%^TJx$^47kcDHr$54+ z^(HoT50>Aa>gALI&`*~#G*Z)=2(xhGLiRM38aK`(Cp!HRl!mK0&}Q&G4ptl#tACcV zZldRe4*Jwp(?=+qT6O zLRF38jcYR=F`CPK?9ITDtXHKppi(=uK=zrs-6IcVpCD8*KkH@LE)elpBe2A@A)W}_ zAzZyiteT%S$tTy0jK_iPrj6+lL1Ao2GUy3}+X#d&&*jpb1R&zEF5m|8nfMD;!l*Mm z5ja73#4TcFeOoS<=A4ry;;~J@L#B-aPXta78M#@kUhrhDmm5vWyBjTY$UL41?4zWt zg_7unMs6`A01=OM16Kn1?aJhdzAUu4ISXtj;=r*JE=uZXLkZ&T8Cjx7Uj#`>a zuYVv}2ZGYxsHhJCx0$-RFKtcQaiASGIEPpclEhuZp|k#{|>B3BK0Ccev}UT zf|BU@W^Xqg0ifr^@io9)(}g7QB7t#&6^959Ke=y~uTk<60Dz>ZQM6S>`5(aNi6D1M zqOC+mP82Kazs{$ayw_%lc@PwVYl>U^+40MN70^eW(C@*Xi9 z;v$HQ+(M{wd_IqQnXtSGIIaRkod-Mz49}~eq1GJ80YP-sQn6;?Qah`$T>t=*qK*Mx z0P6B8sJ&S`^LDU{provY@bEci#`cZk$i}_;1k#1TGV*B>f)y}&kT(aBk(-HBS3BW+ za3})wt58wvfTw`zrVAO2ksuImBRt|3Bgq_A;J5$)Bt`WDH=!k)nmasTu!unR3BuKD z2!t=sHI2(kToFJ|SRz(0c*1Q{k`$Bxl1PeL1KbJJ zlj|99g)D+l)jopdx2Id8?Ir~&fFzQljsq6!U)k417m^74r5%LI-@#vcPpX|c3Wb6e zKwl(9JqJw)i-7b?j@=Z291w&mJ|Yl)eBf?eg-X!~Ac>xaRtL-mW&yQ8px;GKi9nJd z5IsyF{2{)Q*YE|NwrkAZE{aY71CbOpLa!js2BrX`Z4rU5B!NHFf05Z$FDx=Rq<0TSIl5?$I*xa3P9`w~dLP9(V# z+1HLFw;~7jBKx-^`!^%|){B+(U%L8_*}(q+U5CJ>+zR`|00000NkvXXu0mjf5jPh6 literal 0 HcmV?d00001 diff --git a/retroshare-gui/src/gui/statistics/BWGraph.cpp b/retroshare-gui/src/gui/statistics/BWGraph.cpp index db014e3e4..1663cb3bd 100644 --- a/retroshare-gui/src/gui/statistics/BWGraph.cpp +++ b/retroshare-gui/src/gui/statistics/BWGraph.cpp @@ -602,6 +602,6 @@ BWGraph::BWGraph(QWidget *parent) : RSGraphWidget(parent) BWGraph::~BWGraph() { - delete _local_source ; + //delete _local_source ;//Will be deleted by RSGraphWidget destructor } diff --git a/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.cpp b/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.cpp index 8669e8061..47436a40f 100644 --- a/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.cpp +++ b/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.cpp @@ -34,10 +34,12 @@ #define SETTING_OPACITY "Opacity" #define SETTING_ALWAYS_ON_TOP "AlwaysOnTop" #define SETTING_STYLE "GraphStyle" +#define SETTING_GRAPHCOLOR "GraphColor" #define DEFAULT_FILTER (BWGRAPH_LINE_SEND|BWGRAPH_LINE_RECV) #define DEFAULT_ALWAYS_ON_TOP false #define DEFAULT_OPACITY 100 #define DEFAULT_STYLE LineGraph +#define DEFAULT_GRAPHCOLOR DefaultColor #define ADD_TO_FILTER(f,v,b) (f = ((b) ? ((f) | (v)) : ((f) & ~(v)))) @@ -132,6 +134,19 @@ BandwidthGraph::loadSettings() ui.frmGraph->resetFlags(RSGraphWidget::RSGRAPH_FLAGS_PAINT_STYLE_PLAIN); else ui.frmGraph->setFlags(RSGraphWidget::RSGRAPH_FLAGS_PAINT_STYLE_PLAIN); + + /* Set whether we are plotting bandwidth as area graphs or not */ + int graphColor = getSetting(SETTING_GRAPHCOLOR, DEFAULT_GRAPHCOLOR).toInt(); + + if (graphColor < 0 || graphColor >= ui.cmbGraphColor->count()) { + graphColor = DEFAULT_GRAPHCOLOR; + } + ui.cmbGraphColor->setCurrentIndex(graphColor); + + if(graphColor==0) + ui.frmGraph->resetFlags(RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE); + else + ui.frmGraph->setFlags(RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE); /* Set graph frame settings */ ui.frmGraph->setShowEntry(0,ui.chkReceiveRate->isChecked()) ; @@ -158,6 +173,7 @@ void BandwidthGraph::saveChanges() /* Save the opacity and graph style */ saveSetting(SETTING_OPACITY, ui.sldrOpacity->value()); saveSetting(SETTING_STYLE, ui.cmbGraphStyle->currentIndex()); + saveSetting(SETTING_GRAPHCOLOR, ui.cmbGraphColor->currentIndex()); /* Save the Always On Top setting */ saveSetting(SETTING_ALWAYS_ON_TOP, ui.chkAlwaysOnTop->isChecked()); @@ -184,6 +200,11 @@ void BandwidthGraph::saveChanges() else ui.frmGraph->setFlags(RSGraphWidget::RSGRAPH_FLAGS_PAINT_STYLE_PLAIN); + if(ui.cmbGraphColor->currentIndex()==0) + ui.frmGraph->resetFlags(RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE); + else + ui.frmGraph->setFlags(RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE); + /* A change in window flags causes the window to disappear, so make sure * it's still visible. */ showNormal(); diff --git a/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.h b/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.h index 953112289..dbf498115 100644 --- a/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.h +++ b/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.h @@ -40,6 +40,7 @@ class BandwidthGraph : public RWindow public: enum { AreaGraph=0,LineGraph=1 } ; + enum { DefaultColor=0,DarkColor=1 } ; /** Default constructor */ BandwidthGraph(QWidget *parent = 0, Qt::WindowFlags flags = 0); diff --git a/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.ui b/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.ui index 51287c7d9..58136f46c 100644 --- a/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.ui +++ b/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.ui @@ -6,7 +6,7 @@ 0 0 - 414 + 418 305 @@ -24,7 +24,16 @@ 6 - + + 0 + + + 0 + + + 0 + + 0 @@ -69,13 +78,13 @@ - 355 + 400 82 - 355 + 400 82 @@ -88,19 +97,34 @@ QFrame::Raised - - - 6 - - + + 9 - + + 9 + + + 9 + + + 9 + + 6 - + + 3 + + + 3 + + + 3 + + 3 @@ -166,12 +190,21 @@ - + 1 - + + 0 + + + 0 + + + 0 + + 0 @@ -179,7 +212,16 @@ 6 - + + 0 + + + 0 + + + 0 + + 0 @@ -224,6 +266,20 @@ + + + + + Default + + + + + Dark + + + + @@ -241,7 +297,16 @@ 3 - + + 0 + + + 0 + + + 0 + + 0 @@ -299,7 +364,16 @@ 0 - + + 0 + + + 0 + + + 0 + + 0 @@ -377,25 +451,21 @@ - - - - Qt::Horizontal - - - - 21 - 20 - - - - - + 1 - + + 0 + + + 0 + + + 0 + + 0 @@ -414,6 +484,19 @@ + + + + Qt::Horizontal + + + + 21 + 20 + + + + diff --git a/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.cpp b/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.cpp index 56ac1645c..a27335ad9 100644 --- a/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.cpp +++ b/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.cpp @@ -24,6 +24,7 @@ #include "retroshare/rspeers.h" #include "retroshare/rsservicecontrol.h" #include "retroshare-gui/RsAutoUpdatePage.h" +#include "gui/settings/rsharesettings.h" #include "BandwidthStatsWidget.h" BandwidthStatsWidget::BandwidthStatsWidget(QWidget *parent) @@ -31,6 +32,8 @@ BandwidthStatsWidget::BandwidthStatsWidget(QWidget *parent) { ui.setupUi(this) ; + m_bProcessSettings = false; + // now add one button per service ui.friend_CB->addItem(tr("Sum")) ; @@ -51,6 +54,8 @@ BandwidthStatsWidget::BandwidthStatsWidget(QWidget *parent) updateUnitSelection(0); toggleLogScale(ui.logScale_CB->checkState() == Qt::Checked);//Update bwgraph_BW with default logScale_CB state defined in ui file. + + // Setup connections QObject::connect(ui.friend_CB ,SIGNAL(currentIndexChanged(int )),this, SLOT( updateFriendSelection(int ))) ; @@ -59,6 +64,7 @@ BandwidthStatsWidget::BandwidthStatsWidget(QWidget *parent) QObject::connect(ui.service_CB ,SIGNAL(currentIndexChanged(int )),this, SLOT(updateServiceSelection(int ))) ; QObject::connect(ui.legend_CB ,SIGNAL(currentIndexChanged(int )),this, SLOT( updateLegendType(int ))) ; QObject::connect(ui.logScale_CB,SIGNAL( toggled(bool)),this, SLOT( toggleLogScale(bool))) ; + QObject::connect(ui.cmbGraphColor,SIGNAL(currentIndexChanged(int )),this, SLOT( updateGraphSelection(int))) ; // setup one timer for auto-update @@ -66,6 +72,45 @@ BandwidthStatsWidget::BandwidthStatsWidget(QWidget *parent) connect(mTimer, SIGNAL(timeout()), this, SLOT(updateComboBoxes())) ; mTimer->setSingleShot(false) ; mTimer->start(2000) ; + + // load settings + processSettings(true); + + int graphColor = ui.cmbGraphColor->currentIndex(); + + if(graphColor==0) + ui.bwgraph_BW->resetFlags(RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE); + else + ui.bwgraph_BW->setFlags(RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE); +} + +BandwidthStatsWidget::~BandwidthStatsWidget () +{ + // save settings + processSettings(false); +} + +void BandwidthStatsWidget::processSettings(bool bLoad) +{ + m_bProcessSettings = true; + + Settings->beginGroup(QString("BandwidthStatsWidget")); + + if (bLoad) { + // load settings + + // state of Graph Color combobox + int index = Settings->value("cmbGraphColor", 0).toInt(); + ui.cmbGraphColor->setCurrentIndex(index); + } else { + // save settings + + // state of Graph Color combobox + Settings->setValue("cmbGraphColor", ui.cmbGraphColor->currentIndex()); + } + + Settings->endGroup(); + m_bProcessSettings = false; } void BandwidthStatsWidget::toggleLogScale(bool b) @@ -75,6 +120,7 @@ void BandwidthStatsWidget::toggleLogScale(bool b) else ui.bwgraph_BW->resetFlags(RSGraphWidget::RSGRAPH_FLAGS_LOG_SCALE_Y) ; } + void BandwidthStatsWidget::updateComboBoxes() { if(!isVisible()) @@ -234,3 +280,11 @@ void BandwidthStatsWidget::updateUnitSelection(int n) ui.legend_CB->setItemText(1,tr("Total")); } } + +void BandwidthStatsWidget::updateGraphSelection(int n) +{ + if(n==0) + ui.bwgraph_BW->resetFlags(RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE); + else + ui.bwgraph_BW->setFlags(RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE); +} diff --git a/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.h b/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.h index 9c809bc23..c0ae4b4b2 100644 --- a/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.h +++ b/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.h @@ -26,7 +26,10 @@ class BandwidthStatsWidget: public QWidget Q_OBJECT public: + /** Default Constructor */ BandwidthStatsWidget(QWidget *parent) ; + /** Default Destructor */ + ~BandwidthStatsWidget (); protected slots: void updateFriendSelection(int n); @@ -36,8 +39,12 @@ protected slots: void updateUnitSelection(int n); void toggleLogScale(bool b); void updateLegendType(int n); + void updateGraphSelection(int n); private: + void processSettings(bool bLoad); + bool m_bProcessSettings; + Ui::BwStatsWidget ui; QTimer *mTimer ; diff --git a/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.ui b/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.ui index fdfefb99b..dc36efbad 100644 --- a/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.ui +++ b/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.ui @@ -6,7 +6,7 @@ 0 0 - 1148 + 800 385 @@ -140,6 +140,20 @@ + + + + + Default + + + + + Dark + + + + diff --git a/retroshare-gui/src/gui/statistics/DhtWindow.ui b/retroshare-gui/src/gui/statistics/DhtWindow.ui index 9513eeb87..38fb48dde 100644 --- a/retroshare-gui/src/gui/statistics/DhtWindow.ui +++ b/retroshare-gui/src/gui/statistics/DhtWindow.ui @@ -7,7 +7,7 @@ 0 0 760 - 603 + 500 diff --git a/retroshare-gui/src/gui/statistics/GlobalRouterStatistics.cpp b/retroshare-gui/src/gui/statistics/GlobalRouterStatistics.cpp index bd97bc391..e70044d9a 100644 --- a/retroshare-gui/src/gui/statistics/GlobalRouterStatistics.cpp +++ b/retroshare-gui/src/gui/statistics/GlobalRouterStatistics.cpp @@ -84,6 +84,9 @@ GlobalRouterStatistics::GlobalRouterStatistics(QWidget *parent) connect(treeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(CustomPopupMenu(QPoint))); + /* Set initial size the splitter */ + splitter->setStretchFactor(1, 1); + splitter->setStretchFactor(0, 0); // load settings processSettings(true); @@ -106,12 +109,12 @@ void GlobalRouterStatistics::processSettings(bool bLoad) // load settings // state of splitter - //splitter->restoreState(Settings->value("Splitter").toByteArray()); + splitter->restoreState(Settings->value("Splitter").toByteArray()); } else { // save settings // state of splitter - //Settings->setValue("Splitter", splitter->saveState()); + Settings->setValue("Splitter", splitter->saveState()); } diff --git a/retroshare-gui/src/gui/statistics/GlobalRouterStatistics.ui b/retroshare-gui/src/gui/statistics/GlobalRouterStatistics.ui index 83de70e5b..08067a1c0 100644 --- a/retroshare-gui/src/gui/statistics/GlobalRouterStatistics.ui +++ b/retroshare-gui/src/gui/statistics/GlobalRouterStatistics.ui @@ -6,19 +6,96 @@ 0 0 - 1468 - 659 + 800 + 429 Router Statistics - + Qt::Vertical + + + GroupBox + + + + + + Qt::CustomContextMenu + + + true + + + + ID + + + + + Identity Name + + + + + Destinaton + + + + + Data status + + + + + Tunnel status + + + + + Stored data size + + + + + Data hash + + + + + Receive time + + + + + Sending time + + + + + Branching factor + + + + + Receive time (secs ago) + + + + + Sending time (secs ago) + + + + + + QFrame::NoFrame @@ -34,93 +111,14 @@ 0 0 - 1450 - 317 + 782 + 69 - - - - GroupBox - - - - - - Qt::CustomContextMenu - - - true - - - - ID - - - - - Identity Name - - - - - Destinaton - - - - - Data status - - - - - Tunnel status - - - - - Stored data size - - - - - Data hash - - - - - Receive time - - - - - Sending time - - - - - Branching factor - - - - - Receive time (secs ago) - - - - - Sending time (secs ago) - - - - - - - diff --git a/retroshare-gui/src/gui/statistics/GxsTransportStatistics.ui b/retroshare-gui/src/gui/statistics/GxsTransportStatistics.ui index 8ce780e81..781f3c078 100644 --- a/retroshare-gui/src/gui/statistics/GxsTransportStatistics.ui +++ b/retroshare-gui/src/gui/statistics/GxsTransportStatistics.ui @@ -6,8 +6,8 @@ 0 0 - 1468 - 779 + 800 + 500 diff --git a/retroshare-gui/src/gui/statistics/RttStatistics.cpp b/retroshare-gui/src/gui/statistics/RttStatistics.cpp index 57debbb64..f4e97948e 100644 --- a/retroshare-gui/src/gui/statistics/RttStatistics.cpp +++ b/retroshare-gui/src/gui/statistics/RttStatistics.cpp @@ -131,4 +131,11 @@ RttStatisticsGraph::RttStatisticsGraph(QWidget *parent) resetFlags(RSGRAPH_FLAGS_LOG_SCALE_Y) ; resetFlags(RSGRAPH_FLAGS_PAINT_STYLE_PLAIN) ; setFlags(RSGRAPH_FLAGS_SHOW_LEGEND) ; + + int graphColor = Settings->valueFromGroup("BandwidthStatsWidget", "cmbGraphColor", 0).toInt(); + + if(graphColor==0) + resetFlags(RSGraphWidget::RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE); + else + setFlags(RSGraphWidget::RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE); } diff --git a/retroshare-gui/src/gui/statistics/StatisticsWindow.cpp b/retroshare-gui/src/gui/statistics/StatisticsWindow.cpp index 3d3868135..c5d0deade 100644 --- a/retroshare-gui/src/gui/statistics/StatisticsWindow.cpp +++ b/retroshare-gui/src/gui/statistics/StatisticsWindow.cpp @@ -54,7 +54,7 @@ #define IMAGE_DHT ":/icons/DHT128.png" #define IMAGE_TURTLE ":/icons/turtle128.png" -#define IMAGE_IDENTITIES ":/icons/avatar_128.png" +#define IMAGE_IDENTITIES ":/icons/identities.png" #define IMAGE_BWGRAPH ":/icons/bandwidth128.png" #define IMAGE_GLOBALROUTER ":/icons/GRouter128.png" #define IMAGE_GXSTRANSPORT ":/icons/transport128.png" diff --git a/retroshare-gui/src/gui/statistics/StatisticsWindow.ui b/retroshare-gui/src/gui/statistics/StatisticsWindow.ui index 08ae47cd3..b372bae75 100644 --- a/retroshare-gui/src/gui/statistics/StatisticsWindow.ui +++ b/retroshare-gui/src/gui/statistics/StatisticsWindow.ui @@ -15,7 +15,16 @@ - + + 0 + + + 0 + + + 0 + + 0 @@ -45,7 +54,6 @@ false - @@ -61,7 +69,7 @@ - + :/images/add-share24.png:/images/add-share24.png @@ -79,7 +87,7 @@ - + :/images/messenger.png:/images/messenger.png @@ -105,7 +113,7 @@ - + :/images/exit_24x24.png:/images/exit_24x24.png diff --git a/retroshare-gui/src/gui/statistics/TurtleRouterStatistics.cpp b/retroshare-gui/src/gui/statistics/TurtleRouterStatistics.cpp index fa3b21893..50015406b 100644 --- a/retroshare-gui/src/gui/statistics/TurtleRouterStatistics.cpp +++ b/retroshare-gui/src/gui/statistics/TurtleRouterStatistics.cpp @@ -202,7 +202,14 @@ TurtleRouterStatistics::TurtleRouterStatistics(QWidget *parent) float fact = fontHeight/14.0; frmGraph->setMinimumHeight(200*fact); - + + int graphColor = Settings->valueFromGroup("BandwidthStatsWidget", "cmbGraphColor", 0).toInt(); + + if(graphColor==0) + frmGraph->resetFlags(RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE); + else + frmGraph->setFlags(RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE); + // load settings processSettings(true); } @@ -224,12 +231,12 @@ void TurtleRouterStatistics::processSettings(bool bLoad) // load settings // state of splitter - //splitter->restoreState(Settings->value("Splitter").toByteArray()); + splitter->restoreState(Settings->value("Splitter").toByteArray()); } else { // save settings // state of splitter - //Settings->setValue("Splitter", splitter->saveState()); + Settings->setValue("Splitter", splitter->saveState()); } diff --git a/retroshare-gui/src/gui/statistics/TurtleRouterStatistics.ui b/retroshare-gui/src/gui/statistics/TurtleRouterStatistics.ui index e7b443fd1..6cea8ac02 100644 --- a/retroshare-gui/src/gui/statistics/TurtleRouterStatistics.ui +++ b/retroshare-gui/src/gui/statistics/TurtleRouterStatistics.ui @@ -7,7 +7,7 @@ 0 0 680 - 523 + 500 @@ -29,15 +29,15 @@ Qt::Vertical + + 5 + - - - - - QFrame::NoFrame - - - Qt::ScrollBarAlwaysOff + + + 0 + 200 + true @@ -47,28 +47,23 @@ 0 0 - 640 - 248 + 636 + 198 - - true - - - - - - - - 120 - 200 - - - - Qt::NoContextMenu - + + + + 120 + 200 + + + + Qt::NoContextMenu + + diff --git a/retroshare-gui/src/gui/statistics/dhtgraph.h b/retroshare-gui/src/gui/statistics/dhtgraph.h index b908d8e59..b8baff3b0 100644 --- a/retroshare-gui/src/gui/statistics/dhtgraph.h +++ b/retroshare-gui/src/gui/statistics/dhtgraph.h @@ -26,6 +26,7 @@ #include #include +#include "gui/settings/rsharesettings.h" #include #include @@ -74,5 +75,12 @@ class DhtGraph : public RSGraphWidget resetFlags(RSGRAPH_FLAGS_LOG_SCALE_Y) ; setFlags(RSGRAPH_FLAGS_PAINT_STYLE_PLAIN) ; + + int graphColor = Settings->valueFromGroup("BandwidthStatsWidget", "cmbGraphColor", 0).toInt(); + + if(graphColor==0) + resetFlags(RSGraphWidget::RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE); + else + setFlags(RSGraphWidget::RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE); } }; diff --git a/retroshare-gui/src/gui/statistics/turtlegraph.h b/retroshare-gui/src/gui/statistics/turtlegraph.h index ed9b0338c..6b6da78e9 100644 --- a/retroshare-gui/src/gui/statistics/turtlegraph.h +++ b/retroshare-gui/src/gui/statistics/turtlegraph.h @@ -20,6 +20,8 @@ #pragma once +#include "gui/settings/rsharesettings.h" + #include "retroshare/rsturtle.h" #include @@ -68,7 +70,14 @@ class TurtleGraph: public RSGraphWidget resetFlags(RSGRAPH_FLAGS_LOG_SCALE_Y) ; resetFlags(RSGRAPH_FLAGS_PAINT_STYLE_PLAIN) ; - setFlags(RSGRAPH_FLAGS_SHOW_LEGEND) ; + setFlags(RSGRAPH_FLAGS_SHOW_LEGEND) ; + + int graphColor = Settings->valueFromGroup("BandwidthStatsWidget", "cmbGraphColor", 0).toInt(); + + if(graphColor==0) + resetFlags(RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE); + else + setFlags(RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE); } }; From 66ecc8df769b7d3862844d2754adad75008442f1 Mon Sep 17 00:00:00 2001 From: defnax Date: Sat, 16 Jan 2021 21:53:19 +0100 Subject: [PATCH 12/17] Fixed Group Chat toaster to use No Frame * Fixed Group Chat toaster to use No Frame * Hide unused widget on People Dialog --- .../src/gui/People/PeopleDialog.cpp | 1 + retroshare-gui/src/gui/People/PeopleDialog.ui | 80 +++---------------- .../src/gui/toaster/GroupChatToaster.cpp | 2 +- 3 files changed, 14 insertions(+), 69 deletions(-) diff --git a/retroshare-gui/src/gui/People/PeopleDialog.cpp b/retroshare-gui/src/gui/People/PeopleDialog.cpp index e06129905..42bf448a4 100644 --- a/retroshare-gui/src/gui/People/PeopleDialog.cpp +++ b/retroshare-gui/src/gui/People/PeopleDialog.cpp @@ -69,6 +69,7 @@ PeopleDialog::PeopleDialog(QWidget *parent) tabWidget->removeTab(1); //hide circle flow widget not functional yet pictureFlowWidgetExternal->hide(); + widgetExternal->hide(); //need erase QtCreator Layout first(for Win) delete idExternal->layout(); diff --git a/retroshare-gui/src/gui/People/PeopleDialog.ui b/retroshare-gui/src/gui/People/PeopleDialog.ui index bf5b7239f..416496a8a 100644 --- a/retroshare-gui/src/gui/People/PeopleDialog.ui +++ b/retroshare-gui/src/gui/People/PeopleDialog.ui @@ -20,76 +20,25 @@ - + + 0 + + + 0 + + + 0 + + 0 - - - QFrame::Box - - - QFrame::Sunken - - - - 2 - - - - - - 0 - 0 - - - - - 24 - 24 - - - - - - - :/images/identity/identities_32.png - - - true - - - - - - - People - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - true - 1 + 0 @@ -129,7 +78,7 @@ - + @@ -234,11 +183,6 @@ - - StyledLabel - QLabel -
gui/common/StyledLabel.h
-
PictureFlow QWidget diff --git a/retroshare-gui/src/gui/toaster/GroupChatToaster.cpp b/retroshare-gui/src/gui/toaster/GroupChatToaster.cpp index 7a11c02dd..64d49f605 100644 --- a/retroshare-gui/src/gui/toaster/GroupChatToaster.cpp +++ b/retroshare-gui/src/gui/toaster/GroupChatToaster.cpp @@ -37,7 +37,7 @@ GroupChatToaster::GroupChatToaster(const RsPeerId &peerId, const QString &messag /* set informations */ ui.textLabel->setText(RsHtml().formatText(NULL, message, RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS | RSHTML_FORMATTEXT_CLEANSTYLE)); ui.toasterLabel->setText(QString::fromUtf8(rsPeers->getPeerName(peerId).c_str())); - ui.avatarWidget->setFrameType(AvatarWidget::STATUS_FRAME); + ui.avatarWidget->setFrameType(AvatarWidget::NO_FRAME); ui.avatarWidget->setDefaultAvatar(":/images/user/personal64.png"); ui.avatarWidget->setId(ChatId(peerId)); } From a21ce4e53bcddf043ffad1a7810b58ae454db057 Mon Sep 17 00:00:00 2001 From: defnax Date: Sun, 17 Jan 2021 17:10:35 +0100 Subject: [PATCH 13/17] update links --- .../src/gui/help/content/en/links.html | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/retroshare-gui/src/gui/help/content/en/links.html b/retroshare-gui/src/gui/help/content/en/links.html index 0ad4a5ba3..b91bfaccc 100644 --- a/retroshare-gui/src/gui/help/content/en/links.html +++ b/retroshare-gui/src/gui/help/content/en/links.html @@ -1,7 +1,7 @@