mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-03-25 16:18:22 -04:00
Merge remote-tracking branch 'upstream/master' into v0.6-TorControl
This commit is contained in:
commit
a352fd7dcd
@ -103,6 +103,9 @@ enum class RsEventType : uint32_t
|
||||
/// @see rspeers.h
|
||||
NETWORK = 16,
|
||||
|
||||
/// @see RsMailTagEvent
|
||||
MAIL_TAG = 17,
|
||||
|
||||
/** Emitted to update library clients about file hashing being completed */
|
||||
FILE_HASHING_COMPLETED = 20,
|
||||
|
||||
|
@ -308,6 +308,9 @@ enum class RsMailStatusEventCode: uint8_t
|
||||
|
||||
/// An error occurred attempting to sign the message
|
||||
SIGNATURE_FAILED = 0x04,
|
||||
|
||||
MESSAGE_CHANGED = 0x05,
|
||||
TAG_CHANGED = 0x06,
|
||||
};
|
||||
|
||||
struct RsMailStatusEvent : RsEvent
|
||||
@ -329,6 +332,32 @@ struct RsMailStatusEvent : RsEvent
|
||||
~RsMailStatusEvent() override = default;
|
||||
};
|
||||
|
||||
enum class RsMailTagEventCode: uint8_t
|
||||
{
|
||||
TAG_ADDED = 0x00,
|
||||
TAG_CHANGED = 0x01,
|
||||
TAG_REMOVED = 0x02,
|
||||
};
|
||||
|
||||
struct RsMailTagEvent : RsEvent
|
||||
{
|
||||
RsMailTagEvent() : RsEvent(RsEventType::MAIL_TAG) {}
|
||||
|
||||
RsMailTagEventCode mMailTagEventCode;
|
||||
std::set<std::string> mChangedMsgTagIds;
|
||||
|
||||
/// @see RsEvent
|
||||
void serial_process( RsGenericSerializer::SerializeJob j,
|
||||
RsGenericSerializer::SerializeContext& ctx) override
|
||||
{
|
||||
RsEvent::serial_process(j, ctx);
|
||||
RS_SERIAL_PROCESS(mChangedMsgTagIds);
|
||||
RS_SERIAL_PROCESS(mMailTagEventCode);
|
||||
}
|
||||
|
||||
~RsMailTagEvent() override = default;
|
||||
};
|
||||
|
||||
#define RS_CHAT_PUBLIC 0x0001
|
||||
#define RS_CHAT_PRIVATE 0x0002
|
||||
#define RS_CHAT_AVATAR_AVAILABLE 0x0004
|
||||
|
@ -128,14 +128,12 @@ const uint32_t RS_MESSAGE_CONNECT_ATTEMPT = 0x0001;
|
||||
const int NOTIFY_LIST_NEIGHBOURS = 1;
|
||||
const int NOTIFY_LIST_FRIENDS = 2;
|
||||
const int NOTIFY_LIST_SEARCHLIST = 4;
|
||||
const int NOTIFY_LIST_MESSAGELIST = 5;
|
||||
const int NOTIFY_LIST_CHANNELLIST = 6;
|
||||
const int NOTIFY_LIST_TRANSFERLIST = 7;
|
||||
const int NOTIFY_LIST_CONFIG = 8;
|
||||
const int NOTIFY_LIST_DIRLIST_LOCAL = 9;
|
||||
const int NOTIFY_LIST_DIRLIST_FRIENDS = 10;
|
||||
const int NOTIFY_LIST_FORUMLIST_LOCKED = 11; // use connect with Qt::QueuedConnection
|
||||
const int NOTIFY_LIST_MESSAGE_TAGS = 12;
|
||||
const int NOTIFY_LIST_PUBLIC_CHAT = 13;
|
||||
const int NOTIFY_LIST_PRIVATE_INCOMING_CHAT = 14;
|
||||
const int NOTIFY_LIST_PRIVATE_OUTGOING_CHAT = 15;
|
||||
|
@ -220,8 +220,6 @@ void p3MsgService::processIncomingMsg(RsMsgItem *mi)
|
||||
for(std::list<RsTlvFileItem>::const_iterator it(mi->attachment.items.begin());it!=mi->attachment.items.end();++it)
|
||||
rsFiles->FileRequest((*it).name,(*it).hash,(*it).filesize,std::string(),RS_FILE_REQ_ANONYMOUS_ROUTING,srcIds) ;
|
||||
}
|
||||
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_ADD);
|
||||
}
|
||||
|
||||
bool p3MsgService::checkAndRebuildPartialMessage(RsMsgItem *ci)
|
||||
@ -283,16 +281,11 @@ int p3MsgService::incomingMsgs()
|
||||
|
||||
void p3MsgService::handleIncomingItem(RsMsgItem *mi)
|
||||
{
|
||||
bool changed = false ;
|
||||
|
||||
// only returns true when a msg is complete.
|
||||
if(checkAndRebuildPartialMessage(mi))
|
||||
{
|
||||
processIncomingMsg(mi);
|
||||
changed = true ;
|
||||
}
|
||||
if(changed)
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
|
||||
}
|
||||
|
||||
void p3MsgService::statusChange(const std::list<pqiServicePeer> &plist)
|
||||
@ -350,7 +343,6 @@ void p3MsgService::checkSizeAndSendMessage(RsMsgItem *msg)
|
||||
|
||||
int p3MsgService::checkOutgoingMessages()
|
||||
{
|
||||
bool changed = false;
|
||||
std::list<RsMsgItem*> output_queue;
|
||||
|
||||
auto pEvent = std::make_shared<RsMailStatusEvent>();
|
||||
@ -400,7 +392,6 @@ int p3MsgService::checkOutgoingMessages()
|
||||
{
|
||||
(mit->second)->msgFlags &= ~RS_MSG_FLAGS_PENDING;
|
||||
toErase.push_back(mit->first);
|
||||
changed = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -442,9 +433,6 @@ int p3MsgService::checkOutgoingMessages()
|
||||
else
|
||||
checkSizeAndSendMessage(*it);
|
||||
|
||||
if(changed)
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
|
||||
|
||||
if(rsEvents && !pEvent->mChangedMsgIds.empty())
|
||||
rsEvents->postEvent(pEvent);
|
||||
|
||||
@ -954,8 +942,6 @@ bool p3MsgService::removeMsgId(const std::string &mid)
|
||||
|
||||
setMessageTag(mid, 0, false);
|
||||
setMsgParentId(msgId, 0);
|
||||
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
|
||||
}
|
||||
|
||||
if(rsEvents && !pEvent->mChangedMsgIds.empty())
|
||||
@ -968,7 +954,6 @@ bool p3MsgService::markMsgIdRead(const std::string &mid, bool unreadByUser)
|
||||
{
|
||||
std::map<uint32_t, RsMsgItem *>::iterator mit;
|
||||
uint32_t msgId = atoi(mid.c_str());
|
||||
bool changed = false;
|
||||
|
||||
{
|
||||
RsStackMutex stack(mMsgMtx); /********** STACK LOCKED MTX ******/
|
||||
@ -992,18 +977,18 @@ bool p3MsgService::markMsgIdRead(const std::string &mid, bool unreadByUser)
|
||||
|
||||
if (mi->msgFlags != msgFlags)
|
||||
{
|
||||
changed = true;
|
||||
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||
|
||||
auto pEvent = std::make_shared<RsMailStatusEvent>();
|
||||
pEvent->mMailStatusEventCode = RsMailStatusEventCode::MESSAGE_CHANGED;
|
||||
pEvent->mChangedMsgIds.insert(mid);
|
||||
rsEvents->postEvent(pEvent);
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} /* UNLOCKED */
|
||||
|
||||
if (changed) {
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1012,8 +997,6 @@ bool p3MsgService::setMsgFlag(const std::string &mid, uint32_t flag, uint32_t
|
||||
std::map<uint32_t, RsMsgItem *>::iterator mit;
|
||||
uint32_t msgId = atoi(mid.c_str());
|
||||
|
||||
bool changed = false;
|
||||
|
||||
{
|
||||
RsStackMutex stack(mMsgMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
@ -1033,15 +1016,15 @@ bool p3MsgService::setMsgFlag(const std::string &mid, uint32_t flag, uint32_t
|
||||
mit->second->msgFlags |= flag;
|
||||
|
||||
if (mit->second->msgFlags != oldFlag) {
|
||||
changed = true;
|
||||
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||
|
||||
auto pEvent = std::make_shared<RsMailStatusEvent>();
|
||||
pEvent->mMailStatusEventCode = RsMailStatusEventCode::MESSAGE_CHANGED;
|
||||
pEvent->mChangedMsgIds.insert(mid);
|
||||
rsEvents->postEvent(pEvent);
|
||||
}
|
||||
} /* UNLOCKED */
|
||||
|
||||
if (changed) {
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1137,7 +1120,10 @@ uint32_t p3MsgService::sendMessage(RsMsgItem* item)
|
||||
|
||||
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGELIST, NOTIFY_TYPE_ADD); // deprecated
|
||||
auto pEvent = std::make_shared<RsMailStatusEvent>();
|
||||
pEvent->mMailStatusEventCode = RsMailStatusEventCode::MESSAGE_SENT;
|
||||
pEvent->mChangedMsgIds.insert(std::to_string(item->msgId));
|
||||
rsEvents->postEvent(pEvent);
|
||||
|
||||
return item->msgId;
|
||||
}
|
||||
@ -1175,8 +1161,11 @@ uint32_t p3MsgService::sendDistantMessage(RsMsgItem *item, const RsGxsId& from)
|
||||
|
||||
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||
|
||||
RsServer::notify()->notifyListChange( NOTIFY_LIST_MESSAGELIST,
|
||||
NOTIFY_TYPE_ADD );
|
||||
auto pEvent = std::make_shared<RsMailStatusEvent>();
|
||||
pEvent->mMailStatusEventCode = RsMailStatusEventCode::MESSAGE_SENT;
|
||||
pEvent->mChangedMsgIds.insert(std::to_string(item->msgId));
|
||||
rsEvents->postEvent(pEvent);
|
||||
|
||||
return item->msgId;
|
||||
}
|
||||
|
||||
@ -1210,8 +1199,6 @@ bool p3MsgService::MessageSend(MessageInfo &info)
|
||||
// Update info for caller
|
||||
info.msgId = std::to_string(msg->msgId);
|
||||
info .msgflags = msg->msgFlags;
|
||||
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_ADD);// deprecated. Should be removed. Oct. 28, 2020
|
||||
}
|
||||
|
||||
auto pEvent = std::make_shared<RsMailStatusEvent>();
|
||||
@ -1418,10 +1405,9 @@ bool p3MsgService::MessageToDraft(MessageInfo &info, const std::string &msgParen
|
||||
|
||||
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||
|
||||
// RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
|
||||
|
||||
auto pEvent = std::make_shared<RsMailStatusEvent>();
|
||||
pEvent->mMailStatusEventCode = RsMailStatusEventCode::MESSAGE_SENT;
|
||||
pEvent->mChangedMsgIds.insert(std::to_string(msg->msgId));
|
||||
rsEvents->postEvent(pEvent);
|
||||
|
||||
return true;
|
||||
@ -1452,7 +1438,7 @@ bool p3MsgService::getMessageTagTypes(MsgTagType& tags)
|
||||
|
||||
bool p3MsgService::setMessageTagType(uint32_t tagId, std::string& text, uint32_t rgb_color)
|
||||
{
|
||||
int nNotifyType = 0;
|
||||
auto ev = std::make_shared<RsMailTagEvent>();
|
||||
|
||||
{
|
||||
RsStackMutex stack(mMsgMtx); /********** STACK LOCKED MTX ******/
|
||||
@ -1475,7 +1461,8 @@ bool p3MsgService::setMessageTagType(uint32_t tagId, std::string& text, uint32
|
||||
|
||||
mTags.insert(std::pair<uint32_t, RsMsgTagType*>(tagId, tagType));
|
||||
|
||||
nNotifyType = NOTIFY_TYPE_ADD;
|
||||
ev->mMailTagEventCode = RsMailTagEventCode::TAG_ADDED;
|
||||
ev->mChangedMsgTagIds.insert(std::to_string(tagId));
|
||||
} else {
|
||||
if (mit->second->text != text || mit->second->rgb_color != rgb_color) {
|
||||
/* modify existing tag */
|
||||
@ -1489,17 +1476,18 @@ bool p3MsgService::setMessageTagType(uint32_t tagId, std::string& text, uint32
|
||||
}
|
||||
mit->second->rgb_color = rgb_color;
|
||||
|
||||
nNotifyType = NOTIFY_TYPE_MOD;
|
||||
ev->mMailTagEventCode = RsMailTagEventCode::TAG_CHANGED;
|
||||
ev->mChangedMsgTagIds.insert(std::to_string(tagId));
|
||||
}
|
||||
}
|
||||
|
||||
} /* UNLOCKED */
|
||||
|
||||
if (nNotifyType) {
|
||||
if (!ev->mChangedMsgTagIds.empty()) {
|
||||
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGE_TAGS, nNotifyType);
|
||||
|
||||
rsEvents->postEvent(ev);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1513,6 +1501,9 @@ bool p3MsgService::removeMessageTagType(uint32_t tagId)
|
||||
return false;
|
||||
}
|
||||
|
||||
auto msgEvent = std::make_shared<RsMailStatusEvent>();
|
||||
msgEvent->mMailStatusEventCode = RsMailStatusEventCode::TAG_CHANGED;
|
||||
|
||||
{
|
||||
RsStackMutex stack(mMsgMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
@ -1540,7 +1531,10 @@ bool p3MsgService::removeMessageTagType(uint32_t tagId)
|
||||
delete(tag);
|
||||
|
||||
mMsgTags.erase(mit1++);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (msgEvent->mChangedMsgIds.find(std::to_string(mit1->first)) == msgEvent->mChangedMsgIds.end()) {
|
||||
msgEvent->mChangedMsgIds.insert(std::to_string(mit1->first));
|
||||
}
|
||||
}
|
||||
++mit1;
|
||||
@ -1554,7 +1548,14 @@ bool p3MsgService::removeMessageTagType(uint32_t tagId)
|
||||
|
||||
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGE_TAGS, NOTIFY_TYPE_DEL);
|
||||
auto ev = std::make_shared<RsMailTagEvent>();
|
||||
ev->mMailTagEventCode = RsMailTagEventCode::TAG_REMOVED;
|
||||
ev->mChangedMsgTagIds.insert(std::to_string(tagId));
|
||||
rsEvents->postEvent(ev);
|
||||
|
||||
if (!msgEvent->mChangedMsgIds.empty()) {
|
||||
rsEvents->postEvent(msgEvent);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1595,7 +1596,8 @@ bool p3MsgService::setMessageTag(const std::string &msgId, uint32_t tagId, bool
|
||||
}
|
||||
}
|
||||
|
||||
int nNotifyType = 0;
|
||||
auto ev = std::make_shared<RsMailStatusEvent>();
|
||||
ev->mMailStatusEventCode = RsMailStatusEventCode::TAG_CHANGED;
|
||||
|
||||
{
|
||||
RsStackMutex stack(mMsgMtx); /********** STACK LOCKED MTX ******/
|
||||
@ -1614,7 +1616,7 @@ bool p3MsgService::setMessageTag(const std::string &msgId, uint32_t tagId, bool
|
||||
|
||||
mMsgTags.insert(std::pair<uint32_t, RsMsgTags*>(tag->msgId, tag));
|
||||
|
||||
nNotifyType = NOTIFY_TYPE_ADD;
|
||||
ev->mChangedMsgIds.insert(msgId);
|
||||
}
|
||||
} else {
|
||||
RsMsgTags* tag = mit->second;
|
||||
@ -1632,18 +1634,18 @@ bool p3MsgService::setMessageTag(const std::string &msgId, uint32_t tagId, bool
|
||||
tag->tagIds.push_back(tagId);
|
||||
/* keep the list sorted */
|
||||
tag->tagIds.sort();
|
||||
nNotifyType = NOTIFY_TYPE_ADD;
|
||||
ev->mChangedMsgIds.insert(msgId);
|
||||
}
|
||||
} else {
|
||||
if (tagId == 0) {
|
||||
/* remove all */
|
||||
delete(tag);
|
||||
mMsgTags.erase(mit);
|
||||
nNotifyType = NOTIFY_TYPE_DEL;
|
||||
ev->mChangedMsgIds.insert(msgId);
|
||||
} else {
|
||||
if (lit != tag->tagIds.end()) {
|
||||
tag->tagIds.erase(lit);
|
||||
nNotifyType = NOTIFY_TYPE_DEL;
|
||||
ev->mChangedMsgIds.insert(msgId);
|
||||
|
||||
if (tag->tagIds.empty()) {
|
||||
/* remove empty tag */
|
||||
@ -1657,10 +1659,10 @@ bool p3MsgService::setMessageTag(const std::string &msgId, uint32_t tagId, bool
|
||||
|
||||
} /* UNLOCKED */
|
||||
|
||||
if (nNotifyType) {
|
||||
if (!ev->mChangedMsgIds.empty()) {
|
||||
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGE_TAGS, nNotifyType);
|
||||
rsEvents->postEvent(ev);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1687,8 +1689,9 @@ bool p3MsgService::MessageToTrash(const std::string &mid, bool bTrash)
|
||||
std::map<uint32_t, RsMsgItem *>::iterator mit;
|
||||
uint32_t msgId = atoi(mid.c_str());
|
||||
|
||||
bool bChanged = false;
|
||||
bool bFound = false;
|
||||
auto pEvent = std::make_shared<RsMailStatusEvent>();
|
||||
pEvent->mMailStatusEventCode = RsMailStatusEventCode::MESSAGE_CHANGED;
|
||||
|
||||
{
|
||||
RsStackMutex stack(mMsgMtx); /********** STACK LOCKED MTX ******/
|
||||
@ -1711,23 +1714,25 @@ bool p3MsgService::MessageToTrash(const std::string &mid, bool bTrash)
|
||||
if (bTrash) {
|
||||
if ((mi->msgFlags & RS_MSG_FLAGS_TRASH) == 0) {
|
||||
mi->msgFlags |= RS_MSG_FLAGS_TRASH;
|
||||
bChanged = true;
|
||||
pEvent->mChangedMsgIds.insert(std::to_string(mi->msgId));
|
||||
}
|
||||
} else {
|
||||
if (mi->msgFlags & RS_MSG_FLAGS_TRASH) {
|
||||
mi->msgFlags &= ~RS_MSG_FLAGS_TRASH;
|
||||
bChanged = true;
|
||||
pEvent->mChangedMsgIds.insert(std::to_string(mi->msgId));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (bChanged) {
|
||||
if (!pEvent->mChangedMsgIds.empty()) {
|
||||
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||
|
||||
checkOutgoingMessages();
|
||||
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
|
||||
if(rsEvents) {
|
||||
rsEvents->postEvent(pEvent);
|
||||
}
|
||||
}
|
||||
|
||||
return bFound;
|
||||
@ -2111,14 +2116,12 @@ void p3MsgService::notifyDataStatus( const GRouterMsgPropagationId& id,
|
||||
msgOutgoing.erase(it2);
|
||||
#endif
|
||||
|
||||
RsServer::notify()->notifyListChange( NOTIFY_LIST_MESSAGELIST,
|
||||
NOTIFY_TYPE_ADD );
|
||||
IndicateConfigChanged();
|
||||
|
||||
if(rsEvents)
|
||||
{
|
||||
auto pEvent = std::make_shared<RsMailStatusEvent>();
|
||||
pEvent->mMailStatusEventCode = RsMailStatusEventCode::NEW_MESSAGE;
|
||||
pEvent->mMailStatusEventCode = RsMailStatusEventCode::MESSAGE_CHANGED;
|
||||
pEvent->mChangedMsgIds.insert(std::to_string(msg_id));
|
||||
rsEvents->postEvent(pEvent);
|
||||
}
|
||||
@ -2267,8 +2270,6 @@ bool p3MsgService::notifyGxsTransSendStatus( RsGxsTransId mailId,
|
||||
}
|
||||
}
|
||||
|
||||
RsServer::notify()->notifyListChange( NOTIFY_LIST_MESSAGELIST,
|
||||
NOTIFY_TYPE_ADD );
|
||||
IndicateConfigChanged();
|
||||
}
|
||||
else if( status >= GxsTransSendStatus::FAILED_RECEIPT_SIGNATURE )
|
||||
|
@ -92,6 +92,9 @@ VOIPConfigPanel::VOIPConfigPanel(QWidget * parent, Qt::WindowFlags flags)
|
||||
|
||||
inputAudioProcessor = NULL;
|
||||
inputAudioDevice = NULL;
|
||||
graph_source = nullptr;
|
||||
videoInput = nullptr;
|
||||
videoProcessor = nullptr;
|
||||
qtTick = NULL;
|
||||
|
||||
ui.qcbTransmit->addItem(tr("Continuous"), RsVOIP::AudioTransmitContinous);
|
||||
@ -209,11 +212,16 @@ VOIPConfigPanel::~VOIPConfigPanel()
|
||||
|
||||
void VOIPConfigPanel::clearPipeline()
|
||||
{
|
||||
delete qtTick;
|
||||
if (qtTick) {
|
||||
delete qtTick;
|
||||
qtTick = nullptr;
|
||||
}
|
||||
|
||||
graph_source->stop() ;
|
||||
graph_source->setVideoInput(NULL) ;
|
||||
graph_source=nullptr; // is deleted by setSource below. This is a bad design.
|
||||
if (graph_source) {
|
||||
graph_source->stop() ;
|
||||
graph_source->setVideoInput(NULL) ;
|
||||
graph_source=nullptr; // is deleted by setSource below. This is a bad design.
|
||||
}
|
||||
|
||||
ui.voipBwGraph->setSource(nullptr);
|
||||
|
||||
@ -225,8 +233,10 @@ void VOIPConfigPanel::clearPipeline()
|
||||
|
||||
videoInput = nullptr;
|
||||
}
|
||||
delete videoProcessor;
|
||||
videoProcessor = nullptr;
|
||||
if (videoProcessor) {
|
||||
delete videoProcessor;
|
||||
videoProcessor = nullptr;
|
||||
}
|
||||
|
||||
if (inputAudioDevice) {
|
||||
inputAudioDevice->stop();
|
||||
|
@ -59,6 +59,10 @@
|
||||
#define COLUMN_COUNT 3
|
||||
#define COLUMN_DATA 0
|
||||
|
||||
#define COLUMN_NAME_NB_CHAR 30
|
||||
#define COLUMN_USER_COUNT_NB_CHAR 4
|
||||
#define COLUMN_TOPIC_NB_CHAR 25
|
||||
|
||||
#define ROLE_SORT Qt::UserRole
|
||||
#define ROLE_ID Qt::UserRole + 1
|
||||
#define ROLE_SUBSCRIBED Qt::UserRole + 2
|
||||
@ -88,6 +92,13 @@ ChatLobbyWidget::ChatLobbyWidget(QWidget *parent, Qt::WindowFlags flags)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
|
||||
int H = QFontMetricsF(ui.lobbyTreeWidget->font()).height();
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5,11,0)
|
||||
int W = QFontMetricsF(ui.lobbyTreeWidget->font()).width("_");
|
||||
#else
|
||||
int W = QFontMetricsF(ui.lobbyTreeWidget->font()).horizontalAdvance("_");
|
||||
#endif
|
||||
|
||||
m_bProcessSettings = false;
|
||||
myChatLobbyUserNotify = NULL;
|
||||
myInviteYesButton = NULL;
|
||||
@ -108,6 +119,10 @@ ChatLobbyWidget::ChatLobbyWidget(QWidget *parent, Qt::WindowFlags flags)
|
||||
compareRole = new RSTreeWidgetItemCompareRole;
|
||||
compareRole->setRole(COLUMN_NAME, ROLE_SORT);
|
||||
|
||||
RSElidedItemDelegate *itemDelegate = new RSElidedItemDelegate(this);
|
||||
itemDelegate->setSpacing(QSize(W/2, H/4));
|
||||
ui.lobbyTreeWidget->setItemDelegate(itemDelegate);
|
||||
|
||||
ui.lobbyTreeWidget->setColumnCount(COLUMN_COUNT);
|
||||
ui.lobbyTreeWidget->sortItems(COLUMN_NAME, Qt::AscendingOrder);
|
||||
|
||||
@ -159,14 +174,11 @@ ChatLobbyWidget::ChatLobbyWidget(QWidget *parent, Qt::WindowFlags flags)
|
||||
ui.lobbyTreeWidget->setColumnHidden(COLUMN_USER_COUNT,true) ;
|
||||
ui.lobbyTreeWidget->setColumnHidden(COLUMN_TOPIC,true) ;
|
||||
ui.lobbyTreeWidget->setSortingEnabled(true) ;
|
||||
ui.lobbyTreeWidget->setItemDelegateForColumn(COLUMN_NAME, new RSElidedItemDelegate());
|
||||
|
||||
float fact = QFontMetricsF(font()).height()/14.0f;
|
||||
|
||||
ui.lobbyTreeWidget->adjustSize();
|
||||
ui.lobbyTreeWidget->setColumnWidth(COLUMN_NAME,100*fact);
|
||||
ui.lobbyTreeWidget->setColumnWidth(COLUMN_USER_COUNT, 50*fact);
|
||||
ui.lobbyTreeWidget->setColumnWidth(COLUMN_TOPIC, 50*fact);
|
||||
ui.lobbyTreeWidget->setColumnWidth(COLUMN_NAME,COLUMN_NAME_NB_CHAR*W);
|
||||
ui.lobbyTreeWidget->setColumnWidth(COLUMN_USER_COUNT, COLUMN_USER_COUNT_NB_CHAR*W);
|
||||
ui.lobbyTreeWidget->setColumnWidth(COLUMN_TOPIC, COLUMN_TOPIC_NB_CHAR*W);
|
||||
|
||||
/** Setup the actions for the header context menu */
|
||||
showUserCountAct= new QAction(headerItem->text(COLUMN_USER_COUNT),this);
|
||||
@ -181,7 +193,7 @@ ChatLobbyWidget::ChatLobbyWidget(QWidget *parent, Qt::WindowFlags flags)
|
||||
ui.splitter->setStretchFactor(1, 1);
|
||||
|
||||
QList<int> sizes;
|
||||
sizes << 200*fact << width(); // Qt calculates the right sizes
|
||||
sizes << ui.lobbyTreeWidget->columnWidth(COLUMN_NAME) << width(); // Qt calculates the right sizes
|
||||
ui.splitter->setSizes(sizes);
|
||||
|
||||
lobbyChanged();
|
||||
@ -194,7 +206,6 @@ ChatLobbyWidget::ChatLobbyWidget(QWidget *parent, Qt::WindowFlags flags)
|
||||
// load settings
|
||||
processSettings(true);
|
||||
|
||||
int S = QFontMetricsF(font()).height();
|
||||
QString help_str = tr("\
|
||||
<h1><img width=\"%1\" src=\":/icons/help_64.png\"> Chat Rooms</h1> \
|
||||
<p>Chat rooms work pretty much like IRC. \
|
||||
@ -212,11 +223,11 @@ ChatLobbyWidget::ChatLobbyWidget(QWidget *parent, Qt::WindowFlags flags)
|
||||
Note: For the chat rooms to work properly, your computer needs be on time. So check your system clock!\
|
||||
</p> \
|
||||
"
|
||||
).arg(QString::number(2*S), QString::number(S)) ;
|
||||
).arg(QString::number(4*W), QString::number(2*W)) ;
|
||||
|
||||
registerHelpButton(ui.helpButton,help_str,"ChatLobbyDialog") ;
|
||||
|
||||
ui.lobbyTreeWidget->setIconSize(QSize(S*1.5,S*1.5));
|
||||
registerHelpButton(ui.helpButton,help_str,"ChatLobbyDialog") ;
|
||||
|
||||
ui.lobbyTreeWidget->setIconSize(QSize(H*1.5,H*1.5));
|
||||
}
|
||||
|
||||
ChatLobbyWidget::~ChatLobbyWidget()
|
||||
@ -232,7 +243,7 @@ ChatLobbyWidget::~ChatLobbyWidget()
|
||||
UserNotify *ChatLobbyWidget::createUserNotify(QObject *parent)
|
||||
{
|
||||
myChatLobbyUserNotify = new ChatLobbyUserNotify(parent);
|
||||
connect(myChatLobbyUserNotify, SIGNAL(countChanged(ChatLobbyId, uint)), this, SLOT(updateNotify(ChatLobbyId, uint)));
|
||||
connect(myChatLobbyUserNotify, SIGNAL(countChanged(ChatLobbyId,uint)), this, SLOT(updateNotify(ChatLobbyId,uint)));
|
||||
|
||||
return myChatLobbyUserNotify;
|
||||
}
|
||||
|
@ -102,7 +102,7 @@
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="images.qrc">
|
||||
<iconset resource="icons.qrc">
|
||||
<normaloff>:/icons/help_64.png</normaloff>:/icons/help_64.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
@ -191,6 +191,11 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="RSTreeWidget" name="lobbyTreeWidget">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
@ -459,7 +464,7 @@
|
||||
<customwidget>
|
||||
<class>LineEditClear</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>gui/common/LineEditClear.h</header>
|
||||
<header location="global">gui/common/LineEditClear.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>RSTreeWidget</class>
|
||||
@ -468,7 +473,6 @@
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="images.qrc"/>
|
||||
<include location="icons.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
|
@ -169,15 +169,18 @@ IdDialog::IdDialog(QWidget *parent)
|
||||
//connect(mCirclesBroadcastBase, SIGNAL(fillDisplay(bool)), this, SLOT(updateCirclesDisplay(bool)));
|
||||
|
||||
ownItem = new QTreeWidgetItem();
|
||||
ownItem->setText(0, tr("My own identities"));
|
||||
ownItem->setText(RSID_COL_NICKNAME, tr("My own identities"));
|
||||
ownItem->setFont(RSID_COL_NICKNAME, ui->idTreeWidget->font());
|
||||
ownItem->setData(RSID_COL_VOTES, Qt::DecorationRole,0xff); // this is in order to prevent displaying a reputaiton icon next to these items.
|
||||
|
||||
allItem = new QTreeWidgetItem();
|
||||
allItem->setText(0, tr("All"));
|
||||
allItem->setText(RSID_COL_NICKNAME, tr("All"));
|
||||
allItem->setFont(RSID_COL_NICKNAME, ui->idTreeWidget->font());
|
||||
allItem->setData(RSID_COL_VOTES, Qt::DecorationRole,0xff);
|
||||
|
||||
contactsItem = new QTreeWidgetItem();
|
||||
contactsItem->setText(0, tr("My contacts"));
|
||||
contactsItem->setText(RSID_COL_NICKNAME, tr("My contacts"));
|
||||
contactsItem->setFont(RSID_COL_NICKNAME, ui->idTreeWidget->font());
|
||||
contactsItem->setData(RSID_COL_VOTES, Qt::DecorationRole,0xff);
|
||||
|
||||
|
||||
@ -366,6 +369,7 @@ IdDialog::IdDialog(QWidget *parent)
|
||||
ui->idTreeWidget->setColumnWidth(RSID_COL_IDTYPE, 18 * fontWidth);
|
||||
ui->idTreeWidget->setColumnWidth(RSID_COL_VOTES, 2 * fontWidth);
|
||||
|
||||
ui->idTreeWidget->setItemDelegate(new RSElidedItemDelegate());
|
||||
ui->idTreeWidget->setItemDelegateForColumn(
|
||||
RSID_COL_NICKNAME,
|
||||
new GxsIdTreeItemDelegate());
|
||||
@ -648,15 +652,16 @@ void IdDialog::loadCircles(const std::list<RsGroupMetaData>& groupInfo)
|
||||
if(!mExternalOtherCircleItem)
|
||||
{
|
||||
mExternalOtherCircleItem = new QTreeWidgetItem();
|
||||
mExternalOtherCircleItem->setText(0, tr("Other circles"));
|
||||
|
||||
mExternalOtherCircleItem->setText(CIRCLEGROUP_CIRCLE_COL_GROUPNAME, tr("Other circles"));
|
||||
mExternalOtherCircleItem->setFont(CIRCLEGROUP_CIRCLE_COL_GROUPNAME, ui->treeWidget_membership->font());
|
||||
ui->treeWidget_membership->addTopLevelItem(mExternalOtherCircleItem);
|
||||
}
|
||||
|
||||
if(!mExternalBelongingCircleItem )
|
||||
{
|
||||
mExternalBelongingCircleItem = new QTreeWidgetItem();
|
||||
mExternalBelongingCircleItem->setText(0, tr("Circles I belong to"));
|
||||
mExternalBelongingCircleItem->setText(CIRCLEGROUP_CIRCLE_COL_GROUPNAME, tr("Circles I belong to"));
|
||||
mExternalBelongingCircleItem->setFont(CIRCLEGROUP_CIRCLE_COL_GROUPNAME, ui->treeWidget_membership->font());
|
||||
ui->treeWidget_membership->addTopLevelItem(mExternalBelongingCircleItem);
|
||||
}
|
||||
#endif
|
||||
@ -732,14 +737,11 @@ void IdDialog::loadCircles(const std::list<RsGroupMetaData>& groupInfo)
|
||||
|
||||
item->setToolTip(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,tooltip);
|
||||
|
||||
if (am_I_admin)
|
||||
{
|
||||
QFont font = item->font(CIRCLEGROUP_CIRCLE_COL_GROUPNAME) ;
|
||||
font.setBold(true) ;
|
||||
item->setFont(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,font) ;
|
||||
item->setFont(CIRCLEGROUP_CIRCLE_COL_GROUPID,font) ;
|
||||
item->setFont(CIRCLEGROUP_CIRCLE_COL_GROUPFLAGS,font) ;
|
||||
}
|
||||
QFont font = ui->treeWidget_membership->font() ;
|
||||
font.setBold(am_I_admin) ;
|
||||
item->setFont(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,font) ;
|
||||
item->setFont(CIRCLEGROUP_CIRCLE_COL_GROUPID,font) ;
|
||||
item->setFont(CIRCLEGROUP_CIRCLE_COL_GROUPFLAGS,font) ;
|
||||
|
||||
// now determine for this circle wether we have pending invites
|
||||
// we add a sub-item to the circle (to show the invite system info) in the following two cases:
|
||||
@ -854,12 +856,10 @@ void IdDialog::loadCircles(const std::list<RsGroupMetaData>& groupInfo)
|
||||
subitem->setData(CIRCLEGROUP_CIRCLE_COL_GROUPFLAGS, Qt::UserRole, QVariant(it->second)) ;
|
||||
subitem->setData(CIRCLEGROUP_CIRCLE_COL_GROUPID, Qt::UserRole, QString::fromStdString(it->first.toStdString())) ;
|
||||
|
||||
//subitem->setIcon(RSID_COL_NICKNAME, QIcon(pixmap));
|
||||
|
||||
new_sub_items.push_back(subitem);
|
||||
new_sub_items.push_back(subitem);
|
||||
}
|
||||
else
|
||||
subitem = item->child(subitem_index);
|
||||
else
|
||||
subitem = item->child(subitem_index);
|
||||
|
||||
if(invited && !subscrb)
|
||||
{
|
||||
@ -878,15 +878,12 @@ void IdDialog::loadCircles(const std::list<RsGroupMetaData>& groupInfo)
|
||||
if(invited && subscrb)
|
||||
subitem->setText(CIRCLEGROUP_CIRCLE_COL_GROUPID, tr("Member")) ;
|
||||
|
||||
if (is_own_id)
|
||||
{
|
||||
QFont font = subitem->font(CIRCLEGROUP_CIRCLE_COL_GROUPNAME) ;
|
||||
font.setBold(true) ;
|
||||
subitem->setFont(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,font) ;
|
||||
subitem->setFont(CIRCLEGROUP_CIRCLE_COL_GROUPID,font) ;
|
||||
subitem->setFont(CIRCLEGROUP_CIRCLE_COL_GROUPFLAGS,font) ;
|
||||
}
|
||||
}
|
||||
QFont font = ui->treeWidget_membership->font() ;
|
||||
font.setBold(is_own_id) ;
|
||||
subitem->setFont(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,font) ;
|
||||
subitem->setFont(CIRCLEGROUP_CIRCLE_COL_GROUPID,font) ;
|
||||
subitem->setFont(CIRCLEGROUP_CIRCLE_COL_GROUPFLAGS,font) ;
|
||||
}
|
||||
|
||||
// add all items
|
||||
item->addChildren(new_sub_items);
|
||||
@ -1389,73 +1386,42 @@ bool IdDialog::fillIdListItem(const RsGxsIdGroup& data, QTreeWidgetItem *&item,
|
||||
uint32_t item_flags = 0;
|
||||
|
||||
/* do filtering */
|
||||
bool ok = false;
|
||||
if (data.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID_kept_for_compatibility)
|
||||
{
|
||||
if (isLinkedToOwnNode && (accept & RSID_FILTER_YOURSELF))
|
||||
{
|
||||
ok = true;
|
||||
item_flags |= RSID_FILTER_YOURSELF ;
|
||||
}
|
||||
{
|
||||
if (isLinkedToOwnNode && (accept & RSID_FILTER_YOURSELF))
|
||||
item_flags |= RSID_FILTER_YOURSELF ;
|
||||
|
||||
if (data.mPgpKnown && (accept & RSID_FILTER_FRIENDS))
|
||||
{
|
||||
ok = true;
|
||||
item_flags |= RSID_FILTER_FRIENDS ;
|
||||
}
|
||||
if (data.mPgpKnown && (accept & RSID_FILTER_FRIENDS))
|
||||
item_flags |= RSID_FILTER_FRIENDS ;
|
||||
|
||||
if (accept & RSID_FILTER_OTHERS)
|
||||
{
|
||||
ok = true;
|
||||
item_flags |= RSID_FILTER_OTHERS ;
|
||||
}
|
||||
}
|
||||
else if (accept & RSID_FILTER_PSEUDONYMS)
|
||||
{
|
||||
ok = true;
|
||||
item_flags |= RSID_FILTER_PSEUDONYMS ;
|
||||
}
|
||||
if (accept & RSID_FILTER_OTHERS)
|
||||
item_flags |= RSID_FILTER_OTHERS ;
|
||||
}
|
||||
else if (accept & RSID_FILTER_PSEUDONYMS)
|
||||
item_flags |= RSID_FILTER_PSEUDONYMS ;
|
||||
|
||||
if (isOwnId && (accept & RSID_FILTER_OWNED_BY_YOU))
|
||||
{
|
||||
ok = true;
|
||||
item_flags |= RSID_FILTER_OWNED_BY_YOU ;
|
||||
}
|
||||
if (isOwnId && (accept & RSID_FILTER_OWNED_BY_YOU))
|
||||
item_flags |= RSID_FILTER_OWNED_BY_YOU ;
|
||||
|
||||
if (isBanned && (accept & RSID_FILTER_BANNED))
|
||||
{
|
||||
ok = true;
|
||||
item_flags |= RSID_FILTER_BANNED ;
|
||||
}
|
||||
|
||||
if (!ok)
|
||||
if (item_flags == 0)
|
||||
return false;
|
||||
|
||||
if (!item)
|
||||
{
|
||||
item = new TreeWidgetItem();
|
||||
}
|
||||
|
||||
item = new TreeWidgetItem();
|
||||
|
||||
|
||||
item->setText(RSID_COL_NICKNAME, QString::fromUtf8(data.mMeta.mGroupName.c_str()).left(RSID_MAXIMUM_NICKNAME_SIZE));
|
||||
item->setData(RSID_COL_NICKNAME, Qt::UserRole, QString::fromStdString(data.mMeta.mGroupId.toStdString()));
|
||||
item->setText(RSID_COL_KEYID, QString::fromStdString(data.mMeta.mGroupId.toStdString()));
|
||||
|
||||
if(isBanned)
|
||||
{
|
||||
//TODO (Phenom): Add qproperty for these text colors in stylesheets
|
||||
item->setData(RSID_COL_NICKNAME, Qt::ForegroundRole, QColor(Qt::red));
|
||||
item->setData(RSID_COL_KEYID , Qt::ForegroundRole, QColor(Qt::red));
|
||||
item->setData(RSID_COL_IDTYPE , Qt::ForegroundRole, QColor(Qt::red));
|
||||
item->setData(RSID_COL_VOTES , Qt::ForegroundRole, QColor(Qt::red));
|
||||
}
|
||||
else
|
||||
{
|
||||
item->setData(RSID_COL_NICKNAME, Qt::ForegroundRole, QVariant());
|
||||
item->setData(RSID_COL_KEYID , Qt::ForegroundRole, QVariant());
|
||||
item->setData(RSID_COL_IDTYPE , Qt::ForegroundRole, QVariant());
|
||||
item->setData(RSID_COL_VOTES , Qt::ForegroundRole, QVariant());
|
||||
}
|
||||
//TODO (Phenom): Add qproperty for these text colors in stylesheets
|
||||
item->setData(RSID_COL_NICKNAME, Qt::ForegroundRole, isBanned ? QColor(Qt::red) : QVariant() );
|
||||
item->setData(RSID_COL_KEYID , Qt::ForegroundRole, isBanned ? QColor(Qt::red) : QVariant() );
|
||||
item->setData(RSID_COL_IDTYPE , Qt::ForegroundRole, isBanned ? QColor(Qt::red) : QVariant() );
|
||||
item->setData(RSID_COL_VOTES , Qt::ForegroundRole, isBanned ? QColor(Qt::red) : QVariant() );
|
||||
|
||||
item->setData(RSID_COL_KEYID, Qt::UserRole,QVariant(item_flags)) ;
|
||||
item->setTextAlignment(RSID_COL_VOTES, Qt::AlignRight | Qt::AlignVCenter);
|
||||
@ -1466,16 +1432,9 @@ bool IdDialog::fillIdListItem(const RsGxsIdGroup& data, QTreeWidgetItem *&item,
|
||||
RSID_COL_VOTES,SortRole,
|
||||
static_cast<uint32_t>(idd.mReputation.mOverallReputationLevel));
|
||||
|
||||
if(isOwnId)
|
||||
{
|
||||
QFont font = item->font(RSID_COL_NICKNAME) ;
|
||||
|
||||
font.setBold(true) ;
|
||||
item->setFont(RSID_COL_NICKNAME,font) ;
|
||||
item->setFont(RSID_COL_IDTYPE,font) ;
|
||||
item->setFont(RSID_COL_KEYID,font) ;
|
||||
|
||||
QString tooltip = tr("This identity is owned by you");
|
||||
if(isOwnId)
|
||||
{
|
||||
QString tooltip = tr("This identity is owned by you");
|
||||
|
||||
if(idd.mFlags & RS_IDENTITY_FLAGS_IS_DEPRECATED)
|
||||
{
|
||||
@ -1487,10 +1446,16 @@ bool IdDialog::fillIdListItem(const RsGxsIdGroup& data, QTreeWidgetItem *&item,
|
||||
tooltip += tr("\nThis identity has a unsecure fingerprint (It's probably quite old).\nYou should get rid of it now and use a new one.\nThese identities will soon be not supported anymore.") ;
|
||||
}
|
||||
|
||||
item->setToolTip(RSID_COL_NICKNAME, tooltip) ;
|
||||
item->setToolTip(RSID_COL_KEYID, tooltip) ;
|
||||
item->setToolTip(RSID_COL_IDTYPE, tooltip) ;
|
||||
}
|
||||
item->setToolTip(RSID_COL_NICKNAME, tooltip) ;
|
||||
item->setToolTip(RSID_COL_KEYID, tooltip) ;
|
||||
item->setToolTip(RSID_COL_IDTYPE, tooltip) ;
|
||||
}
|
||||
QFont font = ui->idTreeWidget->font() ;
|
||||
font.setBold(isOwnId) ;
|
||||
item->setFont(RSID_COL_NICKNAME,font) ;
|
||||
item->setFont(RSID_COL_IDTYPE,font) ;
|
||||
item->setFont(RSID_COL_KEYID,font) ;
|
||||
|
||||
|
||||
//QPixmap pixmap ;
|
||||
//
|
||||
@ -1501,8 +1466,6 @@ bool IdDialog::fillIdListItem(const RsGxsIdGroup& data, QTreeWidgetItem *&item,
|
||||
// Icon Place Holder
|
||||
item->setIcon(RSID_COL_NICKNAME,FilesDefs::getIconFromQtResourcePath(":/icons/png/anonymous.png"));
|
||||
|
||||
QString tooltip;
|
||||
|
||||
if (data.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID_kept_for_compatibility)
|
||||
{
|
||||
if (data.mPgpKnown)
|
||||
@ -1513,25 +1476,25 @@ bool IdDialog::fillIdListItem(const RsGxsIdGroup& data, QTreeWidgetItem *&item,
|
||||
item->setToolTip(RSID_COL_IDTYPE,"Verified signature from node "+QString::fromStdString(data.mPgpId.toStdString())) ;
|
||||
|
||||
|
||||
tooltip += tr("Node name:")+" " + QString::fromUtf8(details.name.c_str()) + "\n";
|
||||
tooltip += tr("Node Id :")+" " + QString::fromStdString(data.mPgpId.toStdString()) ;
|
||||
QString tooltip = tr("Node name:")+" " + QString::fromUtf8(details.name.c_str()) + "\n";
|
||||
tooltip += tr("Node Id :")+" " + QString::fromStdString(data.mPgpId.toStdString()) ;
|
||||
item->setToolTip(RSID_COL_KEYID,tooltip) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
QString txt = tr("[Unknown node]");
|
||||
QString txt = tr("[Unknown node]");
|
||||
item->setText(RSID_COL_IDTYPE, txt);
|
||||
|
||||
if(!data.mPgpId.isNull())
|
||||
{
|
||||
item->setToolTip(RSID_COL_IDTYPE,tr("Unverified signature from node ")+QString::fromStdString(data.mPgpId.toStdString())) ;
|
||||
item->setToolTip(RSID_COL_KEYID,tr("Unverified signature from node ")+QString::fromStdString(data.mPgpId.toStdString())) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
item->setToolTip(RSID_COL_IDTYPE,tr("Unchecked signature")) ;
|
||||
item->setToolTip(RSID_COL_KEYID,tr("Unchecked signature")) ;
|
||||
}
|
||||
|
||||
if(!data.mPgpId.isNull())
|
||||
{
|
||||
item->setToolTip(RSID_COL_IDTYPE,tr("Unverified signature from node ")+QString::fromStdString(data.mPgpId.toStdString())) ;
|
||||
item->setToolTip(RSID_COL_KEYID,tr("Unverified signature from node ")+QString::fromStdString(data.mPgpId.toStdString())) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
item->setToolTip(RSID_COL_IDTYPE,tr("Unchecked signature")) ;
|
||||
item->setToolTip(RSID_COL_KEYID,tr("Unchecked signature")) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -2224,8 +2187,9 @@ void IdDialog::IdListCustomPopupMenu( QPoint )
|
||||
|
||||
if(!one_item_owned_by_you)
|
||||
{
|
||||
QWidget *widget = new QWidget(contextMenu);
|
||||
widget->setStyleSheet( ".QWidget{background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop:0 #FEFEFE, stop:1 #E8E8E8); border: 1px solid #CCCCCC;}");
|
||||
QFrame *widget = new QFrame(contextMenu);
|
||||
widget->setObjectName("gradFrame"); //Use qss
|
||||
//widget->setStyleSheet( ".QWidget{background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop:0 #FEFEFE, stop:1 #E8E8E8); border: 1px solid #CCCCCC;}");
|
||||
|
||||
// create menu header
|
||||
QHBoxLayout *hbox = new QHBoxLayout(widget);
|
||||
@ -2233,12 +2197,14 @@ void IdDialog::IdListCustomPopupMenu( QPoint )
|
||||
hbox->setSpacing(6);
|
||||
|
||||
QLabel *iconLabel = new QLabel(widget);
|
||||
QPixmap pix = FilesDefs::getPixmapFromQtResourcePath(":/images/user/friends24.png").scaledToHeight(QFontMetricsF(iconLabel->font()).height()*1.5);
|
||||
iconLabel->setObjectName("trans_Icon");
|
||||
QPixmap pix = FilesDefs::getPixmapFromQtResourcePath(":/images/user/friends24.png").scaledToHeight(QFontMetricsF(iconLabel->font()).height()*1.5);
|
||||
iconLabel->setPixmap(pix);
|
||||
iconLabel->setMaximumSize(iconLabel->frameSize().height() + pix.height(), pix.width());
|
||||
hbox->addWidget(iconLabel);
|
||||
|
||||
QLabel *textLabel = new QLabel("<strong>" + ui->titleBarLabel->text() + "</strong>", widget);
|
||||
textLabel->setObjectName("trans_Text");
|
||||
hbox->addWidget(textLabel);
|
||||
|
||||
QSpacerItem *spacerItem = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
|
@ -218,6 +218,11 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
@ -1046,6 +1051,11 @@ border-image: url(:/images/closepressed.png)
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="treeWidget_membership">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
|
@ -35,6 +35,9 @@
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="frame_from_GL">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
@ -232,9 +235,15 @@
|
||||
<item row="2" column="0">
|
||||
<widget class="QFrame" name="frame_input">
|
||||
<layout class="QVBoxLayout" name="frame_input_VL">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="textEdit_Pulse">
|
||||
<property name="font">
|
||||
|
@ -14,6 +14,9 @@
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0" rowspan="2">
|
||||
<widget class="QWidget" name="widget_indent" native="true">
|
||||
<property name="enabled">
|
||||
@ -53,7 +56,7 @@
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>MS Sans Serif</family>
|
||||
<pointsize>10</pointsize>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</widget>
|
||||
|
@ -52,6 +52,9 @@
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QWidget" name="widget_prefix" native="true">
|
||||
<property name="sizePolicy">
|
||||
@ -149,6 +152,9 @@
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<property name="leftMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
@ -440,10 +446,22 @@
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_authorName">
|
||||
<property name="font">
|
||||
@ -611,13 +629,19 @@
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_13">
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
|
@ -50,7 +50,7 @@
|
||||
<height>510</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
@ -63,33 +63,48 @@
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="GroupTreeWidget" name="groupTreeWidget" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>150</height>
|
||||
</size>
|
||||
<item row="0" column="0">
|
||||
<widget class="QSplitter" name="splitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="treeWidget_Pages">
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Page Name</string>
|
||||
<widget class="GroupTreeWidget" name="groupTreeWidget" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Page Id</string>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>150</height>
|
||||
</size>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Orig Id</string>
|
||||
</widget>
|
||||
<widget class="QTreeWidget" name="treeWidget_Pages">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Page Name</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Page Id</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Orig Id</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -126,7 +126,11 @@ bool ElidedLabel::paintElidedLine( QPainter* painter, QString plainText
|
||||
to.setWrapMode(wordWrap ? QTextOption::WrapAtWordBoundaryOrAnywhere : QTextOption::NoWrap);
|
||||
textLayout.setTextOption(to);
|
||||
|
||||
if (painter) painter->save();
|
||||
if (painter)
|
||||
{
|
||||
painter->save();
|
||||
painter->setFont(useFont);
|
||||
}
|
||||
textLayout.beginLayout();
|
||||
forever {
|
||||
//Get new line for text.
|
||||
@ -220,10 +224,7 @@ bool ElidedLabel::paintElidedLine( QPainter* painter, QString plainText
|
||||
|
||||
if(width+iTransX+cr.left() <= cr.right())
|
||||
if (painter)
|
||||
{
|
||||
painter->setFont(useFont);
|
||||
painter->drawText(QPoint(iTransX + cr.left(), y + fontMetrics.ascent() + cr.top()), elidedLastLine);
|
||||
}
|
||||
|
||||
//Draw button to get ToolTip
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5,11,0)
|
||||
|
@ -55,6 +55,7 @@
|
||||
#include "gui/chat/ChatUserNotify.h"
|
||||
#include "gui/connect/ConnectProgressDialog.h"
|
||||
#include "gui/common/ElidedLabel.h"
|
||||
#include "gui/common/FilesDefs.h"
|
||||
|
||||
#include "FriendList.h"
|
||||
#include "ui_FriendList.h"
|
||||
@ -297,8 +298,9 @@ void FriendList::peerTreeWidgetCustomPopupMenu()
|
||||
|
||||
QMenu *contextMenu = new QMenu(this);
|
||||
|
||||
QWidget *widget = new QWidget(contextMenu);
|
||||
widget->setStyleSheet( ".QWidget{background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop:0 #FEFEFE, stop:1 #E8E8E8); border: 1px solid #CCCCCC;}");
|
||||
QFrame *widget = new QFrame(contextMenu);
|
||||
widget->setObjectName("gradFrame"); //Use qss
|
||||
//widget->setStyleSheet( ".QWidget{background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop:0 #FEFEFE, stop:1 #E8E8E8); border: 1px solid #CCCCCC;}");
|
||||
|
||||
// create menu header
|
||||
QHBoxLayout *hbox = new QHBoxLayout(widget);
|
||||
@ -306,12 +308,14 @@ void FriendList::peerTreeWidgetCustomPopupMenu()
|
||||
hbox->setSpacing(6);
|
||||
|
||||
QLabel *iconLabel = new QLabel(widget);
|
||||
iconLabel->setObjectName("trans_Icon");
|
||||
QPixmap pix = FilesDefs::getPixmapFromQtResourcePath(":/images/user/friends24.png").scaledToHeight(QFontMetricsF(iconLabel->font()).height()*1.5);
|
||||
iconLabel->setPixmap(pix);
|
||||
iconLabel->setMaximumSize(iconLabel->frameSize().height() + pix.height(), pix.width());
|
||||
hbox->addWidget(iconLabel);
|
||||
|
||||
QLabel *textLabel = new QLabel("<strong>RetroShare</strong>", widget);
|
||||
textLabel->setObjectName("trans_Text");
|
||||
hbox->addWidget(textLabel);
|
||||
|
||||
QSpacerItem *spacerItem = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
|
@ -60,16 +60,25 @@ GroupTreeWidget::GroupTreeWidget(QWidget *parent) :
|
||||
connect(ui->filterLineEdit, SIGNAL(filterChanged(int)), this, SLOT(filterChanged()));
|
||||
|
||||
connect(ui->treeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(customContextMenuRequested(QPoint)));
|
||||
connect(ui->treeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), this, SLOT(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)));
|
||||
connect(ui->treeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)));
|
||||
connect(ui->treeWidget, SIGNAL(itemActivated(QTreeWidgetItem*,int)), this, SLOT(itemActivated(QTreeWidgetItem*,int)));
|
||||
if (!style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, NULL, this)) {
|
||||
// need signal itemClicked too
|
||||
connect(ui->treeWidget, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(itemActivated(QTreeWidgetItem*,int)));
|
||||
}
|
||||
|
||||
int H = QFontMetricsF(ui->treeWidget->font()).height() ;
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5,11,0)
|
||||
int W = QFontMetricsF(ui->treeWidget->font()).width("_") ;
|
||||
int D = QFontMetricsF(ui->treeWidget->font()).width("9999-99-99[]") ;
|
||||
#else
|
||||
int W = QFontMetricsF(ui->treeWidget->font()).horizontalAdvance("_") ;
|
||||
int D = QFontMetricsF(ui->treeWidget->font()).horizontalAdvance("9999-99-99[]") ;
|
||||
#endif
|
||||
|
||||
/* Add own item delegate */
|
||||
RSElidedItemDelegate *itemDelegate = new RSElidedItemDelegate(this);
|
||||
itemDelegate->setSpacing(QSize(0, 2));
|
||||
itemDelegate->setSpacing(QSize(W/2, H/4));
|
||||
ui->treeWidget->setItemDelegate(itemDelegate);
|
||||
|
||||
/* Set compare role for each column */
|
||||
@ -87,10 +96,6 @@ GroupTreeWidget::GroupTreeWidget(QWidget *parent) :
|
||||
ui->treeWidget->enableColumnCustomize(true);
|
||||
ui->treeWidget->setColumnCustomizable(GTW_COLUMN_NAME, false);
|
||||
|
||||
int S = QFontMetricsF(font()).height() ;
|
||||
int W = QFontMetricsF(font()).width("_") ;
|
||||
int D = QFontMetricsF(font()).width("9999-99-99[]") ;
|
||||
|
||||
QTreeWidgetItem *headerItem = ui->treeWidget->headerItem();
|
||||
headerItem->setText(GTW_COLUMN_NAME, tr("Name"));
|
||||
headerItem->setText(GTW_COLUMN_UNREAD, "");
|
||||
@ -143,7 +148,7 @@ GroupTreeWidget::GroupTreeWidget(QWidget *parent) :
|
||||
|
||||
connect(ui->distantSearchLineEdit,SIGNAL(returnPressed()),this,SLOT(distantSearch())) ;
|
||||
|
||||
ui->treeWidget->setIconSize(QSize(S*1.8,S*1.8));
|
||||
ui->treeWidget->setIconSize(QSize(H*1.8,H*1.8));
|
||||
}
|
||||
|
||||
GroupTreeWidget::~GroupTreeWidget()
|
||||
@ -205,9 +210,9 @@ void GroupTreeWidget::updateColors()
|
||||
|
||||
int color = item->data(GTW_COLUMN_DATA, ROLE_COLOR).toInt();
|
||||
if (color >= 0) {
|
||||
item->setData(GTW_COLUMN_NAME, Qt::TextColorRole, mTextColor[color]);
|
||||
item->setData(GTW_COLUMN_NAME, Qt::ForegroundRole, mTextColor[color]);
|
||||
} else {
|
||||
item->setData(GTW_COLUMN_NAME, Qt::TextColorRole, QVariant());
|
||||
item->setData(GTW_COLUMN_NAME, Qt::ForegroundRole, QVariant());
|
||||
}
|
||||
|
||||
}
|
||||
@ -246,7 +251,6 @@ void GroupTreeWidget::itemActivated(QTreeWidgetItem *item, int column)
|
||||
|
||||
QTreeWidgetItem *GroupTreeWidget::addCategoryItem(const QString &name, const QIcon &icon, bool expand, int sortOrder /*= -1*/)
|
||||
{
|
||||
QFont font;
|
||||
RSTreeWidgetItem *item = new RSTreeWidgetItem();
|
||||
ui->treeWidget->addTopLevelItem(item);
|
||||
// To get StyleSheet for Items
|
||||
@ -255,15 +259,16 @@ QTreeWidgetItem *GroupTreeWidget::addCategoryItem(const QString &name, const QIc
|
||||
|
||||
item->setText(GTW_COLUMN_NAME, name);
|
||||
item->setData(GTW_COLUMN_DATA, ROLE_NAME, name);
|
||||
font = item->font(GTW_COLUMN_NAME);
|
||||
font.setBold(true);
|
||||
item->setFont(GTW_COLUMN_NAME, font);
|
||||
QFont itFont = item->font(GTW_COLUMN_NAME);
|
||||
itFont.setBold(true);
|
||||
itFont.setPointSize(ui->treeWidget->font().pointSize()); //use treeWidget font size defined in ui.
|
||||
item->setFont(GTW_COLUMN_NAME, itFont);
|
||||
item->setIcon(GTW_COLUMN_NAME, icon);
|
||||
|
||||
int S = QFontMetricsF(font).height();
|
||||
//int S = QFontMetricsF(itFont).height();
|
||||
|
||||
item->setSizeHint(GTW_COLUMN_NAME, QSize(S*1.9, S*1.9));
|
||||
item->setData(GTW_COLUMN_NAME, Qt::TextColorRole, textColorCategory());
|
||||
//item->setSizeHint(GTW_COLUMN_NAME, QSize(S*1.9, S*1.9)); //size hint is calculated by item delegate. Use itemDelegate->setSpacing() in constructor.
|
||||
item->setData(GTW_COLUMN_NAME, Qt::ForegroundRole, textColorCategory());
|
||||
item->setData(GTW_COLUMN_DATA, ROLE_COLOR, GROUPTREEWIDGET_COLOR_CATEGORY);
|
||||
|
||||
item->setExpanded(expand);
|
||||
@ -385,6 +390,7 @@ void GroupTreeWidget::fillGroupItems(QTreeWidgetItem *categoryItem, const QList<
|
||||
if (item == NULL) {
|
||||
item = new RSTreeWidgetItem(compareRole);
|
||||
item->setData(GTW_COLUMN_DATA, ROLE_ID, itemInfo.id);
|
||||
item->setFont(GTW_COLUMN_DATA, ui->treeWidget->font());
|
||||
//static_cast<RSTreeWidgetItem*>(item)->setNoDataAsLast(true); //Uncomment this to sort data with QVariant() always at end.
|
||||
categoryItem->addChild(item);
|
||||
}
|
||||
@ -506,18 +512,18 @@ void GroupTreeWidget::setUnreadCount(QTreeWidgetItem *item, int unreadCount)
|
||||
return;
|
||||
}
|
||||
|
||||
QFont font = item->font(GTW_COLUMN_NAME);
|
||||
QFont itFont = item->font(GTW_COLUMN_NAME);
|
||||
|
||||
if (unreadCount) {
|
||||
item->setText(GTW_COLUMN_UNREAD, QString::number(unreadCount));
|
||||
font.setBold(true);
|
||||
itFont.setBold(true);
|
||||
} else {
|
||||
item->setText(GTW_COLUMN_UNREAD, "");
|
||||
font.setBold(false);
|
||||
itFont.setBold(false);
|
||||
}
|
||||
item->setData(GTW_COLUMN_UNREAD, ROLE_SORT, unreadCount);
|
||||
|
||||
item->setFont(GTW_COLUMN_NAME, font);
|
||||
item->setFont(GTW_COLUMN_NAME, itFont);
|
||||
}
|
||||
|
||||
QTreeWidgetItem *GroupTreeWidget::getItemFromId(const QString &id)
|
||||
|
@ -70,6 +70,11 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
|
@ -184,6 +184,13 @@ NewFriendList::NewFriendList(QWidget */*parent*/) : /* RsAutoUpdatePage(5000,par
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
int H = QFontMetricsF(ui->peerTreeWidget->font()).height();
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5,11,0)
|
||||
int W = QFontMetricsF(ui->peerTreeWidget->font()).width("_");
|
||||
#else
|
||||
int W = QFontMetricsF(ui->peerTreeWidget->font()).horizontalAdvance("_");
|
||||
#endif
|
||||
|
||||
ui->filterLineEdit->setPlaceholderText(tr("Search")) ;
|
||||
ui->filterLineEdit->showFilterIcon();
|
||||
|
||||
@ -205,7 +212,9 @@ NewFriendList::NewFriendList(QWidget */*parent*/) : /* RsAutoUpdatePage(5000,par
|
||||
mProxyModel->setFilterRegExp(QRegExp(RsFriendListModel::FilterString));
|
||||
|
||||
ui->peerTreeWidget->setModel(mProxyModel);
|
||||
ui->peerTreeWidget->setItemDelegate(new RSElidedItemDelegate());
|
||||
RSElidedItemDelegate *itemDelegate = new RSElidedItemDelegate(this);
|
||||
itemDelegate->setSpacing(QSize(W/2, H/4));
|
||||
ui->peerTreeWidget->setItemDelegate(itemDelegate);
|
||||
ui->peerTreeWidget->setWordWrap(false);
|
||||
|
||||
/* Add filter actions */
|
||||
@ -228,17 +237,13 @@ NewFriendList::NewFriendList(QWidget */*parent*/) : /* RsAutoUpdatePage(5000,par
|
||||
QShortcut *Shortcut = new QShortcut(QKeySequence(Qt::Key_Delete), ui->peerTreeWidget, 0, 0, Qt::WidgetShortcut);
|
||||
connect(Shortcut, SIGNAL(activated()), this, SLOT(removeItem()),Qt::QueuedConnection);
|
||||
|
||||
QFontMetricsF fontMetrics(ui->peerTreeWidget->font());
|
||||
/* Set initial column width */
|
||||
ui->peerTreeWidget->setColumnWidth(RsFriendListModel::COLUMN_THREAD_NAME , 22 * W);
|
||||
ui->peerTreeWidget->setColumnWidth(RsFriendListModel::COLUMN_THREAD_IP , 15 * W);
|
||||
ui->peerTreeWidget->setColumnWidth(RsFriendListModel::COLUMN_THREAD_ID , 32 * W);
|
||||
ui->peerTreeWidget->setColumnWidth(RsFriendListModel::COLUMN_THREAD_LAST_CONTACT, 12 * W);
|
||||
|
||||
/* Set initial column width */
|
||||
int fontWidth = fontMetrics.width("W");
|
||||
ui->peerTreeWidget->setColumnWidth(RsFriendListModel::COLUMN_THREAD_NAME , 22 * fontWidth);
|
||||
ui->peerTreeWidget->setColumnWidth(RsFriendListModel::COLUMN_THREAD_IP , 15 * fontWidth);
|
||||
ui->peerTreeWidget->setColumnWidth(RsFriendListModel::COLUMN_THREAD_ID , 32 * fontWidth);
|
||||
ui->peerTreeWidget->setColumnWidth(RsFriendListModel::COLUMN_THREAD_LAST_CONTACT, 12 * fontWidth);
|
||||
|
||||
int avatarHeight = fontMetrics.height() * 2;
|
||||
ui->peerTreeWidget->setIconSize(QSize(avatarHeight, avatarHeight));
|
||||
ui->peerTreeWidget->setIconSize(QSize(H*2, H*2));
|
||||
|
||||
mModel->checkInternalData(true);
|
||||
|
||||
@ -301,8 +306,9 @@ void NewFriendList::headerContextMenuRequested(QPoint /*p*/)
|
||||
{
|
||||
QMenu displayMenu(tr("Show Items"), this);
|
||||
|
||||
QWidget *widget = new QWidget(&displayMenu);
|
||||
widget->setStyleSheet( ".QWidget{background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop:0 #FEFEFE, stop:1 #E8E8E8); border: 1px solid #CCCCCC;}");
|
||||
QFrame *widget = new QFrame(&displayMenu);
|
||||
widget->setObjectName("gradFrame"); //Use qss
|
||||
//widget->setStyleSheet( ".QWidget{background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop:0 #FEFEFE, stop:1 #E8E8E8); border: 1px solid #CCCCCC;}");
|
||||
|
||||
// create menu header
|
||||
QHBoxLayout *hbox = new QHBoxLayout(widget);
|
||||
@ -310,12 +316,14 @@ void NewFriendList::headerContextMenuRequested(QPoint /*p*/)
|
||||
hbox->setSpacing(6);
|
||||
|
||||
QLabel *iconLabel = new QLabel(widget);
|
||||
iconLabel->setObjectName("trans_Icon");
|
||||
QPixmap pix = FilesDefs::getPixmapFromQtResourcePath(":/images/user/friends24.png").scaledToHeight(QFontMetricsF(iconLabel->font()).height()*1.5);
|
||||
iconLabel->setPixmap(pix);
|
||||
iconLabel->setMaximumSize(iconLabel->frameSize().height() + pix.height(), pix.width());
|
||||
hbox->addWidget(iconLabel);
|
||||
|
||||
QLabel *textLabel = new QLabel("<strong>Show/hide...</strong>", widget);
|
||||
textLabel->setObjectName("trans_Text");
|
||||
hbox->addWidget(textLabel);
|
||||
|
||||
QSpacerItem *spacerItem = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
@ -564,8 +572,9 @@ void NewFriendList::peerTreeWidgetCustomPopupMenu()
|
||||
|
||||
QMenu contextMenu(this);
|
||||
|
||||
QWidget *widget = new QWidget(&contextMenu);
|
||||
widget->setStyleSheet( ".QWidget{background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop:0 #FEFEFE, stop:1 #E8E8E8); border: 1px solid #CCCCCC;}");
|
||||
QFrame *widget = new QFrame();
|
||||
widget->setObjectName("gradFrame"); //Use qss
|
||||
//widget->setStyleSheet( ".QWidget{background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop:0 #FEFEFE, stop:1 #E8E8E8); border: 1px solid #CCCCCC;}");
|
||||
|
||||
// create menu header
|
||||
QHBoxLayout *hbox = new QHBoxLayout(widget);
|
||||
@ -573,12 +582,14 @@ void NewFriendList::peerTreeWidgetCustomPopupMenu()
|
||||
hbox->setSpacing(6);
|
||||
|
||||
QLabel *iconLabel = new QLabel(widget);
|
||||
iconLabel->setObjectName("trans_Icon");
|
||||
QPixmap pix = FilesDefs::getPixmapFromQtResourcePath(":/images/user/friends24.png").scaledToHeight(QFontMetricsF(iconLabel->font()).height()*1.5);
|
||||
iconLabel->setPixmap(pix);
|
||||
iconLabel->setMaximumSize(iconLabel->frameSize().height() + pix.height(), pix.width());
|
||||
hbox->addWidget(iconLabel);
|
||||
|
||||
QLabel *textLabel = new QLabel("<strong>Friend list</strong>", widget);
|
||||
textLabel->setObjectName("trans_Text");
|
||||
hbox->addWidget(textLabel);
|
||||
|
||||
QSpacerItem *spacerItem = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
|
@ -51,7 +51,7 @@ QTreeView::item:hover, QTreeWidget::item:hover, QListWidget::item:hover{
|
||||
color: #0000EF;
|
||||
background-color: #FEDCBA;
|
||||
}
|
||||
QQTreeView::item:selected:hover, TreeWidget::item:selected:hover, QListWidget::item:selected:hover{
|
||||
QTreeView::item:selected:hover, QTreeWidget::item:selected:hover, QListWidget::item:selected:hover{
|
||||
color: #ABCDEF;
|
||||
background-color: #FE0000;
|
||||
}
|
||||
@ -88,7 +88,12 @@ QSize RSElidedItemDelegate::sizeHint(const QStyleOptionViewItem &option, const Q
|
||||
|
||||
QSize contSize = ownStyle->sizeFromContents( QStyle::CT_ItemViewItem,&ownOption
|
||||
,QSize( checkRect.width()+iconRect.width()+textRect.width()
|
||||
,qMax(checkRect.height(),qMax(iconRect.height(),textRect.height()))),widget);
|
||||
, qMax(checkRect.height(),qMax(iconRect.height(),textRect.height()))
|
||||
), widget ) ;
|
||||
|
||||
contSize += QSize( 2*spacing().width()
|
||||
, qMax(checkRect.height(),iconRect.height()) > textRect.height()
|
||||
? 0 : 2*spacing().height() );
|
||||
|
||||
return contSize;
|
||||
}
|
||||
@ -97,7 +102,7 @@ inline QColor getImagePixelColor(QImage img, int x, int y)
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5,6,0)
|
||||
#ifdef DEBUG_EID_PAINT
|
||||
// RsDbg() << " RSEID: Found Color " << img.pixelColor(x,y).name(QColor::HexArgb).toStdString() << " at " << x << "," << y << std::endl;
|
||||
//RsDbg(" RSEID: Found Color ", img.pixelColor(x,y).name(QColor::HexArgb).toStdString(), " at ", x, ",", y);
|
||||
#endif
|
||||
return img.pixelColor(x,y);
|
||||
#else
|
||||
@ -109,7 +114,7 @@ void RSElidedItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
|
||||
{
|
||||
if(!index.isValid())
|
||||
{
|
||||
RsErr() << __PRETTY_FUNCTION__ << " attempt to draw an invalid index." << std::endl;
|
||||
RS_ERR(" attempt to draw an invalid index.");
|
||||
return ;
|
||||
}
|
||||
painter->save();
|
||||
@ -120,7 +125,7 @@ void RSElidedItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
|
||||
ownOption.icon = option.icon;
|
||||
|
||||
#ifdef DEBUG_EID_PAINT
|
||||
RsDbg() << __PRETTY_FUNCTION__ << std::endl << " RSEID: Enter for item with text:" << ownOption.text.toStdString() << std::endl;
|
||||
RS_DBG("\n RSEID: Enter for item with text:", ownOption.text.toStdString());
|
||||
#endif
|
||||
|
||||
const QWidget* widget = option.widget;
|
||||
@ -139,16 +144,16 @@ void RSElidedItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
|
||||
ownOption.fontMetrics = QFontMetrics(font);
|
||||
#ifdef DEBUG_EID_PAINT
|
||||
QFontInfo info(font);
|
||||
RsDbg() << " RSEID: Found font in model:" << info.family().toStdString() << std::endl;
|
||||
RsDbg(" RSEID: Found font in model:", info.family().toStdString());
|
||||
#endif
|
||||
}
|
||||
// Get Text color from model if one exists
|
||||
QColor textColor;
|
||||
if (index.data(Qt::TextColorRole).isValid()) {
|
||||
if (index.data(Qt::ForegroundRole).isValid()) {
|
||||
//textColor = QColor(index.data(Qt::TextColorRole).toString());//Needs to pass from string else loose RBG format.
|
||||
textColor = index.data(Qt::TextColorRole).value<QColor>();
|
||||
textColor = index.data(Qt::ForegroundRole).value<QColor>();
|
||||
#ifdef DEBUG_EID_PAINT
|
||||
RsDbg() << " RSEID: Found text color in model:" << textColor.name().toStdString() << std::endl;
|
||||
RsDbg(" RSEID: Found text color in model:", textColor.name().toStdString());
|
||||
#endif
|
||||
}
|
||||
// Get Brush from model if one exists
|
||||
@ -157,7 +162,7 @@ void RSElidedItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
|
||||
if (index.data(Qt::BackgroundRole).isValid()) {
|
||||
bgBrush = index.data(Qt::BackgroundRole).value<QBrush>();
|
||||
#ifdef DEBUG_EID_PAINT
|
||||
RsDbg() << " RSEID: Found bg brush in model:" << bgBrush.color().name().toStdString() << std::endl;
|
||||
RsDbg(" RSEID: Found bg brush in model:", bgBrush.color().name().toStdString());
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -165,10 +170,10 @@ void RSElidedItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
|
||||
if ( (bgBrush.color().spec()==QColor::Invalid) || (textColor.spec()!=QColor::Invalid) )
|
||||
{
|
||||
#ifdef DEBUG_EID_PAINT
|
||||
RsDbg() << " RSEID:"
|
||||
<< ((bgBrush.color().spec()==QColor::Invalid) ? " Brush not defined" : "")
|
||||
<< ((textColor.spec()==QColor::Invalid) ? " Text Color not defined" : "")
|
||||
<< " so get it from base image." << std::endl;
|
||||
RsDbg( " RSEID:"
|
||||
, ((bgBrush.color().spec()==QColor::Invalid) ? " Brush not defined" : "")
|
||||
, ((textColor.spec()==QColor::Invalid) ? " Text Color not defined" : "")
|
||||
, " so get it from base image.");
|
||||
#endif
|
||||
// QPalette is not updated by StyleSheet all occurs in internal class. (QRenderRule)
|
||||
// https://code.woboq.org/qt5/qtbase/src/widgets/styles/qstylesheetstyle.cpp.html#4138
|
||||
@ -179,7 +184,7 @@ void RSElidedItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
|
||||
if (moSize.width() <= 20)
|
||||
moSize.setWidth(20);
|
||||
#ifdef DEBUG_EID_PAINT
|
||||
RsDbg() << " RSEID: for item size = " << moSize.width() << "x" << moSize.height() << std::endl;
|
||||
RsDbg(" RSEID: for item size = ", moSize.width(), "x", moSize.height());
|
||||
#endif
|
||||
|
||||
QImage moImg(moSize,QImage::Format_ARGB32);
|
||||
@ -268,14 +273,14 @@ void RSElidedItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
|
||||
{
|
||||
bgBrush = QBrush(moBGColor);
|
||||
#ifdef DEBUG_EID_PAINT
|
||||
RsDbg() << " RSEID: bg brush setted to " << moBGColor.name(QColor::HexArgb).toStdString() << std::endl;
|
||||
RsDbg(" RSEID: bg brush setted to ", moBGColor.name(QColor::HexArgb).toStdString());
|
||||
#endif
|
||||
}
|
||||
if (textColor.spec()==QColor::Invalid)
|
||||
{
|
||||
textColor = moColor;
|
||||
#ifdef DEBUG_EID_PAINT
|
||||
RsDbg() << " RSEID: text color setted to " << moColor.name(QColor::HexArgb).toStdString() << std::endl;
|
||||
RsDbg(" RSEID: text color setted to ", moColor.name(QColor::HexArgb).toStdString());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -389,7 +394,7 @@ void RSElidedItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
|
||||
}
|
||||
painter->restore();
|
||||
#ifdef DEBUG_EID_PAINT
|
||||
RsDbg() << " RSEID: Finished" << std::endl;
|
||||
RsDbg(" RSEID: Finished");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -253,8 +253,9 @@ QMenu *RSTreeWidget::createStandardContextMenu(QMenu *contextMenu)
|
||||
}
|
||||
|
||||
if(!mContextMenuActions.isEmpty() || !mContextMenuMenus.isEmpty() || mEnableColumnCustomize) {
|
||||
QWidget *widget = new QWidget(contextMenu);
|
||||
widget->setStyleSheet( ".QWidget{background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop:0 #FEFEFE, stop:1 #E8E8E8); border: 1px solid #CCCCCC;}");
|
||||
QFrame *widget = new QFrame(contextMenu);
|
||||
widget->setObjectName("gradFrame"); //Use qss
|
||||
//widget->setStyleSheet( ".QWidget{background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop:0 #FEFEFE, stop:1 #E8E8E8); border: 1px solid #CCCCCC;}");
|
||||
|
||||
// create menu header
|
||||
QHBoxLayout *hbox = new QHBoxLayout(widget);
|
||||
@ -262,12 +263,14 @@ QMenu *RSTreeWidget::createStandardContextMenu(QMenu *contextMenu)
|
||||
hbox->setSpacing(6);
|
||||
|
||||
QLabel *iconLabel = new QLabel(widget);
|
||||
QPixmap pix = FilesDefs::getPixmapFromQtResourcePath(":/images/settings.png").scaledToHeight(QFontMetricsF(iconLabel->font()).height()*1.5);
|
||||
iconLabel->setObjectName("trans_Icon");
|
||||
QPixmap pix = FilesDefs::getPixmapFromQtResourcePath(":/images/settings.png").scaledToHeight(QFontMetricsF(iconLabel->font()).height()*1.5);
|
||||
iconLabel->setPixmap(pix);
|
||||
iconLabel->setMaximumSize(iconLabel->frameSize().height() + pix.height(), pix.width());
|
||||
hbox->addWidget(iconLabel);
|
||||
|
||||
QLabel *textLabel = new QLabel("<strong>" + tr("Tree View Options") + "</strong>", widget);
|
||||
textLabel->setObjectName("trans_Text");
|
||||
hbox->addWidget(textLabel);
|
||||
|
||||
QSpacerItem *spacerItem = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "gui/common/AvatarDefs.h"
|
||||
#include "gui/common/FilesDefs.h"
|
||||
#include "gui/notifyqt.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
|
||||
#include <retroshare/rsmsgs.h>
|
||||
#include <retroshare/rspeers.h>
|
||||
@ -59,12 +60,13 @@ MsgItem::MsgItem(FeedHolder *parent, uint32_t feedId, const std::string &msgId,
|
||||
//connect( gotoButton, SIGNAL( clicked( void ) ), this, SLOT( gotoHome ( void ) ) );
|
||||
|
||||
/* specific ones */
|
||||
connect(NotifyQt::getInstance(), SIGNAL(messagesChanged()), this, SLOT(checkMessageReadStatus()));
|
||||
connect( playButton, SIGNAL( clicked( void ) ), this, SLOT( playMedia ( void ) ) );
|
||||
connect( deleteButton, SIGNAL( clicked( void ) ), this, SLOT( deleteMsg ( void ) ) );
|
||||
connect( replyButton, SIGNAL( clicked( void ) ), this, SLOT( replyMsg ( void ) ) );
|
||||
connect( sendinviteButton, SIGNAL( clicked( void ) ), this, SLOT( sendInvite ( void ) ) );
|
||||
|
||||
mEventHandlerId = 0;
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) { RsQThreadUtils::postToObject( [this,event]() { handleEvent_main_thread(event); }); }, mEventHandlerId, RsEventType::MAIL_STATUS );
|
||||
|
||||
expandFrame->hide();
|
||||
info_Frame_Invite->hide();
|
||||
@ -73,6 +75,58 @@ MsgItem::MsgItem(FeedHolder *parent, uint32_t feedId, const std::string &msgId,
|
||||
updateItem();
|
||||
}
|
||||
|
||||
MsgItem::~MsgItem()
|
||||
{
|
||||
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||
}
|
||||
|
||||
void MsgItem::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)
|
||||
{
|
||||
if(event->mType != RsEventType::MAIL_STATUS) {
|
||||
return;
|
||||
}
|
||||
|
||||
const RsMailStatusEvent *fe = dynamic_cast<const RsMailStatusEvent*>(event.get());
|
||||
if (!fe) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (fe->mMailStatusEventCode) {
|
||||
case RsMailStatusEventCode::MESSAGE_CHANGED:
|
||||
if (fe->mChangedMsgIds.find(mMsgId) != fe->mChangedMsgIds.end()) {
|
||||
MessageInfo msgInfo;
|
||||
|
||||
if (!rsMail->getMessage(mMsgId, msgInfo)) {
|
||||
removeItem();
|
||||
break;
|
||||
}
|
||||
|
||||
if (!mCloseOnRead) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (msgInfo.msgflags & RS_MSG_NEW) {
|
||||
/* Message status is still "new" */
|
||||
break;
|
||||
}
|
||||
|
||||
removeItem();
|
||||
}
|
||||
break;
|
||||
case RsMailStatusEventCode::MESSAGE_REMOVED:
|
||||
if (fe->mChangedMsgIds.find(mMsgId) != fe->mChangedMsgIds.end()) {
|
||||
removeItem();
|
||||
}
|
||||
break;
|
||||
case RsMailStatusEventCode::MESSAGE_SENT:
|
||||
case RsMailStatusEventCode::NEW_MESSAGE:
|
||||
case RsMailStatusEventCode::TAG_CHANGED:
|
||||
case RsMailStatusEventCode::MESSAGE_RECEIVED_ACK:
|
||||
case RsMailStatusEventCode::SIGNATURE_FAILED:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void MsgItem::updateItemStatic()
|
||||
{
|
||||
/* fill in */
|
||||
@ -246,7 +300,6 @@ void MsgItem::doExpand(bool open)
|
||||
|
||||
mCloseOnRead = false;
|
||||
rsMail->MessageRead(mMsgId, false);
|
||||
mCloseOnRead = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -332,26 +385,6 @@ void MsgItem::toggle()
|
||||
expand(expandFrame->isHidden());
|
||||
}
|
||||
|
||||
void MsgItem::checkMessageReadStatus()
|
||||
{
|
||||
if (!mCloseOnRead) {
|
||||
return;
|
||||
}
|
||||
|
||||
MessageInfo msgInfo;
|
||||
if (!rsMail->getMessage(mMsgId, msgInfo)) {
|
||||
std::cerr << "MsgItem::checkMessageReadStatus() Couldn't find Msg" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (msgInfo.msgflags & RS_MSG_NEW) {
|
||||
/* Message status is still "new" */
|
||||
return;
|
||||
}
|
||||
|
||||
removeItem();
|
||||
}
|
||||
|
||||
void MsgItem::sendInvite()
|
||||
{
|
||||
MessageInfo mi;
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "ui_MsgItem.h"
|
||||
#include "FeedItem.h"
|
||||
#include <stdint.h>
|
||||
#include <retroshare/rsevents.h>
|
||||
|
||||
class FeedHolder;
|
||||
class SubFileItem;
|
||||
@ -35,6 +36,7 @@ class MsgItem : public FeedItem, private Ui::MsgItem
|
||||
public:
|
||||
/** Default Constructor */
|
||||
MsgItem(FeedHolder *parent, uint32_t feedId, const std::string &msgId, bool isHome);
|
||||
virtual ~MsgItem();
|
||||
|
||||
void updateItemStatic();
|
||||
|
||||
@ -46,6 +48,7 @@ protected:
|
||||
|
||||
private:
|
||||
void fillExpandFrame();
|
||||
void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);
|
||||
|
||||
private slots:
|
||||
/* default stuff */
|
||||
@ -56,7 +59,6 @@ private slots:
|
||||
void deleteMsg();
|
||||
void replyMsg();
|
||||
void sendInvite();
|
||||
void checkMessageReadStatus();
|
||||
|
||||
void updateItem();
|
||||
|
||||
@ -66,6 +68,7 @@ private:
|
||||
|
||||
bool mIsHome;
|
||||
bool mCloseOnRead;
|
||||
RsEventsHandlerId_t mEventHandlerId;
|
||||
|
||||
std::list<SubFileItem *> mFileItems;
|
||||
};
|
||||
|
@ -22,13 +22,20 @@
|
||||
#include "MessageUserNotify.h"
|
||||
#include "gui/notifyqt.h"
|
||||
#include "gui/MainWindow.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
|
||||
#include "gui/msgs/MessageInterface.h"
|
||||
|
||||
MessageUserNotify::MessageUserNotify(QObject *parent) :
|
||||
UserNotify(parent)
|
||||
{
|
||||
connect(NotifyQt::getInstance(), SIGNAL(messagesChanged()), this, SLOT(updateIcon()));
|
||||
mEventHandlerId = 0;
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) { RsQThreadUtils::postToObject( [this,event]() { handleEvent_main_thread(event); }); }, mEventHandlerId, RsEventType::MAIL_STATUS );
|
||||
}
|
||||
|
||||
MessageUserNotify::~MessageUserNotify()
|
||||
{
|
||||
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||
}
|
||||
|
||||
bool MessageUserNotify::hasSetting(QString *name, QString *group)
|
||||
@ -72,3 +79,28 @@ void MessageUserNotify::iconClicked()
|
||||
{
|
||||
MainWindow::showWindow(MainWindow::Messages);
|
||||
}
|
||||
|
||||
void MessageUserNotify::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)
|
||||
{
|
||||
if(event->mType != RsEventType::MAIL_STATUS) {
|
||||
return;
|
||||
}
|
||||
|
||||
const RsMailStatusEvent *fe = dynamic_cast<const RsMailStatusEvent*>(event.get());
|
||||
if (!fe) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (fe->mMailStatusEventCode) {
|
||||
case RsMailStatusEventCode::NEW_MESSAGE:
|
||||
case RsMailStatusEventCode::MESSAGE_CHANGED:
|
||||
case RsMailStatusEventCode::MESSAGE_REMOVED:
|
||||
updateIcon();
|
||||
break;
|
||||
case RsMailStatusEventCode::MESSAGE_SENT:
|
||||
case RsMailStatusEventCode::TAG_CHANGED:
|
||||
case RsMailStatusEventCode::MESSAGE_RECEIVED_ACK:
|
||||
case RsMailStatusEventCode::SIGNATURE_FAILED:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,7 @@
|
||||
#ifndef MESSAGEUSERNOTIFY_H
|
||||
#define MESSAGEUSERNOTIFY_H
|
||||
|
||||
#include <retroshare/rsevents.h>
|
||||
#include "gui/common/UserNotify.h"
|
||||
|
||||
class MessageUserNotify : public UserNotify
|
||||
@ -29,6 +30,7 @@ class MessageUserNotify : public UserNotify
|
||||
|
||||
public:
|
||||
MessageUserNotify(QObject *parent = 0);
|
||||
virtual ~MessageUserNotify();
|
||||
|
||||
virtual bool hasSetting(QString *name, QString *group) override;
|
||||
|
||||
@ -41,6 +43,11 @@ private:
|
||||
virtual QString getNotifyMessage(bool plural) override;
|
||||
|
||||
virtual void iconClicked() override;
|
||||
|
||||
void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);
|
||||
|
||||
private:
|
||||
RsEventsHandlerId_t mEventHandlerId;
|
||||
};
|
||||
|
||||
#endif // MESSAGEUSERNOTIFY_H
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include "util/HandleRichText.h"
|
||||
#include "util/DateTime.h"
|
||||
#include "util/QtVersion.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
|
||||
#include <retroshare/rspeers.h>
|
||||
#include <retroshare/rsfiles.h>
|
||||
@ -159,9 +160,6 @@ MessageWidget::MessageWidget(bool controlled, QWidget *parent, Qt::WindowFlags f
|
||||
viewsource->setShortcut(QKeySequence("CTRL+O"));
|
||||
connect(viewsource, SIGNAL(triggered()), this, SLOT(viewSource()));
|
||||
|
||||
connect(NotifyQt::getInstance(), SIGNAL(messagesTagsChanged()), this, SLOT(messagesTagsChanged()));
|
||||
connect(NotifyQt::getInstance(), SIGNAL(messagesChanged()), this, SLOT(messagesChanged()));
|
||||
|
||||
ui.imageBlockWidget->addButtonAction(tr("Load images always for this message"), this, SLOT(loadImagesAlways()), true);
|
||||
ui.msgText->setImageBlockWidget(ui.imageBlockWidget);
|
||||
|
||||
@ -211,6 +209,9 @@ MessageWidget::MessageWidget(bool controlled, QWidget *parent, Qt::WindowFlags f
|
||||
ui.dateText-> setText("");
|
||||
|
||||
ui.info_Frame_Invite->hide();
|
||||
|
||||
mEventHandlerId = 0;
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) { RsQThreadUtils::postToObject( [this,event]() { handleEvent_main_thread(event); }); }, mEventHandlerId, RsEventType::MAIL_STATUS );
|
||||
}
|
||||
|
||||
MessageWidget::~MessageWidget()
|
||||
@ -218,6 +219,47 @@ MessageWidget::~MessageWidget()
|
||||
if (isControlled == false) {
|
||||
processSettings("MessageWidget", false);
|
||||
}
|
||||
|
||||
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||
}
|
||||
|
||||
void MessageWidget::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)
|
||||
{
|
||||
if(event->mType != RsEventType::MAIL_STATUS) {
|
||||
return;
|
||||
}
|
||||
|
||||
const RsMailStatusEvent *fe = dynamic_cast<const RsMailStatusEvent*>(event.get());
|
||||
if (!fe) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (fe->mMailStatusEventCode) {
|
||||
case RsMailStatusEventCode::MESSAGE_REMOVED:
|
||||
if (fe->mChangedMsgIds.find(currMsgId) != fe->mChangedMsgIds.end()) {
|
||||
if (isControlled) {
|
||||
/* processed by MessagesDialog */
|
||||
return;
|
||||
}
|
||||
|
||||
/* messages was removed */
|
||||
if (isWindow) {
|
||||
window()->close();
|
||||
} else {
|
||||
deleteLater();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case RsMailStatusEventCode::TAG_CHANGED:
|
||||
messagesTagsChanged();
|
||||
break;
|
||||
case RsMailStatusEventCode::MESSAGE_SENT:
|
||||
case RsMailStatusEventCode::MESSAGE_CHANGED:
|
||||
case RsMailStatusEventCode::NEW_MESSAGE:
|
||||
case RsMailStatusEventCode::MESSAGE_RECEIVED_ACK:
|
||||
case RsMailStatusEventCode::SIGNATURE_FAILED:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void MessageWidget::connectAction(enumActionType actionType, QToolButton* button)
|
||||
@ -407,25 +449,6 @@ void MessageWidget::messagesTagsChanged()
|
||||
showTagLabels();
|
||||
}
|
||||
|
||||
void MessageWidget::messagesChanged()
|
||||
{
|
||||
if (isControlled) {
|
||||
/* processed by MessagesDialog */
|
||||
return;
|
||||
}
|
||||
|
||||
/* test Message */
|
||||
MessageInfo msgInfo;
|
||||
if (rsMail->getMessage(currMsgId, msgInfo) == false) {
|
||||
/* messages was removed */
|
||||
if (isWindow) {
|
||||
window()->close();
|
||||
} else {
|
||||
deleteLater();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MessageWidget::clearTagLabels()
|
||||
{
|
||||
/* clear all tags */
|
||||
|
@ -22,6 +22,7 @@
|
||||
#define _MESSAGEWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <retroshare/rsevents.h>
|
||||
#include "ui_MessageWidget.h"
|
||||
|
||||
class QToolButton;
|
||||
@ -75,7 +76,6 @@ private slots:
|
||||
|
||||
void msgfilelistWidgetCostumPopupMenu(QPoint);
|
||||
void messagesTagsChanged();
|
||||
void messagesChanged();
|
||||
|
||||
void togglefileview(bool noUpdate = false);
|
||||
void getcurrentrecommended();
|
||||
@ -93,11 +93,14 @@ private:
|
||||
void showTagLabels();
|
||||
void setToolbarButtonStyle(Qt::ToolButtonStyle style);
|
||||
|
||||
void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);
|
||||
|
||||
bool isControlled;
|
||||
bool isWindow;
|
||||
std::string currMsgId;
|
||||
unsigned int currMsgFlags;
|
||||
bool expandFiles;
|
||||
RsEventsHandlerId_t mEventHandlerId;
|
||||
|
||||
QList<QLabel*> tagLabels;
|
||||
|
||||
|
@ -268,9 +268,6 @@ MessagesDialog::MessagesDialog(QWidget *parent)
|
||||
|
||||
registerHelpButton(ui.helpButton,help_str,"MessagesDialog") ;
|
||||
|
||||
connect(NotifyQt::getInstance(), SIGNAL(messagesChanged()), mMessageModel, SLOT(updateMessages()));
|
||||
connect(NotifyQt::getInstance(), SIGNAL(messagesTagsChanged()), this, SLOT(messagesTagsChanged()));
|
||||
|
||||
connect(ui.filterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(filterChanged(QString)));
|
||||
connect(ui.filterLineEdit, SIGNAL(filterChanged(int)), this, SLOT(filterColumnChanged(int)));
|
||||
|
||||
@ -294,6 +291,9 @@ MessagesDialog::MessagesDialog(QWidget *parent)
|
||||
|
||||
mEventHandlerId=0;
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) { RsQThreadUtils::postToObject( [this,event]() { handleEvent_main_thread(event); }); }, mEventHandlerId, RsEventType::MAIL_STATUS );
|
||||
|
||||
mTagEventHandlerId = 0;
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) { RsQThreadUtils::postToObject( [this,event]() { handleTagEvent_main_thread(event); }); }, mEventHandlerId, RsEventType::MAIL_TAG );
|
||||
}
|
||||
|
||||
void MessagesDialog::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)
|
||||
@ -310,9 +310,34 @@ void MessagesDialog::handleEvent_main_thread(std::shared_ptr<const RsEvent> even
|
||||
case RsMailStatusEventCode::MESSAGE_SENT:
|
||||
case RsMailStatusEventCode::MESSAGE_REMOVED:
|
||||
case RsMailStatusEventCode::NEW_MESSAGE:
|
||||
case RsMailStatusEventCode::MESSAGE_CHANGED:
|
||||
case RsMailStatusEventCode::TAG_CHANGED:
|
||||
mMessageModel->updateMessages();
|
||||
updateMessageSummaryList();
|
||||
break;
|
||||
default:
|
||||
case RsMailStatusEventCode::MESSAGE_RECEIVED_ACK:
|
||||
case RsMailStatusEventCode::SIGNATURE_FAILED:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void MessagesDialog::handleTagEvent_main_thread(std::shared_ptr<const RsEvent> event)
|
||||
{
|
||||
if (event->mType != RsEventType::MAIL_TAG) {
|
||||
return;
|
||||
}
|
||||
|
||||
const RsMailTagEvent *fe = dynamic_cast<const RsMailTagEvent*>(event.get());
|
||||
if (!fe) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (fe->mMailTagEventCode) {
|
||||
case RsMailTagEventCode::TAG_ADDED:
|
||||
case RsMailTagEventCode::TAG_CHANGED:
|
||||
case RsMailTagEventCode::TAG_REMOVED:
|
||||
fillQuickView();
|
||||
mMessageModel->updateMessages();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -324,6 +349,12 @@ void MessagesDialog::preModelUpdate()
|
||||
mTmpSavedSelectedIds.clear();
|
||||
getSelectedMessages(mTmpSavedSelectedIds);
|
||||
|
||||
mTmpSavedCurrentId.clear();
|
||||
const QModelIndex& m = ui.messageTreeWidget->currentIndex();
|
||||
if (m.isValid()) {
|
||||
mTmpSavedCurrentId = m.sibling(m.row(), RsMessageModel::COLUMN_THREAD_MSGID).data(RsMessageModel::MsgIdRole).toString();
|
||||
}
|
||||
|
||||
std::cerr << "Pre-change: saving selection for " << mTmpSavedSelectedIds.size() << " indexes" << std::endl;
|
||||
}
|
||||
|
||||
@ -341,6 +372,13 @@ void MessagesDialog::postModelUpdate()
|
||||
}
|
||||
|
||||
ui.messageTreeWidget->selectionModel()->select(sel,QItemSelectionModel::SelectCurrent);
|
||||
|
||||
if (!mTmpSavedCurrentId.isEmpty()) {
|
||||
QModelIndex index = mMessageProxyModel->mapFromSource(mMessageModel->getIndexOfMessage(mTmpSavedCurrentId.toStdString()));
|
||||
if (index.isValid()) {
|
||||
ui.messageTreeWidget->selectionModel()->setCurrentIndex(index, QItemSelectionModel::Select);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MessagesDialog::sortColumn(int col,Qt::SortOrder so)
|
||||
@ -356,6 +394,9 @@ MessagesDialog::~MessagesDialog()
|
||||
{
|
||||
// save settings
|
||||
processSettings(false);
|
||||
|
||||
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||
rsEvents->unregisterEventsHandler(mTagEventHandlerId);
|
||||
}
|
||||
|
||||
UserNotify *MessagesDialog::createUserNotify(QObject *parent)
|
||||
@ -921,13 +962,6 @@ void MessagesDialog::changeQuickView(int newrow)
|
||||
mMessageProxyModel->setFilterRegExp(QRegExp(RsMessageModel::FilterString)); // this triggers the update of the proxy model
|
||||
}
|
||||
|
||||
void MessagesDialog::messagesTagsChanged()
|
||||
{
|
||||
fillQuickView();
|
||||
mMessageModel->updateMessages();
|
||||
}
|
||||
|
||||
|
||||
// click in messageTreeWidget
|
||||
void MessagesDialog::currentChanged(const QModelIndex& new_proxy_index,const QModelIndex& /*old_proxy_index*/)
|
||||
{
|
||||
|
@ -66,7 +66,6 @@ protected:
|
||||
|
||||
public slots:
|
||||
//void insertMessages();
|
||||
void messagesTagsChanged();
|
||||
void messageRemoved();
|
||||
void preModelUpdate();
|
||||
void postModelUpdate();
|
||||
@ -112,6 +111,7 @@ private slots:
|
||||
|
||||
private:
|
||||
void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);
|
||||
void handleTagEvent_main_thread(std::shared_ptr<const RsEvent> event);
|
||||
|
||||
void updateInterface();
|
||||
|
||||
@ -159,9 +159,11 @@ private:
|
||||
Ui::MessagesDialog ui;
|
||||
|
||||
QList<QString> mTmpSavedSelectedIds;
|
||||
QString mTmpSavedCurrentId;
|
||||
QModelIndex lastSelectedIndex;
|
||||
|
||||
RsEventsHandlerId_t mEventHandlerId;
|
||||
RsEventsHandlerId_t mTagEventHandlerId;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "gui/common/TagDefs.h"
|
||||
#include "gui/settings/NewTag.h"
|
||||
#include "gui/notifyqt.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
|
||||
#include "gui/msgs/MessageInterface.h"
|
||||
|
||||
@ -46,11 +47,18 @@ TagsMenu::TagsMenu(const QString &title, QWidget *parent)
|
||||
: QMenu (title, parent)
|
||||
{
|
||||
connect(this, SIGNAL(triggered (QAction*)), this, SLOT(tagTriggered(QAction*)));
|
||||
connect(NotifyQt::getInstance(), SIGNAL(messagesTagsChanged()), this, SLOT(fillTags()));
|
||||
|
||||
mEventHandlerId = 0;
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) { RsQThreadUtils::postToObject( [this,event]() { handleEvent_main_thread(event); }); }, mEventHandlerId, RsEventType::MAIL_TAG );
|
||||
|
||||
fillTags();
|
||||
}
|
||||
|
||||
TagsMenu::~TagsMenu()
|
||||
{
|
||||
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||
}
|
||||
|
||||
void TagsMenu::paintEvent(QPaintEvent *e)
|
||||
{
|
||||
QMenu::paintEvent(e);
|
||||
@ -89,6 +97,26 @@ void TagsMenu::paintEvent(QPaintEvent *e)
|
||||
}
|
||||
}
|
||||
|
||||
void TagsMenu::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)
|
||||
{
|
||||
if (event->mType != RsEventType::MAIL_TAG) {
|
||||
return;
|
||||
}
|
||||
|
||||
const RsMailTagEvent *fe = dynamic_cast<const RsMailTagEvent*>(event.get());
|
||||
if (!fe) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (fe->mMailTagEventCode) {
|
||||
case RsMailTagEventCode::TAG_ADDED:
|
||||
case RsMailTagEventCode::TAG_CHANGED:
|
||||
case RsMailTagEventCode::TAG_REMOVED:
|
||||
fillTags();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void TagsMenu::fillTags()
|
||||
{
|
||||
clear();
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <QMenu>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <retroshare/rsevents.h>
|
||||
|
||||
class TagsMenu : public QMenu
|
||||
{
|
||||
@ -31,6 +32,7 @@ class TagsMenu : public QMenu
|
||||
|
||||
public:
|
||||
TagsMenu(const QString &title, QWidget *parent);
|
||||
virtual ~TagsMenu();
|
||||
|
||||
void activateActions(std::list<uint32_t>& tagIds);
|
||||
|
||||
@ -42,8 +44,14 @@ protected:
|
||||
virtual void paintEvent(QPaintEvent *e);
|
||||
|
||||
private slots:
|
||||
void fillTags();
|
||||
void tagTriggered(QAction *action);
|
||||
|
||||
private:
|
||||
void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);
|
||||
void fillTags();
|
||||
|
||||
private:
|
||||
RsEventsHandlerId_t mEventHandlerId;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -563,18 +563,6 @@ void NotifyQt::notifyListChange(int list, int type)
|
||||
break;
|
||||
case NOTIFY_LIST_SEARCHLIST:
|
||||
break;
|
||||
case NOTIFY_LIST_MESSAGELIST:
|
||||
#ifdef NOTIFY_DEBUG
|
||||
std::cerr << "received msg changed" << std::endl ;
|
||||
#endif
|
||||
emit messagesChanged() ;
|
||||
break;
|
||||
case NOTIFY_LIST_MESSAGE_TAGS:
|
||||
#ifdef NOTIFY_DEBUG
|
||||
std::cerr << "received msg tags changed" << std::endl ;
|
||||
#endif
|
||||
emit messagesTagsChanged();
|
||||
break;
|
||||
case NOTIFY_LIST_CHANNELLIST:
|
||||
break;
|
||||
case NOTIFY_LIST_TRANSFERLIST:
|
||||
@ -663,8 +651,6 @@ void NotifyQt::notifyListPreChange(int list, int /*type*/)
|
||||
break;
|
||||
case NOTIFY_LIST_SEARCHLIST:
|
||||
break;
|
||||
case NOTIFY_LIST_MESSAGELIST:
|
||||
break;
|
||||
case NOTIFY_LIST_CHANNELLIST:
|
||||
break;
|
||||
case NOTIFY_LIST_TRANSFERLIST:
|
||||
@ -697,7 +683,6 @@ void NotifyQt::UpdateGUI()
|
||||
// the gui is running, then they get updated by callbacks.
|
||||
if(!already_updated)
|
||||
{
|
||||
emit messagesChanged() ;
|
||||
emit neighboursChanged();
|
||||
emit configChanged();
|
||||
|
||||
|
@ -109,8 +109,6 @@ class NotifyQt: public QObject, public NotifyClient
|
||||
void lobbyListChanged() const ;
|
||||
void chatLobbyEvent(qulonglong,int,const RsGxsId&,const QString&) ;
|
||||
void neighboursChanged() const ;
|
||||
void messagesChanged() const ;
|
||||
void messagesTagsChanged() const;
|
||||
void configChanged() const ;
|
||||
void logInfoChanged(const QString&) const ;
|
||||
void chatStatusChanged(const ChatId&,const QString&) const ;
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "gui/common/TagDefs.h"
|
||||
#include <algorithm>
|
||||
#include "NewTag.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
|
||||
MessagePage::MessagePage(QWidget * parent, Qt::WindowFlags flags)
|
||||
: ConfigPage(parent, flags)
|
||||
@ -54,10 +55,14 @@ MessagePage::MessagePage(QWidget * parent, Qt::WindowFlags flags)
|
||||
connect(ui.loadEmbeddedImages, SIGNAL(toggled(bool)), this,SLOT(updateLoadEmbededImages() ));
|
||||
connect(ui.openComboBox, SIGNAL(currentIndexChanged(int)),this,SLOT(updateMsgOpen() ));
|
||||
connect(ui.emoticonscheckBox, SIGNAL(toggled(bool)), this,SLOT(updateLoadEmoticons() ));
|
||||
|
||||
mTagEventHandlerId = 0;
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) { RsQThreadUtils::postToObject( [this,event]() { handleEvent_main_thread(event); }); }, mTagEventHandlerId, RsEventType::MAIL_TAG );
|
||||
}
|
||||
|
||||
MessagePage::~MessagePage()
|
||||
{
|
||||
rsEvents->unregisterEventsHandler(mTagEventHandlerId);
|
||||
delete(m_pTags);
|
||||
}
|
||||
|
||||
@ -134,6 +139,27 @@ MessagePage::load()
|
||||
fillTags();
|
||||
}
|
||||
|
||||
void MessagePage::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)
|
||||
{
|
||||
if (event->mType != RsEventType::MAIL_TAG) {
|
||||
return;
|
||||
}
|
||||
|
||||
const RsMailTagEvent *fe = dynamic_cast<const RsMailTagEvent*>(event.get());
|
||||
if (!fe) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (fe->mMailTagEventCode) {
|
||||
case RsMailTagEventCode::TAG_ADDED:
|
||||
case RsMailTagEventCode::TAG_CHANGED:
|
||||
case RsMailTagEventCode::TAG_REMOVED:
|
||||
rsMail->getMessageTagTypes(*m_pTags);
|
||||
fillTags();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// fill tags
|
||||
void MessagePage::fillTags()
|
||||
{
|
||||
|
@ -62,11 +62,13 @@ private slots:
|
||||
void updateLoadEmoticons();
|
||||
|
||||
private:
|
||||
void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);
|
||||
void fillTags();
|
||||
|
||||
/* Pointer for not include of rsmsgs.h */
|
||||
MsgTagType *m_pTags;
|
||||
std::list<uint32_t> m_changedTagIds;
|
||||
RsEventsHandlerId_t mTagEventHandlerId;
|
||||
|
||||
Ui::MessagePage ui;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user