From 4edcec6fe95f2a0313085a56903129d7b336fa58 Mon Sep 17 00:00:00 2001 From: thunder2 Date: Mon, 15 Jul 2013 18:39:39 +0000 Subject: [PATCH] Posted Links: - cleaned source code - added auto refresh Updated english translation git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6506 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- .../src/gui/Posted/PostedCreatePostDialog.cpp | 74 +-- .../src/gui/Posted/PostedCreatePostDialog.h | 33 +- .../src/gui/Posted/PostedCreatePostDialog.ui | 30 +- retroshare-gui/src/gui/Posted/PostedDialog.h | 18 +- .../src/gui/Posted/PostedGroupDialog.cpp | 9 +- .../src/gui/Posted/PostedGroupDialog.h | 6 +- retroshare-gui/src/gui/Posted/PostedItem.cpp | 61 +-- retroshare-gui/src/gui/Posted/PostedItem.h | 33 +- .../src/gui/Posted/PostedListDialog.cpp | 434 +++++++----------- .../src/gui/Posted/PostedListDialog.h | 169 ++++--- .../src/gui/Posted/PostedListDialog.ui | 9 +- .../src/gui/gxs/GxsCommentContainer.cpp | 48 +- .../src/gui/gxs/GxsCommentContainer.h | 29 +- .../src/gui/gxs/GxsCommentContainer.ui | 25 +- .../src/gui/gxschannels/ChannelDialog.h | 18 +- retroshare-gui/src/lang/retroshare_en.ts | 6 +- 16 files changed, 406 insertions(+), 596 deletions(-) diff --git a/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.cpp b/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.cpp index 12bc58b27..30276b5f9 100644 --- a/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.cpp +++ b/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.cpp @@ -24,50 +24,54 @@ #include #include "PostedCreatePostDialog.h" #include "ui_PostedCreatePostDialog.h" +#include "PostedUserTypes.h" + +#include "util/TokenQueue.h" #include PostedCreatePostDialog::PostedCreatePostDialog(TokenQueue* tokenQ, RsPosted *posted, const RsGxsGroupId& grpId, QWidget *parent): - QDialog(parent), mTokenQueue(tokenQ), mPosted(posted), mGrpId(grpId), - ui(new Ui::PostedCreatePostDialog) + QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint), + mTokenQueue(tokenQ), mPosted(posted), mGrpId(grpId), + ui(new Ui::PostedCreatePostDialog) { - ui->setupUi(this); - connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(createPost())); + ui->setupUi(this); - /* fill in the available OwnIds for signing */ - ui->idChooser->loadIds(IDCHOOSER_ID_REQUIRED, ""); + connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(createPost())); + connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(close())); -} - -void PostedCreatePostDialog::createPost() -{ - RsGxsId authorId; - if (!ui->idChooser->getChosenId(authorId)) - { - std::cerr << "PostedCreatePostDialog::createPost() ERROR GETTING AuthorId!, Post Failed"; - std::cerr << std::endl; - - QMessageBox::warning(this, tr("RetroShare"),tr("Please create or choose a Signing Id first"), - QMessageBox::Ok, QMessageBox::Ok); - - return; - } - - - RsPostedPost post; - post.mMeta.mGroupId = mGrpId; - post.mLink = std::string(ui->linkEdit->text().toUtf8()); - post.mNotes = std::string(ui->notesTextEdit->toPlainText().toUtf8()); - post.mMeta.mMsgName = std::string(ui->titleEdit->text().toUtf8()); - post.mMeta.mAuthorId = authorId; - - uint32_t token; - mPosted->createPost(token, post); - mTokenQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, TOKEN_USER_TYPE_POST); - accept(); + /* fill in the available OwnIds for signing */ + ui->idChooser->loadIds(IDCHOOSER_ID_REQUIRED, ""); } PostedCreatePostDialog::~PostedCreatePostDialog() { - delete ui; + delete ui; +} + +void PostedCreatePostDialog::createPost() +{ + RsGxsId authorId; + if (!ui->idChooser->getChosenId(authorId)) + { + std::cerr << "PostedCreatePostDialog::createPost() ERROR GETTING AuthorId!, Post Failed"; + std::cerr << std::endl; + + QMessageBox::warning(this, tr("RetroShare"),tr("Please create or choose a Signing Id first"), QMessageBox::Ok, QMessageBox::Ok); + + return; + } + + RsPostedPost post; + post.mMeta.mGroupId = mGrpId; + post.mLink = std::string(ui->linkEdit->text().toUtf8()); + post.mNotes = std::string(ui->notesTextEdit->toPlainText().toUtf8()); + post.mMeta.mMsgName = std::string(ui->titleEdit->text().toUtf8()); + post.mMeta.mAuthorId = authorId; + + uint32_t token; + mPosted->createPost(token, post); + mTokenQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, TOKEN_USER_TYPE_POST); + + accept(); } diff --git a/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.h b/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.h index 85531bda9..d4a7bc49c 100644 --- a/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.h +++ b/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.h @@ -26,12 +26,11 @@ #include #include "retroshare/rsposted.h" -#include "PostedUserTypes.h" -#include "util/TokenQueue.h" +class TokenQueue; namespace Ui { - class PostedCreatePostDialog; + class PostedCreatePostDialog; } class PostedCreatePostDialog : public QDialog @@ -39,26 +38,24 @@ class PostedCreatePostDialog : public QDialog Q_OBJECT public: - - /*! - * @param tokenQ parent callee token - * @param posted - */ - explicit PostedCreatePostDialog(TokenQueue* tokenQ, RsPosted* posted, const RsGxsGroupId& grpId, QWidget *parent = 0); - ~PostedCreatePostDialog(); + /*! + * @param tokenQ parent callee token + * @param posted + */ + explicit PostedCreatePostDialog(TokenQueue* tokenQ, RsPosted* posted, const RsGxsGroupId& grpId, QWidget *parent = 0); + ~PostedCreatePostDialog(); private slots: - - void createPost(); + void createPost(); private: - Ui::PostedCreatePostDialog *ui; + QString mLink; + QString mNotes; + TokenQueue* mTokenQueue; + RsPosted* mPosted; + RsGxsGroupId mGrpId; - QString mLink; - QString mNotes; - RsPosted* mPosted; - RsGxsGroupId mGrpId; - TokenQueue* mTokenQueue; + Ui::PostedCreatePostDialog *ui; }; #endif // POSTEDCREATEPOSTDIALOG_H diff --git a/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.ui b/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.ui index 0da5d3806..92c4a5c44 100644 --- a/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.ui +++ b/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.ui @@ -15,9 +15,12 @@ - - - + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> @@ -27,15 +30,8 @@ p, li { white-space: pre-wrap; } - - - - - - - - - + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> @@ -45,7 +41,7 @@ p, li { white-space: pre-wrap; } - + @@ -81,9 +77,9 @@ p, li { white-space: pre-wrap; } - + - + Notes @@ -113,9 +109,7 @@ p, li { white-space: pre-wrap; }
gui/gxs/GxsIdChooser.h
- - - + buttonBox diff --git a/retroshare-gui/src/gui/Posted/PostedDialog.h b/retroshare-gui/src/gui/Posted/PostedDialog.h index 7fd2be4b2..1289b7b15 100644 --- a/retroshare-gui/src/gui/Posted/PostedDialog.h +++ b/retroshare-gui/src/gui/Posted/PostedDialog.h @@ -28,10 +28,11 @@ #include "gui/gxs/GxsCommentContainer.h" #include "gui/Posted/PostedListDialog.h" +#include "gui/Posted/PostedItem.h" class PostedDialog : public GxsCommentContainer { - Q_OBJECT + Q_OBJECT public: PostedDialog(QWidget *parent = 0) @@ -44,7 +45,7 @@ public: virtual QString getServiceName() { - return tr("Posted"); + return tr("Posted Links"); } virtual RsTokenService *getTokenService() @@ -57,12 +58,15 @@ public: return rsPosted; } - virtual QWidget *createHeaderWidget(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId) - { - return new PostedItem(NULL, 0, grpId, msgId, true); - } + virtual QWidget *createHeaderWidget(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId) + { + return new PostedItem(NULL, 0, grpId, msgId, true); + } + virtual QPixmap getServicePixmap() + { + return QPixmap(":/images/posted_24.png"); + } }; #endif - diff --git a/retroshare-gui/src/gui/Posted/PostedGroupDialog.cpp b/retroshare-gui/src/gui/Posted/PostedGroupDialog.cpp index eecd28cf2..0ec0a9bf6 100644 --- a/retroshare-gui/src/gui/Posted/PostedGroupDialog.cpp +++ b/retroshare-gui/src/gui/Posted/PostedGroupDialog.cpp @@ -52,19 +52,14 @@ uint32_t PostedCreateDefaultsFlags = ( GXS_GROUP_DEFAULTS_DISTRIB_PUBLIC | GXS_GROUP_DEFAULTS_COMMENTS_NO | 0); - PostedGroupDialog::PostedGroupDialog(TokenQueue *tokenQueue, QWidget *parent) :GxsGroupDialog(tokenQueue, PostedCreateEnabledFlags, PostedCreateDefaultsFlags, parent) { - - } PostedGroupDialog::PostedGroupDialog(const RsPostedGroup &group, QWidget *parent) - :GxsGroupDialog(group.mMeta, MODE_SHOW, parent) + :GxsGroupDialog(group.mMeta, MODE_SHOW, parent) { - - } void PostedGroupDialog::initUi() @@ -96,7 +91,7 @@ bool PostedGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMetaDa // Specific Function. RsPostedGroup grp; grp.mMeta = meta; - grp.mDescription = getDescription().toStdString(); + grp.mDescription = getDescription().toStdString(); std::cerr << "PostedGroupDialog::service_CreateGroup() storing to Queue"; std::cerr << std::endl; diff --git a/retroshare-gui/src/gui/Posted/PostedGroupDialog.h b/retroshare-gui/src/gui/Posted/PostedGroupDialog.h index e85b27777..632da45fa 100644 --- a/retroshare-gui/src/gui/Posted/PostedGroupDialog.h +++ b/retroshare-gui/src/gui/Posted/PostedGroupDialog.h @@ -21,7 +21,6 @@ * */ - #ifndef _POSTED_GROUP_DIALOG_H #define _POSTED_GROUP_DIALOG_H @@ -42,10 +41,7 @@ protected: virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta); private: - - RsPostedGroup mTopic; - + RsPostedGroup mTopic; }; #endif - diff --git a/retroshare-gui/src/gui/Posted/PostedItem.cpp b/retroshare-gui/src/gui/Posted/PostedItem.cpp index c90cb2e51..3543e4359 100644 --- a/retroshare-gui/src/gui/Posted/PostedItem.cpp +++ b/retroshare-gui/src/gui/Posted/PostedItem.cpp @@ -21,21 +21,15 @@ * */ - #include -#include -#include -#include -#include #include "PostedItem.h" +#include "gui/feeds/FeedHolder.h" #include -#include #include - /** Constructor */ PostedItem::PostedItem(FeedHolder *parent, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome) @@ -53,48 +47,41 @@ PostedItem::PostedItem(FeedHolder *parent, uint32_t feedId, const RsPostedPost & setContent(mPost); } - void PostedItem::setup() { setupUi(this); - setAttribute ( Qt::WA_DeleteOnClose, true ); + setAttribute(Qt::WA_DeleteOnClose, true); - connect( commentButton, SIGNAL( clicked() ), this, SLOT( loadComments() ) ); - connect( voteUpButton, SIGNAL(clicked()), this, SLOT(makeUpVote())); - connect( voteDownButton, SIGNAL(clicked()), this, SLOT( makeDownVote())); - - return; + connect(commentButton, SIGNAL( clicked()), this, SLOT(loadComments())); + connect(voteUpButton, SIGNAL(clicked()), this, SLOT(makeUpVote())); + connect(voteDownButton, SIGNAL(clicked()), this, SLOT( makeDownVote())); } - void PostedItem::loadMessage(const uint32_t &token) { std::vector posts; - if (!rsPosted->getPostData(token, posts)) - { - std::cerr << "GxsChannelPostItem::loadMessage() ERROR getting data"; - std::cerr << std::endl; - return; - } + if (!rsPosted->getPostData(token, posts)) + { + std::cerr << "GxsChannelPostItem::loadMessage() ERROR getting data"; + std::cerr << std::endl; + return; + } - if (posts.size() != 1) - { - std::cerr << "GxsChannelPostItem::loadMessage() Wrong number of Items"; - std::cerr << std::endl; - return; - } + if (posts.size() != 1) + { + std::cerr << "GxsChannelPostItem::loadMessage() Wrong number of Items"; + std::cerr << std::endl; + return; + } mPost = posts[0]; setContent(mPost); - - return; } - - void PostedItem::setContent(const RsPostedPost &post) { mPost = post; + QDateTime qtime; qtime.setTime_t(mPost.mMeta.mPublishTs); QString timestamp = qtime.toString("dd.MMMM yyyy hh:mm"); @@ -169,10 +156,14 @@ void PostedItem::setContent(const RsPostedPost &post) + QString::number(nComments) + "

