mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-21 21:55:15 -05:00
Improved the notification model so that it uses Qt signals to avoid core dumps, and improved the gui to increase responsiveness (e.g. forum display, network discovery info, friends, msg deletion and selection)
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1050 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
93fa052b58
commit
59cdaba9dc
@ -322,7 +322,19 @@ int FileIndexStore::RequestDirDetails(void *ref, DirDetails &details, uint32_t f
|
|||||||
/* cannot be null -> no files at root level */
|
/* cannot be null -> no files at root level */
|
||||||
parent=file->parent;
|
parent=file->parent;
|
||||||
}
|
}
|
||||||
|
// Well, yes, it can be null, beleive me. In such a case it may be that
|
||||||
|
// file is a person entry.
|
||||||
|
|
||||||
|
if(parent==NULL)
|
||||||
|
{
|
||||||
|
if(NULL == (person = dynamic_cast<PersonEntry *>(file)))
|
||||||
|
{
|
||||||
|
std::cerr << "Major Error- Not PersonEntry!";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
/* NEW add path (to dir - if dir, or parent dir - if file? */
|
/* NEW add path (to dir - if dir, or parent dir - if file? */
|
||||||
details.path = parent->path;
|
details.path = parent->path;
|
||||||
|
|
||||||
@ -335,7 +347,7 @@ int FileIndexStore::RequestDirDetails(void *ref, DirDetails &details, uint32_t f
|
|||||||
std::cerr << "Major Error- Not PersonEntry!";
|
std::cerr << "Major Error- Not PersonEntry!";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
details.id = person->id;
|
details.id = person->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,6 +155,7 @@ std::string GPGAuthMgr::OwnId()
|
|||||||
|
|
||||||
bool GPGAuthMgr::getAllList(std::list<std::string> &ids)
|
bool GPGAuthMgr::getAllList(std::list<std::string> &ids)
|
||||||
{
|
{
|
||||||
|
std::cout << "344444555533333333" << std::endl ;
|
||||||
std::map<std::string, pqiAuthDetails>::iterator it;
|
std::map<std::string, pqiAuthDetails>::iterator it;
|
||||||
for(it = mKeyList.begin(); it != mKeyList.end(); it++)
|
for(it = mKeyList.begin(); it != mKeyList.end(); it++)
|
||||||
{
|
{
|
||||||
|
@ -209,6 +209,7 @@ const int NOTIFY_LIST_SEARCHLIST = 4;
|
|||||||
const int NOTIFY_LIST_MESSAGELIST = 5;
|
const int NOTIFY_LIST_MESSAGELIST = 5;
|
||||||
const int NOTIFY_LIST_CHANNELLIST = 6;
|
const int NOTIFY_LIST_CHANNELLIST = 6;
|
||||||
const int NOTIFY_LIST_TRANSFERLIST = 7;
|
const int NOTIFY_LIST_TRANSFERLIST = 7;
|
||||||
|
const int NOTIFY_LIST_CONFIG = 8;
|
||||||
|
|
||||||
const int NOTIFY_TYPE_SAME = 0x01;
|
const int NOTIFY_TYPE_SAME = 0x01;
|
||||||
const int NOTIFY_TYPE_MOD = 0x02; /* general purpose, check all */
|
const int NOTIFY_TYPE_MOD = 0x02; /* general purpose, check all */
|
||||||
|
@ -141,7 +141,8 @@ int RsServer::UpdateAllConfig()
|
|||||||
config.DHTActive = mConnMgr->getDHTEnabled();
|
config.DHTActive = mConnMgr->getDHTEnabled();
|
||||||
|
|
||||||
/* Notify of Changes */
|
/* Notify of Changes */
|
||||||
iface.setChanged(RsIface::Config);
|
// iface.setChanged(RsIface::Config);
|
||||||
|
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CONFIG, NOTIFY_TYPE_MOD);
|
||||||
|
|
||||||
/* unlock Mutexes */
|
/* unlock Mutexes */
|
||||||
iface.unlockData(); /* UNLOCK */
|
iface.unlockData(); /* UNLOCK */
|
||||||
|
@ -480,9 +480,9 @@ void RsServer::intNotifyChangeCert(RsCertId &id)
|
|||||||
/* send the notify message */
|
/* send the notify message */
|
||||||
if (mods)
|
if (mods)
|
||||||
{
|
{
|
||||||
NotifyBase &cb = getNotify();
|
std::cerr << "************** Notifying neighbor change *******************" << std::endl ;
|
||||||
cb.notifyListChange(NOTIFY_LIST_NEIGHBOURS, NOTIFY_TYPE_MOD);
|
getNotify().notifyListChange(NOTIFY_LIST_NEIGHBOURS, NOTIFY_TYPE_MOD);
|
||||||
cb.notifyListChange(NOTIFY_LIST_FRIENDS, NOTIFY_TYPE_MOD);
|
getNotify().notifyListChange(NOTIFY_LIST_FRIENDS, NOTIFY_TYPE_MOD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -668,6 +668,7 @@ int RsServer::UpdateAllNetwork()
|
|||||||
{
|
{
|
||||||
/* PreNotify of the Change */
|
/* PreNotify of the Change */
|
||||||
NotifyBase &cb = getNotify();
|
NotifyBase &cb = getNotify();
|
||||||
|
std::cerr << "************** Notifying neighbor change 2 *******************" << std::endl ;
|
||||||
cb.notifyListPreChange(NOTIFY_LIST_NEIGHBOURS, NOTIFY_TYPE_MOD);
|
cb.notifyListPreChange(NOTIFY_LIST_NEIGHBOURS, NOTIFY_TYPE_MOD);
|
||||||
|
|
||||||
lockRsCore(); /* LOCK */
|
lockRsCore(); /* LOCK */
|
||||||
@ -709,6 +710,7 @@ int RsServer::UpdateAllNetwork()
|
|||||||
unlockRsCore(); /* UNLOCK */
|
unlockRsCore(); /* UNLOCK */
|
||||||
|
|
||||||
/* Now Notify of the Change */
|
/* Now Notify of the Change */
|
||||||
|
std::cerr << "************** Notifying neighbor change 3 *******************" << std::endl ;
|
||||||
cb.notifyListChange(NOTIFY_LIST_NEIGHBOURS, NOTIFY_TYPE_MOD);
|
cb.notifyListChange(NOTIFY_LIST_NEIGHBOURS, NOTIFY_TYPE_MOD);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -352,24 +352,21 @@ bool RsDiscSerialiser::serialiseReply(RsDiscReply *item, void *data, uint32_
|
|||||||
offset += 8;
|
offset += 8;
|
||||||
|
|
||||||
/* add mandatory parts first */
|
/* add mandatory parts first */
|
||||||
ok &= SetTlvIpAddrPortV4(data, tlvsize, &offset,
|
ok &= SetTlvIpAddrPortV4(data, tlvsize, &offset, TLV_TYPE_IPV4_LOCAL, &(item->laddr));
|
||||||
TLV_TYPE_IPV4_LOCAL, &(item->laddr));
|
ok &= SetTlvIpAddrPortV4(data, tlvsize, &offset, TLV_TYPE_IPV4_REMOTE, &(item->saddr));
|
||||||
ok &= SetTlvIpAddrPortV4(data, tlvsize, &offset,
|
|
||||||
TLV_TYPE_IPV4_REMOTE, &(item->saddr));
|
|
||||||
ok &= setRawUInt16(data, tlvsize, &offset, item->contact_tf);
|
ok &= setRawUInt16(data, tlvsize, &offset, item->contact_tf);
|
||||||
ok &= setRawUInt32(data, tlvsize, &offset, item->discFlags);
|
ok &= setRawUInt32(data, tlvsize, &offset, item->discFlags);
|
||||||
|
|
||||||
ok &= SetTlvString(data, tlvsize, &offset,
|
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_PEERID, item->aboutId);
|
||||||
TLV_TYPE_STR_PEERID, item->aboutId);
|
|
||||||
|
|
||||||
ok &= item->certDER.SetTlv(data, tlvsize, &offset);
|
ok &= item->certDER.SetTlv(data, tlvsize, &offset);
|
||||||
|
|
||||||
if (offset != tlvsize)
|
if (offset != tlvsize)
|
||||||
{
|
{
|
||||||
ok = false;
|
ok = false;
|
||||||
#ifdef RSSERIAL_DEBUG
|
//#ifdef RSSERIAL_DEBUG
|
||||||
std::cerr << "RsDiscSerialiser::serialiseReply() Size Error! " << std::endl;
|
std::cerr << "RsDiscSerialiser::serialiseReply() Size Error! " << std::endl;
|
||||||
#endif
|
//#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
|
@ -93,10 +93,10 @@ bool RsChatSerialiser::serialiseItem(RsChatItem *item, void *data, uint32_t
|
|||||||
|
|
||||||
ok &= setRsItemHeader(data, tlvsize, item->PacketId(), tlvsize);
|
ok &= setRsItemHeader(data, tlvsize, item->PacketId(), tlvsize);
|
||||||
|
|
||||||
#ifdef RSSERIAL_DEBUG
|
//#ifdef RSSERIAL_DEBUG
|
||||||
std::cerr << "RsChatSerialiser::serialiseItem() Header: " << ok << std::endl;
|
std::cerr << "RsChatSerialiser::serialiseItem() Header: " << ok << std::endl;
|
||||||
std::cerr << "RsChatSerialiser::serialiseItem() Size: " << tlvsize << std::endl;
|
std::cerr << "RsChatSerialiser::serialiseItem() Size: " << tlvsize << std::endl;
|
||||||
#endif
|
//#endif
|
||||||
|
|
||||||
/* skip the header */
|
/* skip the header */
|
||||||
offset += 8;
|
offset += 8;
|
||||||
@ -109,10 +109,11 @@ bool RsChatSerialiser::serialiseItem(RsChatItem *item, void *data, uint32_t
|
|||||||
if (offset != tlvsize)
|
if (offset != tlvsize)
|
||||||
{
|
{
|
||||||
ok = false;
|
ok = false;
|
||||||
#ifdef RSSERIAL_DEBUG
|
//#ifdef RSSERIAL_DEBUG
|
||||||
std::cerr << "RsChatSerialiser::serialiseItem() Size Error! " << std::endl;
|
std::cerr << "RsChatSerialiser::serialiseItem() Size Error! " << std::endl;
|
||||||
#endif
|
//#endif
|
||||||
}
|
}
|
||||||
|
std::cerr << "computed size: " << 256*((unsigned char*)data)[6]+((unsigned char*)data)[7] << std::endl ;
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
@ -371,7 +371,7 @@ bool setRsItemHeader(void *data, uint32_t size, uint32_t type, uint32_t pktsiz
|
|||||||
|
|
||||||
uint32_t getRsItemId(void *data)
|
uint32_t getRsItemId(void *data)
|
||||||
{
|
{
|
||||||
uint32_t type;
|
uint32_t type = 0;
|
||||||
uint32_t offset = 0;
|
uint32_t offset = 0;
|
||||||
getRawUInt32(data, 4, &offset, &type);
|
getRawUInt32(data, 4, &offset, &type);
|
||||||
return type;
|
return type;
|
||||||
@ -380,7 +380,7 @@ uint32_t getRsItemId(void *data)
|
|||||||
|
|
||||||
uint32_t getRsItemSize(void *data)
|
uint32_t getRsItemSize(void *data)
|
||||||
{
|
{
|
||||||
uint32_t size;
|
uint32_t size = 0;
|
||||||
uint32_t offset = 4;
|
uint32_t offset = 4;
|
||||||
getRawUInt32(data, 8, &offset, &size);
|
getRawUInt32(data, 8, &offset, &size);
|
||||||
return size;
|
return size;
|
||||||
|
@ -82,6 +82,7 @@ int main(int argc, char **argv)
|
|||||||
//CRYPTO_mem_leaks(bio_err);
|
//CRYPTO_mem_leaks(bio_err);
|
||||||
if (bio_err != NULL) BIO_free(bio_err);
|
if (bio_err != NULL) BIO_free(bio_err);
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -146,5 +147,6 @@ int testForums(p3Forums *forum)
|
|||||||
#else
|
#else
|
||||||
sleep(1);
|
sleep(1);
|
||||||
#endif
|
#endif
|
||||||
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,19 +109,25 @@ int p3ChatService::sendChat(std::wstring msg)
|
|||||||
class p3ChatService::AvatarInfo
|
class p3ChatService::AvatarInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
AvatarInfo()
|
||||||
|
{
|
||||||
|
_peer_is_new = false ; // true when the peer has a new avatar
|
||||||
|
_own_is_new = false ; // true when I myself a new avatar to send to this peer.
|
||||||
|
}
|
||||||
|
|
||||||
AvatarInfo(const unsigned char *jpeg_data,int size)
|
AvatarInfo(const unsigned char *jpeg_data,int size)
|
||||||
{
|
{
|
||||||
int n_c = size ;
|
int n_c = size ;
|
||||||
int p = sizeof(wchar_t) ;
|
int p = 2 ;// minimum value for sizeof(wchar_t) over win/mac/linux ;
|
||||||
int n = n_c/p + 1 ;
|
int n = n_c/p + 1 ;
|
||||||
|
|
||||||
_jpeg_wstring = std::wstring(n,0) ;
|
_jpeg_wstring = std::wstring(n,0) ;
|
||||||
|
|
||||||
for(int i=0;i<n;++i)
|
for(int i=0;i<n;++i)
|
||||||
{
|
{
|
||||||
wchar_t h = jpeg_data[p*i] ;
|
wchar_t h = jpeg_data[p*i+p-1] ;
|
||||||
|
|
||||||
for(int j=1;j<p;++j)
|
for(int j=p-2;j>=0;--j)
|
||||||
{
|
{
|
||||||
h = h << 8 ;
|
h = h << 8 ;
|
||||||
h += jpeg_data[p*i+j] ;
|
h += jpeg_data[p*i+j] ;
|
||||||
@ -135,7 +141,7 @@ class p3ChatService::AvatarInfo
|
|||||||
|
|
||||||
void toUnsignedChar(unsigned char *& data,int& size) const
|
void toUnsignedChar(unsigned char *& data,int& size) const
|
||||||
{
|
{
|
||||||
int p = sizeof(wchar_t) ;
|
int p = 2 ;// minimum value for sizeof(wchar_t) over win/mac/linux ;
|
||||||
int n = _jpeg_wstring.size() ;
|
int n = _jpeg_wstring.size() ;
|
||||||
int n_c = p*n ;
|
int n_c = p*n ;
|
||||||
|
|
||||||
@ -146,7 +152,7 @@ class p3ChatService::AvatarInfo
|
|||||||
{
|
{
|
||||||
wchar_t h = _jpeg_wstring[i] ;
|
wchar_t h = _jpeg_wstring[i] ;
|
||||||
|
|
||||||
for(int j=p-1;j>=0;--j)
|
for(int j=0;j<p;++j)
|
||||||
{
|
{
|
||||||
data[p*i+j] = (unsigned char)(h & 0xff) ;
|
data[p*i+j] = (unsigned char)(h & 0xff) ;
|
||||||
h = h >> 8 ;
|
h = h >> 8 ;
|
||||||
@ -177,16 +183,23 @@ int p3ChatService::sendPrivateChat(std::wstring msg, std::string id)
|
|||||||
|
|
||||||
std::map<std::string,AvatarInfo*>::iterator it = _avatars.find(id) ;
|
std::map<std::string,AvatarInfo*>::iterator it = _avatars.find(id) ;
|
||||||
|
|
||||||
|
if(it == _avatars.end())
|
||||||
|
{
|
||||||
|
_avatars[id] = new AvatarInfo ;
|
||||||
|
it = _avatars.find(id) ;
|
||||||
|
}
|
||||||
if(it != _avatars.end() && it->second->_own_is_new)
|
if(it != _avatars.end() && it->second->_own_is_new)
|
||||||
{
|
{
|
||||||
|
#ifdef CHAT_DEBUG
|
||||||
std::cerr << "p3ChatService::sendPrivateChat: new avatar never sent to peer " << id << ". Setting <new> flag to packet." << std::endl;
|
std::cerr << "p3ChatService::sendPrivateChat: new avatar never sent to peer " << id << ". Setting <new> flag to packet." << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
ci->chatFlags |= RS_CHAT_FLAG_AVATAR_AVAILABLE ;
|
ci->chatFlags |= RS_CHAT_FLAG_AVATAR_AVAILABLE ;
|
||||||
it->second->_own_is_new = false ;
|
it->second->_own_is_new = false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cerr << "Sending msg to peer " << id << ", flags = " << ci->chatFlags << std::endl ;
|
|
||||||
#ifdef CHAT_DEBUG
|
#ifdef CHAT_DEBUG
|
||||||
|
std::cerr << "Sending msg to peer " << id << ", flags = " << ci->chatFlags << std::endl ;
|
||||||
std::cerr << "p3ChatService::sendPrivateChat() Item:";
|
std::cerr << "p3ChatService::sendPrivateChat() Item:";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
ci->print(std::cerr);
|
ci->print(std::cerr);
|
||||||
@ -212,8 +225,8 @@ std::list<RsChatItem *> p3ChatService::getChatQueue()
|
|||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
ci->print(std::cerr);
|
ci->print(std::cerr);
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
|
||||||
std::cerr << "Got msg. Flags = " << ci->chatFlags << std::endl ;
|
std::cerr << "Got msg. Flags = " << ci->chatFlags << std::endl ;
|
||||||
|
#endif
|
||||||
|
|
||||||
if(ci->chatFlags & RS_CHAT_FLAG_CONTAINS_AVATAR) // no msg here. Just an avatar.
|
if(ci->chatFlags & RS_CHAT_FLAG_CONTAINS_AVATAR) // no msg here. Just an avatar.
|
||||||
receiveAvatarJpegData(ci) ;
|
receiveAvatarJpegData(ci) ;
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "rsiface/rsiface.h"
|
||||||
#include "rsiface/rspeers.h"
|
#include "rsiface/rspeers.h"
|
||||||
#include "services/p3disc.h"
|
#include "services/p3disc.h"
|
||||||
|
|
||||||
@ -298,13 +299,13 @@ void p3disc::sendOwnDetails(std::string to)
|
|||||||
|
|
||||||
// Then send message.
|
// Then send message.
|
||||||
{
|
{
|
||||||
//#ifdef P3DISC_DEBUG
|
#ifdef P3DISC_DEBUG
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
out << "p3disc::sendOwnDetails()";
|
out << "p3disc::sendOwnDetails()";
|
||||||
out << "Constructing a RsDiscItem Message!" << std::endl;
|
out << "Constructing a RsDiscItem Message!" << std::endl;
|
||||||
out << "Sending to: " << to;
|
out << "Sending to: " << to;
|
||||||
std::cerr << out.str() << std::endl;
|
std::cerr << out.str() << std::endl;
|
||||||
//#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Construct a message
|
// Construct a message
|
||||||
@ -370,13 +371,13 @@ void p3disc::sendPeerDetails(std::string to, std::string about)
|
|||||||
|
|
||||||
/* send it off */
|
/* send it off */
|
||||||
{
|
{
|
||||||
//#ifdef P3DISC_DEBUG
|
#ifdef P3DISC_DEBUG
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
out << "p3disc::sendPeerDetails()";
|
out << "p3disc::sendPeerDetails()";
|
||||||
out << " Sending details of: " << about;
|
out << " Sending details of: " << about;
|
||||||
out << " to: " << to << std::endl;
|
out << " to: " << to << std::endl;
|
||||||
std::cerr << out.str() << std::endl;
|
std::cerr << out.str() << std::endl;
|
||||||
//#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -447,13 +448,19 @@ void p3disc::sendPeerDetails(std::string to, std::string about)
|
|||||||
if(*it == name)
|
if(*it == name)
|
||||||
{
|
{
|
||||||
di->discFlags |= P3DISC_FLAGS_PEER_TRUSTS_ME;
|
di->discFlags |= P3DISC_FLAGS_PEER_TRUSTS_ME;
|
||||||
|
#ifdef P3DISC_DEBUG
|
||||||
std::cerr << " Peer " << about << "(" << name << ")" << " is trusting " << to << ", sending info." << std::endl ;
|
std::cerr << " Peer " << about << "(" << name << ")" << " is trusting " << to << ", sending info." << std::endl ;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t certLen = 0;
|
uint32_t certLen = 0;
|
||||||
|
|
||||||
unsigned char **binptr = (unsigned char **) &(di -> certDER.bin_data);
|
unsigned char **binptr = (unsigned char **) &(di -> certDER.bin_data);
|
||||||
|
|
||||||
mAuthMgr->SaveCertificateToBinary(about, binptr, &certLen);
|
mAuthMgr->SaveCertificateToBinary(about, binptr, &certLen);
|
||||||
|
#ifdef P3DISC_DEBUG
|
||||||
|
std::cerr << "Saved certificate to binary in p3discReply. Length=" << certLen << std::endl ;
|
||||||
|
#endif
|
||||||
if (certLen > 0)
|
if (certLen > 0)
|
||||||
{
|
{
|
||||||
di -> certDER.bin_len = certLen;
|
di -> certDER.bin_len = certLen;
|
||||||
@ -483,9 +490,9 @@ void p3disc::sendPeerDetails(std::string to, std::string about)
|
|||||||
/*************************************************************************************/
|
/*************************************************************************************/
|
||||||
void p3disc::recvPeerOwnMsg(RsDiscItem *item)
|
void p3disc::recvPeerOwnMsg(RsDiscItem *item)
|
||||||
{
|
{
|
||||||
//#ifdef P3DISC_DEBUG
|
#ifdef P3DISC_DEBUG
|
||||||
std::cerr << "p3disc::recvPeerOwnMsg() From: " << item->PeerId() << std::endl;
|
std::cerr << "p3disc::recvPeerOwnMsg() From: " << item->PeerId() << std::endl;
|
||||||
//#endif
|
#endif
|
||||||
|
|
||||||
/* tells us their exact address (mConnectMgr can ignore if it looks wrong) */
|
/* tells us their exact address (mConnectMgr can ignore if it looks wrong) */
|
||||||
uint32_t type = 0;
|
uint32_t type = 0;
|
||||||
@ -530,8 +537,7 @@ void p3disc::recvPeerOwnMsg(RsDiscItem *item)
|
|||||||
/* now reply with all details */
|
/* now reply with all details */
|
||||||
respondToPeer(item->PeerId());
|
respondToPeer(item->PeerId());
|
||||||
|
|
||||||
addDiscoveryData(item->PeerId(), item->PeerId(),
|
addDiscoveryData(item->PeerId(), item->PeerId(), item->laddr, item->saddr, item->discFlags, time(NULL));
|
||||||
item->laddr, item->saddr, item->discFlags, time(NULL));
|
|
||||||
|
|
||||||
/* cleanup (handled by caller) */
|
/* cleanup (handled by caller) */
|
||||||
}
|
}
|
||||||
@ -540,11 +546,11 @@ void p3disc::recvPeerOwnMsg(RsDiscItem *item)
|
|||||||
void p3disc::recvPeerFriendMsg(RsDiscReply *item)
|
void p3disc::recvPeerFriendMsg(RsDiscReply *item)
|
||||||
{
|
{
|
||||||
|
|
||||||
//#ifdef P3DISC_DEBUG
|
#ifdef P3DISC_DEBUG
|
||||||
std::cerr << "p3disc::recvPeerFriendMsg() From: " << item->PeerId();
|
std::cerr << "p3disc::recvPeerFriendMsg() From: " << item->PeerId();
|
||||||
std::cerr << " About " << item->aboutId;
|
std::cerr << " About " << item->aboutId;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
//#endif
|
#endif
|
||||||
|
|
||||||
/* tells us their exact address (mConnectMgr can ignore if it looks wrong) */
|
/* tells us their exact address (mConnectMgr can ignore if it looks wrong) */
|
||||||
|
|
||||||
@ -595,6 +601,8 @@ void p3disc::recvPeerFriendMsg(RsDiscReply *item)
|
|||||||
|
|
||||||
addDiscoveryData(item->PeerId(), peerId, item->laddr, item->saddr, item->discFlags, time(NULL));
|
addDiscoveryData(item->PeerId(), peerId, item->laddr, item->saddr, item->discFlags, time(NULL));
|
||||||
|
|
||||||
|
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_NEIGHBOURS, NOTIFY_TYPE_MOD);
|
||||||
|
|
||||||
/* cleanup (handled by caller) */
|
/* cleanup (handled by caller) */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -604,8 +612,7 @@ void p3disc::recvPeerFriendMsg(RsDiscReply *item)
|
|||||||
/*************************************************************************************/
|
/*************************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
int p3disc::addDiscoveryData(std::string fromId, std::string aboutId,
|
int p3disc::addDiscoveryData(std::string fromId, std::string aboutId, struct sockaddr_in laddr, struct sockaddr_in raddr, uint32_t flags, time_t ts)
|
||||||
struct sockaddr_in laddr, struct sockaddr_in raddr, uint32_t flags, time_t ts)
|
|
||||||
{
|
{
|
||||||
RsStackMutex stack(mDiscMtx); /********** STACK LOCKED MTX ******/
|
RsStackMutex stack(mDiscMtx); /********** STACK LOCKED MTX ******/
|
||||||
|
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "rsiface/rsiface.h"
|
||||||
|
|
||||||
#include "pqi/pqibin.h"
|
#include "pqi/pqibin.h"
|
||||||
#include "pqi/pqiarchive.h"
|
#include "pqi/pqiarchive.h"
|
||||||
#include "pqi/p3connmgr.h"
|
#include "pqi/p3connmgr.h"
|
||||||
@ -121,8 +123,11 @@ int p3MsgService::incomingMsgs()
|
|||||||
{
|
{
|
||||||
RsMsgItem *mi;
|
RsMsgItem *mi;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
bool changed = false ;
|
||||||
|
|
||||||
while((mi = (RsMsgItem *) recvItem()) != NULL)
|
while((mi = (RsMsgItem *) recvItem()) != NULL)
|
||||||
{
|
{
|
||||||
|
changed = true ;
|
||||||
++i;
|
++i;
|
||||||
mi -> recvTime = time(NULL);
|
mi -> recvTime = time(NULL);
|
||||||
mi -> msgFlags = RS_MSG_FLAGS_NEW;
|
mi -> msgFlags = RS_MSG_FLAGS_NEW;
|
||||||
@ -162,6 +167,9 @@ int p3MsgService::incomingMsgs()
|
|||||||
|
|
||||||
/**** STACK UNLOCKED ***/
|
/**** STACK UNLOCKED ***/
|
||||||
}
|
}
|
||||||
|
if(changed)
|
||||||
|
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -472,16 +480,19 @@ bool p3MsgService::removeMsgId(std::string mid)
|
|||||||
{
|
{
|
||||||
std::map<uint32_t, RsMsgItem *>::iterator mit;
|
std::map<uint32_t, RsMsgItem *>::iterator mit;
|
||||||
uint32_t msgId = atoi(mid.c_str());
|
uint32_t msgId = atoi(mid.c_str());
|
||||||
|
bool changed = false ;
|
||||||
|
|
||||||
|
{
|
||||||
RsStackMutex stack(mMsgMtx); /********** STACK LOCKED MTX ******/
|
RsStackMutex stack(mMsgMtx); /********** STACK LOCKED MTX ******/
|
||||||
|
|
||||||
mit = imsg.find(msgId);
|
mit = imsg.find(msgId);
|
||||||
if (mit != imsg.end())
|
if (mit != imsg.end())
|
||||||
{
|
{
|
||||||
|
changed = true ;
|
||||||
RsMsgItem *mi = mit->second;
|
RsMsgItem *mi = mit->second;
|
||||||
imsg.erase(mit);
|
imsg.erase(mit);
|
||||||
delete mi;
|
delete mi;
|
||||||
msgChanged.IndicateChanged();
|
// msgChanged.IndicateChanged();
|
||||||
|
|
||||||
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||||
|
|
||||||
@ -491,15 +502,20 @@ bool p3MsgService::removeMsgId(std::string mid)
|
|||||||
mit = msgOutgoing.find(msgId);
|
mit = msgOutgoing.find(msgId);
|
||||||
if (mit != msgOutgoing.end())
|
if (mit != msgOutgoing.end())
|
||||||
{
|
{
|
||||||
|
changed = true ;
|
||||||
RsMsgItem *mi = mit->second;
|
RsMsgItem *mi = mit->second;
|
||||||
msgOutgoing.erase(mit);
|
msgOutgoing.erase(mit);
|
||||||
delete mi;
|
delete mi;
|
||||||
msgChanged.IndicateChanged();
|
// msgChanged.IndicateChanged();
|
||||||
|
|
||||||
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(changed)
|
||||||
|
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -508,19 +524,25 @@ bool p3MsgService::markMsgIdRead(std::string mid)
|
|||||||
{
|
{
|
||||||
std::map<uint32_t, RsMsgItem *>::iterator mit;
|
std::map<uint32_t, RsMsgItem *>::iterator mit;
|
||||||
uint32_t msgId = atoi(mid.c_str());
|
uint32_t msgId = atoi(mid.c_str());
|
||||||
|
bool changed = false ;
|
||||||
|
|
||||||
|
{
|
||||||
RsStackMutex stack(mMsgMtx); /********** STACK LOCKED MTX ******/
|
RsStackMutex stack(mMsgMtx); /********** STACK LOCKED MTX ******/
|
||||||
|
|
||||||
mit = imsg.find(msgId);
|
mit = imsg.find(msgId);
|
||||||
if (mit != imsg.end())
|
if (mit != imsg.end())
|
||||||
{
|
{
|
||||||
|
changed = true ;
|
||||||
RsMsgItem *mi = mit->second;
|
RsMsgItem *mi = mit->second;
|
||||||
mi -> msgFlags &= ~(RS_MSG_FLAGS_NEW);
|
mi -> msgFlags &= ~(RS_MSG_FLAGS_NEW);
|
||||||
msgChanged.IndicateChanged();
|
|
||||||
|
|
||||||
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(changed) // no need to notify, because the msg is always
|
||||||
|
return true; // marked as read from the gui itself, so the gui
|
||||||
|
else // can mark it as read.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ ForumsDialog::ForumsDialog(QWidget *parent)
|
|||||||
// SLOT( changedThread( QTreeWidgetItem *, QTreeWidgetItem * ) ) );
|
// SLOT( changedThread( QTreeWidgetItem *, QTreeWidgetItem * ) ) );
|
||||||
|
|
||||||
connect( ui.threadTreeWidget, SIGNAL( itemSelectionChanged() ), this, SLOT( changedThread2() ) );
|
connect( ui.threadTreeWidget, SIGNAL( itemSelectionChanged() ), this, SLOT( changedThread2() ) );
|
||||||
connect( ui.viewBox, SIGNAL( currentIndexChanged ( int ) ), this, SLOT( changedThread2() ) );
|
connect( ui.viewBox, SIGNAL( currentIndexChanged ( int ) ), this, SLOT( insertThreads() ) );
|
||||||
|
|
||||||
connect(ui.expandButton, SIGNAL(clicked()), this, SLOT(togglefileview()));
|
connect(ui.expandButton, SIGNAL(clicked()), this, SLOT(togglefileview()));
|
||||||
|
|
||||||
|
@ -33,11 +33,11 @@ public:
|
|||||||
ForumsDialog(QWidget *parent = 0);
|
ForumsDialog(QWidget *parent = 0);
|
||||||
|
|
||||||
void insertForums();
|
void insertForums();
|
||||||
void insertThreads();
|
|
||||||
void insertPost();
|
void insertPost();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
|
void insertThreads();
|
||||||
/** Create the context popup menu and it's submenus */
|
/** Create the context popup menu and it's submenus */
|
||||||
void forumListCustomPopupMenu( QPoint point );
|
void forumListCustomPopupMenu( QPoint point );
|
||||||
void threadListCustomPopupMenu( QPoint point );
|
void threadListCustomPopupMenu( QPoint point );
|
||||||
|
@ -65,7 +65,7 @@ MessagesDialog::MessagesDialog(QWidget *parent)
|
|||||||
|
|
||||||
connect( ui.msgWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( messageslistWidgetCostumPopupMenu( QPoint ) ) );
|
connect( ui.msgWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( messageslistWidgetCostumPopupMenu( QPoint ) ) );
|
||||||
connect( ui.msgList, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( msgfilelistWidgetCostumPopupMenu( QPoint ) ) );
|
connect( ui.msgList, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( msgfilelistWidgetCostumPopupMenu( QPoint ) ) );
|
||||||
connect( ui.msgWidget, SIGNAL( itemClicked ( QTreeWidgetItem *, int) ), this, SLOT( updateMessages ( QTreeWidgetItem *, int) ) );
|
connect( ui.msgWidget, SIGNAL( currentItemChanged ( QTreeWidgetItem *,QTreeWidgetItem * ) ), this, SLOT( updateCurrentMessage( QTreeWidgetItem *, QTreeWidgetItem *) ) );
|
||||||
connect( ui.listWidget, SIGNAL( currentRowChanged ( int) ), this, SLOT( changeBox ( int) ) );
|
connect( ui.listWidget, SIGNAL( currentRowChanged ( int) ), this, SLOT( changeBox ( int) ) );
|
||||||
|
|
||||||
connect(ui.newmessageButton, SIGNAL(clicked()), this, SLOT(newmessage()));
|
connect(ui.newmessageButton, SIGNAL(clicked()), this, SLOT(newmessage()));
|
||||||
@ -448,11 +448,9 @@ void MessagesDialog::getallrecommended()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessagesDialog::changeBox( int newrow )
|
void MessagesDialog::changeBox(int)
|
||||||
{
|
{
|
||||||
//std::cerr << "MessagesDialog::changeBox()" << std::endl;
|
insertMessages(); // show current msg list
|
||||||
insertMessages();
|
|
||||||
insertMsgTxtAndFiles();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessagesDialog::insertMessages()
|
void MessagesDialog::insertMessages()
|
||||||
@ -601,12 +599,27 @@ void MessagesDialog::insertMessages()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessagesDialog::updateMessages( QTreeWidgetItem * item, int column )
|
void MessagesDialog::updateCurrentMessage( QTreeWidgetItem *item , QTreeWidgetItem * )
|
||||||
{
|
{
|
||||||
//std::cerr << "MessagesDialog::insertMsgTxtAndFiles()" << std::endl;
|
|
||||||
insertMsgTxtAndFiles();
|
insertMsgTxtAndFiles();
|
||||||
|
setMsgAsRead(item) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MessagesDialog::setMsgAsRead(QTreeWidgetItem *item)
|
||||||
|
{
|
||||||
|
if(item == NULL)
|
||||||
|
return ;
|
||||||
|
|
||||||
|
for(int i = 0; i < 10; i++)
|
||||||
|
{
|
||||||
|
QFont qf = item->font(i);
|
||||||
|
qf.setBold(false);
|
||||||
|
item->setFont(i, qf);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string mid(item->text(5).toStdString());
|
||||||
|
rsMsgs->MessageRead(mid);
|
||||||
|
}
|
||||||
|
|
||||||
void MessagesDialog::insertMsgTxtAndFiles()
|
void MessagesDialog::insertMsgTxtAndFiles()
|
||||||
{
|
{
|
||||||
@ -747,12 +760,8 @@ void MessagesDialog::insertMsgTxtAndFiles()
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::cerr << "MessagesDialog::insertMsgTxtAndFiles() Msg Displayed OK!" << std::endl;
|
std::cerr << "MessagesDialog::insertMsgTxtAndFiles() Msg Displayed OK!" << std::endl;
|
||||||
|
|
||||||
/* finally mark message as read! */
|
|
||||||
rsMsgs -> MessageRead(mid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool MessagesDialog::getCurrentMsg(std::string &cid, std::string &mid)
|
bool MessagesDialog::getCurrentMsg(std::string &cid, std::string &mid)
|
||||||
{
|
{
|
||||||
/* Locate the current Message */
|
/* Locate the current Message */
|
||||||
@ -774,39 +783,21 @@ bool MessagesDialog::getCurrentMsg(std::string &cid, std::string &mid)
|
|||||||
|
|
||||||
void MessagesDialog::removemessage()
|
void MessagesDialog::removemessage()
|
||||||
{
|
{
|
||||||
#ifdef TO_REMOVE
|
|
||||||
//std::cerr << "MessagesDialog::removemessage()" << std::endl;
|
|
||||||
std::string cid, mid;
|
|
||||||
if (!getCurrentMsg(cid, mid))
|
|
||||||
{
|
|
||||||
//std::cerr << "MessagesDialog::removemessage()";
|
|
||||||
//std::cerr << " No Message selected" << std::endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QList<QTreeWidgetItem*> list(ui.msgWidget->selectedItems()) ;
|
QList<QTreeWidgetItem*> list(ui.msgWidget->selectedItems()) ;
|
||||||
|
|
||||||
|
int maxrow = -1 ;
|
||||||
|
for(QList<QTreeWidgetItem*>::const_iterator it(list.begin());it!=list.end();++it)
|
||||||
|
maxrow = std::max(maxrow,ui.msgWidget->indexOfTopLevelItem(*it)) ;
|
||||||
|
|
||||||
|
QTreeWidgetItem *next = ui.msgWidget->topLevelItem(maxrow+1) ;
|
||||||
|
|
||||||
for(QList<QTreeWidgetItem*>::const_iterator it(list.begin());it!=list.end();++it)
|
for(QList<QTreeWidgetItem*>::const_iterator it(list.begin());it!=list.end();++it)
|
||||||
rsMsgs->MessageDelete((*it)->text(5).toStdString());
|
rsMsgs->MessageDelete((*it)->text(5).toStdString());
|
||||||
|
|
||||||
return;
|
if(next != NULL)
|
||||||
}
|
ui.msgWidget->setCurrentItem(next) ;
|
||||||
|
|
||||||
|
|
||||||
void MessagesDialog::markMsgAsRead()
|
|
||||||
{
|
|
||||||
//std::cerr << "MessagesDialog::markMsgAsRead()" << std::endl;
|
|
||||||
std::string cid, mid;
|
|
||||||
if (!getCurrentMsg(cid, mid))
|
|
||||||
{
|
|
||||||
//std::cerr << "MessagesDialog::markMsgAsRead()";
|
|
||||||
//std::cerr << " No Message selected" << std::endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
rsMsgs -> MessageRead(mid);
|
|
||||||
|
|
||||||
|
insertMessages();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,13 +35,11 @@ public:
|
|||||||
/** Default Constructor */
|
/** Default Constructor */
|
||||||
MessagesDialog(QWidget *parent = 0);
|
MessagesDialog(QWidget *parent = 0);
|
||||||
/** Default Destructor */
|
/** Default Destructor */
|
||||||
|
|
||||||
|
|
||||||
void insertMessages();
|
|
||||||
void insertMsgTxtAndFiles();
|
void insertMsgTxtAndFiles();
|
||||||
|
|
||||||
|
|
||||||
virtual void keyPressEvent(QKeyEvent *) ;
|
virtual void keyPressEvent(QKeyEvent *) ;
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void insertMessages();
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
/** Create the context popup menu and it's submenus */
|
/** Create the context popup menu and it's submenus */
|
||||||
@ -49,7 +47,7 @@ private slots:
|
|||||||
void msgfilelistWidgetCostumPopupMenu(QPoint);
|
void msgfilelistWidgetCostumPopupMenu(QPoint);
|
||||||
|
|
||||||
void changeBox( int newrow );
|
void changeBox( int newrow );
|
||||||
void updateMessages ( QTreeWidgetItem * item, int column );
|
void updateCurrentMessage ( QTreeWidgetItem * item, QTreeWidgetItem * item2 );
|
||||||
|
|
||||||
void newmessage();
|
void newmessage();
|
||||||
|
|
||||||
@ -61,7 +59,6 @@ void updateMessages ( QTreeWidgetItem * item, int column );
|
|||||||
void printpreview();
|
void printpreview();
|
||||||
|
|
||||||
void removemessage();
|
void removemessage();
|
||||||
void markMsgAsRead();
|
|
||||||
|
|
||||||
void getcurrentrecommended();
|
void getcurrentrecommended();
|
||||||
void getallrecommended();
|
void getallrecommended();
|
||||||
@ -72,6 +69,7 @@ void updateMessages ( QTreeWidgetItem * item, int column );
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
bool getCurrentMsg(std::string &cid, std::string &mid);
|
bool getCurrentMsg(std::string &cid, std::string &mid);
|
||||||
|
void setMsgAsRead(QTreeWidgetItem *);
|
||||||
|
|
||||||
std::string mCurrCertId;
|
std::string mCurrCertId;
|
||||||
std::string mCurrMsgId;
|
std::string mCurrMsgId;
|
||||||
|
@ -42,7 +42,6 @@ public:
|
|||||||
MessengerWindow(QWidget *parent = 0, Qt::WFlags flags = 0);
|
MessengerWindow(QWidget *parent = 0, Qt::WFlags flags = 0);
|
||||||
/** Default Destructor */
|
/** Default Destructor */
|
||||||
|
|
||||||
void insertPeers();
|
|
||||||
void setChatDialog(PeersDialog *cd);
|
void setChatDialog(PeersDialog *cd);
|
||||||
|
|
||||||
NetworkDialog *networkDialog2;
|
NetworkDialog *networkDialog2;
|
||||||
@ -51,6 +50,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
void insertPeers();
|
||||||
/** Called when this dialog is to be displayed */
|
/** Called when this dialog is to be displayed */
|
||||||
void show();
|
void show();
|
||||||
|
|
||||||
|
@ -42,10 +42,10 @@ public:
|
|||||||
NetworkDialog(QWidget *parent = 0);
|
NetworkDialog(QWidget *parent = 0);
|
||||||
/** Default Destructor */
|
/** Default Destructor */
|
||||||
|
|
||||||
void insertConnect();
|
|
||||||
void showpeerdetails(std::string id);
|
void showpeerdetails(std::string id);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
void insertConnect();
|
||||||
std::string loadneighbour();
|
std::string loadneighbour();
|
||||||
/* void loadneighbour(); */
|
/* void loadneighbour(); */
|
||||||
void setLogInfo(QString info, QColor color=QApplication::palette().color(QPalette::WindowText));
|
void setLogInfo(QString info, QColor color=QApplication::palette().color(QPalette::WindowText));
|
||||||
|
@ -48,13 +48,11 @@ public:
|
|||||||
void clearOldChats();
|
void clearOldChats();
|
||||||
|
|
||||||
void loadEmoticonsgroupchat();
|
void loadEmoticonsgroupchat();
|
||||||
|
|
||||||
void insertPeers();
|
|
||||||
|
|
||||||
void setChatDialog(ChatDialog *cd);
|
void setChatDialog(ChatDialog *cd);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
|
void insertPeers();
|
||||||
void toggleSendItem( QTreeWidgetItem *item, int col );
|
void toggleSendItem( QTreeWidgetItem *item, int col );
|
||||||
|
|
||||||
void insertChat();
|
void insertChat();
|
||||||
|
@ -70,6 +70,7 @@ TransfersDialog::TransfersDialog(QWidget *parent)
|
|||||||
DLDelegate = new DLListDelegate();
|
DLDelegate = new DLListDelegate();
|
||||||
ui.downloadList->setItemDelegate(DLDelegate);
|
ui.downloadList->setItemDelegate(DLDelegate);
|
||||||
|
|
||||||
|
ui.downloadList->setAutoScroll(false) ;
|
||||||
|
|
||||||
//Selection Setup
|
//Selection Setup
|
||||||
selection = ui.downloadList->selectionModel();
|
selection = ui.downloadList->selectionModel();
|
||||||
@ -108,6 +109,7 @@ TransfersDialog::TransfersDialog(QWidget *parent)
|
|||||||
ULDelegate = new ULListDelegate();
|
ULDelegate = new ULListDelegate();
|
||||||
ui.uploadsList->setItemDelegate(ULDelegate);
|
ui.uploadsList->setItemDelegate(ULDelegate);
|
||||||
|
|
||||||
|
ui.uploadsList->setAutoScroll(false) ;
|
||||||
ui.uploadsList->setRootIsDecorated(false);
|
ui.uploadsList->setRootIsDecorated(false);
|
||||||
|
|
||||||
//Selection Setup
|
//Selection Setup
|
||||||
|
@ -47,9 +47,7 @@ public:
|
|||||||
/** Default Destructor */
|
/** Default Destructor */
|
||||||
~TransfersDialog();
|
~TransfersDialog();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
|
||||||
|
|
||||||
void insertTransfers();
|
void insertTransfers();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -152,9 +152,15 @@ int main(int argc, char *argv[])
|
|||||||
// I'm using a signal to transfer the hashing info to the mainwindow, because Qt schedules signals properly to
|
// I'm using a signal to transfer the hashing info to the mainwindow, because Qt schedules signals properly to
|
||||||
// avoid clashes between infos from threads.
|
// avoid clashes between infos from threads.
|
||||||
//
|
//
|
||||||
QObject::connect(notify,SIGNAL(hashingInfo(const QString&)),w,SLOT(updateHashingInfo(const QString&))) ;
|
QObject::connect(notify,SIGNAL(hashingInfoChanged(const QString&)),w ,SLOT(updateHashingInfo(const QString&))) ;
|
||||||
QObject::connect(notify,SIGNAL(filesPreMod( bool)),w->sharedfilesDialog,SLOT(preModDirectories(bool))) ;
|
QObject::connect(notify,SIGNAL(filesPreModChanged(bool)) ,w->sharedfilesDialog,SLOT(preModDirectories(bool) )) ;
|
||||||
QObject::connect(notify,SIGNAL(filesPostMod( bool)),w->sharedfilesDialog,SLOT(postModDirectories(bool))) ;
|
QObject::connect(notify,SIGNAL(filesPostModChanged(bool)) ,w->sharedfilesDialog,SLOT(postModDirectories(bool) )) ;
|
||||||
|
QObject::connect(notify,SIGNAL(transfersChanged()) ,w->transfersDialog ,SLOT(insertTransfers() )) ;
|
||||||
|
QObject::connect(notify,SIGNAL(friendsChanged()) ,w->messengerWindow ,SLOT(insertPeers() )) ;
|
||||||
|
QObject::connect(notify,SIGNAL(friendsChanged()) ,w->peersDialog ,SLOT(insertPeers() )) ;
|
||||||
|
QObject::connect(notify,SIGNAL(neighborsChanged()) ,w->networkDialog ,SLOT(insertConnect() )) ;
|
||||||
|
QObject::connect(notify,SIGNAL(messagesChanged()) ,w->messagesDialog ,SLOT(insertMessages() )) ;
|
||||||
|
QObject::connect(notify,SIGNAL(configChanged()) ,w->messagesDialog ,SLOT(displayConfig() )) ;
|
||||||
|
|
||||||
/* only show window, if not startMinimized */
|
/* only show window, if not startMinimized */
|
||||||
if (!startMinimised)
|
if (!startMinimised)
|
||||||
|
@ -38,7 +38,7 @@ void NotifyQt::notifyErrorMsg(int list, int type, std::string msg)
|
|||||||
|
|
||||||
void NotifyQt::notifyHashingInfo(std::string fileinfo)
|
void NotifyQt::notifyHashingInfo(std::string fileinfo)
|
||||||
{
|
{
|
||||||
emit hashingInfo(QString::fromStdString(fileinfo)) ;
|
emit hashingInfoChanged(QString::fromStdString(fileinfo)) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotifyQt::notifyChat()
|
void NotifyQt::notifyChat()
|
||||||
@ -56,26 +56,29 @@ void NotifyQt::notifyListChange(int list, int type)
|
|||||||
switch(list)
|
switch(list)
|
||||||
{
|
{
|
||||||
case NOTIFY_LIST_NEIGHBOURS:
|
case NOTIFY_LIST_NEIGHBOURS:
|
||||||
//displayNeighbours();
|
emit neighborsChanged();
|
||||||
break;
|
break;
|
||||||
case NOTIFY_LIST_FRIENDS:
|
case NOTIFY_LIST_FRIENDS:
|
||||||
//displayFriends();
|
emit friendsChanged() ;
|
||||||
break;
|
break;
|
||||||
case NOTIFY_LIST_DIRLIST:
|
case NOTIFY_LIST_DIRLIST:
|
||||||
emit filesPostMod(false) ; /* Remote */
|
emit filesPostModChanged(false) ; /* Remote */
|
||||||
emit filesPostMod(true) ; /* Local */
|
emit filesPostModChanged(true) ; /* Local */
|
||||||
break;
|
break;
|
||||||
case NOTIFY_LIST_SEARCHLIST:
|
case NOTIFY_LIST_SEARCHLIST:
|
||||||
//displaySearch();
|
//displaySearch();
|
||||||
break;
|
break;
|
||||||
case NOTIFY_LIST_MESSAGELIST:
|
case NOTIFY_LIST_MESSAGELIST:
|
||||||
//displayMessages();
|
emit messagesChanged() ;
|
||||||
break;
|
break;
|
||||||
case NOTIFY_LIST_CHANNELLIST:
|
case NOTIFY_LIST_CHANNELLIST:
|
||||||
//displayChannels();
|
//displayChannels();
|
||||||
break;
|
break;
|
||||||
case NOTIFY_LIST_TRANSFERLIST:
|
case NOTIFY_LIST_TRANSFERLIST:
|
||||||
//displayTransfers();
|
emit transfersChanged() ;
|
||||||
|
break;
|
||||||
|
case NOTIFY_LIST_CONFIG:
|
||||||
|
emit configChanged() ;
|
||||||
break ;
|
break ;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -95,11 +98,11 @@ void NotifyQt::notifyListPreChange(int list, int type)
|
|||||||
//preDisplayNeighbours();
|
//preDisplayNeighbours();
|
||||||
break;
|
break;
|
||||||
case NOTIFY_LIST_FRIENDS:
|
case NOTIFY_LIST_FRIENDS:
|
||||||
//preDisplayFriends();
|
emit friendsChanged() ;
|
||||||
break;
|
break;
|
||||||
case NOTIFY_LIST_DIRLIST:
|
case NOTIFY_LIST_DIRLIST:
|
||||||
emit filesPreMod(false) ; /* remote */
|
emit filesPreModChanged(false) ; /* remote */
|
||||||
emit filesPreMod(true) ; /* local */
|
emit filesPreModChanged(true) ; /* local */
|
||||||
break;
|
break;
|
||||||
case NOTIFY_LIST_SEARCHLIST:
|
case NOTIFY_LIST_SEARCHLIST:
|
||||||
//preDisplaySearch();
|
//preDisplaySearch();
|
||||||
@ -127,62 +130,30 @@ void NotifyQt::notifyListPreChange(int list, int type)
|
|||||||
|
|
||||||
void NotifyQt::UpdateGUI()
|
void NotifyQt::UpdateGUI()
|
||||||
{
|
{
|
||||||
iface->lockData(); /* Lock Interface */
|
|
||||||
|
|
||||||
/* make local -> so we can release iface */
|
|
||||||
bool uNeigh = iface->hasChanged(RsIface::Neighbour);
|
|
||||||
bool uFri = iface->hasChanged(RsIface::Friend);
|
|
||||||
bool uTrans = iface->hasChanged(RsIface::Transfer);
|
|
||||||
//bool uChat = iface->hasChanged(RsIface::Chat);
|
|
||||||
bool uMsg = iface->hasChanged(RsIface::Message);
|
|
||||||
bool uChan = iface->hasChanged(RsIface::Channel);
|
|
||||||
bool uRecom = iface->hasChanged(RsIface::Recommend);
|
|
||||||
bool uConf = iface->hasChanged(RsIface::Config);
|
|
||||||
|
|
||||||
iface->unlockData(); /* UnLock Interface */
|
|
||||||
|
|
||||||
/* hack to force updates until we've fixed that part */
|
/* hack to force updates until we've fixed that part */
|
||||||
static time_t lastTs = 0;
|
static time_t lastTs = 0;
|
||||||
|
|
||||||
if (time(NULL) > lastTs + 5)
|
if (time(NULL) > lastTs) // always update, every 1 sec.
|
||||||
{
|
{
|
||||||
lastTs = time(NULL);
|
emit transfersChanged();
|
||||||
|
emit friendsChanged() ;
|
||||||
uNeigh = true;
|
|
||||||
uFri = true;
|
|
||||||
uTrans = true;
|
|
||||||
//uChat = true;
|
|
||||||
uMsg = true;
|
|
||||||
uChan = true;
|
|
||||||
uRecom = true;
|
|
||||||
uConf = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uNeigh)
|
if (time(NULL) > lastTs + 5) // update every 5 seconds. I don't know what to do with these.
|
||||||
displayNeighbours();
|
{
|
||||||
|
|
||||||
if (uFri)
|
|
||||||
displayFriends();
|
|
||||||
|
|
||||||
if (uTrans)
|
|
||||||
displayTransfers();
|
|
||||||
|
|
||||||
//if (uChat)
|
|
||||||
// displayChat();
|
|
||||||
|
|
||||||
if (uMsg)
|
|
||||||
displayMessages();
|
|
||||||
|
|
||||||
if (uChan)
|
|
||||||
displayChannels();
|
displayChannels();
|
||||||
|
}
|
||||||
|
|
||||||
/* TODO
|
static bool already_updated = false ; // these only update once at start because they may already have been set before
|
||||||
if (uRecom)
|
// the gui is running, then they get updated by callbacks.
|
||||||
displayRecommends();
|
if(!already_updated)
|
||||||
|
{
|
||||||
|
emit messagesChanged() ;
|
||||||
|
emit neighborsChanged();
|
||||||
|
emit configChanged();
|
||||||
|
|
||||||
if (uConf)
|
already_updated = true ;
|
||||||
displayConfig();
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
/* Finally Check for PopupMessages / System Error Messages */
|
/* Finally Check for PopupMessages / System Error Messages */
|
||||||
|
|
||||||
@ -265,22 +236,6 @@ static time_t lastTs = 0;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void NotifyQt::displayNeighbours()
|
|
||||||
{
|
|
||||||
/* Do the GUI */
|
|
||||||
if (cDialog)
|
|
||||||
cDialog->insertConnect();
|
|
||||||
}
|
|
||||||
|
|
||||||
void NotifyQt::displayFriends()
|
|
||||||
{
|
|
||||||
if (pDialog)
|
|
||||||
pDialog->insertPeers();
|
|
||||||
if (mWindow)
|
|
||||||
mWindow->insertPeers();
|
|
||||||
}
|
|
||||||
|
|
||||||
void NotifyQt::displaySearch()
|
void NotifyQt::displaySearch()
|
||||||
{
|
{
|
||||||
iface->lockData(); /* Lock Interface */
|
iface->lockData(); /* Lock Interface */
|
||||||
@ -293,13 +248,6 @@ void NotifyQt::displaySearch()
|
|||||||
iface->unlockData(); /* UnLock Interface */
|
iface->unlockData(); /* UnLock Interface */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void NotifyQt::displayMessages()
|
|
||||||
{
|
|
||||||
if (mDialog)
|
|
||||||
mDialog -> insertMessages();
|
|
||||||
}
|
|
||||||
|
|
||||||
void NotifyQt::displayChat()
|
void NotifyQt::displayChat()
|
||||||
{
|
{
|
||||||
iface->lockData(); /* Lock Interface */
|
iface->lockData(); /* Lock Interface */
|
||||||
|
@ -51,9 +51,14 @@ class NotifyQt: public QObject, public NotifyBase
|
|||||||
// It's beneficial to send info to the GUI using signals, because signals are thread-safe
|
// It's beneficial to send info to the GUI using signals, because signals are thread-safe
|
||||||
// as they get queued by Qt.
|
// as they get queued by Qt.
|
||||||
//
|
//
|
||||||
void hashingInfo(const QString&) const ;
|
void hashingInfoChanged(const QString&) const ;
|
||||||
void filesPreMod(bool) const ;
|
void filesPreModChanged(bool) const ;
|
||||||
void filesPostMod(bool) const ;
|
void filesPostModChanged(bool) const ;
|
||||||
|
void transfersChanged() const ;
|
||||||
|
void friendsChanged() const ;
|
||||||
|
void neighborsChanged() const ;
|
||||||
|
void messagesChanged() const ;
|
||||||
|
void configChanged() const ;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
|
@ -209,6 +209,7 @@ const int NOTIFY_LIST_SEARCHLIST = 4;
|
|||||||
const int NOTIFY_LIST_MESSAGELIST = 5;
|
const int NOTIFY_LIST_MESSAGELIST = 5;
|
||||||
const int NOTIFY_LIST_CHANNELLIST = 6;
|
const int NOTIFY_LIST_CHANNELLIST = 6;
|
||||||
const int NOTIFY_LIST_TRANSFERLIST = 7;
|
const int NOTIFY_LIST_TRANSFERLIST = 7;
|
||||||
|
const int NOTIFY_LIST_CONFIG = 8;
|
||||||
|
|
||||||
const int NOTIFY_TYPE_SAME = 0x01;
|
const int NOTIFY_TYPE_SAME = 0x01;
|
||||||
const int NOTIFY_TYPE_MOD = 0x02; /* general purpose, check all */
|
const int NOTIFY_TYPE_MOD = 0x02; /* general purpose, check all */
|
||||||
|
Loading…
Reference in New Issue
Block a user