annotate data/fileio/CachedFile.h @ 476:acddcc3cca36

* Avoid deadlock in indexer
author Chris Cannam
date Fri, 07 Nov 2008 20:25:57 +0000
parents 70b333085952
children a82645e788fc
rev   line source
Chris@465 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@465 2
Chris@465 3 /*
Chris@465 4 Sonic Visualiser
Chris@465 5 An audio file viewer and annotation editor.
Chris@465 6 Centre for Digital Music, Queen Mary, University of London.
Chris@465 7 This file copyright 2008 QMUL.
Chris@465 8
Chris@465 9 This program is free software; you can redistribute it and/or
Chris@465 10 modify it under the terms of the GNU General Public License as
Chris@465 11 published by the Free Software Foundation; either version 2 of the
Chris@465 12 License, or (at your option) any later version. See the file
Chris@465 13 COPYING included with this distribution for more information.
Chris@465 14 */
Chris@465 15
Chris@465 16 #ifndef _CACHED_FILE_H_
Chris@465 17 #define _CACHED_FILE_H_
Chris@465 18
Chris@465 19 #include <QString>
Chris@465 20 #include <QUrl>
Chris@465 21 #include <QDateTime>
Chris@465 22
Chris@465 23 class ProgressReporter;
Chris@465 24
Chris@465 25 class CachedFile
Chris@465 26 {
Chris@465 27 public:
Chris@467 28 CachedFile(QString fileOrUrl, ProgressReporter *reporter = 0);
Chris@465 29 CachedFile(QUrl url, ProgressReporter *reporter = 0);
Chris@465 30
Chris@465 31 virtual ~CachedFile();
Chris@465 32
Chris@465 33 bool isOK() const;
Chris@465 34
Chris@465 35 QString getLocalFilename() const;
Chris@465 36
Chris@465 37 protected:
Chris@468 38 QString m_origin;
Chris@465 39 QString m_localFilename;
Chris@466 40 ProgressReporter *m_reporter;
Chris@465 41 bool m_ok;
Chris@465 42
Chris@467 43 void check();
Chris@465 44 bool retrieve();
Chris@465 45
Chris@465 46 QDateTime getLastRetrieval();
Chris@465 47 void updateLastRetrieval(bool successful);
Chris@465 48
Chris@465 49 static QString getCacheDirectory();
Chris@465 50 static QString getLocalFilenameFor(QUrl url);
Chris@465 51 };
Chris@465 52
Chris@465 53 #endif