mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Forgot to commit the changes in FeedReader plugin
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7685 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
756b9acf41
commit
aa080e02f0
@ -34,7 +34,7 @@
|
||||
|
||||
/** Constructor */
|
||||
FeedReaderFeedItem::FeedReaderFeedItem(RsFeedReader *feedReader, FeedReaderNotify *notify, FeedHolder *parent, const FeedInfo &feedInfo, const FeedMsgInfo &msgInfo)
|
||||
: QWidget(NULL), mFeedReader(feedReader), mNotify(notify), mParent(parent), ui(new Ui::FeedReaderFeedItem)
|
||||
: FeedItem(NULL), mFeedReader(feedReader), mNotify(notify), mParent(parent), ui(new Ui::FeedReaderFeedItem)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui->setupUi(this);
|
||||
@ -95,9 +95,16 @@ FeedReaderFeedItem::~FeedReaderFeedItem()
|
||||
|
||||
void FeedReaderFeedItem::toggle()
|
||||
{
|
||||
mParent->lockLayout(this, true);
|
||||
expand(ui->expandFrame->isHidden());
|
||||
}
|
||||
|
||||
if (ui->expandFrame->isHidden()) {
|
||||
void FeedReaderFeedItem::expand(bool open)
|
||||
{
|
||||
if (mParent) {
|
||||
mParent->lockLayout(this, true);
|
||||
}
|
||||
|
||||
if (open) {
|
||||
ui->expandFrame->show();
|
||||
ui->expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png")));
|
||||
ui->expandButton->setToolTip(tr("Hide"));
|
||||
@ -109,7 +116,11 @@ void FeedReaderFeedItem::toggle()
|
||||
ui->expandButton->setToolTip(tr("Expand"));
|
||||
}
|
||||
|
||||
mParent->lockLayout(this, false);
|
||||
emit sizeChanged(this);
|
||||
|
||||
if (mParent) {
|
||||
mParent->lockLayout(this, false);
|
||||
}
|
||||
}
|
||||
|
||||
void FeedReaderFeedItem::removeItem()
|
||||
|
@ -22,7 +22,7 @@
|
||||
#ifndef _FEEDREADERFEEDITEM_H
|
||||
#define _FEEDREADERFEEDITEM_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "gui/feeds/FeedItem.h"
|
||||
|
||||
namespace Ui {
|
||||
class FeedReaderFeedItem;
|
||||
@ -34,7 +34,7 @@ class FeedHolder;
|
||||
class FeedInfo;
|
||||
class FeedMsgInfo;
|
||||
|
||||
class FeedReaderFeedItem : public QWidget
|
||||
class FeedReaderFeedItem : public FeedItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -42,6 +42,9 @@ public:
|
||||
FeedReaderFeedItem(RsFeedReader *feedReader, FeedReaderNotify *notify, FeedHolder *parent, const FeedInfo &feedInfo, const FeedMsgInfo &msgInfo);
|
||||
~FeedReaderFeedItem();
|
||||
|
||||
/* FeedItem */
|
||||
virtual void expand(bool open);
|
||||
|
||||
private slots:
|
||||
/* default stuff */
|
||||
void removeItem();
|
||||
|
@ -82,16 +82,16 @@ void FeedReaderFeedNotify::msgChanged(const QString &feedId, const QString &msgI
|
||||
|
||||
mMutex->lock();
|
||||
|
||||
FeedItem feedItem;
|
||||
feedItem.mFeedId = feedId;
|
||||
feedItem.mMsgId = msgId;
|
||||
FeedItemData feedItemData;
|
||||
feedItemData.mFeedId = feedId;
|
||||
feedItemData.mMsgId = msgId;
|
||||
|
||||
mPendingNewsFeed.push_back(feedItem);
|
||||
mPendingNewsFeed.push_back(feedItemData);
|
||||
|
||||
mMutex->unlock();
|
||||
}
|
||||
|
||||
QWidget *FeedReaderFeedNotify::feedItem(FeedHolder *parent)
|
||||
FeedItem *FeedReaderFeedNotify::feedItem(FeedHolder *parent)
|
||||
{
|
||||
bool msgPending = false;
|
||||
FeedInfo feedInfo;
|
||||
@ -99,11 +99,11 @@ QWidget *FeedReaderFeedNotify::feedItem(FeedHolder *parent)
|
||||
|
||||
mMutex->lock();
|
||||
while (!mPendingNewsFeed.empty()) {
|
||||
FeedItem feedItem = mPendingNewsFeed.front();
|
||||
FeedItemData feedItemData = mPendingNewsFeed.front();
|
||||
mPendingNewsFeed.pop_front();
|
||||
|
||||
if (mFeedReader->getFeedInfo(feedItem.mFeedId.toStdString(), feedInfo) &&
|
||||
mFeedReader->getMsgInfo(feedItem.mFeedId.toStdString(), feedItem.mMsgId.toStdString(), msgInfo)) {
|
||||
if (mFeedReader->getFeedInfo(feedItemData.mFeedId.toStdString(), feedInfo) &&
|
||||
mFeedReader->getMsgInfo(feedItemData.mFeedId.toStdString(), feedItemData.mMsgId.toStdString(), msgInfo)) {
|
||||
if (msgInfo.flag.isnew) {
|
||||
msgPending = true;
|
||||
break;
|
||||
@ -119,7 +119,7 @@ QWidget *FeedReaderFeedNotify::feedItem(FeedHolder *parent)
|
||||
return new FeedReaderFeedItem(mFeedReader, mNotify, parent, feedInfo, msgInfo);
|
||||
}
|
||||
|
||||
QWidget *FeedReaderFeedNotify::testFeedItem(FeedHolder *parent)
|
||||
FeedItem *FeedReaderFeedNotify::testFeedItem(FeedHolder *parent)
|
||||
{
|
||||
FeedInfo feedInfo;
|
||||
feedInfo.name = tr("Test").toUtf8().constData();
|
||||
|
@ -27,16 +27,17 @@
|
||||
class RsFeedReader;
|
||||
class FeedReaderNotify;
|
||||
class QMutex;
|
||||
class FeedItem;
|
||||
|
||||
class FeedReaderFeedNotify : public FeedNotify
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
protected:
|
||||
class FeedItem
|
||||
class FeedItemData
|
||||
{
|
||||
public:
|
||||
FeedItem() {}
|
||||
FeedItemData() {}
|
||||
|
||||
public:
|
||||
QString mFeedId;
|
||||
@ -50,8 +51,8 @@ public:
|
||||
virtual bool hasSetting(QString &name);
|
||||
virtual bool notifyEnabled();
|
||||
virtual void setNotifyEnabled(bool enabled);
|
||||
virtual QWidget *feedItem(FeedHolder *parent);
|
||||
virtual QWidget *testFeedItem(FeedHolder *parent);
|
||||
virtual FeedItem *feedItem(FeedHolder *parent);
|
||||
virtual FeedItem *testFeedItem(FeedHolder *parent);
|
||||
|
||||
private slots:
|
||||
void msgChanged(const QString &feedId, const QString &msgId, int type);
|
||||
@ -61,7 +62,7 @@ private:
|
||||
FeedReaderNotify *mNotify;
|
||||
|
||||
QMutex *mMutex;
|
||||
QList<FeedItem> mPendingNewsFeed;
|
||||
QList<FeedItemData> mPendingNewsFeed;
|
||||
};
|
||||
|
||||
#endif // FEEDREADERFEEDNOTIFY_H
|
||||
|
Loading…
Reference in New Issue
Block a user