Scribus
Open source desktop publishing at your fingertips
ScImageCacheManager Class Reference

Scribus image cache manager. More...

#include <scimagecachemanager.h>

Inheritance diagram for ScImageCacheManager:
Collaboration diagram for ScImageCacheManager:

Public Types

typedef ScImageCacheDir::AccessCounter AccessCounter
 

Public Member Functions

void setEnabled (bool enableCache)
 Enable/disable the image cache. More...
 
bool enabled (void) const
 Check if the image cache is enabled. More...
 
bool setMaxCacheSizeMiB (int maxCacheSizeMiB)
 Set cache size limit. More...
 
bool setMaxCacheEntries (int maxCacheEntries)
 Set cache entry limit. More...
 
bool setCompressionLevel (int level)
 Set cache image file compression level. More...
 
int compressionLevel () const
 Get cache image file compression level. More...
 
void initialize ()
 Initialize the cache manager.
 
void tryCleanup ()
 Try to run a cache cleanup.
 
bool acquireWriteLock ()
 Try to acquire a write lock. More...
 
bool releaseWriteLock ()
 Release a write lock. More...
 
void removeMasterLock ()
 Remove master lock. More...
 
bool updateAccess (const QString &dir, AccessCounter from, AccessCounter to)
 Access update notification. More...
 
bool updateFile (const QString &file)
 File update notification. More...
 

Static Public Member Functions

static ScImageCacheManagerinstance ()
 Get image cache manager instance. More...
 
static QString absolutePath (const QString &fn)
 Convert relative to absolute path. More...
 

Detailed Description

Scribus image cache manager.

Author
Marcus Holland-Moritz

Member Function Documentation

QString ScImageCacheManager::absolutePath ( const QString &  fn)
static

Convert relative to absolute path.

Parameters
fnPath relative to the image cache root directory
Returns
Absolute path
bool ScImageCacheManager::acquireWriteLock ( )

Try to acquire a write lock.

Returns
true if the write lock could be acquired, false otherwise
int ScImageCacheManager::compressionLevel ( ) const

Get cache image file compression level.

Returns
Current compression level
bool ScImageCacheManager::enabled ( void  ) const
inline

Check if the image cache is enabled.

Returns
true if the cache is be enabled, false otherwise
ScImageCacheManager & ScImageCacheManager::instance ( )
static

Get image cache manager instance.

Returns
Reference to the singleton instance
bool ScImageCacheManager::releaseWriteLock ( )

Release a write lock.

Returns
true if the write lock could be released, false otherwise
void ScImageCacheManager::removeMasterLock ( )

Remove master lock.

This method should only be called if a Scribus crash is detected. It will force the release of an existing master lock in order not to block other Scribus instances.

bool ScImageCacheManager::setCompressionLevel ( int  level)

Set cache image file compression level.

Parameters
levelImage compression level. -1 is the default compression level for PNG images. 0 is no compression, 1 is fastest comression and 9 is best compression.
Returns
true if the compression level could be set, false otherwise
void ScImageCacheManager::setEnabled ( bool  enableCache)

Enable/disable the image cache.

Parameters
enableCachetrue if the cache should be enabled
bool ScImageCacheManager::setMaxCacheEntries ( int  maxCacheEntries)

Set cache entry limit.

Parameters
maxCacheEntriesMaximum number of meta files in the cache
Returns
true if the cache entry limit could be set, false otherwise
bool ScImageCacheManager::setMaxCacheSizeMiB ( int  maxCacheSizeMiB)

Set cache size limit.

Parameters
maxCacheSizeMiBMaximum cache size in MiB.
Returns
true if the cache size limit could be set, false otherwise
bool ScImageCacheManager::updateAccess ( const QString &  dir,
AccessCounter  from,
AccessCounter  to 
)

Access update notification.

This method notifies the cache manager of an updated access file.

Parameters
dirPath of updated directory relative to the image cache root directory
fromPrevious access count
tonew access count
Returns
true if the access count could be updated, false otherwise
bool ScImageCacheManager::updateFile ( const QString &  file)

File update notification.

This method notifies the cache manager of an updated (i.e. newly created, changed or removed) file in the image cache.

Parameters
filePath of updated file relative to the image cache root directory
Returns
true if the file information could be updated, false otherwise

The documentation for this class was generated from the following files: