From d74c113e92ace99031afe42ea26cda39420b3775 Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 10 Sep 2020 20:16:10 +0200 Subject: [PATCH] removed some debug output and some compiler warnings --- .../src/gui/gxs/GxsCommentTreeWidget.cpp | 56 ++++++++++++++----- .../gui/gxschannels/GxsChannelPostsModel.cpp | 14 ++--- 2 files changed, 47 insertions(+), 23 deletions(-) diff --git a/retroshare-gui/src/gui/gxs/GxsCommentTreeWidget.cpp b/retroshare-gui/src/gui/gxs/GxsCommentTreeWidget.cpp index f73126d53..cc2087044 100644 --- a/retroshare-gui/src/gui/gxs/GxsCommentTreeWidget.cpp +++ b/retroshare-gui/src/gui/gxs/GxsCommentTreeWidget.cpp @@ -228,8 +228,10 @@ void GxsCommentTreeWidget::customPopUpMenu(const QPoint& /*point*/) void GxsCommentTreeWidget::voteUp() { - std::cerr << "GxsCommentTreeWidget::voteUp()"; +#ifdef DEBUG_GXSCOMMENT_TREEWIDGET + std::cerr << "GxsCommentTreeWidget::voteUp()"; std::cerr << std::endl; +#endif vote(mGroupId, mLatestMsgId, mCurrentCommentMsgId, mVoterId, true); } @@ -237,8 +239,10 @@ void GxsCommentTreeWidget::voteUp() void GxsCommentTreeWidget::voteDown() { - std::cerr << "GxsCommentTreeWidget::voteDown()"; +#ifdef DEBUG_GXSCOMMENT_TREEWIDGET + std::cerr << "GxsCommentTreeWidget::voteDown()"; std::cerr << std::endl; +#endif vote(mGroupId, mLatestMsgId, mCurrentCommentMsgId, mVoterId, false); } @@ -246,8 +250,10 @@ void GxsCommentTreeWidget::voteDown() void GxsCommentTreeWidget::setVoteId(const RsGxsId &voterId) { mVoterId = voterId; - std::cerr << "GxsCommentTreeWidget::setVoterId(" << mVoterId << ")"; +#ifdef DEBUG_GXSCOMMENT_TREEWIDGET + std::cerr << "GxsCommentTreeWidget::setVoterId(" << mVoterId << ")"; std::cerr << std::endl; +#endif } @@ -270,6 +276,7 @@ void GxsCommentTreeWidget::vote(const RsGxsGroupId &groupId, const RsGxsMessageI vote.mVoteType = GXS_VOTE_DOWN; } +#ifdef DEBUG_GXSCOMMENT_TREEWIDGET std::cerr << "GxsCommentTreeWidget::vote()"; std::cerr << std::endl; @@ -277,6 +284,7 @@ void GxsCommentTreeWidget::vote(const RsGxsGroupId &groupId, const RsGxsMessageI std::cerr << "ThreadId : " << vote.mMeta.mThreadId << std::endl; std::cerr << "ParentId : " << vote.mMeta.mParentId << std::endl; std::cerr << "AuthorId : " << vote.mMeta.mAuthorId << std::endl; +#endif uint32_t token; mCommentService->createNewVote(token, vote); @@ -361,13 +369,17 @@ void GxsCommentTreeWidget::requestComments(const RsGxsGroupId& group, const std: void GxsCommentTreeWidget::service_requestComments(const RsGxsGroupId& group_id,const std::set & msgIds) { /* request comments */ - std::cerr << "GxsCommentTreeWidget::service_requestComments for group " << group_id << std::endl; +#ifdef DEBUG_GXSCOMMENT_TREEWIDGET + std::cerr << "GxsCommentTreeWidget::service_requestComments for group " << group_id << std::endl; +#endif std::vector ids_to_ask; for(std::set::const_iterator it(msgIds.begin());it!=msgIds.end();++it) { - std::cerr << " asking for msg " << *it << std::endl; +#ifdef DEBUG_GXSCOMMENT_TREEWIDGET + std::cerr << " asking for msg " << *it << std::endl; +#endif ids_to_ask.push_back(std::make_pair(group_id,*it)); } @@ -399,14 +411,18 @@ void GxsCommentTreeWidget::completeItems() std::map::iterator lit; std::multimap::iterator pit; - std::cerr << "GxsCommentTreeWidget::completeItems() " << mPendingInsertMap.size(); +#ifdef DEBUG_GXSCOMMENT_TREEWIDGET + std::cerr << "GxsCommentTreeWidget::completeItems() " << mPendingInsertMap.size(); std::cerr << " PendingItems"; std::cerr << std::endl; +#endif for(pit = mPendingInsertMap.begin(); pit != mPendingInsertMap.end(); ++pit) { - std::cerr << "GxsCommentTreeWidget::completeItems() item->parent: " << pit->first; +#ifdef DEBUG_GXSCOMMENT_TREEWIDGET + std::cerr << "GxsCommentTreeWidget::completeItems() item->parent: " << pit->first; std::cerr << std::endl; +#endif if (pit->first != parentId) { @@ -425,15 +441,19 @@ void GxsCommentTreeWidget::completeItems() if (parent) { - std::cerr << "GxsCommentTreeWidget::completeItems() Added to Parent"; +#ifdef DEBUG_GXSCOMMENT_TREEWIDGET + std::cerr << "GxsCommentTreeWidget::completeItems() Added to Parent"; std::cerr << std::endl; +#endif parent->addChild(pit->second); } else if (mMsgVersions.find(parentId) != mMsgVersions.end()) { - std::cerr << "GxsCommentTreeWidget::completeItems() Added to topLevelItems"; +#ifdef DEBUG_GXSCOMMENT_TREEWIDGET + std::cerr << "GxsCommentTreeWidget::completeItems() Added to topLevelItems"; std::cerr << std::endl; +#endif topLevelItems.append(pit->second); } @@ -443,8 +463,10 @@ void GxsCommentTreeWidget::completeItems() /* missing parent -> insert At Top Level */ QTreeWidgetItem *missingItem = service_createMissingItem(pit->first); - std::cerr << "GxsCommentTreeWidget::completeItems() Added MissingItem"; +#ifdef DEBUG_GXSCOMMENT_TREEWIDGET + std::cerr << "GxsCommentTreeWidget::completeItems() Added MissingItem"; std::cerr << std::endl; +#endif parent = missingItem; parent->addChild(pit->second); @@ -464,9 +486,11 @@ void GxsCommentTreeWidget::completeItems() void GxsCommentTreeWidget::addItem(RsGxsMessageId itemId, RsGxsMessageId parentId, QTreeWidgetItem *item) { - std::cerr << "GxsCommentTreeWidget::addItem() Id: " << itemId; +#ifdef DEBUG_GXSCOMMENT_TREEWIDGET + std::cerr << "GxsCommentTreeWidget::addItem() Id: " << itemId; std::cerr << " ParentId: " << parentId; std::cerr << std::endl; +#endif /* store in map -> for children */ mLoadingMap[itemId] = item; @@ -475,15 +499,19 @@ void GxsCommentTreeWidget::addItem(RsGxsMessageId itemId, RsGxsMessageId parentI it = mLoadingMap.find(parentId); if (it != mLoadingMap.end()) { - std::cerr << "GxsCommentTreeWidget::addItem() Added to Parent"; +#ifdef DEBUG_GXSCOMMENT_TREEWIDGET + std::cerr << "GxsCommentTreeWidget::addItem() Added to Parent"; std::cerr << std::endl; +#endif it->second->addChild(item); } else { - std::cerr << "GxsCommentTreeWidget::addItem() Added to Pending List"; +#ifdef DEBUG_GXSCOMMENT_TREEWIDGET + std::cerr << "GxsCommentTreeWidget::addItem() Added to Pending List"; std::cerr << std::endl; +#endif mPendingInsertMap.insert(std::make_pair(parentId, item)); } @@ -641,8 +669,10 @@ QTreeWidgetItem *GxsCommentTreeWidget::service_createMissingItem(const RsGxsMess void GxsCommentTreeWidget::loadRequest(const TokenQueue *queue, const TokenRequest &req) { +#ifdef DEBUG_GXSCOMMENT_TREEWIDGET std::cerr << "GxsCommentTreeWidget::loadRequest() UserType: " << req.mUserType; std::cerr << std::endl; +#endif if (queue != mTokenQueue) { diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsModel.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsModel.cpp index 6bb708ffd..a21d6ff90 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsModel.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsModel.cpp @@ -212,10 +212,12 @@ int RsGxsChannelPostsModel::rowCount(const QModelIndex& parent) const return 0; if(!parent.isValid()) + { if(mTreeMode == TREE_MODE_GRID) return (mFilteredPosts.size() + mColumns-1)/mColumns; // mFilteredPosts always has an item at 0, so size()>=1, and mColumn>=1 else return mFilteredPosts.size(); + } RsErr() << __PRETTY_FUNCTION__ << " rowCount cannot figure out the porper number of rows." << std::endl; return 0; @@ -372,8 +374,6 @@ quintptr RsGxsChannelPostsModel::getParentRow(quintptr ref,int& row) const int RsGxsChannelPostsModel::getChildrenCount(quintptr ref) const { - uint32_t entry = 0 ; - if(ref == quintptr(0)) return rowCount()-1; @@ -430,7 +430,7 @@ QVariant RsGxsChannelPostsModel::data(const QModelIndex &index, int role) const } } -QVariant RsGxsChannelPostsModel::sizeHintRole(int col) const +QVariant RsGxsChannelPostsModel::sizeHintRole(int /* col */) const { float factor = QFontMetricsF(QApplication::font()).height()/14.0f ; @@ -502,7 +502,7 @@ void RsGxsChannelPostsModel::setPosts(const RsGxsChannelGroup& group, std::vecto std::sort(mPosts.begin(),mPosts.end()); mFilteredPosts.clear(); - for(int i=0;i& e1,const std::pair& e2) { return e2.first < e1.first ; } - void RsGxsChannelPostsModel::createPostsArray(std::vector& posts) { // collect new versions of posts if any @@ -705,12 +703,8 @@ void RsGxsChannelPostsModel::setAllMsgReadStatus(bool read_status) bool post_status = !((IS_MSG_UNREAD(mPosts[i].mMeta.mMsgStatus) || IS_MSG_NEW(mPosts[i].mMeta.mMsgStatus))); if(post_status != read_status) - { - std::cerr << "Switch read status of post " << mPosts[i].mMeta.mMsgId << std::endl; - if(!rsGxsChannels->markRead(RsGxsGrpMsgIdPair(mPosts[i].mMeta.mGroupId,mPosts[i].mMeta.mMsgId),read_status)) RsErr() << "setAllMsgReadStatus: failed to change status of msg " << mPosts[i].mMeta.mMsgId << " in group " << mPosts[i].mMeta.mGroupId << " to status " << read_status << std::endl; - } } }); }