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
|
/*
* Copyright (C) 2001-2008 Jacek Sieka, arnetheduck on gmail point 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef DCPLUSPLUS_DCPP_DOWNLOADMANAGERLISTENER_H_
#define DCPLUSPLUS_DCPP_DOWNLOADMANAGERLISTENER_H_
#include "forward.h"
namespace dcpp {
/**
* Use this listener interface to get progress information for downloads.
*
* @remarks All methods are sending a pointer to a Download but the receiver
* (TransferView) is not using any of the methods in Download, only methods
* from its super class, Transfer. The listener functions should send Transfer
* objects instead.
*
* Changing this will will cause a problem with Download::List which is used
* in the on Tick function. One solution is reimplement on Tick to call once
* for every Downloads, sending one Download at a time. But maybe updating the
* GUI is not DownloadManagers problem at all???
*/
class DownloadManagerListener {
public:
virtual ~DownloadManagerListener() { }
template<int I> struct X { enum { TYPE = I }; };
typedef X<0> Complete;
typedef X<1> Failed;
typedef X<2> Starting;
typedef X<3> Tick;
typedef X<3> Requesting;
/**
* This is the first message sent before a download starts.
* No other messages will be sent before this.
*/
virtual void on(Requesting, Download*) throw() { }
/**
* This is the first message sent before a download starts.
*/
virtual void on(Starting, Download*) throw() { }
/**
* Sent once a second if something has actually been downloaded.
*/
virtual void on(Tick, const DownloadList&) throw() { }
/**
* This is the last message sent before a download is deleted.
* No more messages will be sent after it.
*/
virtual void on(Complete, Download*) throw() { }
/**
* This indicates some sort of failure with a particular download.
* No more messages will be sent after it.
*
* @remarks Should send an error code instead of a string and let the GUI
* display an error string.
*/
virtual void on(Failed, Download*, const string&) throw() { }
};
} // namespace dcpp
#endif /*DOWNLOADMANAGERLISTENER_H_*/
|