Added new Card View for Posted

This commit is contained in:
defnax 2019-12-25 17:16:58 +01:00
parent ec65341105
commit 54d0d8ab8b
17 changed files with 1591 additions and 49 deletions

View File

@ -0,0 +1,545 @@
/*******************************************************************************
* retroshare-gui/src/gui/Posted/PostedCardView.cpp *
* *
* Copyright (C) 2019 Retroshare Team <retroshare.project@gmail.com> *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Affero General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#include <QDateTime>
#include <QMenu>
#include <QStyle>
#include "rshare.h"
#include "PostedCardView.h"
#include "gui/feeds/FeedHolder.h"
#include "gui/gxs/GxsIdDetails.h"
#include "util/misc.h"
#include "util/HandleRichText.h"
#include "ui_PostedCardView.h"
#include <retroshare/rsposted.h>
#include <iostream>
#define LINK_IMAGE ":/images/thumb-link.png"
/** Constructor */
PostedCardView::PostedCardView(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate) :
GxsFeedItem(feedHolder, feedId, groupId, messageId, isHome, rsPosted, autoUpdate)
{
setup();
requestGroup();
requestMessage();
requestComment();
}
PostedCardView::PostedCardView(FeedHolder *feedHolder, uint32_t feedId, const RsPostedGroup &group, const RsPostedPost &post, bool isHome, bool autoUpdate) :
GxsFeedItem(feedHolder, feedId, post.mMeta.mGroupId, post.mMeta.mMsgId, isHome, rsPosted, autoUpdate)
{
setup();
mMessageId = post.mMeta.mMsgId;
setGroup(group, false);
setPost(post);
requestComment();
}
PostedCardView::PostedCardView(FeedHolder *feedHolder, uint32_t feedId, const RsPostedPost &post, bool isHome, bool autoUpdate) :
GxsFeedItem(feedHolder, feedId, post.mMeta.mGroupId, post.mMeta.mMsgId, isHome, rsPosted, autoUpdate)
{
setup();
requestGroup();
setPost(post);
requestComment();
}
PostedCardView::~PostedCardView()
{
delete(ui);
}
void PostedCardView::setup()
{
/* Invoke the Qt Designer generated object setup routine */
ui = new Ui::PostedCardView;
ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose, true);
mInFill = false;
/* clear ui */
ui->titleLabel->setText(tr("Loading"));
ui->dateLabel->clear();
ui->fromLabel->clear();
ui->siteLabel->clear();
/* general ones */
connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(removeItem()));
/* specific */
connect(ui->readAndClearButton, SIGNAL(clicked()), this, SLOT(readAndClearItem()));
connect(ui->commentButton, SIGNAL( clicked()), this, SLOT(loadComments()));
connect(ui->voteUpButton, SIGNAL(clicked()), this, SLOT(makeUpVote()));
connect(ui->voteDownButton, SIGNAL(clicked()), this, SLOT( makeDownVote()));
connect(ui->readButton, SIGNAL(toggled(bool)), this, SLOT(readToggled(bool)));
QAction *CopyLinkAction = new QAction(QIcon(""),tr("Copy RetroShare Link"), this);
connect(CopyLinkAction, SIGNAL(triggered()), this, SLOT(copyMessageLink()));
int S = QFontMetricsF(font()).height() ;
ui->voteUpButton->setIconSize(QSize(S*1.5,S*1.5));
ui->voteDownButton->setIconSize(QSize(S*1.5,S*1.5));
ui->commentButton->setIconSize(QSize(S*1.5,S*1.5));
ui->readButton->setIconSize(QSize(S*1.5,S*1.5));
ui->shareButton->setIconSize(QSize(S*1.5,S*1.5));
QMenu *menu = new QMenu();
menu->addAction(CopyLinkAction);
ui->shareButton->setMenu(menu);
ui->clearButton->hide();
ui->readAndClearButton->hide();
}
bool PostedCardView::setGroup(const RsPostedGroup &group, bool doFill)
{
if (groupId() != group.mMeta.mGroupId) {
std::cerr << "PostedCardView::setGroup() - Wrong id, cannot set post";
std::cerr << std::endl;
return false;
}
mGroup = group;
if (doFill) {
fill();
}
return true;
}
bool PostedCardView::setPost(const RsPostedPost &post, bool doFill)
{
if (groupId() != post.mMeta.mGroupId || messageId() != post.mMeta.mMsgId) {
std::cerr << "PostedCardView::setPost() - Wrong id, cannot set post";
std::cerr << std::endl;
return false;
}
mPost = post;
if (doFill) {
fill();
}
return true;
}
void PostedCardView::loadGroup(const uint32_t &token)
{
std::vector<RsPostedGroup> groups;
if (!rsPosted->getGroupData(token, groups))
{
std::cerr << "PostedCardView::loadGroup() ERROR getting data";
std::cerr << std::endl;
return;
}
if (groups.size() != 1)
{
std::cerr << "PostedCardView::loadGroup() Wrong number of Items";
std::cerr << std::endl;
return;
}
setGroup(groups[0]);
}
void PostedCardView::loadMessage(const uint32_t &token)
{
std::vector<RsPostedPost> posts;
std::vector<RsGxsComment> cmts;
if (!rsPosted->getPostData(token, posts, cmts))
{
std::cerr << "GxsChannelPostItem::loadMessage() ERROR getting data";
std::cerr << std::endl;
return;
}
if (posts.size() == 1)
{
setPost(posts[0]);
}
else if (cmts.size() == 1)
{
RsGxsComment cmt = cmts[0];
//ui->newCommentLabel->show();
//ui->commLabel->show();
//ui->commLabel->setText(QString::fromUtf8(cmt.mComment.c_str()));
//Change this item to be uploaded with thread element.
setMessageId(cmt.mMeta.mThreadId);
requestMessage();
}
else
{
std::cerr << "GxsChannelPostItem::loadMessage() Wrong number of Items. Remove It.";
std::cerr << std::endl;
removeItem();
return;
}
}
void PostedCardView::loadComment(const uint32_t &token)
{
std::vector<RsGxsComment> cmts;
if (!rsPosted->getRelatedComments(token, cmts))
{
std::cerr << "GxsChannelPostItem::loadComment() ERROR getting data";
std::cerr << std::endl;
return;
}
size_t comNb = cmts.size();
QString sComButText = tr("Comment");
if (comNb == 1) {
sComButText = sComButText.append("(1)");
} else if (comNb > 1) {
sComButText = " " + tr("Comments").append(" (%1)").arg(comNb);
}
ui->commentButton->setText(sComButText);
}
void PostedCardView::fill()
{
if (isLoading()) {
/* Wait for all requests */
return;
}
QPixmap sqpixmap2 = QPixmap(":/images/thumb-default.png");
mInFill = true;
int desired_height = 1.5*(ui->voteDownButton->height() + ui->voteUpButton->height() + ui->scoreLabel->height());
int desired_width = sqpixmap2.width()*desired_height/(float)sqpixmap2.height();
QDateTime qtime;
qtime.setTime_t(mPost.mMeta.mPublishTs);
QString timestamp = qtime.toString("hh:mm dd-MMM-yyyy");
QString timestamp2 = misc::timeRelativeToNow(mPost.mMeta.mPublishTs);
ui->dateLabel->setText(timestamp2);
ui->dateLabel->setToolTip(timestamp);
ui->fromLabel->setId(mPost.mMeta.mAuthorId);
// Use QUrl to check/parse our URL
// The only combination that seems to work: load as EncodedUrl, extract toEncoded().
QByteArray urlarray(mPost.mLink.c_str());
QUrl url = QUrl::fromEncoded(urlarray.trimmed());
QString urlstr = "Invalid Link";
QString sitestr = "Invalid Link";
bool urlOkay = url.isValid();
if (urlOkay)
{
QString scheme = url.scheme();
if ((scheme != "https")
&& (scheme != "http")
&& (scheme != "ftp")
&& (scheme != "retroshare"))
{
urlOkay = false;
sitestr = "Invalid Link Scheme";
}
}
if (urlOkay)
{
urlstr = QString("<a href=\"");
urlstr += QString(url.toEncoded());
urlstr += QString("\" ><span style=\" text-decoration: underline; color:#2255AA;\"> ");
urlstr += messageName();
urlstr += QString(" </span></a>");
QString siteurl = url.toEncoded();
sitestr = QString("<a href=\"%1\" ><span style=\" text-decoration: underline; color:#0079d3;\"> %2 </span></a>").arg(siteurl).arg(siteurl);
ui->titleLabel->setText(urlstr);
}else
{
ui->titleLabel->setText(messageName());
}
if (urlarray.isEmpty())
{
ui->siteLabel->hide();
}
ui->siteLabel->setText(sitestr);
if(mPost.mImage.mData != NULL)
{
QPixmap pixmap;
GxsIdDetails::loadPixmapFromData(mPost.mImage.mData, mPost.mImage.mSize, pixmap,GxsIdDetails::ORIGINAL);
// Wiping data - as its been passed to thumbnail.
QPixmap sqpixmap = pixmap.scaled(desired_width,desired_height, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation);
ui->pictureLabel->setPixmap(pixmap);
}
else if (mPost.mImage.mData == NULL)
{
ui->picture_frame->hide();
}
else
{
ui->picture_frame->show();
}
//QString score = "Hot" + QString::number(post.mHotScore);
//score += " Top" + QString::number(post.mTopScore);
//score += " New" + QString::number(post.mNewScore);
QString score = QString::number(mPost.mTopScore);
ui->scoreLabel->setText(score);
// FIX THIS UP LATER.
ui->notes->setText(RsHtml().formatText(NULL, QString::fromUtf8(mPost.mNotes.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
if(ui->notes->text().isEmpty())
ui->notes->hide();
// differences between Feed or Top of Comment.
if (mFeedHolder)
{
// feed.
//frame_comment->show();
ui->commentButton->show();
if (mPost.mComments)
{
QString commentText = QString::number(mPost.mComments);
commentText += " ";
commentText += tr("Comments");
ui->commentButton->setText(commentText);
}
else
{
ui->commentButton->setText(tr("Comment"));
}
setReadStatus(IS_MSG_NEW(mPost.mMeta.mMsgStatus), IS_MSG_UNREAD(mPost.mMeta.mMsgStatus) || IS_MSG_NEW(mPost.mMeta.mMsgStatus));
}
else
{
// no feed.
//frame_comment->hide();
ui->commentButton->hide();
ui->readButton->hide();
ui->newLabel->hide();
}
if (mIsHome)
{
ui->clearButton->hide();
ui->readAndClearButton->hide();
}
else
{
ui->clearButton->show();
ui->readAndClearButton->show();
}
// disable voting buttons - if they have already voted.
if (mPost.mMeta.mMsgStatus & GXS_SERV::GXS_MSG_STATUS_VOTE_MASK)
{
ui->voteUpButton->setEnabled(false);
ui->voteDownButton->setEnabled(false);
}
#if 0
uint32_t up, down, nComments;
bool ok = rsPosted->retrieveScores(mPost.mMeta.mServiceString, up, down, nComments);
if(ok)
{
int32_t vote = up - down;
scoreLabel->setText(QString::number(vote));
numCommentsLabel->setText("<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px;"
"margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span"
"style=\" font-size:10pt; font-weight:600;\">#</span><span "
"style=\" font-size:8pt; font-weight:600;\"> Comments: "
+ QString::number(nComments) + "</span></p>");
}
#endif
mInFill = false;
emit sizeChanged(this);
}
const RsPostedPost &PostedCardView::getPost() const
{
return mPost;
}
RsPostedPost &PostedCardView::post()
{
return mPost;
}
QString PostedCardView::groupName()
{
return QString::fromUtf8(mGroup.mMeta.mGroupName.c_str());
}
QString PostedCardView::messageName()
{
return QString::fromUtf8(mPost.mMeta.mMsgName.c_str());
}
void PostedCardView::makeDownVote()
{
RsGxsGrpMsgIdPair msgId;
msgId.first = mPost.mMeta.mGroupId;
msgId.second = mPost.mMeta.mMsgId;
ui->voteUpButton->setEnabled(false);
ui->voteDownButton->setEnabled(false);
emit vote(msgId, false);
}
void PostedCardView::makeUpVote()
{
RsGxsGrpMsgIdPair msgId;
msgId.first = mPost.mMeta.mGroupId;
msgId.second = mPost.mMeta.mMsgId;
ui->voteUpButton->setEnabled(false);
ui->voteDownButton->setEnabled(false);
emit vote(msgId, true);
}
void PostedCardView::loadComments()
{
std::cerr << "PostedCardView::loadComments()";
std::cerr << std::endl;
if (mFeedHolder)
{
QString title = QString::fromUtf8(mPost.mMeta.mMsgName.c_str());
#warning (csoler) Posted item versions not handled yet. When it is the case, start here.
QVector<RsGxsMessageId> post_versions ;
post_versions.push_back(mPost.mMeta.mMsgId) ;
mFeedHolder->openComments(0, mPost.mMeta.mGroupId, post_versions,mPost.mMeta.mMsgId, title);
}
}
void PostedCardView::setReadStatus(bool isNew, bool isUnread)
{
if (isUnread)
{
ui->readButton->setChecked(true);
ui->readButton->setIcon(QIcon(":/images/message-state-unread.png"));
}
else
{
ui->readButton->setChecked(false);
ui->readButton->setIcon(QIcon(":/images/message-state-read.png"));
}
ui->newLabel->setVisible(isNew);
ui->mainFrame->setProperty("new", isNew);
ui->mainFrame->style()->unpolish(ui->mainFrame);
ui->mainFrame->style()->polish( ui->mainFrame);
}
void PostedCardView::readToggled(bool checked)
{
if (mInFill) {
return;
}
RsGxsGrpMsgIdPair msgPair = std::make_pair(groupId(), messageId());
uint32_t token;
rsPosted->setMessageReadStatus(token, msgPair, !checked);
setReadStatus(false, checked);
}
void PostedCardView::readAndClearItem()
{
#ifdef DEBUG_ITEM
std::cerr << "PostedCardView::readAndClearItem()";
std::cerr << std::endl;
#endif
readToggled(false);
removeItem();
}
void PostedCardView::doExpand(bool open)
{
/*if (open)
{
}
else
{
}
emit sizeChanged(this);*/
}
void PostedCardView::copyMessageLink()
{
if (groupId().isNull() || mMessageId.isNull()) {
return;
}
RetroShareLink link = RetroShareLink::createGxsMessageLink(RetroShareLink::TYPE_POSTED, groupId(), mMessageId, messageName());
if (link.valid()) {
QList<RetroShareLink> urls;
urls.push_back(link);
RSLinkClipboard::copyLinks(urls);
}
}

View File

@ -0,0 +1,96 @@
/*******************************************************************************
* retroshare-gui/src/gui/Posted/PostedCardView.h *
* *
* Copyright (C) 2019 by Retroshare Team <retroshare.project@gmail.com> *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Affero General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#ifndef _POSTED_CARDVIEW_H
#define _POSTED_CARDVIEW_H
#include <QMetaType>
#include <retroshare/rsposted.h>
#include "gui/gxs/GxsFeedItem.h"
namespace Ui {
class PostedCardView;
}
class FeedHolder;
class RsPostedPost;
class PostedCardView : public GxsFeedItem
{
Q_OBJECT
public:
PostedCardView(FeedHolder *parent, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate);
PostedCardView(FeedHolder *parent, uint32_t feedId, const RsPostedGroup &group, const RsPostedPost &post, bool isHome, bool autoUpdate);
PostedCardView(FeedHolder *parent, uint32_t feedId, const RsPostedPost &post, bool isHome, bool autoUpdate);
virtual ~PostedCardView();
bool setGroup(const RsPostedGroup& group, bool doFill = true);
bool setPost(const RsPostedPost& post, bool doFill = true);
const RsPostedPost &getPost() const;
RsPostedPost &post();
protected:
/* FeedItem */
virtual void doExpand(bool open);
private slots:
void loadComments();
void makeUpVote();
void makeDownVote();
void readToggled(bool checked);
void readAndClearItem();
void copyMessageLink();
signals:
void vote(const RsGxsGrpMsgIdPair& msgId, bool up);
protected:
/* GxsGroupFeedItem */
virtual QString groupName();
virtual void loadGroup(const uint32_t &token);
virtual RetroShareLink::enumType getLinkType() { return RetroShareLink::TYPE_UNKNOWN; }
/* GxsFeedItem */
virtual QString messageName();
virtual void loadMessage(const uint32_t &token);
virtual void loadComment(const uint32_t &token);
private:
void setup();
void fill();
void setReadStatus(bool isNew, bool isUnread);
private:
bool mInFill;
RsPostedGroup mGroup;
RsPostedPost mPost;
RsGxsMessageId mMessageId;
/** Qt Designer generated object */
Ui::PostedCardView *ui;
};
//Q_DECLARE_METATYPE(RsPostedPost)
#endif

View File

@ -0,0 +1,527 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PostedCardView</class>
<widget class="QWidget" name="PostedCardView">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>614</width>
<height>160</height>
</rect>
</property>
<property name="windowTitle">
<string notr="true"/>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QFrame" name="mainFrame">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<property name="horizontalSpacing">
<number>0</number>
</property>
<property name="verticalSpacing">
<number>6</number>
</property>
<item row="1" column="1">
<widget class="StyledLabel" name="titleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string notr="true">This is a very very very very loooooooooooooooonnnnnnnnnnnnnnnnng title don't you think? Yes it is and should wrap around I hope</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="siteLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">site</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>5</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<item>
<widget class="QLabel" name="fromBoldLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Posted by</string>
</property>
</widget>
</item>
<item>
<widget class="GxsIdLabel" name="fromLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">Signed by</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="dateLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">You eyes only</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="readButton">
<property name="maximumSize">
<size>
<width>24</width>
<height>16777215</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Toggle Message Read Status</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/message-state-unread.png</normaloff>:/images/message-state-unread.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="newLabel">
<property name="text">
<string>New</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>70</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="0" column="0" rowspan="6">
<widget class="QFrame" name="voteFrame">
<property name="minimumSize">
<size>
<width>37</width>
<height>0</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>3</number>
</property>
<property name="topMargin">
<number>3</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item>
<widget class="QToolButton" name="voteUpButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Vote up</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="Posted_images.qrc">
<normaloff>:/images/up-arrow.png</normaloff>:/images/up-arrow.png</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="StyledLabel" name="scoreLabel">
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
<string>0</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="voteDownButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Vote down</string>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>\/</string>
</property>
<property name="icon">
<iconset resource="Posted_images.qrc">
<normaloff>:/images/down-arrow.png</normaloff>:/images/down-arrow.png</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="5" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QToolButton" name="commentButton">
<property name="text">
<string>Comments</string>
</property>
<property name="icon">
<iconset resource="Posted_images.qrc">
<normaloff>:/images/comments.png</normaloff>:/images/comments.png</iconset>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="shareButton">
<property name="text">
<string>Share</string>
</property>
<property name="icon">
<iconset resource="Posted_images.qrc">
<normaloff>:/images/share.png</normaloff>:/images/share.png</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>308</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="readAndClearButton">
<property name="maximumSize">
<size>
<width>24</width>
<height>16777215</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Set as read and remove item</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/png/correct.png</normaloff>:/icons/png/correct.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="clearButton">
<property name="maximumSize">
<size>
<width>24</width>
<height>16777215</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Remove Item</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/png/exit2.png</normaloff>:/icons/png/exit2.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="1">
<widget class="QLabel" name="notes">
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QFrame" name="picture_frame">
<layout class="QHBoxLayout" name="horizontalPictureLayout">
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>219</width>
<height>18</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="pictureLabel">
<property name="text">
<string>PictureLabel</string>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>268</width>
<height>17</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>GxsIdLabel</class>
<extends>QLabel</extends>
<header>gui/gxs/GxsIdLabel.h</header>
</customwidget>
<customwidget>
<class>StyledLabel</class>
<extends>QLabel</extends>
<header>gui/common/StyledLabel.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="Posted_images.qrc"/>
<include location="../images.qrc"/>
<include location="../icons.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -302,6 +302,11 @@ void PostedItem::fill()
} }
if (urlarray.isEmpty())
{
ui->siteLabel->hide();
}
ui->siteLabel->setText(sitestr); ui->siteLabel->setText(sitestr);
if(mPost.mImage.mData != NULL) if(mPost.mImage.mData != NULL)

