diff --git a/build_scripts/Debian+Ubuntu/changelog b/build_scripts/Debian+Ubuntu/changelog index 867933372..d3a6ba8fd 100644 --- a/build_scripts/Debian+Ubuntu/changelog +++ b/build_scripts/Debian+Ubuntu/changelog @@ -1,5 +1,46 @@ retroshare06 (0.6.0-1.XXXXXX~YYYYYY) YYYYYY; urgency=low + f13c81b csoler Sat, 23 Jan 2016 13:17:12 -0500 Merge pull request #258 from PhenomRetroShare/Fix_QuoteLinesWithImage + 9b64b96 csoler Sat, 23 Jan 2016 13:03:29 -0500 fixed potential crash in pqisslstore + 1d2be23 Phenom Sat, 23 Jan 2016 18:17:49 +0100 Fix Quote Lines With Image + 70bf938 defnax Sat, 23 Jan 2016 13:37:08 +0100 reduced the default width & height reorder in MessagePage, move Distant Message box to the top. + fc0067f csoler Fri, 22 Jan 2016 22:06:31 -0500 fixed bug in network graph search sizes + c428739 csoler Fri, 22 Jan 2016 21:32:35 -0500 cleaned the network graph a little bit. Removed text, updated bounding boxes, removed background + b362544 csoler Fri, 22 Jan 2016 09:31:40 -0500 fixed compilation + b3df4c1 csoler Thu, 21 Jan 2016 23:55:22 -0500 made the Global router stats widget more efficient/compact/explicit + 449aba9 csoler Thu, 21 Jan 2016 22:44:48 -0500 fixed compilation of SearchDialog.cpp + 94b5868 csoler Thu, 21 Jan 2016 21:49:52 -0500 moved SearchDialog into FileTransfer/ + 6a32da2 csoler Thu, 21 Jan 2016 21:40:48 -0500 removed explicit size constraint on listview for config page (screws up the view in HDPI screens + 55d0a21 csoler Thu, 21 Jan 2016 21:19:40 -0500 added cache of latest GXS tunnel data items for the last 10 minutes in order to avoid replays of + 9347b86 csoler Thu, 21 Jan 2016 11:48:41 -0500 new simple solution for sound on linux based on using system sound player. To be tested. + 9999742 csoler Thu, 21 Jan 2016 11:32:17 -0500 reverted commit for phonon since phonon is deprecated. Will be replaced by qtmultimedia in + 7488ba1 csoler Wed, 20 Jan 2016 23:56:22 -0500 removed feedback from messages to mGrpServerUpdateTS, which is now only updated when the subscri + c473200 csoler Wed, 20 Jan 2016 23:34:25 -0500 moved getCurrentTS() inside RTT packet sending loop (suggestion from Jo) + e25787b csoler Wed, 20 Jan 2016 23:25:08 -0500 fixed sound on linux using phonon. This should be extensible to all unix systems + fc3606c csoler Wed, 20 Jan 2016 14:02:13 -0500 fixed DHT icon size problem + 9063612 csoler Wed, 20 Jan 2016 11:19:36 -0500 fixed utf8 issue in ChatWidget. To be tested. + c597c8c csoler Tue, 19 Jan 2016 23:19:46 -0500 removed explicit spacing sizes in plugins page + 3203249 csoler Tue, 19 Jan 2016 22:59:11 -0500 fixed size of help icons in MainPage class + 597f541 csoler Tue, 19 Jan 2016 22:44:27 -0500 added 2 icons + 3d58f9b csoler Tue, 19 Jan 2016 22:35:58 -0500 added correct icons in ToasterStatus + b382c3e csoler Tue, 19 Jan 2016 22:16:25 -0500 fixed icon sizes in peerstatus/statusbar + a2d8cc8 csoler Tue, 19 Jan 2016 22:01:26 -0500 fixed DHT status icon sizes and added tooltip + 37204d7 csoler Tue, 19 Jan 2016 21:46:22 -0500 fixed icon in NewsFeed, added missing spacer in IdDialog + 49c1d56 csoler Tue, 19 Jan 2016 21:45:55 -0500 increased GXS post size limit to just below 200K + 1471979 csoler Tue, 19 Jan 2016 18:08:47 -0500 added a few tooltips in Tor configuration panel + 43ee506 csoler Tue, 19 Jan 2016 10:13:24 -0500 added automatic GXS message rejection when item size exceeds 200K. Should fix the forums that go + dedd6d4 csoler Mon, 18 Jan 2016 23:53:54 -0500 disabled debug info + 68a0395 csoler Mon, 18 Jan 2016 23:53:06 -0500 fixed a few bugs in existing msg fragmentation code. Signature checking still not working, not N + 2b52456 defnax Mon, 18 Jan 2016 13:36:38 +0100 Added new iconset for Voip, by Beluga + 39e6a9b csoler Sat, 16 Jan 2016 20:44:52 -0500 fixed up People context menu so as to handle actions for multiple persons at once + 1edfcf9 csoler Sat, 16 Jan 2016 13:41:24 -0500 do not time stamp banned GXS ids + 8296fa9 csoler Sat, 16 Jan 2016 11:30:15 -0500 added checkbox to toggle logscale in statistics + 63b88ec defnax Sat, 16 Jan 2016 14:50:12 +0100 correct sorting for "Reputation" in People, patch by Eugene Tooms + + -- Cyril Soler Sat, 23 Jan 2016 16:00:00 +0100 + +retroshare06 (0.6.0-1.20160115.a34f66aa~trusty) trusty; urgency=low + 0ff6349 thunder2 Fri, 15 Jan 2016 12:01:37 +0100 Fixed possibility of XXE injection in FeedReader plugin. 748147f thunder2 Fri, 15 Jan 2016 12:00:02 +0100 Fixed Windows compile. b5f6059 Cyril Soler Fri, 15 Jan 2016 10:07:21 -0500 deprecated updateClientSyncTS() which is not needed anymore diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index 674e1abff..34fa83c2c 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -216,6 +216,7 @@ //#define NXS_NET_DEBUG_6 1 #define GIXS_CUT_OFF 0 +//#define NXS_FRAG // The constant below have a direct influence on how fast forums/channels/posted/identity groups propagate and on the overloading of queues: // @@ -232,6 +233,7 @@ #define REJECTED_MESSAGE_RETRY_DELAY 24*3600 // re-try rejected messages every 24hrs. Most of the time this is because the peer's reputation has changed. #define GROUP_STATS_UPDATE_DELAY 1800 // update unsubscribed group statistics every 30 mins #define GROUP_STATS_UPDATE_NB_PEERS 2 // update unsubscribed group statistics every 30 mins +#define MAX_ALLOWED_GXS_MESSAGE_SIZE 199000 // 200,000 bytes including signature and headers // Debug system to allow to print only for some IDs (group, Peer, etc) @@ -239,7 +241,7 @@ static const RsPeerId peer_to_print = RsPeerId(std::string("")) ; static const RsGxsGroupId group_id_to_print = RsGxsGroupId(std::string("" )) ; // use this to allow to this group id only, or "" for all IDs -static const uint32_t service_to_print = 0 ; // use this to allow to this service id only, or 0 for all services +static const uint32_t service_to_print = 0x215 ; // use this to allow to this service id only, or 0 for all services // warning. Numbers should be SERVICE IDS (see serialiser/rsserviceids.h. E.g. 0x0215 for forums) class nullstream: public std::ostream {}; @@ -889,7 +891,13 @@ void RsGxsNetService::subscribeStatusChanged(const RsGxsGroupId& grpId,bool subs else it->second->msgUpdateTS = 0 ; // reset! - // no need to update mGrpServerUpdateItem since the ::updateServerSyncTS() call will do it. + // We also update mGrpServerUpdateItem so as to trigger a new grp list exchange with friends (friends will send their known ClientTS which + // will be lower than our own grpUpdateTS, triggering our sending of the new subscribed grp list. + + if(mGrpServerUpdateItem == NULL) + mGrpServerUpdateItem = new RsGxsServerGrpUpdateItem(mServType); + + mGrpServerUpdateItem->grpUpdateTS = time(NULL) ; } bool RsGxsNetService::fragmentMsg(RsNxsMsg& msg, MsgFragments& msgFragments) const @@ -898,7 +906,8 @@ bool RsGxsNetService::fragmentMsg(RsNxsMsg& msg, MsgFragments& msgFragments) con uint32_t msgSize = msg.msg.TlvSize(); uint32_t dataLeft = msgSize; uint8_t nFragments = ceil(float(msgSize)/FRAGMENT_SIZE); - char buffer[FRAGMENT_SIZE]; + + RsTemporaryMemory buffer(FRAGMENT_SIZE); int currPos = 0; @@ -964,10 +973,25 @@ RsNxsMsg* RsGxsNetService::deFragmentMsg(MsgFragments& msgFragments) const if(msgFragments.size() == 1) { RsNxsMsg* m = msgFragments.front(); - if(m->count > 1) + + if(m->count > 1) // normally mcount should be exactly 1, but if not initialised (old versions) it's going to be 0 + { + // delete everything + std::cerr << "(WW) Cannot deFragment message set. m->count=" << m->count << ", but msgFragments.size()=" << msgFragments.size() << ". Incomplete? Dropping all." << std::endl; + + for(uint32_t i=0;imsg.bin_len; - char* data = new char[datSize]; + RsTemporaryMemory data(datSize) ; + + if(!data) + { + for(uint32_t i=0;itransactionNumber = m.transactionNumber; msg->meta = m.meta; - delete[] data; + // now clean! + for(uint32_t i=0;imsgId == mMsgId;} }; -void RsGxsNetService::collateMsgFragments(MsgFragments fragments, std::map& partFragments) const +void RsGxsNetService::collateMsgFragments(MsgFragments& fragments, std::map& partFragments) const { // get all unique message Ids; MsgFragments::iterator vit = fragments.begin(); @@ -1779,6 +1822,10 @@ void RsGxsNetService::updateServerSyncTS() // retrieve all grps and update TS mDataStore->retrieveGxsGrpMetaData(gxsMap); +#ifdef TO_REMOVE + // (cyril) This code is removed because it is inconsistent: the list of grps does not need to be updated when + // new posts arrive. The two (grp list and msg list) are handled independently. + // as a grp list server also note this is the latest item you have if(mGrpServerUpdateItem == NULL) mGrpServerUpdateItem = new RsGxsServerGrpUpdateItem(mServType); @@ -1787,6 +1834,7 @@ void RsGxsNetService::updateServerSyncTS() // we have unsubscribed a group. mGrpServerUpdateItem->grpUpdateTS = 0 ; +#endif bool change = false; // then remove from mServerMsgUpdateMap, all items that are not in the group list! @@ -1824,6 +1872,7 @@ void RsGxsNetService::updateServerSyncTS() ServerMsgMap::iterator mapIT = mServerMsgUpdateMap.find(grpId); RsGxsServerMsgUpdateItem* msui = NULL; +#ifdef TO_REMOVE // That accounts for modification of the meta data. if(mGrpServerUpdateItem->grpUpdateTS < grpMeta->mPublishTs) @@ -1833,6 +1882,7 @@ void RsGxsNetService::updateServerSyncTS() #endif mGrpServerUpdateItem->grpUpdateTS = grpMeta->mPublishTs; } +#endif if(mapIT == mServerMsgUpdateMap.end()) { @@ -1856,6 +1906,7 @@ void RsGxsNetService::updateServerSyncTS() #endif } +#ifdef TO_REMOVE // This might be very inefficient with time. This is needed because an old message might have been received, so the last modification time // needs to account for this so that a friend who hasn't @@ -1867,6 +1918,7 @@ void RsGxsNetService::updateServerSyncTS() mGrpServerUpdateItem->grpUpdateTS = grpMeta->mRecvTS; change = true; } +#endif } // actual change in config settings, then save configuration @@ -2289,13 +2341,15 @@ void RsGxsNetService::locked_processCompletedIncomingTrans(NxsTransaction* tr) std::cerr << "RsGxsNetService::processCompletedTransactions(): item did not caste to msg" << std::endl; } -#ifdef NSXS_FRAG - std::map collatedMsgs; - collateMsgFragments(msgs, collatedMsgs); +#ifdef NXS_FRAG + // (cyril) This code does not work. Since we do not really need message fragmenting, I won't fix it. + + std::map collatedMsgs; + collateMsgFragments(msgs, collatedMsgs); // this destroys msgs whatsoever and recovers memory when needed msgs.clear(); - std::map::iterator mit = collatedMsgs.begin(); + std::map::iterator mit = collatedMsgs.begin(); for(; mit != collatedMsgs.end(); ++mit) { MsgFragments& f = mit->second; @@ -2304,6 +2358,7 @@ void RsGxsNetService::locked_processCompletedIncomingTrans(NxsTransaction* tr) if(msg) msgs.push_back(msg); } + collatedMsgs.clear(); #endif #ifdef NXS_NET_DEBUG_0 GXSNETDEBUG_PG(tr->mTransaction->PeerId(),grpId) << " ...and notifying observer of " << msgs.size() << " new messages." << std::endl; @@ -3175,12 +3230,19 @@ void RsGxsNetService::locked_genSendMsgsTransaction(NxsTransaction* tr) msg->PeerId(peerId); msg->transactionNumber = transN; -#ifndef NXS_FRAG - newTr->mItems.push_back(msg); - msgSize++; -#else + // Quick trick to clamp messages with an exceptionnally large size. Signature will fail on client side, and the message + // will be rejected. + + if(msg->msg.bin_len > MAX_ALLOWED_GXS_MESSAGE_SIZE) + { + std::cerr << "(WW) message with ID " << msg->msgId << " in group " << msg->grpId << " exceeds size limit of " << MAX_ALLOWED_GXS_MESSAGE_SIZE << " bytes. Actual size is " << msg->msg.bin_len << " bytes. Message will be truncated and rejected at client." << std::endl; + msg->msg.bin_len = 1 ; // arbitrary small size, but not 0. No need to send the data since it's going to be rejected. + } +#ifdef NXS_FRAG MsgFragments fragments; fragmentMsg(*msg, fragments); + + delete msg ; MsgFragments::iterator mit = fragments.begin(); @@ -3189,7 +3251,14 @@ void RsGxsNetService::locked_genSendMsgsTransaction(NxsTransaction* tr) newTr->mItems.push_back(*mit); msgSize++; } +#else + msg->count = 1; // only one piece. This is to keep compatibility if we ever implement fragmenting in the future. + msg->pos = 0; + + newTr->mItems.push_back(msg); + msgSize++; #endif + } } diff --git a/libretroshare/src/gxs/rsgxsnetservice.h b/libretroshare/src/gxs/rsgxsnetservice.h index 7cdb764ce..ffc47235b 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.h +++ b/libretroshare/src/gxs/rsgxsnetservice.h @@ -435,7 +435,7 @@ private: * @param fragments message fragments which are not necessarily from the same message * @param partFragments the partitioned fragments (into message ids) */ - void collateMsgFragments(MsgFragments fragments, std::map& partFragments) const; + void collateMsgFragments(MsgFragments &fragments, std::map& partFragments) const; /*! * Note that if all fragments for a group are not found then its fragments are dropped diff --git a/libretroshare/src/gxs/rsgxsutil.cc b/libretroshare/src/gxs/rsgxsutil.cc index 78e0c39cd..8c02f86e6 100644 --- a/libretroshare/src/gxs/rsgxsutil.cc +++ b/libretroshare/src/gxs/rsgxsutil.cc @@ -28,6 +28,7 @@ #include "rsgxsutil.h" #include "retroshare/rsgxsflags.h" #include "retroshare/rspeers.h" +#include "retroshare/rsreputations.h" #include "pqi/pqihash.h" #include "gxs/rsgixs.h" @@ -161,7 +162,8 @@ bool RsGxsIntegrityCheck::check() std::cerr << "TimeStamping group authors' key ID " << grp->metaData->mAuthorId << " in group ID " << grp->grpId << std::endl; #endif - used_gxs_ids.insert(grp->metaData->mAuthorId) ; + if(rsReputations!=NULL && !rsReputations->isIdentityBanned(grp->metaData->mAuthorId)) + used_gxs_ids.insert(grp->metaData->mAuthorId) ; } } } @@ -242,7 +244,8 @@ bool RsGxsIntegrityCheck::check() #ifdef GXSUTIL_DEBUG std::cerr << "TimeStamping message authors' key ID " << msg->metaData->mAuthorId << " in message " << msg->msgId << ", group ID " << msg->grpId<< std::endl; #endif - used_gxs_ids.insert(msg->metaData->mAuthorId) ; + if(rsReputations!=NULL && !rsReputations->isIdentityBanned(msg->metaData->mAuthorId)) + used_gxs_ids.insert(msg->metaData->mAuthorId) ; } delete msg; diff --git a/libretroshare/src/gxstunnel/p3gxstunnel.cc b/libretroshare/src/gxstunnel/p3gxstunnel.cc index 43ff5b0b3..e7d85275a 100644 --- a/libretroshare/src/gxstunnel/p3gxstunnel.cc +++ b/libretroshare/src/gxstunnel/p3gxstunnel.cc @@ -53,7 +53,8 @@ static const uint32_t RS_GXS_TUNNEL_DH_STATUS_UNINITIALIZED = 0x0000 ; static const uint32_t RS_GXS_TUNNEL_DH_STATUS_HALF_KEY_DONE = 0x0001 ; static const uint32_t RS_GXS_TUNNEL_DH_STATUS_KEY_AVAILABLE = 0x0002 ; -static const uint32_t RS_GXS_TUNNEL_DELAY_BETWEEN_RESEND = 10 ; // re-send every 10 secs. +static const uint32_t RS_GXS_TUNNEL_DELAY_BETWEEN_RESEND = 10 ; // re-send every 10 secs. +static const uint32_t RS_GXS_TUNNEL_DATA_PRINT_STORAGE_DELAY = 600 ; // store old message ids for 10 minutes. static const uint32_t GXS_TUNNEL_ENCRYPTION_HMAC_SIZE = SHA_DIGEST_LENGTH ; static const uint32_t GXS_TUNNEL_ENCRYPTION_IV_SIZE = 8 ; @@ -73,9 +74,6 @@ p3GxsTunnelService::p3GxsTunnelService(RsGixs *pids) : mGixs(pids), mGxsTunnelMtx("GXS tunnel") { mTurtle = NULL ; - - // any value is fine here, even 0, since items in different RS sessions will use different AES keys. - global_item_counter = 0;//RSRandom::random_u64() ; } void p3GxsTunnelService::connectToTurtleRouter(p3turtle *tr) @@ -196,7 +194,9 @@ void p3GxsTunnelService::flush() for(std::map::iterator it(_gxs_tunnel_contacts.begin());it!=_gxs_tunnel_contacts.end();) { - // Remove any tunnel that was remotely closed, since we cannot use it anymore. + // All sorts of cleaning. We start with the ones that may remove stuff, for efficiency reasons. + + // 1 - Remove any tunnel that was remotely closed, since we cannot use it anymore. if(it->second.status == RS_GXS_TUNNEL_STATUS_REMOTELY_CLOSED && it->second.last_contact + 20 < now) { @@ -207,6 +207,8 @@ void p3GxsTunnelService::flush() continue ; } + // 2 - re-digg tunnels that have died out of inaction + if(it->second.last_contact+20+GXS_TUNNEL_KEEP_ALIVE_TIMEOUT < now && it->second.status == RS_GXS_TUNNEL_STATUS_CAN_TALK) { #ifdef DEBUG_GXS_TUNNEL @@ -228,6 +230,9 @@ void p3GxsTunnelService::flush() mTurtle->forceReDiggTunnels( randomHashFromDestinationGxsId(it->second.to_gxs_id) ); } } + + // send keep alive packets to active tunnels. + if(it->second.last_keep_alive_sent + GXS_TUNNEL_KEEP_ALIVE_TIMEOUT < now && it->second.status == RS_GXS_TUNNEL_STATUS_CAN_TALK) { RsGxsTunnelStatusItem *cs = new RsGxsTunnelStatusItem ; @@ -244,6 +249,23 @@ void p3GxsTunnelService::flush() std::cerr << "(II) GxsTunnelService:: Sending keep alive packet to gxs id " << it->first << std::endl; #endif } + + // clean old received data prints. + + for(std::map::iterator it2=it->second.received_data_prints.begin();it2!=it->second.received_data_prints.end();) + if(now > it2->second + RS_GXS_TUNNEL_DATA_PRINT_STORAGE_DELAY) + { +#ifdef DEBUG_GXS_TUNNEL + std::cerr << "(II) erasing old data print for message #" << it2->first << " in tunnel " << it->first << std::endl; +#endif + std::map::iterator tmp(it2) ; + ++tmp ; + it->second.received_data_prints.erase(it2) ; + it2 = tmp ; + } + else + ++it2 ; + ++it ; } } @@ -347,6 +369,16 @@ void p3GxsTunnelService::handleRecvTunnelDataItem(const RsGxsTunnelId& tunnel_id it2->second.client_services.insert(item->service_id) ; peer_from = it2->second.to_gxs_id ; } + + // Check if the item has already been received. This is necessary because we actually re-send items until an ACK is received. If the ACK gets lost (connection interrupted) the + // item may be received twice. This is conservative and ensure that no item is lost nor received twice. + + if(it2->second.received_data_prints.find(item->unique_item_counter) != it2->second.received_data_prints.end()) + { + std::cerr << "(WW) received the same data item #" << std::hex << item->unique_item_counter << std::dec << " twice in last 20 mins. Tunnel id=" << tunnel_id << ". Probably a replay. Item will be dropped." << std::endl; + return ; + } + it2->second.received_data_prints[item->unique_item_counter] = time(NULL) ; } if(service->acceptDataFromPeer(peer_from,tunnel_id)) @@ -1325,7 +1357,7 @@ bool p3GxsTunnelService::sendData(const RsGxsTunnelId &tunnel_id, uint32_t servi RsGxsTunnelDataItem *item = new RsGxsTunnelDataItem ; - item->unique_item_counter = global_item_counter++; // this allows to make the item unique + item->unique_item_counter = RSRandom::random_u64(); // this allows to make the item unique, except very rarely, we we don't care. item->flags = 0; // not used yet. item->service_id = service_id; item->data_size = size; // encrypted data size diff --git a/libretroshare/src/gxstunnel/p3gxstunnel.h b/libretroshare/src/gxstunnel/p3gxstunnel.h index 67589f8e5..9a2481623 100644 --- a/libretroshare/src/gxstunnel/p3gxstunnel.h +++ b/libretroshare/src/gxstunnel/p3gxstunnel.h @@ -171,6 +171,7 @@ private: RsTurtleGenericTunnelItem::Direction direction ; // specifiec wether we are client(managing the tunnel) or server. TurtleFileHash hash ; // hash that is last used. This is necessary for handling tunnel establishment std::set client_services ;// services that used this tunnel + std::map received_data_prints ; // list of recently received messages, to avoid duplicates. Kept for 20 mins at most. uint32_t total_sent ; uint32_t total_received ; }; @@ -252,8 +253,6 @@ private: RsGixs *mGixs ; RsMutex mGxsTunnelMtx ; - uint64_t global_item_counter ; - std::map mRegisteredServices ; void debug_dump(); diff --git a/libretroshare/src/pqi/pqistore.cc b/libretroshare/src/pqi/pqistore.cc index 6dedbd5fc..d60962e1c 100644 --- a/libretroshare/src/pqi/pqistore.cc +++ b/libretroshare/src/pqi/pqistore.cc @@ -391,25 +391,26 @@ bool pqiSSLstore::encryptedSendItems(const std::list& rsItemList) std::list::const_iterator it; uint32_t sizeItems = 0, sizeItem = 0; uint32_t offset = 0; - char* data = NULL; for(it = rsItemList.begin(); it != rsItemList.end(); ++it) - sizeItems += rsSerialiser->size(*it); + if(*it != NULL) + sizeItems += rsSerialiser->size(*it); - data = new char[sizeItems]; + RsTemporaryMemory data(sizeItems) ; for(it = rsItemList.begin(); it != rsItemList.end(); ++it) - { - sizeItem = rsSerialiser->size(*it); + if(*it != NULL) + { + sizeItem = rsSerialiser->size(*it); - if(rsSerialiser->serialise(*it, (data+offset),&sizeItem)) - offset += sizeItem; - else - std::cerr << "(EE) pqiSSLstore::encryptedSendItems(): One item did not serialize. The item is probably unknown from the serializer. Dropping the item. " << std::endl; + if(rsSerialiser->serialise(*it, &data[offset],&sizeItem)) + offset += sizeItem; + else + std::cerr << "(EE) pqiSSLstore::encryptedSendItems(): One item did not serialize. The item is probably unknown from the serializer. Dropping the item. " << std::endl; - if (!(bio_flags & BIN_FLAGS_NO_DELETE)) - delete *it; - } + if (!(bio_flags & BIN_FLAGS_NO_DELETE)) + delete *it; + } bool result = true; @@ -418,9 +419,6 @@ bool pqiSSLstore::encryptedSendItems(const std::list& rsItemList) else result = false; - if(data != NULL) - delete[] data; - return result; } diff --git a/libretroshare/src/services/p3rtt.cc b/libretroshare/src/services/p3rtt.cc index f5baed4e8..1e3c96b61 100644 --- a/libretroshare/src/services/p3rtt.cc +++ b/libretroshare/src/services/p3rtt.cc @@ -190,8 +190,6 @@ void p3rtt::sendPingMeasurements() mServiceCtrl->getPeersConnected(getServiceInfo().mServiceType, idList); - double ts = getCurrentTS(); - #ifdef DEBUG_RTT std::cerr << "p3rtt::sendPingMeasurements() @ts: " << ts; std::cerr << std::endl; @@ -205,7 +203,8 @@ void p3rtt::sendPingMeasurements() std::cerr << "p3rtt::sendPingMeasurements() Pinging: " << *it; std::cerr << std::endl; #endif - + double ts = getCurrentTS(); + /* create the packet */ RsRttPingItem *pingPkt = new RsRttPingItem(); pingPkt->PeerId(*it); diff --git a/plugins/VOIP/gui/VOIPChatWidgetHolder.cpp b/plugins/VOIP/gui/VOIPChatWidgetHolder.cpp index 87a5d2f5e..f312e0954 100644 --- a/plugins/VOIP/gui/VOIPChatWidgetHolder.cpp +++ b/plugins/VOIP/gui/VOIPChatWidgetHolder.cpp @@ -53,11 +53,11 @@ VOIPChatWidgetHolder::VOIPChatWidgetHolder(ChatWidget *chatWidget, VOIPNotify *n QSize buttonSize = QSize(iconSize + QSize(3,3)); QIcon iconaudioListenToggleButton ; - iconaudioListenToggleButton.addPixmap(QPixmap(":/images/audio-volume-muted.png")) ; - iconaudioListenToggleButton.addPixmap(QPixmap(":/images/audio-volume-high.png"),QIcon::Normal,QIcon::On) ; - iconaudioListenToggleButton.addPixmap(QPixmap(":/images/audio-volume-high.png"),QIcon::Disabled,QIcon::On) ; - iconaudioListenToggleButton.addPixmap(QPixmap(":/images/audio-volume-high.png"),QIcon::Active,QIcon::On) ; - iconaudioListenToggleButton.addPixmap(QPixmap(":/images/audio-volume-high.png"),QIcon::Selected,QIcon::On) ; + iconaudioListenToggleButton.addPixmap(QPixmap(":/images/speaker_mute.png")) ; + iconaudioListenToggleButton.addPixmap(QPixmap(":/images/speaker.png"),QIcon::Normal,QIcon::On) ; + iconaudioListenToggleButton.addPixmap(QPixmap(":/images/speaker.png"),QIcon::Disabled,QIcon::On) ; + iconaudioListenToggleButton.addPixmap(QPixmap(":/images/speaker.png"),QIcon::Active,QIcon::On) ; + iconaudioListenToggleButton.addPixmap(QPixmap(":/images/speaker.png"),QIcon::Selected,QIcon::On) ; audioListenToggleButton = new QToolButton ; audioListenToggleButton->setIcon(iconaudioListenToggleButton) ; @@ -71,11 +71,11 @@ VOIPChatWidgetHolder::VOIPChatWidgetHolder(ChatWidget *chatWidget, VOIPNotify *n audioListenToggleButton->setEnabled(false); QIcon iconaudioCaptureToggleButton ; - iconaudioCaptureToggleButton.addPixmap(QPixmap(":/images/call-start.png")) ; - iconaudioCaptureToggleButton.addPixmap(QPixmap(":/images/call-hold.png"),QIcon::Normal,QIcon::On) ; - iconaudioCaptureToggleButton.addPixmap(QPixmap(":/images/call-hold.png"),QIcon::Disabled,QIcon::On) ; - iconaudioCaptureToggleButton.addPixmap(QPixmap(":/images/call-hold.png"),QIcon::Active,QIcon::On) ; - iconaudioCaptureToggleButton.addPixmap(QPixmap(":/images/call-hold.png"),QIcon::Selected,QIcon::On) ; + iconaudioCaptureToggleButton.addPixmap(QPixmap(":/images/phone.png")) ; + iconaudioCaptureToggleButton.addPixmap(QPixmap(":/images/microphone_mute.png"),QIcon::Normal,QIcon::On) ; + iconaudioCaptureToggleButton.addPixmap(QPixmap(":/images/microphone_mute.png"),QIcon::Disabled,QIcon::On) ; + iconaudioCaptureToggleButton.addPixmap(QPixmap(":/images/microphone_mute.png"),QIcon::Active,QIcon::On) ; + iconaudioCaptureToggleButton.addPixmap(QPixmap(":/images/microphone_mute.png"),QIcon::Selected,QIcon::On) ; audioCaptureToggleButton = new QToolButton ; audioCaptureToggleButton->setIcon(iconaudioCaptureToggleButton) ; @@ -88,11 +88,11 @@ VOIPChatWidgetHolder::VOIPChatWidgetHolder(ChatWidget *chatWidget, VOIPNotify *n audioCaptureToggleButton->setToolTip(tr("Start Call")); QIcon iconvideoCaptureToggleButton ; - iconvideoCaptureToggleButton.addPixmap(QPixmap(":/images/video-icon-on.png")) ; - iconvideoCaptureToggleButton.addPixmap(QPixmap(":/images/video-icon-off.png"),QIcon::Normal,QIcon::On) ; - iconvideoCaptureToggleButton.addPixmap(QPixmap(":/images/video-icon-off.png"),QIcon::Disabled,QIcon::On) ; - iconvideoCaptureToggleButton.addPixmap(QPixmap(":/images/video-icon-off.png"),QIcon::Active,QIcon::On) ; - iconvideoCaptureToggleButton.addPixmap(QPixmap(":/images/video-icon-off.png"),QIcon::Selected,QIcon::On) ; + iconvideoCaptureToggleButton.addPixmap(QPixmap(":/images/filmcam.png")) ; + iconvideoCaptureToggleButton.addPixmap(QPixmap(":/images/filmcam-off.png"),QIcon::Normal,QIcon::On) ; + iconvideoCaptureToggleButton.addPixmap(QPixmap(":/images/filmcam-off.png"),QIcon::Disabled,QIcon::On) ; + iconvideoCaptureToggleButton.addPixmap(QPixmap(":/images/filmcam-off.png"),QIcon::Active,QIcon::On) ; + iconvideoCaptureToggleButton.addPixmap(QPixmap(":/images/filmcam-off.png"),QIcon::Selected,QIcon::On) ; videoCaptureToggleButton = new QToolButton ; videoCaptureToggleButton->setIcon(iconvideoCaptureToggleButton) ; @@ -105,7 +105,7 @@ VOIPChatWidgetHolder::VOIPChatWidgetHolder(ChatWidget *chatWidget, VOIPNotify *n videoCaptureToggleButton->setToolTip(tr("Start Video Call")); hangupButton = new QToolButton ; - hangupButton->setIcon(QIcon(":/images/call-stop.png")) ; + hangupButton->setIcon(QIcon(":/images/phone_hangup.png")) ; hangupButton->setIconSize(iconSize) ; hangupButton->setMinimumSize(buttonSize) ; hangupButton->setMaximumSize(buttonSize) ; @@ -116,11 +116,11 @@ VOIPChatWidgetHolder::VOIPChatWidgetHolder(ChatWidget *chatWidget, VOIPNotify *n hangupButton->hide(); QIcon iconhideChatTextToggleButton ; - iconhideChatTextToggleButton.addPixmap(QPixmap(":/images/orange-bubble-64.png")) ; - iconhideChatTextToggleButton.addPixmap(QPixmap(":/images/white-bubble-64.png"),QIcon::Normal,QIcon::On) ; - iconhideChatTextToggleButton.addPixmap(QPixmap(":/images/white-bubble-64.png"),QIcon::Disabled,QIcon::On) ; - iconhideChatTextToggleButton.addPixmap(QPixmap(":/images/white-bubble-64.png"),QIcon::Active,QIcon::On) ; - iconhideChatTextToggleButton.addPixmap(QPixmap(":/images/white-bubble-64.png"),QIcon::Selected,QIcon::On) ; + iconhideChatTextToggleButton.addPixmap(QPixmap(":/images/chat-bubble.png")) ; + iconhideChatTextToggleButton.addPixmap(QPixmap(":/images/chat-bubble.png"),QIcon::Normal,QIcon::On) ; + iconhideChatTextToggleButton.addPixmap(QPixmap(":/images/chat-bubble.png"),QIcon::Disabled,QIcon::On) ; + iconhideChatTextToggleButton.addPixmap(QPixmap(":/images/chat-bubble.png"),QIcon::Active,QIcon::On) ; + iconhideChatTextToggleButton.addPixmap(QPixmap(":/images/chat-bubble.png"),QIcon::Selected,QIcon::On) ; hideChatTextToggleButton = new QToolButton ; hideChatTextToggleButton->setIcon(iconhideChatTextToggleButton) ; @@ -134,11 +134,11 @@ VOIPChatWidgetHolder::VOIPChatWidgetHolder(ChatWidget *chatWidget, VOIPNotify *n hideChatTextToggleButton->setEnabled(false) ; QIcon iconfullscreenToggleButton ; - iconfullscreenToggleButton.addPixmap(QPixmap(":/images/channels32.png")) ; - iconfullscreenToggleButton.addPixmap(QPixmap(":/images/folder-draft24.png"),QIcon::Normal,QIcon::On) ; - iconfullscreenToggleButton.addPixmap(QPixmap(":/images/folder-draft24.png"),QIcon::Disabled,QIcon::On) ; - iconfullscreenToggleButton.addPixmap(QPixmap(":/images/folder-draft24.png"),QIcon::Active,QIcon::On) ; - iconfullscreenToggleButton.addPixmap(QPixmap(":/images/folder-draft24.png"),QIcon::Selected,QIcon::On) ; + iconfullscreenToggleButton.addPixmap(QPixmap(":/images/fullscreen_arrows.png")) ; + iconfullscreenToggleButton.addPixmap(QPixmap(":/images/fullscreen.png"),QIcon::Normal,QIcon::On) ; + iconfullscreenToggleButton.addPixmap(QPixmap(":/images/fullscreen.png"),QIcon::Disabled,QIcon::On) ; + iconfullscreenToggleButton.addPixmap(QPixmap(":/images/fullscreen.png"),QIcon::Active,QIcon::On) ; + iconfullscreenToggleButton.addPixmap(QPixmap(":/images/fullscreen.png"),QIcon::Selected,QIcon::On) ; fullscreenToggleButton = new QToolButton ; fullscreenToggleButton->setIcon(iconfullscreenToggleButton) ; @@ -236,7 +236,7 @@ VOIPChatWidgetHolder::VOIPChatWidgetHolder(ChatWidget *chatWidget, VOIPNotify *n videoCaptureToggleButtonFS->setToolTip(tr("Start Video Call")); hangupButtonFS = new QToolButton(fullScreenFrame) ; - hangupButtonFS->setIcon(QIcon(":/images/call-stop.png")) ; + hangupButtonFS->setIcon(QIcon(":/images/phone_hangup.png")) ; hangupButtonFS->setIconSize(iconSize) ; hangupButtonFS->setMinimumSize(buttonSize) ; hangupButtonFS->setMaximumSize(buttonSize) ; diff --git a/plugins/VOIP/gui/VOIP_images.qrc b/plugins/VOIP/gui/VOIP_images.qrc index 0f69a2c2c..218ef9068 100644 --- a/plugins/VOIP/gui/VOIP_images.qrc +++ b/plugins/VOIP/gui/VOIP_images.qrc @@ -1,18 +1,19 @@ - - images/audio-volume-high.png - images/muted_self.svg - images/audio-volume-muted.png - images/talking_on.svg - images/talking_off.svg - images/call-start.png - images/call-stop.png - images/call-hold.png - images/camera-on.png - images/camera-off.png - images/video-icon-big.png - images/video-icon-on.png - images/video-icon-off.png - + + images/muted_self.svg + images/talking_on.svg + images/talking_off.svg + images/chat-bubble.png + images/filmcam.png + images/fullscreen.png + images/fullscreen_arrows.png + images/microphone.png + images/microphone_mute.png + images/phone.png + images/phone_hangup.png + images/speaker.png + images/speaker_mute.png + images/webcam.png + images/video-icon-big.png + - diff --git a/plugins/VOIP/gui/images/audio-volume-high.png b/plugins/VOIP/gui/images/audio-volume-high.png deleted file mode 100644 index e11a90649..000000000 Binary files a/plugins/VOIP/gui/images/audio-volume-high.png and /dev/null differ diff --git a/plugins/VOIP/gui/images/audio-volume-medium-22.png b/plugins/VOIP/gui/images/audio-volume-medium-22.png deleted file mode 100644 index bf6b49f2a..000000000 Binary files a/plugins/VOIP/gui/images/audio-volume-medium-22.png and /dev/null differ diff --git a/plugins/VOIP/gui/images/audio-volume-muted-22.png b/plugins/VOIP/gui/images/audio-volume-muted-22.png deleted file mode 100644 index 426ec3313..000000000 Binary files a/plugins/VOIP/gui/images/audio-volume-muted-22.png and /dev/null differ diff --git a/plugins/VOIP/gui/images/audio-volume-muted.png b/plugins/VOIP/gui/images/audio-volume-muted.png deleted file mode 100644 index 2ee846d70..000000000 Binary files a/plugins/VOIP/gui/images/audio-volume-muted.png and /dev/null differ diff --git a/plugins/VOIP/gui/images/call-hold-22.png b/plugins/VOIP/gui/images/call-hold-22.png deleted file mode 100644 index d133bdc5f..000000000 Binary files a/plugins/VOIP/gui/images/call-hold-22.png and /dev/null differ diff --git a/plugins/VOIP/gui/images/call-hold.png b/plugins/VOIP/gui/images/call-hold.png deleted file mode 100644 index 1c41abb7a..000000000 Binary files a/plugins/VOIP/gui/images/call-hold.png and /dev/null differ diff --git a/plugins/VOIP/gui/images/call-start-22.png b/plugins/VOIP/gui/images/call-start-22.png deleted file mode 100644 index 9a0cf4ca6..000000000 Binary files a/plugins/VOIP/gui/images/call-start-22.png and /dev/null differ diff --git a/plugins/VOIP/gui/images/call-start.png b/plugins/VOIP/gui/images/call-start.png deleted file mode 100644 index 04ef2f399..000000000 Binary files a/plugins/VOIP/gui/images/call-start.png and /dev/null differ diff --git a/plugins/VOIP/gui/images/call-stop-22.png b/plugins/VOIP/gui/images/call-stop-22.png deleted file mode 100644 index 2307fe3e0..000000000 Binary files a/plugins/VOIP/gui/images/call-stop-22.png and /dev/null differ diff --git a/plugins/VOIP/gui/images/call-stop.png b/plugins/VOIP/gui/images/call-stop.png deleted file mode 100644 index bce13e65d..000000000 Binary files a/plugins/VOIP/gui/images/call-stop.png and /dev/null differ diff --git a/plugins/VOIP/gui/images/camera-off.png b/plugins/VOIP/gui/images/camera-off.png deleted file mode 100644 index c1721d492..000000000 Binary files a/plugins/VOIP/gui/images/camera-off.png and /dev/null differ diff --git a/plugins/VOIP/gui/images/camera-on.png b/plugins/VOIP/gui/images/camera-on.png deleted file mode 100644 index e6c8bd9ff..000000000 Binary files a/plugins/VOIP/gui/images/camera-on.png and /dev/null differ diff --git a/plugins/VOIP/gui/images/chat-bubble.png b/plugins/VOIP/gui/images/chat-bubble.png new file mode 100644 index 000000000..9b69b9863 Binary files /dev/null and b/plugins/VOIP/gui/images/chat-bubble.png differ diff --git a/plugins/VOIP/gui/images/filmcam-off.png b/plugins/VOIP/gui/images/filmcam-off.png new file mode 100644 index 000000000..f9585030c Binary files /dev/null and b/plugins/VOIP/gui/images/filmcam-off.png differ diff --git a/plugins/VOIP/gui/images/filmcam.png b/plugins/VOIP/gui/images/filmcam.png new file mode 100644 index 000000000..67dae9a59 Binary files /dev/null and b/plugins/VOIP/gui/images/filmcam.png differ diff --git a/plugins/VOIP/gui/images/fullscreen.png b/plugins/VOIP/gui/images/fullscreen.png new file mode 100644 index 000000000..fba08ff31 Binary files /dev/null and b/plugins/VOIP/gui/images/fullscreen.png differ diff --git a/plugins/VOIP/gui/images/fullscreen_arrows.png b/plugins/VOIP/gui/images/fullscreen_arrows.png new file mode 100644 index 000000000..0e5eba575 Binary files /dev/null and b/plugins/VOIP/gui/images/fullscreen_arrows.png differ diff --git a/plugins/VOIP/gui/images/microphone.png b/plugins/VOIP/gui/images/microphone.png new file mode 100644 index 000000000..08bc32458 Binary files /dev/null and b/plugins/VOIP/gui/images/microphone.png differ diff --git a/plugins/VOIP/gui/images/microphone_mute.png b/plugins/VOIP/gui/images/microphone_mute.png new file mode 100644 index 000000000..965d6998e Binary files /dev/null and b/plugins/VOIP/gui/images/microphone_mute.png differ diff --git a/plugins/VOIP/gui/images/phone.png b/plugins/VOIP/gui/images/phone.png new file mode 100644 index 000000000..9992fc719 Binary files /dev/null and b/plugins/VOIP/gui/images/phone.png differ diff --git a/plugins/VOIP/gui/images/phone_hangup.png b/plugins/VOIP/gui/images/phone_hangup.png new file mode 100644 index 000000000..9ee63a8cf Binary files /dev/null and b/plugins/VOIP/gui/images/phone_hangup.png differ diff --git a/plugins/VOIP/gui/images/speaker.png b/plugins/VOIP/gui/images/speaker.png new file mode 100644 index 000000000..f3fae8a69 Binary files /dev/null and b/plugins/VOIP/gui/images/speaker.png differ diff --git a/plugins/VOIP/gui/images/speaker_mute.png b/plugins/VOIP/gui/images/speaker_mute.png new file mode 100644 index 000000000..2671e0407 Binary files /dev/null and b/plugins/VOIP/gui/images/speaker_mute.png differ diff --git a/plugins/VOIP/gui/images/video-icon-off.png b/plugins/VOIP/gui/images/video-icon-off.png deleted file mode 100644 index 1a4c04840..000000000 Binary files a/plugins/VOIP/gui/images/video-icon-off.png and /dev/null differ diff --git a/plugins/VOIP/gui/images/video-icon-on.png b/plugins/VOIP/gui/images/video-icon-on.png deleted file mode 100644 index 6c4618293..000000000 Binary files a/plugins/VOIP/gui/images/video-icon-on.png and /dev/null differ diff --git a/plugins/VOIP/gui/images/webcam.png b/plugins/VOIP/gui/images/webcam.png new file mode 100644 index 000000000..4388bb580 Binary files /dev/null and b/plugins/VOIP/gui/images/webcam.png differ diff --git a/retroshare-gui/src/gui/SearchDialog.cpp b/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp similarity index 99% rename from retroshare-gui/src/gui/SearchDialog.cpp rename to retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp index cdd853c84..6892ecbb8 100644 --- a/retroshare-gui/src/gui/SearchDialog.cpp +++ b/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp @@ -26,16 +26,16 @@ #include "rshare.h" #include "SearchDialog.h" -#include "RetroShareLink.h" -#include "msgs/MessageComposer.h" #include "gui/RSHumanReadableDelegate.h" +#include "gui/RetroShareLink.h" #include "retroshare-gui/RsAutoUpdatePage.h" +#include "gui/msgs/MessageComposer.h" #include "gui/common/RsCollectionFile.h" #include "gui/common/FilesDefs.h" -#include -#include "settings/rsharesettings.h" -#include "advsearch/advancedsearchdialog.h" -#include "common/RSTreeWidgetItem.h" +#include "gui/common/RsUrlHandler.h" +#include "gui/settings/rsharesettings.h" +#include "gui/advsearch/advancedsearchdialog.h" +#include "gui/common/RSTreeWidgetItem.h" #include "util/QtVersion.h" #include @@ -857,7 +857,7 @@ void SearchDialog::searchKeywords(const QString& keywords) req_id = rsTurtle->turtleSearch(lin_exp) ; } else - req_id = ((((uint32_t)rand()) << 16)^0x1e2fd5e4) + (((uint32_t)rand())^0x1b19acfe) ; // generate a random 32 bits request id + req_id = RSRandom::random_u32() ; // generate a random 32 bits request id initSearchResult(keywords,req_id, ui.FileTypeComboBox->currentIndex(), false) ; // this will act before turtle results come to the interface, thanks to the signals scheduling policy. diff --git a/retroshare-gui/src/gui/SearchDialog.h b/retroshare-gui/src/gui/FileTransfer/SearchDialog.h similarity index 100% rename from retroshare-gui/src/gui/SearchDialog.h rename to retroshare-gui/src/gui/FileTransfer/SearchDialog.h diff --git a/retroshare-gui/src/gui/SearchDialog.ui b/retroshare-gui/src/gui/FileTransfer/SearchDialog.ui similarity index 100% rename from retroshare-gui/src/gui/SearchDialog.ui rename to retroshare-gui/src/gui/FileTransfer/SearchDialog.ui diff --git a/retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp b/retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp index 98b26a637..0a7b7cb45 100644 --- a/retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp +++ b/retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp @@ -43,7 +43,7 @@ #include "DLListDelegate.h" #include "ULListDelegate.h" #include "FileTransferInfoWidget.h" -#include +#include #include #include "xprogressbar.h" #include diff --git a/retroshare-gui/src/gui/Identity/IdDialog.cpp b/retroshare-gui/src/gui/Identity/IdDialog.cpp index e7d22a475..66515534b 100644 --- a/retroshare-gui/src/gui/Identity/IdDialog.cpp +++ b/retroshare-gui/src/gui/Identity/IdDialog.cpp @@ -949,105 +949,133 @@ void IdDialog::loadRequest(const TokenQueue * /*queue*/, const TokenRequest &req void IdDialog::IdListCustomPopupMenu( QPoint ) { - QMenu contextMnu( this ); + QMenu contextMnu( this ); - std::list own_identities ; - rsIdentity->getOwnIds(own_identities) ; + std::list own_identities ; + rsIdentity->getOwnIds(own_identities) ; - QTreeWidgetItem *item = ui->idTreeWidget->currentItem(); - - if(item != allItem && item != contactsItem) { - uint32_t item_flags = item->data(RSID_COL_KEYID,Qt::UserRole).toUInt() ; + // make some stats about what's selected. If the same value is used for all selected items, it can be switched. - if(!(item_flags & RSID_FILTER_OWNED_BY_YOU)) - { - if(own_identities.size() <= 1) - { - QAction *action = contextMnu.addAction(QIcon(":/images/chat_24.png"), tr("Chat with this person"), this, SLOT(chatIdentity())); + QList selected_items = ui->idTreeWidget->selectedItems(); - if(own_identities.empty()) - action->setEnabled(false) ; - else - action->setData(QString::fromStdString((own_identities.front()).toStdString())) ; - } - else - { - QMenu *mnu = contextMnu.addMenu(QIcon(":/images/chat_24.png"),tr("Chat with this person as...")) ; + bool root_node_present = false ; + bool one_item_owned_by_you = false ; + uint32_t n_positive_reputations = 0 ; + uint32_t n_negative_reputations = 0 ; + uint32_t n_neutral_reputations = 0 ; + uint32_t n_is_a_contact = 0 ; + uint32_t n_is_not_a_contact = 0 ; + uint32_t n_selected_items =0 ; - for(std::list::const_iterator it=own_identities.begin();it!=own_identities.end();++it) - { - RsIdentityDetails idd ; - rsIdentity->getIdDetails(*it,idd) ; + for(QList::const_iterator it(selected_items.begin());it!=selected_items.end();++it) + { + if(*it == allItem || *it == contactsItem) + { + root_node_present = true ; + continue ; + } - QPixmap pixmap ; + uint32_t item_flags = (*it)->data(RSID_COL_KEYID,Qt::UserRole).toUInt() ; - if(idd.mAvatar.mSize == 0 || !pixmap.loadFromData(idd.mAvatar.mData, idd.mAvatar.mSize, "PNG")) - pixmap = QPixmap::fromImage(GxsIdDetails::makeDefaultIcon(*it)) ; + if(item_flags & RSID_FILTER_OWNED_BY_YOU) + one_item_owned_by_you = true ; + + std::cerr << " item flags = " << item_flags << std::endl; + RsGxsId keyId((*it)->text(RSID_COL_KEYID).toStdString()); - QAction *action = mnu->addAction(QIcon(pixmap), QString("%1 (%2)").arg(QString::fromUtf8(idd.mNickname.c_str()), QString::fromStdString((*it).toStdString())), this, SLOT(chatIdentity())); - action->setData(QString::fromStdString((*it).toStdString())) ; - } - } + RsReputations::ReputationInfo info ; + rsReputations->getReputationInfo(keyId,info) ; - contextMnu.addAction(QIcon(":/images/mail_new.png"), tr("Send message to this person"), this, SLOT(sendMsg())); - - contextMnu.addSeparator(); + switch(info.mOwnOpinion) + { + case RsReputations::OPINION_NEGATIVE: ++n_negative_reputations ; + break ; + + case RsReputations::OPINION_POSITIVE: ++n_positive_reputations ; + break ; + + case RsReputations::OPINION_NEUTRAL: ++n_neutral_reputations ; + break ; + } - RsIdentityDetails details; - std::string keyId = item->text(RSID_COL_KEYID).toStdString(); + ++n_selected_items ; - rsIdentity->getIdDetails(RsGxsId(keyId), details); - - QAction *addContact = contextMnu.addAction(QIcon(), tr("Add to Contacts"), this, SLOT(addtoContacts())); - QAction *removeContact = contextMnu.addAction(QIcon(":/images/cancel.png"), tr("Remove from Contacts"), this, SLOT(removefromContacts())); + if(rsIdentity->isARegularContact(keyId)) + ++n_is_a_contact ; + else + ++n_is_not_a_contact ; + } - - if(details.mFlags & RS_IDENTITY_FLAGS_IS_A_CONTACT) - { - addContact->setVisible(false); - removeContact->setVisible(true); - } - else - { - addContact->setVisible(true); - removeContact->setVisible(false); - } - - contextMnu.addSeparator(); + if(root_node_present) // don't show menu if some of the root nodes are present + return ; - RsReputations::ReputationInfo info ; - std::string Id = item->text(RSID_COL_KEYID).toStdString(); - rsReputations->getReputationInfo(RsGxsId(Id),info) ; - + if(!one_item_owned_by_you) + { + if(n_selected_items == 1) // if only one item is selected, allow to chat with this item + if(own_identities.size() <= 1) + { + QAction *action = contextMnu.addAction(QIcon(":/images/chat_24.png"), tr("Chat with this person"), this, SLOT(chatIdentity())); - QAction *banaction = contextMnu.addAction(QIcon(":/images/denied16.png"), tr("Ban this person"), this, SLOT(banPerson())); - QAction *unbanaction = contextMnu.addAction(QIcon(), tr("Unban this person"), this, SLOT(unbanPerson())); + if(own_identities.empty()) + action->setEnabled(false) ; + else + action->setData(QString::fromStdString((own_identities.front()).toStdString())) ; + } + else + { + QMenu *mnu = contextMnu.addMenu(QIcon(":/images/chat_24.png"),tr("Chat with this person as...")) ; + + for(std::list::const_iterator it=own_identities.begin();it!=own_identities.end();++it) + { + RsIdentityDetails idd ; + rsIdentity->getIdDetails(*it,idd) ; + + QPixmap pixmap ; + + if(idd.mAvatar.mSize == 0 || !pixmap.loadFromData(idd.mAvatar.mData, idd.mAvatar.mSize, "PNG")) + pixmap = QPixmap::fromImage(GxsIdDetails::makeDefaultIcon(*it)) ; + + QAction *action = mnu->addAction(QIcon(pixmap), QString("%1 (%2)").arg(QString::fromUtf8(idd.mNickname.c_str()), QString::fromStdString((*it).toStdString())), this, SLOT(chatIdentity())); + action->setData(QString::fromStdString((*it).toStdString())) ; + } + } + + // always allow to send messages + contextMnu.addAction(QIcon(":/images/mail_new.png"), tr("Send message"), this, SLOT(sendMsg())); + + contextMnu.addSeparator(); + + if(n_is_a_contact == 0) + contextMnu.addAction(QIcon(), tr("Add to Contacts"), this, SLOT(addtoContacts())); + + if(n_is_not_a_contact == 0) + contextMnu.addAction(QIcon(":/images/cancel.png"), tr("Remove from Contacts"), this, SLOT(removefromContacts())); + + contextMnu.addSeparator(); + + if(n_positive_reputations == 0) // only unban when all items are banned + contextMnu.addAction(QIcon(), tr("Set positive opinion"), this, SLOT(positivePerson())); + + if(n_neutral_reputations == 0) // only unban when all items are banned + contextMnu.addAction(QIcon(), tr("Set neutral opinion"), this, SLOT(neutralPerson())); + + if(n_negative_reputations == 0) + contextMnu.addAction(QIcon(":/images/denied16.png"), tr("Set negative opinion"), this, SLOT(negativePerson())); + } + + if(one_item_owned_by_you && n_selected_items==1) + { + contextMnu.addSeparator(); + + contextMnu.addAction(ui->editIdentity); + contextMnu.addAction(ui->removeIdentity); + } - - if(info.mAssessment == RsReputations::ASSESSMENT_BAD) - { - banaction->setVisible(false); - unbanaction->setVisible(true); - } - else - { - banaction->setVisible(true); - unbanaction->setVisible(false); - } - } - contextMnu.addSeparator(); - contextMnu.addAction(ui->editIdentity); - contextMnu.addAction(ui->removeIdentity); - } - - - contextMnu.addSeparator(); - - contextMnu.exec(QCursor::pos()); + contextMnu.exec(QCursor::pos()); } void IdDialog::chatIdentity() @@ -1076,25 +1104,27 @@ void IdDialog::chatIdentity() void IdDialog::sendMsg() { - QTreeWidgetItem *item = ui->idTreeWidget->currentItem(); - if (!item) - { - return; - } + QList selected_items = ui->idTreeWidget->selectedItems(); - MessageComposer *nMsgDialog = MessageComposer::newMsg(); - if (nMsgDialog == NULL) { - return; - } + if(selected_items.empty()) + return ; - std::string keyId = item->text(RSID_COL_KEYID).toStdString(); + MessageComposer *nMsgDialog = MessageComposer::newMsg(); + if (nMsgDialog == NULL) + return; - nMsgDialog->addRecipient(MessageComposer::TO, RsGxsId(keyId)); - nMsgDialog->show(); - nMsgDialog->activateWindow(); + for(QList::const_iterator it(selected_items.begin());it!=selected_items.end();++it) + { + QTreeWidgetItem *item = *it ; + + std::string keyId = item->text(RSID_COL_KEYID).toStdString(); + + nMsgDialog->addRecipient(MessageComposer::TO, RsGxsId(keyId)); + } + nMsgDialog->show(); + nMsgDialog->activateWindow(); /* window will destroy itself! */ - } QString IdDialog::inviteMessage() @@ -1133,33 +1163,48 @@ void IdDialog::sendInvite() } -void IdDialog::banPerson() +void IdDialog::negativePerson() { - QTreeWidgetItem *item = ui->idTreeWidget->currentItem(); - if (!item) - { - return; - } - + QList selected_items = ui->idTreeWidget->selectedItems(); + for(QList::const_iterator it(selected_items.begin());it!=selected_items.end();++it) + { + QTreeWidgetItem *item = *it ; + std::string Id = item->text(RSID_COL_KEYID).toStdString(); rsReputations->setOwnOpinion(RsGxsId(Id),RsReputations::OPINION_NEGATIVE) ; + } requestIdDetails(); requestIdList(); } -void IdDialog::unbanPerson() +void IdDialog::neutralPerson() { - QTreeWidgetItem *item = ui->idTreeWidget->currentItem(); - if (!item) - { - return; - } + QList selected_items = ui->idTreeWidget->selectedItems(); + for(QList::const_iterator it(selected_items.begin());it!=selected_items.end();++it) + { + QTreeWidgetItem *item = *it ; + + std::string Id = item->text(RSID_COL_KEYID).toStdString(); + + rsReputations->setOwnOpinion(RsGxsId(Id),RsReputations::OPINION_NEUTRAL) ; + } + + requestIdDetails(); + requestIdList(); +} +void IdDialog::positivePerson() +{ + QList selected_items = ui->idTreeWidget->selectedItems(); + for(QList::const_iterator it(selected_items.begin());it!=selected_items.end();++it) + { + QTreeWidgetItem *item = *it ; std::string Id = item->text(RSID_COL_KEYID).toStdString(); rsReputations->setOwnOpinion(RsGxsId(Id),RsReputations::OPINION_POSITIVE) ; + } requestIdDetails(); requestIdList(); @@ -1167,30 +1212,28 @@ void IdDialog::unbanPerson() void IdDialog::addtoContacts() { - QTreeWidgetItem *item = ui->idTreeWidget->currentItem(); - if (!item) - { - return; - } - + QList selected_items = ui->idTreeWidget->selectedItems(); + for(QList::const_iterator it(selected_items.begin());it!=selected_items.end();++it) + { + QTreeWidgetItem *item = *it ; std::string Id = item->text(RSID_COL_KEYID).toStdString(); rsIdentity->setAsRegularContact(RsGxsId(Id),true); + } requestIdList(); } void IdDialog::removefromContacts() { - QTreeWidgetItem *item = ui->idTreeWidget->currentItem(); - if (!item) - { - return; - } - +QList selected_items = ui->idTreeWidget->selectedItems(); + for(QList::const_iterator it(selected_items.begin());it!=selected_items.end();++it) + { + QTreeWidgetItem *item = *it ; std::string Id = item->text(RSID_COL_KEYID).toStdString(); rsIdentity->setAsRegularContact(RsGxsId(Id),false); + } requestIdList(); } diff --git a/retroshare-gui/src/gui/Identity/IdDialog.h b/retroshare-gui/src/gui/Identity/IdDialog.h index 1d945429b..be27ebaed 100644 --- a/retroshare-gui/src/gui/Identity/IdDialog.h +++ b/retroshare-gui/src/gui/Identity/IdDialog.h @@ -77,8 +77,9 @@ private slots: void addtoContacts(); void removefromContacts(); - void banPerson(); - void unbanPerson(); + void negativePerson(); + void positivePerson(); + void neutralPerson(); static QString inviteMessage(); void sendInvite(); diff --git a/retroshare-gui/src/gui/Identity/IdDialog.ui b/retroshare-gui/src/gui/Identity/IdDialog.ui index 97469d84c..185655063 100644 --- a/retroshare-gui/src/gui/Identity/IdDialog.ui +++ b/retroshare-gui/src/gui/Identity/IdDialog.ui @@ -7,7 +7,7 @@ 0 0 745 - 500 + 634 @@ -20,21 +20,12 @@ - - 0 - - - 0 - - - 0 - - - 0 - 0 + + 0 + @@ -50,16 +41,7 @@ QFrame::Sunken - - 2 - - - 2 - - - 2 - - + 2 @@ -150,16 +132,7 @@ QFrame::Sunken - - 2 - - - 2 - - - 2 - - + 2 @@ -255,7 +228,7 @@ Reputation - AlignLeading|AlignVCenter + AlignLeft|AlignVCenter @@ -319,16 +292,7 @@ - - 6 - - - 6 - - - 6 - - + 6 @@ -485,6 +449,19 @@ + + + + Qt::Vertical + + + + 20 + 40 + + + + @@ -502,16 +479,7 @@ - - 6 - - - 6 - - - 6 - - + 6 diff --git a/retroshare-gui/src/gui/MainPage.cpp b/retroshare-gui/src/gui/MainPage.cpp index 3ccc58ed3..0eefd45e9 100644 --- a/retroshare-gui/src/gui/MainPage.cpp +++ b/retroshare-gui/src/gui/MainPage.cpp @@ -1,3 +1,5 @@ +#include + #include #include "common/FloatingHelpBrowser.h" @@ -9,12 +11,13 @@ MainPage::MainPage(QWidget *parent , Qt::WindowFlags flags ) : QWidget(parent, f mHelp = ""; } -void MainPage::registerHelpButton(QAbstractButton *button,const QString& help_html_txt) +void MainPage::registerHelpButton(QToolButton *button,const QString& help_html_txt) { if (mHelpBrowser == NULL) - { mHelpBrowser = new FloatingHelpBrowser(this, button) ; - } + + float S = QFontMetricsF(button->font()).height() ; + button->setIconSize(QSize(S,S)) ; mHelpBrowser->setHelpText(help_html_txt) ; } diff --git a/retroshare-gui/src/gui/MainWindow.cpp b/retroshare-gui/src/gui/MainWindow.cpp index 3efd0c23d..c7dfa813d 100644 --- a/retroshare-gui/src/gui/MainWindow.cpp +++ b/retroshare-gui/src/gui/MainWindow.cpp @@ -40,7 +40,7 @@ #include "ui_MainWindow.h" #include "MessengerWindow.h" #include "NetworkDialog.h" -#include "SearchDialog.h" +#include "gui/FileTransfer/SearchDialog.h" #include "gui/FileTransfer/TransfersDialog.h" #include "MessagesDialog.h" #include "SharedFilesDialog.h" diff --git a/retroshare-gui/src/gui/NetworkView.cpp b/retroshare-gui/src/gui/NetworkView.cpp index ea095a39e..44c99736d 100644 --- a/retroshare-gui/src/gui/NetworkView.cpp +++ b/retroshare-gui/src/gui/NetworkView.cpp @@ -43,7 +43,7 @@ NetworkView::NetworkView(QWidget *parent) mScene = new QGraphicsScene(); mScene->setItemIndexMethod(QGraphicsScene::NoIndex); - mScene->setSceneRect(-200, -200, 1200, 1200); + mScene->setSceneRect(0, 0, ui.graphicsView->width(), ui.graphicsView->height()); ui.graphicsView->setScene(mScene); ui.graphicsView->setEdgeLength(ui.edgeLengthSB->value()) ; diff --git a/retroshare-gui/src/gui/NewsFeed.ui b/retroshare-gui/src/gui/NewsFeed.ui index 7b42b35d7..ba5f4b945 100644 --- a/retroshare-gui/src/gui/NewsFeed.ui +++ b/retroshare-gui/src/gui/NewsFeed.ui @@ -91,8 +91,8 @@ Qt::NoFocus - - :/icons/information_128.png:/icons/information_128.png + + :/icons/help_64.png:/icons/help_64.png diff --git a/retroshare-gui/src/gui/RetroShareLink.cpp b/retroshare-gui/src/gui/RetroShareLink.cpp index 88e8f6f29..71c1a91a8 100644 --- a/retroshare-gui/src/gui/RetroShareLink.cpp +++ b/retroshare-gui/src/gui/RetroShareLink.cpp @@ -38,7 +38,7 @@ #include "MainWindow.h" #include "gui/gxsforums/GxsForumsDialog.h" #include "gui/gxschannels/GxsChannelDialog.h" -#include "SearchDialog.h" +#include "gui/FileTransfer/SearchDialog.h" #include "msgs/MessageComposer.h" #include "util/misc.h" #include "common/PeerDefs.h" diff --git a/retroshare-gui/src/gui/SoundManager.cpp b/retroshare-gui/src/gui/SoundManager.cpp index 0a5f117fd..5a839a49e 100644 --- a/retroshare-gui/src/gui/SoundManager.cpp +++ b/retroshare-gui/src/gui/SoundManager.cpp @@ -20,6 +20,8 @@ ****************************************************************/ #include +#include +#include #include #include @@ -28,6 +30,10 @@ #include #endif +// #ifdef QMEDIAPLAYER +// #nclude +// #endif + #include "SoundManager.h" #include "settings/rsharesettings.h" #include "retroshare/rsinit.h" @@ -234,12 +240,60 @@ void SoundManager::playFile(const QString &filename) } QString playFilename = realFilename(filename); - + bool played = false ; + #if QT_VERSION >= QT_VERSION_CHECK (5, 0, 0) - if (!QAudioDeviceInfo::availableDevices(QAudio::AudioOutput).isEmpty()) { + if (!QAudioDeviceInfo::availableDevices(QAudio::AudioOutput).isEmpty()) #else - if (QSound::isAvailable()) { + if (QSound::isAvailable()) #endif - QSound::play(playFilename); - } + { + QSound::play(playFilename); + played = true ; + } + + if(!played) // let's go for the hard core stuff + { + // #ifdef QMEDIAPLAYER + // static QMediaPlayer *qmplayer; + // if (qmplayer == NULL) { + // qmplayer = new QMediaPlayer(); + // qmplayer->setMedia(QMediaContent(QUrl::fromLocalFile(playFilename))); + // } + // std::cerr << "Play QMediaPlayer" << std::endl; + // qmplayer->play(); + // return; + // #endif + +#ifdef Q_OS_LINUX + QString player_cmd = soundDetectPlayer(); + QStringList args = player_cmd.split(' '); + args += filename; + QString prog = args.takeFirst(); + //std::cerr << "Play " << prog.toStdString() << std::endl; + QProcess::startDetached(prog, args); +#endif + } } + + +#ifdef Q_OS_LINUX +/** Detect default player helper on unix like systems + * Inspired by Psi IM (0.15) in common.cpp + */ +QString SoundManager::soundDetectPlayer() +{ + // prefer ALSA on linux + + if (QFile("/proc/asound").exists()) { + return "aplay -q"; + } + // fallback to "play" + return "play"; +} +#endif + + + + + diff --git a/retroshare-gui/src/gui/SoundManager.h b/retroshare-gui/src/gui/SoundManager.h index ca6d26d65..ae929f161 100644 --- a/retroshare-gui/src/gui/SoundManager.h +++ b/retroshare-gui/src/gui/SoundManager.h @@ -67,6 +67,10 @@ signals: public: static void create(); +#ifdef Q_OS_LINUX + static QString soundDetectPlayer(); +#endif + static void initDefault(); static QString defaultFilename(const QString &event, bool check); static QString convertFilename(const QString &filename); @@ -84,7 +88,7 @@ public: static QString eventFilename(const QString &event); static void setEventFilename(const QString &event, const QString &filename); - + private: SoundManager(); }; diff --git a/retroshare-gui/src/gui/chat/ChatWidget.cpp b/retroshare-gui/src/gui/chat/ChatWidget.cpp index f11693669..a08ce7857 100644 --- a/retroshare-gui/src/gui/chat/ChatWidget.cpp +++ b/retroshare-gui/src/gui/chat/ChatWidget.cpp @@ -1657,7 +1657,7 @@ void ChatWidget::updatePeersCustomStateString(const QString& /*peer_id*/, const void ChatWidget::updateStatusString(const QString &statusMask, const QString &statusString, bool permanent) { - ui->typingLabel->setText(QString(statusMask).arg(tr(statusString.toLatin1()))); // displays info for 5 secs. + ui->typingLabel->setText(QString(statusMask).arg(tr(statusString.toUtf8()))); // displays info for 5 secs. ui->typingpixmapLabel->setPixmap(QPixmap(":images/typing.png") ); if (statusString == "is typing...") { @@ -1693,6 +1693,7 @@ void ChatWidget::quote() { QStringList sl = text.split(QRegExp("[\r\n]"),QString::SkipEmptyParts); text = sl.join("\n>"); + text.replace(QChar(-4),"");//Char used when image on text. emit ui->chatTextEdit->append(QString(">") + text); } } diff --git a/retroshare-gui/src/gui/common/MimeTextEdit.cpp b/retroshare-gui/src/gui/common/MimeTextEdit.cpp index 4d292a87e..79ae8de56 100644 --- a/retroshare-gui/src/gui/common/MimeTextEdit.cpp +++ b/retroshare-gui/src/gui/common/MimeTextEdit.cpp @@ -269,7 +269,7 @@ void MimeTextEdit::pasteOwnCertificateLink() void MimeTextEdit::pastePlainText() { - insertPlainText(QApplication::clipboard()->text()); + insertPlainText(QApplication::clipboard()->text().remove(QChar(-4)));//Char used when image on text. } void MimeTextEdit::spoiler() diff --git a/retroshare-gui/src/gui/elastic/graphwidget.cpp b/retroshare-gui/src/gui/elastic/graphwidget.cpp index c0adf04f7..571cdc828 100644 --- a/retroshare-gui/src/gui/elastic/graphwidget.cpp +++ b/retroshare-gui/src/gui/elastic/graphwidget.cpp @@ -127,7 +127,8 @@ GraphWidget::GraphWidget(QWidget *) // scene->setItemIndexMethod(QGraphicsScene::NoIndex); // scene->clear() ; // setScene(scene); -// scene->setSceneRect(0, 0, 500, 500); + +// scene()->setSceneRect(0, 0, width(), height()); setCacheMode(CacheBackground); setViewportUpdateMode(BoundingRectViewportUpdate); @@ -154,7 +155,8 @@ void GraphWidget::clearGraph() // } scene()->clear(); - scene()->setSceneRect(-200, -200, 1000, 1000); + scene()->setSceneRect(0, 0, width(), height()); + _edges.clear(); _nodes.clear(); _friction_factor = 1.0f ; @@ -391,9 +393,11 @@ void GraphWidget::setEdgeLength(uint32_t l) void GraphWidget::setNameSearch(QString s) { + float f = QFontMetrics(font()).height()/16.0 ; + if (s.length() == 0){ for(uint32_t i=0;i<_nodes.size();++i) - _nodes[i]->setNodeDrawSize(20); + _nodes[i]->setNodeDrawSize(12 * f); forceRedraw(); return; } @@ -405,10 +409,10 @@ void GraphWidget::setNameSearch(QString s) if (ns.find(qs) != std::string::npos) { //std::cout << "found!" << '\n'; - ni->setNodeDrawSize(22); + ni->setNodeDrawSize(22 * f); //std::cout << ni->getNodeDrawSize() << '\n'; } else { - ni->setNodeDrawSize(12); + ni->setNodeDrawSize(12 * f); } } @@ -420,47 +424,53 @@ void GraphWidget::forceRedraw() for(uint32_t i=0;i<_nodes.size();++i) _nodes[i]->update(_nodes[i]->boundingRect()) ; } + +void GraphWidget::resizeEvent(QResizeEvent *event) +{ + scene()->setSceneRect(QRectF(QPointF(0,0),event->size())); +} + void GraphWidget::wheelEvent(QWheelEvent *event) { scaleView(pow((double)2, -event->delta() / 240.0)); } -void GraphWidget::drawBackground(QPainter *painter, const QRectF &rect) -{ - Q_UNUSED(rect); - - // Shadow - QRectF sceneRect = this->sceneRect(); - QRectF rightShadow(sceneRect.right(), sceneRect.top() + 5, 5, sceneRect.height()); - QRectF bottomShadow(sceneRect.left() + 5, sceneRect.bottom(), sceneRect.width(), 5); - if (rightShadow.intersects(rect) || rightShadow.contains(rect)) - painter->fillRect(rightShadow, Qt::darkGray); - if (bottomShadow.intersects(rect) || bottomShadow.contains(rect)) - painter->fillRect(bottomShadow, Qt::darkGray); - - // Fill - QLinearGradient gradient(sceneRect.topLeft(), sceneRect.bottomRight()); - gradient.setColorAt(0, Qt::white); - gradient.setColorAt(1, Qt::lightGray); - painter->fillRect(rect.intersected(sceneRect), gradient); - painter->setBrush(Qt::NoBrush); - painter->drawRect(sceneRect); - - // Text - QRectF textRect(sceneRect.left() + 4, sceneRect.top() + 4, - sceneRect.width() - 4, sceneRect.height() - 4); - QString message(tr("Click and drag the nodes around, and zoom with the mouse " - "wheel or the '+' and '-' keys")); - - QFont font = painter->font(); - font.setBold(true); - font.setPointSize(14); - painter->setFont(font); - painter->setPen(Qt::lightGray); - painter->drawText(textRect.translated(2, 2), message); - painter->setPen(Qt::black); - painter->drawText(textRect, message); -} +//void GraphWidget::drawBackground(QPainter *painter, const QRectF &rect) +//{ +// Q_UNUSED(rect); +// +// // Shadow +// QRectF sceneRect = this->sceneRect(); +// QRectF rightShadow(sceneRect.right(), sceneRect.top() + 5, 5, sceneRect.height()); +// QRectF bottomShadow(sceneRect.left() + 5, sceneRect.bottom(), sceneRect.width(), 5); +// if (rightShadow.intersects(rect) || rightShadow.contains(rect)) +// painter->fillRect(rightShadow, Qt::darkGray); +// if (bottomShadow.intersects(rect) || bottomShadow.contains(rect)) +// painter->fillRect(bottomShadow, Qt::darkGray); +// +// // Fill +// QLinearGradient gradient(sceneRect.topLeft(), sceneRect.bottomRight()); +// gradient.setColorAt(0, Qt::white); +// gradient.setColorAt(1, Qt::lightGray); +// painter->fillRect(rect.intersected(sceneRect), gradient); +// painter->setBrush(Qt::NoBrush); +// painter->drawRect(sceneRect); +// +// // Text +// QRectF textRect(sceneRect.left() + 4, sceneRect.top() + 4, +// sceneRect.width() - 4, sceneRect.height() - 4); +// QString message(tr("Click and drag the nodes around, and zoom with the mouse " +// "wheel or the '+' and '-' keys")); +// +// QFont font = painter->font(); +// font.setBold(true); +// font.setPointSize(14); +// painter->setFont(font); +// painter->setPen(Qt::lightGray); +// painter->drawText(textRect.translated(2, 2), message); +// painter->setPen(Qt::black); +// painter->drawText(textRect, message); +//} void GraphWidget::scaleView(qreal scaleFactor) { diff --git a/retroshare-gui/src/gui/elastic/graphwidget.h b/retroshare-gui/src/gui/elastic/graphwidget.h index 7983c5c25..4a7a6a340 100644 --- a/retroshare-gui/src/gui/elastic/graphwidget.h +++ b/retroshare-gui/src/gui/elastic/graphwidget.h @@ -91,10 +91,11 @@ public: void forceRedraw() ; protected: - void keyPressEvent(QKeyEvent *event); - void timerEvent(QTimerEvent *event); - void wheelEvent(QWheelEvent *event); - void drawBackground(QPainter *painter, const QRectF &rect); + virtual void keyPressEvent(QKeyEvent *event); + virtual void timerEvent(QTimerEvent *event); + virtual void wheelEvent(QWheelEvent *event); + virtual void resizeEvent(QResizeEvent *event); + //void drawBackground(QPainter *painter, const QRectF &rect); void scaleView(qreal scaleFactor); diff --git a/retroshare-gui/src/gui/elastic/node.cpp b/retroshare-gui/src/gui/elastic/node.cpp index ee4be2857..77551720d 100644 --- a/retroshare-gui/src/gui/elastic/node.cpp +++ b/retroshare-gui/src/gui/elastic/node.cpp @@ -205,8 +205,8 @@ void Node::calculateForces(const double *map,int width,int height,int W,int H,fl QRectF sceneRect = scene()->sceneRect(); newPos = pos() + QPointF(_speedx, _speedy) / friction_factor; - newPos.setX(qMin(qMax(newPos.x(), sceneRect.left() + 10), sceneRect.right() - 10)); - newPos.setY(qMin(qMax(newPos.y(), sceneRect.top() + 10), sceneRect.bottom() - 10)); + newPos.setX(qMin(qMax(newPos.x(), sceneRect.left()), sceneRect.right())); + newPos.setY(qMin(qMax(newPos.y(), sceneRect.top()) , sceneRect.bottom())); } bool Node::advance() @@ -222,20 +222,22 @@ bool Node::advance() QRectF Node::boundingRect() const { - qreal adjust = 2; + float m = QFontMetricsF(graph->font()).height(); + float f = m/16.0; + qreal adjust = 2*f; /* add in the size of the text */ - qreal realwidth = 40; + qreal realwidth = 40*f; + if (mDeterminedBB) { realwidth = mBBWidth + adjust; } - if (realwidth < 23 + adjust) + if (realwidth < 23*f + adjust) { - realwidth = 23 + adjust; + realwidth = 23*f + adjust; } - return QRectF(-10 - adjust, -10 - adjust, - realwidth, 23 + adjust); + return QRectF(-10*f - adjust, -10*f - adjust, realwidth, 23*f + adjust); } QPainterPath Node::shape() const @@ -314,12 +316,17 @@ void Node::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWid painter->setBrush(gradient); painter->setPen(QPen(Qt::black, 0)); painter->drawEllipse(-mNodeDrawSize2, -mNodeDrawSize2, mNodeDrawSize, mNodeDrawSize); - painter->drawText(-10, 0, QString::fromUtf8(_desc_string.c_str())); + + QString txt = QString::fromUtf8(_desc_string.c_str()); + float m = QFontMetricsF(graph->font()).height(); + float f = m/16.0; + + painter->drawText(-10, 5*f, txt) ; if (!mDeterminedBB) { - QRect textBox = painter->boundingRect(-10, 0, 400, 20, 0, QString::fromUtf8(_desc_string.c_str())); - mBBWidth = textBox.width(); + QRect textBox = painter->boundingRect(-10, 5*f, QFontMetricsF(graph->font()).width(txt), 1.5*m, Qt::AlignVCenter, QString::fromUtf8(_desc_string.c_str())); + mBBWidth = textBox.width()+40*f; mDeterminedBB = true; } } diff --git a/retroshare-gui/src/gui/icons.qrc b/retroshare-gui/src/gui/icons.qrc index 8967f1670..0a7f8342a 100644 --- a/retroshare-gui/src/gui/icons.qrc +++ b/retroshare-gui/src/gui/icons.qrc @@ -3,6 +3,9 @@ icons/add_user_256.png icons/anonymous_blue_128.png icons/anonymous_green_128.png + icons/aol.png + icons/avatar_128.png + icons/avatar_grey_128.png icons/blank_blue_128.png icons/blank_green_128.png icons/browsable_blue_128.png @@ -19,6 +22,7 @@ icons/friends_128.png icons/global_switch_off_128.png icons/global_switch_on_128.png + icons/gmail.png icons/help_128.png icons/help_64.png icons/information_128.png @@ -38,6 +42,7 @@ icons/mail_old_128.png icons/mail_red_128.png icons/newsfeed128.png + icons/outlook.png icons/plugins_128.png icons/posted_128.png icons/posted_red_128.png @@ -55,19 +60,18 @@ icons/tile_downloaded_48.png icons/tile_downloading_48.png icons/tile_inactive_48.png + icons/tor-logo.png + icons/tor-off.png + icons/tor-on.png + icons/tor-starting.png + icons/tor-stopping.png icons/user-away_64.png icons/user-away-extended_64.png icons/user-busy_64.png icons/user-offline_64.png icons/user-online_64.png - icons/yellow_biohazard64.png - icons/gmail.png icons/yahoo.png - icons/outlook.png - icons/aol.png icons/yandex.png - icons/tor-on.png - icons/tor-logo.png - icons/tor-off.png + icons/yellow_biohazard64.png diff --git a/retroshare-gui/src/gui/icons/avatar_128.png b/retroshare-gui/src/gui/icons/avatar_128.png new file mode 100644 index 000000000..feb636e39 Binary files /dev/null and b/retroshare-gui/src/gui/icons/avatar_128.png differ diff --git a/retroshare-gui/src/gui/icons/avatar_grey_128.png b/retroshare-gui/src/gui/icons/avatar_grey_128.png new file mode 100644 index 000000000..bf8c4ecca Binary files /dev/null and b/retroshare-gui/src/gui/icons/avatar_grey_128.png differ diff --git a/retroshare-gui/src/gui/settings/MessagePage.ui b/retroshare-gui/src/gui/settings/MessagePage.ui index 5a02693da..57d801bed 100644 --- a/retroshare-gui/src/gui/settings/MessagePage.ui +++ b/retroshare-gui/src/gui/settings/MessagePage.ui @@ -17,6 +17,41 @@ + + + + Distant messages: + + + + + + + Everyone + + + + + Contacts + + + + + Nobody + + + + + + + + Accept encrypted distant messages from + + + + + + @@ -54,41 +89,6 @@ - - - - Distant messages: - - - - - - - Everyone - - - - - Contacts - - - - - Nobody - - - - - - - - Accept encrypted distant messages from - - - - - - diff --git a/retroshare-gui/src/gui/settings/PluginsPage.ui b/retroshare-gui/src/gui/settings/PluginsPage.ui index e357307ec..895bafed7 100644 --- a/retroshare-gui/src/gui/settings/PluginsPage.ui +++ b/retroshare-gui/src/gui/settings/PluginsPage.ui @@ -27,9 +27,6 @@ Plugins - - 6 - @@ -43,7 +40,7 @@ 0 0 - 391 + 920 16 @@ -74,20 +71,7 @@ - - - - 0 - 0 - - - - - 16777215 - 50 - - - + diff --git a/retroshare-gui/src/gui/settings/ServerPage.ui b/retroshare-gui/src/gui/settings/ServerPage.ui index 712e49f3e..34a136302 100755 --- a/retroshare-gui/src/gui/settings/ServerPage.ui +++ b/retroshare-gui/src/gui/settings/ServerPage.ui @@ -798,6 +798,9 @@ behind a firewall or a VPN. + + <html><head/><body><p>This is the port of the Tor Socks proxy. Your Retroshare node can use this port to connect to</p><p>Hidden nodes. The led at right turns green when this port is active on your computer. </p><p>This does not mean however that your Retroshare traffic transits though Tor. It does only if </p><p>you connect to Hidden nodes, or if you are running a Hidden node yourself.</p></body></html> + 10 @@ -828,6 +831,9 @@ behind a firewall or a VPN. + + <html><head/><body><p>This led is green when the port listen on the left is active on your computer. It does not</p><p>mean that your Retroshare traffic transits though Tor. It will do so only if </p><p>you connect to Hidden nodes, or if you are running a Hidden node yourself.</p></body></html> + Tor outgoing Okay @@ -859,6 +865,9 @@ behind a firewall or a VPN. + + <html><head/><body><p>This is the port of the I2P Socks proxy. Your Retroshare node can use this port to connect to</p><p>Hidden nodes. The led at right turns green when this port is active on your computer. </p><p>This does not mean however that your Retroshare traffic transits though I2P. It does only if </p><p>you connect to Hidden nodes, or if you are running a Hidden node yourself.</p></body></html> + 10 @@ -883,6 +892,9 @@ behind a firewall or a VPN. + + <html><head/><body><p>This led is green when the port listen on the left is active on your computer. It does not</p><p>mean that your Retroshare traffic transits though I2P. It will do so only if </p><p>you connect to Hidden nodes, or if you are running a Hidden node yourself.</p></body></html> + I2P outgoing Okay @@ -949,7 +961,7 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why - <html><head/><body><p>This button simulates a SSL connection to your hidden address using the corresponding proxy. If your hidden node is reachable, it should cause a SSL handshake error, which RS will interpret as a valid connection state. This operation might also cause several &quot;security warning&quot; about connections from your local host IP (127.0.0.1) in the News Feed if you enabled it,</p></body></html> + <html><head/><body><p>This button simulates a SSL connection to your hidden address using the corresponding proxy. If your hidden node is reachable, it should cause a SSL handshake error, which RS will interpret as a valid connection state. This operation might also cause several &quot;security warning&quot; about connections from your local host IP (127.0.0.1) in the News Feed if you enabled it, which you should interpret as a sign of good communication.</p></body></html> Test @@ -1016,6 +1028,9 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why + + <html><head/><body><p>This led turns green only if you launch an active test using the above button. </p><p>When it does, it means that your hidden node can be reached from anywhere, using the Tor (resp. I2P) </p><p>network. Congratulations!</p></body></html> + incoming ok diff --git a/retroshare-gui/src/gui/settings/settings.ui b/retroshare-gui/src/gui/settings/settings.ui index 2b4d73c58..2784c1c18 100755 --- a/retroshare-gui/src/gui/settings/settings.ui +++ b/retroshare-gui/src/gui/settings/settings.ui @@ -23,16 +23,7 @@ 6 - - 0 - - - 0 - - - 0 - - + 0 @@ -106,29 +97,17 @@ - - - 130 - 0 - + + + 0 + 0 + - - - 130 - 16777215 - - - - false - - - - 24 - 24 - + + Qt::IgnoreAction - Qt::ElideMiddle + Qt::ElideRight QListView::Static @@ -148,12 +127,6 @@ 0 - - - 100 - 26 - - QListView::ListMode @@ -191,21 +164,12 @@ 0 0 - 666 - 517 + 540 + 495 - - 3 - - - 3 - - - 3 - - + 3 diff --git a/retroshare-gui/src/gui/statistics/BWGraph.h b/retroshare-gui/src/gui/statistics/BWGraph.h index dbab1ed14..92187913f 100644 --- a/retroshare-gui/src/gui/statistics/BWGraph.h +++ b/retroshare-gui/src/gui/statistics/BWGraph.h @@ -25,7 +25,6 @@ public: virtual void getValues(std::map& values) const; virtual QString displayValue(float v) const; -// virtual QString displayName(int i) const; virtual QString legend(int i,float v) const; virtual void update(); QString unitName() const ; diff --git a/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.cpp b/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.cpp index 5d411c120..5ef4a9d68 100644 --- a/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.cpp +++ b/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.cpp @@ -22,6 +22,8 @@ BandwidthStatsWidget::BandwidthStatsWidget(QWidget *parent) ui.unit_CB->addItem(tr("KB/s")) ; ui.unit_CB->addItem(tr("Count")) ; + + ui.logScale_CB->setChecked(true) ; ui.bwgraph_BW->source()->setSelector(BWGraphSource::SELECTOR_TYPE_FRIEND,BWGraphSource::GRAPH_TYPE_SUM) ; ui.bwgraph_BW->source()->setSelector(BWGraphSource::SELECTOR_TYPE_SERVICE,BWGraphSource::GRAPH_TYPE_SUM) ; @@ -33,6 +35,7 @@ BandwidthStatsWidget::BandwidthStatsWidget(QWidget *parent) QObject::connect(ui.updn_CB ,SIGNAL(currentIndexChanged(int)),this, SLOT( updateUpDownSelection(int))) ; QObject::connect(ui.unit_CB ,SIGNAL(currentIndexChanged(int)),this, SLOT( updateUnitSelection(int))) ; QObject::connect(ui.service_CB,SIGNAL(currentIndexChanged(int)),this, SLOT(updateServiceSelection(int))) ; + QObject::connect(ui.logScale_CB,SIGNAL(toggled(bool)),this, SLOT(toggleLogScale(bool))) ; // setup one timer for auto-update @@ -42,6 +45,13 @@ BandwidthStatsWidget::BandwidthStatsWidget(QWidget *parent) mTimer->start(2000) ; } +void BandwidthStatsWidget::toggleLogScale(bool b) +{ + if(b) + ui.bwgraph_BW->setFlags(RSGraphWidget::RSGRAPH_FLAGS_LOG_SCALE_Y) ; + else + ui.bwgraph_BW->resetFlags(RSGraphWidget::RSGRAPH_FLAGS_LOG_SCALE_Y) ; +} void BandwidthStatsWidget::updateComboBoxes() { if(!isVisible()) diff --git a/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.h b/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.h index b3fc1e57f..9a835fc57 100644 --- a/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.h +++ b/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.h @@ -14,7 +14,8 @@ protected slots: void updateComboBoxes() ; void updateUpDownSelection(int n); void updateUnitSelection(int n); - + void toggleLogScale(bool b); + private: Ui::BwStatsWidget ui; diff --git a/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.ui b/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.ui index 3ed54ef4e..e99058ac3 100644 --- a/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.ui +++ b/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.ui @@ -6,8 +6,8 @@ 0 0 - 812 - 349 + 1128 + 385 @@ -18,14 +18,7 @@ 0 - - - QFrame::StyledPanel - - - QFrame::Raised - - + @@ -110,6 +103,13 @@ + + + + Log scale + + + @@ -131,8 +131,8 @@ BWGraph - QFrame -
gui/statistics/BWGraph.h
+ QWidget +
gui/statistics/BWGraph.h
1
diff --git a/retroshare-gui/src/gui/statistics/GlobalRouterStatistics.cpp b/retroshare-gui/src/gui/statistics/GlobalRouterStatistics.cpp index 91139618b..60a6519ba 100644 --- a/retroshare-gui/src/gui/statistics/GlobalRouterStatistics.cpp +++ b/retroshare-gui/src/gui/statistics/GlobalRouterStatistics.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -52,7 +53,7 @@ #define COL_RECEIVED 7 #define COL_SEND 8 - +static const int PARTIAL_VIEW_SIZE = 5 ; static const int MAX_TUNNEL_REQUESTS_DISPLAY = 10 ; static QColor colorScale(float f) @@ -211,6 +212,7 @@ GlobalRouterStatisticsWidget::GlobalRouterStatisticsWidget(QWidget *parent) maxWidth = 400*fact ; maxHeight = 0 ; + mCurrentN = PARTIAL_VIEW_SIZE/2+1 ; } void GlobalRouterStatisticsWidget::updateContent() @@ -218,6 +220,8 @@ void GlobalRouterStatisticsWidget::updateContent() RsGRouter::GRouterRoutingMatrixInfo matrix_info ; rsGRouter->getRoutingMatrixInfo(matrix_info) ; + + mNumberOfKnownKeys = matrix_info.per_friend_probabilities.size() ; float size = QFontMetricsF(font()).height() ; float fact = size/14.0 ; @@ -302,44 +306,85 @@ void GlobalRouterStatisticsWidget::updateContent() oy += celly ; oy += celly ; - //print friends in the same order their prob is shown - QString FO = tr("Friend Order ("); - RsPeerDetails peer_ssl_details; - for(uint32_t i=0;igetPeerDetails(matrix_info.friend_ids[i], peer_ssl_details); - QString fn = QString::fromUtf8(peer_ssl_details.name.c_str()); - FO+=fn; - FO+=" "; - - } - FO+=")"; - - painter.drawText(ox+0*cellx,oy+fm_times.height(),FO) ; - oy += celly ; - oy += celly ; +// //print friends in the same order their prob is shown +// QString FO = tr("Friend Order ("); +// RsPeerDetails peer_ssl_details; +// for(uint32_t i=0;igetPeerDetails(matrix_info.friend_ids[i], peer_ssl_details); +// QString fn = QString::fromUtf8(peer_ssl_details.name.c_str()); +// FO+=fn; +// FO+=" "; +// +// } +// FO+=")"; +// +// painter.drawText(ox+0*cellx,oy+fm_times.height(),FO) ; +// oy += celly ; +// oy += celly ; static const int MaxKeySize = 20*fact ; painter.setFont(monospace_f) ; - for(std::map >::const_iterator it(matrix_info.per_friend_probabilities.begin());it!=matrix_info.per_friend_probabilities.end();++it) + int n=0; + QString ids; + std::vector current_probs ; + int current_oy = 0 ; + + mMinWheelZoneX = ox+2*cellx ; + mMinWheelZoneY = oy ; + + for(std::map >::const_iterator it(matrix_info.per_friend_probabilities.begin());it!=matrix_info.per_friend_probabilities.end();++it,++n) + if(n >= mCurrentN-PARTIAL_VIEW_SIZE/2 && n <= mCurrentN+PARTIAL_VIEW_SIZE/2) + { + //bool is_null = false ; + + //for(uint32_t i=0;isecond[i] > 0.0) + // is_null = false ; + + //if(!is_null) + //{ + ids = QString::fromStdString(it->first.toStdString())+" : " ; + mMaxWheelZoneX = ox+2*cellx + fm_monospace.width(ids); + painter.drawText(ox+2*cellx,oy+celly,ids) ; + + for(uint32_t i=0;isecond[i])) ; + + if(n == mCurrentN) + { + current_probs = it->second ; + current_oy = oy ; + } + + oy += celly ; + //} + + } + mMaxWheelZoneY = oy+celly ; + + painter.setPen(QColor::fromRgb(0,0,0)) ; + + painter.setPen(QColor::fromRgb(0.5,0.5,0.5)); + painter.drawRect(ox+2*cellx,current_oy+0.15*celly,fm_monospace.width(ids)+cellx*matrix_info.friend_ids.size()- 2*cellx,celly) ; + + float total_length = (matrix_info.friend_ids.size()+2)*cellx ; + + if(!current_probs.empty()) + for(uint32_t i=0;isecond[i] > 0.0) - is_null = false ; - - if(!is_null) - { - QString ids = QString::fromStdString(it->first.toStdString())+" : " ; - painter.drawText(ox+2*cellx,oy+celly,ids) ; - - for(uint32_t i=0;isecond[i])) ; - - oy += celly ; - } + float x1 = ox+(i+0.5)*cellx+fm_monospace.width(ids) ; + float y1 = oy+0.15*celly ; + float y2 = y1+(matrix_info.friend_ids.size()-1-i+1)*celly; + + RsPeerDetails peer_ssl_details; + rsPeers->getPeerDetails(matrix_info.friend_ids[i], peer_ssl_details); + + painter.drawLine(x1,y1,x1,y2); + painter.drawLine(x1,y2,x1 + total_length - i*cellx,y2) ; + painter.drawText(cellx+ x1 + total_length - i*cellx,y2+(0.35)*celly, QString::fromUtf8(peer_ssl_details.name.c_str()) + " ("+QString::number(current_probs[i])+")"); } + oy += celly * (2+matrix_info.friend_ids.size()); oy += celly ; oy += celly ; @@ -350,6 +395,24 @@ void GlobalRouterStatisticsWidget::updateContent() maxHeight = oy ; } +void GlobalRouterStatisticsWidget::wheelEvent(QWheelEvent *e) +{ + if(e->x() < mMinWheelZoneX || e->x() > mMaxWheelZoneX || e->y() < mMinWheelZoneY || e->y() > mMaxWheelZoneY) + { + QWidget::wheelEvent(e) ; + return ; + } + + if(e->delta() > 0 && mCurrentN+PARTIAL_VIEW_SIZE/2+1 < mNumberOfKnownKeys) + mCurrentN++ ; + + if(e->delta() < 0 && mCurrentN > PARTIAL_VIEW_SIZE/2+1) + mCurrentN-- ; + + updateContent(); + update(); +} + QString GlobalRouterStatisticsWidget::speedString(float f) { if(f < 1.0f) diff --git a/retroshare-gui/src/gui/statistics/GlobalRouterStatistics.h b/retroshare-gui/src/gui/statistics/GlobalRouterStatistics.h index 2180849cc..fa86448cf 100644 --- a/retroshare-gui/src/gui/statistics/GlobalRouterStatistics.h +++ b/retroshare-gui/src/gui/statistics/GlobalRouterStatistics.h @@ -68,6 +68,7 @@ class GlobalRouterStatisticsWidget: public QWidget virtual void paintEvent(QPaintEvent *event) ; virtual void resizeEvent(QResizeEvent *event); + virtual void wheelEvent(QWheelEvent *event); void updateContent() ; private: @@ -75,5 +76,11 @@ class GlobalRouterStatisticsWidget: public QWidget QPixmap pixmap ; int maxWidth,maxHeight ; + int mCurrentN ; + int mNumberOfKnownKeys ; + int mMinWheelZoneX ; + int mMinWheelZoneY ; + int mMaxWheelZoneX ; + int mMaxWheelZoneY ; }; diff --git a/retroshare-gui/src/gui/statusbar/SysTrayStatus.cpp b/retroshare-gui/src/gui/statusbar/SysTrayStatus.cpp index 784cbc5de..38c26b746 100644 --- a/retroshare-gui/src/gui/statusbar/SysTrayStatus.cpp +++ b/retroshare-gui/src/gui/statusbar/SysTrayStatus.cpp @@ -25,9 +25,9 @@ #include "SysTrayStatus.h" -#define IMAGE_NOONLINE ":/images/logo/logo_24_0.png" -#define IMAGE_ONEONLINE ":/images/logo/logo_24_1.png" -#define IMAGE_TWOONLINE ":/images/logo/logo_24_2.png" +#define IMAGE_NOONLINE ":/icons/logo_0_connected_128.png" +#define IMAGE_ONEONLINE ":/icons/logo_1_connected_128.png" +#define IMAGE_TWOONLINE ":/icons/logo_2_connected_128.png" SysTrayStatus::SysTrayStatus(QWidget *parent) : QWidget(parent) @@ -40,7 +40,6 @@ SysTrayStatus::SysTrayStatus(QWidget *parent) : imageButton->setIcon(QIcon(IMAGE_NOONLINE)); imageButton->setFlat(true); imageButton->setCheckable(false); - imageButton->setMaximumSize(24, 24); imageButton->setFocusPolicy(Qt::ClickFocus); hbox->addWidget(imageButton); diff --git a/retroshare-gui/src/gui/statusbar/ToasterDisable.cpp b/retroshare-gui/src/gui/statusbar/ToasterDisable.cpp index 3e17637c5..e5636e76f 100644 --- a/retroshare-gui/src/gui/statusbar/ToasterDisable.cpp +++ b/retroshare-gui/src/gui/statusbar/ToasterDisable.cpp @@ -36,9 +36,12 @@ ToasterDisable::ToasterDisable(QWidget *parent) hbox->setSpacing(0); imageButton = new QPushButton(this); + + int S = QFontMetricsF(imageButton->font()).height(); + imageButton->setFlat(true); imageButton->setCheckable(true); - imageButton->setMaximumSize(24, 24); + imageButton->setMaximumSize(S,S); imageButton->setFocusPolicy(Qt::ClickFocus); hbox->addWidget(imageButton); @@ -55,7 +58,7 @@ ToasterDisable::ToasterDisable(QWidget *parent) void ToasterDisable::disable(bool isDisable) { - imageButton->setIcon(QIcon(isDisable ? IMAGE_TOASTERDISABLE : IMAGE_TOASTERENABLE)); + imageButton->setIcon(QPixmap(isDisable ? IMAGE_TOASTERDISABLE : IMAGE_TOASTERENABLE)); imageButton->setToolTip(isDisable ? tr("All Toasters are disabled") : tr("Toasters are enabled")); imageButton->setChecked(isDisable); } diff --git a/retroshare-gui/src/gui/statusbar/dhtstatus.cpp b/retroshare-gui/src/gui/statusbar/dhtstatus.cpp index 7ab41f033..936ab0035 100644 --- a/retroshare-gui/src/gui/statusbar/dhtstatus.cpp +++ b/retroshare-gui/src/gui/statusbar/dhtstatus.cpp @@ -40,10 +40,13 @@ DHTStatus::DHTStatus(QWidget *parent) hbox->setSpacing(6); statusDHT = new QLabel("" + tr("DHT") + ":", this ); + statusDHT->setToolTip(tr("

Retroshare uses Bittorrent's DHT as a proxy for connexions. It does not \"store\" your IP in the DHT. \ + Instead the DHT is used by your friends to reach you while processing standard DHT requests. \ + The status bullet will turn green as soon as Retroshare gets a DHT response from one of your friends.

")) ; hbox->addWidget(statusDHT); dhtstatusLabel = new QLabel( this ); - dhtstatusLabel->setPixmap(QPixmap(":/images/grayled.png")); + dhtstatusLabel->setPixmap(QPixmap(":/icons/bullet_grey_128.png")); hbox->addWidget(dhtstatusLabel); spaceLabel = new QLabel( "|", this ); @@ -52,7 +55,8 @@ DHTStatus::DHTStatus(QWidget *parent) dhtnetworkLabel = new QLabel( this ); dhtnetworkLabel->setVisible(false); - dhtnetworkLabel->setPixmap(QPixmap(":/images/dht16.png")); + int S = QFontMetricsF(dhtnetworkLabel->font()).height(); + dhtnetworkLabel->setPixmap(QPixmap(":/images/dht32.png").scaledToHeight(S,Qt::SmoothTransformation)); hbox->addWidget(dhtnetworkLabel); dhtnetworksizeLabel = new QLabel( "0 (0) ",this ); @@ -125,7 +129,7 @@ void DHTStatus::getDHTStatus() { // RED - some issue. dhtstatusLabel->setPixmap(QPixmap(":/icons/bullet_red_128.png").scaledToHeight(S,Qt::SmoothTransformation)); - dhtstatusLabel->setToolTip( text + tr("DHT Error")); + dhtstatusLabel->setToolTip( text + tr("No peer found in DHT")); spaceLabel->setVisible(false); dhtnetworkLabel->setVisible(false); diff --git a/retroshare-gui/src/gui/statusbar/peerstatus.cpp b/retroshare-gui/src/gui/statusbar/peerstatus.cpp index e496ae13e..084620a95 100644 --- a/retroshare-gui/src/gui/statusbar/peerstatus.cpp +++ b/retroshare-gui/src/gui/statusbar/peerstatus.cpp @@ -31,13 +31,13 @@ PeerStatus::PeerStatus(QWidget *parent) hbox->setMargin(0); hbox->setSpacing(6); + iconLabel = new QLabel( this ); - iconLabel->setPixmap(QPixmap(":/images/user/identitygray16.png")); - // iconLabel doesn't change over time, so we didn't need a minimum size + int S = QFontMetricsF(iconLabel->font()).height(); + iconLabel->setPixmap(QPixmap(":/icons/avatar_grey_128.png").scaledToHeight(S,Qt::SmoothTransformation)); hbox->addWidget(iconLabel); statusPeers = new QLabel( tr("Friends: 0/0"), this ); -// statusPeers->setMinimumSize( statusPeers->frameSize().width() + 0, 0 ); hbox->addWidget(statusPeers); _compactMode = false; @@ -48,22 +48,19 @@ PeerStatus::PeerStatus(QWidget *parent) void PeerStatus::getPeerStatus(unsigned int nFriendCount, unsigned int nOnlineCount) { - /* set users/friends/network */ + /* set users/friends/network */ - if (statusPeers){ - statusPeers->setToolTip(tr("Online Friends/Total Friends") ); - QString text; - if (_compactMode) text = QString("%1/%2").arg(nOnlineCount).arg(nFriendCount); - else text = QString("%1: %2/%3 ").arg(tr("Friends")).arg(nOnlineCount).arg(nFriendCount); - statusPeers -> setText(text); - } + if (statusPeers){ + statusPeers->setToolTip(tr("Online Friends/Total Friends") ); + QString text; + if (_compactMode) text = QString("%1/%2").arg(nOnlineCount).arg(nFriendCount); + else text = QString("%1: %2/%3 ").arg(tr("Friends")).arg(nOnlineCount).arg(nFriendCount); + statusPeers -> setText(text); + } + int S = QFontMetricsF(iconLabel->font()).height(); - if (nOnlineCount > 0) - { - iconLabel->setPixmap(QPixmap(":/images/user/identity16.png")); - } - else - { - iconLabel->setPixmap(QPixmap(":/images/user/identitygray16.png")); - } + if (nOnlineCount > 0) + iconLabel->setPixmap(QPixmap(":/icons/avatar_128.png").scaledToHeight(S,Qt::SmoothTransformation)); + else + iconLabel->setPixmap(QPixmap(":/icons/avatar_grey_128.png").scaledToHeight(S,Qt::SmoothTransformation)); } diff --git a/retroshare-gui/src/main.cpp b/retroshare-gui/src/main.cpp index ba44deee5..20ee39561 100644 --- a/retroshare-gui/src/main.cpp +++ b/retroshare-gui/src/main.cpp @@ -25,7 +25,7 @@ #include #include "gui/MainWindow.h" #include "gui/FriendsDialog.h" -#include "gui/SearchDialog.h" +#include "gui/FileTransfer/SearchDialog.h" #include "gui/FileTransfer/TransfersDialog.h" #include "gui/SharedFilesDialog.h" #include "gui/NetworkDialog.h" diff --git a/retroshare-gui/src/retroshare-gui.pro b/retroshare-gui/src/retroshare-gui.pro index 963a6b20f..83a7ddd99 100644 --- a/retroshare-gui/src/retroshare-gui.pro +++ b/retroshare-gui/src/retroshare-gui.pro @@ -320,7 +320,6 @@ HEADERS += rshare.h \ gui/RemoteDirModel.h \ gui/RetroShareLink.h \ gui/SearchTreeWidget.h \ - gui/SearchDialog.h \ gui/SharedFilesDialog.h \ gui/ShareManager.h \ gui/ShareDialog.h \ @@ -329,6 +328,7 @@ HEADERS += rshare.h \ gui/HelpDialog.h \ gui/LogoBar.h \ gui/common/AvatarDialog.h \ + gui/FileTransfer/SearchDialog.h \ gui/FileTransfer/xprogressbar.h \ gui/FileTransfer/DetailsDialog.h \ gui/FileTransfer/FileTransferInfoWidget.h \ @@ -558,11 +558,11 @@ FORMS += gui/StartDialog.ui \ gui/common/AvatarDialog.ui \ gui/FileTransfer/TransfersDialog.ui \ gui/FileTransfer/DetailsDialog.ui \ + gui/FileTransfer/SearchDialog.ui \ gui/MainWindow.ui \ gui/NetworkView.ui \ gui/MessengerWindow.ui \ gui/FriendsDialog.ui \ - gui/SearchDialog.ui \ gui/SharedFilesDialog.ui \ gui/ShareManager.ui \ gui/ShareDialog.ui \ @@ -682,7 +682,6 @@ SOURCES += main.cpp \ gui/RsAutoUpdatePage.cpp \ gui/RetroShareLink.cpp \ gui/SearchTreeWidget.cpp \ - gui/SearchDialog.cpp \ gui/SharedFilesDialog.cpp \ gui/ShareManager.cpp \ gui/ShareDialog.cpp \ @@ -694,6 +693,7 @@ SOURCES += main.cpp \ gui/im_history/IMHistoryItemPainter.cpp \ gui/help/browser/helpbrowser.cpp \ gui/help/browser/helptextbrowser.cpp \ + gui/FileTransfer/SearchDialog.cpp \ gui/FileTransfer/TransfersDialog.cpp \ gui/FileTransfer/FileTransferInfoWidget.cpp \ gui/FileTransfer/DLListDelegate.cpp \ diff --git a/retroshare-gui/src/retroshare-gui/mainpage.h b/retroshare-gui/src/retroshare-gui/mainpage.h index 064fc2210..e87e9836f 100644 --- a/retroshare-gui/src/retroshare-gui/mainpage.h +++ b/retroshare-gui/src/retroshare-gui/mainpage.h @@ -30,6 +30,7 @@ class UserNotify; class QAbstractButton ; class FloatingHelpBrowser; +class QToolButton; class MainPage : public QWidget { @@ -60,7 +61,7 @@ public: // Overload this to add some help info to the page. The way the info is // shown is handled by showHelp() below; // - void registerHelpButton(QAbstractButton *button, const QString& help_html_text) ; + void registerHelpButton(QToolButton *button, const QString& help_html_text) ; private: FloatingHelpBrowser *mHelpBrowser ; diff --git a/retroshare-gui/src/util/HandleRichText.cpp b/retroshare-gui/src/util/HandleRichText.cpp index c2b7174e4..886bb60bb 100644 --- a/retroshare-gui/src/util/HandleRichText.cpp +++ b/retroshare-gui/src/util/HandleRichText.cpp @@ -1067,6 +1067,7 @@ QString RsHtml::makeQuotedText(RSTextBrowser *browser) } QStringList sl = text.split(QRegExp("[\r\n]"),QString::SkipEmptyParts); text = sl.join("\n>"); + text.replace(QChar(-4),"");//Char used when image on text. return QString(">") + text; }