mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-29 18:35:37 -04:00
[libcalamaresui] Report elapsed time as well.
- While waiting on modules, report the elapsed time in seconds based on the number of progress-ticks that have passed.
This commit is contained in:
parent
5ddf7b980b
commit
0ad115732e
2 changed files with 9 additions and 1 deletions
|
@ -66,6 +66,7 @@ RequirementsChecker::RequirementsChecker( QVector< Module* > modules, QObject* p
|
|||
: QObject( parent )
|
||||
, m_modules( std::move( modules ) )
|
||||
, m_progressTimer( nullptr )
|
||||
, m_progressTimeouts( 0 )
|
||||
{
|
||||
m_watchers.reserve( m_modules.count() );
|
||||
m_collectedRequirements.reserve( m_modules.count() );
|
||||
|
@ -135,9 +136,15 @@ RequirementsChecker::addCheckedRequirements( RequirementsList l )
|
|||
void
|
||||
RequirementsChecker::reportProgress()
|
||||
{
|
||||
m_progressTimeouts++;
|
||||
|
||||
auto remaining = std::count_if( m_watchers.cbegin(), m_watchers.cend(), []( const Watcher *w ) { return w && !w->isFinished(); } );
|
||||
if ( remaining > 0 )
|
||||
emit requirementsProgress( tr( "Waiting for %n module(s).", "", remaining ) );
|
||||
{
|
||||
QString waiting = tr( "Waiting for %n module(s).", "", remaining );
|
||||
QString elapsed = tr( "(%n second(s))", "", m_progressTimeouts * m_progressTimer->interval() / 1000 );
|
||||
emit requirementsProgress( waiting + QString( " " ) + elapsed );
|
||||
}
|
||||
else
|
||||
emit requirementsProgress( tr( "System-requirements checking is complete." ) );
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue