summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-05-15 20:29:39 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-05-15 20:29:39 -0500
commit08e74d66da9affec59345a218e769e480578fff4 (patch)
treec0387ac7713fd9623036a24180f745cfbdd63fc4
parent534ba7f879c28f4ee283b9f14f3477b462effd77 (diff)
downloadamarok-08e74d66.tar.gz
amarok-08e74d66.zip
Minor source cleanup
-rw-r--r--amarok/src/loader/loader.cpp40
-rw-r--r--amarok/src/main.cpp2
2 files changed, 32 insertions, 10 deletions
diff --git a/amarok/src/loader/loader.cpp b/amarok/src/loader/loader.cpp
index e615ed9d..0410b2af 100644
--- a/amarok/src/loader/loader.cpp
+++ b/amarok/src/loader/loader.cpp
@@ -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
diff --git a/amarok/src/main.cpp b/amarok/src/main.cpp
index 27482a93..66748e29 100644
--- a/amarok/src/main.cpp
+++ b/amarok/src/main.cpp
@@ -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" );