Code maintenance

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7335 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2014-05-05 23:25:17 +00:00
parent 306c8fe431
commit 471f4357ba
4 changed files with 202 additions and 227 deletions

View File

@ -50,28 +50,24 @@
#define SELF_LOAD 1 #define SELF_LOAD 1
#define DATA_PROVIDED 2 #define DATA_PROVIDED 2
GxsChannelPostItem::GxsChannelPostItem(FeedHolder *parent, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome) :
GxsChannelPostItem::GxsChannelPostItem(FeedHolder *parent, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome) GxsFeedItem(parent, feedId, groupId, messageId, isHome, rsGxsChannels, true)
:GxsFeedItem(parent, feedId, groupId, messageId, isHome, rsGxsChannels, true)
{ {
mMode = SELF_LOAD; mMode = SELF_LOAD;
setup(); setup();
} }
/** Constructor */ /** Constructor */
GxsChannelPostItem::GxsChannelPostItem(FeedHolder *parent, uint32_t feedId, const RsGxsChannelPost &post, uint32_t subFlags, bool isHome) GxsChannelPostItem::GxsChannelPostItem(FeedHolder *parent, uint32_t feedId, const RsGxsChannelPost &post, uint32_t subFlags, bool isHome) :
:GxsFeedItem(parent, feedId, post.mMeta.mGroupId, post.mMeta.mMsgId, isHome, rsGxsChannels, false) GxsFeedItem(parent, feedId, post.mMeta.mGroupId, post.mMeta.mMsgId, isHome, rsGxsChannels, false)
{ {
std::cerr << "GxsChannelPostItem::GxsChannelPostItem() Direct Load"; std::cerr << "GxsChannelPostItem::GxsChannelPostItem() Direct Load";
std::cerr << std::endl; std::cerr << std::endl;
mMode = DATA_PROVIDED; mMode = DATA_PROVIDED;
mGroupMeta.mSubscribeFlags = subFlags; mGroupMeta.mSubscribeFlags = subFlags;
m_inUpdateItemStatic = false; mInUpdateItemStatic = false;
setup(); setup();
@ -79,62 +75,65 @@ GxsChannelPostItem::GxsChannelPostItem(FeedHolder *parent, uint32_t feedId, cons
loadPost(post); loadPost(post);
} }
GxsChannelPostItem::~GxsChannelPostItem()
{
delete(ui);
}
void GxsChannelPostItem::setup() void GxsChannelPostItem::setup()
{ {
/* Invoke the Qt Designer generated object setup routine */ /* Invoke the Qt Designer generated object setup routine */
setupUi(this); ui = new Ui::GxsChannelPostItem;
ui->setupUi(this);
setAttribute ( Qt::WA_DeleteOnClose, true ); setAttribute ( Qt::WA_DeleteOnClose, true );
m_inUpdateItemStatic = false; mInUpdateItemStatic = false;
/* general ones */ /* general ones */
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) ); connect(ui->expandButton, SIGNAL(clicked(void)), this, SLOT(toggle(void)));
connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) ); connect(ui->clearButton, SIGNAL(clicked(void)), this, SLOT(removeItem(void)));
/* specific */ /* specific */
connect(readAndClearButton, SIGNAL(clicked()), this, SLOT(readAndClearItem())); connect(ui->readAndClearButton, SIGNAL(clicked()), this, SLOT(readAndClearItem()));
connect( unsubscribeButton, SIGNAL( clicked( void ) ), this, SLOT( unsubscribeChannel ( void ) ) ); connect(ui->unsubscribeButton, SIGNAL(clicked(void)), this, SLOT(unsubscribeChannel(void)));
connect( downloadButton, SIGNAL( clicked( void ) ), this, SLOT( download ( void ) ) ); connect(ui->downloadButton, SIGNAL(clicked(void)), this, SLOT(download(void)));
// HACK FOR NOW. // HACK FOR NOW.
connect( commentButton, SIGNAL( clicked( void ) ), this, SLOT( loadComments ( void ) ) ); connect(ui->commentButton, SIGNAL(clicked(void)), this, SLOT(loadComments(void)));
connect( playButton, SIGNAL( clicked( void ) ), this, SLOT( play ( void ) ) ); connect(ui->playButton, SIGNAL(clicked(void)), this, SLOT( play(void)));
connect( copyLinkButton, SIGNAL( clicked( void ) ), this, SLOT( copyLink ( void ) ) ); connect(ui->copyLinkButton, SIGNAL(clicked(void)), this, SLOT(copyLink(void)));
connect( readButton, SIGNAL( toggled(bool) ), this, SLOT( readToggled(bool) ) ); connect(ui->readButton, SIGNAL(toggled(bool)), this, SLOT(readToggled(bool)));
connect( NotifyQt::getInstance(), SIGNAL(channelMsgReadSatusChanged(QString,QString,int)), this, SLOT(channelMsgReadSatusChanged(QString,QString,int)), Qt::QueuedConnection); //connect(NotifyQt::getInstance(), SIGNAL(channelMsgReadSatusChanged(QString,QString,int)), this, SLOT(channelMsgReadSatusChanged(QString,QString,int)), Qt::QueuedConnection);
//connect( voteUpButton, SIGNAL(clicked()), this, SLOT(makeUpVote())); //connect(ui-> voteUpButton, SIGNAL(clicked()), this, SLOT(makeUpVote()));
//connect( voteDownButton, SIGNAL(clicked()), this, SLOT( makeDownVote())); //connect(ui->voteDownButton, SIGNAL(clicked()), this, SLOT(makeDownVote()));
downloadButton->hide(); ui->downloadButton->hide();
playButton->hide(); ui->playButton->hide();
warn_image_label->hide(); ui->warn_image_label->hide();
warning_label->hide(); ui->warning_label->hide();
titleLabel->setMinimumWidth(100); ui->titleLabel->setMinimumWidth(100);
subjectLabel->setMinimumWidth(100); ui->subjectLabel->setMinimumWidth(100);
warning_label->setMinimumWidth(100); ui->warning_label->setMinimumWidth(100);
frame->setProperty("state", ""); ui->frame->setProperty("state", "");
QPalette palette = frame->palette(); QPalette palette = ui->frame->palette();
palette.setColor(frame->backgroundRole(), COLOR_NORMAL); palette.setColor(ui->frame->backgroundRole(), COLOR_NORMAL);
frame->setPalette(palette); ui->frame->setPalette(palette);
expandFrame->hide(); ui->expandFrame->hide();
} }
void GxsChannelPostItem::loadComments() void GxsChannelPostItem::loadComments()
{ {
QString title = QString::fromUtf8(mPost.mMeta.mMsgName.c_str()); QString title = QString::fromUtf8(mPost.mMeta.mMsgName.c_str());
comments(title); comments(title);
} }
void GxsChannelPostItem::loadMessage(const uint32_t &token) void GxsChannelPostItem::loadMessage(const uint32_t &token)
{ {
std::cerr << "GxsChannelPostItem::loadMessage()"; std::cerr << "GxsChannelPostItem::loadMessage()";
@ -160,8 +159,6 @@ void GxsChannelPostItem::loadMessage(const uint32_t &token)
updateItem(); updateItem();
} }
void GxsChannelPostItem::loadPost(const RsGxsChannelPost &post) void GxsChannelPostItem::loadPost(const RsGxsChannelPost &post)
{ {
/* fill in */ /* fill in */
@ -170,7 +167,7 @@ void GxsChannelPostItem::loadPost(const RsGxsChannelPost &post)
std::cerr << std::endl; std::cerr << std::endl;
#endif #endif
m_inUpdateItemStatic = true; mInUpdateItemStatic = true;
mPost = post; mPost = post;
@ -182,44 +179,43 @@ void GxsChannelPostItem::loadPost(const RsGxsChannelPost &post)
RetroShareLink link; RetroShareLink link;
link.createChannel(post.mMeta.mGroupId.toStdString(), ""); link.createChannel(post.mMeta.mGroupId.toStdString(), "");
title += link.toHtml(); title += link.toHtml();
titleLabel->setText(title); ui->titleLabel->setText(title);
RetroShareLink msgLink; RetroShareLink msgLink;
msgLink.createChannel(post.mMeta.mGroupId.toStdString(), post.mMeta.mMsgId.toStdString()); msgLink.createChannel(post.mMeta.mGroupId.toStdString(), post.mMeta.mMsgId.toStdString());
subjectLabel->setText(msgLink.toHtml()); ui->subjectLabel->setText(msgLink.toHtml());
if (IS_GROUP_SUBSCRIBED(mSubscribeFlags) || IS_GROUP_ADMIN(mSubscribeFlags)) if (IS_GROUP_SUBSCRIBED(mSubscribeFlags) || IS_GROUP_ADMIN(mSubscribeFlags))
{ {
unsubscribeButton->setEnabled(true); ui->unsubscribeButton->setEnabled(true);
} }
else else
{ {
unsubscribeButton->setEnabled(false); ui->unsubscribeButton->setEnabled(false);
} }
readButton->hide(); ui->readButton->hide();
//newLabel->hide(); //newLabel->hide();
copyLinkButton->hide(); ui->copyLinkButton->hide();
} }
else else
{ {
/* subject */ /* subject */
titleLabel->setText(QString::fromUtf8(post.mMeta.mMsgName.c_str())); ui->titleLabel->setText(QString::fromUtf8(post.mMeta.mMsgName.c_str()));
subjectLabel->setText(RsHtml().formatText(NULL, QString::fromUtf8(post.mMsg.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS)); ui->subjectLabel->setText(RsHtml().formatText(NULL, QString::fromUtf8(post.mMsg.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
//QString score = QString::number(post.mTopScore); //QString score = QString::number(post.mTopScore);
// scoreLabel->setText(score); // scoreLabel->setText(score);
/* disable buttons: deletion facility not enabled with cache services yet */ /* disable buttons: deletion facility not enabled with cache services yet */
clearButton->setEnabled(false); ui->clearButton->setEnabled(false);
unsubscribeButton->setEnabled(false); ui->unsubscribeButton->setEnabled(false);
clearButton->hide(); ui->clearButton->hide();
readAndClearButton->hide(); ui->readAndClearButton->hide();
unsubscribeButton->hide(); ui->unsubscribeButton->hide();
copyLinkButton->show(); ui->copyLinkButton->show();
if (IS_GROUP_SUBSCRIBED(mGroupMeta.mSubscribeFlags) || IS_GROUP_ADMIN(mGroupMeta.mSubscribeFlags)) if (IS_GROUP_SUBSCRIBED(mGroupMeta.mSubscribeFlags) || IS_GROUP_ADMIN(mGroupMeta.mSubscribeFlags))
{ {
ui->readButton->setVisible(true);
readButton->setVisible(true);
#if 0 #if 0
uint32_t status = 0; uint32_t status = 0;
rsChannels->getMessageStatus(mChanId, mMsgId, status); rsChannels->getMessageStatus(mChanId, mMsgId, status);
@ -227,13 +223,13 @@ void GxsChannelPostItem::loadPost(const RsGxsChannelPost &post)
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))
{ {
readButton->setChecked(true); ui->readButton->setChecked(true);
readButton->setIcon(QIcon(":/images/message-state-unread.png")); ui->readButton->setIcon(QIcon(":/images/message-state-unread.png"));
} }
else else
{ {
readButton->setChecked(false); ui->readButton->setChecked(false);
readButton->setIcon(QIcon(":/images/message-state-read.png")); ui->readButton->setIcon(QIcon(":/images/message-state-read.png"));
} }
bool newState; bool newState;
@ -252,26 +248,26 @@ void GxsChannelPostItem::loadPost(const RsGxsChannelPost &post)
} }
/* unpolish widget to clear the stylesheet's palette cache */ /* unpolish widget to clear the stylesheet's palette cache */
frame->style()->unpolish(frame); ui->frame->style()->unpolish(ui->frame);
QPalette palette = frame->palette(); QPalette palette = ui->frame->palette();
palette.setColor(frame->backgroundRole(), color); palette.setColor(ui->frame->backgroundRole(), color);
frame->setPalette(palette); ui->frame->setPalette(palette);
frame->setProperty("new", newState); ui->frame->setProperty("new", newState);
Rshare::refreshStyleSheet(frame, false); Rshare::refreshStyleSheet(ui->frame, false);
} }
else else
{ {
readButton->setVisible(false); ui->readButton->setVisible(false);
//newLabel->setVisible(false); //ui->newLabel->setVisible(false);
} }
} }
// differences between Feed or Top of Comment. // differences between Feed or Top of Comment.
if (mParent) if (mParent)
{ {
commentButton->show(); ui->commentButton->show();
// THIS CODE IS doesn't compile - disabling until fixed. // THIS CODE IS doesn't compile - disabling until fixed.
#if 0 #if 0
@ -280,18 +276,18 @@ void GxsChannelPostItem::loadPost(const RsGxsChannelPost &post)
QString commentText = QString::number(post.mComments); QString commentText = QString::number(post.mComments);
commentText += " "; commentText += " ";
commentText += tr("Comments"); commentText += tr("Comments");
commentButton->setText(commentText); ui->commentButton->setText(commentText);
} }
else else
{ {
commentButton->setText(tr("Comment")); ui->commentButton->setText(tr("Comment"));
} }
#endif #endif
} }
else else
{ {
commentButton->hide(); ui->commentButton->hide();
} }
// disable voting buttons - if they have already voted. // disable voting buttons - if they have already voted.
@ -301,12 +297,12 @@ void GxsChannelPostItem::loadPost(const RsGxsChannelPost &post)
voteDownButton->setEnabled(false); voteDownButton->setEnabled(false);
}*/ }*/
msgLabel->setText(RsHtml().formatText(NULL, QString::fromUtf8(post.mMsg.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS)); ui->msgLabel->setText(RsHtml().formatText(NULL, QString::fromUtf8(post.mMsg.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
msgFrame->setVisible(!post.mMsg.empty()); ui->msgFrame->setVisible(!post.mMsg.empty());
datetimelabel->setText(DateTime::formatLongDateTime(post.mMeta.mPublishTs)); ui->datetimelabel->setText(DateTime::formatLongDateTime(post.mMeta.mPublishTs));
filelabel->setText(QString("(%1 %2) %3").arg(post.mCount).arg(tr("Files")).arg(misc::friendlyUnit(post.mSize))); ui->filelabel->setText(QString("(%1 %2) %3").arg(post.mCount).arg(tr("Files")).arg(misc::friendlyUnit(post.mSize)));
if (mFileItems.empty() == false) { if (mFileItems.empty() == false) {
std::list<SubFileItem *>::iterator it; std::list<SubFileItem *>::iterator it;
@ -329,8 +325,7 @@ void GxsChannelPostItem::loadPost(const RsGxsChannelPost &post)
if (!misc::isPreviewable(QFileInfo(QString::fromUtf8(it->mName.c_str())).suffix())) if (!misc::isPreviewable(QFileInfo(QString::fromUtf8(it->mName.c_str())).suffix()))
fi->mediatype(); fi->mediatype();
QLayout *layout = ui->expandFrame->layout();
QLayout *layout = expandFrame->layout();
layout->addWidget(fi); layout->addWidget(fi);
} }
@ -339,10 +334,10 @@ void GxsChannelPostItem::loadPost(const RsGxsChannelPost &post)
QPixmap thumbnail; QPixmap thumbnail;
thumbnail.loadFromData(post.mThumbnail.mData, post.mThumbnail.mSize, "PNG"); thumbnail.loadFromData(post.mThumbnail.mData, post.mThumbnail.mSize, "PNG");
// Wiping data - as its been passed to thumbnail. // Wiping data - as its been passed to thumbnail.
logoLabel->setPixmap(thumbnail); ui->logoLabel->setPixmap(thumbnail);
} }
m_inUpdateItemStatic = false; mInUpdateItemStatic = false;
} }
void GxsChannelPostItem::setFileCleanUpWarning(uint32_t time_left) void GxsChannelPostItem::setFileCleanUpWarning(uint32_t time_left)
@ -350,22 +345,21 @@ void GxsChannelPostItem::setFileCleanUpWarning(uint32_t time_left)
int hours = (int)time_left/3600; int hours = (int)time_left/3600;
int minutes = (time_left - hours*3600)%60; int minutes = (time_left - hours*3600)%60;
warning_label->setText(tr("Warning! You have less than %1 hours and %2 minute before this file is deleted Consider saving it.").arg( ui->warning_label->setText(tr("Warning! You have less than %1 hours and %2 minute before this file is deleted Consider saving it.").arg(
QString::number(hours)).arg(QString::number(minutes))); QString::number(hours)).arg(QString::number(minutes)));
QFont warnFont = warning_label->font(); QFont warnFont = ui->warning_label->font();
warnFont.setBold(true); warnFont.setBold(true);
warning_label->setFont(warnFont); ui->warning_label->setFont(warnFont);
warn_image_label->setVisible(true);
warning_label->setVisible(true);
return;
ui->warn_image_label->setVisible(true);
ui->warning_label->setVisible(true);
} }
void GxsChannelPostItem::updateItem() void GxsChannelPostItem::updateItem()
{ {
/* fill in */ /* fill in */
#ifdef DEBUG_ITEM #ifdef DEBUG_ITEM
std::cerr << "GxsChannelPostItem::updateItem()"; std::cerr << "GxsChannelPostItem::updateItem()";
std::cerr << std::endl; std::cerr << std::endl;
@ -406,27 +400,27 @@ void GxsChannelPostItem::updateItem()
} }
if (downloadCount) { if (downloadCount) {
downloadButton->show(); ui->downloadButton->show();
if (downloadStartable) { if (downloadStartable) {
downloadButton->setEnabled(true); ui->downloadButton->setEnabled(true);
} else { } else {
downloadButton->setEnabled(false); ui->downloadButton->setEnabled(false);
} }
} else { } else {
downloadButton->hide(); ui->downloadButton->hide();
} }
if (playCount) { if (playCount) {
/* one file is playable */ /* one file is playable */
playButton->show(); ui->playButton->show();
if (playStartable == 1) { if (playStartable == 1) {
playButton->setEnabled(true); ui->playButton->setEnabled(true);
} else { } else {
playButton->setEnabled(false); ui->playButton->setEnabled(false);
} }
} else { } else {
playButton->hide(); ui->playButton->hide();
} }
if (loopAgain) { if (loopAgain) {
@ -445,19 +439,19 @@ void GxsChannelPostItem::toggle()
mParent->lockLayout(this, true); mParent->lockLayout(this, true);
} }
if (expandFrame->isHidden()) if (ui->expandFrame->isHidden())
{ {
expandFrame->show(); ui->expandFrame->show();
expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png"))); ui->expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png")));
expandButton->setToolTip(tr("Hide")); ui->expandButton->setToolTip(tr("Hide"));
readToggled(false); readToggled(false);
} }
else else
{ {
expandFrame->hide(); ui->expandFrame->hide();
expandButton->setIcon(QIcon(QString(":/images/edit_add24.png"))); ui->expandButton->setIcon(QIcon(QString(":/images/edit_add24.png")));
expandButton->setToolTip(tr("Expand")); ui->expandButton->setToolTip(tr("Expand"));
} }
if (mParent) if (mParent)
@ -515,9 +509,8 @@ void GxsChannelPostItem::play()
void GxsChannelPostItem::readToggled(bool checked) void GxsChannelPostItem::readToggled(bool checked)
{ {
#if 0 #if 0
if (m_inUpdateItemStatic) { if (mInUpdateItemStatic) {
return; return;
} }
@ -538,14 +531,11 @@ void GxsChannelPostItem::readToggled(bool checked)
if (!mIsHome) { if (!mIsHome) {
connect( NotifyQt::getInstance(), SIGNAL(channelMsgReadSatusChanged(QString,QString,int)), this, SLOT(channelMsgReadSatusChanged(QString,QString,int)), Qt::QueuedConnection); connect( NotifyQt::getInstance(), SIGNAL(channelMsgReadSatusChanged(QString,QString,int)), this, SLOT(channelMsgReadSatusChanged(QString,QString,int)), Qt::QueuedConnection);
} }
#endif #endif
} }
void GxsChannelPostItem::channelMsgReadSatusChanged(const QString& channelId, const QString& msgId, int status) void GxsChannelPostItem::channelMsgReadSatusChanged(const QString& channelId, const QString& msgId, int status)
{ {
#if 0 #if 0
if (channelId.toStdString() == mChanId && msgId.toStdString() == mMsgId) { if (channelId.toStdString() == mChanId && msgId.toStdString() == mMsgId) {
if (!mIsHome) { if (!mIsHome) {
@ -557,12 +547,10 @@ void GxsChannelPostItem::channelMsgReadSatusChanged(const QString& channelId, co
updateItemStatic(); updateItemStatic();
} }
#endif #endif
} }
void GxsChannelPostItem::copyLink() void GxsChannelPostItem::copyLink()
{ {
#if 0 #if 0
if (mChanId.empty() || mMsgId.empty()) { if (mChanId.empty() || mMsgId.empty()) {
return; return;
@ -578,7 +566,6 @@ void GxsChannelPostItem::copyLink()
} }
} }
#endif #endif
} }
void GxsChannelPostItem::makeDownVote() void GxsChannelPostItem::makeDownVote()
@ -587,8 +574,8 @@ void GxsChannelPostItem::makeDownVote()
msgId.first = mPost.mMeta.mGroupId; msgId.first = mPost.mMeta.mGroupId;
msgId.second = mPost.mMeta.mMsgId; msgId.second = mPost.mMeta.mMsgId;
voteUpButton->setEnabled(false); ui->voteUpButton->setEnabled(false);
voteDownButton->setEnabled(false); ui->voteDownButton->setEnabled(false);
emit vote(msgId, false); emit vote(msgId, false);
} }
@ -599,8 +586,8 @@ void GxsChannelPostItem::makeUpVote()
msgId.first = mPost.mMeta.mGroupId; msgId.first = mPost.mMeta.mGroupId;
msgId.second = mPost.mMeta.mMsgId; msgId.second = mPost.mMeta.mMsgId;
voteUpButton->setEnabled(false); ui->voteUpButton->setEnabled(false);
voteDownButton->setEnabled(false); ui->voteDownButton->setEnabled(false);
emit vote(msgId, true); emit vote(msgId, true);
} }

