25#define GAUGE_RANGE 1000
44 if( !aShowDownloadSection )
53 m_reporter->Report(
_(
"Aborting remaining tasks." ) );
68 std::lock_guard<std::mutex> guard(
m_mutex );
69 m_reports.push_back( std::make_pair( aText, aSeverity ) );
82 return ( aValue + 999 ) / 1000;
113 double current = ( total > 0 ) ? (
double( cp ) /
double( total ) ) : 0;
116 current = ( phase + current ) / phases;
118 if( current > 1.0 || finished )
131 m_downloadText->SetLabel( wxString::Format(
_(
"Downloaded %lld/%lld kB" ),
137 if( current > 1.0 || finished )
143 std::lock_guard<std::mutex> guard(
m_mutex );
145 for(
const std::pair<wxString, SEVERITY>& pair :
m_reports )
146 m_reporter->Report( pair.first, pair.second );
wxPanel * m_panelDownload
wxButton * m_buttonCancel
wxGauge * m_downloadGauge
DIALOG_PCM_PROGRESS_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Applying Package Changes"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(600, 500), long style=wxCAPTION)
wxStaticText * m_downloadText
WX_HTML_REPORT_BOX * m_reporter
std::atomic_int64_t m_currentProgressTotal
std::atomic_int64_t m_currentProgress
void OnCloseClicked(wxCommandEvent &event) override
std::atomic_bool m_finished
wxWindowDisabler m_disabler
void OnCancelClicked(wxCommandEvent &event) override
void AdvancePhase() override
Safe to call from non-UI thread. Disables cancel button, enables close button.
wxAppProgressIndicator m_appProgressIndicator
void SetDownloadProgress(uint64_t aDownloaded, uint64_t aTotal)
Safe to call from non-UI thread. Sets the download prgress of the current package.
void SetPackageProgress(uint64_t aProgress, uint64_t aTotal)
Safe to call from non-UI thread. Advances to the next package.
std::vector< std::pair< wxString, SEVERITY > > m_reports
void PCMReport(const wxString &aText, SEVERITY aSeverity)
Safe to call from non-UI thread. Sets the download progress of the current zip entry.
static uint64_t toKb(uint64_t aValue)
DIALOG_PCM_PROGRESS(wxWindow *parent, bool aShowDownloadSection=true)
Constructor.
std::atomic_int64_t m_downloadTotal
std::atomic_int64_t m_downloaded
virtual void AdvancePhase() override
Use the next available virtual zone of the dialog progress bar.
PROGRESS_REPORTER_BASE(int aNumPhases)
std::atomic_int m_numPhases
std::atomic_bool m_cancelled
std::atomic_int m_progress
void SetNumPhases(int aNumPhases) override
Set the number of phases.
std::atomic_int m_maxProgress