"); } #endif - } -RsPostedPost PostedItem::getPost() const +const RsPostedPost &PostedItem::getPost() const +{ + return mPost; +} + +RsPostedPost &PostedItem::post() { return mPost; } @@ -185,6 +176,7 @@ void PostedItem::makeDownVote() voteUpButton->setEnabled(false); voteDownButton->setEnabled(false); + emit vote(msgId, false); } @@ -210,6 +202,3 @@ void PostedItem::loadComments() mParent->openComments(0, mPost.mMeta.mGroupId, mPost.mMeta.mMsgId, title); } } - - - diff --git a/retroshare-gui/src/gui/Posted/PostedItem.h b/retroshare-gui/src/gui/Posted/PostedItem.h index 5f6c4f115..94fa70975 100644 --- a/retroshare-gui/src/gui/Posted/PostedItem.h +++ b/retroshare-gui/src/gui/Posted/PostedItem.h @@ -27,31 +27,29 @@ #include "ui_PostedItem.h" #include -#include "gui/feeds/FeedHolder.h" #include "gui/gxs/GxsFeedItem.h" +class RsPostedPost; class PostedItem : public GxsFeedItem, private Ui::PostedItem { - Q_OBJECT + Q_OBJECT public: - PostedItem(FeedHolder *parent, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome); - PostedItem(FeedHolder *parent, uint32_t feedId, const RsPostedPost &post, bool isHome); + PostedItem(FeedHolder *parent, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome); + PostedItem(FeedHolder *parent, uint32_t feedId, const RsPostedPost &post, bool isHome); - RsPostedPost getPost() const; - void setContent(const RsPostedPost& post); - - // Make this public so we can sort based on it. - RsPostedPost mPost; + const RsPostedPost &getPost() const; + RsPostedPost &post(); + void setContent(const RsPostedPost& post); private slots: - void loadComments(); - void makeUpVote(); - void makeDownVote(); + void loadComments(); + void makeUpVote(); + void makeDownVote(); signals: - void vote(const RsGxsGrpMsgIdPair& msgId, bool up); + void vote(const RsGxsGrpMsgIdPair& msgId, bool up); protected: virtual void loadMessage(const uint32_t &token); @@ -59,12 +57,9 @@ protected: private: void setup(); - uint32_t mType; - bool mSelected; - - + uint32_t mType; + bool mSelected; + RsPostedPost mPost; }; - #endif - diff --git a/retroshare-gui/src/gui/Posted/PostedListDialog.cpp b/retroshare-gui/src/gui/Posted/PostedListDialog.cpp index 1f7f54f3f..30b22818b 100644 --- a/retroshare-gui/src/gui/Posted/PostedListDialog.cpp +++ b/retroshare-gui/src/gui/Posted/PostedListDialog.cpp @@ -23,54 +23,37 @@ #include "PostedListDialog.h" -#include "gui/Posted/PostedGroupDialog.h" -#include "gui/Posted/PostedCreatePostDialog.h" -#include "gui/Posted/PostedDialog.h" - -#include -#include +#include "PostedGroupDialog.h" +#include "PostedCreatePostDialog.h" +#include "PostedDialog.h" +#include "PostedItem.h" +#include "PostedUserTypes.h" #include -#include -#include -#include #include #include /**************************************************************** */ -//#define DEBUG_FORUMS - /* Images for context menu icons */ -#define IMAGE_MESSAGE ":/images/folder-draft.png" -#define IMAGE_MESSAGEREPLY ":/images/mail_reply.png" -#define IMAGE_MESSAGEREMOVE ":/images/mail_delete.png" -#define IMAGE_DOWNLOAD ":/images/start.png" -#define IMAGE_DOWNLOADALL ":/images/startall.png" +#define IMAGE_MESSAGE ":/images/folder-draft.png" /* Images for TreeWidget */ -#define IMAGE_FOLDER ":/images/folder16.png" -#define IMAGE_FOLDERGREEN ":/images/folder_green.png" -#define IMAGE_FOLDERRED ":/images/folder_red.png" +#define IMAGE_FOLDER ":/images/folder16.png" +#define IMAGE_FOLDERGREEN ":/images/folder_green.png" +#define IMAGE_FOLDERRED ":/images/folder_red.png" #define IMAGE_FOLDERYELLOW ":/images/folder_yellow.png" -#define IMAGE_FORUM ":/images/konversation16.png" -#define IMAGE_SUBSCRIBE ":/images/edit_add24.png" -#define IMAGE_UNSUBSCRIBE ":/images/cancel.png" -#define IMAGE_INFO ":/images/info16.png" -#define IMAGE_NEWFORUM ":/images/new_forum16.png" -#define IMAGE_FORUMAUTHD ":/images/konv_message2.png" -#define IMAGE_COPYLINK ":/images/copyrslink.png" // token types to deal with -#define POSTED_DEFAULT_LISTING_LENGTH 10 -#define POSTED_MAX_INDEX 10000 +#define POSTED_DEFAULT_LISTING_LENGTH 10 +#define POSTED_MAX_INDEX 10000 /** Constructor */ PostedListDialog::PostedListDialog(QWidget *parent) -: RsAutoUpdatePage(1000,parent), GxsServiceDialog(dynamic_cast(parent)) +: RsGxsUpdateBroadcastPage(rsPosted, parent), GxsServiceDialog(dynamic_cast(parent)) { /* Invoke the Qt Designer generated object setup routine */ ui.setupUi(this); @@ -78,9 +61,8 @@ PostedListDialog::PostedListDialog(QWidget *parent) /* Setup Queue */ mPostedQueue = new TokenQueue(rsPosted->getTokenService(), this); - connect( ui.groupTreeWidget, SIGNAL( treeCustomContextMenuRequested( QPoint ) ), this, SLOT( groupListCustomPopupMenu( QPoint ) ) ); - - connect( ui.groupTreeWidget, SIGNAL( treeCurrentItemChanged(QString) ), this, SLOT( changedTopic(QString) ) ); + connect( ui.groupTreeWidget, SIGNAL(treeCustomContextMenuRequested(QPoint)), this, SLOT(groupListCustomPopupMenu(QPoint))); + connect( ui.groupTreeWidget, SIGNAL(treeCurrentItemChanged(QString)), this, SLOT(changedTopic(QString))); connect(ui.hotSortButton, SIGNAL(clicked()), this, SLOT(getRankings())); connect(ui.newSortButton, SIGNAL(clicked()), this, SLOT(getRankings())); @@ -102,14 +84,10 @@ PostedListDialog::PostedListDialog(QWidget *parent) ui.hotSortButton->setChecked(true); - connect( ui.newTopicButton, SIGNAL( clicked() ), this, SLOT( newTopic() ) ); - connect(ui.refreshButton, SIGNAL(clicked()), this, SLOT(refreshTopics())); + connect(ui.newTopicButton, SIGNAL(clicked()), this, SLOT(newTopic())); connect(ui.submitPostButton, SIGNAL(clicked()), this, SLOT(newPost())); - - refreshTopics(); } - void PostedListDialog::showNext() { mPostIndex += mPostShow; @@ -119,7 +97,6 @@ void PostedListDialog::showNext() updateShowText(); } - void PostedListDialog::showPrev() { mPostIndex -= mPostShow; @@ -129,7 +106,6 @@ void PostedListDialog::showPrev() updateShowText(); } - void PostedListDialog::updateShowText() { QString showText = tr("Showing"); @@ -140,8 +116,6 @@ void PostedListDialog::updateShowText() ui.showLabel->setText(showText); } - - void PostedListDialog::getRankings() { if(mCurrTopicId.empty()) @@ -180,25 +154,7 @@ void PostedListDialog::getRankings() applyRanking(); } - -void PostedListDialog::refreshTopics() -{ - std::cerr << "PostedListDialog::requestGroupSummary()"; - std::cerr << std::endl; - - RsTokReqOptions opts; - opts.mReqType = GXS_REQUEST_TYPE_GROUP_META; - uint32_t token; - mPostedQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, TOKEN_USER_TYPE_TOPIC); - - - /* refresh Id Chooser Too */ - RsGxsId currentId = ""; - ui.idChooser->getChosenId(currentId); - ui.idChooser->loadIds(IDCHOOSER_ID_REQUIRED, currentId); -} - -void PostedListDialog::groupListCustomPopupMenu( QPoint /*point*/ ) +void PostedListDialog::groupListCustomPopupMenu(QPoint /*point*/) { if (mCurrTopicId.empty()) { @@ -238,7 +194,6 @@ void PostedListDialog::newPost() } } - void PostedListDialog::unsubscribeTopic() { std::cerr << "PostedListDialog::unsubscribeTopic()"; @@ -249,10 +204,9 @@ void PostedListDialog::unsubscribeTopic() uint32_t token; rsPosted->subscribeToGroup(token, mCurrTopicId, false); - mPostedQueue->queueRequest(token, 0 , RS_TOKREQ_ANSTYPE_ACK, TOKEN_USER_TYPE_SUBSCRIBE_CHANGE); + mPostedQueue->queueRequest(token, 0, RS_TOKREQ_ANSTYPE_ACK, TOKEN_USER_TYPE_SUBSCRIBE_CHANGE); } - void PostedListDialog::subscribeTopic() { std::cerr << "PostedListDialog::subscribeTopic()"; @@ -263,10 +217,9 @@ void PostedListDialog::subscribeTopic() uint32_t token; rsPosted->subscribeToGroup(token, mCurrTopicId, true); - mPostedQueue->queueRequest(token, 0 , RS_TOKREQ_ANSTYPE_ACK, TOKEN_USER_TYPE_SUBSCRIBE_CHANGE); + mPostedQueue->queueRequest(token, 0, RS_TOKREQ_ANSTYPE_ACK, TOKEN_USER_TYPE_SUBSCRIBE_CHANGE); } - void PostedListDialog::submitVote(const RsGxsGrpMsgIdPair &msgId, bool up) { /* must grab AuthorId from Layout */ @@ -276,8 +229,7 @@ void PostedListDialog::submitVote(const RsGxsGrpMsgIdPair &msgId, bool up) std::cerr << "PostedListDialog::createPost() ERROR GETTING AuthorId!, Vote Failed"; std::cerr << std::endl; - QMessageBox::warning(this, tr("RetroShare"),tr("Please create or choose a Signing Id before Voting"), - QMessageBox::Ok, QMessageBox::Ok); + QMessageBox::warning(this, tr("RetroShare"),tr("Please create or choose a Signing Id before Voting"), QMessageBox::Ok, QMessageBox::Ok); return; } @@ -311,105 +263,66 @@ void PostedListDialog::submitVote(const RsGxsGrpMsgIdPair &msgId, bool up) mPostedQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, TOKEN_USER_TYPE_VOTE); } - /*****************************************************************************************/ - // Overloaded from FeedHolder. +// Overloaded from FeedHolder. QScrollArea *PostedListDialog::getScrollArea() { return ui.scrollArea; } -void PostedListDialog::deleteFeedItem(QWidget *item, uint32_t type) +void PostedListDialog::deleteFeedItem(QWidget */*item*/, uint32_t /*type*/) { std::cerr << "PostedListDialog::deleteFeedItem() Nah"; std::cerr << std::endl; return; } -void PostedListDialog::openChat(std::string peerId) +void PostedListDialog::openChat(std::string /*peerId*/) { std::cerr << "PostedListDialog::openChat() Nah"; std::cerr << std::endl; return; } -void PostedListDialog::openComments(uint32_t feed_type, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, const QString &title) +void PostedListDialog::openComments(uint32_t /*feed_type*/, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, const QString &title) { commentLoad(groupId, msgId, title); } /*****************************************************************************************/ - -void PostedListDialog::updateDisplay() +void PostedListDialog::updateDisplay(bool /*initialFill*/) { - if (!rsPosted) - return; + std::cerr << "rsPosted->updateDisplay()"; + std::cerr << std::endl; + /* update List */ + insertGroups(); - std::list groupIds; - std::map > msgs; - - - if (rsPosted->updated(true, true)) + std::map > &msgs = getMsgIds(); + if(!msgs.empty()) { - std::cerr << "rsPosted->updated() returned true"; + std::cerr << "rsPosted->msgsChanged():"; std::cerr << std::endl; - /* update Forums List */ - rsPosted->groupsChanged(groupIds); - if(!groupIds.empty()) + std::map >::iterator mit; + mit = msgs.find(mCurrTopicId); + if(mit != msgs.end()) { - std::cerr << "rsPosted->groupsChanged():"; + std::cerr << "current Group -> updating Displayed Items"; std::cerr << std::endl; - std::list::iterator it; - for(it = groupIds.begin(); it != groupIds.end(); it++) - { - std::cerr << "\t" << *it; - std::cerr << std::endl; - } - - it = std::find(groupIds.begin(), groupIds.end(), mCurrTopicId); - if(it != groupIds.end()) - { - std::cerr << "current Group -> requesting Group Summary"; - std::cerr << std::endl; - requestGroupSummary(); - return; - } - } - - rsPosted->msgsChanged(msgs); - - if(!msgs.empty()) - { - std::cerr << "rsPosted->msgsChanged():"; - std::cerr << std::endl; - - - std::map >::iterator mit; - mit = msgs.find(mCurrTopicId); - if(mit != msgs.end()) - { - std::cerr << "current Group -> updating Displayed Items"; - std::cerr << std::endl; - updateDisplayedItems(mit->second); - } + updateDisplayedItems(mit->second); } } - } - void PostedListDialog::updateDisplayedItems(const std::vector &msgIds) { - RsTokReqOptions opts; opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA; opts.mOptions = RS_TOKREQOPT_MSG_LATEST; - GxsMsgReq msgs; msgs[mCurrTopicId] = msgIds; @@ -425,25 +338,21 @@ void PostedListDialog::updateDisplayedItems(const std::vector &m uint32_t token; mPostedQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgs, TOKEN_USER_TYPE_POST_MOD); - } - - void PostedListDialog::changedTopic(const QString &id) { mCurrTopicId = id.toStdString(); insertThreads(); } - /*********************** **** **** **** ***********************/ /** New / Edit Groups ********************************/ /*********************** **** **** **** ***********************/ void PostedListDialog::newTopic() { - PostedGroupDialog cf (mPostedQueue, this); + PostedGroupDialog cf (mPostedQueue, this); cf.exec (); } @@ -458,7 +367,6 @@ void PostedListDialog::showGroupDetails() cf.exec (); } - void PostedListDialog::insertGroups() { requestGroupSummary(); @@ -466,13 +374,18 @@ void PostedListDialog::insertGroups() void PostedListDialog::requestGroupSummary() { - std::cerr << "PostedListDialog::requestGroupSummary()"; - std::cerr << std::endl; + std::cerr << "PostedListDialog::requestGroupSummary()"; + std::cerr << std::endl; - RsTokReqOptions opts; - opts.mReqType = GXS_REQUEST_TYPE_GROUP_META; + RsTokReqOptions opts; + opts.mReqType = GXS_REQUEST_TYPE_GROUP_META; uint32_t token; - mPostedQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, TOKEN_USER_TYPE_TOPIC); + mPostedQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, TOKEN_USER_TYPE_TOPIC); + + /* refresh Id Chooser Too */ + RsGxsId currentId = ""; + ui.idChooser->getChosenId(currentId); + ui.idChooser->loadIds(IDCHOOSER_ID_REQUIRED, currentId); } void PostedListDialog::acknowledgeGroup(const uint32_t &token) @@ -482,7 +395,6 @@ void PostedListDialog::acknowledgeGroup(const uint32_t &token) if(!grpId.empty()) { - RsTokReqOptions opts; opts.mReqType = GXS_REQUEST_TYPE_GROUP_META; uint32_t reqToken; @@ -500,21 +412,21 @@ void PostedListDialog::acknowledgePostMsg(const uint32_t &token) void PostedListDialog::loadGroupSummary(const uint32_t &token) { - std::cerr << "PostedListDialog::loadGroupSummary()"; + std::cerr << "PostedListDialog::loadGroupSummary()"; + std::cerr << std::endl; + + std::list groupInfo; + rsPosted->getGroupSummary(token, groupInfo); + + if (groupInfo.size() > 0) + { + insertGroupData(groupInfo); + } + else + { + std::cerr << "PostedListDialog::loadGroupSummary() ERROR No Groups..."; std::cerr << std::endl; - - std::list groupInfo; - rsPosted->getGroupSummary(token, groupInfo); - - if (groupInfo.size() > 0) - { - insertGroupData(groupInfo); - } - else - { - std::cerr << "PostedListDialog::loadGroupSummary() ERROR No Groups..."; - std::cerr << std::endl; - } + } } void PostedListDialog::loadPostData(const uint32_t &token) @@ -529,7 +441,7 @@ void PostedListDialog::acknowledgeVoteMsg(const uint32_t &token) rsPosted->acknowledgeVote(token, msgId); } -void PostedListDialog::loadVoteData(const uint32_t &token) +void PostedListDialog::loadVoteData(const uint32_t &/*token*/) { return; } @@ -537,17 +449,15 @@ void PostedListDialog::loadVoteData(const uint32_t &token) /*********************** **** **** **** ***********************/ /*********************** **** **** **** ***********************/ - - void PostedListDialog::requestGroupSummary_CurrentForum(const std::string &forumId) { - RsTokReqOptions opts; + RsTokReqOptions opts; std::list grpIds; grpIds.push_back(forumId); - std::cerr << "PostedListDialog::requestGroupSummary_CurrentForum(" << forumId << ")"; - std::cerr << std::endl; + std::cerr << "PostedListDialog::requestGroupSummary_CurrentForum(" << forumId << ")"; + std::cerr << std::endl; uint32_t token; mPostedQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, grpIds, POSTEDDIALOG_CURRENTFORUM); @@ -555,22 +465,22 @@ void PostedListDialog::requestGroupSummary_CurrentForum(const std::string &forum void PostedListDialog::loadGroupSummary_CurrentForum(const uint32_t &token) { - std::cerr << "PostedListDialog::loadGroupSummary_CurrentForum()"; - std::cerr << std::endl; + std::cerr << "PostedListDialog::loadGroupSummary_CurrentForum()"; + std::cerr << std::endl; - std::list groupInfo; - rsPosted->getGroupSummary(token, groupInfo); + std::list groupInfo; + rsPosted->getGroupSummary(token, groupInfo); - if (groupInfo.size() == 1) - { + if (groupInfo.size() == 1) + { RsGroupMetaData fi = groupInfo.front(); //insertForumThreads(fi); - } - else - { - std::cerr << "PostedListDialog::loadGroupSummary_CurrentForum() ERROR Invalid Number of Groups..."; - std::cerr << std::endl; - } + } + else + { + std::cerr << "PostedListDialog::loadGroupSummary_CurrentForum() ERROR Invalid Number of Groups..."; + std::cerr << std::endl; + } } /*********************** **** **** **** ***********************/ @@ -578,33 +488,29 @@ void PostedListDialog::loadGroupSummary_CurrentForum(const uint32_t &token) /*********************** **** **** **** ***********************/ /*********************** **** **** **** ***********************/ - void PostedListDialog::insertThreads() { - loadCurrentTopicThreads(mCurrTopicId); + loadCurrentTopicThreads(mCurrTopicId); } void PostedListDialog::loadCurrentTopicThreads(const std::string &topicId) { + std::cerr << "PostedListDialog::loadCurrentForumThreads(" << topicId << ")"; + std::cerr << std::endl; - std::cerr << "PostedListDialog::loadCurrentForumThreads(" << topicId << ")"; - std::cerr << std::endl; - - if (topicId.empty()) + if (topicId.empty()) { - std::cerr << "PostedListDialog::loadCurrentForumThreads() Empty GroupId .. ignoring Req"; - std::cerr << std::endl; + std::cerr << "PostedListDialog::loadCurrentForumThreads() Empty GroupId .. ignoring Req"; + std::cerr << std::endl; return; - } + } clearPosts(); - /* initiate loading */ - requestGroupThreadData_InsertThreads(topicId); + /* initiate loading */ + requestGroupThreadData_InsertThreads(topicId); } - - void PostedListDialog::requestGroupThreadData_InsertThreads(const std::string &groupId) { RsTokReqOptions opts; @@ -622,7 +528,6 @@ void PostedListDialog::requestGroupThreadData_InsertThreads(const std::string &g mPostedQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds, TOKEN_USER_TYPE_POST); } - void PostedListDialog::loadGroupThreadData_InsertThreads(const uint32_t &token) { std::cerr << "PostedListDialog::loadGroupThreadData_InsertThreads()"; @@ -641,7 +546,6 @@ void PostedListDialog::loadGroupThreadData_InsertThreads(const uint32_t &token) } applyRanking(); - } void PostedListDialog::loadPost(const RsPostedPost &post) @@ -654,33 +558,37 @@ void PostedListDialog::loadPost(const RsPostedPost &post) mPostList.push_back(item); } - bool CmpPIHot(const PostedItem *a, const PostedItem *b) { - if (a->mPost.mHotScore == b->mPost.mHotScore) + const RsPostedPost &postA = a->getPost(); + const RsPostedPost &postB = b->getPost(); + + if (postA.mHotScore == postB.mHotScore) { - (a->mPost.mNewScore > b->mPost.mNewScore); + return (postA.mNewScore > postB.mNewScore); } - return (a->mPost.mHotScore > b->mPost.mHotScore); + return (postA.mHotScore > postB.mHotScore); } bool CmpPITop(const PostedItem *a, const PostedItem *b) { - if (a->mPost.mTopScore == b->mPost.mTopScore) + const RsPostedPost &postA = a->getPost(); + const RsPostedPost &postB = b->getPost(); + + if (postA.mTopScore == postB.mTopScore) { - (a->mPost.mNewScore > b->mPost.mNewScore); + return (postA.mNewScore > postB.mNewScore); } - return (a->mPost.mTopScore > b->mPost.mTopScore); + return (postA.mTopScore > postB.mTopScore); } bool CmpPINew(const PostedItem *a, const PostedItem *b) { - return (a->mPost.mNewScore > b->mPost.mNewScore); + return (a->getPost().mNewScore > b->getPost().mNewScore); } - void PostedListDialog::applyRanking() { /* uses current settings to sort posts, then add to layout */ @@ -725,7 +633,7 @@ void PostedListDialog::applyRanking() std::cerr << "PostedListDialog::applyRanking() Item: " << item; std::cerr << std::endl; - if (item->mPost.mMeta.mPublishTs < min_ts) + if (item->getPost().mMeta.mPublishTs < min_ts) { std::cerr << "\t Skipping OLD"; std::cerr << std::endl; @@ -733,7 +641,6 @@ void PostedListDialog::applyRanking() continue; } - if (counter >= mPostIndex + mPostShow) { std::cerr << "\t END - Counter too high"; @@ -745,8 +652,8 @@ void PostedListDialog::applyRanking() std::cerr << "\t Adding to Layout"; std::cerr << std::endl; /* add it in! */ - item->show(); alayout->addWidget(item); + item->show(); } else { @@ -764,7 +671,6 @@ void PostedListDialog::applyRanking() ui.scrollAreaWidgetContents->update(); } - void PostedListDialog::clearPosts() { std::cerr << "PostedListDialog::clearPosts()" << std::endl; @@ -776,34 +682,34 @@ void PostedListDialog::clearPosts() int count = alayout->count(); for(int i = 0; i < count; i++) { - QLayoutItem *litem = alayout->itemAt(i); - if (!litem) - { - std::cerr << "PostedListDialog::clearPosts() missing litem"; - std::cerr << std::endl; - continue; - } + QLayoutItem *litem = alayout->itemAt(i); + if (!litem) + { + std::cerr << "PostedListDialog::clearPosts() missing litem"; + std::cerr << std::endl; + continue; + } - PostedItem *item = dynamic_cast(litem->widget()); - if (item) - { - std::cerr << "PostedListDialog::clearPosts() item: " << item; - std::cerr << std::endl; + PostedItem *item = dynamic_cast(litem->widget()); + if (item) + { + std::cerr << "PostedListDialog::clearPosts() item: " << item; + std::cerr << std::endl; - postedItems.push_back(item); - } - else - { - std::cerr << "PostedListDialog::clearPosts() Found Child, which is not a PostedItem???"; - std::cerr << std::endl; - } + postedItems.push_back(item); + } + else + { + std::cerr << "PostedListDialog::clearPosts() Found Child, which is not a PostedItem???"; + std::cerr << std::endl; + } } for(pit = postedItems.begin(); pit != postedItems.end(); pit++) { - PostedItem *item = *pit; - alayout->removeWidget(item); - delete item; + PostedItem *item = *pit; + alayout->removeWidget(item); + delete item; } mPosts.clear(); @@ -821,35 +727,34 @@ void PostedListDialog::shallowClearPosts() int count = alayout->count(); for(int i = 0; i < count; i++) { - QLayoutItem *litem = alayout->itemAt(i); - if (!litem) - { - std::cerr << "PostedListDialog::shallowClearPosts() missing litem"; - std::cerr << std::endl; - continue; - } + QLayoutItem *litem = alayout->itemAt(i); + if (!litem) + { + std::cerr << "PostedListDialog::shallowClearPosts() missing litem"; + std::cerr << std::endl; + continue; + } - PostedItem *item = dynamic_cast(litem->widget()); - if (item) - { - std::cerr << "PostedListDialog::shallowClearPosts() item: " << item; - std::cerr << std::endl; + PostedItem *item = dynamic_cast(litem->widget()); + if (item) + { + std::cerr << "PostedListDialog::shallowClearPosts() item: " << item; + std::cerr << std::endl; - postedItems.push_back(item); - } - else - { - std::cerr << "PostedListDialog::shallowClearPosts() Found Child, which is not a PostedItem???"; - std::cerr << std::endl; - } + postedItems.push_back(item); + } + else + { + std::cerr << "PostedListDialog::shallowClearPosts() Found Child, which is not a PostedItem???"; + std::cerr << std::endl; + } } for(pit = postedItems.begin(); pit != postedItems.end(); pit++) { - PostedItem *item = *pit; - alayout->removeWidget(item); + PostedItem *item = *pit; + alayout->removeWidget(item); } - } void PostedListDialog::updateCurrentDisplayComplete(const uint32_t &token) @@ -863,7 +768,6 @@ void PostedListDialog::updateCurrentDisplayComplete(const uint32_t &token) std::vector::iterator vit; for(vit = posts.begin(); vit != posts.end(); vit++) { - RsPostedPost& p = *vit; // modify post content @@ -887,13 +791,12 @@ void PostedListDialog::updateCurrentDisplayComplete(const uint32_t &token) QMap::iterator pit; for(pit = mPosts.begin(); pit != mPosts.end(); pit++) { - (*pit)->mPost.calculateScores(now); + (*pit)->post().calculateScores(now); } applyRanking(); } - void PostedListDialog::acknowledgeSubscribeChange(const uint32_t &token) { std::cerr << "PostedListDialog::acknowledgeSubscribeChange()"; @@ -903,7 +806,7 @@ void PostedListDialog::acknowledgeSubscribeChange(const uint32_t &token) RsGxsGroupId groupId; rsPosted->acknowledgeGrp(token, groupId); - refreshTopics(); + insertGroups(); } /*********************** **** **** **** ***********************/ @@ -917,10 +820,9 @@ void PostedListDialog::loadRequest(const TokenQueue *queue, const TokenRequest & if (queue == mPostedQueue) { - /* now switch on req */ + /* now switch on req */ switch(req.mUserType) { - case TOKEN_USER_TYPE_TOPIC: switch(req.mAnsType) { @@ -988,28 +890,25 @@ void PostedListDialog::loadRequest(const TokenQueue *queue, const TokenRequest & } } - /* now switch on req */ - switch(req.mType) - { - case TOKENREQ_GROUPINFO: - switch(req.mAnsType) - { - case RS_TOKREQ_ANSTYPE_ACK: - acknowledgeGroup(req.mToken); - break; - } + /* now switch on req */ + switch(req.mType) + { + case TOKENREQ_GROUPINFO: + switch(req.mAnsType) + { + case RS_TOKREQ_ANSTYPE_ACK: + acknowledgeGroup(req.mToken); + break; + } break; - } + } } - - /**************************************************************************************/ /**************************************************************************************/ /**************************************************************************************/ /**************************** Groups **********************/ - void PostedListDialog::groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo) { groupItemInfo.id = QString::fromStdString(groupInfo.mGroupId); @@ -1017,14 +916,11 @@ void PostedListDialog::groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo //groupItemInfo.description = QString::fromUtf8(groupInfo.forumDesc); groupItemInfo.popularity = groupInfo.mPop; groupItemInfo.lastpost = QDateTime::fromTime_t(groupInfo.mLastPost); - groupItemInfo.subscribeFlags = groupInfo.mSubscribeFlags; - - + groupItemInfo.subscribeFlags = groupInfo.mSubscribeFlags; } void PostedListDialog::insertGroupData(const std::list &groupList) { - std::list::const_iterator it; QList adminList; @@ -1070,15 +966,15 @@ void PostedListDialog::insertGroupData(const std::list &groupLi std::multimap::reverse_iterator rit; for(rit = popMap.rbegin(); ((rit != popMap.rend()) && (i < popCount)); rit++, i++) ; if (rit != popMap.rend()) { - popLimit = rit->first; + popLimit = rit->first; } for (rit = popMap.rbegin(); rit != popMap.rend(); rit++) { if (rit->second.popularity < (int) popLimit) { - otherList.append(rit->second); - } else { - popList.append(rit->second); - } + otherList.append(rit->second); + } else { + popList.append(rit->second); + } } /* now we can add them in as a tree! */ @@ -1091,5 +987,3 @@ void PostedListDialog::insertGroupData(const std::list &groupLi /**************************************************************************************/ /**************************************************************************************/ /**************************************************************************************/ - - diff --git a/retroshare-gui/src/gui/Posted/PostedListDialog.h b/retroshare-gui/src/gui/Posted/PostedListDialog.h index 53918cb83..3f550d1bc 100644 --- a/retroshare-gui/src/gui/Posted/PostedListDialog.h +++ b/retroshare-gui/src/gui/Posted/PostedListDialog.h @@ -24,41 +24,36 @@ #ifndef MRK_POSTED_LIST_DIALOG_H #define MRK_POSTED_LIST_DIALOG_H - #include "retroshare-gui/mainpage.h" #include "ui_PostedListDialog.h" #include -#include - -#include "gui/Posted/PostedItem.h" -#include "gui/common/GroupTreeWidget.h" - #include "util/TokenQueue.h" -#include "retroshare-gui/RsAutoUpdatePage.h" -#include "PostedUserTypes.h" +#include "gui/gxs/RsGxsUpdateBroadcastPage.h" #include "gui/gxs/GxsCommentContainer.h" +#include "gui/feeds/FeedHolder.h" +class PostedItem; /*********************** **** **** **** ***********************/ /** Request / Response of Data ********************************/ /*********************** **** **** **** ***********************/ -#define POSTEDDIALOG_LISTING 1 -#define POSTEDDIALOG_CURRENTFORUM 2 -#define POSTEDDIALOG_INSERTTHREADS 3 -#define POSTEDDIALOG_INSERTCHILD 4 -#define POSTEDDIALOG_INSERT_POST 5 -#define POSTEDDIALOG_REPLY_MESSAGE 6 +#define POSTEDDIALOG_LISTING 1 +#define POSTEDDIALOG_CURRENTFORUM 2 +#define POSTEDDIALOG_INSERTTHREADS 3 +#define POSTEDDIALOG_INSERTCHILD 4 +#define POSTEDDIALOG_INSERT_POST 5 +#define POSTEDDIALOG_REPLY_MESSAGE 6 -class PostedListDialog : public RsAutoUpdatePage, public FeedHolder, public TokenResponse, public GxsServiceDialog +class PostedListDialog : public RsGxsUpdateBroadcastPage, public FeedHolder, public TokenResponse, public GxsServiceDialog { - Q_OBJECT + Q_OBJECT public: - PostedListDialog(QWidget *parent = 0); + PostedListDialog(QWidget *parent = 0); // Overloaded from FeedHolder. virtual QScrollArea *getScrollArea(); @@ -67,109 +62,99 @@ public: virtual void openComments(uint32_t type, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, const QString &title); private slots: + void groupListCustomPopupMenu(QPoint point); + void changedTopic(const QString &id); - void groupListCustomPopupMenu( QPoint /*point*/ ); - void changedTopic(const QString &id); + void newTopic(); + void showGroupDetails(); + void newPost(); - void newTopic(); - void showGroupDetails(); - void newPost(); - void refreshTopics(); + void submitVote(const RsGxsGrpMsgIdPair& msgId, bool up); - void submitVote(const RsGxsGrpMsgIdPair& msgId, bool up); + void getRankings(); - void getRankings(); + void subscribeTopic(); + void unsubscribeTopic(); - void subscribeTopic(); - void unsubscribeTopic(); + void showNext(); + void showPrev(); - - void showNext(); - void showPrev(); +protected: + virtual void updateDisplay(bool initialFill); private: + void updateShowText(); - void updateShowText(); + void clearPosts(); - void clearPosts(); + /*! + * Only removes it from layout + */ + void shallowClearPosts(); - /*! - * Only removes it from layout - */ - void shallowClearPosts(); + void loadPost(const RsPostedPost &post); - void updateDisplay(); - void loadPost(const RsPostedPost &post); + void insertGroups(); + void requestGroupSummary(); + void acknowledgeGroup(const uint32_t &token); + void loadGroupSummary(const uint32_t &token); - void insertGroups(); - void requestGroupSummary(); - void acknowledgeGroup(const uint32_t &token); - void loadGroupSummary(const uint32_t &token); + void requestGroupSummary_CurrentForum(const std::string &forumId); + void loadGroupSummary_CurrentForum(const uint32_t &token); - void requestGroupSummary_CurrentForum(const std::string &forumId); - void loadGroupSummary_CurrentForum(const uint32_t &token); + // subscribe/unsubscribe ack. + void acknowledgeSubscribeChange(const uint32_t &token); + // posts + void acknowledgePostMsg(const uint32_t &token); + void loadPostData(const uint32_t &token); + void insertThreads(); + void loadCurrentTopicThreads(const std::string &forumId); + void requestGroupThreadData_InsertThreads(const std::string &forumId); + void loadGroupThreadData_InsertThreads(const uint32_t &token); - // subscribe/unsubscribe ack. - void acknowledgeSubscribeChange(const uint32_t &token); + // votes + void acknowledgeVoteMsg(const uint32_t& token); + void loadVoteData(const uint32_t &token); - // posts - void acknowledgePostMsg(const uint32_t &token); - void loadPostData(const uint32_t &token); - void insertThreads(); - void loadCurrentTopicThreads(const std::string &forumId); - void requestGroupThreadData_InsertThreads(const std::string &forumId); - void loadGroupThreadData_InsertThreads(const uint32_t &token); + // ranking + //void loadRankings(const uint32_t& token); + //void applyRanking(const PostedRanking& ranks); + void applyRanking(); - // votes + // update displayed item + void updateDisplayedItems(const std::vector& msgIds); + void updateCurrentDisplayComplete(const uint32_t& token); - void acknowledgeVoteMsg(const uint32_t& token); - void loadVoteData(const uint32_t &token); + void insertGroupData(const std::list &groupList); + void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo); - // ranking - - //void loadRankings(const uint32_t& token); - //void applyRanking(const PostedRanking& ranks); - void applyRanking(); - - - // update displayed item - - void updateDisplayedItems(const std::vector& msgIds); - void updateCurrentDisplayComplete(const uint32_t& token); - - void insertGroupData(const std::list &groupList); - void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo); - - void loadRequest(const TokenQueue *queue, const TokenRequest &req); + void loadRequest(const TokenQueue *queue, const TokenRequest &req); private: + QTreeWidgetItem *yourTopics; + QTreeWidgetItem *subscribedTopics; + QTreeWidgetItem *popularTopics; + QTreeWidgetItem *otherTopics; - QTreeWidgetItem *yourTopics; - QTreeWidgetItem *subscribedTopics; - QTreeWidgetItem *popularTopics; - QTreeWidgetItem *otherTopics; + int mSortMethod; + int mLastSortMethod; + int mPostIndex; + int mPostShow; - int mSortMethod; - int mLastSortMethod; - int mPostIndex; - int mPostShow; + bool mThreadLoading; + RsGxsGroupId mCurrTopicId; - bool mThreadLoading; - RsGxsGroupId mCurrTopicId; + QMap mGroups; + QMap mPosts; + std::list mPostList; - QMap mGroups; - QMap mPosts; - std::list mPostList; + TokenQueue *mPostedQueue; + //CommentHolder* mCommentHolder; - TokenQueue *mPostedQueue; - - //CommentHolder* mCommentHolder; - - /* UI - from Designer */ - Ui::PostedListDialog ui; - + /* UI - from Designer */ + Ui::PostedListDialog ui; }; #endif diff --git a/retroshare-gui/src/gui/Posted/PostedListDialog.ui b/retroshare-gui/src/gui/Posted/PostedListDialog.ui index 86309d05a..3e3a46532 100644 --- a/retroshare-gui/src/gui/Posted/PostedListDialog.ui +++ b/retroshare-gui/src/gui/Posted/PostedListDialog.ui @@ -73,13 +73,6 @@
- - - - Refresh - - - @@ -224,7 +217,7 @@ 0 0 443 - 162 + 166 diff --git a/retroshare-gui/src/gui/gxs/GxsCommentContainer.cpp b/retroshare-gui/src/gui/gxs/GxsCommentContainer.cpp index dc34da70d..890ca75b7 100644 --- a/retroshare-gui/src/gui/gxs/GxsCommentContainer.cpp +++ b/retroshare-gui/src/gui/gxs/GxsCommentContainer.cpp @@ -25,18 +25,11 @@ #include "gui/gxs/GxsCommentDialog.h" #include -#include - -#include -#include - -/****** - * #define PHOTO_DEBUG 1 - *****/ +#define MAX_COMMENT_TITLE 32 /**************************************************************** - * Posted Dialog + * GxsCommentContainer * */ @@ -45,24 +38,22 @@ GxsCommentContainer::GxsCommentContainer(QWidget *parent) { ui.setupUi(this); - connect(ui.tabWidget, SIGNAL(tabCloseRequested( int )), this, SLOT(tabCloseRequested( int ))); - + connect(ui.tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(tabCloseRequested(int))); } - void GxsCommentContainer::setup() { mServiceDialog = createServiceDialog(); + QString name = getServiceName(); + ui.titleBarLabel->setText(name); + ui.titleBarPixmap->setPixmap(getServicePixmap()); - QString list(name); QWidget *widget = dynamic_cast(mServiceDialog); - ui.tabWidget->addTab(widget, name); + int index = ui.tabWidget->addTab(widget, name); + ui.tabWidget->hideCloseButton(index); } - -#define MAX_COMMENT_TITLE 32 - void GxsCommentContainer::commentLoad(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId, const QString &title) { QString comments = title; @@ -72,7 +63,7 @@ void GxsCommentContainer::commentLoad(const RsGxsGroupId &grpId, const RsGxsMess comments += "..."; } - GxsCommentDialog *commentDialog = new GxsCommentDialog(this, getTokenService(), getCommentService()); + GxsCommentDialog *commentDialog = new GxsCommentDialog(this, getTokenService(), getCommentService()); QWidget *commentHeader = createHeaderWidget(grpId, msgId); commentDialog->setCommentHeader(commentHeader); @@ -82,12 +73,11 @@ void GxsCommentContainer::commentLoad(const RsGxsGroupId &grpId, const RsGxsMess ui.tabWidget->addTab(commentDialog, comments); } - - void GxsCommentContainer::tabCloseRequested(int index) { std::cerr << "GxsCommentContainer::tabCloseRequested(" << index << ")"; std::cerr << std::endl; + if (index != 0) { QWidget *comments = ui.tabWidget->widget(index); @@ -100,21 +90,3 @@ void GxsCommentContainer::tabCloseRequested(int index) std::cerr << std::endl; } } - - - - - - - - - - - - - - - - - - diff --git a/retroshare-gui/src/gui/gxs/GxsCommentContainer.h b/retroshare-gui/src/gui/gxs/GxsCommentContainer.h index 3520c3334..086aee640 100644 --- a/retroshare-gui/src/gui/gxs/GxsCommentContainer.h +++ b/retroshare-gui/src/gui/gxs/GxsCommentContainer.h @@ -30,59 +30,50 @@ #include #include -#include - class GxsServiceDialog; class GxsCommentContainer : public MainPage { - Q_OBJECT + Q_OBJECT public: GxsCommentContainer(QWidget *parent = 0); void setup(); - void commentLoad(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId, const QString &title); + void commentLoad(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId, const QString &title); - virtual GxsServiceDialog *createServiceDialog() = 0; - virtual QString getServiceName() = 0; - virtual RsTokenService *getTokenService() = 0; - virtual RsGxsCommentService *getCommentService() = 0; - virtual QWidget *createHeaderWidget(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId) = 0; + virtual GxsServiceDialog *createServiceDialog() = 0; + virtual QString getServiceName() = 0; + virtual RsTokenService *getTokenService() = 0; + virtual RsGxsCommentService *getCommentService() = 0; + virtual QWidget *createHeaderWidget(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId) = 0; + virtual QPixmap getServicePixmap() = 0; private slots: void tabCloseRequested(int index); private: - GxsServiceDialog *mServiceDialog; /* UI - from Designer */ Ui::GxsCommentContainer ui; - }; - - class GxsServiceDialog { - public: GxsServiceDialog(GxsCommentContainer *container) :mContainer(container) { return; } -virtual ~GxsServiceDialog() { return; } + virtual ~GxsServiceDialog() { return; } void commentLoad(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId, const QString &title) { mContainer->commentLoad(grpId, msgId, title); } + private: GxsCommentContainer *mContainer; - }; - - #endif - diff --git a/retroshare-gui/src/gui/gxs/GxsCommentContainer.ui b/retroshare-gui/src/gui/gxs/GxsCommentContainer.ui index aa3ee40f4..fd1076da1 100644 --- a/retroshare-gui/src/gui/gxs/GxsCommentContainer.ui +++ b/retroshare-gui/src/gui/gxs/GxsCommentContainer.ui @@ -17,33 +17,30 @@ - QFrame::StyledPanel + QFrame::Box - QFrame::Raised + QFrame::Sunken 2 - + 24 24 - - - :/images/posted_24.png - + 10 @@ -73,7 +70,7 @@ - + -1 @@ -84,8 +81,14 @@ - - - + + + RSTabWidget + QTabWidget +
gui/common/RSTabWidget.h
+ 1 +
+
+ diff --git a/retroshare-gui/src/gui/gxschannels/ChannelDialog.h b/retroshare-gui/src/gui/gxschannels/ChannelDialog.h index 890b68238..7f48c85a7 100644 --- a/retroshare-gui/src/gui/gxschannels/ChannelDialog.h +++ b/retroshare-gui/src/gui/gxschannels/ChannelDialog.h @@ -24,23 +24,21 @@ #ifndef MRK_CHANNEL_DIALOG_H #define MRK_CHANNEL_DIALOG_H - #include #include "gui/gxs/GxsCommentContainer.h" #include "gui/gxschannels/GxsChannelDialog.h" #include "gui/feeds/GxsChannelPostItem.h" - class ChannelDialog : public GxsCommentContainer { - //Q_OBJECT + Q_OBJECT public: ChannelDialog(QWidget *parent = 0) :GxsCommentContainer(parent) { return; } - virtual GxsServiceDialog *createServiceDialog() + virtual GxsServiceDialog *createServiceDialog() { return new GxsChannelDialog(this); } @@ -50,21 +48,25 @@ public: return tr("GxsChannels"); } - virtual RsTokenService *getTokenService() + virtual RsTokenService *getTokenService() { return rsGxsChannels->getTokenService(); } - virtual RsGxsCommentService *getCommentService() + virtual RsGxsCommentService *getCommentService() { return rsGxsChannels; } - virtual QWidget *createHeaderWidget(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId) + virtual QWidget *createHeaderWidget(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId) { return new GxsChannelPostItem(NULL, 0, grpId, msgId, true); } + + virtual QPixmap getServicePixmap() + { + return QPixmap(":/images/channels24.png"); + } }; #endif - diff --git a/retroshare-gui/src/lang/retroshare_en.ts b/retroshare-gui/src/lang/retroshare_en.ts index 792490aea..de6c7df58 100644 --- a/retroshare-gui/src/lang/retroshare_en.ts +++ b/retroshare-gui/src/lang/retroshare_en.ts @@ -9962,7 +9962,7 @@ p, li { white-space: pre-wrap; } PostedDialog - Posted + Posted Links @@ -10050,10 +10050,6 @@ p, li { white-space: pre-wrap; } Top - - Refresh - - Today