1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
//
// C++ Interface: filetransfer
//
// Description:
//
//
// Author: Rikard Björklind <olof@linux.nu>, (C) 2005
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef FILETRANSFER_H__
#define FILETRANSFER_H__
#include "global.h"
#include "log.h"
#include <QString>
struct FileTransfer
{
enum Type {UPLOAD=0,DOWNLOAD=1};
Type type;
qint64 pos;
qint64 startpos;
qint64 actual;
qint64 size;
qint64 averageSpeed;
qint64 secondsLeft;
qint64 bytesLeft;
QString filename;
QString localfilename;
QString tth;
QString status;
int userid;
//! This method might be quite incorrect, we have to check dc++ behaviour a little better.
bool operator==(const FileTransfer& ft) const {
// quick rejection test
logger->debug("comparing files");
if(type==ft.type) logger->debug("type samma");
if(type!=ft.type) return false;
// Use TTH if available for both
//if(!tth.isEmpty() && !ft.tth.isEmpty()) {
// logger->debug("tthcomp:" + QString::number(tth==ft.tth?1:0 ));;
// return tth==ft.tth;
//}
logger->debug("userid: " + QString::number(userid) + ", " + QString::number(ft.userid) + ", " + filename + ", " + ft.filename);
// No tth, use filename, user
return userid==ft.userid && filename==ft.filename;
}
QString toString() const
{
return QString("Type: ") + QString::number(type) + "\nFilename: " + filename + "\nsize: " + QString::number(size) + " userid:"+QString::number(userid);
}
};
#endif
|