From 213d24c1d8a06b5a48400536e82db5c67fc17e09 Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 31 Aug 2008 16:50:36 +0000 Subject: [PATCH] - made the source comulmn more explicit by displaying the real name of the source - used for the source the same colour code (i.e. green when the source is online) git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@711 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/SearchDialog.cpp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/retroshare-gui/src/gui/SearchDialog.cpp b/retroshare-gui/src/gui/SearchDialog.cpp index a4c065bb8..95be898ed 100644 --- a/retroshare-gui/src/gui/SearchDialog.cpp +++ b/retroshare-gui/src/gui/SearchDialog.cpp @@ -25,6 +25,7 @@ #include "rsiface/rsiface.h" #include "rsiface/rsexpr.h" #include "rsiface/rsfiles.h" +#include "rsiface/rspeers.h" #include #include @@ -479,24 +480,30 @@ void SearchDialog::resultsToTree(std::string txt, std::list results) QTreeWidgetItem *item = new QTreeWidgetItem(); item->setText(SR_NAME_COL, QString::fromStdString(it->name)); item->setText(SR_HASH_COL, QString::fromStdString(it->hash)); - item->setText(SR_ID_COL, QString::fromStdString(it->id)); item->setText(SR_SEARCH_ID_COL, QString::fromStdString(out.str())); /* * to facilitate downlaods we need to save the file size too */ - QVariant * variant = new QVariant(it->size); - item->setText(SR_SIZE_COL, QString(variant->toString())); + QVariant * variant = new QVariant(it->size); + item->setText(SR_SIZE_COL, QString(variant->toString())); + // I kept the color code green=online, grey=offline + // Qt::blue is very dark and hardly compatible with the black text on it. + // if (it->id == "Local") { - /* colour green? */ - item->setBackground(2, QBrush(Qt::green)); + item->setText(SR_ID_COL, QString::fromStdString(it->id)); + item->setBackground(2, QBrush(Qt::red)); /* colour green? */ } - else + else { - /* colour blue? */ - item->setBackground(2, QBrush(Qt::blue)); + item->setText(SR_ID_COL, QString::fromStdString( rsPeers->getPeerName(it->id))); + if(rsPeers->isOnline(it->id)) + item->setBackground(2, QBrush(Qt::green)); + else + item->setBackground(2, QBrush(Qt::lightGray)); } + ui.searchResultWidget->addTopLevelItem(item); }