View File

@ -19,6 +19,7 @@
*******************************************************************************/ *******************************************************************************/
#include <QMessageBox> #include <QMessageBox>
#include <QSignalMapper>
#include "PostedListWidget.h" #include "PostedListWidget.h"
#include "ui_PostedListWidget.h" #include "ui_PostedListWidget.h"
@ -26,10 +27,12 @@
#include "gui/gxs/GxsIdDetails.h" #include "gui/gxs/GxsIdDetails.h"
#include "PostedCreatePostDialog.h" #include "PostedCreatePostDialog.h"
#include "PostedItem.h" #include "PostedItem.h"
#include "PostedCardView.h"
#include "gui/common/UIStateHelper.h" #include "gui/common/UIStateHelper.h"
#include "gui/RetroShareLink.h" #include "gui/RetroShareLink.h"
#include "util/HandleRichText.h" #include "util/HandleRichText.h"
#include "util/DateTime.h" #include "util/DateTime.h"
#include "gui/settings/rsharesettings.h"
#include <retroshare/rsposted.h> #include <retroshare/rsposted.h>
#include "retroshare/rsgxscircles.h" #include "retroshare/rsgxscircles.h"
@ -39,6 +42,10 @@
#define TOPIC_DEFAULT_IMAGE ":/icons/png/posted.png" #define TOPIC_DEFAULT_IMAGE ":/icons/png/posted.png"
/* View mode */
#define VIEW_MODE_CLASSIC 1
#define VIEW_MODE_CARD 2
/** Constructor */ /** Constructor */
PostedListWidget::PostedListWidget(const RsGxsGroupId &postedId, QWidget *parent) PostedListWidget::PostedListWidget(const RsGxsGroupId &postedId, QWidget *parent)
: GxsMessageFramePostWidget(rsPosted, parent), : GxsMessageFramePostWidget(rsPosted, parent),
@ -61,6 +68,12 @@ PostedListWidget::PostedListWidget(const RsGxsGroupId &postedId, QWidget *parent
connect(ui->comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(getRankings(int))); connect(ui->comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(getRankings(int)));
QSignalMapper *signalMapper = new QSignalMapper(this);
connect(ui->classicViewButton, SIGNAL(clicked()), signalMapper, SLOT(map()));
connect(ui->cardViewButton, SIGNAL(clicked()), signalMapper, SLOT(map()));
signalMapper->setMapping(ui->classicViewButton, VIEW_MODE_CLASSIC);
signalMapper->setMapping(ui->cardViewButton, VIEW_MODE_CARD);
connect(signalMapper, SIGNAL(mapped(int)), this, SLOT(setViewMode(int)));
// default sort method. // default sort method.
mSortMethod = RsPosted::HotRankType; mSortMethod = RsPosted::HotRankType;
@ -101,17 +114,23 @@ PostedListWidget::~PostedListWidget()
delete(ui); delete(ui);
} }
void PostedListWidget::processSettings(bool /*load*/) void PostedListWidget::processSettings(bool load)
{ {
// Settings->beginGroup(QString("PostedListWidget")); Settings->beginGroup(QString("PostedListWidget"));
//
// if (load) { if (load) {
// // load settings // load settings
// } else {
// // save settings /* View mode */
// } setViewMode(Settings->value("viewMode", VIEW_MODE_CLASSIC).toInt());
// } else {
// Settings->endGroup(); // save settings
/* View mode */
Settings->setValue("viewMode", viewMode());
}
Settings->endGroup();
} }
QIcon PostedListWidget::groupIcon() QIcon PostedListWidget::groupIcon()
@ -141,6 +160,13 @@ QScrollArea *PostedListWidget::getScrollArea()
return ui->scrollArea; return ui->scrollArea;
} }
// Overloaded from FeedHolder.
/*QScrollArea *PostedListWidget::getScrollArea()
{
return ui->scrollAreaCardView;
}*/
void PostedListWidget::deleteFeedItem(QWidget */*item*/, uint32_t /*type*/) void PostedListWidget::deleteFeedItem(QWidget */*item*/, uint32_t /*type*/)
{ {
std::cerr << "PostedListWidget::deleteFeedItem() Nah"; std::cerr << "PostedListWidget::deleteFeedItem() Nah";
@ -404,11 +430,23 @@ void PostedListWidget::loadPost(const RsPostedPost &post)
PostedItem *item = new PostedItem(this, 0, dummyGroup, post, true, false); PostedItem *item = new PostedItem(this, 0, dummyGroup, post, true, false);
connect(item, SIGNAL(vote(RsGxsGrpMsgIdPair,bool)), this, SLOT(submitVote(RsGxsGrpMsgIdPair,bool))); connect(item, SIGNAL(vote(RsGxsGrpMsgIdPair,bool)), this, SLOT(submitVote(RsGxsGrpMsgIdPair,bool)));
mPosts.insert(post.mMeta.mMsgId, item); mPosts.insert(post.mMeta.mMsgId, item);
//QLayout *alayout = ui.scrollAreaWidgetContents->layout();
//alayout->addWidget(item);
mPostItems.push_back(item); mPostItems.push_back(item);
} }
void PostedListWidget::loadPostCardView(const RsPostedPost &post)
{
/* Group is not always available because of the TokenQueue */
RsPostedGroup dummyGroup;
dummyGroup.mMeta.mGroupId = groupId();
PostedCardView *cvitem = new PostedCardView(this, 0, dummyGroup, post, true, false);
connect(cvitem, SIGNAL(vote(RsGxsGrpMsgIdPair,bool)), this, SLOT(submitVote(RsGxsGrpMsgIdPair,bool)));
mCVPosts.insert(post.mMeta.mMsgId, cvitem);
mPostCardView.push_back(cvitem);
}
static bool CmpPIHot(const GxsFeedItem *a, const GxsFeedItem *b) static bool CmpPIHot(const GxsFeedItem *a, const GxsFeedItem *b)
{ {
const PostedItem *aa = dynamic_cast<const PostedItem*>(a); const PostedItem *aa = dynamic_cast<const PostedItem*>(a);
@ -461,6 +499,58 @@ static bool CmpPINew(const GxsFeedItem *a, const GxsFeedItem *b)
return (aa->getPost().mNewScore > bb->getPost().mNewScore); return (aa->getPost().mNewScore > bb->getPost().mNewScore);
} }
static bool CVHot(const GxsFeedItem *a, const GxsFeedItem *b)
{
const PostedCardView *aa = dynamic_cast<const PostedCardView*>(a);
const PostedCardView *bb = dynamic_cast<const PostedCardView*>(b);
if (!aa || !bb) {
return true;
}
const RsPostedPost &postA = aa->getPost();
const RsPostedPost &postB = bb->getPost();
if (postA.mHotScore == postB.mHotScore)
{
return (postA.mNewScore > postB.mNewScore);
}
return (postA.mHotScore > postB.mHotScore);
}
static bool CVTop(const GxsFeedItem *a, const GxsFeedItem *b)
{
const PostedCardView *aa = dynamic_cast<const PostedCardView*>(a);
const PostedCardView *bb = dynamic_cast<const PostedCardView*>(b);
if (!aa || !bb) {
return true;
}
const RsPostedPost &postA = aa->getPost();
const RsPostedPost &postB = bb->getPost();
if (postA.mTopScore == postB.mTopScore)
{
return (postA.mNewScore > postB.mNewScore);
}
return (postA.mTopScore > postB.mTopScore);
}
static bool CVNew(const GxsFeedItem *a, const GxsFeedItem *b)
{
const PostedCardView *aa = dynamic_cast<const PostedCardView*>(a);
const PostedCardView *bb = dynamic_cast<const PostedCardView*>(b);
if (!aa || !bb) {
return true;
}
return (aa->getPost().mNewScore > bb->getPost().mNewScore);
}
void PostedListWidget::applyRanking() void PostedListWidget::applyRanking()
{ {
/* uses current settings to sort posts, then add to layout */ /* uses current settings to sort posts, then add to layout */
@ -477,16 +567,19 @@ void PostedListWidget::applyRanking()
std::cerr << "PostedListWidget::applyRanking() HOT"; std::cerr << "PostedListWidget::applyRanking() HOT";
std::cerr << std::endl; std::cerr << std::endl;
qSort(mPostItems.begin(), mPostItems.end(), CmpPIHot); qSort(mPostItems.begin(), mPostItems.end(), CmpPIHot);
qSort(mPostCardView.begin(), mPostCardView.end(), CVHot);
break; break;
case RsPosted::NewRankType: case RsPosted::NewRankType:
std::cerr << "PostedListWidget::applyRanking() NEW"; std::cerr << "PostedListWidget::applyRanking() NEW";
std::cerr << std::endl; std::cerr << std::endl;
qSort(mPostItems.begin(), mPostItems.end(), CmpPINew); qSort(mPostItems.begin(), mPostItems.end(), CmpPINew);
qSort(mPostCardView.begin(), mPostCardView.end(), CVNew);
break; break;
case RsPosted::TopRankType: case RsPosted::TopRankType:
std::cerr << "PostedListWidget::applyRanking() TOP"; std::cerr << "PostedListWidget::applyRanking() TOP";
std::cerr << std::endl; std::cerr << std::endl;
qSort(mPostItems.begin(), mPostItems.end(), CmpPITop); qSort(mPostItems.begin(), mPostItems.end(), CmpPITop);
qSort(mPostCardView.begin(), mPostCardView.end(), CVTop);
break; break;
} }
mLastSortMethod = mSortMethod; mLastSortMethod = mSortMethod;
@ -496,8 +589,11 @@ void PostedListWidget::applyRanking()
/* go through list (skipping out-of-date items) to get */ /* go through list (skipping out-of-date items) to get */
QLayout *alayout = ui->scrollAreaWidgetContents->layout(); QLayout *alayout = ui->scrollAreaWidgetContents->layout();
int counter = 0; int counter = 0;
time_t min_ts = 0; time_t min_ts = 0;
foreach (PostedItem *item, mPostItems) foreach (PostedItem *item, mPostItems)
{ {
std::cerr << "PostedListWidget::applyRanking() Item: " << item; std::cerr << "PostedListWidget::applyRanking() Item: " << item;
@ -534,11 +630,52 @@ void PostedListWidget::applyRanking()
++counter; ++counter;
} }
// Card View
QLayout *cviewlayout = ui->scrollAreaWidgetContentsCardView->layout();
foreach (PostedCardView *item, mPostCardView)
{
std::cerr << "PostedListWidget::applyRanking() Item: " << item;
std::cerr << std::endl;
if (item->getPost().mMeta.mPublishTs < min_ts)
{
std::cerr << "\t Skipping OLD";
std::cerr << std::endl;
item->hide();
continue;
}
if (counter >= mPostIndex + mPostShow)
{
std::cerr << "\t END - Counter too high";
std::cerr << std::endl;
item->hide();
}
else if (counter >= mPostIndex)
{
std::cerr << "\t Adding to Layout";
std::cerr << std::endl;
/* add it in! */
cviewlayout->addWidget(item);
item->show();
}
else
{
std::cerr << "\t Skipping to Low";
std::cerr << std::endl;
item->hide();
}
++counter;
}
std::cerr << "PostedListWidget::applyRanking() Loaded New Order"; std::cerr << "PostedListWidget::applyRanking() Loaded New Order";
std::cerr << std::endl; std::cerr << std::endl;
// trigger a redraw. // trigger a redraw.
ui->scrollAreaWidgetContents->update(); ui->scrollAreaWidgetContents->update();
ui->scrollAreaWidgetContentsCardView->update();
} }
void PostedListWidget::blank() void PostedListWidget::blank()
@ -548,10 +685,17 @@ void PostedListWidget::blank()
} }
void PostedListWidget::clearPosts() void PostedListWidget::clearPosts()
{ {
/* clear all messages */ /* clear all classic view messages */
foreach (PostedItem *item, mPostItems) { foreach (PostedItem *item, mPostItems) {
delete(item); delete(item);
} }
/* clear all card view messages */
foreach (PostedCardView *item, mPostCardView) {
delete(item);
}
mPostCardView.clear();
mPostItems.clear(); mPostItems.clear();
mPosts.clear(); mPosts.clear();
} }
@ -601,6 +745,45 @@ void PostedListWidget::shallowClearPosts()
PostedItem *item = *pit; PostedItem *item = *pit;
alayout->removeWidget(item); alayout->removeWidget(item);
} }
//Posted Card view
std::list<PostedCardView *> postedCardViewItems;
std::list<PostedCardView *>::iterator pcvit;
QLayout *cviewlayout = ui->scrollAreaWidgetContentsCardView->layout();
int countcv = cviewlayout->count();
for(int i = 0; i < countcv; ++i)
{
QLayoutItem *litem = cviewlayout->itemAt(i);
if (!litem)
{
std::cerr << "PostedListWidget::shallowClearPosts() missing litem";
std::cerr << std::endl;
continue;
}
PostedCardView *item = dynamic_cast<PostedCardView *>(litem->widget());
if (item)
{
std::cerr << "PostedListWidget::shallowClearPosts() item: " << item;
std::cerr << std::endl;
postedCardViewItems.push_back(item);
}
else
{
std::cerr << "PostedListWidget::shallowClearPosts() Found Child, which is not a PostedItem???";
std::cerr << std::endl;
}
}
for(pcvit = postedCardViewItems.begin(); pcvit != postedCardViewItems.end(); ++pcvit)
{
PostedCardView *item = *pcvit;
cviewlayout->removeWidget(item);
}
} }
bool PostedListWidget::insertGroupData(const uint32_t &token, RsGroupMetaData &metaData) bool PostedListWidget::insertGroupData(const uint32_t &token, RsGroupMetaData &metaData)
@ -628,6 +811,7 @@ void PostedListWidget::insertAllPosts(const uint32_t &token, GxsMessageFramePost
{ {
RsPostedPost& p = *vit; RsPostedPost& p = *vit;
loadPost(p); loadPost(p);
loadPostCardView(p);
} }
applyRanking(); applyRanking();
@ -721,3 +905,39 @@ void PostedListWidget::loadRequest(const TokenQueue *queue, const TokenRequest &
GxsMessageFramePostWidget::loadRequest(queue, req); GxsMessageFramePostWidget::loadRequest(queue, req);
} }
int PostedListWidget::viewMode()
{
if (ui->classicViewButton->isChecked()) {
return VIEW_MODE_CLASSIC;
} else if (ui->cardViewButton->isChecked()) {
return VIEW_MODE_CARD;
}
/* Default */
return VIEW_MODE_CLASSIC;
}
void PostedListWidget::setViewMode(int viewMode)
{
switch (viewMode) {
case VIEW_MODE_CLASSIC:
ui->stackedWidget->setCurrentIndex(0);
ui->classicViewButton->setChecked(true);
ui->cardViewButton->setChecked(false);
break;
case VIEW_MODE_CARD:
ui->stackedWidget->setCurrentIndex(1);
ui->cardViewButton->setChecked(true);
ui->classicViewButton->setChecked(false);
break;
default:
setViewMode(VIEW_MODE_CLASSIC);
return;
}
}

