removed useless thread line, kept link copy functionality, used a GxsIdLabel to show the by_label correctly, added hide/show of labels when not useful

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8201 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2015-05-01 15:20:23 +00:00
parent b7e9a63177
commit b999ccc34b
4 changed files with 80 additions and 80 deletions

View File

@ -10,7 +10,7 @@ Legend:
To be done
0001 [ ] forums - middle horisontal bar - always shows *by anonymous* (from noname)
0001 [X] forums - middle horisontal bar - always shows *by anonymous* (from noname) [fixed, also removed useless thread line]
0002 [ ] remove useless column in forums "signed by" (last column) (from electron)
0003 [ ] main window must close on ESC (from noname)
0004 [ ] show storage time of forums/channels/posted in gui (from cave)

View File

@ -48,7 +48,7 @@ static void fillLabelCallback(GxsIdDetailsType type, const RsIdentityDetails &de
break;
case GXS_ID_DETAILS_TYPE_DONE:
toolTip = GxsIdDetails::getComment(details);
toolTip = GxsIdDetails::getComment(details);
break;
}

View File

@ -118,7 +118,7 @@ GxsForumThreadWidget::GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget
mStateHelper->addWidget(mTokenTypeMessageData, ui->downloadButton);
mStateHelper->addLoadPlaceholder(mTokenTypeMessageData, ui->postText);
mStateHelper->addLoadPlaceholder(mTokenTypeMessageData, ui->threadTitle);
//mStateHelper->addLoadPlaceholder(mTokenTypeMessageData, ui->threadTitle);
mSubscribeFlags = 0;
mInProcessSettings = false;
@ -192,7 +192,15 @@ GxsForumThreadWidget::GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget
setGroupId(forumId);
ui->threadTreeWidget->installEventFilter(this);
ui->threadTreeWidget->installEventFilter(this);
ui->postText->clear();
ui->by_label->setId(RsGxsId());
ui->time_label->clear() ;
ui->line->hide() ;
ui->line_2->hide() ;
ui->by_text_label->hide() ;
ui->by_label->hide() ;
}
GxsForumThreadWidget::~GxsForumThreadWidget()
@ -450,7 +458,7 @@ void GxsForumThreadWidget::threadListCustomPopupMenu(QPoint /*point*/)
contextMnu.addAction(replyAct);
contextMnu.addAction(replyauthorAct);
contextMnu.addAction(newthreadAct);
QAction* action = contextMnu.addAction(QIcon(IMAGE_COPYLINK), tr("Copy RetroShare Link"), this, SLOT(copyMessageLink()));
QAction* action = contextMnu.addAction(QIcon(IMAGE_COPYLINK), tr("Copy RetroShare Link"), this, SLOT(copyMessageLink()));
action->setEnabled(!groupId().isNull() && !mThreadId.isNull());
contextMnu.addSeparator();
contextMnu.addAction(markMsgAsRead);
@ -692,7 +700,7 @@ void GxsForumThreadWidget::insertGroupData(const RsGxsForumGroup &group)
if (mThreadId.isNull() && !mStateHelper->isLoading(mTokenTypeMessageData))
{
ui->threadTitle->setText(tr("Forum Description"));
//ui->threadTitle->setText(tr("Forum Description"));
ui->postText->setText(mForumDescription);
}
@ -1171,7 +1179,7 @@ void GxsForumThreadWidget::insertMessage()
mStateHelper->clear(mTokenTypeMessageData);
ui->postText->clear();
ui->threadTitle->clear();
//ui->threadTitle->clear();
return;
}
@ -1180,7 +1188,7 @@ void GxsForumThreadWidget::insertMessage()
mStateHelper->setActive(mTokenTypeMessageData, false);
mStateHelper->clear(mTokenTypeMessageData);
ui->threadTitle->setText(tr("Forum Description"));
//ui->threadTitle->setText(tr("Forum Description"));
ui->postText->setText(mForumDescription);
return;
}
@ -1205,6 +1213,12 @@ void GxsForumThreadWidget::insertMessage()
/* blank text, incase we get nothing */
ui->postText->clear();
ui->by_label->setId(RsGxsId());
ui->time_label->clear() ;
ui->line->hide() ;
ui->line_2->hide() ;
ui->by_text_label->hide() ;
ui->by_label->hide() ;
/* request Post */
RsGxsGrpMsgIdPair msgId = std::make_pair(groupId(), mThreadId);
@ -1215,7 +1229,7 @@ void GxsForumThreadWidget::insertMessageData(const RsGxsForumMsg &msg)
{
/* As some time has elapsed since request - check that this is still the current msg.
* otherwise, another request will fill the data
*/
*/
if ((msg.mMeta.mGroupId != groupId()) || (msg.mMeta.mMsgId != mThreadId))
{
@ -1259,24 +1273,17 @@ void GxsForumThreadWidget::insertMessageData(const RsGxsForumMsg &msg)
}
ui->time_label->setText(DateTime::formatLongDateTime(msg.mMeta.mPublishTs));
ui->by_label->setId(msg.mMeta.mAuthorId) ;
std::string authorName;
//= rsPeers->getPeerName(msg.mMeta.mAuthorId);
QString text = QString::fromUtf8(authorName.c_str());
ui->line->show() ;
ui->line_2->show() ;
ui->by_text_label->show() ;
ui->by_label->show() ;
if (text.isEmpty())
{
ui->by_label->setText( tr("By") + " " + tr("Anonymous"));
}
else
{
ui->by_label->setText( tr("By") + " " + text );
}
QString extraTxt = RsHtml().formatText(ui->postText->document(), QString::fromUtf8(msg.mMsg.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS);
QString extraTxt = RsHtml().formatText(ui->postText->document(), QString::fromUtf8(msg.mMsg.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS);
ui->postText->setHtml(extraTxt);
ui->threadTitle->setText(QString::fromUtf8(msg.mMeta.mMsgName.c_str()));
//ui->threadTitle->setText(QString::fromUtf8(msg.mMeta.mMsgName.c_str()));
}
void GxsForumThreadWidget::previousMessage()
@ -1559,7 +1566,11 @@ void GxsForumThreadWidget::copyMessageLink()
}
RetroShareLink link;
if (link.createGxsMessageLink(RetroShareLink::TYPE_FORUM, groupId(), mThreadId, ui->threadTitle->text())) {
QTreeWidgetItem *item = ui->threadTreeWidget->currentItem();
QString thread_title = (item != NULL)?item->text(COLUMN_THREAD_TITLE):QString() ;
if (link.createGxsMessageLink(RetroShareLink::TYPE_FORUM, groupId(), mThreadId, thread_title)) {
QList<RetroShareLink> urls;
urls.push_back(link);
RSLinkClipboard::copyLinks(urls);

View File

@ -256,33 +256,33 @@
<property name="leftMargin">
<number>3</number>
</property>
<item>
<widget class="QLabel" name="threadLabel">
<property name="text">
<string>Thread:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="threadTitle">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="postLayout">
<item row="0" column="5">
<widget class="QToolButton" name="downloadButton">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Download all files</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/down.png</normaloff>:/images/down.png</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="7">
<widget class="QLabel" name="time_label">
<property name="text">
@ -290,7 +290,7 @@
</property>
</widget>
</item>
<item row="0" column="11">
<item row="0" column="12">
<widget class="QPushButton" name="nextUnreadButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
@ -326,7 +326,7 @@
</property>
</widget>
</item>
<item row="0" column="13">
<item row="0" column="14">
<widget class="QPushButton" name="expandButton">
<property name="maximumSize">
<size>
@ -352,29 +352,6 @@
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QToolButton" name="downloadButton">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Download all files</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/down.png</normaloff>:/images/down.png</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="6">
<widget class="Line" name="line_2">
<property name="orientation">
@ -389,14 +366,7 @@
</property>
</widget>
</item>
<item row="0" column="9">
<widget class="QLabel" name="by_label">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="0" column="10">
<item row="0" column="11">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -488,6 +458,20 @@
</property>
</widget>
</item>
<item row="0" column="10">
<widget class="GxsIdLabel" name="by_label">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="0" column="9">
<widget class="QLabel" name="by_text_label">
<property name="text">
<string>By </string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
@ -525,6 +509,11 @@
<extends>QTreeWidget</extends>
<header>gui/common/RSTreeWidget.h</header>
</customwidget>
<customwidget>
<class>GxsIdLabel</class>
<extends>QLabel</extends>
<header>gui/gxs/GxsIdLabel.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../images.qrc"/>