You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
90 lines
2.5 KiB
90 lines
2.5 KiB
/****************************************************************************
|
|
** ui.h extension file, included from the uic-generated form implementation.
|
|
**
|
|
** If you wish to add, delete or rename functions or slots use
|
|
** TQt Designer which will update this file, preserving your code. Create an
|
|
** init() function in place of a constructor, and a destroy() function in
|
|
** place of a destructor.
|
|
*****************************************************************************/
|
|
|
|
/*
|
|
* SQ_ThumbnailCacheMaster manipulates thumbnail cache
|
|
* in memory and on disk. It can show current cache size,
|
|
* delete cache on disk, clear cache etc.
|
|
*/
|
|
|
|
void SQ_ThumbnailCacheMaster::init()
|
|
{
|
|
pushCache->setIconSet(SQ_IconLoader::instance()->loadIcon("kcalc", KIcon::Desktop, KIcon::SizeSmall));
|
|
pushCacheMemory->setIconSet(SQ_IconLoader::instance()->loadIcon("kcalc", KIcon::Desktop, KIcon::SizeSmall));
|
|
pushShowCache->setIconSet(SQ_IconLoader::instance()->loadIcon("memory", KIcon::Desktop, KIcon::SizeSmall));
|
|
|
|
slotCalcCacheMemory();
|
|
}
|
|
|
|
void SQ_ThumbnailCacheMaster::slotCalcCache()
|
|
{
|
|
SQ_DirThumbs tmp;
|
|
|
|
KURL url = tmp.root();
|
|
|
|
int size = KDirSize::dirSize(url);
|
|
|
|
TQString s = KIO::convertSize(size);
|
|
|
|
textThumbSize->setText(s);
|
|
}
|
|
|
|
void SQ_ThumbnailCacheMaster::slotClearCache()
|
|
{
|
|
TQApplication::setOverrideCursor(TQCursor(TQt::WaitCursor));
|
|
|
|
SQ_DirThumbs tmp;
|
|
|
|
KURL url = tmp.root();
|
|
|
|
KIO::DeleteJob *job = KIO::del(url);
|
|
connect(job, TQT_SIGNAL(result(KIO::Job*)), this, TQT_SLOT(slotClearFinished(KIO::Job*)));
|
|
}
|
|
|
|
void SQ_ThumbnailCacheMaster::slotClearFinished( KIO::Job * )
|
|
{
|
|
TQApplication::restoreOverrideCursor();
|
|
slotCalcCache();
|
|
}
|
|
|
|
void SQ_ThumbnailCacheMaster::slotClearMemoryCache()
|
|
{
|
|
TQApplication::setOverrideCursor(TQCursor(TQt::WaitCursor));
|
|
|
|
SQ_PixmapCache::instance()->clear();
|
|
slotCalcCacheMemory();
|
|
|
|
TQApplication::restoreOverrideCursor();
|
|
}
|
|
|
|
void SQ_ThumbnailCacheMaster::slotCalcCacheMemory()
|
|
{
|
|
textCacheMemSize->setText(TQString::tqfromLatin1("%1/%2")
|
|
.tqarg(KIO::convertSize(SQ_PixmapCache::instance()->totalSize()))
|
|
.tqarg(KIO::convertSize(SQ_PixmapCache::instance()->cacheLimit())));
|
|
}
|
|
|
|
void SQ_ThumbnailCacheMaster::slotShowDiskCache()
|
|
{
|
|
SQ_ViewCache m_view(this);
|
|
m_view.exec();
|
|
}
|
|
|
|
void SQ_ThumbnailCacheMaster::slotSyncCache()
|
|
{
|
|
TQApplication::setOverrideCursor(TQCursor(TQt::WaitCursor));
|
|
|
|
SQ_PixmapCache::instance()->sync();
|
|
|
|
slotCalcCacheMemory();
|
|
slotCalcCache();
|
|
|
|
TQApplication::restoreOverrideCursor();
|
|
}
|