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
This commit is contained in:
thunder2 2013-07-15 18:39:39 +00:00
parent 11d2701edc
commit 4edcec6fe9
16 changed files with 406 additions and 596 deletions

View file

@ -24,19 +24,29 @@
#include <QMessageBox> #include <QMessageBox>
#include "PostedCreatePostDialog.h" #include "PostedCreatePostDialog.h"
#include "ui_PostedCreatePostDialog.h" #include "ui_PostedCreatePostDialog.h"
#include "PostedUserTypes.h"
#include "util/TokenQueue.h"
#include <iostream> #include <iostream>
PostedCreatePostDialog::PostedCreatePostDialog(TokenQueue* tokenQ, RsPosted *posted, const RsGxsGroupId& grpId, QWidget *parent): PostedCreatePostDialog::PostedCreatePostDialog(TokenQueue* tokenQ, RsPosted *posted, const RsGxsGroupId& grpId, QWidget *parent):
QDialog(parent), mTokenQueue(tokenQ), mPosted(posted), mGrpId(grpId), QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint),
mTokenQueue(tokenQ), mPosted(posted), mGrpId(grpId),
ui(new Ui::PostedCreatePostDialog) ui(new Ui::PostedCreatePostDialog)
{ {
ui->setupUi(this); ui->setupUi(this);
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(createPost())); connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(createPost()));
connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(close()));
/* fill in the available OwnIds for signing */ /* fill in the available OwnIds for signing */
ui->idChooser->loadIds(IDCHOOSER_ID_REQUIRED, ""); ui->idChooser->loadIds(IDCHOOSER_ID_REQUIRED, "");
}
PostedCreatePostDialog::~PostedCreatePostDialog()
{
delete ui;
} }
void PostedCreatePostDialog::createPost() void PostedCreatePostDialog::createPost()
@ -47,13 +57,11 @@ void PostedCreatePostDialog::createPost()
std::cerr << "PostedCreatePostDialog::createPost() ERROR GETTING AuthorId!, Post Failed"; std::cerr << "PostedCreatePostDialog::createPost() ERROR GETTING AuthorId!, Post Failed";
std::cerr << std::endl; std::cerr << std::endl;
QMessageBox::warning(this, tr("RetroShare"),tr("Please create or choose a Signing Id first"), QMessageBox::warning(this, tr("RetroShare"),tr("Please create or choose a Signing Id first"), QMessageBox::Ok, QMessageBox::Ok);
QMessageBox::Ok, QMessageBox::Ok);
return; return;
} }
RsPostedPost post; RsPostedPost post;
post.mMeta.mGroupId = mGrpId; post.mMeta.mGroupId = mGrpId;
post.mLink = std::string(ui->linkEdit->text().toUtf8()); post.mLink = std::string(ui->linkEdit->text().toUtf8());
@ -64,10 +72,6 @@ void PostedCreatePostDialog::createPost()
uint32_t token; uint32_t token;
mPosted->createPost(token, post); mPosted->createPost(token, post);
mTokenQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, TOKEN_USER_TYPE_POST); mTokenQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, TOKEN_USER_TYPE_POST);
accept(); accept();
} }
PostedCreatePostDialog::~PostedCreatePostDialog()
{
delete ui;
}

View file

