diff --git a/retroshare-gui/src/gui/gxs/GxsIdDetails.cpp b/retroshare-gui/src/gui/gxs/GxsIdDetails.cpp index bbaf99715..f6d13d053 100644 --- a/retroshare-gui/src/gui/gxs/GxsIdDetails.cpp +++ b/retroshare-gui/src/gui/gxs/GxsIdDetails.cpp @@ -70,8 +70,8 @@ uint32_t GxsIdDetails::mImagesAllocated = 0; time_t GxsIdDetails::mLastIconCacheCleaning = time(NULL); std::map[4] > GxsIdDetails::mDefaultIconCache ; -#define ICON_CACHE_STORAGE_TIME 60 -#define DELAY_BETWEEN_ICON_CACHE_CLEANING 30 +#define ICON_CACHE_STORAGE_TIME 240 +#define DELAY_BETWEEN_ICON_CACHE_CLEANING 120 void ReputationItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { @@ -378,79 +378,6 @@ static bool findTagIcon(int tag_class, int /*tag_type*/, QIcon &icon) return true; } -//QImage GxsIdDetails::makeDefaultIcon(const RsGxsId& id) -//{ -// static std::map image_cache ; -// -// std::map::const_iterator it = image_cache.find(id) ; -// -// if(it != image_cache.end()) -// return it->second ; -// -// int S = 128 ; -// QImage pix(S,S,QImage::Format_RGB32) ; -// -// uint64_t n = reinterpret_cast(id.toByteArray())[0] ; -// -// uint8_t a[8] ; -// for(int i=0;i<8;++i) -// { -// a[i] = n&0xff ; -// n >>= 8 ; -// } -// QColor val[16] = { -// QColor::fromRgb( 255, 110, 180), -// QColor::fromRgb( 238, 92, 66), -// QColor::fromRgb( 255, 127, 36), -// QColor::fromRgb( 255, 193, 193), -// QColor::fromRgb( 127, 255, 212), -// QColor::fromRgb( 0, 255, 255), -// QColor::fromRgb( 224, 255, 255), -// QColor::fromRgb( 199, 21, 133), -// QColor::fromRgb( 50, 205, 50), -// QColor::fromRgb( 107, 142, 35), -// QColor::fromRgb( 30, 144, 255), -// QColor::fromRgb( 95, 158, 160), -// QColor::fromRgb( 143, 188, 143), -// QColor::fromRgb( 233, 150, 122), -// QColor::fromRgb( 151, 255, 255), -// QColor::fromRgb( 162, 205, 90), -// }; -// -// int c1 = (a[0]^a[1]) & 0xf ; -// int c2 = (a[1]^a[2]) & 0xf ; -// int c3 = (a[2]^a[3]) & 0xf ; -// int c4 = (a[3]^a[4]) & 0xf ; -// -// for(int i=0;i> 4) + sin( (2*M_PI*i/(float)S) * k1 * f) * cos( (2*M_PI*j/(float)S) * k2 * f) * (a[k1+k2] >> 4) ; -// res2 += cos( (2*M_PI*i/(float)S) * k2 * f) * (a[k1+2] & 0xf) + sin( (2*M_PI*j/(float)S) * k1 * f) * (a[k2+1] >> 4) + sin( (2*M_PI*i/(float)S) * k2 * f) * cos( (2*M_PI*j/(float)S) * k1 * f) * (a[k1^k2] >> 4) ; -// } -// -// uint32_t q = 0 ; -// if(res1 >= 0.0f) q += val[c1].rgb() ; else q += val[c2].rgb() ; -// if(res2 >= 0.0f) q += val[c3].rgb() ; else q += val[c4].rgb() ; -// -// pix.setPixel( i, j, q) ; -// pix.setPixel( S-1-i, j, q) ; -// pix.setPixel( S-1-i, S-1-j, q) ; -// pix.setPixel( i, S-1-j, q) ; -// } -// -// image_cache[id] = pix.scaled(128,128,Qt::KeepAspectRatio,Qt::SmoothTransformation) ; -// -// return image_cache[id] ; -//} - /** * @brief GxsIdDetails::makeIdentIcon * @param id: RsGxsId to compute @@ -593,8 +520,9 @@ bool GxsIdDetails::loadPixmapFromData(const unsigned char *data,size_t data_len, pixmap = pixmap.scaled(wanted_S,wanted_S,Qt::IgnoreAspectRatio,Qt::SmoothTransformation); mDefaultIconCache[id][(int)size] = std::make_pair(now,pixmap); - +#ifdef DEBUG std::cerr << "Allocated new icon " << id << " size " << (int)size << std::endl; +#endif return true; } /**