Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

visual_progress.c File Reference


Detailed Description

Displaying the visual progress of downloading graphically.

Visual progress indicator for files in the download queue.

Todo:
Make colors into properties so that they can be stored in config, should keep hardcoded backups.

Add progress data also to fileinfo table, so that the info is shown for all current files.

Do not redraw the bar too often, only on event for actual file and perhaps max once a second.

Author:
Hans de Graaff
Date:
2003-2005

#include "gui.h"
#include "visual_progress.h"
#include "if/core/http.h"
#include "if/gui_property_priv.h"
#include "if/bridge/ui2c.h"
#include "lib/walloc.h"
#include "lib/override.h"

Data Structures

struct  vp_context
 The context for drawing, including location to draw. More...

struct  vp_info
 Locally cached information from fileinfo needed for drawing the graphics. More...


Defines

#define VP_ARROW_HEIGHT   7
 The height of the indicator arrows in visual progress.


Typedefs

typedef vp_context vp_context_t
 The context for drawing, including location to draw.

typedef vp_info vp_info_t
 Locally cached information from fileinfo needed for drawing the graphics.


Functions

 RCSID ("$Id:visual_progress.c, v 1.37 2005/11/03 08:51:51 rmanfredi Exp $")
void vp_draw_rectangle (vp_info_t *v, filesize_t from, filesize_t to, guint top, guint bottom)
 Draw a rectangle for visual progress.

void vp_draw_chunk (gpointer data, gpointer user_data)
 Draw a chunk for visual progress.

void vp_draw_arrow (vp_info_t *v, filesize_t at)
 Draw an downward arrow starting at the top.

void vp_draw_arrows (gpointer data, gpointer user_data)
 Draw arrows on the start of BUSY chunks to make them stand out.

void vp_draw_range (gpointer data, gpointer user_data)
 Draw an available range.

void vp_draw_fi_progress (gboolean valid, gnet_fi_t fih)
 External function for drawing information in supplied pixmap.

void on_drawingarea_fi_progress_realize (GtkWidget *widget, gpointer user_data)
 Callback for the fileinfo pane GtkDrawingArea.

gboolean on_drawingarea_fi_progress_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer user_data)
 Callback for the fileinfo pane GtkDrawingArea.

GSList * vp_get_chunks_initial (gnet_fi_t fih)
 Get a list of chunks and filter out all empty chunks for quicker handling later on.

void vp_gui_fi_added (gnet_fi_t fih)
 A new fileinfo is available.

void vp_gui_fi_removed (gnet_fi_t fih)
 Handle the event that a fileinfo entry has been removed.

void vp_print_chunk (FILE *file, gnet_fi_chunks_t *c, gboolean show_old)
 For debugging: print chunk.

void vp_print_chunk_list (FILE *file, GSList *list, gchar *title)
 For debugging: print chunk list.

gnet_fi_chunks_tvp_create_chunk (filesize_t from, filesize_t to, enum dl_chunk_status status, gboolean old)
 Allocate a new chunk based on the parameters.

gboolean vp_assert_chunks_list (GSList *list, gnet_fi_info_t *fi)
 Assert that a chunks list confirms to the assumptions.

void vp_gui_fi_status_changed (gnet_fi_t fih)
 Fileinfo has been changed for a file.

void vp_gui_fi_ranges_changed (gnet_fi_t fih)
 The available ranges information has been changed for a file.

void vp_free_key_value (gpointer key, gpointer value, gpointer user_data)
 Free the vp_info_t structs in the vp_info_hash.

void vp_gui_init (void)
 Initialize the use of visual progress.

void vp_gui_shutdown (void)
 Undo everything set up in vp_gui_init.


Variables

GHashTable * vp_info_hash
 Hash table with our cached fileinfo info.

GdkColor done
 Pre-filled color (green) for DONE chunks.

GdkColor done_old
 Pre-filled color (dull green) for DONE chunks from previous sessions.

GdkColor busy
 Pre-filled color (yellow) for BUSY chunks.

GdkColor arrow
 Pre-filled color (blue) for start of BUSY.

GdkColor empty
 Pre-filled color (red) for EMPTY chunks.

GdkColor black
 Pre-filled color (black) for general drawing.

GdkColor available
 Pre-filled color (blue) available on network.

GdkColor nosize
 Pre-filled color (gray) indicates chunk information is not available (e.g.

GdkColor * base
 Theme-defined background color.

vp_context_t fi_context
 The visual progress context for drawing fileinfo information.


Define Documentation

#define VP_ARROW_HEIGHT   7
 

The height of the indicator arrows in visual progress.


Typedef Documentation

typedef struct vp_context vp_context_t
 

The context for drawing, including location to draw.

typedef struct vp_info vp_info_t
 

Locally cached information from fileinfo needed for drawing the graphics.


Function Documentation

gboolean on_drawingarea_fi_progress_expose_event GtkWidget *  widget,
GdkEventExpose *  event,
gpointer  user_data
 

Callback for the fileinfo pane GtkDrawingArea.

void on_drawingarea_fi_progress_realize GtkWidget *  widget,
gpointer  user_data
 

Callback for the fileinfo pane GtkDrawingArea.

RCSID "$Id:visual_progress.  c,
v 1.37 2005/11/03 08:51:51 rmanfredi Exp $" 
 

gboolean vp_assert_chunks_list GSList *  list,
gnet_fi_info_t fi
[static]
 

Assert that a chunks list confirms to the assumptions.

gnet_fi_chunks_t* vp_create_chunk filesize_t  from,
filesize_t  to,
enum dl_chunk_status  status,
gboolean  old
[static]
 

Allocate a new chunk based on the parameters.

Parameters:
from Start of chunk
to End of chunk
status Status of chunk
old TRUE if the chunk was downloaded before gtk-gnutella is started

void vp_draw_arrow vp_info_t v,
filesize_t  at
[static]
 

Draw an downward arrow starting at the top.

void vp_draw_arrows gpointer  data,
gpointer  user_data
[static]
 

Draw arrows on the start of BUSY chunks to make them stand out.

This is done in a separate funtion, because the arrows need to be drawn on top of the chunks.

void vp_draw_chunk gpointer  data,
gpointer  user_data
[static]
 

Draw a chunk for visual progress.

void vp_draw_fi_progress gboolean  valid,
gnet_fi_t  fih
 

External function for drawing information in supplied pixmap.

fih is expected to be a valid fih. Depending on the value of valid the area will be drawn or cleared.

void vp_draw_range gpointer  data,
gpointer  user_data
[static]
 

Draw an available range.

Callback for a list iterator.

Parameters:
data The HTTP range to draw.
user_data A pointer to the vp_info_t structure.

void vp_draw_rectangle vp_info_t v,
filesize_t  from,
filesize_t  to,
guint  top,
guint  bottom
 

Draw a rectangle for visual progress.

void vp_free_key_value gpointer  key,
gpointer  value,
gpointer  user_data
 

Free the vp_info_t structs in the vp_info_hash.

GSList* vp_get_chunks_initial gnet_fi_t  fih  )  [static]
 

Get a list of chunks and filter out all empty chunks for quicker handling later on.

Returns pointer to the new list. Caller should make sure to free this list and its chunks.

Parameters:
fih Fileinfo handle for which chunks should be retrieved

void vp_gui_fi_added gnet_fi_t  fih  )  [static]
 

A new fileinfo is available.

We need to create a structure for it and store all relevant information.

Parameters:
fih The fileinfo handle of the entry being added.

void vp_gui_fi_ranges_changed gnet_fi_t  fih  )  [static]
 

The available ranges information has been changed for a file.

Update the information and draw the information so the changes are visible.

Parameters:
fih Handle for fileinfo data that has been changed.

void vp_gui_fi_removed gnet_fi_t  fih  )  [static]
 

Handle the event that a fileinfo entry has been removed.

Parameters:
fih The fileinfo handle of the entry to be removed

void vp_gui_fi_status_changed gnet_fi_t  fih  )  [static]
 

Fileinfo has been changed for a file.

Update the information and draw the information so the changes are visible.

Parameters:
fih Handle for fileinfo data that has been changed.

void vp_gui_init void   ) 
 

Initialize the use of visual progress.

Register listeners into the fileinfo structure so that we are notified of fileinfo events, and get a permanent handle to the drawing area for later reuse.

void vp_gui_shutdown void   ) 
 

Undo everything set up in vp_gui_init.

void vp_print_chunk FILE *  file,
gnet_fi_chunks_t c,
gboolean  show_old
[static]
 

For debugging: print chunk.

void vp_print_chunk_list FILE *  file,
GSList *  list,
gchar *  title
[static]
 

For debugging: print chunk list.


Variable Documentation

GdkColor arrow [static]
 

Pre-filled color (blue) for start of BUSY.

GdkColor available [static]
 

Pre-filled color (blue) available on network.

GdkColor* base [static]
 

Theme-defined background color.

GdkColor black [static]
 

Pre-filled color (black) for general drawing.

GdkColor busy [static]
 

Pre-filled color (yellow) for BUSY chunks.

GdkColor done [static]
 

Pre-filled color (green) for DONE chunks.

GdkColor done_old [static]
 

Pre-filled color (dull green) for DONE chunks from previous sessions.

GdkColor empty [static]
 

Pre-filled color (red) for EMPTY chunks.

vp_context_t fi_context [static]
 

The visual progress context for drawing fileinfo information.

GdkColor nosize [static]
 

Pre-filled color (gray) indicates chunk information is not available (e.g.

file size == 0

GHashTable* vp_info_hash [static]
 

Hash table with our cached fileinfo info.


Generated on Sun Feb 12 10:50:10 2006 for Gtk-Gnutella by doxygen 1.3.6