mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 06:06:10 -04:00
Show channel logo in group tree
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7528 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
3dff1d7bfc
commit
e07dac9ca7
6 changed files with 110 additions and 20 deletions
|
@ -27,6 +27,16 @@
|
|||
#include "gui/feeds/GxsChannelPostItem.h"
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
#include "gui/notifyqt.h"
|
||||
#include "gui/common/GroupTreeWidget.h"
|
||||
|
||||
class GxsChannelGroupInfoData : public RsUserdata
|
||||
{
|
||||
public:
|
||||
GxsChannelGroupInfoData() : RsUserdata() {}
|
||||
|
||||
public:
|
||||
QMap<RsGxsGroupId, QIcon> mIcon;
|
||||
};
|
||||
|
||||
/** Constructor */
|
||||
GxsChannelDialog::GxsChannelDialog(QWidget *parent)
|
||||
|
@ -168,3 +178,42 @@ void GxsChannelDialog::toggleAutoDownload()
|
|||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void GxsChannelDialog::loadGroupSummaryToken(const uint32_t &token, std::list<RsGroupMetaData> &groupInfo, RsUserdata *&userdata)
|
||||
{
|
||||
std::vector<RsGxsChannelGroup> groups;
|
||||
rsGxsChannels->getGroupData(token, groups);
|
||||
|
||||
/* Save groups to fill icons */
|
||||
GxsChannelGroupInfoData *channelData = new GxsChannelGroupInfoData;
|
||||
userdata = channelData;
|
||||
|
||||
std::vector<RsGxsChannelGroup>::iterator groupIt;
|
||||
for (groupIt = groups.begin(); groupIt != groups.end(); ++groupIt) {
|
||||
RsGxsChannelGroup &group = *groupIt;
|
||||
groupInfo.push_back(group.mMeta);
|
||||
|
||||
if (group.mImage.mData != NULL) {
|
||||
QPixmap image;
|
||||
image.loadFromData(group.mImage.mData, group.mImage.mSize, "PNG");
|
||||
channelData->mIcon[group.mMeta.mGroupId] = image;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GxsChannelDialog::groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo, const RsUserdata *userdata)
|
||||
{
|
||||
GxsGroupFrameDialog::groupInfoToGroupItemInfo(groupInfo, groupItemInfo, userdata);
|
||||
|
||||
const GxsChannelGroupInfoData *channelData = dynamic_cast<const GxsChannelGroupInfoData*>(userdata);
|
||||
if (!channelData) {
|
||||
std::cerr << "GxsChannelDialog::groupInfoToGroupItemInfo() Failed to cast data to GxsChannelGroupInfoData";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
QMap<RsGxsGroupId, QIcon>::const_iterator iconIt = channelData->mIcon.find(groupInfo.mGroupId);
|
||||
if (iconIt != channelData->mIcon.end()) {
|
||||
groupItemInfo.icon = iconIt.value();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,9 +43,11 @@ public:
|
|||
virtual UserNotify *getUserNotify(QObject *parent);
|
||||
|
||||
protected:
|
||||
/* GxsGroupFrameDialog */
|
||||
virtual RetroShareLink::enumType getLinkType() { return RetroShareLink::TYPE_CHANNEL; }
|
||||
virtual GroupFrameSettings::Type groupFrameSettingsType() { return GroupFrameSettings::Channel; }
|
||||
virtual QString getHelpString() const ;
|
||||
virtual void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo, const RsUserdata *userdata);
|
||||
|
||||
private slots:
|
||||
void toggleAutoDownload();
|
||||
|
@ -62,6 +64,8 @@ private:
|
|||
virtual void groupTreeCustomActions(RsGxsGroupId grpId, int subscribeFlags, QList<QAction*> &actions);
|
||||
virtual RsGxsCommentService *getCommentService();
|
||||
virtual QWidget *createCommentHeaderWidget(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId);
|
||||
virtual uint32_t requestGroupSummaryType() { return GXS_REQUEST_TYPE_GROUP_DATA; } // request complete group data
|
||||
virtual void loadGroupSummaryToken(const uint32_t &token, std::list<RsGroupMetaData> &groupInfo, RsUserdata* &userdata);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue