improved progress information when rendering at console
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1442 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
2008-08-19 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
|
||||
|
||||
* src/core/main.cpp:
|
||||
* src/core/project_renderer.cpp:
|
||||
improved progress information when rendering at console
|
||||
|
||||
2008-08-18 Paul Giblock <drfaygo/at/gmail/dot/com>
|
||||
|
||||
* include/controller.h:
|
||||
|
||||
@@ -432,7 +432,7 @@ int main( int argc, char * * argv )
|
||||
QTimer * t = new QTimer( r );
|
||||
r->connect( t, SIGNAL( timeout() ),
|
||||
SLOT( updateConsoleProgress() ) );
|
||||
t->start( 50 );
|
||||
t->start( 200 );
|
||||
|
||||
// start now!
|
||||
r->startProcessing();
|
||||
|
||||
@@ -186,21 +186,23 @@ void projectRenderer::updateConsoleProgress( void )
|
||||
{
|
||||
const int cols = 50;
|
||||
static int rot = 0;
|
||||
char buf[80];
|
||||
char prog[cols+1];
|
||||
|
||||
printf("\r|");
|
||||
for( int i = 0; i < cols; ++i )
|
||||
{
|
||||
printf( "%c",( i*100/cols <= m_progress ? '-' : ' ' ));
|
||||
prog[i] = ( i*100/cols <= m_progress ? '-' : ' ' );
|
||||
}
|
||||
printf( "| %3d%% ", m_progress );
|
||||
switch( rot )
|
||||
{
|
||||
case 3: putchar( '|' ); break;
|
||||
case 2: putchar( '/' ); break;
|
||||
case 1: putchar( '-' ); break;
|
||||
case 0: putchar( '\\' ); break;
|
||||
}
|
||||
rot = ++rot % 4;
|
||||
prog[cols] = 0;
|
||||
|
||||
const char * activity = (const char *) "|/-\\";
|
||||
memset( buf, 0, sizeof( buf ) );
|
||||
sprintf( buf, "\r|%s| %3d%% %c ", prog, m_progress,
|
||||
activity[rot] );
|
||||
rot = ( rot+1 ) % 4;
|
||||
|
||||
fprintf( stderr, "%s", buf );
|
||||
fflush( stderr );
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user