@ -26,9 +26,8 @@
#include <QDialog> #include <QDialog>
#include "retroshare/rsposted.h" #include "retroshare/rsposted.h"
#include "PostedUserTypes.h"
#include "util/TokenQueue.h" class TokenQueue;
namespace Ui { namespace Ui {
class PostedCreatePostDialog; class PostedCreatePostDialog;
@ -39,7 +38,6 @@ class PostedCreatePostDialog : public QDialog
Q_OBJECT Q_OBJECT
public: public:
/*! /*!
* @param tokenQ parent callee token * @param tokenQ parent callee token
* @param posted * @param posted
@ -48,17 +46,16 @@ public:
~PostedCreatePostDialog(); ~PostedCreatePostDialog();
private slots: private slots:
void createPost(); void createPost();
private: private:
Ui::PostedCreatePostDialog *ui;
QString mLink; QString mLink;
QString mNotes; QString mNotes;
TokenQueue* mTokenQueue;
RsPosted* mPosted; RsPosted* mPosted;
RsGxsGroupId mGrpId; RsGxsGroupId mGrpId;
TokenQueue* mTokenQueue;
Ui::PostedCreatePostDialog *ui;
}; };
#endif // POSTEDCREATEPOSTDIALOG_H #endif // POSTEDCREATEPOSTDIALOG_H

View file

@ -15,9 +15,12 @@
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QGridLayout" name="gridLayout">
<item> <item row="0" column="1">
<widget class="QLabel" name="label_3"> <widget class="QLineEdit" name="titleEdit"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="titleLabel">
<property name="text"> <property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt; &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
@ -27,15 +30,8 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="1" column="0">
<widget class="QLineEdit" name="titleEdit"/> <widget class="QLabel" name="linkLabel">
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text"> <property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt; &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
@ -45,7 +41,7 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="1" column="1">
<widget class="QLineEdit" name="linkEdit"/> <widget class="QLineEdit" name="linkEdit"/>
</item> </item>
</layout> </layout>
@ -81,9 +77,9 @@ p, li { white-space: pre-wrap; }
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="notesLayout">
<item> <item>
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="notesLabel">
<property name="text"> <property name="text">
<string>Notes</string> <string>Notes</string>
</property> </property>
@ -113,9 +109,7 @@ p, li { white-space: pre-wrap; }
<header>gui/gxs/GxsIdChooser.h</header> <header>gui/gxs/GxsIdChooser.h</header>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources> <resources/>
<include location="../images.qrc"/>
</resources>
<connections> <connections>
<connection> <connection>
<sender>buttonBox</sender> <sender>buttonBox</sender>

View file

@ -28,6 +28,7 @@
#include "gui/gxs/GxsCommentContainer.h" #include "gui/gxs/GxsCommentContainer.h"
#include "gui/Posted/PostedListDialog.h" #include "gui/Posted/PostedListDialog.h"
#include "gui/Posted/PostedItem.h"
class PostedDialog : public GxsCommentContainer class PostedDialog : public GxsCommentContainer
{ {
@ -44,7 +45,7 @@ public:
virtual QString getServiceName() virtual QString getServiceName()
{ {
return tr("Posted"); return tr("Posted Links");
} }
virtual RsTokenService *getTokenService() virtual RsTokenService *getTokenService()
@ -62,7 +63,10 @@ public:
return new PostedItem(NULL, 0, grpId, msgId, true); return new PostedItem(NULL, 0, grpId, msgId, true);
} }
virtual QPixmap getServicePixmap()
{
return QPixmap(":/images/posted_24.png");
}
}; };
#endif #endif

View file

@ -52,19 +52,14 @@ uint32_t PostedCreateDefaultsFlags = ( GXS_GROUP_DEFAULTS_DISTRIB_PUBLIC |
GXS_GROUP_DEFAULTS_COMMENTS_NO | GXS_GROUP_DEFAULTS_COMMENTS_NO |
0); 0);
PostedGroupDialog::PostedGroupDialog(TokenQueue *tokenQueue, QWidget *parent) PostedGroupDialog::PostedGroupDialog(TokenQueue *tokenQueue, QWidget *parent)
:GxsGroupDialog(tokenQueue, PostedCreateEnabledFlags, PostedCreateDefaultsFlags, parent) :GxsGroupDialog(tokenQueue, PostedCreateEnabledFlags, PostedCreateDefaultsFlags, parent)
{ {
} }
PostedGroupDialog::PostedGroupDialog(const RsPostedGroup &group, QWidget *parent) PostedGroupDialog::PostedGroupDialog(const RsPostedGroup &group, QWidget *parent)
:GxsGroupDialog(group.mMeta, MODE_SHOW, parent) :GxsGroupDialog(group.mMeta, MODE_SHOW, parent)
{ {
} }
void PostedGroupDialog::initUi() void PostedGroupDialog::initUi()

View file

@ -21,7 +21,6 @@
* *
*/ */
#ifndef _POSTED_GROUP_DIALOG_H #ifndef _POSTED_GROUP_DIALOG_H
#define _POSTED_GROUP_DIALOG_H #define _POSTED_GROUP_DIALOG_H
@ -42,10 +41,7 @@ protected:
virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta); virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta);
private: private:
RsPostedGroup mTopic; RsPostedGroup mTopic;
}; };
#endif #endif

View file

@ -21,21 +21,15 @@
* *
*/ */
#include <QDateTime> #include <QDateTime>
#include <QMessageBox>
#include <QMouseEvent>
#include <QBuffer>
#include <time.h>
#include "PostedItem.h" #include "PostedItem.h"
#include "gui/feeds/FeedHolder.h"
#include <retroshare/rsposted.h> #include <retroshare/rsposted.h>
#include <algorithm>
#include <iostream> #include <iostream>
/** Constructor */ /** Constructor */
PostedItem::PostedItem(FeedHolder *parent, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome) PostedItem::PostedItem(FeedHolder *parent, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome)
@ -53,7 +47,6 @@ PostedItem::PostedItem(FeedHolder *parent, uint32_t feedId, const RsPostedPost &
setContent(mPost); setContent(mPost);
} }
void PostedItem::setup() void PostedItem::setup()
{ {
setupUi(this); setupUi(this);
@ -62,11 +55,8 @@ void PostedItem::setup()
connect(commentButton, SIGNAL( clicked()), this, SLOT(loadComments())); connect(commentButton, SIGNAL( clicked()), this, SLOT(loadComments()));
connect(voteUpButton, SIGNAL(clicked()), this, SLOT(makeUpVote())); connect(voteUpButton, SIGNAL(clicked()), this, SLOT(makeUpVote()));
connect(voteDownButton, SIGNAL(clicked()), this, SLOT( makeDownVote())); connect(voteDownButton, SIGNAL(clicked()), this, SLOT( makeDownVote()));
return;
} }
void PostedItem::loadMessage(const uint32_t &token) void PostedItem::loadMessage(const uint32_t &token)
{ {
std::vector<RsPostedPost> posts; std::vector<RsPostedPost> posts;
@ -86,15 +76,12 @@ void PostedItem::loadMessage(const uint32_t &token)
mPost = posts[0]; mPost = posts[0];
setContent(mPost); setContent(mPost);
return;
} }
void PostedItem::setContent(const RsPostedPost &post) void PostedItem::setContent(const RsPostedPost &post)
{ {
mPost = post; mPost = post;
QDateTime qtime; QDateTime qtime;
qtime.setTime_t(mPost.mMeta.mPublishTs); qtime.setTime_t(mPost.mMeta.mPublishTs);
QString timestamp = qtime.toString("dd.MMMM yyyy hh:mm"); QString timestamp = qtime.toString("dd.MMMM yyyy hh:mm");
@ -169,10 +156,14 @@ void PostedItem::setContent(const RsPostedPost &post)
+ QString::number(nComments) + "</span></p>"); + QString::number(nComments) + "</span></p>");
} }
#endif #endif
} }
RsPostedPost PostedItem::getPost() const const RsPostedPost &PostedItem::getPost() const
{
return mPost;
}
RsPostedPost &PostedItem::post()
{ {
return mPost; return mPost;
} }
@ -185,6 +176,7 @@ void PostedItem::makeDownVote()
voteUpButton->setEnabled(false); voteUpButton->setEnabled(false);
voteDownButton->setEnabled(false); voteDownButton->setEnabled(false);
emit vote(msgId, false); emit vote(msgId, false);
} }
@ -210,6 +202,3 @@ void PostedItem::loadComments()
mParent->openComments(0, mPost.mMeta.mGroupId, mPost.mMeta.mMsgId, title); mParent->openComments(0, mPost.mMeta.mGroupId, mPost.mMeta.mMsgId, title);
} }
} }

View file

@ -27,9 +27,9 @@
#include "ui_PostedItem.h" #include "ui_PostedItem.h"
#include <retroshare/rsposted.h> #include <retroshare/rsposted.h>
#include "gui/feeds/FeedHolder.h"
#include "gui/gxs/GxsFeedItem.h" #include "gui/gxs/GxsFeedItem.h"
class RsPostedPost;
class PostedItem : public GxsFeedItem, private Ui::PostedItem class PostedItem : public GxsFeedItem, private Ui::PostedItem
{ {
@ -39,12 +39,10 @@ public:
PostedItem(FeedHolder *parent, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, 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); PostedItem(FeedHolder *parent, uint32_t feedId, const RsPostedPost &post, bool isHome);
RsPostedPost getPost() const; const RsPostedPost &getPost() const;
RsPostedPost &post();
void setContent(const RsPostedPost& post); void setContent(const RsPostedPost& post);
// Make this public so we can sort based on it.
RsPostedPost mPost;
private slots: private slots:
void loadComments(); void loadComments();
void makeUpVote(); void makeUpVote();
@ -61,10 +59,7 @@ private:
uint32_t mType; uint32_t mType;
bool mSelected; bool mSelected;
RsPostedPost mPost;
}; };
#endif #endif

View file

@ -23,45 +23,28 @@
#include "PostedListDialog.h" #include "PostedListDialog.h"
#include "gui/Posted/PostedGroupDialog.h" #include "PostedGroupDialog.h"
#include "gui/Posted/PostedCreatePostDialog.h" #include "PostedCreatePostDialog.h"
#include "gui/Posted/PostedDialog.h" #include "PostedDialog.h"
#include "PostedItem.h"
#include <retroshare/rsposted.h> #include "PostedUserTypes.h"
#include <retroshare/rsgxsflags.h>
#include <iostream> #include <iostream>
#include <sstream>
#include <algorithm>
#include <QTimer>
#include <QMenu> #include <QMenu>
#include <QMessageBox> #include <QMessageBox>
/**************************************************************** /****************************************************************
*/ */
//#define DEBUG_FORUMS
/* Images for context menu icons */ /* Images for context menu icons */
#define IMAGE_MESSAGE ":/images/folder-draft.png" #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"
/* Images for TreeWidget */ /* Images for TreeWidget */
#define IMAGE_FOLDER ":/images/folder16.png" #define IMAGE_FOLDER ":/images/folder16.png"
#define IMAGE_FOLDERGREEN ":/images/folder_green.png" #define IMAGE_FOLDERGREEN ":/images/folder_green.png"
#define IMAGE_FOLDERRED ":/images/folder_red.png" #define IMAGE_FOLDERRED ":/images/folder_red.png"
#define IMAGE_FOLDERYELLOW ":/images/folder_yellow.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 // token types to deal with
@ -70,7 +53,7 @@
/** Constructor */ /** Constructor */
PostedListDialog::PostedListDialog(QWidget *parent) PostedListDialog::PostedListDialog(QWidget *parent)
: RsAutoUpdatePage(1000,parent), GxsServiceDialog(dynamic_cast<GxsCommentContainer *>(parent)) : RsGxsUpdateBroadcastPage(rsPosted, parent), GxsServiceDialog(dynamic_cast<GxsCommentContainer *>(parent))
{ {
/* Invoke the Qt Designer generated object setup routine */ /* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this); ui.setupUi(this);
@ -79,7 +62,6 @@ PostedListDialog::PostedListDialog(QWidget *parent)
mPostedQueue = new TokenQueue(rsPosted->getTokenService(), this); mPostedQueue = new TokenQueue(rsPosted->getTokenService(), this);
connect( ui.groupTreeWidget, SIGNAL(treeCustomContextMenuRequested(QPoint)), this, SLOT(groupListCustomPopupMenu(QPoint))); connect( ui.groupTreeWidget, SIGNAL(treeCustomContextMenuRequested(QPoint)), this, SLOT(groupListCustomPopupMenu(QPoint)));
connect( ui.groupTreeWidget, SIGNAL(treeCurrentItemChanged(QString)), this, SLOT(changedTopic(QString))); connect( ui.groupTreeWidget, SIGNAL(treeCurrentItemChanged(QString)), this, SLOT(changedTopic(QString)));
connect(ui.hotSortButton, SIGNAL(clicked()), this, SLOT(getRankings())); connect(ui.hotSortButton, SIGNAL(clicked()), this, SLOT(getRankings()));
@ -103,13 +85,9 @@ PostedListDialog::PostedListDialog(QWidget *parent)
ui.hotSortButton->setChecked(true); ui.hotSortButton->setChecked(true);
connect(ui.newTopicButton, SIGNAL(clicked()), this, SLOT(newTopic())); connect(ui.newTopicButton, SIGNAL(clicked()), this, SLOT(newTopic()));
connect(ui.refreshButton, SIGNAL(clicked()), this, SLOT(refreshTopics()));
connect(ui.submitPostButton, SIGNAL(clicked()), this, SLOT(newPost())); connect(ui.submitPostButton, SIGNAL(clicked()), this, SLOT(newPost()));
refreshTopics();
} }
void PostedListDialog::showNext() void PostedListDialog::showNext()
{ {
mPostIndex += mPostShow; mPostIndex += mPostShow;
@ -119,7 +97,6 @@ void PostedListDialog::showNext()
updateShowText(); updateShowText();
} }
void PostedListDialog::showPrev() void PostedListDialog::showPrev()
{ {
mPostIndex -= mPostShow; mPostIndex -= mPostShow;
@ -129,7 +106,6 @@ void PostedListDialog::showPrev()
updateShowText(); updateShowText();
} }
void PostedListDialog::updateShowText() void PostedListDialog::updateShowText()
{ {
QString showText = tr("Showing"); QString showText = tr("Showing");
@ -140,8 +116,6 @@ void PostedListDialog::updateShowText()
ui.showLabel->setText(showText); ui.showLabel->setText(showText);
} }
void PostedListDialog::getRankings() void PostedListDialog::getRankings()
{ {
if(mCurrTopicId.empty()) if(mCurrTopicId.empty())
@ -180,24 +154,6 @@ void PostedListDialog::getRankings()
applyRanking(); 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()) if (mCurrTopicId.empty())
@ -238,7 +194,6 @@ void PostedListDialog::newPost()
} }
} }
void PostedListDialog::unsubscribeTopic() void PostedListDialog::unsubscribeTopic()
{ {
std::cerr << "PostedListDialog::unsubscribeTopic()"; std::cerr << "PostedListDialog::unsubscribeTopic()";
@ -252,7 +207,6 @@ void PostedListDialog::unsubscribeTopic()
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() void PostedListDialog::subscribeTopic()
{ {
std::cerr << "PostedListDialog::subscribeTopic()"; std::cerr << "PostedListDialog::subscribeTopic()";
@ -266,7 +220,6 @@ void PostedListDialog::subscribeTopic()
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) void PostedListDialog::submitVote(const RsGxsGrpMsgIdPair &msgId, bool up)
{ {
/* must grab AuthorId from Layout */ /* 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 << "PostedListDialog::createPost() ERROR GETTING AuthorId!, Vote Failed";
std::cerr << std::endl; std::cerr << std::endl;
QMessageBox::warning(this, tr("RetroShare"),tr("Please create or choose a Signing Id before Voting"), QMessageBox::warning(this, tr("RetroShare"),tr("Please create or choose a Signing Id before Voting"), QMessageBox::Ok, QMessageBox::Ok);
QMessageBox::Ok, QMessageBox::Ok);
return; return;
} }
@ -311,7 +263,6 @@ void PostedListDialog::submitVote(const RsGxsGrpMsgIdPair &msgId, bool up)
mPostedQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, TOKEN_USER_TYPE_VOTE); mPostedQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, TOKEN_USER_TYPE_VOTE);
} }
/*****************************************************************************************/ /*****************************************************************************************/
// Overloaded from FeedHolder. // Overloaded from FeedHolder.
QScrollArea *PostedListDialog::getScrollArea() QScrollArea *PostedListDialog::getScrollArea()
@ -319,74 +270,41 @@ QScrollArea *PostedListDialog::getScrollArea()
return ui.scrollArea; 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 << "PostedListDialog::deleteFeedItem() Nah";
std::cerr << std::endl; std::cerr << std::endl;
return; return;
} }
void PostedListDialog::openChat(std::string peerId) void PostedListDialog::openChat(std::string /*peerId*/)
{ {
std::cerr << "PostedListDialog::openChat() Nah"; std::cerr << "PostedListDialog::openChat() Nah";
std::cerr << std::endl; std::cerr << std::endl;
return; 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); commentLoad(groupId, msgId, title);
} }
/*****************************************************************************************/ /*****************************************************************************************/
void PostedListDialog::updateDisplay(bool /*initialFill*/)
void PostedListDialog::updateDisplay()
{ {
if (!rsPosted) std::cerr << "rsPosted->updateDisplay()";
return;
std::list<std::string> groupIds;
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > msgs;
if (rsPosted->updated(true, true))
{
std::cerr << "rsPosted->updated() returned true";
std::cerr << std::endl; std::cerr << std::endl;
/* update Forums List */
rsPosted->groupsChanged(groupIds); /* update List */
if(!groupIds.empty()) insertGroups();
{
std::cerr << "rsPosted->groupsChanged():";
std::cerr << std::endl;
std::list<std::string>::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);
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgs = getMsgIds();
if(!msgs.empty()) if(!msgs.empty())
{ {
std::cerr << "rsPosted->msgsChanged():"; std::cerr << "rsPosted->msgsChanged():";
std::cerr << std::endl; std::cerr << std::endl;
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::iterator mit; std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::iterator mit;
mit = msgs.find(mCurrTopicId); mit = msgs.find(mCurrTopicId);
if(mit != msgs.end()) if(mit != msgs.end())
@ -398,18 +316,13 @@ void PostedListDialog::updateDisplay()
} }
} }
}
void PostedListDialog::updateDisplayedItems(const std::vector<RsGxsMessageId> &msgIds) void PostedListDialog::updateDisplayedItems(const std::vector<RsGxsMessageId> &msgIds)
{ {
RsTokReqOptions opts; RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA; opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
opts.mOptions = RS_TOKREQOPT_MSG_LATEST; opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
GxsMsgReq msgs; GxsMsgReq msgs;
msgs[mCurrTopicId] = msgIds; msgs[mCurrTopicId] = msgIds;
@ -425,18 +338,14 @@ void PostedListDialog::updateDisplayedItems(const std::vector<RsGxsMessageId> &m
uint32_t token; uint32_t token;
mPostedQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgs, TOKEN_USER_TYPE_POST_MOD); mPostedQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgs, TOKEN_USER_TYPE_POST_MOD);
} }
void PostedListDialog::changedTopic(const QString &id) void PostedListDialog::changedTopic(const QString &id)
{ {
mCurrTopicId = id.toStdString(); mCurrTopicId = id.toStdString();
insertThreads(); insertThreads();
} }
/*********************** **** **** **** ***********************/ /*********************** **** **** **** ***********************/
/** New / Edit Groups ********************************/ /** New / Edit Groups ********************************/
/*********************** **** **** **** ***********************/ /*********************** **** **** **** ***********************/
@ -458,7 +367,6 @@ void PostedListDialog::showGroupDetails()
cf.exec (); cf.exec ();
} }
void PostedListDialog::insertGroups() void PostedListDialog::insertGroups()
{ {
requestGroupSummary(); requestGroupSummary();
@ -473,6 +381,11 @@ void PostedListDialog::requestGroupSummary()
opts.mReqType = GXS_REQUEST_TYPE_GROUP_META; opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
uint32_t token; 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) void PostedListDialog::acknowledgeGroup(const uint32_t &token)
@ -482,7 +395,6 @@ void PostedListDialog::acknowledgeGroup(const uint32_t &token)
if(!grpId.empty()) if(!grpId.empty())
{ {
RsTokReqOptions opts; RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_GROUP_META; opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
uint32_t reqToken; uint32_t reqToken;
@ -529,7 +441,7 @@ void PostedListDialog::acknowledgeVoteMsg(const uint32_t &token)
rsPosted->acknowledgeVote(token, msgId); rsPosted->acknowledgeVote(token, msgId);
} }
void PostedListDialog::loadVoteData(const uint32_t &token) void PostedListDialog::loadVoteData(const uint32_t &/*token*/)
{ {
return; return;
} }
@ -537,8 +449,6 @@ void PostedListDialog::loadVoteData(const uint32_t &token)
/*********************** **** **** **** ***********************/ /*********************** **** **** **** ***********************/
/*********************** **** **** **** ***********************/ /*********************** **** **** **** ***********************/
void PostedListDialog::requestGroupSummary_CurrentForum(const std::string &forumId) void PostedListDialog::requestGroupSummary_CurrentForum(const std::string &forumId)
{ {
RsTokReqOptions opts; RsTokReqOptions opts;
@ -578,7 +488,6 @@ void PostedListDialog::loadGroupSummary_CurrentForum(const uint32_t &token)
/*********************** **** **** **** ***********************/ /*********************** **** **** **** ***********************/
/*********************** **** **** **** ***********************/ /*********************** **** **** **** ***********************/
void PostedListDialog::insertThreads() void PostedListDialog::insertThreads()
{ {
loadCurrentTopicThreads(mCurrTopicId); loadCurrentTopicThreads(mCurrTopicId);
@ -586,7 +495,6 @@ void PostedListDialog::insertThreads()
void PostedListDialog::loadCurrentTopicThreads(const std::string &topicId) void PostedListDialog::loadCurrentTopicThreads(const std::string &topicId)
{ {
std::cerr << "PostedListDialog::loadCurrentForumThreads(" << topicId << ")"; std::cerr << "PostedListDialog::loadCurrentForumThreads(" << topicId << ")";
std::cerr << std::endl; std::cerr << std::endl;
@ -603,8 +511,6 @@ void PostedListDialog::loadCurrentTopicThreads(const std::string &topicId)
requestGroupThreadData_InsertThreads(topicId); requestGroupThreadData_InsertThreads(topicId);
} }
void PostedListDialog::requestGroupThreadData_InsertThreads(const std::string &groupId) void PostedListDialog::requestGroupThreadData_InsertThreads(const std::string &groupId)
{ {
RsTokReqOptions opts; 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); mPostedQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds, TOKEN_USER_TYPE_POST);
} }
void PostedListDialog::loadGroupThreadData_InsertThreads(const uint32_t &token) void PostedListDialog::loadGroupThreadData_InsertThreads(const uint32_t &token)
{ {
std::cerr << "PostedListDialog::loadGroupThreadData_InsertThreads()"; std::cerr << "PostedListDialog::loadGroupThreadData_InsertThreads()";
@ -641,7 +546,6 @@ void PostedListDialog::loadGroupThreadData_InsertThreads(const uint32_t &token)
} }
applyRanking(); applyRanking();
} }
void PostedListDialog::loadPost(const RsPostedPost &post) void PostedListDialog::loadPost(const RsPostedPost &post)
@ -654,33 +558,37 @@ void PostedListDialog::loadPost(const RsPostedPost &post)
mPostList.push_back(item); mPostList.push_back(item);
} }
bool CmpPIHot(const PostedItem *a, const PostedItem *b) 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) 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) 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() void PostedListDialog::applyRanking()
{ {
/* uses current settings to sort posts, then add to layout */ /* 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 << "PostedListDialog::applyRanking() Item: " << item;
std::cerr << std::endl; 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 << "\t Skipping OLD";
std::cerr << std::endl; std::cerr << std::endl;
@ -733,7 +641,6 @@ void PostedListDialog::applyRanking()
continue; continue;
} }
if (counter >= mPostIndex + mPostShow) if (counter >= mPostIndex + mPostShow)
{ {
std::cerr << "\t END - Counter too high"; std::cerr << "\t END - Counter too high";
@ -745,8 +652,8 @@ void PostedListDialog::applyRanking()
std::cerr << "\t Adding to Layout"; std::cerr << "\t Adding to Layout";
std::cerr << std::endl; std::cerr << std::endl;
/* add it in! */ /* add it in! */
item->show();
alayout->addWidget(item); alayout->addWidget(item);
item->show();
} }
else else
{ {
@ -764,7 +671,6 @@ void PostedListDialog::applyRanking()
ui.scrollAreaWidgetContents->update(); ui.scrollAreaWidgetContents->update();
} }
void PostedListDialog::clearPosts() void PostedListDialog::clearPosts()
{ {
std::cerr << "PostedListDialog::clearPosts()" << std::endl; std::cerr << "PostedListDialog::clearPosts()" << std::endl;
@ -849,7 +755,6 @@ void PostedListDialog::shallowClearPosts()
PostedItem *item = *pit; PostedItem *item = *pit;
alayout->removeWidget(item); alayout->removeWidget(item);
} }
} }
void PostedListDialog::updateCurrentDisplayComplete(const uint32_t &token) void PostedListDialog::updateCurrentDisplayComplete(const uint32_t &token)
@ -863,7 +768,6 @@ void PostedListDialog::updateCurrentDisplayComplete(const uint32_t &token)
std::vector<RsPostedPost>::iterator vit; std::vector<RsPostedPost>::iterator vit;
for(vit = posts.begin(); vit != posts.end(); vit++) for(vit = posts.begin(); vit != posts.end(); vit++)
{ {
RsPostedPost& p = *vit; RsPostedPost& p = *vit;
// modify post content // modify post content
@ -887,13 +791,12 @@ void PostedListDialog::updateCurrentDisplayComplete(const uint32_t &token)
QMap<RsGxsMessageId, PostedItem*>::iterator pit; QMap<RsGxsMessageId, PostedItem*>::iterator pit;
for(pit = mPosts.begin(); pit != mPosts.end(); pit++) for(pit = mPosts.begin(); pit != mPosts.end(); pit++)
{ {
(*pit)->mPost.calculateScores(now); (*pit)->post().calculateScores(now);
} }
applyRanking(); applyRanking();
} }
void PostedListDialog::acknowledgeSubscribeChange(const uint32_t &token) void PostedListDialog::acknowledgeSubscribeChange(const uint32_t &token)
{ {
std::cerr << "PostedListDialog::acknowledgeSubscribeChange()"; std::cerr << "PostedListDialog::acknowledgeSubscribeChange()";
@ -903,7 +806,7 @@ void PostedListDialog::acknowledgeSubscribeChange(const uint32_t &token)
RsGxsGroupId groupId; RsGxsGroupId groupId;
rsPosted->acknowledgeGrp(token, groupId); rsPosted->acknowledgeGrp(token, groupId);
refreshTopics(); insertGroups();
} }
/*********************** **** **** **** ***********************/ /*********************** **** **** **** ***********************/
@ -920,7 +823,6 @@ void PostedListDialog::loadRequest(const TokenQueue *queue, const TokenRequest &
/* now switch on req */ /* now switch on req */
switch(req.mUserType) switch(req.mUserType)
{ {
case TOKEN_USER_TYPE_TOPIC: case TOKEN_USER_TYPE_TOPIC:
switch(req.mAnsType) switch(req.mAnsType)
{ {
@ -1002,14 +904,11 @@ void PostedListDialog::loadRequest(const TokenQueue *queue, const TokenRequest &
} }
} }
/**************************************************************************************/ /**************************************************************************************/
/**************************************************************************************/ /**************************************************************************************/
/**************************************************************************************/ /**************************************************************************************/
/**************************** Groups **********************/ /**************************** Groups **********************/
void PostedListDialog::groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo) void PostedListDialog::groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo)
{ {
groupItemInfo.id = QString::fromStdString(groupInfo.mGroupId); groupItemInfo.id = QString::fromStdString(groupInfo.mGroupId);
@ -1018,13 +917,10 @@ void PostedListDialog::groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo
groupItemInfo.popularity = groupInfo.mPop; groupItemInfo.popularity = groupInfo.mPop;
groupItemInfo.lastpost = QDateTime::fromTime_t(groupInfo.mLastPost); groupItemInfo.lastpost = QDateTime::fromTime_t(groupInfo.mLastPost);
groupItemInfo.subscribeFlags = groupInfo.mSubscribeFlags; groupItemInfo.subscribeFlags = groupInfo.mSubscribeFlags;
} }
void PostedListDialog::insertGroupData(const std::list<RsGroupMetaData> &groupList) void PostedListDialog::insertGroupData(const std::list<RsGroupMetaData> &groupList)
{ {
std::list<RsGroupMetaData>::const_iterator it; std::list<RsGroupMetaData>::const_iterator it;
QList<GroupItemInfo> adminList; QList<GroupItemInfo> adminList;
@ -1091,5 +987,3 @@ void PostedListDialog::insertGroupData(const std::list<RsGroupMetaData> &groupLi
/**************************************************************************************/ /**************************************************************************************/
/**************************************************************************************/ /**************************************************************************************/
/**************************************************************************************/ /**************************************************************************************/

View file

@ -24,23 +24,18 @@
#ifndef MRK_POSTED_LIST_DIALOG_H #ifndef MRK_POSTED_LIST_DIALOG_H
#define MRK_POSTED_LIST_DIALOG_H #define MRK_POSTED_LIST_DIALOG_H
#include "retroshare-gui/mainpage.h" #include "retroshare-gui/mainpage.h"
#include "ui_PostedListDialog.h" #include "ui_PostedListDialog.h"
#include <retroshare/rsposted.h> #include <retroshare/rsposted.h>
#include <map>
#include "gui/Posted/PostedItem.h"
#include "gui/common/GroupTreeWidget.h"
#include "util/TokenQueue.h" #include "util/TokenQueue.h"
#include "retroshare-gui/RsAutoUpdatePage.h" #include "gui/gxs/RsGxsUpdateBroadcastPage.h"
#include "PostedUserTypes.h"
#include "gui/gxs/GxsCommentContainer.h" #include "gui/gxs/GxsCommentContainer.h"
#include "gui/feeds/FeedHolder.h"
class PostedItem;
/*********************** **** **** **** ***********************/ /*********************** **** **** **** ***********************/
/** Request / Response of Data ********************************/ /** Request / Response of Data ********************************/
@ -53,7 +48,7 @@
#define POSTEDDIALOG_INSERT_POST 5 #define POSTEDDIALOG_INSERT_POST 5
#define POSTEDDIALOG_REPLY_MESSAGE 6 #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
@ -67,14 +62,12 @@ public:
virtual void openComments(uint32_t type, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, const QString &title); virtual void openComments(uint32_t type, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, const QString &title);
private slots: private slots:
void groupListCustomPopupMenu(QPoint point);
void groupListCustomPopupMenu( QPoint /*point*/ );
void changedTopic(const QString &id); void changedTopic(const QString &id);
void newTopic(); void newTopic();
void showGroupDetails(); void showGroupDetails();
void newPost(); void newPost();
void refreshTopics();
void submitVote(const RsGxsGrpMsgIdPair& msgId, bool up); void submitVote(const RsGxsGrpMsgIdPair& msgId, bool up);
@ -83,12 +76,13 @@ private slots:
void subscribeTopic(); void subscribeTopic();
void unsubscribeTopic(); void unsubscribeTopic();
void showNext(); void showNext();
void showPrev(); void showPrev();
private: protected:
virtual void updateDisplay(bool initialFill);
private:
void updateShowText(); void updateShowText();
void clearPosts(); void clearPosts();
@ -98,7 +92,6 @@ private:
*/ */
void shallowClearPosts(); void shallowClearPosts();
void updateDisplay();
void loadPost(const RsPostedPost &post); void loadPost(const RsPostedPost &post);
void insertGroups(); void insertGroups();
@ -109,7 +102,6 @@ private:
void requestGroupSummary_CurrentForum(const std::string &forumId); void requestGroupSummary_CurrentForum(const std::string &forumId);
void loadGroupSummary_CurrentForum(const uint32_t &token); void loadGroupSummary_CurrentForum(const uint32_t &token);
// subscribe/unsubscribe ack. // subscribe/unsubscribe ack.
void acknowledgeSubscribeChange(const uint32_t &token); void acknowledgeSubscribeChange(const uint32_t &token);
@ -122,19 +114,15 @@ private:
void loadGroupThreadData_InsertThreads(const uint32_t &token); void loadGroupThreadData_InsertThreads(const uint32_t &token);
// votes // votes
void acknowledgeVoteMsg(const uint32_t& token); void acknowledgeVoteMsg(const uint32_t& token);
void loadVoteData(const uint32_t &token); void loadVoteData(const uint32_t &token);
// ranking // ranking
//void loadRankings(const uint32_t& token); //void loadRankings(const uint32_t& token);
//void applyRanking(const PostedRanking& ranks); //void applyRanking(const PostedRanking& ranks);
void applyRanking(); void applyRanking();
// update displayed item // update displayed item
void updateDisplayedItems(const std::vector<RsGxsMessageId>& msgIds); void updateDisplayedItems(const std::vector<RsGxsMessageId>& msgIds);
void updateCurrentDisplayComplete(const uint32_t& token); void updateCurrentDisplayComplete(const uint32_t& token);
@ -144,7 +132,6 @@ private:
void loadRequest(const TokenQueue *queue, const TokenRequest &req); void loadRequest(const TokenQueue *queue, const TokenRequest &req);
private: private:
QTreeWidgetItem *yourTopics; QTreeWidgetItem *yourTopics;
QTreeWidgetItem *subscribedTopics; QTreeWidgetItem *subscribedTopics;
QTreeWidgetItem *popularTopics; QTreeWidgetItem *popularTopics;
@ -162,14 +149,12 @@ private:
QMap<RsGxsMessageId, PostedItem*> mPosts; QMap<RsGxsMessageId, PostedItem*> mPosts;
std::list<PostedItem *> mPostList; std::list<PostedItem *> mPostList;
TokenQueue *mPostedQueue; TokenQueue *mPostedQueue;
//CommentHolder* mCommentHolder; //CommentHolder* mCommentHolder;
/* UI - from Designer */ /* UI - from Designer */
Ui::PostedListDialog ui; Ui::PostedListDialog ui;
}; };
#endif #endif

View file

@ -73,13 +73,6 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="QPushButton" name="refreshButton">
<property name="text">
<string>Refresh</string>
</property>
</widget>
</item>
<item> <item>
<spacer name="horizontalSpacer"> <spacer name="horizontalSpacer">
<property name="orientation"> <property name="orientation">
@ -224,7 +217,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>443</width> <width>443</width>
<height>162</height> <height>166</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">

View file

@ -25,18 +25,11 @@
#include "gui/gxs/GxsCommentDialog.h" #include "gui/gxs/GxsCommentDialog.h"
#include <iostream> #include <iostream>
#include <sstream>
#include <QTimer>
#include <QMessageBox>
/******
* #define PHOTO_DEBUG 1
*****/
#define MAX_COMMENT_TITLE 32
/**************************************************************** /****************************************************************
* Posted Dialog * GxsCommentContainer
* *
*/ */
@ -46,23 +39,21 @@ GxsCommentContainer::GxsCommentContainer(QWidget *parent)
ui.setupUi(this); 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() void GxsCommentContainer::setup()
{ {
mServiceDialog = createServiceDialog(); mServiceDialog = createServiceDialog();
QString name = getServiceName(); QString name = getServiceName();
ui.titleBarLabel->setText(name);
ui.titleBarPixmap->setPixmap(getServicePixmap());
QString list(name);
QWidget *widget = dynamic_cast<QWidget *>(mServiceDialog); QWidget *widget = dynamic_cast<QWidget *>(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) void GxsCommentContainer::commentLoad(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId, const QString &title)
{ {
QString comments = title; QString comments = title;
@ -82,12 +73,11 @@ void GxsCommentContainer::commentLoad(const RsGxsGroupId &grpId, const RsGxsMess
ui.tabWidget->addTab(commentDialog, comments); ui.tabWidget->addTab(commentDialog, comments);
} }
void GxsCommentContainer::tabCloseRequested(int index) void GxsCommentContainer::tabCloseRequested(int index)
{ {
std::cerr << "GxsCommentContainer::tabCloseRequested(" << index << ")"; std::cerr << "GxsCommentContainer::tabCloseRequested(" << index << ")";
std::cerr << std::endl; std::cerr << std::endl;
if (index != 0) if (index != 0)
{ {
QWidget *comments = ui.tabWidget->widget(index); QWidget *comments = ui.tabWidget->widget(index);
@ -100,21 +90,3 @@ void GxsCommentContainer::tabCloseRequested(int index)
std::cerr << std::endl; std::cerr << std::endl;
} }
} }

View file

@ -30,8 +30,6 @@
#include <retroshare/rsgxscommon.h> #include <retroshare/rsgxscommon.h>
#include <retroshare/rstokenservice.h> #include <retroshare/rstokenservice.h>
#include <map>
class GxsServiceDialog; class GxsServiceDialog;
class GxsCommentContainer : public MainPage class GxsCommentContainer : public MainPage
@ -49,24 +47,20 @@ public:
virtual RsTokenService *getTokenService() = 0; virtual RsTokenService *getTokenService() = 0;
virtual RsGxsCommentService *getCommentService() = 0; virtual RsGxsCommentService *getCommentService() = 0;
virtual QWidget *createHeaderWidget(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId) = 0; virtual QWidget *createHeaderWidget(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId) = 0;
virtual QPixmap getServicePixmap() = 0;
private slots: private slots:
void tabCloseRequested(int index); void tabCloseRequested(int index);
private: private:
GxsServiceDialog *mServiceDialog; GxsServiceDialog *mServiceDialog;
/* UI - from Designer */ /* UI - from Designer */
Ui::GxsCommentContainer ui; Ui::GxsCommentContainer ui;
}; };
class GxsServiceDialog class GxsServiceDialog
{ {
public: public:
GxsServiceDialog(GxsCommentContainer *container) GxsServiceDialog(GxsCommentContainer *container)
:mContainer(container) { return; } :mContainer(container) { return; }
@ -77,12 +71,9 @@ virtual ~GxsServiceDialog() { return; }
{ {
mContainer->commentLoad(grpId, msgId, title); mContainer->commentLoad(grpId, msgId, title);
} }
private: private:
GxsCommentContainer *mContainer; GxsCommentContainer *mContainer;
}; };
#endif #endif

View file

@ -17,33 +17,30 @@
<item> <item>
<widget class="QFrame" name="titleBarFrame"> <widget class="QFrame" name="titleBarFrame">
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::StyledPanel</enum> <enum>QFrame::Box</enum>
</property> </property>
<property name="frameShadow"> <property name="frameShadow">
<enum>QFrame::Raised</enum> <enum>QFrame::Sunken</enum>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<property name="margin"> <property name="margin">
<number>2</number> <number>2</number>
</property> </property>
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="titleBarPixmap">
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>24</width> <width>24</width>
<height>24</height> <height>24</height>
</size> </size>
</property> </property>
<property name="text">
<string/>
</property>
<property name="pixmap"> <property name="pixmap">
<pixmap>:/images/posted_24.png</pixmap> <pixmap>:/images/posted_24.png</pixmap>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="titleBarLabel">
<property name="font"> <property name="font">
<font> <font>
<pointsize>10</pointsize> <pointsize>10</pointsize>
@ -73,7 +70,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QTabWidget" name="tabWidget"> <widget class="RSTabWidget" name="tabWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>-1</number> <number>-1</number>
</property> </property>
@ -84,8 +81,14 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<resources> <customwidgets>
<include location="Posted_images.qrc"/> <customwidget>
</resources> <class>RSTabWidget</class>
<extends>QTabWidget</extends>
<header>gui/common/RSTabWidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/> <connections/>
</ui> </ui>

View file

@ -24,17 +24,15 @@
#ifndef MRK_CHANNEL_DIALOG_H #ifndef MRK_CHANNEL_DIALOG_H
#define MRK_CHANNEL_DIALOG_H #define MRK_CHANNEL_DIALOG_H
#include <retroshare/rsgxschannels.h> #include <retroshare/rsgxschannels.h>
#include "gui/gxs/GxsCommentContainer.h" #include "gui/gxs/GxsCommentContainer.h"
#include "gui/gxschannels/GxsChannelDialog.h" #include "gui/gxschannels/GxsChannelDialog.h"
#include "gui/feeds/GxsChannelPostItem.h" #include "gui/feeds/GxsChannelPostItem.h"
class ChannelDialog : public GxsCommentContainer class ChannelDialog : public GxsCommentContainer
{ {
//Q_OBJECT Q_OBJECT
public: public:
ChannelDialog(QWidget *parent = 0) ChannelDialog(QWidget *parent = 0)
@ -64,7 +62,11 @@ public:
{ {
return new GxsChannelPostItem(NULL, 0, grpId, msgId, true); return new GxsChannelPostItem(NULL, 0, grpId, msgId, true);
} }
virtual QPixmap getServicePixmap()
{
return QPixmap(":/images/channels24.png");
}
}; };
#endif #endif

View file

@ -9962,7 +9962,7 @@ p, li { white-space: pre-wrap; }
<context> <context>
<name>PostedDialog</name> <name>PostedDialog</name>
<message> <message>
<source>Posted</source> <source>Posted Links</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
@ -10050,10 +10050,6 @@ p, li { white-space: pre-wrap; }
<source>Top</source> <source>Top</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Refresh</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Today</source> <source>Today</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>