added comments

This commit is contained in:
csoler 2020-06-07 22:50:17 +02:00
parent 944c5b3592
commit 1cb6369cb6
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C
4 changed files with 39 additions and 8 deletions

View File

@ -36,10 +36,12 @@ GxsCommentDialog::GxsCommentDialog(QWidget *parent, RsTokenService *token_servic
/* Invoke the Qt Designer generated QObject setup routine */ /* Invoke the Qt Designer generated QObject setup routine */
ui->setupUi(this); ui->setupUi(this);
//ui->postFrame->setVisible(false); setTokenService(token_service,comment_service);
init();
ui->treeWidget->setup(token_service, comment_service); }
void GxsCommentDialog::init()
{
/* Set header resize modes and initial section sizes */ /* Set header resize modes and initial section sizes */
QHeaderView * ttheader = ui->treeWidget->header () ; QHeaderView * ttheader = ui->treeWidget->header () ;
ttheader->resizeSection (0, 440); ttheader->resizeSection (0, 440);
@ -62,6 +64,20 @@ GxsCommentDialog::GxsCommentDialog(QWidget *parent, RsTokenService *token_servic
ui->sortBox->setIconSize(QSize(S*1.5,S*1.5)); ui->sortBox->setIconSize(QSize(S*1.5,S*1.5));
} }
void GxsCommentDialog::setTokenService(RsTokenService *token_service, RsGxsCommentService *comment_service)
{
ui->treeWidget->setup(token_service, comment_service);
}
GxsCommentDialog::GxsCommentDialog(QWidget *parent)
: QWidget(parent), ui(new Ui::GxsCommentDialog)
{
/* Invoke the Qt Designer generated QObject setup routine */
ui->setupUi(this);
init();
}
GxsCommentDialog::~GxsCommentDialog() GxsCommentDialog::~GxsCommentDialog()
{ {
delete(ui); delete(ui);

View File

@ -32,9 +32,11 @@ class GxsCommentDialog: public QWidget
Q_OBJECT Q_OBJECT
public: public:
GxsCommentDialog(QWidget *parent);
GxsCommentDialog(QWidget *parent, RsTokenService *token_service, RsGxsCommentService *comment_service); GxsCommentDialog(QWidget *parent, RsTokenService *token_service, RsGxsCommentService *comment_service);
virtual ~GxsCommentDialog(); virtual ~GxsCommentDialog();
void setTokenService(RsTokenService *token_service, RsGxsCommentService *comment_service);
void setCommentHeader(QWidget *header); void setCommentHeader(QWidget *header);
void commentLoad(const RsGxsGroupId &grpId, const std::set<RsGxsMessageId> &msg_versions, const RsGxsMessageId &most_recent_msgId); void commentLoad(const RsGxsGroupId &grpId, const std::set<RsGxsMessageId> &msg_versions, const RsGxsMessageId &most_recent_msgId);
@ -48,6 +50,8 @@ private slots:
void sortComments(int); void sortComments(int);
private: private:
void init();
RsGxsGroupId mGrpId; RsGxsGroupId mGrpId;
RsGxsMessageId mMostRecentMsgId; RsGxsMessageId mMostRecentMsgId;
std::set<RsGxsMessageId> mMsgVersions; std::set<RsGxsMessageId> mMsgVersions;

View File

@ -322,6 +322,8 @@ GxsChannelPostsWidgetWithModel::GxsChannelPostsWidgetWithModel(const RsGxsGroupI
ui->subscribeToolButton->addSubscribedAction(mAutoDownloadAction); ui->subscribeToolButton->addSubscribedAction(mAutoDownloadAction);
ui->commentsDialog->setTokenService(rsGxsChannels->getTokenService(),rsGxsChannels);
/* Initialize GUI */ /* Initialize GUI */
setAutoDownload(false); setAutoDownload(false);
settingsChanged(); settingsChanged();
@ -394,6 +396,11 @@ void GxsChannelPostsWidgetWithModel::showPostDetails()
mChannelPostFilesModel->setFiles(post.mFiles); mChannelPostFilesModel->setFiles(post.mFiles);
auto all_msgs_versions(post.mOlderVersions);
all_msgs_versions.insert(post.mMeta.mMsgId);
ui->commentsDialog->commentLoad(post.mMeta.mGroupId, all_msgs_versions, post.mMeta.mMsgId);
std::cerr << "Showing details about selected index : "<< index.row() << "," << index.column() << std::endl; std::cerr << "Showing details about selected index : "<< index.row() << "," << index.column() << std::endl;
ui->postDetails_TE->setText(RsHtml().formatText(NULL, QString::fromUtf8(post.mMsg.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS)); ui->postDetails_TE->setText(RsHtml().formatText(NULL, QString::fromUtf8(post.mMsg.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
@ -417,7 +424,6 @@ void GxsChannelPostsWidgetWithModel::showPostDetails()
ui->channelPostFiles_TV->resizeColumnToContents(RsGxsChannelPostFilesModel::COLUMN_FILES_FILE); ui->channelPostFiles_TV->resizeColumnToContents(RsGxsChannelPostFilesModel::COLUMN_FILES_FILE);
ui->channelPostFiles_TV->resizeColumnToContents(RsGxsChannelPostFilesModel::COLUMN_FILES_SIZE); ui->channelPostFiles_TV->resizeColumnToContents(RsGxsChannelPostFilesModel::COLUMN_FILES_SIZE);
ui->channelPostFiles_TV->resizeColumnToContents(RsGxsChannelPostFilesModel::COLUMN_FILES_NAME);
ui->channelPostFiles_TV->setAutoSelect(true); ui->channelPostFiles_TV->setAutoSelect(true);
} }
@ -431,7 +437,6 @@ void GxsChannelPostsWidgetWithModel::updateChannelFiles()
ui->channelFiles_TV->resizeColumnToContents(RsGxsChannelPostFilesModel::COLUMN_FILES_FILE); ui->channelFiles_TV->resizeColumnToContents(RsGxsChannelPostFilesModel::COLUMN_FILES_FILE);
ui->channelFiles_TV->resizeColumnToContents(RsGxsChannelPostFilesModel::COLUMN_FILES_SIZE); ui->channelFiles_TV->resizeColumnToContents(RsGxsChannelPostFilesModel::COLUMN_FILES_SIZE);
ui->channelFiles_TV->resizeColumnToContents(RsGxsChannelPostFilesModel::COLUMN_FILES_NAME);
ui->channelFiles_TV->setAutoSelect(true); ui->channelFiles_TV->setAutoSelect(true);
} }

View File

@ -224,7 +224,7 @@
<item> <item>
<widget class="QTabWidget" name="channel_TW"> <widget class="QTabWidget" name="channel_TW">
<property name="currentIndex"> <property name="currentIndex">
<number>2</number> <number>1</number>
</property> </property>
<widget class="QWidget" name="tab_3"> <widget class="QWidget" name="tab_3">
<attribute name="title"> <attribute name="title">
@ -448,7 +448,7 @@ p, li { white-space: pre-wrap; }
</font> </font>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>2</number>
</property> </property>
<widget class="QWidget" name="tab"> <widget class="QWidget" name="tab">
<attribute name="title"> <attribute name="title">
@ -532,7 +532,7 @@ p, li { white-space: pre-wrap; }
</attribute> </attribute>
<layout class="QHBoxLayout" name="horizontalLayout_5"> <layout class="QHBoxLayout" name="horizontalLayout_5">
<item> <item>
<widget class="QWidget" name="commentsDialog" native="true"/> <widget class="GxsCommentDialog" name="commentsDialog" native="true"/>
</item> </item>
</layout> </layout>
</widget> </widget>
@ -593,6 +593,12 @@ p, li { white-space: pre-wrap; }
<extends>QTreeView</extends> <extends>QTreeView</extends>
<header>gui/common/RSTreeView.h</header> <header>gui/common/RSTreeView.h</header>
</customwidget> </customwidget>
<customwidget>
<class>GxsCommentDialog</class>
<extends>QWidget</extends>
<header>gui/gxs/GxsCommentDialog.h</header>
<container>1</container>
</customwidget>
</customwidgets> </customwidgets>
<resources> <resources>
<include location="../images.qrc"/> <include location="../images.qrc"/>