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 */
ui->setupUi(this);
//ui->postFrame->setVisible(false);
ui->treeWidget->setup(token_service, comment_service);
setTokenService(token_service,comment_service);
init();
}
void GxsCommentDialog::init()
{
/* Set header resize modes and initial section sizes */
QHeaderView * ttheader = ui->treeWidget->header () ;
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));
}
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()
{
delete(ui);

View File

@ -32,9 +32,11 @@ class GxsCommentDialog: public QWidget
Q_OBJECT
public:
GxsCommentDialog(QWidget *parent);
GxsCommentDialog(QWidget *parent, RsTokenService *token_service, RsGxsCommentService *comment_service);
virtual ~GxsCommentDialog();
void setTokenService(RsTokenService *token_service, RsGxsCommentService *comment_service);
void setCommentHeader(QWidget *header);
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);
private:
void init();
RsGxsGroupId mGrpId;
RsGxsMessageId mMostRecentMsgId;
std::set<RsGxsMessageId> mMsgVersions;

View File

@ -322,6 +322,8 @@ GxsChannelPostsWidgetWithModel::GxsChannelPostsWidgetWithModel(const RsGxsGroupI
ui->subscribeToolButton->addSubscribedAction(mAutoDownloadAction);
ui->commentsDialog->setTokenService(rsGxsChannels->getTokenService(),rsGxsChannels);
/* Initialize GUI */
setAutoDownload(false);
settingsChanged();
@ -394,6 +396,11 @@ void GxsChannelPostsWidgetWithModel::showPostDetails()
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;
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_SIZE);
ui->channelPostFiles_TV->resizeColumnToContents(RsGxsChannelPostFilesModel::COLUMN_FILES_NAME);
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_SIZE);
ui->channelFiles_TV->resizeColumnToContents(RsGxsChannelPostFilesModel::COLUMN_FILES_NAME);
ui->channelFiles_TV->setAutoSelect(true);
}

View File

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