View File

@ -29,6 +29,7 @@
class RsPostedGroup; class RsPostedGroup;
class RsPostedPost; class RsPostedPost;
class PostedItem; class PostedItem;
class PostedCardView;
namespace Ui { namespace Ui {
class PostedListWidget; class PostedListWidget;
@ -79,16 +80,21 @@ private slots:
void showNext(); void showNext();
void showPrev(); void showPrev();
void setViewMode(int viewMode);
private: private:
void processSettings(bool load); void processSettings(bool load);
void updateShowText(); void updateShowText();
int viewMode();
/*! /*!
* Only removes it from layout * Only removes it from layout
*/ */
void shallowClearPosts(); void shallowClearPosts();
void loadPost(const RsPostedPost &post); void loadPost(const RsPostedPost &post);
void loadPostCardView(const RsPostedPost &post);
void insertPostedDetails(const RsPostedGroup &group); void insertPostedDetails(const RsPostedGroup &group);
@ -115,6 +121,9 @@ private:
QMap<RsGxsMessageId, PostedItem*> mPosts; QMap<RsGxsMessageId, PostedItem*> mPosts;
QList<PostedItem*> mPostItems; QList<PostedItem*> mPostItems;
QMap<RsGxsMessageId, PostedCardView*> mCVPosts;
QList<PostedCardView*> mPostCardView;
/* UI - from Designer */ /* UI - from Designer */
Ui::PostedListWidget *ui; Ui::PostedListWidget *ui;
}; };

