NQueueItem Class Reference

QListViewItem for Queue Item Entries. More...

#include <nqueue.h>


Public Member Functions

 NQueueItem (QListViewItem *parent, int id, int hid, QUrl src, QString srcName, QUrl dst, QString dstName, uint size, bool dir=false)
 Creates a new item entry under parent.

virtual ~NQueueItem ()
 Destroys the item entry, but does not properly update NQueue's data structures.

void dieNow ()
 Destroys the item entry, and properly cleans up NQueue's data structures.

virtual int compare (QListViewItem *i, int col, bool ascending) const
 Compares the values of i to this object's entries for column col.

virtual QString text (int c) const
 Return a serialized value for the content of column c.

virtual const QPixmap * pixmap (int c) const
 Returns 0.

virtual int rtti () const
 Returns 2302, the arbitrary rtti chosen for this QListViewItem type.

const int id () const
 Returns the ID we were assigned.

const int hostid () const
 Return the ID of the host we require.

const QUrl source () const
 Return the URL of our source file, minus the filename.

const QUrl dest () const
 Return the URL of our destination file, minus the filename.

const QString sourceFileName () const
 Return the source filename.

const QString destFileName () const
 Return the destination filename.

const uint size () const
 Return the size of our queued file in bytes.

const uint progress () const
 Return the number of bytes recieved so far.

const bool isDir () const
 Boolean affirmation that the entry represents a directory.

const bool isDone () const
 Boolean affirmation that the item is done.

const bool inUse () const
 Boolean affirmation that the item is currently in use.

const bool failed () const
 Boolean affirmation that the item has failed.

const int whichRemote () const
 Returns an integer which represents which URL is for the remote system.

void totals (int *mytot, int *myrem)
 Retrieve the total number of entries this entry represents, and the number of those waiting to be transferred.

void childReset ()
 Forces a statistics regeneration.

void killChildren (int prune=0)
 Summarily destroy any children that fit the desired kill parameters.

void setProgress (uint progress)
 Update the current number of bytes transferred.

void setInUse (bool s=true)
 Marks the entry as in use.

void setDone (bool s=true)
 Marks the entry as done or failed depending on s.

void setFailed (bool s=true)
 Marks the entry as failed or not depending on s.

void childDone (bool removed=false)
 A child entry was marked done, decrease the remaining children count.

void addChild ()
 Add statistics for new child.

void reset (int *mytot=0, int *myrem=0)
 Resets this entry and any children to a waiting state.

void setXferStats (uint size, int time, double rate)
 Sets the entries transfer statistics.


Detailed Description

QListViewItem for Queue Item Entries.


Every Queue Item entry will be stored using this class. This can represent directories as well as files, and this is determined by isDir().


Constructor & Destructor Documentation

NQueueItem::NQueueItem QListViewItem *  parent,
int  id,
int  hid,
QUrl  src,
QString  srcName,
QUrl  dst,
QString  dstName,
uint  size,
bool  dir = false
 

Creates a new item entry under parent.

Parameters:
parent Parent object. Must be either a NQueueItem or NQueueHost.
id ID assigned to this item entry.
hid ID of the host this item requires.
src URL of the source file, excluding filename.
srcName Filename of the source file.
dst URL of the destination file, excluding filename.
dstName Filename of the destination file.
size Size of file in bytes.
dir Boolean state specifying if we are acting as a directory, rather than a file.

NQueueItem::~NQueueItem  )  [virtual]
 

Destroys the item entry, but does not properly update NQueue's data structures.

Use dieNow() rather than delete where possible.


Member Function Documentation

void NQueueItem::addChild  ) 
 

Add statistics for new child.

Automatically sets the done flag to false. This function notifies the object's parent via addChild().

void NQueueItem::childDone bool  removed = false  ) 
 

A child entry was marked done, decrease the remaining children count.

If removed is true, update the childTotal as well. If the remaining children count is reduced to zero, perform setDone(). This function notifies the object's parent via childDone().

void NQueueItem::childReset  ) 
 

Forces a statistics regeneration.

Called when a child at any depth was reset.
If the resultant remaining child count is greater than zero, the done flag is set to false.

int NQueueItem::compare QListViewItem *  i,
int  col,
bool  ascending
const [virtual]
 

Compares the values of i to this object's entries for column col.

const QUrl NQueueItem::dest  )  const [inline]
 

Return the URL of our destination file, minus the filename.

const QString NQueueItem::destFileName  )  const [inline]
 

Return the destination filename.

void NQueueItem::dieNow  ) 
 

Destroys the item entry, and properly cleans up NQueue's data structures.

Use this rather than delete where possible.

const bool NQueueItem::failed  )  const [inline]
 

Boolean affirmation that the item has failed.

Failed implies that an error occured in this item's transfer, or in one of its children.

const int NQueueItem::hostid  )  const [inline]
 

Return the ID of the host we require.

const int NQueueItem::id  )  const [inline]
 

Returns the ID we were assigned.

const bool NQueueItem::inUse  )  const [inline]
 

Boolean affirmation that the item is currently in use.

In Use implies that the item is in the process of transferring.

const bool NQueueItem::isDir  )  const [inline]
 

Boolean affirmation that the entry represents a directory.

const bool NQueueItem::isDone  )  const [inline]
 

Boolean affirmation that the item is done.

Done in this case implies that any children are completed, and that this entry was already processed fully.

void NQueueItem::killChildren int  prune = 0  ) 
 

Summarily destroy any children that fit the desired kill parameters.

If prune is 1, the child must be Done and Not Failed.
If prune is 0, the child must not currently be in use.
If prune is -1, all children will be destroyed.
This function is recursive, so if a child fails the test, but has its own children, they will be tested as well.

const QPixmap * NQueueItem::pixmap int  c  )  const [virtual]
 

Returns 0.

const uint NQueueItem::progress  )  const [inline]
 

Return the number of bytes recieved so far.

void NQueueItem::reset int *  mytot = 0,
int *  myrem = 0
 

Resets this entry and any children to a waiting state.

This function notifies the object's parent via childReset().

virtual int NQueueItem::rtti  )  const [inline, virtual]
 

Returns 2302, the arbitrary rtti chosen for this QListViewItem type.

void NQueueItem::setDone bool  s = true  ) 
 

Marks the entry as done or failed depending on s.

This function notifies the object's parent with childDone().

void NQueueItem::setFailed bool  s = true  ) 
 

Marks the entry as failed or not depending on s.

This function notifies the object's parent with setFailed().

void NQueueItem::setInUse bool  s = true  ) 
 

Marks the entry as in use.

void NQueueItem::setProgress uint  progress  )  [inline]
 

Update the current number of bytes transferred.

void NQueueItem::setXferStats uint  size,
int  time,
double  rate
[inline]
 

Sets the entries transfer statistics.

Parameters:
size Total number of bytes transferred.
time Time elapsed.
rate Transfer rate in kilobytes per second.

const uint NQueueItem::size  )  const [inline]
 

Return the size of our queued file in bytes.

const QUrl NQueueItem::source  )  const [inline]
 

Return the URL of our source file, minus the filename.

const QString NQueueItem::sourceFileName  )  const [inline]
 

Return the source filename.

QString NQueueItem::text int  c  )  const [virtual]
 

Return a serialized value for the content of column c.

void NQueueItem::totals int *  mytot,
int *  myrem
 

Retrieve the total number of entries this entry represents, and the number of those waiting to be transferred.

Includes itself.

const int NQueueItem::whichRemote  )  const
 

Returns an integer which represents which URL is for the remote system.

Returns:
0 if both are local.

1 if the source is remote.

2 if the destination is remote.

3 if both the source and destination are remote.


The documentation for this class was generated from the following files:
Generated on Wed Oct 22 20:32:05 2003 for nvemftp by doxygen1.3