summaryrefslogtreecommitdiffstats
path: root/kuickshow/src/filecache.h
blob: 16e532615c7c54d540f2264d06182ddf5f392857 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/****************************************************************************
** $Id: .emacs,v 1.3 2006/02/20 15:06:53 gis Exp $
**
** Created : 2006
**
** Copyright (C) 2006 Carsten Pfeiffer <pfeiffer@kde.org>
**
****************************************************************************/

#ifndef FILECACHE_H
#define FILECACHE_H

#include <qcache.h>

#include "kuickfile.h"

class KTempDir;

class FileCache
{
public:
    static FileCache * self();
    static void shutdown();

    KuickFile * getFile( const KURL& url );
    void setLimit( int numFiles );
    int getLimit() const { return m_limit; }

    /**
     * @return the temporary directory or QString::null if none available
     */
    QString tempDir();

private:
    static FileCache *s_self;
    FileCache();
    ~FileCache();

    KTempDir * createTempDir();
    QCache<KuickFile> m_files;

    int m_limit;
    KTempDir *m_tempDir;

};

#endif // FILECACHE_H