Chris@208: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@208: Chris@208: /* Chris@208: Sonic Visualiser Chris@208: An audio file viewer and annotation editor. Chris@208: Centre for Digital Music, Queen Mary, University of London. Chris@208: This file copyright 2007 QMUL. Chris@208: Chris@208: This program is free software; you can redistribute it and/or Chris@208: modify it under the terms of the GNU General Public License as Chris@208: published by the Free Software Foundation; either version 2 of the Chris@208: License, or (at your option) any later version. See the file Chris@208: COPYING included with this distribution for more information. Chris@208: */ Chris@208: Chris@208: #ifndef _REMOTE_FILE_H_ Chris@208: #define _REMOTE_FILE_H_ Chris@208: Chris@208: #include Chris@208: #include Chris@208: #include Chris@208: Chris@208: class QFtp; Chris@208: class QHttp; Chris@208: class QFile; Chris@208: class QProgressDialog; Chris@208: Chris@208: class RemoteFile : public QObject Chris@208: { Chris@208: Q_OBJECT Chris@208: Chris@208: public: Chris@208: RemoteFile(QUrl url); Chris@208: virtual ~RemoteFile(); Chris@208: Chris@208: void wait(); Chris@208: Chris@208: bool isOK() const; Chris@208: bool isDone() const; Chris@208: QString getLocalFilename() const; Chris@208: QString getErrorString() const; Chris@208: Chris@208: static bool canHandleScheme(QUrl url); Chris@208: Chris@208: signals: Chris@208: void progress(int percent); Chris@208: void ready(); Chris@208: Chris@208: protected slots: Chris@208: void dataReadProgress(int done, int total); Chris@208: void dataTransferProgress(qint64 done, qint64 total); Chris@208: void done(bool error); Chris@208: Chris@208: protected: Chris@208: QFtp *m_ftp; Chris@208: QHttp *m_http; Chris@208: QFile *m_localFile; Chris@208: QString m_localFilename; Chris@208: QString m_errorString; Chris@208: bool m_ok; Chris@208: bool m_done; Chris@208: QProgressDialog *m_progressDialog; Chris@208: Chris@208: QString createLocalFile(QUrl url); Chris@208: Chris@208: static QMutex m_fileCreationMutex; Chris@208: static int m_count; Chris@208: }; Chris@208: Chris@208: #endif