Minor source cleanup

pull/1/head
Timothy Pearson 11 years ago
parent 534ba7f879
commit 08e74d66da

@ -38,8 +38,9 @@ main( int argc, char *argv[] )
{
//NOTE this list doesn't include argv[0] ("amarok")
TQStringList args;
for( int i = 1; i < argc; i++ )
for( int i = 1; i < argc; i++ ) {
args += TQString::fromLocal8Bit(argv[i]);
}
const bool isRunning = amarokIsRunning();
@ -56,8 +57,9 @@ main( int argc, char *argv[] )
// both --arg and -arg are valid
{
TQStringList longlongs;
foreach( longs )
foreach( longs ) {
longlongs += TQChar('-') + *it;
}
longs += longlongs;
}
@ -101,9 +103,21 @@ main( int argc, char *argv[] )
dcop_args += "]";
TQProcess proc( dcop_args );
proc.start();
while( proc.isRunning() )
if ( !proc.start() ) {
printf("[ERROR] Unable to launch DCOP for communication with running Amarok instance!\n\r");
}
while( proc.isRunning() ) {
::usleep( 100 );
}
if ( !proc.normalExit() || proc.exitStatus() ) {
printf("[ERROR] DCOP communication failure with running Amarok instance!\n\r");
while ( proc.canReadLineStdout() ) {
printf("%s\n\r", proc.readLineStdout().ascii());
}
while ( proc.canReadLineStderr() ) {
printf("%s\n\r", proc.readLineStderr().ascii());
}
}
return 0;
}
@ -123,9 +137,11 @@ amarokIsRunning()
while( proc.isRunning() )
::usleep( 100 );
while( proc.canReadLineStdout() )
if ( proc.readLineStdout() == "amarok" )
while( proc.canReadLineStdout() ) {
if ( proc.readLineStdout() == "amarok" ) {
return true;
}
}
return false;
}
@ -189,13 +205,16 @@ Loader::timerEvent( TQTimerEvent* )
{
if( m_proc->isRunning() )
{
if( ++m_counter == (30000 / INTERVAL) )
if( ++m_counter == (30000 / INTERVAL) ) {
// 30 seconds have passed
std::cerr << "Amarok: [Loader] Amarok is taking a long time to load! Perhaps something has gone wrong?\n";
}
while( m_proc->canReadLineStdout() )
if( m_proc->readLineStdout() == "STARTUP" )
while( m_proc->canReadLineStdout() ) {
if( m_proc->readLineStdout() == "STARTUP" ) {
TQApplication::exit( 0 );
}
}
}
else if( !m_proc->normalExit() ) {
// no reason to show messagebox, as amarokapp should start drkonqi
@ -203,11 +222,12 @@ Loader::timerEvent( TQTimerEvent* )
TQApplication::exit( 3 );
}
else
else {
// if we get here, then either we didn't receive STARTUP through
// the pipe, or amarokapp exited normally before the STARTUP was
// written to stdout (possibly possible)
TQApplication::exit( 0 );
}
}
bool

@ -58,6 +58,8 @@ int main( int argc, char *argv[] )
I18N_NOOP( "Developer (sebr)" ), "ruiz@kde.org", "http://www.sebruiz.net" );
aboutData.addAuthor( "Stanislav '" I18N_NOOP("All you need is DCOP") "' Karchebny",
I18N_NOOP( "DCOP, improvements, cleanups, i18n (berkus)" ), "berkus@madfire.net" );
aboutData.addAuthor( "Timothy '"I18N_NOOP("HCI nut") "' Pearson",
I18N_NOOP( "Developer (kb9vqf)" ), "kb9vqf@pearsoncomputing.net" );
aboutData.addCredit( "Adam Pigg", I18N_NOOP( "Analyzers, patches, shoutcast" ), "adam@piggz.co.uk" );

Loading…
Cancel
Save