Replaced scroll area in NewsFeed with RSFeedWidget.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7680 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2014-11-15 17:24:49 +00:00
parent dcabaf780d
commit dee39a8840
20 changed files with 477 additions and 290 deletions

View file

@ -41,8 +41,8 @@
****/
/** Constructor */
ChatMsgItem::ChatMsgItem(FeedHolder *parent, uint32_t feedId, const RsPeerId &peerId, const std::string &message)
:QWidget(NULL), mParent(parent), mFeedId(feedId), mPeerId(peerId)
ChatMsgItem::ChatMsgItem(FeedHolder *parent, uint32_t feedId, const RsPeerId &peerId, const std::string &message) :
FeedItem(NULL), mParent(parent), mFeedId(feedId), mPeerId(peerId)
{
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
@ -224,16 +224,18 @@ void ChatMsgItem::togglequickmessage()
if (messageFrame->isHidden())
{
messageFrame->setVisible(true);
messageFrame->show();
sendButton->show();
cancelButton->show();
}
else
{
messageFrame->setVisible(false);
messageFrame->hide();
sendButton->hide();
cancelButton->hide();
}
}
emit sizeChanged(this);
mParent->lockLayout(this, false);
}
@ -253,6 +255,8 @@ void ChatMsgItem::sendMessage()
messageFrame->setVisible(false);
sendButton->hide();
cancelButton->hide();
emit sizeChanged(this);
}
void ChatMsgItem::on_quickmsgText_textChanged()

View file

@ -23,20 +23,24 @@
#define _CHATMSG_ITEM_DIALOG_H
#include "ui_ChatMsgItem.h"
#include "FeedItem.h"
#include <stdint.h>
class FeedHolder;
class ChatMsgItem : public QWidget, private Ui::ChatMsgItem
class ChatMsgItem : public FeedItem, private Ui::ChatMsgItem
{
Q_OBJECT
public:
/** Default Constructor */
ChatMsgItem(FeedHolder *parent, uint32_t feedId, const RsPeerId &peerId, const std::string &message);
ChatMsgItem(FeedHolder *parent, uint32_t feedId, const RsPeerId &peerId, const std::string &message);
void updateItemStatic();
/* FeedItem */
virtual void expand(bool /*open*/) {}
private slots:
/* default stuff */
void gotoHome();
@ -58,7 +62,7 @@ private:
FeedHolder *mParent;
uint32_t mFeedId;
RsPeerId mPeerId;
RsPeerId mPeerId;
};
#endif

View file

@ -11,8 +11,17 @@
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_1">
<property name="margin">
<number>0</number>
<property name="leftMargin">
<number>1</number>
</property>
<property name="topMargin">
<number>1</number>
</property>
<property name="rightMargin">
<number>1</number>
</property>
<property name="bottomMargin">
<number>1</number>
</property>
<item row="0" column="0">
<widget class="QFrame" name="frame">
@ -204,32 +213,22 @@
</property>
</widget>
</item>
<item row="2" column="0" colspan="5">
<widget class="QFrame" name="frame_2">
<layout class="QGridLayout" name="gridLayout_4">
<property name="margin">
<item row="3" column="0" colspan="5">
<widget class="QFrame" name="buttonFrame">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<item row="0" column="0" colspan="6">
<widget class="QFrame" name="messageFrame">
<layout class="QGridLayout" name="gridLayout_3">
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0" colspan="2">
<widget class="QTextEdit" name="quickmsgText">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>115</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QToolButton" name="quickmsgButton">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
@ -252,7 +251,7 @@
</property>
</widget>
</item>
<item row="1" column="1">
<item>
<widget class="QToolButton" name="msgButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@ -281,7 +280,7 @@
</property>
</widget>
</item>
<item row="1" column="2">
<item>
<widget class="QToolButton" name="chatButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@ -313,7 +312,7 @@
</property>
</widget>
</item>
<item row="1" column="3">
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -326,7 +325,17 @@
</property>
</spacer>
</item>
<item row="1" column="5">
<item>
<widget class="QPushButton" name="cancelButton">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="sendButton">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
@ -339,13 +348,31 @@
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QPushButton" name="cancelButton">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Cancel</string>
</layout>
</widget>
</item>
<item row="2" column="0" colspan="5">
<widget class="QFrame" name="messageFrame">
<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>
<item row="0" column="0" colspan="2">
<widget class="QTextEdit" name="quickmsgText">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>115</height>
</size>
</property>
</widget>
</item>

View file

