/* * Copyright 2013, Stephan Aßmus . * Copyright 2011, Ingo Weinhold, * Copyright 2013, Rene Gollent, * Copyright 2017, Julian Harnath . * Copyright 2021, Andrew Lindesay . * * All rights reserved. Distributed under the terms of the MIT License. * * Note that this file has been re-factored from `PackageManager.h` and * copyrights have been carried across in 2021. */ #ifndef INSTALL_PACKAGE_PROCESS_H #define INSTALL_PACKAGE_PROCESS_H #include #include "AbstractPackageProcess.h" #include "PackageProgressListener.h" typedef std::set PackageInfoSet; class DownloadProgress; class InstallPackageProcess : public AbstractPackageProcess, private PackageProgressListener { public: InstallPackageProcess( PackageInfoRef package, Model* model); virtual ~InstallPackageProcess(); virtual const char* Name() const; virtual const char* Description() const; virtual float Progress(); // DownloadProgressListener virtual void DownloadProgressChanged( const char* packageName, float progress); virtual void DownloadProgressComplete( const char* packageName); virtual void ConfirmedChanges( BPackageManager::InstalledRepository& repository); protected: virtual status_t RunInternal(); private: static status_t _DeriveSimplePackageName( const BString& canonicalForm, BString& simplePackageName); void _SetDownloadedPackagesState( PackageState state); void _SetDownloadProgress( const BString& simplePackageName, float progress); private: std::vector fDownloadProgresses; BString fDescription; bigtime_t fLastDownloadUpdate; PackageInfoSet fDownloadedPackages; }; #endif // INSTALL_PACKAGE_PROCESS_H