Optimized some internals in the news feed items

- std::string -> const std::string&
- QObjectList -> QSet<QObject*>

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4870 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2012-02-01 12:21:14 +00:00
parent 7cfdbd2d8d
commit ff0d6ff25a
24 changed files with 105 additions and 165 deletions

View File

@ -181,7 +181,7 @@ void NewsFeed::addFeedItem(QWidget *item)
item->setAttribute(Qt::WA_DeleteOnClose, true); item->setAttribute(Qt::WA_DeleteOnClose, true);
connect(item, SIGNAL(destroyed(QObject*)), this, SLOT(itemDestroyed(QObject*))); connect(item, SIGNAL(destroyed(QObject*)), this, SLOT(itemDestroyed(QObject*)));
widgetList.push_back(item); widgets.insert(item);
sendNewsFeedChanged(); sendNewsFeedChanged();
@ -192,16 +192,14 @@ void NewsFeed::addFeedItem(QWidget *item)
} }
} }
void NewsFeed::addFeedItemIfUnique(QWidget *item, int itemType, std::string sslId, bool replace) void NewsFeed::addFeedItemIfUnique(QWidget *item, int itemType, const std::string &sslId, bool replace)
{ {
QObjectList::iterator it; foreach (QObject *itemObject, widgets) {
for (it = widgetList.begin(); it != widgetList.end(); it++) SecurityItem *secitem = dynamic_cast<SecurityItem*>(itemObject);
{
SecurityItem *secitem = dynamic_cast<SecurityItem*>(*it);
if ((secitem) && (secitem->isSame(sslId, itemType))) if ((secitem) && (secitem->isSame(sslId, itemType)))
{ {
if (!replace) if (!replace)
{ {
delete item; delete item;
return; return;
} }
@ -496,7 +494,7 @@ void NewsFeed::addFeedItemChatNew(RsFeedItem &fi)
} }
/* make new widget */ /* make new widget */
ChatMsgItem *cm = new ChatMsgItem(this, NEWSFEED_CHATMSGLIST, fi.mId1, fi.mId2, true); ChatMsgItem *cm = new ChatMsgItem(this, NEWSFEED_CHATMSGLIST, fi.mId1, fi.mId2);
/* store in forum list */ /* store in forum list */
@ -553,11 +551,7 @@ void NewsFeed::openChat(std::string peerId)
void NewsFeed::itemDestroyed(QObject *item) void NewsFeed::itemDestroyed(QObject *item)
{ {
int index = widgetList.indexOf(item); widgets.remove(item);
if (index >= 0) {
widgetList.removeAt(index);
}
sendNewsFeedChanged(); sendNewsFeedChanged();
} }
@ -566,23 +560,21 @@ void NewsFeed::removeAll()
#ifdef NEWS_DEBUG #ifdef NEWS_DEBUG
std::cerr << "NewsFeed::removeAll()" << std::endl; std::cerr << "NewsFeed::removeAll()" << std::endl;
#endif #endif
while (widgetList.count()) {
QObject *item = widgetList.first();
widgetList.pop_front();
foreach (QObject *item, widgets) {
if (item) { if (item) {
item->deleteLater(); item->deleteLater();
} }
} }
widgets.clear();
} }
void NewsFeed::sendNewsFeedChanged() void NewsFeed::sendNewsFeedChanged()
{ {
int count = 0; int count = 0;
QObjectList::iterator it; foreach (QObject *item, widgets) {
for (it = widgetList.begin(); it != widgetList.end(); it++) { if (dynamic_cast<PeerItem*>(item) == NULL) {
if (dynamic_cast<PeerItem*>(*it) == NULL) {
/* don't count PeerItem's */ /* don't count PeerItem's */
count++; count++;
} }
@ -593,5 +585,5 @@ void NewsFeed::sendNewsFeedChanged()
void NewsFeed::feedoptions() void NewsFeed::feedoptions()
{ {
RSettingsWin::showYourself(this, RSettingsWin::Notify); RSettingsWin::showYourself(this, RSettingsWin::Notify);
} }

View File

@ -58,7 +58,7 @@ private slots:
private: private:
void addFeedItem(QWidget *item); void addFeedItem(QWidget *item);
void addFeedItemIfUnique(QWidget *item, int itemType, std::string sslId, bool replace); void addFeedItemIfUnique(QWidget *item, int itemType, const std::string &sslId, bool replace);
void addFeedItemPeerConnect(RsFeedItem &fi); void addFeedItemPeerConnect(RsFeedItem &fi);
void addFeedItemPeerDisconnect(RsFeedItem &fi); void addFeedItemPeerDisconnect(RsFeedItem &fi);
@ -85,7 +85,7 @@ private:
void sendNewsFeedChanged(); void sendNewsFeedChanged();
QLayout *mLayout; QLayout *mLayout;
QObjectList widgetList; QSet<QObject*> widgets;
/* lists of feedItems */ /* lists of feedItems */
std::list<ForumNewItem *> mForumNewItems; std::list<ForumNewItem *> mForumNewItems;

View File

@ -48,8 +48,6 @@ public:
AttachFileItem(const QString& localpath); AttachFileItem(const QString& localpath);
AttachFileItem(const std::string& hash, const QString& name, uint64_t size, uint32_t flags, const std::string& srcId); AttachFileItem(const std::string& hash, const QString& name, uint64_t size, uint32_t flags, const std::string& srcId);
/** Default Destructor */
const std::string& FileHash() { return mFileHash; } const std::string& FileHash() { return mFileHash; }
const QString& FileName() { return mFileName; } const QString& FileName() { return mFileName; }
uint64_t FileSize() { return mFileSize; } uint64_t FileSize() { return mFileSize; }

View File

@ -30,21 +30,19 @@ class SubFileItem;
class BlogMsgItem : public QWidget, private Ui::BlogMsgItem class BlogMsgItem : public QWidget, private Ui::BlogMsgItem
{ {
Q_OBJECT Q_OBJECT
public: public:
/** Default Constructor */ /** Default Constructor */
BlogMsgItem(FeedHolder *parent, uint32_t feedId, std::string peerId, std::string msgId, bool isHome); BlogMsgItem(FeedHolder *parent, uint32_t feedId, const std::string &peerId, const std::string &msgId, bool isHome);
/** Default Destructor */
void updateItemStatic(); void updateItemStatic();
void small(); void small();
private slots: private slots:
/* default stuff */ /* default stuff */
void gotoHome(); void gotoHome();
void removeItem(); void removeItem();
void toggle(); void toggle();
void playMedia(); void playMedia();
@ -63,7 +61,5 @@ private:
std::list<SubFileItem *> mFileItems; std::list<SubFileItem *> mFileItems;
}; };
#endif #endif

View File

@ -29,21 +29,19 @@ class FeedHolder;
class BlogNewItem : public QWidget, private Ui::BlogNewItem class BlogNewItem : public QWidget, private Ui::BlogNewItem
{ {
Q_OBJECT Q_OBJECT
public: public:
/** Default Constructor */ /** Default Constructor */
BlogNewItem(FeedHolder *parent, uint32_t feedId, std::string blogId, bool isHome, bool isNew); BlogNewItem(FeedHolder *parent, uint32_t feedId, const std::string &blogId, bool isHome, bool isNew);
/** Default Destructor */
void updateItemStatic(); void updateItemStatic();
void small(); void small();
private slots: private slots:
/* default stuff */ /* default stuff */
void gotoHome(); void gotoHome();
void removeItem(); void removeItem();
void toggle(); void toggle();
void unsubscribeBlog(); void unsubscribeBlog();
@ -60,7 +58,5 @@ private:
bool mIsNew; bool mIsNew;
}; };
#endif #endif

View File

@ -40,7 +40,7 @@
****/ ****/
/** Constructor */ /** Constructor */
ChanMsgItem::ChanMsgItem(FeedHolder *parent, uint32_t feedId, std::string chanId, std::string msgId, bool isHome) ChanMsgItem::ChanMsgItem(FeedHolder *parent, uint32_t feedId, const std::string &chanId, const std::string &msgId, bool isHome)
:QWidget(NULL), mParent(parent), mFeedId(feedId), :QWidget(NULL), mParent(parent), mFeedId(feedId),
mChanId(chanId), mMsgId(msgId), mIsHome(isHome) mChanId(chanId), mMsgId(msgId), mIsHome(isHome)
{ {

View File

@ -34,7 +34,7 @@ class ChanMsgItem : public QWidget, private Ui::ChanMsgItem
public: public:
/** Default Constructor */ /** Default Constructor */
ChanMsgItem(FeedHolder *parent, uint32_t feedId, std::string chanId, std::string msgId, bool isHome); ChanMsgItem(FeedHolder *parent, uint32_t feedId, const std::string &chanId, const std::string &msgId, bool isHome);
void updateItemStatic(); void updateItemStatic();
void small(); void small();

View File

@ -32,7 +32,7 @@
****/ ****/
/** Constructor */ /** Constructor */
ChanNewItem::ChanNewItem(FeedHolder *parent, uint32_t feedId, std::string chanId, bool isHome, bool isNew) ChanNewItem::ChanNewItem(FeedHolder *parent, uint32_t feedId, const std::string &chanId, bool isHome, bool isNew)
:QWidget(NULL), mParent(parent), mFeedId(feedId), :QWidget(NULL), mParent(parent), mFeedId(feedId),
mChanId(chanId), mIsHome(isHome), mIsNew(isNew) mChanId(chanId), mIsHome(isHome), mIsNew(isNew)
{ {

View File

@ -29,20 +29,18 @@ class FeedHolder;
class ChanNewItem : public QWidget, private Ui::ChanNewItem class ChanNewItem : public QWidget, private Ui::ChanNewItem
{ {
Q_OBJECT Q_OBJECT
public: public:
/** Default Constructor */ /** Default Constructor */
ChanNewItem(FeedHolder *parent, uint32_t feedId, std::string chanId, bool isHome, bool isNew); ChanNewItem(FeedHolder *parent, uint32_t feedId, const std::string &chanId, bool isHome, bool isNew);
/** Default Destructor */
void updateItemStatic(); void updateItemStatic();
void small(); void small();
private slots: private slots:
/* default stuff */ /* default stuff */
void removeItem(); void removeItem();
void toggle(); void toggle();
void unsubscribeChannel(); void unsubscribeChannel();
@ -59,7 +57,5 @@ private:
bool mIsNew; bool mIsNew;
}; };
#endif #endif

View File

@ -42,9 +42,8 @@
****/ ****/
/** Constructor */ /** Constructor */
ChatMsgItem::ChatMsgItem(FeedHolder *parent, uint32_t feedId, std::string peerId, std::string message, bool isHome) ChatMsgItem::ChatMsgItem(FeedHolder *parent, uint32_t feedId, const std::string &peerId, const std::string &message)
:QWidget(NULL), mParent(parent), mFeedId(feedId), :QWidget(NULL), mParent(parent), mFeedId(feedId), mPeerId(peerId)
mPeerId(peerId), mIsHome(isHome)
{ {
/* Invoke the Qt Designer generated object setup routine */ /* Invoke the Qt Designer generated object setup routine */
setupUi(this); setupUi(this);
@ -140,7 +139,7 @@ void ChatMsgItem::updateItem()
return; return;
} }
void ChatMsgItem::insertChat(std::string &message) void ChatMsgItem::insertChat(const std::string &message)
{ {
#ifdef DEBUG_ITEM #ifdef DEBUG_ITEM
std::cerr << "ChatMsgItem::insertChat(): " << msg << std::endl; std::cerr << "ChatMsgItem::insertChat(): " << msg << std::endl;

View File

@ -25,19 +25,15 @@
#include "ui_ChatMsgItem.h" #include "ui_ChatMsgItem.h"
#include <stdint.h> #include <stdint.h>
class FeedHolder; class FeedHolder;
class ChatMsgItem : public QWidget, private Ui::ChatMsgItem class ChatMsgItem : public QWidget, private Ui::ChatMsgItem
{ {
Q_OBJECT Q_OBJECT
public: public:
/** Default Constructor */ /** Default Constructor */
ChatMsgItem(FeedHolder *parent, uint32_t feedId, std::string peerId, std::string message, bool isHome); ChatMsgItem(FeedHolder *parent, uint32_t feedId, const std::string &peerId, const std::string &message);
/** Default Destructor */
void updateItemStatic(); void updateItemStatic();
@ -57,15 +53,12 @@ private slots:
void on_quickmsgText_textChanged(); void on_quickmsgText_textChanged();
private: private:
void insertChat(std::string &message); void insertChat(const std::string &message);
FeedHolder *mParent; FeedHolder *mParent;
uint32_t mFeedId; uint32_t mFeedId;
std::string mPeerId; std::string mPeerId;
bool mIsHome;
}; };
#endif #endif

View File

@ -26,16 +26,15 @@
#include <stdint.h> #include <stdint.h>
const uint32_t FEEDHOLDER_MSG_MESSAGE = 0x0001; const uint32_t FEEDHOLDER_MSG_MESSAGE = 0x0001;
const uint32_t FEEDHOLDER_MSG_FORUM = 0x0002; const uint32_t FEEDHOLDER_MSG_FORUM = 0x0002;
const uint32_t FEEDHOLDER_MSG_CHANNEL = 0x0003; const uint32_t FEEDHOLDER_MSG_CHANNEL = 0x0003;
const uint32_t FEEDHOLDER_MSG_BLOG = 0x0004; const uint32_t FEEDHOLDER_MSG_BLOG = 0x0004;
class FeedHolder class FeedHolder
{ {
public: public:
virtual void deleteFeedItem(QWidget *item, uint32_t type) = 0;
virtual void deleteFeedItem(QWidget *item, uint32_t type) = 0; virtual void openChat(std::string peerId) = 0;
virtual void openChat(std::string peerId) = 0;
}; };
#endif #endif

View File

@ -29,20 +29,18 @@ class FeedHolder;
#include <stdint.h> #include <stdint.h>
class ForumMsgItem : public QWidget, private Ui::ForumMsgItem class ForumMsgItem : public QWidget, private Ui::ForumMsgItem
{ {
Q_OBJECT Q_OBJECT
public: public:
/** Default Constructor */ /** Default Constructor */
ForumMsgItem(FeedHolder *parent, uint32_t feedId, const std::string &forumId, const std::string &postId, bool isHome); ForumMsgItem(FeedHolder *parent, uint32_t feedId, const std::string &forumId, const std::string &postId, bool isHome);
/** Default Destructor */
void updateItemStatic(); void updateItemStatic();
void small(); void small();
private slots: private slots:
/* default stuff */ /* default stuff */
void removeItem(); void removeItem();
void toggle(); void toggle();
void unsubscribeForum(); void unsubscribeForum();
@ -63,7 +61,5 @@ private:
bool mIsTop; bool mIsTop;
}; };
#endif #endif

View File

@ -31,7 +31,7 @@
****/ ****/
/** Constructor */ /** Constructor */
ForumNewItem::ForumNewItem(FeedHolder *parent, uint32_t feedId, std::string forumId, bool isHome, bool isNew) ForumNewItem::ForumNewItem(FeedHolder *parent, uint32_t feedId, const std::string &forumId, bool isHome, bool isNew)
:QWidget(NULL), mParent(parent), mFeedId(feedId), :QWidget(NULL), mParent(parent), mFeedId(feedId),
mForumId(forumId), mIsHome(isHome), mIsNew(isNew) mForumId(forumId), mIsHome(isHome), mIsNew(isNew)
{ {
@ -203,4 +203,3 @@ void ForumNewItem::postToForum()
cfm->show(); cfm->show();
} }
} }

View File

@ -29,20 +29,18 @@ class FeedHolder;
class ForumNewItem : public QWidget, private Ui::ForumNewItem class ForumNewItem : public QWidget, private Ui::ForumNewItem
{ {
Q_OBJECT Q_OBJECT
public: public:
/** Default Constructor */ /** Default Constructor */
ForumNewItem(FeedHolder *parent, uint32_t feedId, std::string forumId, bool isHome, bool isNew); ForumNewItem(FeedHolder *parent, uint32_t feedId, const std::string &forumId, bool isHome, bool isNew);
/** Default Destructor */
void updateItemStatic(); void updateItemStatic();
void small(); void small();
private slots: private slots:
/* default stuff */ /* default stuff */
void removeItem(); void removeItem();
void toggle(); void toggle();
void unsubscribeForum(); void unsubscribeForum();
@ -60,7 +58,5 @@ private:
bool mIsNew; bool mIsNew;
}; };
#endif #endif

View File

@ -38,7 +38,7 @@
****/ ****/
/** Constructor */ /** Constructor */
MsgItem::MsgItem(FeedHolder *parent, uint32_t feedId, std::string msgId, bool isHome) MsgItem::MsgItem(FeedHolder *parent, uint32_t feedId, const std::string &msgId, bool isHome)
:QWidget(NULL), mParent(parent), mFeedId(feedId), mMsgId(msgId), mIsHome(isHome) :QWidget(NULL), mParent(parent), mFeedId(feedId), mMsgId(msgId), mIsHome(isHome)
{ {
/* Invoke the Qt Designer generated object setup routine */ /* Invoke the Qt Designer generated object setup routine */

View File

@ -30,21 +30,19 @@ class SubFileItem;
class MsgItem : public QWidget, private Ui::MsgItem class MsgItem : public QWidget, private Ui::MsgItem
{ {
Q_OBJECT Q_OBJECT
public: public:
/** Default Constructor */ /** Default Constructor */
MsgItem(FeedHolder *parent, uint32_t feedId, std::string msgId, bool isHome); MsgItem(FeedHolder *parent, uint32_t feedId, const std::string &msgId, bool isHome);
/** Default Destructor */
void updateItemStatic(); void updateItemStatic();
void small(); void small();
private slots: private slots:
/* default stuff */ /* default stuff */
void gotoHome(); void gotoHome();
void removeItem(); void removeItem();
void toggle(); void toggle();
void playMedia(); void playMedia();
@ -65,7 +63,5 @@ private:
std::list<SubFileItem *> mFileItems; std::list<SubFileItem *> mFileItems;
}; };
#endif #endif

View File

@ -41,7 +41,7 @@
****/ ****/
/** Constructor */ /** Constructor */
PeerItem::PeerItem(FeedHolder *parent, uint32_t feedId, std::string peerId, uint32_t type, bool isHome) PeerItem::PeerItem(FeedHolder *parent, uint32_t feedId, const std::string &peerId, uint32_t type, bool isHome)
:QWidget(NULL), mParent(parent), mFeedId(feedId), :QWidget(NULL), mParent(parent), mFeedId(feedId),
mPeerId(peerId), mType(type), mIsHome(isHome) mPeerId(peerId), mType(type), mIsHome(isHome)
{ {
@ -95,19 +95,19 @@ void PeerItem::updateItemStatic()
switch(mType) switch(mType)
{ {
case PEER_TYPE_STD: case PEER_TYPE_STD:
title = tr("Friend"); title = tr("Friend");
break; break;
case PEER_TYPE_CONNECT: case PEER_TYPE_CONNECT:
title = tr("Friend Connected"); title = tr("Friend Connected");
break; break;
case PEER_TYPE_HELLO: case PEER_TYPE_HELLO:
title = tr("Connect Attempt"); title = tr("Connect Attempt");
break; break;
case PEER_TYPE_NEW_FOF: case PEER_TYPE_NEW_FOF:
title = tr("Friend of Friend"); title = tr("Friend of Friend");
break; break;
default: default:
title = tr("Peer"); title = tr("Peer");
break; break;
} }
@ -313,12 +313,12 @@ void PeerItem::togglequickmessage()
{ {
if (messageframe->isHidden()) if (messageframe->isHidden())
{ {
messageframe->setVisible(true); messageframe->setVisible(true);
} }
else else
{ {
messageframe->setVisible(false); messageframe->setVisible(false);
} }
} }
void PeerItem::sendMessage() void PeerItem::sendMessage()
@ -328,7 +328,7 @@ void PeerItem::sendMessage()
mi.title = tr("Quick Message").toStdWString(); mi.title = tr("Quick Message").toStdWString();
mi.msg = quickmsgText->toHtml().toStdWString(); mi.msg = quickmsgText->toHtml().toStdWString();
mi.msgto.push_back(mPeerId); mi.msgto.push_back(mPeerId);
rsMsgs->MessageSend(mi); rsMsgs->MessageSend(mi);

View File

@ -25,30 +25,27 @@
#include "ui_PeerItem.h" #include "ui_PeerItem.h"
#include <stdint.h> #include <stdint.h>
const uint32_t PEER_TYPE_STD = 0x0001; const uint32_t PEER_TYPE_STD = 0x0001;
const uint32_t PEER_TYPE_CONNECT = 0x0002; const uint32_t PEER_TYPE_CONNECT = 0x0002;
const uint32_t PEER_TYPE_HELLO = 0x0003; /* failed Connect Attempt */ const uint32_t PEER_TYPE_HELLO = 0x0003; /* failed Connect Attempt */
const uint32_t PEER_TYPE_NEW_FOF = 0x0004; /* new Friend of Friend */ const uint32_t PEER_TYPE_NEW_FOF = 0x0004; /* new Friend of Friend */
class FeedHolder; class FeedHolder;
class PeerItem : public QWidget, private Ui::PeerItem class PeerItem : public QWidget, private Ui::PeerItem
{ {
Q_OBJECT Q_OBJECT
public: public:
/** Default Constructor */ /** Default Constructor */
PeerItem(FeedHolder *parent, uint32_t feedId, std::string peerId, uint32_t type, bool isHome); PeerItem(FeedHolder *parent, uint32_t feedId, const std::string &peerId, uint32_t type, bool isHome);
/** Default Destructor */
void updateItemStatic(); void updateItemStatic();
void small(); void small();
private slots: private slots:
/* default stuff */ /* default stuff */
void removeItem(); void removeItem();
void toggle(); void toggle();
void addFriend(); void addFriend();
@ -57,13 +54,12 @@ private slots:
void openChat(); void openChat();
void updateItem(); void updateItem();
void togglequickmessage(); void togglequickmessage();
void sendMessage(); void sendMessage();
void on_quickmsgText_textChanged(); void on_quickmsgText_textChanged();
private: private:
FeedHolder *mParent; FeedHolder *mParent;
uint32_t mFeedId; uint32_t mFeedId;
@ -73,7 +69,5 @@ private:
bool mIsHome; bool mIsHome;
}; };
#endif #endif

View File

@ -43,7 +43,7 @@
****/ ****/
/** Constructor */ /** Constructor */
SecurityItem::SecurityItem(FeedHolder *parent, uint32_t feedId, std::string gpgId, std::string sslId, uint32_t type, bool isHome) SecurityItem::SecurityItem(FeedHolder *parent, uint32_t feedId, const std::string &gpgId, const std::string &sslId, uint32_t type, bool isHome)
:QWidget(NULL), mParent(parent), mFeedId(feedId), :QWidget(NULL), mParent(parent), mFeedId(feedId),
mSslId(sslId), mGpgId(gpgId), mType(type), mIsHome(isHome) mSslId(sslId), mGpgId(gpgId), mType(type), mIsHome(isHome)
{ {

View File

@ -38,7 +38,7 @@ class SecurityItem : public QWidget, private Ui::SecurityItem
public: public:
/** Default Constructor */ /** Default Constructor */
SecurityItem(FeedHolder *parent, uint32_t feedId, std::string gpgId, std::string sslId, uint32_t type, bool isHome); SecurityItem(FeedHolder *parent, uint32_t feedId, const std::string &gpgId, const std::string &sslId, uint32_t type, bool isHome);
void updateItemStatic(); void updateItemStatic();
void small(); void small();
@ -73,7 +73,5 @@ private:
bool mIsHome; bool mIsHome;
}; };
#endif #endif

View File

@ -31,7 +31,7 @@
****/ ****/
/** Constructor */ /** Constructor */
SubDestItem::SubDestItem(uint32_t type, std::string groupId, std::string inReplyTo) SubDestItem::SubDestItem(uint32_t type, const std::string &groupId, const std::string &inReplyTo)
:QWidget(NULL), mType(type), mGroupId(groupId), mInReplyTo(inReplyTo) :QWidget(NULL), mType(type), mGroupId(groupId), mInReplyTo(inReplyTo)
{ {
/* Invoke the Qt Designer generated object setup routine */ /* Invoke the Qt Designer generated object setup routine */

View File

@ -27,23 +27,21 @@
class SubDestItem : public QWidget, private Ui::SubDestItem class SubDestItem : public QWidget, private Ui::SubDestItem
{ {
Q_OBJECT Q_OBJECT
public: public:
/** Default Constructor */ /** Default Constructor */
SubDestItem(uint32_t type, std::string groupId, std::string inReplyTo); SubDestItem(uint32_t type, const std::string &groupId, const std::string &inReplyTo);
/** Default Destructor */
uint32_t DestType() { return mType; } uint32_t DestType() { return mType; }
std::string DestGroupId() { return mGroupId; } std::string DestGroupId() { return mGroupId; }
std::string DestInReplyTo() { return mInReplyTo; } std::string DestInReplyTo() { return mInReplyTo; }
void updateItemStatic(); void updateItemStatic();
private slots: private slots:
/* default stuff */ /* default stuff */
void cancel(); void cancel();
private: private:
uint32_t mType; uint32_t mType;
@ -51,7 +49,5 @@ private:
std::string mInReplyTo; std::string mInReplyTo;
}; };
#endif #endif

View File

@ -24,20 +24,20 @@
#include "ui_SubFileItem.h" #include "ui_SubFileItem.h"
#include <stdint.h> #include <stdint.h>
const uint32_t SFI_MASK_STATE = 0x000f; const uint32_t SFI_MASK_STATE = 0x000f;
const uint32_t SFI_MASK_TYPE = 0x00f0; const uint32_t SFI_MASK_TYPE = 0x00f0;
//const uint32_t SFI_MASK_FT = 0x0f00; //const uint32_t SFI_MASK_FT = 0x0f00;
const uint32_t SFI_MASK_FLAG = 0xf000; const uint32_t SFI_MASK_FLAG = 0xf000;
const uint32_t SFI_STATE_ERROR = 0x0001; const uint32_t SFI_STATE_ERROR = 0x0001;
const uint32_t SFI_STATE_EXTRA = 0x0002; const uint32_t SFI_STATE_EXTRA = 0x0002;
const uint32_t SFI_STATE_REMOTE = 0x0003; const uint32_t SFI_STATE_REMOTE = 0x0003;
const uint32_t SFI_STATE_DOWNLOAD = 0x0004; const uint32_t SFI_STATE_DOWNLOAD = 0x0004;
const uint32_t SFI_STATE_LOCAL = 0x0005; const uint32_t SFI_STATE_LOCAL = 0x0005;
const uint32_t SFI_STATE_UPLOAD = 0x0006; const uint32_t SFI_STATE_UPLOAD = 0x0006;
const uint32_t SFI_TYPE_CHANNEL = 0x0010; const uint32_t SFI_TYPE_CHANNEL = 0x0010;
const uint32_t SFI_TYPE_ATTACH = 0x0020; const uint32_t SFI_TYPE_ATTACH = 0x0020;
const uint32_t SFI_FLAG_CREATE = 0x1000; const uint32_t SFI_FLAG_CREATE = 0x1000;
@ -51,15 +51,13 @@ const uint32_t SFI_FLAG_CREATE = 0x1000;
*/ */
class SubFileItem : public QWidget, private Ui::SubFileItem class SubFileItem : public QWidget, private Ui::SubFileItem
{ {
Q_OBJECT Q_OBJECT
public: public:
/** Default Constructor */ /** Default Constructor */
SubFileItem(const std::string &hash, const std::string &name, const std::string &path, uint64_t size, uint32_t flags, const std::string &srcId); SubFileItem(const std::string &hash, const std::string &name, const std::string &path, uint64_t size, uint32_t flags, const std::string &srcId);
/** Default Destructor */ void smaller();
void smaller();
std::string FileHash() { return mFileHash; } std::string FileHash() { return mFileHash; }
std::string FileName() { return mFileName; } std::string FileName() { return mFileName; }
@ -68,14 +66,14 @@ public:
void updateItemStatic(); void updateItemStatic();
bool done(); bool done();
bool ready(); bool ready();
uint32_t getState(); uint32_t getState();
bool isDownloadable(bool &startable); bool isDownloadable(bool &startable);
bool isPlayable(bool &startable); bool isPlayable(bool &startable);
public slots: public slots:
void download(); void download();
void play(); void play();
@ -88,7 +86,6 @@ private slots:
void updateItem(); void updateItem();
private: private:
void Setup(); void Setup();
std::string mPath; std::string mPath;
@ -107,7 +104,6 @@ private:
signals: signals:
void fileFinished(SubFileItem * subFileItem); void fileFinished(SubFileItem * subFileItem);
}; };
#endif #endif