mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-11 00:36:20 +02:00
50 lines
720 B
C++
50 lines
720 B
C++
|
#pragma once
|
||
|
|
||
|
#include "sync.hh"
|
||
|
#include "util.hh"
|
||
|
|
||
|
namespace nix {
|
||
|
|
||
|
class ProgressBar
|
||
|
{
|
||
|
private:
|
||
|
struct State
|
||
|
{
|
||
|
std::string status;
|
||
|
bool done = false;
|
||
|
std::list<std::string> activities;
|
||
|
};
|
||
|
|
||
|
Sync<State> state;
|
||
|
|
||
|
public:
|
||
|
|
||
|
ProgressBar();
|
||
|
|
||
|
~ProgressBar();
|
||
|
|
||
|
void updateStatus(const std::string & s);
|
||
|
|
||
|
void done();
|
||
|
|
||
|
class Activity
|
||
|
{
|
||
|
friend class ProgressBar;
|
||
|
private:
|
||
|
ProgressBar & pb;
|
||
|
std::list<std::string>::iterator it;
|
||
|
Activity(ProgressBar & pb, const FormatOrString & fs);
|
||
|
public:
|
||
|
~Activity();
|
||
|
};
|
||
|
|
||
|
Activity startActivity(const FormatOrString & fs);
|
||
|
|
||
|
private:
|
||
|
|
||
|
void render(State & state_);
|
||
|
|
||
|
};
|
||
|
|
||
|
}
|