ExecutionProgress.h (1778B)
1 // Copyright (c) Microsoft Corporation. 2 // Licensed under the MIT License. 3 #pragma once 4 #include "ChannelStreams.h" 5 #include <AppInstallerProgress.h> 6 #include <AppInstallerStrings.h> 7 #include <winget/UserSettings.h> 8 9 #include <functional> 10 #include <memory> 11 #include <string> 12 #include <string_view> 13 14 namespace AppInstaller::CLI::Execution 15 { 16 // Displays an indefinite spinner. 17 struct IIndefiniteSpinner 18 { 19 virtual ~IIndefiniteSpinner() = default; 20 21 // Set the message for the spinner. 22 virtual void SetMessage(std::string_view message) = 0; 23 24 // Get the current message for the spinner. 25 virtual std::shared_ptr<Utility::NormalizedString> Message() = 0; 26 27 // Show the indefinite spinner. 28 virtual void ShowSpinner() = 0; 29 30 // Stop showing the indefinite spinner. 31 virtual void StopSpinner() = 0; 32 33 // Creates an indefinite spinner for the given style. 34 static std::unique_ptr<IIndefiniteSpinner> CreateForStyle(BaseStream& stream, bool enableVT, AppInstaller::Settings::VisualStyle style, const std::function<bool()>& sixelSupported); 35 }; 36 37 // Displays a progress bar. 38 struct IProgressBar 39 { 40 virtual ~IProgressBar() = default; 41 42 // Show progress with the given values. 43 virtual void ShowProgress(uint64_t current, uint64_t maximum, ProgressType type) = 0; 44 45 // Stop showing progress. 46 virtual void EndProgress(bool hideProgressWhenDone) = 0; 47 48 // Creates a progress bar for the given style. 49 static std::unique_ptr<IProgressBar> CreateForStyle(BaseStream& stream, bool enableVT, AppInstaller::Settings::VisualStyle style, const std::function<bool()>& sixelSupported); 50 }; 51 }