ELinks 0.18.0
download.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "elinks.h"
#include "bfu/dialog.h"
#include "bfu/hierbox.h"
#include "dialogs/download.h"
#include "dialogs/menu.h"
#include "dialogs/progress.h"
#include "dialogs/status.h"
#include "intl/libintl.h"
#include "main/object.h"
#include "main/select.h"
#include "network/connection.h"
#include "network/progress.h"
#include "protocol/bittorrent/dialogs.h"
#include "protocol/protocol.h"
#include "protocol/uri.h"
#include "session/download.h"
#include "session/session.h"
#include "terminal/draw.h"
#include "terminal/terminal.h"
#include "util/color.h"
#include "util/conv.h"
#include "util/error.h"
#include "util/memlist.h"
#include "util/memory.h"
#include "util/string.h"
#include "util/time.h"
Include dependency graph for download.c:

Macros

#define DOWNLOAD_WIDGETS_COUNT   4
#define DOWNLOAD_METER_WIDTH   15
#define DOWNLOAD_URI_PERCENTAGE   50

Functions

static void undisplay_download (struct file_download *file_download)
static void do_abort_download (struct file_download *file_download)
static widget_handler_status_T dlg_set_notify (struct dialog_data *dlg_data, struct widget_data *widget_data)
static widget_handler_status_T dlg_abort_download (struct dialog_data *dlg_data, struct widget_data *widget_data)
static widget_handler_status_T push_delete_button (struct dialog_data *dlg_data, struct widget_data *widget_data)
static widget_handler_status_T dlg_undisplay_download (struct dialog_data *dlg_data, struct widget_data *widget_data)
static void download_abort_function (struct dialog_data *dlg_data)
static void download_dialog_layouter (struct dialog_data *dlg_data)
static enum dlg_refresh_code refresh_file_download (struct dialog_data *dlg_data, void *data)
void display_download (struct terminal *term, struct file_download *file_download, struct session *ses)
static void lock_file_download (struct listbox_item *item)
static void unlock_file_download (struct listbox_item *item)
static int is_file_download_used (struct listbox_item *item)
static char * get_file_download_text (struct listbox_item *item, struct terminal *term)
static char * get_file_download_info (struct listbox_item *item, struct terminal *term)
static struct uriget_file_download_uri (struct listbox_item *item)
static struct listbox_itemget_file_download_root (struct listbox_item *item)
static int can_delete_file_download (struct listbox_item *item)
static void delete_file_download (struct listbox_item *item, int last)
static void draw_file_download (struct listbox_item *item, struct listbox_context *context, int x, int y, int width)
static widget_handler_status_T push_info_button (struct dialog_data *dlg_data, struct widget_data *button)
static struct_hierbox_browser (download_browser, N_("Download manager"), download_buttons, &downloads_listbox_ops)
void download_manager (struct session *ses)
void init_download_display (struct file_download *file_download)
void done_download_display (struct file_download *file_download)

Variables

static struct listbox_ops_messages download_messages
static const struct listbox_ops downloads_listbox_ops
static const struct hierbox_browser_button download_buttons []

Macro Definition Documentation

◆ DOWNLOAD_METER_WIDTH

#define DOWNLOAD_METER_WIDTH   15

◆ DOWNLOAD_URI_PERCENTAGE

#define DOWNLOAD_URI_PERCENTAGE   50

◆ DOWNLOAD_WIDGETS_COUNT

#define DOWNLOAD_WIDGETS_COUNT   4

Function Documentation

◆ can_delete_file_download()

int can_delete_file_download ( struct listbox_item * item)
static

◆ delete_file_download()

void delete_file_download ( struct listbox_item * item,
int last )
static

◆ display_download()

void display_download ( struct terminal * term,
struct file_download * file_download,
struct session * ses )

◆ dlg_abort_download()

widget_handler_status_T dlg_abort_download ( struct dialog_data * dlg_data,
struct widget_data * widget_data )
static

◆ dlg_set_notify()

widget_handler_status_T dlg_set_notify ( struct dialog_data * dlg_data,
struct widget_data * widget_data )
static

◆ dlg_undisplay_download()

widget_handler_status_T dlg_undisplay_download ( struct dialog_data * dlg_data,
struct widget_data * widget_data )
static

◆ do_abort_download()

void do_abort_download ( struct file_download * file_download)
static

◆ done_download_display()

void done_download_display ( struct file_download * file_download)

◆ download_abort_function()

void download_abort_function ( struct dialog_data * dlg_data)
static

◆ download_dialog_layouter()

void download_dialog_layouter ( struct dialog_data * dlg_data)
static

◆ download_manager()

void download_manager ( struct session * ses)

◆ draw_file_download()

void draw_file_download ( struct listbox_item * item,
struct listbox_context * context,
int x,
int y,
int width )
static

◆ get_file_download_info()

char * get_file_download_info ( struct listbox_item * item,
struct terminal * term )
static

◆ get_file_download_root()

struct listbox_item * get_file_download_root ( struct listbox_item * item)
static

◆ get_file_download_text()

char * get_file_download_text ( struct listbox_item * item,
struct terminal * term )
static

◆ get_file_download_uri()

struct uri * get_file_download_uri ( struct listbox_item * item)
static

◆ init_download_display()

void init_download_display ( struct file_download * file_download)

◆ is_file_download_used()

int is_file_download_used ( struct listbox_item * item)
static

◆ lock_file_download()

void lock_file_download ( struct listbox_item * item)
static

◆ push_delete_button()

widget_handler_status_T push_delete_button ( struct dialog_data * dlg_data,
struct widget_data * widget_data )
static

◆ push_info_button()

widget_handler_status_T push_info_button ( struct dialog_data * dlg_data,
struct widget_data * button )
static

◆ refresh_file_download()

enum dlg_refresh_code refresh_file_download ( struct dialog_data * dlg_data,
void * data )
static

◆ struct_hierbox_browser()

struct_hierbox_browser ( download_browser ,
N_("Download manager") ,
download_buttons ,
& downloads_listbox_ops )
static

◆ undisplay_download()

void undisplay_download ( struct file_download * file_download)
static

◆ unlock_file_download()

void unlock_file_download ( struct listbox_item * item)
static

Variable Documentation

◆ download_buttons

const struct hierbox_browser_button download_buttons[]
static
Initial value:
= {
{ N_("~Info"), push_info_button },
{ N_("C~lear"), push_hierbox_clear_button },
}
static widget_handler_status_T push_info_button(struct dialog_data *dlg_data, struct widget_data *button)
Definition download.c:482
#define N_(msg)
Definition libintl.h:25
widget_handler_status_T push_hierbox_clear_button(struct dialog_data *dlg_data, struct widget_data *button)
Definition hierbox.c:863
widget_handler_status_T push_hierbox_delete_button(struct dialog_data *dlg_data, struct widget_data *button)
Definition hierbox.c:799

◆ download_messages

struct listbox_ops_messages download_messages
static
Initial value:
= {
N_("Sorry, but download \"%s\" cannot be interrupted."),
N_("Sorry, but download \"%s\" is being used by something else."),
N_("Interrupt marked downloads"),
N_("Interrupt marked downloads?"),
N_("Interrupt download"),
N_("Interrupt this download?"),
N_("Interrupt all downloads"),
N_("Do you really want to interrupt all downloads?"),
}
#define NULL
Definition explodename.c:35

◆ downloads_listbox_ops

const struct listbox_ops downloads_listbox_ops
static
Initial value:
= {
}
static struct listbox_ops_messages download_messages
Definition download.c:438
static struct listbox_item * get_file_download_root(struct listbox_item *item)
Definition download.c:354
static int is_file_download_used(struct listbox_item *item)
Definition download.c:315
static int can_delete_file_download(struct listbox_item *item)
Definition download.c:360
static void delete_file_download(struct listbox_item *item, int last)
Definition download.c:366
static char * get_file_download_text(struct listbox_item *item, struct terminal *term)
Definition download.c:321
static void unlock_file_download(struct listbox_item *item)
Definition download.c:309
static struct uri * get_file_download_uri(struct listbox_item *item)
Definition download.c:346
static void draw_file_download(struct listbox_item *item, struct listbox_context *context, int x, int y, int width)
Definition download.c:380
static void lock_file_download(struct listbox_item *item)
Definition download.c:303
static char * get_file_download_info(struct listbox_item *item, struct terminal *term)
Definition download.c:340