mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
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:
parent
11d2701edc
commit
4edcec6fe9
@ -24,50 +24,54 @@
|
||||
#include <QMessageBox>
|
||||
#include "PostedCreatePostDialog.h"
|
||||
#include "ui_PostedCreatePostDialog.h"
|
||||
#include "PostedUserTypes.h"
|
||||
|
||||
#include "util/TokenQueue.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
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();
|
||||
}
|
||||
|
@ -26,12 +26,11 @@
|
||||
|
||||
#include <QDialog>
|
||||
#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
|
||||
|
@ -15,9 +15,12 @@
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="titleEdit"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="titleLabel">
|
||||
<property name="text">
|
||||
<string><!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; }
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="titleEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="linkLabel">
|
||||
<property name="text">
|
||||
<string><!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; }
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="linkEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
@ -81,9 +77,9 @@ p, li { white-space: pre-wrap; }
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<layout class="QVBoxLayout" name="notesLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<widget class="QLabel" name="notesLabel">
|
||||
<property name="text">
|
||||
<string>Notes</string>
|
||||
</property>
|
||||
@ -113,9 +109,7 @@ p, li { white-space: pre-wrap; }
|
||||
<header>gui/gxs/GxsIdChooser.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../images.qrc"/>
|
||||
</resources>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
|
@ -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
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -21,21 +21,15 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QMessageBox>
|
||||
#include <QMouseEvent>
|
||||
#include <QBuffer>
|
||||
#include <time.h>
|
||||
|
||||
#include "PostedItem.h"
|
||||
#include "gui/feeds/FeedHolder.h"
|
||||
|
||||
#include <retroshare/rsposted.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
/** 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<RsPostedPost> 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) + "</span></p>");
|
||||
}
|
||||
#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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -27,31 +27,29 @@
|
||||
#include "ui_PostedItem.h"
|
||||
|
||||
#include <retroshare/rsposted.h>
|
||||
#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
|
||||
|
||||
|
@ -23,54 +23,37 @@
|
||||
|
||||
#include "PostedListDialog.h"
|
||||
|
||||
#include "gui/Posted/PostedGroupDialog.h"
|
||||
#include "gui/Posted/PostedCreatePostDialog.h"
|
||||
#include "gui/Posted/PostedDialog.h"
|
||||
|
||||
#include <retroshare/rsposted.h>
|
||||
#include <retroshare/rsgxsflags.h>
|
||||
#include "PostedGroupDialog.h"
|
||||
#include "PostedCreatePostDialog.h"
|
||||
#include "PostedDialog.h"
|
||||
#include "PostedItem.h"
|
||||
#include "PostedUserTypes.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <algorithm>
|
||||
|
||||
#include <QTimer>
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
|
||||
/****************************************************************
|
||||
*/
|
||||
|
||||
//#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<GxsCommentContainer *>(parent))
|
||||
: RsGxsUpdateBroadcastPage(rsPosted, parent), GxsServiceDialog(dynamic_cast<GxsCommentContainer *>(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<std::string> groupIds;
|
||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > msgs;
|
||||
|
||||
|
||||
if (rsPosted->updated(true, true))
|
||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &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<RsGxsGroupId, std::vector<RsGxsMessageId> >::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<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);
|
||||
|
||||
if(!msgs.empty())
|
||||
{
|
||||
std::cerr << "rsPosted->msgsChanged():";
|
||||
std::cerr << std::endl;
|
||||
|
||||
|
||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::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<RsGxsMessageId> &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<RsGxsMessageId> &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<RsGroupMetaData> 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<RsGroupMetaData> 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<std::string> 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<RsGroupMetaData> groupInfo;
|
||||
rsPosted->getGroupSummary(token, groupInfo);
|
||||
std::list<RsGroupMetaData> 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<PostedItem *>(litem->widget());
|
||||
if (item)
|
||||
{
|
||||
std::cerr << "PostedListDialog::clearPosts() item: " << item;
|
||||
std::cerr << std::endl;
|
||||
PostedItem *item = dynamic_cast<PostedItem *>(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<PostedItem *>(litem->widget());
|
||||
if (item)
|
||||
{
|
||||
std::cerr << "PostedListDialog::shallowClearPosts() item: " << item;
|
||||
std::cerr << std::endl;
|
||||
PostedItem *item = dynamic_cast<PostedItem *>(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<RsPostedPost>::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<RsGxsMessageId, PostedItem*>::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<RsGroupMetaData> &groupList)
|
||||
{
|
||||
|
||||
std::list<RsGroupMetaData>::const_iterator it;
|
||||
|
||||
QList<GroupItemInfo> adminList;
|
||||
@ -1070,15 +966,15 @@ void PostedListDialog::insertGroupData(const std::list<RsGroupMetaData> &groupLi
|
||||
std::multimap<uint32_t, GroupItemInfo>::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<RsGroupMetaData> &groupLi
|
||||
/**************************************************************************************/
|
||||
/**************************************************************************************/
|
||||
/**************************************************************************************/
|
||||
|
||||
|
||||
|
@ -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 <retroshare/rsposted.h>
|
||||
|
||||
#include <map>
|
||||
|
||||
#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<RsGxsMessageId>& msgIds);
|
||||
void updateCurrentDisplayComplete(const uint32_t& token);
|
||||
|
||||
void acknowledgeVoteMsg(const uint32_t& token);
|
||||
void loadVoteData(const uint32_t &token);
|
||||
void insertGroupData(const std::list<RsGroupMetaData> &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<RsGxsMessageId>& msgIds);
|
||||
void updateCurrentDisplayComplete(const uint32_t& token);
|
||||
|
||||
void insertGroupData(const std::list<RsGroupMetaData> &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<RsGxsGroupId, RsPostedGroup> mGroups;
|
||||
QMap<RsGxsMessageId, PostedItem*> mPosts;
|
||||
std::list<PostedItem *> mPostList;
|
||||
|
||||
QMap<RsGxsGroupId, RsPostedGroup> mGroups;
|
||||
QMap<RsGxsMessageId, PostedItem*> mPosts;
|
||||
std::list<PostedItem *> mPostList;
|
||||
TokenQueue *mPostedQueue;
|
||||
|
||||
//CommentHolder* mCommentHolder;
|
||||
|
||||
TokenQueue *mPostedQueue;
|
||||
|
||||
//CommentHolder* mCommentHolder;
|
||||
|
||||
/* UI - from Designer */
|
||||
Ui::PostedListDialog ui;
|
||||
|
||||
/* UI - from Designer */
|
||||
Ui::PostedListDialog ui;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -73,13 +73,6 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="refreshButton">
|
||||
<property name="text">
|
||||
<string>Refresh</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
@ -224,7 +217,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>443</width>
|
||||
<height>162</height>
|
||||
<height>166</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
|
@ -25,18 +25,11 @@
|
||||
#include "gui/gxs/GxsCommentDialog.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#include <QTimer>
|
||||
#include <QMessageBox>
|
||||
|
||||
/******
|
||||
* #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<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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -30,59 +30,50 @@
|
||||
#include <retroshare/rsgxscommon.h>
|
||||
#include <retroshare/rstokenservice.h>
|
||||
|
||||
#include <map>
|
||||
|
||||
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
|
||||
|
||||
|
@ -17,33 +17,30 @@
|
||||
<item>
|
||||
<widget class="QFrame" name="titleBarFrame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="margin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<widget class="QLabel" name="titleBarPixmap">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap>:/images/posted_24.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<widget class="QLabel" name="titleBarLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
@ -73,7 +70,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<widget class="RSTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
@ -84,8 +81,14 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="Posted_images.qrc"/>
|
||||
</resources>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>RSTabWidget</class>
|
||||
<extends>QTabWidget</extends>
|
||||
<header>gui/common/RSTabWidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
@ -24,23 +24,21 @@
|
||||
#ifndef MRK_CHANNEL_DIALOG_H
|
||||
#define MRK_CHANNEL_DIALOG_H
|
||||
|
||||
|
||||
#include <retroshare/rsgxschannels.h>
|
||||
|
||||
#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
|
||||
|
||||
|
@ -9962,7 +9962,7 @@ p, li { white-space: pre-wrap; }
|
||||
<context>
|
||||
<name>PostedDialog</name>
|
||||
<message>
|
||||
<source>Posted</source>
|
||||
<source>Posted Links</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
@ -10050,10 +10050,6 @@ p, li { white-space: pre-wrap; }
|
||||
<source>Top</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Refresh</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Today</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
Loading…
Reference in New Issue
Block a user