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()
{
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<RsGxsMessageId> & 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<RsGxsGrpMsgIdPair> ids_to_ask;
for(std::set<RsGxsMessageId>::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<RsGxsMessageId, QTreeWidgetItem *>::iterator lit;
std::multimap<RsGxsMessageId, QTreeWidgetItem *>::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)
{

View File

@ -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<mPosts.size();++i)
for(uint32_t i=0;i<mPosts.size();++i)
mFilteredPosts.push_back(i);
#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)
{
// 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;
}
}
});
}