mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
fixed merge
This commit is contained in:
commit
c81bdd9932
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -32,3 +32,6 @@
|
||||
path = libretroshare
|
||||
url = ../libretroshare
|
||||
branch = master
|
||||
[submodule "retroshare-webui"]
|
||||
path = retroshare-webui
|
||||
url = git@github.com:Retroshare/RSNewWebUI
|
||||
|
@ -68,6 +68,13 @@ retroshare_plugins {
|
||||
plugins.target = plugins
|
||||
}
|
||||
|
||||
rs_webui {
|
||||
SUBDIRS += retroshare-webui
|
||||
retroshare-webui.file = retroshare-webui/webui.pro
|
||||
retroshare-webui.target = rs_webui
|
||||
retroshare-webui.depends = retroshare_gui
|
||||
}
|
||||
|
||||
wikipoos {
|
||||
SUBDIRS += pegmarkdown
|
||||
pegmarkdown.file = supportlibs/pegmarkdown/pegmarkdown.pro
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 2ddc86fb575a61170f4c06a00152e3e7dc74c8f4
|
||||
Subproject commit 659423769541169457c41f71c8a038e2d64ba079
|
@ -1 +1 @@
|
||||
Subproject commit a9d4447c5660337b4f7945d20e0f4ffd68d918e9
|
||||
Subproject commit 74cd958cf8a3c8b3e2d3f8a22657b5e16bdad476
|
@ -358,7 +358,7 @@ void CreateCircleDialog::addMember(const QString& keyId, const QString& idtype,
|
||||
|
||||
tree->addTopLevelItem(member);
|
||||
|
||||
ui.members_groupBox->setTitle( tr("Invited Members") + " (" + QString::number(ui.treeWidget_membership->topLevelItemCount()) + ")" );
|
||||
updateMembership();
|
||||
}
|
||||
|
||||
/** Maybe we can use RsGxsCircleGroup instead of RsGxsCircleDetails ??? (TODO)**/
|
||||
@ -413,6 +413,8 @@ void CreateCircleDialog::removeMember()
|
||||
|
||||
// does this just work? (TODO)
|
||||
delete(item);
|
||||
|
||||
updateMembership();
|
||||
}
|
||||
|
||||
void CreateCircleDialog::createCircle()
|
||||
@ -952,3 +954,8 @@ void CreateCircleDialog::MembershipListCustomPopupMenu( QPoint )
|
||||
contextMnu.exec(QCursor::pos());
|
||||
}
|
||||
|
||||
void CreateCircleDialog::updateMembership()
|
||||
{
|
||||
ui.members_groupBox->setTitle( tr("Invited Members") + " (" + QString::number(ui.treeWidget_membership->topLevelItemCount()) + ")" );
|
||||
}
|
||||
|
||||
|
@ -56,6 +56,7 @@ private slots:
|
||||
void filterChanged(const QString &text);
|
||||
void createNewGxsId();
|
||||
void idTypeChanged();
|
||||
void updateMembership();
|
||||
|
||||
/** Create the context popup menu and it's submenus */
|
||||
void IdListCustomPopupMenu( QPoint point );
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "TransfersDialog.h"
|
||||
|
||||
#include "gui/notifyqt.h"
|
||||
#include "gui/SoundManager.h"
|
||||
#include "gui/RetroShareLink.h"
|
||||
#include "gui/common/FilesDefs.h"
|
||||
#include "gui/common/RsCollection.h"
|
||||
@ -1110,9 +1111,16 @@ void TransfersDialog::handleEvent_main_thread(std::shared_ptr<const RsEvent> eve
|
||||
if(!fe)
|
||||
return;
|
||||
|
||||
FileInfo nfo ;
|
||||
if(!rsFiles->FileDetails(fe->mHash, RS_FILE_HINTS_DOWNLOAD, nfo))
|
||||
return ;
|
||||
|
||||
switch (fe->mFileTransferEventCode)
|
||||
{
|
||||
case RsFileTransferEventCode::DOWNLOAD_COMPLETE:
|
||||
SoundManager::play(SOUND_DOWNLOAD_COMPLETE);
|
||||
if (Settings->getNotifyFlags() & RS_POPUP_DOWNLOAD)
|
||||
NotifyQt::getInstance()->addToaster(RS_POPUP_DOWNLOAD, fe->mHash.toStdString(), nfo.fname.c_str(),"");
|
||||
case RsFileTransferEventCode::COMPLETED_FILES_REMOVED:
|
||||
|
||||
getUserNotify()->updateIcon();
|
||||
|
@ -1628,6 +1628,11 @@ NATStatus *MainWindow::natstatusInstance()
|
||||
return natstatus;
|
||||
}
|
||||
|
||||
void MainWindow::torstatusReset()
|
||||
{
|
||||
if(torstatus != nullptr)
|
||||
torstatus->reset();
|
||||
}
|
||||
DHTStatus *MainWindow::dhtstatusInstance()
|
||||
{
|
||||
return dhtstatus;
|
||||
|
@ -187,6 +187,7 @@ public:
|
||||
RSComboBox *statusComboBoxInstance();
|
||||
PeerStatus *peerstatusInstance();
|
||||
NATStatus *natstatusInstance();
|
||||
void torstatusReset();
|
||||
DHTStatus *dhtstatusInstance();
|
||||
HashingStatus *hashingstatusInstance();
|
||||
DiscStatus *discstatusInstance();
|
||||
|
@ -441,6 +441,8 @@ void NewsFeed::handleConnectionEvent(std::shared_ptr<const RsEvent> event)
|
||||
{
|
||||
case RsConnectionEventCode::PEER_CONNECTED:
|
||||
addFeedItemIfUnique(new PeerItem(this, NEWSFEED_PEERLIST, e.mSslId, PEER_TYPE_CONNECT, false), true);
|
||||
if (Settings->getNotifyFlags() & RS_POPUP_CONNECT)
|
||||
NotifyQt::getInstance()->addToaster(RS_POPUP_CONNECT, e.mSslId.toStdString().c_str(), "", "");
|
||||
break;
|
||||
case RsConnectionEventCode::PEER_DISCONNECTED: // not handled yet
|
||||
break;
|
||||
@ -477,6 +479,7 @@ void NewsFeed::handleSecurityEvent(std::shared_ptr<const RsEvent> event)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
uint32_t FeedItemType=0;
|
||||
|
||||
switch(e.mErrorCode)
|
||||
@ -504,6 +507,9 @@ void NewsFeed::handleSecurityEvent(std::shared_ptr<const RsEvent> event)
|
||||
|
||||
if (Settings->getMessageFlags() & RS_MESSAGE_CONNECT_ATTEMPT)
|
||||
MessageComposer::addConnectAttemptMsg(e.mPgpId, e.mSslId, QString::fromStdString(det.name + "(" + det.location + ")"));
|
||||
|
||||
if (Settings->getNotifyFlags() & RS_POPUP_CONNECT_ATTEMPT)
|
||||
NotifyQt::getInstance()->addToaster(RS_POPUP_CONNECT_ATTEMPT, e.mPgpId.toStdString().c_str(), det.location, e.mSslId.toStdString().c_str());
|
||||
}
|
||||
|
||||
void NewsFeed::testFeeds(uint /*notifyFlags*/)
|
||||
|
@ -29,10 +29,10 @@ PulseMessage::PulseMessage(QWidget *parent)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
connect(label_image1, SIGNAL(clicked()), this, SLOT(viewPicture()));
|
||||
connect(label_image2, SIGNAL(clicked()), this, SLOT(viewPicture()));
|
||||
connect(label_image3, SIGNAL(clicked()), this, SLOT(viewPicture()));
|
||||
connect(label_image4, SIGNAL(clicked()), this, SLOT(viewPicture()));
|
||||
connect(label_image1, SIGNAL(clicked()), this, SLOT(viewPictureOne()));
|
||||
connect(label_image2, SIGNAL(clicked()), this, SLOT(viewPictureTwo()));
|
||||
connect(label_image3, SIGNAL(clicked()), this, SLOT(viewPictureThree()));
|
||||
connect(label_image4, SIGNAL(clicked()), this, SLOT(viewPictureFour()));
|
||||
}
|
||||
|
||||
void PulseMessage::setup(RsWirePulseSPtr pulse)
|
||||
@ -148,7 +148,7 @@ void PulseMessage::setRefImageCount(uint32_t count)
|
||||
}
|
||||
}
|
||||
|
||||
void PulseMessage::viewPicture()
|
||||
void PulseMessage::viewPictureOne()
|
||||
{
|
||||
PhotoView *photoView = new PhotoView(this);
|
||||
|
||||
@ -159,6 +159,22 @@ void PulseMessage::viewPicture()
|
||||
photoView->setPixmap(pixmap);
|
||||
}
|
||||
|
||||
QString timestamp = misc::timeRelativeToNow(mPulse->mRefPublishTs);
|
||||
|
||||
photoView->setTitle(QString::fromStdString(mPulse->mPulseText));
|
||||
photoView->setGroupNameString(QString::fromStdString(mPulse->mRefGroupName));
|
||||
photoView->setTime(timestamp);
|
||||
//photoView->setGroupId(mPulse->mRefGroupId);
|
||||
|
||||
photoView->show();
|
||||
|
||||
/* window will destroy itself! */
|
||||
}
|
||||
|
||||
void PulseMessage::viewPictureTwo()
|
||||
{
|
||||
PhotoView *photoView = new PhotoView(this);
|
||||
|
||||
if (!mPulse->mImage2.empty()) {
|
||||
// install image.
|
||||
QPixmap pixmap;
|
||||
@ -166,6 +182,22 @@ void PulseMessage::viewPicture()
|
||||
photoView->setPixmap(pixmap);
|
||||
}
|
||||
|
||||
QString timestamp = misc::timeRelativeToNow(mPulse->mRefPublishTs);
|
||||
|
||||
photoView->setTitle(QString::fromStdString(mPulse->mPulseText));
|
||||
photoView->setGroupNameString(QString::fromStdString(mPulse->mRefGroupName));
|
||||
photoView->setTime(timestamp);
|
||||
//photoView->setGroupId(mPulse->mRefGroupId);
|
||||
|
||||
photoView->show();
|
||||
|
||||
/* window will destroy itself! */
|
||||
}
|
||||
|
||||
void PulseMessage::viewPictureThree()
|
||||
{
|
||||
PhotoView *photoView = new PhotoView(this);
|
||||
|
||||
if (!mPulse->mImage3.empty()) {
|
||||
// install image.
|
||||
QPixmap pixmap;
|
||||
@ -173,6 +205,22 @@ void PulseMessage::viewPicture()
|
||||
photoView->setPixmap(pixmap);
|
||||
}
|
||||
|
||||
QString timestamp = misc::timeRelativeToNow(mPulse->mRefPublishTs);
|
||||
|
||||
photoView->setTitle(QString::fromStdString(mPulse->mPulseText));
|
||||
photoView->setGroupNameString(QString::fromStdString(mPulse->mRefGroupName));
|
||||
photoView->setTime(timestamp);
|
||||
//photoView->setGroupId(mPulse->mRefGroupId);
|
||||
|
||||
photoView->show();
|
||||
|
||||
/* window will destroy itself! */
|
||||
}
|
||||
|
||||
void PulseMessage::viewPictureFour()
|
||||
{
|
||||
PhotoView *photoView = new PhotoView(this);
|
||||
|
||||
if (!mPulse->mImage4.empty()) {
|
||||
// install image.
|
||||
QPixmap pixmap;
|
||||
|
@ -37,7 +37,10 @@ public:
|
||||
void setRefImageCount(uint32_t count);
|
||||
|
||||
private slots:
|
||||
void viewPicture();
|
||||
void viewPictureOne();
|
||||
void viewPictureTwo();
|
||||
void viewPictureThree();
|
||||
void viewPictureFour();
|
||||
|
||||
private:
|
||||
RsWirePulseSPtr mPulse;
|
||||
|
@ -51,7 +51,7 @@ static QHash<QString, QPixmap> iconcache;
|
||||
void Emoticons::load()
|
||||
{
|
||||
loadSmiley();
|
||||
filters << "*.png" << "*.jpg" << "*.gif" << "*.webp";
|
||||
filters << "*.png" << "*.jpg" << "*.jpeg" << "*.gif" << "*.webp";
|
||||
stickerFolders << (QString::fromStdString(RsAccounts::AccountDirectory()) + "/stickers"); //under account, unique for user
|
||||
stickerFolders << (QString::fromStdString(RsAccounts::ConfigDirectory()) + "/stickers"); //under .retroshare, shared between users
|
||||
stickerFolders << (QString::fromStdString(RsAccounts::systemDataDirectory()) + "/stickers"); //exe's folder, shipped with RS
|
||||
|
@ -33,11 +33,11 @@
|
||||
|
||||
#include "GxsChannelPostFilesModel.h"
|
||||
|
||||
//#define DEBUG_CHANNEL_MODEL
|
||||
//#define DEBUG_CHANNEL_FILES_MODEL
|
||||
|
||||
Q_DECLARE_METATYPE(ChannelPostFileInfo)
|
||||
|
||||
#ifdef DEBUG_CHANNEL_MODEL
|
||||
#ifdef DEBUG_CHANNEL_FILES_MODEL
|
||||
static std::ostream& operator<<(std::ostream& o, const QModelIndex& i);// defined elsewhere
|
||||
#endif
|
||||
|
||||
@ -161,8 +161,8 @@ QModelIndex RsGxsChannelPostFilesModel::index(int row, int column, const QModelI
|
||||
|
||||
quintptr ref = getChildRef(parent.internalId(),row);
|
||||
|
||||
#ifdef DEBUG_CHANNEL_MODEL
|
||||
std::cerr << "index-3(" << row << "," << column << " parent=" << parent << ") : " << createIndex(row,column,ref) << std::endl;
|
||||
#ifdef DEBUG_CHANNEL_FILES_MODEL
|
||||
RsDbg() << "index-3(" << row << "," << column << " parent=" << parent << ") : " << createIndex(row,column,ref) ;
|
||||
#endif
|
||||
return createIndex(row,column,ref) ;
|
||||
}
|
||||
@ -242,7 +242,7 @@ QVariant RsGxsChannelPostFilesModel::headerData(int section, Qt::Orientation /*o
|
||||
|
||||
QVariant RsGxsChannelPostFilesModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
#ifdef DEBUG_CHANNEL_MODEL
|
||||
#ifdef DEBUG_CHANNEL_FILES_MODEL
|
||||
std::cerr << "calling data(" << index << ") role=" << role << std::endl;
|
||||
#endif
|
||||
|
||||
@ -259,13 +259,13 @@ QVariant RsGxsChannelPostFilesModel::data(const QModelIndex &index, int role) co
|
||||
quintptr ref = (index.isValid())?index.internalId():0 ;
|
||||
uint32_t entry = 0;
|
||||
|
||||
#ifdef DEBUG_CHANNEL_MODEL
|
||||
#ifdef DEBUG_CHANNEL_FILES_MODEL
|
||||
std::cerr << "data(" << index << ")" ;
|
||||
#endif
|
||||
|
||||
if(!ref)
|
||||
{
|
||||
#ifdef DEBUG_CHANNEL_MODEL
|
||||
#ifdef DEBUG_CHANNEL_FILES_MODEL
|
||||
std::cerr << " [empty]" << std::endl;
|
||||
#endif
|
||||
return QVariant() ;
|
||||
@ -273,7 +273,7 @@ QVariant RsGxsChannelPostFilesModel::data(const QModelIndex &index, int role) co
|
||||
|
||||
if(!convertRefPointerToTabEntry(ref,entry) || entry >= mFilteredFiles.size())
|
||||
{
|
||||
#ifdef DEBUG_CHANNEL_MODEL
|
||||
#ifdef DEBUG_CHANNEL_FILES_MODEL
|
||||
std::cerr << "Bad pointer: " << (void*)ref << std::endl;
|
||||
#endif
|
||||
return QVariant() ;
|
||||
@ -426,7 +426,6 @@ QVariant RsGxsChannelPostFilesModel::userRole(const ChannelPostFileInfo& fmpe,in
|
||||
|
||||
void RsGxsChannelPostFilesModel::clear()
|
||||
{
|
||||
|
||||
initEmptyHierarchy();
|
||||
|
||||
emit channelLoaded();
|
||||
@ -444,7 +443,7 @@ void RsGxsChannelPostFilesModel::setFiles(const std::list<ChannelPostFileInfo> &
|
||||
for(uint32_t i=0;i<mFiles.size();++i)
|
||||
mFilteredFiles.push_back(i);
|
||||
|
||||
#ifdef DEBUG_CHANNEL_MODEL
|
||||
#ifdef DEBUG_CHANNEL_FILES_MODEL
|
||||
// debug_dump();
|
||||
#endif
|
||||
|
||||
@ -463,3 +462,61 @@ void RsGxsChannelPostFilesModel::setFiles(const std::list<ChannelPostFileInfo> &
|
||||
|
||||
postMods();
|
||||
}
|
||||
|
||||
void RsGxsChannelPostFilesModel::update_files(std::set<ChannelPostFileInfo>& added_files,std::set<ChannelPostFileInfo>& removed_files)
|
||||
{
|
||||
// 1 - remove common files from both lists
|
||||
|
||||
#ifdef DEBUG_CHANNEL_FILES_MODEL
|
||||
RsDbg() << "RsGxsChannelPostsFilesModel:: updating files." ;
|
||||
#endif
|
||||
|
||||
for(auto afit=added_files.begin();afit!=added_files.end();)
|
||||
{
|
||||
auto rfit = removed_files.find(*afit);
|
||||
|
||||
if(rfit != removed_files.end())
|
||||
{
|
||||
#ifdef DEBUG_CHANNEL_FILES_MODEL
|
||||
RsDbg() << " Eliminating common file " << rfit->mName ;
|
||||
#endif
|
||||
removed_files.erase(rfit);
|
||||
auto tmp = afit;
|
||||
++tmp;
|
||||
added_files.erase(afit);
|
||||
afit = tmp;
|
||||
}
|
||||
else
|
||||
++afit;
|
||||
}
|
||||
|
||||
RsDbg() << " Remains: " << added_files.size() << " added files and " << removed_files.size() << " removed files" ;
|
||||
|
||||
// 2 - add whatever file remains,
|
||||
|
||||
for(const auto& f:removed_files)
|
||||
{
|
||||
#ifdef DEBUG_CHANNEL_FILES_MODEL
|
||||
RsDbg() << " Removing deleted file " << f.mName ;
|
||||
#endif
|
||||
|
||||
for(uint32_t i=0;i<mFiles.size();++i)
|
||||
if(mFiles[i].mHash == f.mHash)
|
||||
{
|
||||
mFiles[i] = mFiles.back();
|
||||
mFiles.pop_back();
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 3 - add other files. We do not check that they are duplicates, because the list of files includes duplicates.
|
||||
|
||||
for(const auto& f:added_files )
|
||||
{
|
||||
#ifdef DEBUG_CHANNEL_FILES_MODEL
|
||||
RsDbg() << " Adding new file " << f.mName ;
|
||||
#endif
|
||||
mFilteredFiles.push_back(mFiles.size());
|
||||
mFiles.push_back(f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ struct ChannelPostFileInfo: public RsGxsFile
|
||||
|
||||
ChannelPostFileInfo() : mPublishTime(0) {}
|
||||
|
||||
rstime_t mPublishTime;
|
||||
rstime_t mPublishTime; // related post publish time
|
||||
};
|
||||
|
||||
// This class is the item model used by Qt to display the information
|
||||
@ -83,6 +83,9 @@ public:
|
||||
void setFiles(const std::list<ChannelPostFileInfo>& files);
|
||||
void setFilter(const QStringList &strings, uint32_t &count) ;
|
||||
|
||||
// This method adds/removes the given lists of files. Useful when a single post is updated
|
||||
void update_files(std::set<ChannelPostFileInfo> &added_files, std::set<ChannelPostFileInfo> &removed_files);
|
||||
|
||||
#ifdef TODO
|
||||
QModelIndex getIndexOfFile(const RsFileHash& hash) const;
|
||||
void setSortMode(SortMode mode) ;
|
||||
|
@ -35,10 +35,10 @@
|
||||
#include "GxsChannelPostsModel.h"
|
||||
#include "GxsChannelPostFilesModel.h"
|
||||
|
||||
#define DEBUG_CHANNEL_MODEL
|
||||
//#define DEBUG_CHANNEL_MODEL_DATA
|
||||
//#define DEBUG_CHANNEL_MODEL
|
||||
|
||||
Q_DECLARE_METATYPE(RsMsgMetaData)
|
||||
|
||||
Q_DECLARE_METATYPE(RsGxsChannelPost)
|
||||
|
||||
std::ostream& operator<<(std::ostream& o, const QModelIndex& i);// defined elsewhere
|
||||
@ -47,14 +47,6 @@ RsGxsChannelPostsModel::RsGxsChannelPostsModel(QObject *parent)
|
||||
: QAbstractItemModel(parent), mTreeMode(RsGxsChannelPostsModel::TREE_MODE_GRID), mColumns(6)
|
||||
{
|
||||
initEmptyHierarchy();
|
||||
|
||||
mEventHandlerId = 0;
|
||||
// Needs to be asynced because this function is called by another thread!
|
||||
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event)
|
||||
{
|
||||
RsQThreadUtils::postToObject([=](){ handleEvent_main_thread(event); }, this );
|
||||
}, mEventHandlerId, RsEventType::GXS_CHANNELS );
|
||||
}
|
||||
|
||||
RsGxsChannelPostsModel::~RsGxsChannelPostsModel()
|
||||
@ -72,7 +64,7 @@ void RsGxsChannelPostsModel::setMode(TreeMode mode)
|
||||
triggerViewUpdate();
|
||||
}
|
||||
|
||||
void updateCommentCounts( std::vector<RsGxsChannelPost>& posts, std::vector<RsGxsComment>& comments)
|
||||
void RsGxsChannelPostsModel::computeCommentCounts( std::vector<RsGxsChannelPost>& posts, std::vector<RsGxsComment>& comments)
|
||||
{
|
||||
// Store posts IDs in a std::map to avoid a quadratic cost
|
||||
|
||||
@ -108,99 +100,6 @@ void updateCommentCounts( std::vector<RsGxsChannelPost>& posts, std::vector<RsGx
|
||||
}
|
||||
|
||||
|
||||
void RsGxsChannelPostsModel::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)
|
||||
{
|
||||
const RsGxsChannelEvent *e = dynamic_cast<const RsGxsChannelEvent*>(event.get());
|
||||
|
||||
if(!e)
|
||||
return;
|
||||
|
||||
switch(e->mChannelEventCode)
|
||||
{
|
||||
case RsChannelEventCode::UPDATED_MESSAGE:
|
||||
case RsChannelEventCode::READ_STATUS_CHANGED:
|
||||
{
|
||||
// Normally we should just emit dataChanged() on the index of the data that has changed:
|
||||
// We need to update the data!
|
||||
|
||||
// make a copy of e, so as to avoid destruction of the shared pointer during async thread execution, since [e] doesn't actually tell
|
||||
// the original shared_ptr that it is copied! So no counter is updated in event, which will be destroyed (as e will be) during or even before
|
||||
// the execution of the lambda.
|
||||
|
||||
RsGxsChannelEvent E(*e);
|
||||
|
||||
if(E.mChannelGroupId == mChannelGroup.mMeta.mGroupId)
|
||||
RsThread::async([this, E]()
|
||||
{
|
||||
// 1 - get message data from p3GxsChannels. No need for pointers here, because we send only a single post to postToObject()
|
||||
// At this point we dont know what kind of msg id we have. It can be a vote, a comment or an actual message.
|
||||
|
||||
std::vector<RsGxsChannelPost> posts;
|
||||
std::vector<RsGxsComment> comments;
|
||||
std::vector<RsGxsVote> votes;
|
||||
std::set<RsGxsMessageId> msg_ids{ E.mChannelMsgId };
|
||||
|
||||
if(!rsGxsChannels->getChannelContent(E.mChannelGroupId,msg_ids, posts,comments,votes))
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << " failed to retrieve channel message data for channel/msg " << E.mChannelGroupId << "/" << E.mChannelMsgId << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if what we have actually is a comment or a vote. If so we need to update the actual message they refer to
|
||||
|
||||
if(posts.empty()) // means we have a comment or a vote
|
||||
{
|
||||
msg_ids.clear();
|
||||
|
||||
for(auto c:comments) msg_ids.insert(c.mMeta.mThreadId);
|
||||
for(auto v:votes ) msg_ids.insert(v.mMeta.mThreadId);
|
||||
|
||||
comments.clear();
|
||||
votes.clear();
|
||||
|
||||
if(!rsGxsChannels->getChannelContent(E.mChannelGroupId,msg_ids,posts,comments,votes))
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << " failed to retrieve channel message data for channel/msg " << E.mChannelGroupId << "/" << E.mChannelMsgId << std::endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Need to call this in order to get the actuall comment count. The previous call only retrieves the message, since we supplied the message ID.
|
||||
// another way to go would be to save the comment ids of the existing message and re-insert them before calling getChannelContent.
|
||||
|
||||
if(!rsGxsChannels->getChannelComments(E.mChannelGroupId,msg_ids,comments))
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << " failed to retrieve message comment data for channel/msg " << E.mChannelGroupId << "/" << E.mChannelMsgId << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
updateCommentCounts(posts,comments);
|
||||
|
||||
// 2 - update the model in the UI thread.
|
||||
|
||||
RsQThreadUtils::postToObject( [posts,this]()
|
||||
{
|
||||
for(uint32_t i=0;i<posts.size();++i)
|
||||
{
|
||||
// linear search. Not good at all, but normally this is for a single post.
|
||||
|
||||
for(uint32_t j=0;j<mPosts.size();++j)
|
||||
if(mPosts[j].mMeta.mMsgId == posts[i].mMeta.mMsgId)
|
||||
{
|
||||
mPosts[j] = posts[i];
|
||||
|
||||
triggerViewUpdate();
|
||||
}
|
||||
}
|
||||
},this);
|
||||
});
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void RsGxsChannelPostsModel::initEmptyHierarchy()
|
||||
{
|
||||
beginResetModel();
|
||||
@ -241,7 +140,31 @@ void RsGxsChannelPostsModel::getFilesList(std::list<ChannelPostFileInfo>& files)
|
||||
files.push_back(it.second);
|
||||
}
|
||||
|
||||
bool RsGxsChannelPostsModel::postPassesFilter(const RsGxsChannelPost& post,const QStringList& strings,bool only_unread) const
|
||||
{
|
||||
bool passes_strings = true;
|
||||
|
||||
for(auto& s:strings)
|
||||
passes_strings = passes_strings && QString::fromStdString(post.mMeta.mMsgName).contains(s,Qt::CaseInsensitive);
|
||||
|
||||
if(strings.empty())
|
||||
passes_strings = true;
|
||||
|
||||
if(passes_strings && (!only_unread || (IS_MSG_UNREAD(post.mMeta.mMsgStatus) || IS_MSG_NEW(post.mMeta.mMsgStatus))))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void RsGxsChannelPostsModel::setFilter(const QStringList& strings,bool only_unread, uint32_t& count)
|
||||
{
|
||||
mFilteredStrings = strings;
|
||||
mFilterUnread = only_unread;
|
||||
|
||||
updateFilter(count);
|
||||
}
|
||||
|
||||
void RsGxsChannelPostsModel::updateFilter(uint32_t& count)
|
||||
{
|
||||
preMods();
|
||||
|
||||
@ -252,18 +175,8 @@ void RsGxsChannelPostsModel::setFilter(const QStringList& strings,bool only_unre
|
||||
endResetModel();
|
||||
|
||||
for(size_t i=0;i<mPosts.size();++i)
|
||||
{
|
||||
bool passes_strings = true;
|
||||
|
||||
for(auto& s:strings)
|
||||
passes_strings = passes_strings && QString::fromStdString(mPosts[i].mMeta.mMsgName).contains(s,Qt::CaseInsensitive);
|
||||
|
||||
if(strings.empty())
|
||||
passes_strings = true;
|
||||
|
||||
if(passes_strings && (!only_unread || (IS_MSG_UNREAD(mPosts[i].mMeta.mMsgStatus) || IS_MSG_NEW(mPosts[i].mMeta.mMsgStatus))))
|
||||
if(postPassesFilter(mPosts[i],mFilteredStrings,mFilterUnread))
|
||||
mFilteredPosts.push_back(i);
|
||||
}
|
||||
|
||||
count = mFilteredPosts.size();
|
||||
|
||||
@ -292,7 +205,7 @@ int RsGxsChannelPostsModel::rowCount(const QModelIndex& parent) const
|
||||
return mFilteredPosts.size();
|
||||
}
|
||||
|
||||
RsErr() << __PRETTY_FUNCTION__ << " rowCount cannot figure out the porper number of rows." << std::endl;
|
||||
RsErr() << __PRETTY_FUNCTION__ << " rowCount cannot figure out the proper number of rows." ;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -370,7 +283,7 @@ QModelIndex RsGxsChannelPostsModel::index(int row, int column, const QModelIndex
|
||||
|
||||
quintptr ref = getChildRef(parent.internalId(),(mTreeMode == TREE_MODE_GRID)?(column + row*mColumns):row);
|
||||
|
||||
#ifdef DEBUG_CHANNEL_MODEL
|
||||
#ifdef DEBUG_CHANNEL_MODEL_DATA
|
||||
std::cerr << "index-3(" << row << "," << column << " parent=" << parent << ") : " << createIndex(row,column,ref) << std::endl;
|
||||
#endif
|
||||
return createIndex(row,column,ref) ;
|
||||
@ -460,7 +373,7 @@ int RsGxsChannelPostsModel::getChildrenCount(quintptr ref) const
|
||||
|
||||
QVariant RsGxsChannelPostsModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
#ifdef DEBUG_CHANNEL_MODEL
|
||||
#ifdef DEBUG_CHANNEL_MODEL_DATA
|
||||
std::cerr << "calling data(" << index << ") role=" << role << std::endl;
|
||||
#endif
|
||||
|
||||
@ -477,13 +390,13 @@ QVariant RsGxsChannelPostsModel::data(const QModelIndex &index, int role) const
|
||||
quintptr ref = (index.isValid())?index.internalId():0 ;
|
||||
uint32_t entry = 0;
|
||||
|
||||
#ifdef DEBUG_CHANNEL_MODEL
|
||||
#ifdef DEBUG_CHANNEL_MODEL_DATA
|
||||
std::cerr << "data(" << index << ")" ;
|
||||
#endif
|
||||
|
||||
if(!ref)
|
||||
{
|
||||
#ifdef DEBUG_CHANNEL_MODEL
|
||||
#ifdef DEBUG_CHANNEL_MODEL_DATA
|
||||
std::cerr << " [empty]" << std::endl;
|
||||
#endif
|
||||
return QVariant() ;
|
||||
@ -491,7 +404,7 @@ QVariant RsGxsChannelPostsModel::data(const QModelIndex &index, int role) const
|
||||
|
||||
if(!convertRefPointerToTabEntry(ref,entry) || entry >= mFilteredPosts.size())
|
||||
{
|
||||
#ifdef DEBUG_CHANNEL_MODEL
|
||||
#ifdef DEBUG_CHANNEL_MODEL_DATA
|
||||
std::cerr << "Bad pointer: " << (void*)ref << std::endl;
|
||||
#endif
|
||||
return QVariant() ;
|
||||
@ -564,6 +477,79 @@ bool operator<(const RsGxsChannelPost& p1,const RsGxsChannelPost& p2)
|
||||
return p1.mMeta.mPublishTs > p2.mMeta.mPublishTs;
|
||||
}
|
||||
|
||||
void RsGxsChannelPostsModel::updateSinglePost(const RsGxsChannelPost& post,std::set<RsGxsFile>& added_files,std::set<RsGxsFile>& removed_files)
|
||||
{
|
||||
#ifdef DEBUG_CHANNEL_MODEL
|
||||
RsDbg() << "updating single post for group id=" << currentGroupId() << " and msg id=" << post.mMeta.mMsgId ;
|
||||
#endif
|
||||
added_files.clear();
|
||||
removed_files.clear();
|
||||
|
||||
emit layoutAboutToBeChanged();
|
||||
|
||||
// linear search. Not good at all, but normally this is just for a single post.
|
||||
|
||||
bool found = false;
|
||||
const auto& new_post_meta(post.mMeta);
|
||||
|
||||
for(uint32_t j=0;j<mPosts.size();++j)
|
||||
if(new_post_meta.mMsgId == mPosts[j].mMeta.mMsgId) // same post updated
|
||||
{
|
||||
added_files.insert(post.mFiles.begin(),post.mFiles.end());
|
||||
removed_files.insert(mPosts[j].mFiles.begin(),mPosts[j].mFiles.end());
|
||||
|
||||
auto save_ucc = mPosts[j].mUnreadCommentCount;
|
||||
auto save_cc = mPosts[j].mCommentCount;
|
||||
|
||||
mPosts[j] = post;
|
||||
|
||||
mPosts[j].mUnreadCommentCount = save_ucc;
|
||||
mPosts[j].mCommentCount = save_cc;
|
||||
|
||||
#ifdef DEBUG_CHANNEL_MODEL
|
||||
RsDbg() << " post is an updated existing post." ;
|
||||
#endif
|
||||
found=true;
|
||||
break;
|
||||
}
|
||||
else if( (new_post_meta.mOrigMsgId == mPosts[j].mMeta.mOrigMsgId || new_post_meta.mOrigMsgId == mPosts[j].mMeta.mMsgId)
|
||||
&& mPosts[j].mMeta.mPublishTs < new_post_meta.mPublishTs) // new post version
|
||||
{
|
||||
added_files.insert(post.mFiles.begin(),post.mFiles.end());
|
||||
removed_files.insert(mPosts[j].mFiles.begin(),mPosts[j].mFiles.end());
|
||||
|
||||
auto old_post_id = mPosts[j].mMeta.mMsgId;
|
||||
auto save_ucc = mPosts[j].mUnreadCommentCount;
|
||||
auto save_cc = mPosts[j].mCommentCount;
|
||||
|
||||
mPosts[j] = post;
|
||||
|
||||
mPosts[j].mCommentCount += save_cc;
|
||||
mPosts[j].mUnreadCommentCount += save_ucc;
|
||||
mPosts[j].mOlderVersions.insert(old_post_id);
|
||||
#ifdef DEBUG_CHANNEL_MODEL
|
||||
RsDbg() << " post is an new version of an existing post." ;
|
||||
#endif
|
||||
found=true;
|
||||
break;
|
||||
}
|
||||
|
||||
if(!found)
|
||||
{
|
||||
#ifdef DEBUG_CHANNEL_MODEL
|
||||
RsDbg() << " post is an new post.";
|
||||
#endif
|
||||
added_files.insert(post.mFiles.begin(),post.mFiles.end());
|
||||
mPosts.push_back(post);
|
||||
}
|
||||
std::sort(mPosts.begin(),mPosts.end());
|
||||
|
||||
uint32_t count;
|
||||
updateFilter(count);
|
||||
|
||||
triggerViewUpdate();
|
||||
}
|
||||
|
||||
void RsGxsChannelPostsModel::setPosts(const RsGxsChannelGroup& group, std::vector<RsGxsChannelPost>& posts)
|
||||
{
|
||||
preMods();
|
||||
@ -593,6 +579,8 @@ void RsGxsChannelPostsModel::setPosts(const RsGxsChannelGroup& group, std::vecto
|
||||
emit channelPostsLoaded();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void RsGxsChannelPostsModel::update_posts(const RsGxsGroupId& group_id)
|
||||
{
|
||||
if(group_id.isNull())
|
||||
@ -635,7 +623,7 @@ void RsGxsChannelPostsModel::update_posts(const RsGxsGroupId& group_id)
|
||||
// This shouldn't be needed normally. We need it until a background process computes the number of comments per
|
||||
// post and stores it in the service string. Since we request all data, this process isn't costing much anyway.
|
||||
|
||||
updateCommentCounts(*posts,*comments);
|
||||
computeCommentCounts(*posts,*comments);
|
||||
|
||||
// 2 - update the model in the UI thread.
|
||||
|
||||
@ -945,8 +933,28 @@ void RsGxsChannelPostsModel::setAllMsgReadStatus(bool read_status)
|
||||
if(!rsGxsChannels->setMessageReadStatus(p,read_status))
|
||||
RsErr() << "setAllMsgReadStatus: failed to change status of msg " << p.first << " in group " << p.second << " to status " << read_status << std::endl;
|
||||
});
|
||||
|
||||
// 3 - update the local model data, since we don't catch the READ_STATUS_CHANGED event later, to avoid re-loading the msg.
|
||||
|
||||
for(uint32_t i=0;i<mPosts.size();++i)
|
||||
if(read_status)
|
||||
mPosts[i].mMeta.mMsgStatus &= ~(GXS_SERV::GXS_MSG_STATUS_GUI_UNREAD | GXS_SERV::GXS_MSG_STATUS_GUI_NEW);
|
||||
else
|
||||
mPosts[i].mMeta.mMsgStatus |= GXS_SERV::GXS_MSG_STATUS_GUI_UNREAD ;
|
||||
|
||||
emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(rowCount()-1,mColumns-1,(void*)NULL));
|
||||
}
|
||||
|
||||
void RsGxsChannelPostsModel::updatePostWithNewComment(const RsGxsMessageId& msg_id)
|
||||
{
|
||||
for(uint32_t i=0;i<mPosts.size();++i)
|
||||
if(mPosts[i].mMeta.mMsgId == msg_id)
|
||||
{
|
||||
++mPosts[i].mUnreadCommentCount;
|
||||
emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(rowCount()-1,mColumns-1,(void*)NULL)); // update everything because we don't know the index.
|
||||
break;
|
||||
}
|
||||
}
|
||||
void RsGxsChannelPostsModel::setMsgReadStatus(const QModelIndex& i,bool read_status)
|
||||
{
|
||||
if(!i.isValid())
|
||||
@ -961,6 +969,18 @@ void RsGxsChannelPostsModel::setMsgReadStatus(const QModelIndex& i,bool read_sta
|
||||
return ;
|
||||
|
||||
rsGxsChannels->setMessageReadStatus(RsGxsGrpMsgIdPair(mPosts[mFilteredPosts[entry]].mMeta.mGroupId,mPosts[mFilteredPosts[entry]].mMeta.mMsgId),read_status);
|
||||
|
||||
// Quick update to the msg itself. Normally setMsgReadStatus will launch an event,
|
||||
// that we can catch to update the msg, but all the information is already here.
|
||||
|
||||
if(read_status)
|
||||
mPosts[mFilteredPosts[entry]].mMeta.mMsgStatus &= ~(GXS_SERV::GXS_MSG_STATUS_GUI_UNREAD | GXS_SERV::GXS_MSG_STATUS_GUI_NEW);
|
||||
else
|
||||
mPosts[mFilteredPosts[entry]].mMeta.mMsgStatus |= GXS_SERV::GXS_MSG_STATUS_GUI_UNREAD;
|
||||
|
||||
mPosts[mFilteredPosts[entry]].mUnreadCommentCount = 0;
|
||||
|
||||
emit dataChanged(i,i);
|
||||
}
|
||||
|
||||
QModelIndex RsGxsChannelPostsModel::getIndexOfMessage(const RsGxsMessageId& mid) const
|
||||
|
@ -101,6 +101,7 @@ public:
|
||||
SORT_MODE_CHILDREN_PUBLISH_TS = 0x01,
|
||||
};
|
||||
#endif
|
||||
static void computeCommentCounts( std::vector<RsGxsChannelPost>& posts, std::vector<RsGxsComment>& comments);
|
||||
|
||||
QModelIndex root() const{ return createIndex(0,0,(void*)NULL) ;}
|
||||
QModelIndex getIndexOfMessage(const RsGxsMessageId& mid) const;
|
||||
@ -138,8 +139,11 @@ public:
|
||||
|
||||
void setMsgReadStatus(const QModelIndex &i, bool read_status);
|
||||
void setAllMsgReadStatus(bool read_status);
|
||||
void updatePostWithNewComment(const RsGxsMessageId& msg_id);
|
||||
|
||||
void setFilter(const QStringList &strings, bool only_unread,uint32_t &count) ;
|
||||
bool postPassesFilter(const RsGxsChannelPost &post, const QStringList &strings, bool only_unread) const;
|
||||
void updateFilter(uint32_t& count);
|
||||
|
||||
#ifdef TODO
|
||||
void setAuthorOpinion(const QModelIndex& indx,RsOpinion op);
|
||||
@ -215,6 +219,8 @@ private:
|
||||
|
||||
void update_posts(const RsGxsGroupId& group_id);
|
||||
|
||||
private:
|
||||
|
||||
#ifdef TODO
|
||||
void setForumMessageSummary(const std::vector<RsGxsForumMsg>& messages);
|
||||
#endif
|
||||
@ -232,8 +238,13 @@ private:
|
||||
void old_createPostsArray(std::vector<RsGxsChannelPost> &posts);
|
||||
void createPostsArray(std::vector<RsGxsChannelPost>& posts);
|
||||
void setPosts(const RsGxsChannelGroup& group, std::vector<RsGxsChannelPost> &posts);
|
||||
public:
|
||||
void updateSinglePost(const RsGxsChannelPost& post, std::set<RsGxsFile>& added_files, std::set<RsGxsFile>& removed_files);
|
||||
private:
|
||||
void initEmptyHierarchy();
|
||||
void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);
|
||||
|
||||
QStringList mFilteredStrings;
|
||||
bool mFilterUnread;
|
||||
|
||||
std::vector<int> mFilteredPosts; // stores the list of displayes indices due to filtering.
|
||||
std::vector<RsGxsChannelPost> mPosts ; // store the list of posts updated from rsForums.
|
||||
|
@ -75,6 +75,7 @@ QColor SelectedColor = QRgb(0xff308dc7);
|
||||
|
||||
#define STAR_OVERLAY_IMAGE ":icons/star_overlay_128.png"
|
||||
#define COMMENT_OVERLAY_IMAGE ":images/white-bubble-64.png"
|
||||
#define UNREAD_COMMENT_OVERLAY_IMAGE ":images/orange-bubble-64.png"
|
||||
#define IMAGE_COPYLINK ":icons/png/copy.png"
|
||||
#define IMAGE_GRID_VIEW ":icons/png/menu.png"
|
||||
#define IMAGE_DOWNLOAD ":icons/png/download.png"
|
||||
@ -121,11 +122,7 @@ void ChannelPostDelegate::paint(QPainter * painter, const QStyleOptionViewItem &
|
||||
|
||||
RsGxsChannelPost post = index.data(Qt::UserRole).value<RsGxsChannelPost>() ;
|
||||
|
||||
// if(index.row() & 0x01)
|
||||
// painter->fillRect( option.rect, option.palette.alternateBase().color());
|
||||
// else
|
||||
painter->fillRect( option.rect, option.palette.base().color());
|
||||
|
||||
painter->restore();
|
||||
|
||||
if(mUseGrid || index.column()==0)
|
||||
@ -144,14 +141,7 @@ void ChannelPostDelegate::paint(QPainter * painter, const QStyleOptionViewItem &
|
||||
if((option.state & QStyle::State_Selected) && post.mMeta.mPublishTs > 0) // check if post is selected and is not empty (end of last row)
|
||||
pixmap.fill(SelectedColor); // I dont know how to grab the backgroud color for selected objects automatically.
|
||||
else
|
||||
{
|
||||
// we need to do the alternate color manually
|
||||
|
||||
//if(index.row() & 0x01)
|
||||
// pixmap.fill(option.palette.alternateBase().color());
|
||||
//else
|
||||
pixmap.fill(option.palette.base().color());
|
||||
}
|
||||
|
||||
w.render(&pixmap,QPoint(),QRegion(),QWidget::DrawChildren );// draw the widgets, not the background
|
||||
|
||||
@ -168,8 +158,6 @@ void ChannelPostDelegate::paint(QPainter * painter, const QStyleOptionViewItem &
|
||||
// file.close();
|
||||
// }
|
||||
|
||||
if(mUseGrid || index.column()==0)
|
||||
{
|
||||
if(mZoom != 1.0)
|
||||
pixmap = pixmap.scaled(mZoom*pixmap.size(),Qt::KeepAspectRatio,Qt::SmoothTransformation);
|
||||
|
||||
@ -181,7 +169,16 @@ void ChannelPostDelegate::paint(QPainter * painter, const QStyleOptionViewItem &
|
||||
p.drawPixmap(mZoom*QPoint(0.1*fm.height(),-3.4*fm.height()),FilesDefs::getPixmapFromQtResourcePath(STAR_OVERLAY_IMAGE).scaled(mZoom*6*fm.height(),mZoom*6*fm.height(),Qt::KeepAspectRatio,Qt::SmoothTransformation));
|
||||
}
|
||||
|
||||
if(post.mUnreadCommentCount)
|
||||
if(post.mUnreadCommentCount > 0)
|
||||
{
|
||||
QPainter p(&pixmap);
|
||||
QFontMetricsF fm(option.font);
|
||||
|
||||
p.drawPixmap(QPoint(pixmap.width(),0.0)+mZoom*QPoint(-2.9*fm.height(),0.4*fm.height()),
|
||||
FilesDefs::getPixmapFromQtResourcePath(UNREAD_COMMENT_OVERLAY_IMAGE).scaled(mZoom*3*fm.height(),mZoom*3*fm.height(),
|
||||
Qt::KeepAspectRatio,Qt::SmoothTransformation));
|
||||
}
|
||||
else if(post.mCommentCount > 0)
|
||||
{
|
||||
QPainter p(&pixmap);
|
||||
QFontMetricsF fm(option.font);
|
||||
@ -191,10 +188,9 @@ void ChannelPostDelegate::paint(QPainter * painter, const QStyleOptionViewItem &
|
||||
Qt::KeepAspectRatio,Qt::SmoothTransformation));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
painter->drawPixmap(option.rect.topLeft(),
|
||||
pixmap.scaled(option.rect.width(),option.rect.width()*pixmap.height()/(float)pixmap.width(),Qt::IgnoreAspectRatio,Qt::SmoothTransformation));
|
||||
pixmap.scaled(option.rect.width(),option.rect.width()*pixmap.height()/(float)pixmap.width(),
|
||||
Qt::IgnoreAspectRatio,Qt::SmoothTransformation));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -262,6 +258,9 @@ QSize ChannelPostDelegate::sizeHint(const QStyleOptionViewItem& option, const QM
|
||||
|
||||
float cell_width = mZoom*COLUMN_SIZE_FONT_FACTOR_W*fm.height();
|
||||
float cell_height = mZoom*COLUMN_SIZE_FONT_FACTOR_W*fm.height()*aspect_ratio;
|
||||
#ifdef DEBUG_CHANNEL_POSTS_WIDGET
|
||||
RsDbg() << "SizeHint: mUseGrid=" << mUseGrid << " cell_width=" << cell_width << " cell_height=" << cell_height << " mZoom=" << mZoom ;
|
||||
#endif
|
||||
|
||||
if(mUseGrid || index.column()==0)
|
||||
return QSize(cell_width,cell_height);
|
||||
@ -743,7 +742,7 @@ void GxsChannelPostsWidgetWithModel::handlePostsTreeSizeChange(QSize s,bool forc
|
||||
return;
|
||||
|
||||
int n_columns = std::max(1,(int)floor(s.width() / (mChannelPostsDelegate->cellSize(0,font(),ui->postsTree->width()))));
|
||||
std::cerr << "nb columns: " << n_columns << " current count=" << mChannelPostsModel->columnCount() << std::endl;
|
||||
RsDbg() << "nb columns: " << n_columns << " current count=" << mChannelPostsModel->columnCount() ;
|
||||
|
||||
// save current post. The setNumColumns() indeed loses selection
|
||||
|
||||
@ -771,20 +770,90 @@ void GxsChannelPostsWidgetWithModel::handleEvent_main_thread(std::shared_ptr<con
|
||||
{
|
||||
case RsChannelEventCode::NEW_CHANNEL: // [[fallthrough]];
|
||||
case RsChannelEventCode::DELETED_CHANNEL: // [[fallthrough]];
|
||||
case RsChannelEventCode::NEW_COMMENT: // [[fallthrough]];
|
||||
case RsChannelEventCode::NEW_VOTE: // [[fallthrough]];
|
||||
case RsChannelEventCode::UPDATED_CHANNEL: // [[fallthrough]];
|
||||
case RsChannelEventCode::NEW_MESSAGE: // [[fallthrough]];
|
||||
case RsChannelEventCode::UPDATED_MESSAGE:
|
||||
case RsChannelEventCode::RECEIVED_PUBLISH_KEY:
|
||||
case RsChannelEventCode::SYNC_PARAMETERS_UPDATED:
|
||||
{
|
||||
if(e->mChannelGroupId == groupId())
|
||||
updateDisplay(true);
|
||||
updateDisplay(true,false);
|
||||
}
|
||||
break;
|
||||
|
||||
case RsChannelEventCode::READ_STATUS_CHANGED: // This is already handled by setMsgReadStatus() that has been called and issued this event.
|
||||
break;
|
||||
|
||||
case RsChannelEventCode::NEW_MESSAGE:
|
||||
{
|
||||
if(e->mChannelGroupId == groupId())
|
||||
{
|
||||
RsDbg() << "Received new message in current channel, msgId=" << e->mChannelMsgId ;
|
||||
|
||||
RsThread::async([this,E=*e]() // dereferencing to make a copy that will survive while e is deleted by the parent thread.
|
||||
{
|
||||
// 1 - get message data from p3GxsChannels. No need for pointers here, because we send only a single post to postToObject()
|
||||
// At this point we dont know what kind of msg id we have. It can be a vote, a comment or an actual message.
|
||||
|
||||
std::vector<RsGxsChannelPost> posts;
|
||||
std::vector<RsGxsComment> comments;
|
||||
std::vector<RsGxsVote> votes;
|
||||
|
||||
const auto& msg_id(E.mChannelMsgId);
|
||||
const auto& grp_id(E.mChannelGroupId);
|
||||
|
||||
if(!rsGxsChannels->getChannelContent(grp_id, { msg_id }, posts,comments,votes) || posts.size() != 1)
|
||||
{
|
||||
RsErr() << " failed to retrieve channel message data for channel/msg " << grp_id << "/" << msg_id;
|
||||
return;
|
||||
}
|
||||
|
||||
// Need to call this in order to get the actual comment count. The previous call only retrieves the message, since we supplied the message ID.
|
||||
// another way to go would be to save the comment ids of the existing message and re-insert them before calling getChannelContent.
|
||||
|
||||
if(!rsGxsChannels->getChannelComments(grp_id,{ msg_id },comments))
|
||||
{
|
||||
RsErr() << " failed to retrieve message comment data for channel/msg " << grp_id << "/" << msg_id ;
|
||||
return;
|
||||
}
|
||||
|
||||
// Normally, there's a single post in the "post" array. The function below takes a full array of posts however.
|
||||
|
||||
RsGxsChannelPostsModel::computeCommentCounts(posts,comments);
|
||||
|
||||
// 2 - update the model in the UI thread.
|
||||
|
||||
RsQThreadUtils::postToObject( [post=posts[0],this]()
|
||||
{
|
||||
std::set<RsGxsFile> added_files,removed_files;
|
||||
|
||||
mChannelPostsModel->updateSinglePost(post,added_files,removed_files);
|
||||
|
||||
std::set<ChannelPostFileInfo> added_filesi,removed_filesi;
|
||||
|
||||
for(auto f:added_files) added_filesi.insert(ChannelPostFileInfo(f,post.mMeta.mPublishTs));
|
||||
for(auto f:removed_files) removed_filesi.insert(ChannelPostFileInfo(f,post.mMeta.mPublishTs));
|
||||
|
||||
mChannelFilesModel->update_files(added_filesi,removed_filesi);
|
||||
|
||||
},this);
|
||||
});
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case RsChannelEventCode::NEW_COMMENT:
|
||||
|
||||
if(e->mChannelGroupId == groupId() && e->mChannelThreadId != ui->commentsDialog->messageId())
|
||||
mChannelPostsModel->updatePostWithNewComment(e->mChannelThreadId); [[fallthrough]];
|
||||
|
||||
case RsChannelEventCode::NEW_VOTE:
|
||||
|
||||
if(e->mChannelGroupId == groupId() && e->mChannelThreadId == ui->commentsDialog->messageId())
|
||||
ui->commentsDialog->refresh();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -793,7 +862,7 @@ void GxsChannelPostsWidgetWithModel::showPostDetails()
|
||||
QModelIndex index = ui->postsTree->selectionModel()->currentIndex();
|
||||
RsGxsChannelPost post = index.data(Qt::UserRole).value<RsGxsChannelPost>() ;
|
||||
#ifdef DEBUG_CHANNEL_POSTS_WIDGET
|
||||
std::cerr << "showPostDetails: current index is " << index.row() << "," << index.column() << std::endl;
|
||||
RsDbg() << "showPostDetails: current index is " << index.row() << "," << index.column() ;
|
||||
#endif
|
||||
|
||||
//QTextDocument doc;
|
||||
@ -818,7 +887,7 @@ void GxsChannelPostsWidgetWithModel::showPostDetails()
|
||||
ui->postTime_LB->show();
|
||||
|
||||
#ifdef DEBUG_CHANNEL_POSTS_WIDGET
|
||||
std::cerr << "showPostDetails: setting mLastSelectedPosts[groupId()] to current post Id " << post.mMeta.mMsgId << ". Previous value: " << mLastSelectedPosts[groupId()] << std::endl;
|
||||
RsDbg() << "showPostDetails: setting mLastSelectedPosts[groupId()] to current post Id " << post.mMeta.mMsgId << ". Previous value: " << mLastSelectedPosts[groupId()] ;
|
||||
#endif
|
||||
mLastSelectedPosts[groupId()] = post.mMeta.mMsgId;
|
||||
|
||||
@ -834,7 +903,7 @@ void GxsChannelPostsWidgetWithModel::showPostDetails()
|
||||
ui->commentsDialog->commentLoad(post.mMeta.mGroupId, all_msgs_versions, post.mMeta.mMsgId,true);
|
||||
|
||||
#ifdef DEBUG_CHANNEL_POSTS_WIDGET
|
||||
std::cerr << "Showing details about selected index : "<< index.row() << "," << index.column() << std::endl;
|
||||
RsDbg() << "Showing details about selected index : "<< index.row() << "," << index.column() ;
|
||||
#endif
|
||||
|
||||
ui->postDetails_TE->setText(RsHtml().formatText(NULL, QString::fromUtf8(post.mMsg.c_str()), /* RSHTML_FORMATTEXT_EMBED_SMILEYS |*/ RSHTML_FORMATTEXT_EMBED_LINKS));
|
||||
@ -864,13 +933,18 @@ void GxsChannelPostsWidgetWithModel::showPostDetails()
|
||||
|
||||
// Now also set the post as read
|
||||
|
||||
if(IS_MSG_UNREAD(post.mMeta.mMsgStatus) || IS_MSG_NEW(post.mMeta.mMsgStatus))
|
||||
if(IS_MSG_UNREAD(post.mMeta.mMsgStatus) || IS_MSG_NEW(post.mMeta.mMsgStatus) || post.mUnreadCommentCount > 0)
|
||||
{
|
||||
RsGxsGrpMsgIdPair postId;
|
||||
postId.second = post.mMeta.mMsgId;
|
||||
postId.first = post.mMeta.mGroupId;
|
||||
mChannelPostsModel->setMsgReadStatus(index,true);
|
||||
|
||||
RsThread::async([postId]() { rsGxsChannels->setMessageReadStatus(postId, true) ; } );
|
||||
//RsGxsGrpMsgIdPair postId;
|
||||
//postId.second = post.mMeta.mMsgId;
|
||||
//postId.first = post.mMeta.mGroupId;
|
||||
|
||||
//RsThread::async([postId]()
|
||||
//{
|
||||
//rsGxsChannels->setMessageReadStatus(postId, true) ;
|
||||
//} );
|
||||
}
|
||||
|
||||
updateDAll_PB();
|
||||
@ -883,7 +957,7 @@ void GxsChannelPostsWidgetWithModel::updateCommentsCount(int n)
|
||||
else
|
||||
ui->details_TW->setTabText(2,tr("Comments"));
|
||||
}
|
||||
void GxsChannelPostsWidgetWithModel::updateGroupData()
|
||||
void GxsChannelPostsWidgetWithModel::updateData(bool update_group_data, bool update_posts)
|
||||
{
|
||||
if(groupId().isNull())
|
||||
{
|
||||
@ -893,10 +967,10 @@ void GxsChannelPostsWidgetWithModel::updateGroupData()
|
||||
return;
|
||||
}
|
||||
|
||||
RsThread::async([this]()
|
||||
RsThread::async([this,update_group_data,update_posts]()
|
||||
{
|
||||
RsGxsChannelGroup group;
|
||||
std::vector<RsGxsChannelGroup> groups;
|
||||
RsGxsChannelGroup group;
|
||||
|
||||
if(rsGxsChannels->getChannelsInfo(std::list<RsGxsGroupId>{ groupId() }, groups) && groups.size()==1)
|
||||
group = groups[0];
|
||||
@ -906,7 +980,7 @@ void GxsChannelPostsWidgetWithModel::updateGroupData()
|
||||
return;
|
||||
}
|
||||
|
||||
RsQThreadUtils::postToObject( [this,group]()
|
||||
RsQThreadUtils::postToObject( [this,update_group_data,update_posts,group]()
|
||||
{
|
||||
if(mGroup.mMeta.mGroupId != group.mMeta.mGroupId) // this prevents any attempt to display the wrong index. Navigate() if needed will use mNavigatePendingMsgId
|
||||
{
|
||||
@ -918,15 +992,21 @@ void GxsChannelPostsWidgetWithModel::updateGroupData()
|
||||
updateCommentsCount(0);
|
||||
}
|
||||
|
||||
if(update_group_data)
|
||||
{
|
||||
mGroup = group;
|
||||
insertChannelDetails(mGroup);
|
||||
}
|
||||
|
||||
if(update_posts)
|
||||
{
|
||||
ui->postsTree->setPlaceholderText(tr("Loading..."));
|
||||
|
||||
mChannelPostsModel->updateChannel(groupId());
|
||||
|
||||
whileBlocking(ui->filterLineEdit)->clear();
|
||||
whileBlocking(ui->showUnread_TB)->setChecked(false);
|
||||
|
||||
insertChannelDetails(mGroup);
|
||||
}
|
||||
|
||||
emit groupDataLoaded();
|
||||
emit groupChanged(this); // signals the parent widget to e.g. update the group tab name
|
||||
@ -991,10 +1071,10 @@ void GxsChannelPostsWidgetWithModel::postChannelPostLoad()
|
||||
handlePostsTreeSizeChange(ui->postsTree->size(),true); // force the update
|
||||
}
|
||||
|
||||
void GxsChannelPostsWidgetWithModel::updateDisplay(bool complete)
|
||||
void GxsChannelPostsWidgetWithModel::updateDisplay(bool update_group_data,bool update_posts)
|
||||
{
|
||||
// First, clear all widget
|
||||
blank();
|
||||
|
||||
#ifdef DEBUG_CHANNEL
|
||||
std::cerr << "udateDisplay: groupId()=" << groupId()<< std::endl;
|
||||
#endif
|
||||
@ -1006,25 +1086,16 @@ void GxsChannelPostsWidgetWithModel::updateDisplay(bool complete)
|
||||
return;
|
||||
}
|
||||
|
||||
if(mGroup.mMeta.mGroupId.isNull() && !groupId().isNull())
|
||||
if(mGroup.mMeta.mGroupId != groupId())
|
||||
{
|
||||
#ifdef DEBUG_FORUMS
|
||||
std::cerr << " inconsistent group data. Reloading!"<< std::endl;
|
||||
#endif
|
||||
complete = true;
|
||||
update_group_data = true;
|
||||
update_posts = true;
|
||||
}
|
||||
if(complete) // need to update the group data, reload the messages etc.
|
||||
{
|
||||
#warning csoler 2020-06-02 : todo
|
||||
//saveExpandedItems(mSavedExpandedMessages);
|
||||
|
||||
//if(mGroupId != mChannelPostsModel->currentGroupId())
|
||||
// mThreadId.clear();
|
||||
|
||||
updateGroupData();
|
||||
|
||||
return;
|
||||
}
|
||||
updateData(update_group_data,update_posts);
|
||||
}
|
||||
GxsChannelPostsWidgetWithModel::~GxsChannelPostsWidgetWithModel()
|
||||
{
|
||||
|
@ -104,11 +104,11 @@ public:
|
||||
|
||||
/* GxsMessageFrameWidget */
|
||||
virtual QIcon groupIcon() override;
|
||||
virtual void groupIdChanged() override { updateDisplay(true); }
|
||||
virtual void groupIdChanged() override { updateDisplay(true,true); }
|
||||
virtual QString groupName(bool) override;
|
||||
virtual bool navigate(const RsGxsMessageId&) override;
|
||||
|
||||
void updateDisplay(bool complete);
|
||||
void updateDisplay(bool update_group_data, bool update_posts);
|
||||
|
||||
#ifdef TODO
|
||||
/* FeedHolder */
|
||||
@ -141,7 +141,7 @@ protected:
|
||||
|
||||
private slots:
|
||||
void showPostDetails();
|
||||
void updateGroupData();
|
||||
void updateData(bool update_group_data,bool update_posts);
|
||||
void download();
|
||||
void updateDAll_PB();
|
||||
void createMsg();
|
||||
|
@ -387,12 +387,11 @@ void RsMessageModel::setFilter(FilterType filter_type, const QStringList& string
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
preMods();
|
||||
|
||||
mFilterType = filter_type;
|
||||
mFilterStrings = strings;
|
||||
|
||||
postMods();
|
||||
if(rowCount() > 0)
|
||||
emit dataChanged(createIndex(0,0),createIndex(rowCount()-1,RsMessageModel::columnCount()-1));
|
||||
}
|
||||
|
||||
QVariant RsMessageModel::toolTipRole(const Rs::Msgs::MsgInfoSummary& fmpe,int column) const
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "gui/notifyqt.h"
|
||||
#include "gui/MainWindow.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
|
||||
#include "gui/msgs/MessageInterface.h"
|
||||
|
||||
@ -91,8 +92,18 @@ void MessageUserNotify::handleEvent_main_thread(std::shared_ptr<const RsEvent> e
|
||||
return;
|
||||
}
|
||||
|
||||
std::set<RsMailMessageId>::const_iterator it;
|
||||
|
||||
switch (fe->mMailStatusEventCode) {
|
||||
case RsMailStatusEventCode::NEW_MESSAGE:
|
||||
if (Settings->getNotifyFlags() & RS_POPUP_MSG)
|
||||
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() );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case RsMailStatusEventCode::MESSAGE_CHANGED:
|
||||
case RsMailStatusEventCode::MESSAGE_REMOVED:
|
||||
updateIcon();
|
||||
|
@ -1162,3 +1162,82 @@ void NotifyQt::runningTick()
|
||||
}
|
||||
}
|
||||
|
||||
void NotifyQt::addToaster(uint notifyFlags, const std::string& id, const std::string& title, const std::string& msg)
|
||||
{
|
||||
uint pos = 0;
|
||||
|
||||
while (notifyFlags) {
|
||||
uint type = notifyFlags & (1 << pos);
|
||||
notifyFlags &= ~(1 << pos);
|
||||
++pos;
|
||||
|
||||
ToasterItem *toaster = NULL;
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case RS_POPUP_ENCRYPTED_MSG:
|
||||
SoundManager::play(SOUND_MESSAGE_ARRIVED);
|
||||
|
||||
toaster = new ToasterItem(new MessageToaster(std::string(), tr("Unknown title"), QString("[%1]").arg(tr("Encrypted message"))));
|
||||
break;
|
||||
case RS_POPUP_MSG:
|
||||
SoundManager::play(SOUND_MESSAGE_ARRIVED);
|
||||
|
||||
toaster = new ToasterItem(new MessageToaster(id, QString::fromUtf8(title.c_str()), QString::fromUtf8(msg.c_str())));
|
||||
break;
|
||||
case RS_POPUP_CONNECT:
|
||||
SoundManager::play(SOUND_USER_ONLINE);
|
||||
|
||||
toaster = new ToasterItem(new OnlineToaster(RsPeerId(id)));
|
||||
break;
|
||||
case RS_POPUP_DOWNLOAD:
|
||||
SoundManager::play(SOUND_DOWNLOAD_COMPLETE);
|
||||
|
||||
toaster = new ToasterItem(new DownloadToaster(RsFileHash(id), QString::fromUtf8(title.c_str())));
|
||||
break;
|
||||
case RS_POPUP_CHAT:
|
||||
toaster = new ToasterItem(new ChatToaster(RsPeerId(id), QString::fromUtf8(msg.c_str())));
|
||||
break;
|
||||
case RS_POPUP_GROUPCHAT:
|
||||
#ifdef RS_DIRECT_CHAT
|
||||
toaster = new ToasterItem(new GroupChatToaster(RsPeerId(id), QString::fromUtf8(msg.c_str())));
|
||||
#endif // RS_DIRECT_CHAT
|
||||
break;
|
||||
case RS_POPUP_CHATLOBBY:
|
||||
{
|
||||
ChatId chat_id(id);
|
||||
|
||||
ChatDialog *chatDialog = ChatDialog::getChat(chat_id);
|
||||
ChatWidget *chatWidget;
|
||||
if (chatDialog && (chatWidget = chatDialog->getChatWidget()) && chatWidget->isActive()) {
|
||||
// do not show when active
|
||||
break;
|
||||
}
|
||||
|
||||
ChatLobbyDialog *chatLobbyDialog = dynamic_cast<ChatLobbyDialog*>(chatDialog);
|
||||
|
||||
RsGxsId sender(title);
|
||||
if (!chatLobbyDialog || chatLobbyDialog->isParticipantMuted(sender))
|
||||
break; // participant is muted
|
||||
|
||||
toaster = new ToasterItem(new ChatLobbyToaster(chat_id.toLobbyId(), sender, QString::fromUtf8(msg.c_str())));
|
||||
}
|
||||
break;
|
||||
case RS_POPUP_CONNECT_ATTEMPT:
|
||||
// id = gpgid
|
||||
// title = ssl name
|
||||
// msg = peer id
|
||||
toaster = new ToasterItem(new FriendRequestToaster(RsPgpId(id), QString::fromUtf8(title.c_str()), RsPeerId(msg)));
|
||||
break;
|
||||
}
|
||||
|
||||
if (toaster) {
|
||||
/* init attributes */
|
||||
toaster->widget->setWindowFlags(Qt::ToolTip | Qt::WindowStaysOnTopHint);
|
||||
|
||||
/* add toaster to waiting list */
|
||||
//QMutexLocker lock(&waitingToasterMutex);
|
||||
waitingToasterList.push_back(toaster);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -95,6 +95,7 @@ class NotifyQt: public QObject, public NotifyClient
|
||||
void testToaster(ToasterNotify *toasterNotify, /*RshareSettings::enumToasterPosition*/ int position, QPoint margin);
|
||||
void testToaster(QString tag, ToasterNotify *toasterNotify, /*RshareSettings::enumToasterPosition*/ int position, QPoint margin);
|
||||
|
||||
void addToaster(uint notifyFlags, const std::string& id, const std::string& title, const std::string& msg);
|
||||
void notifySettingsChanged();
|
||||
|
||||
signals:
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "ServerPage.h"
|
||||
|
||||
#include <gui/notifyqt.h>
|
||||
#include "gui/MainWindow.h"
|
||||
#include "rshare.h"
|
||||
#include "rsharesettings.h"
|
||||
#include "util/i2pcommon.h"
|
||||
@ -1366,6 +1367,7 @@ void ServerPage::saveAddressesHiddenNode()
|
||||
|
||||
void ServerPage::updateOutProxyIndicator()
|
||||
{
|
||||
MainWindow::getInstance()->torstatusReset();
|
||||
QTcpSocket socket ;
|
||||
|
||||
// Tor
|
||||
@ -1382,6 +1384,8 @@ void ServerPage::updateOutProxyIndicator()
|
||||
ui.iconlabel_tor_outgoing->setToolTip(tr("Tor proxy is not enabled")) ;
|
||||
}
|
||||
|
||||
if (mHiddenType == RS_HIDDEN_TYPE_I2P && mSamSettings.enable)
|
||||
{
|
||||
// I2P - SAM
|
||||
// Note: there is only "the SAM port", there is no additional proxy port!
|
||||
samStatus ss;
|
||||
@ -1397,7 +1401,22 @@ void ServerPage::updateOutProxyIndicator()
|
||||
ui.iconlabel_i2p_outgoing->setPixmap(FilesDefs::getPixmapFromQtResourcePath(ICON_STATUS_UNKNOWN)) ;
|
||||
ui.iconlabel_i2p_outgoing->setToolTip(tr("I2P proxy is not enabled")) ;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
socket.connectToHost(ui.hiddenpage_proxyAddress_i2p->text(),ui.hiddenpage_proxyPort_i2p->text().toInt());
|
||||
if(socket.waitForConnected(500))
|
||||
{
|
||||
socket.disconnectFromHost();
|
||||
ui.iconlabel_i2p_outgoing->setPixmap(FilesDefs::getPixmapFromQtResourcePath(ICON_STATUS_OK)) ;
|
||||
ui.iconlabel_i2p_outgoing->setToolTip(tr("Proxy seems to work.")) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.iconlabel_i2p_outgoing->setPixmap(FilesDefs::getPixmapFromQtResourcePath(ICON_STATUS_UNKNOWN)) ;
|
||||
ui.iconlabel_i2p_outgoing->setToolTip(tr("I2P proxy is not enabled")) ;
|
||||
}
|
||||
}
|
||||
socket.connectToHost(ui.hiddenpage_proxyAddress_i2p_2->text(), 7656);
|
||||
if(true == (mSamAccessible = socket.waitForConnected(1000)))
|
||||
{
|
||||
|
@ -168,7 +168,7 @@ void TorStatus::getTorStatus()
|
||||
torstatusLabel->setToolTip( text + tr("Tor proxy is not available"));
|
||||
}
|
||||
}
|
||||
if(hiddentype == RS_HIDDEN_TYPE_I2P)
|
||||
else if(hiddentype == RS_HIDDEN_TYPE_I2P)
|
||||
{
|
||||
statusTor->setText("<strong>" + tr("I2P") + ":</strong>");
|
||||
rsPeers->getProxyServer(RS_HIDDEN_TYPE_I2P, proxyaddr, proxyport, status);
|
||||
@ -185,6 +185,11 @@ void TorStatus::getTorStatus()
|
||||
torstatusLabel->setToolTip( text + tr("i2p proxy is not available"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
torstatusLabel->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":/icons/tile_inactive_48.png").scaledToHeight(S,Qt::SmoothTransformation));
|
||||
torstatusLabel->setToolTip(tr("No tor configuration"));
|
||||
}
|
||||
_updated = true;
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,11 @@
|
||||
#include "MessageToaster.h"
|
||||
#include "../MainWindow.h"
|
||||
|
||||
#include <retroshare/rsmsgs.h>
|
||||
#include <retroshare/rspeers.h>
|
||||
#include <retroshare/rsidentity.h>
|
||||
|
||||
#include "gui/msgs/MessageInterface.h"
|
||||
|
||||
MessageToaster::MessageToaster(const std::string &peerId, const QString &title, const QString &message) : QWidget(NULL)
|
||||
{
|
||||
@ -39,8 +43,24 @@ MessageToaster::MessageToaster(const std::string &peerId, const QString &title,
|
||||
ui.textLabel->setText(message);
|
||||
ui.textLabel->setToolTip(message);
|
||||
|
||||
std::string name = (!RsPeerId(peerId).isNull())? (rsPeers->getPeerName(RsPeerId(peerId))): (rsPeers->getGPGName(RsPgpId(peerId))) ;
|
||||
ui.toasterLabel->setText(ui.toasterLabel->text() + " " + QString::fromUtf8(name.c_str()));
|
||||
MessageInfo mi;
|
||||
|
||||
if (!rsMail->getMessage(peerId, mi))
|
||||
return;
|
||||
|
||||
QString srcName;
|
||||
|
||||
if(mi.msgflags & RS_MSG_DISTANT)
|
||||
{
|
||||
RsIdentityDetails details ;
|
||||
rsIdentity->getIdDetails(mi.from.toGxsId(), details) ;
|
||||
|
||||
srcName = QString::fromUtf8(details.mNickname.c_str());
|
||||
}
|
||||
else
|
||||
srcName = QString::fromUtf8(rsPeers->getPeerName(mi.from.toRsPeerId()).c_str());
|
||||
|
||||
ui.toasterLabel->setText(ui.toasterLabel->text() + " " + srcName);
|
||||
}
|
||||
|
||||
void MessageToaster::openmessageClicked()
|
||||
|
1
retroshare-webui
Submodule
1
retroshare-webui
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 5cc37b3e5ad6b64b247e9d2066a9b6c8acae67ce
|
Loading…
Reference in New Issue
Block a user