Visual progress indicator for files in the download queue.
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.
#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_t * | vp_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. |
|
The height of the indicator arrows in visual progress.
|
|
The context for drawing, including location to draw.
|
|
Locally cached information from fileinfo needed for drawing the graphics.
|
|
Callback for the fileinfo pane GtkDrawingArea.
|
|
Callback for the fileinfo pane GtkDrawingArea.
|
|
|
|
Assert that a chunks list confirms to the assumptions.
|
|
Allocate a new chunk based on the parameters.
|
|
Draw an downward arrow starting at the top.
|
|
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. |
|
Draw a chunk for visual progress.
|
|
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. |
|
Draw an available range. Callback for a list iterator.
|
|
Draw a rectangle for visual progress.
|
|
Free the vp_info_t structs in the vp_info_hash.
|
|
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.
|
|
A new fileinfo is available. We need to create a structure for it and store all relevant information.
|
|
The available ranges information has been changed for a file. Update the information and draw the information so the changes are visible.
|
|
Handle the event that a fileinfo entry has been removed.
|
|
Fileinfo has been changed for a file. Update the information and draw the information so the changes are visible.
|
|
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. |
|
Undo everything set up in vp_gui_init.
|
|
For debugging: print chunk.
|
|
For debugging: print chunk list.
|
|
Pre-filled color (blue) for start of BUSY.
|
|
Pre-filled color (blue) available on network.
|
|
Theme-defined background color.
|
|
Pre-filled color (black) for general drawing.
|
|
Pre-filled color (yellow) for BUSY chunks.
|
|
Pre-filled color (green) for DONE chunks.
|
|
Pre-filled color (dull green) for DONE chunks from previous sessions.
|
|
Pre-filled color (red) for EMPTY chunks.
|
|
The visual progress context for drawing fileinfo information.
|
|
Pre-filled color (gray) indicates chunk information is not available (e.g. file size == 0 |
|
Hash table with our cached fileinfo info.
|