update display of the profilewidget tab in peersdialog

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2087 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
joss17 2010-01-19 21:43:13 +00:00
parent 0b736d9f28
commit 2f13d31725
3 changed files with 20 additions and 18 deletions

View File

@ -297,7 +297,16 @@ void PeersDialog::keyPressEvent(QKeyEvent *e)
void PeersDialog::updateDisplay()
{
insertPeers() ;
// add self nick and Avatar to Friends.
RsPeerDetails pd ;
if (rsPeers->getPeerDetails(rsPeers->getOwnId(),pd)) {
QString titleStr("<span style=\"font-size:16pt; font-weight:500;"
"color:#32cd32;\">%1</span>");
ui.nicklabel->setText(titleStr.arg(QString::fromStdString(pd.name) + tr(" (me)") + QString::fromStdString(pd.location))) ;
}
insertPeers() ;
}
/* get the list of peers from the RsIface. */
@ -308,6 +317,7 @@ void PeersDialog::insertPeers()
if (!rsPeers) {
/* not ready yet! */
std::cerr << "PeersDialog::insertPeers() not ready yet : rsPeers unintialized." << std::endl;
return;
}
@ -323,14 +333,6 @@ void PeersDialog::insertPeers()
/* get a link to the table */
QTreeWidget *peertreeWidget = ui.peertreeWidget;
// add self nick and Avatar to Friends.
RsPeerDetails pd ;
if (rsPeers->getPeerDetails(rsPeers->getOwnId(),pd)) {
QString titleStr("<span style=\"font-size:16pt; font-weight:500;"
"color:#32cd32;\">%1</span>");
ui.nicklabel->setText(titleStr.arg(QString::fromStdString(pd.name) + tr(" (me)"))) ;
}
//remove items that are not fiends anymore
int index = 0;
while (index < peertreeWidget->topLevelItemCount()) {

View File

@ -43,7 +43,7 @@ ProfileWidget::ProfileWidget(QWidget *parent, Qt::WFlags flags)
connect(ui.editstatuspushButton,SIGNAL(clicked()), this, SLOT(statusmessagedlg()));
loadDialog();
//loadDialog();
}
/** Destructor. */
@ -58,25 +58,25 @@ void ProfileWidget::closeEvent (QCloseEvent * event)
QWidget::closeEvent(event);
}
void ProfileWidget::loadDialog()
void ProfileWidget::showEvent ( QShowEvent * event )
{
RsPeerDetails detail;
if (rsPeers->getPeerDetails(rsPeers->getOwnId(),detail))
{
if (rsPeers->getPeerDetails(rsPeers->getOwnId(),detail))
{
ui.name->setText(QString::fromStdString(detail.name));
ui.country->setText(QString::fromStdString(detail.location));
ui.peerid->setText(QString::fromStdString(detail.id));
ui.peerid->setText(QString::fromStdString(detail.id));
// Dont Show a timestamp in RS calculate the day
QDateTime date = QDateTime::fromTime_t(detail.lastConnect);
QString stime = date.toString(Qt::LocalDate);
/* set retroshare version */
std::map<std::string, std::string>::iterator vit;
std::map<std::string, std::string> versions;
/* set retroshare version */
std::map<std::string, std::string>::iterator vit;
std::map<std::string, std::string> versions;
bool retv = rsDisc->getDiscVersions(versions);
if (retv && versions.end() != (vit = versions.find(detail.id)))
{

View File

@ -43,7 +43,7 @@ protected:
private slots:
void loadDialog();
void showEvent ( QShowEvent * event );
void statusmessagedlg();
private: