removed some debug output and some compiler warnings

This commit is contained in:
csoler 2020-09-10 20:16:10 +02:00
parent 8d6bd1a0b8
commit d74c113e92
2 changed files with 47 additions and 23 deletions

View file

@ -228,8 +228,10 @@ void GxsCommentTreeWidget::customPopUpMenu(const QPoint& /*point*/)
void GxsCommentTreeWidget::voteUp() void GxsCommentTreeWidget::voteUp()
{ {
#ifdef DEBUG_GXSCOMMENT_TREEWIDGET
std::cerr << "GxsCommentTreeWidget::voteUp()"; std::cerr << "GxsCommentTreeWidget::voteUp()";
std::cerr << std::endl; std::cerr << std::endl;
#endif
vote(mGroupId, mLatestMsgId, mCurrentCommentMsgId, mVoterId, true); vote(mGroupId, mLatestMsgId, mCurrentCommentMsgId, mVoterId, true);
} }
@ -237,8 +239,10 @@ void GxsCommentTreeWidget::voteUp()
void GxsCommentTreeWidget::voteDown() void GxsCommentTreeWidget::voteDown()
{ {
#ifdef DEBUG_GXSCOMMENT_TREEWIDGET
std::cerr << "GxsCommentTreeWidget::voteDown()"; std::cerr << "GxsCommentTreeWidget::voteDown()";
std::cerr << std::endl; std::cerr << std::endl;
#endif
vote(mGroupId, mLatestMsgId, mCurrentCommentMsgId, mVoterId, false); vote(mGroupId, mLatestMsgId, mCurrentCommentMsgId, mVoterId, false);
} }
@ -246,8 +250,10 @@ void GxsCommentTreeWidget::voteDown()
void GxsCommentTreeWidget::setVoteId(const RsGxsId &voterId) void GxsCommentTreeWidget::setVoteId(const RsGxsId &voterId)
{ {
mVoterId = voterId; mVoterId = voterId;
#ifdef DEBUG_GXSCOMMENT_TREEWIDGET
std::cerr << "GxsCommentTreeWidget::setVoterId(" << mVoterId << ")"; std::cerr << "GxsCommentTreeWidget::setVoterId(" << mVoterId << ")";
std::cerr << std::endl; std::cerr << std::endl;
#endif
} }
@ -270,6 +276,7 @@ void GxsCommentTreeWidget::vote(const RsGxsGroupId &groupId, const RsGxsMessageI
vote.mVoteType = GXS_VOTE_DOWN; vote.mVoteType = GXS_VOTE_DOWN;
} }
#ifdef DEBUG_GXSCOMMENT_TREEWIDGET
std::cerr << "GxsCommentTreeWidget::vote()"; std::cerr << "GxsCommentTreeWidget::vote()";
std::cerr << std::endl; 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 << "ThreadId : " << vote.mMeta.mThreadId << std::endl;
std::cerr << "ParentId : " << vote.mMeta.mParentId << std::endl; std::cerr << "ParentId : " << vote.mMeta.mParentId << std::endl;
std::cerr << "AuthorId : " << vote.mMeta.mAuthorId << std::endl; std::cerr << "AuthorId : " << vote.mMeta.mAuthorId << std::endl;
#endif
uint32_t token; uint32_t token;
mCommentService->createNewVote(token, vote); 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<RsGxsMessageId> & msgIds) void GxsCommentTreeWidget::service_requestComments(const RsGxsGroupId& group_id,const std::set<RsGxsMessageId> & msgIds)
{ {
/* request comments */ /* request comments */
#ifdef DEBUG_GXSCOMMENT_TREEWIDGET
std::cerr << "GxsCommentTreeWidget::service_requestComments for group " << group_id << std::endl; std::cerr << "GxsCommentTreeWidget::service_requestComments for group " << group_id << std::endl;
#endif
std::vector<RsGxsGrpMsgIdPair> ids_to_ask; std::vector<RsGxsGrpMsgIdPair> ids_to_ask;
for(std::set<RsGxsMessageId>::const_iterator it(msgIds.begin());it!=msgIds.end();++it) for(std::set<RsGxsMessageId>::const_iterator it(msgIds.begin());it!=msgIds.end();++it)
{ {
#ifdef DEBUG_GXSCOMMENT_TREEWIDGET
std::cerr << " asking for msg " << *it << std::endl; std::cerr << " asking for msg " << *it << std::endl;
#endif
ids_to_ask.push_back(std::make_pair(group_id,*it)); ids_to_ask.push_back(std::make_pair(group_id,*it));
} }
@ -399,14 +411,18 @@ void GxsCommentTreeWidget::completeItems()
std::map<RsGxsMessageId, QTreeWidgetItem *>::iterator lit; std::map<RsGxsMessageId, QTreeWidgetItem *>::iterator lit;
std::multimap<RsGxsMessageId, QTreeWidgetItem *>::iterator pit; std::multimap<RsGxsMessageId, QTreeWidgetItem *>::iterator pit;
#ifdef DEBUG_GXSCOMMENT_TREEWIDGET
std::cerr << "GxsCommentTreeWidget::completeItems() " << mPendingInsertMap.size(); std::cerr << "GxsCommentTreeWidget::completeItems() " << mPendingInsertMap.size();
std::cerr << " PendingItems"; std::cerr << " PendingItems";
std::cerr << std::endl; std::cerr << std::endl;
#endif
for(pit = mPendingInsertMap.begin(); pit != mPendingInsertMap.end(); ++pit) for(pit = mPendingInsertMap.begin(); pit != mPendingInsertMap.end(); ++pit)
{ {
#ifdef DEBUG_GXSCOMMENT_TREEWIDGET
std::cerr << "GxsCommentTreeWidget::completeItems() item->parent: " << pit->first; std::cerr << "GxsCommentTreeWidget::completeItems() item->parent: " << pit->first;
std::cerr << std::endl; std::cerr << std::endl;
#endif
if (pit->first != parentId) if (pit->first != parentId)
{ {
@ -425,15 +441,19 @@ void GxsCommentTreeWidget::completeItems()
if (parent) if (parent)
{ {
#ifdef DEBUG_GXSCOMMENT_TREEWIDGET
std::cerr << "GxsCommentTreeWidget::completeItems() Added to Parent"; std::cerr << "GxsCommentTreeWidget::completeItems() Added to Parent";
std::cerr << std::endl; std::cerr << std::endl;
#endif
parent->addChild(pit->second); parent->addChild(pit->second);
} }
else if (mMsgVersions.find(parentId) != mMsgVersions.end()) else if (mMsgVersions.find(parentId) != mMsgVersions.end())
{ {
#ifdef DEBUG_GXSCOMMENT_TREEWIDGET
std::cerr << "GxsCommentTreeWidget::completeItems() Added to topLevelItems"; std::cerr << "GxsCommentTreeWidget::completeItems() Added to topLevelItems";
std::cerr << std::endl; std::cerr << std::endl;
#endif
topLevelItems.append(pit->second); topLevelItems.append(pit->second);
} }
@ -443,8 +463,10 @@ void GxsCommentTreeWidget::completeItems()
/* missing parent -> insert At Top Level */ /* missing parent -> insert At Top Level */
QTreeWidgetItem *missingItem = service_createMissingItem(pit->first); QTreeWidgetItem *missingItem = service_createMissingItem(pit->first);
#ifdef DEBUG_GXSCOMMENT_TREEWIDGET
std::cerr << "GxsCommentTreeWidget::completeItems() Added MissingItem"; std::cerr << "GxsCommentTreeWidget::completeItems() Added MissingItem";
std::cerr << std::endl; std::cerr << std::endl;
#endif
parent = missingItem; parent = missingItem;
parent->addChild(pit->second); parent->addChild(pit->second);
@ -464,9 +486,11 @@ void GxsCommentTreeWidget::completeItems()
void GxsCommentTreeWidget::addItem(RsGxsMessageId itemId, RsGxsMessageId parentId, QTreeWidgetItem *item) void GxsCommentTreeWidget::addItem(RsGxsMessageId itemId, RsGxsMessageId parentId, QTreeWidgetItem *item)
{ {
#ifdef DEBUG_GXSCOMMENT_TREEWIDGET
std::cerr << "GxsCommentTreeWidget::addItem() Id: " << itemId; std::cerr << "GxsCommentTreeWidget::addItem() Id: " << itemId;
std::cerr << " ParentId: " << parentId; std::cerr << " ParentId: " << parentId;
std::cerr << std::endl; std::cerr << std::endl;
#endif
/* store in map -> for children */ /* store in map -> for children */
mLoadingMap[itemId] = item; mLoadingMap[itemId] = item;
@ -475,15 +499,19 @@ void GxsCommentTreeWidget::addItem(RsGxsMessageId itemId, RsGxsMessageId parentI
it = mLoadingMap.find(parentId); it = mLoadingMap.find(parentId);
if (it != mLoadingMap.end()) if (it != mLoadingMap.end())
{ {
#ifdef DEBUG_GXSCOMMENT_TREEWIDGET
std::cerr << "GxsCommentTreeWidget::addItem() Added to Parent"; std::cerr << "GxsCommentTreeWidget::addItem() Added to Parent";
std::cerr << std::endl; std::cerr << std::endl;
#endif
it->second->addChild(item); it->second->addChild(item);
} }
else else
{ {
#ifdef DEBUG_GXSCOMMENT_TREEWIDGET
std::cerr << "GxsCommentTreeWidget::addItem() Added to Pending List"; std::cerr << "GxsCommentTreeWidget::addItem() Added to Pending List";
std::cerr << std::endl; std::cerr << std::endl;
#endif
mPendingInsertMap.insert(std::make_pair(parentId, item)); 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) void GxsCommentTreeWidget::loadRequest(const TokenQueue *queue, const TokenRequest &req)
{ {
#ifdef DEBUG_GXSCOMMENT_TREEWIDGET
std::cerr << "GxsCommentTreeWidget::loadRequest() UserType: " << req.mUserType; std::cerr << "GxsCommentTreeWidget::loadRequest() UserType: " << req.mUserType;
std::cerr << std::endl; std::cerr << std::endl;
#endif
if (queue != mTokenQueue) if (queue != mTokenQueue)
{ {

View file

@ -212,10 +212,12 @@ int RsGxsChannelPostsModel::rowCount(const QModelIndex& parent) const
return 0; return 0;
if(!parent.isValid()) if(!parent.isValid())
{
if(mTreeMode == TREE_MODE_GRID) if(mTreeMode == TREE_MODE_GRID)
return (mFilteredPosts.size() + mColumns-1)/mColumns; // mFilteredPosts always has an item at 0, so size()>=1, and mColumn>=1 return (mFilteredPosts.size() + mColumns-1)/mColumns; // mFilteredPosts always has an item at 0, so size()>=1, and mColumn>=1
else else
return mFilteredPosts.size(); return mFilteredPosts.size();
}
RsErr() << __PRETTY_FUNCTION__ << " rowCount cannot figure out the porper number of rows." << std::endl; RsErr() << __PRETTY_FUNCTION__ << " rowCount cannot figure out the porper number of rows." << std::endl;
return 0; return 0;
@ -372,8 +374,6 @@ quintptr RsGxsChannelPostsModel::getParentRow(quintptr ref,int& row) const
int RsGxsChannelPostsModel::getChildrenCount(quintptr ref) const int RsGxsChannelPostsModel::getChildrenCount(quintptr ref) const
{ {
uint32_t entry = 0 ;
if(ref == quintptr(0)) if(ref == quintptr(0))
return rowCount()-1; 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 ; 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()); std::sort(mPosts.begin(),mPosts.end());
mFilteredPosts.clear(); mFilteredPosts.clear();
for(int i=0;i<mPosts.size();++i) for(uint32_t i=0;i<mPosts.size();++i)
mFilteredPosts.push_back(i); mFilteredPosts.push_back(i);
#ifdef DEBUG_CHANNEL_MODEL #ifdef DEBUG_CHANNEL_MODEL
@ -573,8 +573,6 @@ void RsGxsChannelPostsModel::update_posts(const RsGxsGroupId& group_id)
}); });
} }
static bool decreasing_time_comp(const std::pair<time_t,RsGxsMessageId>& e1,const std::pair<time_t,RsGxsMessageId>& e2) { return e2.first < e1.first ; }
void RsGxsChannelPostsModel::createPostsArray(std::vector<RsGxsChannelPost>& posts) void RsGxsChannelPostsModel::createPostsArray(std::vector<RsGxsChannelPost>& posts)
{ {
// collect new versions of posts if any // collect new versions of posts if any
@ -705,13 +703,9 @@ void RsGxsChannelPostsModel::setAllMsgReadStatus(bool read_status)
bool post_status = !((IS_MSG_UNREAD(mPosts[i].mMeta.mMsgStatus) || IS_MSG_NEW(mPosts[i].mMeta.mMsgStatus))); bool post_status = !((IS_MSG_UNREAD(mPosts[i].mMeta.mMsgStatus) || IS_MSG_NEW(mPosts[i].mMeta.mMsgStatus)));
if(post_status != read_status) 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)) 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; RsErr() << "setAllMsgReadStatus: failed to change status of msg " << mPosts[i].mMeta.mMsgId << " in group " << mPosts[i].mMeta.mGroupId << " to status " << read_status << std::endl;
} }
}
}); });
} }