mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-26 07:59:35 -05:00
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:
parent
7cfdbd2d8d
commit
ff0d6ff25a
@ -181,7 +181,7 @@ void NewsFeed::addFeedItem(QWidget *item)
|
||||
item->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
|
||||
connect(item, SIGNAL(destroyed(QObject*)), this, SLOT(itemDestroyed(QObject*)));
|
||||
widgetList.push_back(item);
|
||||
widgets.insert(item);
|
||||
|
||||
sendNewsFeedChanged();
|
||||
|
||||
@ -192,12 +192,10 @@ 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;
|
||||
for (it = widgetList.begin(); it != widgetList.end(); it++)
|
||||
{
|
||||
SecurityItem *secitem = dynamic_cast<SecurityItem*>(*it);
|
||||
foreach (QObject *itemObject, widgets) {
|
||||
SecurityItem *secitem = dynamic_cast<SecurityItem*>(itemObject);
|
||||
if ((secitem) && (secitem->isSame(sslId, itemType)))
|
||||
{
|
||||
if (!replace)
|
||||
@ -496,7 +494,7 @@ void NewsFeed::addFeedItemChatNew(RsFeedItem &fi)
|
||||
}
|
||||
|
||||
/* 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 */
|
||||
|
||||
@ -553,11 +551,7 @@ void NewsFeed::openChat(std::string peerId)
|
||||
|
||||
void NewsFeed::itemDestroyed(QObject *item)
|
||||
{
|
||||
int index = widgetList.indexOf(item);
|
||||
if (index >= 0) {
|
||||
widgetList.removeAt(index);
|
||||
}
|
||||
|
||||
widgets.remove(item);
|
||||
sendNewsFeedChanged();
|
||||
}
|
||||
|
||||
@ -566,23 +560,21 @@ void NewsFeed::removeAll()
|
||||
#ifdef NEWS_DEBUG
|
||||
std::cerr << "NewsFeed::removeAll()" << std::endl;
|
||||
#endif
|
||||
while (widgetList.count()) {
|
||||
QObject *item = widgetList.first();
|
||||
widgetList.pop_front();
|
||||
|
||||
foreach (QObject *item, widgets) {
|
||||
if (item) {
|
||||
item->deleteLater();
|
||||
}
|
||||
}
|
||||
widgets.clear();
|
||||
}
|
||||
|
||||
void NewsFeed::sendNewsFeedChanged()
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
QObjectList::iterator it;
|
||||
for (it = widgetList.begin(); it != widgetList.end(); it++) {
|
||||
if (dynamic_cast<PeerItem*>(*it) == NULL) {
|
||||
foreach (QObject *item, widgets) {
|
||||
if (dynamic_cast<PeerItem*>(item) == NULL) {
|
||||
/* don't count PeerItem's */
|
||||
count++;
|
||||
}
|
||||
@ -593,5 +585,5 @@ void NewsFeed::sendNewsFeedChanged()
|
||||
|
||||
void NewsFeed::feedoptions()
|
||||
{
|
||||
RSettingsWin::showYourself(this, RSettingsWin::Notify);
|
||||
RSettingsWin::showYourself(this, RSettingsWin::Notify);
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ private slots:
|
||||
|
||||
private:
|
||||
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 addFeedItemPeerDisconnect(RsFeedItem &fi);
|
||||
@ -85,7 +85,7 @@ private:
|
||||
void sendNewsFeedChanged();
|
||||
|
||||
QLayout *mLayout;
|
||||
QObjectList widgetList;
|
||||
QSet<QObject*> widgets;
|
||||
|
||||
/* lists of feedItems */
|
||||
std::list<ForumNewItem *> mForumNewItems;
|
||||
|
@ -48,8 +48,6 @@ public:
|
||||
AttachFileItem(const QString& localpath);
|
||||
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 QString& FileName() { return mFileName; }
|
||||
uint64_t FileSize() { return mFileSize; }
|
||||
|
@ -30,21 +30,19 @@ class SubFileItem;
|
||||
|
||||
class BlogMsgItem : public QWidget, private Ui::BlogMsgItem
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default Constructor */
|
||||
BlogMsgItem(FeedHolder *parent, uint32_t feedId, std::string peerId, std::string msgId, bool isHome);
|
||||
|
||||
/** Default Destructor */
|
||||
/** Default Constructor */
|
||||
BlogMsgItem(FeedHolder *parent, uint32_t feedId, const std::string &peerId, const std::string &msgId, bool isHome);
|
||||
|
||||
void updateItemStatic();
|
||||
void small();
|
||||
void small();
|
||||
|
||||
private slots:
|
||||
/* default stuff */
|
||||
void gotoHome();
|
||||
void removeItem();
|
||||
void gotoHome();
|
||||
void removeItem();
|
||||
void toggle();
|
||||
|
||||
void playMedia();
|
||||
@ -63,7 +61,5 @@ private:
|
||||
std::list<SubFileItem *> mFileItems;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -29,21 +29,19 @@ class FeedHolder;
|
||||
|
||||
class BlogNewItem : public QWidget, private Ui::BlogNewItem
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default Constructor */
|
||||
BlogNewItem(FeedHolder *parent, uint32_t feedId, std::string blogId, bool isHome, bool isNew);
|
||||
|
||||
/** Default Destructor */
|
||||
/** Default Constructor */
|
||||
BlogNewItem(FeedHolder *parent, uint32_t feedId, const std::string &blogId, bool isHome, bool isNew);
|
||||
|
||||
void updateItemStatic();
|
||||
void small();
|
||||
void small();
|
||||
|
||||
private slots:
|
||||
/* default stuff */
|
||||
void gotoHome();
|
||||
void removeItem();
|
||||
void gotoHome();
|
||||
void removeItem();
|
||||
void toggle();
|
||||
|
||||
void unsubscribeBlog();
|
||||
@ -60,7 +58,5 @@ private:
|
||||
bool mIsNew;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
****/
|
||||
|
||||
/** 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),
|
||||
mChanId(chanId), mMsgId(msgId), mIsHome(isHome)
|
||||
{
|
||||
|
@ -34,7 +34,7 @@ class ChanMsgItem : public QWidget, private Ui::ChanMsgItem
|
||||
|
||||
public:
|
||||
/** 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 small();
|
||||
|
@ -32,7 +32,7 @@
|
||||
****/
|
||||
|
||||
/** 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),
|
||||
mChanId(chanId), mIsHome(isHome), mIsNew(isNew)
|
||||
{
|
||||
|
@ -29,20 +29,18 @@ class FeedHolder;
|
||||
|
||||
class ChanNewItem : public QWidget, private Ui::ChanNewItem
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default Constructor */
|
||||
ChanNewItem(FeedHolder *parent, uint32_t feedId, std::string chanId, bool isHome, bool isNew);
|
||||
|
||||
/** Default Destructor */
|
||||
/** Default Constructor */
|
||||
ChanNewItem(FeedHolder *parent, uint32_t feedId, const std::string &chanId, bool isHome, bool isNew);
|
||||
|
||||
void updateItemStatic();
|
||||
void small();
|
||||
void small();
|
||||
|
||||
private slots:
|
||||
/* default stuff */
|
||||
void removeItem();
|
||||
void removeItem();
|
||||
void toggle();
|
||||
|
||||
void unsubscribeChannel();
|
||||
@ -59,7 +57,5 @@ private:
|
||||
bool mIsNew;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -42,9 +42,8 @@
|
||||
****/
|
||||
|
||||
/** Constructor */
|
||||
ChatMsgItem::ChatMsgItem(FeedHolder *parent, uint32_t feedId, std::string peerId, std::string message, bool isHome)
|
||||
:QWidget(NULL), mParent(parent), mFeedId(feedId),
|
||||
mPeerId(peerId), mIsHome(isHome)
|
||||
ChatMsgItem::ChatMsgItem(FeedHolder *parent, uint32_t feedId, const std::string &peerId, const std::string &message)
|
||||
:QWidget(NULL), mParent(parent), mFeedId(feedId), mPeerId(peerId)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
setupUi(this);
|
||||
@ -140,7 +139,7 @@ void ChatMsgItem::updateItem()
|
||||
return;
|
||||
}
|
||||
|
||||
void ChatMsgItem::insertChat(std::string &message)
|
||||
void ChatMsgItem::insertChat(const std::string &message)
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "ChatMsgItem::insertChat(): " << msg << std::endl;
|
||||
|
@ -25,19 +25,15 @@
|
||||
#include "ui_ChatMsgItem.h"
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
class FeedHolder;
|
||||
|
||||
|
||||
class ChatMsgItem : public QWidget, private Ui::ChatMsgItem
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default Constructor */
|
||||
ChatMsgItem(FeedHolder *parent, uint32_t feedId, std::string peerId, std::string message, bool isHome);
|
||||
|
||||
/** Default Destructor */
|
||||
/** Default Constructor */
|
||||
ChatMsgItem(FeedHolder *parent, uint32_t feedId, const std::string &peerId, const std::string &message);
|
||||
|
||||
void updateItemStatic();
|
||||
|
||||
@ -57,15 +53,12 @@ private slots:
|
||||
void on_quickmsgText_textChanged();
|
||||
|
||||
private:
|
||||
void insertChat(std::string &message);
|
||||
void insertChat(const std::string &message);
|
||||
|
||||
FeedHolder *mParent;
|
||||
uint32_t mFeedId;
|
||||
|
||||
std::string mPeerId;
|
||||
|
||||
bool mIsHome;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -26,16 +26,15 @@
|
||||
#include <stdint.h>
|
||||
|
||||
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_BLOG = 0x0004;
|
||||
const uint32_t FEEDHOLDER_MSG_BLOG = 0x0004;
|
||||
|
||||
class FeedHolder
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void deleteFeedItem(QWidget *item, uint32_t type) = 0;
|
||||
virtual void openChat(std::string peerId) = 0;
|
||||
public:
|
||||
virtual void deleteFeedItem(QWidget *item, uint32_t type) = 0;
|
||||
virtual void openChat(std::string peerId) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -29,20 +29,18 @@ class FeedHolder;
|
||||
#include <stdint.h>
|
||||
class ForumMsgItem : public QWidget, private Ui::ForumMsgItem
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default Constructor */
|
||||
ForumMsgItem(FeedHolder *parent, uint32_t feedId, const std::string &forumId, const std::string &postId, bool isHome);
|
||||
|
||||
/** Default Destructor */
|
||||
|
||||
void updateItemStatic();
|
||||
void small();
|
||||
void small();
|
||||
|
||||
private slots:
|
||||
/* default stuff */
|
||||
void removeItem();
|
||||
void removeItem();
|
||||
void toggle();
|
||||
|
||||
void unsubscribeForum();
|
||||
@ -63,7 +61,5 @@ private:
|
||||
bool mIsTop;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
****/
|
||||
|
||||
/** 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),
|
||||
mForumId(forumId), mIsHome(isHome), mIsNew(isNew)
|
||||
{
|
||||
@ -203,4 +203,3 @@ void ForumNewItem::postToForum()
|
||||
cfm->show();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,20 +29,18 @@ class FeedHolder;
|
||||
|
||||
class ForumNewItem : public QWidget, private Ui::ForumNewItem
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default Constructor */
|
||||
ForumNewItem(FeedHolder *parent, uint32_t feedId, std::string forumId, bool isHome, bool isNew);
|
||||
|
||||
/** Default Destructor */
|
||||
/** Default Constructor */
|
||||
ForumNewItem(FeedHolder *parent, uint32_t feedId, const std::string &forumId, bool isHome, bool isNew);
|
||||
|
||||
void updateItemStatic();
|
||||
void small();
|
||||
void small();
|
||||
|
||||
private slots:
|
||||
/* default stuff */
|
||||
void removeItem();
|
||||
void removeItem();
|
||||
void toggle();
|
||||
|
||||
void unsubscribeForum();
|
||||
@ -60,7 +58,5 @@ private:
|
||||
bool mIsNew;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
||||
****/
|
||||
|
||||
/** 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)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
|
@ -30,21 +30,19 @@ class SubFileItem;
|
||||
|
||||
class MsgItem : public QWidget, private Ui::MsgItem
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default Constructor */
|
||||
MsgItem(FeedHolder *parent, uint32_t feedId, std::string msgId, bool isHome);
|
||||
|
||||
/** Default Destructor */
|
||||
/** Default Constructor */
|
||||
MsgItem(FeedHolder *parent, uint32_t feedId, const std::string &msgId, bool isHome);
|
||||
|
||||
void updateItemStatic();
|
||||
void small();
|
||||
void small();
|
||||
|
||||
private slots:
|
||||
/* default stuff */
|
||||
void gotoHome();
|
||||
void removeItem();
|
||||
void gotoHome();
|
||||
void removeItem();
|
||||
void toggle();
|
||||
|
||||
void playMedia();
|
||||
@ -65,7 +63,5 @@ private:
|
||||
std::list<SubFileItem *> mFileItems;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -41,7 +41,7 @@
|
||||
****/
|
||||
|
||||
/** 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),
|
||||
mPeerId(peerId), mType(type), mIsHome(isHome)
|
||||
{
|
||||
@ -95,19 +95,19 @@ void PeerItem::updateItemStatic()
|
||||
switch(mType)
|
||||
{
|
||||
case PEER_TYPE_STD:
|
||||
title = tr("Friend");
|
||||
title = tr("Friend");
|
||||
break;
|
||||
case PEER_TYPE_CONNECT:
|
||||
title = tr("Friend Connected");
|
||||
title = tr("Friend Connected");
|
||||
break;
|
||||
case PEER_TYPE_HELLO:
|
||||
title = tr("Connect Attempt");
|
||||
title = tr("Connect Attempt");
|
||||
break;
|
||||
case PEER_TYPE_NEW_FOF:
|
||||
title = tr("Friend of Friend");
|
||||
title = tr("Friend of Friend");
|
||||
break;
|
||||
default:
|
||||
title = tr("Peer");
|
||||
title = tr("Peer");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -313,12 +313,12 @@ void PeerItem::togglequickmessage()
|
||||
{
|
||||
if (messageframe->isHidden())
|
||||
{
|
||||
messageframe->setVisible(true);
|
||||
}
|
||||
messageframe->setVisible(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
messageframe->setVisible(false);
|
||||
}
|
||||
messageframe->setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
void PeerItem::sendMessage()
|
||||
|
@ -25,30 +25,27 @@
|
||||
#include "ui_PeerItem.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_HELLO = 0x0003; /* failed Connect Attempt */
|
||||
const uint32_t PEER_TYPE_NEW_FOF = 0x0004; /* new Friend of Friend */
|
||||
|
||||
class FeedHolder;
|
||||
|
||||
|
||||
class PeerItem : public QWidget, private Ui::PeerItem
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default Constructor */
|
||||
PeerItem(FeedHolder *parent, uint32_t feedId, std::string peerId, uint32_t type, bool isHome);
|
||||
|
||||
/** Default Destructor */
|
||||
/** Default Constructor */
|
||||
PeerItem(FeedHolder *parent, uint32_t feedId, const std::string &peerId, uint32_t type, bool isHome);
|
||||
|
||||
void updateItemStatic();
|
||||
void small();
|
||||
void small();
|
||||
|
||||
private slots:
|
||||
/* default stuff */
|
||||
void removeItem();
|
||||
void removeItem();
|
||||
void toggle();
|
||||
|
||||
void addFriend();
|
||||
@ -58,12 +55,11 @@ private slots:
|
||||
|
||||
void updateItem();
|
||||
|
||||
void togglequickmessage();
|
||||
void togglequickmessage();
|
||||
void sendMessage();
|
||||
|
||||
void on_quickmsgText_textChanged();
|
||||
|
||||
|
||||
private:
|
||||
FeedHolder *mParent;
|
||||
uint32_t mFeedId;
|
||||
@ -73,7 +69,5 @@ private:
|
||||
bool mIsHome;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -43,7 +43,7 @@
|
||||
****/
|
||||
|
||||
/** 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),
|
||||
mSslId(sslId), mGpgId(gpgId), mType(type), mIsHome(isHome)
|
||||
{
|
||||
|
@ -38,7 +38,7 @@ class SecurityItem : public QWidget, private Ui::SecurityItem
|
||||
|
||||
public:
|
||||
/** 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 small();
|
||||
@ -73,7 +73,5 @@ private:
|
||||
bool mIsHome;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
****/
|
||||
|
||||
/** 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)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
|
@ -27,23 +27,21 @@
|
||||
|
||||
class SubDestItem : public QWidget, private Ui::SubDestItem
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default Constructor */
|
||||
SubDestItem(uint32_t type, std::string groupId, std::string inReplyTo);
|
||||
|
||||
/** Default Destructor */
|
||||
/** Default Constructor */
|
||||
SubDestItem(uint32_t type, const std::string &groupId, const std::string &inReplyTo);
|
||||
|
||||
uint32_t DestType() { return mType; }
|
||||
std::string DestGroupId() { return mGroupId; }
|
||||
std::string DestInReplyTo() { return mInReplyTo; }
|
||||
|
||||
void updateItemStatic();
|
||||
void updateItemStatic();
|
||||
|
||||
private slots:
|
||||
/* default stuff */
|
||||
void cancel();
|
||||
void cancel();
|
||||
|
||||
private:
|
||||
uint32_t mType;
|
||||
@ -51,7 +49,5 @@ private:
|
||||
std::string mInReplyTo;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -24,20 +24,20 @@
|
||||
|
||||
#include "ui_SubFileItem.h"
|
||||
#include <stdint.h>
|
||||
const uint32_t SFI_MASK_STATE = 0x000f;
|
||||
const uint32_t SFI_MASK_TYPE = 0x00f0;
|
||||
//const uint32_t SFI_MASK_FT = 0x0f00;
|
||||
const uint32_t SFI_MASK_STATE = 0x000f;
|
||||
const uint32_t SFI_MASK_TYPE = 0x00f0;
|
||||
//const uint32_t SFI_MASK_FT = 0x0f00;
|
||||
const uint32_t SFI_MASK_FLAG = 0xf000;
|
||||
|
||||
const uint32_t SFI_STATE_ERROR = 0x0001;
|
||||
const uint32_t SFI_STATE_EXTRA = 0x0002;
|
||||
const uint32_t SFI_STATE_REMOTE = 0x0003;
|
||||
const uint32_t SFI_STATE_DOWNLOAD = 0x0004;
|
||||
const uint32_t SFI_STATE_LOCAL = 0x0005;
|
||||
const uint32_t SFI_STATE_UPLOAD = 0x0006;
|
||||
const uint32_t SFI_STATE_ERROR = 0x0001;
|
||||
const uint32_t SFI_STATE_EXTRA = 0x0002;
|
||||
const uint32_t SFI_STATE_REMOTE = 0x0003;
|
||||
const uint32_t SFI_STATE_DOWNLOAD = 0x0004;
|
||||
const uint32_t SFI_STATE_LOCAL = 0x0005;
|
||||
const uint32_t SFI_STATE_UPLOAD = 0x0006;
|
||||
|
||||
const uint32_t SFI_TYPE_CHANNEL = 0x0010;
|
||||
const uint32_t SFI_TYPE_ATTACH = 0x0020;
|
||||
const uint32_t SFI_TYPE_CHANNEL = 0x0010;
|
||||
const uint32_t SFI_TYPE_ATTACH = 0x0020;
|
||||
|
||||
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
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
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);
|
||||
|
||||
/** Default Destructor */
|
||||
|
||||
void smaller();
|
||||
void smaller();
|
||||
|
||||
std::string FileHash() { return mFileHash; }
|
||||
std::string FileName() { return mFileName; }
|
||||
@ -68,14 +66,14 @@ public:
|
||||
|
||||
void updateItemStatic();
|
||||
|
||||
bool done();
|
||||
bool done();
|
||||
bool ready();
|
||||
uint32_t getState();
|
||||
|
||||
bool isDownloadable(bool &startable);
|
||||
bool isPlayable(bool &startable);
|
||||
|
||||
public slots:
|
||||
public slots:
|
||||
void download();
|
||||
void play();
|
||||
|
||||
@ -88,7 +86,6 @@ private slots:
|
||||
void updateItem();
|
||||
|
||||
private:
|
||||
|
||||
void Setup();
|
||||
|
||||
std::string mPath;
|
||||
@ -107,7 +104,6 @@ private:
|
||||
|
||||
signals:
|
||||
void fileFinished(SubFileItem * subFileItem);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user