Mercurial > hg > svcore
annotate data/fileio/CachedFile.h @ 466:f35bfa88f0b5
* flesh out CachedFile a bit more
author | Chris Cannam |
---|---|
date | Mon, 27 Oct 2008 15:07:35 +0000 |
parents | 63b8ba45d953 |
children | c9b055f84326 |
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@465 | 28 CachedFile(QUrl url, ProgressReporter *reporter = 0); |
Chris@465 | 29 |
Chris@465 | 30 virtual ~CachedFile(); |
Chris@465 | 31 |
Chris@465 | 32 bool isOK() const; |
Chris@465 | 33 |
Chris@465 | 34 QString getLocalFilename() const; |
Chris@465 | 35 |
Chris@465 | 36 protected: |
Chris@465 | 37 QUrl m_url; |
Chris@465 | 38 QString m_localFilename; |
Chris@466 | 39 ProgressReporter *m_reporter; |
Chris@465 | 40 bool m_ok; |
Chris@465 | 41 |
Chris@465 | 42 void refresh(); |
Chris@465 | 43 bool retrieve(); |
Chris@465 | 44 |
Chris@465 | 45 QDateTime getLastRetrieval(); |
Chris@465 | 46 void updateLastRetrieval(bool successful); |
Chris@465 | 47 |
Chris@465 | 48 static QString getCacheDirectory(); |
Chris@465 | 49 static QString getLocalFilenameFor(QUrl url); |
Chris@465 | 50 }; |
Chris@465 | 51 |
Chris@465 | 52 #endif |