removed some debug info

This commit is contained in:
csoler 2019-12-22 22:29:14 +01:00
parent 8f80db07c5
commit 1d9dc657fd
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C
3 changed files with 54 additions and 4 deletions

View File

@ -330,7 +330,9 @@ void NewsFeed::handleConnectionEvent(std::shared_ptr<const RsEvent> event)
auto& e(*pe); auto& e(*pe);
#ifdef NEWS_DEBUG
std::cerr << "NotifyQt: handling connection event from peer " << e.mSslId << std::endl; std::cerr << "NotifyQt: handling connection event from peer " << e.mSslId << std::endl;
#endif
switch(e.mConnectionInfoCode) switch(e.mConnectionInfoCode)
{ {
@ -355,8 +357,9 @@ void NewsFeed::handleSecurityEvent(std::shared_ptr<const RsEvent> event)
return; return;
auto& e(*pe); auto& e(*pe);
#ifdef NEWS_DEBUG
std::cerr << "NotifyQt: handling security event from (" << e.mSslId << "," << e.mPgpId << ") error code: " << (int)e.mErrorCode << std::endl; std::cerr << "NotifyQt: handling security event from (" << e.mSslId << "," << e.mPgpId << ") error code: " << (int)e.mErrorCode << std::endl;
#endif
uint flags = Settings->getNewsFeedFlags(); uint flags = Settings->getNewsFeedFlags();
if(e.mErrorCode == RsAuthSslConnectionAutenticationEvent::AuthenticationCode::PEER_REFUSED_CONNECTION) if(e.mErrorCode == RsAuthSslConnectionAutenticationEvent::AuthenticationCode::PEER_REFUSED_CONNECTION)
@ -438,7 +441,6 @@ void NewsFeed::addFeedItem(FeedItem *item)
{ {
static const int MAX_FEEDITEM_COUNT = 500 ; static const int MAX_FEEDITEM_COUNT = 500 ;
std::cerr << "Adding feed item thread " << pthread_self() << std::endl;
item->setAttribute(Qt::WA_DeleteOnClose, true); item->setAttribute(Qt::WA_DeleteOnClose, true);
// costly, but not really a problem here // costly, but not really a problem here
@ -462,7 +464,6 @@ void NewsFeed::addFeedItemIfUnique(FeedItem *item, bool replace)
{ {
FeedItem *feedItem = ui->feedWidget->findFeedItem(item->uniqueIdentifier()); FeedItem *feedItem = ui->feedWidget->findFeedItem(item->uniqueIdentifier());
std::cerr << "Adding feed item thread " << pthread_self() << std::endl;
if (feedItem) if (feedItem)
{ {
if (!replace) if (!replace)
@ -482,7 +483,6 @@ void NewsFeed::remUniqueFeedItem(FeedItem *item)
{ {
FeedItem *feedItem = ui->feedWidget->findFeedItem(item->uniqueIdentifier()); FeedItem *feedItem = ui->feedWidget->findFeedItem(item->uniqueIdentifier());
std::cerr << "Adding feed item thread " << pthread_self() << std::endl;
if (feedItem) if (feedItem)
{ {
delete item; delete item;

View File

@ -37,6 +37,8 @@
#define POSTED_DEFAULT_LISTING_LENGTH 10 #define POSTED_DEFAULT_LISTING_LENGTH 10
#define POSTED_MAX_INDEX 10000 #define POSTED_MAX_INDEX 10000
#define DEBUG_POSTED_LIST_WIDGET
#define TOPIC_DEFAULT_IMAGE ":/icons/png/posted.png" #define TOPIC_DEFAULT_IMAGE ":/icons/png/posted.png"
/** Constructor */ /** Constructor */
@ -143,15 +145,19 @@ QScrollArea *PostedListWidget::getScrollArea()
void PostedListWidget::deleteFeedItem(QWidget */*item*/, uint32_t /*type*/) void PostedListWidget::deleteFeedItem(QWidget */*item*/, uint32_t /*type*/)
{ {
#ifdef DEBUG_POSTED_LIST_WIDGET
std::cerr << "PostedListWidget::deleteFeedItem() Nah"; std::cerr << "PostedListWidget::deleteFeedItem() Nah";
std::cerr << std::endl; std::cerr << std::endl;
#endif
return; return;
} }
void PostedListWidget::openChat(const RsPeerId & /*peerId*/) void PostedListWidget::openChat(const RsPeerId & /*peerId*/)
{ {
#ifdef DEBUG_POSTED_LIST_WIDGET
std::cerr << "PostedListWidget::openChat() Nah"; std::cerr << "PostedListWidget::openChat() Nah";
std::cerr << std::endl; std::cerr << std::endl;
#endif
return; return;
} }
@ -207,8 +213,10 @@ void PostedListWidget::getRankings(int i)
if (groupId().isNull()) if (groupId().isNull())
return; return;
#ifdef DEBUG_POSTED_LIST_WIDGET
std::cerr << "PostedListWidget::getRankings()"; std::cerr << "PostedListWidget::getRankings()";
std::cerr << std::endl; std::cerr << std::endl;
#endif
int oldSortMethod = mSortMethod; int oldSortMethod = mSortMethod;
@ -268,6 +276,7 @@ void PostedListWidget::submitVote(const RsGxsGrpMsgIdPair &msgId, bool up)
vote.mVoteType = GXS_VOTE_DOWN; vote.mVoteType = GXS_VOTE_DOWN;
}//if (up) }//if (up)
#ifdef DEBUG_POSTED_LIST_WIDGET
std::cerr << "PostedListWidget::submitVote()"; std::cerr << "PostedListWidget::submitVote()";
std::cerr << std::endl; std::cerr << std::endl;
@ -275,6 +284,7 @@ void PostedListWidget::submitVote(const RsGxsGrpMsgIdPair &msgId, bool up)
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;
rsPosted->createNewVote(token, vote); rsPosted->createNewVote(token, vote);
@ -464,8 +474,10 @@ static bool CmpPINew(const GxsFeedItem *a, const GxsFeedItem *b)
void PostedListWidget::applyRanking() void PostedListWidget::applyRanking()
{ {
/* uses current settings to sort posts, then add to layout */ /* uses current settings to sort posts, then add to layout */
#ifdef DEBUG_POSTED_LIST_WIDGET
std::cerr << "PostedListWidget::applyRanking()"; std::cerr << "PostedListWidget::applyRanking()";
std::cerr << std::endl; std::cerr << std::endl;
#endif
shallowClearPosts(); shallowClearPosts();
@ -474,25 +486,33 @@ void PostedListWidget::applyRanking()
{ {
default: default:
case RsPosted::HotRankType: case RsPosted::HotRankType:
#ifdef DEBUG_POSTED_LIST_WIDGET
std::cerr << "PostedListWidget::applyRanking() HOT"; std::cerr << "PostedListWidget::applyRanking() HOT";
std::cerr << std::endl; std::cerr << std::endl;
#endif
qSort(mPostItems.begin(), mPostItems.end(), CmpPIHot); qSort(mPostItems.begin(), mPostItems.end(), CmpPIHot);
break; break;
case RsPosted::NewRankType: case RsPosted::NewRankType:
#ifdef DEBUG_POSTED_LIST_WIDGET
std::cerr << "PostedListWidget::applyRanking() NEW"; std::cerr << "PostedListWidget::applyRanking() NEW";
std::cerr << std::endl; std::cerr << std::endl;
#endif
qSort(mPostItems.begin(), mPostItems.end(), CmpPINew); qSort(mPostItems.begin(), mPostItems.end(), CmpPINew);
break; break;
case RsPosted::TopRankType: case RsPosted::TopRankType:
#ifdef DEBUG_POSTED_LIST_WIDGET
std::cerr << "PostedListWidget::applyRanking() TOP"; std::cerr << "PostedListWidget::applyRanking() TOP";
std::cerr << std::endl; std::cerr << std::endl;
#endif
qSort(mPostItems.begin(), mPostItems.end(), CmpPITop); qSort(mPostItems.begin(), mPostItems.end(), CmpPITop);
break; break;
} }
mLastSortMethod = mSortMethod; mLastSortMethod = mSortMethod;
#ifdef DEBUG_POSTED_LIST_WIDGET
std::cerr << "PostedListWidget::applyRanking() Sorted mPostList"; std::cerr << "PostedListWidget::applyRanking() Sorted mPostList";
std::cerr << std::endl; std::cerr << std::endl;
#endif
/* go through list (skipping out-of-date items) to get */ /* go through list (skipping out-of-date items) to get */
QLayout *alayout = ui->scrollAreaWidgetContents->layout(); QLayout *alayout = ui->scrollAreaWidgetContents->layout();
@ -500,42 +520,54 @@ void PostedListWidget::applyRanking()
time_t min_ts = 0; time_t min_ts = 0;
foreach (PostedItem *item, mPostItems) foreach (PostedItem *item, mPostItems)
{ {
#ifdef DEBUG_POSTED_LIST_WIDGET
std::cerr << "PostedListWidget::applyRanking() Item: " << item; std::cerr << "PostedListWidget::applyRanking() Item: " << item;
std::cerr << std::endl; std::cerr << std::endl;
#endif
if (item->getPost().mMeta.mPublishTs < min_ts) if (item->getPost().mMeta.mPublishTs < min_ts)
{ {
#ifdef DEBUG_POSTED_LIST_WIDGET
std::cerr << "\t Skipping OLD"; std::cerr << "\t Skipping OLD";
std::cerr << std::endl; std::cerr << std::endl;
#endif
item->hide(); item->hide();
continue; continue;
} }
if (counter >= mPostIndex + mPostShow) if (counter >= mPostIndex + mPostShow)
{ {
#ifdef DEBUG_POSTED_LIST_WIDGET
std::cerr << "\t END - Counter too high"; std::cerr << "\t END - Counter too high";
std::cerr << std::endl; std::cerr << std::endl;
#endif
item->hide(); item->hide();
} }
else if (counter >= mPostIndex) else if (counter >= mPostIndex)
{ {
#ifdef DEBUG_POSTED_LIST_WIDGET
std::cerr << "\t Adding to Layout"; std::cerr << "\t Adding to Layout";
std::cerr << std::endl; std::cerr << std::endl;
#endif
/* add it in! */ /* add it in! */
alayout->addWidget(item); alayout->addWidget(item);
item->show(); item->show();
} }
else else
{ {
#ifdef DEBUG_POSTED_LIST_WIDGET
std::cerr << "\t Skipping to Low"; std::cerr << "\t Skipping to Low";
std::cerr << std::endl; std::cerr << std::endl;
#endif
item->hide(); item->hide();
} }
++counter; ++counter;
} }
#ifdef DEBUG_POSTED_LIST_WIDGET
std::cerr << "PostedListWidget::applyRanking() Loaded New Order"; std::cerr << "PostedListWidget::applyRanking() Loaded New Order";
std::cerr << std::endl; std::cerr << std::endl;
#endif
// trigger a redraw. // trigger a redraw.
ui->scrollAreaWidgetContents->update(); ui->scrollAreaWidgetContents->update();
@ -564,7 +596,9 @@ bool PostedListWidget::navigatePostItem(const RsGxsMessageId & /*msgId*/)
void PostedListWidget::shallowClearPosts() void PostedListWidget::shallowClearPosts()
{ {
#ifdef DEBUG_POSTED_LIST_WIDGET
std::cerr << "PostedListWidget::shallowClearPosts()" << std::endl; std::cerr << "PostedListWidget::shallowClearPosts()" << std::endl;
#endif
std::list<PostedItem *> postedItems; std::list<PostedItem *> postedItems;
std::list<PostedItem *>::iterator pit; std::list<PostedItem *>::iterator pit;
@ -576,24 +610,30 @@ void PostedListWidget::shallowClearPosts()
QLayoutItem *litem = alayout->itemAt(i); QLayoutItem *litem = alayout->itemAt(i);
if (!litem) if (!litem)
{ {
#ifdef DEBUG_POSTED_LIST_WIDGET
std::cerr << "PostedListWidget::shallowClearPosts() missing litem"; std::cerr << "PostedListWidget::shallowClearPosts() missing litem";
std::cerr << std::endl; std::cerr << std::endl;
#endif
continue; continue;
} }
PostedItem *item = dynamic_cast<PostedItem *>(litem->widget()); PostedItem *item = dynamic_cast<PostedItem *>(litem->widget());
if (item) if (item)
{ {
#ifdef DEBUG_POSTED_LIST_WIDGET
std::cerr << "PostedListWidget::shallowClearPosts() item: " << item; std::cerr << "PostedListWidget::shallowClearPosts() item: " << item;
std::cerr << std::endl; std::cerr << std::endl;
#endif
postedItems.push_back(item); postedItems.push_back(item);
} }
#ifdef DEBUG_POSTED_LIST_WIDGET
else else
{ {
std::cerr << "PostedListWidget::shallowClearPosts() Found Child, which is not a PostedItem???"; std::cerr << "PostedListWidget::shallowClearPosts() Found Child, which is not a PostedItem???";
std::cerr << std::endl; std::cerr << std::endl;
} }
#endif
} }
for(pit = postedItems.begin(); pit != postedItems.end(); ++pit) for(pit = postedItems.begin(); pit != postedItems.end(); ++pit)
@ -646,15 +686,19 @@ void PostedListWidget::insertPosts(const uint32_t &token)
// modify post content // modify post content
if(mPosts.find(p.mMeta.mMsgId) != mPosts.end()) if(mPosts.find(p.mMeta.mMsgId) != mPosts.end())
{ {
#ifdef DEBUG_POSTED_LIST_WIDGET
std::cerr << "PostedListWidget::updateCurrentDisplayComplete() updating MsgId: " << p.mMeta.mMsgId; std::cerr << "PostedListWidget::updateCurrentDisplayComplete() updating MsgId: " << p.mMeta.mMsgId;
std::cerr << std::endl; std::cerr << std::endl;
#endif
mPosts[p.mMeta.mMsgId]->setPost(p); mPosts[p.mMeta.mMsgId]->setPost(p);
} }
else else
{ {
#ifdef DEBUG_POSTED_LIST_WIDGET
std::cerr << "PostedListWidget::updateCurrentDisplayComplete() loading New MsgId: " << p.mMeta.mMsgId; std::cerr << "PostedListWidget::updateCurrentDisplayComplete() loading New MsgId: " << p.mMeta.mMsgId;
std::cerr << std::endl; std::cerr << std::endl;
#endif
/* insert new entry */ /* insert new entry */
loadPost(p); loadPost(p);
} }
@ -689,8 +733,10 @@ void PostedListWidget::setAllMessagesReadDo(bool read, uint32_t &token)
void PostedListWidget::loadRequest(const TokenQueue *queue, const TokenRequest &req) void PostedListWidget::loadRequest(const TokenQueue *queue, const TokenRequest &req)
{ {
#ifdef DEBUG_POSTED_LIST_WIDGET
std::cerr << "PostedListWidget::loadRequest() UserType: " << req.mUserType; std::cerr << "PostedListWidget::loadRequest() UserType: " << req.mUserType;
std::cerr << std::endl; std::cerr << std::endl;
#endif
if (queue == mTokenQueue) if (queue == mTokenQueue)
{ {

View File

@ -351,7 +351,9 @@ void GxsIdChooser::setDefaultItem()
if (def >= 0) { if (def >= 0) {
setCurrentIndex(def); setCurrentIndex(def);
#ifdef IDCHOOSER_DEBUG
std::cerr << "GxsIdChooser-002" << (void*)this << " setting current index to " << def << std::endl; std::cerr << "GxsIdChooser-002" << (void*)this << " setting current index to " << def << std::endl;
#endif
} }
} }
@ -363,7 +365,9 @@ bool GxsIdChooser::setChosenId(const RsGxsId &gxsId)
int index = findData(id); int index = findData(id);
if (index >= 0) { if (index >= 0) {
setCurrentIndex(index); setCurrentIndex(index);
#ifdef IDCHOOSER_DEBUG
std::cerr << "GxsIdChooser-001" << (void*)this << " setting current index to " << index << std::endl; std::cerr << "GxsIdChooser-001" << (void*)this << " setting current index to " << index << std::endl;
#endif
return true; return true;
} }
return false; return false;