jigdo API
JobLine Class Reference
One "job", e.g. More...
#include <jobline.hh>

Public Member Functions | |
JobLine () | |
virtual | ~JobLine () |
If the JobLine was in a needTicks() state, jobList()->unregisterTicks() is called by this dtor. | |
virtual bool | run ()=0 |
Start/restart this job. | |
virtual void | selectRow ()=0 |
Called when the JobLine's line is selected in the list. | |
virtual bool | paused () const =0 |
Is the job currently paused? | |
virtual void | pause ()=0 |
Pause the job. | |
virtual void | cont ()=0 |
Continue executing the job. | |
virtual void | stop ()=0 |
Stop executing the job. | |
virtual void | percentDone (uint64 *cur, uint64 *total)=0 |
When called, must fill in current nr of bytes downloaded and total nr of bytes. | |
Static Public Member Functions | |
static void | create (const char *uri, const char *dest) |
Kind of a JobLine factory, called when the user clicks on OK to start a new download. | |
Protected Types | |
typedef void(JobLine::* | TickHandler )() |
Protected Member Functions | |
JobList * | jobList () const |
Pointer to JobList. | |
GtkTreeIter * | row () |
Iterator for our row in the list. | |
void | callRegularly (TickHandler handler) |
Register a tick handler. | |
TickHandler | getHandler () const |
Return current tick handler. | |
bool | needTicks () const |
Does this object need to be called regularly? | |
void | callRegularlyLater (const int milliSec, TickHandler handler) |
Wait appropriate nr of ticks, then register the supplied handler. | |
Friends | |
class | JobList |
Detailed Description
One "job", e.g.file download, scanning through files, or image download (which has many file downloads as children). Virtual class.
Member Typedef Documentation
typedef void(JobLine::* JobLine::TickHandler)() [protected] |
Reimplemented in GtkMakeImage, and GtkSingleUrl.
Constructor & Destructor Documentation
JobLine::JobLine | ( | ) | [inline] |
JobLine::~JobLine | ( | ) | [virtual] |
If the JobLine was in a needTicks() state, jobList()->unregisterTicks() is called by this dtor.
Additionally, removes the line from the GtkTreeList.
References JobList::erase(), jobList(), needTicks(), row(), and JobList::unregisterTicks().
Member Function Documentation
virtual bool JobLine::run | ( | ) | [pure virtual] |
Start/restart this job.
When called, must also create GUI elements for this Job in row number row() of GtkTreeView jobList()->view(). Is called after Job is added to the list, and when it is restarted (if at all). Child classes should provide an implementation.
- Returns:
- SUCCESS if everything OK, FAILURE if this object has deleted itself.
Implemented in GtkMakeImage, and GtkSingleUrl.
virtual void JobLine::selectRow | ( | ) | [pure virtual] |
Called when the JobLine's line is selected in the list.
Implemented in GtkMakeImage, and GtkSingleUrl.
virtual bool JobLine::paused | ( | ) | const [pure virtual] |
virtual void JobLine::pause | ( | ) | [pure virtual] |
virtual void JobLine::cont | ( | ) | [pure virtual] |
virtual void JobLine::stop | ( | ) | [pure virtual] |
virtual void JobLine::percentDone | ( | uint64 * | cur, | |
uint64 * | total | |||
) | [pure virtual] |
When called, must fill in current nr of bytes downloaded and total nr of bytes.
Implemented in GtkMakeImage, and GtkSingleUrl.
void JobLine::create | ( | const char * | uri, | |
const char * | dest | |||
) | [static] |
Kind of a JobLine factory, called when the user clicks on OK to start a new download.
It decides whether a normal file download or a .jigdo download is needed and creates the appropriate object. Additionally, the Job is appended to the list of jobs, and run.
- Parameters:
-
uri What to download (if it ends in ".jigdo" and dest is a directory, will start jigdo processing) dest Where to put downloaded data, either a dir or a file.
References _, MessageBox::addButton(), compareEnd(), MessageBox::ERROR, MessageBox::INFO, GUI::jobList, Error::message, MessageBox::NONE, MessageBox::OK, JobList::prepend(), GtkMakeImage::run(), GtkSingleUrl::run(), MessageBox::show(), and subst.
Referenced by main(), and on_openButton_clicked().
JobList * JobLine::jobList | ( | ) | const [inline, protected] |
GtkTreeIter * JobLine::row | ( | ) | [inline, protected] |
Iterator for our row in the list.
Do not modify the returned value, copy it instead! (It is non-const because various gtk functions which read it are incorrectly(?) declared non-const.) NB: The returned iter is UNINITIALIZED until the JobLine is added to a JobList!
Referenced by JobList::append(), JobList::prepend(), GtkSingleUrl::run(), GtkMakeImage::run(), GtkMakeImage::~GtkMakeImage(), and ~JobLine().
void JobLine::callRegularly | ( | TickHandler | handler | ) | [inline, protected] |
Register a tick handler.
The handler will be called every JobList::TICK_INTERVAL milliseconds by a GTK+ callback function that JobList registers. Handy for updating progress reports at regular intervals. Only register a handler if you really need it. Otherwise, pass 0 as the handler function pointer - if no JobLine at all registers a tick handler, the callback fnc will not be registered at all, saving some CPU time.
References jobList(), needTicks(), JobList::registerTicks(), and JobList::unregisterTicks().
Referenced by GtkSingleUrl::callRegularly(), GtkMakeImage::callRegularly(), and callRegularlyLater().
TickHandler JobLine::getHandler | ( | ) | const [inline, protected] |
Return current tick handler.
bool JobLine::needTicks | ( | ) | const [inline, protected] |
void JobLine::callRegularlyLater | ( | const int | milliSec, | |
TickHandler | handler | |||
) | [inline, protected] |
Wait appropriate nr of ticks, then register the supplied handler.
Effectively, this means the JobLine pauses for a while - e.g. so the user can read some status report.
References callRegularly(), and JobList::TICK_INTERVAL.
Referenced by GtkSingleUrl::callRegularlyLater(), and GtkMakeImage::callRegularlyLater().
Friends And Related Function Documentation
friend class JobList [friend] |
The documentation for this class was generated from the following files:
- gtk/jobline.hh
- gtk/jobline.cc
Generated on Tue Sep 23 14:27:42 2008 for jigdo by
