~ubuntu-branches/ubuntu/vivid/aptitude/vivid

« back to all changes in this revision

Viewing changes to src/cmdline/cmdline_util.cc

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2011-06-22 12:32:56 UTC
  • mfrom: (1.8.6 sid)
  • Revision ID: james.westby@ubuntu.com-20110622123256-8aox9w9ch3x72dci
Tags: 0.6.4-1ubuntu1
* Merge from debian unstable.  Remaining changes:
  - debian/05aptitude: never autoremove kernels
  - drop aptitude-doc to Suggests
  - 03_branding.dpatch: ubuntu branding
  - 04_changelog.dpatch: take changelogs from changelogs.ubuntu.com
  - 09_ubuntu_fortify_source.dpatch: Suppress a number of warnings (turned
    into errors by -Werror) triggered by Ubuntu's default of
    -D_FORTIFY_SOURCE=2.
  - 11_ubuntu_uses_sudo.dpatch: fix status line of 'Become root' menu entry
    to not refer to su.
  - 12_point_manpage_to_doc_package.dpatch: point Finnish manpage to the
    correct place for further info
  - 14_html2text_preferred.dpatch: switch back to html2text in favor of
    elinks, since html2text is in main and elinks isn't.
* dropped 01_intltool_update.dpatch
* updated 15_ftbfs_new_apt

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
 
60
60
namespace cw = cwidget;
61
61
 
 
62
using aptitude::cmdline::create_cmdline_download_progress;
62
63
using aptitude::cmdline::make_text_progress;
63
 
using aptitude::cmdline::terminal;
 
64
using aptitude::cmdline::terminal_input;
64
65
using aptitude::cmdline::terminal_locale;
 
66
using aptitude::cmdline::terminal_metrics;
 
67
using aptitude::cmdline::terminal_output;
 
68
using aptitude::controllers::acquire_download_progress;
65
69
using boost::shared_ptr;
66
70
 
67
71
namespace
109
113
}
110
114
 
111
115
void cmdline_show_stringlist(strvector &items,
112
 
                             const shared_ptr<terminal> &term)
 
116
                             const shared_ptr<terminal_metrics> &term_metrics)
113
117
{
114
 
  const unsigned int screen_width = term->get_screen_width();
 
118
  const unsigned int screen_width = term_metrics->get_screen_width();
115
119
 
116
120
  int loc=2;
117
121
 
133
137
}
134
138
 
135
139
void cmdline_show_pkglist(pkgvector &items,
136
 
                          const shared_ptr<terminal> &term)
 
140
                          const shared_ptr<terminal_metrics> &term_metrics)
137
141
{
138
142
  strvector tmp;
139
143
 
140
144
  for(pkgvector::iterator i=items.begin(); i!=items.end(); ++i)
141
145
    tmp.push_back(i->Name());
142
146
 
143
 
  cmdline_show_stringlist(tmp, term);
 
147
  cmdline_show_stringlist(tmp, term_metrics);
144
148
}
145
149
 
146
150
pkgCache::VerIterator cmdline_find_ver(pkgCache::PkgIterator pkg,
319
323
  void show_stats_change(stats initial, stats final,
320
324
                         bool show_all,
321
325
                         bool show_unchanged,
322
 
                         const shared_ptr<terminal> &term)
 
326
                         const shared_ptr<terminal_metrics> &term_metrics)
323
327
  {
324
328
    using cw::fragf;
325
329
    using cw::util::ssprintf;
404
408
      {
405
409
        cw::fragment *f = join_fragments(output_fragments, L"\n");
406
410
 
407
 
        const unsigned int screen_width = term->get_screen_width();
 
411
        const unsigned int screen_width = term_metrics->get_screen_width();
408
412
        std::cout << f->layout(screen_width, screen_width, cw::style());
409
413
        delete f;
410
414
      }
422
426
 
423
427
download_manager::result cmdline_do_download(download_manager *m,
424
428
                                             int verbose,
425
 
                                             const shared_ptr<terminal> &term,
426
 
                                             const shared_ptr<terminal_locale> &term_locale)
 
429
                                             const shared_ptr<terminal_input> &term_input,
 
430
                                             const shared_ptr<terminal_locale> &term_locale,
 
431
                                             const shared_ptr<terminal_metrics> &term_metrics,
 
432
                                             const shared_ptr<terminal_output> &term_output)
427
433
{
428
434
  stats initial_stats(0, 0, 0, std::set<std::string>());
429
 
  shared_ptr<OpProgress> progress = make_text_progress(false, term, term_locale);
 
435
  shared_ptr<OpProgress> progress = make_text_progress(false, term_locale, term_metrics, term_output);
430
436
 
431
437
  if(aptcfg->FindI("Quiet", 0) == 0)
432
438
    {
440
446
      initial_stats = compute_apt_stats();
441
447
    }
442
448
 
443
 
  std::auto_ptr<download_signal_log> log(gen_cmdline_download_progress(term));
 
449
  std::pair<download_signal_log *, boost::shared_ptr<acquire_download_progress> >
 
450
    progress_display = create_cmdline_download_progress(term_input,
 
451
                                                        term_locale,
 
452
                                                        term_metrics,
 
453
                                                        term_output);
 
454
 
 
455
  std::auto_ptr<download_signal_log> log(progress_display.first);
444
456
 
445
457
  // Dump errors here because prepare() might check for pending errors
446
458
  // and think something failed.
468
480
      final_stats = compute_apt_stats();
469
481
      show_stats_change(initial_stats, final_stats,
470
482
                        verbose >= 1, verbose >= 2,
471
 
                        term);
 
483
                        term_metrics);
472
484
    }
473
485
 
474
486
  return finish_res;