mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-03-06 05:36:10 -05:00
fixed conflict with master
This commit is contained in:
commit
f491e3c20e
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
@ -833,8 +834,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
|
||||
@ -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
|
||||
|
||||
@ -1123,7 +1124,6 @@ bool RsGxsDataAccess::getMsgMetaDataList( const GxsMsgReq& msgIds, const RsTokRe
|
||||
if(metaV[i] != nullptr)
|
||||
{
|
||||
const auto& msgMeta = metaV[i];
|
||||
bool add = false;
|
||||
|
||||
/* if we are grabbing thread Head... then parentId == empty. */
|
||||
if (onlyThreadHeadMsgs && !msgMeta->mParentId.isNull())
|
||||
|
@ -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)
|
||||
|
@ -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<RsGxsNotify *> &changes)
|
||||
void notifyChanges(std::vector<RsGxsNotify *> &changes);
|
||||
void notifyChanges(std::vector<RsGxsNotify *> &changes) override;
|
||||
|
||||
/// @see p3Config::setupSerialiser()
|
||||
virtual RsSerialiser* setupSerialiser();
|
||||
virtual RsSerialiser* setupSerialiser() override;
|
||||
|
||||
/// @see p3Config::saveList(bool &cleanup, std::list<RsItem *>&)
|
||||
virtual bool saveList(bool &cleanup, std::list<RsItem *>&saveList);
|
||||
virtual bool saveList(bool &cleanup, std::list<RsItem *>&saveList) override;
|
||||
|
||||
/// @see p3Config::saveDone()
|
||||
void saveDone();
|
||||
void saveDone() override;
|
||||
|
||||
/// @see p3Config::loadList(std::list<RsItem *>&)
|
||||
virtual bool loadList(std::list<RsItem *>& loadList);
|
||||
virtual bool loadList(std::list<RsItem *>& loadList) override;
|
||||
|
||||
/// Request groups list to GXS backend. Async method.
|
||||
bool requestGroupsData(const std::list<RsGxsGroupId>* groupIds = NULL);
|
||||
@ -325,7 +327,7 @@ private:
|
||||
|
||||
// Overloaded from RsGenExchange.
|
||||
|
||||
bool acceptNewMessage(const RsGxsMsgMetaData *msgMeta, uint32_t size) ;
|
||||
bool acceptNewMessage(const RsGxsMsgMetaData *msgMeta, uint32_t size) override;
|
||||
|
||||
GxsTransIntegrityCleanupThread *mCleanupThread ;
|
||||
|
||||
|
@ -1134,12 +1134,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)
|
||||
|
@ -178,15 +178,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
|
||||
@ -277,7 +277,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(
|
||||
@ -295,7 +295,7 @@ virtual bool ExtraFileRemove(const RsFileHash &hash);
|
||||
) override;
|
||||
|
||||
virtual bool shareChannelKeys(
|
||||
const RsGxsGroupId& channelId, const std::set<RsPeerId>& peers );
|
||||
const RsGxsGroupId& channelId, const std::set<RsPeerId>& peers ) override;
|
||||
|
||||
/// Implementation of @see RsGxsChannels::createChannel
|
||||
RS_DEPRECATED_FOR(createChannelV2)
|
||||
@ -316,7 +316,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:
|
||||
|
@ -585,7 +585,7 @@ void p3GxsCircles::notifyChanges(std::vector<RsGxsNotify *> &changes)
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
p3Notify *notify = RsServer::notify();
|
||||
//p3Notify *notify = RsServer::notify();
|
||||
std::set<RsGxsCircleId> circles_to_reload;
|
||||
|
||||
for(auto it = changes.begin(); it != changes.end(); ++it)
|
||||
@ -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)
|
||||
|
@ -318,7 +318,8 @@ protected:
|
||||
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;
|
||||
|
@ -199,7 +199,7 @@ bool p3GxsCommentService::getGxsCommentData(const uint32_t &token, std::vector<R
|
||||
|
||||
for(; mit != msgData.end(); ++mit)
|
||||
{
|
||||
RsGxsGroupId grpId = mit->first;
|
||||
//RsGxsGroupId grpId = mit->first;
|
||||
std::vector<RsGxsMsgItem*>& msgItems = mit->second;
|
||||
std::vector<RsGxsMsgItem*>::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)
|
||||
|
@ -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:
|
||||
|
||||
|
@ -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<RsGxsIface&>(*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<RsGxsIface&>(*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;
|
||||
|
||||
// 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);
|
||||
|
||||
@ -4478,7 +4477,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.
|
||||
@ -4694,36 +4693,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: "
|
||||
|
@ -405,7 +405,8 @@ protected:
|
||||
virtual bool acceptNewGroup(const RsGxsGrpMetaData *grpMeta) 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;
|
||||
@ -558,7 +559,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);
|
||||
|
@ -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;
|
||||
|
@ -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<RsGxsNotify*>& changes);
|
||||
void notifyChanges(std::vector<RsGxsNotify*>& changes) override;
|
||||
public:
|
||||
|
||||
/** Requests **/
|
||||
|
||||
void groupsChanged(std::list<RsGxsGroupId>& grpIds);
|
||||
void groupsChanged(std::list<RsGxsGroupId>& grpIds) override;
|
||||
|
||||
|
||||
void msgsChanged(GxsMsgIdResult& msgs);
|
||||
void msgsChanged(GxsMsgIdResult& msgs) override;
|
||||
|
||||
RsTokenService* getTokenService();
|
||||
RsTokenService* getTokenService() override;
|
||||
|
||||
bool getGroupList(const uint32_t &token, std::list<RsGxsGroupId> &groupIds);
|
||||
bool getMsgList(const uint32_t &token, GxsMsgIdResult& msgIds);
|
||||
bool getGroupList(const uint32_t &token, std::list<RsGxsGroupId> &groupIds) override;
|
||||
bool getMsgList(const uint32_t &token, GxsMsgIdResult& msgIds) override;
|
||||
|
||||
/* Generic Summary */
|
||||
bool getGroupSummary(const uint32_t &token, std::list<RsGroupMetaData> &groupInfo);
|
||||
bool getGroupSummary(const uint32_t &token, std::list<RsGroupMetaData> &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<RsPhotoAlbum> &albums);
|
||||
bool getPhoto(const uint32_t &token, PhotoResult &photos);
|
||||
bool getAlbum(const uint32_t &token, std::vector<RsPhotoAlbum> &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<RsGxsGroupId, RsGxsMessageId>& msgId);
|
||||
bool acknowledgeMsg(const uint32_t& token, std::pair<RsGxsGroupId, RsGxsMessageId>& 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.
|
||||
/*!
|
||||
|
@ -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)
|
||||
|
@ -77,7 +77,8 @@ protected:
|
||||
virtual void notifyChanges(std::vector<RsGxsNotify*>& 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;
|
||||
|
@ -110,6 +110,6 @@ android-* {
|
||||
}
|
||||
|
||||
################################### Pkg-Config Stuff #############################
|
||||
|
||||
LIBS *= $$system(pkg-config --libs $$PKGCONFIG)
|
||||
|
||||
!isEmpty(PKGCONFIG) {
|
||||
LIBS *= $$system(pkg-config --libs $$PKGCONFIG)
|
||||
}
|
||||
|
@ -378,6 +378,8 @@ MainWindow::~MainWindow()
|
||||
delete trayIcon;
|
||||
delete trayMenu;
|
||||
// delete notifyMenu; // already deleted by the deletion of trayMenu
|
||||
StatisticsWindow::releaseInstance();
|
||||
|
||||
#ifdef MESSENGER_WINDOW
|
||||
MessengerWindow::releaseInstance();
|
||||
#endif
|
||||
|
@ -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();
|
||||
|
@ -20,76 +20,25 @@
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="titleBarLayout">
|
||||
<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>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QFrame" name="titleBarFrame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout">
|
||||
<property name="margin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="titleBarPixmap">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../images.qrc">:/images/identity/identities_32.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="StyledLabel" name="titleBarLabel">
|
||||
<property name="text">
|
||||
<string>People</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="titleBarSpacer">
|
||||
<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>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tabExternal">
|
||||
<property name="sizePolicy">
|
||||
@ -129,7 +78,7 @@
|
||||
<layout class="QVBoxLayout"/>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="widgetExternal">
|
||||
<widget class="QFrame" name="widgetExternal">
|
||||
<layout class="QGridLayout" name="layoutExternal">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_External">
|
||||
@ -234,11 +183,6 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>StyledLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
<header>gui/common/StyledLabel.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>PictureFlow</class>
|
||||
<extends>QWidget</extends>
|
||||
|
@ -365,6 +365,9 @@
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -81,8 +81,10 @@ void RsPostedPostsModel::handleEvent_main_thread(std::shared_ptr<const RsEvent>
|
||||
//
|
||||
// We need to update the data!
|
||||
|
||||
if(e->mPostedGroupId == mPostedGroup.mMeta.mGroupId)
|
||||
RsThread::async([this, e]()
|
||||
RsGxsPostedEvent E(*e);
|
||||
|
||||
if(E.mPostedGroupId == mPostedGroup.mMeta.mGroupId)
|
||||
RsThread::async([this, E]()
|
||||
{
|
||||
// 1 - get message data from p3GxsChannels
|
||||
|
||||
@ -90,9 +92,9 @@ void RsPostedPostsModel::handleEvent_main_thread(std::shared_ptr<const RsEvent>
|
||||
std::vector<RsGxsComment> comments;
|
||||
std::vector<RsGxsVote> votes;
|
||||
|
||||
if(!rsPosted->getBoardContent(mPostedGroup.mMeta.mGroupId,std::set<RsGxsMessageId>{ e->mPostedMsgId }, posts,comments,votes))
|
||||
if(!rsPosted->getBoardContent(mPostedGroup.mMeta.mGroupId,std::set<RsGxsMessageId>{ E.mPostedMsgId }, posts,comments,votes))
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << " failed to retrieve channel message data for channel/msg " << e->mPostedGroupId << "/" << e->mPostedMsgId << std::endl;
|
||||
RS_ERR(" failed to retrieve channel message data for channel/msg ", E.mPostedGroupId, "/", E.mPostedMsgId);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -118,10 +120,10 @@ void RsPostedPostsModel::handleEvent_main_thread(std::shared_ptr<const RsEvent>
|
||||
},this);
|
||||
});
|
||||
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RsPostedPostsModel::initEmptyHierarchy()
|
||||
@ -138,13 +140,12 @@ void RsPostedPostsModel::initEmptyHierarchy()
|
||||
|
||||
void RsPostedPostsModel::preMods()
|
||||
{
|
||||
beginResetModel();
|
||||
emit layoutAboutToBeChanged();
|
||||
}
|
||||
void RsPostedPostsModel::postMods()
|
||||
{
|
||||
endResetModel();
|
||||
|
||||
emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(mDisplayedNbPosts,0,(void*)NULL));
|
||||
update();
|
||||
emit layoutChanged();
|
||||
}
|
||||
void RsPostedPostsModel::update()
|
||||
{
|
||||
@ -160,20 +161,17 @@ void RsPostedPostsModel::setFilter(const QStringList& strings, uint32_t& count)
|
||||
{
|
||||
preMods();
|
||||
|
||||
beginRemoveRows(QModelIndex(),0,rowCount()-1);
|
||||
endRemoveRows();
|
||||
beginResetModel();
|
||||
mFilteredPosts.clear();
|
||||
endResetModel();
|
||||
|
||||
if(strings.empty())
|
||||
{
|
||||
mFilteredPosts.clear();
|
||||
for(int i=0;i<(int)(mPosts.size());++i)
|
||||
mFilteredPosts.push_back(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
mFilteredPosts.clear();
|
||||
//mFilteredPosts.push_back(0);
|
||||
|
||||
for(int i=0;i<static_cast<int>(mPosts.size());++i)
|
||||
{
|
||||
bool passes_strings = true;
|
||||
@ -197,8 +195,11 @@ void RsPostedPostsModel::setFilter(const QStringList& strings, uint32_t& count)
|
||||
|
||||
std::cerr << "After filtering: " << count << " posts remain." << std::endl;
|
||||
|
||||
if (rowCount()>0)
|
||||
{
|
||||
beginInsertRows(QModelIndex(),0,rowCount()-1);
|
||||
endInsertRows();
|
||||
}
|
||||
|
||||
postMods();
|
||||
}
|
||||
@ -208,7 +209,7 @@ int RsPostedPostsModel::rowCount(const QModelIndex& parent) const
|
||||
if(parent.column() > 0)
|
||||
return 0;
|
||||
|
||||
if(mFilteredPosts.empty()) // security. Should never happen.
|
||||
if(mFilteredPosts.empty()) // rowCount is called by internal Qt so maybe before posts are populated.
|
||||
return 0;
|
||||
|
||||
if(!parent.isValid())
|
||||
@ -471,7 +472,7 @@ private:
|
||||
Qt::ItemFlags RsPostedPostsModel::flags(const QModelIndex& index) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return 0;
|
||||
return Qt::ItemFlags();
|
||||
|
||||
return QAbstractItemModel::flags(index) | Qt::ItemIsEditable;
|
||||
}
|
||||
@ -517,12 +518,13 @@ void RsPostedPostsModel::setPosts(const RsPostedGroup& group, std::vector<RsPost
|
||||
{
|
||||
preMods();
|
||||
|
||||
beginRemoveRows(QModelIndex(),0,rowCount()-1);
|
||||
endRemoveRows();
|
||||
beginResetModel();
|
||||
|
||||
mPosts.clear();
|
||||
mPostedGroup = group;
|
||||
|
||||
endResetModel();
|
||||
|
||||
createPostsArray(posts);
|
||||
|
||||
std::sort(mPosts.begin(),mPosts.end(), PostSorter(mSortingStrategy));
|
||||
@ -533,8 +535,11 @@ void RsPostedPostsModel::setPosts(const RsPostedGroup& group, std::vector<RsPost
|
||||
mDisplayedNbPosts = std::min((uint32_t)mFilteredPosts.size(),DEFAULT_DISPLAYED_NB_POSTS);
|
||||
mDisplayedStartIndex = 0;
|
||||
|
||||
if (rowCount()>0)
|
||||
{
|
||||
beginInsertRows(QModelIndex(),0,rowCount()-1);
|
||||
endInsertRows();
|
||||
}
|
||||
|
||||
postMods();
|
||||
|
||||
@ -597,8 +602,6 @@ void RsPostedPostsModel::update_posts(const RsGxsGroupId& group_id)
|
||||
});
|
||||
}
|
||||
|
||||
//static bool decreasing_time_comp(const std::pair<time_t,RsGxsMessageId>& e1,const std::pair<time_t,RsGxsMessageId>& e2) { return e2.first < e1.first ; }
|
||||
|
||||
void RsPostedPostsModel::createPostsArray(std::vector<RsPostedPost>& posts)
|
||||
{
|
||||
#ifdef TODO
|
||||
|
@ -228,7 +228,15 @@ void AvatarWidget::refreshStatus()
|
||||
DistantChatPeerInfo dcpinfo ;
|
||||
|
||||
if(rsMsgs->getDistantChatStatus(mId.toDistantChatId(),dcpinfo))
|
||||
status = dcpinfo.status ;
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
@ -152,13 +152,12 @@ void RsFriendListModel::setDisplayGroups(bool b)
|
||||
}
|
||||
void RsFriendListModel::preMods()
|
||||
{
|
||||
beginResetModel();
|
||||
emit layoutAboutToBeChanged();
|
||||
}
|
||||
void RsFriendListModel::postMods()
|
||||
{
|
||||
endResetModel();
|
||||
|
||||
emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(rowCount()-1,columnCount()-1,(void*)NULL));
|
||||
emit layoutChanged();
|
||||
}
|
||||
|
||||
int RsFriendListModel::rowCount(const QModelIndex& parent) const
|
||||
@ -187,7 +186,7 @@ int RsFriendListModel::rowCount(const QModelIndex& parent) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
int RsFriendListModel::columnCount(const QModelIndex &parent) const
|
||||
int RsFriendListModel::columnCount(const QModelIndex &/*parent*/) const
|
||||
{
|
||||
return COLUMN_THREAD_NB_COLUMNS ;
|
||||
}
|
||||
@ -204,11 +203,12 @@ bool RsFriendListModel::hasChildren(const QModelIndex &parent) const
|
||||
return false;
|
||||
|
||||
if(parent_index.type == ENTRY_TYPE_PROFILE)
|
||||
{
|
||||
if(parent_index.group_index < UNDEFINED_GROUP_INDEX_VALUE)
|
||||
return !mProfiles[mGroups[parent_index.group_index].child_profile_indices[parent_index.profile_index]].child_node_indices.empty();
|
||||
else
|
||||
return !mProfiles[parent_index.profile_index].child_node_indices.empty();
|
||||
|
||||
}
|
||||
if(parent_index.type == ENTRY_TYPE_GROUP)
|
||||
return !mGroups[parent_index.group_index].child_profile_indices.empty();
|
||||
|
||||
@ -236,6 +236,8 @@ RsFriendListModel::EntryIndex RsFriendListModel::EntryIndex::parent() const
|
||||
case ENTRY_TYPE_NODE: i.type = ENTRY_TYPE_PROFILE;
|
||||
i.node_index = UNDEFINED_NODE_INDEX_VALUE;
|
||||
break;
|
||||
case ENTRY_TYPE_UNKNOWN:
|
||||
RS_ERR("Unknown Entry type for parent.");
|
||||
}
|
||||
|
||||
return i;
|
||||
@ -330,12 +332,12 @@ QModelIndex RsFriendListModel::parent(const QModelIndex& index) const
|
||||
Qt::ItemFlags RsFriendListModel::flags(const QModelIndex& index) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return 0;
|
||||
return Qt::ItemFlags();
|
||||
|
||||
return QAbstractItemModel::flags(index);
|
||||
}
|
||||
|
||||
QVariant RsFriendListModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
QVariant RsFriendListModel::headerData(int section, Qt::Orientation /*orientation*/, int role) const
|
||||
{
|
||||
if(role == Qt::DisplayRole)
|
||||
switch(section)
|
||||
@ -414,12 +416,12 @@ QVariant RsFriendListModel::textColorRole(const EntryIndex& fmpe,int column) con
|
||||
}
|
||||
}
|
||||
|
||||
QVariant RsFriendListModel::statusRole(const EntryIndex& fmpe,int column) const
|
||||
QVariant RsFriendListModel::statusRole(const EntryIndex& /*fmpe*/,int /*column*/) const
|
||||
{
|
||||
return QVariant();//fmpe.mMsgStatus);
|
||||
}
|
||||
|
||||
bool RsFriendListModel::passesFilter(const EntryIndex& e,int column) const
|
||||
bool RsFriendListModel::passesFilter(const EntryIndex& e,int /*column*/) const
|
||||
{
|
||||
QString s ;
|
||||
bool passes_strings = true ;
|
||||
@ -435,6 +437,8 @@ bool RsFriendListModel::passesFilter(const EntryIndex& e,int column) const
|
||||
if(s.isNull())
|
||||
passes_strings = false;
|
||||
break;
|
||||
case FILTER_TYPE_NONE:
|
||||
RS_ERR("None Type for Filter.");
|
||||
};
|
||||
}
|
||||
|
||||
@ -453,12 +457,9 @@ QVariant RsFriendListModel::filterRole(const EntryIndex& e,int column) const
|
||||
return QVariant(QString());
|
||||
}
|
||||
|
||||
uint32_t RsFriendListModel::updateFilterStatus(ForumModelIndex i,int column,const QStringList& strings)
|
||||
uint32_t RsFriendListModel::updateFilterStatus(ForumModelIndex /*i*/,int /*column*/,const QStringList& /*strings*/)
|
||||
{
|
||||
QString s ;
|
||||
uint32_t count = 0;
|
||||
|
||||
return count;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -479,7 +480,7 @@ void RsFriendListModel::setFilter(FilterType filter_type, const QStringList& str
|
||||
postMods();
|
||||
}
|
||||
|
||||
QVariant RsFriendListModel::toolTipRole(const EntryIndex& fmpe,int column) const
|
||||
QVariant RsFriendListModel::toolTipRole(const EntryIndex& /*fmpe*/,int /*column*/) const
|
||||
{
|
||||
return QVariant();
|
||||
}
|
||||
@ -542,7 +543,7 @@ QVariant RsFriendListModel::sortRole(const EntryIndex& entry,int column) const
|
||||
}
|
||||
}
|
||||
|
||||
QVariant RsFriendListModel::onlineRole(const EntryIndex& e, int col) const
|
||||
QVariant RsFriendListModel::onlineRole(const EntryIndex& e, int /*col*/) const
|
||||
{
|
||||
switch(e.type)
|
||||
{
|
||||
@ -698,7 +699,7 @@ QVariant RsFriendListModel::displayRole(const EntryIndex& e, int col) const
|
||||
if(col == COLUMN_THREAD_IP) return QVariant(most_recent_ip);
|
||||
}
|
||||
|
||||
}
|
||||
}// Fall-through
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
@ -826,7 +827,6 @@ const RsFriendListModel::HierarchicalNodeInformation *RsFriendListModel::getNode
|
||||
if(e.node_index >= mProfiles[pindex].child_node_indices.size())
|
||||
return NULL ;
|
||||
|
||||
time_t now = time(NULL);
|
||||
HierarchicalNodeInformation& node(mLocations[mProfiles[pindex].child_node_indices[e.node_index]]);
|
||||
|
||||
return &node;
|
||||
@ -895,8 +895,6 @@ void RsFriendListModel::clear()
|
||||
emit friendListChanged();
|
||||
}
|
||||
|
||||
static bool decreasing_time_comp(const std::pair<time_t,RsGxsMessageId>& e1,const std::pair<time_t,RsGxsMessageId>& e2) { return e2.first < e1.first ; }
|
||||
|
||||
void RsFriendListModel::debug_dump() const
|
||||
{
|
||||
std::cerr << "==== FriendListModel Debug dump ====" << std::endl;
|
||||
@ -1084,14 +1082,14 @@ void RsFriendListModel::updateInternalData()
|
||||
{
|
||||
preMods();
|
||||
|
||||
beginRemoveRows(QModelIndex(),0,mTopLevel.size()-1);
|
||||
beginResetModel();
|
||||
|
||||
mGroups.clear();
|
||||
mProfiles.clear();
|
||||
mLocations.clear();
|
||||
mTopLevel.clear();
|
||||
|
||||
endRemoveRows();
|
||||
endResetModel();
|
||||
|
||||
auto TL = mTopLevel ; // This allows to fill TL without touching mTopLevel outside of [begin/end]InsertRows().
|
||||
|
||||
@ -1220,11 +1218,13 @@ void RsFriendListModel::updateInternalData()
|
||||
|
||||
// finally, tell the model client that layout has changed.
|
||||
|
||||
beginInsertRows(QModelIndex(),0,TL.size()-1);
|
||||
|
||||
mTopLevel = TL;
|
||||
|
||||
if (TL.size()>0)
|
||||
{
|
||||
beginInsertRows(QModelIndex(),0,TL.size()-1);
|
||||
endInsertRows();
|
||||
}
|
||||
|
||||
postMods();
|
||||
|
||||
|
@ -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<QMouseEvent *>(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();
|
||||
|
@ -345,7 +345,11 @@ void RSGraphWidget::paintEvent(QPaintEvent *)
|
||||
_painter->setRenderHint(QPainter::TextAntialiasing);
|
||||
|
||||
/* Fill in the background */
|
||||
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,11 +653,18 @@ void RSGraphWidget::paintScale1()
|
||||
|
||||
QString text = _source->displayValue(scale) ;
|
||||
|
||||
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 */
|
||||
_painter->drawLine(SCALE_WIDTH*fact, top, SCALE_WIDTH*fact, bottom);
|
||||
@ -675,7 +686,9 @@ void RSGraphWidget::paintScale2()
|
||||
|
||||
int seconds = (_rec.width()-i)/_time_scale ; // pixels / (pixels per second) => seconds
|
||||
QString text = QString::number(seconds)+ " secs";
|
||||
|
||||
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,7 +756,9 @@ 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);
|
||||
|
||||
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) ;
|
||||
|
||||
|
@ -39,6 +39,9 @@
|
||||
#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
|
||||
|
||||
@ -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
|
||||
|
@ -37,7 +37,9 @@
|
||||
|
||||
Q_DECLARE_METATYPE(ChannelPostFileInfo)
|
||||
|
||||
#ifdef DEBUG_CHANNEL_MODEL
|
||||
static std::ostream& operator<<(std::ostream& o, const QModelIndex& i);// defined elsewhere
|
||||
#endif
|
||||
|
||||
RsGxsChannelPostFilesModel::RsGxsChannelPostFilesModel(QObject *parent)
|
||||
: QAbstractItemModel(parent)
|
||||
@ -50,30 +52,28 @@ RsGxsChannelPostFilesModel::RsGxsChannelPostFilesModel(QObject *parent)
|
||||
|
||||
void RsGxsChannelPostFilesModel::initEmptyHierarchy()
|
||||
{
|
||||
preMods();
|
||||
beginResetModel();
|
||||
|
||||
mFiles.clear();
|
||||
mFilteredFiles.clear();
|
||||
|
||||
postMods();
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
void RsGxsChannelPostFilesModel::preMods()
|
||||
{
|
||||
//emit layoutAboutToBeChanged(); //Generate SIGSEGV when click on button move next/prev.
|
||||
|
||||
beginResetModel();
|
||||
emit layoutAboutToBeChanged();
|
||||
}
|
||||
void RsGxsChannelPostFilesModel::postMods()
|
||||
{
|
||||
endResetModel();
|
||||
|
||||
emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(mFilteredFiles.size(),COLUMN_FILES_NB_COLUMNS-1,(void*)NULL));
|
||||
emit QAbstractItemModel::dataChanged(createIndex(0,0,(void*)NULL), createIndex(mFilteredFiles.size(),COLUMN_FILES_NB_COLUMNS-1,(void*)NULL));
|
||||
emit layoutChanged();
|
||||
}
|
||||
|
||||
void RsGxsChannelPostFilesModel::update()
|
||||
{
|
||||
emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(mFilteredFiles.size(),COLUMN_FILES_NB_COLUMNS-1,(void*)NULL));
|
||||
preMods();
|
||||
postMods();
|
||||
}
|
||||
|
||||
int RsGxsChannelPostFilesModel::rowCount(const QModelIndex& parent) const
|
||||
@ -87,7 +87,7 @@ int RsGxsChannelPostFilesModel::rowCount(const QModelIndex& parent) const
|
||||
if(!parent.isValid())
|
||||
return mFilteredFiles.size(); // mFilteredPosts always has an item at 0, so size()>=1, and mColumn>=1
|
||||
|
||||
RsErr() << __PRETTY_FUNCTION__ << " rowCount cannot figure out the porper number of rows." << std::endl;
|
||||
RS_ERR(" rowCount cannot figure out the proper number of rows.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -167,18 +167,15 @@ QModelIndex RsGxsChannelPostFilesModel::index(int row, int column, const QModelI
|
||||
return createIndex(row,column,ref) ;
|
||||
}
|
||||
|
||||
QModelIndex RsGxsChannelPostFilesModel::parent(const QModelIndex& index) const
|
||||
QModelIndex RsGxsChannelPostFilesModel::parent(const QModelIndex& /*index*/) const
|
||||
{
|
||||
if(!index.isValid())
|
||||
return QModelIndex();
|
||||
|
||||
return QModelIndex(); // there's no hierarchy here. So nothing to do!
|
||||
}
|
||||
|
||||
Qt::ItemFlags RsGxsChannelPostFilesModel::flags(const QModelIndex& index) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return 0;
|
||||
return Qt::ItemFlag();
|
||||
|
||||
if(index.column() == COLUMN_FILES_FILE)
|
||||
return QAbstractItemModel::flags(index) | Qt::ItemIsEditable;
|
||||
@ -221,15 +218,13 @@ quintptr RsGxsChannelPostFilesModel::getParentRow(quintptr ref,int& row) const
|
||||
|
||||
int RsGxsChannelPostFilesModel::getChildrenCount(quintptr ref) const
|
||||
{
|
||||
uint32_t entry = 0 ;
|
||||
|
||||
if(ref == quintptr(0))
|
||||
return rowCount()-1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
QVariant RsGxsChannelPostFilesModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
QVariant RsGxsChannelPostFilesModel::headerData(int section, Qt::Orientation /*orientation*/, int role) const
|
||||
{
|
||||
if (role != Qt::DisplayRole)
|
||||
return QVariant();
|
||||
@ -300,20 +295,15 @@ void RsGxsChannelPostFilesModel::setFilter(const QStringList& strings, uint32_t&
|
||||
{
|
||||
preMods();
|
||||
|
||||
beginRemoveRows(QModelIndex(),0,rowCount()-1);
|
||||
endRemoveRows();
|
||||
initEmptyHierarchy();
|
||||
|
||||
if(strings.empty())
|
||||
{
|
||||
mFilteredFiles.clear();
|
||||
for(uint32_t i=0;i<mFiles.size();++i)
|
||||
mFilteredFiles.push_back(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
mFilteredFiles.clear();
|
||||
//mFilteredPosts.push_back(0);
|
||||
|
||||
for(uint32_t i=0;i<mFiles.size();++i)
|
||||
{
|
||||
bool passes_strings = true;
|
||||
@ -329,8 +319,11 @@ void RsGxsChannelPostFilesModel::setFilter(const QStringList& strings, uint32_t&
|
||||
|
||||
std::cerr << "After filtering: " << count << " posts remain." << std::endl;
|
||||
|
||||
if (rowCount()>0)
|
||||
{
|
||||
beginInsertRows(QModelIndex(),0,rowCount()-1);
|
||||
endInsertRows();
|
||||
}
|
||||
|
||||
postMods();
|
||||
}
|
||||
@ -372,7 +365,7 @@ void RsGxsChannelPostFilesModel::sort(int column, Qt::SortOrder order)
|
||||
update();
|
||||
}
|
||||
|
||||
QVariant RsGxsChannelPostFilesModel::sizeHintRole(int col) const
|
||||
QVariant RsGxsChannelPostFilesModel::sizeHintRole(int /*col*/) const
|
||||
{
|
||||
float factor = QFontMetricsF(QApplication::font()).height()/14.0f ;
|
||||
|
||||
@ -435,11 +428,9 @@ QVariant RsGxsChannelPostFilesModel::userRole(const ChannelPostFileInfo& fmpe,in
|
||||
|
||||
void RsGxsChannelPostFilesModel::clear()
|
||||
{
|
||||
preMods();
|
||||
|
||||
initEmptyHierarchy();
|
||||
|
||||
postMods();
|
||||
emit channelLoaded();
|
||||
}
|
||||
|
||||
@ -447,9 +438,6 @@ void RsGxsChannelPostFilesModel::setFiles(const std::list<ChannelPostFileInfo> &
|
||||
{
|
||||
preMods();
|
||||
|
||||
beginRemoveRows(QModelIndex(),0,mFilteredFiles.size()-1);
|
||||
endRemoveRows();
|
||||
|
||||
initEmptyHierarchy();
|
||||
|
||||
for(auto& file:files)
|
||||
@ -462,10 +450,11 @@ void RsGxsChannelPostFilesModel::setFiles(const std::list<ChannelPostFileInfo> &
|
||||
// debug_dump();
|
||||
#endif
|
||||
|
||||
if (mFilteredFiles.size()>0)
|
||||
{
|
||||
beginInsertRows(QModelIndex(),0,mFilteredFiles.size()-1);
|
||||
endInsertRows();
|
||||
|
||||
postMods();
|
||||
}
|
||||
|
||||
emit channelLoaded();
|
||||
|
||||
@ -473,4 +462,6 @@ void RsGxsChannelPostFilesModel::setFiles(const std::list<ChannelPostFileInfo> &
|
||||
mTimer->start(5000);
|
||||
else
|
||||
mTimer->stop();
|
||||
|
||||
postMods();
|
||||
}
|
||||
|
@ -203,23 +203,22 @@ void RsGxsChannelPostsModel::handleEvent_main_thread(std::shared_ptr<const RsEve
|
||||
|
||||
void RsGxsChannelPostsModel::initEmptyHierarchy()
|
||||
{
|
||||
preMods();
|
||||
beginResetModel();
|
||||
|
||||
mPosts.clear();
|
||||
mFilteredPosts.clear();
|
||||
|
||||
postMods();
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
void RsGxsChannelPostsModel::preMods()
|
||||
{
|
||||
beginResetModel();
|
||||
emit layoutAboutToBeChanged();
|
||||
}
|
||||
void RsGxsChannelPostsModel::postMods()
|
||||
{
|
||||
endResetModel();
|
||||
|
||||
triggerViewUpdate();
|
||||
emit layoutChanged();
|
||||
}
|
||||
void RsGxsChannelPostsModel::triggerViewUpdate()
|
||||
{
|
||||
@ -246,11 +245,11 @@ void RsGxsChannelPostsModel::setFilter(const QStringList& strings,bool only_unre
|
||||
{
|
||||
preMods();
|
||||
|
||||
beginRemoveRows(QModelIndex(),0,rowCount()-1);
|
||||
endRemoveRows();
|
||||
beginResetModel();
|
||||
|
||||
mFilteredPosts.clear();
|
||||
//mFilteredPosts.push_back(0);
|
||||
endResetModel();
|
||||
|
||||
for(size_t i=0;i<mPosts.size();++i)
|
||||
{
|
||||
@ -268,8 +267,11 @@ void RsGxsChannelPostsModel::setFilter(const QStringList& strings,bool only_unre
|
||||
|
||||
count = mFilteredPosts.size();
|
||||
|
||||
if (rowCount()>0)
|
||||
{
|
||||
beginInsertRows(QModelIndex(),0,rowCount()-1);
|
||||
endInsertRows();
|
||||
}
|
||||
|
||||
postMods();
|
||||
}
|
||||
@ -374,18 +376,15 @@ QModelIndex RsGxsChannelPostsModel::index(int row, int column, const QModelIndex
|
||||
return createIndex(row,column,ref) ;
|
||||
}
|
||||
|
||||
QModelIndex RsGxsChannelPostsModel::parent(const QModelIndex& index) const
|
||||
QModelIndex RsGxsChannelPostsModel::parent(const QModelIndex& /*index*/) const
|
||||
{
|
||||
if(!index.isValid())
|
||||
return QModelIndex();
|
||||
|
||||
return QModelIndex(); // there's no hierarchy here. So nothing to do!
|
||||
}
|
||||
|
||||
Qt::ItemFlags RsGxsChannelPostsModel::flags(const QModelIndex& index) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return 0;
|
||||
return Qt::ItemFlags();
|
||||
|
||||
return QAbstractItemModel::flags(index);
|
||||
}
|
||||
@ -402,13 +401,16 @@ bool RsGxsChannelPostsModel::setNumColumns(int n)
|
||||
|
||||
preMods();
|
||||
|
||||
beginRemoveRows(QModelIndex(),0,rowCount()-1);
|
||||
endRemoveRows();
|
||||
beginResetModel();
|
||||
endResetModel();
|
||||
|
||||
mColumns = n;
|
||||
|
||||
if (rowCount()>0)
|
||||
{
|
||||
beginInsertRows(QModelIndex(),0,rowCount()-1);
|
||||
endInsertRows();
|
||||
}
|
||||
|
||||
postMods();
|
||||
|
||||
@ -551,7 +553,6 @@ void RsGxsChannelPostsModel::clear()
|
||||
{
|
||||
preMods();
|
||||
|
||||
mPosts.clear();
|
||||
initEmptyHierarchy();
|
||||
|
||||
postMods();
|
||||
@ -567,17 +568,13 @@ void RsGxsChannelPostsModel::setPosts(const RsGxsChannelGroup& group, std::vecto
|
||||
{
|
||||
preMods();
|
||||
|
||||
beginRemoveRows(QModelIndex(),0,rowCount()-1);
|
||||
endRemoveRows();
|
||||
|
||||
mPosts.clear();
|
||||
initEmptyHierarchy();
|
||||
mChannelGroup = group;
|
||||
|
||||
createPostsArray(posts);
|
||||
|
||||
std::sort(mPosts.begin(),mPosts.end());
|
||||
|
||||
mFilteredPosts.clear();
|
||||
for(uint32_t i=0;i<mPosts.size();++i)
|
||||
mFilteredPosts.push_back(i);
|
||||
|
||||
@ -585,8 +582,11 @@ void RsGxsChannelPostsModel::setPosts(const RsGxsChannelGroup& group, std::vecto
|
||||
// debug_dump();
|
||||
#endif
|
||||
|
||||
if (rowCount()>0)
|
||||
{
|
||||
beginInsertRows(QModelIndex(),0,rowCount()-1);
|
||||
endInsertRows();
|
||||
}
|
||||
|
||||
postMods();
|
||||
|
||||
|
@ -238,7 +238,7 @@ void ChannelPostDelegate::paint(QPainter * painter, const QStyleOptionViewItem &
|
||||
info_text += ", " + QString::number(post.mAttachmentCount)+ " " +((post.mAttachmentCount>1)?tr("files"):tr("file")) + " (" + misc::friendlyUnit(qulonglong(post.mSize)) + ")" ;
|
||||
|
||||
painter->drawText(QPoint(p.x()+0.5*font_height,y),info_text);
|
||||
y += font_height;
|
||||
//y += font_height;
|
||||
|
||||
painter->restore();
|
||||
}
|
||||
@ -400,21 +400,21 @@ GxsChannelPostsWidgetWithModel::GxsChannelPostsWidgetWithModel(const RsGxsGroupI
|
||||
ui->channelPostFiles_TV->setItemDelegate(new ChannelPostFilesDelegate(this));
|
||||
ui->channelPostFiles_TV->setPlaceholderText(tr("No files in this post, or no post selected"));
|
||||
ui->channelPostFiles_TV->setSortingEnabled(true);
|
||||
ui->channelPostFiles_TV->sortByColumn(3, Qt::AscendingOrder); // sort by time
|
||||
ui->channelPostFiles_TV->sortByColumn(RsGxsChannelPostFilesModel::COLUMN_FILES_DATE, Qt::DescendingOrder); // sort by time
|
||||
ui->channelPostFiles_TV->setAlternatingRowColors(false);
|
||||
|
||||
ui->channelFiles_TV->setModel(mChannelFilesModel = new RsGxsChannelPostFilesModel());
|
||||
ui->channelFiles_TV->setItemDelegate(mFilesDelegate = new ChannelPostFilesDelegate(this));
|
||||
ui->channelFiles_TV->setPlaceholderText(tr("No files in the channel, or no channel selected"));
|
||||
ui->channelFiles_TV->setSortingEnabled(true);
|
||||
ui->channelFiles_TV->sortByColumn(RsGxsChannelPostFilesModel::COLUMN_FILES_DATE, Qt::DescendingOrder); // sort by time
|
||||
|
||||
connect(ui->channelPostFiles_TV->header(),SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), this, SLOT(sortColumnPostFiles(int,Qt::SortOrder)));
|
||||
connect(ui->channelFiles_TV->header(),SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), this, SLOT(sortColumnFiles(int,Qt::SortOrder)));
|
||||
|
||||
connect(ui->channelPostFiles_TV,SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showChannelFilesContextMenu(QPoint)));
|
||||
connect(ui->channelFiles_TV,SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showChannelFilesContextMenu(QPoint)));
|
||||
|
||||
ui->channelFiles_TV->setModel(mChannelFilesModel = new RsGxsChannelPostFilesModel());
|
||||
ui->channelFiles_TV->setItemDelegate(mFilesDelegate = new ChannelPostFilesDelegate(this));
|
||||
ui->channelFiles_TV->setPlaceholderText(tr("No files in the channel, or no channel selected"));
|
||||
ui->channelFiles_TV->setSortingEnabled(true);
|
||||
ui->channelFiles_TV->sortByColumn(3, Qt::AscendingOrder); // sort by time
|
||||
|
||||
connect(ui->postsTree->selectionModel(),SIGNAL(selectionChanged(const QItemSelection&,const QItemSelection&)),this,SLOT(showPostDetails()));
|
||||
connect(ui->postsTree,SIGNAL(customContextMenuRequested(const QPoint&)),this,SLOT(postContextMenu(const QPoint&)));
|
||||
|
||||
@ -666,7 +666,7 @@ void GxsChannelPostsWidgetWithModel::download()
|
||||
std::string destination;
|
||||
rsGxsChannels->getChannelDownloadDirectory(mGroup.mMeta.mGroupId,destination);
|
||||
|
||||
for(auto file:post.mFiles)
|
||||
for(auto& file:post.mFiles)
|
||||
{
|
||||
std::list<RsPeerId> sources;
|
||||
|
||||
@ -940,7 +940,8 @@ void GxsChannelPostsWidgetWithModel::postChannelPostLoad()
|
||||
mChannelFilesModel->setFiles(files);
|
||||
|
||||
ui->channelFiles_TV->setAutoSelect(true);
|
||||
ui->channelFiles_TV->sortByColumn(3, Qt::AscendingOrder);
|
||||
ui->channelFiles_TV->sortByColumn(ui->channelFiles_TV->header()->sortIndicatorSection()
|
||||
,ui->channelFiles_TV->header()->sortIndicatorOrder());
|
||||
|
||||
ui->infoPosts->setText(QString::number(mChannelPostsModel->getNumberOfPosts()) + " / " + QString::number(mGroup.mMeta.mVisibleMsgCount));
|
||||
|
||||
@ -1206,11 +1207,11 @@ void GxsChannelPostsWidgetWithModel::insertChannelDetails(const RsGxsChannelGrou
|
||||
|
||||
QString distrib_string ( "[unknown]" );
|
||||
|
||||
switch(group.mMeta.mCircleType)
|
||||
switch((RsGxsCircleType)group.mMeta.mCircleType)
|
||||
{
|
||||
case GXS_CIRCLE_TYPE_PUBLIC: distrib_string = tr("Public") ;
|
||||
case RsGxsCircleType::PUBLIC: distrib_string = tr("Public") ;
|
||||
break ;
|
||||
case GXS_CIRCLE_TYPE_EXTERNAL:
|
||||
case RsGxsCircleType::EXTERNAL:
|
||||
{
|
||||
RsGxsCircleDetails det ;
|
||||
|
||||
@ -1222,9 +1223,9 @@ void GxsChannelPostsWidgetWithModel::insertChannelDetails(const RsGxsChannelGrou
|
||||
distrib_string = tr("Restricted to members of circle ")+QString::fromStdString(group.mMeta.mCircleId.toStdString()) ;
|
||||
}
|
||||
break ;
|
||||
case GXS_CIRCLE_TYPE_YOUR_EYES_ONLY: distrib_string = tr("Your eyes only");
|
||||
case RsGxsCircleType::YOUR_EYES_ONLY: distrib_string = tr("Your eyes only");
|
||||
break ;
|
||||
case GXS_CIRCLE_TYPE_LOCAL: distrib_string = tr("You and your friend nodes");
|
||||
case RsGxsCircleType::LOCAL: distrib_string = tr("You and your friend nodes");
|
||||
break ;
|
||||
default:
|
||||
std::cerr << "(EE) badly initialised group distribution ID = " << group.mMeta.mCircleType << std::endl;
|
||||
@ -1245,7 +1246,7 @@ void GxsChannelPostsWidgetWithModel::insertChannelDetails(const RsGxsChannelGrou
|
||||
showPostDetails();
|
||||
}
|
||||
|
||||
void GxsChannelPostsWidgetWithModel::showChannelFilesContextMenu(QPoint p)
|
||||
void GxsChannelPostsWidgetWithModel::showChannelFilesContextMenu(QPoint /*p*/)
|
||||
{
|
||||
QMenu contextMnu(this) ;
|
||||
|
||||
@ -1316,7 +1317,7 @@ void GxsChannelPostsWidgetWithModel::switchOnlyUnread(bool)
|
||||
}
|
||||
void GxsChannelPostsWidgetWithModel::filterChanged(QString s)
|
||||
{
|
||||
QStringList ql = s.split(' ',QString::SkipEmptyParts);
|
||||
QStringList ql = s.split(' ',Qt::SkipEmptyParts);
|
||||
uint32_t count;
|
||||
mChannelPostsModel->setFilter(ql,ui->showUnread_TB->isChecked(),count);
|
||||
mChannelFilesModel->setFilter(ql,count);
|
||||
@ -1419,7 +1420,7 @@ void GxsChannelPostsWidgetWithModel::toggleAutoDownload()
|
||||
class GxsChannelPostsReadData
|
||||
{
|
||||
public:
|
||||
GxsChannelPostsReadData(bool read)
|
||||
explicit GxsChannelPostsReadData(bool read)
|
||||
{
|
||||
mRead = read;
|
||||
mLastToken = 0;
|
||||
|
@ -50,18 +50,16 @@ RsGxsForumModel::RsGxsForumModel(QObject *parent)
|
||||
|
||||
void RsGxsForumModel::preMods()
|
||||
{
|
||||
//emit layoutAboutToBeChanged(); //Generate SIGSEGV when click on button move next/prev.
|
||||
|
||||
beginResetModel();
|
||||
emit layoutAboutToBeChanged();
|
||||
}
|
||||
void RsGxsForumModel::postMods()
|
||||
{
|
||||
endResetModel();
|
||||
|
||||
if(mTreeMode == TREE_MODE_FLAT)
|
||||
emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(mPosts.size(),COLUMN_THREAD_NB_COLUMNS-1,(void*)NULL));
|
||||
else
|
||||
emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(mPosts[0].mChildren.size(),COLUMN_THREAD_NB_COLUMNS-1,(void*)NULL));
|
||||
|
||||
emit layoutChanged();
|
||||
}
|
||||
|
||||
void RsGxsForumModel::setTreeMode(TreeMode mode)
|
||||
@ -71,19 +69,11 @@ void RsGxsForumModel::setTreeMode(TreeMode mode)
|
||||
|
||||
preMods();
|
||||
|
||||
if(mode == TREE_MODE_TREE) // means we were in FLAT mode, so the last rows are removed.
|
||||
{
|
||||
beginRemoveRows(QModelIndex(),mPosts[0].mChildren.size(),mPosts.size()-1);
|
||||
endRemoveRows();
|
||||
}
|
||||
beginResetModel();
|
||||
|
||||
mTreeMode = mode;
|
||||
|
||||
if(mode == TREE_MODE_FLAT) // means we were in tree mode, so the last rows are added.
|
||||
{
|
||||
beginInsertRows(QModelIndex(),mPosts[0].mChildren.size(),mPosts.size()-1);
|
||||
endInsertRows();
|
||||
}
|
||||
endResetModel();
|
||||
|
||||
postMods();
|
||||
}
|
||||
@ -241,7 +231,7 @@ QModelIndex RsGxsForumModel::parent(const QModelIndex& index) const
|
||||
Qt::ItemFlags RsGxsForumModel::flags(const QModelIndex& index) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return 0;
|
||||
return Qt::ItemFlags();
|
||||
|
||||
return QAbstractItemModel::flags(index);
|
||||
}
|
||||
@ -757,12 +747,8 @@ void RsGxsForumModel::setPosts(const RsGxsForumGroup& group, const std::vector<F
|
||||
{
|
||||
preMods();
|
||||
|
||||
if(mTreeMode == TREE_MODE_FLAT)
|
||||
beginRemoveRows(QModelIndex(),0,mPosts.size()-1);
|
||||
else
|
||||
beginRemoveRows(QModelIndex(),0,mPosts[0].mChildren.size()-1);
|
||||
|
||||
endRemoveRows();
|
||||
beginResetModel();
|
||||
endResetModel();
|
||||
|
||||
mForumGroup = group;
|
||||
mPosts = posts;
|
||||
@ -785,11 +771,18 @@ void RsGxsForumModel::setPosts(const RsGxsForumGroup& group, const std::vector<F
|
||||
debug_dump();
|
||||
#endif
|
||||
|
||||
int count = 0;
|
||||
if(mTreeMode == TREE_MODE_FLAT)
|
||||
beginInsertRows(QModelIndex(),0,mPosts.size()-1);
|
||||
count = mPosts.size();
|
||||
else
|
||||
beginInsertRows(QModelIndex(),0,mPosts[0].mChildren.size()-1);
|
||||
count = mPosts[0].mChildren.size();
|
||||
|
||||
if(count>0)
|
||||
{
|
||||
beginInsertRows(QModelIndex(),0,count-1);
|
||||
endInsertRows();
|
||||
}
|
||||
|
||||
postMods();
|
||||
emit forumLoaded();
|
||||
}
|
||||
@ -898,7 +891,6 @@ void RsGxsForumModel::computeReputationLevel(uint32_t forum_sign_flags,ForumMode
|
||||
uint32_t idflags =0;
|
||||
RsReputationLevel reputation_level =
|
||||
rsReputations->overallReputationLevel(fentry.mAuthorId, &idflags);
|
||||
bool redacted = false;
|
||||
|
||||
if(reputation_level == RsReputationLevel::LOCALLY_NEGATIVE)
|
||||
fentry.mPostFlags |= ForumModelPostEntry::FLAG_POST_IS_REDACTED;
|
||||
|
@ -33,48 +33,48 @@
|
||||
<td> </td>
|
||||
<td>Homepage</td>
|
||||
<td>
|
||||
<a href="http://retroshare.sourceforge.net">
|
||||
http://retroshare.sourceforge.net</a>
|
||||
<a href="https://retroshare.cc/">
|
||||
https://retroshare.cc/</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td>RetroShare Forum</td>
|
||||
<td>Blog</td>
|
||||
<td>
|
||||
<a href="http://retroshare.sourceforge.net/forum">
|
||||
http://retroshare.sourceforge.net/forum</a>
|
||||
<a href="https://retroshareteam.wordpress.com/">
|
||||
https://retroshareteam.wordpress.com/</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td>RetroShare Wiki</td>
|
||||
<td>
|
||||
<a href="http://retroshare.sourceforge.net/wiki">
|
||||
http://retroshare.sourceforge.net/wiki</a>
|
||||
<a href="https://retroshare.readthedocs.io/en/latest/">
|
||||
https://retroshare.readthedocs.io/en/latest/</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td>Project Page</td>
|
||||
<td>
|
||||
<a href="http://sourceforge.net/projects/retroshare">
|
||||
http://sourceforge.net/projects/retroshare</a>
|
||||
<a href="https://github.com/RetroShare/RetroShare">
|
||||
https://github.com/RetroShare/RetroShare</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td>Bugtracker</td>
|
||||
<td>
|
||||
<a href="http://sourceforge.net/tracker/?group_id=178712&atid=886239">
|
||||
http://sourceforge.net/tracker/?group_id=178712&atid=886239</a>
|
||||
<a href="https://github.com/RetroShare/RetroShare/issues">
|
||||
https://github.com/RetroShare/RetroShare/issues</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td>Translation</td>
|
||||
<td>
|
||||
<a href="http://retroshare.sourceforge.net/wiki/index.php/Translation">
|
||||
http://retroshare.sourceforge.net/wiki/index.php/Translation</a>
|
||||
<a href="https://www.transifex.com/beluga/retroshare/">
|
||||
https://www.transifex.com/beluga/retroshare/</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -53,6 +53,7 @@
|
||||
<file>icons/gmail.png</file>
|
||||
<file>icons/help_128.png</file>
|
||||
<file>icons/help_64.png</file>
|
||||
<file>icons/identities.png</file>
|
||||
<file>icons/information_128.png</file>
|
||||
<file>icons/internet_128.png</file>
|
||||
<file>icons/invite64.png</file>
|
||||
|
BIN
retroshare-gui/src/gui/icons/identities.png
Normal file
BIN
retroshare-gui/src/gui/icons/identities.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.7 KiB |
@ -22,6 +22,7 @@
|
||||
#include <QMessageBox>
|
||||
#include <QCloseEvent>
|
||||
#include <QClipboard>
|
||||
#include <QLabel>
|
||||
#include <QTextCodec>
|
||||
#include <QPrintDialog>
|
||||
#include <QPrinter>
|
||||
@ -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()));
|
||||
@ -379,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)
|
||||
{
|
||||
@ -396,6 +410,7 @@ void MessageComposer::updateCells(int,int)
|
||||
ui.respond_to_CB->show();
|
||||
ui.distantFrame->show();
|
||||
ui.fromLabel->show();
|
||||
checkLength();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2853,3 +2868,30 @@ 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(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);
|
||||
}
|
||||
}
|
||||
|
@ -168,6 +168,8 @@ private slots:
|
||||
|
||||
static QString inviteMessage();
|
||||
|
||||
void checkLength();
|
||||
|
||||
private:
|
||||
static QString buildReplyHeader(const MessageInfo &msgInfo);
|
||||
|
||||
@ -257,6 +259,12 @@ private:
|
||||
RSTreeWidgetItemCompareRole *m_compareRole;
|
||||
QCompleter *m_completer;
|
||||
|
||||
QLabel *infoLabel;
|
||||
QLabel *lengthLabel;
|
||||
QLabel *lineLabel;
|
||||
|
||||
bool has_gxs;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::MessageComposer ui;
|
||||
|
||||
|
@ -66,6 +66,7 @@ void RsMessageModel::preMods()
|
||||
void RsMessageModel::postMods()
|
||||
{
|
||||
emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(mMessages.size()-1,COLUMN_THREAD_NB_COLUMNS-1,(void*)NULL));
|
||||
emit layoutChanged();
|
||||
}
|
||||
|
||||
int RsMessageModel::rowCount(const QModelIndex& parent) const
|
||||
@ -85,7 +86,7 @@ int RsMessageModel::rowCount(const QModelIndex& parent) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
int RsMessageModel::columnCount(const QModelIndex &parent) const
|
||||
int RsMessageModel::columnCount(const QModelIndex &/*parent*/) const
|
||||
{
|
||||
return COLUMN_THREAD_NB_COLUMNS ;
|
||||
}
|
||||
@ -154,12 +155,12 @@ QModelIndex RsMessageModel::parent(const QModelIndex& index) const
|
||||
Qt::ItemFlags RsMessageModel::flags(const QModelIndex& index) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return 0;
|
||||
return Qt::ItemFlags();
|
||||
|
||||
return QAbstractItemModel::flags(index);
|
||||
}
|
||||
|
||||
QVariant RsMessageModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
QVariant RsMessageModel::headerData(int section, Qt::Orientation /*orientation*/, int role) const
|
||||
{
|
||||
if(role == Qt::DisplayRole)
|
||||
switch(section)
|
||||
@ -274,7 +275,7 @@ QVariant RsMessageModel::data(const QModelIndex &index, int role) const
|
||||
}
|
||||
}
|
||||
|
||||
QVariant RsMessageModel::textColorRole(const Rs::Msgs::MsgInfoSummary& fmpe,int column) const
|
||||
QVariant RsMessageModel::textColorRole(const Rs::Msgs::MsgInfoSummary& fmpe,int /*column*/) const
|
||||
{
|
||||
Rs::Msgs::MsgTagType tags;
|
||||
rsMsgs->getMessageTagTypes(tags);
|
||||
@ -287,7 +288,7 @@ QVariant RsMessageModel::textColorRole(const Rs::Msgs::MsgInfoSummary& fmpe,int
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
QVariant RsMessageModel::statusRole(const Rs::Msgs::MsgInfoSummary& fmpe,int column) const
|
||||
QVariant RsMessageModel::statusRole(const Rs::Msgs::MsgInfoSummary& /*fmpe*/,int /*column*/) const
|
||||
{
|
||||
// if(column != COLUMN_THREAD_DATA)
|
||||
// return QVariant();
|
||||
@ -295,7 +296,7 @@ QVariant RsMessageModel::statusRole(const Rs::Msgs::MsgInfoSummary& fmpe,int col
|
||||
return QVariant();//fmpe.mMsgStatus);
|
||||
}
|
||||
|
||||
bool RsMessageModel::passesFilter(const Rs::Msgs::MsgInfoSummary& fmpe,int column) const
|
||||
bool RsMessageModel::passesFilter(const Rs::Msgs::MsgInfoSummary& fmpe,int /*column*/) const
|
||||
{
|
||||
QString s ;
|
||||
bool passes_strings = true ;
|
||||
@ -330,6 +331,9 @@ bool RsMessageModel::passesFilter(const Rs::Msgs::MsgInfoSummary& fmpe,int colum
|
||||
for(auto it(minfo.files.begin());it!=minfo.files.end();++it)
|
||||
s += QString::fromUtf8((*it).fname.c_str())+" ";
|
||||
}
|
||||
break;
|
||||
case FILTER_TYPE_NONE:
|
||||
RS_ERR("None Type for Filter.");
|
||||
};
|
||||
}
|
||||
|
||||
@ -361,12 +365,9 @@ QVariant RsMessageModel::filterRole(const Rs::Msgs::MsgInfoSummary& fmpe,int col
|
||||
return QVariant(QString());
|
||||
}
|
||||
|
||||
uint32_t RsMessageModel::updateFilterStatus(ForumModelIndex i,int column,const QStringList& strings)
|
||||
uint32_t RsMessageModel::updateFilterStatus(ForumModelIndex /*i*/,int /*column*/,const QStringList& /*strings*/)
|
||||
{
|
||||
QString s ;
|
||||
uint32_t count = 0;
|
||||
|
||||
return count;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -408,7 +409,7 @@ QVariant RsMessageModel::toolTipRole(const Rs::Msgs::MsgInfoSummary& fmpe,int co
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
QVariant RsMessageModel::backgroundRole(const Rs::Msgs::MsgInfoSummary &fmpe, int column) const
|
||||
QVariant RsMessageModel::backgroundRole(const Rs::Msgs::MsgInfoSummary &/*fmpe*/, int /*column*/) const
|
||||
{
|
||||
return QVariant();
|
||||
}
|
||||
@ -426,7 +427,7 @@ QVariant RsMessageModel::sizeHintRole(int col) const
|
||||
}
|
||||
}
|
||||
|
||||
QVariant RsMessageModel::authorRole(const Rs::Msgs::MsgInfoSummary& fmpe,int column) const
|
||||
QVariant RsMessageModel::authorRole(const Rs::Msgs::MsgInfoSummary& /*fmpe*/,int /*column*/) const
|
||||
{
|
||||
return QVariant();
|
||||
}
|
||||
@ -448,6 +449,7 @@ QVariant RsMessageModel::sortRole(const Rs::Msgs::MsgInfoSummary& fmpe,int colum
|
||||
|
||||
if(GxsIdTreeItemDelegate::computeName(RsGxsId(fmpe.srcId.toStdString()),name))
|
||||
return name;
|
||||
return ""; //Not Found
|
||||
}
|
||||
default:
|
||||
return displayRole(fmpe,column);
|
||||
@ -574,7 +576,10 @@ void RsMessageModel::clear()
|
||||
{
|
||||
preMods();
|
||||
|
||||
beginResetModel();
|
||||
mMessages.clear();
|
||||
mMessagesMap.clear();
|
||||
endResetModel();
|
||||
|
||||
postMods();
|
||||
|
||||
@ -583,13 +588,8 @@ void RsMessageModel::clear()
|
||||
|
||||
void RsMessageModel::setMessages(const std::list<Rs::Msgs::MsgInfoSummary>& msgs)
|
||||
{
|
||||
preMods();
|
||||
|
||||
beginRemoveRows(QModelIndex(),0,mMessages.size()-1);
|
||||
endRemoveRows();
|
||||
|
||||
mMessages.clear();
|
||||
mMessagesMap.clear();
|
||||
clear();
|
||||
|
||||
for(auto it(msgs.begin());it!=msgs.end();++it)
|
||||
{
|
||||
@ -603,9 +603,11 @@ void RsMessageModel::setMessages(const std::list<Rs::Msgs::MsgInfoSummary>& msgs
|
||||
debug_dump();
|
||||
#endif
|
||||
|
||||
if (mMessages.size()>0)
|
||||
{
|
||||
beginInsertRows(QModelIndex(),0,mMessages.size()-1);
|
||||
endInsertRows();
|
||||
postMods();
|
||||
}
|
||||
|
||||
emit messagesLoaded();
|
||||
}
|
||||
@ -672,8 +674,6 @@ void RsMessageModel::updateMessages()
|
||||
emit messagesLoaded();
|
||||
}
|
||||
|
||||
static bool decreasing_time_comp(const std::pair<time_t,RsGxsMessageId>& e1,const std::pair<time_t,RsGxsMessageId>& e2) { return e2.first < e1.first ; }
|
||||
|
||||
void RsMessageModel::setMsgReadStatus(const QModelIndex& i,bool read_status)
|
||||
{
|
||||
if(!i.isValid())
|
||||
|
@ -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);
|
||||
}
|
@ -86,6 +86,7 @@ private slots:
|
||||
void loadImagesAlways();
|
||||
void buttonStyle();
|
||||
void viewSource();
|
||||
void checkLength();
|
||||
|
||||
private:
|
||||
void clearTagLabels();
|
||||
|
@ -621,7 +621,7 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
@ -682,6 +682,27 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Message Size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="sizeLabel">
|
||||
<property name="text">
|
||||
<string>Size</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="filesHSpacer">
|
||||
<property name="orientation">
|
||||
|
@ -18,7 +18,7 @@
|
||||
</property>
|
||||
<widget class="QWidget" name="tabFeed">
|
||||
<attribute name="title">
|
||||
<string>Log</string>
|
||||
<string>Activity</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="tabFeedVLayout">
|
||||
<item>
|
||||
|
@ -602,6 +602,6 @@ BWGraph::BWGraph(QWidget *parent) : RSGraphWidget(parent)
|
||||
|
||||
BWGraph::~BWGraph()
|
||||
{
|
||||
delete _local_source ;
|
||||
//delete _local_source ;//Will be deleted by RSGraphWidget destructor
|
||||
}
|
||||
|
||||
|
@ -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))))
|
||||
|
||||
@ -133,6 +135,19 @@ BandwidthGraph::loadSettings()
|
||||
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()) ;
|
||||
ui.frmGraph->setShowEntry(1,ui.chkSendRate->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();
|
||||
|
@ -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);
|
||||
|
@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>414</width>
|
||||
<width>418</width>
|
||||
<height>305</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -24,7 +24,16 @@
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</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>
|
||||
</property>
|
||||
<item>
|
||||
@ -69,13 +78,13 @@
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>355</width>
|
||||
<width>400</width>
|
||||
<height>82</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>355</width>
|
||||
<width>400</width>
|
||||
<height>82</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -88,19 +97,34 @@
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="topMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item row="0" column="0" rowspan="2">
|
||||
<layout class="QVBoxLayout" name="_2">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -166,12 +190,21 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<item row="0" column="1" rowspan="2">
|
||||
<layout class="QVBoxLayout" name="_3">
|
||||
<property name="spacing">
|
||||
<number>1</number>
|
||||
</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>
|
||||
</property>
|
||||
<item>
|
||||
@ -179,7 +212,16 @@
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</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>
|
||||
</property>
|
||||
<item>
|
||||
@ -224,6 +266,20 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="cmbGraphColor">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Default</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Dark</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
@ -241,7 +297,16 @@
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</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>
|
||||
</property>
|
||||
<item>
|
||||
@ -299,7 +364,16 @@
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</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>
|
||||
</property>
|
||||
<item>
|
||||
@ -377,25 +451,21 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<item row="0" column="4" rowspan="2">
|
||||
<layout class="QVBoxLayout" name="_7">
|
||||
<property name="spacing">
|
||||
<number>1</number>
|
||||
</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>
|
||||
</property>
|
||||
<item>
|
||||
@ -414,6 +484,19 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -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")) ;
|
||||
@ -49,6 +52,9 @@ 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
|
||||
|
||||
@ -58,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
|
||||
|
||||
@ -65,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)
|
||||
@ -74,6 +120,7 @@ void BandwidthStatsWidget::toggleLogScale(bool b)
|
||||
else
|
||||
ui.bwgraph_BW->resetFlags(RSGraphWidget::RSGRAPH_FLAGS_LOG_SCALE_Y) ;
|
||||
}
|
||||
|
||||
void BandwidthStatsWidget::updateComboBoxes()
|
||||
{
|
||||
if(!isVisible())
|
||||
@ -233,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);
|
||||
}
|
||||
|
@ -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 ;
|
||||
|
@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1148</width>
|
||||
<width>800</width>
|
||||
<height>385</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -140,6 +140,20 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="cmbGraphColor">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Default</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Dark</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>760</width>
|
||||
<height>603</height>
|
||||
<height>500</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -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());
|
||||
|
||||
}
|
||||
|
||||
|
@ -6,43 +6,19 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1468</width>
|
||||
<height>659</height>
|
||||
<width>800</width>
|
||||
<height>429</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Router Statistics</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<item row="0" column="0">
|
||||
<widget class="QSplitter" name="splitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<widget class="QScrollArea" name="_router_F">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1450</width>
|
||||
<height>317</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>GroupBox</string>
|
||||
@ -120,6 +96,28 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QScrollArea" name="_router_F">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>782</width>
|
||||
<height>69</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1468</width>
|
||||
<height>779</height>
|
||||
<width>800</width>
|
||||
<height>500</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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"
|
||||
|
@ -15,7 +15,16 @@
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<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>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
@ -45,7 +54,6 @@
|
||||
<attribute name="toolBarBreak">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<addaction name="separator"/>
|
||||
</widget>
|
||||
<action name="actionAdd_Friend">
|
||||
<property name="icon">
|
||||
@ -61,7 +69,7 @@
|
||||
</action>
|
||||
<action name="actionAdd_Share">
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/images/add-share24.png</normaloff>:/images/add-share24.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -79,7 +87,7 @@
|
||||
</action>
|
||||
<action name="actionMessenger">
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/images/messenger.png</normaloff>:/images/messenger.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -105,7 +113,7 @@
|
||||
</action>
|
||||
<action name="actionQuit">
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/images/exit_24x24.png</normaloff>:/images/exit_24x24.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
|
@ -203,6 +203,13 @@ TurtleRouterStatistics::TurtleRouterStatistics(QWidget *parent)
|
||||
|
||||
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());
|
||||
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>680</width>
|
||||
<height>523</height>
|
||||
<height>500</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -29,15 +29,15 @@
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="handleWidth">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<widget class="QScrollArea" name="_tunnel_statistics_F">
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>200</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
@ -47,18 +47,12 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>640</width>
|
||||
<height>248</height>
|
||||
<width>636</width>
|
||||
<height>198</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="TurtleGraph" name="frmGraph" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@ -70,6 +64,7 @@
|
||||
<enum>Qt::NoContextMenu</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
#include <QApplication>
|
||||
#include <gui/common/RSGraphWidget.h>
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
|
||||
#include <retroshare/rsdht.h>
|
||||
#include <retroshare/rsconfig.h>
|
||||
@ -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);
|
||||
}
|
||||
};
|
||||
|
@ -20,6 +20,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
|
||||
#include "retroshare/rsturtle.h"
|
||||
#include <gui/common/RSGraphWidget.h>
|
||||
|
||||
@ -69,6 +71,13 @@ class TurtleGraph: public RSGraphWidget
|
||||
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::RSGRAPH_FLAGS_DARK_STYLE);
|
||||
else
|
||||
setFlags(RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -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));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user