X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/8336ae355b8a22877cd233063c715688155aa617..75c10df1533ede97e05fef3d1e2fc6a22fc4db00:/apt-pkg/install-progress.h?ds=inline diff --git a/apt-pkg/install-progress.h b/apt-pkg/install-progress.h index 9c31eac92..8a5b68a8f 100644 --- a/apt-pkg/install-progress.h +++ b/apt-pkg/install-progress.h @@ -3,11 +3,15 @@ #include #include - +#include +#include namespace APT { namespace Progress { + class PackageManager; + PackageManager* PackageManagerProgressFactory(); + class PackageManager { private: @@ -24,9 +28,15 @@ namespace Progress { : percentage(0.0), last_reported_progress(-1) {}; virtual ~PackageManager() {}; - virtual void Start() {}; + /* Global Start/Stop */ + virtual void Start(int child_pty=-1) {}; virtual void Stop() {}; + /* When dpkg is invoked (may happen multiple times for each + * install/remove block + */ + virtual void StartDpkg() {}; + virtual pid_t fork() {return fork(); }; virtual void Pulse() {}; @@ -59,7 +69,7 @@ namespace Progress { public: PackageManagerProgressFd(int progress_fd); - virtual void Start(); + virtual void StartDpkg(); virtual void Stop(); virtual bool StatusChanged(std::string PackageName, @@ -88,7 +98,7 @@ namespace Progress { public: PackageManagerProgressDeb822Fd(int progress_fd); - virtual void Start(); + virtual void StartDpkg(); virtual void Stop(); virtual bool StatusChanged(std::string PackageName, @@ -107,13 +117,22 @@ namespace Progress { class PackageManagerFancy : public PackageManager { + private: + static void staticSIGWINCH(int); + static std::vector instances; + protected: - int nr_terminal_rows; void SetupTerminalScrollArea(int nr_rows); + void HandleSIGWINCH(int); + + int GetNumberTerminalRows(); + sighandler_t old_SIGWINCH; + int child_pty; public: PackageManagerFancy(); - virtual void Start(); + ~PackageManagerFancy(); + virtual void Start(int child_pty=-1); virtual void Stop(); virtual bool StatusChanged(std::string PackageName, unsigned int StepsDone,