@ -39,8 +39,8 @@
****/
/** Constructor */
MsgItem::MsgItem(FeedHolder *parent, uint32_t feedId, const std::string &msgId, bool isHome)
:QWidget(NULL), mParent(parent), mFeedId(feedId), mMsgId(msgId), mIsHome(isHome)
MsgItem::MsgItem(FeedHolder *parent, uint32_t feedId, const std::string &msgId, bool isHome) :
FeedItem(NULL), mParent(parent), mFeedId(feedId), mMsgId(msgId), mIsHome(isHome)
{
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
@ -194,24 +194,34 @@ void MsgItem::updateItem()
void MsgItem::toggle()
{
mParent->lockLayout(this, true);
expand(expandFrame->isHidden());
}
if (expandFrame->isHidden())
void MsgItem::expand(bool open)
{
if (mParent) {
mParent->lockLayout(this, true);
}
if (open)
{
expandFrame->show();
expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png")));
expandButton->setToolTip(tr("Hide"));
expandButton->setToolTip(tr("Hide"));
}
else
{
expandFrame->hide();
expandButton->setIcon(QIcon(QString(":/images/edit_add24.png")));
expandButton->setToolTip(tr("Expand"));
expandButton->setIcon(QIcon(QString(":/images/edit_add24.png")));
expandButton->setToolTip(tr("Expand"));
}
mParent->lockLayout(this, false);
}
emit sizeChanged(this);
if (mParent) {
mParent->lockLayout(this, false);
}
}
void MsgItem::removeItem()
{

View file

@ -23,12 +23,13 @@
#define _MSG_ITEM_DIALOG_H
#include "ui_MsgItem.h"
#include "FeedItem.h"
#include <stdint.h>
class FeedHolder;
class SubFileItem;
class MsgItem : public QWidget, private Ui::MsgItem
class MsgItem : public FeedItem, private Ui::MsgItem
{
Q_OBJECT
@ -38,6 +39,9 @@ public:
void updateItemStatic();
/* FeedItem */
virtual void expand(bool open);
private slots:
/* default stuff */
void gotoHome();

View file

@ -11,8 +11,17 @@
</rect>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>0</number>
<property name="leftMargin">
<number>1</number>
</property>
<property name="topMargin">
<number>1</number>
</property>
<property name="rightMargin">
<number>1</number>
</property>
<property name="bottomMargin">
<number>1</number>
</property>
<item row="0" column="0">
<widget class="QFrame" name="frame">

View file

@ -40,9 +40,9 @@
****/
/** Constructor */
PeerItem::PeerItem(FeedHolder *parent, uint32_t feedId, const RsPeerId &peerId, uint32_t type, bool isHome)
:QWidget(NULL), mParent(parent), mFeedId(feedId),
mPeerId(peerId), mType(type), mIsHome(isHome)
PeerItem::PeerItem(FeedHolder *parent, uint32_t feedId, const RsPeerId &peerId, uint32_t type, bool isHome) :
FeedItem(NULL), mParent(parent), mFeedId(feedId),
mPeerId(peerId), mType(type), mIsHome(isHome)
{
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
@ -209,9 +209,16 @@ void PeerItem::updateItem()
void PeerItem::toggle()
{
mParent->lockLayout(this, true);
expand(expandFrame->isHidden());
}
if (expandFrame->isHidden())
void PeerItem::expand(bool open)
{
if (mParent) {
mParent->lockLayout(this, true);
}
if (open)
{
expandFrame->show();
expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png")));
@ -224,9 +231,12 @@ void PeerItem::toggle()
expandButton->setToolTip(tr("Expand"));
}
mParent->lockLayout(this, false);
}
emit sizeChanged(this);
if (mParent) {
mParent->lockLayout(this, false);
}
}
void PeerItem::removeItem()
{

View file

@ -23,6 +23,7 @@
#define _PEER_ITEM_DIALOG_H
#include "ui_PeerItem.h"
#include "FeedItem.h"
#include <stdint.h>
const uint32_t PEER_TYPE_STD = 0x0001;
@ -32,16 +33,19 @@ const uint32_t PEER_TYPE_NEW_FOF = 0x0004; /* new Friend of Friend */
class FeedHolder;
class PeerItem : public QWidget, private Ui::PeerItem
class PeerItem : public FeedItem, private Ui::PeerItem
{
Q_OBJECT
public:
/** Default Constructor */
PeerItem(FeedHolder *parent, uint32_t feedId, const RsPeerId &peerId, uint32_t type, bool isHome);
PeerItem(FeedHolder *parent, uint32_t feedId, const RsPeerId &peerId, uint32_t type, bool isHome);
void updateItemStatic();
/* FeedItem */
virtual void expand(bool open);
private slots:
/* default stuff */
void removeItem();

View file

@ -11,8 +11,17 @@
</rect>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>0</number>
<property name="leftMargin">
<number>1</number>
</property>
<property name="topMargin">
<number>1</number>
</property>
<property name="rightMargin">
<number>1</number>
</property>
<property name="bottomMargin">
<number>1</number>
</property>
<item row="0" column="0">
<widget class="QFrame" name="frame">

View file

@ -43,43 +43,42 @@
****/
/** Constructor */
SecurityItem::SecurityItem(FeedHolder *parent, uint32_t feedId, const RsPgpId &gpgId, const RsPeerId &sslId, const std::string &sslCn, const std::string& ip_address,uint32_t type, bool isHome)
:QWidget(NULL), mParent(parent), mFeedId(feedId),
mGpgId(gpgId), mSslId(sslId), mSslCn(sslCn), mIP(ip_address), mType(type), mIsHome(isHome)
SecurityItem::SecurityItem(FeedHolder *parent, uint32_t feedId, const RsPgpId &gpgId, const RsPeerId &sslId, const std::string &sslCn, const std::string& ip_address,uint32_t type, bool isHome) :
FeedItem(NULL), mParent(parent), mFeedId(feedId),
mGpgId(gpgId), mSslId(sslId), mSslCn(sslCn), mIP(ip_address), mType(type), mIsHome(isHome)
{
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
quickmsgButton->hide();
chatButton->hide();
removeFriendButton->setEnabled(false);
removeFriendButton->hide();
peerDetailsButton->setEnabled(false);
friendRequesttoolButton->hide();
requestLabel->hide();
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
/* general ones */
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );
quickmsgButton->hide();
chatButton->hide();
removeFriendButton->setEnabled(false);
removeFriendButton->hide();
peerDetailsButton->setEnabled(false);
friendRequesttoolButton->hide();
requestLabel->hide();
/* specific ones */
connect( chatButton, SIGNAL( clicked( void ) ), this, SLOT( openChat ( void ) ) );
/* general ones */
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );
connect( quickmsgButton, SIGNAL( clicked( ) ), this, SLOT( sendMsg() ) );
/* specific ones */
connect( chatButton, SIGNAL( clicked( void ) ), this, SLOT( openChat ( void ) ) );
connect( removeFriendButton, SIGNAL(clicked()), this, SLOT(removeFriend()));
connect( peerDetailsButton, SIGNAL(clicked()), this, SLOT(peerDetails()));
connect( friendRequesttoolButton, SIGNAL(clicked()), this, SLOT(friendRequest()));
connect( quickmsgButton, SIGNAL( clicked( ) ), this, SLOT( sendMsg() ) );
connect(NotifyQt::getInstance(), SIGNAL(friendsChanged()), this, SLOT(updateItem()));
connect( removeFriendButton, SIGNAL(clicked()), this, SLOT(removeFriend()));
connect( peerDetailsButton, SIGNAL(clicked()), this, SLOT(peerDetails()));
connect( friendRequesttoolButton, SIGNAL(clicked()), this, SLOT(friendRequest()));
connect(NotifyQt::getInstance(), SIGNAL(friendsChanged()), this, SLOT(updateItem()));
avatar->setId(mSslId);
avatar->setId(mSslId);
expandFrame->hide();
expandFrame->hide();
updateItemStatic();
updateItem();
updateItemStatic();
updateItem();
}
@ -283,9 +282,16 @@ void SecurityItem::updateItem()
void SecurityItem::toggle()
{
mParent->lockLayout(this, true);
expand(expandFrame->isHidden());
}
if (expandFrame->isHidden())
void SecurityItem::expand(bool open)
{
if (mParent) {
mParent->lockLayout(this, true);
}
if (open)
{
expandFrame->show();
expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png")));
@ -298,7 +304,11 @@ void SecurityItem::toggle()
expandButton->setToolTip(tr("Expand"));
}
mParent->lockLayout(this, false);
emit sizeChanged(this);
if (mParent) {
mParent->lockLayout(this, false);
}
}
void SecurityItem::removeItem()

View file

@ -23,6 +23,7 @@
#define _SECURITY_ITEM_DIALOG_H
#include "ui_SecurityItem.h"
#include "FeedItem.h"
#include <stdint.h>
//const uint32_t SEC_TYPE_CONNECT_ATTEMPT = 0x0001; /* failed Connect Attempt */
@ -32,17 +33,20 @@
class FeedHolder;
class SecurityItem : public QWidget, private Ui::SecurityItem
class SecurityItem : public FeedItem, private Ui::SecurityItem
{
Q_OBJECT
public:
/** Default Constructor */
SecurityItem(FeedHolder *parent, uint32_t feedId, const RsPgpId &gpgId, const RsPeerId &sslId, const std::string &sslCn, const std::string& ip_addr,uint32_t type, bool isHome);
SecurityItem(FeedHolder *parent, uint32_t feedId, const RsPgpId &gpgId, const RsPeerId &sslId, const std::string &sslCn, const std::string& ip_addr,uint32_t type, bool isHome);
void updateItemStatic();
bool isSame(const RsPeerId &sslId, uint32_t type);
bool isSame(const RsPeerId &sslId, uint32_t type);
/* FeedItem */
virtual void expand(bool open);
private slots:
/* default stuff */
@ -57,14 +61,12 @@ private slots:
void updateItem();
private:
FeedHolder *mParent;
uint32_t mFeedId;
RsPgpId mGpgId;
RsPeerId mSslId;
RsPgpId mGpgId;
RsPeerId mSslId;
std::string mSslCn;
std::string mIP;
uint32_t mType;

View file

@ -11,8 +11,17 @@
</rect>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>0</number>
<property name="leftMargin">
<number>1</number>
</property>
<property name="topMargin">
<number>1</number>
</property>
<property name="rightMargin">
<number>1</number>
</property>
<property name="bottomMargin">
<number>1</number>
</property>
<item row="0" column="0">
<widget class="QFrame" name="frame">