#include <string>
#include <unistd.h>
-
+#include <signal.h>
namespace APT {
namespace Progress {
+ class PackageManager;
+ PackageManager* PackageManagerProgressFactory();
+
class PackageManager
{
private:
: 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() {};
public:
PackageManagerProgressFd(int progress_fd);
- virtual void Start();
+ virtual void StartDpkg();
virtual void Stop();
virtual bool StatusChanged(std::string PackageName,
public:
PackageManagerProgressDeb822Fd(int progress_fd);
- virtual void Start();
+ virtual void StartDpkg();
virtual void Stop();
virtual bool StatusChanged(std::string PackageName,
class PackageManagerFancy : public PackageManager
{
protected:
- int nr_terminal_rows;
- void SetupTerminalScrollArea(int nr_rows);
+ static void SetupTerminalScrollArea(int nr_rows);
+ static int GetNumberTerminalRows();
+ static void HandleSIGWINCH(int);
+ sighandler_t old_SIGWINCH;
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,