View File

@ -29,10 +29,14 @@
#include "ui_GxsChannelPostItem.h" #include "ui_GxsChannelPostItem.h"
#include <stdint.h> #include <stdint.h>
namespace Ui {
class GxsChannelPostItem;
}
class FeedHolder; class FeedHolder;
class SubFileItem; class SubFileItem;
class GxsChannelPostItem : public GxsFeedItem, private Ui::GxsChannelPostItem class GxsChannelPostItem : public GxsFeedItem
{ {
Q_OBJECT Q_OBJECT
@ -40,11 +44,10 @@ public:
/** Default Constructor */ /** Default Constructor */
GxsChannelPostItem(FeedHolder *parent, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome); GxsChannelPostItem(FeedHolder *parent, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome);
GxsChannelPostItem(FeedHolder *parent, uint32_t feedId, const RsGxsChannelPost &post, uint32_t subscribeFlags, bool isHome); GxsChannelPostItem(FeedHolder *parent, uint32_t feedId, const RsGxsChannelPost &post, uint32_t subscribeFlags, bool isHome);
virtual ~GxsChannelPostItem();
void setFileCleanUpWarning(uint32_t time_left); void setFileCleanUpWarning(uint32_t time_left);
//const std::string &msgId() { return mMsgId; }
protected: protected:
virtual void loadMessage(const uint32_t &token); virtual void loadMessage(const uint32_t &token);
@ -73,14 +76,16 @@ private:
void setup(); void setup();
void loadPost(const RsGxsChannelPost &post); void loadPost(const RsGxsChannelPost &post);
bool m_inUpdateItemStatic; bool mInUpdateItemStatic;
uint32_t mMode; uint32_t mMode;
uint32_t mSubscribeFlags; uint32_t mSubscribeFlags;
RsGxsChannelPost mPost; RsGxsChannelPost mPost;
std::list<SubFileItem *> mFileItems; std::list<SubFileItem *> mFileItems;
/** Qt Designer generated object */
Ui::GxsChannelPostItem *ui;
}; };
#endif #endif

View File

@ -30,12 +30,9 @@
* #define DEBUG_ITEM 1 * #define DEBUG_ITEM 1
**/ **/
#define DEBUG_ITEM 1
#define GXSFEEDITEM_GROUPMETA 5 #define GXSFEEDITEM_GROUPMETA 5
#define GXSFEEDITEM_MESSAGE 6 #define GXSFEEDITEM_MESSAGE 6
void GxsFeedItem::removeItem() void GxsFeedItem::removeItem()
{ {
#ifdef DEBUG_ITEM #ifdef DEBUG_ITEM
@ -84,7 +81,6 @@ void GxsFeedItem::unsubscribe()
} }
} }
void GxsFeedItem::subscribe() void GxsFeedItem::subscribe()
{ {
#ifdef DEBUG_ITEM #ifdef DEBUG_ITEM
@ -99,26 +95,24 @@ void GxsFeedItem::subscribe()
} }
} }
void GxsFeedItem::updateItemStatic() void GxsFeedItem::updateItemStatic()
{ {
std::cerr << "GxsFeedItem::updateItemStatic()"; std::cerr << "GxsFeedItem::updateItemStatic()";
std::cerr << std::endl; std::cerr << std::endl;
requestMessage(); requestMessage();
} }
void GxsFeedItem::updateItem() void GxsFeedItem::updateItem()
{ {
std::cerr << "GxsFeedItem::updateItem() EMPTY"; std::cerr << "GxsFeedItem::updateItem() EMPTY";
std::cerr << std::endl; std::cerr << std::endl;
} }
/***********************************************************/ /***********************************************************/
GxsFeedItem::GxsFeedItem(FeedHolder *parent, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome, RsGxsIfaceHelper *iface, bool loadData) GxsFeedItem::GxsFeedItem(FeedHolder *parent, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome, RsGxsIfaceHelper *iface, bool loadData) :
:QWidget(NULL) QWidget(NULL)
{ {
std::cerr << "GxsFeedItem::GxsFeedItem()"; std::cerr << "GxsFeedItem::GxsFeedItem()";
std::cerr << std::endl; std::cerr << std::endl;
@ -144,7 +138,6 @@ GxsFeedItem::GxsFeedItem(FeedHolder *parent, uint32_t feedId, const RsGxsGroupId
} }
} }
GxsFeedItem::~GxsFeedItem() GxsFeedItem::~GxsFeedItem()
{ {
std::cerr << "GxsFeedItem::~GxsFeedItem()"; std::cerr << "GxsFeedItem::~GxsFeedItem()";
@ -156,7 +149,6 @@ GxsFeedItem::~GxsFeedItem()
} }
} }
void GxsFeedItem::requestGroupMeta() void GxsFeedItem::requestGroupMeta()
{ {
std::cerr << "GxsFeedItem::requestGroup()"; std::cerr << "GxsFeedItem::requestGroup()";
@ -178,7 +170,6 @@ void GxsFeedItem::requestGroupMeta()
updateItemStatic(); updateItemStatic();
} }
void GxsFeedItem::requestMessage() void GxsFeedItem::requestMessage()
{ {
std::cerr << "GxsFeedItem::requestMessage()"; std::cerr << "GxsFeedItem::requestMessage()";
@ -200,7 +191,6 @@ void GxsFeedItem::requestMessage()
mLoadQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, GXSFEEDITEM_MESSAGE); mLoadQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, GXSFEEDITEM_MESSAGE);
} }
void GxsFeedItem::loadGroupMeta(const uint32_t &token) void GxsFeedItem::loadGroupMeta(const uint32_t &token)
{ {
std::cerr << "GxsFeedItem::loadGroupMeta()"; std::cerr << "GxsFeedItem::loadGroupMeta()";
@ -226,7 +216,6 @@ void GxsFeedItem::loadGroupMeta(const uint32_t &token)
} }
} }
void GxsFeedItem::loadRequest(const TokenQueue *queue, const TokenRequest &req) void GxsFeedItem::loadRequest(const TokenQueue *queue, const TokenRequest &req)
{ {
std::cerr << "GxsFeedItem::loadRequest()"; std::cerr << "GxsFeedItem::loadRequest()";
@ -251,5 +240,3 @@ void GxsFeedItem::loadRequest(const TokenQueue *queue, const TokenRequest &req)
} }
} }
} }

View File

@ -43,28 +43,25 @@ virtual ~GxsFeedItem();
RsGxsMessageId messageId() { return mMessageId; } RsGxsMessageId messageId() { return mMessageId; }
protected: protected:
// generic Fns - to be overloaded. // generic Fns - to be overloaded.
virtual void updateItemStatic(); virtual void updateItemStatic();
virtual void updateItem(); virtual void updateItem();
virtual void loadMessage(const uint32_t &token) = 0; virtual void loadMessage(const uint32_t &token) = 0;
void requestMessage(); void requestMessage();
virtual void loadGroupMeta(const uint32_t &token); virtual void loadGroupMeta(const uint32_t &token);
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req); virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
// general fns that can be implemented here. // general fns that can be implemented here.
protected slots:
protected slots:
void comments(const QString &title); void comments(const QString &title);
void subscribe(); void subscribe();
void unsubscribe(); void unsubscribe();
void removeItem(); void removeItem();
protected: protected:
FeedHolder *mParent; FeedHolder *mParent;
uint32_t mFeedId; uint32_t mFeedId;
bool mIsHome; bool mIsHome;
@ -75,7 +72,6 @@ protected:
RsGroupMetaData mGroupMeta; RsGroupMetaData mGroupMeta;
private: private:
void requestGroupMeta(); void requestGroupMeta();
RsGxsIfaceHelper *mGxsIface; RsGxsIfaceHelper *mGxsIface;