| 45 | #include "phnc.h" |
| 46 | |
| 47 | void photorec_info(WINDOW *window, const file_stat_t *file_stats) |
| 48 | { |
| 49 | unsigned int i; |
| 50 | unsigned int nbr; |
| 51 | unsigned int others=0; |
| 52 | file_stat_t *new_file_stats; |
| 53 | for(i=0;file_stats[i].file_hint!=NULL;i++); |
| 54 | nbr=i; |
| 55 | if(nbr==0) |
| 56 | return ; |
| 57 | new_file_stats=(file_stat_t*)MALLOC(nbr*sizeof(file_stat_t)); |
| 58 | memcpy(new_file_stats, file_stats, nbr*sizeof(file_stat_t)); |
| 59 | qsort(new_file_stats, nbr, sizeof(file_stat_t), sorfile_stat_ts); |
| 60 | for(i=0; i<9 && i<nbr && new_file_stats[i].recovered>0; i++) |
| 61 | { |
| 62 | wmove(window,12+i,0); |
| 63 | wclrtoeol(window); |
| 64 | wprintw(window, "%s: %u recovered\n", |
| 65 | (new_file_stats[i].file_hint->extension!=NULL? |
| 66 | new_file_stats[i].file_hint->extension:""), |
| 67 | new_file_stats[i].recovered); |
| 68 | } |
| 69 | for(;i<nbr && new_file_stats[i].recovered>0;i++) |
| 70 | others+=new_file_stats[i].recovered; |
| 71 | if(others>0) |
| 72 | { |
| 73 | wmove(window,12+9,0); |
| 74 | wclrtoeol(window); |
| 75 | wprintw(window, "others: %u recovered\n", others); |
| 76 | } |
| 77 | free(new_file_stats); |
| 78 | } |
| 79 | |
| 80 | pstatus_t photorec_progressbar(WINDOW *window, const unsigned int pass, const struct ph_param *params, const uint64_t offset, const time_t current_time) |
| 81 | { |
no test coverage detected