/[mldonkey]/mldonkey/src/gtk2/gui/guiMisc.ml
ViewVC logotype

Diff of /mldonkey/src/gtk2/gui/guiMisc.ml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.10 by spiralvoice, Sun Oct 16 20:42:53 2005 UTC revision 1.11 by spiralvoice, Mon Oct 31 18:34:02 2005 UTC
# Line 60  let save_gui_options gui = Line 60  let save_gui_options gui =
60  (*                      To pretty-print a file size                               *)  (*                      To pretty-print a file size                               *)
61  (*                                                                                *)  (*                                                                                *)
62  (**********************************************************************************)  (**********************************************************************************)
63  let ko = 1024l  let ko = Int32.of_int 1024
 let mo = Int32.mul ko ko  
64        
65  let unit_of_string s =  let unit_of_string s =
66    match String.lowercase s with    match String.lowercase s with
67      "mo" -> mo      "mo" -> Int32.mul ko ko
68    | "ko" -> ko    | "ko" -> ko
69    | _ -> Int32.one    | _ -> Int32.one
70    
# Line 503  let is_connected state = Line 502  let is_connected state =
502  (*************************************************************************)  (*************************************************************************)
503    
504  let uploader_state_to_string state has_upload =  let uploader_state_to_string state has_upload =
505    if has_upload    if has_upload = source_has_upload
506      then begin      then begin
507        match state with        match state with
508            Connected_downloading _  -> !M.dT_tx_updown            Connected_downloading _  -> !M.dT_tx_updown
# Line 1269  let list_files tree = Line 1268  let list_files tree =
1268  let client_to_source c =  let client_to_source c =
1269    let s =    let s =
1270      {      {
1271       source_num = c.client_num;       source_num             = c.client_num;
1272       source_network = c.client_network;       source_network         = c.client_network;
1273    
1274       source_kind = c.client_kind;       source_kind            = c.client_kind;
1275       source_state = c.client_state;       source_state           = c.client_state;
1276       source_type = c.client_type;       source_type            = c.client_type;
1277       source_tags = c.client_tags;       source_tags            = c.client_tags;
1278       source_name = U.utf8_of c.client_name;       source_name            = U.utf8_of c.client_name;
1279       source_files = None;       source_files           = None;
1280       source_rating = c.client_rating;       source_rating          = c.client_rating;
1281       source_chat_port = c.client_chat_port;       source_chat_port       = c.client_chat_port;
1282       source_connect_time = BasicSocket.last_time () - c.client_connect_time;       source_connect_time    = BasicSocket.last_time () - c.client_connect_time;
1283       source_last_seen = BasicSocket.current_time ();       source_last_seen       = BasicSocket.current_time ();
1284       source_software = concat_strings c.client_software (concat_strings c.client_emulemod c.client_release);       source_software        = concat_strings c.client_software (concat_strings c.client_emulemod c.client_release);
1285       source_downloaded = c.client_downloaded;       source_downloaded      = c.client_downloaded;
1286       source_uploaded = c.client_uploaded;       source_uploaded        = c.client_uploaded;
1287       source_upload_rate = 0.;       source_upload_rate     = 0.;
1288       source_download_rate = 0.;       source_download_rate   = 0.;
1289       source_upload = c.client_upload;       source_upload          = c.client_upload;
1290       source_has_upload = false;       source_has_upload      = source_only;
1291       source_availability = [];       source_availability    = [];
1292       source_files_requested = [];       source_files_requested = [];
1293      }      }
1294    in    in
# Line 1305  let uid_list_to_string l = Line 1304  let uid_list_to_string l =
1304    match l with    match l with
1305        [] -> ""        [] -> ""
1306      | uid :: _ -> U.simple_utf8_of (Uid.to_string uid)      | uid :: _ -> U.simple_utf8_of (Uid.to_string uid)
1307    
1308    (*************************************************************************)
1309    (*                                                                       *)
1310    (*                        to_uid_type                                    *)
1311    (*                                                                       *)
1312    (*************************************************************************)
1313    
1314    let to_uid_type l =
1315      match l with
1316          [] -> NoUid
1317        | uid :: _ -> Uid.to_uid uid
1318    
1319    (*************************************************************************)
1320    (*                                                                       *)
1321    (*                        shared_info_to_shared_file                     *)
1322    (*                                                                       *)
1323    (*************************************************************************)
1324    
1325    let shared_info_to_shared_file si =
1326      {
1327        g_shared_num       = si.shared_num;
1328        g_shared_network   = si.shared_network;
1329        g_shared_filename  = si.shared_filename;
1330        g_shared_size      = si.shared_size;
1331        g_shared_uploaded  = si.shared_uploaded;
1332        g_shared_requests  = si.shared_requests;
1333        g_shared_uids      = si.shared_uids;
1334        g_shared_last_seen = BasicSocket.current_time ();
1335      }
1336    
1337    (*************************************************************************)
1338    (*                                                                       *)
1339    (*                        file_info_to_g_file_info                       *)
1340    (*                                                                       *)
1341    (*************************************************************************)
1342    
1343    let file_info_to_g_file_info f =
1344      {
1345        g_file_num             = f.file_num;
1346        g_file_network         = f.file_network;
1347    
1348        g_file_comment         = f.file_comment;
1349        g_file_name            = f.file_name;
1350        g_file_names           = f.file_names;
1351        g_file_size            = f.file_size;
1352        g_file_downloaded      = f.file_downloaded;
1353        g_file_active_sources  = f.file_active_sources;
1354        g_file_all_sources     = f.file_all_sources;
1355        g_file_state           = f.file_state;
1356        g_file_chunks          = f.file_chunks;
1357        g_file_availability    = f.file_availability;
1358        g_file_sources         = f.file_sources;
1359        g_file_download_rate   = f.file_download_rate;
1360        g_file_format          = f.file_format;
1361        g_file_chunks_age      = f.file_chunks_age;
1362        g_file_age             = (BasicSocket.last_time () - f.file_age);
1363        g_file_last_seen       = (BasicSocket.last_time () - f.file_last_seen);
1364        g_file_priority        = f.file_priority;
1365        g_file_uids            = f.file_uids;
1366    
1367        g_file_razorback_stats = None;
1368      }

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26