View File

@ -7,16 +7,13 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>616</width> <width>616</width>
<height>428</height> <height>595</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QGridLayout" name="gridLayout_5">
<property name="spacing">
<number>3</number>
</property>
<property name="leftMargin"> <property name="leftMargin">
<number>0</number> <number>0</number>
</property> </property>
@ -29,7 +26,10 @@
<property name="bottomMargin"> <property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<item> <property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QFrame" name="headerFrame"> <widget class="QFrame" name="headerFrame">
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::Box</enum> <enum>QFrame::Box</enum>
@ -37,12 +37,9 @@
<property name="frameShadow"> <property name="frameShadow">
<enum>QFrame::Sunken</enum> <enum>QFrame::Sunken</enum>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin"> <property name="leftMargin">
<number>4</number> <number>6</number>
</property> </property>
<property name="topMargin"> <property name="topMargin">
<number>2</number> <number>2</number>
@ -164,6 +161,59 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="classicViewButton">
<property name="toolTip">
<string>Classic view</string>
</property>
<property name="icon">
<iconset resource="Posted_images.qrc">
<normaloff>:/images/classic.png</normaloff>:/images/classic.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cardViewButton">
<property name="toolTip">
<string>Card View</string>
</property>
<property name="icon">
<iconset resource="Posted_images.qrc">
<normaloff>:/images/card.png</normaloff>:/images/card.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item> <item>
<widget class="QPushButton" name="prevButton"> <widget class="QPushButton" name="prevButton">
<property name="toolTip"> <property name="toolTip">
@ -205,7 +255,7 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item> <item row="1" column="0">
<widget class="QFrame" name="infoframe"> <widget class="QFrame" name="infoframe">
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::StyledPanel</enum> <enum>QFrame::StyledPanel</enum>
@ -478,30 +528,13 @@ p, li { white-space: pre-wrap; }
</layout> </layout>
</widget> </widget>
</item> </item>
<item> <item row="2" column="0">
<widget class="QScrollArea" name="scrollArea"> <widget class="QStackedWidget" name="stackedWidget">
<property name="widgetResizable"> <property name="currentIndex">
<bool>true</bool> <number>1</number>
</property> </property>
<widget class="QWidget" name="scrollAreaWidgetContents"> <widget class="QWidget" name="page">
<property name="geometry"> <layout class="QGridLayout" name="gridLayout_2">
<rect>
<x>0</x>
<y>0</y>
<width>614</width>
<height>16</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin"> <property name="leftMargin">
<number>0</number> <number>0</number>
</property> </property>
@ -514,6 +547,102 @@ p, li { white-space: pre-wrap; }
<property name="bottomMargin"> <property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<item row="0" column="0">
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>614</width>
<height>16</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_2">
<layout class="QGridLayout" name="gridLayout_4">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QScrollArea" name="scrollAreaCardView">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContentsCardView">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>614</width>
<height>16</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
</layout>
</widget>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</widget> </widget>

View File

@ -1,6 +1,6 @@
<RCC> <RCC>
<qresource prefix="/" > <qresource prefix="/" >
<file>images/posted_16.png</file> <file>images/posted_16.png</file>
<file>images/posted_24.png</file> <file>images/posted_24.png</file>
<file>images/posted_32.png</file> <file>images/posted_32.png</file>
<file>images/posted_48.png</file> <file>images/posted_48.png</file>
@ -23,5 +23,9 @@
<file>images/link.png</file> <file>images/link.png</file>
<file>images/post.png</file> <file>images/post.png</file>
<file>images/photo.png</file> <file>images/photo.png</file>
<file>images/classic.png</file>
<file>images/card.png</file>
<file>images/down-hover.png</file>
<file>images/up-hover.png</file>
</qresource> </qresource>
</RCC> </RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -857,6 +857,10 @@ PostedItem QLabel#fromBoldLabel, QLabel#fromLabel, QLabel#dateLabel, QLabel#site
color: #787c7e; color: #787c7e;
} }
PostedCardView QFrame#voteFrame {
background: #f8f9fa;
}
GxsCommentDialog QComboBox#sortBox { GxsCommentDialog QComboBox#sortBox {
font: bold; font: bold;
color: #0099cc; color: #0099cc;

View File

