From 499bb00b82370d72e4fa088bfb8fcee90c76e79c Mon Sep 17 00:00:00 2001 From: thunder2 Date: Tue, 30 Dec 2014 21:22:45 +0000 Subject: [PATCH] Added icons to GxsIdChooser Fixed display of "Create new Identity" without an identity git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7809 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/gxs/GxsIdChooser.cpp | 28 +++++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/retroshare-gui/src/gui/gxs/GxsIdChooser.cpp b/retroshare-gui/src/gui/gxs/GxsIdChooser.cpp index 4a9d1c8ef..00b88cdf6 100644 --- a/retroshare-gui/src/gui/gxs/GxsIdChooser.cpp +++ b/retroshare-gui/src/gui/gxs/GxsIdChooser.cpp @@ -131,8 +131,27 @@ static void loadPrivateIdsCallback(GxsIdDetailsType type, const RsIdentityDetail index = chooser->count() - 1; } + QList icons; + + switch (type) { + case GXS_ID_DETAILS_TYPE_EMPTY: + case GXS_ID_DETAILS_TYPE_FAILED: +// icons = ; + break; + + case GXS_ID_DETAILS_TYPE_LOADING: + icons.push_back(GxsIdDetails::getLoadingIcon(details.mId)); + break; + + case GXS_ID_DETAILS_TYPE_DONE: + GxsIdDetails::getIcons(details, icons); + break; + } + chooser->setItemData(index, QString("%1_%2").arg((type == GXS_ID_DETAILS_TYPE_DONE) ? TYPE_FOUND_ID : TYPE_UNKNOWN_ID).arg(text), ROLE_SORT); chooser->setItemData(index, (type == GXS_ID_DETAILS_TYPE_DONE) ? TYPE_FOUND_ID : TYPE_UNKNOWN_ID, ROLE_TYPE); + chooser->setItemIcon(index, icons.empty() ? QIcon() : icons[0]); + chooser->model()->sort(0); } @@ -197,13 +216,6 @@ void GxsIdChooser::loadPrivateIds(uint32_t token) } } - if (ids.empty()) { - mFirstLoad = false; - std::cerr << "GxsIdChooser::loadPrivateIds() ERROR no ids"; - std::cerr << std::endl; - return; - } - for (std::list::iterator it = ids.begin(); it != ids.end(); ++it) { /* add to Chooser */ GxsIdDetails::process(*it, loadPrivateIdsCallback, this); @@ -215,7 +227,7 @@ void GxsIdChooser::loadPrivateIds(uint32_t token) QString str = tr("Create new Identity"); QString id = ""; - addItem(str, id); + addItem(QIcon(":/images/identity/identity_create_32.png"), str, id); setItemData(count() - 1, QString("%1_%2").arg(TYPE_CREATE_ID).arg(str), ROLE_SORT); setItemData(count() - 1, TYPE_CREATE_ID, ROLE_TYPE); }