mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-22 21:31:07 -05:00
fixed right-click menu on board posts
This commit is contained in:
parent
44bb2c0f05
commit
4a69380848
@ -43,6 +43,7 @@
|
|||||||
|
|
||||||
#define LINK_IMAGE ":/images/thumb-link.png"
|
#define LINK_IMAGE ":/images/thumb-link.png"
|
||||||
|
|
||||||
|
|
||||||
// #ifdef DEBUG_BOARDPOSTDISPLAYWIDGET 1
|
// #ifdef DEBUG_BOARDPOSTDISPLAYWIDGET 1
|
||||||
|
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
@ -58,6 +59,7 @@ BoardPostDisplayWidgetBase::BoardPostDisplayWidgetBase(const RsPostedPost& post,
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BoardPostDisplayWidgetBase::setCommentsSize(int comNb)
|
void BoardPostDisplayWidgetBase::setCommentsSize(int comNb)
|
||||||
{
|
{
|
||||||
QString sComButText = tr("Comment");
|
QString sComButText = tr("Comment");
|
||||||
@ -168,6 +170,7 @@ void BoardPostDisplayWidgetBase::baseSetup()
|
|||||||
|
|
||||||
readButton()->setChecked(false);
|
readButton()->setChecked(false);
|
||||||
|
|
||||||
|
#ifdef TO_REMOVE
|
||||||
QMenu *menu = new QMenu();
|
QMenu *menu = new QMenu();
|
||||||
menu->addAction(CopyLinkAction);
|
menu->addAction(CopyLinkAction);
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
@ -175,6 +178,7 @@ void BoardPostDisplayWidgetBase::baseSetup()
|
|||||||
shareButton()->setPopupMode(QToolButton::InstantPopup);
|
shareButton()->setPopupMode(QToolButton::InstantPopup);
|
||||||
|
|
||||||
connect(menu,SIGNAL(aboutToShow()),this,SLOT(handleShareButtonClicked()));
|
connect(menu,SIGNAL(aboutToShow()),this,SLOT(handleShareButtonClicked()));
|
||||||
|
#endif
|
||||||
|
|
||||||
RsReputationLevel overall_reputation = rsReputations->overallReputationLevel(mPost.mMeta.mAuthorId);
|
RsReputationLevel overall_reputation = rsReputations->overallReputationLevel(mPost.mMeta.mAuthorId);
|
||||||
bool redacted = (overall_reputation == RsReputationLevel::LOCALLY_NEGATIVE);
|
bool redacted = (overall_reputation == RsReputationLevel::LOCALLY_NEGATIVE);
|
||||||
@ -182,7 +186,9 @@ void BoardPostDisplayWidgetBase::baseSetup()
|
|||||||
if(redacted)
|
if(redacted)
|
||||||
{
|
{
|
||||||
commentButton()->setDisabled(true);
|
commentButton()->setDisabled(true);
|
||||||
|
#ifdef TO_REMOVE
|
||||||
shareButton()->setDisabled(true);
|
shareButton()->setDisabled(true);
|
||||||
|
#endif
|
||||||
voteUpButton()->setDisabled(true);
|
voteUpButton()->setDisabled(true);
|
||||||
voteDownButton()->setDisabled(true);
|
voteDownButton()->setDisabled(true);
|
||||||
fromLabel()->setId(mPost.mMeta.mAuthorId);
|
fromLabel()->setId(mPost.mMeta.mAuthorId);
|
||||||
@ -275,6 +281,7 @@ void BoardPostDisplayWidgetBase::baseSetup()
|
|||||||
emit sizeChanged(this);
|
emit sizeChanged(this);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#ifdef TO_REMOVE
|
||||||
void BoardPostDisplayWidgetBase::handleShareButtonClicked()
|
void BoardPostDisplayWidgetBase::handleShareButtonClicked()
|
||||||
{
|
{
|
||||||
emit shareButtonClicked();
|
emit shareButtonClicked();
|
||||||
@ -284,6 +291,8 @@ void BoardPostDisplayWidgetBase::handleCopyLinkClicked()
|
|||||||
{
|
{
|
||||||
emit copylinkClicked();
|
emit copylinkClicked();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//===================================================================================================================================
|
//===================================================================================================================================
|
||||||
//== class BoardPostDisplayWidget ==
|
//== class BoardPostDisplayWidget ==
|
||||||
//===================================================================================================================================
|
//===================================================================================================================================
|
||||||
@ -292,6 +301,7 @@ BoardPostDisplayWidget_compact::BoardPostDisplayWidget_compact(const RsPostedPos
|
|||||||
: BoardPostDisplayWidgetBase(post,display_flags,parent), ui(new Ui::BoardPostDisplayWidget_compact())
|
: BoardPostDisplayWidgetBase(post,display_flags,parent), ui(new Ui::BoardPostDisplayWidget_compact())
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
ui->shareButton->hide();
|
||||||
BoardPostDisplayWidget_compact::setup();
|
BoardPostDisplayWidget_compact::setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -403,7 +413,7 @@ QLabel *BoardPostDisplayWidget_compact::dateLabel() { return ui->da
|
|||||||
QLabel *BoardPostDisplayWidget_compact::titleLabel() { return ui->titleLabel; }
|
QLabel *BoardPostDisplayWidget_compact::titleLabel() { return ui->titleLabel; }
|
||||||
QLabel *BoardPostDisplayWidget_compact::scoreLabel() { return ui->scoreLabel; }
|
QLabel *BoardPostDisplayWidget_compact::scoreLabel() { return ui->scoreLabel; }
|
||||||
QLabel *BoardPostDisplayWidget_compact::notes() { return ui->notes; }
|
QLabel *BoardPostDisplayWidget_compact::notes() { return ui->notes; }
|
||||||
QToolButton *BoardPostDisplayWidget_compact::shareButton() { return ui->shareButton; }
|
//QToolButton *BoardPostDisplayWidget_compact::shareButton() { return ui->shareButton; }
|
||||||
QLabel *BoardPostDisplayWidget_compact::pictureLabel() { return ui->pictureLabel; }
|
QLabel *BoardPostDisplayWidget_compact::pictureLabel() { return ui->pictureLabel; }
|
||||||
QFrame *BoardPostDisplayWidget_compact::feedFrame() { return ui->feedFrame; }
|
QFrame *BoardPostDisplayWidget_compact::feedFrame() { return ui->feedFrame; }
|
||||||
|
|
||||||
@ -415,6 +425,7 @@ BoardPostDisplayWidget_card::BoardPostDisplayWidget_card(const RsPostedPost& pos
|
|||||||
: BoardPostDisplayWidgetBase(post,display_flags,parent), ui(new Ui::BoardPostDisplayWidget_card())
|
: BoardPostDisplayWidgetBase(post,display_flags,parent), ui(new Ui::BoardPostDisplayWidget_card())
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
ui->shareButton->hide();
|
||||||
BoardPostDisplayWidget_card::setup();
|
BoardPostDisplayWidget_card::setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -472,7 +483,7 @@ QLabel *BoardPostDisplayWidget_card::dateLabel() { return ui->dateL
|
|||||||
QLabel *BoardPostDisplayWidget_card::titleLabel() { return ui->titleLabel; }
|
QLabel *BoardPostDisplayWidget_card::titleLabel() { return ui->titleLabel; }
|
||||||
QLabel *BoardPostDisplayWidget_card::scoreLabel() { return ui->scoreLabel; }
|
QLabel *BoardPostDisplayWidget_card::scoreLabel() { return ui->scoreLabel; }
|
||||||
QLabel *BoardPostDisplayWidget_card::notes() { return ui->notes; }
|
QLabel *BoardPostDisplayWidget_card::notes() { return ui->notes; }
|
||||||
QToolButton *BoardPostDisplayWidget_card::shareButton() { return ui->shareButton; }
|
//QToolButton *BoardPostDisplayWidget_card::shareButton() { return ui->shareButton; }
|
||||||
QLabel *BoardPostDisplayWidget_card::pictureLabel() { return ui->pictureLabel; }
|
QLabel *BoardPostDisplayWidget_card::pictureLabel() { return ui->pictureLabel; }
|
||||||
QFrame *BoardPostDisplayWidget_card::feedFrame() { return ui->feedFrame; }
|
QFrame *BoardPostDisplayWidget_card::feedFrame() { return ui->feedFrame; }
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ protected:
|
|||||||
virtual QLabel *notes() =0;
|
virtual QLabel *notes() =0;
|
||||||
virtual QLabel *pictureLabel()=0;
|
virtual QLabel *pictureLabel()=0;
|
||||||
virtual QToolButton *readButton() =0;
|
virtual QToolButton *readButton() =0;
|
||||||
virtual QToolButton *shareButton() =0;
|
// virtual QToolButton *shareButton() =0;
|
||||||
virtual QFrame *feedFrame() =0;
|
virtual QFrame *feedFrame() =0;
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
@ -89,9 +89,10 @@ protected slots:
|
|||||||
void makeUpVote() ;
|
void makeUpVote() ;
|
||||||
void makeDownVote() ;
|
void makeDownVote() ;
|
||||||
void setCommentsSize(int comNb) ;
|
void setCommentsSize(int comNb) ;
|
||||||
|
#ifdef TO_REMOVE
|
||||||
void handleShareButtonClicked() ;
|
void handleShareButtonClicked() ;
|
||||||
void handleCopyLinkClicked() ;
|
void handleCopyLinkClicked() ;
|
||||||
|
#endif
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void changeReadStatusRequested(const RsGxsMessageId&,bool);
|
void changeReadStatusRequested(const RsGxsMessageId&,bool);
|
||||||
@ -99,8 +100,8 @@ signals:
|
|||||||
void expand(RsGxsMessageId,bool);
|
void expand(RsGxsMessageId,bool);
|
||||||
void commentsRequested(const RsGxsMessageId&,bool);
|
void commentsRequested(const RsGxsMessageId&,bool);
|
||||||
void thumbnailOpenned();
|
void thumbnailOpenned();
|
||||||
void shareButtonClicked();
|
// void shareButtonClicked();
|
||||||
void copylinkClicked();
|
// void copylinkClicked();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
RsPostedPost mPost;
|
RsPostedPost mPost;
|
||||||
@ -128,7 +129,9 @@ public:
|
|||||||
QLabel *notes() override;
|
QLabel *notes() override;
|
||||||
QLabel *pictureLabel() override;
|
QLabel *pictureLabel() override;
|
||||||
QToolButton *readButton() override;
|
QToolButton *readButton() override;
|
||||||
|
#ifdef TO_REMOVE
|
||||||
QToolButton *shareButton() override;
|
QToolButton *shareButton() override;
|
||||||
|
#endif
|
||||||
QFrame *feedFrame() override;
|
QFrame *feedFrame() override;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
@ -166,7 +169,7 @@ public:
|
|||||||
QLabel *scoreLabel() override;
|
QLabel *scoreLabel() override;
|
||||||
QLabel *notes() override;
|
QLabel *notes() override;
|
||||||
QToolButton *readButton() override;
|
QToolButton *readButton() override;
|
||||||
QToolButton *shareButton() override;
|
// QToolButton *shareButton() override;
|
||||||
QLabel *pictureLabel() override;
|
QLabel *pictureLabel() override;
|
||||||
QFrame *feedFrame() override;
|
QFrame *feedFrame() override;
|
||||||
|
|
||||||
|
@ -230,7 +230,6 @@ QWidget *PostedPostDelegate::createEditor(QWidget *parent, const QStyleOptionVie
|
|||||||
QObject::connect(w,SIGNAL(expand(RsGxsMessageId,bool)),this,SLOT(markCurrentPostAsRead()));
|
QObject::connect(w,SIGNAL(expand(RsGxsMessageId,bool)),this,SLOT(markCurrentPostAsRead()));
|
||||||
QObject::connect(w,SIGNAL(commentsRequested(RsGxsMessageId,bool)),mPostListWidget,SLOT(markCurrentPostAsRead()));
|
QObject::connect(w,SIGNAL(commentsRequested(RsGxsMessageId,bool)),mPostListWidget,SLOT(markCurrentPostAsRead()));
|
||||||
QObject::connect(w,SIGNAL(shareButtonClicked()),mPostListWidget,SLOT(markCurrentPostAsRead()));
|
QObject::connect(w,SIGNAL(shareButtonClicked()),mPostListWidget,SLOT(markCurrentPostAsRead()));
|
||||||
QObject::connect(w,SIGNAL(copylinkClicked()),mPostListWidget,SLOT(copyMessageLink()));
|
|
||||||
|
|
||||||
w->setGeometry(option.rect);
|
w->setGeometry(option.rect);
|
||||||
w->adjustSize();
|
w->adjustSize();
|
||||||
@ -277,7 +276,6 @@ PostedListWidgetWithModel::PostedListWidgetWithModel(const RsGxsGroupId& postedI
|
|||||||
connect(ui->nextButton,SIGNAL(clicked()),this,SLOT(nextPosts()));
|
connect(ui->nextButton,SIGNAL(clicked()),this,SLOT(nextPosts()));
|
||||||
connect(ui->prevButton,SIGNAL(clicked()),this,SLOT(prevPosts()));
|
connect(ui->prevButton,SIGNAL(clicked()),this,SLOT(prevPosts()));
|
||||||
|
|
||||||
connect(ui->postsTree,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(postContextMenu(QPoint)));
|
|
||||||
connect(ui->viewModeButton,SIGNAL(clicked()),this,SLOT(switchDisplayMode()));
|
connect(ui->viewModeButton,SIGNAL(clicked()),this,SLOT(switchDisplayMode()));
|
||||||
|
|
||||||
connect(mPostedPostsModel,SIGNAL(boardPostsLoaded()),this,SLOT(postPostLoad()));
|
connect(mPostedPostsModel,SIGNAL(boardPostsLoaded()),this,SLOT(postPostLoad()));
|
||||||
@ -296,6 +294,10 @@ PostedListWidgetWithModel::PostedListWidgetWithModel(const RsGxsGroupId& postedI
|
|||||||
|
|
||||||
connect(ui->postsTree,SIGNAL(sizeChanged(QSize)),this,SLOT(handlePostsTreeSizeChange(QSize)));
|
connect(ui->postsTree,SIGNAL(sizeChanged(QSize)),this,SLOT(handlePostsTreeSizeChange(QSize)));
|
||||||
|
|
||||||
|
ui->postsTree->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
|
//QObject::connect(this,SIGNAL(copylinkClicked()),this,SLOT(copyMessageLink()));
|
||||||
|
connect(ui->postsTree,SIGNAL(customContextMenuRequested(const QPoint&)),this,SLOT(postContextMenu(const QPoint&)));
|
||||||
|
|
||||||
/* load settings */
|
/* load settings */
|
||||||
processSettings(true);
|
processSettings(true);
|
||||||
|
|
||||||
@ -325,6 +327,32 @@ PostedListWidgetWithModel::PostedListWidgetWithModel(const RsGxsGroupId& postedI
|
|||||||
}, mEventHandlerId, RsEventType::GXS_POSTED );
|
}, mEventHandlerId, RsEventType::GXS_POSTED );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PostedListWidgetWithModel::postContextMenu(const QPoint& point)
|
||||||
|
{
|
||||||
|
QMenu menu(this);
|
||||||
|
|
||||||
|
// 1 - check that we are clicking on a post
|
||||||
|
|
||||||
|
QModelIndex index = ui->postsTree->indexAt(point);
|
||||||
|
|
||||||
|
if(!index.isValid())
|
||||||
|
return;
|
||||||
|
|
||||||
|
// 2 - generate the menu for that post.
|
||||||
|
|
||||||
|
menu.addAction(FilesDefs::getIconFromQtResourcePath(IMAGE_COPYLINK), tr("Copy RetroShare Link"), this, SLOT(copyMessageLink()))->setData(index);
|
||||||
|
menu.addAction(FilesDefs::getIconFromQtResourcePath(IMAGE_AUTHOR), tr("Show author in People tab"), this, SLOT(showAuthorInPeople()))->setData(index);
|
||||||
|
|
||||||
|
#ifdef TODO
|
||||||
|
// This feature is not implemented yet in libretroshare.
|
||||||
|
|
||||||
|
if(IS_GROUP_PUBLISHER(mGroup.mMeta.mSubscribeFlags))
|
||||||
|
menu.addAction(FilesDefs::getIconFromQtResourcePath(":/images/edit_16.png"), tr("Edit"), this, SLOT(editPost()));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
menu.exec(QCursor::pos());
|
||||||
|
}
|
||||||
|
|
||||||
void PostedListWidgetWithModel::switchDisplayMode()
|
void PostedListWidgetWithModel::switchDisplayMode()
|
||||||
{
|
{
|
||||||
if(mPostedPostsDelegate->getDisplayMode() == BoardPostDisplayWidget_compact::DISPLAY_MODE_CARD)
|
if(mPostedPostsDelegate->getDisplayMode() == BoardPostDisplayWidget_compact::DISPLAY_MODE_CARD)
|
||||||
@ -403,7 +431,7 @@ void PostedListWidgetWithModel::prevPosts()
|
|||||||
|
|
||||||
void PostedListWidgetWithModel::showAuthorInPeople()
|
void PostedListWidgetWithModel::showAuthorInPeople()
|
||||||
{
|
{
|
||||||
QModelIndex index = ui->postsTree->selectionModel()->currentIndex();
|
QModelIndex index = qobject_cast<QAction*>(QObject::sender())->data().toModelIndex();
|
||||||
|
|
||||||
if(!index.isValid())
|
if(!index.isValid())
|
||||||
throw std::runtime_error("No post under mouse!");
|
throw std::runtime_error("No post under mouse!");
|
||||||
@ -428,23 +456,6 @@ void PostedListWidgetWithModel::showAuthorInPeople()
|
|||||||
MainWindow::showWindow(MainWindow::People);
|
MainWindow::showWindow(MainWindow::People);
|
||||||
idDialog->navigate(RsGxsId(post.mMeta.mAuthorId));
|
idDialog->navigate(RsGxsId(post.mMeta.mAuthorId));
|
||||||
}
|
}
|
||||||
void PostedListWidgetWithModel::postContextMenu(const QPoint&)
|
|
||||||
{
|
|
||||||
QMenu menu(this);
|
|
||||||
|
|
||||||
menu.addAction(FilesDefs::getIconFromQtResourcePath(IMAGE_COPYLINK), tr("Copy RetroShare Link"), this, SLOT(copyMessageLink()));
|
|
||||||
menu.addAction(FilesDefs::getIconFromQtResourcePath(IMAGE_AUTHOR), tr("Show author in People tab"), this, SLOT(showAuthorInPeople()));
|
|
||||||
|
|
||||||
#ifdef TODO
|
|
||||||
// This feature is not implemented yet in libretroshare.
|
|
||||||
|
|
||||||
if(IS_GROUP_PUBLISHER(mGroup.mMeta.mSubscribeFlags))
|
|
||||||
menu.addAction(FilesDefs::getIconFromQtResourcePath(":/images/edit_16.png"), tr("Edit"), this, SLOT(editPost()));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
menu.exec(QCursor::pos());
|
|
||||||
}
|
|
||||||
|
|
||||||
void PostedListWidgetWithModel::copyMessageLink()
|
void PostedListWidgetWithModel::copyMessageLink()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -452,7 +463,7 @@ void PostedListWidgetWithModel::copyMessageLink()
|
|||||||
if (groupId().isNull())
|
if (groupId().isNull())
|
||||||
throw std::runtime_error("No channel currently selected!");
|
throw std::runtime_error("No channel currently selected!");
|
||||||
|
|
||||||
QModelIndex index = ui->postsTree->selectionModel()->currentIndex();
|
QModelIndex index = qobject_cast<QAction*>(QObject::sender())->data().toModelIndex();
|
||||||
|
|
||||||
if(!index.isValid())
|
if(!index.isValid())
|
||||||
throw std::runtime_error("No post under mouse!");
|
throw std::runtime_error("No post under mouse!");
|
||||||
@ -528,87 +539,6 @@ void PostedListWidgetWithModel::handleEvent_main_thread(std::shared_ptr<const Rs
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TO_REMOVE
|
|
||||||
void PostedListWidgetWithModel::showPostDetails()
|
|
||||||
{
|
|
||||||
QModelIndex index = ui->postsTree->selectionModel()->currentIndex();
|
|
||||||
RsPostedPost post = index.data(Qt::UserRole).value<RsPostedPost>() ;
|
|
||||||
|
|
||||||
QTextDocument doc;
|
|
||||||
doc.setHtml(post.mMsg.c_str());
|
|
||||||
|
|
||||||
if(post.mMeta.mPublishTs == 0)
|
|
||||||
{
|
|
||||||
ui->postDetails_TE->clear();
|
|
||||||
ui->postLogo_LB->hide();
|
|
||||||
ui->postName_LB->hide();
|
|
||||||
ui->postTime_LB->hide();
|
|
||||||
mChannelPostFilesModel->clear();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ui->postLogo_LB->show();
|
|
||||||
ui->postName_LB->show();
|
|
||||||
ui->postTime_LB->show();
|
|
||||||
|
|
||||||
if(index.row()==0 && index.column()==0)
|
|
||||||
std::cerr << "here" << std::endl;
|
|
||||||
|
|
||||||
std::cerr << "showPostDetails: setting mLastSelectedPosts[groupId()] to current post Id " << post.mMeta.mMsgId << ". Previous value: " << mLastSelectedPosts[groupId()] << std::endl;
|
|
||||||
mLastSelectedPosts[groupId()] = post.mMeta.mMsgId;
|
|
||||||
|
|
||||||
std::list<ChannelPostFileInfo> files;
|
|
||||||
for(auto& file:post.mFiles)
|
|
||||||
files.push_back(ChannelPostFileInfo(file,post.mMeta.mPublishTs));
|
|
||||||
|
|
||||||
mChannelPostFilesModel->setFiles(files);
|
|
||||||
|
|
||||||
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));
|
|
||||||
|
|
||||||
QPixmap postImage;
|
|
||||||
|
|
||||||
if (post.mThumbnail.mData != NULL)
|
|
||||||
GxsIdDetails::loadPixmapFromData(post.mThumbnail.mData, post.mThumbnail.mSize, postImage,GxsIdDetails::ORIGINAL);
|
|
||||||
else
|
|
||||||
postImage = FilesDefs::getPixmapFromQtResourcePath(ChannelPostThumbnailView::CHAN_DEFAULT_IMAGE);
|
|
||||||
|
|
||||||
int W = QFontMetricsF(font()).height() * 8;
|
|
||||||
|
|
||||||
// Using fixed width so that the post will not displace the text when we browse.
|
|
||||||
|
|
||||||
ui->postLogo_LB->setPixmap(postImage);
|
|
||||||
ui->postLogo_LB->setFixedSize(W,postImage.height()/(float)postImage.width()*W);
|
|
||||||
|
|
||||||
ui->postName_LB->setText(QString::fromUtf8(post.mMeta.mMsgName.c_str()));
|
|
||||||
ui->postName_LB->setFixedWidth(W);
|
|
||||||
ui->postTime_LB->setText(QDateTime::fromMSecsSinceEpoch(post.mMeta.mPublishTs*1000).toString("MM/dd/yyyy, hh:mm"));
|
|
||||||
ui->postTime_LB->setFixedWidth(W);
|
|
||||||
|
|
||||||
//ui->channelPostFiles_TV->resizeColumnToContents(RsGxsChannelPostFilesModel::COLUMN_FILES_FILE);
|
|
||||||
//ui->channelPostFiles_TV->resizeColumnToContents(RsGxsChannelPostFilesModel::COLUMN_FILES_SIZE);
|
|
||||||
ui->channelPostFiles_TV->setAutoSelect(true);
|
|
||||||
|
|
||||||
// Now also set the post as read
|
|
||||||
|
|
||||||
if(IS_MSG_UNREAD(post.mMeta.mMsgStatus) || IS_MSG_NEW(post.mMeta.mMsgStatus))
|
|
||||||
{
|
|
||||||
RsGxsGrpMsgIdPair postId;
|
|
||||||
postId.second = post.mMeta.mMsgId;
|
|
||||||
postId.first = post.mMeta.mGroupId;
|
|
||||||
|
|
||||||
RsThread::async([postId]() { rsGxsChannels->markRead(postId, true) ; } );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void PostedListWidgetWithModel::updateGroupData()
|
void PostedListWidgetWithModel::updateGroupData()
|
||||||
{
|
{
|
||||||
if(groupId().isNull())
|
if(groupId().isNull())
|
||||||
|
@ -136,6 +136,7 @@ private slots:
|
|||||||
#ifdef TO_REMOVE
|
#ifdef TO_REMOVE
|
||||||
void showPostDetails();
|
void showPostDetails();
|
||||||
#endif
|
#endif
|
||||||
|
void postContextMenu(const QPoint&);
|
||||||
void showAuthorInPeople();
|
void showAuthorInPeople();
|
||||||
void tabCloseRequested(int index);
|
void tabCloseRequested(int index);
|
||||||
void updateSorting(int);
|
void updateSorting(int);
|
||||||
@ -145,7 +146,6 @@ private slots:
|
|||||||
void subscribeGroup(bool subscribe);
|
void subscribeGroup(bool subscribe);
|
||||||
void settingsChanged();
|
void settingsChanged();
|
||||||
void postPostLoad();
|
void postPostLoad();
|
||||||
void postContextMenu(const QPoint&);
|
|
||||||
void copyMessageLink();
|
void copyMessageLink();
|
||||||
void nextPosts();
|
void nextPosts();
|
||||||
void prevPosts();
|
void prevPosts();
|
||||||
|
Loading…
Reference in New Issue
Block a user