diff options
author | Arno <am@disconnect.de> | 2010-12-16 19:46:34 +0100 |
---|---|---|
committer | Arno <am@disconnect.de> | 2010-12-16 19:46:34 +0100 |
commit | 69bdaf5d1cdf2cb6a5da8371658e1c3995a71cfb (patch) | |
tree | e307f53d30b4ad59f6ab592c97adcf58008a8c6c /smglobals.h | |
parent | c7bffca4cfc626c62c0eae6bc6b06d92cb2a8340 (diff) | |
download | SheMov-69bdaf5d1cdf2cb6a5da8371658e1c3995a71cfb.tar.gz SheMov-69bdaf5d1cdf2cb6a5da8371658e1c3995a71cfb.tar.bz2 SheMov-69bdaf5d1cdf2cb6a5da8371658e1c3995a71cfb.zip |
Cache for frame grabbing
Implemetented a cache for hovering over movies, saving the pictures from
ffmpeg. For that SmGlobals got a new member *frameCache, handling all
the dirty file access.
I first tried to implement it as a helper, but that produced too much
duplicate code.
Diffstat (limited to 'smglobals.h')
-rw-r--r-- | smglobals.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/smglobals.h b/smglobals.h index 06d7b43..b994b53 100644 --- a/smglobals.h +++ b/smglobals.h @@ -10,17 +10,41 @@ #include <QHash> #include <QSize> +#include <QPair> class QAbstractItemModel; class PictureViewer; +class QPixmap; class SmGlobals : public QObject { Q_OBJECT public: + class FrameCache : public QObject { + public: + FrameCache(QObject *parent = 0); + ~FrameCache(); + void readConfig(); + const QPixmap entry(const QString &sourcePath, const QString &when = QString()); + + private: + void readCache(); + void grabFrame(const QString &sourceFile, QString when); + QHash<QPair<QString, QString>, QString> mFrameCache; + const qint32 mMagic; + const QString mCacheSubDir; + const QString mCacheFileName; + QString mCacheDir; + QString mCacheFile; + QString mWhen; + QString mFfMpegPath; + + }; + ~SmGlobals(); static SmGlobals *instance(); QAbstractItemModel *model(const QString &which); PictureViewer *pictureViewer(); + FrameCache *frameCache(); QSize cursorSize(); private: @@ -30,6 +54,7 @@ class SmGlobals : public QObject { static SmGlobals *mInstance; QHash<QString, QAbstractItemModel*> mModels; PictureViewer *mPictureViewer; + SmGlobals::FrameCache *mFrameCache; QSize mCursorSize; }; |