summaryrefslogtreecommitdiffstats
path: root/src/sq_thumbnailcachemaster.ui.h
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2025-02-10 15:10:13 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2025-02-13 11:44:42 +0900
commit8f8f84410cc591c85c5e83e0b3efdcda5fdbe42e (patch)
treef273a932ce048ef22ea9d9888b77ea8a2b8f3e33 /src/sq_thumbnailcachemaster.ui.h
parent424635023ee423826de12514b2fec7834b8deb7b (diff)
downloadksquirrel-8f8f8441.tar.gz
ksquirrel-8f8f8441.zip
Rename 'ksquirrel' folder to 'src'
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it> (cherry picked from commit 203fcb8d90752b546c672c625927a136b959fcfb)
Diffstat (limited to 'src/sq_thumbnailcachemaster.ui.h')
-rw-r--r--src/sq_thumbnailcachemaster.ui.h89
1 files changed, 89 insertions, 0 deletions
diff --git a/src/sq_thumbnailcachemaster.ui.h b/src/sq_thumbnailcachemaster.ui.h
new file mode 100644
index 0000000..2659ae8
--- /dev/null
+++ b/src/sq_thumbnailcachemaster.ui.h
@@ -0,0 +1,89 @@
+/****************************************************************************
+** 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", TDEIcon::Desktop, TDEIcon::SizeSmall));
+ pushCacheMemory->setIconSet(SQ_IconLoader::instance()->loadIcon("kcalc", TDEIcon::Desktop, TDEIcon::SizeSmall));
+ pushShowCache->setIconSet(SQ_IconLoader::instance()->loadIcon("memory", TDEIcon::Desktop, TDEIcon::SizeSmall));
+
+ slotCalcCacheMemory();
+}
+
+void SQ_ThumbnailCacheMaster::slotCalcCache()
+{
+ SQ_DirThumbs tmp;
+
+ KURL url = tmp.root();
+
+ int size = KDirSize::dirSize(url);
+
+ TQString s = TDEIO::convertSize(size);
+
+ textThumbSize->setText(s);
+}
+
+void SQ_ThumbnailCacheMaster::slotClearCache()
+{
+ TQApplication::setOverrideCursor(TQCursor(TQt::WaitCursor));
+
+ SQ_DirThumbs tmp;
+
+ KURL url = tmp.root();
+
+ TDEIO::DeleteJob *job = TDEIO::del(url);
+ connect(job, TQ_SIGNAL(result(TDEIO::Job*)), this, TQ_SLOT(slotClearFinished(TDEIO::Job*)));
+}
+
+void SQ_ThumbnailCacheMaster::slotClearFinished( TDEIO::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::fromLatin1("%1/%2")
+ .arg(TDEIO::convertSize(SQ_PixmapCache::instance()->totalSize()))
+ .arg(TDEIO::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();
+}