print more debug info and added missing emit to display the channel tab name after loading

This commit is contained in:
csoler 2020-06-21 21:43:10 +02:00
parent 800a7499d8
commit d0a373c14f
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C
2 changed files with 12 additions and 8 deletions

View File

@ -1997,7 +1997,9 @@ bool p3GxsCircles::processMembershipRequests(uint32_t token)
// now do another sweep and remove all msgs that are older than the latest // now do another sweep and remove all msgs that are older than the latest
#ifdef DEBUG_CIRCLES
std::cerr << " Cleaning old messages..." << std::endl; std::cerr << " Cleaning old messages..." << std::endl;
#endif
for(uint32_t i=0;i<it->second.size();++i) for(uint32_t i=0;i<it->second.size();++i)
{ {

View File

@ -417,9 +417,6 @@ void GxsChannelPostsWidgetWithModel::showPostDetails()
QTextDocument doc; QTextDocument doc;
doc.setHtml(post.mMsg.c_str()); doc.setHtml(post.mMsg.c_str());
if(doc.toPlainText().trimmed().isEmpty())
ui->postDetails_TE->setPlaceholderText(tr("No message in this post"));
if(post.mMeta.mPublishTs == 0) if(post.mMeta.mPublishTs == 0)
{ {
ui->postDetails_TE->clear(); ui->postDetails_TE->clear();
@ -427,6 +424,8 @@ void GxsChannelPostsWidgetWithModel::showPostDetails()
ui->postName_LB->hide(); ui->postName_LB->hide();
ui->postTime_LB->hide(); ui->postTime_LB->hide();
mChannelPostFilesModel->clear(); mChannelPostFilesModel->clear();
std::cerr << "showPostDetails: no valid post. Clearing mSelectedPost." << std::endl;
mSelectedPost.clear(); mSelectedPost.clear();
return; return;
} }
@ -438,6 +437,7 @@ void GxsChannelPostsWidgetWithModel::showPostDetails()
if(index.row()==0 && index.column()==0) if(index.row()==0 && index.column()==0)
std::cerr << "here" << std::endl; std::cerr << "here" << std::endl;
std::cerr << "showPostDetails: setting mSelectedPost to current post Id " << post.mMeta.mMsgId << ". Previous value: " << mSelectedPost << std::endl;
mSelectedPost = post.mMeta.mMsgId; mSelectedPost = post.mMeta.mMsgId;
std::list<ChannelPostFileInfo> files; std::list<ChannelPostFileInfo> files;
@ -522,6 +522,8 @@ void GxsChannelPostsWidgetWithModel::updateGroupData()
mChannelPostsModel->updateChannel(groupId()); mChannelPostsModel->updateChannel(groupId());
insertChannelDetails(mGroup); insertChannelDetails(mGroup);
emit groupChanged(this); // signals the parent widget to e.g. update the group tab name
} ); } );
}); });
} }
@ -533,7 +535,9 @@ void GxsChannelPostsWidgetWithModel::postChannelPostLoad()
if(!mSelectedPost.isNull()) if(!mSelectedPost.isNull())
{ {
QModelIndex index = mChannelPostsModel->getIndexOfMessage(mSelectedPost); QModelIndex index = mChannelPostsModel->getIndexOfMessage(mSelectedPost);
std::cerr << "Setting current index to " << index.row() << ","<< index.column() << " for current post " << mSelectedPost << std::endl;
std::cerr << "Setting current index to " << index.row() << ","<< index.column() << " for current post "
<< mSelectedPost.toStdString() << std::endl;
ui->postsTree->selectionModel()->setCurrentIndex(index,QItemSelectionModel::ClearAndSelect); ui->postsTree->selectionModel()->setCurrentIndex(index,QItemSelectionModel::ClearAndSelect);
ui->postsTree->scrollTo(ui->postsTree->currentIndex());//May change if model reloaded ui->postsTree->scrollTo(ui->postsTree->currentIndex());//May change if model reloaded
@ -541,7 +545,7 @@ void GxsChannelPostsWidgetWithModel::postChannelPostLoad()
ui->postsTree->update(); ui->postsTree->update();
} }
else else
mSelectedPost.clear(); std::cerr << "No pre-selected channel post." << std::endl;
std::list<ChannelPostFileInfo> files; std::list<ChannelPostFileInfo> files;
@ -551,7 +555,6 @@ void GxsChannelPostsWidgetWithModel::postChannelPostLoad()
//ui->channelFiles_TV->resizeColumnToContents(RsGxsChannelPostFilesModel::COLUMN_FILES_FILE); //ui->channelFiles_TV->resizeColumnToContents(RsGxsChannelPostFilesModel::COLUMN_FILES_FILE);
//ui->channelFiles_TV->resizeColumnToContents(RsGxsChannelPostFilesModel::COLUMN_FILES_SIZE); //ui->channelFiles_TV->resizeColumnToContents(RsGxsChannelPostFilesModel::COLUMN_FILES_SIZE);
ui->channelFiles_TV->setAutoSelect(true); ui->channelFiles_TV->setAutoSelect(true);
ui->postDetails_TE->setPlaceholderText(tr("No post selected"));
} }
@ -651,7 +654,7 @@ void GxsChannelPostsWidgetWithModel::settingsChanged()
QString GxsChannelPostsWidgetWithModel::groupName(bool) QString GxsChannelPostsWidgetWithModel::groupName(bool)
{ {
return "Group name" ; return QString::fromUtf8(mGroup.mMeta.mGroupName.c_str());
} }
void GxsChannelPostsWidgetWithModel::groupNameChanged(const QString &name) void GxsChannelPostsWidgetWithModel::groupNameChanged(const QString &name)
@ -1026,7 +1029,6 @@ void GxsChannelPostsWidgetWithModel::blank()
mChannelPostsModel->clear(); mChannelPostsModel->clear();
mChannelPostFilesModel->clear(); mChannelPostFilesModel->clear();
ui->postDetails_TE->clear(); ui->postDetails_TE->clear();
ui->postDetails_TE->setPlaceholderText(tr("No post selected"));
ui->postLogo_LB->hide(); ui->postLogo_LB->hide();
ui->postName_LB->hide(); ui->postName_LB->hide();
ui->postTime_LB->hide(); ui->postTime_LB->hide();