mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-12-13 07:38:54 -05:00
Merge pull request #2951 from csoler/v0.6-Notify2
Getting rid of old notify system
This commit is contained in:
commit
553d2e8f50
124 changed files with 2160 additions and 2476 deletions
|
|
@ -1 +1 @@
|
||||||
Subproject commit a82f87cc935694e903bc5b99768d4390d421fb14
|
Subproject commit 96e249a06d8f30c2aace38beecc8fb7271159a88
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
#include "FeedReaderStringDefs.h"
|
#include "FeedReaderStringDefs.h"
|
||||||
#include "gui/common/RSTreeWidgetItem.h"
|
#include "gui/common/RSTreeWidgetItem.h"
|
||||||
#include "gui/settings/rsharesettings.h"
|
#include "gui/settings/rsharesettings.h"
|
||||||
#include "gui/notifyqt.h"
|
#include "gui/RsGUIEventManager.h"
|
||||||
#include "FeedReaderUserNotify.h"
|
#include "FeedReaderUserNotify.h"
|
||||||
#include "gui/Posted/PostedCreatePostDialog.h"
|
#include "gui/Posted/PostedCreatePostDialog.h"
|
||||||
#include "util/imageutil.h"
|
#include "util/imageutil.h"
|
||||||
|
|
@ -73,7 +73,7 @@ FeedReaderDialog::FeedReaderDialog(RsFeedReader *feedReader, FeedReaderNotify *n
|
||||||
connect(mNotify, &FeedReaderNotify::feedChanged, this, &FeedReaderDialog::feedChanged, Qt::QueuedConnection);
|
connect(mNotify, &FeedReaderNotify::feedChanged, this, &FeedReaderDialog::feedChanged, Qt::QueuedConnection);
|
||||||
connect(mNotify, &FeedReaderNotify::optimizeImage, this, &FeedReaderDialog::optimizeImage, Qt::QueuedConnection);
|
connect(mNotify, &FeedReaderNotify::optimizeImage, this, &FeedReaderDialog::optimizeImage, Qt::QueuedConnection);
|
||||||
|
|
||||||
connect(NotifyQt::getInstance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
|
connect(RsGUIEventManager::getInstance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
|
||||||
|
|
||||||
/* connect signals */
|
/* connect signals */
|
||||||
connect(ui->feedTreeWidget, SIGNAL(itemActivated(QTreeWidgetItem*,int)), this, SLOT(feedTreeItemActivated(QTreeWidgetItem*)));
|
connect(ui->feedTreeWidget, SIGNAL(itemActivated(QTreeWidgetItem*,int)), this, SLOT(feedTreeItemActivated(QTreeWidgetItem*)));
|
||||||
|
|
@ -570,7 +570,7 @@ void FeedReaderDialog::feedChanged(uint32_t feedId, int type)
|
||||||
}
|
}
|
||||||
|
|
||||||
FeedInfo feedInfo;
|
FeedInfo feedInfo;
|
||||||
if (type != NOTIFY_TYPE_DEL) {
|
if (type != FeedReaderNotify::NOTIFY_TYPE_DEL) {
|
||||||
if (!mFeedReader->getFeedInfo(feedId, feedInfo)) {
|
if (!mFeedReader->getFeedInfo(feedId, feedInfo)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -580,12 +580,12 @@ void FeedReaderDialog::feedChanged(uint32_t feedId, int type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == NOTIFY_TYPE_MOD || type == NOTIFY_TYPE_DEL) {
|
if (type == FeedReaderNotify::NOTIFY_TYPE_MOD || type == FeedReaderNotify::NOTIFY_TYPE_DEL) {
|
||||||
QTreeWidgetItemIterator it(ui->feedTreeWidget);
|
QTreeWidgetItemIterator it(ui->feedTreeWidget);
|
||||||
QTreeWidgetItem *item;
|
QTreeWidgetItem *item;
|
||||||
while ((item = *it) != NULL) {
|
while ((item = *it) != NULL) {
|
||||||
if (item->data(COLUMN_FEED_DATA, ROLE_FEED_ID).toUInt() == feedId) {
|
if (item->data(COLUMN_FEED_DATA, ROLE_FEED_ID).toUInt() == feedId) {
|
||||||
if (type == NOTIFY_TYPE_MOD) {
|
if (type == FeedReaderNotify::NOTIFY_TYPE_MOD) {
|
||||||
updateFeedItem(item, feedInfo);
|
updateFeedItem(item, feedInfo);
|
||||||
} else {
|
} else {
|
||||||
delete(item);
|
delete(item);
|
||||||
|
|
@ -596,7 +596,7 @@ void FeedReaderDialog::feedChanged(uint32_t feedId, int type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == NOTIFY_TYPE_ADD) {
|
if (type == FeedReaderNotify::NOTIFY_TYPE_ADD) {
|
||||||
QTreeWidgetItemIterator it(ui->feedTreeWidget);
|
QTreeWidgetItemIterator it(ui->feedTreeWidget);
|
||||||
QTreeWidgetItem *itemParent;
|
QTreeWidgetItem *itemParent;
|
||||||
while ((itemParent = *it) != NULL) {
|
while ((itemParent = *it) != NULL) {
|
||||||
|
|
|
||||||
|
|
@ -40,15 +40,15 @@ class FeedReaderDialog : public MainPage
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FeedReaderDialog(RsFeedReader *feedReader, FeedReaderNotify *notify, QWidget *parent = 0);
|
FeedReaderDialog(RsFeedReader *feedReader, FeedReaderNotify *notify, QWidget *parent = 0);
|
||||||
~FeedReaderDialog();
|
~FeedReaderDialog();
|
||||||
|
|
||||||
static QIcon iconFromFeed(const FeedInfo &feedInfo);
|
static QIcon iconFromFeed(const FeedInfo &feedInfo);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual UserNotify *createUserNotify(QObject *parent) override;
|
virtual UserNotify *createUserNotify(QObject *parent) override;
|
||||||
virtual void showEvent(QShowEvent *event);
|
virtual void showEvent(QShowEvent *event) override;
|
||||||
bool eventFilter(QObject *obj, QEvent *ev);
|
bool eventFilter(QObject *obj, QEvent *ev) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void settingsChanged();
|
void settingsChanged();
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ void FeedReaderFeedNotify::msgChanged(uint32_t feedId, const QString &msgId, int
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type != NOTIFY_TYPE_ADD) {
|
if (type != FeedReaderNotify::NOTIFY_TYPE_ADD) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -515,12 +515,12 @@ void FeedReaderMessageWidget::feedChanged(uint32_t feedId, int type)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == NOTIFY_TYPE_DEL) {
|
if (type == FeedReaderNotify::NOTIFY_TYPE_DEL) {
|
||||||
setFeedId(0);
|
setFeedId(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == NOTIFY_TYPE_MOD) {
|
if (type == FeedReaderNotify::NOTIFY_TYPE_MOD) {
|
||||||
if (!mFeedReader->getFeedInfo(mFeedId, mFeedInfo)) {
|
if (!mFeedReader->getFeedInfo(mFeedId, mFeedInfo)) {
|
||||||
setFeedId(0);
|
setFeedId(0);
|
||||||
return;
|
return;
|
||||||
|
|
@ -555,18 +555,18 @@ void FeedReaderMessageWidget::msgChanged(uint32_t feedId, const QString &msgId,
|
||||||
}
|
}
|
||||||
|
|
||||||
FeedMsgInfo msgInfo;
|
FeedMsgInfo msgInfo;
|
||||||
if (type != NOTIFY_TYPE_DEL) {
|
if (type != FeedReaderNotify::NOTIFY_TYPE_DEL) {
|
||||||
if (!mFeedReader->getMsgInfo(feedId, msgId.toStdString(), msgInfo)) {
|
if (!mFeedReader->getMsgInfo(feedId, msgId.toStdString(), msgInfo)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == NOTIFY_TYPE_MOD || type == NOTIFY_TYPE_DEL) {
|
if (type == FeedReaderNotify::NOTIFY_TYPE_MOD || type == FeedReaderNotify::NOTIFY_TYPE_DEL) {
|
||||||
QTreeWidgetItemIterator it(ui->msgTreeWidget);
|
QTreeWidgetItemIterator it(ui->msgTreeWidget);
|
||||||
QTreeWidgetItem *item;
|
QTreeWidgetItem *item;
|
||||||
while ((item = *it) != NULL) {
|
while ((item = *it) != NULL) {
|
||||||
if (item->data(COLUMN_MSG_DATA, ROLE_MSG_ID).toString() == msgId) {
|
if (item->data(COLUMN_MSG_DATA, ROLE_MSG_ID).toString() == msgId) {
|
||||||
if (type == NOTIFY_TYPE_MOD) {
|
if (type == FeedReaderNotify::NOTIFY_TYPE_MOD) {
|
||||||
updateMsgItem(item, msgInfo);
|
updateMsgItem(item, msgInfo);
|
||||||
filterItem(item);
|
filterItem(item);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -578,13 +578,13 @@ void FeedReaderMessageWidget::msgChanged(uint32_t feedId, const QString &msgId,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == NOTIFY_TYPE_MOD) {
|
if (type == FeedReaderNotify::NOTIFY_TYPE_MOD) {
|
||||||
if (msgId.toStdString() == currentMsgId()) {
|
if (msgId.toStdString() == currentMsgId()) {
|
||||||
updateCurrentMessage();
|
updateCurrentMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == NOTIFY_TYPE_ADD) {
|
if (type == FeedReaderNotify::NOTIFY_TYPE_ADD) {
|
||||||
QTreeWidgetItem *item = new RSTreeWidgetItem(mMsgCompareRole);
|
QTreeWidgetItem *item = new RSTreeWidgetItem(mMsgCompareRole);
|
||||||
updateMsgItem(item, msgInfo);
|
updateMsgItem(item, msgInfo);
|
||||||
ui->msgTreeWidget->addTopLevelItem(item);
|
ui->msgTreeWidget->addTopLevelItem(item);
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,13 @@ class FeedReaderNotify : public QObject, public RsFeedReaderNotify
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
// These replace the variables from the old notify system. It's simpler than switching the entire
|
||||||
|
// feedreader plugin to the new rsEvents system
|
||||||
|
|
||||||
|
static const int NOTIFY_TYPE_ADD = 0x01;
|
||||||
|
static const int NOTIFY_TYPE_DEL = 0x02;
|
||||||
|
static const int NOTIFY_TYPE_MOD = 0x03;
|
||||||
|
|
||||||
FeedReaderNotify();
|
FeedReaderNotify();
|
||||||
|
|
||||||
/* RsFeedReaderNotify */
|
/* RsFeedReaderNotify */
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ void FeedReaderUserNotify::iconClicked()
|
||||||
|
|
||||||
void FeedReaderUserNotify::feedChanged(uint32_t /*feedId*/, int type)
|
void FeedReaderUserNotify::feedChanged(uint32_t /*feedId*/, int type)
|
||||||
{
|
{
|
||||||
if (type == NOTIFY_TYPE_DEL) {
|
if (type == FeedReaderNotify::NOTIFY_TYPE_DEL) {
|
||||||
updateIcon();
|
updateIcon();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -294,13 +294,13 @@ void PreviewFeedDialog::feedChanged(uint32_t feedId, int type)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == NOTIFY_TYPE_DEL) {
|
if (type == FeedReaderNotify::NOTIFY_TYPE_DEL) {
|
||||||
/* feed deleted */
|
/* feed deleted */
|
||||||
mFeedId = 0;
|
mFeedId = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == NOTIFY_TYPE_ADD || type == NOTIFY_TYPE_MOD) {
|
if (type == FeedReaderNotify::NOTIFY_TYPE_ADD || type == FeedReaderNotify::NOTIFY_TYPE_MOD) {
|
||||||
FeedInfo feedInfo;
|
FeedInfo feedInfo;
|
||||||
if (!mFeedReader->getFeedInfo(mFeedId, feedInfo)) {
|
if (!mFeedReader->getFeedInfo(mFeedId, feedInfo)) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -320,18 +320,18 @@ void PreviewFeedDialog::msgChanged(uint32_t feedId, const QString &msgId, int ty
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case NOTIFY_TYPE_ADD:
|
case FeedReaderNotify::NOTIFY_TYPE_ADD:
|
||||||
if (mMsgId.empty()) {
|
if (mMsgId.empty()) {
|
||||||
mMsgId = msgId.toStdString();
|
mMsgId = msgId.toStdString();
|
||||||
updateMsg();
|
updateMsg();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NOTIFY_TYPE_MOD:
|
case FeedReaderNotify::NOTIFY_TYPE_MOD:
|
||||||
if (mMsgId == msgId.toStdString()) {
|
if (mMsgId == msgId.toStdString()) {
|
||||||
updateMsg();
|
updateMsg();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NOTIFY_TYPE_DEL:
|
case FeedReaderNotify::NOTIFY_TYPE_DEL:
|
||||||
if (mMsgId == msgId.toStdString()) {
|
if (mMsgId == msgId.toStdString()) {
|
||||||
std::list<std::string>::iterator it = std::find(mMsgIds.begin(), mMsgIds.end(), mMsgId);
|
std::list<std::string>::iterator it = std::find(mMsgIds.begin(), mMsgIds.end(), mMsgId);
|
||||||
if (it != mMsgIds.end()) {
|
if (it != mMsgIds.end()) {
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
#include "rsFeedReaderItems.h"
|
#include "rsFeedReaderItems.h"
|
||||||
#include "p3FeedReader.h"
|
#include "p3FeedReader.h"
|
||||||
|
#include "gui/FeedReaderNotify.h"
|
||||||
#include "p3FeedReaderThread.h"
|
#include "p3FeedReaderThread.h"
|
||||||
#include "rsitems/rsconfigitems.h"
|
#include "rsitems/rsconfigitems.h"
|
||||||
#include "retroshare/rsiface.h"
|
#include "retroshare/rsiface.h"
|
||||||
|
|
@ -415,7 +416,7 @@ RsFeedResult p3FeedReader::addFolder(uint32_t parentId, const std::string &name,
|
||||||
IndicateConfigChanged(RsConfigMgr::CheckPriority::SAVE_NOW);
|
IndicateConfigChanged(RsConfigMgr::CheckPriority::SAVE_NOW);
|
||||||
|
|
||||||
if (mNotify) {
|
if (mNotify) {
|
||||||
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_ADD);
|
mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_ADD);
|
||||||
}
|
}
|
||||||
|
|
||||||
return RS_FEED_RESULT_SUCCESS;
|
return RS_FEED_RESULT_SUCCESS;
|
||||||
|
|
@ -455,7 +456,7 @@ RsFeedResult p3FeedReader::setFolder(uint32_t feedId, const std::string &name)
|
||||||
IndicateConfigChanged(RsConfigMgr::CheckPriority::SAVE_NOW);
|
IndicateConfigChanged(RsConfigMgr::CheckPriority::SAVE_NOW);
|
||||||
|
|
||||||
if (mNotify) {
|
if (mNotify) {
|
||||||
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD);
|
mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
|
||||||
}
|
}
|
||||||
|
|
||||||
return RS_FEED_RESULT_SUCCESS;
|
return RS_FEED_RESULT_SUCCESS;
|
||||||
|
|
@ -502,7 +503,7 @@ RsFeedResult p3FeedReader::addFeed(const FeedInfo &feedInfo, uint32_t &feedId)
|
||||||
IndicateConfigChanged(RsConfigMgr::CheckPriority::SAVE_NOW);
|
IndicateConfigChanged(RsConfigMgr::CheckPriority::SAVE_NOW);
|
||||||
|
|
||||||
if (mNotify) {
|
if (mNotify) {
|
||||||
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_ADD);
|
mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_ADD);
|
||||||
}
|
}
|
||||||
|
|
||||||
return RS_FEED_RESULT_SUCCESS;
|
return RS_FEED_RESULT_SUCCESS;
|
||||||
|
|
@ -587,7 +588,7 @@ RsFeedResult p3FeedReader::setFeed(uint32_t feedId, const FeedInfo &feedInfo)
|
||||||
IndicateConfigChanged(RsConfigMgr::CheckPriority::SAVE_NOW);
|
IndicateConfigChanged(RsConfigMgr::CheckPriority::SAVE_NOW);
|
||||||
|
|
||||||
if (mNotify) {
|
if (mNotify) {
|
||||||
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD);
|
mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!forumId.empty()) {
|
if (!forumId.empty()) {
|
||||||
|
|
@ -658,7 +659,7 @@ RsFeedResult p3FeedReader::setParent(uint32_t feedId, uint32_t parentId)
|
||||||
IndicateConfigChanged(RsConfigMgr::CheckPriority::SAVE_NOW);
|
IndicateConfigChanged(RsConfigMgr::CheckPriority::SAVE_NOW);
|
||||||
|
|
||||||
if (mNotify) {
|
if (mNotify) {
|
||||||
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD);
|
mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -756,7 +757,7 @@ bool p3FeedReader::removeFeed(uint32_t feedId)
|
||||||
/* only notify remove of feed */
|
/* only notify remove of feed */
|
||||||
std::list<uint32_t>::iterator it;
|
std::list<uint32_t>::iterator it;
|
||||||
for (it = removedFeedIds.begin(); it != removedFeedIds.end(); ++it) {
|
for (it = removedFeedIds.begin(); it != removedFeedIds.end(); ++it) {
|
||||||
mNotify->notifyFeedChanged(*it, NOTIFY_TYPE_DEL);
|
mNotify->notifyFeedChanged(*it, FeedReaderNotify::NOTIFY_TYPE_DEL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -803,7 +804,7 @@ bool p3FeedReader::addPreviewFeed(const FeedInfo &feedInfo, uint32_t &feedId)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mNotify) {
|
if (mNotify) {
|
||||||
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_ADD);
|
mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_ADD);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
@ -925,8 +926,8 @@ bool p3FeedReader::removeMsg(uint32_t feedId, const std::string &msgId)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mNotify) {
|
if (mNotify) {
|
||||||
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD);
|
mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
|
||||||
mNotify->notifyMsgChanged(feedId, msgId, NOTIFY_TYPE_DEL);
|
mNotify->notifyMsgChanged(feedId, msgId, FeedReaderNotify::NOTIFY_TYPE_DEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -977,11 +978,11 @@ bool p3FeedReader::removeMsgs(uint32_t feedId, const std::list<std::string> &msg
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mNotify && !removedMsgs.empty()) {
|
if (mNotify && !removedMsgs.empty()) {
|
||||||
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD);
|
mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
|
||||||
|
|
||||||
std::list<std::string>::iterator it;
|
std::list<std::string>::iterator it;
|
||||||
for (it = removedMsgs.begin(); it != removedMsgs.end(); ++it) {
|
for (it = removedMsgs.begin(); it != removedMsgs.end(); ++it) {
|
||||||
mNotify->notifyMsgChanged(feedId, *it, NOTIFY_TYPE_DEL);
|
mNotify->notifyMsgChanged(feedId, *it, FeedReaderNotify::NOTIFY_TYPE_DEL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1224,7 +1225,7 @@ bool p3FeedReader::processFeed(uint32_t feedId)
|
||||||
|
|
||||||
if (mNotify) {
|
if (mNotify) {
|
||||||
for (it = notifyIds.begin(); it != notifyIds.end(); ++it) {
|
for (it = notifyIds.begin(); it != notifyIds.end(); ++it) {
|
||||||
mNotify->notifyFeedChanged(*it, NOTIFY_TYPE_MOD);
|
mNotify->notifyFeedChanged(*it, FeedReaderNotify::NOTIFY_TYPE_MOD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1273,8 +1274,8 @@ bool p3FeedReader::setMessageRead(uint32_t feedId, const std::string &msgId, boo
|
||||||
if (changed) {
|
if (changed) {
|
||||||
IndicateConfigChanged(RsConfigMgr::CheckPriority::SAVE_OFTEN);
|
IndicateConfigChanged(RsConfigMgr::CheckPriority::SAVE_OFTEN);
|
||||||
if (mNotify) {
|
if (mNotify) {
|
||||||
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD);
|
mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
|
||||||
mNotify->notifyMsgChanged(feedId, msgId, NOTIFY_TYPE_MOD);
|
mNotify->notifyMsgChanged(feedId, msgId, FeedReaderNotify::NOTIFY_TYPE_MOD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1328,10 +1329,10 @@ bool p3FeedReader::retransformMsg(uint32_t feedId, const std::string &msgId)
|
||||||
IndicateConfigChanged(RsConfigMgr::CheckPriority::SAVE_NOW);
|
IndicateConfigChanged(RsConfigMgr::CheckPriority::SAVE_NOW);
|
||||||
if (mNotify) {
|
if (mNotify) {
|
||||||
if (feedChanged) {
|
if (feedChanged) {
|
||||||
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD);
|
mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
|
||||||
}
|
}
|
||||||
if (msgChanged) {
|
if (msgChanged) {
|
||||||
mNotify->notifyMsgChanged(feedId, msgId, NOTIFY_TYPE_MOD);
|
mNotify->notifyMsgChanged(feedId, msgId, FeedReaderNotify::NOTIFY_TYPE_MOD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1466,7 +1467,7 @@ int p3FeedReader::tick()
|
||||||
|
|
||||||
if (mNotify) {
|
if (mNotify) {
|
||||||
for (it = notifyIds.begin(); it != notifyIds.end(); ++it) {
|
for (it = notifyIds.begin(); it != notifyIds.end(); ++it) {
|
||||||
mNotify->notifyFeedChanged(*it, NOTIFY_TYPE_MOD);
|
mNotify->notifyFeedChanged(*it, FeedReaderNotify::NOTIFY_TYPE_MOD);
|
||||||
}
|
}
|
||||||
if (imageToOptimze) {
|
if (imageToOptimze) {
|
||||||
mNotify->notifyOptimizeImage();
|
mNotify->notifyOptimizeImage();
|
||||||
|
|
@ -1526,7 +1527,7 @@ void p3FeedReader::cleanFeeds()
|
||||||
if (mNotify) {
|
if (mNotify) {
|
||||||
std::list<std::pair<uint32_t, std::string> >::iterator it;
|
std::list<std::pair<uint32_t, std::string> >::iterator it;
|
||||||
for (it = removedMsgIds.begin(); it != removedMsgIds.end(); ++it) {
|
for (it = removedMsgIds.begin(); it != removedMsgIds.end(); ++it) {
|
||||||
mNotify->notifyMsgChanged(it->first, it->second, NOTIFY_TYPE_DEL);
|
mNotify->notifyMsgChanged(it->first, it->second, FeedReaderNotify::NOTIFY_TYPE_DEL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1801,7 +1802,7 @@ bool p3FeedReader::getFeedToDownload(RsFeedReaderFeed &feed, uint32_t neededFeed
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mNotify) {
|
if (mNotify) {
|
||||||
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD);
|
mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -1852,7 +1853,7 @@ void p3FeedReader::onDownloadSuccess(uint32_t feedId, const std::string &content
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mNotify) {
|
if (mNotify) {
|
||||||
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD);
|
mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1889,7 +1890,7 @@ void p3FeedReader::onDownloadError(uint32_t feedId, RsFeedReaderErrorState resul
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mNotify) {
|
if (mNotify) {
|
||||||
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD);
|
mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1944,7 +1945,7 @@ bool p3FeedReader::getFeedToProcess(RsFeedReaderFeed &feed, uint32_t neededFeedI
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mNotify) {
|
if (mNotify) {
|
||||||
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD);
|
mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -2323,11 +2324,11 @@ void p3FeedReader::onProcessSuccess_addMsgs(uint32_t feedId, std::list<RsFeedRea
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mNotify) {
|
if (mNotify) {
|
||||||
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD);
|
mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
|
||||||
|
|
||||||
std::list<std::string>::iterator it;
|
std::list<std::string>::iterator it;
|
||||||
for (it = addedMsgs.begin(); it != addedMsgs.end(); ++it) {
|
for (it = addedMsgs.begin(); it != addedMsgs.end(); ++it) {
|
||||||
mNotify->notifyMsgChanged(feedId, *it, NOTIFY_TYPE_ADD);
|
mNotify->notifyMsgChanged(feedId, *it, FeedReaderNotify::NOTIFY_TYPE_ADD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2365,7 +2366,7 @@ void p3FeedReader::onProcessError(uint32_t feedId, RsFeedReaderErrorState result
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mNotify) {
|
if (mNotify) {
|
||||||
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD);
|
mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2433,7 +2434,7 @@ void p3FeedReader::setFeedInfo(uint32_t feedId, const std::string &name, const s
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mNotify) {
|
if (mNotify) {
|
||||||
mNotify->notifyFeedChanged(feedId, NOTIFY_TYPE_MOD);
|
mNotify->notifyFeedChanged(feedId, FeedReaderNotify::NOTIFY_TYPE_MOD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,9 @@ class RsFeedReaderMsg;
|
||||||
class p3FeedReaderThread;
|
class p3FeedReaderThread;
|
||||||
|
|
||||||
class RsGxsForums;
|
class RsGxsForums;
|
||||||
struct RsGxsForumGroup;
|
class RsGxsForumGroup;
|
||||||
class RsPosted;
|
class RsPosted;
|
||||||
struct RsPostedGroup;
|
class RsPostedGroup;
|
||||||
class RsGxsIfaceHelper;
|
class RsGxsIfaceHelper;
|
||||||
|
|
||||||
class p3FeedReader : public RsPQIService, public RsFeedReader
|
class p3FeedReader : public RsPQIService, public RsFeedReader
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
/*Retroshare-Gui*/
|
/*Retroshare-Gui*/
|
||||||
#include "gui/chat/ChatDialog.h"
|
#include "gui/chat/ChatDialog.h"
|
||||||
#include "gui/notifyqt.h"
|
#include "gui/RsGUIEventManager.h"
|
||||||
#include "util/HandleRichText.h"
|
#include "util/HandleRichText.h"
|
||||||
|
|
||||||
VOIPToasterItem::VOIPToasterItem(const RsPeerId &peer_id, const QString &msg, const voipToasterItem_Type type)
|
VOIPToasterItem::VOIPToasterItem(const RsPeerId &peer_id, const QString &msg, const voipToasterItem_Type type)
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@
|
||||||
|
|
||||||
#include "ChatLobbyWidget.h"
|
#include "ChatLobbyWidget.h"
|
||||||
|
|
||||||
#include "notifyqt.h"
|
|
||||||
#include "RetroShareLink.h"
|
#include "RetroShareLink.h"
|
||||||
#include "chat/ChatLobbyDialog.h"
|
#include "chat/ChatLobbyDialog.h"
|
||||||
#include "chat/ChatLobbyUserNotify.h"
|
#include "chat/ChatLobbyUserNotify.h"
|
||||||
|
|
@ -35,11 +34,11 @@
|
||||||
#include "settings/rsharesettings.h"
|
#include "settings/rsharesettings.h"
|
||||||
#include "util/HandleRichText.h"
|
#include "util/HandleRichText.h"
|
||||||
#include "util/misc.h"
|
#include "util/misc.h"
|
||||||
|
#include "util/qtthreadsutils.h"
|
||||||
#include "util/RsQtVersion.h"
|
#include "util/RsQtVersion.h"
|
||||||
|
|
||||||
#include "retroshare/rsmsgs.h"
|
#include "retroshare/rsmsgs.h"
|
||||||
#include "retroshare/rspeers.h"
|
#include "retroshare/rspeers.h"
|
||||||
#include "retroshare/rsnotify.h"
|
|
||||||
#include "retroshare/rsidentity.h"
|
#include "retroshare/rsidentity.h"
|
||||||
|
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
|
|
@ -105,9 +104,39 @@ ChatLobbyWidget::ChatLobbyWidget(QWidget *parent, Qt::WindowFlags flags)
|
||||||
myInviteYesButton = NULL;
|
myInviteYesButton = NULL;
|
||||||
myInviteIdChooser = NULL;
|
myInviteIdChooser = NULL;
|
||||||
|
|
||||||
QObject::connect( NotifyQt::getInstance(), SIGNAL(lobbyListChanged()), SLOT(lobbyChanged()));
|
mEventHandlerId = 0;
|
||||||
QObject::connect( NotifyQt::getInstance(), SIGNAL(chatLobbyEvent(qulonglong,int,RsGxsId,QString)), this, SLOT(displayChatLobbyEvent(qulonglong,int,RsGxsId,QString)));
|
|
||||||
QObject::connect( NotifyQt::getInstance(), SIGNAL(chatLobbyInviteReceived()), this, SLOT(readChatLobbyInvites()));
|
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event)
|
||||||
|
{
|
||||||
|
RsQThreadUtils::postToObject([=](){
|
||||||
|
auto ev = dynamic_cast<const RsChatLobbyEvent *>(event.get());
|
||||||
|
|
||||||
|
if(!ev) return;
|
||||||
|
|
||||||
|
switch(ev->mEventCode)
|
||||||
|
{
|
||||||
|
case RsChatLobbyEventCode::CHAT_LOBBY_INVITE_RECEIVED:
|
||||||
|
readChatLobbyInvites();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RsChatLobbyEventCode::CHAT_LOBBY_LIST_CHANGED:
|
||||||
|
lobbyChanged();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RsChatLobbyEventCode::CHAT_LOBBY_EVENT_PEER_LEFT:
|
||||||
|
case RsChatLobbyEventCode::CHAT_LOBBY_EVENT_PEER_STATUS:
|
||||||
|
case RsChatLobbyEventCode::CHAT_LOBBY_EVENT_PEER_JOINED:
|
||||||
|
case RsChatLobbyEventCode::CHAT_LOBBY_EVENT_PEER_CHANGE_NICKNAME:
|
||||||
|
case RsChatLobbyEventCode::CHAT_LOBBY_EVENT_KEEP_ALIVE:
|
||||||
|
|
||||||
|
handleChatLobbyEvent(ev->mLobbyId,ev->mEventCode,ev->mGxsId,QString::fromUtf8(ev->mStr.c_str()));
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}, this );
|
||||||
|
}, mEventHandlerId, RsEventType::CHAT_SERVICE );
|
||||||
|
|
||||||
QObject::connect( ui.lobbyTreeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(lobbyTreeWidgetCustomPopupMenu(QPoint)));
|
QObject::connect( ui.lobbyTreeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(lobbyTreeWidgetCustomPopupMenu(QPoint)));
|
||||||
QObject::connect( ui.lobbyTreeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(itemDoubleClicked(QTreeWidgetItem*,int)));
|
QObject::connect( ui.lobbyTreeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(itemDoubleClicked(QTreeWidgetItem*,int)));
|
||||||
|
|
@ -236,6 +265,7 @@ ChatLobbyWidget::ChatLobbyWidget(QWidget *parent, Qt::WindowFlags flags)
|
||||||
|
|
||||||
ChatLobbyWidget::~ChatLobbyWidget()
|
ChatLobbyWidget::~ChatLobbyWidget()
|
||||||
{
|
{
|
||||||
|
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||||
// save settings
|
// save settings
|
||||||
processSettings(false);
|
processSettings(false);
|
||||||
|
|
||||||
|
|
@ -650,7 +680,7 @@ void ChatLobbyWidget::updateDisplay()
|
||||||
|
|
||||||
if (autoSubscribe && subscribed && _lobby_infos.find(lobby.lobby_id) == _lobby_infos.end())
|
if (autoSubscribe && subscribed && _lobby_infos.find(lobby.lobby_id) == _lobby_infos.end())
|
||||||
{
|
{
|
||||||
ChatDialog *cd = ChatDialog::getChat(ChatId(lobby.lobby_id), RS_CHAT_OPEN);
|
ChatDialog *cd = ChatDialog::getChat(ChatId(lobby.lobby_id), RsChatFlags::RS_CHAT_OPEN);
|
||||||
|
|
||||||
addChatPage(dynamic_cast<ChatLobbyDialog*>(cd));
|
addChatPage(dynamic_cast<ChatLobbyDialog*>(cd));
|
||||||
}
|
}
|
||||||
|
|
@ -753,7 +783,7 @@ void ChatLobbyWidget::showLobby(QTreeWidgetItem *item)
|
||||||
showBlankPage(id) ;
|
showBlankPage(id) ;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_lobby_infos[id].dialog->showDialog(RS_CHAT_FOCUS);
|
_lobby_infos[id].dialog->showDialog(RsChatFlags::RS_CHAT_FOCUS);
|
||||||
if (_lobby_infos[id].dialog->isWindowed())
|
if (_lobby_infos[id].dialog->isWindowed())
|
||||||
showBlankPage(id, true);
|
showBlankPage(id, true);
|
||||||
}
|
}
|
||||||
|
|
@ -816,7 +846,7 @@ bool ChatLobbyWidget::showLobbyAnchor(ChatLobbyId id, QString anchor)
|
||||||
if(_lobby_infos.find(id) == _lobby_infos.end()) {
|
if(_lobby_infos.find(id) == _lobby_infos.end()) {
|
||||||
showBlankPage(id) ;
|
showBlankPage(id) ;
|
||||||
} else {
|
} else {
|
||||||
_lobby_infos[id].dialog->showDialog(RS_CHAT_FOCUS);
|
_lobby_infos[id].dialog->showDialog(RsChatFlags::RS_CHAT_FOCUS);
|
||||||
if (_lobby_infos[id].dialog->isWindowed())
|
if (_lobby_infos[id].dialog->isWindowed())
|
||||||
showBlankPage(id, true);
|
showBlankPage(id, true);
|
||||||
|
|
||||||
|
|
@ -1158,10 +1188,10 @@ void ChatLobbyWidget::itemDoubleClicked(QTreeWidgetItem *item, int /*column*/)
|
||||||
subscribeChatLobbyAtItem(item);
|
subscribeChatLobbyAtItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatLobbyWidget::displayChatLobbyEvent(qulonglong lobby_id, int event_type, const RsGxsId &gxs_id, const QString& str)
|
void ChatLobbyWidget::handleChatLobbyEvent(uint64_t lobby_id, RsChatLobbyEventCode event_type, const RsGxsId &gxs_id, const QString& str)
|
||||||
{
|
{
|
||||||
if (ChatLobbyDialog *cld = dynamic_cast<ChatLobbyDialog*>(ChatDialog::getExistingChat(ChatId(lobby_id)))) {
|
if (ChatLobbyDialog *cld = dynamic_cast<ChatLobbyDialog*>(ChatDialog::getExistingChat(ChatId(lobby_id)))) {
|
||||||
cld->displayLobbyEvent(event_type, gxs_id, str);
|
cld->handleLobbyEvent(event_type, gxs_id, str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -89,8 +89,8 @@ protected slots:
|
||||||
void unsubscribeItem();
|
void unsubscribeItem();
|
||||||
void itemDoubleClicked(QTreeWidgetItem *item, int column);
|
void itemDoubleClicked(QTreeWidgetItem *item, int column);
|
||||||
void updateCurrentLobby() ;
|
void updateCurrentLobby() ;
|
||||||
void displayChatLobbyEvent(qulonglong lobby_id, int event_type, const RsGxsId& gxs_id, const QString& str);
|
void handleChatLobbyEvent(uint64_t lobby_id, RsChatLobbyEventCode event_type, const RsGxsId &gxs_id, const QString& str);
|
||||||
void readChatLobbyInvites();
|
void readChatLobbyInvites();
|
||||||
void showLobby(QTreeWidgetItem *lobby_item) ;
|
void showLobby(QTreeWidgetItem *lobby_item) ;
|
||||||
void showBlankPage(ChatLobbyId id, bool subscribed = false) ;
|
void showBlankPage(ChatLobbyId id, bool subscribed = false) ;
|
||||||
void unsubscribeChatLobby(ChatLobbyId id) ;
|
void unsubscribeChatLobby(ChatLobbyId id) ;
|
||||||
|
|
@ -151,5 +151,7 @@ private:
|
||||||
|
|
||||||
/* UI - from Designer */
|
/* UI - from Designer */
|
||||||
Ui::ChatLobbyWidget ui;
|
Ui::ChatLobbyWidget ui;
|
||||||
|
|
||||||
|
RsEventsHandlerId_t mEventHandlerId;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@
|
||||||
|
|
||||||
#include "rshare.h"
|
#include "rshare.h"
|
||||||
#include "gui/MainWindow.h"
|
#include "gui/MainWindow.h"
|
||||||
#include "gui/notifyqt.h"
|
|
||||||
#include "gui/RemoteDirModel.h"
|
#include "gui/RemoteDirModel.h"
|
||||||
#include "gui/RetroShareLink.h"
|
#include "gui/RetroShareLink.h"
|
||||||
#include "gui/ShareManager.h"
|
#include "gui/ShareManager.h"
|
||||||
|
|
@ -35,6 +34,7 @@
|
||||||
#include "gui/settings/rsharesettings.h"
|
#include "gui/settings/rsharesettings.h"
|
||||||
#include "util/RsQtVersion.h"
|
#include "util/RsQtVersion.h"
|
||||||
#include "util/RsAction.h"
|
#include "util/RsAction.h"
|
||||||
|
#include "util/qtthreadsutils.h"
|
||||||
#include "util/misc.h"
|
#include "util/misc.h"
|
||||||
#include "util/rstime.h"
|
#include "util/rstime.h"
|
||||||
#include "util/rsdir.h"
|
#include "util/rsdir.h"
|
||||||
|
|
@ -166,6 +166,7 @@ public:
|
||||||
|
|
||||||
SharedFilesDialog::~SharedFilesDialog()
|
SharedFilesDialog::~SharedFilesDialog()
|
||||||
{
|
{
|
||||||
|
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||||
delete tree_model;
|
delete tree_model;
|
||||||
delete flat_model;
|
delete flat_model;
|
||||||
delete tree_proxyModel;
|
delete tree_proxyModel;
|
||||||
|
|
@ -177,9 +178,36 @@ SharedFilesDialog::SharedFilesDialog(bool remote_mode, QWidget *parent)
|
||||||
/* Invoke the Qt Designer generated object setup routine */
|
/* Invoke the Qt Designer generated object setup routine */
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
|
|
||||||
NotifyQt *notify = NotifyQt::getInstance();
|
//connect(notify, SIGNAL(filesPreModChanged(bool)), this, SLOT(preModDirectories(bool)));
|
||||||
connect(notify, SIGNAL(filesPreModChanged(bool)), this, SLOT(preModDirectories(bool)));
|
//connect(notify, SIGNAL(filesPostModChanged(bool)), this, SLOT(postModDirectories(bool)));
|
||||||
connect(notify, SIGNAL(filesPostModChanged(bool)), this, SLOT(postModDirectories(bool)));
|
|
||||||
|
mEventHandlerId = 0;
|
||||||
|
|
||||||
|
rsEvents->registerEventsHandler([this](std::shared_ptr<const RsEvent> event)
|
||||||
|
{
|
||||||
|
RsQThreadUtils::postToObject([=](){
|
||||||
|
|
||||||
|
auto e = dynamic_cast<const RsSharedDirectoriesEvent*>(event.get());
|
||||||
|
|
||||||
|
switch(e->mEventCode)
|
||||||
|
{
|
||||||
|
case RsSharedDirectoriesEventCode::OWN_DIR_LIST_PROCESSING:
|
||||||
|
preModDirectories(true);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RsSharedDirectoriesEventCode::OWN_DIR_LIST_UPDATED:
|
||||||
|
postModDirectories(true);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RsSharedDirectoriesEventCode::FRIEND_DIR_LIST_UPDATED:
|
||||||
|
preModDirectories(false);
|
||||||
|
postModDirectories(false);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
};}, this);
|
||||||
|
}, mEventHandlerId,RsEventType::SHARED_DIRECTORIES);
|
||||||
|
|
||||||
connect(ui.viewType_CB, SIGNAL(currentIndexChanged(int)), this, SLOT(changeCurrentViewModel(int)));
|
connect(ui.viewType_CB, SIGNAL(currentIndexChanged(int)), this, SLOT(changeCurrentViewModel(int)));
|
||||||
connect(ui.dirTreeView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT( spawnCustomPopupMenu( QPoint ) ) );
|
connect(ui.dirTreeView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT( spawnCustomPopupMenu( QPoint ) ) );
|
||||||
|
|
@ -739,7 +767,6 @@ void SharedFilesDialog::collCreate()
|
||||||
model->getDirDetailsFromSelect(lst, dirVec);
|
model->getDirDetailsFromSelect(lst, dirVec);
|
||||||
|
|
||||||
auto RemoteMode = isRemote();
|
auto RemoteMode = isRemote();
|
||||||
FileSearchFlags f = RemoteMode?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL ;
|
|
||||||
|
|
||||||
QString dir_name;
|
QString dir_name;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@
|
||||||
#ifndef _SHAREDFILESDIALOG_H
|
#ifndef _SHAREDFILESDIALOG_H
|
||||||
#define _SHAREDFILESDIALOG_H
|
#define _SHAREDFILESDIALOG_H
|
||||||
|
|
||||||
|
#include <retroshare/rsevents.h>
|
||||||
#include "ui_SharedFilesDialog.h"
|
#include "ui_SharedFilesDialog.h"
|
||||||
|
|
||||||
#include <retroshare-gui/RsAutoUpdatePage.h>
|
#include <retroshare-gui/RsAutoUpdatePage.h>
|
||||||
|
|
@ -145,6 +146,8 @@ protected:
|
||||||
QString lastFilterString;
|
QString lastFilterString;
|
||||||
QString mLastFilterText ;
|
QString mLastFilterText ;
|
||||||
RsProtectedTimer* mFilterTimer;
|
RsProtectedTimer* mFilterTimer;
|
||||||
|
|
||||||
|
RsEventsHandlerId_t mEventHandlerId ;
|
||||||
};
|
};
|
||||||
|
|
||||||
class LocalSharedFilesDialog : public SharedFilesDialog
|
class LocalSharedFilesDialog : public SharedFilesDialog
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@
|
||||||
|
|
||||||
#include "retroshare/rsfiles.h"
|
#include "retroshare/rsfiles.h"
|
||||||
#include "TransferUserNotify.h"
|
#include "TransferUserNotify.h"
|
||||||
#include "gui/notifyqt.h"
|
|
||||||
#include "gui/MainWindow.h"
|
#include "gui/MainWindow.h"
|
||||||
|
|
||||||
TransferUserNotify::TransferUserNotify(QObject *parent) :
|
TransferUserNotify::TransferUserNotify(QObject *parent) :
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@
|
||||||
|
|
||||||
#include "TransfersDialog.h"
|
#include "TransfersDialog.h"
|
||||||
|
|
||||||
#include "gui/notifyqt.h"
|
|
||||||
#include "gui/SoundManager.h"
|
#include "gui/SoundManager.h"
|
||||||
#include "gui/RetroShareLink.h"
|
#include "gui/RetroShareLink.h"
|
||||||
#include "gui/common/FilesDefs.h"
|
#include "gui/common/FilesDefs.h"
|
||||||
|
|
@ -1010,7 +1009,6 @@ TransfersDialog::TransfersDialog(QWidget *parent)
|
||||||
connect(collViewAct,SIGNAL(triggered()),this,SLOT(collView()));
|
connect(collViewAct,SIGNAL(triggered()),this,SLOT(collView()));
|
||||||
collOpenAct = new QAction(FilesDefs::getIconFromQtResourcePath(IMAGE_COLLOPEN), tr( "Download from collection file..." ), this );
|
collOpenAct = new QAction(FilesDefs::getIconFromQtResourcePath(IMAGE_COLLOPEN), tr( "Download from collection file..." ), this );
|
||||||
connect(collOpenAct, SIGNAL(triggered()), this, SLOT(collOpen()));
|
connect(collOpenAct, SIGNAL(triggered()), this, SLOT(collOpen()));
|
||||||
connect(NotifyQt::getInstance(), SIGNAL(downloadComplete(QString)), this, SLOT(collAutoOpen(QString)));
|
|
||||||
|
|
||||||
/** Setup the actions for the download header context menu */
|
/** Setup the actions for the download header context menu */
|
||||||
showDLSizeAct= new QAction(tr("Size"),this);
|
showDLSizeAct= new QAction(tr("Size"),this);
|
||||||
|
|
@ -1115,14 +1113,8 @@ void TransfersDialog::handleEvent_main_thread(std::shared_ptr<const RsEvent> eve
|
||||||
switch (fe->mFileTransferEventCode)
|
switch (fe->mFileTransferEventCode)
|
||||||
{
|
{
|
||||||
case RsFileTransferEventCode::DOWNLOAD_COMPLETE:
|
case RsFileTransferEventCode::DOWNLOAD_COMPLETE:
|
||||||
{
|
collAutoOpen(fe->mHash);
|
||||||
FileInfo nfo ;
|
|
||||||
if(!rsFiles->FileDetails(fe->mHash, RS_FILE_HINTS_DOWNLOAD, nfo))
|
|
||||||
break;
|
|
||||||
|
|
||||||
SoundManager::play(SOUND_DOWNLOAD_COMPLETE);
|
|
||||||
NotifyQt::getInstance()->addToaster(RS_POPUP_DOWNLOAD, fe->mHash.toStdString(), nfo.fname.c_str(),"");
|
|
||||||
}
|
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
|
|
||||||
case RsFileTransferEventCode::COMPLETED_FILES_REMOVED:
|
case RsFileTransferEventCode::COMPLETED_FILES_REMOVED:
|
||||||
|
|
@ -2578,11 +2570,10 @@ void TransfersDialog::collOpen()
|
||||||
QMessageBox::information(nullptr,tr("Error openning collection file"),RsCollection::errorString(code));
|
QMessageBox::information(nullptr,tr("Error openning collection file"),RsCollection::errorString(code));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransfersDialog::collAutoOpen(const QString &fileHash)
|
void TransfersDialog::collAutoOpen(const RsFileHash& hash)
|
||||||
{
|
{
|
||||||
if (Settings->valueFromGroup("Transfer","AutoDLColl").toBool())
|
if (Settings->valueFromGroup("Transfer","AutoDLColl").toBool())
|
||||||
{
|
{
|
||||||
RsFileHash hash = RsFileHash(fileHash.toStdString());
|
|
||||||
FileInfo info;
|
FileInfo info;
|
||||||
if (rsFiles->FileDetails(hash, RS_FILE_HINTS_DOWNLOAD, info)) {
|
if (rsFiles->FileDetails(hash, RS_FILE_HINTS_DOWNLOAD, info)) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ private slots:
|
||||||
void collModif();
|
void collModif();
|
||||||
void collView();
|
void collView();
|
||||||
void collOpen();
|
void collOpen();
|
||||||
void collAutoOpen(const QString& fileHash);
|
void collAutoOpen(const RsFileHash &hash);
|
||||||
|
|
||||||
void setShowDLSizeColumn(bool show);
|
void setShowDLSizeColumn(bool show);
|
||||||
void setShowDLCompleteColumn(bool show);
|
void setShowDLCompleteColumn(bool show);
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ FriendServerControl::FriendServerControl(QWidget *parent)
|
||||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event)
|
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event)
|
||||||
{
|
{
|
||||||
RsQThreadUtils::postToObject([=](){ handleEvent_main_thread(event); }, this );
|
RsQThreadUtils::postToObject([=](){ handleEvent_main_thread(event); }, this );
|
||||||
}, mEventHandlerId_peer, RsEventType::PEER_CONNECTION );
|
}, mEventHandlerId_peer, RsEventType::FRIEND_LIST );
|
||||||
}
|
}
|
||||||
|
|
||||||
void FriendServerControl::onAutoAddFriends(bool b)
|
void FriendServerControl::onAutoAddFriends(bool b)
|
||||||
|
|
@ -145,14 +145,14 @@ void FriendServerControl::handleEvent_main_thread(std::shared_ptr<const RsEvent>
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
const RsConnectionEvent *pe = dynamic_cast<const RsConnectionEvent*>(event.get());
|
const RsFriendListEvent *pe = dynamic_cast<const RsFriendListEvent*>(event.get());
|
||||||
|
|
||||||
if(pe)
|
if(pe)
|
||||||
switch(pe->mConnectionInfoCode)
|
switch(pe->mEventCode)
|
||||||
{
|
{
|
||||||
case RsConnectionEventCode::PEER_ADDED:
|
case RsFriendListEventCode::NODE_ADDED:
|
||||||
case RsConnectionEventCode::PEER_REMOVED:
|
case RsFriendListEventCode::NODE_REMOVED:
|
||||||
case RsConnectionEventCode::PEER_CONNECTED: updateContactsStatus();
|
case RsFriendListEventCode::NODE_CONNECTED: updateContactsStatus();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: ;
|
default: ;
|
||||||
|
|
@ -169,7 +169,7 @@ FriendServerControl::~FriendServerControl()
|
||||||
rsEvents->unregisterEventsHandler(mEventHandlerId_peer);
|
rsEvents->unregisterEventsHandler(mEventHandlerId_peer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FriendServerControl::launchStatusContextMenu(QPoint p)
|
void FriendServerControl::launchStatusContextMenu(QPoint /* p */)
|
||||||
{
|
{
|
||||||
RsPeerId peer_id = getCurrentPeer();
|
RsPeerId peer_id = getCurrentPeer();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,12 +34,12 @@
|
||||||
#include "groups/CreateGroup.h"
|
#include "groups/CreateGroup.h"
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
#include "NewsFeed.h"
|
#include "NewsFeed.h"
|
||||||
#include "notifyqt.h"
|
|
||||||
#include "profile/ProfileWidget.h"
|
#include "profile/ProfileWidget.h"
|
||||||
#include "profile/StatusMessage.h"
|
#include "profile/StatusMessage.h"
|
||||||
#include "RetroShareLink.h"
|
#include "RetroShareLink.h"
|
||||||
#include "settings/rsharesettings.h"
|
#include "settings/rsharesettings.h"
|
||||||
#include "util/misc.h"
|
#include "util/misc.h"
|
||||||
|
#include "util/qtthreadsutils.h"
|
||||||
#include "util/DateTime.h"
|
#include "util/DateTime.h"
|
||||||
#include "FriendsDialog.h"
|
#include "FriendsDialog.h"
|
||||||
#include "NetworkView.h"
|
#include "NetworkView.h"
|
||||||
|
|
@ -77,12 +77,49 @@ FriendsDialog::FriendsDialog(QWidget *parent) : MainPage(parent)
|
||||||
ui.chatWidget->setWelcomeMessage(msg);
|
ui.chatWidget->setWelcomeMessage(msg);
|
||||||
ui.chatWidget->init(ChatId::makeBroadcastId(), tr("Broadcast"));
|
ui.chatWidget->init(ChatId::makeBroadcastId(), tr("Broadcast"));
|
||||||
|
|
||||||
connect(NotifyQt::getInstance(), SIGNAL(chatMessageReceived(ChatMessage)), this, SLOT(chatMessageReceived(ChatMessage)));
|
mEventHandlerId_chat = 0;
|
||||||
connect(NotifyQt::getInstance(), SIGNAL(chatStatusChanged(ChatId,QString)), this, SLOT(chatStatusReceived(ChatId,QString)));
|
|
||||||
|
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e)
|
||||||
|
{
|
||||||
|
RsQThreadUtils::postToObject([=]()
|
||||||
|
{
|
||||||
|
auto fe = dynamic_cast<const RsChatServiceEvent*>(e.get()); if(!fe) return;
|
||||||
|
|
||||||
|
switch(fe->mEventCode)
|
||||||
|
{
|
||||||
|
case RsChatServiceEventCode::CHAT_MESSAGE_RECEIVED: chatMessageReceived(fe->mMsg); break;
|
||||||
|
case RsChatServiceEventCode::CHAT_STATUS_CHANGED: chatStatusReceived(fe->mCid,QString::fromUtf8(fe->mStr.c_str())); break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
, this );
|
||||||
|
}, mEventHandlerId_chat, RsEventType::CHAT_SERVICE );
|
||||||
|
|
||||||
#else // def RS_DIRECT_CHAT
|
#else // def RS_DIRECT_CHAT
|
||||||
ui.tabWidget->removeTab(ui.tabWidget->indexOf(ui.groupChatTab));
|
ui.tabWidget->removeTab(ui.tabWidget->indexOf(ui.groupChatTab));
|
||||||
#endif // def RS_DIRECT_CHAT
|
#endif // def RS_DIRECT_CHAT
|
||||||
|
|
||||||
|
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e)
|
||||||
|
{
|
||||||
|
RsQThreadUtils::postToObject([=]()
|
||||||
|
{
|
||||||
|
auto fe = dynamic_cast<const RsFriendListEvent*>(e.get()); if(!fe) return;
|
||||||
|
|
||||||
|
switch(fe->mEventCode)
|
||||||
|
{
|
||||||
|
case RsFriendListEventCode::OWN_STATUS_CHANGED: loadmypersonalstatus();
|
||||||
|
break;
|
||||||
|
default: // OWN_AVATAR_CHANGED is handled in AvatarWidget
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
, this );
|
||||||
|
}, mEventHandlerId_friends, RsEventType::FRIEND_LIST );
|
||||||
|
|
||||||
|
mEventHandlerId_friends = 0;
|
||||||
|
|
||||||
connect( ui.mypersonalstatusLabel, SIGNAL(clicked()), SLOT(statusmessage()));
|
connect( ui.mypersonalstatusLabel, SIGNAL(clicked()), SLOT(statusmessage()));
|
||||||
connect( ui.actionSet_your_Avatar, SIGNAL(triggered()), this, SLOT(getAvatar()));
|
connect( ui.actionSet_your_Avatar, SIGNAL(triggered()), this, SLOT(getAvatar()));
|
||||||
|
|
@ -153,6 +190,8 @@ FriendsDialog::~FriendsDialog ()
|
||||||
if (this == instance) {
|
if (this == instance) {
|
||||||
instance = NULL;
|
instance = NULL;
|
||||||
}
|
}
|
||||||
|
rsEvents->unregisterEventsHandler(mEventHandlerId_friends);
|
||||||
|
rsEvents->unregisterEventsHandler(mEventHandlerId_chat);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FriendsDialog::activatePage(FriendsDialog::Page page)
|
void FriendsDialog::activatePage(FriendsDialog::Page page)
|
||||||
|
|
@ -200,7 +239,17 @@ void FriendsDialog::processSettings(bool bLoad)
|
||||||
|
|
||||||
void FriendsDialog::chatMessageReceived(const ChatMessage &msg)
|
void FriendsDialog::chatMessageReceived(const ChatMessage &msg)
|
||||||
{
|
{
|
||||||
if(msg.chat_id.isBroadcast())
|
if(!msg.chat_id.isBroadcast())
|
||||||
|
return;
|
||||||
|
|
||||||
|
QDateTime sendTime = QDateTime::fromTime_t(msg.sendTime);
|
||||||
|
QDateTime recvTime = QDateTime::fromTime_t(msg.recvTime);
|
||||||
|
QString message = QString::fromUtf8(msg.msg.c_str());
|
||||||
|
QString name = QString::fromUtf8(rsPeers->getPeerName(msg.broadcast_peer_id).c_str());
|
||||||
|
|
||||||
|
ui.chatWidget->addChatMsg(msg.incoming, name, sendTime, recvTime, message, ChatWidget::MSGTYPE_NORMAL);
|
||||||
|
|
||||||
|
if(ui.chatWidget->isActive())
|
||||||
{
|
{
|
||||||
QDateTime sendTime = DateTime::DateTimeFromTime_t(msg.sendTime);
|
QDateTime sendTime = DateTime::DateTimeFromTime_t(msg.sendTime);
|
||||||
QDateTime recvTime = DateTime::DateTimeFromTime_t(msg.recvTime);
|
QDateTime recvTime = DateTime::DateTimeFromTime_t(msg.recvTime);
|
||||||
|
|
@ -220,11 +269,11 @@ void FriendsDialog::chatMessageReceived(const ChatMessage &msg)
|
||||||
|
|
||||||
void FriendsDialog::chatStatusReceived(const ChatId &chat_id, const QString &status_string)
|
void FriendsDialog::chatStatusReceived(const ChatId &chat_id, const QString &status_string)
|
||||||
{
|
{
|
||||||
if(chat_id.isBroadcast())
|
if(!chat_id.isBroadcast())
|
||||||
{
|
return;
|
||||||
QString name = QString::fromUtf8(rsPeers->getPeerName(chat_id.broadcast_status_peer_id).c_str());
|
|
||||||
ui.chatWidget->updateStatusString(name + " %1", status_string);
|
QString name = QString::fromUtf8(rsPeers->getPeerName(chat_id.broadcast_status_peer_id).c_str());
|
||||||
}
|
ui.chatWidget->updateStatusString(name + " %1", status_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FriendsDialog::addFriend()
|
void FriendsDialog::addFriend()
|
||||||
|
|
|
||||||
|
|
@ -70,9 +70,6 @@ public:
|
||||||
IdDialog *idDialog;
|
IdDialog *idDialog;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void chatMessageReceived(const ChatMessage& msg);
|
|
||||||
void chatStatusReceived(const ChatId& chat_id, const QString& status_string);
|
|
||||||
|
|
||||||
void addFriend();
|
void addFriend();
|
||||||
|
|
||||||
void statusmessage();
|
void statusmessage();
|
||||||
|
|
@ -89,10 +86,17 @@ signals:
|
||||||
void notifyGroupChat(const QString&,const QString&) ;
|
void notifyGroupChat(const QString&,const QString&) ;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void chatMessageReceived(const ChatMessage& msg);
|
||||||
|
void chatStatusReceived(const ChatId& chat_id, const QString& status_string);
|
||||||
|
|
||||||
void processSettings(bool bLoad);
|
void processSettings(bool bLoad);
|
||||||
|
|
||||||
/** Qt Designer generated object */
|
/** Qt Designer generated object */
|
||||||
Ui::FriendsDialog ui;
|
Ui::FriendsDialog ui;
|
||||||
|
RsEventsHandlerId_t mEventHandlerId_friends ;
|
||||||
|
#ifdef RS_DIRECT_CHAT
|
||||||
|
RsEventsHandlerId_t mEventHandlerId_chat ;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,6 @@
|
||||||
#include "retroshare/rstor.h"
|
#include "retroshare/rstor.h"
|
||||||
#include "retroshare/rsidentity.h"
|
#include "retroshare/rsidentity.h"
|
||||||
#include "retroshare/rsinit.h"
|
#include "retroshare/rsinit.h"
|
||||||
#include "retroshare/rsnotify.h"
|
|
||||||
#include "rsserver/rsaccounts.h"
|
#include "rsserver/rsaccounts.h"
|
||||||
#include "util/rsrandom.h"
|
#include "util/rsrandom.h"
|
||||||
|
|
||||||
|
|
@ -643,7 +642,7 @@ void GenCertDialog::genPerson()
|
||||||
std::cout << "RsAccounts::GenerateSSLCertificate" << std::endl;
|
std::cout << "RsAccounts::GenerateSSLCertificate" << std::endl;
|
||||||
|
|
||||||
// now cache the PGP password so that it's not asked again for immediately signing the key
|
// now cache the PGP password so that it's not asked again for immediately signing the key
|
||||||
rsNotify->cachePgpPassphrase(ui.password_input->text().toUtf8().constData()) ;
|
rsLoginHelper->cachePgpPassphrase(ui.password_input->text().toUtf8().constData()) ;
|
||||||
|
|
||||||
bool okGen = RsAccounts::createNewAccount(PGPId, "", genLoc, "", isHiddenLoc, isAutoTor, sslPasswd, sslId, err);
|
bool okGen = RsAccounts::createNewAccount(PGPId, "", genLoc, "", isHiddenLoc, isAutoTor, sslPasswd, sslId, err);
|
||||||
|
|
||||||
|
|
@ -656,7 +655,7 @@ void GenCertDialog::genPerson()
|
||||||
// Normally we should clear the cached passphrase as soon as possible. However,some other GUI components may still need it at start.
|
// Normally we should clear the cached passphrase as soon as possible. However,some other GUI components may still need it at start.
|
||||||
// (csoler) This is really bad: we have to guess that 30 secs will be enough. I have no better way to do this.
|
// (csoler) This is really bad: we have to guess that 30 secs will be enough. I have no better way to do this.
|
||||||
|
|
||||||
QTimer::singleShot(30000, []() { rsNotify->clearPgpPassphrase(); } );
|
QTimer::singleShot(30000, []() { RsLoginHelper::clearPgpPassphrase(); } );
|
||||||
|
|
||||||
accept();
|
accept();
|
||||||
}
|
}
|
||||||
|
|
@ -664,7 +663,7 @@ void GenCertDialog::genPerson()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Now clear the cached passphrase
|
// Now clear the cached passphrase
|
||||||
rsNotify->clearPgpPassphrase();
|
RsLoginHelper::clearPgpPassphrase();
|
||||||
|
|
||||||
/* Message Dialog */
|
/* Message Dialog */
|
||||||
QMessageBox::warning(this,
|
QMessageBox::warning(this,
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@
|
||||||
#include "util/qtthreadsutils.h"
|
#include "util/qtthreadsutils.h"
|
||||||
#include "util/misc.h"
|
#include "util/misc.h"
|
||||||
|
|
||||||
#include "gui/notifyqt.h"
|
|
||||||
#include "gui/common/FilesDefs.h"
|
#include "gui/common/FilesDefs.h"
|
||||||
#include "gui/msgs/MessageComposer.h"
|
#include "gui/msgs/MessageComposer.h"
|
||||||
#include "gui/connect/ConnectFriendWizard.h"
|
#include "gui/connect/ConnectFriendWizard.h"
|
||||||
|
|
|
||||||
|
|
@ -29,10 +29,10 @@
|
||||||
#include "gui/gxs/GxsIdDetails.h"
|
#include "gui/gxs/GxsIdDetails.h"
|
||||||
#include "util/qtthreadsutils.h"
|
#include "util/qtthreadsutils.h"
|
||||||
#include "util/misc.h"
|
#include "util/misc.h"
|
||||||
#include "gui/notifyqt.h"
|
|
||||||
|
|
||||||
#include "retroshare/rsidentity.h"
|
#include "retroshare/rsidentity.h"
|
||||||
#include "retroshare/rspeers.h"
|
#include "retroshare/rspeers.h"
|
||||||
|
#include "retroshare/rsinit.h"
|
||||||
#include "gui/common/FilesDefs.h"
|
#include "gui/common/FilesDefs.h"
|
||||||
#include "util/imageutil.h"
|
#include "util/imageutil.h"
|
||||||
#include "util/RsQtVersion.h"
|
#include "util/RsQtVersion.h"
|
||||||
|
|
@ -596,9 +596,9 @@ void IdEditDialog::createId()
|
||||||
std::string gpg_name = rsPeers->getGPGName(rsPeers->getGPGOwnId());
|
std::string gpg_name = rsPeers->getGPGName(rsPeers->getGPGOwnId());
|
||||||
bool cancelled;
|
bool cancelled;
|
||||||
|
|
||||||
rsNotify->clearPgpPassphrase(); // just in case
|
RsLoginHelper::clearPgpPassphrase(); // just in case
|
||||||
|
|
||||||
if(!NotifyQt::getInstance()->askForPassword(tr("Profile password needed.").toStdString(),
|
if(!RsLoginHelper::askForPassword(tr("Profile password needed.").toStdString(),
|
||||||
gpg_name + " (" + rsPeers->getOwnId().toStdString() + ")",
|
gpg_name + " (" + rsPeers->getOwnId().toStdString() + ")",
|
||||||
false,
|
false,
|
||||||
gpg_password,cancelled))
|
gpg_password,cancelled))
|
||||||
|
|
@ -670,9 +670,9 @@ void IdEditDialog::updateId()
|
||||||
std::string gpg_name = rsPeers->getGPGName(rsPeers->getGPGOwnId());
|
std::string gpg_name = rsPeers->getGPGName(rsPeers->getGPGOwnId());
|
||||||
bool cancelled;
|
bool cancelled;
|
||||||
|
|
||||||
rsNotify->clearPgpPassphrase(); // just in case
|
RsLoginHelper::clearPgpPassphrase(); // just in case
|
||||||
|
|
||||||
if(!NotifyQt::getInstance()->askForPassword(tr("Profile password needed.").toStdString(),
|
if(!RsLoginHelper::askForPassword(tr("Profile password needed.").toStdString(),
|
||||||
gpg_name + " (" + rsPeers->getOwnId().toStdString() + ")",
|
gpg_name + " (" + rsPeers->getOwnId().toStdString() + ")",
|
||||||
false,
|
false,
|
||||||
gpg_password,cancelled))
|
gpg_password,cancelled))
|
||||||
|
|
|
||||||
|
|
@ -168,7 +168,7 @@ public:
|
||||||
|
|
||||||
/* Color definitions (for standard see default.qss) */
|
/* Color definitions (for standard see default.qss) */
|
||||||
QColor mTextColorGroup;
|
QColor mTextColorGroup;
|
||||||
QColor mTextColorStatus[RS_STATUS_COUNT];
|
QColor mTextColorStatus[(int)RsStatusValue::RS_STATUS_COUNT];
|
||||||
|
|
||||||
void setIdentities(const std::list<RsGroupMetaData>& identities_meta);
|
void setIdentities(const std::list<RsGroupMetaData>& identities_meta);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,11 @@
|
||||||
#include <QMenuBar>
|
#include <QMenuBar>
|
||||||
#include <QActionGroup>
|
#include <QActionGroup>
|
||||||
|
|
||||||
#include <retroshare/rsplugin.h>
|
#include "retroshare/rsplugin.h"
|
||||||
#include <retroshare/rsconfig.h>
|
#include "retroshare/rsconfig.h"
|
||||||
#include <util/argstream.h>
|
#include "retroshare/rsevents.h"
|
||||||
|
#include "util/argstream.h"
|
||||||
|
#include "util/qtthreadsutils.h"
|
||||||
|
|
||||||
#if defined(Q_OS_DARWIN)
|
#if defined(Q_OS_DARWIN)
|
||||||
#include "gui/common/MacDockIconHandler.h"
|
#include "gui/common/MacDockIconHandler.h"
|
||||||
|
|
@ -65,7 +67,6 @@
|
||||||
#include "chat/ChatDialog.h"
|
#include "chat/ChatDialog.h"
|
||||||
#include "RetroShareLink.h"
|
#include "RetroShareLink.h"
|
||||||
#include "SoundManager.h"
|
#include "SoundManager.h"
|
||||||
#include "notifyqt.h"
|
|
||||||
#include "common/UserNotify.h"
|
#include "common/UserNotify.h"
|
||||||
#include "gui/ServicePermissionDialog.h"
|
#include "gui/ServicePermissionDialog.h"
|
||||||
|
|
||||||
|
|
@ -99,7 +100,6 @@
|
||||||
#include "retroshare/rsiface.h"
|
#include "retroshare/rsiface.h"
|
||||||
#include "retroshare/rspeers.h"
|
#include "retroshare/rspeers.h"
|
||||||
#include "retroshare/rsfiles.h"
|
#include "retroshare/rsfiles.h"
|
||||||
#include "retroshare/rsnotify.h"
|
|
||||||
#include "retroshare/rsinit.h"
|
#include "retroshare/rsinit.h"
|
||||||
|
|
||||||
#include "gui/gxschannels/GxsChannelDialog.h"
|
#include "gui/gxschannels/GxsChannelDialog.h"
|
||||||
|
|
@ -121,11 +121,11 @@
|
||||||
#include "gui/statistics/StatisticsWindow.h"
|
#include "gui/statistics/StatisticsWindow.h"
|
||||||
|
|
||||||
#include "gui/connect/ConnectFriendWizard.h"
|
#include "gui/connect/ConnectFriendWizard.h"
|
||||||
|
#include "gui/RsGUIEventManager.h"
|
||||||
#include "gui/common/RsCollectionDialog.h"
|
#include "gui/common/RsCollectionDialog.h"
|
||||||
#include "settings/rsettingswin.h"
|
#include "settings/rsettingswin.h"
|
||||||
#include "settings/rsharesettings.h"
|
#include "settings/rsharesettings.h"
|
||||||
#include "common/StatusDefs.h"
|
#include "common/StatusDefs.h"
|
||||||
#include "gui/notifyqt.h"
|
|
||||||
|
|
||||||
#ifdef RS_WEBUI
|
#ifdef RS_WEBUI
|
||||||
# include "settings/WebuiPage.h"
|
# include "settings/WebuiPage.h"
|
||||||
|
|
@ -341,10 +341,8 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
|
||||||
|
|
||||||
createNotifyIcons();
|
createNotifyIcons();
|
||||||
|
|
||||||
/* calculate friend count */
|
/* intialize friend count */
|
||||||
updateFriends();
|
updateFriends();
|
||||||
connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(QString,int)), this, SLOT(updateFriends()));
|
|
||||||
connect(NotifyQt::getInstance(), SIGNAL(friendsChanged()), this, SLOT(updateFriends()));
|
|
||||||
|
|
||||||
loadOwnStatus();
|
loadOwnStatus();
|
||||||
|
|
||||||
|
|
@ -359,10 +357,28 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
|
||||||
timer->connect(timer, SIGNAL(timeout()), this, SLOT(updateStatus()));
|
timer->connect(timer, SIGNAL(timeout()), this, SLOT(updateStatus()));
|
||||||
timer->start(1000);
|
timer->start(1000);
|
||||||
|
|
||||||
connect(NotifyQt::getInstance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
|
connect(RsGUIEventManager::getInstance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
|
||||||
settingsChanged();
|
settingsChanged();
|
||||||
|
|
||||||
mFontSizeHandler.registerFontSize(ui->listWidget, 1.5f);
|
mFontSizeHandler.registerFontSize(ui->listWidget, 1.5f);
|
||||||
|
|
||||||
|
mEventHandlerId_friends = 0;
|
||||||
|
|
||||||
|
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e)
|
||||||
|
{
|
||||||
|
RsQThreadUtils::postToObject([=]()
|
||||||
|
{
|
||||||
|
auto fe = dynamic_cast<const RsFriendListEvent*>(e.get());
|
||||||
|
|
||||||
|
if(!fe)
|
||||||
|
return;
|
||||||
|
|
||||||
|
updateFriends();
|
||||||
|
}
|
||||||
|
, this );
|
||||||
|
}, mEventHandlerId_friends, RsEventType::FRIEND_LIST );
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Destructor. */
|
/** Destructor. */
|
||||||
|
|
@ -373,6 +389,8 @@ MainWindow::~MainWindow()
|
||||||
Settings->setValueToGroup("MainWindow", "SplitterState", ui->splitter->saveState());
|
Settings->setValueToGroup("MainWindow", "SplitterState", ui->splitter->saveState());
|
||||||
Settings->setValueToGroup("MainWindow", "State", saveState());
|
Settings->setValueToGroup("MainWindow", "State", saveState());
|
||||||
|
|
||||||
|
rsEvents->unregisterEventsHandler(mEventHandlerId_friends);
|
||||||
|
|
||||||
delete statusComboBox;
|
delete statusComboBox;
|
||||||
delete peerstatus;
|
delete peerstatus;
|
||||||
delete natstatus;
|
delete natstatus;
|
||||||
|
|
@ -597,28 +615,6 @@ void MainWindow::setNewPage(int page)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::displayDiskSpaceWarning(int loc,int size_limit_mb)
|
|
||||||
{
|
|
||||||
QString locString ;
|
|
||||||
switch(loc)
|
|
||||||
{
|
|
||||||
case RS_PARTIALS_DIRECTORY: locString = "Partials" ;
|
|
||||||
break ;
|
|
||||||
|
|
||||||
case RS_CONFIG_DIRECTORY: locString = "Config" ;
|
|
||||||
break ;
|
|
||||||
|
|
||||||
case RS_DOWNLOAD_DIRECTORY: locString = "Download" ;
|
|
||||||
break ;
|
|
||||||
|
|
||||||
default:
|
|
||||||
std::cerr << "Error: " << __PRETTY_FUNCTION__ << " was called with an unknown parameter loc=" << loc << std::endl ;
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
QMessageBox::critical(NULL,tr("Low disk space warning"),
|
|
||||||
tr("The disk space in your")+" "+locString +" "+tr("directory is running low (current limit is")+" "+QString::number(size_limit_mb)+tr("MB). \n\n RetroShare will now safely suspend any disk access to this directory. \n\n Please make some free space and click Ok.")) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Creates a tray icon with a context menu and adds it to the system
|
/** Creates a tray icon with a context menu and adds it to the system
|
||||||
* notification area. */
|
* notification area. */
|
||||||
void MainWindow::createTrayIcon()
|
void MainWindow::createTrayIcon()
|
||||||
|
|
@ -1352,11 +1348,6 @@ void MainWindow::receiveNewArgs(QStringList args)
|
||||||
retroshareLinkActivated(link.toUrl());
|
retroshareLinkActivated(link.toUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::displayErrorMessage(int /*a*/,int /*b*/,const QString& error_msg)
|
|
||||||
{
|
|
||||||
QMessageBox::critical(NULL, tr("Internal Error"),error_msg) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::closeEvent(QCloseEvent *e)
|
void MainWindow::closeEvent(QCloseEvent *e)
|
||||||
{
|
{
|
||||||
e->ignore();
|
e->ignore();
|
||||||
|
|
@ -1454,7 +1445,7 @@ MainWindow::retranslateUi()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set status object to status value */
|
/* set status object to status value */
|
||||||
static void setStatusObject(QObject *pObject, int nStatus)
|
static void setStatusObject(QObject *pObject, RsStatusValue nStatus)
|
||||||
{
|
{
|
||||||
QMenu *pMenu = dynamic_cast<QMenu*>(pObject);
|
QMenu *pMenu = dynamic_cast<QMenu*>(pObject);
|
||||||
if (pMenu) {
|
if (pMenu) {
|
||||||
|
|
@ -1465,7 +1456,7 @@ static void setStatusObject(QObject *pObject, int nStatus)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pAction->data().toInt() == nStatus) {
|
if (pAction->data().toInt() == (int)nStatus) {
|
||||||
pAction->setChecked(true);
|
pAction->setChecked(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -1475,7 +1466,7 @@ static void setStatusObject(QObject *pObject, int nStatus)
|
||||||
RSComboBox *pComboBox = dynamic_cast<RSComboBox*>(pObject);
|
RSComboBox *pComboBox = dynamic_cast<RSComboBox*>(pObject);
|
||||||
if (pComboBox) {
|
if (pComboBox) {
|
||||||
/* set index of combobox */
|
/* set index of combobox */
|
||||||
int nIndex = pComboBox->findData(nStatus, Qt::UserRole);
|
int nIndex = pComboBox->findData((int)nStatus, Qt::UserRole);
|
||||||
if (nIndex != -1) {
|
if (nIndex != -1) {
|
||||||
pComboBox->setCurrentIndex(nIndex);
|
pComboBox->setCurrentIndex(nIndex);
|
||||||
}
|
}
|
||||||
|
|
@ -1538,20 +1529,20 @@ void MainWindow::initializeStatusObject(QObject *pObject, bool bConnect)
|
||||||
/* initialize menu */
|
/* initialize menu */
|
||||||
QActionGroup *pGroup = new QActionGroup(pMenu);
|
QActionGroup *pGroup = new QActionGroup(pMenu);
|
||||||
|
|
||||||
QAction *pAction = new QAction(QIcon(StatusDefs::imageStatus(RS_STATUS_ONLINE)), StatusDefs::name(RS_STATUS_ONLINE), pMenu);
|
QAction *pAction = new QAction(QIcon(StatusDefs::imageStatus(RsStatusValue::RS_STATUS_ONLINE)), StatusDefs::name(RsStatusValue::RS_STATUS_ONLINE), pMenu);
|
||||||
pAction->setData(RS_STATUS_ONLINE);
|
pAction->setData((int)RsStatusValue::RS_STATUS_ONLINE);
|
||||||
pAction->setCheckable(true);
|
pAction->setCheckable(true);
|
||||||
pMenu->addAction(pAction);
|
pMenu->addAction(pAction);
|
||||||
pGroup->addAction(pAction);
|
pGroup->addAction(pAction);
|
||||||
|
|
||||||
pAction = new QAction(QIcon(StatusDefs::imageStatus(RS_STATUS_BUSY)), StatusDefs::name(RS_STATUS_BUSY), pMenu);
|
pAction = new QAction(QIcon(StatusDefs::imageStatus(RsStatusValue::RS_STATUS_BUSY)), StatusDefs::name(RsStatusValue::RS_STATUS_BUSY), pMenu);
|
||||||
pAction->setData(RS_STATUS_BUSY);
|
pAction->setData((int)RsStatusValue::RS_STATUS_BUSY);
|
||||||
pAction->setCheckable(true);
|
pAction->setCheckable(true);
|
||||||
pMenu->addAction(pAction);
|
pMenu->addAction(pAction);
|
||||||
pGroup->addAction(pAction);
|
pGroup->addAction(pAction);
|
||||||
|
|
||||||
pAction = new QAction(QIcon(StatusDefs::imageStatus(RS_STATUS_AWAY)), StatusDefs::name(RS_STATUS_AWAY), pMenu);
|
pAction = new QAction(QIcon(StatusDefs::imageStatus(RsStatusValue::RS_STATUS_AWAY)), StatusDefs::name(RsStatusValue::RS_STATUS_AWAY), pMenu);
|
||||||
pAction->setData(RS_STATUS_AWAY);
|
pAction->setData((int)RsStatusValue::RS_STATUS_AWAY);
|
||||||
pAction->setCheckable(true);
|
pAction->setCheckable(true);
|
||||||
pMenu->addAction(pAction);
|
pMenu->addAction(pAction);
|
||||||
pGroup->addAction(pAction);
|
pGroup->addAction(pAction);
|
||||||
|
|
@ -1563,9 +1554,9 @@ void MainWindow::initializeStatusObject(QObject *pObject, bool bConnect)
|
||||||
/* initialize combobox */
|
/* initialize combobox */
|
||||||
RSComboBox *pComboBox = dynamic_cast<RSComboBox*>(pObject);
|
RSComboBox *pComboBox = dynamic_cast<RSComboBox*>(pObject);
|
||||||
if (pComboBox) {
|
if (pComboBox) {
|
||||||
pComboBox->addItem(QIcon(StatusDefs::imageStatus(RS_STATUS_ONLINE)), StatusDefs::name(RS_STATUS_ONLINE), RS_STATUS_ONLINE);
|
pComboBox->addItem(QIcon(StatusDefs::imageStatus(RsStatusValue::RS_STATUS_ONLINE)), StatusDefs::name(RsStatusValue::RS_STATUS_ONLINE), (int)RsStatusValue::RS_STATUS_ONLINE);
|
||||||
pComboBox->addItem(QIcon(StatusDefs::imageStatus(RS_STATUS_BUSY)), StatusDefs::name(RS_STATUS_BUSY), RS_STATUS_BUSY);
|
pComboBox->addItem(QIcon(StatusDefs::imageStatus(RsStatusValue::RS_STATUS_BUSY)), StatusDefs::name(RsStatusValue::RS_STATUS_BUSY), (int)RsStatusValue::RS_STATUS_BUSY);
|
||||||
pComboBox->addItem(QIcon(StatusDefs::imageStatus(RS_STATUS_AWAY)), StatusDefs::name(RS_STATUS_AWAY), RS_STATUS_AWAY);
|
pComboBox->addItem(QIcon(StatusDefs::imageStatus(RsStatusValue::RS_STATUS_AWAY)), StatusDefs::name(RsStatusValue::RS_STATUS_AWAY), (int)RsStatusValue::RS_STATUS_AWAY);
|
||||||
|
|
||||||
if (bConnect) {
|
if (bConnect) {
|
||||||
connect(pComboBox, SIGNAL(activated(int)), this, SLOT(statusChangedComboBox(int)));
|
connect(pComboBox, SIGNAL(activated(int)), this, SLOT(statusChangedComboBox(int)));
|
||||||
|
|
@ -1593,11 +1584,11 @@ void MainWindow::removeStatusObject(QObject *pObject)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Save own status Online,Away,Busy **/
|
/** Save own status Online,Away,Busy **/
|
||||||
void MainWindow::setStatus(QObject *pObject, int nStatus)
|
void MainWindow::setStatus(QObject *pObject, RsStatusValue nStatus)
|
||||||
{
|
{
|
||||||
if (isIdle && nStatus == (int) RS_STATUS_ONLINE) {
|
if (isIdle && nStatus == RsStatusValue::RS_STATUS_ONLINE) {
|
||||||
/* set idle only when I am online */
|
/* set idle only when I am online */
|
||||||
nStatus = RS_STATUS_INACTIVE;
|
nStatus = RsStatusValue::RS_STATUS_INACTIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
rsStatus->sendStatus(RsPeerId(), nStatus);
|
rsStatus->sendStatus(RsPeerId(), nStatus);
|
||||||
|
|
@ -1617,7 +1608,7 @@ void MainWindow::statusChangedMenu(QAction *pAction)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setStatus(pAction->parent(), pAction->data().toInt());
|
setStatus(pAction->parent(), RsStatusValue(pAction->data().toInt()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* new status from combobox in statusbar */
|
/* new status from combobox in statusbar */
|
||||||
|
|
@ -1628,7 +1619,7 @@ void MainWindow::statusChangedComboBox(int index)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* no object known */
|
/* no object known */
|
||||||
setStatus(NULL, statusComboBox->itemData(index, Qt::UserRole).toInt());
|
setStatus(NULL, RsStatusValue(statusComboBox->itemData(index, Qt::UserRole).toInt()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*new setting*/
|
/*new setting*/
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,9 @@
|
||||||
#include <QSystemTrayIcon>
|
#include <QSystemTrayIcon>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
|
#include "retroshare/rsevents.h"
|
||||||
|
#include "retroshare/rsstatus.h"
|
||||||
|
|
||||||
#include "gui/common/rwindow.h"
|
#include "gui/common/rwindow.h"
|
||||||
#include "gui/common/RSComboBox.h"
|
#include "gui/common/RSComboBox.h"
|
||||||
#include "util/FontSizeHandler.h"
|
#include "util/FontSizeHandler.h"
|
||||||
|
|
@ -183,7 +186,7 @@ public:
|
||||||
/* initialize widget with status informations, status constant stored in data or in Qt::UserRole */
|
/* initialize widget with status informations, status constant stored in data or in Qt::UserRole */
|
||||||
void initializeStatusObject(QObject *pObject, bool bConnect);
|
void initializeStatusObject(QObject *pObject, bool bConnect);
|
||||||
void removeStatusObject(QObject *pObject);
|
void removeStatusObject(QObject *pObject);
|
||||||
void setStatus(QObject *pObject, int nStatus);
|
void setStatus(QObject *pObject, RsStatusValue nStatus);
|
||||||
|
|
||||||
RSComboBox *statusComboBoxInstance();
|
RSComboBox *statusComboBoxInstance();
|
||||||
PeerStatus *peerstatusInstance();
|
PeerStatus *peerstatusInstance();
|
||||||
|
|
@ -207,9 +210,7 @@ public:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void receiveNewArgs(QStringList args);
|
void receiveNewArgs(QStringList args);
|
||||||
void displayErrorMessage(int,int,const QString&) ;
|
|
||||||
void postModDirectories(bool update_local);
|
void postModDirectories(bool update_local);
|
||||||
void displayDiskSpaceWarning(int loc,int size_limit_mb) ;
|
|
||||||
void checkAndSetIdle(int idleTime);
|
void checkAndSetIdle(int idleTime);
|
||||||
|
|
||||||
void externalLinkActivated(const QUrl &url);
|
void externalLinkActivated(const QUrl &url);
|
||||||
|
|
@ -375,6 +376,7 @@ private:
|
||||||
FontSizeHandler mFontSizeHandler;
|
FontSizeHandler mFontSizeHandler;
|
||||||
|
|
||||||
Ui::MainWindow *ui ;
|
Ui::MainWindow *ui ;
|
||||||
};
|
|
||||||
|
|
||||||
|
RsEventsHandlerId_t mEventHandlerId_friends;
|
||||||
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@
|
||||||
#include <retroshare/rspeers.h>
|
#include <retroshare/rspeers.h>
|
||||||
#include <retroshare/rsmsgs.h>
|
#include <retroshare/rsmsgs.h>
|
||||||
#include <retroshare/rsstatus.h>
|
#include <retroshare/rsstatus.h>
|
||||||
#include <retroshare/rsnotify.h>
|
|
||||||
|
|
||||||
#include "rshare.h"
|
#include "rshare.h"
|
||||||
#include "MessengerWindow.h"
|
#include "MessengerWindow.h"
|
||||||
|
|
@ -37,9 +36,9 @@
|
||||||
|
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
#include "ShareManager.h"
|
#include "ShareManager.h"
|
||||||
#include "notifyqt.h"
|
|
||||||
#include "connect/ConnectFriendWizard.h"
|
#include "connect/ConnectFriendWizard.h"
|
||||||
#include "util/PixmapMerging.h"
|
#include "util/PixmapMerging.h"
|
||||||
|
#include "util/qtthreadsutils.h"
|
||||||
#include "LogoBar.h"
|
#include "LogoBar.h"
|
||||||
#include "util/Widget.h"
|
#include "util/Widget.h"
|
||||||
#include "util/misc.h"
|
#include "util/misc.h"
|
||||||
|
|
@ -95,8 +94,26 @@ MessengerWindow::MessengerWindow(QWidget* parent, Qt::WindowFlags flags)
|
||||||
|
|
||||||
connect(ui.messagelineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(savestatusmessage()));
|
connect(ui.messagelineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(savestatusmessage()));
|
||||||
|
|
||||||
connect(NotifyQt::getInstance(), SIGNAL(ownStatusMessageChanged()), this, SLOT(loadmystatusmessage()));
|
mEventHandlerId = 0;
|
||||||
connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(QString,int)), this, SLOT(updateOwnStatus(QString,int)));
|
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e)
|
||||||
|
{
|
||||||
|
RsQThreadUtils::postToObject([=](){
|
||||||
|
auto fe = dynamic_cast<const RsFriendListEvent*>(e.get());
|
||||||
|
|
||||||
|
if(!fe) return;
|
||||||
|
|
||||||
|
switch(fe->mEventCode)
|
||||||
|
{
|
||||||
|
case RsFriendListEventCode::NODE_STATUS_CHANGED: updateOwnStatus(QString::fromStdString(fe->mSslId.toStdString()),fe->mStatus);
|
||||||
|
break;
|
||||||
|
case RsFriendListEventCode::OWN_STATUS_CHANGED: loadmystatusmessage();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}, this );
|
||||||
|
},mEventHandlerId,RsEventType::FRIEND_LIST);
|
||||||
|
|
||||||
for (std::set<RsPgpId>::iterator peerIt = expandedPeers.begin(); peerIt != expandedPeers.end(); ++peerIt) {
|
for (std::set<RsPgpId>::iterator peerIt = expandedPeers.begin(); peerIt != expandedPeers.end(); ++peerIt) {
|
||||||
ui.friendList->addPeerToExpand(*peerIt);
|
ui.friendList->addPeerToExpand(*peerIt);
|
||||||
|
|
@ -159,6 +176,7 @@ MessengerWindow::~MessengerWindow ()
|
||||||
{
|
{
|
||||||
// save settings
|
// save settings
|
||||||
processSettings(false);
|
processSettings(false);
|
||||||
|
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||||
|
|
||||||
MainWindow *pMainWindow = MainWindow::getInstance();
|
MainWindow *pMainWindow = MainWindow::getInstance();
|
||||||
if (pMainWindow) {
|
if (pMainWindow) {
|
||||||
|
|
@ -214,7 +232,7 @@ void MessengerWindow::savestatusmessage()
|
||||||
rsMsgs->setCustomStateString(ui.messagelineEdit->currentText().toUtf8().constData());
|
rsMsgs->setCustomStateString(ui.messagelineEdit->currentText().toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessengerWindow::updateOwnStatus(const QString &peer_id, int status)
|
void MessengerWindow::updateOwnStatus(const QString &peer_id, RsStatusValue status)
|
||||||
{
|
{
|
||||||
// add self nick + own status
|
// add self nick + own status
|
||||||
if (peer_id == QString::fromStdString(rsPeers->getOwnId().toStdString()))
|
if (peer_id == QString::fromStdString(rsPeers->getOwnId().toStdString()))
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ private slots:
|
||||||
/** Open Shared Manager **/
|
/** Open Shared Manager **/
|
||||||
void openShareManager();
|
void openShareManager();
|
||||||
|
|
||||||
void updateOwnStatus(const QString &peer_id, int status);
|
void updateOwnStatus(const QString &peer_id, RsStatusValue status);
|
||||||
|
|
||||||
void savestatusmessage();
|
void savestatusmessage();
|
||||||
|
|
||||||
|
|
@ -68,6 +68,7 @@ private:
|
||||||
|
|
||||||
static std::set<RsPgpId> expandedPeers ;
|
static std::set<RsPgpId> expandedPeers ;
|
||||||
static std::set<RsNodeGroupId> expandedGroups ;
|
static std::set<RsNodeGroupId> expandedGroups ;
|
||||||
|
RsEventsHandlerId_t mEventHandlerId ;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include "gui/elastic/elnode.h"
|
#include "gui/elastic/elnode.h"
|
||||||
|
#include "util/qtthreadsutils.h"
|
||||||
|
|
||||||
/********
|
/********
|
||||||
* #define DEBUG_NETWORKVIEW
|
* #define DEBUG_NETWORKVIEW
|
||||||
|
|
@ -60,12 +61,32 @@ NetworkView::NetworkView(QWidget *parent)
|
||||||
connect( ui.nameBox, SIGNAL(textChanged(QString)), this, SLOT(setNameSearch(QString)));
|
connect( ui.nameBox, SIGNAL(textChanged(QString)), this, SLOT(setNameSearch(QString)));
|
||||||
|
|
||||||
_should_update = true ;
|
_should_update = true ;
|
||||||
|
|
||||||
|
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event)
|
||||||
|
{
|
||||||
|
RsQThreadUtils::postToObject([=](){
|
||||||
|
auto ev = dynamic_cast<const RsGossipDiscoveryEvent *>(event.get());
|
||||||
|
|
||||||
|
if(!ev) return;
|
||||||
|
|
||||||
|
switch(ev->mGossipDiscoveryEventType)
|
||||||
|
{
|
||||||
|
case RsGossipDiscoveryEventType::DISCOVERY_INFO_RECEIVED: update();
|
||||||
|
[[fallthrough]];
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}, this );
|
||||||
|
}, mEventHandlerId, RsEventType::GOSSIP_DISCOVERY );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkView::~NetworkView()
|
NetworkView::~NetworkView()
|
||||||
{
|
{
|
||||||
if(mScene != NULL)
|
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||||
delete mScene ;
|
|
||||||
|
if(mScene != NULL)
|
||||||
|
delete mScene ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkView::setEdgeLength(int l)
|
void NetworkView::setEdgeLength(int l)
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
#include <QGraphicsScene>
|
#include <QGraphicsScene>
|
||||||
|
|
||||||
#include <retroshare/rstypes.h>
|
#include <retroshare/rstypes.h>
|
||||||
|
#include <retroshare/rsevents.h>
|
||||||
|
|
||||||
#include <retroshare-gui/RsAutoUpdatePage.h>
|
#include <retroshare-gui/RsAutoUpdatePage.h>
|
||||||
#include "ui_NetworkView.h"
|
#include "ui_NetworkView.h"
|
||||||
|
|
@ -65,6 +66,7 @@ class NetworkView : public RsAutoUpdatePage
|
||||||
std::map<RsPgpId,GraphWidget::NodeId> _node_ids ;
|
std::map<RsPgpId,GraphWidget::NodeId> _node_ids ;
|
||||||
|
|
||||||
bool _should_update ;
|
bool _should_update ;
|
||||||
|
RsEventsHandlerId_t mEventHandlerId;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@
|
||||||
#include <retroshare/rsgxschannels.h>
|
#include <retroshare/rsgxschannels.h>
|
||||||
#include <retroshare/rsgxsforums.h>
|
#include <retroshare/rsgxsforums.h>
|
||||||
#include <retroshare/rsmsgs.h>
|
#include <retroshare/rsmsgs.h>
|
||||||
#include <retroshare/rsnotify.h>
|
|
||||||
#include <retroshare/rspeers.h>
|
#include <retroshare/rspeers.h>
|
||||||
#include <retroshare/rsplugin.h>
|
#include <retroshare/rsplugin.h>
|
||||||
#include <retroshare/rsposted.h>
|
#include <retroshare/rsposted.h>
|
||||||
|
|
@ -58,7 +57,6 @@
|
||||||
#include "msgs/MessageInterface.h"
|
#include "msgs/MessageInterface.h"
|
||||||
|
|
||||||
#include "common/FeedNotify.h"
|
#include "common/FeedNotify.h"
|
||||||
#include "notifyqt.h"
|
|
||||||
|
|
||||||
#define ROLE_RECEIVED FEED_TREEWIDGET_SORTROLE
|
#define ROLE_RECEIVED FEED_TREEWIDGET_SORTROLE
|
||||||
|
|
||||||
|
|
@ -76,7 +74,7 @@ static NewsFeed* instance = nullptr;
|
||||||
NewsFeed::NewsFeed(QWidget *parent) : MainPage(parent), ui(new Ui::NewsFeed),
|
NewsFeed::NewsFeed(QWidget *parent) : MainPage(parent), ui(new Ui::NewsFeed),
|
||||||
mEventTypes({
|
mEventTypes({
|
||||||
RsEventType::AUTHSSL_CONNECTION_AUTENTICATION,
|
RsEventType::AUTHSSL_CONNECTION_AUTENTICATION,
|
||||||
RsEventType::PEER_CONNECTION ,
|
RsEventType::FRIEND_LIST ,
|
||||||
RsEventType::GXS_CIRCLES ,
|
RsEventType::GXS_CIRCLES ,
|
||||||
RsEventType::GXS_CHANNELS ,
|
RsEventType::GXS_CHANNELS ,
|
||||||
RsEventType::GXS_FORUMS ,
|
RsEventType::GXS_FORUMS ,
|
||||||
|
|
@ -192,27 +190,27 @@ void NewsFeed::handleEvent(std::shared_ptr<const RsEvent> event)
|
||||||
|
|
||||||
void NewsFeed::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)
|
void NewsFeed::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)
|
||||||
{
|
{
|
||||||
uint flags = Settings->getNewsFeedFlags();
|
RsFeedTypeFlags flags = (RsFeedTypeFlags)Settings->getNewsFeedFlags();
|
||||||
|
|
||||||
if(event->mType == RsEventType::AUTHSSL_CONNECTION_AUTENTICATION && (flags & RS_FEED_TYPE_SECURITY))
|
if(event->mType == RsEventType::AUTHSSL_CONNECTION_AUTENTICATION && (!!(flags & RsFeedTypeFlags::RS_FEED_TYPE_SECURITY)))
|
||||||
handleSecurityEvent(event);
|
handleSecurityEvent(event);
|
||||||
|
|
||||||
if(event->mType == RsEventType::PEER_CONNECTION && (flags & RS_FEED_TYPE_PEER))
|
if(event->mType == RsEventType::FRIEND_LIST && (!!(flags & RsFeedTypeFlags::RS_FEED_TYPE_PEER)))
|
||||||
handleConnectionEvent(event);
|
handleConnectionEvent(event);
|
||||||
|
|
||||||
if(event->mType == RsEventType::GXS_CIRCLES && (flags & RS_FEED_TYPE_CIRCLE))
|
if(event->mType == RsEventType::GXS_CIRCLES && (!!(flags & RsFeedTypeFlags::RS_FEED_TYPE_CIRCLE)))
|
||||||
handleCircleEvent(event);
|
handleCircleEvent(event);
|
||||||
|
|
||||||
if(event->mType == RsEventType::GXS_CHANNELS && (flags & RS_FEED_TYPE_CHANNEL))
|
if(event->mType == RsEventType::GXS_CHANNELS && (!!(flags & RsFeedTypeFlags::RS_FEED_TYPE_CHANNEL)))
|
||||||
handleChannelEvent(event);
|
handleChannelEvent(event);
|
||||||
|
|
||||||
if(event->mType == RsEventType::GXS_FORUMS && (flags & RS_FEED_TYPE_FORUM))
|
if(event->mType == RsEventType::GXS_FORUMS && (!!(flags & RsFeedTypeFlags::RS_FEED_TYPE_FORUM)))
|
||||||
handleForumEvent(event);
|
handleForumEvent(event);
|
||||||
|
|
||||||
if(event->mType == RsEventType::GXS_POSTED && (flags & RS_FEED_TYPE_POSTED))
|
if(event->mType == RsEventType::GXS_POSTED && (!!(flags & RsFeedTypeFlags::RS_FEED_TYPE_POSTED)))
|
||||||
handlePostedEvent(event);
|
handlePostedEvent(event);
|
||||||
|
|
||||||
if(event->mType == RsEventType::MAIL_STATUS && (flags & RS_FEED_TYPE_MSG))
|
if(event->mType == RsEventType::MAIL_STATUS && (!!(flags & RsFeedTypeFlags::RS_FEED_TYPE_MSG)))
|
||||||
handleMailEvent(event);
|
handleMailEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -389,25 +387,25 @@ void NewsFeed::handleCircleEvent(std::shared_ptr<const RsEvent> event)
|
||||||
case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_REQUEST:
|
case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_REQUEST:
|
||||||
// only show membership requests if we're an admin of that circle
|
// only show membership requests if we're an admin of that circle
|
||||||
if(details.isIdInInviteeList(pe->mGxsId))
|
if(details.isIdInInviteeList(pe->mGxsId))
|
||||||
addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RS_FEED_ITEM_CIRCLE_MEMB_JOIN),true);
|
addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_MEMB_JOIN),true);
|
||||||
else if(details.mAmIAdmin)
|
else if(details.mAmIAdmin)
|
||||||
addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RS_FEED_ITEM_CIRCLE_MEMB_REQ),true);
|
addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_MEMB_REQ),true);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_LEAVE:
|
case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_LEAVE:
|
||||||
|
|
||||||
if(details.isIdInInviteeList(pe->mGxsId))
|
if(details.isIdInInviteeList(pe->mGxsId))
|
||||||
addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RS_FEED_ITEM_CIRCLE_MEMB_LEAVE),true);
|
addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_MEMB_LEAVE),true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_ID_ADDED_TO_INVITEE_LIST:
|
case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_ID_ADDED_TO_INVITEE_LIST:
|
||||||
if(rsIdentity->isOwnId(pe->mGxsId))
|
if(rsIdentity->isOwnId(pe->mGxsId))
|
||||||
{
|
{
|
||||||
if(details.isIdRequestingMembership(pe->mGxsId))
|
if(details.isIdRequestingMembership(pe->mGxsId))
|
||||||
addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RS_FEED_ITEM_CIRCLE_MEMB_ACCEPTED),true);
|
addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_MEMB_ACCEPTED),true);
|
||||||
else
|
else
|
||||||
addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RS_FEED_ITEM_CIRCLE_INVITE_REC),true);
|
addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_INVITE_REC),true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -415,9 +413,9 @@ void NewsFeed::handleCircleEvent(std::shared_ptr<const RsEvent> event)
|
||||||
if(rsIdentity->isOwnId(pe->mGxsId))
|
if(rsIdentity->isOwnId(pe->mGxsId))
|
||||||
{
|
{
|
||||||
if(details.isIdRequestingMembership(pe->mGxsId))
|
if(details.isIdRequestingMembership(pe->mGxsId))
|
||||||
addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RS_FEED_ITEM_CIRCLE_MEMB_REVOKED),true);
|
addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_MEMB_REVOKED),true);
|
||||||
else
|
else
|
||||||
addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RS_FEED_ITEM_CIRCLE_INVITE_CANCELLED),true);
|
addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_INVITE_CANCELLED),true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -428,31 +426,26 @@ void NewsFeed::handleCircleEvent(std::shared_ptr<const RsEvent> event)
|
||||||
|
|
||||||
void NewsFeed::handleConnectionEvent(std::shared_ptr<const RsEvent> event)
|
void NewsFeed::handleConnectionEvent(std::shared_ptr<const RsEvent> event)
|
||||||
{
|
{
|
||||||
const RsConnectionEvent *pe = dynamic_cast<const RsConnectionEvent*>(event.get());
|
const RsFriendListEvent *pe = dynamic_cast<const RsFriendListEvent*>(event.get());
|
||||||
if(!pe) return;
|
if(!pe) return;
|
||||||
|
|
||||||
auto& e(*pe);
|
auto& e(*pe);
|
||||||
|
|
||||||
#ifdef NEWS_DEBUG
|
switch(e.mEventCode)
|
||||||
std::cerr << "NotifyQt: handling connection event from peer " << e.mSslId << std::endl;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
switch(e.mConnectionInfoCode)
|
|
||||||
{
|
{
|
||||||
case RsConnectionEventCode::PEER_CONNECTED:
|
case RsFriendListEventCode::NODE_CONNECTED:
|
||||||
addFeedItemIfUnique(new PeerItem(this, NEWSFEED_PEERLIST, e.mSslId, PEER_TYPE_CONNECT, false), true);
|
addFeedItemIfUnique(new PeerItem(this, NEWSFEED_PEERLIST, e.mSslId, PEER_TYPE_CONNECT, false), true);
|
||||||
NotifyQt::getInstance()->addToaster(RS_POPUP_CONNECT, e.mSslId.toStdString().c_str(), "", "");
|
|
||||||
break;
|
break;
|
||||||
case RsConnectionEventCode::PEER_DISCONNECTED: // not handled yet
|
case RsFriendListEventCode::NODE_DISCONNECTED: // not handled yet
|
||||||
break;
|
break;
|
||||||
case RsConnectionEventCode::PEER_TIME_SHIFT:
|
case RsFriendListEventCode::NODE_TIME_SHIFT:
|
||||||
addFeedItemIfUnique(new PeerItem(this, NEWSFEED_PEERLIST, e.mSslId, PEER_TYPE_OFFSET, false),false);
|
addFeedItemIfUnique(new PeerItem(this, NEWSFEED_PEERLIST, e.mSslId, PEER_TYPE_OFFSET, false),false);
|
||||||
break;
|
break;
|
||||||
case RsConnectionEventCode::PEER_REPORTS_WRONG_IP:
|
case RsFriendListEventCode::NODE_REPORTS_WRONG_IP:
|
||||||
addFeedItemIfUnique(new SecurityIpItem(
|
addFeedItemIfUnique(new SecurityIpItem(
|
||||||
this, e.mSslId, e.mOwnLocator.toString(),
|
this, e.mSslId, e.mOwnLocator.toString(),
|
||||||
e.mReportedLocator.toString(),
|
e.mReportedLocator.toString(),
|
||||||
RS_FEED_ITEM_SEC_IP_WRONG_EXTERNAL_IP_REPORTED,
|
RsFeedTypeFlags::RS_FEED_ITEM_SEC_IP_WRONG_EXTERNAL_IP_REPORTED,
|
||||||
false ), false);
|
false ), false);
|
||||||
break;
|
break;
|
||||||
default: break;
|
default: break;
|
||||||
|
|
@ -467,34 +460,31 @@ void NewsFeed::handleSecurityEvent(std::shared_ptr<const RsEvent> event)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto& e(*pe);
|
auto& e(*pe);
|
||||||
#ifdef NEWS_DEBUG
|
RsFeedTypeFlags flags = (RsFeedTypeFlags)Settings->getNewsFeedFlags();
|
||||||
std::cerr << "NotifyQt: handling security event from (" << e.mSslId << "," << e.mPgpId << ") error code: " << (int)e.mErrorCode << std::endl;
|
|
||||||
#endif
|
|
||||||
uint flags = Settings->getNewsFeedFlags();
|
|
||||||
|
|
||||||
if(e.mErrorCode == RsAuthSslError::PEER_REFUSED_CONNECTION && (flags & RS_FEED_TYPE_SECURITY_IP))
|
if(e.mErrorCode == RsAuthSslError::PEER_REFUSED_CONNECTION && (!!(flags & RsFeedTypeFlags::RS_FEED_TYPE_SECURITY_IP)))
|
||||||
{
|
{
|
||||||
addFeedItemIfUnique(new PeerItem(this, NEWSFEED_PEERLIST, e.mSslId, PEER_TYPE_HELLO, false), true );
|
addFeedItemIfUnique(new PeerItem(this, NEWSFEED_PEERLIST, e.mSslId, PEER_TYPE_HELLO, false), true );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32_t FeedItemType=0;
|
RsFeedTypeFlags FeedItemType(RsFeedTypeFlags::RS_FEED_TYPE_NONE);
|
||||||
|
|
||||||
switch(e.mErrorCode)
|
switch(e.mErrorCode)
|
||||||
{
|
{
|
||||||
case RsAuthSslError::NO_CERTIFICATE_SUPPLIED: // fallthrough
|
case RsAuthSslError::NO_CERTIFICATE_SUPPLIED: // fallthrough
|
||||||
case RsAuthSslError::MISMATCHED_PGP_ID: // fallthrough
|
case RsAuthSslError::MISMATCHED_PGP_ID: // fallthrough
|
||||||
case RsAuthSslError::MISSING_AUTHENTICATION_INFO:
|
case RsAuthSslError::MISSING_AUTHENTICATION_INFO:
|
||||||
FeedItemType = RS_FEED_ITEM_SEC_BAD_CERTIFICATE; break;
|
FeedItemType = RsFeedTypeFlags::RS_FEED_ITEM_SEC_BAD_CERTIFICATE; break;
|
||||||
case RsAuthSslError::PGP_SIGNATURE_VALIDATION_FAILED:
|
case RsAuthSslError::PGP_SIGNATURE_VALIDATION_FAILED:
|
||||||
FeedItemType = RS_FEED_ITEM_SEC_WRONG_SIGNATURE; break;
|
FeedItemType = RsFeedTypeFlags::RS_FEED_ITEM_SEC_WRONG_SIGNATURE; break;
|
||||||
case RsAuthSslError::NOT_A_FRIEND:
|
case RsAuthSslError::NOT_A_FRIEND:
|
||||||
FeedItemType = RS_FEED_ITEM_SEC_CONNECT_ATTEMPT; break;
|
FeedItemType = RsFeedTypeFlags::RS_FEED_ITEM_SEC_CONNECT_ATTEMPT; break;
|
||||||
case RsAuthSslError::IP_IS_BLACKLISTED:
|
case RsAuthSslError::IP_IS_BLACKLISTED:
|
||||||
FeedItemType = RS_FEED_ITEM_SEC_IP_BLACKLISTED; break;
|
FeedItemType = RsFeedTypeFlags::RS_FEED_ITEM_SEC_IP_BLACKLISTED; break;
|
||||||
case RsAuthSslError::MISSING_CERTIFICATE:
|
case RsAuthSslError::MISSING_CERTIFICATE:
|
||||||
FeedItemType = RS_FEED_ITEM_SEC_MISSING_CERTIFICATE; break;
|
FeedItemType = RsFeedTypeFlags::RS_FEED_ITEM_SEC_MISSING_CERTIFICATE; break;
|
||||||
default:
|
default:
|
||||||
return; // display nothing
|
return; // display nothing
|
||||||
}
|
}
|
||||||
|
|
@ -504,13 +494,11 @@ void NewsFeed::handleSecurityEvent(std::shared_ptr<const RsEvent> event)
|
||||||
|
|
||||||
addFeedItemIfUnique(new SecurityItem(this, NEWSFEED_SECLIST, e.mPgpId, e.mSslId, det.location, e.mLocator.toString(), FeedItemType, false), true );
|
addFeedItemIfUnique(new SecurityItem(this, NEWSFEED_SECLIST, e.mPgpId, e.mSslId, det.location, e.mLocator.toString(), FeedItemType, false), true );
|
||||||
|
|
||||||
if (Settings->getMessageFlags() & RS_MESSAGE_CONNECT_ATTEMPT)
|
if (Settings->getMessageFlags() & RshareSettings::RS_MESSAGE_CONNECT_ATTEMPT)
|
||||||
MessageComposer::addConnectAttemptMsg(e.mPgpId, e.mSslId, QString::fromStdString(det.name + "(" + det.location + ")"));
|
MessageComposer::addConnectAttemptMsg(e.mPgpId, e.mSslId, QString::fromStdString(det.name + "(" + det.location + ")"));
|
||||||
|
|
||||||
NotifyQt::getInstance()->addToaster(RS_POPUP_CONNECT_ATTEMPT, e.mPgpId.toStdString().c_str(), det.location, e.mSslId.toStdString().c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewsFeed::testFeeds(uint /*notifyFlags*/)
|
void NewsFeed::testFeeds(RsFeedTypeFlags /*notifyFlags*/)
|
||||||
{
|
{
|
||||||
uint flags = Settings->getNewsFeedFlags();
|
uint flags = Settings->getNewsFeedFlags();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
#include <retroshare-gui/mainpage.h>
|
#include <retroshare-gui/mainpage.h>
|
||||||
|
|
||||||
#include "gui/feeds/FeedHolder.h"
|
#include "gui/feeds/FeedHolder.h"
|
||||||
|
#include "gui/feeds/FeedItem.h"
|
||||||
#include <retroshare-gui/RsAutoUpdatePage.h>
|
#include <retroshare-gui/RsAutoUpdatePage.h>
|
||||||
|
|
||||||
#define IMAGE_NEWSFEED ":/icons/png/newsfeed.png"
|
#define IMAGE_NEWSFEED ":/icons/png/newsfeed.png"
|
||||||
|
|
@ -67,19 +68,19 @@ public:
|
||||||
/** Default Destructor */
|
/** Default Destructor */
|
||||||
virtual ~NewsFeed();
|
virtual ~NewsFeed();
|
||||||
|
|
||||||
virtual QIcon iconPixmap() const { return QIcon(IMAGE_NEWSFEED) ; } //MainPage
|
virtual QIcon iconPixmap() const override { return QIcon(IMAGE_NEWSFEED) ; } //MainPage
|
||||||
virtual QString pageName() const { return tr("Activity") ; } //MainPage
|
virtual QString pageName() const override { return tr("Activity") ; } //MainPage
|
||||||
virtual QString helpText() const { return ""; } //MainPage
|
virtual QString helpText() const override { return ""; } //MainPage
|
||||||
|
|
||||||
virtual UserNotify *createUserNotify(QObject *parent) override;
|
virtual UserNotify *createUserNotify(QObject *parent) override;
|
||||||
|
|
||||||
/* FeedHolder Functions (for FeedItem functionality) */
|
/* FeedHolder Functions (for FeedItem functionality) */
|
||||||
virtual QScrollArea *getScrollArea();
|
virtual QScrollArea *getScrollArea()override ;
|
||||||
virtual void deleteFeedItem(FeedItem *item, uint32_t type);
|
virtual void deleteFeedItem(FeedItem *item, uint32_t type)override ;
|
||||||
virtual void openChat(const RsPeerId& peerId);
|
virtual void openChat(const RsPeerId& peerId)override ;
|
||||||
virtual void openComments(uint32_t type, const RsGxsGroupId &groupId, const QVector<RsGxsMessageId> &versions, const RsGxsMessageId &msgId, const QString &title);
|
virtual void openComments(uint32_t type, const RsGxsGroupId &groupId, const QVector<RsGxsMessageId> &versions, const RsGxsMessageId &msgId, const QString &title)override ;
|
||||||
|
|
||||||
static void testFeeds(uint notifyFlags);
|
static void testFeeds(RsFeedTypeFlags notifyFlags);
|
||||||
static void testFeed(FeedNotify *feedNotify);
|
static void testFeed(FeedNotify *feedNotify);
|
||||||
|
|
||||||
void handleEvent(std::shared_ptr<const RsEvent> event); // get events from libretroshare
|
void handleEvent(std::shared_ptr<const RsEvent> event); // get events from libretroshare
|
||||||
|
|
|
||||||
|
|
@ -37,8 +37,8 @@
|
||||||
#include "gui/common/UIStateHelper.h"
|
#include "gui/common/UIStateHelper.h"
|
||||||
#include "gui/common/RSTabWidget.h"
|
#include "gui/common/RSTabWidget.h"
|
||||||
#include "gui/settings/rsharesettings.h"
|
#include "gui/settings/rsharesettings.h"
|
||||||
|
#include "gui/RsGUIEventManager.h"
|
||||||
#include "gui/feeds/SubFileItem.h"
|
#include "gui/feeds/SubFileItem.h"
|
||||||
#include "gui/notifyqt.h"
|
|
||||||
#include "gui/Identity/IdDialog.h"
|
#include "gui/Identity/IdDialog.h"
|
||||||
#include "gui/RetroShareLink.h"
|
#include "gui/RetroShareLink.h"
|
||||||
#include "util/HandleRichText.h"
|
#include "util/HandleRichText.h"
|
||||||
|
|
@ -289,7 +289,7 @@ PostedListWidgetWithModel::PostedListWidgetWithModel(const RsGxsGroupId& postedI
|
||||||
connect(ui->submitPostButton, SIGNAL(clicked()), this, SLOT(createMsg()));
|
connect(ui->submitPostButton, SIGNAL(clicked()), this, SLOT(createMsg()));
|
||||||
connect(ui->subscribeToolButton, SIGNAL(subscribe(bool)), this, SLOT(subscribeGroup(bool)));
|
connect(ui->subscribeToolButton, SIGNAL(subscribe(bool)), this, SLOT(subscribeGroup(bool)));
|
||||||
connect(ui->filter_LE, SIGNAL(textChanged(QString)), this, SLOT(filterItems(QString)));
|
connect(ui->filter_LE, SIGNAL(textChanged(QString)), this, SLOT(filterItems(QString)));
|
||||||
connect(NotifyQt::getInstance(), SIGNAL(settingsChanged()),this, SLOT(settingsChanged()));
|
connect(RsGUIEventManager::getInstance(), SIGNAL(settingsChanged()),this, SLOT(settingsChanged()));
|
||||||
|
|
||||||
/* add filter actions */
|
/* add filter actions */
|
||||||
ui->postsTree->setPlaceholderText(tr("No posts available in this board"));
|
ui->postsTree->setPlaceholderText(tr("No posts available in this board"));
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,6 @@
|
||||||
#include <retroshare/rsgxsforums.h>
|
#include <retroshare/rsgxsforums.h>
|
||||||
#include <retroshare/rsidentity.h>
|
#include <retroshare/rsidentity.h>
|
||||||
#include <retroshare/rsmsgs.h>
|
#include <retroshare/rsmsgs.h>
|
||||||
#include <retroshare/rsnotify.h>
|
|
||||||
#include <retroshare/rspeers.h>
|
#include <retroshare/rspeers.h>
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
@ -1758,7 +1757,7 @@ static void processList(const QStringList &list, const QString &textSingular, co
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ChatDialog* chatDialog = ChatDialog::getChat(chatId, Settings->getChatFlags());
|
ChatDialog* chatDialog = ChatDialog::getChat(chatId, (RsChatFlags)Settings->getChatFlags());
|
||||||
if (chatDialog) {
|
if (chatDialog) {
|
||||||
chatroomFound.append(link.name());
|
chatroomFound.append(link.name());
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
732
retroshare-gui/src/gui/RsGUIEventManager.cpp
Normal file
732
retroshare-gui/src/gui/RsGUIEventManager.cpp
Normal file
|
|
@ -0,0 +1,732 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* gui/RsGUIEventManager.cpp *
|
||||||
|
* *
|
||||||
|
* Copyright (c) 2010 Retroshare Team <retroshare.project@gmail.com> *
|
||||||
|
* *
|
||||||
|
* This program is free software: you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU Affero General Public License as *
|
||||||
|
* published by the Free Software Foundation, either version 3 of the *
|
||||||
|
* License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU Affero General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU Affero General Public License *
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
||||||
|
* *
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#include "gui/common/FilesDefs.h"
|
||||||
|
#include <retroshare/rsgxsifacehelper.h>
|
||||||
|
|
||||||
|
#include <retroshare/rspeers.h>
|
||||||
|
#include <retroshare/rsidentity.h>
|
||||||
|
#include <retroshare/rsmsgs.h>
|
||||||
|
#include <retroshare/rsinit.h>
|
||||||
|
#include <util/rsdir.h>
|
||||||
|
#include <util/qtthreadsutils.h>
|
||||||
|
|
||||||
|
#include <retroshare-gui/RsAutoUpdatePage.h>
|
||||||
|
|
||||||
|
#include "rshare.h"
|
||||||
|
#include "MainWindow.h"
|
||||||
|
#include "toaster/OnlineToaster.h"
|
||||||
|
#include "toaster/MessageToaster.h"
|
||||||
|
#include "toaster/DownloadToaster.h"
|
||||||
|
#include "toaster/ChatToaster.h"
|
||||||
|
#include "toaster/GroupChatToaster.h"
|
||||||
|
#include "toaster/ChatLobbyToaster.h"
|
||||||
|
#include "toaster/FriendRequestToaster.h"
|
||||||
|
#include "toaster/ToasterItem.h"
|
||||||
|
#include "common/ToasterNotify.h"
|
||||||
|
#include "RsGUIEventManager.h"
|
||||||
|
|
||||||
|
#include "chat/ChatDialog.h"
|
||||||
|
#include "chat/ChatLobbyDialog.h"
|
||||||
|
#include "chat/ChatWidget.h"
|
||||||
|
#include "FriendsDialog.h"
|
||||||
|
#include "gui/settings/rsharesettings.h"
|
||||||
|
#include "SoundManager.h"
|
||||||
|
|
||||||
|
#include "retroshare/rsplugin.h"
|
||||||
|
|
||||||
|
#include <QInputDialog>
|
||||||
|
#include <QMessageBox>
|
||||||
|
//#include <QMutexLocker>
|
||||||
|
#include <QThread>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
|
/*****
|
||||||
|
* #define NOTIFY_DEBUG
|
||||||
|
****/
|
||||||
|
|
||||||
|
/*static*/ RsGUIEventManager *RsGUIEventManager::_instance = nullptr;
|
||||||
|
/*static*/ bool RsGUIEventManager::_disableAllToaster = false;
|
||||||
|
|
||||||
|
/*static*/ void RsGUIEventManager::Create ()
|
||||||
|
{
|
||||||
|
if (_instance == nullptr)
|
||||||
|
_instance = new RsGUIEventManager ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*static*/ RsGUIEventManager *RsGUIEventManager::getInstance ()
|
||||||
|
{
|
||||||
|
return _instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*static*/ bool RsGUIEventManager::isAllDisable ()
|
||||||
|
{
|
||||||
|
return _disableAllToaster;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RsGUIEventManager::SetDisableAll(bool bValue)
|
||||||
|
{
|
||||||
|
if (bValue!=_disableAllToaster)
|
||||||
|
{
|
||||||
|
_disableAllToaster=bValue;
|
||||||
|
emit disableAllChanged(bValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RsGUIEventManager::RsGUIEventManager() : cDialog(NULL)
|
||||||
|
{
|
||||||
|
runningToasterTimer = new QTimer(this);
|
||||||
|
connect(runningToasterTimer, SIGNAL(timeout()), this, SLOT(runningTick()));
|
||||||
|
runningToasterTimer->setInterval(10); // tick 100 times a second
|
||||||
|
runningToasterTimer->setSingleShot(true);
|
||||||
|
{
|
||||||
|
QMutexLocker m(&_mutex) ;
|
||||||
|
_enabled = false ;
|
||||||
|
}
|
||||||
|
|
||||||
|
#warning TODO: do we need a timer anymore??
|
||||||
|
|
||||||
|
// Catch all events that require toasters and
|
||||||
|
|
||||||
|
mEventHandlerId = 0;
|
||||||
|
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event)
|
||||||
|
{
|
||||||
|
if(event->mType == RsEventType::SYSTEM && dynamic_cast<const RsSystemEvent*>(event.get())->mEventCode == RsSystemEventCode::PASSWORD_REQUESTED)
|
||||||
|
sync_handleIncomingEvent(event);
|
||||||
|
else
|
||||||
|
RsQThreadUtils::postToObject([=](){ async_handleIncomingEvent(event); }, this );
|
||||||
|
}, mEventHandlerId); // No event type means we expect to catch all possible events
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RsGUIEventManager::GUI_askForPassword(const std::string& title, const std::string& key_details, bool prev_is_bad)
|
||||||
|
{
|
||||||
|
RsAutoUpdatePage::lockAllEvents() ;
|
||||||
|
|
||||||
|
QString windowTitle;
|
||||||
|
if (title == "")
|
||||||
|
windowTitle = tr("Passphrase required");
|
||||||
|
else if (title == "AuthSSLimpl::SignX509ReqWithGPG()")
|
||||||
|
windowTitle = tr("You need to sign your node's certificate.");
|
||||||
|
else if (title == "p3IdService::service_CreateGroup()")
|
||||||
|
windowTitle = tr("You need to sign your forum/chatrooms identity.");
|
||||||
|
else
|
||||||
|
windowTitle = QString::fromStdString(title);
|
||||||
|
|
||||||
|
QString labelText = ( prev_is_bad ? QString("%1<br/><br/>").arg(tr("Wrong password !")) : QString() )
|
||||||
|
+ QString("<b>%1</b><br/>Profile: <i>%2</i>\n")
|
||||||
|
.arg( tr("Please enter your Retroshare passphrase")
|
||||||
|
, QString::fromUtf8(key_details.c_str()) );
|
||||||
|
|
||||||
|
QLineEdit::EchoMode textEchoMode = QLineEdit::Password;
|
||||||
|
bool modal = true;
|
||||||
|
|
||||||
|
bool sameThread = QThread::currentThread() == qApp->thread();
|
||||||
|
Gui_InputDialogReturn ret;
|
||||||
|
qRegisterMetaType<Gui_InputDialogReturn>("Gui_InputDialogReturn");
|
||||||
|
QMetaObject::invokeMethod( MainWindow::getInstance()
|
||||||
|
, "guiInputDialog"
|
||||||
|
, sameThread ? Qt::DirectConnection : Qt::BlockingQueuedConnection
|
||||||
|
, Q_RETURN_ARG(Gui_InputDialogReturn, ret)
|
||||||
|
, Q_ARG(QString, windowTitle)
|
||||||
|
, Q_ARG(QString, labelText)
|
||||||
|
, Q_ARG(QLineEdit::EchoMode, textEchoMode)
|
||||||
|
, Q_ARG(bool, modal)
|
||||||
|
);
|
||||||
|
//cancelled = false ;
|
||||||
|
|
||||||
|
RsAutoUpdatePage::unlockAllEvents() ;
|
||||||
|
|
||||||
|
if (ret.execReturn == QDialog::Rejected) {
|
||||||
|
RsLoginHelper::clearPgpPassphrase();
|
||||||
|
//cancelled = true ;
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ret.execReturn == QDialog::Accepted) {
|
||||||
|
auto password = ret.textValue.toUtf8().constData();
|
||||||
|
RsLoginHelper::cachePgpPassphrase(password);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
RsLoginHelper::clearPgpPassphrase();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
bool RsGUIEventManager::GUI_askForPluginConfirmation(const std::string& plugin_file_name, const RsFileHash& plugin_file_hash, bool first_time)
|
||||||
|
{
|
||||||
|
// By default, when no information is known about plugins, just dont load them. They will be enabled from the GUI by the user.
|
||||||
|
|
||||||
|
if(first_time)
|
||||||
|
return false ;
|
||||||
|
|
||||||
|
RsAutoUpdatePage::lockAllEvents() ;
|
||||||
|
|
||||||
|
QMessageBox dialog;
|
||||||
|
dialog.setWindowTitle(tr("Unregistered plugin/executable"));
|
||||||
|
|
||||||
|
QString text ;
|
||||||
|
text += tr( "RetroShare has detected an unregistered plugin. This happens in two cases:<UL><LI>Your RetroShare executable has changed.</LI><LI>The plugin has changed</LI></UL>Click on Yes to authorize this plugin, or No to deny it. You can change your mind later in Options -> Plugins, then restart." ) ;
|
||||||
|
text += "<UL>" ;
|
||||||
|
text += "<LI>Hash:\t" + QString::fromStdString(plugin_file_hash.toStdString()) + "</LI>" ;
|
||||||
|
text += "<LI>File:\t" + QString::fromStdString(plugin_file_name) + "</LI>";
|
||||||
|
text += "</UL>" ;
|
||||||
|
|
||||||
|
dialog.setText(text) ;
|
||||||
|
dialog.setWindowIcon(FilesDefs::getIconFromQtResourcePath(":/icons/logo_128.png"));
|
||||||
|
dialog.setStandardButtons(QMessageBox::Yes | QMessageBox::No) ;
|
||||||
|
|
||||||
|
int ret = dialog.exec();
|
||||||
|
|
||||||
|
RsAutoUpdatePage::unlockAllEvents() ;
|
||||||
|
|
||||||
|
if (ret == QMessageBox::Yes)
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rsPlugins->disablePlugin(plugin_file_hash);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RsGUIEventManager::enable()
|
||||||
|
{
|
||||||
|
QMutexLocker m(&_mutex) ;
|
||||||
|
std::cerr << "Enabling notification system" << std::endl;
|
||||||
|
_enabled = true ;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RsGUIEventManager::sync_handleIncomingEvent(std::shared_ptr<const RsEvent> event)
|
||||||
|
{
|
||||||
|
auto ev6 = dynamic_cast<const RsSystemEvent*>(event.get());
|
||||||
|
|
||||||
|
if(ev6->mEventCode == RsSystemEventCode::PASSWORD_REQUESTED)
|
||||||
|
GUI_askForPassword(ev6->passwd_request_title, ev6->passwd_request_key_details, ev6->passwd_request_prev_is_bad);
|
||||||
|
else if(ev6->mEventCode == RsSystemEventCode::NEW_PLUGIN_FOUND)
|
||||||
|
GUI_askForPluginConfirmation(ev6->plugin_file_name, ev6->plugin_file_hash, ev6->plugin_first_time);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RsGUIEventManager::async_handleIncomingEvent(std::shared_ptr<const RsEvent> event)
|
||||||
|
{
|
||||||
|
/* Finally Check for PopupMessages / System Error Messages */
|
||||||
|
|
||||||
|
RsNotifyPopupFlags popupflags = (RsNotifyPopupFlags)Settings->getNotifyFlags();
|
||||||
|
|
||||||
|
auto insertToaster = [this](ToasterItem *toaster) {
|
||||||
|
|
||||||
|
/* init attributes */
|
||||||
|
toaster->widget->setWindowFlags(Qt::ToolTip | Qt::WindowStaysOnTopHint);
|
||||||
|
|
||||||
|
/* add toaster to waiting list */
|
||||||
|
waitingToasterList.push_back(toaster);
|
||||||
|
};
|
||||||
|
|
||||||
|
// check for all possibly handled events
|
||||||
|
|
||||||
|
auto ev1 = dynamic_cast<const RsMailStatusEvent*>(event.get());
|
||||||
|
|
||||||
|
if(ev1)
|
||||||
|
{
|
||||||
|
if(ev1->mMailStatusEventCode == RsMailStatusEventCode::NEW_MESSAGE)
|
||||||
|
{
|
||||||
|
SoundManager::play(SOUND_MESSAGE_ARRIVED);
|
||||||
|
|
||||||
|
if((!!(popupflags & RsNotifyPopupFlags::RS_POPUP_MSG)) && !_disableAllToaster)
|
||||||
|
{
|
||||||
|
for(auto msgid:ev1->mChangedMsgIds)
|
||||||
|
{
|
||||||
|
Rs::Msgs::MessageInfo msgInfo;
|
||||||
|
if(rsMsgs->getMessage(msgid, msgInfo))
|
||||||
|
insertToaster(new ToasterItem(new MessageToaster(msgInfo.from.toStdString(), QString::fromUtf8(msgInfo.title.c_str()), QString::fromUtf8(msgInfo.msg.c_str()))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ev2 = dynamic_cast<const RsFriendListEvent*>(event.get());
|
||||||
|
|
||||||
|
if(ev2)
|
||||||
|
{
|
||||||
|
if(ev2->mEventCode == RsFriendListEventCode::NODE_CONNECTED)
|
||||||
|
{
|
||||||
|
SoundManager::play(SOUND_USER_ONLINE);
|
||||||
|
|
||||||
|
if ((!!(popupflags & RsNotifyPopupFlags::RS_POPUP_CONNECT)) && !_disableAllToaster)
|
||||||
|
insertToaster(new ToasterItem(new OnlineToaster(ev2->mSslId)));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ev3 = dynamic_cast<const RsFileTransferEvent*>(event.get());
|
||||||
|
|
||||||
|
if(ev3)
|
||||||
|
{
|
||||||
|
if(ev3->mFileTransferEventCode == RsFileTransferEventCode::DOWNLOAD_COMPLETE)
|
||||||
|
{
|
||||||
|
SoundManager::play(SOUND_DOWNLOAD_COMPLETE);
|
||||||
|
|
||||||
|
if ((!!(popupflags & RsNotifyPopupFlags::RS_POPUP_DOWNLOAD)) && !_disableAllToaster)
|
||||||
|
insertToaster(new ToasterItem(new DownloadToaster(ev3->mHash)));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ev4 = dynamic_cast<const RsAuthSslConnectionAutenticationEvent*>(event.get());
|
||||||
|
|
||||||
|
if(ev4)
|
||||||
|
{
|
||||||
|
if(ev4->mErrorCode == RsAuthSslError::NOT_A_FRIEND)
|
||||||
|
{
|
||||||
|
if ((!!(popupflags & RsNotifyPopupFlags::RS_POPUP_CONNECT_ATTEMPT)) && !_disableAllToaster)
|
||||||
|
// id = gpgid
|
||||||
|
// title = ssl name
|
||||||
|
// msg = peer id
|
||||||
|
insertToaster(new ToasterItem(new FriendRequestToaster(ev4->mPgpId, ev4->mSslId)));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ev5 = dynamic_cast<const RsChatServiceEvent*>(event.get());
|
||||||
|
|
||||||
|
if(ev5)
|
||||||
|
{
|
||||||
|
// This code below should be simplified. In particular GroupChatToaster, ChatToaster and ChatLobbyToaster should be only one class.
|
||||||
|
|
||||||
|
if(ev5->mEventCode == RsChatServiceEventCode::CHAT_MESSAGE_RECEIVED)
|
||||||
|
{
|
||||||
|
if (ev5->mCid.isPeerId() && (!!(popupflags & RsNotifyPopupFlags::RS_POPUP_CHAT)) && !_disableAllToaster)
|
||||||
|
{
|
||||||
|
// TODO: fix for distant chat, look up if dstant chat uses RS_POPUP_CHAT
|
||||||
|
ChatDialog *chatDialog = ChatDialog::getChat(ev5->mCid);
|
||||||
|
ChatWidget *chatWidget;
|
||||||
|
|
||||||
|
if (chatDialog && (chatWidget = chatDialog->getChatWidget()) && chatWidget->isActive()) // do not show when active
|
||||||
|
return;
|
||||||
|
|
||||||
|
insertToaster(new ToasterItem(new ChatToaster(ev5->mCid.toPeerId(), QString::fromUtf8(ev5->mMsg.msg.c_str()))));
|
||||||
|
}
|
||||||
|
#ifdef RS_DIRECT_CHAT
|
||||||
|
else if (ev5->mCid.isBroadcast() && (!!(popupflags & RsNotifyPopupFlags::RS_POPUP_GROUPCHAT)) && !_disableAllToaster)
|
||||||
|
{
|
||||||
|
MainWindow *mainWindow = MainWindow::getInstance();
|
||||||
|
if (mainWindow && mainWindow->isActiveWindow() && !mainWindow->isMinimized()
|
||||||
|
&& (MainWindow::getActivatePage() == MainWindow::Friends) && (FriendsDialog::isGroupChatActive()))
|
||||||
|
return;
|
||||||
|
|
||||||
|
insertToaster(new ToasterItem(new GroupChatToaster(ev5->mCid.toPeerId(), QString::fromUtf8(ev5->mMsg.msg.c_str()))));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
else if (ev5->mCid.isLobbyId() && (!!(popupflags & RsNotifyPopupFlags::RS_POPUP_CHATLOBBY)) && !_disableAllToaster)
|
||||||
|
{
|
||||||
|
ChatDialog *chatDialog = ChatDialog::getChat(ev5->mCid);
|
||||||
|
ChatWidget *chatWidget;
|
||||||
|
|
||||||
|
if (chatDialog && (chatWidget = chatDialog->getChatWidget()) && chatWidget->isActive())
|
||||||
|
return;
|
||||||
|
|
||||||
|
ChatLobbyDialog *chatLobbyDialog = dynamic_cast<ChatLobbyDialog*>(chatDialog);
|
||||||
|
|
||||||
|
if (!chatLobbyDialog || chatLobbyDialog->isParticipantMuted(ev5->mMsg.lobby_peer_gxs_id))
|
||||||
|
return;
|
||||||
|
|
||||||
|
insertToaster(new ToasterItem(new ChatLobbyToaster(ev5->mCid.toLobbyId(), ev5->mMsg.lobby_peer_gxs_id, QString::fromUtf8(ev5->mMsg.msg.c_str()))));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ev6 = dynamic_cast<const RsSystemEvent*>(event.get());
|
||||||
|
|
||||||
|
if(ev6)
|
||||||
|
{
|
||||||
|
switch(ev6->mEventCode)
|
||||||
|
{
|
||||||
|
case RsSystemEventCode::TIME_SHIFT_PROBLEM:
|
||||||
|
displayErrorMessage(RsNotifySysFlags::RS_SYS_WARNING,tr("System time mismatch"),tr("Time shift problem notification. Make sure your machine is on time, because it will break chat rooms."));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RsSystemEventCode::DISK_SPACE_ERROR:
|
||||||
|
displayDiskSpaceWarning(ev6->mDiskErrorLocation,ev6->mDiskErrorSizeLimit);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RsSystemEventCode::DATA_STREAMING_ERROR:
|
||||||
|
case RsSystemEventCode::GENERAL_ERROR:
|
||||||
|
displayErrorMessage(RsNotifySysFlags::RS_SYS_WARNING,tr("Internal error"),QString::fromUtf8(ev6->mErrorMsg.c_str()));
|
||||||
|
break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*Now check Plugins*/
|
||||||
|
|
||||||
|
if(rsPlugins) // rsPlugins may not be initialized yet if we're handlign TorManager events.
|
||||||
|
{
|
||||||
|
int pluginCount = rsPlugins->nbPlugins();
|
||||||
|
|
||||||
|
for (int i = 0; i < pluginCount; ++i) {
|
||||||
|
RsPlugin *rsPlugin = rsPlugins->plugin(i);
|
||||||
|
if (rsPlugin) {
|
||||||
|
ToasterNotify *toasterNotify = rsPlugin->qt_toasterNotify();
|
||||||
|
if (toasterNotify) {
|
||||||
|
insertToaster(toasterNotify->toasterItem());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Now start the waiting toasters */
|
||||||
|
startWaitingToasters();
|
||||||
|
}
|
||||||
|
|
||||||
|
void RsGUIEventManager::testToasters(RsNotifyPopupFlags notifyFlags, /*RshareSettings::enumToasterPosition*/ int position, QPoint margin)
|
||||||
|
{
|
||||||
|
QString title = tr("Test");
|
||||||
|
QString message = tr("This is a test.");
|
||||||
|
|
||||||
|
RsPeerId id = rsPeers->getOwnId();
|
||||||
|
RsPgpId pgpid = rsPeers->getGPGOwnId();
|
||||||
|
|
||||||
|
uint pos = 0;
|
||||||
|
uint nf = (uint)notifyFlags;
|
||||||
|
|
||||||
|
while (nf) {
|
||||||
|
uint type = nf & (1 << pos);
|
||||||
|
nf &= ~(1 << pos);
|
||||||
|
++pos;
|
||||||
|
|
||||||
|
ToasterItem *toaster = NULL;
|
||||||
|
|
||||||
|
switch(type)
|
||||||
|
{
|
||||||
|
case (int)RsNotifyPopupFlags::RS_POPUP_ENCRYPTED_MSG:
|
||||||
|
toaster = new ToasterItem(new MessageToaster(std::string(), tr("Unknown title"), QString("[%1]").arg(tr("Encrypted message"))));
|
||||||
|
break;
|
||||||
|
case (int)RsNotifyPopupFlags::RS_POPUP_MSG:
|
||||||
|
toaster = new ToasterItem(new MessageToaster(id.toStdString(), title, message));
|
||||||
|
break;
|
||||||
|
case (int)RsNotifyPopupFlags::RS_POPUP_CONNECT:
|
||||||
|
toaster = new ToasterItem(new OnlineToaster(id));
|
||||||
|
break;
|
||||||
|
case (int)RsNotifyPopupFlags::RS_POPUP_DOWNLOAD:
|
||||||
|
toaster = new ToasterItem(new DownloadToaster(RsFileHash::random()));
|
||||||
|
break;
|
||||||
|
case (int)RsNotifyPopupFlags::RS_POPUP_CHAT:
|
||||||
|
toaster = new ToasterItem(new ChatToaster(id, message));
|
||||||
|
break;
|
||||||
|
case (int)RsNotifyPopupFlags::RS_POPUP_GROUPCHAT:
|
||||||
|
#ifdef RS_DIRECT_CHAT
|
||||||
|
toaster = new ToasterItem(new GroupChatToaster(id, message));
|
||||||
|
#endif // RS_DIRECT_CHAT
|
||||||
|
break;
|
||||||
|
case (int)RsNotifyPopupFlags::RS_POPUP_CHATLOBBY:
|
||||||
|
{
|
||||||
|
std::list<RsGxsId> gxsid;
|
||||||
|
if(rsIdentity->getOwnIds(gxsid) && (gxsid.size() > 0)){
|
||||||
|
toaster = new ToasterItem(new ChatLobbyToaster(0, gxsid.front(), message));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (int)RsNotifyPopupFlags::RS_POPUP_CONNECT_ATTEMPT:
|
||||||
|
toaster = new ToasterItem(new FriendRequestToaster(pgpid, id));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (toaster) {
|
||||||
|
/* init attributes */
|
||||||
|
toaster->widget->setWindowFlags(Qt::ToolTip | Qt::WindowStaysOnTopHint);
|
||||||
|
toaster->position = (RshareSettings::enumToasterPosition) position;
|
||||||
|
toaster->margin = margin;
|
||||||
|
|
||||||
|
/* add toaster to waiting list */
|
||||||
|
|
||||||
|
waitingToasterList.push_back(toaster);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RsGUIEventManager::testToaster(ToasterNotify *toasterNotify, /*RshareSettings::enumToasterPosition*/ int position, QPoint margin)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!toasterNotify) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ToasterItem *toaster = toasterNotify->testToasterItem();
|
||||||
|
|
||||||
|
if (toaster) {
|
||||||
|
/* init attributes */
|
||||||
|
toaster->widget->setWindowFlags(Qt::ToolTip | Qt::WindowStaysOnTopHint);
|
||||||
|
toaster->position = (RshareSettings::enumToasterPosition) position;
|
||||||
|
toaster->margin = margin;
|
||||||
|
|
||||||
|
/* add toaster to waiting list */
|
||||||
|
//QMutexLocker lock(&waitingToasterMutex);
|
||||||
|
waitingToasterList.push_back(toaster);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RsGUIEventManager::testToaster(QString tag, ToasterNotify *toasterNotify, /*RshareSettings::enumToasterPosition*/ int position, QPoint margin)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!toasterNotify) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ToasterItem *toaster = toasterNotify->testToasterItem(tag);
|
||||||
|
|
||||||
|
if (toaster) {
|
||||||
|
/* init attributes */
|
||||||
|
toaster->widget->setWindowFlags(Qt::ToolTip | Qt::WindowStaysOnTopHint);
|
||||||
|
toaster->position = (RshareSettings::enumToasterPosition) position;
|
||||||
|
toaster->margin = margin;
|
||||||
|
|
||||||
|
/* add toaster to waiting list */
|
||||||
|
|
||||||
|
waitingToasterList.push_back(toaster);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RsGUIEventManager::notifyChatFontChanged()
|
||||||
|
{
|
||||||
|
{
|
||||||
|
QMutexLocker m(&_mutex) ;
|
||||||
|
if(!_enabled)
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
|
emit chatFontChanged();
|
||||||
|
}
|
||||||
|
void RsGUIEventManager::notifyChatStyleChanged(int /*ChatStyle::enumStyleType*/ styleType)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
QMutexLocker m(&_mutex) ;
|
||||||
|
if(!_enabled)
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
|
emit chatStyleChanged(styleType);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RsGUIEventManager::notifySettingsChanged()
|
||||||
|
{
|
||||||
|
emit settingsChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void RsGUIEventManager::startWaitingToasters()
|
||||||
|
{
|
||||||
|
{
|
||||||
|
if (waitingToasterList.empty()) {
|
||||||
|
/* No toasters are waiting */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
if (runningToasterList.size() >= 3) {
|
||||||
|
/* Don't show more than 3 toasters at once */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ToasterItem *toaster = NULL;
|
||||||
|
|
||||||
|
{
|
||||||
|
if (waitingToasterList.size()) {
|
||||||
|
/* Take one toaster of the waiting list */
|
||||||
|
toaster = waitingToasterList.front();
|
||||||
|
waitingToasterList.pop_front();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (toaster) {
|
||||||
|
|
||||||
|
/* Calculate positions */
|
||||||
|
QSize size = toaster->widget->size();
|
||||||
|
|
||||||
|
QRect desktopGeometry = RsApplication::primaryScreenGeometry();
|
||||||
|
|
||||||
|
switch (toaster->position) {
|
||||||
|
case RshareSettings::TOASTERPOS_TOPLEFT:
|
||||||
|
toaster->startPos = QPoint(desktopGeometry.left() + toaster->margin.x(), desktopGeometry.top() - size.height());
|
||||||
|
toaster->endPos = QPoint(toaster->startPos.x(), desktopGeometry.top() + toaster->margin.y());
|
||||||
|
break;
|
||||||
|
case RshareSettings::TOASTERPOS_TOPRIGHT:
|
||||||
|
toaster->startPos = QPoint(desktopGeometry.right() - size.width() - toaster->margin.x(), desktopGeometry.top() - size.height());
|
||||||
|
toaster->endPos = QPoint(toaster->startPos.x(), desktopGeometry.top() + toaster->margin.y());
|
||||||
|
break;
|
||||||
|
case RshareSettings::TOASTERPOS_BOTTOMLEFT:
|
||||||
|
toaster->startPos = QPoint(desktopGeometry.left() + toaster->margin.x(), desktopGeometry.bottom());
|
||||||
|
toaster->endPos = QPoint(toaster->startPos.x(), desktopGeometry.bottom() - size.height() - toaster->margin.y());
|
||||||
|
break;
|
||||||
|
case RshareSettings::TOASTERPOS_BOTTOMRIGHT: // default
|
||||||
|
default:
|
||||||
|
toaster->startPos = QPoint(desktopGeometry.right() - size.width() - toaster->margin.x(), desktopGeometry.bottom());
|
||||||
|
toaster->endPos = QPoint(toaster->startPos.x(), desktopGeometry.bottom() - size.height() - toaster->margin.y());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Initialize widget */
|
||||||
|
toaster->widget->move(toaster->startPos);
|
||||||
|
|
||||||
|
/* Initialize toaster */
|
||||||
|
toaster->elapsedTimeToShow = 0;
|
||||||
|
toaster->elapsedTimeToLive = 0;
|
||||||
|
toaster->elapsedTimeToHide = 0;
|
||||||
|
|
||||||
|
/* Add toaster to the running list */
|
||||||
|
runningToasterList.push_front(toaster);
|
||||||
|
if (runningToasterTimer->isActive() == false) {
|
||||||
|
/* Start the toaster timer */
|
||||||
|
runningToasterTimer->start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RsGUIEventManager::runningTick()
|
||||||
|
{
|
||||||
|
//QMutexLocker lock(&runningToasterMutex);
|
||||||
|
|
||||||
|
int interval = runningToasterTimer->interval();
|
||||||
|
QPoint diff;
|
||||||
|
|
||||||
|
QList<ToasterItem*>::iterator it = runningToasterList.begin();
|
||||||
|
while (it != runningToasterList.end()) {
|
||||||
|
ToasterItem *toaster = *it;
|
||||||
|
|
||||||
|
bool visible = true;
|
||||||
|
if (toaster->elapsedTimeToShow) {
|
||||||
|
/* Toaster is started, check for visible */
|
||||||
|
visible = toaster->widget->isVisible();
|
||||||
|
}
|
||||||
|
|
||||||
|
QPoint newPos;
|
||||||
|
enum { NOTHING, SHOW, HIDE } operation = NOTHING;
|
||||||
|
|
||||||
|
if (visible && toaster->elapsedTimeToShow <= toaster->timeToShow) {
|
||||||
|
/* Toaster is showing */
|
||||||
|
if (toaster->elapsedTimeToShow == 0) {
|
||||||
|
/* Toaster is not visible, show it now */
|
||||||
|
operation = SHOW;
|
||||||
|
}
|
||||||
|
|
||||||
|
toaster->elapsedTimeToShow += interval;
|
||||||
|
|
||||||
|
newPos = QPoint(toaster->startPos.x() - (toaster->startPos.x() - toaster->endPos.x()) * toaster->elapsedTimeToShow / toaster->timeToShow,
|
||||||
|
toaster->startPos.y() - (toaster->startPos.y() - toaster->endPos.y()) * toaster->elapsedTimeToShow / toaster->timeToShow);
|
||||||
|
} else if (visible && toaster->elapsedTimeToLive <= toaster->timeToLive) {
|
||||||
|
/* Toaster is living */
|
||||||
|
toaster->elapsedTimeToLive += interval;
|
||||||
|
|
||||||
|
newPos = toaster->endPos;
|
||||||
|
} else if (visible && toaster->elapsedTimeToHide <= toaster->timeToHide) {
|
||||||
|
/* Toaster is hiding */
|
||||||
|
toaster->elapsedTimeToHide += interval;
|
||||||
|
|
||||||
|
if (toaster->elapsedTimeToHide == toaster->timeToHide) {
|
||||||
|
/* Toaster is back at the start position, hide it */
|
||||||
|
operation = HIDE;
|
||||||
|
}
|
||||||
|
|
||||||
|
newPos = QPoint(toaster->startPos.x() - (toaster->startPos.x() - toaster->endPos.x()) * (toaster->timeToHide - toaster->elapsedTimeToHide) / toaster->timeToHide,
|
||||||
|
toaster->startPos.y() - (toaster->startPos.y() - toaster->endPos.y()) * (toaster->timeToHide - toaster->elapsedTimeToHide) / toaster->timeToHide);
|
||||||
|
} else {
|
||||||
|
/* Toaster is hidden, delete it */
|
||||||
|
it = runningToasterList.erase(it);
|
||||||
|
//delete(toaster->widget);
|
||||||
|
delete(toaster);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
toaster->widget->move(newPos + diff);
|
||||||
|
diff += newPos - toaster->startPos;
|
||||||
|
|
||||||
|
QRect mask = QRect(0, 0, toaster->widget->width(), qAbs(toaster->startPos.y() - newPos.y()));
|
||||||
|
if (newPos.y() > toaster->startPos.y()) {
|
||||||
|
/* Toaster is moving from top */
|
||||||
|
mask.moveTop(toaster->widget->height() - (newPos.y() - toaster->startPos.y()));
|
||||||
|
}
|
||||||
|
toaster->widget->setMask(QRegion(mask));
|
||||||
|
|
||||||
|
switch (operation) {
|
||||||
|
case NOTHING:
|
||||||
|
break;
|
||||||
|
case SHOW:
|
||||||
|
toaster->widget->show();
|
||||||
|
break;
|
||||||
|
case HIDE:
|
||||||
|
toaster->widget->hide();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (runningToasterList.size()) {
|
||||||
|
/* There are more running toasters, start the timer again */
|
||||||
|
runningToasterTimer->start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RsGUIEventManager::displayErrorMessage(RsNotifySysFlags type,const QString& title,const QString& error_msg)
|
||||||
|
{
|
||||||
|
/* make a warning message */
|
||||||
|
switch(type)
|
||||||
|
{
|
||||||
|
case RsNotifySysFlags::RS_SYS_ERROR: QMessageBox::critical(MainWindow::getInstance(),title,error_msg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RsNotifySysFlags::RS_SYS_WARNING: QMessageBox::warning(MainWindow::getInstance(),title,error_msg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RsNotifySysFlags::RS_SYS_INFO: QMessageBox::information(MainWindow::getInstance(),title,error_msg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default: std::cerr << "Warning: unhandled system error type " << type << std::endl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RsGUIEventManager::displayDiskSpaceWarning(int loc,int size_limit_mb)
|
||||||
|
{
|
||||||
|
QString locString ;
|
||||||
|
switch(loc)
|
||||||
|
{
|
||||||
|
case RS_PARTIALS_DIRECTORY: locString = "Partials" ;
|
||||||
|
break ;
|
||||||
|
|
||||||
|
case RS_CONFIG_DIRECTORY: locString = "Config" ;
|
||||||
|
break ;
|
||||||
|
|
||||||
|
case RS_DOWNLOAD_DIRECTORY: locString = "Download" ;
|
||||||
|
break ;
|
||||||
|
|
||||||
|
default:
|
||||||
|
std::cerr << "Error: " << __PRETTY_FUNCTION__ << " was called with an unknown parameter loc=" << loc << std::endl ;
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
QMessageBox::critical(NULL,tr("Low disk space warning"),
|
||||||
|
tr("The disk space in your")+" "+locString +" "+tr("directory is running low (current limit is")+" "+QString::number(size_limit_mb)+tr("MB). \n\n RetroShare will now safely suspend any disk access to this directory. \n\n Please make some free space and click Ok.")) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* gui/NotifyQt.h *
|
* gui/RsGUIEventManager.h *
|
||||||
* *
|
* *
|
||||||
* Copyright (c) 2010 Retroshare Team <retroshare.project@gmail.com> *
|
* Copyright (c) 2010 Retroshare Team <retroshare.project@gmail.com> *
|
||||||
* *
|
* *
|
||||||
|
|
@ -23,13 +23,14 @@
|
||||||
|
|
||||||
#include <retroshare/rsiface.h>
|
#include <retroshare/rsiface.h>
|
||||||
#include <retroshare/rsturtle.h>
|
#include <retroshare/rsturtle.h>
|
||||||
#include <retroshare/rsnotify.h>
|
|
||||||
#include <retroshare/rsmsgs.h>
|
#include <retroshare/rsmsgs.h>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
#include <QPoint>
|
#include <QPoint>
|
||||||
//#include <QMutex>
|
//#include <QMutex>
|
||||||
|
|
||||||
|
#include "settings/rsharesettings.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
class QTimer;
|
class QTimer;
|
||||||
|
|
@ -47,92 +48,40 @@ class SignatureEventData ;
|
||||||
struct TurtleFileInfo;
|
struct TurtleFileInfo;
|
||||||
struct TurtleGxsInfo;
|
struct TurtleGxsInfo;
|
||||||
|
|
||||||
class NotifyQt: public QObject, public NotifyClient
|
class RsGUIEventManager: public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
static NotifyQt *Create ();
|
static void Create();
|
||||||
static NotifyQt *getInstance ();
|
static RsGUIEventManager *getInstance ();
|
||||||
static bool isAllDisable();
|
static bool isAllDisable();
|
||||||
void enable() ;
|
void enable() ;
|
||||||
|
|
||||||
virtual ~NotifyQt() = default;
|
virtual ~RsGUIEventManager() = default;
|
||||||
|
|
||||||
void setNetworkDialog(NetworkDialog *c) { cDialog = c; }
|
virtual bool GUI_askForPassword(const std::string& title, const std::string& key_details, bool prev_is_bad);
|
||||||
|
virtual bool GUI_askForPluginConfirmation(const std::string& plugin_filename, const RsFileHash& plugin_file_hash,bool first_time);
|
||||||
virtual void notifyListPreChange(int list, int type);
|
|
||||||
virtual void notifyListChange(int list, int type);
|
|
||||||
virtual void notifyErrorMsg(int list, int sev, std::string msg);
|
|
||||||
virtual void notifyChatMessage(const ChatMessage& /* msg */);
|
|
||||||
virtual void notifyChatStatus(const ChatId &chat_id,const std::string& status_string);
|
|
||||||
virtual void notifyChatCleared(const ChatId &chat_id);
|
|
||||||
virtual void notifyCustomState(const std::string& peer_id, const std::string& status_string);
|
|
||||||
#ifdef TO_REMOVE
|
|
||||||
virtual void notifyTurtleSearchResult(const RsPeerId &pid, uint32_t search_id, const std::list<TurtleFileInfo>& found_files);
|
|
||||||
#endif
|
|
||||||
virtual void notifyTurtleSearchResult(uint32_t search_id,const std::list<TurtleGxsInfo>& found_groups);
|
|
||||||
virtual void notifyPeerHasNewAvatar(std::string peer_id) ;
|
|
||||||
virtual void notifyOwnAvatarChanged() ;
|
|
||||||
virtual void notifyChatLobbyEvent(uint64_t /* lobby id */, uint32_t /* event type */, const RsGxsId & /*nickname*/, const std::string& /* any string */) ;
|
|
||||||
virtual void notifyChatLobbyTimeShift(int time_shift) ;
|
|
||||||
|
|
||||||
virtual void notifyOwnStatusMessageChanged() ;
|
|
||||||
virtual void notifyDiskFull(uint32_t loc,uint32_t size_in_mb) ;
|
|
||||||
/* peer has changed the state */
|
|
||||||
virtual void notifyPeerStatusChanged(const std::string& peer_id, uint32_t state);
|
|
||||||
/* one or more peers has changed the states */
|
|
||||||
virtual void notifyPeerStatusChangedSummary();
|
|
||||||
|
|
||||||
virtual void notifyHistoryChanged(uint32_t msgId, int type);
|
|
||||||
|
|
||||||
virtual void notifyDiscInfoChanged() ;
|
|
||||||
virtual bool askForPassword(const std::string& title, const std::string& key_details, bool prev_is_bad, std::string& password, bool &cancelled);
|
|
||||||
virtual bool askForPluginConfirmation(const std::string& plugin_filename, const std::string& plugin_file_hash,bool first_time);
|
|
||||||
|
|
||||||
/* Notify from GUI */
|
/* Notify from GUI */
|
||||||
void notifyChatFontChanged();
|
void notifyChatFontChanged();
|
||||||
void notifyChatStyleChanged(int /*ChatStyle::enumStyleType*/ styleType);
|
void notifyChatStyleChanged(int /*ChatStyle::enumStyleType*/ styleType);
|
||||||
|
|
||||||
void testToasters(uint notifyFlags, /*RshareSettings::enumToasterPosition*/ int position, QPoint margin);
|
void testToasters(RsNotifyPopupFlags notifyFlags, /*RshareSettings::enumToasterPosition*/ int position, QPoint margin);
|
||||||
void testToaster(ToasterNotify *toasterNotify, /*RshareSettings::enumToasterPosition*/ int position, QPoint margin);
|
void testToaster(ToasterNotify *toasterNotify, /*RshareSettings::enumToasterPosition*/ int position, QPoint margin);
|
||||||
void testToaster(QString tag, ToasterNotify *toasterNotify, /*RshareSettings::enumToasterPosition*/ int position, QPoint margin);
|
void testToaster(QString tag, ToasterNotify *toasterNotify, /*RshareSettings::enumToasterPosition*/ int position, QPoint margin);
|
||||||
|
#ifdef TO_REMOVE
|
||||||
void addToaster(uint notifyFlags, const std::string& id, const std::string& title, const std::string& msg);
|
void addToaster(uint notifyFlags, const std::string& id, const std::string& title, const std::string& msg);
|
||||||
|
#endif
|
||||||
void notifySettingsChanged();
|
void notifySettingsChanged();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
// It's beneficial to send info to the GUI using signals, because signals are thread-safe
|
// It's beneficial to send info to the GUI using signals, because signals are thread-safe
|
||||||
// as they get queued by Qt.
|
// as they get queued by Qt.
|
||||||
//
|
//
|
||||||
void hashingInfoChanged(const QString&) const ;
|
|
||||||
void filesPreModChanged(bool) const ;
|
|
||||||
void filesPostModChanged(bool) const ;
|
|
||||||
void transfersChanged() const ;
|
|
||||||
void friendsChanged() const ;
|
|
||||||
void lobbyListChanged() const ;
|
|
||||||
void chatLobbyEvent(qulonglong,int,const RsGxsId&,const QString&) ;
|
|
||||||
void neighboursChanged() const ;
|
|
||||||
void configChanged() const ;
|
void configChanged() const ;
|
||||||
void logInfoChanged(const QString&) const ;
|
void logInfoChanged(const QString&) const ;
|
||||||
void chatStatusChanged(const ChatId&,const QString&) const ;
|
|
||||||
void chatCleared(const ChatId&) const ;
|
void chatCleared(const ChatId&) const ;
|
||||||
void peerHasNewCustomStateString(const QString& /* peer_id */, const QString& /* status_string */) const ;
|
|
||||||
void peerHasNewAvatar(const QString& peer_id) const ;
|
|
||||||
void ownAvatarChanged() const ;
|
|
||||||
void ownStatusMessageChanged() const ;
|
|
||||||
void errorOccurred(int,int,const QString&) const ;
|
|
||||||
void diskFull(int,int) const ;
|
|
||||||
void peerStatusChanged(const QString& /* peer_id */, int /* status */);
|
|
||||||
void peerStatusChangedSummary() const;
|
|
||||||
void gxsChange(const RsGxsChanges& /* changes */);
|
|
||||||
void chatMessageReceived(ChatMessage msg);
|
|
||||||
void groupsChanged(int type) const ;
|
|
||||||
void discInfoChanged() const ;
|
|
||||||
void historyChanged(uint msgId, int type);
|
void historyChanged(uint msgId, int type);
|
||||||
void chatLobbyInviteReceived() ;
|
|
||||||
void deferredSignatureHandlingRequested() ;
|
|
||||||
void chatLobbyTimeShift(int time_shift) ;
|
|
||||||
void connectionWithoutCert();
|
|
||||||
|
|
||||||
/* Notify from GUI */
|
/* Notify from GUI */
|
||||||
void chatFontChanged();
|
void chatFontChanged();
|
||||||
|
|
@ -141,25 +90,24 @@ class NotifyQt: public QObject, public NotifyClient
|
||||||
void disableAllChanged(bool disableAll) const;
|
void disableAllChanged(bool disableAll) const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void UpdateGUI(); /* called by timer */
|
|
||||||
void SetDisableAll(bool bValue);
|
void SetDisableAll(bool bValue);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void runningTick();
|
void runningTick();
|
||||||
void handleSignatureEvent() ;
|
|
||||||
void handleChatLobbyTimeShift(int) ;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NotifyQt();
|
RsGUIEventManager();
|
||||||
|
|
||||||
static NotifyQt *_instance;
|
static void displayDiskSpaceWarning(int loc,int size_limit_mb);
|
||||||
|
static void displayErrorMessage(RsNotifySysFlags type,const QString& title,const QString& error_msg);
|
||||||
|
|
||||||
|
static RsGUIEventManager *_instance;
|
||||||
static bool _disableAllToaster;
|
static bool _disableAllToaster;
|
||||||
|
|
||||||
/* system notifications */
|
/* system notifications */
|
||||||
|
|
||||||
void startWaitingToasters();
|
void startWaitingToasters();
|
||||||
|
|
||||||
// QMutex waitingToasterMutex; // for lock of the waiting toaster list
|
|
||||||
QList<ToasterItem*> waitingToasterList;
|
QList<ToasterItem*> waitingToasterList;
|
||||||
|
|
||||||
QTimer *runningToasterTimer;
|
QTimer *runningToasterTimer;
|
||||||
|
|
@ -172,6 +120,11 @@ class NotifyQt: public QObject, public NotifyClient
|
||||||
|
|
||||||
/* so we can update windows */
|
/* so we can update windows */
|
||||||
NetworkDialog *cDialog;
|
NetworkDialog *cDialog;
|
||||||
|
|
||||||
|
void async_handleIncomingEvent(std::shared_ptr<const RsEvent> e);
|
||||||
|
void sync_handleIncomingEvent(std::shared_ptr<const RsEvent> e);
|
||||||
|
|
||||||
|
RsEventsHandlerId_t mEventHandlerId;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -35,9 +35,9 @@
|
||||||
#include "gui/common/GroupFlagsWidget.h"
|
#include "gui/common/GroupFlagsWidget.h"
|
||||||
#include "gui/common/GroupSelectionBox.h"
|
#include "gui/common/GroupSelectionBox.h"
|
||||||
#include "gui/common/GroupDefs.h"
|
#include "gui/common/GroupDefs.h"
|
||||||
#include "gui/notifyqt.h"
|
|
||||||
#include "util/RsQtVersion.h"
|
#include "util/RsQtVersion.h"
|
||||||
#include "util/misc.h"
|
#include "util/misc.h"
|
||||||
|
#include "util/qtthreadsutils.h"
|
||||||
#include "gui/common/FilesDefs.h"
|
#include "gui/common/FilesDefs.h"
|
||||||
|
|
||||||
/* Images for context menu icons */
|
/* Images for context menu icons */
|
||||||
|
|
@ -73,7 +73,21 @@ ShareManager::ShareManager()
|
||||||
connect(ui.shareddirList, SIGNAL(cellDoubleClicked(int,int)), this, SLOT(doubleClickedCell(int,int)));
|
connect(ui.shareddirList, SIGNAL(cellDoubleClicked(int,int)), this, SLOT(doubleClickedCell(int,int)));
|
||||||
connect(ui.shareddirList, SIGNAL(cellChanged(int,int)), this, SLOT(handleCellChange(int,int)));
|
connect(ui.shareddirList, SIGNAL(cellChanged(int,int)), this, SLOT(handleCellChange(int,int)));
|
||||||
|
|
||||||
connect(NotifyQt::getInstance(), SIGNAL(groupsChanged(int)), this, SLOT(reload()));
|
mEventHandlerId = 0;
|
||||||
|
|
||||||
|
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e)
|
||||||
|
{
|
||||||
|
RsQThreadUtils::postToObject([=]()
|
||||||
|
{
|
||||||
|
auto fe = dynamic_cast<const RsFriendListEvent*>(e.get());
|
||||||
|
|
||||||
|
if(!fe)
|
||||||
|
return;
|
||||||
|
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
, this );
|
||||||
|
}, mEventHandlerId, RsEventType::FRIEND_LIST );
|
||||||
|
|
||||||
QHeaderView* header = ui.shareddirList->horizontalHeader();
|
QHeaderView* header = ui.shareddirList->horizontalHeader();
|
||||||
QHeaderView_setSectionResizeModeColumn(header, COLUMN_PATH, QHeaderView::Stretch);
|
QHeaderView_setSectionResizeModeColumn(header, COLUMN_PATH, QHeaderView::Stretch);
|
||||||
|
|
@ -152,6 +166,7 @@ ShareManager::~ShareManager()
|
||||||
{
|
{
|
||||||
_instance = NULL;
|
_instance = NULL;
|
||||||
|
|
||||||
|
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||||
Settings->saveWidgetInformation(this);
|
Settings->saveWidgetInformation(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,7 @@ private:
|
||||||
Ui::ShareManager ui;
|
Ui::ShareManager ui;
|
||||||
|
|
||||||
std::vector<SharedDirInfo> mDirInfos ;
|
std::vector<SharedDirInfo> mDirInfos ;
|
||||||
|
RsEventsHandlerId_t mEventHandlerId;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@
|
||||||
#include "settings/rsharesettings.h"
|
#include "settings/rsharesettings.h"
|
||||||
|
|
||||||
#include "retroshare/rsinit.h"
|
#include "retroshare/rsinit.h"
|
||||||
#include "retroshare/rsnotify.h"
|
|
||||||
|
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
@ -119,13 +118,11 @@ void StartDialog::loadPerson()
|
||||||
RsPeerId accountId = RsPeerId((data.toString()).toStdString());
|
RsPeerId accountId = RsPeerId((data.toString()).toStdString());
|
||||||
|
|
||||||
// Cache the passphrase, so that it is not asked again.
|
// Cache the passphrase, so that it is not asked again.
|
||||||
rsNotify->cachePgpPassphrase(ui.password_input->text().toUtf8().constData()) ;
|
RsLoginHelper::cachePgpPassphrase(ui.password_input->text().toUtf8().constData()) ;
|
||||||
rsNotify->setDisableAskPassword(true);
|
|
||||||
|
|
||||||
bool res = RsApplication::loadCertificate(accountId, ui.autologin_checkbox->isChecked()) ;
|
bool res = RsApplication::loadCertificate(accountId, ui.autologin_checkbox->isChecked()) ;
|
||||||
|
|
||||||
rsNotify->setDisableAskPassword(false);
|
RsLoginHelper::clearPgpPassphrase();
|
||||||
rsNotify->clearPgpPassphrase();
|
|
||||||
|
|
||||||
if(res)
|
if(res)
|
||||||
accept();
|
accept();
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,6 @@
|
||||||
#include "gui/SoundManager.h"
|
#include "gui/SoundManager.h"
|
||||||
|
|
||||||
#include <retroshare/rsiface.h>
|
#include <retroshare/rsiface.h>
|
||||||
#include <retroshare/rsnotify.h>
|
|
||||||
#include <retroshare/rspeers.h>
|
#include <retroshare/rspeers.h>
|
||||||
|
|
||||||
static std::map<ChatId, ChatDialog*> chatDialogsList;
|
static std::map<ChatId, ChatDialog*> chatDialogsList;
|
||||||
|
|
@ -86,7 +85,7 @@ void ChatDialog::init(const ChatId &id, const QString &title)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*static*/ ChatDialog* ChatDialog::getChat(ChatId id, uint chatflags)
|
/*static*/ ChatDialog* ChatDialog::getChat(ChatId id, RsChatFlags chatflags)
|
||||||
{
|
{
|
||||||
if(id.isBroadcast() || id.isNotSet())
|
if(id.isBroadcast() || id.isNotSet())
|
||||||
return NULL; // broadcast is not handled by a chat dialog
|
return NULL; // broadcast is not handled by a chat dialog
|
||||||
|
|
@ -97,9 +96,9 @@ void ChatDialog::init(const ChatId &id, const QString &title)
|
||||||
if (cd == NULL) {
|
if (cd == NULL) {
|
||||||
|
|
||||||
if(id.isDistantChatId())
|
if(id.isDistantChatId())
|
||||||
chatflags = RS_CHAT_OPEN | RS_CHAT_FOCUS; // force open for distant chat
|
chatflags = RsChatFlags::RS_CHAT_OPEN | RsChatFlags::RS_CHAT_FOCUS; // force open for distant chat
|
||||||
|
|
||||||
if (chatflags & RS_CHAT_OPEN) {
|
if (!!(chatflags & RsChatFlags::RS_CHAT_OPEN)) {
|
||||||
if (id.isLobbyId()) {
|
if (id.isLobbyId()) {
|
||||||
ChatLobbyDialog* cld = new ChatLobbyDialog(id.toLobbyId());
|
ChatLobbyDialog* cld = new ChatLobbyDialog(id.toLobbyId());
|
||||||
cld->init(ChatId(), "");
|
cld->init(ChatId(), "");
|
||||||
|
|
@ -176,7 +175,7 @@ void ChatDialog::init(const ChatId &id, const QString &title)
|
||||||
// play sound when recv a message
|
// play sound when recv a message
|
||||||
SoundManager::play(SOUND_NEW_CHAT_MESSAGE);
|
SoundManager::play(SOUND_NEW_CHAT_MESSAGE);
|
||||||
|
|
||||||
ChatDialog *cd = getChat(msg.chat_id, Settings->getChatFlags());
|
ChatDialog *cd = getChat(msg.chat_id, (RsChatFlags)Settings->getChatFlags());
|
||||||
if(cd)
|
if(cd)
|
||||||
cd->addChatMsg(msg);
|
cd->addChatMsg(msg);
|
||||||
else
|
else
|
||||||
|
|
@ -185,7 +184,7 @@ void ChatDialog::init(const ChatId &id, const QString &title)
|
||||||
|
|
||||||
/*static*/ void ChatDialog::chatFriend(const ChatId &peerId, const bool forceFocus)
|
/*static*/ void ChatDialog::chatFriend(const ChatId &peerId, const bool forceFocus)
|
||||||
{
|
{
|
||||||
getChat(peerId, forceFocus ? RS_CHAT_OPEN | RS_CHAT_FOCUS : RS_CHAT_OPEN);
|
getChat(peerId, forceFocus ? (RsChatFlags::RS_CHAT_OPEN | RsChatFlags::RS_CHAT_FOCUS) : RsChatFlags::RS_CHAT_OPEN);
|
||||||
|
|
||||||
// below is the old code witch does lots of error checking.
|
// below is the old code witch does lots of error checking.
|
||||||
// because there are many different chat types, there are also different ways to check if the id is valid
|
// because there are many different chat types, there are also different ways to check if the id is valid
|
||||||
|
|
@ -330,7 +329,7 @@ QString ChatDialog::getOwnName() const
|
||||||
return "ChatDialog::getOwnName(): invalid id type passed (RsPeerId is required). This is a bug.";
|
return "ChatDialog::getOwnName(): invalid id type passed (RsPeerId is required). This is a bug.";
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatDialog::setPeerStatus(uint32_t status)
|
void ChatDialog::setPeerStatus(RsStatusValue status)
|
||||||
{
|
{
|
||||||
ChatWidget *cw = getChatWidget();
|
ChatWidget *cw = getChatWidget();
|
||||||
if (cw)
|
if (cw)
|
||||||
|
|
@ -338,22 +337,17 @@ void ChatDialog::setPeerStatus(uint32_t status)
|
||||||
// convert to virtual peer id
|
// convert to virtual peer id
|
||||||
// this is only required for private and distant chat,
|
// this is only required for private and distant chat,
|
||||||
// because lobby and broadcast does not have a status
|
// because lobby and broadcast does not have a status
|
||||||
RsPeerId vpid;
|
cw->updateStatus(mChatId, status);
|
||||||
if(mChatId.isPeerId())
|
|
||||||
vpid = mChatId.toPeerId();
|
|
||||||
if(mChatId.isDistantChatId())
|
|
||||||
vpid = RsPeerId(mChatId.toDistantChatId());
|
|
||||||
cw->updateStatus(QString::fromStdString(vpid.toStdString()), status);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int ChatDialog::getPeerStatus()
|
RsStatusValue ChatDialog::getPeerStatus()
|
||||||
{
|
{
|
||||||
ChatWidget *cw = getChatWidget();
|
ChatWidget *cw = getChatWidget();
|
||||||
if (cw) {
|
if (cw) {
|
||||||
return cw->getPeerStatus();
|
return cw->getPeerStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return RsStatusValue::RS_STATUS_OFFLINE;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ChatDialog::getTitle()
|
QString ChatDialog::getTitle()
|
||||||
|
|
|
||||||
|
|
@ -23,10 +23,13 @@
|
||||||
#ifndef CHATDIALOG_H
|
#ifndef CHATDIALOG_H
|
||||||
#define CHATDIALOG_H
|
#define CHATDIALOG_H
|
||||||
|
|
||||||
|
#include "retroshare/rsstatus.h"
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <retroshare/rsmsgs.h>
|
#include <retroshare/rsmsgs.h>
|
||||||
|
|
||||||
class ChatWidget;
|
#include "gui/chat/ChatWidget.h"
|
||||||
|
|
||||||
class RSStyle;
|
class RSStyle;
|
||||||
|
|
||||||
class ChatDialog : public QWidget
|
class ChatDialog : public QWidget
|
||||||
|
|
@ -35,14 +38,14 @@ class ChatDialog : public QWidget
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static ChatDialog *getExistingChat(ChatId id);
|
static ChatDialog *getExistingChat(ChatId id);
|
||||||
static ChatDialog *getChat(ChatId id, uint chatflags = 0);
|
static ChatDialog *getChat(ChatId id, RsChatFlags chatflags = RsChatFlags::RS_CHAT_NONE);
|
||||||
static void cleanupChat();
|
static void cleanupChat();
|
||||||
static void chatFriend(const ChatId &peerId, bool forceFocus = true);
|
static void chatFriend(const ChatId &peerId, bool forceFocus = true);
|
||||||
static void chatFriend(const RsPgpId &gpgId, bool forceFocus = true);
|
static void chatFriend(const RsPgpId &gpgId, bool forceFocus = true);
|
||||||
static void closeChat(const ChatId &chat_id);
|
static void closeChat(const ChatId &chat_id);
|
||||||
static void chatMessageReceived(ChatMessage msg);
|
static void chatMessageReceived(ChatMessage msg);
|
||||||
|
|
||||||
virtual void showDialog(uint /*chatflags*/) {}
|
virtual void showDialog(RsChatFlags /*chatflags*/) {}
|
||||||
|
|
||||||
virtual ChatWidget *getChatWidget() = 0;
|
virtual ChatWidget *getChatWidget() = 0;
|
||||||
virtual bool hasPeerStatus() = 0;
|
virtual bool hasPeerStatus() = 0;
|
||||||
|
|
@ -58,8 +61,8 @@ public:
|
||||||
bool setStyle();
|
bool setStyle();
|
||||||
const RSStyle *getStyle();
|
const RSStyle *getStyle();
|
||||||
|
|
||||||
int getPeerStatus();
|
RsStatusValue getPeerStatus();
|
||||||
void setPeerStatus(uint32_t state);
|
void setPeerStatus(RsStatusValue state);
|
||||||
|
|
||||||
void focusDialog();
|
void focusDialog();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,6 @@
|
||||||
#include "util/HandleRichText.h"
|
#include "util/HandleRichText.h"
|
||||||
#include "util/RsQtVersion.h"
|
#include "util/RsQtVersion.h"
|
||||||
|
|
||||||
#include "retroshare/rsnotify.h"
|
|
||||||
#include "util/rstime.h"
|
#include "util/rstime.h"
|
||||||
#include "util/DateTime.h"
|
#include "util/DateTime.h"
|
||||||
|
|
||||||
|
|
@ -848,25 +847,26 @@ QString ChatLobbyDialog::getParticipantName(const RsGxsId& gxs_id) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ChatLobbyDialog::displayLobbyEvent(int event_type, const RsGxsId& gxs_id, const QString& str)
|
void ChatLobbyDialog::handleLobbyEvent(RsChatLobbyEventCode event_type, const RsGxsId& gxs_id, const QString& str)
|
||||||
{
|
{
|
||||||
RsGxsId qsParticipant;
|
RsGxsId qsParticipant;
|
||||||
|
|
||||||
QString name= getParticipantName(gxs_id) ;
|
QString name= getParticipantName(gxs_id) ;
|
||||||
|
|
||||||
|
//std::cerr << "Received ChatLobby event " << (int)event_type << " for lobby " << (void*)lobbyId << std::endl;
|
||||||
switch (event_type)
|
switch (event_type)
|
||||||
{
|
{
|
||||||
case RS_CHAT_LOBBY_EVENT_PEER_LEFT:
|
case RsChatLobbyEventCode::CHAT_LOBBY_EVENT_PEER_LEFT:
|
||||||
qsParticipant=gxs_id;
|
qsParticipant=gxs_id;
|
||||||
ui.chatWidget->addChatMsg(true, tr("Chat room management"), QDateTime::currentDateTime(), QDateTime::currentDateTime(), tr("%1 has left the room.").arg(RsHtml::plainText(name)), ChatWidget::MSGTYPE_SYSTEM);
|
ui.chatWidget->addChatMsg(true, tr("Chat room management"), QDateTime::currentDateTime(), QDateTime::currentDateTime(), tr("%1 has left the room.").arg(RsHtml::plainText(name)), ChatWidget::MSGTYPE_SYSTEM);
|
||||||
emit peerLeft(id()) ;
|
emit peerLeft(id()) ;
|
||||||
break;
|
break;
|
||||||
case RS_CHAT_LOBBY_EVENT_PEER_JOINED:
|
case RsChatLobbyEventCode::CHAT_LOBBY_EVENT_PEER_JOINED:
|
||||||
qsParticipant=gxs_id;
|
qsParticipant=gxs_id;
|
||||||
ui.chatWidget->addChatMsg(true, tr("Chat room management"), QDateTime::currentDateTime(), QDateTime::currentDateTime(), tr("%1 joined the room.").arg(RsHtml::plainText(name)), ChatWidget::MSGTYPE_SYSTEM);
|
ui.chatWidget->addChatMsg(true, tr("Chat room management"), QDateTime::currentDateTime(), QDateTime::currentDateTime(), tr("%1 joined the room.").arg(RsHtml::plainText(name)), ChatWidget::MSGTYPE_SYSTEM);
|
||||||
emit peerJoined(id()) ;
|
emit peerJoined(id()) ;
|
||||||
break;
|
break;
|
||||||
case RS_CHAT_LOBBY_EVENT_PEER_STATUS:
|
case RsChatLobbyEventCode::CHAT_LOBBY_EVENT_PEER_STATUS:
|
||||||
{
|
{
|
||||||
|
|
||||||
qsParticipant=gxs_id;
|
qsParticipant=gxs_id;
|
||||||
|
|
@ -878,7 +878,7 @@ void ChatLobbyDialog::displayLobbyEvent(int event_type, const RsGxsId& gxs_id, c
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RS_CHAT_LOBBY_EVENT_PEER_CHANGE_NICKNAME:
|
case RsChatLobbyEventCode::CHAT_LOBBY_EVENT_PEER_CHANGE_NICKNAME:
|
||||||
{
|
{
|
||||||
qsParticipant=gxs_id;
|
qsParticipant=gxs_id;
|
||||||
|
|
||||||
|
|
@ -894,11 +894,11 @@ void ChatLobbyDialog::displayLobbyEvent(int event_type, const RsGxsId& gxs_id, c
|
||||||
muteParticipant(RsGxsId(str.toStdString())) ;
|
muteParticipant(RsGxsId(str.toStdString())) ;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RS_CHAT_LOBBY_EVENT_KEEP_ALIVE:
|
case RsChatLobbyEventCode::CHAT_LOBBY_EVENT_KEEP_ALIVE:
|
||||||
//std::cerr << "Received keep alive packet from " << nickname.toStdString() << " in chat room " << getPeerId() << std::endl;
|
//std::cerr << "Received keep alive packet from " << nickname.toStdString() << " in chat room " << getPeerId() << std::endl;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
std::cerr << "ChatLobbyDialog::displayLobbyEvent() Unhandled chat room event type " << event_type << std::endl;
|
std::cerr << "ChatLobbyDialog::handledLobbyEvent() Unhandled chat room event type " << (int)event_type << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!qsParticipant.isNull())
|
if (!qsParticipant.isNull())
|
||||||
|
|
@ -929,9 +929,9 @@ bool ChatLobbyDialog::canClose()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatLobbyDialog::showDialog(uint chatflags)
|
void ChatLobbyDialog::showDialog(RsChatFlags chatflags)
|
||||||
{
|
{
|
||||||
if (chatflags & RS_CHAT_FOCUS)
|
if (!!(chatflags & RsChatFlags::RS_CHAT_FOCUS))
|
||||||
{
|
{
|
||||||
if (isWindowed() && mPCWindow) {
|
if (isWindowed() && mPCWindow) {
|
||||||
mPCWindow->showDialog(this, chatflags);
|
mPCWindow->showDialog(this, chatflags);
|
||||||
|
|
@ -1019,5 +1019,5 @@ void ChatLobbyDialog::setWindowed(bool windowed)
|
||||||
}
|
}
|
||||||
show();
|
show();
|
||||||
if (chatLobbyPage)// If not defined, we are on autosubscribe loop of lobby widget constructor. So don't recall it.
|
if (chatLobbyPage)// If not defined, we are on autosubscribe loop of lobby widget constructor. So don't recall it.
|
||||||
showDialog(RS_CHAT_FOCUS);
|
showDialog(RsChatFlags::RS_CHAT_FOCUS);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,12 +42,12 @@ class ChatLobbyDialog: public ChatDialog
|
||||||
friend class ChatDialog;
|
friend class ChatDialog;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void displayLobbyEvent(int event_type, const RsGxsId &gxs_id, const QString& str);
|
void handleLobbyEvent(RsChatLobbyEventCode event_type, const RsGxsId& gxs_id, const QString& str);
|
||||||
|
|
||||||
virtual void showDialog(uint chatflags);
|
virtual void showDialog(RsChatFlags chatflags) override;
|
||||||
virtual ChatWidget *getChatWidget();
|
virtual ChatWidget *getChatWidget() override;
|
||||||
virtual bool hasPeerStatus() { return false; }
|
virtual bool hasPeerStatus() override{ return false; }
|
||||||
virtual bool notifyBlink();
|
virtual bool notifyBlink() override;
|
||||||
void setIdentity(const RsGxsId& gxs_id);
|
void setIdentity(const RsGxsId& gxs_id);
|
||||||
bool isParticipantMuted(const RsGxsId &participant);
|
bool isParticipantMuted(const RsGxsId &participant);
|
||||||
ChatLobbyId id() const { return lobbyId ;}
|
ChatLobbyId id() const { return lobbyId ;}
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@
|
||||||
|
|
||||||
#include "gui/ChatLobbyWidget.h"
|
#include "gui/ChatLobbyWidget.h"
|
||||||
#include "gui/MainWindow.h"
|
#include "gui/MainWindow.h"
|
||||||
#include "gui/notifyqt.h"
|
|
||||||
#include "gui/SoundManager.h"
|
#include "gui/SoundManager.h"
|
||||||
#include "gui/settings/rsharesettings.h"
|
#include "gui/settings/rsharesettings.h"
|
||||||
#include "util/DateTime.h"
|
#include "util/DateTime.h"
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@
|
||||||
|
|
||||||
#include "ChatStyle.h"
|
#include "ChatStyle.h"
|
||||||
#include "gui/settings/rsharesettings.h"
|
#include "gui/settings/rsharesettings.h"
|
||||||
#include "gui/notifyqt.h"
|
#include "gui/RsGUIEventManager.h"
|
||||||
#include "util/DateTime.h"
|
#include "util/DateTime.h"
|
||||||
#include "util/HandleRichText.h"
|
#include "util/HandleRichText.h"
|
||||||
|
|
||||||
|
|
@ -130,7 +130,7 @@ ChatStyle::ChatStyle() : QObject()
|
||||||
{
|
{
|
||||||
m_styleType = TYPE_UNKNOWN;
|
m_styleType = TYPE_UNKNOWN;
|
||||||
|
|
||||||
connect(NotifyQt::getInstance(), SIGNAL(chatStyleChanged(int)), SLOT(styleChanged(int)));
|
connect(RsGUIEventManager::getInstance(), SIGNAL(chatStyleChanged(int)), SLOT(styleChanged(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Destructor. */
|
/* Destructor. */
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,7 @@ void ChatTabWidget::tabInfoChanged(ChatDialog *dialog)
|
||||||
}
|
}
|
||||||
} else if (dialog->hasPeerStatus()) {
|
} else if (dialog->hasPeerStatus()) {
|
||||||
setBlinking(tab, false);
|
setBlinking(tab, false);
|
||||||
setTabIcon(tab, QIcon(StatusDefs::imageIM(dialog->getPeerStatus())));
|
setTabIcon(tab, QIcon(StatusDefs::imageIM((RsStatusValue)dialog->getPeerStatus())));
|
||||||
} else {
|
} else {
|
||||||
setBlinking(tab, false);
|
setBlinking(tab, false);
|
||||||
setTabIcon(tab, QIcon());
|
setTabIcon(tab, QIcon());
|
||||||
|
|
@ -155,7 +155,7 @@ void ChatTabWidget::getInfo(bool &isTyping, bool &hasNewMessage, QIcon *icon)
|
||||||
} else {
|
} else {
|
||||||
cd = dynamic_cast<ChatDialog*>(currentWidget());
|
cd = dynamic_cast<ChatDialog*>(currentWidget());
|
||||||
if (cd && cd->hasPeerStatus()) {
|
if (cd && cd->hasPeerStatus()) {
|
||||||
*icon = QIcon(StatusDefs::imageIM(cd->getPeerStatus()));
|
*icon = QIcon(StatusDefs::imageIM((RsStatusValue)cd->getPeerStatus()));
|
||||||
} else {
|
} else {
|
||||||
*icon = QIcon();
|
*icon = QIcon();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,13 +22,12 @@
|
||||||
|
|
||||||
#include "gui/common/FilesDefs.h"
|
#include "gui/common/FilesDefs.h"
|
||||||
#include "ChatUserNotify.h"
|
#include "ChatUserNotify.h"
|
||||||
#include "gui/notifyqt.h"
|
|
||||||
#include "gui/MainWindow.h"
|
#include "gui/MainWindow.h"
|
||||||
#include "gui/chat/ChatDialog.h"
|
#include "gui/chat/ChatDialog.h"
|
||||||
#include "gui/settings/rsharesettings.h"
|
#include "gui/settings/rsharesettings.h"
|
||||||
|
#include "util/qtthreadsutils.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <retroshare/rsnotify.h>
|
|
||||||
#include <retroshare/rsmsgs.h>
|
#include <retroshare/rsmsgs.h>
|
||||||
|
|
||||||
static std::map<ChatId, int> waitingChats;
|
static std::map<ChatId, int> waitingChats;
|
||||||
|
|
@ -57,8 +56,30 @@ static ChatUserNotify* instance = 0;
|
||||||
ChatUserNotify::ChatUserNotify(QObject *parent) :
|
ChatUserNotify::ChatUserNotify(QObject *parent) :
|
||||||
UserNotify(parent)
|
UserNotify(parent)
|
||||||
{
|
{
|
||||||
connect(NotifyQt::getInstance(), SIGNAL(chatMessageReceived(ChatMessage)), this, SLOT(chatMessageReceived(ChatMessage)));
|
|
||||||
instance = this;
|
instance = this;
|
||||||
|
|
||||||
|
mEventHandlerId = 0;
|
||||||
|
|
||||||
|
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e)
|
||||||
|
{
|
||||||
|
RsQThreadUtils::postToObject([=]()
|
||||||
|
{
|
||||||
|
auto fe = dynamic_cast<const RsChatServiceEvent*>(e.get()); if(!fe) return;
|
||||||
|
|
||||||
|
if(!fe)
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch(fe->mEventCode)
|
||||||
|
{
|
||||||
|
case RsChatServiceEventCode::CHAT_MESSAGE_RECEIVED: chatMessageReceived(fe->mMsg); break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
, this );
|
||||||
|
}, mEventHandlerId, RsEventType::CHAT_SERVICE );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatUserNotify::~ChatUserNotify()
|
ChatUserNotify::~ChatUserNotify()
|
||||||
|
|
@ -108,7 +129,7 @@ void ChatUserNotify::iconClicked()
|
||||||
{
|
{
|
||||||
ChatDialog *chatDialog = NULL;
|
ChatDialog *chatDialog = NULL;
|
||||||
// ChatWidget removes the waiting chat from the list with clearWaitingChat()
|
// ChatWidget removes the waiting chat from the list with clearWaitingChat()
|
||||||
chatDialog = ChatDialog::getChat(waitingChats.begin()->first, RS_CHAT_OPEN | RS_CHAT_FOCUS);
|
chatDialog = ChatDialog::getChat(waitingChats.begin()->first, RsChatFlags::RS_CHAT_OPEN | RsChatFlags::RS_CHAT_FOCUS);
|
||||||
|
|
||||||
if (chatDialog == NULL) {
|
if (chatDialog == NULL) {
|
||||||
MainWindow::showWindow(MainWindow::Friends);
|
MainWindow::showWindow(MainWindow::Friends);
|
||||||
|
|
@ -120,7 +141,7 @@ void ChatUserNotify::chatMessageReceived(ChatMessage msg)
|
||||||
{
|
{
|
||||||
if(!msg.chat_id.isBroadcast()
|
if(!msg.chat_id.isBroadcast()
|
||||||
&&( ChatDialog::getExistingChat(msg.chat_id)
|
&&( ChatDialog::getExistingChat(msg.chat_id)
|
||||||
|| (Settings->getChatFlags() & RS_CHAT_OPEN)
|
|| (Settings->getChatFlags() & (uint32_t)RsChatFlags::RS_CHAT_OPEN)
|
||||||
|| msg.chat_id.isDistantChatId()))
|
|| msg.chat_id.isDistantChatId()))
|
||||||
{
|
{
|
||||||
ChatDialog::chatMessageReceived(msg);
|
ChatDialog::chatMessageReceived(msg);
|
||||||
|
|
|
||||||
|
|
@ -42,11 +42,10 @@ public:
|
||||||
|
|
||||||
virtual bool hasSetting(QString *name, QString *group) override;
|
virtual bool hasSetting(QString *name, QString *group) override;
|
||||||
|
|
||||||
private slots:
|
|
||||||
void chatMessageReceived(ChatMessage msg);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual QIcon getIcon() override;
|
void chatMessageReceived(ChatMessage msg);
|
||||||
|
|
||||||
|
virtual QIcon getIcon() override;
|
||||||
virtual QIcon getMainIcon(bool hasNew) override;
|
virtual QIcon getMainIcon(bool hasNew) override;
|
||||||
virtual unsigned int getNewCount() override;
|
virtual unsigned int getNewCount() override;
|
||||||
|
|
||||||
|
|
@ -54,6 +53,8 @@ private:
|
||||||
virtual QString getNotifyMessage(bool plural) override;
|
virtual QString getNotifyMessage(bool plural) override;
|
||||||
|
|
||||||
virtual void iconClicked() override;
|
virtual void iconClicked() override;
|
||||||
|
|
||||||
|
RsEventsHandlerId_t mEventHandlerId;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CHATUSERNOTIFY_H
|
#endif // CHATUSERNOTIFY_H
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@
|
||||||
#include "ui_ChatWidget.h"
|
#include "ui_ChatWidget.h"
|
||||||
|
|
||||||
#include "gui/MainWindow.h"
|
#include "gui/MainWindow.h"
|
||||||
#include "gui/notifyqt.h"
|
|
||||||
#include "gui/RetroShareLink.h"
|
#include "gui/RetroShareLink.h"
|
||||||
#include "gui/settings/rsharesettings.h"
|
#include "gui/settings/rsharesettings.h"
|
||||||
#include "gui/settings/rsettingswin.h"
|
#include "gui/settings/rsettingswin.h"
|
||||||
|
|
@ -33,11 +32,14 @@
|
||||||
#include "gui/common/Emoticons.h"
|
#include "gui/common/Emoticons.h"
|
||||||
#include "gui/chat/ChatLobbyDialog.h"
|
#include "gui/chat/ChatLobbyDialog.h"
|
||||||
#include "gui/gxs/GxsIdDetails.h"
|
#include "gui/gxs/GxsIdDetails.h"
|
||||||
|
#include "gui/RsGUIEventManager.h"
|
||||||
#include "util/misc.h"
|
#include "util/misc.h"
|
||||||
|
#include "util/qtthreadsutils.h"
|
||||||
#include "util/HandleRichText.h"
|
#include "util/HandleRichText.h"
|
||||||
#include "gui/chat/ChatUserNotify.h"//For BradCast
|
#include "gui/chat/ChatUserNotify.h"//For BradCast
|
||||||
#include "util/DateTime.h"
|
#include "util/DateTime.h"
|
||||||
#include "util/imageutil.h"
|
#include "util/imageutil.h"
|
||||||
|
#include "util/qtthreadsutils.h"
|
||||||
#include "gui/im_history/ImHistoryBrowser.h"
|
#include "gui/im_history/ImHistoryBrowser.h"
|
||||||
|
|
||||||
#include <retroshare/rsstatus.h>
|
#include <retroshare/rsstatus.h>
|
||||||
|
|
@ -75,7 +77,7 @@
|
||||||
|
|
||||||
ChatWidget::ChatWidget(QWidget *parent)
|
ChatWidget::ChatWidget(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
, completionPosition(0), newMessages(false), typing(false), peerStatus(0)
|
, completionPosition(0), newMessages(false), typing(false), peerStatus(RsStatusValue::RS_STATUS_OFFLINE)
|
||||||
, sendingBlocked(false), useCMark(false)
|
, sendingBlocked(false), useCMark(false)
|
||||||
, lastStatusSendTime(0)
|
, lastStatusSendTime(0)
|
||||||
, firstShow(true), inChatCharFormatChanged(false), firstSearch(true)
|
, firstShow(true), inChatCharFormatChanged(false), firstSearch(true)
|
||||||
|
|
@ -172,9 +174,32 @@ ChatWidget::ChatWidget(QWidget *parent)
|
||||||
|
|
||||||
connect(ui->hashBox, SIGNAL(fileHashingFinished(QList<HashedFile>)), this, SLOT(fileHashingFinished(QList<HashedFile>)));
|
connect(ui->hashBox, SIGNAL(fileHashingFinished(QList<HashedFile>)), this, SLOT(fileHashingFinished(QList<HashedFile>)));
|
||||||
|
|
||||||
connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(const QString&, int)), this, SLOT(updateStatus(const QString&, int)));
|
mEventHandlerId_friends = 0;
|
||||||
connect(NotifyQt::getInstance(), SIGNAL(peerHasNewCustomStateString(const QString&, const QString&)), this, SLOT(updatePeersCustomStateString(const QString&, const QString&)));
|
|
||||||
connect(NotifyQt::getInstance(), SIGNAL(chatFontChanged()), this, SLOT(resetFonts()));
|
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e)
|
||||||
|
{
|
||||||
|
RsQThreadUtils::postToObject([=](){
|
||||||
|
auto fe = dynamic_cast<const RsFriendListEvent*>(e.get());
|
||||||
|
|
||||||
|
if(!fe)
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch(fe->mEventCode)
|
||||||
|
{
|
||||||
|
case RsFriendListEventCode::NODE_STATUS_CHANGED: updateStatus(ChatId(fe->mSslId),fe->mStatus);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RsFriendListEventCode::NODE_STATE_STRING_CHANGED: updatePeersCustomStateString(ChatId(fe->mSslId),QString::fromUtf8(fe->mStateString.c_str()));
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}, this );
|
||||||
|
},mEventHandlerId_friends,RsEventType::FRIEND_LIST);
|
||||||
|
|
||||||
|
connect(RsGUIEventManager::getInstance(), SIGNAL(chatFontChanged()), this, SLOT(resetFonts()));
|
||||||
|
|
||||||
connect(ui->textBrowser, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuTextBrowser(QPoint)));
|
connect(ui->textBrowser, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuTextBrowser(QPoint)));
|
||||||
|
|
||||||
|
|
@ -255,6 +280,7 @@ ChatWidget::ChatWidget(QWidget *parent)
|
||||||
ChatWidget::~ChatWidget()
|
ChatWidget::~ChatWidget()
|
||||||
{
|
{
|
||||||
processSettings(false);
|
processSettings(false);
|
||||||
|
rsEvents->unregisterEventsHandler(mEventHandlerId_friends);
|
||||||
|
|
||||||
/* Cleanup plugin functions */
|
/* Cleanup plugin functions */
|
||||||
foreach (ChatWidgetHolder *chatWidgetHolder, mChatWidgetHolder) {
|
foreach (ChatWidgetHolder *chatWidgetHolder, mChatWidgetHolder) {
|
||||||
|
|
@ -369,11 +395,11 @@ void ChatWidget::init(const ChatId &chat_id, const QString &title)
|
||||||
StatusInfo peerStatusInfo;
|
StatusInfo peerStatusInfo;
|
||||||
// No check of return value. Non existing status info is handled as offline.
|
// No check of return value. Non existing status info is handled as offline.
|
||||||
rsStatus->getStatus(chatId.toPeerId(), peerStatusInfo);
|
rsStatus->getStatus(chatId.toPeerId(), peerStatusInfo);
|
||||||
updateStatus(QString::fromStdString(chatId.toPeerId().toStdString()), peerStatusInfo.status);
|
updateStatus(chatId, peerStatusInfo.status);
|
||||||
|
|
||||||
// initialize first custom state string
|
// initialize first custom state string
|
||||||
QString customStateString = QString::fromUtf8(rsMsgs->getCustomStateString(chatId.toPeerId()).c_str());
|
QString customStateString = QString::fromUtf8(rsMsgs->getCustomStateString(chatId.toPeerId()).c_str());
|
||||||
updatePeersCustomStateString(QString::fromStdString(chatId.toPeerId().toStdString()), customStateString);
|
updatePeersCustomStateString(chatId, customStateString);
|
||||||
} else if (chatType() == CHATTYPE_DISTANT){
|
} else if (chatType() == CHATTYPE_DISTANT){
|
||||||
hist_chat_type = RS_HISTORY_TYPE_DISTANT ;
|
hist_chat_type = RS_HISTORY_TYPE_DISTANT ;
|
||||||
messageCount = Settings->getDistantChatHistoryCount();
|
messageCount = Settings->getDistantChatHistoryCount();
|
||||||
|
|
@ -1792,108 +1818,106 @@ void ChatWidget::setCurrentFileName(const QString &fileName)
|
||||||
setWindowModified(false);
|
setWindowModified(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidget::updateStatus(const QString &peer_id, int status)
|
void ChatWidget::updateStatus(const ChatId& cid, RsStatusValue status)
|
||||||
{
|
{
|
||||||
if (! (chatType() == CHATTYPE_PRIVATE || chatType() == CHATTYPE_DISTANT))
|
if (! (chatType() == CHATTYPE_PRIVATE || chatType() == CHATTYPE_DISTANT))
|
||||||
{
|
{
|
||||||
// updateTitle is used
|
// updateTitle is used
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// make virtual peer id from gxs id in case of distant chat
|
// // make virtual peer id from gxs id in case of distant chat
|
||||||
RsPeerId vpid;
|
// RsPeerId vpid;
|
||||||
|
// if(chatId.isDistantChatId())
|
||||||
|
// vpid = RsPeerId(chatId.toDistantChatId());
|
||||||
|
// else
|
||||||
|
// vpid = chatId.toPeerId();
|
||||||
|
|
||||||
|
/* set font size for status */
|
||||||
|
if (!(cid == chatId))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// the peers status has changed
|
||||||
|
|
||||||
|
QString tooltip_info ;
|
||||||
|
QString peerName ;
|
||||||
|
|
||||||
if(chatId.isDistantChatId())
|
if(chatId.isDistantChatId())
|
||||||
vpid = RsPeerId(chatId.toDistantChatId());
|
|
||||||
else
|
|
||||||
vpid = chatId.toPeerId();
|
|
||||||
|
|
||||||
/* set font size for status */
|
|
||||||
if (peer_id.toStdString() == vpid.toStdString())
|
|
||||||
{
|
{
|
||||||
// the peers status has changed
|
DistantChatPeerInfo dcpinfo ;
|
||||||
|
RsIdentityDetails details ;
|
||||||
|
|
||||||
QString tooltip_info ;
|
if(rsMsgs->getDistantChatStatus(chatId.toDistantChatId(),dcpinfo))
|
||||||
QString peerName ;
|
{
|
||||||
|
if(rsIdentity->getIdDetails(dcpinfo.to_id,details))
|
||||||
|
peerName = QString::fromUtf8( details.mNickname.c_str() ) ;
|
||||||
|
else
|
||||||
|
peerName = QString::fromStdString(dcpinfo.to_id.toStdString()) ;
|
||||||
|
|
||||||
if(chatId.isDistantChatId())
|
tooltip_info = QString("Identity Id: ")+QString::fromStdString(dcpinfo.to_id.toStdString());
|
||||||
{
|
}
|
||||||
DistantChatPeerInfo dcpinfo ;
|
else
|
||||||
RsIdentityDetails details ;
|
{
|
||||||
|
peerName = QString::fromStdString(chatId.toDistantChatId().toStdString()) ;
|
||||||
if(rsMsgs->getDistantChatStatus(chatId.toDistantChatId(),dcpinfo))
|
tooltip_info = QString("Identity Id: unknown (bug?)");
|
||||||
{
|
}
|
||||||
if(rsIdentity->getIdDetails(dcpinfo.to_id,details))
|
}
|
||||||
peerName = QString::fromUtf8( details.mNickname.c_str() ) ;
|
else
|
||||||
else
|
{
|
||||||
peerName = QString::fromStdString(dcpinfo.to_id.toStdString()) ;
|
peerName = QString::fromUtf8(rsPeers->getPeerName(chatId.toPeerId()).c_str());
|
||||||
|
tooltip_info = QString("Peer Id: ") + QString::fromStdString(chatId.toPeerId().toStdString());
|
||||||
tooltip_info = QString("Identity Id: ")+QString::fromStdString(dcpinfo.to_id.toStdString());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
peerName = QString::fromStdString(chatId.toDistantChatId().toStdString()) ;
|
|
||||||
tooltip_info = QString("Identity Id: unknown (bug?)");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
peerName = QString::fromUtf8(rsPeers->getPeerName(chatId.toPeerId()).c_str());
|
|
||||||
tooltip_info = QString("Peer Id: ") + QString::fromStdString(chatId.toPeerId().toStdString());
|
|
||||||
}
|
|
||||||
|
|
||||||
// is scrollbar at the end?
|
|
||||||
QScrollBar *scrollbar = ui->textBrowser->verticalScrollBar();
|
|
||||||
bool atEnd = (scrollbar->value() == scrollbar->maximum());
|
|
||||||
|
|
||||||
switch (status) {
|
|
||||||
case RS_STATUS_OFFLINE:
|
|
||||||
ui->info_Frame->setVisible(true);
|
|
||||||
ui->infoLabel->setText(peerName + " " + tr("appears to be Offline.") +"\n" + tr("Messages you send will be delivered after Friend is again Online."));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RS_STATUS_INACTIVE:
|
|
||||||
ui->info_Frame->setVisible(true);
|
|
||||||
ui->infoLabel->setText(peerName + " " + tr("is Idle and may not reply"));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RS_STATUS_ONLINE:
|
|
||||||
ui->info_Frame->setVisible(false);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RS_STATUS_AWAY:
|
|
||||||
ui->infoLabel->setText(peerName + " " + tr("is Away and may not reply"));
|
|
||||||
ui->info_Frame->setVisible(true);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RS_STATUS_BUSY:
|
|
||||||
ui->infoLabel->setText(peerName + " " + tr("is Busy and may not reply"));
|
|
||||||
ui->info_Frame->setVisible(true);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
ui->titleLabel->setText(peerName);
|
|
||||||
ui->titleLabel->setToolTip(tooltip_info);
|
|
||||||
ui->statusLabel->setText(QString("(%1)").arg(StatusDefs::name(status)));
|
|
||||||
|
|
||||||
peerStatus = status;
|
|
||||||
|
|
||||||
if (atEnd) {
|
|
||||||
// scroll to the end
|
|
||||||
scrollbar->setValue(scrollbar->maximum());
|
|
||||||
}
|
|
||||||
|
|
||||||
emit infoChanged(this);
|
|
||||||
emit statusChanged(status);
|
|
||||||
|
|
||||||
// Notify all ChatWidgetHolder
|
|
||||||
foreach (ChatWidgetHolder *chatWidgetHolder, mChatWidgetHolder) {
|
|
||||||
chatWidgetHolder->updateStatus(status);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore status change
|
// is scrollbar at the end?
|
||||||
|
QScrollBar *scrollbar = ui->textBrowser->verticalScrollBar();
|
||||||
|
bool atEnd = (scrollbar->value() == scrollbar->maximum());
|
||||||
|
|
||||||
|
switch (status) {
|
||||||
|
default:
|
||||||
|
case RsStatusValue::RS_STATUS_OFFLINE:
|
||||||
|
ui->info_Frame->setVisible(true);
|
||||||
|
ui->infoLabel->setText(peerName + " " + tr("appears to be Offline.") +"\n" + tr("Messages you send will be delivered after Friend is again Online."));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RsStatusValue::RS_STATUS_INACTIVE:
|
||||||
|
ui->info_Frame->setVisible(true);
|
||||||
|
ui->infoLabel->setText(peerName + " " + tr("is Idle and may not reply"));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RsStatusValue::RS_STATUS_ONLINE:
|
||||||
|
ui->info_Frame->setVisible(false);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RsStatusValue::RS_STATUS_AWAY:
|
||||||
|
ui->infoLabel->setText(peerName + " " + tr("is Away and may not reply"));
|
||||||
|
ui->info_Frame->setVisible(true);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RsStatusValue::RS_STATUS_BUSY:
|
||||||
|
ui->infoLabel->setText(peerName + " " + tr("is Busy and may not reply"));
|
||||||
|
ui->info_Frame->setVisible(true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->titleLabel->setText(peerName);
|
||||||
|
ui->titleLabel->setToolTip(tooltip_info);
|
||||||
|
#warning inconsistent conversion here
|
||||||
|
ui->statusLabel->setText(QString("(%1)").arg(StatusDefs::name((RsStatusValue)status)));
|
||||||
|
|
||||||
|
peerStatus = status;
|
||||||
|
|
||||||
|
if (atEnd) {
|
||||||
|
// scroll to the end
|
||||||
|
scrollbar->setValue(scrollbar->maximum());
|
||||||
|
}
|
||||||
|
|
||||||
|
emit infoChanged(this);
|
||||||
|
emit statusChanged(status);
|
||||||
|
|
||||||
|
// Notify all ChatWidgetHolder
|
||||||
|
foreach (ChatWidgetHolder *chatWidgetHolder, mChatWidgetHolder) {
|
||||||
|
chatWidgetHolder->updateStatus(status);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidget::updateTitle()
|
void ChatWidget::updateTitle()
|
||||||
|
|
@ -1906,7 +1930,7 @@ void ChatWidget::updateTitle()
|
||||||
ui->titleLabel->setText(RsHtml::plainText(name) + "@" + RsHtml::plainText(title));
|
ui->titleLabel->setText(RsHtml::plainText(name) + "@" + RsHtml::plainText(title));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidget::updatePeersCustomStateString(const QString& peer_id, const QString& status_string)
|
void ChatWidget::updatePeersCustomStateString(const ChatId& id, const QString& status_string)
|
||||||
{
|
{
|
||||||
if (chatType() != CHATTYPE_PRIVATE )
|
if (chatType() != CHATTYPE_PRIVATE )
|
||||||
{
|
{
|
||||||
|
|
@ -1915,7 +1939,7 @@ void ChatWidget::updatePeersCustomStateString(const QString& peer_id, const QStr
|
||||||
|
|
||||||
QString status_text;
|
QString status_text;
|
||||||
|
|
||||||
if (RsPeerId(peer_id.toStdString()) == chatId.toPeerId()) {
|
if (id.toPeerId() == chatId.toPeerId()) {
|
||||||
// the peers status string has changed
|
// the peers status string has changed
|
||||||
if (status_string.isEmpty()) {
|
if (status_string.isEmpty()) {
|
||||||
ui->statusMessageLabel->hide();
|
ui->statusMessageLabel->hide();
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@
|
||||||
|
|
||||||
#include <retroshare/rsmsgs.h>
|
#include <retroshare/rsmsgs.h>
|
||||||
#include <retroshare/rsfiles.h>
|
#include <retroshare/rsfiles.h>
|
||||||
|
#include <retroshare/rsstatus.h>
|
||||||
|
|
||||||
#include <QCompleter>
|
#include <QCompleter>
|
||||||
#include <QTextCharFormat>
|
#include <QTextCharFormat>
|
||||||
|
|
@ -52,6 +53,17 @@ namespace Ui {
|
||||||
class ChatWidget;
|
class ChatWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum class RsChatFlags: uint32_t {
|
||||||
|
RS_CHAT_NONE = 0x0000,
|
||||||
|
RS_CHAT_OPEN = 0x0001,
|
||||||
|
RS_CHAT_FOCUS = 0x0004,
|
||||||
|
RS_CHAT_TABBED_WINDOW = 0x0008,
|
||||||
|
RS_CHAT_BLINK = 0x0010,
|
||||||
|
};
|
||||||
|
|
||||||
|
RS_REGISTER_ENUM_FLAGS_TYPE(RsChatFlags);
|
||||||
|
|
||||||
|
|
||||||
// a Container for the logic behind buttons in a PopupChatDialog
|
// a Container for the logic behind buttons in a PopupChatDialog
|
||||||
// Plugins can implement this interface to provide their own buttons
|
// Plugins can implement this interface to provide their own buttons
|
||||||
class ChatWidgetHolder
|
class ChatWidgetHolder
|
||||||
|
|
@ -62,7 +74,7 @@ public:
|
||||||
|
|
||||||
// status comes from notifyPeerStatusChanged
|
// status comes from notifyPeerStatusChanged
|
||||||
// see rststaus.h for possible values
|
// see rststaus.h for possible values
|
||||||
virtual void updateStatus(int /*status*/) {}
|
virtual void updateStatus(RsStatusValue /*status*/) {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ChatWidget *mChatWidget;
|
ChatWidget *mChatWidget;
|
||||||
|
|
@ -105,7 +117,7 @@ public:
|
||||||
void addToolsAction(QAction *action);
|
void addToolsAction(QAction *action);
|
||||||
|
|
||||||
QString getTitle() { return title; }
|
QString getTitle() { return title; }
|
||||||
int getPeerStatus() { return peerStatus; }
|
RsStatusValue getPeerStatus() { return peerStatus; }
|
||||||
void setName(const QString &name);
|
void setName(const QString &name);
|
||||||
|
|
||||||
bool setStyle();
|
bool setStyle();
|
||||||
|
|
@ -130,7 +142,7 @@ public:
|
||||||
const QList<ChatWidgetHolder*> &chatWidgetHolderList() { return mChatWidgetHolder; }
|
const QList<ChatWidgetHolder*> &chatWidgetHolderList() { return mChatWidgetHolder; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void updateStatus(const QString &peer_id, int status);
|
void updateStatus(const ChatId &cid, RsStatusValue status);
|
||||||
void setUseCMark(const bool bUseCMark);
|
void setUseCMark(const bool bUseCMark);
|
||||||
void updateCMPreview();
|
void updateCMPreview();
|
||||||
|
|
||||||
|
|
@ -144,7 +156,7 @@ private slots:
|
||||||
signals:
|
signals:
|
||||||
void infoChanged(ChatWidget*);
|
void infoChanged(ChatWidget*);
|
||||||
void newMessage(ChatWidget*);
|
void newMessage(ChatWidget*);
|
||||||
void statusChanged(int);
|
void statusChanged(RsStatusValue);
|
||||||
void textBrowserAskContextMenu(QMenu* contextMnu, QString anchorForPosition, const QPoint point);
|
void textBrowserAskContextMenu(QMenu* contextMnu, QString anchorForPosition, const QPoint point);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
@ -189,7 +201,7 @@ private slots:
|
||||||
void updateLenOfChatTextEdit();
|
void updateLenOfChatTextEdit();
|
||||||
void sendChat();
|
void sendChat();
|
||||||
|
|
||||||
void updatePeersCustomStateString(const QString& peer_id, const QString& status_string) ;
|
void updatePeersCustomStateString(const ChatId& id, const QString& status_string) ;
|
||||||
|
|
||||||
bool fileSave();
|
bool fileSave();
|
||||||
bool fileSaveAs();
|
bool fileSaveAs();
|
||||||
|
|
@ -229,7 +241,7 @@ private:
|
||||||
|
|
||||||
bool newMessages;
|
bool newMessages;
|
||||||
bool typing;
|
bool typing;
|
||||||
int peerStatus;
|
RsStatusValue peerStatus;
|
||||||
|
|
||||||
bool sendingBlocked;
|
bool sendingBlocked;
|
||||||
bool useCMark;
|
bool useCMark;
|
||||||
|
|
@ -272,6 +284,9 @@ private:
|
||||||
ChatLobbyUserNotify* notify;
|
ChatLobbyUserNotify* notify;
|
||||||
|
|
||||||
Ui::ChatWidget *ui;
|
Ui::ChatWidget *ui;
|
||||||
|
|
||||||
|
// RsEventsHandlerId_t mEventHandlerId_chat ;
|
||||||
|
RsEventsHandlerId_t mEventHandlerId_friends ;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CHATWIDGET_H
|
#endif // CHATWIDGET_H
|
||||||
|
|
|
||||||
|
|
@ -26,12 +26,11 @@
|
||||||
#include "gui/common/FilesDefs.h"
|
#include "gui/common/FilesDefs.h"
|
||||||
#include "gui/settings/rsharesettings.h"
|
#include "gui/settings/rsharesettings.h"
|
||||||
#include "gui/settings/RsharePeerSettings.h"
|
#include "gui/settings/RsharePeerSettings.h"
|
||||||
#include "gui/notifyqt.h"
|
|
||||||
#include "util/DateTime.h"
|
#include "util/DateTime.h"
|
||||||
|
#include "util/qtthreadsutils.h"
|
||||||
|
|
||||||
#include <retroshare/rspeers.h>
|
#include <retroshare/rspeers.h>
|
||||||
#include <retroshare/rsiface.h>
|
#include <retroshare/rsiface.h>
|
||||||
#include <retroshare/rsnotify.h>
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
|
@ -50,7 +49,25 @@ PopupChatDialog::PopupChatDialog(QWidget *parent, Qt::WindowFlags flags)
|
||||||
|
|
||||||
connect(ui.avatarFrameButton, SIGNAL(toggled(bool)), this, SLOT(showAvatarFrame(bool)));
|
connect(ui.avatarFrameButton, SIGNAL(toggled(bool)), this, SLOT(showAvatarFrame(bool)));
|
||||||
connect(ui.actionClearOfflineMessages, SIGNAL(triggered()), this, SLOT(clearOfflineMessages()));
|
connect(ui.actionClearOfflineMessages, SIGNAL(triggered()), this, SLOT(clearOfflineMessages()));
|
||||||
connect(NotifyQt::getInstance(), SIGNAL(chatStatusChanged(ChatId,QString)), this, SLOT(chatStatusChanged(ChatId,QString)));
|
|
||||||
|
mEventHandlerId_chat =0;
|
||||||
|
|
||||||
|
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e)
|
||||||
|
{
|
||||||
|
RsQThreadUtils::postToObject([=]()
|
||||||
|
{
|
||||||
|
auto fe = dynamic_cast<const RsChatServiceEvent*>(e.get()); if(!fe) return;
|
||||||
|
|
||||||
|
switch(fe->mEventCode)
|
||||||
|
{
|
||||||
|
case RsChatServiceEventCode::CHAT_STATUS_CHANGED: chatStatusChanged(fe->mCid,QString::fromUtf8(fe->mStr.c_str())); break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
, this );
|
||||||
|
}, mEventHandlerId_chat, RsEventType::CHAT_SERVICE );
|
||||||
}
|
}
|
||||||
|
|
||||||
void PopupChatDialog::init(const ChatId &chat_id, const QString &title)
|
void PopupChatDialog::init(const ChatId &chat_id, const QString &title)
|
||||||
|
|
@ -81,6 +98,7 @@ void PopupChatDialog::init(const ChatId &chat_id, const QString &title)
|
||||||
/** Destructor. */
|
/** Destructor. */
|
||||||
PopupChatDialog::~PopupChatDialog()
|
PopupChatDialog::~PopupChatDialog()
|
||||||
{
|
{
|
||||||
|
rsEvents->unregisterEventsHandler(mEventHandlerId_chat);
|
||||||
// save settings
|
// save settings
|
||||||
processSettings(false);
|
processSettings(false);
|
||||||
}
|
}
|
||||||
|
|
@ -92,7 +110,7 @@ ChatWidget *PopupChatDialog::getChatWidget()
|
||||||
|
|
||||||
bool PopupChatDialog::notifyBlink()
|
bool PopupChatDialog::notifyBlink()
|
||||||
{
|
{
|
||||||
return (Settings->getChatFlags() & RS_CHAT_BLINK);
|
return (Settings->getChatFlags() & (uint32_t)RsChatFlags::RS_CHAT_BLINK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PopupChatDialog::processSettings(bool load)
|
void PopupChatDialog::processSettings(bool load)
|
||||||
|
|
@ -108,7 +126,7 @@ void PopupChatDialog::processSettings(bool load)
|
||||||
Settings->endGroup();
|
Settings->endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PopupChatDialog::showDialog(uint chatflags)
|
void PopupChatDialog::showDialog(RsChatFlags chatflags)
|
||||||
{
|
{
|
||||||
PopupChatWindow *window = WINDOW(this);
|
PopupChatWindow *window = WINDOW(this);
|
||||||
if (window) {
|
if (window) {
|
||||||
|
|
|
||||||
|
|
@ -46,11 +46,11 @@ protected:
|
||||||
/** Default destructor */
|
/** Default destructor */
|
||||||
virtual ~PopupChatDialog();
|
virtual ~PopupChatDialog();
|
||||||
|
|
||||||
virtual void init(const ChatId &chat_id, const QString &title);
|
virtual void init(const ChatId &chat_id, const QString &title) override;
|
||||||
virtual void showDialog(uint chatflags);
|
virtual void showDialog(RsChatFlags chatflags) override;
|
||||||
virtual ChatWidget *getChatWidget();
|
virtual ChatWidget *getChatWidget() override;
|
||||||
virtual bool hasPeerStatus() { return true; }
|
virtual bool hasPeerStatus() override{ return true; }
|
||||||
virtual bool notifyBlink();
|
virtual bool notifyBlink() override;
|
||||||
|
|
||||||
virtual void updateStatus(int /*status*/) {}
|
virtual void updateStatus(int /*status*/) {}
|
||||||
|
|
||||||
|
|
@ -65,6 +65,8 @@ protected:
|
||||||
|
|
||||||
/** Qt Designer generated object */
|
/** Qt Designer generated object */
|
||||||
Ui::PopupChatDialog ui;
|
Ui::PopupChatDialog ui;
|
||||||
|
|
||||||
|
RsEventsHandlerId_t mEventHandlerId_chat;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,6 @@
|
||||||
|
|
||||||
#include <retroshare/rsidentity.h>
|
#include <retroshare/rsidentity.h>
|
||||||
#include <retroshare/rsmsgs.h>
|
#include <retroshare/rsmsgs.h>
|
||||||
#include <retroshare/rsnotify.h>
|
|
||||||
|
|
||||||
|
|
||||||
#define IMAGE_TYPING ":/images/white-bubble-64.png"
|
#define IMAGE_TYPING ":/images/white-bubble-64.png"
|
||||||
|
|
@ -49,7 +48,7 @@ static PopupChatWindow *instance = NULL;
|
||||||
|
|
||||||
/*static*/ PopupChatWindow *PopupChatWindow::getWindow(bool needSingleWindow)
|
/*static*/ PopupChatWindow *PopupChatWindow::getWindow(bool needSingleWindow)
|
||||||
{
|
{
|
||||||
if (needSingleWindow == false && (Settings->getChatFlags() & RS_CHAT_TABBED_WINDOW)) {
|
if (needSingleWindow == false && (Settings->getChatFlags() & (uint32_t)RsChatFlags::RS_CHAT_TABBED_WINDOW)) {
|
||||||
if (instance == NULL) {
|
if (instance == NULL) {
|
||||||
instance = new PopupChatWindow(true);
|
instance = new PopupChatWindow(true);
|
||||||
}
|
}
|
||||||
|
|
@ -162,7 +161,7 @@ void PopupChatWindow::showContextMenu(QPoint)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings->getChatFlags() & RS_CHAT_TABBED_WINDOW)
|
if (Settings->getChatFlags() & (uint32_t)RsChatFlags::RS_CHAT_TABBED_WINDOW)
|
||||||
{
|
{
|
||||||
if(tabbedWindow)
|
if(tabbedWindow)
|
||||||
contextMnu.addAction(FilesDefs::getIconFromQtResourcePath(":/images/tab-dock.png"),tr("Dock window"),this,SLOT(docTab()));
|
contextMnu.addAction(FilesDefs::getIconFromQtResourcePath(":/images/tab-dock.png"),tr("Dock window"),this,SLOT(docTab()));
|
||||||
|
|
@ -300,9 +299,9 @@ void PopupChatWindow::removeDialog(ChatDialog *dialog)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PopupChatWindow::showDialog(ChatDialog *dialog, uint chatflags)
|
void PopupChatWindow::showDialog(ChatDialog *dialog, RsChatFlags chatflags)
|
||||||
{
|
{
|
||||||
if (chatflags & RS_CHAT_FOCUS) {
|
if (!!(chatflags & RsChatFlags::RS_CHAT_FOCUS)) {
|
||||||
if (tabbedWindow) {
|
if (tabbedWindow) {
|
||||||
ui.tabWidget->setCurrentWidget(dialog);
|
ui.tabWidget->setCurrentWidget(dialog);
|
||||||
}
|
}
|
||||||
|
|
@ -352,7 +351,7 @@ void PopupChatWindow::calculateTitle(ChatDialog *dialog)
|
||||||
icon = FilesDefs::getIconFromQtResourcePath(IMAGE_TYPING);
|
icon = FilesDefs::getIconFromQtResourcePath(IMAGE_TYPING);
|
||||||
} else if (hasNewMessages) {
|
} else if (hasNewMessages) {
|
||||||
icon = FilesDefs::getIconFromQtResourcePath(IMAGE_CHAT);
|
icon = FilesDefs::getIconFromQtResourcePath(IMAGE_CHAT);
|
||||||
if (Settings->getChatFlags() & RS_CHAT_BLINK) {
|
if (Settings->getChatFlags() & (uint32_t)RsChatFlags::RS_CHAT_BLINK) {
|
||||||
mBlinkIcon = icon;
|
mBlinkIcon = icon;
|
||||||
} else {
|
} else {
|
||||||
mBlinkIcon = QIcon();
|
mBlinkIcon = QIcon();
|
||||||
|
|
@ -360,7 +359,7 @@ void PopupChatWindow::calculateTitle(ChatDialog *dialog)
|
||||||
} else {
|
} else {
|
||||||
mBlinkIcon = QIcon();
|
mBlinkIcon = QIcon();
|
||||||
if (cd && cd->hasPeerStatus()) {
|
if (cd && cd->hasPeerStatus()) {
|
||||||
icon = QIcon(StatusDefs::imageIM(cd->getPeerStatus()));
|
icon = QIcon(StatusDefs::imageIM((RsStatusValue)cd->getPeerStatus()));
|
||||||
} else {
|
} else {
|
||||||
icon = qApp->windowIcon();
|
icon = qApp->windowIcon();
|
||||||
}
|
}
|
||||||
|
|
@ -371,7 +370,7 @@ void PopupChatWindow::calculateTitle(ChatDialog *dialog)
|
||||||
if (cd) {
|
if (cd) {
|
||||||
QString title = cd->getTitle();
|
QString title = cd->getTitle();
|
||||||
if (cd->hasPeerStatus()) {
|
if (cd->hasPeerStatus()) {
|
||||||
title += " (" + StatusDefs::name(cd->getPeerStatus()) + ")";
|
title += " (" + StatusDefs::name((RsStatusValue)cd->getPeerStatus()) + ")";
|
||||||
}
|
}
|
||||||
setWindowTitle(title);
|
setWindowTitle(title);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -423,7 +422,7 @@ void PopupChatWindow::tabNewMessage(ChatDialog *dialog)
|
||||||
|
|
||||||
void PopupChatWindow::dockTab()
|
void PopupChatWindow::dockTab()
|
||||||
{
|
{
|
||||||
if ((Settings->getChatFlags() & RS_CHAT_TABBED_WINDOW) && chatDialog) {
|
if ((Settings->getChatFlags() & (uint32_t)RsChatFlags::RS_CHAT_TABBED_WINDOW) && chatDialog) {
|
||||||
PopupChatWindow *pcw = getWindow(false);
|
PopupChatWindow *pcw = getWindow(false);
|
||||||
if (pcw) {
|
if (pcw) {
|
||||||
ChatDialog *pcd = chatDialog;
|
ChatDialog *pcd = chatDialog;
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,9 @@
|
||||||
#include "ui_PopupChatWindow.h"
|
#include "ui_PopupChatWindow.h"
|
||||||
#include <retroshare/rstypes.h>
|
#include <retroshare/rstypes.h>
|
||||||
#include <retroshare/rsmsgs.h>
|
#include <retroshare/rsmsgs.h>
|
||||||
|
|
||||||
|
#include "gui/chat/ChatWidget.h"
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(RsGxsId)
|
Q_DECLARE_METATYPE(RsGxsId)
|
||||||
Q_DECLARE_METATYPE(QList<RsGxsId>)
|
Q_DECLARE_METATYPE(QList<RsGxsId>)
|
||||||
|
|
||||||
|
|
@ -43,7 +46,7 @@ public:
|
||||||
public:
|
public:
|
||||||
void addDialog(ChatDialog *dialog);
|
void addDialog(ChatDialog *dialog);
|
||||||
void removeDialog(ChatDialog *dialog);
|
void removeDialog(ChatDialog *dialog);
|
||||||
void showDialog(ChatDialog *dialog, uint chatflags);
|
void showDialog(ChatDialog *dialog, RsChatFlags chatflags);
|
||||||
void alertDialog(ChatDialog *dialog);
|
void alertDialog(ChatDialog *dialog);
|
||||||
void calculateTitle(ChatDialog *dialog);
|
void calculateTitle(ChatDialog *dialog);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@
|
||||||
</action>
|
</action>
|
||||||
<action name="actionDockTab">
|
<action name="actionDockTab">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../images.qrc">
|
<iconset>
|
||||||
<normaloff>:/images/tab-dock.png</normaloff>:/images/tab-dock.png</iconset>
|
<normaloff>:/images/tab-dock.png</normaloff>:/images/tab-dock.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
|
@ -97,7 +97,7 @@
|
||||||
</action>
|
</action>
|
||||||
<action name="actionUndockTab">
|
<action name="actionUndockTab">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../images.qrc">
|
<iconset>
|
||||||
<normaloff>:/images/tab-undock.png</normaloff>:/images/tab-undock.png</iconset>
|
<normaloff>:/images/tab-undock.png</normaloff>:/images/tab-undock.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ void PopupDistantChatDialog::updateDisplay()
|
||||||
getChatWidget()->blockSending(tr( "Can't send message immediately, "
|
getChatWidget()->blockSending(tr( "Can't send message immediately, "
|
||||||
"because there is no tunnel "
|
"because there is no tunnel "
|
||||||
"available." ));
|
"available." ));
|
||||||
setPeerStatus(RS_STATUS_OFFLINE);
|
setPeerStatus(RsStatusValue::RS_STATUS_OFFLINE);
|
||||||
break ;
|
break ;
|
||||||
case RS_DISTANT_CHAT_STATUS_REMOTELY_CLOSED:
|
case RS_DISTANT_CHAT_STATUS_REMOTELY_CLOSED:
|
||||||
std::cerr << "Chat remotely closed. " << std::endl;
|
std::cerr << "Chat remotely closed. " << std::endl;
|
||||||
|
|
@ -131,7 +131,7 @@ void PopupDistantChatDialog::updateDisplay()
|
||||||
getChatWidget()->updateStatusString("%1", tr( "Your partner closed the conversation." ), true );
|
getChatWidget()->updateStatusString("%1", tr( "Your partner closed the conversation." ), true );
|
||||||
getChatWidget()->blockSending(tr( "Your partner closed the conversation."));
|
getChatWidget()->blockSending(tr( "Your partner closed the conversation."));
|
||||||
|
|
||||||
setPeerStatus(RS_STATUS_OFFLINE) ;
|
setPeerStatus(RsStatusValue::RS_STATUS_OFFLINE) ;
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
case RS_DISTANT_CHAT_STATUS_TUNNEL_DN:
|
case RS_DISTANT_CHAT_STATUS_TUNNEL_DN:
|
||||||
|
|
@ -145,7 +145,7 @@ void PopupDistantChatDialog::updateDisplay()
|
||||||
_status_label->setToolTip(msg);
|
_status_label->setToolTip(msg);
|
||||||
getChatWidget()->updateStatusString("%1", msg, true);
|
getChatWidget()->updateStatusString("%1", msg, true);
|
||||||
getChatWidget()->blockSending(msg);
|
getChatWidget()->blockSending(msg);
|
||||||
setPeerStatus(RS_STATUS_OFFLINE);
|
setPeerStatus(RsStatusValue::RS_STATUS_OFFLINE);
|
||||||
break;
|
break;
|
||||||
case RS_DISTANT_CHAT_STATUS_CAN_TALK:
|
case RS_DISTANT_CHAT_STATUS_CAN_TALK:
|
||||||
|
|
||||||
|
|
@ -153,7 +153,7 @@ void PopupDistantChatDialog::updateDisplay()
|
||||||
msg = QObject::tr( "End-to-end encrypted conversation established");
|
msg = QObject::tr( "End-to-end encrypted conversation established");
|
||||||
_status_label->setToolTip(msg);
|
_status_label->setToolTip(msg);
|
||||||
getChatWidget()->unblockSending();
|
getChatWidget()->unblockSending();
|
||||||
setPeerStatus(RS_STATUS_ONLINE);
|
setPeerStatus(RsStatusValue::RS_STATUS_ONLINE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,8 @@
|
||||||
#include <retroshare/rspeers.h>
|
#include <retroshare/rspeers.h>
|
||||||
#include <retroshare/rsmsgs.h>
|
#include <retroshare/rsmsgs.h>
|
||||||
|
|
||||||
#include "gui/notifyqt.h"
|
|
||||||
#include "util/misc.h"
|
#include "util/misc.h"
|
||||||
|
#include "util/qtthreadsutils.h"
|
||||||
#include "gui/common/AvatarDefs.h"
|
#include "gui/common/AvatarDefs.h"
|
||||||
#include "gui/common/AvatarDialog.h"
|
#include "gui/common/AvatarDialog.h"
|
||||||
|
|
||||||
|
|
@ -39,21 +39,44 @@
|
||||||
|
|
||||||
AvatarWidget::AvatarWidget(QWidget *parent) : QLabel(parent), ui(new Ui::AvatarWidget)
|
AvatarWidget::AvatarWidget(QWidget *parent) : QLabel(parent), ui(new Ui::AvatarWidget)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
mFlag.isOwnId = false;
|
mFlag.isOwnId = false;
|
||||||
defaultAvatar = ":/images/no_avatar_background.png";
|
defaultAvatar = ":/images/no_avatar_background.png";
|
||||||
mPeerState = RS_STATUS_OFFLINE ;
|
mPeerState = RsStatusValue::RS_STATUS_OFFLINE ;
|
||||||
|
|
||||||
setFrameType(NO_FRAME);
|
setFrameType(NO_FRAME);
|
||||||
|
|
||||||
|
mEventHandlerId = 0;
|
||||||
|
|
||||||
|
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event)
|
||||||
|
{
|
||||||
|
RsQThreadUtils::postToObject([=](){
|
||||||
|
|
||||||
|
const RsFriendListEvent *e = dynamic_cast<const RsFriendListEvent*>(event.get());
|
||||||
|
if(!e)
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch(e->mEventCode)
|
||||||
|
{
|
||||||
|
case RsFriendListEventCode::OWN_AVATAR_CHANGED:
|
||||||
|
case RsFriendListEventCode::NODE_AVATAR_CHANGED: updateAvatar(QString::fromStdString(e->mSslId.toStdString()));
|
||||||
|
break;
|
||||||
|
case RsFriendListEventCode::OWN_STATUS_CHANGED:
|
||||||
|
case RsFriendListEventCode::NODE_STATUS_CHANGED: updateStatus(QString::fromStdString(e->mSslId.toStdString()),e->mStatus);
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}, this );
|
||||||
|
}, mEventHandlerId, RsEventType::FRIEND_LIST );
|
||||||
|
|
||||||
/* connect signals */
|
|
||||||
connect(NotifyQt::getInstance(), SIGNAL(peerHasNewAvatar(const QString&)), this, SLOT(updateAvatar(const QString&)));
|
|
||||||
connect(NotifyQt::getInstance(), SIGNAL(ownAvatarChanged()), this, SLOT(updateOwnAvatar()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AvatarWidget::~AvatarWidget()
|
AvatarWidget::~AvatarWidget()
|
||||||
{
|
{
|
||||||
|
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -68,16 +91,18 @@ QString AvatarWidget::frameState()
|
||||||
case STATUS_FRAME:
|
case STATUS_FRAME:
|
||||||
switch (mPeerState)
|
switch (mPeerState)
|
||||||
{
|
{
|
||||||
case RS_STATUS_OFFLINE:
|
case RsStatusValue::RS_STATUS_OFFLINE:
|
||||||
return "OFFLINE";
|
return "OFFLINE";
|
||||||
case RS_STATUS_INACTIVE:
|
case RsStatusValue::RS_STATUS_INACTIVE:
|
||||||
return "INACTIVE";
|
return "INACTIVE";
|
||||||
case RS_STATUS_ONLINE:
|
case RsStatusValue::RS_STATUS_ONLINE:
|
||||||
return "ONLINE";
|
return "ONLINE";
|
||||||
case RS_STATUS_AWAY:
|
case RsStatusValue::RS_STATUS_AWAY:
|
||||||
return "AWAY";
|
return "AWAY";
|
||||||
case RS_STATUS_BUSY:
|
case RsStatusValue::RS_STATUS_BUSY:
|
||||||
return "BUSY";
|
return "BUSY";
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "NOTHING";
|
return "NOTHING";
|
||||||
|
|
@ -107,18 +132,6 @@ void AvatarWidget::setFrameType(FrameType type)
|
||||||
{
|
{
|
||||||
mFrameType = type;
|
mFrameType = type;
|
||||||
|
|
||||||
switch (mFrameType) {
|
|
||||||
case NO_FRAME:
|
|
||||||
disconnect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(QString,int)), this, SLOT(updateStatus(const QString&, int)));
|
|
||||||
break;
|
|
||||||
case NORMAL_FRAME:
|
|
||||||
disconnect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(QString,int)), this, SLOT(updateStatus(const QString&, int)));
|
|
||||||
break;
|
|
||||||
case STATUS_FRAME:
|
|
||||||
connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(QString,int)), this, SLOT(updateStatus(const QString&, int)));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//refreshAvatarImage();
|
//refreshAvatarImage();
|
||||||
refreshStatus();
|
refreshStatus();
|
||||||
RsApplication::refreshStyleSheet(this, false);
|
RsApplication::refreshStyleSheet(this, false);
|
||||||
|
|
@ -179,7 +192,7 @@ void AvatarWidget::refreshStatus()
|
||||||
}
|
}
|
||||||
case STATUS_FRAME:
|
case STATUS_FRAME:
|
||||||
{
|
{
|
||||||
uint32_t status = 0;
|
RsStatusValue status = RsStatusValue::RS_STATUS_OFFLINE;
|
||||||
|
|
||||||
if (mId.isNotSet())
|
if (mId.isNotSet())
|
||||||
return;
|
return;
|
||||||
|
|
@ -193,7 +206,7 @@ void AvatarWidget::refreshStatus()
|
||||||
status = statusInfo.status ;
|
status = statusInfo.status ;
|
||||||
}
|
}
|
||||||
else if(mId.isDistantChatId())
|
else if(mId.isDistantChatId())
|
||||||
status = RS_STATUS_ONLINE ;
|
status = RsStatusValue::RS_STATUS_ONLINE ;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cerr << "Unhandled chat id type in AvatarWidget::refreshStatus()" << std::endl;
|
std::cerr << "Unhandled chat id type in AvatarWidget::refreshStatus()" << std::endl;
|
||||||
|
|
@ -217,10 +230,10 @@ void AvatarWidget::refreshStatus()
|
||||||
{
|
{
|
||||||
switch (dcpinfo.status)
|
switch (dcpinfo.status)
|
||||||
{
|
{
|
||||||
case RS_DISTANT_CHAT_STATUS_CAN_TALK : status = RS_STATUS_ONLINE ; break;
|
case RS_DISTANT_CHAT_STATUS_CAN_TALK : status = RsStatusValue::RS_STATUS_ONLINE ; break;
|
||||||
case RS_DISTANT_CHAT_STATUS_UNKNOWN : // Fall-through
|
case RS_DISTANT_CHAT_STATUS_UNKNOWN : // Fall-through
|
||||||
case RS_DISTANT_CHAT_STATUS_TUNNEL_DN : // Fall-through
|
case RS_DISTANT_CHAT_STATUS_TUNNEL_DN : // Fall-through
|
||||||
case RS_DISTANT_CHAT_STATUS_REMOTELY_CLOSED : status = RS_STATUS_OFFLINE;
|
case RS_DISTANT_CHAT_STATUS_REMOTELY_CLOSED : status = RsStatusValue::RS_STATUS_OFFLINE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -238,20 +251,20 @@ void AvatarWidget::refreshStatus()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AvatarWidget::updateStatus(const QString& peerId, int status)
|
void AvatarWidget::updateStatus(const QString& peerId, RsStatusValue status)
|
||||||
{
|
{
|
||||||
if (mId.isPeerId() && mId.toPeerId() == RsPeerId(peerId.toStdString()))
|
if (mId.isPeerId() && mId.toPeerId() == RsPeerId(peerId.toStdString()))
|
||||||
updateStatus(status) ;
|
updateStatus(status) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AvatarWidget::updateStatus(int status)
|
void AvatarWidget::updateStatus(RsStatusValue status)
|
||||||
{
|
{
|
||||||
if (mFrameType != STATUS_FRAME)
|
if (mFrameType != STATUS_FRAME)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mPeerState = status;
|
mPeerState = status;
|
||||||
|
|
||||||
setEnabled(((uint32_t) status == RS_STATUS_OFFLINE) ? false : true);
|
setEnabled((status == RsStatusValue::RS_STATUS_OFFLINE) ? false : true);
|
||||||
RsApplication::refreshStyleSheet(this, false);
|
RsApplication::refreshStyleSheet(this, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,9 @@
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <retroshare/rstypes.h>
|
#include <retroshare/rstypes.h>
|
||||||
|
#include <retroshare/rsevents.h>
|
||||||
#include <retroshare/rsmsgs.h>
|
#include <retroshare/rsmsgs.h>
|
||||||
|
#include <retroshare/rsstatus.h>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class AvatarWidget;
|
class AvatarWidget;
|
||||||
|
|
@ -57,14 +59,14 @@ protected:
|
||||||
void mouseReleaseEvent(QMouseEvent *event);
|
void mouseReleaseEvent(QMouseEvent *event);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updateStatus(const QString& peerId, int status);
|
void updateStatus(const QString& peerId, RsStatusValue status);
|
||||||
void updateAvatar(const QString& peerId);
|
void updateAvatar(const QString& peerId);
|
||||||
void updateOwnAvatar();
|
void updateOwnAvatar();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void refreshAvatarImage() ;
|
void refreshAvatarImage() ;
|
||||||
void refreshStatus();
|
void refreshStatus();
|
||||||
void updateStatus(int status);
|
void updateStatus(RsStatusValue status);
|
||||||
|
|
||||||
QString defaultAvatar;
|
QString defaultAvatar;
|
||||||
Ui::AvatarWidget *ui;
|
Ui::AvatarWidget *ui;
|
||||||
|
|
@ -77,7 +79,9 @@ private:
|
||||||
// bool isGpg : 1;
|
// bool isGpg : 1;
|
||||||
} mFlag;
|
} mFlag;
|
||||||
FrameType mFrameType;
|
FrameType mFrameType;
|
||||||
uint32_t mPeerState;
|
RsStatusValue mPeerState;
|
||||||
|
|
||||||
|
RsEventsHandlerId_t mEventHandlerId;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // AVATARWIDGET_H
|
#endif // AVATARWIDGET_H
|
||||||
|
|
|
||||||
|
|
@ -458,7 +458,7 @@ QVariant RsFriendListModel::statusRole(const EntryIndex& fmpe,int /*column*/) co
|
||||||
StatusInfo status;
|
StatusInfo status;
|
||||||
rsStatus->getStatus(node->node_info.id, status);
|
rsStatus->getStatus(node->node_info.id, status);
|
||||||
|
|
||||||
return QVariant(status.status);
|
return QVariant((int)status.status);
|
||||||
}
|
}
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
@ -603,7 +603,7 @@ QVariant RsFriendListModel::onlineRole(const EntryIndex& e, int /*col*/) const
|
||||||
|
|
||||||
for(uint32_t i=0;i<prof.child_node_indices.size();++i)
|
for(uint32_t i=0;i<prof.child_node_indices.size();++i)
|
||||||
if(mLocations[prof.child_node_indices[i]].node_info.state & RS_PEER_STATE_CONNECTED)
|
if(mLocations[prof.child_node_indices[i]].node_info.state & RS_PEER_STATE_CONNECTED)
|
||||||
return QVariant(RS_STATUS_ONLINE);
|
return QVariant((int)RsStatusValue::RS_STATUS_ONLINE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -616,7 +616,7 @@ QVariant RsFriendListModel::onlineRole(const EntryIndex& e, int /*col*/) const
|
||||||
{
|
{
|
||||||
for(uint32_t i=0;i<prof->child_node_indices.size();++i)
|
for(uint32_t i=0;i<prof->child_node_indices.size();++i)
|
||||||
if(mLocations[prof->child_node_indices[i]].node_info.state & RS_PEER_STATE_CONNECTED)
|
if(mLocations[prof->child_node_indices[i]].node_info.state & RS_PEER_STATE_CONNECTED)
|
||||||
return QVariant(RS_STATUS_ONLINE);
|
return QVariant((int)RsStatusValue::RS_STATUS_ONLINE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -626,12 +626,12 @@ QVariant RsFriendListModel::onlineRole(const EntryIndex& e, int /*col*/) const
|
||||||
const HierarchicalNodeInformation *node = getNodeInfo(e);
|
const HierarchicalNodeInformation *node = getNodeInfo(e);
|
||||||
|
|
||||||
if(node && bool(node->node_info.state & RS_PEER_STATE_CONNECTED))
|
if(node && bool(node->node_info.state & RS_PEER_STATE_CONNECTED))
|
||||||
return QVariant(RS_STATUS_ONLINE);
|
return QVariant((int)RsStatusValue::RS_STATUS_ONLINE);
|
||||||
else
|
else
|
||||||
return QVariant(RS_STATUS_OFFLINE);
|
return QVariant((int)RsStatusValue::RS_STATUS_OFFLINE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return QVariant(RS_STATUS_OFFLINE);
|
return QVariant((int)RsStatusValue::RS_STATUS_OFFLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant RsFriendListModel::fontRole(const EntryIndex& e, int col) const
|
QVariant RsFriendListModel::fontRole(const EntryIndex& e, int col) const
|
||||||
|
|
@ -640,14 +640,14 @@ QVariant RsFriendListModel::fontRole(const EntryIndex& e, int col) const
|
||||||
std::cerr << " font role " << e.type << ", (" << (int)e.group_index << ","<< (int)e.profile_index << ","<< (int)e.node_index << ") col="<< col<<": " << std::endl;
|
std::cerr << " font role " << e.type << ", (" << (int)e.group_index << ","<< (int)e.profile_index << ","<< (int)e.node_index << ") col="<< col<<": " << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int status = onlineRole(e,col).toInt();
|
auto status = RsStatusValue(onlineRole(e,col).toInt());
|
||||||
|
|
||||||
switch (status)
|
switch (status)
|
||||||
{
|
{
|
||||||
case RS_STATUS_AWAY:
|
case RsStatusValue::RS_STATUS_AWAY:
|
||||||
case RS_STATUS_BUSY:
|
case RsStatusValue::RS_STATUS_BUSY:
|
||||||
case RS_STATUS_ONLINE:
|
case RsStatusValue::RS_STATUS_ONLINE:
|
||||||
case RS_STATUS_INACTIVE:
|
case RsStatusValue::RS_STATUS_INACTIVE:
|
||||||
{
|
{
|
||||||
QFont font ;
|
QFont font ;
|
||||||
QTreeView* myParent = dynamic_cast<QTreeView*>(QAbstractItemModel::parent());
|
QTreeView* myParent = dynamic_cast<QTreeView*>(QAbstractItemModel::parent());
|
||||||
|
|
@ -781,7 +781,7 @@ QVariant RsFriendListModel::displayRole(const EntryIndex& e, int col) const
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return QVariant(QString::fromUtf8(node->node_info.location.c_str())+"\n"
|
return QVariant(QString::fromUtf8(node->node_info.location.c_str())+"\n"
|
||||||
+ "(" + StatusDefs::name(statusRole(e,col).toInt()) + ")");
|
+ "(" + StatusDefs::name(RsStatusValue(statusRole(e,col).toInt())) + ")");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return QVariant(QString::fromUtf8(node->node_info.location.c_str()));
|
return QVariant(QString::fromUtf8(node->node_info.location.c_str()));
|
||||||
|
|
@ -900,10 +900,10 @@ bool RsFriendListModel::getPeerOnlineStatus(const EntryIndex& e) const
|
||||||
return (noded && (noded->node_info.state & RS_PEER_STATE_CONNECTED));
|
return (noded && (noded->node_info.state & RS_PEER_STATE_CONNECTED));
|
||||||
}
|
}
|
||||||
|
|
||||||
const RsFriendListModel::HierarchicalNodeInformation *RsFriendListModel::getBestNodeInformation(const HierarchicalProfileInformation *profileInfo, uint32_t *status) const
|
const RsFriendListModel::HierarchicalNodeInformation *RsFriendListModel::getBestNodeInformation(const HierarchicalProfileInformation *profileInfo, RsStatusValue *status) const
|
||||||
{
|
{
|
||||||
if (status) {
|
if (status) {
|
||||||
*status = RS_STATUS_OFFLINE;
|
*status = RsStatusValue::RS_STATUS_OFFLINE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!profileInfo) {
|
if (!profileInfo) {
|
||||||
|
|
@ -921,28 +921,28 @@ const RsFriendListModel::HierarchicalNodeInformation *RsFriendListModel::getBest
|
||||||
|
|
||||||
int statusIndex = 0;
|
int statusIndex = 0;
|
||||||
switch (statusInfo.status) {
|
switch (statusInfo.status) {
|
||||||
case RS_STATUS_OFFLINE:
|
case RsStatusValue::RS_STATUS_OFFLINE:
|
||||||
statusIndex = 1;
|
statusIndex = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RS_STATUS_INACTIVE:
|
case RsStatusValue::RS_STATUS_INACTIVE:
|
||||||
statusIndex = 2;
|
statusIndex = 2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RS_STATUS_AWAY:
|
case RsStatusValue::RS_STATUS_AWAY:
|
||||||
statusIndex = 3;
|
statusIndex = 3;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RS_STATUS_BUSY:
|
case RsStatusValue::RS_STATUS_BUSY:
|
||||||
statusIndex = 4;
|
statusIndex = 4;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RS_STATUS_ONLINE:
|
case RsStatusValue::RS_STATUS_ONLINE:
|
||||||
statusIndex = 5;
|
statusIndex = 5;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
std::cerr << "FriendListModel: Unknown status " << statusInfo.status << std::endl;
|
std::cerr << "FriendListModel: Unknown status " << (int)statusInfo.status << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bestStatusIndex == 0 || statusIndex > bestStatusIndex) {
|
if (bestStatusIndex == 0 || statusIndex > bestStatusIndex) {
|
||||||
|
|
@ -999,7 +999,7 @@ QVariant RsFriendListModel::decorationRole(const EntryIndex& entry,int col) cons
|
||||||
QPixmap sslAvatar;
|
QPixmap sslAvatar;
|
||||||
bool foundAvatar = false;
|
bool foundAvatar = false;
|
||||||
const HierarchicalProfileInformation *hn = getProfileInfo(entry);
|
const HierarchicalProfileInformation *hn = getProfileInfo(entry);
|
||||||
uint32_t status = RS_STATUS_OFFLINE;
|
RsStatusValue status = RsStatusValue::RS_STATUS_OFFLINE;
|
||||||
const HierarchicalNodeInformation *bestNodeInformation = NULL;
|
const HierarchicalNodeInformation *bestNodeInformation = NULL;
|
||||||
|
|
||||||
if (mDisplayStatusIcon) {
|
if (mDisplayStatusIcon) {
|
||||||
|
|
@ -1049,7 +1049,7 @@ QVariant RsFriendListModel::decorationRole(const EntryIndex& entry,int col) cons
|
||||||
QPixmap sslAvatar;
|
QPixmap sslAvatar;
|
||||||
AvatarDefs::getAvatarFromSslId(RsPeerId(hn->node_info.id.toStdString()), sslAvatar);
|
AvatarDefs::getAvatarFromSslId(RsPeerId(hn->node_info.id.toStdString()), sslAvatar);
|
||||||
if (mDisplayStatusIcon) {
|
if (mDisplayStatusIcon) {
|
||||||
QPixmap sslOverlayIcon = FilesDefs::getPixmapFromQtResourcePath(StatusDefs::imageStatus(statusRole(entry, col).toInt()));
|
QPixmap sslOverlayIcon = FilesDefs::getPixmapFromQtResourcePath(StatusDefs::imageStatus(RsStatusValue(statusRole(entry, col).toInt())));
|
||||||
return QVariant(QIcon(createAvatar(sslAvatar, sslOverlayIcon)));
|
return QVariant(QIcon(createAvatar(sslAvatar, sslOverlayIcon)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,7 @@ public:
|
||||||
|
|
||||||
/* Color definitions (for standard see default.qss) */
|
/* Color definitions (for standard see default.qss) */
|
||||||
QColor mTextColorGroup;
|
QColor mTextColorGroup;
|
||||||
QColor mTextColorStatus[RS_STATUS_COUNT];
|
QColor mTextColorStatus[(int)RsStatusValue::RS_STATUS_COUNT];
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const HierarchicalGroupInformation *getGroupInfo (const EntryIndex&) const;
|
const HierarchicalGroupInformation *getGroupInfo (const EntryIndex&) const;
|
||||||
|
|
@ -223,7 +223,7 @@ private:
|
||||||
|
|
||||||
uint32_t updateFilterStatus(ForumModelIndex i,int column,const QStringList& strings);
|
uint32_t updateFilterStatus(ForumModelIndex i,int column,const QStringList& strings);
|
||||||
|
|
||||||
const HierarchicalNodeInformation *getBestNodeInformation(const HierarchicalProfileInformation *profileInfo, uint32_t *status = NULL) const;
|
const HierarchicalNodeInformation *getBestNodeInformation(const HierarchicalProfileInformation *profileInfo, RsStatusValue *status = NULL) const;
|
||||||
|
|
||||||
QStringList mFilterStrings;
|
QStringList mFilterStrings;
|
||||||
FilterType mFilterType;
|
FilterType mFilterType;
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@
|
||||||
#include "ui_FriendSelectionWidget.h"
|
#include "ui_FriendSelectionWidget.h"
|
||||||
#include "gui/gxs/GxsIdDetails.h"
|
#include "gui/gxs/GxsIdDetails.h"
|
||||||
#include <retroshare-gui/RsAutoUpdatePage.h>
|
#include <retroshare-gui/RsAutoUpdatePage.h>
|
||||||
#include "gui/notifyqt.h"
|
|
||||||
#include "gui/common/RSTreeWidgetItem.h"
|
#include "gui/common/RSTreeWidgetItem.h"
|
||||||
#include "gui/common/StatusDefs.h"
|
#include "gui/common/StatusDefs.h"
|
||||||
#include "util/qtthreadsutils.h"
|
#include "util/qtthreadsutils.h"
|
||||||
|
|
@ -101,9 +100,6 @@ FriendSelectionWidget::FriendSelectionWidget(QWidget *parent)
|
||||||
connect(ui->friendList, SIGNAL(itemSelectionChanged()), this, SIGNAL(itemSelectionChanged()));
|
connect(ui->friendList, SIGNAL(itemSelectionChanged()), this, SIGNAL(itemSelectionChanged()));
|
||||||
connect(ui->filterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(filterItems(QString)));
|
connect(ui->filterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(filterItems(QString)));
|
||||||
|
|
||||||
connect(NotifyQt::getInstance(), SIGNAL(groupsChanged(int)), this, SLOT(groupsChanged(int)));
|
|
||||||
connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(const QString&,int)), this, SLOT(peerStatusChanged(const QString&,int)));
|
|
||||||
|
|
||||||
mCompareRole = new RSTreeWidgetItemCompareRole;
|
mCompareRole = new RSTreeWidgetItemCompareRole;
|
||||||
mActionSortByState = new QAction(tr("Sort by state"), this);
|
mActionSortByState = new QAction(tr("Sort by state"), this);
|
||||||
mActionSortByState->setCheckable(true);
|
mActionSortByState->setCheckable(true);
|
||||||
|
|
@ -134,7 +130,7 @@ FriendSelectionWidget::FriendSelectionWidget(QWidget *parent)
|
||||||
RsQThreadUtils::postToObject( [this,event]() { handleEvent_main_thread(event); }) ;}, mEventHandlerId_identities, RsEventType::GXS_IDENTITY );
|
RsQThreadUtils::postToObject( [this,event]() { handleEvent_main_thread(event); }) ;}, mEventHandlerId_identities, RsEventType::GXS_IDENTITY );
|
||||||
mEventHandlerId_peers = 0;
|
mEventHandlerId_peers = 0;
|
||||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) {
|
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) {
|
||||||
RsQThreadUtils::postToObject( [this,event]() { handleEvent_main_thread(event); }) ;}, mEventHandlerId_peers, RsEventType::PEER_CONNECTION );
|
RsQThreadUtils::postToObject( [this,event]() { handleEvent_main_thread(event); }) ;}, mEventHandlerId_peers, RsEventType::FRIEND_LIST );
|
||||||
|
|
||||||
mFontSizeHandler.registerFontSize(ui->friendList);
|
mFontSizeHandler.registerFontSize(ui->friendList);
|
||||||
}
|
}
|
||||||
|
|
@ -149,17 +145,31 @@ void FriendSelectionWidget::handleEvent_main_thread(std::shared_ptr<const RsEven
|
||||||
update(); // Qt flush
|
update(); // Qt flush
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const RsConnectionEvent *fp = dynamic_cast<const RsConnectionEvent*>(event.get());
|
const RsFriendListEvent *fp = dynamic_cast<const RsFriendListEvent*>(event.get());
|
||||||
|
|
||||||
if(fp)
|
if(fp)
|
||||||
switch(fp->mConnectionInfoCode)
|
switch(fp->mEventCode)
|
||||||
{
|
{
|
||||||
case RsConnectionEventCode::PEER_REMOVED:
|
case RsFriendListEventCode::NODE_REMOVED:
|
||||||
case RsConnectionEventCode::PEER_ADDED:
|
case RsFriendListEventCode::NODE_ADDED:
|
||||||
updateDisplay(true);
|
updateDisplay(true);
|
||||||
update(); // Qt flush
|
update(); // Qt flush
|
||||||
break;
|
break;
|
||||||
default: break ;
|
case RsFriendListEventCode::GROUP_ADDED:
|
||||||
|
case RsFriendListEventCode::GROUP_REMOVED:
|
||||||
|
case RsFriendListEventCode::GROUP_CHANGED:
|
||||||
|
groupsChanged();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RsFriendListEventCode::NODE_STATUS_CHANGED:
|
||||||
|
{
|
||||||
|
StatusInfo i;
|
||||||
|
rsStatus->getStatus(fp->mSslId,i);
|
||||||
|
|
||||||
|
peerStatusChanged(fp->mSslId,i.status);
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -241,7 +251,7 @@ static void initSslItem(QTreeWidgetItem *item, const RsPeerDetails &detail, cons
|
||||||
QString name = PeerDefs::nameWithLocation(detail);
|
QString name = PeerDefs::nameWithLocation(detail);
|
||||||
item->setText(COLUMN_NAME, name);
|
item->setText(COLUMN_NAME, name);
|
||||||
|
|
||||||
int state = RS_STATUS_OFFLINE;
|
RsStatusValue state = RsStatusValue::RS_STATUS_OFFLINE;
|
||||||
if (detail.state & RS_PEER_STATE_CONNECTED) {
|
if (detail.state & RS_PEER_STATE_CONNECTED) {
|
||||||
std::list<StatusInfo>::const_iterator it;
|
std::list<StatusInfo>::const_iterator it;
|
||||||
for (it = statusInfo.begin(); it != statusInfo.end() ; ++it) {
|
for (it = statusInfo.begin(); it != statusInfo.end() ; ++it) {
|
||||||
|
|
@ -252,7 +262,7 @@ static void initSslItem(QTreeWidgetItem *item, const RsPeerDetails &detail, cons
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state != (int) RS_STATUS_OFFLINE) {
|
if (state != RsStatusValue::RS_STATUS_OFFLINE) {
|
||||||
item->setData(COLUMN_NAME, Qt::ForegroundRole, textColorOnline);
|
item->setData(COLUMN_NAME, Qt::ForegroundRole, textColorOnline);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -262,7 +272,7 @@ static void initSslItem(QTreeWidgetItem *item, const RsPeerDetails &detail, cons
|
||||||
item->setData(COLUMN_NAME, ROLE_SORT_GROUP, 1);
|
item->setData(COLUMN_NAME, ROLE_SORT_GROUP, 1);
|
||||||
item->setData(COLUMN_NAME, ROLE_SORT_STANDARD_GROUP, 0);
|
item->setData(COLUMN_NAME, ROLE_SORT_STANDARD_GROUP, 0);
|
||||||
item->setData(COLUMN_NAME, ROLE_SORT_NAME, name);
|
item->setData(COLUMN_NAME, ROLE_SORT_NAME, name);
|
||||||
item->setData(COLUMN_NAME, ROLE_SORT_STATE, state);
|
item->setData(COLUMN_NAME, ROLE_SORT_STATE, (int)state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FriendSelectionWidget::fillList()
|
void FriendSelectionWidget::fillList()
|
||||||
|
|
@ -501,17 +511,17 @@ void FriendSelectionWidget::secured_fillList()
|
||||||
sslIds.clear();
|
sslIds.clear();
|
||||||
rsPeers->getAssociatedSSLIds(*gpgIt, sslIds);
|
rsPeers->getAssociatedSSLIds(*gpgIt, sslIds);
|
||||||
|
|
||||||
int state = RS_STATUS_OFFLINE;
|
RsStatusValue state = RsStatusValue::RS_STATUS_OFFLINE;
|
||||||
for (statusIt = statusInfo.begin(); statusIt != statusInfo.end() ; ++statusIt) {
|
for (statusIt = statusInfo.begin(); statusIt != statusInfo.end() ; ++statusIt) {
|
||||||
if (std::find(sslIds.begin(), sslIds.end(), statusIt->id) != sslIds.end()) {
|
if (std::find(sslIds.begin(), sslIds.end(), statusIt->id) != sslIds.end()) {
|
||||||
if (statusIt->status != RS_STATUS_OFFLINE) {
|
if (statusIt->status != RsStatusValue::RS_STATUS_OFFLINE) {
|
||||||
state = RS_STATUS_ONLINE;
|
state = RsStatusValue::RS_STATUS_ONLINE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state != (int) RS_STATUS_OFFLINE) {
|
if (state != RsStatusValue::RS_STATUS_OFFLINE) {
|
||||||
gpgItem->setData(COLUMN_NAME, Qt::ForegroundRole, textColorOnline());
|
gpgItem->setData(COLUMN_NAME, Qt::ForegroundRole, textColorOnline());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -522,7 +532,7 @@ void FriendSelectionWidget::secured_fillList()
|
||||||
gpgItem->setData(COLUMN_NAME, ROLE_SORT_GROUP, 1);
|
gpgItem->setData(COLUMN_NAME, ROLE_SORT_GROUP, 1);
|
||||||
gpgItem->setData(COLUMN_NAME, ROLE_SORT_STANDARD_GROUP, 0);
|
gpgItem->setData(COLUMN_NAME, ROLE_SORT_STANDARD_GROUP, 0);
|
||||||
gpgItem->setData(COLUMN_NAME, ROLE_SORT_NAME, name);
|
gpgItem->setData(COLUMN_NAME, ROLE_SORT_NAME, name);
|
||||||
gpgItem->setData(COLUMN_NAME, ROLE_SORT_STATE, state);
|
gpgItem->setData(COLUMN_NAME, ROLE_SORT_STATE, (int)state);
|
||||||
|
|
||||||
if (mListModus == MODUS_CHECK) {
|
if (mListModus == MODUS_CHECK) {
|
||||||
gpgItem->setCheckState(0, Qt::Unchecked);
|
gpgItem->setCheckState(0, Qt::Unchecked);
|
||||||
|
|
@ -770,23 +780,20 @@ template<> inline void FriendSelectionWidget::setSelectedIds<RsGxsId,FriendSelec
|
||||||
loadIdentities();
|
loadIdentities();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FriendSelectionWidget::groupsChanged(int /*type*/)
|
void FriendSelectionWidget::groupsChanged()
|
||||||
{
|
{
|
||||||
if (mShowTypes & SHOW_GROUP) {
|
if (mShowTypes & SHOW_GROUP) {
|
||||||
fillList();
|
fillList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FriendSelectionWidget::peerStatusChanged(const QString& peerId, int status)
|
void FriendSelectionWidget::peerStatusChanged(const RsPeerId& peerid, RsStatusValue status)
|
||||||
{
|
{
|
||||||
if(!isVisible())
|
if(!isVisible())
|
||||||
return ;
|
return ;
|
||||||
if(RsAutoUpdatePage::eventsLocked())
|
|
||||||
return ;
|
|
||||||
|
|
||||||
RsPeerId peerid(peerId.toStdString()) ;
|
|
||||||
QString gpgId;
|
QString gpgId;
|
||||||
int gpgStatus = RS_STATUS_OFFLINE;
|
RsStatusValue gpgStatus = RsStatusValue::RS_STATUS_OFFLINE;
|
||||||
|
|
||||||
if (mShowTypes & (SHOW_GPG | SHOW_NON_FRIEND_GPG)) {
|
if (mShowTypes & (SHOW_GPG | SHOW_NON_FRIEND_GPG)) {
|
||||||
/* need gpg id and online state */
|
/* need gpg id and online state */
|
||||||
|
|
@ -795,7 +802,7 @@ void FriendSelectionWidget::peerStatusChanged(const QString& peerId, int status)
|
||||||
{
|
{
|
||||||
gpgId = QString::fromStdString(detail.gpg_id.toStdString());
|
gpgId = QString::fromStdString(detail.gpg_id.toStdString());
|
||||||
|
|
||||||
if (status == (int) RS_STATUS_OFFLINE) {
|
if (status == RsStatusValue::RS_STATUS_OFFLINE) {
|
||||||
/* try other nodes */
|
/* try other nodes */
|
||||||
std::list<RsPeerId> sslIds;
|
std::list<RsPeerId> sslIds;
|
||||||
rsPeers->getAssociatedSSLIds(detail.gpg_id, sslIds);
|
rsPeers->getAssociatedSSLIds(detail.gpg_id, sslIds);
|
||||||
|
|
@ -806,15 +813,15 @@ void FriendSelectionWidget::peerStatusChanged(const QString& peerId, int status)
|
||||||
|
|
||||||
for (statusIt = statusInfo.begin(); statusIt != statusInfo.end() ; ++statusIt) {
|
for (statusIt = statusInfo.begin(); statusIt != statusInfo.end() ; ++statusIt) {
|
||||||
if (std::find(sslIds.begin(), sslIds.end(), statusIt->id) != sslIds.end()) {
|
if (std::find(sslIds.begin(), sslIds.end(), statusIt->id) != sslIds.end()) {
|
||||||
if (statusIt->status != RS_STATUS_OFFLINE) {
|
if (statusIt->status != RsStatusValue::RS_STATUS_OFFLINE) {
|
||||||
gpgStatus = RS_STATUS_ONLINE;
|
gpgStatus = RsStatusValue::RS_STATUS_ONLINE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* one node is online */
|
/* one node is online */
|
||||||
gpgStatus = RS_STATUS_ONLINE;
|
gpgStatus = RsStatusValue::RS_STATUS_ONLINE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -834,7 +841,7 @@ void FriendSelectionWidget::peerStatusChanged(const QString& peerId, int status)
|
||||||
case IDTYPE_GPG:
|
case IDTYPE_GPG:
|
||||||
{
|
{
|
||||||
if (item->data(COLUMN_DATA, ROLE_ID).toString() == gpgId) {
|
if (item->data(COLUMN_DATA, ROLE_ID).toString() == gpgId) {
|
||||||
if (status != (int) RS_STATUS_OFFLINE) {
|
if (status != RsStatusValue::RS_STATUS_OFFLINE) {
|
||||||
item->setData(COLUMN_NAME, Qt::ForegroundRole, textColorOnline());
|
item->setData(COLUMN_NAME, Qt::ForegroundRole, textColorOnline());
|
||||||
} else {
|
} else {
|
||||||
item->setData(COLUMN_NAME, Qt::ForegroundRole, QVariant());
|
item->setData(COLUMN_NAME, Qt::ForegroundRole, QVariant());
|
||||||
|
|
@ -842,7 +849,7 @@ void FriendSelectionWidget::peerStatusChanged(const QString& peerId, int status)
|
||||||
|
|
||||||
item->setIcon(COLUMN_NAME, FilesDefs::getIconFromQtResourcePath(StatusDefs::imageUser(gpgStatus)));
|
item->setIcon(COLUMN_NAME, FilesDefs::getIconFromQtResourcePath(StatusDefs::imageUser(gpgStatus)));
|
||||||
|
|
||||||
item->setData(COLUMN_NAME, ROLE_SORT_STATE, gpgStatus);
|
item->setData(COLUMN_NAME, ROLE_SORT_STATE, (int)gpgStatus);
|
||||||
|
|
||||||
bFoundGPG = true;
|
bFoundGPG = true;
|
||||||
}
|
}
|
||||||
|
|
@ -850,8 +857,9 @@ void FriendSelectionWidget::peerStatusChanged(const QString& peerId, int status)
|
||||||
break;
|
break;
|
||||||
case IDTYPE_SSL:
|
case IDTYPE_SSL:
|
||||||
{
|
{
|
||||||
if (item->data(COLUMN_DATA, ROLE_ID).toString() == peerId) {
|
if (RsPeerId(item->data(COLUMN_DATA, ROLE_ID).toString().toStdString()) == peerid)
|
||||||
if (status != (int) RS_STATUS_OFFLINE) {
|
{
|
||||||
|
if (status != RsStatusValue::RS_STATUS_OFFLINE) {
|
||||||
item->setData(COLUMN_NAME, Qt::ForegroundRole, textColorOnline());
|
item->setData(COLUMN_NAME, Qt::ForegroundRole, textColorOnline());
|
||||||
} else {
|
} else {
|
||||||
item->setData(COLUMN_NAME, Qt::ForegroundRole, QVariant());
|
item->setData(COLUMN_NAME, Qt::ForegroundRole, QVariant());
|
||||||
|
|
@ -859,7 +867,7 @@ void FriendSelectionWidget::peerStatusChanged(const QString& peerId, int status)
|
||||||
|
|
||||||
item->setIcon(COLUMN_NAME, FilesDefs::getIconFromQtResourcePath(StatusDefs::imageUser(status)));
|
item->setIcon(COLUMN_NAME, FilesDefs::getIconFromQtResourcePath(StatusDefs::imageUser(status)));
|
||||||
|
|
||||||
item->setData(COLUMN_NAME, ROLE_SORT_STATE, status);
|
item->setData(COLUMN_NAME, ROLE_SORT_STATE, (int)status);
|
||||||
|
|
||||||
bFoundSSL = true;
|
bFoundSSL = true;
|
||||||
}
|
}
|
||||||
|
|
@ -1262,7 +1270,7 @@ bool FriendSelectionWidget::isSortByState()
|
||||||
|
|
||||||
void FriendSelectionWidget::filterConnected(bool filter)
|
void FriendSelectionWidget::filterConnected(bool filter)
|
||||||
{
|
{
|
||||||
ui->friendList->filterMinValItems(COLUMN_NAME, filter ? RS_STATUS_AWAY : RS_STATUS_OFFLINE, ROLE_SORT_STATE);
|
ui->friendList->filterMinValItems(COLUMN_NAME, filter ? double(RsStatusValue::RS_STATUS_AWAY) : double(RsStatusValue::RS_STATUS_OFFLINE), ROLE_SORT_STATE);
|
||||||
|
|
||||||
mActionFilterConnected->setChecked(filter);
|
mActionFilterConnected->setChecked(filter);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
#include "retroshare/rsevents.h"
|
#include "retroshare/rsevents.h"
|
||||||
|
#include "retroshare/rsstatus.h"
|
||||||
#include <gui/gxs/RsGxsUpdateBroadcastPage.h>
|
#include <gui/gxs/RsGxsUpdateBroadcastPage.h>
|
||||||
#include "util/FontSizeHandler.h"
|
#include "util/FontSizeHandler.h"
|
||||||
|
|
||||||
|
|
@ -137,8 +138,7 @@ public slots:
|
||||||
void filterConnected(bool filter);
|
void filterConnected(bool filter);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void groupsChanged(int type);
|
void peerStatusChanged(const RsPeerId &peerid, RsStatusValue status);
|
||||||
void peerStatusChanged(const QString& peerId, int status);
|
|
||||||
void filterItems(const QString &text);
|
void filterItems(const QString &text);
|
||||||
void contextMenuRequested(const QPoint &pos);
|
void contextMenuRequested(const QPoint &pos);
|
||||||
void itemDoubleClicked(QTreeWidgetItem *item, int column);
|
void itemDoubleClicked(QTreeWidgetItem *item, int column);
|
||||||
|
|
@ -147,7 +147,8 @@ private slots:
|
||||||
void deselectAll() ;
|
void deselectAll() ;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void fillList();
|
void groupsChanged();
|
||||||
|
void fillList();
|
||||||
void secured_fillList();
|
void secured_fillList();
|
||||||
|
|
||||||
void selectedIds_internal(IdType idType, std::set<std::string> &ids, bool onlyDirectSelected);
|
void selectedIds_internal(IdType idType, std::set<std::string> &ids, bool onlyDirectSelected);
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
#include <retroshare/rspeers.h>
|
#include <retroshare/rspeers.h>
|
||||||
#include "GroupSelectionBox.h"
|
#include "GroupSelectionBox.h"
|
||||||
#include "GroupDefs.h"
|
#include "GroupDefs.h"
|
||||||
#include "gui/notifyqt.h"
|
#include "util/qtthreadsutils.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
|
@ -34,11 +34,38 @@ GroupSelectionBox::GroupSelectionBox(QWidget *parent)
|
||||||
{
|
{
|
||||||
setSelectionMode(QAbstractItemView::SingleSelection);
|
setSelectionMode(QAbstractItemView::SingleSelection);
|
||||||
|
|
||||||
connect(NotifyQt::getInstance(), SIGNAL(groupsChanged(int)), this, SLOT(fillGroups()));
|
mEventHandlerId = 0;
|
||||||
|
|
||||||
|
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e)
|
||||||
|
{
|
||||||
|
RsQThreadUtils::postToObject([=]()
|
||||||
|
{
|
||||||
|
auto fe = dynamic_cast<const RsFriendListEvent*>(e.get());
|
||||||
|
|
||||||
|
if(!fe)
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch(fe->mEventCode)
|
||||||
|
{
|
||||||
|
case RsFriendListEventCode::GROUP_ADDED:
|
||||||
|
case RsFriendListEventCode::GROUP_REMOVED:
|
||||||
|
case RsFriendListEventCode::GROUP_CHANGED: fillGroups();
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
, this );
|
||||||
|
}, mEventHandlerId, RsEventType::FRIEND_LIST );
|
||||||
|
|
||||||
// Fill with available groups
|
// Fill with available groups
|
||||||
fillGroups();
|
fillGroups();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GroupSelectionBox::~GroupSelectionBox()
|
||||||
|
{
|
||||||
|
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||||
|
}
|
||||||
void GroupSelectionBox::fillGroups()
|
void GroupSelectionBox::fillGroups()
|
||||||
{
|
{
|
||||||
std::list<RsNodeGroupId> selectedIds;
|
std::list<RsNodeGroupId> selectedIds;
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@
|
||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <retroshare/rsids.h>
|
#include <retroshare/rsids.h>
|
||||||
|
#include <retroshare/rsevents.h>
|
||||||
|
|
||||||
class GroupSelectionBox: public QListWidget
|
class GroupSelectionBox: public QListWidget
|
||||||
{
|
{
|
||||||
|
|
@ -28,6 +29,7 @@ class GroupSelectionBox: public QListWidget
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GroupSelectionBox(QWidget *parent);
|
GroupSelectionBox(QWidget *parent);
|
||||||
|
virtual ~GroupSelectionBox();
|
||||||
|
|
||||||
static void selectGroups(const std::list<RsNodeGroupId>& default_groups) ;
|
static void selectGroups(const std::list<RsNodeGroupId>& default_groups) ;
|
||||||
|
|
||||||
|
|
@ -38,6 +40,9 @@ public:
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void fillGroups();
|
void fillGroups();
|
||||||
|
|
||||||
|
private:
|
||||||
|
RsEventsHandlerId_t mEventHandlerId ;
|
||||||
};
|
};
|
||||||
|
|
||||||
class GroupSelectionDialog: public QDialog
|
class GroupSelectionDialog: public QDialog
|
||||||
|
|
|
||||||
|
|
@ -259,7 +259,7 @@ void HashBox::checkAttachmentReady()
|
||||||
emit fileHashingFinished(hashedFiles);
|
emit fileHashingFinished(hashedFiles);
|
||||||
|
|
||||||
auto ev = std::make_shared<RsSharedDirectoriesEvent>();
|
auto ev = std::make_shared<RsSharedDirectoriesEvent>();
|
||||||
ev->mEventCode = RsSharedDirectoriesEventCode::DIRECTORY_SWEEP_ENDED;
|
ev->mEventCode = RsSharedDirectoriesEventCode::HASHING_PROCESS_FINISHED;
|
||||||
if(rsEvents)
|
if(rsEvents)
|
||||||
rsEvents->postEvent(ev);
|
rsEvents->postEvent(ev);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,6 @@
|
||||||
#include "gui/chat/ChatUserNotify.h"
|
#include "gui/chat/ChatUserNotify.h"
|
||||||
#include "gui/connect/ConnectProgressDialog.h"
|
#include "gui/connect/ConnectProgressDialog.h"
|
||||||
#include "gui/common/ElidedLabel.h"
|
#include "gui/common/ElidedLabel.h"
|
||||||
#include "gui/notifyqt.h"
|
|
||||||
|
|
||||||
#include "NewFriendList.h"
|
#include "NewFriendList.h"
|
||||||
#include "ui_NewFriendList.h"
|
#include "ui_NewFriendList.h"
|
||||||
|
|
@ -132,8 +131,8 @@ public:
|
||||||
if(is_group_1 ^ is_group_2) // if the two are different, put the group first.
|
if(is_group_1 ^ is_group_2) // if the two are different, put the group first.
|
||||||
return is_group_1 ;
|
return is_group_1 ;
|
||||||
|
|
||||||
bool online1 = (left .data(RsFriendListModel::OnlineRole).toInt() != RS_STATUS_OFFLINE);
|
bool online1 = (left .data(RsFriendListModel::OnlineRole).toInt() != (int)RsStatusValue::RS_STATUS_OFFLINE);
|
||||||
bool online2 = (right.data(RsFriendListModel::OnlineRole).toInt() != RS_STATUS_OFFLINE);
|
bool online2 = (right.data(RsFriendListModel::OnlineRole).toInt() != (int)RsStatusValue::RS_STATUS_OFFLINE);
|
||||||
|
|
||||||
if((online1 != online2) && m_sortByState)
|
if((online1 != online2) && m_sortByState)
|
||||||
return (m_header->sortIndicatorOrder()==Qt::AscendingOrder)?online1:online2 ; // always put online nodes first
|
return (m_header->sortIndicatorOrder()==Qt::AscendingOrder)?online1:online2 ; // always put online nodes first
|
||||||
|
|
@ -155,7 +154,7 @@ public:
|
||||||
|
|
||||||
// Filter offline friends
|
// Filter offline friends
|
||||||
|
|
||||||
if(!m_showOfflineNodes && (index.data(RsFriendListModel::OnlineRole).toInt() == RS_STATUS_OFFLINE))
|
if(!m_showOfflineNodes && (RsStatusValue(index.data(RsFriendListModel::OnlineRole).toInt()) == RsStatusValue::RS_STATUS_OFFLINE))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return index.data(RsFriendListModel::FilterRole).toString() == RsFriendListModel::FilterString ;
|
return index.data(RsFriendListModel::FilterRole).toString() == RsFriendListModel::FilterString ;
|
||||||
|
|
@ -195,17 +194,14 @@ NewFriendList::NewFriendList(QWidget */*parent*/) : /* RsAutoUpdatePage(5000,par
|
||||||
ui->filterLineEdit->setPlaceholderText(tr("Search")) ;
|
ui->filterLineEdit->setPlaceholderText(tr("Search")) ;
|
||||||
ui->filterLineEdit->showFilterIcon();
|
ui->filterLineEdit->showFilterIcon();
|
||||||
|
|
||||||
|
// mEventHandlerId_pssc=0; // forces initialization
|
||||||
mEventHandlerId_peer=0; // forces initialization
|
mEventHandlerId_peer=0; // forces initialization
|
||||||
mEventHandlerId_gssp=0; // forces initialization
|
mEventHandlerId_gssp=0; // forces initialization
|
||||||
mEventHandlerId_pssc=0; // forces initialization
|
|
||||||
|
|
||||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e) { handleEvent(e); }, mEventHandlerId_pssc, RsEventType::PEER_STATE_CHANGED );
|
// rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e) { handleEvent(e); }, mEventHandlerId_pssc, RsEventType::PEER_STATE_CHANGED );
|
||||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e) { handleEvent(e); }, mEventHandlerId_peer, RsEventType::PEER_CONNECTION );
|
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e) { handleEvent(e); }, mEventHandlerId_peer, RsEventType::FRIEND_LIST );
|
||||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e) { handleEvent(e); }, mEventHandlerId_gssp, RsEventType::GOSSIP_DISCOVERY );
|
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e) { handleEvent(e); }, mEventHandlerId_gssp, RsEventType::GOSSIP_DISCOVERY );
|
||||||
|
|
||||||
connect(NotifyQt::getInstance(), SIGNAL(peerHasNewAvatar(QString)), this, SLOT(forceUpdateDisplay()));
|
|
||||||
connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(QString,int)), this, SLOT(forceUpdateDisplay()));
|
|
||||||
|
|
||||||
mModel = new RsFriendListModel(ui->peerTreeWidget);
|
mModel = new RsFriendListModel(ui->peerTreeWidget);
|
||||||
mProxyModel = new FriendListSortFilterProxyModel(ui->peerTreeWidget->header(),this);
|
mProxyModel = new FriendListSortFilterProxyModel(ui->peerTreeWidget->header(),this);
|
||||||
|
|
||||||
|
|
@ -293,7 +289,7 @@ NewFriendList::~NewFriendList()
|
||||||
{
|
{
|
||||||
rsEvents->unregisterEventsHandler(mEventHandlerId_peer);
|
rsEvents->unregisterEventsHandler(mEventHandlerId_peer);
|
||||||
rsEvents->unregisterEventsHandler(mEventHandlerId_gssp);
|
rsEvents->unregisterEventsHandler(mEventHandlerId_gssp);
|
||||||
rsEvents->unregisterEventsHandler(mEventHandlerId_pssc);
|
// rsEvents->unregisterEventsHandler(mEventHandlerId_pssc);
|
||||||
|
|
||||||
delete mModel;
|
delete mModel;
|
||||||
delete mProxyModel;
|
delete mProxyModel;
|
||||||
|
|
|
||||||
|
|
@ -66,18 +66,18 @@ public:
|
||||||
//void updateDisplay() override;
|
//void updateDisplay() override;
|
||||||
|
|
||||||
QColor textColorGroup() const { return mModel->mTextColorGroup; }
|
QColor textColorGroup() const { return mModel->mTextColorGroup; }
|
||||||
QColor textColorStatusOffline() const { return mModel->mTextColorStatus[RS_STATUS_OFFLINE ]; }
|
QColor textColorStatusOffline() const { return mModel->mTextColorStatus[(uint8_t)RsStatusValue::RS_STATUS_OFFLINE ]; }
|
||||||
QColor textColorStatusAway() const { return mModel->mTextColorStatus[RS_STATUS_AWAY ]; }
|
QColor textColorStatusAway() const { return mModel->mTextColorStatus[(uint8_t)RsStatusValue::RS_STATUS_AWAY ]; }
|
||||||
QColor textColorStatusBusy() const { return mModel->mTextColorStatus[RS_STATUS_BUSY ]; }
|
QColor textColorStatusBusy() const { return mModel->mTextColorStatus[(uint8_t)RsStatusValue::RS_STATUS_BUSY ]; }
|
||||||
QColor textColorStatusOnline() const { return mModel->mTextColorStatus[RS_STATUS_ONLINE ]; }
|
QColor textColorStatusOnline() const { return mModel->mTextColorStatus[(uint8_t)RsStatusValue::RS_STATUS_ONLINE ]; }
|
||||||
QColor textColorStatusInactive() const { return mModel->mTextColorStatus[RS_STATUS_INACTIVE]; }
|
QColor textColorStatusInactive() const { return mModel->mTextColorStatus[(uint8_t)RsStatusValue::RS_STATUS_INACTIVE]; }
|
||||||
|
|
||||||
void setTextColorGroup(QColor color) { mModel->mTextColorGroup = color; }
|
void setTextColorGroup(QColor color) { mModel->mTextColorGroup = color; }
|
||||||
void setTextColorStatusOffline(QColor color) { mModel->mTextColorStatus[RS_STATUS_OFFLINE ] = color; }
|
void setTextColorStatusOffline(QColor color) { mModel->mTextColorStatus[(uint8_t)RsStatusValue::RS_STATUS_OFFLINE ] = color; }
|
||||||
void setTextColorStatusAway(QColor color) { mModel->mTextColorStatus[RS_STATUS_AWAY ] = color; }
|
void setTextColorStatusAway(QColor color) { mModel->mTextColorStatus[(uint8_t)RsStatusValue::RS_STATUS_AWAY ] = color; }
|
||||||
void setTextColorStatusBusy(QColor color) { mModel->mTextColorStatus[RS_STATUS_BUSY ] = color; }
|
void setTextColorStatusBusy(QColor color) { mModel->mTextColorStatus[(uint8_t)RsStatusValue::RS_STATUS_BUSY ] = color; }
|
||||||
void setTextColorStatusOnline(QColor color) { mModel->mTextColorStatus[RS_STATUS_ONLINE ] = color; }
|
void setTextColorStatusOnline(QColor color) { mModel->mTextColorStatus[(uint8_t)RsStatusValue::RS_STATUS_ONLINE ] = color; }
|
||||||
void setTextColorStatusInactive(QColor color) { mModel->mTextColorStatus[RS_STATUS_INACTIVE] = color; }
|
void setTextColorStatusInactive(QColor color) { mModel->mTextColorStatus[(uint8_t)RsStatusValue::RS_STATUS_INACTIVE] = color; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void filterItems(const QString &text);
|
void filterItems(const QString &text);
|
||||||
|
|
@ -127,7 +127,7 @@ private:
|
||||||
bool mShowState;
|
bool mShowState;
|
||||||
RsEventsHandlerId_t mEventHandlerId_peer;
|
RsEventsHandlerId_t mEventHandlerId_peer;
|
||||||
RsEventsHandlerId_t mEventHandlerId_gssp;
|
RsEventsHandlerId_t mEventHandlerId_gssp;
|
||||||
RsEventsHandlerId_t mEventHandlerId_pssc;
|
// RsEventsHandlerId_t mEventHandlerId_pssc;
|
||||||
|
|
||||||
std::set<RsNodeGroupId> openGroups;
|
std::set<RsNodeGroupId> openGroups;
|
||||||
std::set<RsPgpId> openPeers;
|
std::set<RsPgpId> openPeers;
|
||||||
|
|
|
||||||
|
|
@ -24,118 +24,124 @@
|
||||||
|
|
||||||
#include "StatusDefs.h"
|
#include "StatusDefs.h"
|
||||||
|
|
||||||
QString StatusDefs::name(unsigned int status)
|
QString StatusDefs::name(RsStatusValue status)
|
||||||
{
|
{
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case RS_STATUS_OFFLINE:
|
default:
|
||||||
|
case RsStatusValue::RS_STATUS_OFFLINE:
|
||||||
return qApp->translate("StatusDefs", "Offline");
|
return qApp->translate("StatusDefs", "Offline");
|
||||||
case RS_STATUS_AWAY:
|
case RsStatusValue::RS_STATUS_AWAY:
|
||||||
return qApp->translate("StatusDefs", "Away");
|
return qApp->translate("StatusDefs", "Away");
|
||||||
case RS_STATUS_BUSY:
|
case RsStatusValue::RS_STATUS_BUSY:
|
||||||
return qApp->translate("StatusDefs", "Busy");
|
return qApp->translate("StatusDefs", "Busy");
|
||||||
case RS_STATUS_ONLINE:
|
case RsStatusValue::RS_STATUS_ONLINE:
|
||||||
return qApp->translate("StatusDefs", "Online");
|
return qApp->translate("StatusDefs", "Online");
|
||||||
case RS_STATUS_INACTIVE:
|
case RsStatusValue::RS_STATUS_INACTIVE:
|
||||||
return qApp->translate("StatusDefs", "Idle");
|
return qApp->translate("StatusDefs", "Idle");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cerr << "StatusDefs::name: Unknown status requested " << status;
|
RsErr() << "StatusDefs::name: Unknown status requested " << (int)status;
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *StatusDefs::imageIM(unsigned int status)
|
const char *StatusDefs::imageIM(RsStatusValue status)
|
||||||
{
|
{
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case RS_STATUS_OFFLINE:
|
default:
|
||||||
|
case RsStatusValue::RS_STATUS_OFFLINE:
|
||||||
return ":/images/im-user-offline.png";
|
return ":/images/im-user-offline.png";
|
||||||
case RS_STATUS_AWAY:
|
case RsStatusValue::RS_STATUS_AWAY:
|
||||||
return ":/images/im-user-away.png";
|
return ":/images/im-user-away.png";
|
||||||
case RS_STATUS_BUSY:
|
case RsStatusValue::RS_STATUS_BUSY:
|
||||||
return ":/images/im-user-busy.png";
|
return ":/images/im-user-busy.png";
|
||||||
case RS_STATUS_ONLINE:
|
case RsStatusValue::RS_STATUS_ONLINE:
|
||||||
return ":/images/im-user.png";
|
return ":/images/im-user.png";
|
||||||
case RS_STATUS_INACTIVE:
|
case RsStatusValue::RS_STATUS_INACTIVE:
|
||||||
return ":/images/im-user-inactive.png";
|
return ":/images/im-user-inactive.png";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cerr << "StatusDefs::imageIM: Unknown status requested " << status;
|
RsErr() << "StatusDefs::imageIM: Unknown status requested " << (int)status;
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *StatusDefs::imageUser(unsigned int status)
|
const char *StatusDefs::imageUser(RsStatusValue status)
|
||||||
{
|
{
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case RS_STATUS_OFFLINE:
|
default:
|
||||||
|
case RsStatusValue::RS_STATUS_OFFLINE:
|
||||||
return ":/images/user/identityoffline24.png";
|
return ":/images/user/identityoffline24.png";
|
||||||
case RS_STATUS_AWAY:
|
case RsStatusValue::RS_STATUS_AWAY:
|
||||||
return ":/images/user/identity24away.png";
|
return ":/images/user/identity24away.png";
|
||||||
case RS_STATUS_BUSY:
|
case RsStatusValue::RS_STATUS_BUSY:
|
||||||
return ":/images/user/identity24busy.png";
|
return ":/images/user/identity24busy.png";
|
||||||
case RS_STATUS_ONLINE:
|
case RsStatusValue::RS_STATUS_ONLINE:
|
||||||
return ":/images/user/identity24.png";
|
return ":/images/user/identity24.png";
|
||||||
case RS_STATUS_INACTIVE:
|
case RsStatusValue::RS_STATUS_INACTIVE:
|
||||||
return ":/images/user/identity24idle.png";
|
return ":/images/user/identity24idle.png";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cerr << "StatusDefs::imageUser: Unknown status requested " << status;
|
RsErr() << "StatusDefs::imageUser: Unknown status requested " << (int)status;
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *StatusDefs::imageStatus(unsigned int status)
|
const char *StatusDefs::imageStatus(RsStatusValue status)
|
||||||
{
|
{
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case RS_STATUS_OFFLINE:
|
default:
|
||||||
|
case RsStatusValue::RS_STATUS_OFFLINE:
|
||||||
return ":/icons/user-offline_64.png";
|
return ":/icons/user-offline_64.png";
|
||||||
case RS_STATUS_AWAY:
|
case RsStatusValue::RS_STATUS_AWAY:
|
||||||
return ":/icons/user-away_64.png";
|
return ":/icons/user-away_64.png";
|
||||||
case RS_STATUS_BUSY:
|
case RsStatusValue::RS_STATUS_BUSY:
|
||||||
return ":/icons/user-busy_64.png";
|
return ":/icons/user-busy_64.png";
|
||||||
case RS_STATUS_ONLINE:
|
case RsStatusValue::RS_STATUS_ONLINE:
|
||||||
return ":/icons/user-online_64.png";
|
return ":/icons/user-online_64.png";
|
||||||
case RS_STATUS_INACTIVE:
|
case RsStatusValue::RS_STATUS_INACTIVE:
|
||||||
return ":/icons/user-away-extended_64.png";
|
return ":/icons/user-away-extended_64.png";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cerr << "StatusDefs::imageUser: Unknown status requested " << status;
|
RsErr() << "StatusDefs::imageUser: Unknown status requested " << (int)status;
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
QString StatusDefs::tooltip(unsigned int status)
|
QString StatusDefs::tooltip(RsStatusValue status)
|
||||||
{
|
{
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case RS_STATUS_OFFLINE:
|
default:
|
||||||
|
case RsStatusValue::RS_STATUS_OFFLINE:
|
||||||
return qApp->translate("StatusDefs", "Friend is offline");
|
return qApp->translate("StatusDefs", "Friend is offline");
|
||||||
case RS_STATUS_AWAY:
|
case RsStatusValue::RS_STATUS_AWAY:
|
||||||
return qApp->translate("StatusDefs", "Friend is away");
|
return qApp->translate("StatusDefs", "Friend is away");
|
||||||
case RS_STATUS_BUSY:
|
case RsStatusValue::RS_STATUS_BUSY:
|
||||||
return qApp->translate("StatusDefs", "Friend is busy");
|
return qApp->translate("StatusDefs", "Friend is busy");
|
||||||
case RS_STATUS_ONLINE:
|
case RsStatusValue::RS_STATUS_ONLINE:
|
||||||
return qApp->translate("StatusDefs", "Friend is online");
|
return qApp->translate("StatusDefs", "Friend is online");
|
||||||
case RS_STATUS_INACTIVE:
|
case RsStatusValue::RS_STATUS_INACTIVE:
|
||||||
return qApp->translate("StatusDefs", "Friend is idle");
|
return qApp->translate("StatusDefs", "Friend is idle");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cerr << "StatusDefs::tooltip: Unknown status requested " << status;
|
RsErr() << "StatusDefs::tooltip: Unknown status requested " << (int)status;
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
QFont StatusDefs::font(unsigned int status)
|
QFont StatusDefs::font(RsStatusValue status)
|
||||||
{
|
{
|
||||||
QFont font;
|
QFont font;
|
||||||
|
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case RS_STATUS_AWAY:
|
default:
|
||||||
case RS_STATUS_BUSY:
|
case RsStatusValue::RS_STATUS_AWAY:
|
||||||
case RS_STATUS_ONLINE:
|
case RsStatusValue::RS_STATUS_BUSY:
|
||||||
case RS_STATUS_INACTIVE:
|
case RsStatusValue::RS_STATUS_ONLINE:
|
||||||
|
case RsStatusValue::RS_STATUS_INACTIVE:
|
||||||
font.setBold(true);
|
font.setBold(true);
|
||||||
return font;
|
return font;
|
||||||
case RS_STATUS_OFFLINE:
|
case RsStatusValue::RS_STATUS_OFFLINE:
|
||||||
font.setBold(false);
|
font.setBold(false);
|
||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cerr << "StatusDefs::font: Unknown status requested " << status;
|
RsErr() << "StatusDefs::font: Unknown status requested " << (int)status;
|
||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,18 +24,20 @@
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
|
|
||||||
|
#include "retroshare/rsstatus.h"
|
||||||
|
|
||||||
struct RsPeerDetails;
|
struct RsPeerDetails;
|
||||||
|
|
||||||
class StatusDefs
|
class StatusDefs
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static QString name(unsigned int status);
|
static QString name(RsStatusValue status);
|
||||||
static const char* imageIM(unsigned int status);
|
static const char* imageIM(RsStatusValue status);
|
||||||
static const char* imageUser(unsigned int status);
|
static const char* imageUser(RsStatusValue status);
|
||||||
static const char* imageStatus(unsigned int status);
|
static const char* imageStatus(RsStatusValue status);
|
||||||
static QString tooltip(unsigned int status);
|
static QString tooltip(RsStatusValue status);
|
||||||
|
|
||||||
static QFont font(unsigned int status);
|
static QFont font(RsStatusValue status);
|
||||||
|
|
||||||
static QString peerStateString(int peerState);
|
static QString peerStateString(int peerState);
|
||||||
static QString connectStateString(RsPeerDetails &details);
|
static QString connectStateString(RsPeerDetails &details);
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@
|
||||||
#include <retroshare/rspeers.h>
|
#include <retroshare/rspeers.h>
|
||||||
#include <retroshare/rsdisc.h>
|
#include <retroshare/rsdisc.h>
|
||||||
#include <retroshare/rsmsgs.h>
|
#include <retroshare/rsmsgs.h>
|
||||||
|
#include <retroshare/rsiface.h>
|
||||||
|
|
||||||
#include <retroshare-gui/mainpage.h>
|
#include <retroshare-gui/mainpage.h>
|
||||||
|
|
||||||
|
|
@ -38,7 +39,6 @@
|
||||||
#include "gui/common/PeerDefs.h"
|
#include "gui/common/PeerDefs.h"
|
||||||
#include "gui/common/StatusDefs.h"
|
#include "gui/common/StatusDefs.h"
|
||||||
#include "gui/RetroShareLink.h"
|
#include "gui/RetroShareLink.h"
|
||||||
#include "gui/notifyqt.h"
|
|
||||||
#include "gui/common/AvatarDefs.h"
|
#include "gui/common/AvatarDefs.h"
|
||||||
#include "gui/common/FilesDefs.h"
|
#include "gui/common/FilesDefs.h"
|
||||||
#include "gui/MainWindow.h"
|
#include "gui/MainWindow.h"
|
||||||
|
|
|
||||||
|
|
@ -41,11 +41,11 @@
|
||||||
#include "ui_ConnectFriendWizard.h"
|
#include "ui_ConnectFriendWizard.h"
|
||||||
#include "gui/common/PeerDefs.h"
|
#include "gui/common/PeerDefs.h"
|
||||||
#include "gui/connect/ConfCertDialog.h"
|
#include "gui/connect/ConfCertDialog.h"
|
||||||
#include "gui/notifyqt.h"
|
|
||||||
#include "gui/common/GroupDefs.h"
|
#include "gui/common/GroupDefs.h"
|
||||||
#include "gui/msgs/MessageComposer.h"
|
#include "gui/msgs/MessageComposer.h"
|
||||||
|
|
||||||
#include <retroshare/rsiface.h>
|
#include <retroshare/rsiface.h>
|
||||||
|
#include <retroshare/rsinit.h>
|
||||||
#include <retroshare/rsbanlist.h>
|
#include <retroshare/rsbanlist.h>
|
||||||
#include <retroshare/rsconfig.h>
|
#include <retroshare/rsconfig.h>
|
||||||
|
|
||||||
|
|
@ -767,7 +767,7 @@ void ConnectFriendWizard::accept()
|
||||||
bool cancelled;
|
bool cancelled;
|
||||||
std::string pgp_password;
|
std::string pgp_password;
|
||||||
|
|
||||||
if(!NotifyQt::getInstance()->askForPassword(tr("Profile password needed.").toStdString(), pgp_name + " (" + rsPeers->getOwnId().toStdString() + ")", prev_is_bad, pgp_password,cancelled))
|
if(!RsLoginHelper::askForPassword(tr("Profile password needed.").toStdString(), pgp_name + " (" + rsPeers->getOwnId().toStdString() + ")", prev_is_bad, pgp_password,cancelled))
|
||||||
{
|
{
|
||||||
QMessageBox::critical(NULL,tr("Identity creation failed"),tr("Cannot create an identity linked to your profile without your profile password."));
|
QMessageBox::critical(NULL,tr("Identity creation failed"),tr("Cannot create an identity linked to your profile without your profile password."));
|
||||||
return;
|
return;
|
||||||
|
|
@ -855,7 +855,12 @@ void ConnectFriendWizard::accept()
|
||||||
ConnectProgressDialog::showProgress(ssl_id);
|
ConnectProgressDialog::showProgress(ssl_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
NotifyQt::getInstance()->notifyListChange(NOTIFY_LIST_NEIGHBOURS,1) ;
|
auto ev = std::make_shared<RsFriendListEvent>();
|
||||||
|
ev->mEventCode = RsFriendListEventCode::NODE_ADDED;
|
||||||
|
ev->mSslId = peerDetails.id;
|
||||||
|
ev->mPgpId = peerDetails.gpg_id;
|
||||||
|
rsEvents->postEvent(ev);
|
||||||
|
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -968,190 +973,6 @@ void ConnectFriendWizard::openCert()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TO_BE_REMOVED
|
|
||||||
//========================== CertificatePage =================================
|
|
||||||
|
|
||||||
void ConnectFriendWizard::loadFriendCert()
|
|
||||||
{
|
|
||||||
QString fileName ;
|
|
||||||
if(!misc::getOpenFileName(this, RshareSettings::LASTDIR_CERT, tr("Select Certificate"), tr("RetroShare Certificate (*.rsc );;All Files (*)"),fileName))
|
|
||||||
return ;
|
|
||||||
|
|
||||||
if (!fileName.isNull()) {
|
|
||||||
ui->friendFileNameEdit->setText(fileName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConnectFriendWizard::generateCertificateCalled()
|
|
||||||
{
|
|
||||||
#ifdef FRIEND_WIZARD_DEBUG
|
|
||||||
std::cerr << " generateCertificateCalled" << std::endl;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
std::string cert = rsPeers->GetRetroshareInvite();
|
|
||||||
if (cert.empty()) {
|
|
||||||
QMessageBox::information(this, "RetroShare", tr("Sorry, create certificate failed"), QMessageBox::Ok, QMessageBox::Ok);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString qdir = QFileDialog::getSaveFileName(this, tr("Please choose a filename"), QDir::homePath(), tr("RetroShare Certificate (*.rsc );;All Files (*)"));
|
|
||||||
|
|
||||||
//Todo: move save to file to p3Peers::SaveCertificateToFile
|
|
||||||
|
|
||||||
if (qdir.isEmpty() == false) {
|
|
||||||
QFile CertFile(qdir);
|
|
||||||
if (CertFile.open(QIODevice::WriteOnly/* | QIODevice::Text*/)) {
|
|
||||||
if (CertFile.write(QByteArray(cert.c_str())) > 0) {
|
|
||||||
QMessageBox::information(this, "RetroShare", tr("Certificate file successfully created"), QMessageBox::Ok, QMessageBox::Ok);
|
|
||||||
} else {
|
|
||||||
QMessageBox::information(this, "RetroShare", tr("Sorry, certificate file creation failed"), QMessageBox::Ok, QMessageBox::Ok);
|
|
||||||
}
|
|
||||||
CertFile.close();
|
|
||||||
} else {
|
|
||||||
QMessageBox::information(this, "RetroShare", tr("Sorry, certificate file creation failed"), QMessageBox::Ok, QMessageBox::Ok);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//============================= FofPage ======================================
|
|
||||||
|
|
||||||
void ConnectFriendWizard::updatePeersList(int index)
|
|
||||||
{
|
|
||||||
|
|
||||||
ui->selectedPeersTW->clearContents();
|
|
||||||
ui->selectedPeersTW->setRowCount(0);
|
|
||||||
|
|
||||||
RsPgpId ownId = rsPeers->getGPGOwnId();
|
|
||||||
|
|
||||||
int row = 0;
|
|
||||||
|
|
||||||
_id_boxes.clear();
|
|
||||||
|
|
||||||
// We have to use this trick because signers are given by their names instead of their ids. That's a cause
|
|
||||||
// for some confusion when two peers have the same name.
|
|
||||||
//
|
|
||||||
std::list<RsPgpId> gpg_ids;
|
|
||||||
rsPeers->getGPGAllList(gpg_ids);
|
|
||||||
for (std::list<RsPgpId>::const_iterator it(gpg_ids.begin()); it != gpg_ids.end(); ++it) {
|
|
||||||
if (*it == ownId) {
|
|
||||||
// its me
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef FRIEND_WIZARD_DEBUG
|
|
||||||
std::cerr << "examining peer " << *it << " (name=" << rsPeers->getPeerName(*it);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
RsPeerDetails details ;
|
|
||||||
if (!rsPeers->getGPGDetails(*it,details)) {
|
|
||||||
#ifdef FRIEND_WIZARD_DEBUG
|
|
||||||
std::cerr << " no details." << std::endl ;
|
|
||||||
#endif
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// determine common friends
|
|
||||||
|
|
||||||
std::list<RsPgpId> common_friends;
|
|
||||||
|
|
||||||
for (std::list<RsPgpId>::const_iterator it2(details.gpgSigners.begin()); it2 != details.gpgSigners.end(); ++it2) {
|
|
||||||
if(rsPeers->isGPGAccepted(*it2)) {
|
|
||||||
common_friends.push_back(*it2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bool show = false;
|
|
||||||
|
|
||||||
switch(index) {
|
|
||||||
case 0: // "All unsigned friends of my friends"
|
|
||||||
show = !details.ownsign;
|
|
||||||
#ifdef FRIEND_WIZARD_DEBUG
|
|
||||||
std::cerr << "case 0: ownsign=" << details.ownsign << ", show=" << show << std::endl;
|
|
||||||
#endif
|
|
||||||
break ;
|
|
||||||
case 1: // "Unsigned peers who already signed my certificate"
|
|
||||||
show = details.hasSignedMe && !(details.state & RS_PEER_STATE_FRIEND);
|
|
||||||
#ifdef FRIEND_WIZARD_DEBUG
|
|
||||||
std::cerr << "case 1, ownsign=" << details.ownsign << ", is_authed_me=" << details.hasSignedMe << ", show=" << show << std::endl;
|
|
||||||
#endif
|
|
||||||
break ;
|
|
||||||
case 2: // "Peers shown as denied"
|
|
||||||
show = details.ownsign && !(details.state & RS_PEER_STATE_FRIEND);
|
|
||||||
#ifdef FRIEND_WIZARD_DEBUG
|
|
||||||
std::cerr << "case 2, ownsign=" << details.ownsign << ", state_friend=" << (details.state & RS_PEER_STATE_FRIEND) << ", show=" << show << std::endl;
|
|
||||||
#endif
|
|
||||||
break ;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (show) {
|
|
||||||
ui->selectedPeersTW->insertRow(row);
|
|
||||||
|
|
||||||
QCheckBox *cb = new QCheckBox;
|
|
||||||
cb->setChecked(true);
|
|
||||||
_id_boxes[cb] = details.id;
|
|
||||||
_gpg_id_boxes[cb] = details.gpg_id;
|
|
||||||
|
|
||||||
ui->selectedPeersTW->setCellWidget(row, 0, cb);
|
|
||||||
ui->selectedPeersTW->setItem(row, 1, new QTableWidgetItem(QString::fromUtf8(details.name.c_str())));
|
|
||||||
|
|
||||||
QComboBox *qcb = new QComboBox;
|
|
||||||
|
|
||||||
if (common_friends.empty()) {
|
|
||||||
qcb->addItem(tr("*** None ***"));
|
|
||||||
} else {
|
|
||||||
for (std::list<RsPgpId>::const_iterator it2(common_friends.begin()); it2 != common_friends.end(); ++it2) {
|
|
||||||
qcb->addItem(QString::fromStdString( (*it2).toStdString()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ui->selectedPeersTW->setCellWidget(row, 2, qcb);
|
|
||||||
ui->selectedPeersTW->setItem(row, 3, new QTableWidgetItem(QString::fromStdString(details.id.toStdString())));
|
|
||||||
++row;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#ifdef FRIEND_WIZARD_DEBUG
|
|
||||||
std::cerr << "FofPage::updatePeersList() finished iterating over peers" << std::endl;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (row>0) {
|
|
||||||
ui->selectedPeersTW->resizeColumnsToContents();
|
|
||||||
ui->makeFriendButton->setEnabled(true);
|
|
||||||
} else {
|
|
||||||
ui->makeFriendButton->setEnabled(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConnectFriendWizard::signAllSelectedUsers()
|
|
||||||
{
|
|
||||||
#ifdef FRIEND_WIZARD_DEBUG
|
|
||||||
std::cerr << "making lots of friends !!" << std::endl;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (std::map<QCheckBox*, RsPeerId>::const_iterator it(_id_boxes.begin()); it != _id_boxes.end(); ++it) {
|
|
||||||
if (it->first->isChecked()) {
|
|
||||||
#ifdef FRIEND_WIZARD_DEBUG
|
|
||||||
std::cerr << "Making friend with " << it->second << std::endl ;
|
|
||||||
#endif
|
|
||||||
//rsPeers->AuthCertificate(it->second, "");
|
|
||||||
rsPeers->addFriend(it->second, _gpg_id_boxes[it->first]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ui->FofPage->setComplete(true);
|
|
||||||
|
|
||||||
ui->userSelectionCB->setEnabled(false);
|
|
||||||
ui->selectedPeersTW->setEnabled(false);
|
|
||||||
ui->makeFriendButton->setEnabled(false);
|
|
||||||
|
|
||||||
NotifyQt::getInstance()->notifyListChange(NOTIFY_LIST_NEIGHBOURS,0);
|
|
||||||
NotifyQt::getInstance()->notifyListChange(NOTIFY_LIST_FRIENDS,0);
|
|
||||||
}
|
|
||||||
|
|
||||||
//============================= RsidPage =====================================
|
|
||||||
|
|
||||||
|
|
||||||
//============================ Emailpage =====================================
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//========================= ErrorMessagePage =================================
|
//========================= ErrorMessagePage =================================
|
||||||
|
|
||||||
//========================== ConclusionPage ==================================
|
//========================== ConclusionPage ==================================
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@
|
||||||
#include <retroshare/rspeers.h>
|
#include <retroshare/rspeers.h>
|
||||||
#include <retroshare/rsdisc.h>
|
#include <retroshare/rsdisc.h>
|
||||||
#include <retroshare/rsmsgs.h>
|
#include <retroshare/rsmsgs.h>
|
||||||
|
#include <retroshare/rsinit.h>
|
||||||
|
|
||||||
#include <retroshare-gui/mainpage.h>
|
#include <retroshare-gui/mainpage.h>
|
||||||
|
|
||||||
|
|
@ -39,7 +40,6 @@
|
||||||
#include "gui/common/PeerDefs.h"
|
#include "gui/common/PeerDefs.h"
|
||||||
#include "gui/common/StatusDefs.h"
|
#include "gui/common/StatusDefs.h"
|
||||||
#include "gui/RetroShareLink.h"
|
#include "gui/RetroShareLink.h"
|
||||||
#include "gui/notifyqt.h"
|
|
||||||
#include "gui/common/AvatarDefs.h"
|
#include "gui/common/AvatarDefs.h"
|
||||||
#include "gui/MainWindow.h"
|
#include "gui/MainWindow.h"
|
||||||
#include "util/DateTime.h"
|
#include "util/DateTime.h"
|
||||||
|
|
@ -364,13 +364,13 @@ void PGPKeyDialog::signGPGKey()
|
||||||
bool cancelled;
|
bool cancelled;
|
||||||
std::string gpg_password;
|
std::string gpg_password;
|
||||||
|
|
||||||
if(!NotifyQt::getInstance()->askForPassword(tr("Profile password needed.").toStdString(), gpg_name + " (" + rsPeers->getOwnId().toStdString() + ")", false, gpg_password,cancelled))
|
if(!RsLoginHelper::askForPassword(tr("Profile password needed.").toStdString(), gpg_name + " (" + rsPeers->getOwnId().toStdString() + ")", false, gpg_password,cancelled))
|
||||||
{
|
{
|
||||||
QMessageBox::critical(NULL,tr("Identity creation failed"),tr("Cannot create an identity linked to your profile without your profile password."));
|
QMessageBox::critical(NULL,tr("Identity creation failed"),tr("Cannot create an identity linked to your profile without your profile password."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rsNotify->clearPgpPassphrase(); // just in case
|
RsLoginHelper::clearPgpPassphrase(); // just in case
|
||||||
|
|
||||||
if(!rsPeers->signGPGCertificate(pgpId,gpg_password))
|
if(!rsPeers->signGPGCertificate(pgpId,gpg_password))
|
||||||
QMessageBox::warning ( NULL, tr("Signature Failure"), tr("Check the password!"), QMessageBox::Ok);
|
QMessageBox::warning ( NULL, tr("Signature Failure"), tr("Check the password!"), QMessageBox::Ok);
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@
|
||||||
#include "gui/common/AvatarDefs.h"
|
#include "gui/common/AvatarDefs.h"
|
||||||
#include "gui/settings/rsharesettings.h"
|
#include "gui/settings/rsharesettings.h"
|
||||||
|
|
||||||
#include "gui/notifyqt.h"
|
|
||||||
|
|
||||||
#include <retroshare/rsmsgs.h>
|
#include <retroshare/rsmsgs.h>
|
||||||
#include <retroshare/rspeers.h>
|
#include <retroshare/rspeers.h>
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ uint64_t FeedItem::hash_64bits(const std::string& s) const
|
||||||
if(mHash == 0)
|
if(mHash == 0)
|
||||||
mHash = hash64(s);
|
mHash = hash64(s);
|
||||||
|
|
||||||
return mHash;
|
return mHash;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t FeedItem::hash64(const std::string& s)
|
uint64_t FeedItem::hash64(const std::string& s)
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,70 @@
|
||||||
#ifndef _FEED_ITEM_H
|
#ifndef _FEED_ITEM_H
|
||||||
#define _FEED_ITEM_H
|
#define _FEED_ITEM_H
|
||||||
|
|
||||||
|
#include <retroshare/rsflags.h>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
class FeedHolder;
|
class FeedHolder;
|
||||||
|
|
||||||
|
enum class RsFeedTypeFlags: uint32_t {
|
||||||
|
RS_FEED_TYPE_NONE = 0x0000,
|
||||||
|
RS_FEED_TYPE_PEER = 0x0010,
|
||||||
|
RS_FEED_TYPE_CHANNEL = 0x0020,
|
||||||
|
RS_FEED_TYPE_FORUM = 0x0040,
|
||||||
|
RS_FEED_TYPE_CHAT = 0x0100,
|
||||||
|
RS_FEED_TYPE_MSG = 0x0200,
|
||||||
|
RS_FEED_TYPE_FILES = 0x0400,
|
||||||
|
RS_FEED_TYPE_SECURITY = 0x0800,
|
||||||
|
RS_FEED_TYPE_POSTED = 0x1000,
|
||||||
|
RS_FEED_TYPE_SECURITY_IP = 0x2000,
|
||||||
|
RS_FEED_TYPE_CIRCLE = 0x4000,
|
||||||
|
|
||||||
|
RS_FEED_ITEM_PEER_CONNECT = RS_FEED_TYPE_PEER | 0x0001,
|
||||||
|
RS_FEED_ITEM_PEER_DISCONNECT = RS_FEED_TYPE_PEER | 0x0002,
|
||||||
|
RS_FEED_ITEM_PEER_HELLO = RS_FEED_TYPE_PEER | 0x0003,
|
||||||
|
RS_FEED_ITEM_PEER_NEW = RS_FEED_TYPE_PEER | 0x0004,
|
||||||
|
RS_FEED_ITEM_PEER_OFFSET = RS_FEED_TYPE_PEER | 0x0005,
|
||||||
|
RS_FEED_ITEM_PEER_DENIES_CONNEXION = RS_FEED_TYPE_PEER | 0x0006,
|
||||||
|
|
||||||
|
RS_FEED_ITEM_SEC_CONNECT_ATTEMPT = RS_FEED_TYPE_SECURITY | 0x0001,
|
||||||
|
RS_FEED_ITEM_SEC_AUTH_DENIED = RS_FEED_TYPE_SECURITY | 0x0002, // locally denied connection
|
||||||
|
RS_FEED_ITEM_SEC_UNKNOWN_IN = RS_FEED_TYPE_SECURITY | 0x0003,
|
||||||
|
RS_FEED_ITEM_SEC_UNKNOWN_OUT = RS_FEED_TYPE_SECURITY | 0x0004,
|
||||||
|
RS_FEED_ITEM_SEC_WRONG_SIGNATURE = RS_FEED_TYPE_SECURITY | 0x0005,
|
||||||
|
RS_FEED_ITEM_SEC_BAD_CERTIFICATE = RS_FEED_TYPE_SECURITY | 0x0006,
|
||||||
|
RS_FEED_ITEM_SEC_INTERNAL_ERROR = RS_FEED_TYPE_SECURITY | 0x0007,
|
||||||
|
RS_FEED_ITEM_SEC_MISSING_CERTIFICATE = RS_FEED_TYPE_SECURITY | 0x0008,
|
||||||
|
|
||||||
|
RS_FEED_ITEM_SEC_IP_BLACKLISTED = RS_FEED_TYPE_SECURITY_IP | 0x0001,
|
||||||
|
RS_FEED_ITEM_SEC_IP_WRONG_EXTERNAL_IP_REPORTED = RS_FEED_TYPE_SECURITY_IP | 0x0002,
|
||||||
|
|
||||||
|
RS_FEED_ITEM_CHANNEL_NEW = RS_FEED_TYPE_CHANNEL | 0x0002,
|
||||||
|
RS_FEED_ITEM_CHANNEL_MSG = RS_FEED_TYPE_CHANNEL | 0x0003,
|
||||||
|
RS_FEED_ITEM_CHANNEL_PUBLISHKEY = RS_FEED_TYPE_CHANNEL| 0x0004,
|
||||||
|
|
||||||
|
RS_FEED_ITEM_FORUM_NEW = RS_FEED_TYPE_FORUM | 0x0001,
|
||||||
|
RS_FEED_ITEM_FORUM_MSG = RS_FEED_TYPE_FORUM | 0x0003,
|
||||||
|
RS_FEED_ITEM_FORUM_PUBLISHKEY = RS_FEED_TYPE_FORUM | 0x0004,
|
||||||
|
|
||||||
|
RS_FEED_ITEM_POSTED_NEW = RS_FEED_TYPE_POSTED | 0x0001,
|
||||||
|
RS_FEED_ITEM_POSTED_MSG = RS_FEED_TYPE_POSTED | 0x0003,
|
||||||
|
|
||||||
|
RS_FEED_ITEM_CHAT_NEW = RS_FEED_TYPE_CHAT | 0x0001,
|
||||||
|
RS_FEED_ITEM_MESSAGE = RS_FEED_TYPE_MSG | 0x0001,
|
||||||
|
RS_FEED_ITEM_FILES_NEW = RS_FEED_TYPE_FILES | 0x0001,
|
||||||
|
|
||||||
|
RS_FEED_ITEM_CIRCLE_MEMB_REQ = RS_FEED_TYPE_CIRCLE | 0x0001,
|
||||||
|
RS_FEED_ITEM_CIRCLE_INVITE_REC = RS_FEED_TYPE_CIRCLE | 0x0002,
|
||||||
|
RS_FEED_ITEM_CIRCLE_MEMB_LEAVE = RS_FEED_TYPE_CIRCLE | 0x0003,
|
||||||
|
RS_FEED_ITEM_CIRCLE_MEMB_JOIN = RS_FEED_TYPE_CIRCLE | 0x0004,
|
||||||
|
RS_FEED_ITEM_CIRCLE_MEMB_ACCEPTED = RS_FEED_TYPE_CIRCLE | 0x0005,
|
||||||
|
RS_FEED_ITEM_CIRCLE_MEMB_REVOKED = RS_FEED_TYPE_CIRCLE | 0x0006,
|
||||||
|
RS_FEED_ITEM_CIRCLE_INVITE_CANCELLED= RS_FEED_TYPE_CIRCLE | 0x0007,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
RS_REGISTER_ENUM_FLAGS_TYPE(RsFeedTypeFlags);
|
||||||
|
|
||||||
class FeedItem : public QWidget
|
class FeedItem : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@
|
||||||
#include "ui_GxsCircleItem.h"
|
#include "ui_GxsCircleItem.h"
|
||||||
|
|
||||||
#include "FeedHolder.h"
|
#include "FeedHolder.h"
|
||||||
#include "gui/notifyqt.h"
|
|
||||||
#include "gui/Circles/CreateCircleDialog.h"
|
#include "gui/Circles/CreateCircleDialog.h"
|
||||||
#include "gui/gxs/GxsIdDetails.h"
|
#include "gui/gxs/GxsIdDetails.h"
|
||||||
#include "gui/common/FilesDefs.h"
|
#include "gui/common/FilesDefs.h"
|
||||||
|
|
@ -40,7 +39,7 @@
|
||||||
#define CIRCLESDIALOG_GROUPUPDATE 3
|
#define CIRCLESDIALOG_GROUPUPDATE 3
|
||||||
|
|
||||||
|
|
||||||
GxsCircleItem::GxsCircleItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsCircleId &circleId, const RsGxsId &gxsId, const uint32_t type)
|
GxsCircleItem::GxsCircleItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsCircleId &circleId, const RsGxsId &gxsId, RsFeedTypeFlags type)
|
||||||
:FeedItem(feedHolder,feedId,NULL), mType(type), mCircleId(circleId), mGxsId(gxsId)
|
:FeedItem(feedHolder,feedId,NULL), mType(type), mCircleId(circleId), mGxsId(gxsId)
|
||||||
{
|
{
|
||||||
setup();
|
setup();
|
||||||
|
|
@ -92,7 +91,7 @@ void GxsCircleItem::setup()
|
||||||
|
|
||||||
// from here we can figure out if we already have requested membership or not
|
// from here we can figure out if we already have requested membership or not
|
||||||
|
|
||||||
if (mType == RS_FEED_ITEM_CIRCLE_MEMB_REQ)
|
if (mType == RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_MEMB_REQ)
|
||||||
{
|
{
|
||||||
ui->titleLabel->setText(tr("You received a membership request a circle you're administrating:"));
|
ui->titleLabel->setText(tr("You received a membership request a circle you're administrating:"));
|
||||||
ui->iconLabel->setPixmap(pixmap);
|
ui->iconLabel->setPixmap(pixmap);
|
||||||
|
|
@ -105,7 +104,7 @@ void GxsCircleItem::setup()
|
||||||
|
|
||||||
ui->membershipButton->setHidden(true);
|
ui->membershipButton->setHidden(true);
|
||||||
}
|
}
|
||||||
else if (mType == RS_FEED_ITEM_CIRCLE_INVITE_REC)
|
else if (mType == RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_INVITE_REC)
|
||||||
{
|
{
|
||||||
ui->titleLabel->setText(tr("You received an invitation to join this circle:"));
|
ui->titleLabel->setText(tr("You received an invitation to join this circle:"));
|
||||||
ui->iconLabel->setPixmap(pixmap);
|
ui->iconLabel->setPixmap(pixmap);
|
||||||
|
|
@ -118,7 +117,7 @@ void GxsCircleItem::setup()
|
||||||
connect(ui->membershipButton, SIGNAL(clicked()), this, SLOT(requestCircleSubscription()));
|
connect(ui->membershipButton, SIGNAL(clicked()), this, SLOT(requestCircleSubscription()));
|
||||||
ui->inviteeButton->setHidden(true);
|
ui->inviteeButton->setHidden(true);
|
||||||
}
|
}
|
||||||
else if (mType == RS_FEED_ITEM_CIRCLE_MEMB_LEAVE)
|
else if (mType == RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_MEMB_LEAVE)
|
||||||
{
|
{
|
||||||
ui->titleLabel->setText(idName + tr(" has left this circle."));
|
ui->titleLabel->setText(idName + tr(" has left this circle."));
|
||||||
ui->iconLabel->setPixmap(pixmap);
|
ui->iconLabel->setPixmap(pixmap);
|
||||||
|
|
@ -127,7 +126,7 @@ void GxsCircleItem::setup()
|
||||||
ui->membershipButton->setHidden(true);
|
ui->membershipButton->setHidden(true);
|
||||||
ui->inviteeButton->setHidden(true);
|
ui->inviteeButton->setHidden(true);
|
||||||
}
|
}
|
||||||
else if (mType == RS_FEED_ITEM_CIRCLE_MEMB_JOIN)
|
else if (mType == RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_MEMB_JOIN)
|
||||||
{
|
{
|
||||||
if(circleDetails.mAmIAdmin)
|
if(circleDetails.mAmIAdmin)
|
||||||
{
|
{
|
||||||
|
|
@ -148,7 +147,7 @@ void GxsCircleItem::setup()
|
||||||
|
|
||||||
ui->membershipButton->setHidden(true);
|
ui->membershipButton->setHidden(true);
|
||||||
}
|
}
|
||||||
else if (mType == RS_FEED_ITEM_CIRCLE_MEMB_REVOKED)
|
else if (mType == RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_MEMB_REVOKED)
|
||||||
{
|
{
|
||||||
ui->titleLabel->setText(tr("Your identity %1 has been revoked from this circle.").arg(idName));
|
ui->titleLabel->setText(tr("Your identity %1 has been revoked from this circle.").arg(idName));
|
||||||
|
|
||||||
|
|
@ -162,7 +161,7 @@ void GxsCircleItem::setup()
|
||||||
|
|
||||||
ui->inviteeButton->setHidden(true);
|
ui->inviteeButton->setHidden(true);
|
||||||
}
|
}
|
||||||
else if (mType == RS_FEED_ITEM_CIRCLE_MEMB_ACCEPTED)
|
else if (mType == RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_MEMB_ACCEPTED)
|
||||||
{
|
{
|
||||||
ui->titleLabel->setText(tr("Your identity %1 as been accepted in this circle.").arg(idName));
|
ui->titleLabel->setText(tr("Your identity %1 as been accepted in this circle.").arg(idName));
|
||||||
|
|
||||||
|
|
@ -198,7 +197,7 @@ void GxsCircleItem::showCircleDetails()
|
||||||
{
|
{
|
||||||
CreateCircleDialog dlg;
|
CreateCircleDialog dlg;
|
||||||
|
|
||||||
dlg.editExistingId(RsGxsGroupId(mCircleId), true, mType != RS_FEED_ITEM_CIRCLE_MEMB_REQ) ;
|
dlg.editExistingId(RsGxsGroupId(mCircleId), true, mType != RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_MEMB_REQ) ;
|
||||||
dlg.exec();
|
dlg.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -215,9 +214,9 @@ void GxsCircleItem::toggleCircleMembership()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mType == RS_FEED_ITEM_CIRCLE_INVITE_REC)
|
if(mType == RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_INVITE_REC)
|
||||||
rsGxsCircles->requestCircleMembership(mGxsId,mCircleId);
|
rsGxsCircles->requestCircleMembership(mGxsId,mCircleId);
|
||||||
else if(mType == RS_FEED_ITEM_CIRCLE_MEMB_REVOKED)
|
else if(mType == RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_MEMB_REVOKED)
|
||||||
rsGxsCircles->cancelCircleMembership(mGxsId,mCircleId);
|
rsGxsCircles->cancelCircleMembership(mGxsId,mCircleId);
|
||||||
else
|
else
|
||||||
RsErr() << __PRETTY_FUNCTION__ << ": inconsistent call. mType is " << mType << std::endl;
|
RsErr() << __PRETTY_FUNCTION__ << ": inconsistent call. mType is " << mType << std::endl;
|
||||||
|
|
@ -225,12 +224,12 @@ void GxsCircleItem::toggleCircleMembership()
|
||||||
|
|
||||||
void GxsCircleItem::toggleCircleInvite()
|
void GxsCircleItem::toggleCircleInvite()
|
||||||
{
|
{
|
||||||
if(mType == RS_FEED_ITEM_CIRCLE_MEMB_JOIN)
|
if(mType == RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_MEMB_JOIN)
|
||||||
RsThread::async([this]()
|
RsThread::async([this]()
|
||||||
{
|
{
|
||||||
rsGxsCircles->revokeIdsFromCircle(std::set<RsGxsId>( { mGxsId } ),mCircleId);
|
rsGxsCircles->revokeIdsFromCircle(std::set<RsGxsId>( { mGxsId } ),mCircleId);
|
||||||
});
|
});
|
||||||
else if(mType == RS_FEED_ITEM_CIRCLE_MEMB_REQ)
|
else if(mType == RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_MEMB_REQ)
|
||||||
RsThread::async([this]()
|
RsThread::async([this]()
|
||||||
{
|
{
|
||||||
rsGxsCircles->inviteIdsToCircle(std::set<RsGxsId>( { mGxsId } ),mCircleId);
|
rsGxsCircles->inviteIdsToCircle(std::set<RsGxsId>( { mGxsId } ),mCircleId);
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ class GxsCircleItem : public FeedItem
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** Default Constructor */
|
/** Default Constructor */
|
||||||
GxsCircleItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsCircleId &circleId, const RsGxsId &gxsId, const uint32_t type);
|
GxsCircleItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsCircleId &circleId, const RsGxsId &gxsId, RsFeedTypeFlags type);
|
||||||
virtual ~GxsCircleItem();
|
virtual ~GxsCircleItem();
|
||||||
|
|
||||||
uint64_t uniqueIdentifier() const override;
|
uint64_t uniqueIdentifier() const override;
|
||||||
|
|
@ -60,7 +60,7 @@ private slots:
|
||||||
private:
|
private:
|
||||||
void setup();
|
void setup();
|
||||||
|
|
||||||
uint32_t mType;
|
RsFeedTypeFlags mType;
|
||||||
|
|
||||||
RsGxsCircleId mCircleId;
|
RsGxsCircleId mCircleId;
|
||||||
RsGxsId mGxsId;
|
RsGxsId mGxsId;
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@
|
||||||
#include "util/DateTime.h"
|
#include "util/DateTime.h"
|
||||||
#include "gui/common/AvatarDefs.h"
|
#include "gui/common/AvatarDefs.h"
|
||||||
#include "gui/common/FilesDefs.h"
|
#include "gui/common/FilesDefs.h"
|
||||||
#include "gui/notifyqt.h"
|
|
||||||
#include "util/qtthreadsutils.h"
|
#include "util/qtthreadsutils.h"
|
||||||
|
|
||||||
#include <retroshare/rsmsgs.h>
|
#include <retroshare/rsmsgs.h>
|
||||||
|
|
|
||||||
|
|
@ -28,10 +28,9 @@
|
||||||
#include "gui/common/StatusDefs.h"
|
#include "gui/common/StatusDefs.h"
|
||||||
#include "gui/common/FilesDefs.h"
|
#include "gui/common/FilesDefs.h"
|
||||||
#include "gui/common/AvatarDefs.h"
|
#include "gui/common/AvatarDefs.h"
|
||||||
|
#include "util/qtthreadsutils.h"
|
||||||
#include "util/DateTime.h"
|
#include "util/DateTime.h"
|
||||||
|
|
||||||
#include "gui/notifyqt.h"
|
|
||||||
|
|
||||||
#include <retroshare/rsmsgs.h>
|
#include <retroshare/rsmsgs.h>
|
||||||
#include <retroshare/rspeers.h>
|
#include <retroshare/rspeers.h>
|
||||||
#include <retroshare/rsrtt.h>
|
#include <retroshare/rsrtt.h>
|
||||||
|
|
@ -58,7 +57,21 @@ PeerItem::PeerItem(FeedHolder *parent, uint32_t feedId, const RsPeerId &peerId,
|
||||||
connect( chatButton, SIGNAL( clicked() ), this, SLOT( openChat() ) );
|
connect( chatButton, SIGNAL( clicked() ), this, SLOT( openChat() ) );
|
||||||
connect( sendmsgButton, SIGNAL( clicked() ), this, SLOT( sendMsg() ) );
|
connect( sendmsgButton, SIGNAL( clicked() ), this, SLOT( sendMsg() ) );
|
||||||
|
|
||||||
connect(NotifyQt::getInstance(), SIGNAL(friendsChanged()), this, SLOT(updateItem()));
|
mEventHandlerId = 0;
|
||||||
|
|
||||||
|
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e)
|
||||||
|
{
|
||||||
|
RsQThreadUtils::postToObject([=]()
|
||||||
|
{
|
||||||
|
auto fe = dynamic_cast<const RsFriendListEvent*>(e.get());
|
||||||
|
|
||||||
|
if(!fe)
|
||||||
|
return;
|
||||||
|
|
||||||
|
updateItem();
|
||||||
|
}
|
||||||
|
, this );
|
||||||
|
}, mEventHandlerId, RsEventType::FRIEND_LIST );
|
||||||
|
|
||||||
avatar->setId(ChatId(mPeerId));// TODO: remove unnecesary converstation
|
avatar->setId(ChatId(mPeerId));// TODO: remove unnecesary converstation
|
||||||
|
|
||||||
|
|
@ -68,6 +81,10 @@ PeerItem::PeerItem(FeedHolder *parent, uint32_t feedId, const RsPeerId &peerId,
|
||||||
updateItem();
|
updateItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PeerItem::~PeerItem()
|
||||||
|
{
|
||||||
|
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||||
|
}
|
||||||
uint64_t PeerItem::uniqueIdentifier() const
|
uint64_t PeerItem::uniqueIdentifier() const
|
||||||
{
|
{
|
||||||
return hash_64bits("PeerItem " + mPeerId.toStdString() + " " + QString::number(mType).toStdString()) ;
|
return hash_64bits("PeerItem " + mPeerId.toStdString() + " " + QString::number(mType).toStdString()) ;
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ class PeerItem : public FeedItem, private Ui::PeerItem
|
||||||
public:
|
public:
|
||||||
/** Default Constructor */
|
/** Default Constructor */
|
||||||
PeerItem(FeedHolder *parent, uint32_t feedId, const RsPeerId &peerId, uint32_t type, bool isHome);
|
PeerItem(FeedHolder *parent, uint32_t feedId, const RsPeerId &peerId, uint32_t type, bool isHome);
|
||||||
|
virtual ~PeerItem();
|
||||||
|
|
||||||
void updateItemStatic();
|
void updateItemStatic();
|
||||||
|
|
||||||
|
|
@ -66,6 +67,7 @@ private:
|
||||||
RsPeerId mPeerId;
|
RsPeerId mPeerId;
|
||||||
uint32_t mType;
|
uint32_t mType;
|
||||||
bool mIsHome;
|
bool mIsHome;
|
||||||
|
RsEventsHandlerId_t mEventHandlerId ;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -33,21 +33,20 @@
|
||||||
|
|
||||||
#include <retroshare/rspeers.h>
|
#include <retroshare/rspeers.h>
|
||||||
#include <retroshare/rsbanlist.h>
|
#include <retroshare/rsbanlist.h>
|
||||||
#include <retroshare/rsnotify.h>
|
|
||||||
|
|
||||||
/*****
|
/*****
|
||||||
* #define DEBUG_ITEM 1
|
* #define DEBUG_ITEM 1
|
||||||
****/
|
****/
|
||||||
|
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
SecurityIpItem::SecurityIpItem(FeedHolder *parent, const RsPeerId &sslId, const std::string &ipAddr, uint32_t result, uint32_t type, bool isTest) :
|
SecurityIpItem::SecurityIpItem(FeedHolder *parent, const RsPeerId &sslId, const std::string &ipAddr, uint32_t result, RsFeedTypeFlags type, bool isTest) :
|
||||||
FeedItem(parent,0,NULL), mType(type), mSslId(sslId), mIpAddr(ipAddr), mResult(result), mIsTest(isTest),
|
FeedItem(parent,0,NULL), mType(type), mSslId(sslId), mIpAddr(ipAddr), mResult(result), mIsTest(isTest),
|
||||||
ui(new(Ui::SecurityIpItem))
|
ui(new(Ui::SecurityIpItem))
|
||||||
{
|
{
|
||||||
setup();
|
setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
SecurityIpItem::SecurityIpItem(FeedHolder *parent, const RsPeerId &sslId, const std::string& ipAddr, const std::string& ipAddrReported, uint32_t type, bool isTest) :
|
SecurityIpItem::SecurityIpItem(FeedHolder *parent, const RsPeerId &sslId, const std::string& ipAddr, const std::string& ipAddrReported, RsFeedTypeFlags type, bool isTest) :
|
||||||
FeedItem(parent,0,NULL), mType(type), mSslId(sslId), mIpAddr(ipAddr), mIpAddrReported(ipAddrReported), mResult(0), mIsTest(isTest),
|
FeedItem(parent,0,NULL), mType(type), mSslId(sslId), mIpAddr(ipAddr), mIpAddrReported(ipAddrReported), mResult(0), mIsTest(isTest),
|
||||||
ui(new(Ui::SecurityIpItem))
|
ui(new(Ui::SecurityIpItem))
|
||||||
{
|
{
|
||||||
|
|
@ -81,7 +80,7 @@ void SecurityIpItem::setup()
|
||||||
|
|
||||||
uint64_t SecurityIpItem::uniqueIdentifier() const
|
uint64_t SecurityIpItem::uniqueIdentifier() const
|
||||||
{
|
{
|
||||||
return hash_64bits("SecurityItem " + QString::number(mType).toStdString() + " " + mSslId.toStdString() + " " + mIpAddr + " " + mIpAddrReported) ;
|
return hash_64bits("SecurityItem " + QString::number((int)mType).toStdString() + " " + mSslId.toStdString() + " " + mIpAddr + " " + mIpAddrReported) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SecurityIpItem::updateItemStatic()
|
void SecurityIpItem::updateItemStatic()
|
||||||
|
|
@ -97,12 +96,12 @@ void SecurityIpItem::updateItemStatic()
|
||||||
|
|
||||||
/* Specific type */
|
/* Specific type */
|
||||||
switch (mType) {
|
switch (mType) {
|
||||||
case RS_FEED_ITEM_SEC_IP_BLACKLISTED:
|
case RsFeedTypeFlags::RS_FEED_ITEM_SEC_IP_BLACKLISTED:
|
||||||
ui->rsBanListButton->setDisabled(mIsTest);
|
ui->rsBanListButton->setDisabled(mIsTest);
|
||||||
ui->ipAddrReported->hide();
|
ui->ipAddrReported->hide();
|
||||||
ui->ipAddrReportedLabel->hide();
|
ui->ipAddrReportedLabel->hide();
|
||||||
break;
|
break;
|
||||||
case RS_FEED_ITEM_SEC_IP_WRONG_EXTERNAL_IP_REPORTED:
|
case RsFeedTypeFlags::RS_FEED_ITEM_SEC_IP_WRONG_EXTERNAL_IP_REPORTED:
|
||||||
ui->rsBanListButton->hide();
|
ui->rsBanListButton->hide();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
@ -126,7 +125,7 @@ void SecurityIpItem::updateItem()
|
||||||
|
|
||||||
if(!RsAutoUpdatePage::eventsLocked()) {
|
if(!RsAutoUpdatePage::eventsLocked()) {
|
||||||
switch (mType) {
|
switch (mType) {
|
||||||
case RS_FEED_ITEM_SEC_IP_BLACKLISTED:
|
case RsFeedTypeFlags::RS_FEED_ITEM_SEC_IP_BLACKLISTED:
|
||||||
ui->titleLabel->setText(RsBanListDefs::resultString(mResult));
|
ui->titleLabel->setText(RsBanListDefs::resultString(mResult));
|
||||||
ui->ipAddr->setText(QString::fromStdString(mIpAddr));
|
ui->ipAddr->setText(QString::fromStdString(mIpAddr));
|
||||||
|
|
||||||
|
|
@ -145,7 +144,7 @@ void SecurityIpItem::updateItem()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RS_FEED_ITEM_SEC_IP_WRONG_EXTERNAL_IP_REPORTED:
|
case RsFeedTypeFlags::RS_FEED_ITEM_SEC_IP_WRONG_EXTERNAL_IP_REPORTED:
|
||||||
ui->titleLabel->setText(tr("Wrong external ip address reported"));
|
ui->titleLabel->setText(tr("Wrong external ip address reported"));
|
||||||
ui->ipAddr->setText(QString::fromStdString(mIpAddr));
|
ui->ipAddr->setText(QString::fromStdString(mIpAddr));
|
||||||
ui->ipAddr->setToolTip(tr("<p>This is the external IP your Retroshare node thinks it is using.</p>")) ;
|
ui->ipAddr->setToolTip(tr("<p>This is the external IP your Retroshare node thinks it is using.</p>")) ;
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,8 @@ class SecurityIpItem : public FeedItem
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** Default Constructor */
|
/** Default Constructor */
|
||||||
SecurityIpItem(FeedHolder *parent, const RsPeerId &sslId, const std::string& ipAddr, uint32_t result, uint32_t type, bool isTest);
|
SecurityIpItem(FeedHolder *parent, const RsPeerId &sslId, const std::string& ipAddr, uint32_t result, RsFeedTypeFlags type, bool isTest);
|
||||||
SecurityIpItem(FeedHolder *parent, const RsPeerId &sslId, const std::string& ipAddr, const std::string& ipAddrReported, uint32_t type, bool isTest);
|
SecurityIpItem(FeedHolder *parent, const RsPeerId &sslId, const std::string& ipAddr, const std::string& ipAddrReported, RsFeedTypeFlags type, bool isTest);
|
||||||
|
|
||||||
void updateItemStatic();
|
void updateItemStatic();
|
||||||
|
|
||||||
|
|
@ -60,7 +60,7 @@ private slots:
|
||||||
void banIpListChanged(const QString &ipAddress);
|
void banIpListChanged(const QString &ipAddress);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32_t mType;
|
RsFeedTypeFlags mType;
|
||||||
RsPeerId mSslId;
|
RsPeerId mSslId;
|
||||||
std::string mIpAddr;
|
std::string mIpAddr;
|
||||||
std::string mIpAddrReported;
|
std::string mIpAddrReported;
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,7 @@
|
||||||
#include "gui/connect/ConnectFriendWizard.h"
|
#include "gui/connect/ConnectFriendWizard.h"
|
||||||
#include "gui/common/AvatarDefs.h"
|
#include "gui/common/AvatarDefs.h"
|
||||||
#include "util/DateTime.h"
|
#include "util/DateTime.h"
|
||||||
|
#include "util/qtthreadsutils.h"
|
||||||
#include "gui/notifyqt.h"
|
|
||||||
|
|
||||||
#include <retroshare/rsmsgs.h>
|
#include <retroshare/rsmsgs.h>
|
||||||
#include <retroshare/rspeers.h>
|
#include <retroshare/rspeers.h>
|
||||||
|
|
@ -44,7 +43,7 @@
|
||||||
****/
|
****/
|
||||||
|
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
SecurityItem::SecurityItem(FeedHolder *parent, uint32_t feedId, const RsPgpId &gpgId, const RsPeerId &sslId, const std::string &sslCn, const std::string& ip_address,uint32_t type, bool isHome) :
|
SecurityItem::SecurityItem(FeedHolder *parent, uint32_t feedId, const RsPgpId &gpgId, const RsPeerId &sslId, const std::string &sslCn, const std::string& ip_address,RsFeedTypeFlags type, bool isHome) :
|
||||||
FeedItem(parent,feedId,NULL),
|
FeedItem(parent,feedId,NULL),
|
||||||
mGpgId(gpgId), mSslId(sslId), mSslCn(sslCn), mIP(ip_address), mType(type), mIsHome(isHome)
|
mGpgId(gpgId), mSslId(sslId), mSslCn(sslCn), mIP(ip_address), mType(type), mIsHome(isHome)
|
||||||
{
|
{
|
||||||
|
|
@ -72,7 +71,21 @@ SecurityItem::SecurityItem(FeedHolder *parent, uint32_t feedId, const RsPgpId &g
|
||||||
connect( peerDetailsButton, SIGNAL(clicked()), this, SLOT(peerDetails()));
|
connect( peerDetailsButton, SIGNAL(clicked()), this, SLOT(peerDetails()));
|
||||||
connect( friendRequesttoolButton, SIGNAL(clicked()), this, SLOT(friendRequest()));
|
connect( friendRequesttoolButton, SIGNAL(clicked()), this, SLOT(friendRequest()));
|
||||||
|
|
||||||
connect(NotifyQt::getInstance(), SIGNAL(friendsChanged()), this, SLOT(updateItem()));
|
mEventHandlerId = 0;
|
||||||
|
|
||||||
|
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e)
|
||||||
|
{
|
||||||
|
RsQThreadUtils::postToObject([=]()
|
||||||
|
{
|
||||||
|
auto fe = dynamic_cast<const RsFriendListEvent*>(e.get());
|
||||||
|
|
||||||
|
if(!fe)
|
||||||
|
return;
|
||||||
|
|
||||||
|
updateItem();
|
||||||
|
}
|
||||||
|
, this );
|
||||||
|
}, mEventHandlerId, RsEventType::FRIEND_LIST );
|
||||||
|
|
||||||
avatar->setId(ChatId(mSslId));
|
avatar->setId(ChatId(mSslId));
|
||||||
|
|
||||||
|
|
@ -82,9 +95,13 @@ SecurityItem::SecurityItem(FeedHolder *parent, uint32_t feedId, const RsPgpId &g
|
||||||
updateItem();
|
updateItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SecurityItem::~SecurityItem()
|
||||||
|
{
|
||||||
|
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||||
|
}
|
||||||
uint64_t SecurityItem::uniqueIdentifier() const
|
uint64_t SecurityItem::uniqueIdentifier() const
|
||||||
{
|
{
|
||||||
return hash_64bits("SecurityItem " + QString::number(mType).toStdString() + " " + mSslId.toStdString());
|
return hash_64bits("SecurityItem " + QString::number((uint)mType).toStdString() + " " + mSslId.toStdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SecurityItem::updateItemStatic()
|
void SecurityItem::updateItemStatic()
|
||||||
|
|
@ -101,35 +118,35 @@ void SecurityItem::updateItemStatic()
|
||||||
|
|
||||||
switch(mType)
|
switch(mType)
|
||||||
{
|
{
|
||||||
case RS_FEED_ITEM_SEC_CONNECT_ATTEMPT:
|
case RsFeedTypeFlags::RS_FEED_ITEM_SEC_CONNECT_ATTEMPT:
|
||||||
title = tr("Connect Attempt");
|
title = tr("Connect Attempt");
|
||||||
requestLabel->show();
|
requestLabel->show();
|
||||||
avatar->setDefaultAvatar(":images/avatar_request.png");
|
avatar->setDefaultAvatar(":images/avatar_request.png");
|
||||||
break;
|
break;
|
||||||
case RS_FEED_ITEM_SEC_AUTH_DENIED:
|
case RsFeedTypeFlags::RS_FEED_ITEM_SEC_AUTH_DENIED:
|
||||||
title = tr("Connection refused by remote peer");
|
title = tr("Connection refused by remote peer");
|
||||||
requestLabel->hide();
|
requestLabel->hide();
|
||||||
avatar->setDefaultAvatar(":images/avatar_refused.png");
|
avatar->setDefaultAvatar(":images/avatar_refused.png");
|
||||||
break;
|
break;
|
||||||
case RS_FEED_ITEM_SEC_UNKNOWN_IN:
|
case RsFeedTypeFlags::RS_FEED_ITEM_SEC_UNKNOWN_IN:
|
||||||
title = tr("Unknown (Incoming) Connect Attempt");
|
title = tr("Unknown (Incoming) Connect Attempt");
|
||||||
requestLabel->hide();
|
requestLabel->hide();
|
||||||
avatar->setDefaultAvatar(":images/avatar_request_unknown.png");
|
avatar->setDefaultAvatar(":images/avatar_request_unknown.png");
|
||||||
break;
|
break;
|
||||||
case RS_FEED_ITEM_SEC_UNKNOWN_OUT:
|
case RsFeedTypeFlags::RS_FEED_ITEM_SEC_UNKNOWN_OUT:
|
||||||
title = tr("Unknown (Outgoing) Connect Attempt");
|
title = tr("Unknown (Outgoing) Connect Attempt");
|
||||||
requestLabel->hide();
|
requestLabel->hide();
|
||||||
break;
|
break;
|
||||||
case RS_FEED_ITEM_SEC_WRONG_SIGNATURE:
|
case RsFeedTypeFlags::RS_FEED_ITEM_SEC_WRONG_SIGNATURE:
|
||||||
title = tr("Certificate has wrong signature!! This peer is not who he claims to be.");
|
title = tr("Certificate has wrong signature!! This peer is not who he claims to be.");
|
||||||
requestLabel->hide();
|
requestLabel->hide();
|
||||||
break;
|
break;
|
||||||
case RS_FEED_ITEM_SEC_MISSING_CERTIFICATE:
|
case RsFeedTypeFlags::RS_FEED_ITEM_SEC_MISSING_CERTIFICATE:
|
||||||
title = tr("Peer/node not in friendlist (PGP id=")+QString::fromStdString(mGpgId.toStdString())+")";
|
title = tr("Peer/node not in friendlist (PGP id=")+QString::fromStdString(mGpgId.toStdString())+")";
|
||||||
avatar->setDefaultAvatar(":images/avatar_request_unknown.png");
|
avatar->setDefaultAvatar(":images/avatar_request_unknown.png");
|
||||||
requestLabel->show();
|
requestLabel->show();
|
||||||
break;
|
break;
|
||||||
case RS_FEED_ITEM_SEC_BAD_CERTIFICATE:
|
case RsFeedTypeFlags::RS_FEED_ITEM_SEC_BAD_CERTIFICATE:
|
||||||
{
|
{
|
||||||
RsPeerDetails details ;
|
RsPeerDetails details ;
|
||||||
if(rsPeers->getGPGDetails(mGpgId, details))
|
if(rsPeers->getGPGDetails(mGpgId, details))
|
||||||
|
|
@ -140,7 +157,7 @@ void SecurityItem::updateItemStatic()
|
||||||
}
|
}
|
||||||
avatar->setDefaultAvatar(":icons/ssl.png");
|
avatar->setDefaultAvatar(":icons/ssl.png");
|
||||||
break;
|
break;
|
||||||
case RS_FEED_ITEM_SEC_INTERNAL_ERROR:
|
case RsFeedTypeFlags::RS_FEED_ITEM_SEC_INTERNAL_ERROR:
|
||||||
title = tr("Certificate caused an internal error.");
|
title = tr("Certificate caused an internal error.");
|
||||||
requestLabel->hide();
|
requestLabel->hide();
|
||||||
break;
|
break;
|
||||||
|
|
@ -211,7 +228,7 @@ void SecurityItem::updateItem()
|
||||||
removeFriendButton->hide();
|
removeFriendButton->hide();
|
||||||
peerDetailsButton->setEnabled(false);
|
peerDetailsButton->setEnabled(false);
|
||||||
|
|
||||||
if(mType == RS_FEED_ITEM_SEC_BAD_CERTIFICATE)
|
if(mType == RsFeedTypeFlags::RS_FEED_ITEM_SEC_BAD_CERTIFICATE)
|
||||||
{
|
{
|
||||||
peerNameLabel->setText(tr("SSL request"));
|
peerNameLabel->setText(tr("SSL request"));
|
||||||
friendRequesttoolButton->hide();
|
friendRequesttoolButton->hide();
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,8 @@ class SecurityItem : public FeedItem, private Ui::SecurityItem
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** Default Constructor */
|
/** Default Constructor */
|
||||||
SecurityItem(FeedHolder *parent, uint32_t feedId, const RsPgpId &gpgId, const RsPeerId &sslId, const std::string &sslCn, const std::string& ip_addr,uint32_t type, bool isHome);
|
SecurityItem(FeedHolder *parent, uint32_t feedId, const RsPgpId &gpgId, const RsPeerId &sslId, const std::string &sslCn, const std::string& ip_addr,RsFeedTypeFlags type, bool isHome);
|
||||||
|
~SecurityItem();
|
||||||
|
|
||||||
void updateItemStatic();
|
void updateItemStatic();
|
||||||
|
|
||||||
|
|
@ -65,8 +66,10 @@ private:
|
||||||
RsPeerId mSslId;
|
RsPeerId mSslId;
|
||||||
std::string mSslCn;
|
std::string mSslCn;
|
||||||
std::string mIP;
|
std::string mIP;
|
||||||
uint32_t mType;
|
RsFeedTypeFlags mType;
|
||||||
bool mIsHome;
|
bool mIsHome;
|
||||||
|
|
||||||
|
RsEventsHandlerId_t mEventHandlerId;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,9 @@
|
||||||
#include "gui/gxs/GxsGroupShareKey.h"
|
#include "gui/gxs/GxsGroupShareKey.h"
|
||||||
#include "gui/common/GroupTreeWidget.h"
|
#include "gui/common/GroupTreeWidget.h"
|
||||||
#include "gui/common/RSTreeWidget.h"
|
#include "gui/common/RSTreeWidget.h"
|
||||||
#include "gui/notifyqt.h"
|
|
||||||
#include "gui/common/UIStateHelper.h"
|
#include "gui/common/UIStateHelper.h"
|
||||||
#include "gui/common/UserNotify.h"
|
#include "gui/common/UserNotify.h"
|
||||||
|
#include "gui/RsGUIEventManager.h"
|
||||||
#include "util/qtthreadsutils.h"
|
#include "util/qtthreadsutils.h"
|
||||||
#include "retroshare/rsgxsifacetypes.h"
|
#include "retroshare/rsgxsifacetypes.h"
|
||||||
#include "GxsCommentDialog.h"
|
#include "GxsCommentDialog.h"
|
||||||
|
|
@ -173,7 +173,7 @@ void GxsGroupFrameDialog::initUi()
|
||||||
processSettings(true);
|
processSettings(true);
|
||||||
|
|
||||||
if (groupFrameSettingsType() != GroupFrameSettings::Nothing) {
|
if (groupFrameSettingsType() != GroupFrameSettings::Nothing) {
|
||||||
connect(NotifyQt::getInstance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
|
connect(RsGUIEventManager::getInstance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
|
||||||
settingsChanged();
|
settingsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@
|
||||||
#include "gui/gxs/GxsGroupShareKey.h"
|
#include "gui/gxs/GxsGroupShareKey.h"
|
||||||
#include "gui/feeds/GxsChannelPostItem.h"
|
#include "gui/feeds/GxsChannelPostItem.h"
|
||||||
#include "gui/settings/rsharesettings.h"
|
#include "gui/settings/rsharesettings.h"
|
||||||
#include "gui/notifyqt.h"
|
|
||||||
#include "gui/common/GroupTreeWidget.h"
|
#include "gui/common/GroupTreeWidget.h"
|
||||||
#include "util/qtthreadsutils.h"
|
#include "util/qtthreadsutils.h"
|
||||||
#include "util/misc.h"
|
#include "util/misc.h"
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ RsGxsChannelPostsModel::RsGxsChannelPostsModel(QObject *parent)
|
||||||
|
|
||||||
RsGxsChannelPostsModel::~RsGxsChannelPostsModel()
|
RsGxsChannelPostsModel::~RsGxsChannelPostsModel()
|
||||||
{
|
{
|
||||||
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
// rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsGxsChannelPostsModel::setMode(TreeMode mode)
|
void RsGxsChannelPostsModel::setMode(TreeMode mode)
|
||||||
|
|
|
||||||
|
|
@ -256,6 +256,6 @@ private:
|
||||||
QColor mTextColorNotSubscribed ;
|
QColor mTextColorNotSubscribed ;
|
||||||
QColor mTextColorMissing ;
|
QColor mTextColorMissing ;
|
||||||
|
|
||||||
RsEventsHandlerId_t mEventHandlerId ;
|
//RsEventsHandlerId_t mEventHandlerId ;
|
||||||
friend class const_iterator;
|
friend class const_iterator;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -30,12 +30,12 @@
|
||||||
#include "gui/feeds/GxsChannelPostItem.h"
|
#include "gui/feeds/GxsChannelPostItem.h"
|
||||||
#include "gui/gxs/GxsIdDetails.h"
|
#include "gui/gxs/GxsIdDetails.h"
|
||||||
#include "gui/gxs/GxsGroupFrameDialog.h"
|
#include "gui/gxs/GxsGroupFrameDialog.h"
|
||||||
|
#include "gui/RsGUIEventManager.h"
|
||||||
#include "util/misc.h"
|
#include "util/misc.h"
|
||||||
#include "gui/gxschannels/CreateGxsChannelMsg.h"
|
#include "gui/gxschannels/CreateGxsChannelMsg.h"
|
||||||
#include "gui/common/UIStateHelper.h"
|
#include "gui/common/UIStateHelper.h"
|
||||||
#include "gui/settings/rsharesettings.h"
|
#include "gui/settings/rsharesettings.h"
|
||||||
#include "gui/feeds/SubFileItem.h"
|
#include "gui/feeds/SubFileItem.h"
|
||||||
#include "gui/notifyqt.h"
|
|
||||||
#include "gui/RetroShareLink.h"
|
#include "gui/RetroShareLink.h"
|
||||||
#include "util/HandleRichText.h"
|
#include "util/HandleRichText.h"
|
||||||
#include "util/DateTime.h"
|
#include "util/DateTime.h"
|
||||||
|
|
@ -446,7 +446,7 @@ GxsChannelPostsWidgetWithModel::GxsChannelPostsWidgetWithModel(const RsGxsGroupI
|
||||||
/* Connect signals */
|
/* Connect signals */
|
||||||
connect(ui->postButton, SIGNAL(clicked()), this, SLOT(createMsg()));
|
connect(ui->postButton, SIGNAL(clicked()), this, SLOT(createMsg()));
|
||||||
connect(ui->subscribeToolButton, SIGNAL(subscribe(bool)), this, SLOT(subscribeGroup(bool)));
|
connect(ui->subscribeToolButton, SIGNAL(subscribe(bool)), this, SLOT(subscribeGroup(bool)));
|
||||||
connect(NotifyQt::getInstance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
|
connect(RsGUIEventManager::getInstance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
|
||||||
|
|
||||||
ui->postButton->setText(tr("Add new post"));
|
ui->postButton->setText(tr("Add new post"));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@
|
||||||
#include "GxsForumThreadWidget.h"
|
#include "GxsForumThreadWidget.h"
|
||||||
#include "CreateGxsForumMsg.h"
|
#include "CreateGxsForumMsg.h"
|
||||||
#include "GxsForumUserNotify.h"
|
#include "GxsForumUserNotify.h"
|
||||||
#include "gui/notifyqt.h"
|
|
||||||
#include "gui/common/GroupTreeWidget.h"
|
#include "gui/common/GroupTreeWidget.h"
|
||||||
#include "gui/gxs/GxsGroupShareKey.h"
|
#include "gui/gxs/GxsGroupShareKey.h"
|
||||||
#include "util/misc.h"
|
#include "util/misc.h"
|
||||||
|
|
|
||||||
|
|
@ -32,13 +32,13 @@
|
||||||
#include "IMHistoryItemDelegate.h"
|
#include "IMHistoryItemDelegate.h"
|
||||||
#include "IMHistoryItemPainter.h"
|
#include "IMHistoryItemPainter.h"
|
||||||
#include "util/HandleRichText.h"
|
#include "util/HandleRichText.h"
|
||||||
|
#include "util/qtthreadsutils.h"
|
||||||
#include "gui/common/FilesDefs.h"
|
#include "gui/common/FilesDefs.h"
|
||||||
|
|
||||||
#include "rshare.h"
|
#include "rshare.h"
|
||||||
#include <retroshare/rshistory.h>
|
#include <retroshare/rshistory.h>
|
||||||
#include <retroshare/rsidentity.h>
|
#include <retroshare/rsidentity.h>
|
||||||
#include "gui/settings/rsharesettings.h"
|
#include "gui/settings/rsharesettings.h"
|
||||||
#include "gui/notifyqt.h"
|
|
||||||
#include "util/DateTime.h"
|
#include "util/DateTime.h"
|
||||||
|
|
||||||
#define ROLE_MSGID Qt::UserRole
|
#define ROLE_MSGID Qt::UserRole
|
||||||
|
|
@ -101,8 +101,6 @@ ImHistoryBrowser::ImHistoryBrowser(const ChatId &chatId, QTextEdit *edit,const Q
|
||||||
m_chatId = chatId;
|
m_chatId = chatId;
|
||||||
textEdit = edit;
|
textEdit = edit;
|
||||||
|
|
||||||
connect(NotifyQt::getInstance(), SIGNAL(historyChanged(uint, int)), this, SLOT(historyChanged(uint, int)));
|
|
||||||
|
|
||||||
connect(ui.filterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(filterChanged(QString)));
|
connect(ui.filterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(filterChanged(QString)));
|
||||||
|
|
||||||
connect(ui.copyButton, SIGNAL(clicked()), SLOT(copyMessage()));
|
connect(ui.copyButton, SIGNAL(clicked()), SLOT(copyMessage()));
|
||||||
|
|
@ -138,6 +136,22 @@ ImHistoryBrowser::ImHistoryBrowser(const ChatId &chatId, QTextEdit *edit,const Q
|
||||||
connect(m_createThread, SIGNAL(finished()), this, SLOT(createThreadFinished()));
|
connect(m_createThread, SIGNAL(finished()), this, SLOT(createThreadFinished()));
|
||||||
connect(m_createThread, SIGNAL(progress(int,int)), this, SLOT(createThreadProgress(int,int)));
|
connect(m_createThread, SIGNAL(progress(int,int)), this, SLOT(createThreadProgress(int,int)));
|
||||||
m_createThread->start();
|
m_createThread->start();
|
||||||
|
|
||||||
|
mEventHandlerId = 0;
|
||||||
|
|
||||||
|
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event)
|
||||||
|
{
|
||||||
|
RsQThreadUtils::postToObject([=](){
|
||||||
|
|
||||||
|
auto ev = dynamic_cast<const RsChatServiceEvent*>(event.get());
|
||||||
|
|
||||||
|
if(!ev)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(ev->mEventCode == RsChatServiceEventCode::CHAT_HISTORY_CHANGED)
|
||||||
|
historyChanged(ev->mMsgHistoryId,ev->mHistoryChangeType);
|
||||||
|
}, this );
|
||||||
|
}, mEventHandlerId, RsEventType::CHAT_SERVICE );
|
||||||
}
|
}
|
||||||
|
|
||||||
ImHistoryBrowser::~ImHistoryBrowser()
|
ImHistoryBrowser::~ImHistoryBrowser()
|
||||||
|
|
@ -221,9 +235,9 @@ void ImHistoryBrowser::historyAdd(HistoryMsg& msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImHistoryBrowser::historyChanged(uint msgId, int type)
|
void ImHistoryBrowser::historyChanged(uint msgId, RsChatHistoryChangeFlags type)
|
||||||
{
|
{
|
||||||
if (type == NOTIFY_TYPE_ADD) {
|
if (type == RsChatHistoryChangeFlags::ADD) {
|
||||||
/* history message added */
|
/* history message added */
|
||||||
HistoryMsg msg;
|
HistoryMsg msg;
|
||||||
if (rsHistory->getMessage(msgId, msg) == false) {
|
if (rsHistory->getMessage(msgId, msg) == false) {
|
||||||
|
|
@ -237,7 +251,7 @@ void ImHistoryBrowser::historyChanged(uint msgId, int type)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == NOTIFY_TYPE_DEL) {
|
if (type == RsChatHistoryChangeFlags::DEL) {
|
||||||
/* history message removed */
|
/* history message removed */
|
||||||
int count = ui.listWidget->count();
|
int count = ui.listWidget->count();
|
||||||
for (int i = 0; i < count; ++i) {
|
for (int i = 0; i < count; ++i) {
|
||||||
|
|
@ -250,7 +264,7 @@ void ImHistoryBrowser::historyChanged(uint msgId, int type)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == NOTIFY_TYPE_MOD) {
|
if (type == RsChatHistoryChangeFlags::MOD) {
|
||||||
/* clear history */
|
/* clear history */
|
||||||
// As no ChatId nor msgId are send via Notify,
|
// As no ChatId nor msgId are send via Notify,
|
||||||
// only check if history of this chat is empty before clear our list.
|
// only check if history of this chat is empty before clear our list.
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ private slots:
|
||||||
void createThreadFinished();
|
void createThreadFinished();
|
||||||
void createThreadProgress(int current, int count);
|
void createThreadProgress(int current, int count);
|
||||||
|
|
||||||
void historyChanged(uint msgId, int type);
|
void historyChanged(uint msgId, RsChatHistoryChangeFlags type);
|
||||||
|
|
||||||
void filterChanged(const QString& text);
|
void filterChanged(const QString& text);
|
||||||
|
|
||||||
|
|
@ -86,6 +86,7 @@ private:
|
||||||
|
|
||||||
/** Qt Designer generated object */
|
/** Qt Designer generated object */
|
||||||
Ui::ImHistoryBrowser ui;
|
Ui::ImHistoryBrowser ui;
|
||||||
|
RsEventsHandlerId_t mEventHandlerId;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ImHistoryBrowserCreateItemsThread : public QThread
|
class ImHistoryBrowserCreateItemsThread : public QThread
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,6 @@
|
||||||
#include <retroshare/rsgxschannels.h>
|
#include <retroshare/rsgxschannels.h>
|
||||||
#include <retroshare/rsgxsforums.h>
|
#include <retroshare/rsgxsforums.h>
|
||||||
|
|
||||||
#include "gui/notifyqt.h"
|
|
||||||
#include "gui/common/RSTreeWidgetItem.h"
|
#include "gui/common/RSTreeWidgetItem.h"
|
||||||
#include "gui/common/GroupDefs.h"
|
#include "gui/common/GroupDefs.h"
|
||||||
#include "gui/common/StatusDefs.h"
|
#include "gui/common/StatusDefs.h"
|
||||||
|
|
@ -66,6 +65,7 @@
|
||||||
#include "util/misc.h"
|
#include "util/misc.h"
|
||||||
#include "util/DateTime.h"
|
#include "util/DateTime.h"
|
||||||
#include "util/HandleRichText.h"
|
#include "util/HandleRichText.h"
|
||||||
|
#include "util/qtthreadsutils.h"
|
||||||
#include "util/RsQtVersion.h"
|
#include "util/RsQtVersion.h"
|
||||||
#include "textformat.h"
|
#include "textformat.h"
|
||||||
#include "TagsMenu.h"
|
#include "TagsMenu.h"
|
||||||
|
|
@ -215,7 +215,19 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WindowFlags flags)
|
||||||
connect(ui.addBccButton, SIGNAL(clicked()), this, SLOT(addBcc()));
|
connect(ui.addBccButton, SIGNAL(clicked()), this, SLOT(addBcc()));
|
||||||
connect(ui.addRecommendButton, SIGNAL(clicked()), this, SLOT(addRecommend()));
|
connect(ui.addRecommendButton, SIGNAL(clicked()), this, SLOT(addRecommend()));
|
||||||
|
|
||||||
connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(QString,int)), this, SLOT(peerStatusChanged(QString,int)));
|
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e)
|
||||||
|
{
|
||||||
|
RsQThreadUtils::postToObject([=](){
|
||||||
|
auto fe = dynamic_cast<const RsFriendListEvent*>(e.get());
|
||||||
|
|
||||||
|
if(!fe || fe->mEventCode != RsFriendListEventCode::NODE_STATUS_CHANGED)
|
||||||
|
return;
|
||||||
|
|
||||||
|
peerStatusChanged(QString::fromStdString(fe->mSslId.toStdString()),fe->mStatus);
|
||||||
|
|
||||||
|
}, this );
|
||||||
|
},mEventHandlerId,RsEventType::FRIEND_LIST);
|
||||||
|
|
||||||
connect(ui.friendSelectionWidget, SIGNAL(contentChanged()), this, SLOT(buildCompleter()));
|
connect(ui.friendSelectionWidget, SIGNAL(contentChanged()), this, SLOT(buildCompleter()));
|
||||||
connect(ui.friendSelectionWidget, SIGNAL(doubleClicked(int,QString)), this, SLOT(addTo()));
|
connect(ui.friendSelectionWidget, SIGNAL(doubleClicked(int,QString)), this, SLOT(addTo()));
|
||||||
connect(ui.friendSelectionWidget, SIGNAL(itemSelectionChanged()), this, SLOT(friendSelectionChanged()));
|
connect(ui.friendSelectionWidget, SIGNAL(itemSelectionChanged()), this, SLOT(friendSelectionChanged()));
|
||||||
|
|
@ -421,6 +433,7 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WindowFlags flags)
|
||||||
|
|
||||||
MessageComposer::~MessageComposer()
|
MessageComposer::~MessageComposer()
|
||||||
{
|
{
|
||||||
|
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||||
delete(m_compareRole);
|
delete(m_compareRole);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -812,7 +825,7 @@ void MessageComposer::buildCompleter()
|
||||||
setNewCompleter(ui.recipientWidget, m_completer);
|
setNewCompleter(ui.recipientWidget, m_completer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageComposer::peerStatusChanged(const QString& peer_id, int status)
|
void MessageComposer::peerStatusChanged(const QString& peer_id, RsStatusValue status)
|
||||||
{
|
{
|
||||||
int rowCount = ui.recipientWidget->rowCount();
|
int rowCount = ui.recipientWidget->rowCount();
|
||||||
int row;
|
int row;
|
||||||
|
|
|
||||||
|
|
@ -157,7 +157,7 @@ private slots:
|
||||||
void editingRecipientFinished();
|
void editingRecipientFinished();
|
||||||
void contactDetails();
|
void contactDetails();
|
||||||
|
|
||||||
void peerStatusChanged(const QString& peer_id, int status);
|
void peerStatusChanged(const QString& peer_id, RsStatusValue status);
|
||||||
void friendSelectionChanged();
|
void friendSelectionChanged();
|
||||||
|
|
||||||
void tagAboutToShow();
|
void tagAboutToShow();
|
||||||
|
|
@ -274,6 +274,7 @@ private:
|
||||||
Ui::MessageComposer ui;
|
Ui::MessageComposer ui;
|
||||||
|
|
||||||
std::list<FileInfo> _recList ;
|
std::list<FileInfo> _recList ;
|
||||||
|
RsEventsHandlerId_t mEventHandlerId;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@
|
||||||
|
|
||||||
#include "gui/common/FilesDefs.h"
|
#include "gui/common/FilesDefs.h"
|
||||||
#include "MessageUserNotify.h"
|
#include "MessageUserNotify.h"
|
||||||
#include "gui/notifyqt.h"
|
|
||||||
#include "gui/MainWindow.h"
|
#include "gui/MainWindow.h"
|
||||||
#include "util/qtthreadsutils.h"
|
#include "util/qtthreadsutils.h"
|
||||||
#include "gui/settings/rsharesettings.h"
|
#include "gui/settings/rsharesettings.h"
|
||||||
|
|
@ -97,12 +96,7 @@ void MessageUserNotify::handleEvent_main_thread(std::shared_ptr<const RsEvent> e
|
||||||
switch (fe->mMailStatusEventCode)
|
switch (fe->mMailStatusEventCode)
|
||||||
{
|
{
|
||||||
case RsMailStatusEventCode::NEW_MESSAGE:
|
case RsMailStatusEventCode::NEW_MESSAGE:
|
||||||
for (it = fe->mChangedMsgIds.begin(); it != fe->mChangedMsgIds.end(); ++it) {
|
|
||||||
MessageInfo msgInfo;
|
|
||||||
if (rsMail->getMessage(*it, msgInfo)) {
|
|
||||||
NotifyQt::getInstance()->addToaster(RS_POPUP_MSG, msgInfo.msgId.c_str(), msgInfo.title.c_str(), msgInfo.msg.c_str() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
updateIcon();
|
updateIcon();
|
||||||
break;
|
break;
|
||||||
case RsMailStatusEventCode::MESSAGE_CHANGED:
|
case RsMailStatusEventCode::MESSAGE_CHANGED:
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,6 @@
|
||||||
#include <QPlainTextEdit>
|
#include <QPlainTextEdit>
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
#include "gui/notifyqt.h"
|
|
||||||
#include "gui/RetroShareLink.h"
|
#include "gui/RetroShareLink.h"
|
||||||
#include "gui/common/TagDefs.h"
|
#include "gui/common/TagDefs.h"
|
||||||
#include "gui/common/PeerDefs.h"
|
#include "gui/common/PeerDefs.h"
|
||||||
|
|
@ -261,7 +260,9 @@ void MessageWidget::handleEvent_main_thread(std::shared_ptr<const RsEvent> event
|
||||||
case RsMailStatusEventCode::MESSAGE_RECEIVED_ACK:
|
case RsMailStatusEventCode::MESSAGE_RECEIVED_ACK:
|
||||||
case RsMailStatusEventCode::SIGNATURE_FAILED:
|
case RsMailStatusEventCode::SIGNATURE_FAILED:
|
||||||
break;
|
break;
|
||||||
}
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageWidget::connectAction(enumActionType actionType, QToolButton* button)
|
void MessageWidget::connectAction(enumActionType actionType, QToolButton* button)
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@
|
||||||
|
|
||||||
#include "MessagesDialog.h"
|
#include "MessagesDialog.h"
|
||||||
|
|
||||||
#include "gui/notifyqt.h"
|
|
||||||
#include "gui/common/TagDefs.h"
|
#include "gui/common/TagDefs.h"
|
||||||
#include "gui/common/PeerDefs.h"
|
#include "gui/common/PeerDefs.h"
|
||||||
#include "gui/common/RSElidedItemDelegate.h"
|
#include "gui/common/RSElidedItemDelegate.h"
|
||||||
|
|
@ -309,7 +308,7 @@ MessagesDialog::MessagesDialog(QWidget *parent)
|
||||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) { RsQThreadUtils::postToObject( [this,event]() { handleEvent_main_thread(event); }); }, mEventHandlerId, RsEventType::MAIL_STATUS );
|
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) { RsQThreadUtils::postToObject( [this,event]() { handleEvent_main_thread(event); }); }, mEventHandlerId, RsEventType::MAIL_STATUS );
|
||||||
|
|
||||||
mTagEventHandlerId = 0;
|
mTagEventHandlerId = 0;
|
||||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) { RsQThreadUtils::postToObject( [this,event]() { handleTagEvent_main_thread(event); }); }, mEventHandlerId, RsEventType::MAIL_TAG );
|
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) { RsQThreadUtils::postToObject( [this,event]() { handleTagEvent_main_thread(event); }); }, mTagEventHandlerId, RsEventType::MAIL_TAG );
|
||||||
|
|
||||||
mFontSizeHandler.registerFontSize(ui.listWidget, 1.5f, [this] (QAbstractItemView*, int fontSize) {
|
mFontSizeHandler.registerFontSize(ui.listWidget, 1.5f, [this] (QAbstractItemView*, int fontSize) {
|
||||||
// Set new font size on all items
|
// Set new font size on all items
|
||||||
|
|
@ -351,6 +350,8 @@ void MessagesDialog::handleEvent_main_thread(std::shared_ptr<const RsEvent> even
|
||||||
case RsMailStatusEventCode::MESSAGE_RECEIVED_ACK:
|
case RsMailStatusEventCode::MESSAGE_RECEIVED_ACK:
|
||||||
case RsMailStatusEventCode::SIGNATURE_FAILED:
|
case RsMailStatusEventCode::SIGNATURE_FAILED:
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1088,11 +1089,13 @@ void MessagesDialog::doubleClicked(const QModelIndex& proxy_index)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* edit message */
|
/* edit message */
|
||||||
switch (Settings->getMsgOpen()) {
|
switch (Settings->getMsgOpen())
|
||||||
case RshareSettings::MSG_OPEN_TAB:
|
{
|
||||||
|
default:
|
||||||
|
case RsSettingsMsgOptions::MSG_OPEN_TAB:
|
||||||
openAsTab();
|
openAsTab();
|
||||||
break;
|
break;
|
||||||
case RshareSettings::MSG_OPEN_WINDOW:
|
case RsSettingsMsgOptions::MSG_OPEN_WINDOW:
|
||||||
openAsWindow();
|
openAsWindow();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@
|
||||||
#include "TagsMenu.h"
|
#include "TagsMenu.h"
|
||||||
#include "gui/common/TagDefs.h"
|
#include "gui/common/TagDefs.h"
|
||||||
#include "gui/settings/NewTag.h"
|
#include "gui/settings/NewTag.h"
|
||||||
#include "gui/notifyqt.h"
|
|
||||||
#include "util/qtthreadsutils.h"
|
#include "util/qtthreadsutils.h"
|
||||||
|
|
||||||
#include "gui/msgs/MessageInterface.h"
|
#include "gui/msgs/MessageInterface.h"
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue