#ifndef _FILE_TRANSFER_H #define _FILE_TRANSFER_H #include #include #include class file_transfer { public: file_transfer (int id, const QString &nick,const QString &fname=QString::null,const QString& rfile=QString::null,int size=0); double percent_done() const; double transfer_speed() const; double estimated_time() const; bool transfer_done() { return done; } const int transfer_id() const { return id; } const QString& transfer_user() const { return user; } const QString& transfer_file() const { return file; } const QString& RemoteFile() const {return remoteFile;} int Size() const {return total_size;} void update(const QString& fname, int totSize, int recSize, int aRecLast10) { file = fname; total_size = totSize; bytes_transferred = recSize; recLast10 = aRecLast10; } void update(int size, int amount) { total_size = size; bytes_transferred = amount; } bool operator==(const file_transfer& o) const { return user == o.user && file == o.file; } protected: int bps() const; enum TransferType {DOWNLOAD,UPLOAD}; TransferType type; QString user; QString file; QString remoteFile; QString local_path; int total_size; int bytes_transferred; int recLast10; off_t orig_size; time_t time_started; bool done; int id; }; #endif