From d3e8fbb395f57954acd7a2095f02ce530a05ec6a Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 27 Feb 2014 01:20:53 +0100 Subject: =?UTF-8?q?warning:=20extra=20=E2=80=98;=E2=80=99=20[-Wpedantic]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Git-Dch: Ignore Reported-By: gcc -Wpedantic --- apt-pkg/install-progress.h | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'apt-pkg/install-progress.h') diff --git a/apt-pkg/install-progress.h b/apt-pkg/install-progress.h index 8a5b68a8f..8bcc32927 100644 --- a/apt-pkg/install-progress.h +++ b/apt-pkg/install-progress.h @@ -24,7 +24,7 @@ namespace Progress { int last_reported_progress; public: - PackageManager() + PackageManager() : percentage(0.0), last_reported_progress(-1) {}; virtual ~PackageManager() {}; @@ -32,8 +32,8 @@ namespace Progress { virtual void Start(int child_pty=-1) {}; virtual void Stop() {}; - /* When dpkg is invoked (may happen multiple times for each - * install/remove block + /* When dpkg is invoked (may happen multiple times for each + * install/remove block */ virtual void StartDpkg() {}; @@ -44,18 +44,18 @@ namespace Progress { return 500000; }; - virtual bool StatusChanged(std::string PackageName, + virtual bool StatusChanged(std::string PackageName, unsigned int StepsDone, unsigned int TotalSteps, - std::string HumanReadableAction) ; - virtual void Error(std::string PackageName, + std::string HumanReadableAction); + virtual void Error(std::string PackageName, unsigned int StepsDone, unsigned int TotalSteps, - std::string ErrorMessage) {}; + std::string ErrorMessage) {} virtual void ConffilePrompt(std::string PackageName, unsigned int StepsDone, unsigned int TotalSteps, - std::string ConfMessage) {}; + std::string ConfMessage) {} }; class PackageManagerProgressFd : public PackageManager @@ -72,11 +72,11 @@ namespace Progress { virtual void StartDpkg(); virtual void Stop(); - virtual bool StatusChanged(std::string PackageName, + virtual bool StatusChanged(std::string PackageName, unsigned int StepsDone, unsigned int TotalSteps, std::string HumanReadableAction); - virtual void Error(std::string PackageName, + virtual void Error(std::string PackageName, unsigned int StepsDone, unsigned int TotalSteps, std::string ErrorMessage); @@ -101,11 +101,11 @@ namespace Progress { virtual void StartDpkg(); virtual void Stop(); - virtual bool StatusChanged(std::string PackageName, + virtual bool StatusChanged(std::string PackageName, unsigned int StepsDone, unsigned int TotalSteps, std::string HumanReadableAction); - virtual void Error(std::string PackageName, + virtual void Error(std::string PackageName, unsigned int StepsDone, unsigned int TotalSteps, std::string ErrorMessage); @@ -134,7 +134,7 @@ namespace Progress { ~PackageManagerFancy(); virtual void Start(int child_pty=-1); virtual void Stop(); - virtual bool StatusChanged(std::string PackageName, + virtual bool StatusChanged(std::string PackageName, unsigned int StepsDone, unsigned int TotalSteps, std::string HumanReadableAction); @@ -143,14 +143,14 @@ namespace Progress { class PackageManagerText : public PackageManager { public: - virtual bool StatusChanged(std::string PackageName, + virtual bool StatusChanged(std::string PackageName, unsigned int StepsDone, unsigned int TotalSteps, std::string HumanReadableAction); }; -}; // namespace Progress -}; // namespace APT +} // namespace Progress +} // namespace APT #endif -- cgit v1.2.3 From 655122418d714f342b5d9789f45f8035f3fe8b9a Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 1 Mar 2014 15:11:42 +0100 Subject: =?UTF-8?q?warning:=20unused=20parameter=20=E2=80=98foo=E2=80=99?= =?UTF-8?q?=20[-Wunused-parameter]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reported-By: gcc -Wunused-parameter Git-Dch: Ignore --- apt-pkg/install-progress.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'apt-pkg/install-progress.h') diff --git a/apt-pkg/install-progress.h b/apt-pkg/install-progress.h index 8bcc32927..baf245376 100644 --- a/apt-pkg/install-progress.h +++ b/apt-pkg/install-progress.h @@ -29,7 +29,7 @@ namespace Progress { virtual ~PackageManager() {}; /* Global Start/Stop */ - virtual void Start(int child_pty=-1) {}; + virtual void Start(int /*child_pty*/=-1) {}; virtual void Stop() {}; /* When dpkg is invoked (may happen multiple times for each @@ -48,14 +48,14 @@ namespace Progress { unsigned int StepsDone, unsigned int TotalSteps, std::string HumanReadableAction); - virtual void Error(std::string PackageName, - unsigned int StepsDone, - unsigned int TotalSteps, - std::string ErrorMessage) {} - virtual void ConffilePrompt(std::string PackageName, - unsigned int StepsDone, - unsigned int TotalSteps, - std::string ConfMessage) {} + virtual void Error(std::string /*PackageName*/, + unsigned int /*StepsDone*/, + unsigned int /*TotalSteps*/, + std::string /*ErrorMessage*/) {} + virtual void ConffilePrompt(std::string /*PackageName*/, + unsigned int /*StepsDone*/, + unsigned int /*TotalSteps*/, + std::string /*ConfMessage*/) {} }; class PackageManagerProgressFd : public PackageManager -- cgit v1.2.3 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 From 76bd63e2dc6ac5aaaf7f2cc98c2a83ab88ccc46c Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 14 Apr 2014 17:12:09 +0200 Subject: force fancy progressbar redraw on window size change We always reacted on the size change, but the bar is only redraw if the precentage changes, which can take quiet a while in big upgrades, so with a bit of refactoring we can now call for a redraw immediate to fix this. This refactor also helps in avoiding obscure pitfalls clangs static analyser was complaining about (namely failure of ioctl resulting in garbage values in the struct). --- apt-pkg/install-progress.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'apt-pkg/install-progress.h') diff --git a/apt-pkg/install-progress.h b/apt-pkg/install-progress.h index 112b034fb..5d1a20e9b 100644 --- a/apt-pkg/install-progress.h +++ b/apt-pkg/install-progress.h @@ -1,6 +1,8 @@ #ifndef PKGLIB_IPROGRESS_H #define PKGLIB_IPROGRESS_H +#include + #include #include #include @@ -120,6 +122,7 @@ namespace Progress { private: static void staticSIGWINCH(int); static std::vector instances; + APT_HIDDEN bool DrawStatusLine(); protected: void SetupTerminalScrollArea(int nr_rows); -- cgit v1.2.3