mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-25 09:11:06 -04:00
Added read/unread state to channel service (copied from forum service).
Added new and missing tests of the RsItems. Added new notifier on channel changes. Reworked fill of channels in ChannelFeed. Now the channel tree is updated and not refilled. Show unread message count in channels tree. Fixed memory leak in context menu. Show a new tray icon and action icon in MainWindow, when new channel messages are available. Recompile of the GUI needed. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3626 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
df20d69b29
commit
fc0ff38206
22 changed files with 1181 additions and 653 deletions
|
@ -34,6 +34,10 @@
|
||||||
#include "rstypes.h"
|
#include "rstypes.h"
|
||||||
#include "rsdistrib.h" /* For FLAGS */
|
#include "rsdistrib.h" /* For FLAGS */
|
||||||
|
|
||||||
|
#define CHANNEL_MSG_STATUS_MASK 0x000f
|
||||||
|
#define CHANNEL_MSG_STATUS_READ 0x0001
|
||||||
|
#define CHANNEL_MSG_STATUS_UNREAD_BY_USER 0x0002
|
||||||
|
|
||||||
//! Stores information for a give channel id
|
//! Stores information for a give channel id
|
||||||
/*!
|
/*!
|
||||||
* Stores all information for a given channel id
|
* Stores all information for a given channel id
|
||||||
|
@ -167,6 +171,31 @@ virtual bool getChannelMsgList(std::string cId, std::list<ChannelMsgSummary> &ms
|
||||||
*/
|
*/
|
||||||
virtual bool getChannelMessage(std::string cId, std::string mId, ChannelMsgInfo &msg) = 0;
|
virtual bool getChannelMessage(std::string cId, std::string mId, ChannelMsgInfo &msg) = 0;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* set message status
|
||||||
|
* @param cId channel id
|
||||||
|
* @param mId message id
|
||||||
|
* @param status status to set
|
||||||
|
* @param statusMask bitmask to modify
|
||||||
|
*/
|
||||||
|
virtual bool setMessageStatus(const std::string& cId,const std::string& mId, const uint32_t status, const uint32_t statusMask) = 0;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* set message status
|
||||||
|
* @param cId channel id
|
||||||
|
* @param mId message id
|
||||||
|
* @param status status
|
||||||
|
*/
|
||||||
|
virtual bool getMessageStatus(const std::string& cId, const std::string& mId, uint32_t& status) = 0;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* count the new and unread messages
|
||||||
|
* @param cId channel id
|
||||||
|
* @param newCount count of new messages
|
||||||
|
* @param unreadCount count of unread messages
|
||||||
|
*/
|
||||||
|
virtual bool getMessageCount(const std::string cId, unsigned int &newCount, unsigned int &unreadCount) = 0;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* send message contain in message info to the id indicated within it (make sure you set the channel id of the message info)
|
* send message contain in message info to the id indicated within it (make sure you set the channel id of the message info)
|
||||||
* @param info message to be sent
|
* @param info message to be sent
|
||||||
|
|
|
@ -198,6 +198,7 @@ class NotifyBase
|
||||||
virtual void notifyPeerStatusChanged(const std::string& /* peer_id */, uint32_t /* status */) {}
|
virtual void notifyPeerStatusChanged(const std::string& /* peer_id */, uint32_t /* status */) {}
|
||||||
/* one or more peers has changed the states */
|
/* one or more peers has changed the states */
|
||||||
virtual void notifyPeerStatusChangedSummary() {}
|
virtual void notifyPeerStatusChangedSummary() {}
|
||||||
|
virtual void notifyChannelMsgReadSatusChanged(const std::string& /* channelId */, const std::string& /* msgId */, uint32_t /* status */) {}
|
||||||
|
|
||||||
virtual std::string askForPassword(const std::string& /* key_details */ ,bool /* prev_is_bad */ ) { return "" ;}
|
virtual std::string askForPassword(const std::string& /* key_details */ ,bool /* prev_is_bad */ ) { return "" ;}
|
||||||
};
|
};
|
||||||
|
@ -217,6 +218,7 @@ const int NOTIFY_LIST_PUBLIC_CHAT = 13;
|
||||||
const int NOTIFY_LIST_PRIVATE_INCOMING_CHAT = 14;
|
const int NOTIFY_LIST_PRIVATE_INCOMING_CHAT = 14;
|
||||||
const int NOTIFY_LIST_PRIVATE_OUTGOING_CHAT = 15;
|
const int NOTIFY_LIST_PRIVATE_OUTGOING_CHAT = 15;
|
||||||
const int NOTIFY_LIST_GROUPLIST = 16;
|
const int NOTIFY_LIST_GROUPLIST = 16;
|
||||||
|
const int NOTIFY_LIST_CHANNELLIST_LOCKED = 17; // use connect with Qt::QueuedConnection
|
||||||
|
|
||||||
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 */
|
||||||
|
|
|
@ -74,6 +74,45 @@ std::ostream &RsChannelMsg::print(std::ostream &out, uint16_t indent)
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RsChannelReadStatus::clear()
|
||||||
|
{
|
||||||
|
|
||||||
|
RsDistribChildConfig::clear();
|
||||||
|
|
||||||
|
channelId.clear();
|
||||||
|
msgReadStatus.clear();
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
std::ostream& RsChannelReadStatus::print(std::ostream &out, uint16_t indent = 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
printRsItemBase(out, "RsChannelMsg", indent);
|
||||||
|
uint16_t int_Indent = indent + 2;
|
||||||
|
|
||||||
|
RsDistribChildConfig::print(out, int_Indent);
|
||||||
|
|
||||||
|
printIndent(out, int_Indent);
|
||||||
|
out << "ChannelId: " << channelId << std::endl;
|
||||||
|
|
||||||
|
std::map<std::string, uint32_t>::iterator mit = msgReadStatus.begin();
|
||||||
|
|
||||||
|
for(; mit != msgReadStatus.end(); mit++)
|
||||||
|
{
|
||||||
|
|
||||||
|
printIndent(out, int_Indent);
|
||||||
|
out << "msgId : " << mit->first << std::endl;
|
||||||
|
|
||||||
|
printIndent(out, int_Indent);
|
||||||
|
out << " status : " << mit->second << std::endl;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
printRsItemEnd(out, "RsChannelMsg", indent);
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
@ -204,19 +243,207 @@ RsChannelMsg *RsChannelSerialiser::deserialiseMsg(void *data, uint32_t *pktsize)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint32_t RsChannelSerialiser::sizeReadStatus(RsChannelReadStatus *item)
|
||||||
|
{
|
||||||
|
uint32_t s = 8; /* header */
|
||||||
|
/* RsDistribChildConfig stuff */
|
||||||
|
|
||||||
|
s += 4; /* save_type */
|
||||||
|
|
||||||
|
/* RsChannelReadStatus stuff */
|
||||||
|
|
||||||
|
s += GetTlvStringSize(item->channelId);
|
||||||
|
|
||||||
|
std::map<std::string, uint32_t>::iterator mit = item->msgReadStatus.begin();
|
||||||
|
|
||||||
|
for(; mit != item->msgReadStatus.end(); mit++)
|
||||||
|
{
|
||||||
|
s += GetTlvStringSize(mit->first); /* key */
|
||||||
|
s += 4; /* value */
|
||||||
|
}
|
||||||
|
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* serialise the data to the buffer */
|
||||||
|
bool RsChannelSerialiser::serialiseReadStatus(RsChannelReadStatus *item, void *data, uint32_t *pktsize)
|
||||||
|
{
|
||||||
|
uint32_t tlvsize = sizeReadStatus(item);
|
||||||
|
uint32_t offset = 0;
|
||||||
|
|
||||||
|
if (*pktsize < tlvsize)
|
||||||
|
return false; /* not enough space */
|
||||||
|
|
||||||
|
*pktsize = tlvsize;
|
||||||
|
|
||||||
|
bool ok = true;
|
||||||
|
|
||||||
|
ok &= setRsItemHeader(data, tlvsize, item->PacketId(), tlvsize);
|
||||||
|
|
||||||
|
std::cerr << "RsChannelSerialiser::serialiseReadStatus() Header: " << ok << std::endl;
|
||||||
|
std::cerr << "RsChannelSerialiser::serialiseReadStatus() Size: " << tlvsize << std::endl;
|
||||||
|
|
||||||
|
/* skip the header */
|
||||||
|
offset += 8;
|
||||||
|
|
||||||
|
/* RsDistribMsg first */
|
||||||
|
|
||||||
|
ok &= setRawUInt32(data, tlvsize, &offset, item->save_type);
|
||||||
|
std::cerr << "RsChannelSerialiser::serialiseReadStatus() save_type: " << ok << std::endl;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* RsChannelMsg */
|
||||||
|
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_GROUPID, item->channelId);
|
||||||
|
std::cerr << "RsChannelSerialiser::serialiseReadStatus() channelId: " << ok << std::endl;
|
||||||
|
|
||||||
|
std::map<std::string, uint32_t>::iterator mit = item->msgReadStatus.begin();
|
||||||
|
|
||||||
|
for(; mit != item->msgReadStatus.end(); mit++)
|
||||||
|
{
|
||||||
|
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_MSGID, mit->first); /* key */
|
||||||
|
ok &= setRawUInt32(data, tlvsize, &offset, mit->second); /* value */
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cerr << "RsChannelSerialiser::serialiseReadStatus() msgReadStatus: " << ok << std::endl;
|
||||||
|
|
||||||
|
if (offset != tlvsize)
|
||||||
|
{
|
||||||
|
ok = false;
|
||||||
|
std::cerr << "RsChannelSerialiser::serialiseReadStatus() Size Error! " << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
RsChannelReadStatus *RsChannelSerialiser::deserialiseReadStatus(void *data, uint32_t *pktsize)
|
||||||
|
{
|
||||||
|
/* get the type and size */
|
||||||
|
uint32_t rstype = getRsItemId(data);
|
||||||
|
uint32_t rssize = getRsItemSize(data);
|
||||||
|
|
||||||
|
uint32_t offset = 0;
|
||||||
|
|
||||||
|
|
||||||
|
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
|
||||||
|
(RS_SERVICE_TYPE_CHANNEL != getRsItemService(rstype)) ||
|
||||||
|
(RS_PKT_SUBTYPE_CHANNEL_READ_STATUS != getRsItemSubType(rstype)))
|
||||||
|
{
|
||||||
|
return NULL; /* wrong type */
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*pktsize < rssize) /* check size */
|
||||||
|
return NULL; /* not enough data */
|
||||||
|
|
||||||
|
/* set the packet length */
|
||||||
|
*pktsize = rssize;
|
||||||
|
|
||||||
|
bool ok = true;
|
||||||
|
|
||||||
|
/* ready to load */
|
||||||
|
RsChannelReadStatus *item = new RsChannelReadStatus();
|
||||||
|
item->clear();
|
||||||
|
|
||||||
|
/* skip the header */
|
||||||
|
offset += 8;
|
||||||
|
|
||||||
|
/* RsDistribMsg first */
|
||||||
|
ok &= getRawUInt32(data, rssize, &offset, &(item->save_type));
|
||||||
|
|
||||||
|
/* RschannelMsg */
|
||||||
|
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_GROUPID, item->channelId);
|
||||||
|
|
||||||
|
std::string key;
|
||||||
|
uint32_t value;
|
||||||
|
|
||||||
|
while(offset != rssize)
|
||||||
|
{
|
||||||
|
key.clear();
|
||||||
|
value = 0;
|
||||||
|
|
||||||
|
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_MSGID, key); /* key */
|
||||||
|
|
||||||
|
/* incomplete key value pair? then fail*/
|
||||||
|
if(offset == rssize)
|
||||||
|
{
|
||||||
|
delete item;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ok &= getRawUInt32(data, rssize, &offset, &value); /* value */
|
||||||
|
|
||||||
|
item->msgReadStatus.insert(std::pair<std::string, uint32_t>(key, value));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ok)
|
||||||
|
{
|
||||||
|
delete item;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
/************************************************************/
|
||||||
|
|
||||||
uint32_t RsChannelSerialiser::size(RsItem *item)
|
uint32_t RsChannelSerialiser::size(RsItem *item)
|
||||||
{
|
{
|
||||||
return sizeMsg((RsChannelMsg *) item);
|
RsChannelMsg* dcm;
|
||||||
|
RsChannelReadStatus* drs;
|
||||||
|
|
||||||
|
if( NULL != ( dcm = dynamic_cast<RsChannelMsg*>(item)))
|
||||||
|
{
|
||||||
|
return sizeMsg(dcm);
|
||||||
|
}
|
||||||
|
else if(NULL != (drs = dynamic_cast<RsChannelReadStatus* >(item)))
|
||||||
|
{
|
||||||
|
return sizeReadStatus(drs);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RsChannelSerialiser::serialise(RsItem *item, void *data, uint32_t *pktsize)
|
bool RsChannelSerialiser::serialise(RsItem *item, void *data, uint32_t *pktsize)
|
||||||
{
|
{
|
||||||
return serialiseMsg((RsChannelMsg *) item, data, pktsize);
|
RsChannelMsg* dcm;
|
||||||
|
RsChannelReadStatus* drs;
|
||||||
|
|
||||||
|
if( NULL != ( dcm = dynamic_cast<RsChannelMsg*>(item)))
|
||||||
|
{
|
||||||
|
return serialiseMsg(dcm, data, pktsize);
|
||||||
|
}
|
||||||
|
else if(NULL != (drs = dynamic_cast<RsChannelReadStatus* >(item)))
|
||||||
|
{
|
||||||
|
return serialiseReadStatus(drs, data, pktsize);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
RsItem *RsChannelSerialiser::deserialise(void *data, uint32_t *pktsize)
|
RsItem *RsChannelSerialiser::deserialise(void *data, uint32_t *pktsize)
|
||||||
{
|
{
|
||||||
|
/* get the type and size */
|
||||||
|
uint32_t rstype = getRsItemId(data);
|
||||||
|
|
||||||
|
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
|
||||||
|
(RS_SERVICE_TYPE_CHANNEL != getRsItemService(rstype)))
|
||||||
|
{
|
||||||
|
return NULL; /* wrong type */
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(getRsItemSubType(rstype))
|
||||||
|
{
|
||||||
|
case RS_PKT_SUBTYPE_CHANNEL_MSG:
|
||||||
return deserialiseMsg(data, pktsize);
|
return deserialiseMsg(data, pktsize);
|
||||||
|
case RS_PKT_SUBTYPE_CHANNEL_READ_STATUS:
|
||||||
|
return deserialiseReadStatus(data, pktsize);
|
||||||
|
default:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include "serialiser/rsdistribitems.h"
|
#include "serialiser/rsdistribitems.h"
|
||||||
|
|
||||||
const uint8_t RS_PKT_SUBTYPE_CHANNEL_MSG = 0x01;
|
const uint8_t RS_PKT_SUBTYPE_CHANNEL_MSG = 0x01;
|
||||||
|
const uint8_t RS_PKT_SUBTYPE_CHANNEL_READ_STATUS = 0x02;
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
|
|
||||||
|
@ -63,6 +64,29 @@ virtual std::ostream& print(std::ostream &out, uint16_t indent = 0);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* This is used to keep track of whether a message has been read
|
||||||
|
* by client
|
||||||
|
*/
|
||||||
|
class RsChannelReadStatus : public RsDistribChildConfig
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RsChannelReadStatus()
|
||||||
|
: RsDistribChildConfig(RS_SERVICE_TYPE_CHANNEL, RS_PKT_SUBTYPE_CHANNEL_READ_STATUS)
|
||||||
|
{ return; }
|
||||||
|
|
||||||
|
virtual ~RsChannelReadStatus() {return; }
|
||||||
|
|
||||||
|
virtual void clear();
|
||||||
|
virtual std::ostream& print(std::ostream &out, uint16_t indent);
|
||||||
|
|
||||||
|
std::string channelId;
|
||||||
|
|
||||||
|
/// a map which contains the read for messages within a forum
|
||||||
|
std::map<std::string, uint32_t> msgReadStatus;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
class RsChannelSerialiser: public RsSerialType
|
class RsChannelSerialiser: public RsSerialType
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -83,6 +107,10 @@ virtual uint32_t sizeMsg(RsChannelMsg *);
|
||||||
virtual bool serialiseMsg(RsChannelMsg *item, void *data, uint32_t *size);
|
virtual bool serialiseMsg(RsChannelMsg *item, void *data, uint32_t *size);
|
||||||
virtual RsChannelMsg *deserialiseMsg(void *data, uint32_t *size);
|
virtual RsChannelMsg *deserialiseMsg(void *data, uint32_t *size);
|
||||||
|
|
||||||
|
virtual uint32_t sizeReadStatus(RsChannelReadStatus* );
|
||||||
|
virtual bool serialiseReadStatus(RsChannelReadStatus* item, void* data, uint32_t *size);
|
||||||
|
virtual RsChannelReadStatus *deserialiseReadStatus(void* data, uint32_t *size);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
#include "services/p3channels.h"
|
#include "services/p3channels.h"
|
||||||
#include "util/rsdir.h"
|
#include "util/rsdir.h"
|
||||||
|
#include "retroshare/rsiface.h"
|
||||||
|
|
||||||
std::ostream &operator<<(std::ostream &out, const ChannelInfo &info)
|
std::ostream &operator<<(std::ostream &out, const ChannelInfo &info)
|
||||||
{
|
{
|
||||||
|
@ -182,14 +183,14 @@ bool p3Channels::getChannelMsgList(std::string cId, std::list<ChannelMsgSummary>
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3Channels::getChannelMessage(std::string fId, std::string mId, ChannelMsgInfo &info)
|
bool p3Channels::getChannelMessage(std::string cId, std::string mId, ChannelMsgInfo &info)
|
||||||
{
|
{
|
||||||
std::list<std::string> msgIds;
|
std::list<std::string> msgIds;
|
||||||
std::list<std::string>::iterator it;
|
std::list<std::string>::iterator it;
|
||||||
|
|
||||||
RsStackMutex stack(distribMtx); /***** STACK LOCKED MUTEX *****/
|
RsStackMutex stack(distribMtx); /***** STACK LOCKED MUTEX *****/
|
||||||
|
|
||||||
RsDistribMsg *msg = locked_getGroupMsg(fId, mId);
|
RsDistribMsg *msg = locked_getGroupMsg(cId, mId);
|
||||||
RsChannelMsg *cmsg = dynamic_cast<RsChannelMsg *>(msg);
|
RsChannelMsg *cmsg = dynamic_cast<RsChannelMsg *>(msg);
|
||||||
if (!cmsg)
|
if (!cmsg)
|
||||||
return false;
|
return false;
|
||||||
|
@ -285,9 +286,181 @@ bool p3Channels::ChannelMessageSend(ChannelMsgInfo &info)
|
||||||
|
|
||||||
std::string msgId = publishMsg(cmsg, toSign);
|
std::string msgId = publishMsg(cmsg, toSign);
|
||||||
|
|
||||||
|
if (msgId.empty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return setMessageStatus(info.channelId, msgId, CHANNEL_MSG_STATUS_READ, CHANNEL_MSG_STATUS_MASK);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool p3Channels::setMessageStatus(const std::string& cId,const std::string& mId,const uint32_t status, const uint32_t statusMask)
|
||||||
|
{
|
||||||
|
bool changed = false;
|
||||||
|
uint32_t newStatus = 0;
|
||||||
|
|
||||||
|
{
|
||||||
|
RsStackMutex stack(distribMtx); /***** STACK LOCKED MUTEX *****/
|
||||||
|
|
||||||
|
std::list<RsChannelReadStatus *>::iterator lit = mReadStatus.begin();
|
||||||
|
|
||||||
|
for(; lit != mReadStatus.end(); lit++)
|
||||||
|
{
|
||||||
|
|
||||||
|
if((*lit)->channelId == cId)
|
||||||
|
{
|
||||||
|
RsChannelReadStatus* rsi = *lit;
|
||||||
|
uint32_t oldStatus = rsi->msgReadStatus[mId];
|
||||||
|
rsi->msgReadStatus[mId] &= ~statusMask;
|
||||||
|
rsi->msgReadStatus[mId] |= (status & statusMask);
|
||||||
|
|
||||||
|
newStatus = rsi->msgReadStatus[mId];
|
||||||
|
if (oldStatus != newStatus) {
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// if channel id does not exist create one
|
||||||
|
if(lit == mReadStatus.end())
|
||||||
|
{
|
||||||
|
RsChannelReadStatus* rsi = new RsChannelReadStatus();
|
||||||
|
rsi->channelId = cId;
|
||||||
|
rsi->msgReadStatus[mId] = status & statusMask;
|
||||||
|
mReadStatus.push_back(rsi);
|
||||||
|
saveList.push_back(rsi);
|
||||||
|
|
||||||
|
newStatus = rsi->msgReadStatus[mId];
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (changed) {
|
||||||
|
IndicateConfigChanged();
|
||||||
|
}
|
||||||
|
} /******* UNLOCKED ********/
|
||||||
|
|
||||||
|
if (changed) {
|
||||||
|
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHANNELLIST_LOCKED, NOTIFY_TYPE_MOD);
|
||||||
|
rsicontrol->getNotify().notifyChannelMsgReadSatusChanged(cId, mId, newStatus);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool p3Channels::getMessageStatus(const std::string& cId, const std::string& mId, uint32_t& status)
|
||||||
|
{
|
||||||
|
|
||||||
|
status = 0;
|
||||||
|
|
||||||
|
RsStackMutex stack(distribMtx);
|
||||||
|
|
||||||
|
std::list<RsChannelReadStatus *>::iterator lit = mReadStatus.begin();
|
||||||
|
|
||||||
|
for(; lit != mReadStatus.end(); lit++)
|
||||||
|
{
|
||||||
|
|
||||||
|
if((*lit)->channelId == cId)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(lit == mReadStatus.end())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::map<std::string, uint32_t >::iterator mit = (*lit)->msgReadStatus.find(mId);
|
||||||
|
|
||||||
|
if(mit != (*lit)->msgReadStatus.end())
|
||||||
|
{
|
||||||
|
status = mit->second;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool p3Channels::getMessageCount(const std::string cId, unsigned int &newCount, unsigned int &unreadCount)
|
||||||
|
{
|
||||||
|
newCount = 0;
|
||||||
|
unreadCount = 0;
|
||||||
|
|
||||||
|
std::list<std::string> grpIds;
|
||||||
|
|
||||||
|
if (cId.empty()) {
|
||||||
|
// count all messages of all subscribed channels
|
||||||
|
getAllGroupList(grpIds);
|
||||||
|
} else {
|
||||||
|
// count all messages of one channels
|
||||||
|
grpIds.push_back(cId);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::list<std::string>::iterator git;
|
||||||
|
for (git = grpIds.begin(); git != grpIds.end(); git++) {
|
||||||
|
std::string cId = *git;
|
||||||
|
uint32_t grpFlags;
|
||||||
|
|
||||||
|
{
|
||||||
|
// only flag is needed
|
||||||
|
RsStackMutex stack(distribMtx); /***** STACK LOCKED MUTEX *****/
|
||||||
|
GroupInfo *gi = locked_getGroupInfo(cId);
|
||||||
|
if (gi == NULL) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
grpFlags = gi->flags;
|
||||||
|
} /******* UNLOCKED ********/
|
||||||
|
|
||||||
|
if (grpFlags & (RS_DISTRIB_ADMIN | RS_DISTRIB_SUBSCRIBED)) {
|
||||||
|
std::list<std::string> msgIds;
|
||||||
|
if (getAllMsgList(cId, msgIds)) {
|
||||||
|
std::list<std::string>::iterator mit;
|
||||||
|
|
||||||
|
RsStackMutex stack(distribMtx); /***** STACK LOCKED MUTEX *****/
|
||||||
|
|
||||||
|
std::list<RsChannelReadStatus *>::iterator lit;
|
||||||
|
for(lit = mReadStatus.begin(); lit != mReadStatus.end(); lit++) {
|
||||||
|
if ((*lit)->channelId == cId) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lit == mReadStatus.end()) {
|
||||||
|
// no status available -> all messages are new
|
||||||
|
newCount += msgIds.size();
|
||||||
|
unreadCount += msgIds.size();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (mit = msgIds.begin(); mit != msgIds.end(); mit++) {
|
||||||
|
std::map<std::string, uint32_t >::iterator rit = (*lit)->msgReadStatus.find(*mit);
|
||||||
|
|
||||||
|
if (rit == (*lit)->msgReadStatus.end()) {
|
||||||
|
// no status available -> message is new
|
||||||
|
newCount++;
|
||||||
|
unreadCount++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rit->second & CHANNEL_MSG_STATUS_READ) {
|
||||||
|
// message is not new
|
||||||
|
if (rit->second & CHANNEL_MSG_STATUS_UNREAD_BY_USER) {
|
||||||
|
// message is unread
|
||||||
|
unreadCount++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
newCount++;
|
||||||
|
unreadCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} /******* UNLOCKED ********/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool p3Channels::channelExtraFileHash(std::string path, std::string chId, FileInfo& fInfo){
|
bool p3Channels::channelExtraFileHash(std::string path, std::string chId, FileInfo& fInfo){
|
||||||
|
|
||||||
|
@ -636,7 +809,6 @@ bool p3Channels::locked_eventNewMsg(GroupInfo *grp, RsDistribMsg *msg, std::stri
|
||||||
return locked_eventDuplicateMsg(grp, msg, id);
|
return locked_eventDuplicateMsg(grp, msg, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void p3Channels::locked_notifyGroupChanged(GroupInfo &grp, uint32_t flags)
|
void p3Channels::locked_notifyGroupChanged(GroupInfo &grp, uint32_t flags)
|
||||||
{
|
{
|
||||||
std::string grpId = grp.grpId;
|
std::string grpId = grp.grpId;
|
||||||
|
@ -655,12 +827,14 @@ void p3Channels::locked_notifyGroupChanged(GroupInfo &grp, uint32_t flags)
|
||||||
std::cerr << "p3Channels::locked_notifyGroupChanged() NEW UPDATE" << std::endl;
|
std::cerr << "p3Channels::locked_notifyGroupChanged() NEW UPDATE" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
getPqiNotify()->AddFeedItem(RS_FEED_ITEM_CHAN_NEW, grpId, msgId, nullId);
|
getPqiNotify()->AddFeedItem(RS_FEED_ITEM_CHAN_NEW, grpId, msgId, nullId);
|
||||||
|
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHANNELLIST_LOCKED, NOTIFY_TYPE_ADD);
|
||||||
break;
|
break;
|
||||||
case GRP_UPDATE:
|
case GRP_UPDATE:
|
||||||
#ifdef CHANNEL_DEBUG
|
#ifdef CHANNEL_DEBUG
|
||||||
std::cerr << "p3Channels::locked_notifyGroupChanged() UPDATE" << std::endl;
|
std::cerr << "p3Channels::locked_notifyGroupChanged() UPDATE" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
getPqiNotify()->AddFeedItem(RS_FEED_ITEM_CHAN_UPDATE, grpId, msgId, nullId);
|
getPqiNotify()->AddFeedItem(RS_FEED_ITEM_CHAN_UPDATE, grpId, msgId, nullId);
|
||||||
|
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHANNELLIST_LOCKED, NOTIFY_TYPE_MOD);
|
||||||
break;
|
break;
|
||||||
case GRP_LOAD_KEY:
|
case GRP_LOAD_KEY:
|
||||||
#ifdef CHANNEL_DEBUG
|
#ifdef CHANNEL_DEBUG
|
||||||
|
@ -671,6 +845,7 @@ void p3Channels::locked_notifyGroupChanged(GroupInfo &grp, uint32_t flags)
|
||||||
#ifdef CHANNEL_DEBUG
|
#ifdef CHANNEL_DEBUG
|
||||||
std::cerr << "p3Channels::locked_notifyGroupChanged() NEW MSG" << std::endl;
|
std::cerr << "p3Channels::locked_notifyGroupChanged() NEW MSG" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHANNELLIST_LOCKED, NOTIFY_TYPE_ADD);
|
||||||
break;
|
break;
|
||||||
case GRP_SUBSCRIBED:
|
case GRP_SUBSCRIBED:
|
||||||
#ifdef CHANNEL_DEBUG
|
#ifdef CHANNEL_DEBUG
|
||||||
|
@ -690,11 +865,13 @@ void p3Channels::locked_notifyGroupChanged(GroupInfo &grp, uint32_t flags)
|
||||||
/* check if downloads need to be started? */
|
/* check if downloads need to be started? */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHANNELLIST_LOCKED, NOTIFY_TYPE_ADD);
|
||||||
break;
|
break;
|
||||||
case GRP_UNSUBSCRIBED:
|
case GRP_UNSUBSCRIBED:
|
||||||
#ifdef CHANNEL_DEBUG
|
#ifdef CHANNEL_DEBUG
|
||||||
std::cerr << "p3Channels::locked_notifyGroupChanged() UNSUBSCRIBED" << std::endl;
|
std::cerr << "p3Channels::locked_notifyGroupChanged() UNSUBSCRIBED" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHANNELLIST_LOCKED, NOTIFY_TYPE_DEL);
|
||||||
|
|
||||||
/* won't stop downloads... */
|
/* won't stop downloads... */
|
||||||
|
|
||||||
|
@ -778,6 +955,24 @@ void p3Channels::cleanUpOldFiles(){
|
||||||
//TODO: if you want to config saving and loading for channel distrib service implement this method further
|
//TODO: if you want to config saving and loading for channel distrib service implement this method further
|
||||||
bool p3Channels::childLoadList(std::list<RsItem* >& configSaves)
|
bool p3Channels::childLoadList(std::list<RsItem* >& configSaves)
|
||||||
{
|
{
|
||||||
|
RsChannelReadStatus* drs = NULL;
|
||||||
|
std::list<RsItem* >::iterator it;
|
||||||
|
|
||||||
|
for(it = configSaves.begin(); it != configSaves.end(); it++)
|
||||||
|
{
|
||||||
|
if(NULL != (drs = dynamic_cast<RsChannelReadStatus* >(*it)))
|
||||||
|
{
|
||||||
|
mReadStatus.push_back(drs);
|
||||||
|
saveList.push_back(drs);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cerr << "p3Channels::childLoadList(): Configs items loaded were incorrect!"
|
||||||
|
<< std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,10 @@ virtual bool getChannelMsgList(std::string cId, std::list<ChannelMsgSummary> &ms
|
||||||
virtual bool getChannelMessage(std::string cId, std::string mId, ChannelMsgInfo &msg);
|
virtual bool getChannelMessage(std::string cId, std::string mId, ChannelMsgInfo &msg);
|
||||||
|
|
||||||
virtual bool ChannelMessageSend(ChannelMsgInfo &info);
|
virtual bool ChannelMessageSend(ChannelMsgInfo &info);
|
||||||
|
virtual bool setMessageStatus(const std::string& cId, const std::string& mId, const uint32_t status, const uint32_t statusMask);
|
||||||
|
virtual bool getMessageStatus(const std::string& cId, const std::string& mId, uint32_t& status);
|
||||||
|
|
||||||
|
virtual bool getMessageCount(const std::string cId, unsigned int &newCount, unsigned int &unreadCount);
|
||||||
|
|
||||||
virtual bool channelSubscribe(std::string cId, bool subscribe);
|
virtual bool channelSubscribe(std::string cId, bool subscribe);
|
||||||
virtual bool channelExtraFileHash(std::string path, std::string chId, FileInfo& fInfo);
|
virtual bool channelExtraFileHash(std::string path, std::string chId, FileInfo& fInfo);
|
||||||
|
@ -106,6 +110,7 @@ bool cpyMsgFileToChFldr(std::string path, std::string fname, std::string chId, b
|
||||||
std::string mChannelsDir;
|
std::string mChannelsDir;
|
||||||
std::list<RsItem *> saveList;
|
std::list<RsItem *> saveList;
|
||||||
|
|
||||||
|
std::list<RsChannelReadStatus *> mReadStatus;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -564,9 +564,11 @@ void p3Forums::locked_notifyGroupChanged(GroupInfo &grp, uint32_t flags)
|
||||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_FORUMLIST_LOCKED, NOTIFY_TYPE_ADD);
|
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_FORUMLIST_LOCKED, NOTIFY_TYPE_ADD);
|
||||||
break;
|
break;
|
||||||
case GRP_SUBSCRIBED:
|
case GRP_SUBSCRIBED:
|
||||||
case GRP_UNSUBSCRIBED:
|
|
||||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_FORUMLIST_LOCKED, NOTIFY_TYPE_ADD);
|
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_FORUMLIST_LOCKED, NOTIFY_TYPE_ADD);
|
||||||
break;
|
break;
|
||||||
|
case GRP_UNSUBSCRIBED:
|
||||||
|
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_FORUMLIST_LOCKED, NOTIFY_TYPE_DEL);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return p3GroupDistrib::locked_notifyGroupChanged(grp, flags);
|
return p3GroupDistrib::locked_notifyGroupChanged(grp, flags);
|
||||||
}
|
}
|
||||||
|
|
|
@ -276,6 +276,51 @@ bool operator==(const RsForumReadStatus& frs1, const RsForumReadStatus& frs2)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
RsSerialType* init_item(RsChannelReadStatus& fRdStatus)
|
||||||
|
{
|
||||||
|
randString(SHORT_STR, fRdStatus.channelId);
|
||||||
|
fRdStatus.save_type = rand()%42;
|
||||||
|
|
||||||
|
std::map<std::string, uint32_t>::iterator mit = fRdStatus.msgReadStatus.begin();
|
||||||
|
|
||||||
|
std::string id;
|
||||||
|
uint32_t status = 0;
|
||||||
|
|
||||||
|
int numMaps = rand()%12;
|
||||||
|
|
||||||
|
for(int i = 0; i < numMaps; i++)
|
||||||
|
{
|
||||||
|
randString(SHORT_STR, id);
|
||||||
|
status = rand()%23;
|
||||||
|
|
||||||
|
fRdStatus.msgReadStatus.insert(std::pair<std::string, uint32_t>(id, status));
|
||||||
|
}
|
||||||
|
|
||||||
|
return new RsChannelSerialiser();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator==(const RsChannelReadStatus& frs1, const RsChannelReadStatus& frs2)
|
||||||
|
{
|
||||||
|
if(frs1.channelId != frs2.channelId) return false;
|
||||||
|
if(frs1.save_type != frs2.save_type) return false;
|
||||||
|
|
||||||
|
if(frs1.msgReadStatus.size() != frs2.msgReadStatus.size()) return false;
|
||||||
|
|
||||||
|
std::map<std::string, uint32_t>::const_iterator mit
|
||||||
|
= frs1.msgReadStatus.begin();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for(;mit != frs1.msgReadStatus.end(); mit++)
|
||||||
|
{
|
||||||
|
if(mit->second != frs2.msgReadStatus.find(mit->first)->second) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool operator==(const RsBlogMsg& bMsg1,const RsBlogMsg& bMsg2)
|
bool operator==(const RsBlogMsg& bMsg1,const RsBlogMsg& bMsg2)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -307,6 +352,7 @@ int main(){
|
||||||
test_RsItem<RsDistribGrpKey>(); REPORT("Serialise/Deserialise RsDistribGrpKey");
|
test_RsItem<RsDistribGrpKey>(); REPORT("Serialise/Deserialise RsDistribGrpKey");
|
||||||
test_RsItem<RsDistribSignedMsg>(); REPORT("Serialise/Deserialise RsDistribSignedMsg");
|
test_RsItem<RsDistribSignedMsg>(); REPORT("Serialise/Deserialise RsDistribSignedMsg");
|
||||||
test_RsItem<RsChannelMsg>(); REPORT("Serialise/Deserialise RsChannelMsg");
|
test_RsItem<RsChannelMsg>(); REPORT("Serialise/Deserialise RsChannelMsg");
|
||||||
|
test_RsItem<RsChannelReadStatus>(); REPORT("Serialise/Deserialise RsChannelReadStatus");
|
||||||
test_RsItem<RsForumMsg>(); REPORT("Serialise/Deserialise RsForumMsg");
|
test_RsItem<RsForumMsg>(); REPORT("Serialise/Deserialise RsForumMsg");
|
||||||
test_RsItem<RsForumReadStatus>(); REPORT("Serialise/Deserialise RsForumReadStatus");
|
test_RsItem<RsForumReadStatus>(); REPORT("Serialise/Deserialise RsForumReadStatus");
|
||||||
test_RsItem<RsBlogMsg>(); REPORT("Serialise/Deserialise RsBlogMsg");
|
test_RsItem<RsBlogMsg>(); REPORT("Serialise/Deserialise RsBlogMsg");
|
||||||
|
|
|
@ -42,6 +42,18 @@ RsSerialType* init_item(RsChatMsgItem& cmi)
|
||||||
return new RsChatSerialiser();
|
return new RsChatSerialiser();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RsSerialType* init_item(RsPrivateChatMsgConfigItem& pcmi)
|
||||||
|
{
|
||||||
|
randString(SHORT_STR, pcmi.configPeerId);
|
||||||
|
pcmi.chatFlags = rand()%34;
|
||||||
|
pcmi.configFlags = rand()%21;
|
||||||
|
pcmi.sendTime = rand()%422224;
|
||||||
|
randString(LARGE_STR, pcmi.message);
|
||||||
|
pcmi.recvTime = rand()%344443;
|
||||||
|
|
||||||
|
return new RsChatSerialiser();
|
||||||
|
}
|
||||||
|
|
||||||
RsSerialType* init_item(RsChatStatusItem& csi)
|
RsSerialType* init_item(RsChatStatusItem& csi)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -123,6 +135,19 @@ bool operator ==(const RsChatMsgItem& cmiLeft,const RsChatMsgItem& cmiRight)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool operator ==(const RsPrivateChatMsgConfigItem& pcmiLeft,const RsPrivateChatMsgConfigItem& pcmiRight)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(pcmiLeft.configPeerId != pcmiRight.configPeerId) return false;
|
||||||
|
if(pcmiLeft.chatFlags != pcmiRight.chatFlags) return false;
|
||||||
|
if(pcmiLeft.configFlags != pcmiRight.configFlags) return false;
|
||||||
|
if(pcmiLeft.message != pcmiRight.message) return false;
|
||||||
|
if(pcmiLeft.sendTime != pcmiRight.sendTime) return false;
|
||||||
|
if(pcmiLeft.recvTime != pcmiRight.recvTime) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool operator ==(const RsChatStatusItem& csiLeft, const RsChatStatusItem& csiRight)
|
bool operator ==(const RsChatStatusItem& csiLeft, const RsChatStatusItem& csiRight)
|
||||||
{
|
{
|
||||||
if(csiLeft.flags != csiRight.flags) return false;
|
if(csiLeft.flags != csiRight.flags) return false;
|
||||||
|
@ -201,6 +226,7 @@ bool operator ==(const RsMsgSrcId& msLeft, const RsMsgSrcId& msRight)
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
test_RsItem<RsChatMsgItem >(); REPORT("Serialise/Deserialise RsChatMsgItem");
|
test_RsItem<RsChatMsgItem >(); REPORT("Serialise/Deserialise RsChatMsgItem");
|
||||||
|
test_RsItem<RsChatMsgItem >(); REPORT("Serialise/Deserialise RsPrivateChatMsgConfigItem");
|
||||||
test_RsItem<RsChatStatusItem >(); REPORT("Serialise/Deserialise RsChatStatusItem");
|
test_RsItem<RsChatStatusItem >(); REPORT("Serialise/Deserialise RsChatStatusItem");
|
||||||
test_RsItem<RsChatAvatarItem >(); REPORT("Serialise/Deserialise RsChatAvatarItem");
|
test_RsItem<RsChatAvatarItem >(); REPORT("Serialise/Deserialise RsChatAvatarItem");
|
||||||
test_RsItem<RsMsgItem >(); REPORT("Serialise/Deserialise RsMsgItem");
|
test_RsItem<RsMsgItem >(); REPORT("Serialise/Deserialise RsMsgItem");
|
||||||
|
|
|
@ -26,22 +26,29 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include <retroshare/rschannels.h>
|
|
||||||
|
|
||||||
#include "ChannelFeed.h"
|
#include "ChannelFeed.h"
|
||||||
|
|
||||||
#include "gui/feeds/ChanMsgItem.h"
|
#include "feeds/ChanMsgItem.h"
|
||||||
|
|
||||||
#include "gui/channels/CreateChannel.h"
|
#include "channels/CreateChannel.h"
|
||||||
#include "gui/channels/ChannelDetails.h"
|
#include "channels/ChannelDetails.h"
|
||||||
#include "gui/channels/CreateChannelMsg.h"
|
#include "channels/CreateChannelMsg.h"
|
||||||
#include "gui/channels/EditChanDetails.h"
|
#include "channels/EditChanDetails.h"
|
||||||
#include "gui/channels/ShareKey.h"
|
#include "channels/ShareKey.h"
|
||||||
|
#include "notifyqt.h"
|
||||||
|
|
||||||
#include "gui/ChanGroupDelegate.h"
|
#include "ChanGroupDelegate.h"
|
||||||
|
|
||||||
#define CHAN_DEFAULT_IMAGE ":/images/channels.png"
|
#define CHAN_DEFAULT_IMAGE ":/images/channels.png"
|
||||||
|
|
||||||
|
#define COLUMN_NAME 0
|
||||||
|
#define COLUMN_POPULARITY 1
|
||||||
|
#define COLUMN_COUNT 2
|
||||||
|
#define COLUMN_DATA COLUMN_NAME
|
||||||
|
|
||||||
|
#define ROLE_ID Qt::UserRole
|
||||||
|
#define ROLE_CHANNEL_TITLE Qt::UserRole + 1
|
||||||
|
|
||||||
/****
|
/****
|
||||||
* #define CHAN_DEBUG
|
* #define CHAN_DEBUG
|
||||||
***/
|
***/
|
||||||
|
@ -57,18 +64,18 @@ ChannelFeed::ChannelFeed(QWidget *parent)
|
||||||
connect(postButton, SIGNAL(clicked()), this, SLOT(createMsg()));
|
connect(postButton, SIGNAL(clicked()), this, SLOT(createMsg()));
|
||||||
connect(subscribeButton, SIGNAL( clicked( void ) ), this, SLOT( subscribeChannel ( void ) ) );
|
connect(subscribeButton, SIGNAL( clicked( void ) ), this, SLOT( subscribeChannel ( void ) ) );
|
||||||
connect(unsubscribeButton, SIGNAL( clicked( void ) ), this, SLOT( unsubscribeChannel ( void ) ) );
|
connect(unsubscribeButton, SIGNAL( clicked( void ) ), this, SLOT( unsubscribeChannel ( void ) ) );
|
||||||
|
connect(setAllAsReadButton, SIGNAL(clicked()), this, SLOT(setAllAsReadClicked()));
|
||||||
|
|
||||||
|
connect(NotifyQt::getInstance(), SIGNAL(channelMsgReadSatusChanged(QString,QString,int)), this, SLOT(channelMsgReadSatusChanged(QString,QString,int)));
|
||||||
|
|
||||||
/*************** Setup Left Hand Side (List of Channels) ****************/
|
/*************** Setup Left Hand Side (List of Channels) ****************/
|
||||||
|
|
||||||
connect(treeView, SIGNAL(clicked(const QModelIndex &)), this, SLOT(selectChannel(const QModelIndex &)));
|
|
||||||
connect(treeView, SIGNAL(activated(const QModelIndex &)), this, SLOT(toggleSelection(const QModelIndex &)));
|
|
||||||
connect(treeView, SIGNAL(customContextMenuRequested( QPoint ) ), this, SLOT( channelListCustomPopupMenu( QPoint ) ) );
|
connect(treeView, SIGNAL(customContextMenuRequested( QPoint ) ), this, SLOT( channelListCustomPopupMenu( QPoint ) ) );
|
||||||
|
|
||||||
mChannelId = "";
|
mChannelId.clear();
|
||||||
model = new QStandardItemModel(0, 3, this);
|
model = new QStandardItemModel(0, 2, this);
|
||||||
model->setHeaderData(0, Qt::Horizontal, tr("Name"), Qt::DisplayRole);
|
model->setHeaderData(COLUMN_NAME, Qt::Horizontal, tr("Name"), Qt::DisplayRole);
|
||||||
model->setHeaderData(1, Qt::Horizontal, tr("Popularity"), Qt::DisplayRole);
|
model->setHeaderData(COLUMN_POPULARITY, Qt::Horizontal, tr("Popularity"), Qt::DisplayRole);
|
||||||
model->setHeaderData(2, Qt::Horizontal, tr("ID"), Qt::DisplayRole);
|
|
||||||
|
|
||||||
treeView->setModel(model);
|
treeView->setModel(model);
|
||||||
treeView->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
treeView->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||||
|
@ -76,16 +83,15 @@ ChannelFeed::ChannelFeed(QWidget *parent)
|
||||||
treeView->setItemDelegate(new ChanGroupDelegate());
|
treeView->setItemDelegate(new ChanGroupDelegate());
|
||||||
treeView->setRootIsDecorated(true);
|
treeView->setRootIsDecorated(true);
|
||||||
|
|
||||||
|
connect(treeView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), this, SLOT(selectChannel(QModelIndex)));
|
||||||
|
|
||||||
// hide header and id column
|
// hide header and id column
|
||||||
treeView->setHeaderHidden(true);
|
treeView->setHeaderHidden(true);
|
||||||
treeView->hideColumn(2);
|
|
||||||
|
|
||||||
/* Set header resize modes and initial section sizes TreeView*/
|
/* Set header resize modes and initial section sizes TreeView*/
|
||||||
QHeaderView * _header = treeView->header () ;
|
QHeaderView * _header = treeView->header () ;
|
||||||
_header->setResizeMode ( 1, QHeaderView::Custom);
|
_header->setResizeMode ( COLUMN_POPULARITY, QHeaderView::Custom);
|
||||||
_header->resizeSection ( 0, 190 );
|
_header->resizeSection ( COLUMN_NAME, 190 );
|
||||||
_header->resizeSection ( 1, 22 );
|
|
||||||
_header->resizeSection ( 2, 22 );
|
|
||||||
|
|
||||||
// set ChannelList Font
|
// set ChannelList Font
|
||||||
itemFont = QFont("ARIAL", 10);
|
itemFont = QFont("ARIAL", 10);
|
||||||
|
@ -129,64 +135,56 @@ ChannelFeed::ChannelFeed(QWidget *parent)
|
||||||
channelpushButton->setMenu(channelmenu);
|
channelpushButton->setMenu(channelmenu);
|
||||||
|
|
||||||
updateChannelMsgs();
|
updateChannelMsgs();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChannelFeed::channelListCustomPopupMenu( QPoint point )
|
void ChannelFeed::channelListCustomPopupMenu( QPoint point )
|
||||||
{
|
{
|
||||||
ChannelInfo ci;
|
ChannelInfo ci;
|
||||||
if (!rsChannels->getChannelInfo(mChannelId, ci))
|
if (!rsChannels->getChannelInfo(mChannelId, ci)) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QMenu contextMnu( this );
|
QMenu contextMnu(this);
|
||||||
|
|
||||||
postchannelAct = new QAction(QIcon(":/images/mail_reply.png"), tr( "Post to Channel" ), this );
|
QAction *postchannelAct = new QAction(QIcon(":/images/mail_reply.png"), tr( "Post to Channel" ), &contextMnu);
|
||||||
connect( postchannelAct , SIGNAL( triggered() ), this, SLOT( createMsg() ) );
|
connect( postchannelAct , SIGNAL( triggered() ), this, SLOT( createMsg() ) );
|
||||||
|
|
||||||
subscribechannelAct = new QAction(QIcon(":/images/edit_add24.png"), tr( "Subscribe to Channel" ), this );
|
QAction *subscribechannelAct = new QAction(QIcon(":/images/edit_add24.png"), tr( "Subscribe to Channel" ), &contextMnu);
|
||||||
connect( subscribechannelAct , SIGNAL( triggered() ), this, SLOT( subscribeChannel() ) );
|
connect( subscribechannelAct , SIGNAL( triggered() ), this, SLOT( subscribeChannel() ) );
|
||||||
|
|
||||||
unsubscribechannelAct = new QAction(QIcon(":/images/cancel.png"), tr( "Unsubscribe to Channel" ), this );
|
QAction *unsubscribechannelAct = new QAction(QIcon(":/images/cancel.png"), tr( "Unsubscribe to Channel" ), &contextMnu);
|
||||||
connect( unsubscribechannelAct , SIGNAL( triggered() ), this, SLOT( unsubscribeChannel() ) );
|
connect( unsubscribechannelAct , SIGNAL( triggered() ), this, SLOT( unsubscribeChannel() ) );
|
||||||
|
|
||||||
channeldetailsAct = new QAction(QIcon(":/images/info16.png"), tr( "Show Channel Details" ), this );
|
QAction *channeldetailsAct = new QAction(QIcon(":/images/info16.png"), tr( "Show Channel Details" ), &contextMnu);
|
||||||
connect( channeldetailsAct , SIGNAL( triggered() ), this, SLOT( showChannelDetails() ) );
|
connect( channeldetailsAct , SIGNAL( triggered() ), this, SLOT( showChannelDetails() ) );
|
||||||
|
|
||||||
restoreKeysAct = new QAction(QIcon(":/images/settings16.png"), tr("Restore Publish Rights for Channel" ), this );
|
QAction *restoreKeysAct = new QAction(QIcon(":/images/settings16.png"), tr("Restore Publish Rights for Channel" ), &contextMnu);
|
||||||
connect( restoreKeysAct , SIGNAL( triggered() ), this, SLOT( restoreChannelKeys() ) );
|
connect( restoreKeysAct , SIGNAL( triggered() ), this, SLOT( restoreChannelKeys() ) );
|
||||||
|
|
||||||
editChannelDetailAct = new QAction(QIcon(":/images/edit_16.png"), tr("Edit Channel Details"), this);
|
QAction *editChannelDetailAct = new QAction(QIcon(":/images/edit_16.png"), tr("Edit Channel Details"), &contextMnu);
|
||||||
connect( editChannelDetailAct, SIGNAL( triggered() ), this, SLOT( editChannelDetail() ) );
|
connect( editChannelDetailAct, SIGNAL( triggered() ), this, SLOT( editChannelDetail() ) );
|
||||||
|
|
||||||
shareKeyAct = new QAction(QIcon(":/images/gpgp_key_generate.png"), tr("Share Channel"), this);
|
QAction *shareKeyAct = new QAction(QIcon(":/images/gpgp_key_generate.png"), tr("Share Channel"), &contextMnu);
|
||||||
connect( shareKeyAct, SIGNAL( triggered() ), this, SLOT( shareKey() ) );
|
connect( shareKeyAct, SIGNAL( triggered() ), this, SLOT( shareKey() ) );
|
||||||
|
|
||||||
if((ci.channelFlags & RS_DISTRIB_PUBLISH) && (ci.channelFlags & RS_DISTRIB_ADMIN))
|
if ((ci.channelFlags & RS_DISTRIB_PUBLISH) && (ci.channelFlags & RS_DISTRIB_ADMIN)) {
|
||||||
{
|
|
||||||
contextMnu.addAction( postchannelAct );
|
contextMnu.addAction( postchannelAct );
|
||||||
contextMnu.addSeparator();
|
contextMnu.addSeparator();
|
||||||
contextMnu.addAction( editChannelDetailAct);
|
contextMnu.addAction( editChannelDetailAct);
|
||||||
contextMnu.addAction( shareKeyAct );
|
contextMnu.addAction( shareKeyAct );
|
||||||
contextMnu.addAction( channeldetailsAct );
|
contextMnu.addAction( channeldetailsAct );
|
||||||
}
|
}
|
||||||
else if (ci.channelFlags & RS_DISTRIB_PUBLISH)
|
else if (ci.channelFlags & RS_DISTRIB_PUBLISH) {
|
||||||
{
|
|
||||||
contextMnu.addAction( postchannelAct );
|
contextMnu.addAction( postchannelAct );
|
||||||
contextMnu.addSeparator();
|
contextMnu.addSeparator();
|
||||||
contextMnu.addAction( channeldetailsAct );
|
contextMnu.addAction( channeldetailsAct );
|
||||||
contextMnu.addAction( shareKeyAct );
|
contextMnu.addAction( shareKeyAct );
|
||||||
}
|
} else if (ci.channelFlags & RS_DISTRIB_SUBSCRIBED) {
|
||||||
else if (ci.channelFlags & RS_DISTRIB_SUBSCRIBED)
|
|
||||||
{
|
|
||||||
contextMnu.addAction( unsubscribechannelAct );
|
contextMnu.addAction( unsubscribechannelAct );
|
||||||
contextMnu.addSeparator();
|
contextMnu.addSeparator();
|
||||||
contextMnu.addAction( channeldetailsAct );
|
contextMnu.addAction( channeldetailsAct );
|
||||||
contextMnu.addAction( restoreKeysAct );
|
contextMnu.addAction( restoreKeysAct );
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
contextMnu.addAction( subscribechannelAct );
|
contextMnu.addAction( subscribechannelAct );
|
||||||
contextMnu.addSeparator();
|
contextMnu.addSeparator();
|
||||||
contextMnu.addAction( channeldetailsAct );
|
contextMnu.addAction( channeldetailsAct );
|
||||||
|
@ -212,92 +210,82 @@ void ChannelFeed::channelSelection()
|
||||||
updateChannelMsgs();
|
updateChannelMsgs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************************/
|
/*************************************************************************************/
|
||||||
/*************************************************************************************/
|
/*************************************************************************************/
|
||||||
/*************************************************************************************/
|
/*************************************************************************************/
|
||||||
|
|
||||||
void ChannelFeed::deleteFeedItem(QWidget *item, uint32_t type)
|
void ChannelFeed::deleteFeedItem(QWidget *item, uint32_t type)
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChannelFeed::openChat(std::string peerId)
|
void ChannelFeed::openChat(std::string peerId)
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChannelFeed::editChannelDetail(){
|
void ChannelFeed::editChannelDetail(){
|
||||||
|
|
||||||
EditChanDetails editUi(this, 0, mChannelId);
|
EditChanDetails editUi(this, 0, mChannelId);
|
||||||
editUi.exec();
|
editUi.exec();
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChannelFeed::shareKey()
|
void ChannelFeed::shareKey()
|
||||||
{
|
{
|
||||||
ShareKey shareUi(this, 0, mChannelId);
|
ShareKey shareUi(this, 0, mChannelId);
|
||||||
shareUi.exec();
|
shareUi.exec();
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChannelFeed::createMsg()
|
void ChannelFeed::createMsg()
|
||||||
{
|
{
|
||||||
if (mChannelId == "")
|
if (mChannelId.empty()) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CreateChannelMsg *msgDialog = new CreateChannelMsg(mChannelId);
|
CreateChannelMsg *msgDialog = new CreateChannelMsg(mChannelId);
|
||||||
|
|
||||||
msgDialog->show();
|
msgDialog->show();
|
||||||
|
|
||||||
/* window will destroy itself! */
|
/* window will destroy itself! */
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChannelFeed::selectChannel( std::string cId)
|
void ChannelFeed::restoreChannelKeys()
|
||||||
{
|
{
|
||||||
mChannelId = cId;
|
|
||||||
|
|
||||||
updateChannelMsgs();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ChannelFeed::restoreChannelKeys(){
|
|
||||||
|
|
||||||
rsChannels->channelRestoreKeys(mChannelId);
|
rsChannels->channelRestoreKeys(mChannelId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChannelFeed::selectChannel(const QModelIndex &index)
|
void ChannelFeed::selectChannel(QModelIndex index)
|
||||||
{
|
{
|
||||||
int row = index.row();
|
QStandardItem *itemData = NULL;
|
||||||
int col = index.column();
|
|
||||||
if (col != 2) {
|
if (index.isValid()) {
|
||||||
QModelIndex sibling = index.sibling(row, 2);
|
QStandardItem *item = model->itemFromIndex(index);
|
||||||
if (sibling.isValid())
|
if (item && item->parent() != NULL) {
|
||||||
mChannelId = sibling.data().toString().toStdString();
|
itemData = item->parent()->child(item->row(), COLUMN_DATA);
|
||||||
} else
|
}
|
||||||
mChannelId = index.data().toString().toStdString();
|
}
|
||||||
|
|
||||||
|
if (itemData) {
|
||||||
|
mChannelId = itemData->data(ROLE_ID).toString().toStdString();
|
||||||
|
} else {
|
||||||
|
mChannelId.clear();
|
||||||
|
}
|
||||||
|
|
||||||
updateChannelMsgs();
|
updateChannelMsgs();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChannelFeed::updateDisplay()
|
void ChannelFeed::updateDisplay()
|
||||||
{
|
{
|
||||||
|
if (!rsChannels) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
std::list<std::string> chanIds;
|
std::list<std::string> chanIds;
|
||||||
std::list<std::string>::iterator it;
|
std::list<std::string>::iterator it;
|
||||||
if (!rsChannels)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (rsChannels->channelsChanged(chanIds))
|
if (rsChannels->channelsChanged(chanIds)) {
|
||||||
{
|
/* update channel list */
|
||||||
/* update Forums List */
|
|
||||||
updateChannelList();
|
updateChannelList();
|
||||||
|
|
||||||
it = std::find(chanIds.begin(), chanIds.end(), mChannelId);
|
it = std::find(chanIds.begin(), chanIds.end(), mChannelId);
|
||||||
if (it != chanIds.end())
|
if (it != chanIds.end()) {
|
||||||
{
|
|
||||||
updateChannelMsgs();
|
updateChannelMsgs();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -305,370 +293,211 @@ void ChannelFeed::updateDisplay()
|
||||||
|
|
||||||
void ChannelFeed::updateChannelList()
|
void ChannelFeed::updateChannelList()
|
||||||
{
|
{
|
||||||
|
if (!rsChannels) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
std::list<ChannelInfo> channelList;
|
std::list<ChannelInfo> channelList;
|
||||||
std::list<ChannelInfo>::iterator it;
|
std::list<ChannelInfo>::iterator it;
|
||||||
if (!rsChannels)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
rsChannels->getChannelList(channelList);
|
rsChannels->getChannelList(channelList);
|
||||||
|
|
||||||
/* get the ids for our lists */
|
/* get the ids for our lists */
|
||||||
std::list<std::string> adminIds;
|
std::list<ChannelInfo> adminList;
|
||||||
std::list<std::string> subIds;
|
std::list<ChannelInfo> subList;
|
||||||
std::list<std::string> popIds;
|
std::list<ChannelInfo> popList;
|
||||||
std::list<std::string> otherIds;
|
std::list<ChannelInfo> otherList;
|
||||||
std::multimap<uint32_t, std::string> popMap;
|
std::multimap<uint32_t, ChannelInfo> popMap;
|
||||||
|
|
||||||
for(it = channelList.begin(); it != channelList.end(); it++)
|
for(it = channelList.begin(); it != channelList.end(); it++) {
|
||||||
{
|
|
||||||
/* sort it into Publish (Own), Subscribed, Popular and Other */
|
/* sort it into Publish (Own), Subscribed, Popular and Other */
|
||||||
uint32_t flags = it->channelFlags;
|
uint32_t flags = it->channelFlags;
|
||||||
|
|
||||||
if (flags & RS_DISTRIB_ADMIN)
|
if (flags & RS_DISTRIB_ADMIN) {
|
||||||
{
|
adminList.push_back(*it);
|
||||||
adminIds.push_back(it->channelId);
|
} else if (flags & RS_DISTRIB_SUBSCRIBED) {
|
||||||
}
|
subList.push_back(*it);
|
||||||
else if (flags & RS_DISTRIB_SUBSCRIBED)
|
} else {
|
||||||
{
|
|
||||||
subIds.push_back(it->channelId);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* rate the others by popularity */
|
/* rate the others by popularity */
|
||||||
popMap.insert(std::make_pair(it->pop, it->channelId));
|
popMap.insert(std::make_pair(it->pop, *it));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* iterate backwards through popMap - take the top 5 or 10% of list */
|
/* iterate backwards through popMap - take the top 5 or 10% of list */
|
||||||
uint32_t popCount = 5;
|
uint32_t popCount = 5;
|
||||||
if (popCount < popMap.size() / 10)
|
if (popCount < popMap.size() / 10) {
|
||||||
{
|
|
||||||
popCount = popMap.size() / 10;
|
popCount = popMap.size() / 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t i = 0;
|
uint32_t i = 0;
|
||||||
std::multimap<uint32_t, std::string>::reverse_iterator rit;
|
std::multimap<uint32_t, ChannelInfo>::reverse_iterator rit;
|
||||||
for(rit = popMap.rbegin(); rit != popMap.rend(); rit++)
|
for (rit = popMap.rbegin(); rit != popMap.rend(); rit++) {
|
||||||
{
|
if (i < popCount) {
|
||||||
if(i < popCount){
|
popList.push_back(rit->second);
|
||||||
popIds.push_back(rit->second);
|
|
||||||
i++;
|
i++;
|
||||||
}else{
|
} else {
|
||||||
otherIds.push_back(rit->second);
|
otherList.push_back(rit->second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* now we have our lists ---> update entries */
|
/* now we have our lists ---> update entries */
|
||||||
|
|
||||||
updateChannelListOwn(adminIds);
|
fillChannelList(OWN, adminList);
|
||||||
updateChannelListSub(subIds);
|
fillChannelList(SUBSCRIBED, subList);
|
||||||
updateChannelListPop(popIds);
|
fillChannelList(POPULAR, popList);
|
||||||
updateChannelListOther(otherIds);
|
fillChannelList(OTHER, otherList);
|
||||||
|
|
||||||
|
updateMessageSummaryList("");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChannelFeed::updateChannelListOwn(std::list<std::string> &ids)
|
void ChannelFeed::fillChannelList(int channelItem, std::list<ChannelInfo> &channelInfos)
|
||||||
{
|
{
|
||||||
std::list<std::string>::iterator iit;
|
std::list<ChannelInfo>::iterator iit;
|
||||||
|
|
||||||
/* remove rows with groups before adding new ones */
|
/* remove rows with groups before adding new ones */
|
||||||
model->item(OWN)->removeRows(0, model->item(OWN)->rowCount());
|
QStandardItem *groupItem = model->item(channelItem);
|
||||||
|
if (groupItem == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (iit = ids.begin(); iit != ids.end(); iit ++) {
|
/* iterate all channels */
|
||||||
|
for (iit = channelInfos.begin(); iit != channelInfos.end(); iit++) {
|
||||||
#ifdef CHAN_DEBUG
|
#ifdef CHAN_DEBUG
|
||||||
std::cerr << "ChannelFeed::updateChannelListOwn(): " << *iit << std::endl;
|
std::cerr << "ChannelFeed::fillChannelList(): " << channelItem << " - " << iit->channelId << std::endl;
|
||||||
#endif
|
#endif
|
||||||
QStandardItem *ownGroup = model->item(OWN);
|
|
||||||
QList<QStandardItem *> channel;
|
ChannelInfo &ci = *iit;
|
||||||
|
QString channelId = QString::fromStdString(ci.channelId);
|
||||||
|
|
||||||
|
/* search exisiting channel item */
|
||||||
|
int row;
|
||||||
|
int rowCount = groupItem->rowCount();
|
||||||
|
for (row = 0; row < rowCount; row++) {
|
||||||
|
if (groupItem->child(row, COLUMN_DATA)->data(ROLE_ID).toString() == channelId) {
|
||||||
|
/* found channel */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QStandardItem *chNameItem = new QStandardItem();
|
QStandardItem *chNameItem = new QStandardItem();
|
||||||
QStandardItem *chPopItem = new QStandardItem();
|
QStandardItem *chPopItem = new QStandardItem();
|
||||||
QStandardItem *chIdItem = new QStandardItem();
|
if (row < rowCount) {
|
||||||
chNameItem->setSizeHint( QSize( 22,22 ) );
|
chNameItem = groupItem->child(row, COLUMN_NAME);
|
||||||
|
chPopItem = groupItem->child(row, COLUMN_POPULARITY);
|
||||||
|
} else {
|
||||||
|
QList<QStandardItem*> channel;
|
||||||
|
chNameItem = new QStandardItem();
|
||||||
|
chPopItem = new QStandardItem();
|
||||||
|
|
||||||
ChannelInfo ci;
|
chNameItem->setSizeHint(QSize(22, 22));
|
||||||
if (rsChannels && rsChannels->getChannelInfo(*iit, ci)) {
|
|
||||||
chNameItem->setData(QVariant(QString::fromStdWString(ci.channelName)), Qt::DisplayRole);
|
channel.append(chNameItem);
|
||||||
//chPopItem->setData(QVariant(QString::number(ci.pop)), Qt::DisplayRole);
|
channel.append(chPopItem);
|
||||||
chIdItem->setData(QVariant(QString::fromStdString(ci.channelId)), Qt::DisplayRole);
|
groupItem->appendRow(channel);
|
||||||
|
|
||||||
|
groupItem->child(chNameItem->index().row(), COLUMN_DATA)->setData(channelId, ROLE_ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
chNameItem->setText(QString::fromStdWString(ci.channelName));
|
||||||
|
groupItem->child(chNameItem->index().row(), COLUMN_DATA)->setData(QString::fromStdWString(ci.channelName), ROLE_CHANNEL_TITLE);
|
||||||
chNameItem->setToolTip(tr("Popularity: %1\nFetches: %2\nAvailable: %3").arg(QString::number(ci.pop)).arg(9999).arg(9999));
|
chNameItem->setToolTip(tr("Popularity: %1\nFetches: %2\nAvailable: %3").arg(QString::number(ci.pop)).arg(9999).arg(9999));
|
||||||
|
|
||||||
if(ci.pngImageLen != 0){
|
|
||||||
|
|
||||||
QPixmap chanImage;
|
QPixmap chanImage;
|
||||||
|
if (ci.pngImageLen != 0) {
|
||||||
chanImage.loadFromData(ci.pngChanImage, ci.pngImageLen, "PNG");
|
chanImage.loadFromData(ci.pngChanImage, ci.pngImageLen, "PNG");
|
||||||
chNameItem->setData(QIcon(chanImage), Qt::DecorationRole);
|
|
||||||
}else{
|
|
||||||
QPixmap defaulImage(CHAN_DEFAULT_IMAGE);
|
|
||||||
chNameItem->setData(QIcon(defaulImage), Qt::DecorationRole);
|
|
||||||
}
|
|
||||||
|
|
||||||
int popcount = ci.pop;
|
|
||||||
/* set Popularity icon */
|
|
||||||
if (popcount == 0)
|
|
||||||
{
|
|
||||||
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_0.png")), Qt::DecorationRole);
|
|
||||||
}
|
|
||||||
else if (popcount < 2)
|
|
||||||
{
|
|
||||||
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_1.png")), Qt::DecorationRole);
|
|
||||||
}
|
|
||||||
else if (popcount < 4)
|
|
||||||
{
|
|
||||||
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_2.png")), Qt::DecorationRole);
|
|
||||||
}
|
|
||||||
else if (popcount < 8)
|
|
||||||
{
|
|
||||||
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_3.png")), Qt::DecorationRole);
|
|
||||||
}
|
|
||||||
else if (popcount < 16) {
|
|
||||||
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_4.png")), Qt::DecorationRole);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_5.png")), Qt::DecorationRole);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
chNameItem->setData(QVariant(QString(tr("Unknown Channel"))), Qt::DisplayRole);
|
chanImage = QPixmap(CHAN_DEFAULT_IMAGE);
|
||||||
chPopItem->setData(QVariant(QString::fromStdString(*iit)), Qt::DisplayRole);
|
}
|
||||||
chNameItem->setToolTip(tr("Unknown Channel\nNo Description"));
|
chNameItem->setIcon(QIcon(chanImage));
|
||||||
|
|
||||||
|
/* set Popularity icon */
|
||||||
|
int popcount = ci.pop;
|
||||||
|
if (popcount == 0) {
|
||||||
|
chPopItem->setIcon(QIcon(":/images/hot_0.png"));
|
||||||
|
} else if (popcount < 2) {
|
||||||
|
chPopItem->setIcon(QIcon(":/images/hot_1.png"));
|
||||||
|
} else if (popcount < 4) {
|
||||||
|
chPopItem->setIcon(QIcon(":/images/hot_2.png"));
|
||||||
|
} else if (popcount < 8) {
|
||||||
|
chPopItem->setIcon(QIcon(":/images/hot_3.png"));
|
||||||
|
} else if (popcount < 16) {
|
||||||
|
chPopItem->setIcon(QIcon(":/images/hot_4.png"));
|
||||||
|
} else {
|
||||||
|
chPopItem->setIcon(QIcon(":/images/hot_5.png"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
channel.append(chNameItem);
|
/* remove all items not in list */
|
||||||
channel.append(chPopItem);
|
int row = 0;
|
||||||
channel.append(chIdItem);
|
int rowCount = groupItem->rowCount();
|
||||||
ownGroup->appendRow(channel);
|
while (row < rowCount) {
|
||||||
|
std::string channelId = groupItem->child(row, COLUMN_DATA)->data(ROLE_ID).toString().toStdString();
|
||||||
|
|
||||||
|
for (iit = channelInfos.begin(); iit != channelInfos.end(); iit++) {
|
||||||
|
if (iit->channelId == channelId) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (iit == channelInfos.end()) {
|
||||||
|
groupItem->removeRow(row);
|
||||||
|
rowCount = groupItem->rowCount();
|
||||||
|
} else {
|
||||||
|
row++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChannelFeed::updateChannelListSub(std::list<std::string> &ids)
|
void ChannelFeed::channelMsgReadSatusChanged(const QString& channelId, const QString& msgId, int status)
|
||||||
{
|
{
|
||||||
std::list<std::string>::iterator iit;
|
updateMessageSummaryList(channelId.toStdString());
|
||||||
|
|
||||||
/* remove rows with groups before adding new ones */
|
|
||||||
model->item(SUBSCRIBED)->removeRows(0, model->item(SUBSCRIBED)->rowCount());
|
|
||||||
|
|
||||||
for (iit = ids.begin(); iit != ids.end(); iit ++) {
|
|
||||||
#ifdef CHAN_DEBUG
|
|
||||||
std::cerr << "ChannelFeed::updateChannelListSub(): " << *iit << std::endl;
|
|
||||||
#endif
|
|
||||||
QStandardItem *ownGroup = model->item(SUBSCRIBED);
|
|
||||||
QList<QStandardItem *> channel;
|
|
||||||
QStandardItem *chNameItem = new QStandardItem();
|
|
||||||
QStandardItem *chPopItem = new QStandardItem();
|
|
||||||
QStandardItem *chIdItem = new QStandardItem();
|
|
||||||
chNameItem->setSizeHint( QSize( 22,22 ) );
|
|
||||||
|
|
||||||
ChannelInfo ci;
|
|
||||||
if (rsChannels && rsChannels->getChannelInfo(*iit, ci)) {
|
|
||||||
chNameItem->setData(QVariant(QString::fromStdWString(ci.channelName)), Qt::DisplayRole);
|
|
||||||
chIdItem->setData(QVariant(QString::fromStdString(ci.channelId)), Qt::DisplayRole);
|
|
||||||
chNameItem->setToolTip(tr("Popularity: %1\nFetches: %2\nAvailable: %3").arg(QString::number(ci.pop)).arg(9999).arg(9999));
|
|
||||||
|
|
||||||
if(ci.pngImageLen != 0){
|
|
||||||
|
|
||||||
QPixmap chanImage;
|
|
||||||
chanImage.loadFromData(ci.pngChanImage, ci.pngImageLen, "PNG");
|
|
||||||
chNameItem->setData(QIcon(chanImage), Qt::DecorationRole);
|
|
||||||
}else{
|
|
||||||
QPixmap defaulImage(CHAN_DEFAULT_IMAGE);
|
|
||||||
chNameItem->setData(QIcon(defaulImage), Qt::DecorationRole);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* set Popularity icon */
|
|
||||||
int popcount = ci.pop;
|
|
||||||
|
|
||||||
if (popcount == 0)
|
|
||||||
{
|
|
||||||
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_0.png")), Qt::DecorationRole);
|
|
||||||
}
|
|
||||||
else if (popcount < 2)
|
|
||||||
{
|
|
||||||
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_1.png")), Qt::DecorationRole);
|
|
||||||
}
|
|
||||||
else if (popcount < 4)
|
|
||||||
{
|
|
||||||
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_2.png")), Qt::DecorationRole);
|
|
||||||
}
|
|
||||||
else if (popcount < 8)
|
|
||||||
{
|
|
||||||
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_3.png")), Qt::DecorationRole);
|
|
||||||
}
|
|
||||||
else if (popcount < 16)
|
|
||||||
{
|
|
||||||
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_4.png")), Qt::DecorationRole);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_5.png")), Qt::DecorationRole);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
|
||||||
chNameItem->setData(QVariant(QString(tr("Unknown Channel"))), Qt::DisplayRole);
|
|
||||||
chPopItem->setData(QVariant(QString::fromStdString(*iit)), Qt::DisplayRole);
|
|
||||||
chNameItem->setToolTip(tr("Unknown Channel\nNo Description"));
|
|
||||||
}
|
|
||||||
|
|
||||||
channel.append(chNameItem);
|
|
||||||
channel.append(chPopItem);
|
|
||||||
channel.append(chIdItem);
|
|
||||||
ownGroup->appendRow(channel);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChannelFeed::updateChannelListPop(std::list<std::string> &ids)
|
void ChannelFeed::updateMessageSummaryList(const std::string &channelId)
|
||||||
{
|
{
|
||||||
std::list<std::string>::iterator iit;
|
int channelItems[2] = { OWN, SUBSCRIBED };
|
||||||
|
|
||||||
/* remove rows with groups before adding new ones */
|
for (int channelItem = 0; channelItem < 2; channelItem++) {
|
||||||
model->item(POPULAR)->removeRows(0, model->item(POPULAR)->rowCount());
|
QStandardItem *groupItem = model->item(channelItem);
|
||||||
|
if (groupItem == NULL) {
|
||||||
for (iit = ids.begin(); iit != ids.end(); iit ++) {
|
continue;
|
||||||
#ifdef CHAN_DEBUG
|
|
||||||
std::cerr << "ChannelFeed::updateChannelListPop(): " << *iit << std::endl;
|
|
||||||
#endif
|
|
||||||
QStandardItem *ownGroup = model->item(POPULAR);
|
|
||||||
QList<QStandardItem *> channel;
|
|
||||||
QStandardItem *chNameItem = new QStandardItem();
|
|
||||||
QStandardItem *chPopItem = new QStandardItem();
|
|
||||||
QStandardItem *chIdItem = new QStandardItem();
|
|
||||||
chNameItem->setSizeHint( QSize( 22,22 ) );
|
|
||||||
|
|
||||||
ChannelInfo ci;
|
|
||||||
if (rsChannels && rsChannels->getChannelInfo(*iit, ci)) {
|
|
||||||
chNameItem->setData(QVariant(QString::fromStdWString(ci.channelName)), Qt::DisplayRole);
|
|
||||||
chIdItem->setData(QVariant(QString::fromStdString(ci.channelId)), Qt::DisplayRole);
|
|
||||||
chNameItem->setToolTip(tr("Popularity: %1\nFetches: %2\nAvailable: %3").arg(QString::number(ci.pop)).arg(9999).arg(9999));
|
|
||||||
|
|
||||||
if(ci.pngImageLen != 0){
|
|
||||||
|
|
||||||
QPixmap chanImage;
|
|
||||||
chanImage.loadFromData(ci.pngChanImage, ci.pngImageLen, "PNG");
|
|
||||||
chNameItem->setData(QIcon(chanImage), Qt::DecorationRole);
|
|
||||||
}else{
|
|
||||||
QPixmap defaulImage(CHAN_DEFAULT_IMAGE);
|
|
||||||
chNameItem->setData(QIcon(defaulImage), Qt::DecorationRole);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set Popularity icon */
|
int row;
|
||||||
int popcount = ci.pop;
|
int rowCount = groupItem->rowCount();
|
||||||
|
for (row = 0; row < rowCount; row++) {
|
||||||
if (popcount == 0)
|
std::string rowChannelId = groupItem->child(row, COLUMN_DATA)->data(ROLE_ID).toString().toStdString();
|
||||||
{
|
if (rowChannelId.empty()) {
|
||||||
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_0.png")), Qt::DecorationRole);
|
continue;
|
||||||
}
|
|
||||||
else if (popcount < 2)
|
|
||||||
{
|
|
||||||
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_1.png")), Qt::DecorationRole);
|
|
||||||
}
|
|
||||||
else if (popcount < 4)
|
|
||||||
{
|
|
||||||
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_2.png")), Qt::DecorationRole);
|
|
||||||
}
|
|
||||||
else if (popcount < 8)
|
|
||||||
{
|
|
||||||
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_3.png")), Qt::DecorationRole);
|
|
||||||
}
|
|
||||||
else if (popcount < 16) {
|
|
||||||
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_4.png")), Qt::DecorationRole);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_5.png")), Qt::DecorationRole);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (channelId.empty() || rowChannelId == channelId) {
|
||||||
|
/* calculate unread messages */
|
||||||
|
unsigned int newMessageCount = 0;
|
||||||
|
unsigned int unreadMessageCount = 0;
|
||||||
|
rsChannels->getMessageCount(rowChannelId, newMessageCount, unreadMessageCount);
|
||||||
|
|
||||||
|
QStandardItem *item = groupItem->child(row, COLUMN_NAME);
|
||||||
|
|
||||||
|
QString title = item->data(ROLE_CHANNEL_TITLE).toString();
|
||||||
|
QFont font = item->font();
|
||||||
|
|
||||||
|
if (unreadMessageCount) {
|
||||||
|
title += " (" + QString::number(unreadMessageCount) + ")";
|
||||||
|
font.setBold(true);
|
||||||
} else {
|
} else {
|
||||||
chNameItem->setData(QVariant(QString(tr("Unknown Channel"))), Qt::DisplayRole);
|
font.setBold(false);
|
||||||
chPopItem->setData(QVariant(QString::fromStdString(*iit)), Qt::DisplayRole);
|
|
||||||
chNameItem->setToolTip(tr("Unknown Channel\nNo Description"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
channel.append(chNameItem);
|
item->setText(title);
|
||||||
channel.append(chPopItem);
|
item->setFont(font);
|
||||||
channel.append(chIdItem);
|
|
||||||
ownGroup->appendRow(channel);
|
if (channelId.empty() == false) {
|
||||||
|
/* calculate only this channel */
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void ChannelFeed::updateChannelListOther(std::list<std::string> &ids)
|
|
||||||
{
|
|
||||||
std::list<std::string>::iterator iit;
|
|
||||||
|
|
||||||
/* remove rows with groups before adding new ones */
|
|
||||||
model->item(OTHER)->removeRows(0, model->item(OTHER)->rowCount());
|
|
||||||
|
|
||||||
for (iit = ids.begin(); iit != ids.end(); iit ++) {
|
|
||||||
#ifdef CHAN_DEBUG
|
|
||||||
std::cerr << "ChannelFeed::updateChannelListOther(): " << *iit << std::endl;
|
|
||||||
#endif
|
|
||||||
QStandardItem *ownGroup = model->item(OTHER);
|
|
||||||
QList<QStandardItem *> channel;
|
|
||||||
QStandardItem *chNameItem = new QStandardItem();
|
|
||||||
QStandardItem *chPopItem = new QStandardItem();
|
|
||||||
QStandardItem *chIdItem = new QStandardItem();
|
|
||||||
chNameItem->setSizeHint( QSize( 22,22 ) );
|
|
||||||
|
|
||||||
ChannelInfo ci;
|
|
||||||
if (rsChannels && rsChannels->getChannelInfo(*iit, ci)) {
|
|
||||||
chNameItem->setData(QVariant(QString::fromStdWString(ci.channelName)), Qt::DisplayRole);
|
|
||||||
chIdItem->setData(QVariant(QString::fromStdString(ci.channelId)), Qt::DisplayRole);
|
|
||||||
chNameItem->setToolTip(tr("Popularity: %1\nFetches: %2\nAvailable: %3"
|
|
||||||
).arg(QString::number(ci.pop)).arg(9999).arg(9999));
|
|
||||||
|
|
||||||
if(ci.pngImageLen != 0){
|
|
||||||
|
|
||||||
QPixmap chanImage;
|
|
||||||
chanImage.loadFromData(ci.pngChanImage, ci.pngImageLen, "PNG");
|
|
||||||
chNameItem->setData(QIcon(chanImage), Qt::DecorationRole);
|
|
||||||
}else{
|
|
||||||
QPixmap defaulImage(CHAN_DEFAULT_IMAGE);
|
|
||||||
chNameItem->setData(QIcon(defaulImage), Qt::DecorationRole);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set Popularity icon */
|
|
||||||
int popcount = ci.pop;
|
|
||||||
|
|
||||||
if (popcount == 0)
|
|
||||||
{
|
|
||||||
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_0.png")), Qt::DecorationRole);
|
|
||||||
}
|
}
|
||||||
else if (popcount < 2)
|
|
||||||
{
|
|
||||||
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_1.png")), Qt::DecorationRole);
|
|
||||||
}
|
|
||||||
else if (popcount < 4)
|
|
||||||
{
|
|
||||||
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_2.png")), Qt::DecorationRole);
|
|
||||||
}
|
|
||||||
else if (popcount < 8)
|
|
||||||
{
|
|
||||||
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_3.png")), Qt::DecorationRole);
|
|
||||||
}
|
|
||||||
else if (popcount < 16) {
|
|
||||||
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_4.png")), Qt::DecorationRole);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
chPopItem->setData(QIcon(QString::fromUtf8(":/images/hot_5.png")), Qt::DecorationRole);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
|
||||||
chNameItem->setData(QVariant(QString(tr("Unknown Channel"))), Qt::DisplayRole);
|
|
||||||
chPopItem->setData(QVariant(QString::fromStdString(*iit)), Qt::DisplayRole);
|
|
||||||
chNameItem->setToolTip(tr("Unknown Channel\nNo Description"));
|
|
||||||
}
|
|
||||||
|
|
||||||
channel.append(chNameItem);
|
|
||||||
channel.append(chPopItem);
|
|
||||||
channel.append(chIdItem);
|
|
||||||
ownGroup->appendRow(channel);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -679,28 +508,28 @@ static bool sortChannelMsgSummary(const ChannelMsgSummary &msg1, const ChannelMs
|
||||||
|
|
||||||
void ChannelFeed::updateChannelMsgs()
|
void ChannelFeed::updateChannelMsgs()
|
||||||
{
|
{
|
||||||
if (!rsChannels)
|
if (!rsChannels) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ChannelInfo ci;
|
ChannelInfo ci;
|
||||||
if (!rsChannels->getChannelInfo(mChannelId, ci))
|
if (!rsChannels->getChannelInfo(mChannelId, ci)) {
|
||||||
{
|
|
||||||
postButton->setEnabled(false);
|
postButton->setEnabled(false);
|
||||||
subscribeButton->setEnabled(false);
|
subscribeButton->setEnabled(false);
|
||||||
unsubscribeButton->setEnabled(false);
|
unsubscribeButton->setEnabled(false);
|
||||||
|
setAllAsReadButton->setEnabled(false);
|
||||||
nameLabel->setText(tr("No Channel Selected"));
|
nameLabel->setText(tr("No Channel Selected"));
|
||||||
iconLabel->setPixmap(QPixmap(":/images/channels.png"));
|
iconLabel->setPixmap(QPixmap(":/images/channels.png"));
|
||||||
iconLabel->setEnabled(false);
|
iconLabel->setEnabled(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ci.pngImageLen != 0){
|
if (ci.pngImageLen != 0) {
|
||||||
|
|
||||||
QPixmap chanImage;
|
QPixmap chanImage;
|
||||||
chanImage.loadFromData(ci.pngChanImage, ci.pngImageLen, "PNG");
|
chanImage.loadFromData(ci.pngChanImage, ci.pngImageLen, "PNG");
|
||||||
iconLabel->setPixmap(chanImage);
|
iconLabel->setPixmap(chanImage);
|
||||||
iconLabel->setStyleSheet("QLabel{border: 3px solid white;}");
|
iconLabel->setStyleSheet("QLabel{border: 3px solid white;}");
|
||||||
}else{
|
} else {
|
||||||
QPixmap defaulImage(CHAN_DEFAULT_IMAGE);
|
QPixmap defaulImage(CHAN_DEFAULT_IMAGE);
|
||||||
iconLabel->setPixmap(defaulImage);
|
iconLabel->setPixmap(defaulImage);
|
||||||
iconLabel->setStyleSheet("QLabel{border: 2px solid white;border-radius: 10px;}");
|
iconLabel->setStyleSheet("QLabel{border: 2px solid white;border-radius: 10px;}");
|
||||||
|
@ -716,30 +545,25 @@ void ChannelFeed::updateChannelMsgs()
|
||||||
nameLabel->setText(channelStr.arg(cname));
|
nameLabel->setText(channelStr.arg(cname));
|
||||||
|
|
||||||
/* do buttons */
|
/* do buttons */
|
||||||
if (ci.channelFlags & RS_DISTRIB_SUBSCRIBED)
|
if (ci.channelFlags & RS_DISTRIB_SUBSCRIBED) {
|
||||||
{
|
|
||||||
subscribeButton->setEnabled(false);
|
subscribeButton->setEnabled(false);
|
||||||
unsubscribeButton->setEnabled(true);
|
unsubscribeButton->setEnabled(true);
|
||||||
}
|
setAllAsReadButton->setEnabled(true);
|
||||||
else
|
} else {
|
||||||
{
|
|
||||||
subscribeButton->setEnabled(true);
|
subscribeButton->setEnabled(true);
|
||||||
unsubscribeButton->setEnabled(false);
|
unsubscribeButton->setEnabled(false);
|
||||||
|
setAllAsReadButton->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ci.channelFlags & RS_DISTRIB_PUBLISH)
|
if (ci.channelFlags & RS_DISTRIB_PUBLISH) {
|
||||||
{
|
|
||||||
postButton->setEnabled(true);
|
postButton->setEnabled(true);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
postButton->setEnabled(false);
|
postButton->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* replace all the messages with new ones */
|
/* replace all the messages with new ones */
|
||||||
std::list<ChanMsgItem *>::iterator mit;
|
std::list<ChanMsgItem *>::iterator mit;
|
||||||
for(mit = mChanMsgItems.begin(); mit != mChanMsgItems.end(); mit++)
|
for (mit = mChanMsgItems.begin(); mit != mChanMsgItems.end(); mit++) {
|
||||||
{
|
|
||||||
delete (*mit);
|
delete (*mit);
|
||||||
}
|
}
|
||||||
mChanMsgItems.clear();
|
mChanMsgItems.clear();
|
||||||
|
@ -751,8 +575,7 @@ void ChannelFeed::updateChannelMsgs()
|
||||||
|
|
||||||
msgs.sort(sortChannelMsgSummary);
|
msgs.sort(sortChannelMsgSummary);
|
||||||
|
|
||||||
for(it = msgs.begin(); it != msgs.end(); it++)
|
for(it = msgs.begin(); it != msgs.end(); it++) {
|
||||||
{
|
|
||||||
ChanMsgItem *cmi = new ChanMsgItem(this, 0, mChannelId, it->msgId, true);
|
ChanMsgItem *cmi = new ChanMsgItem(this, 0, mChannelId, it->msgId, true);
|
||||||
|
|
||||||
mChanMsgItems.push_back(cmi);
|
mChanMsgItems.push_back(cmi);
|
||||||
|
@ -760,17 +583,17 @@ void ChannelFeed::updateChannelMsgs()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ChannelFeed::unsubscribeChannel()
|
void ChannelFeed::unsubscribeChannel()
|
||||||
{
|
{
|
||||||
#ifdef CHAN_DEBUG
|
#ifdef CHAN_DEBUG
|
||||||
std::cerr << "ChannelFeed::unsubscribeChannel()";
|
std::cerr << "ChannelFeed::unsubscribeChannel()";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
if (rsChannels)
|
|
||||||
{
|
if (rsChannels) {
|
||||||
rsChannels->channelSubscribe(mChannelId, false);
|
rsChannels->channelSubscribe(mChannelId, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateChannelMsgs();
|
updateChannelMsgs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -781,33 +604,53 @@ void ChannelFeed::subscribeChannel()
|
||||||
std::cerr << "ChannelFeed::subscribeChannel()";
|
std::cerr << "ChannelFeed::subscribeChannel()";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
if (rsChannels)
|
|
||||||
{
|
if (rsChannels) {
|
||||||
rsChannels->channelSubscribe(mChannelId, true);
|
rsChannels->channelSubscribe(mChannelId, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateChannelMsgs();
|
updateChannelMsgs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ChannelFeed::toggleSelection(const QModelIndex &index)
|
|
||||||
{
|
|
||||||
QItemSelectionModel *selectionModel = treeView->selectionModel();
|
|
||||||
if (index.child(0, 0).isValid())
|
|
||||||
selectionModel->select(index, QItemSelectionModel::Toggle);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ChannelFeed::showChannelDetails()
|
void ChannelFeed::showChannelDetails()
|
||||||
{
|
{
|
||||||
if (mChannelId == "")
|
if (mChannelId.empty()) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!rsChannels)
|
if (!rsChannels) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ChannelDetails channelui (this);
|
ChannelDetails channelui (this);
|
||||||
|
|
||||||
channelui.showDetails(mChannelId);
|
channelui.showDetails(mChannelId);
|
||||||
channelui.exec();
|
channelui.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ChannelFeed::setAllAsReadClicked()
|
||||||
|
{
|
||||||
|
if (mChannelId.empty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!rsChannels) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ChannelInfo ci;
|
||||||
|
if (rsChannels->getChannelInfo(mChannelId, ci) == false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ci.channelFlags & RS_DISTRIB_SUBSCRIBED) {
|
||||||
|
std::list<ChannelMsgSummary> msgs;
|
||||||
|
std::list<ChannelMsgSummary>::iterator it;
|
||||||
|
|
||||||
|
rsChannels->getChannelMsgList(mChannelId, msgs);
|
||||||
|
|
||||||
|
for(it = msgs.begin(); it != msgs.end(); it++) {
|
||||||
|
rsChannels->setMessageStatus(mChannelId, it->msgId, CHANNEL_MSG_STATUS_READ, CHANNEL_MSG_STATUS_READ | CHANNEL_MSG_STATUS_UNREAD_BY_USER);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
#ifndef _CHANNEL_FEED_DIALOG_H
|
#ifndef _CHANNEL_FEED_DIALOG_H
|
||||||
#define _CHANNEL_FEED_DIALOG_H
|
#define _CHANNEL_FEED_DIALOG_H
|
||||||
|
|
||||||
|
#include <retroshare/rschannels.h>
|
||||||
|
|
||||||
#include "mainpage.h"
|
#include "mainpage.h"
|
||||||
#include "RsAutoUpdatePage.h"
|
#include "RsAutoUpdatePage.h"
|
||||||
|
|
||||||
|
@ -36,6 +38,7 @@
|
||||||
|
|
||||||
class ChanMsgItem;
|
class ChanMsgItem;
|
||||||
class QStandardItemModel;
|
class QStandardItemModel;
|
||||||
|
class QStandardItem;
|
||||||
|
|
||||||
class ChannelFeed : public RsAutoUpdatePage, public FeedHolder, private Ui::ChannelFeed
|
class ChannelFeed : public RsAutoUpdatePage, public FeedHolder, private Ui::ChannelFeed
|
||||||
{
|
{
|
||||||
|
@ -54,13 +57,9 @@ public:
|
||||||
virtual void updateDisplay();
|
virtual void updateDisplay();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
void selectChannel(QModelIndex index);
|
||||||
void selectChannel( std::string );
|
|
||||||
void selectChannel(const QModelIndex &);
|
|
||||||
void toggleSelection(const QModelIndex &);
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void channelListCustomPopupMenu( QPoint point );
|
void channelListCustomPopupMenu( QPoint point );
|
||||||
|
|
||||||
void createChannel();
|
void createChannel();
|
||||||
|
@ -69,6 +68,7 @@ private slots:
|
||||||
|
|
||||||
void subscribeChannel();
|
void subscribeChannel();
|
||||||
void unsubscribeChannel();
|
void unsubscribeChannel();
|
||||||
|
void setAllAsReadClicked();
|
||||||
|
|
||||||
void createMsg();
|
void createMsg();
|
||||||
|
|
||||||
|
@ -77,15 +77,14 @@ private slots:
|
||||||
void editChannelDetail();
|
void editChannelDetail();
|
||||||
void shareKey();
|
void shareKey();
|
||||||
|
|
||||||
private:
|
void channelMsgReadSatusChanged(const QString& channelId, const QString& msgId, int status);
|
||||||
|
|
||||||
|
private:
|
||||||
void updateChannelList();
|
void updateChannelList();
|
||||||
void updateChannelListOwn(std::list<std::string> &ids);
|
void fillChannelList(int channelItem, std::list<ChannelInfo> &channelInfos);
|
||||||
void updateChannelListSub(std::list<std::string> &ids);
|
|
||||||
void updateChannelListPop(std::list<std::string> &ids);
|
|
||||||
void updateChannelListOther(std::list<std::string> &ids);
|
|
||||||
|
|
||||||
void updateChannelMsgs();
|
void updateChannelMsgs();
|
||||||
|
void updateMessageSummaryList(const std::string &channelId);
|
||||||
|
|
||||||
QStandardItemModel *model;
|
QStandardItemModel *model;
|
||||||
|
|
||||||
|
@ -98,15 +97,6 @@ private:
|
||||||
|
|
||||||
QFont mChannelFont;
|
QFont mChannelFont;
|
||||||
QFont itemFont;
|
QFont itemFont;
|
||||||
|
|
||||||
QAction* postchannelAct;
|
|
||||||
QAction* subscribechannelAct;
|
|
||||||
QAction* unsubscribechannelAct;
|
|
||||||
QAction* channeldetailsAct;
|
|
||||||
QAction* restoreKeysAct;
|
|
||||||
QAction* editChannelDetailAct;
|
|
||||||
QAction* shareKeyAct;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -469,7 +469,7 @@ border-image: url(:/images/btn_26_pressed.png) 4;
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="4">
|
<item row="0" column="4">
|
||||||
<widget class="QToolButton" name="setallreadtoolButton">
|
<widget class="QToolButton" name="setAllAsReadButton">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>26</width>
|
<width>26</width>
|
||||||
|
|
|
@ -68,6 +68,7 @@
|
||||||
#include <retroshare/rspeers.h>
|
#include <retroshare/rspeers.h>
|
||||||
#include <retroshare/rsfiles.h>
|
#include <retroshare/rsfiles.h>
|
||||||
#include <retroshare/rsforums.h>
|
#include <retroshare/rsforums.h>
|
||||||
|
#include <retroshare/rschannels.h>
|
||||||
#include <retroshare/rsnotify.h>
|
#include <retroshare/rsnotify.h>
|
||||||
|
|
||||||
#include "gui/connect/ConnectFriendWizard.h"
|
#include "gui/connect/ConnectFriendWizard.h"
|
||||||
|
@ -218,7 +219,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
||||||
messageAction = createPageAction(QIcon(IMAGE_MESSAGES), tr("Messages"), grp));
|
messageAction = createPageAction(QIcon(IMAGE_MESSAGES), tr("Messages"), grp));
|
||||||
|
|
||||||
ui.stackPages->add(channelFeed = new ChannelFeed(ui.stackPages),
|
ui.stackPages->add(channelFeed = new ChannelFeed(ui.stackPages),
|
||||||
createPageAction(QIcon(IMAGE_CHANNELS), tr("Channels"), grp));
|
channelAction = createPageAction(QIcon(IMAGE_CHANNELS), tr("Channels"), grp));
|
||||||
|
|
||||||
#ifdef BLOGS
|
#ifdef BLOGS
|
||||||
ui.stackPages->add(blogsFeed = new BlogsDialog(ui.stackPages),
|
ui.stackPages->add(blogsFeed = new BlogsDialog(ui.stackPages),
|
||||||
|
@ -308,6 +309,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
||||||
/* call once */
|
/* call once */
|
||||||
updateMessages();
|
updateMessages();
|
||||||
updateForums();
|
updateForums();
|
||||||
|
updateChannels(NOTIFY_TYPE_ADD);
|
||||||
privateChatChanged(NOTIFY_LIST_PRIVATE_INCOMING_CHAT, NOTIFY_TYPE_ADD);
|
privateChatChanged(NOTIFY_LIST_PRIVATE_INCOMING_CHAT, NOTIFY_TYPE_ADD);
|
||||||
|
|
||||||
idle = new Idle();
|
idle = new Idle();
|
||||||
|
@ -403,6 +405,11 @@ void MainWindow::createTrayIcon()
|
||||||
trayIconForums->setIcon(QIcon(":/images/konversation16.png"));
|
trayIconForums->setIcon(QIcon(":/images/konversation16.png"));
|
||||||
connect(trayIconForums, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayIconForumsClicked(QSystemTrayIcon::ActivationReason)));
|
connect(trayIconForums, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayIconForumsClicked(QSystemTrayIcon::ActivationReason)));
|
||||||
|
|
||||||
|
// Create the tray icon for channels
|
||||||
|
trayIconChannels = new QSystemTrayIcon(this);
|
||||||
|
trayIconChannels->setIcon(QIcon(":/images/channels16.png"));
|
||||||
|
connect(trayIconChannels, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayIconChannelsClicked(QSystemTrayIcon::ActivationReason)));
|
||||||
|
|
||||||
// Create the tray icon for chat
|
// Create the tray icon for chat
|
||||||
trayIconChat = new QSystemTrayIcon(this);
|
trayIconChat = new QSystemTrayIcon(this);
|
||||||
trayIconChat->setIcon(QIcon(":/images/chat.png"));
|
trayIconChat->setIcon(QIcon(":/images/chat.png"));
|
||||||
|
@ -458,9 +465,9 @@ void MainWindow::updateForums()
|
||||||
rsForums->getMessageCount("", newMessageCount, unreadMessageCount);
|
rsForums->getMessageCount("", newMessageCount, unreadMessageCount);
|
||||||
|
|
||||||
if (newMessageCount) {
|
if (newMessageCount) {
|
||||||
forumAction->setIcon(QIcon(QPixmap(":/images/konversation_new.png"))) ;
|
forumAction->setIcon(QIcon(":/images/konversation_new.png")) ;
|
||||||
} else {
|
} else {
|
||||||
forumAction->setIcon(QIcon(QPixmap(":/images/konversation.png"))) ;
|
forumAction->setIcon(QIcon(IMAGE_FORUMS)) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newMessageCount) {
|
if (newMessageCount) {
|
||||||
|
@ -475,6 +482,30 @@ void MainWindow::updateForums()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::updateChannels(int type)
|
||||||
|
{
|
||||||
|
unsigned int newMessageCount = 0;
|
||||||
|
unsigned int unreadMessageCount = 0;
|
||||||
|
rsChannels->getMessageCount("", newMessageCount, unreadMessageCount);
|
||||||
|
|
||||||
|
if (newMessageCount) {
|
||||||
|
channelAction->setIcon(QIcon(":/images/channels_new32.png")) ;
|
||||||
|
} else {
|
||||||
|
channelAction->setIcon(QIcon(IMAGE_CHANNELS)) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newMessageCount) {
|
||||||
|
if (newMessageCount > 1) {
|
||||||
|
trayIconChannels->setToolTip(tr("RetroShare") + "\n" + tr("You have %1 new messages").arg(newMessageCount));
|
||||||
|
} else {
|
||||||
|
trayIconChannels->setToolTip(tr("RetroShare") + "\n" + tr("You have %1 new message").arg(newMessageCount));
|
||||||
|
}
|
||||||
|
trayIconChannels->show();
|
||||||
|
} else {
|
||||||
|
trayIconChannels->hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::updateStatus()
|
void MainWindow::updateStatus()
|
||||||
{
|
{
|
||||||
// This call is essential to remove locks due to QEventLoop re-entrance while asking gpg passwds. Dont' remove it!
|
// This call is essential to remove locks due to QEventLoop re-entrance while asking gpg passwds. Dont' remove it!
|
||||||
|
@ -831,6 +862,13 @@ void MainWindow::trayIconForumsClicked(QSystemTrayIcon::ActivationReason e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::trayIconChannelsClicked(QSystemTrayIcon::ActivationReason e)
|
||||||
|
{
|
||||||
|
if(e == QSystemTrayIcon::Trigger || e == QSystemTrayIcon::DoubleClick) {
|
||||||
|
showWindow(MainWindow::Channels);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::trayIconChatClicked(QSystemTrayIcon::ActivationReason e)
|
void MainWindow::trayIconChatClicked(QSystemTrayIcon::ActivationReason e)
|
||||||
{
|
{
|
||||||
if(e == QSystemTrayIcon::Trigger || e == QSystemTrayIcon::DoubleClick) {
|
if(e == QSystemTrayIcon::Trigger || e == QSystemTrayIcon::DoubleClick) {
|
||||||
|
|
|
@ -141,6 +141,7 @@ public slots:
|
||||||
void checkAndSetIdle(int idleTime);
|
void checkAndSetIdle(int idleTime);
|
||||||
void updateMessages();
|
void updateMessages();
|
||||||
void updateForums();
|
void updateForums();
|
||||||
|
void updateChannels(int type);
|
||||||
void privateChatChanged(int list, int type);
|
void privateChatChanged(int list, int type);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -161,6 +162,7 @@ private slots:
|
||||||
void toggleVisibilitycontextmenu();
|
void toggleVisibilitycontextmenu();
|
||||||
void trayIconMessagesClicked(QSystemTrayIcon::ActivationReason e);
|
void trayIconMessagesClicked(QSystemTrayIcon::ActivationReason e);
|
||||||
void trayIconForumsClicked(QSystemTrayIcon::ActivationReason e);
|
void trayIconForumsClicked(QSystemTrayIcon::ActivationReason e);
|
||||||
|
void trayIconChannelsClicked(QSystemTrayIcon::ActivationReason e);
|
||||||
void trayIconChatClicked(QSystemTrayIcon::ActivationReason e);
|
void trayIconChatClicked(QSystemTrayIcon::ActivationReason e);
|
||||||
|
|
||||||
/** Toolbar fns. */
|
/** Toolbar fns. */
|
||||||
|
@ -225,6 +227,7 @@ private:
|
||||||
QSystemTrayIcon *trayIcon;
|
QSystemTrayIcon *trayIcon;
|
||||||
QSystemTrayIcon *trayIconMessages;
|
QSystemTrayIcon *trayIconMessages;
|
||||||
QSystemTrayIcon *trayIconForums;
|
QSystemTrayIcon *trayIconForums;
|
||||||
|
QSystemTrayIcon *trayIconChannels;
|
||||||
QSystemTrayIcon *trayIconChat;
|
QSystemTrayIcon *trayIconChat;
|
||||||
QAction *toggleVisibilityAction, *toolAct;
|
QAction *toggleVisibilityAction, *toolAct;
|
||||||
QMenu *trayMenu;
|
QMenu *trayMenu;
|
||||||
|
@ -238,6 +241,7 @@ private:
|
||||||
|
|
||||||
QAction *messageAction;
|
QAction *messageAction;
|
||||||
QAction *forumAction;
|
QAction *forumAction;
|
||||||
|
QAction *channelAction;
|
||||||
|
|
||||||
/* Status */
|
/* Status */
|
||||||
std::set <QObject*> m_apStatusObjects; // added objects for status
|
std::set <QObject*> m_apStatusObjects; // added objects for status
|
||||||
|
@ -254,4 +258,3 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
#include "FeedHolder.h"
|
#include "FeedHolder.h"
|
||||||
#include "SubFileItem.h"
|
#include "SubFileItem.h"
|
||||||
|
#include "gui/notifyqt.h"
|
||||||
|
|
||||||
#include <retroshare/rschannels.h>
|
#include <retroshare/rschannels.h>
|
||||||
|
|
||||||
|
@ -46,6 +47,8 @@ ChanMsgItem::ChanMsgItem(FeedHolder *parent, uint32_t feedId, std::string chanId
|
||||||
|
|
||||||
setAttribute ( Qt::WA_DeleteOnClose, true );
|
setAttribute ( Qt::WA_DeleteOnClose, true );
|
||||||
|
|
||||||
|
m_inUpdateItemStatic = false;
|
||||||
|
|
||||||
/* general ones */
|
/* general ones */
|
||||||
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
|
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
|
||||||
connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );
|
connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );
|
||||||
|
@ -55,13 +58,15 @@ ChanMsgItem::ChanMsgItem(FeedHolder *parent, uint32_t feedId, std::string chanId
|
||||||
connect( downloadButton, SIGNAL( clicked( void ) ), this, SLOT( download ( void ) ) );
|
connect( downloadButton, SIGNAL( clicked( void ) ), this, SLOT( download ( void ) ) );
|
||||||
connect( playButton, SIGNAL( clicked( void ) ), this, SLOT( play ( void ) ) );
|
connect( playButton, SIGNAL( clicked( void ) ), this, SLOT( play ( void ) ) );
|
||||||
|
|
||||||
|
connect( readButton, SIGNAL( toggled(bool) ), this, SLOT( readToggled(bool) ) );
|
||||||
|
connect( NotifyQt::getInstance(), SIGNAL(channelMsgReadSatusChanged(QString,QString,int)), this, SLOT(channelMsgReadSatusChanged(QString,QString,int)), Qt::QueuedConnection);
|
||||||
|
|
||||||
downloadButton->hide();
|
downloadButton->hide();
|
||||||
playButton->hide();
|
playButton->hide();
|
||||||
|
|
||||||
small();
|
small();
|
||||||
updateItemStatic();
|
updateItemStatic();
|
||||||
updateItem();
|
updateItem();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -81,12 +86,15 @@ void ChanMsgItem::updateItemStatic()
|
||||||
if (!rsChannels->getChannelMessage(mChanId, mMsgId, cmi))
|
if (!rsChannels->getChannelMessage(mChanId, mMsgId, cmi))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
m_inUpdateItemStatic = true;
|
||||||
|
|
||||||
QString title;
|
QString title;
|
||||||
|
|
||||||
|
ChannelInfo ci;
|
||||||
|
rsChannels->getChannelInfo(mChanId, ci);
|
||||||
|
|
||||||
if (!mIsHome)
|
if (!mIsHome)
|
||||||
{
|
{
|
||||||
ChannelInfo ci;
|
|
||||||
rsChannels->getChannelInfo(mChanId, ci);
|
|
||||||
title = "Channel Feed: ";
|
title = "Channel Feed: ";
|
||||||
title += QString::fromStdWString(ci.channelName);
|
title += QString::fromStdWString(ci.channelName);
|
||||||
titleLabel->setText(title);
|
titleLabel->setText(title);
|
||||||
|
@ -97,6 +105,8 @@ void ChanMsgItem::updateItemStatic()
|
||||||
} else {
|
} else {
|
||||||
unsubscribeButton->setEnabled(false);
|
unsubscribeButton->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
readButton->setVisible(false);
|
||||||
|
newLabel->setVisible(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -109,6 +119,30 @@ void ChanMsgItem::updateItemStatic()
|
||||||
unsubscribeButton->setEnabled(false);
|
unsubscribeButton->setEnabled(false);
|
||||||
clearButton->hide();
|
clearButton->hide();
|
||||||
unsubscribeButton->hide();
|
unsubscribeButton->hide();
|
||||||
|
|
||||||
|
if ((ci.channelFlags & RS_DISTRIB_SUBSCRIBED) || (ci.channelFlags & RS_DISTRIB_ADMIN)) {
|
||||||
|
readButton->setVisible(true);
|
||||||
|
|
||||||
|
uint32_t status = 0;
|
||||||
|
rsChannels->getMessageStatus(mChanId, mMsgId, status);
|
||||||
|
|
||||||
|
if ((status & CHANNEL_MSG_STATUS_READ) == 0 || (status & CHANNEL_MSG_STATUS_UNREAD_BY_USER)) {
|
||||||
|
readButton->setChecked(true);
|
||||||
|
readButton->setIcon(QIcon(":/images/message-state-unread.png"));
|
||||||
|
} else {
|
||||||
|
readButton->setChecked(false);
|
||||||
|
readButton->setIcon(QIcon(":/images/message-state-read.png"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status & CHANNEL_MSG_STATUS_READ) {
|
||||||
|
newLabel->setVisible(false);
|
||||||
|
} else {
|
||||||
|
newLabel->setVisible(true);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
readButton->setVisible(false);
|
||||||
|
newLabel->setVisible(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
msgLabel->setText(QString::fromStdWString(cmi.msg));
|
msgLabel->setText(QString::fromStdWString(cmi.msg));
|
||||||
|
@ -155,6 +189,8 @@ void ChanMsgItem::updateItemStatic()
|
||||||
label->setPixmap(thumbnail);
|
label->setPixmap(thumbnail);
|
||||||
label->setStyleSheet("QLabel#label{border: 2px solid #D3D3D3;border-radius: 3px;}");
|
label->setStyleSheet("QLabel#label{border: 2px solid #D3D3D3;border-radius: 3px;}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_inUpdateItemStatic = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -311,3 +347,28 @@ void ChanMsgItem::play()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ChanMsgItem::readToggled(bool checked)
|
||||||
|
{
|
||||||
|
if (m_inUpdateItemStatic) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* set always as read ... */
|
||||||
|
uint32_t statusNew = CHANNEL_MSG_STATUS_READ;
|
||||||
|
if (checked) {
|
||||||
|
/* ... and as unread by user */
|
||||||
|
statusNew |= CHANNEL_MSG_STATUS_UNREAD_BY_USER;
|
||||||
|
} else {
|
||||||
|
/* ... and as read by user */
|
||||||
|
statusNew &= ~CHANNEL_MSG_STATUS_UNREAD_BY_USER;
|
||||||
|
}
|
||||||
|
rsChannels->setMessageStatus(mChanId, mMsgId, statusNew, CHANNEL_MSG_STATUS_READ | CHANNEL_MSG_STATUS_UNREAD_BY_USER);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ChanMsgItem::channelMsgReadSatusChanged(const QString& channelId, const QString& msgId, int status)
|
||||||
|
{
|
||||||
|
if (channelId.toStdString() == mChanId && msgId.toStdString() == mMsgId) {
|
||||||
|
updateItemStatic();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -51,6 +51,9 @@ private slots:
|
||||||
void download();
|
void download();
|
||||||
void play();
|
void play();
|
||||||
|
|
||||||
|
void readToggled(bool checked);
|
||||||
|
void channelMsgReadSatusChanged(const QString& channelId, const QString& msgId, int status);
|
||||||
|
|
||||||
void updateItem();
|
void updateItem();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -61,11 +64,10 @@ private:
|
||||||
std::string mMsgId;
|
std::string mMsgId;
|
||||||
|
|
||||||
bool mIsHome;
|
bool mIsHome;
|
||||||
|
bool m_inUpdateItemStatic;
|
||||||
|
|
||||||
std::list<SubFileItem *> mFileItems;
|
std::list<SubFileItem *> mFileItems;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ border-radius: 10px;}</string>
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="pixmap">
|
<property name="pixmap">
|
||||||
<pixmap resource="../images.qrc">:/images/thumb-default-video.png</pixmap>
|
<pixmap>:/images/thumb-default-video.png</pixmap>
|
||||||
</property>
|
</property>
|
||||||
<property name="scaledContents">
|
<property name="scaledContents">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
@ -114,7 +114,7 @@ border-radius: 10px;}</string>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="0" colspan="7">
|
<item row="0" column="0" colspan="8">
|
||||||
<widget class="QLabel" name="titleLabel">
|
<widget class="QLabel" name="titleLabel">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
|
@ -139,7 +139,7 @@ p, li { white-space: pre-wrap; }
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="7" colspan="3">
|
<item row="0" column="8" colspan="3">
|
||||||
<widget class="QLabel" name="datetimelabel">
|
<widget class="QLabel" name="datetimelabel">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
|
@ -156,7 +156,7 @@ p, li { white-space: pre-wrap; }
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" colspan="10">
|
<item row="1" column="0" colspan="11">
|
||||||
<widget class="QLabel" name="subjectLabel">
|
<widget class="QLabel" name="subjectLabel">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
|
||||||
|
@ -182,7 +182,7 @@ p, li { white-space: pre-wrap; }
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="6" colspan="2">
|
<item row="2" column="7" colspan="2">
|
||||||
<widget class="QPushButton" name="unsubscribeButton">
|
<widget class="QPushButton" name="unsubscribeButton">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
@ -197,12 +197,12 @@ p, li { white-space: pre-wrap; }
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../images.qrc">
|
<iconset>
|
||||||
<normaloff>:/images/mail_delete.png</normaloff>:/images/mail_delete.png</iconset>
|
<normaloff>:/images/mail_delete.png</normaloff>:/images/mail_delete.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="8">
|
<item row="2" column="9">
|
||||||
<widget class="QPushButton" name="clearButton">
|
<widget class="QPushButton" name="clearButton">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
@ -217,12 +217,12 @@ p, li { white-space: pre-wrap; }
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../images.qrc">
|
<iconset>
|
||||||
<normaloff>:/images/close_normal.png</normaloff>:/images/close_normal.png</iconset>
|
<normaloff>:/images/close_normal.png</normaloff>:/images/close_normal.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="9">
|
<item row="2" column="10">
|
||||||
<widget class="QPushButton" name="expandButton">
|
<widget class="QPushButton" name="expandButton">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
@ -240,7 +240,7 @@ p, li { white-space: pre-wrap; }
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../images.qrc">
|
<iconset>
|
||||||
<normaloff>:/images/edit_add24.png</normaloff>:/images/edit_add24.png</iconset>
|
<normaloff>:/images/edit_add24.png</normaloff>:/images/edit_add24.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -248,33 +248,33 @@ p, li { white-space: pre-wrap; }
|
||||||
<item row="2" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QLabel" name="filelabel">
|
<widget class="QLabel" name="filelabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string notr="true">TextLabel</string>
|
<string notr="true">fileLabel</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="3">
|
<item row="2" column="4">
|
||||||
<widget class="QPushButton" name="downloadButton">
|
<widget class="QPushButton" name="downloadButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Download</string>
|
<string>Download</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../images.qrc">
|
<iconset>
|
||||||
<normaloff>:/images/download16.png</normaloff>:/images/download16.png</iconset>
|
<normaloff>:/images/download16.png</normaloff>:/images/download16.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="4">
|
<item row="2" column="5">
|
||||||
<widget class="QPushButton" name="playButton">
|
<widget class="QPushButton" name="playButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Play</string>
|
<string>Play</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../images.qrc">
|
<iconset>
|
||||||
<normaloff>:/images/player_play.png</normaloff>:/images/player_play.png</iconset>
|
<normaloff>:/images/player_play.png</normaloff>:/images/player_play.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="5">
|
<item row="2" column="6">
|
||||||
<spacer>
|
<spacer>
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
|
@ -290,6 +290,30 @@ p, li { white-space: pre-wrap; }
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
|
<widget class="QPushButton" name="readButton">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset>
|
||||||
|
<normaloff>:/images/message-state-unread.png</normaloff>:/images/message-state-unread.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="3">
|
||||||
|
<widget class="QLabel" name="newLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>New</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
@ -349,15 +373,6 @@ border-radius: 10px;}</string>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources/>
|
||||||
<include location="../images.qrc"/>
|
|
||||||
<include location="../images.qrc"/>
|
|
||||||
<include location="../images.qrc"/>
|
|
||||||
<include location="../images.qrc"/>
|
|
||||||
<include location="../images.qrc"/>
|
|
||||||
<include location="../images.qrc"/>
|
|
||||||
<include location="../images.qrc"/>
|
|
||||||
<include location="../images.qrc"/>
|
|
||||||
</resources>
|
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
@ -58,6 +58,7 @@
|
||||||
<file>images/channels16.png</file>
|
<file>images/channels16.png</file>
|
||||||
<file>images/channels24.png</file>
|
<file>images/channels24.png</file>
|
||||||
<file>images/channels32.png</file>
|
<file>images/channels32.png</file>
|
||||||
|
<file>images/channels_new32.png</file>
|
||||||
<file>images/copyrslink.png</file>
|
<file>images/copyrslink.png</file>
|
||||||
<file>images/contacts24.png</file>
|
<file>images/contacts24.png</file>
|
||||||
<file>images/connection.png</file>
|
<file>images/connection.png</file>
|
||||||
|
|
BIN
retroshare-gui/src/gui/images/channels_new32.png
Normal file
BIN
retroshare-gui/src/gui/images/channels_new32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2 KiB |
|
@ -98,6 +98,11 @@ void NotifyQt::notifyPeerStatusChangedSummary()
|
||||||
emit peerStatusChangedSummary();
|
emit peerStatusChangedSummary();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NotifyQt::notifyChannelMsgReadSatusChanged(const std::string& channelId, const std::string& msgId, uint32_t status)
|
||||||
|
{
|
||||||
|
emit channelMsgReadSatusChanged(QString::fromStdString(channelId), QString::fromStdString(msgId), status);
|
||||||
|
}
|
||||||
|
|
||||||
void NotifyQt::notifyOwnStatusMessageChanged()
|
void NotifyQt::notifyOwnStatusMessageChanged()
|
||||||
{
|
{
|
||||||
#ifdef NOTIFY_DEBUG
|
#ifdef NOTIFY_DEBUG
|
||||||
|
@ -226,6 +231,12 @@ void NotifyQt::notifyListChange(int list, int type)
|
||||||
#endif
|
#endif
|
||||||
emit forumsChanged(); // use connect with Qt::QueuedConnection
|
emit forumsChanged(); // use connect with Qt::QueuedConnection
|
||||||
break;
|
break;
|
||||||
|
case NOTIFY_LIST_CHANNELLIST_LOCKED:
|
||||||
|
#ifdef NOTIFY_DEBUG
|
||||||
|
std::cerr << "received channel msg changed" << std::endl ;
|
||||||
|
#endif
|
||||||
|
emit channelsChanged(type); // use connect with Qt::QueuedConnection
|
||||||
|
break;
|
||||||
case NOTIFY_LIST_PUBLIC_CHAT:
|
case NOTIFY_LIST_PUBLIC_CHAT:
|
||||||
#ifdef NOTIFY_DEBUG
|
#ifdef NOTIFY_DEBUG
|
||||||
std::cerr << "received public chat changed" << std::endl ;
|
std::cerr << "received public chat changed" << std::endl ;
|
||||||
|
|
|
@ -44,6 +44,7 @@ class NotifyQt: public QObject, public NotifyBase
|
||||||
virtual void notifyPeerStatusChanged(const std::string& peer_id, uint32_t state);
|
virtual void notifyPeerStatusChanged(const std::string& peer_id, uint32_t state);
|
||||||
/* one or more peers has changed the states */
|
/* one or more peers has changed the states */
|
||||||
virtual void notifyPeerStatusChangedSummary();
|
virtual void notifyPeerStatusChangedSummary();
|
||||||
|
virtual void notifyChannelMsgReadSatusChanged(const std::string& channelId, const std::string& msgId, uint32_t status);
|
||||||
|
|
||||||
virtual std::string askForPassword(const std::string& key_details,bool prev_is_bad) ;
|
virtual std::string askForPassword(const std::string& key_details,bool prev_is_bad) ;
|
||||||
|
|
||||||
|
@ -63,6 +64,7 @@ class NotifyQt: public QObject, public NotifyBase
|
||||||
void messagesChanged() const ;
|
void messagesChanged() const ;
|
||||||
void messagesTagsChanged() const;
|
void messagesTagsChanged() const;
|
||||||
void forumsChanged() const ; // use connect with Qt::QueuedConnection
|
void forumsChanged() const ; // use connect with Qt::QueuedConnection
|
||||||
|
void channelsChanged(int type) const ; // use connect with Qt::QueuedConnection
|
||||||
void configChanged() const ;
|
void configChanged() const ;
|
||||||
void logInfoChanged(const QString&) const ;
|
void logInfoChanged(const QString&) const ;
|
||||||
void chatStatusChanged(const QString&,const QString&,bool) const ;
|
void chatStatusChanged(const QString&,const QString&,bool) const ;
|
||||||
|
@ -78,6 +80,7 @@ class NotifyQt: public QObject, public NotifyBase
|
||||||
void publicChatChanged(int type) const ;
|
void publicChatChanged(int type) const ;
|
||||||
void privateChatChanged(int list, int type) const ;
|
void privateChatChanged(int list, int type) const ;
|
||||||
void groupsChanged(int type) const ;
|
void groupsChanged(int type) const ;
|
||||||
|
void channelMsgReadSatusChanged(const QString& channelId, const QString& msgId, int status);
|
||||||
|
|
||||||
/* Notify from GUI */
|
/* Notify from GUI */
|
||||||
void chatStyleChanged(int /*ChatStyle::enumStyleType*/ styleType);
|
void chatStyleChanged(int /*ChatStyle::enumStyleType*/ styleType);
|
||||||
|
|
|
@ -196,6 +196,7 @@ int main(int argc, char *argv[])
|
||||||
QObject::connect(notify,SIGNAL(messagesTagsChanged()) ,w->messagesDialog ,SLOT(messagesTagsChanged() )) ;
|
QObject::connect(notify,SIGNAL(messagesTagsChanged()) ,w->messagesDialog ,SLOT(messagesTagsChanged() )) ;
|
||||||
QObject::connect(notify,SIGNAL(messagesChanged()) ,w ,SLOT(updateMessages() )) ;
|
QObject::connect(notify,SIGNAL(messagesChanged()) ,w ,SLOT(updateMessages() )) ;
|
||||||
QObject::connect(notify,SIGNAL(forumsChanged()) ,w ,SLOT(updateForums() ), Qt::QueuedConnection);
|
QObject::connect(notify,SIGNAL(forumsChanged()) ,w ,SLOT(updateForums() ), Qt::QueuedConnection);
|
||||||
|
QObject::connect(notify,SIGNAL(channelsChanged(int)) ,w ,SLOT(updateChannels(int) ), Qt::QueuedConnection);
|
||||||
|
|
||||||
QObject::connect(notify,SIGNAL(chatStatusChanged(const QString&,const QString&,bool)),w->peersDialog,SLOT(updatePeerStatusString(const QString&,const QString&,bool)));
|
QObject::connect(notify,SIGNAL(chatStatusChanged(const QString&,const QString&,bool)),w->peersDialog,SLOT(updatePeerStatusString(const QString&,const QString&,bool)));
|
||||||
QObject::connect(notify,SIGNAL(peerHasNewAvatar(const QString&)),w->peersDialog,SLOT(updatePeersAvatar(const QString&)));
|
QObject::connect(notify,SIGNAL(peerHasNewAvatar(const QString&)),w->peersDialog,SLOT(updatePeersAvatar(const QString&)));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue