📄 transfer.h
字号:
/**************************************************************** ** 文件名: transfer.h ** 建立日期: 2002年8月2日 ** 作者: 何林强 ** 描述: ***************************************************************/#ifndef TRANSFER_H#define TRANSFER_H/*************************************** ** 结构名: transfer_files; ** 建立日期:2002年8月14日 ** 作者: 何林强 ** 描述: 这是文件传输时记录的目录树 ***************************************/struct Ctransfer_files{ gchar filename[100]; glong filesize; gint filetype; Ctransfer_files* brother;};/****************************************************** ** 类名: Chftp_transfer ** 建立日期:2002年8月2日 ** 建立者: 何林强 ** 描述: 这个类原本是想作为ftp协议底层的内容与 ** 与用户界面之间的一个接口,但设计结果并 ** 没有完全达到预期目的,整个程序的主要操 ** 作集中于此. ******************************************************/class Chftp_transfer{ private: /**************** **传入的参数. *****************/ static GtkWidget *Filenotebook; //整个远程文件列表的notebook. Chftp_Filelist *Local; //本地文件列表的一个类. Chftp_State *StateBox; //下载状态框. Chftp_Filedata *Localdata; //关于本地磁盘的数据的一个类. gint pageindex; //记录本页是属于notebook中的第几页. /////////////////////////////// Chftp_Filelist *Remote_Filelist; //登陆一个ftp服务器后的文件列表框的类. CRFC959 *Rfc959; //一个ftp连接(ftp协议在RFC959文档中描述); gchar *files[7]; //用于处理列表框的标题. Chftp_conflict_dialog *conflict; //文件下载出现冲突时的选择对话框。 gint timeout1; gint timeout2; gint timeout3[5]; gint timeout4; /******************** **互斥量及伪互斥量及标志 *********************/ sem_t bin_sem; gint tag; //记录当前是上传还是下载. gint mutex; //无奈,第二个二元信号量无法再定义 //,互斥量会跟时间函数有冲突,可恶的gtk+库.
static gint staterows; //状态列表框中列有的状态总数. gint position; //下载状态在状态框中的位置. gint is_dir; //当前选中的是否目录. gint mutitrans; //同时传输多少文件时,用于控制先后顺序. /************************ ** 传输过程中的状态量 *************************/ FILE *myfile; //本地文件. gchar *filename_text; //远程文件的文件名. glong progress; //文件下载进度. glong filesize; //文件长度. glong donesize; //下载中碰到同名文件,则记录下同名文件大小,以备续传用. time_t starttime; //文件开始下载(上传)的起始时间. /******************************************** ** 以下为同时传输多个文件用到的变量 ********************************************/ Ctransfer_files *filestree; //传输多文件时的目录树(转储为链表). Ctransfer_files *currentfile; //链表当前指针. char *uploaddir; //传输多个文件时的远程当前路径. char fulldir[900]; //本地绝对路径. /****************************************** ** 远程(本地)框中两个弹出菜单, *****************************************/ Chftp_Remote_menu_1 *Remote_pop_menu_1; Chftp_Remote_menu_2 *Remote_pop_menu_2; Chftp_Local_menu_1 *Local_pop_menu_1; Chftp_Local_menu_2 *Local_pop_menu_2; ///////////////////////////////////////////////////////////////////////// private: static gint Re_Connect(gpointer data); static gint idle_function(gpointer data); static void hftp_getdir(GtkWidget *TheWindow,gpointer data); static void hftp_backdir(GtkWidget *TheWindow,gpointer data); static void hftp_Refresh(GtkWidget *TheWindow,gpointer data); static void hftp_shut_down(GtkWidget *TheWindow,gpointer data); ///////////////////////////////////////////////////////////////////////// static void hftp_list_dbclick_local(GtkWidget *widget, GdkEventButton *event,gpointer data); static void Locallistbox_drag(GtkWidget *widget, GdkDragContext *context, GtkSelectionData *selection_data,guint info,guint32 clk_time, gpointer data); void upload_a_file(GtkWidget *widget,gint row); static void hftp_list_dbclick_remote(GtkWidget *widget, GdkEventButton *event, gpointer data); static void Remotelistbox_drag(GtkWidget *widget, GdkDragContext *context, GtkSelectionData *selection_data,guint info,guint32 clk_time, gpointer data); void search_a_function(); static gint call_timeout_func1(gpointer data); static gint call_timeout_func2(gpointer data); static gint call_timeout_func3(gpointer data); static gint call_timeout_func4(gpointer data); static gint call_timeout_func5(gpointer data); gint check_waitfiles(); Ctransfer_files *get_download_dir(Ctransfer_files **tree,char *dirname); void end_dir_transfer(); //////////////////////////////////////////////////////////////////////////////// glong create_transfer(const gchar *filename,const gchar *localfilename,off_t startsize); static gint updata_progress(gpointer data); gint hftp_read_files(Ctransfer_files **tree,gint tag); static gpointer hftp_get_file(gpointer arg); gint hftp_get_next_request(FILE *fd,gchar *buf,gint size); glong hftp_get_next_file_chunk(gchar *buf,glong size); glong hftp_put_next_file_chunk(gchar *buf, glong size); void hftp_calc_kbs(gchar **speed); void hftp_calc_time(gchar **timeuse,gchar **timeleft); void hftp_convert_size(glong filesize,gchar **strsize); public: Chftp_transfer(GtkWidget *Filelist,Chftp_Filelist *p_Local, Chftp_Toolbar *hftp_Toolbar,Chftp_State *p_State, Chftp_Filedata *p_Localdata,gint index); ~Chftp_transfer(); friend class Chftp_conflict_dialog; friend class Chftp_Remote_menu_1; friend class Chftp_Remote_menu_2; friend class Chftp_Local_menu_1; friend class Chftp_Local_menu_2;};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -