From fa211e2d3b0305cfdd184cdba9750259f6d9c98e Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 27 Mar 2014 07:56:42 +0100 Subject: Add progressbar to "Dpkg::Progress-Fancy" A text progressbar is now displayed in the Dpkg::Progress-Fancy mode. It can be turned off via the apt option Dpkg::Progress-Fancy::Progress-Bar=false --- apt-pkg/install-progress.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'apt-pkg/install-progress.h') diff --git a/apt-pkg/install-progress.h b/apt-pkg/install-progress.h index baf245376..112b034fb 100644 --- a/apt-pkg/install-progress.h +++ b/apt-pkg/install-progress.h @@ -125,7 +125,12 @@ namespace Progress { void SetupTerminalScrollArea(int nr_rows); void HandleSIGWINCH(int); - int GetNumberTerminalRows(); + typedef struct { + int rows; + int columns; + } TermSize; + TermSize GetTerminalSize(); + sighandler_t old_SIGWINCH; int child_pty; @@ -138,6 +143,10 @@ namespace Progress { unsigned int StepsDone, unsigned int TotalSteps, std::string HumanReadableAction); + + // return a progress bar of the given size for the given progress + // percent between 0.0 and 1.0 in the form "[####...]" + static std::string GetTextProgressStr(float percent, int OutputSize); }; class PackageManagerText : public PackageManager -- cgit v1.2.3