Пример #1
0
void RSWappFriendsPage::showFriendDetails(const std::string& friend_id)
{
	RsPeerDetails info ;

	if(!mPeers->getPeerDetails(friend_id,info))
	{
		std::cerr << "Can't get file details for friend " << friend_id << std::endl;
		return ;
	}

#ifdef DEBUG_FRIENDSPAGE	
	std::cerr << "Showing peer details: " << std::endl;
	std::cerr << info << std::endl;
#endif

	Wt::WDialog dialog ;
	dialog.setModal(false) ;

	Wt::WVBoxLayout *layout = new Wt::WVBoxLayout ;
	dialog.contents()->setLayout(layout) ;

	Wt::WHBoxLayout *layout2 = new Wt::WHBoxLayout ;
	Wt::WImage *img = new Wt::WImage(_model->getAvatarUrl(friend_id),dialog.contents());

	img->setMinimumSize(128,128) ;
	img->setMaximumSize(128,128) ;

	layout2->addWidget(img) ;
	layout2->addStretch() ;

	layout->addLayout(layout2,1) ;

	Wt::WString str ;
	str += "<br/>" ;
	str += "<b>Name</b>   \t\t: " + info.name + "<br/>" ;
	str += "<b>PGP id</b> \t\t: " + info.gpg_id + "<br/>" ;
	str += "<b>PGP fingerprint</b> \t: " + info.fpr + "<br/>" ;
	str += "<b>Location name  </b> \t: " + info.location + "<br/>" ;
	str += "<b>Location ID    </b> \t: " + info.id + "<br/>" ;

	layout->addWidget(new Wt::WLabel(str,dialog.contents())) ;

	Wt::WPushButton ok("Ok", dialog.contents());
	layout->addWidget(&ok) ;

	ok.clicked().connect(&dialog, &Wt::WDialog::accept);

	dialog.exec() ;
}