@ -1344,6 +1344,7 @@ posted {
HEADERS += gui/Posted/PostedDialog.h \ HEADERS += gui/Posted/PostedDialog.h \
gui/Posted/PostedListWidget.h \ gui/Posted/PostedListWidget.h \
gui/Posted/PostedItem.h \ gui/Posted/PostedItem.h \
gui/Posted/PostedCardView.h \
gui/Posted/PostedGroupDialog.h \ gui/Posted/PostedGroupDialog.h \
gui/feeds/PostedGroupItem.h \ gui/feeds/PostedGroupItem.h \
gui/Posted/PostedCreatePostDialog.h \ gui/Posted/PostedCreatePostDialog.h \
@ -1355,6 +1356,7 @@ posted {
FORMS += gui/Posted/PostedListWidget.ui \ FORMS += gui/Posted/PostedListWidget.ui \
gui/feeds/PostedGroupItem.ui \ gui/feeds/PostedGroupItem.ui \
gui/Posted/PostedItem.ui \ gui/Posted/PostedItem.ui \
gui/Posted/PostedCardView.ui \
gui/Posted/PostedCreatePostDialog.ui \ gui/Posted/PostedCreatePostDialog.ui \
#gui/Posted/PostedDialog.ui \ #gui/Posted/PostedDialog.ui \
@ -1365,6 +1367,7 @@ posted {
gui/Posted/PostedListWidget.cpp \ gui/Posted/PostedListWidget.cpp \
gui/feeds/PostedGroupItem.cpp \ gui/feeds/PostedGroupItem.cpp \
gui/Posted/PostedItem.cpp \ gui/Posted/PostedItem.cpp \
gui/Posted/PostedCardView.cpp \
gui/Posted/PostedGroupDialog.cpp \ gui/Posted/PostedGroupDialog.cpp \
gui/Posted/PostedCreatePostDialog.cpp \ gui/Posted/PostedCreatePostDialog.cpp \
gui/Posted/PostedUserNotify.cpp gui/Posted/PostedUserNotify.cpp