fixed to not stretch News Feed items when you has one few items in News Feed.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2227 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2010-02-07 15:47:30 +00:00
parent 57454e0486
commit dcfdaf44e0
2 changed files with 103 additions and 76 deletions

View File

@ -58,29 +58,6 @@ NewsFeed::NewsFeed(QWidget *parent)
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
/* mLayout -> to add widgets to */
mLayout = new QVBoxLayout;
mLayout->setSpacing(0);
mLayout->setMargin(0);
QWidget *middleWidget = new QWidget();
//middleWidget->setSizePolicy( QSizePolicy::Policy::Maximum, QSizePolicy::Policy::Minimum);
middleWidget->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum);
middleWidget->setLayout(mLayout);
QScrollArea *scrollArea = new QScrollArea;
//scrollArea->setBackgroundRole(QPalette::Dark);
scrollArea->setWidget(middleWidget);
scrollArea->setWidgetResizable(true);
scrollArea->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
QVBoxLayout *layout2 = new QVBoxLayout;
layout2->addWidget(scrollArea);
layout2->setSpacing(0);
layout2->setMargin(0);
frame->setLayout(layout2);
QTimer *timer = new QTimer(this);
timer->connect(timer, SIGNAL(timeout()), this, SLOT(updateFeed()));
@ -178,7 +155,7 @@ void NewsFeed::addFeedItemPeerConnect(RsFeedItem &fi)
/* store */
/* add to layout */
mLayout->addWidget(pi);
verticalLayout->addWidget(pi);
#ifdef NEWS_DEBUG
std::cerr << "NewsFeed::addFeedItemPeerConnect()";
@ -196,7 +173,7 @@ void NewsFeed::addFeedItemPeerDisconnect(RsFeedItem &fi)
/* store */
/* add to layout */
mLayout->addWidget(pi);
verticalLayout->addWidget(pi);
@ -215,7 +192,7 @@ void NewsFeed::addFeedItemPeerHello(RsFeedItem &fi)
/* store */
/* add to layout */
mLayout->addWidget(pi);
verticalLayout->addWidget(pi);
#ifdef NEWS_DEBUG
@ -233,7 +210,7 @@ void NewsFeed::addFeedItemPeerNew(RsFeedItem &fi)
/* store */
/* add to layout */
mLayout->addWidget(pi);
verticalLayout->addWidget(pi);
#ifdef NEWS_DEBUG
std::cerr << "NewsFeed::addFeedItemPeerNew()";
@ -250,7 +227,7 @@ void NewsFeed::addFeedItemChanNew(RsFeedItem &fi)
/* store in list */
/* add to layout */
mLayout->addWidget(cni);
verticalLayout->addWidget(cni);
#ifdef NEWS_DEBUG
std::cerr << "NewsFeed::addFeedItemChanNew()";
@ -267,7 +244,7 @@ void NewsFeed::addFeedItemChanUpdate(RsFeedItem &fi)
/* store in list */
/* add to layout */
mLayout->addWidget(cni);
verticalLayout->addWidget(cni);
#ifdef NEWS_DEBUG
std::cerr << "NewsFeed::addFeedItemChanUpdate()";
@ -284,7 +261,7 @@ void NewsFeed::addFeedItemChanMsg(RsFeedItem &fi)
/* store in forum list */
/* add to layout */
mLayout->addWidget(cm);
verticalLayout->addWidget(cm);
#ifdef NEWS_DEBUG
std::cerr << "NewsFeed::addFeedItemChanMsg()";
@ -302,7 +279,7 @@ void NewsFeed::addFeedItemForumNew(RsFeedItem &fi)
mForumNewItems.push_back(fni);
/* add to layout */
mLayout->addWidget(fni);
verticalLayout->addWidget(fni);
#ifdef NEWS_DEBUG
@ -321,7 +298,7 @@ void NewsFeed::addFeedItemForumUpdate(RsFeedItem &fi)
mForumNewItems.push_back(fni);
/* add to layout */
mLayout->addWidget(fni);
verticalLayout->addWidget(fni);
#ifdef NEWS_DEBUG
std::cerr << "NewsFeed::addFeedItemForumUpdate()";
@ -338,7 +315,7 @@ void NewsFeed::addFeedItemForumMsg(RsFeedItem &fi)
/* store in forum list */
/* add to layout */
mLayout->addWidget(fm);
verticalLayout->addWidget(fm);
#ifdef NEWS_DEBUG
std::cerr << "NewsFeed::addFeedItemForumMsg()";
@ -355,7 +332,7 @@ void NewsFeed::addFeedItemBlogMsg(RsFeedItem &fi)
/* store in forum list */
/* add to layout */
mLayout->addWidget(bm);
verticalLayout->addWidget(bm);
#ifdef NEWS_DEBUG
std::cerr << "NewsFeed::addFeedItemBlogMsg()";
@ -381,7 +358,7 @@ void NewsFeed::addFeedItemMessage(RsFeedItem &fi)
/* store in list */
/* add to layout */
mLayout->addWidget(mi);
verticalLayout->addWidget(mi);
#ifdef NEWS_DEBUG
std::cerr << "NewsFeed::addFeedItemMessage()";

View File

@ -1,7 +1,8 @@
<ui version="4.0" >
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>NewsFeed</class>
<widget class="QWidget" name="NewsFeed" >
<property name="geometry" >
<widget class="QWidget" name="NewsFeed">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
@ -9,75 +10,75 @@
<height>256</height>
</rect>
</property>
<property name="windowTitle" >
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_2" >
<property name="margin" >
<layout class="QGridLayout" name="gridLayout_2">
<property name="margin">
<number>0</number>
</property>
<property name="spacing" >
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0" >
<layout class="QGridLayout" name="gridLayout" >
<property name="leftMargin" >
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin" >
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin" >
<property name="rightMargin">
<number>0</number>
</property>
<property name="horizontalSpacing" >
<property name="horizontalSpacing">
<number>6</number>
</property>
<property name="verticalSpacing" >
<property name="verticalSpacing">
<number>0</number>
</property>
<item row="0" column="0" >
<widget class="QLabel" name="label_2" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;img src=":/images/konqsidebar_news16.png" />&lt;/p>&lt;/body>&lt;/html></string>
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;img src=&quot;:/images/konqsidebar_news16.png&quot; /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QLabel" name="newslabel" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
<item row="0" column="1">
<widget class="QLabel" name="newslabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-size:9pt; font-weight:600;">News Feed&lt;/span>&lt;/p>&lt;/body>&lt;/html></string>
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:9pt; font-weight:600;&quot;&gt;News Feed&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1" >
<spacer name="horizontalSpacer" >
<property name="orientation" >
<item row="0" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0" >
<property name="sizeHint" stdset="0">
<size>
<width>321</width>
<height>13</height>
@ -85,20 +86,69 @@ p, li { white-space: pre-wrap; }
</property>
</spacer>
</item>
<item row="1" column="0" colspan="2" >
<widget class="QFrame" name="frame" >
<property name="frameShape" >
<item row="1" column="0" colspan="2">
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow" >
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QScrollArea" name="scrollArea">
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>424</width>
<height>229</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout" name="verticalLayout"/>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="images.qrc" />
<include location="images.qrc"/>
</resources>
<connections/>
</ui>