예제 #1
0
  virtual void do_update_ui() {
    const unsigned c_width = 60;

    percent_done = calc_percent(extract_completed, extract_total);

    unsigned __int64 extract_speed;
    if (time_elapsed() == 0)
      extract_speed = 0;
    else
      extract_speed = al_round(static_cast<double>(extract_completed) / time_elapsed() * ticks_per_sec());

    if (extract_total && cache_total > extract_total)
      cache_total = extract_total;

    unsigned cache_stored_percent = calc_percent(cache_stored, cache_total);
    unsigned cache_written_percent = calc_percent(cache_written, cache_total);

    wostringstream st;
    st << fit_str(arc_path, c_width) << L'\n';
    st << L"\x1\n";
    st << fit_str(extract_file_path, c_width) << L'\n';
    st << setw(7) << format_data_size(extract_completed, get_size_suffixes()) << L" / " << format_data_size(extract_total, get_size_suffixes()) << L" @ " << setw(9) << format_data_size(extract_speed, get_speed_suffixes()) << L'\n';
    st << Far::get_progress_bar_str(c_width, percent_done, 100) << L'\n';
    st << L"\x1\n";
    st << fit_str(cache_file_path, c_width) << L'\n';
    st << L"(" << format_data_size(cache_stored, get_size_suffixes()) << L" - " << format_data_size(cache_written, get_size_suffixes()) << L") / " << format_data_size(cache_total, get_size_suffixes()) << L'\n';
    st << get_progress_bar_str(c_width, cache_written_percent, cache_stored_percent) << L'\n';
    progress_text = st.str();
  }
예제 #2
0
  virtual void do_update_ui() {
    const unsigned c_width = 60;

    if (total == 0)
      percent_done = 0;
    else
      percent_done = al_round(static_cast<double>(completed) * 100 / total);
    if (percent_done > 100)
      percent_done = 100;

    unsigned __int64 speed;
    if (time_elapsed() == 0)
      speed = 0;
    else
      speed = al_round(static_cast<double>(completed) / time_elapsed() * ticks_per_sec());

    wostringstream st;
    st << setw(7) << format_data_size(completed, get_size_suffixes()) << L" / " << format_data_size(total, get_size_suffixes()) << L" @ " << setw(9) << format_data_size(speed, get_speed_suffixes()) << L'\n';
    st << Far::get_progress_bar_str(c_width, percent_done, 100) << L'\n';
    progress_text = st.str();
  }
예제 #3
0
wstring get_progress_bar_str(unsigned width, unsigned percent1, unsigned percent2) {
  const wchar_t c_pb_black = 9608;
  const wchar_t c_pb_gray = 9619;
  const wchar_t c_pb_white = 9617;
  unsigned len1 = al_round(static_cast<double>(percent1) / 100 * width);
  if (len1 > width)
    len1 = width;
  unsigned len2 = al_round(static_cast<double>(percent2) / 100 * width);
  if (len2 > width)
    len2 = width;
  if (len2 > len1)
    len2 -= len1;
  else
    len2 = 0;
  unsigned len3 = width - (len1 + len2);
  wstring result;
  result.append(len1, c_pb_black);
  result.append(len2, c_pb_gray);
  result.append(len3, c_pb_white);
  return result;
}
예제 #4
0
  virtual void do_update_ui() {
    const unsigned c_width = 60;

    percent_done = calc_percent(completed, total);

    unsigned __int64 time = time_elapsed();
    unsigned __int64 speed;
    if (time == 0)
      speed = 0;
    else
      speed = al_round(static_cast<double>(completed) / time * ticks_per_sec());

    unsigned __int64 total_time;
    if (completed)
      total_time = static_cast<unsigned __int64>(static_cast<double>(total) / completed * time);
    else
      total_time = 0;
    if (total_time < time)
      total_time = time;

    wostringstream st;
    st << fit_str(arc_path, c_width) << L'\n';
    st << L"\x1\n";
    st << fit_str(file_path, c_width) << L'\n';
    st << setw(7) << format_data_size(file_completed, get_size_suffixes()) << L" / " <<
      format_data_size(file_total, get_size_suffixes()) << L'\n';
    st << Far::get_progress_bar_str(c_width, calc_percent(file_completed, file_total), 100) << L'\n';
    st << L"\x1\n";
    st << setw(7) << format_data_size(completed, get_size_suffixes()) << L" / " <<
      format_data_size(total, get_size_suffixes()) << L" @ " << setw(9) <<
      format_data_size(speed, get_speed_suffixes()) << L" -" << format_time((total_time - time) / ticks_per_sec()) << L'\n';
    st << setw(7) << format_data_size(total_data_read, get_size_suffixes()) << L" \x2192 " <<
      setw(7) << format_data_size(total_data_written, get_size_suffixes()) << L" = " <<
      setw(2) << calc_percent(total_data_written, total_data_read) << L"%" << L'\n';
    st << Far::get_progress_bar_str(c_width, percent_done, 100) << L'\n';
    progress_text = st.str();
  }