mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-12-16 17:13:58 -05:00
started improving Boards the same way than Channels. Not working yet
This commit is contained in:
parent
5120f693be
commit
958db27eaa
8 changed files with 165 additions and 203 deletions
|
|
@ -95,23 +95,23 @@ GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId,
|
|||
// mPost = post ;
|
||||
// }
|
||||
|
||||
void GxsChannelPostItem::init(const RsGxsMessageId& messageId,const std::set<RsGxsMessageId>& older_versions)
|
||||
{
|
||||
QVector<RsGxsMessageId> v;
|
||||
//bool self = false;
|
||||
|
||||
for(std::set<RsGxsMessageId>::const_iterator it(older_versions.begin());it!=older_versions.end();++it)
|
||||
v.push_back(*it) ;
|
||||
|
||||
if(older_versions.find(messageId) == older_versions.end())
|
||||
v.push_back(messageId);
|
||||
|
||||
setMessageVersions(v) ;
|
||||
|
||||
setup();
|
||||
|
||||
mLoaded = false ;
|
||||
}
|
||||
// void GxsChannelPostItem::init(const RsGxsMessageId& messageId,const std::set<RsGxsMessageId>& older_versions)
|
||||
// {
|
||||
// QVector<RsGxsMessageId> v;
|
||||
// //bool self = false;
|
||||
//
|
||||
// for(std::set<RsGxsMessageId>::const_iterator it(older_versions.begin());it!=older_versions.end();++it)
|
||||
// v.push_back(*it) ;
|
||||
//
|
||||
// if(older_versions.find(messageId) == older_versions.end())
|
||||
// v.push_back(messageId);
|
||||
//
|
||||
// setMessageVersions(v) ;
|
||||
//
|
||||
// setup();
|
||||
//
|
||||
// mLoaded = false ;
|
||||
// }
|
||||
|
||||
void GxsChannelPostItem::paintEvent(QPaintEvent *e)
|
||||
{
|
||||
|
|
@ -267,6 +267,45 @@ void GxsChannelPostItem::loadComments()
|
|||
comments(title);
|
||||
}
|
||||
|
||||
void GxsChannelPostItem::loadGroup()
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "GxsChannelGroupItem::loadGroup()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
RsThread::async([this]()
|
||||
{
|
||||
// 1 - get group data
|
||||
|
||||
std::vector<RsGxsChannelGroup> groups;
|
||||
const std::list<RsGxsGroupId> groupIds = { groupId() };
|
||||
|
||||
if(!rsGxsChannels->getChannelsInfo(groupIds,groups)) // would be better to call channel Summaries for a single group
|
||||
{
|
||||
RsErr() << "GxsGxsChannelGroupItem::loadGroup() ERROR getting data" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (groups.size() != 1)
|
||||
{
|
||||
std::cerr << "GxsGxsChannelGroupItem::loadGroup() Wrong number of Items";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
RsGxsChannelGroup group(groups[0]);
|
||||
|
||||
RsQThreadUtils::postToObject( [group,this]()
|
||||
{
|
||||
/* Here it goes any code you want to be executed on the Qt Gui
|
||||
* thread, for example to update the data model with new information
|
||||
* after a blocking call to RetroShare API complete */
|
||||
|
||||
mGroupMeta = group.mMeta;
|
||||
|
||||
}, this );
|
||||
});
|
||||
}
|
||||
void GxsChannelPostItem::loadMessage()
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
|
|
@ -834,42 +873,4 @@ void GxsChannelPostItem::makeUpVote()
|
|||
emit vote(msgId, true);
|
||||
}
|
||||
|
||||
void GxsChannelPostItem::loadGroup()
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "GxsChannelGroupItem::loadGroup()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
RsThread::async([this]()
|
||||
{
|
||||
// 1 - get group data
|
||||
|
||||
std::vector<RsGxsChannelGroup> groups;
|
||||
const std::list<RsGxsGroupId> groupIds = { groupId() };
|
||||
|
||||
if(!rsGxsChannels->getChannelsInfo(groupIds,groups)) // would be better to call channel Summaries for a single group
|
||||
{
|
||||
RsErr() << "GxsGxsChannelGroupItem::loadGroup() ERROR getting data" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (groups.size() != 1)
|
||||
{
|
||||
std::cerr << "GxsGxsChannelGroupItem::loadGroup() Wrong number of Items";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
RsGxsChannelGroup group(groups[0]);
|
||||
|
||||
RsQThreadUtils::postToObject( [group,this]()
|
||||
{
|
||||
/* Here it goes any code you want to be executed on the Qt Gui
|
||||
* thread, for example to update the data model with new information
|
||||
* after a blocking call to RetroShare API complete */
|
||||
|
||||
mGroupMeta = group.mMeta;
|
||||
|
||||
}, this );
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,17 +49,12 @@ public:
|
|||
|
||||
GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGroupMetaData& group, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate, const std::set<RsGxsMessageId>& older_versions = std::set<RsGxsMessageId>());
|
||||
|
||||
// // This method can be called when additional information is known about the post. In this case, the widget will be initialized with some
|
||||
// // minimap information from the post and completed when the use displays it, which shouldn't cost anything more.
|
||||
//
|
||||
// GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelPost& post, bool isHome, bool autoUpdate, const std::set<RsGxsMessageId>& older_versions = std::set<RsGxsMessageId>());
|
||||
|
||||
virtual ~GxsChannelPostItem();
|
||||
|
||||
uint64_t uniqueIdentifier() const override { return hash_64bits("GxsChannelPostItem " + messageId().toStdString()) ; }
|
||||
|
||||
bool setGroup(const RsGxsChannelGroup &group, bool doFill = true);
|
||||
bool setPost(const RsGxsChannelPost &post, bool doFill = true);
|
||||
bool setGroup(const RsGxsChannelGroup& group, bool doFill = true);
|
||||
bool setPost(const RsGxsChannelPost& post, bool doFill = true);
|
||||
|
||||
void setFileCleanUpWarning(uint32_t time_left);
|
||||
|
||||
|
|
@ -72,7 +67,7 @@ public:
|
|||
|
||||
static uint64_t computeIdentifier(const RsGxsMessageId& msgid) { return hash64("GxsChannelPostItem " + msgid.toStdString()) ; }
|
||||
protected:
|
||||
void init(const RsGxsMessageId& messageId,const std::set<RsGxsMessageId>& older_versions);
|
||||
//void init(const RsGxsMessageId& messageId,const std::set<RsGxsMessageId>& older_versions);
|
||||
|
||||
/* FeedItem */
|
||||
virtual void doExpand(bool open);
|
||||
|
|
@ -81,7 +76,7 @@ protected:
|
|||
// This does nothing except triggering the loading of the post data and comments. This function is mainly used to detect
|
||||
// when the post is actually made visible.
|
||||
|
||||
virtual void paintEvent(QPaintEvent *);
|
||||
virtual void paintEvent(QPaintEvent *) override;
|
||||
|
||||
/* GxsGroupFeedItem */
|
||||
virtual QString groupName();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue