diff options
Diffstat (limited to 'apt-pkg/install-progress.cc')
-rw-r--r-- | apt-pkg/install-progress.cc | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/apt-pkg/install-progress.cc b/apt-pkg/install-progress.cc index fe065da4f..dfe4fb18c 100644 --- a/apt-pkg/install-progress.cc +++ b/apt-pkg/install-progress.cc @@ -1,17 +1,23 @@ +#include <config.h> + #include <apt-pkg/configuration.h> #include <apt-pkg/fileutl.h> #include <apt-pkg/strutl.h> #include <apt-pkg/install-progress.h> -#include <apti18n.h> - -#include <termios.h> +#include <signal.h> +#include <unistd.h> +#include <iostream> +#include <string> +#include <vector> #include <sys/ioctl.h> #include <sstream> #include <fcntl.h> #include <algorithm> #include <stdio.h> +#include <apti18n.h> + namespace APT { namespace Progress { @@ -41,10 +47,10 @@ PackageManager* PackageManagerProgressFactory() return progress; } -bool PackageManager::StatusChanged(std::string PackageName, +bool PackageManager::StatusChanged(std::string /*PackageName*/, unsigned int StepsDone, unsigned int TotalSteps, - std::string HumanReadableAction) + std::string /*HumanReadableAction*/) { int reporting_steps = _config->FindI("DpkgPM::Reporting-Steps", 1); percentage = StepsDone/(float)TotalSteps * 100.0; @@ -87,7 +93,7 @@ void PackageManagerProgressFd::StartDpkg() WriteToStatusFd(status.str()); } -void PackageManagerProgressFd::Stop() +APT_CONST void PackageManagerProgressFd::Stop() { } @@ -170,7 +176,7 @@ void PackageManagerProgressDeb822Fd::StartDpkg() WriteToStatusFd(status.str()); } -void PackageManagerProgressDeb822Fd::Stop() +APT_CONST void PackageManagerProgressDeb822Fd::Stop() { } @@ -242,7 +248,7 @@ PackageManagerFancy::~PackageManagerFancy() void PackageManagerFancy::staticSIGWINCH(int signum) { std::vector<PackageManagerFancy *>::const_iterator I; - for(I = instances.begin(); I != instances.end(); I++) + for(I = instances.begin(); I != instances.end(); ++I) (*I)->HandleSIGWINCH(signum); } @@ -329,15 +335,15 @@ bool PackageManagerFancy::StatusChanged(std::string PackageName, int row = GetNumberTerminalRows(); - static string save_cursor = "\033[s"; - static string restore_cursor = "\033[u"; - - static string set_bg_color = "\033[42m"; // green - static string set_fg_color = "\033[30m"; // black - - static string restore_bg = "\033[49m"; - static string restore_fg = "\033[39m"; - + static std::string save_cursor = "\033[s"; + static std::string restore_cursor = "\033[u"; + + static std::string set_bg_color = "\033[42m"; // green + static std::string set_fg_color = "\033[30m"; // black + + static std::string restore_bg = "\033[49m"; + static std::string restore_fg = "\033[39m"; + std::cout << save_cursor // move cursor position to last row << "\033[" << row << ";0f" @@ -371,5 +377,5 @@ bool PackageManagerText::StatusChanged(std::string PackageName, -}; // namespace progress -}; // namespace apt +} // namespace progress +} // namespace apt |