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 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) 0002 [ ] remove useless column in forums "signed by" (last column) (from electron)
0003 [ ] main window must close on ESC (from noname) 0003 [ ] main window must close on ESC (from noname)
0004 [ ] show storage time of forums/channels/posted in gui (from cave) 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; break;
case GXS_ID_DETAILS_TYPE_DONE: case GXS_ID_DETAILS_TYPE_DONE:
toolTip = GxsIdDetails::getComment(details); toolTip = GxsIdDetails::getComment(details);
break; break;
} }

View File

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

View File

@ -256,33 +256,33 @@
<property name="leftMargin"> <property name="leftMargin">
<number>3</number> <number>3</number>
</property> </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> </layout>
</item> </item>
<item> <item>
<layout class="QGridLayout" name="postLayout"> <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"> <item row="0" column="7">
<widget class="QLabel" name="time_label"> <widget class="QLabel" name="time_label">
<property name="text"> <property name="text">
@ -290,7 +290,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="11"> <item row="0" column="12">
<widget class="QPushButton" name="nextUnreadButton"> <widget class="QPushButton" name="nextUnreadButton">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed"> <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
@ -326,7 +326,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="13"> <item row="0" column="14">
<widget class="QPushButton" name="expandButton"> <widget class="QPushButton" name="expandButton">
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
@ -352,29 +352,6 @@
</property> </property>
</widget> </widget>
</item> </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"> <item row="0" column="6">
<widget class="Line" name="line_2"> <widget class="Line" name="line_2">
<property name="orientation"> <property name="orientation">
@ -389,14 +366,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="9"> <item row="0" column="11">
<widget class="QLabel" name="by_label">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="0" column="10">
<spacer name="horizontalSpacer_2"> <spacer name="horizontalSpacer_2">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -488,6 +458,20 @@
</property> </property>
</widget> </widget>
</item> </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> </layout>
</item> </item>
</layout> </layout>
@ -525,6 +509,11 @@
<extends>QTreeWidget</extends> <extends>QTreeWidget</extends>
<header>gui/common/RSTreeWidget.h</header> <header>gui/common/RSTreeWidget.h</header>
</customwidget> </customwidget>
<customwidget>
<class>GxsIdLabel</class>
<extends>QLabel</extends>
<header>gui/gxs/GxsIdLabel.h</header>
</customwidget>
</customwidgets> </customwidgets>
<resources> <resources>
<include location="../images.qrc"/> <include location="../images.qrc"/>