From ff0d6ff25a87026f4900dd2a4cb108e2d51d4201 Mon Sep 17 00:00:00 2001 From: thunder2 Date: Wed, 1 Feb 2012 12:21:14 +0000 Subject: [PATCH] Optimized some internals in the news feed items - std::string -> const std::string& - QObjectList -> QSet git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4870 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/NewsFeed.cpp | 32 +++++++---------- retroshare-gui/src/gui/NewsFeed.h | 4 +-- retroshare-gui/src/gui/feeds/AttachFileItem.h | 2 -- retroshare-gui/src/gui/feeds/BlogMsgItem.h | 16 ++++----- retroshare-gui/src/gui/feeds/BlogNewItem.h | 16 ++++----- retroshare-gui/src/gui/feeds/ChanMsgItem.cpp | 2 +- retroshare-gui/src/gui/feeds/ChanMsgItem.h | 2 +- retroshare-gui/src/gui/feeds/ChanNewItem.cpp | 2 +- retroshare-gui/src/gui/feeds/ChanNewItem.h | 14 +++----- retroshare-gui/src/gui/feeds/ChatMsgItem.cpp | 7 ++-- retroshare-gui/src/gui/feeds/ChatMsgItem.h | 15 +++----- retroshare-gui/src/gui/feeds/FeedHolder.h | 11 +++--- retroshare-gui/src/gui/feeds/ForumMsgItem.h | 10 ++---- retroshare-gui/src/gui/feeds/ForumNewItem.cpp | 3 +- retroshare-gui/src/gui/feeds/ForumNewItem.h | 14 +++----- retroshare-gui/src/gui/feeds/MsgItem.cpp | 2 +- retroshare-gui/src/gui/feeds/MsgItem.h | 16 ++++----- retroshare-gui/src/gui/feeds/PeerItem.cpp | 22 ++++++------ retroshare-gui/src/gui/feeds/PeerItem.h | 22 +++++------- retroshare-gui/src/gui/feeds/SecurityItem.cpp | 2 +- retroshare-gui/src/gui/feeds/SecurityItem.h | 4 +-- retroshare-gui/src/gui/feeds/SubDestItem.cpp | 2 +- retroshare-gui/src/gui/feeds/SubDestItem.h | 14 +++----- retroshare-gui/src/gui/feeds/SubFileItem.h | 36 +++++++++---------- 24 files changed, 105 insertions(+), 165 deletions(-) diff --git a/retroshare-gui/src/gui/NewsFeed.cpp b/retroshare-gui/src/gui/NewsFeed.cpp index be642f313..90c46c385 100644 --- a/retroshare-gui/src/gui/NewsFeed.cpp +++ b/retroshare-gui/src/gui/NewsFeed.cpp @@ -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,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; - for (it = widgetList.begin(); it != widgetList.end(); it++) - { - SecurityItem *secitem = dynamic_cast(*it); + foreach (QObject *itemObject, widgets) { + SecurityItem *secitem = dynamic_cast(itemObject); if ((secitem) && (secitem->isSame(sslId, itemType))) { if (!replace) - { + { delete item; return; } @@ -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(*it) == NULL) { + foreach (QObject *item, widgets) { + if (dynamic_cast(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); } diff --git a/retroshare-gui/src/gui/NewsFeed.h b/retroshare-gui/src/gui/NewsFeed.h index 6454b5454..95bb8c0c5 100644 --- a/retroshare-gui/src/gui/NewsFeed.h +++ b/retroshare-gui/src/gui/NewsFeed.h @@ -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 widgets; /* lists of feedItems */ std::list mForumNewItems; diff --git a/retroshare-gui/src/gui/feeds/AttachFileItem.h b/retroshare-gui/src/gui/feeds/AttachFileItem.h index 3f98c8e79..f15305a71 100644 --- a/retroshare-gui/src/gui/feeds/AttachFileItem.h +++ b/retroshare-gui/src/gui/feeds/AttachFileItem.h @@ -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; } diff --git a/retroshare-gui/src/gui/feeds/BlogMsgItem.h b/retroshare-gui/src/gui/feeds/BlogMsgItem.h index 0165b4f03..b89e21a59 100644 --- a/retroshare-gui/src/gui/feeds/BlogMsgItem.h +++ b/retroshare-gui/src/gui/feeds/BlogMsgItem.h @@ -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 mFileItems; }; - - #endif diff --git a/retroshare-gui/src/gui/feeds/BlogNewItem.h b/retroshare-gui/src/gui/feeds/BlogNewItem.h index 562533805..93f7781da 100644 --- a/retroshare-gui/src/gui/feeds/BlogNewItem.h +++ b/retroshare-gui/src/gui/feeds/BlogNewItem.h @@ -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 diff --git a/retroshare-gui/src/gui/feeds/ChanMsgItem.cpp b/retroshare-gui/src/gui/feeds/ChanMsgItem.cpp index cb5ccc42b..fde4165f4 100644 --- a/retroshare-gui/src/gui/feeds/ChanMsgItem.cpp +++ b/retroshare-gui/src/gui/feeds/ChanMsgItem.cpp @@ -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) { diff --git a/retroshare-gui/src/gui/feeds/ChanMsgItem.h b/retroshare-gui/src/gui/feeds/ChanMsgItem.h index 67ade9512..e4cca4a93 100644 --- a/retroshare-gui/src/gui/feeds/ChanMsgItem.h +++ b/retroshare-gui/src/gui/feeds/ChanMsgItem.h @@ -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(); diff --git a/retroshare-gui/src/gui/feeds/ChanNewItem.cpp b/retroshare-gui/src/gui/feeds/ChanNewItem.cpp index ecedefe66..81a88c1c3 100644 --- a/retroshare-gui/src/gui/feeds/ChanNewItem.cpp +++ b/retroshare-gui/src/gui/feeds/ChanNewItem.cpp @@ -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) { diff --git a/retroshare-gui/src/gui/feeds/ChanNewItem.h b/retroshare-gui/src/gui/feeds/ChanNewItem.h index d373674fb..a265e02f4 100644 --- a/retroshare-gui/src/gui/feeds/ChanNewItem.h +++ b/retroshare-gui/src/gui/feeds/ChanNewItem.h @@ -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 diff --git a/retroshare-gui/src/gui/feeds/ChatMsgItem.cpp b/retroshare-gui/src/gui/feeds/ChatMsgItem.cpp index f24be8384..d61f64dcb 100644 --- a/retroshare-gui/src/gui/feeds/ChatMsgItem.cpp +++ b/retroshare-gui/src/gui/feeds/ChatMsgItem.cpp @@ -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; diff --git a/retroshare-gui/src/gui/feeds/ChatMsgItem.h b/retroshare-gui/src/gui/feeds/ChatMsgItem.h index 5446aab36..f5d4e30e7 100644 --- a/retroshare-gui/src/gui/feeds/ChatMsgItem.h +++ b/retroshare-gui/src/gui/feeds/ChatMsgItem.h @@ -25,19 +25,15 @@ #include "ui_ChatMsgItem.h" #include - 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 - diff --git a/retroshare-gui/src/gui/feeds/FeedHolder.h b/retroshare-gui/src/gui/feeds/FeedHolder.h index 67b658749..8e1a3d5dd 100644 --- a/retroshare-gui/src/gui/feeds/FeedHolder.h +++ b/retroshare-gui/src/gui/feeds/FeedHolder.h @@ -26,16 +26,15 @@ #include 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 diff --git a/retroshare-gui/src/gui/feeds/ForumMsgItem.h b/retroshare-gui/src/gui/feeds/ForumMsgItem.h index 20cbbcb5b..28ebeda4c 100644 --- a/retroshare-gui/src/gui/feeds/ForumMsgItem.h +++ b/retroshare-gui/src/gui/feeds/ForumMsgItem.h @@ -29,20 +29,18 @@ class FeedHolder; #include 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 diff --git a/retroshare-gui/src/gui/feeds/ForumNewItem.cpp b/retroshare-gui/src/gui/feeds/ForumNewItem.cpp index fd76c6fa9..8549e7200 100644 --- a/retroshare-gui/src/gui/feeds/ForumNewItem.cpp +++ b/retroshare-gui/src/gui/feeds/ForumNewItem.cpp @@ -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(); } } - diff --git a/retroshare-gui/src/gui/feeds/ForumNewItem.h b/retroshare-gui/src/gui/feeds/ForumNewItem.h index 58743af91..d349ab122 100644 --- a/retroshare-gui/src/gui/feeds/ForumNewItem.h +++ b/retroshare-gui/src/gui/feeds/ForumNewItem.h @@ -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 diff --git a/retroshare-gui/src/gui/feeds/MsgItem.cpp b/retroshare-gui/src/gui/feeds/MsgItem.cpp index 7f234e225..bf9aed913 100644 --- a/retroshare-gui/src/gui/feeds/MsgItem.cpp +++ b/retroshare-gui/src/gui/feeds/MsgItem.cpp @@ -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 */ diff --git a/retroshare-gui/src/gui/feeds/MsgItem.h b/retroshare-gui/src/gui/feeds/MsgItem.h index 2e7f04cc2..e1d0e52ba 100644 --- a/retroshare-gui/src/gui/feeds/MsgItem.h +++ b/retroshare-gui/src/gui/feeds/MsgItem.h @@ -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 mFileItems; }; - - #endif diff --git a/retroshare-gui/src/gui/feeds/PeerItem.cpp b/retroshare-gui/src/gui/feeds/PeerItem.cpp index 222f707ae..a3eb7a0da 100644 --- a/retroshare-gui/src/gui/feeds/PeerItem.cpp +++ b/retroshare-gui/src/gui/feeds/PeerItem.cpp @@ -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() @@ -328,7 +328,7 @@ void PeerItem::sendMessage() mi.title = tr("Quick Message").toStdWString(); mi.msg = quickmsgText->toHtml().toStdWString(); - mi.msgto.push_back(mPeerId); + mi.msgto.push_back(mPeerId); rsMsgs->MessageSend(mi); diff --git a/retroshare-gui/src/gui/feeds/PeerItem.h b/retroshare-gui/src/gui/feeds/PeerItem.h index 012a32f74..882c2fe57 100644 --- a/retroshare-gui/src/gui/feeds/PeerItem.h +++ b/retroshare-gui/src/gui/feeds/PeerItem.h @@ -25,30 +25,27 @@ #include "ui_PeerItem.h" #include -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(); @@ -57,13 +54,12 @@ private slots: void openChat(); 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 diff --git a/retroshare-gui/src/gui/feeds/SecurityItem.cpp b/retroshare-gui/src/gui/feeds/SecurityItem.cpp index 89232a12e..88c162059 100644 --- a/retroshare-gui/src/gui/feeds/SecurityItem.cpp +++ b/retroshare-gui/src/gui/feeds/SecurityItem.cpp @@ -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) { diff --git a/retroshare-gui/src/gui/feeds/SecurityItem.h b/retroshare-gui/src/gui/feeds/SecurityItem.h index e087b48c3..c17a0da8a 100644 --- a/retroshare-gui/src/gui/feeds/SecurityItem.h +++ b/retroshare-gui/src/gui/feeds/SecurityItem.h @@ -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 diff --git a/retroshare-gui/src/gui/feeds/SubDestItem.cpp b/retroshare-gui/src/gui/feeds/SubDestItem.cpp index dd5bb5583..028ae574e 100644 --- a/retroshare-gui/src/gui/feeds/SubDestItem.cpp +++ b/retroshare-gui/src/gui/feeds/SubDestItem.cpp @@ -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 */ diff --git a/retroshare-gui/src/gui/feeds/SubDestItem.h b/retroshare-gui/src/gui/feeds/SubDestItem.h index df347ae9b..57f5038af 100644 --- a/retroshare-gui/src/gui/feeds/SubDestItem.h +++ b/retroshare-gui/src/gui/feeds/SubDestItem.h @@ -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 diff --git a/retroshare-gui/src/gui/feeds/SubFileItem.h b/retroshare-gui/src/gui/feeds/SubFileItem.h index 6790ad97d..936b92480 100644 --- a/retroshare-gui/src/gui/feeds/SubFileItem.h +++ b/retroshare-gui/src/gui/feeds/SubFileItem.h @@ -24,20 +24,20 @@ #include "ui_SubFileItem.h" #include -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