removed debug times in GxsIdDetails cache cleaning

This commit is contained in:
csoler 2019-06-05 19:47:06 +02:00
parent b6b840a673
commit 2720022163
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C

View File

@ -70,8 +70,8 @@ uint32_t GxsIdDetails::mImagesAllocated = 0;
time_t GxsIdDetails::mLastIconCacheCleaning = time(NULL);
std::map<RsGxsId,std::pair<time_t,QPixmap>[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<RsGxsId,QImage> image_cache ;
//
// std::map<RsGxsId,QImage>::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<const uint64_t*>(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<S/2;++i)
// for(int j=0;j<S/2;++j)
// {
// float res1 = 0.0f ;
// float res2 = 0.0f ;
// float f = 1.70;
//
// for(int k1=0;k1<4;++k1)
// for(int k2=0;k2<4;++k2)
// {
// res1 += cos( (2*M_PI*i/(float)S) * k1 * f) * (a[k1 ] & 0xf) + sin( (2*M_PI*j/(float)S) * k2 * f) * (a[k2 ] >> 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;
}
/**