Add sub progress display.

This commit is contained in:
Bartosz Taudul 2018-07-28 18:56:52 +02:00
parent 3a401106b0
commit a14238c199
3 changed files with 16 additions and 0 deletions

View File

@ -253,6 +253,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask )
s_loadProgress.total.store( 8, std::memory_order_relaxed );
}
s_loadProgress.subTotal.store( 0, std::memory_order_relaxed );
s_loadProgress.progress.store( 0, std::memory_order_relaxed );
f.Read( m_resolution );
f.Read( m_timerMul );

View File

@ -49,6 +49,8 @@ struct LoadProgress
{
std::atomic<uint64_t> total = 0;
std::atomic<uint64_t> progress = 0;
std::atomic<uint64_t> subTotal = 0;
std::atomic<uint64_t> subProgress = 0;
};
class Worker

View File

@ -192,6 +192,19 @@ int main( int argc, char** argv )
}
ImGui::Text( "Total progress: %" PRIu64 "/%" PRIu64, currProgress, totalProgress );
ImGui::ProgressBar( float( currProgress ) / totalProgress, ImVec2( 200 * dpiScale, 0 ) );
auto subTotal = progress.subTotal.load( std::memory_order_relaxed );
auto subProgress = progress.subProgress.load( std::memory_order_relaxed );
if( subTotal == 0 )
{
ImGui::Text( "Sub progress..." );
ImGui::ProgressBar( 1.f, ImVec2( 200 * dpiScale, 0 ) );
}
else
{
ImGui::Text( "Sub progress: %" PRIu64 "/%" PRIu64, subProgress, subTotal );
ImGui::ProgressBar( float( subProgress ) / subTotal, ImVec2( 200 * dpiScale, 0 ) );
}
ImGui::EndPopup();
}