feat(ui): stream search results and show real download progress
Search now publishes provider results in small batches as they arrive, so the first matches appear in the table while slower providers keep running. The bottom status-bar bar is now a determinate indicator: pacman output is streamed live and its (n/Total) package counter is parsed into a percentage that fills the bar during install/update, instead of an indeterminate spinner. Generated with Codebuff 🤖 Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
8 files changed
+246
-112
No files matched your search
@@ -108,6 +108,11 @@ inline void sortByProviderThenName(std::vector<PackageInfo>& packages,
|
||||
});
|
||||
}
|
||||
|
||||
// Progress reported during an operation: a human-readable message plus an
|
||||
// optional percentage (0-100) when the tool exposes real progress, or -1 when
|
||||
// the exact position is unknown. -1 lets the UI keep an indeterminate bar.
|
||||
using ProgressCallback = std::function<void(const std::string& message, int percent)>;
|
||||
|
||||
// Abstract interface for the package manager
|
||||
class IPackageManager {
|
||||
public:
|
||||
@@ -128,14 +133,14 @@ public:
|
||||
// Operations
|
||||
virtual std::vector<PackageInfo> search(const std::string& query) = 0;
|
||||
virtual bool install(const std::string& packageName,
|
||||
std::function<void(const std::string&)> progressCallback = nullptr) = 0;
|
||||
ProgressCallback progressCallback = nullptr) = 0;
|
||||
virtual bool remove(const std::string& packageName,
|
||||
std::function<void(const std::string&)> progressCallback = nullptr) = 0;
|
||||
ProgressCallback progressCallback = nullptr) = 0;
|
||||
virtual bool update(const std::string& packageName = "",
|
||||
std::function<void(const std::string&)> progressCallback = nullptr) = 0;
|
||||
ProgressCallback progressCallback = nullptr) = 0;
|
||||
virtual std::vector<PackageInfo> listInstalled() = 0;
|
||||
virtual std::vector<PackageInfo> listUpdates() = 0;
|
||||
virtual bool refresh(std::function<void(const std::string&)> progressCallback = nullptr) = 0;
|
||||
virtual bool refresh(ProgressCallback progressCallback = nullptr) = 0;
|
||||
|
||||
// Check if the package manager is available on the system
|
||||
virtual bool isAvailable() const = 0;
|
||||
|
||||
Reference in new issue
Block a user