mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-04 09:05:34 -05:00
Friends Storm:
- Don't update the connection time of the PeerItem. Only show the real connection time. - Removed memory leak. All PeerItems are only set to invisible and wasn't deleted. - Added button to remove all items. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3754 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
c19c8b5532
commit
2122dd8351
@ -64,11 +64,11 @@ NewsFeed::NewsFeed(QWidget *parent)
|
|||||||
/* Invoke the Qt Designer generated object setup routine */
|
/* Invoke the Qt Designer generated object setup routine */
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
|
||||||
|
connect(removeAllButton, SIGNAL(clicked()), this, SLOT(removeAll()));
|
||||||
|
|
||||||
QTimer *timer = new QTimer(this);
|
QTimer *timer = new QTimer(this);
|
||||||
timer->connect(timer, SIGNAL(timeout()), this, SLOT(updateFeed()));
|
timer->connect(timer, SIGNAL(timeout()), this, SLOT(updateFeed()));
|
||||||
timer->start(1000);
|
timer->start(1000);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -157,6 +157,11 @@ void NewsFeed::updateFeed()
|
|||||||
|
|
||||||
void NewsFeed::addFeedItem(QWidget *item)
|
void NewsFeed::addFeedItem(QWidget *item)
|
||||||
{
|
{
|
||||||
|
item->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||||
|
|
||||||
|
connect(item, SIGNAL(destroyed(QObject*)), this, SLOT(itemDestroyed(QObject*)));
|
||||||
|
widgetList.push_back(item);
|
||||||
|
|
||||||
if (Settings->getAddFeedsAtEnd()) {
|
if (Settings->getAddFeedsAtEnd()) {
|
||||||
verticalLayout->addWidget(item);
|
verticalLayout->addWidget(item);
|
||||||
} else {
|
} else {
|
||||||
@ -440,3 +445,26 @@ void NewsFeed::openChat(std::string peerId)
|
|||||||
|
|
||||||
PopupChatDialog::chatFriend(peerId);
|
PopupChatDialog::chatFriend(peerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NewsFeed::itemDestroyed(QObject *item)
|
||||||
|
{
|
||||||
|
int index = widgetList.indexOf(item);
|
||||||
|
if (index >= 0) {
|
||||||
|
widgetList.removeAt(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void NewsFeed::removeAll()
|
||||||
|
{
|
||||||
|
#ifdef NEWS_DEBUG
|
||||||
|
std::cerr << "NewsFeed::removeAll()" << std::endl;
|
||||||
|
#endif
|
||||||
|
while (widgetList.count()) {
|
||||||
|
QObject *item = widgetList.first();
|
||||||
|
widgetList.pop_front();
|
||||||
|
|
||||||
|
if (item) {
|
||||||
|
item->deleteLater();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -48,7 +48,9 @@ public:
|
|||||||
private slots:
|
private slots:
|
||||||
// void toggleChanMsgItems(bool on);
|
// void toggleChanMsgItems(bool on);
|
||||||
|
|
||||||
void updateFeed();
|
void updateFeed();
|
||||||
|
void removeAll();
|
||||||
|
void itemDestroyed(QObject*);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void addFeedItem(QWidget *item);
|
void addFeedItem(QWidget *item);
|
||||||
@ -70,6 +72,7 @@ private:
|
|||||||
void addFeedItemFilesNew(RsFeedItem &fi);
|
void addFeedItemFilesNew(RsFeedItem &fi);
|
||||||
|
|
||||||
QLayout *mLayout;
|
QLayout *mLayout;
|
||||||
|
QObjectList widgetList;
|
||||||
|
|
||||||
/* lists of feedItems */
|
/* lists of feedItems */
|
||||||
std::list<ForumNewItem *> mForumNewItems;
|
std::list<ForumNewItem *> mForumNewItems;
|
||||||
|
@ -70,20 +70,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="1" column="0" colspan="4">
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>321</width>
|
|
||||||
<height>13</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0" colspan="2">
|
|
||||||
<widget class="QFrame" name="frame">
|
<widget class="QFrame" name="frame">
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
<enum>QFrame::StyledPanel</enum>
|
<enum>QFrame::StyledPanel</enum>
|
||||||
@ -142,6 +129,26 @@ p, li { white-space: pre-wrap; }
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QPushButton" name="removeAllButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Remove All</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>321</width>
|
||||||
|
<height>13</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
@ -122,6 +122,10 @@ void PeerItem::updateItemStatic()
|
|||||||
QString peername = QString::fromStdString(details.name);
|
QString peername = QString::fromStdString(details.name);
|
||||||
peernameLabel->setText(nameStr.arg(peername));
|
peernameLabel->setText(nameStr.arg(peername));
|
||||||
|
|
||||||
|
QDateTime date = QDateTime::fromTime_t(details.lastConnect);
|
||||||
|
QString stime = date.toString(Qt::LocalDate);
|
||||||
|
lastLabel-> setText(stime);
|
||||||
|
|
||||||
/* expanded Info */
|
/* expanded Info */
|
||||||
nameLabel->setText(QString::fromStdString(details.name));
|
nameLabel->setText(QString::fromStdString(details.name));
|
||||||
idLabel->setText(QString::fromStdString(details.id));
|
idLabel->setText(QString::fromStdString(details.id));
|
||||||
@ -198,9 +202,6 @@ void PeerItem::updateItem()
|
|||||||
}
|
}
|
||||||
|
|
||||||
connLabel->setText(QString::fromStdString(details.autoconnect));
|
connLabel->setText(QString::fromStdString(details.autoconnect));
|
||||||
QDateTime date = QDateTime::fromTime_t(details.lastConnect);
|
|
||||||
QString stime = date.toString(Qt::LocalDate);
|
|
||||||
lastLabel-> setText(stime);
|
|
||||||
|
|
||||||
/* do buttons */
|
/* do buttons */
|
||||||
chatButton->setEnabled(details.state & RS_PEER_STATE_CONNECTED);
|
chatButton->setEnabled(details.state & RS_PEER_STATE_CONNECTED);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user