/usr/include/kmldonkey/fileinfo.h is in kmldonkey 4:2.0.5+kde4.3.3-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | /* -*- c++ -*-
*
* fileinfo.h
*
* Copyright (C) 2003 Petter Stokke <ummo@hellokitty.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef __libkmldonkey_fileinfo_h__
#define __libkmldonkey_fileinfo_h__
#include <QString>
#include <QStringList>
#include <QHash>
#include <sys/types.h>
#include <time.h>
#include <kmldonkey_export.h>
#include "donkeytypes.h"
class DonkeyMessage;
//! Representation of a file.
class KMLDONKEY_EXPORT FileInfo
{
public:
//! File state.
enum State {
Downloading = 0,
Paused,
Complete,
Shared,
Cancelled,
New,
Aborted,
Queued
};
FileInfo(int num, DonkeyMessage* msg, int proto);
~FileInfo();
void updateFileInfo(DonkeyMessage* msg, int proto);
//! The numerical ID of the file.
const int& fileNo() const;
//! The network the file is on.
const int& fileNetwork() const;
//! The file name.
const QString& fileName() const;
//! Alternative file names found on the network.
const QStringList& fileNames() const;
//! A list of all the file's uids.
const QStringList& fileUids() const;
//! The file's primary uid.
QString fileUid() const;
//! Return the uid for the given URN type, without the identifier string.
QString fileUid(const QString& type) const;
//! The file size.
const int64& fileSize() const;
//! Bytes downloaded so far.
const int64& fileDownloaded() const;
//! Bytes downloaded at first time seen
const int64& fileFirstDownloaded() const;
const int& fileNLocations() const;
const int& fileNClients() const;
//! The file state.
const State& fileState() const;
//! If state is Aborted, this is the reason why.
const QString& fileAbortedMsg() const;
//! String describing file chunks downloaded, one char for each chunk.
const QByteArray& fileChunks() const;
//! A map of networks, with each value describing chunk availability, one char for each chunk.
const QHash<int,QByteArray>& fileAvailability() const;
//! Current download speed.
const double& fileSpeed() const;
//! The age of individual chunks.
const QList<time_t>& fileChunksAge() const;
//! The time the download was started (seconds since Epoch).
const time_t& fileAge() const;
//! The time the download was first seen (seconds since Epoch).
const time_t& fileFirstTime() const;
//! The file format.
const int& fileFormat() const;
//! A string describing the file format in more detail.
const QString& fileFormatInfo() const;
//! Seconds since the file was last seen on the network.
const int& fileLastSeen() const;
//! The file priority.
const int& filePriority() const;
//! File availability described by a map of client IDs to strings similar to fileChunks().
const QHash<int,QByteArray>& fileSources() const;
//! The file's comment, if any.
const QString& fileComment() const;
void setFileName(const QString& newname);
void addSource(int source);
bool removeSource(int source);
void updateAvailability(int source, const QByteArray &avail);
void updateDownloadStatus(DonkeyMessage* msg, int proto);
//! Converts a QByteArray containing an MD4 hash to a readable string.
static QString md4ToString(const QByteArray& hash);
//! Converts a string describing an MD4 hash into a QByteArray.
static QByteArray stringToMd4(const QString& hash);
static QString humanReadableSize( int64 rsz );
static QString humanReadableSpeed( double sp );
static QString humanReadableTime( time_t t, bool shortFormat );
static double calculateETANumeric( const FileInfo* fi );
static QString calculateETA( const FileInfo* fi );
static QString humanReadablePriority( int pri );
private:
int num, network;
QString name;
QStringList names, uids;
int64 size, downloaded, firstdown;
int nlocations, nclients;
State state;
QString abortedmsg;
QByteArray chunks;
QHash<int,QByteArray> availability;
double speed;
QList<time_t> chunks_age;
time_t age, firsttime;
int format;
QString formatinfo;
int lastseen, priority;
QString comment;
QHash<int,QByteArray> sources;
Q_DISABLE_COPY(FileInfo)
};
#endif
|