⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 edit.cc

📁 一个功能比较强的下载软件
💻 CC
📖 第 1 页 / 共 5 页
字号:
	temp1=1;	sscanf(gtk_entry_get_text(GTK_ENTRY(ftp_recurse_depth_entry)),"%u",&temp1);	if (temp1>=0) parent->config->ftp_recurse_depth=temp1;	temp1=1;	sscanf(gtk_entry_get_text(GTK_ENTRY(http_recurse_depth_entry)),"%u",&temp1);	if (temp1>=0) parent->config->http_recurse_depth=temp1;	sscanf(gtk_entry_get_text(GTK_ENTRY(rollback_entry)),"%u",&temp1);	if (temp1>=0) parent->config->rollback=temp1;	sscanf(gtk_entry_get_text(GTK_ENTRY(speed_entry)),"%u",&temp1);	if (temp1>=0) parent->config->speed=temp1;	parent->config->passive=GTK_TOGGLE_BUTTON(ftp_passive_check)->active;	parent->config->dont_send_quit=GTK_TOGGLE_BUTTON(dont_send_quit_check)->active;	parent->config->permisions=GTK_TOGGLE_BUTTON(permisions_check)->active;	parent->config->get_date=GTK_TOGGLE_BUTTON(get_date_check)->active;	parent->config->retry=GTK_TOGGLE_BUTTON(retry_check)->active;	parent->config->follow_link=0;	if (GTK_TOGGLE_BUTTON(follow_link_check)->active) parent->config->follow_link=1;	if (GTK_TOGGLE_BUTTON(link_as_file_check)->active) parent->config->follow_link=2;	parent->config->leave_server=GTK_TOGGLE_BUTTON(leave_server_check)->active;	parent->config->ihate_etag=GTK_TOGGLE_BUTTON(ihate_etag_check)->active;	parent->config->dont_leave_dir=GTK_TOGGLE_BUTTON(leave_dir_check)->active;	parent->restart_from_begin=GTK_TOGGLE_BUTTON(restart_from_begin_check)->active;	parent->config->sleep_before_complete=GTK_TOGGLE_BUTTON(sleep_check)->active;	parent->config->change_links=GTK_TOGGLE_BUTTON(change_links_check)->active;	parent->config->http_recursing=parent->config->http_recurse_depth==1?0:1;	parent->config->quest_sign_replace=GTK_TOGGLE_BUTTON(quest_sign_check)->active;	parent->config->ftp_dirontop=GTK_TOGGLE_BUTTON(ftp_dirontop_check)->active;	parent->config->check_time=GTK_TOGGLE_BUTTON(check_time_check)->active;	temp1=0;	sscanf(gtk_entry_get_text(GTK_ENTRY(split_entry)),"%u",&temp1);	if (parent->config->isdefault) temp1=CFG.NUMBER_OF_PARTS;	if (temp1>1){		if (temp1>10) temp1=10;		if (parent->split==NULL)			parent->split=new tSplitInfo;		parent->split->NumOfParts=temp1;	}else{		if (parent->split)			delete(parent->split);		parent->split=NULL;	};	if (limit && con_limit_entry){		sscanf(gtk_entry_get_text(GTK_ENTRY(con_limit_entry)),"%u",&temp1);		if (temp1>=0)			parent->config->con_limit=temp1;		else			parent->config->con_limit=0;	};	if (GTK_TOGGLE_BUTTON(time_check)->active) {		time_t NOW=time(NULL);		struct tm date;		date.tm_isdst=-1;		localtime_r(&NOW,&date);		sscanf(text_from_combo(hour_entry),"%i",&date.tm_hour);		sscanf(text_from_combo(minute_entry),"%i",&date.tm_min);		gtk_calendar_get_date(GTK_CALENDAR(calendar),				      (guint *)&date.tm_year,				      (guint *)&date.tm_mon,				      (guint *)&date.tm_mday);		date.tm_year-=1900;		date.tm_sec=0;		parent->ScheduleTime=mktime(&date);		if (parent_in_db && time(NULL)<parent->ScheduleTime){			aa.schedule_download(parent);			parent_in_db=0;		};	} else {		parent->ScheduleTime=0;	};	return 0;};void tDEdit::toggle_isdefault() {	int a=!GTK_TOGGLE_BUTTON(isdefault_check)->active;//	gtk_widget_set_sensitive(restart_from_begin_check,a);	gtk_widget_set_sensitive(proxy->frame,a);//	gtk_widget_set_sensitive(split_entry,a);	gtk_widget_set_sensitive(path_entry,a);	gtk_widget_set_sensitive(timeout_entry,a);	gtk_widget_set_sensitive(sleep_entry,a);	gtk_widget_set_sensitive(attempts_entry,a);	gtk_widget_set_sensitive(rollback_entry,a);	gtk_widget_set_sensitive(speed_entry,a);	gtk_widget_set_sensitive(get_date_check,a);	gtk_widget_set_sensitive(retry_check,a);	gtk_widget_set_sensitive(sleep_check,a);	gtk_widget_set_sensitive(check_time_check,a);	gtk_widget_set_sensitive(log_save_entry,a);	gtk_widget_set_sensitive(ftp_frame,a);	gtk_widget_set_sensitive(http_frame,a);};void tDEdit::toggle_time() {	gtk_widget_set_sensitive(calendar,GTK_TOGGLE_BUTTON(time_check)->active);	gtk_widget_set_sensitive(hour_entry,GTK_TOGGLE_BUTTON(time_check)->active);	gtk_widget_set_sensitive(minute_entry,GTK_TOGGLE_BUTTON(time_check)->active);};void tDEdit::set_description(char *desc){	if (desc)		text_to_combo(desc_entry,desc);	else		text_to_combo(desc_entry,"");		};void tDEdit::setup_entries() {	set_editable_for_combo(pass_entry,GTK_TOGGLE_BUTTON(use_pass_check)->active);	gtk_editable_set_editable(GTK_EDITABLE(GTK_COMBO(user_entry)->entry),GTK_TOGGLE_BUTTON(use_pass_check)->active);	gtk_widget_set_sensitive(user_entry,GTK_TOGGLE_BUTTON(use_pass_check)->active);	gtk_widget_set_sensitive(pass_entry,GTK_TOGGLE_BUTTON(use_pass_check)->active);};void tDEdit::setup_time(time_t when) {	char data[MAX_LEN];	struct tm date;	if (when){		localtime_r(&when,&date);	}else{		time_t NOW=time(NULL);		localtime_r(&NOW,&date);		date.tm_hour=1;		date.tm_min=0;		time_t tonight=mktime(&date);		if (tonight<NOW)			tonight+=24*60*60;		localtime_r(&tonight,&date);	};	sprintf(data,"%i",date.tm_hour);	text_to_combo(hour_entry,data);	sprintf(data,"%i",date.tm_min);	text_to_combo(minute_entry,data);	gtk_calendar_select_month(GTK_CALENDAR(calendar),date.tm_mon,date.tm_year+1900);	gtk_calendar_select_day(GTK_CALENDAR(calendar),date.tm_mday);	GTK_TOGGLE_BUTTON(time_check)->active=when?TRUE:FALSE;	toggle_time();};void  tDEdit::paste_url() {	char *a=d4x_mw_clipboard_get();	if (a && global_url(a)){		set_url(a);		return;	};	if (old_clipboard_content()!=NULL && global_url(old_clipboard_content())){		set_url(old_clipboard_content());		return;	};	gtk_editable_paste_clipboard(GTK_EDITABLE(GTK_COMBO(url_entry)->entry));//	printf("%s\n",text_from_combo(url_entry));};void tDEdit::select_url() {	gtk_editable_select_region(GTK_EDITABLE(GTK_COMBO(url_entry)->entry),0,strlen(text_from_combo(url_entry)));};void tDEdit::clear_url() {	text_to_combo(url_entry,"");};void tDEdit::clear_save_name() {	text_to_combo(MY_GTK_FILESEL(file_entry)->combo,"");};char *tDEdit::get_url(){	return(text_from_combo(url_entry));};void tDEdit::set_url(char *a) {	text_to_combo(url_entry,a);};void tDEdit::disable_time(){	gtk_widget_set_sensitive(time_check,FALSE);};void tDEdit::disable_save_name(){	gtk_widget_set_sensitive(file_entry,FALSE);};void tDEdit::disable_items(int *array){	gtk_widget_set_sensitive(url_entry,FALSE);	gtk_widget_set_sensitive(file_entry,FALSE);	gtk_widget_set_sensitive(pause_check,FALSE);	gtk_widget_set_sensitive(log_save_entry,FALSE);	if (array[EDIT_OPT_USERPASS]==0){		gtk_widget_set_sensitive(pass_entry,FALSE);		gtk_widget_set_sensitive(user_entry,FALSE);		gtk_widget_set_sensitive(use_pass_check,FALSE);	};	if (array[EDIT_OPT_SAVEPATH]==0)		gtk_widget_set_sensitive(path_entry,FALSE);	if (array[EDIT_OPT_USERAGENT]==0)		gtk_widget_set_sensitive(user_agent_entry,FALSE);	if (array[EDIT_OPT_REFERER]==0)		gtk_widget_set_sensitive(referer_entry,FALSE);	if (array[EDIT_OPT_COOKIE]==0)		gtk_widget_set_sensitive(cookie_entry,FALSE);	if (array[EDIT_OPT_TIMEOUT]==0)		gtk_widget_set_sensitive(timeout_entry,FALSE);	if (array[EDIT_OPT_ATTEMPTS]==0)		gtk_widget_set_sensitive(attempts_entry,FALSE);	if (array[EDIT_OPT_SLEEPTIME]==0)		gtk_widget_set_sensitive(sleep_entry,FALSE);	if (array[EDIT_OPT_ROLLBACK]==0)		gtk_widget_set_sensitive(rollback_entry,FALSE);	if (array[EDIT_OPT_PASSIVEFTP]==0)		gtk_widget_set_sensitive(ftp_passive_check,FALSE);	if (array[EDIT_OPT_DIRONTOP]==0)		gtk_widget_set_sensitive(ftp_dirontop_check,FALSE);	if (array[EDIT_OPT_PERMISSIONS]==0)		gtk_widget_set_sensitive(permisions_check,FALSE);	if (array[EDIT_OPT_DATE]==0)		gtk_widget_set_sensitive(get_date_check,FALSE);	if (array[EDIT_OPT_IFNOREGET]==0)		gtk_widget_set_sensitive(retry_check,FALSE);	if (array[EDIT_OPT_FOLLOWLINK]==0){		gtk_widget_set_sensitive(follow_link_check,FALSE);		gtk_widget_set_sensitive(link_as_file_check,FALSE);		gtk_widget_set_sensitive(load_link_check,FALSE);	};	if (array[EDIT_OPT_LEAVESERVER]==0)		gtk_widget_set_sensitive(leave_server_check,FALSE);	if (array[EDIT_OPT_LEAVEDIR]==0)		gtk_widget_set_sensitive(leave_dir_check,FALSE);	if (array[EDIT_OPT_CHANGE_LINKS]==0)		gtk_widget_set_sensitive(change_links_check,FALSE);	if (array[EDIT_OPT_IHATEETAG]==0)		gtk_widget_set_sensitive(ihate_etag_check,FALSE);	if (array[EDIT_OPT_QUEST_SIGN]==0)		gtk_widget_set_sensitive(quest_sign_check,FALSE);	if (array[EDIT_OPT_RECURSEDEPTHFTP]==0)		gtk_widget_set_sensitive(ftp_recurse_depth_entry,FALSE);	if (array[EDIT_OPT_RECURSEDEPTHHTTP]==0)		gtk_widget_set_sensitive(http_recurse_depth_entry,FALSE);	if (array[EDIT_OPT_FROMBEGIN]==0)		gtk_widget_set_sensitive(restart_from_begin_check,FALSE);	if (array[EDIT_OPT_SPEED]==0)		gtk_widget_set_sensitive(speed_entry,FALSE);	if (array[EDIT_OPT_CHECK_TIME]==0)		gtk_widget_set_sensitive(check_time_check,FALSE);	if (array[EDIT_OPT_SLEEP_BEFORE_COMPLETE]==0)		gtk_widget_set_sensitive(sleep_check,FALSE);	if (array[EDIT_OPT_TIME]==0){		gtk_widget_set_sensitive(time_check,FALSE);		gtk_widget_set_sensitive(calendar,FALSE);		gtk_widget_set_sensitive(hour_entry,FALSE);		gtk_widget_set_sensitive(minute_entry,FALSE);	};	if (array[EDIT_OPT_SPLIT]==0)		gtk_widget_set_sensitive(split_entry,FALSE);	if (array[EDIT_OPT_PROXY]==0)		gtk_widget_set_sensitive(proxy->frame,FALSE);	if (array[EDIT_OPT_DONT_SEND_QUIT]==0)		gtk_widget_set_sensitive(dont_send_quit_check,FALSE);};void tDEdit::apply_enabled_changes(){	if (GTK_WIDGET_SENSITIVE(proxy->frame)){		switch(parent->info->proto){		case D_PROTO_FTP:{			proxy->apply_changes(parent->config,1);			break;		};		case D_PROTO_HTTP:{			proxy->apply_changes(parent->config,0);			break;		};		};	};	if (GTK_WIDGET_SENSITIVE(use_pass_check)){		char *pass_string=text_from_combo(pass_entry);		if (GTK_TOGGLE_BUTTON(use_pass_check)->active) {			if (strlen(text_from_combo(user_entry)) && strlen(pass_string)) {				parent->info->username.set(text_from_combo(user_entry));				ALL_HISTORIES[USER_HISTORY]->add(parent->info->username.get());				parent->info->pass.set(pass_string);				if (CFG.REMEMBER_PASS)					ALL_HISTORIES[PASS_HISTORY]->add(pass_string);			};		};	};	if (GTK_WIDGET_SENSITIVE(path_entry)){		parent->config->save_path.set(text_from_combo(MY_GTK_FILESEL(path_entry)->combo));		normalize_path(parent->config->save_path.get());		ALL_HISTORIES[PATH_HISTORY]->add(text_from_combo(MY_GTK_FILESEL(path_entry)->combo));	};	if (GTK_WIDGET_SENSITIVE(user_agent_entry)){		parent->config->user_agent.set(text_from_combo(user_agent_entry));		ALL_HISTORIES[USER_AGENT_HISTORY]->add(text_from_combo(user_agent_entry));	};	if (GTK_WIDGET_SENSITIVE(referer_entry)){		char *referer=text_from_combo(referer_entry);		if (referer && *referer){			parent->config->referer.set(referer);			ALL_HISTORIES[REFERER_HISTORY]->add(referer);		}else			parent->config->referer.set(NULL);	};	if (GTK_WIDGET_SENSITIVE(cookie_entry)){		char *referer=text_from_combo(cookie_entry);		if (referer && *referer){			parent->config->cookie.set(referer);			ALL_HISTORIES[COOKIE_HISTORY]->add(referer);		}else			parent->config->cookie.set(NULL);	};	/*change data in list if available	 */	int  temp1=0;	if (GTK_WIDGET_SENSITIVE(timeout_entry)){		sscanf(gtk_entry_get_text(GTK_ENTRY(timeout_entry)),"%u",&temp1);		if (temp1>0 && temp1<1000) parent->config->timeout=temp1;	};	if (GTK_WIDGET_SENSITIVE(sleep_entry)){		sscanf(gtk_entry_get_text(GTK_ENTRY(sleep_entry)),"%u",&temp1);		if (temp1>=0 && temp1<1000) parent->config->time_for_sleep=temp1;	};	if (GTK_WIDGET_SENSITIVE(attempts_entry)){		sscanf(gtk_entry_get_text(GTK_ENTRY(attempts_entry)),"%u",&temp1);		if (temp1>=0) parent->config->number_of_attempts=temp1;	};	if (GTK_WIDGET_SENSITIVE(ftp_recurse_depth_entry)){		temp1=1;		sscanf(gtk_entry_get_text(GTK_ENTRY(ftp_recurse_depth_entry)),"%u",&temp1);		if (temp1>=0) parent->config->ftp_recurse_depth=temp1;	};	if (GTK_WIDGET_SENSITIVE(http_recurse_depth_entry)){		temp1=1;		sscanf(gtk_entry_get_text(GTK_ENTRY(http_recurse_depth_entry)),"%u",&temp1);		if (temp1>=0) parent->config->http_recurse_depth=temp1;	};	if (GTK_WIDGET_SENSITIVE(rollback_entry)){		sscanf(gtk_entry_get_text(GTK_ENTRY(rollback_entry)),"%u",&temp1);		if (temp1>=0) parent->config->rollback=temp1;	};	if (GTK_WIDGET_SENSITIVE(speed_entry)){		sscanf(gtk_entry_get_text(GTK_ENTRY(speed_entry)),"%u",&temp1);		if (temp1>=0) parent->config->speed=temp1;	};	if (GTK_WIDGET_SENSITIVE(ftp_passive_check))		parent->config->passive=GTK_TOGGLE_BUTTON(ftp_passive_check)->active;	if (GTK_WIDGET_SENSITIVE(dont_send_quit_check))		parent->config->dont_send_quit=GTK_TOGGLE_BUTTON(dont_send_quit_check)->active;	if (GTK_WIDGET_SENSITIVE(permisions_check))		parent->config->permisions=GTK_TOGGLE_BUTTON(permisions_check)->active;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -