satui/satapp/src/satappplaytoneprovider.cpp
changeset 15 d7fc66ccd6fb
child 27 7eb70891911c
equal deleted inserted replaced
13:e32024264ebb 15:d7fc66ccd6fb
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // PlayStandardTone
       
    20 #include    <MProfile.h>
       
    21 #include    <MProfileEngine.h>
       
    22 #include    <MProfileTones.h>
       
    23 #include    <TProfileToneSettings.h>
       
    24 #include    <audiopreference.h>//KAudioPriorityLowLevel
       
    25 #include    <Mda/Common/Resource.h>//KMdaRepeatForever
       
    26 #include    <QTimer> // timeout callback
       
    27 #include    <hbmessagebox.h>//playtone note
       
    28 #include    <mdaaudiotoneplayer.h>// for CMdaAudioToneUtility&CMdaAudioPlayerUtility
       
    29 #include    <e32std.h>//TTimeIntervalMicroSeconds
       
    30 
       
    31 #include "satappplaytoneprovider.h"
       
    32 #include "satappcommonconstant.h"
       
    33 #include "tflogger.h"
       
    34 
       
    35 //const
       
    36 // Maximum length for sound file. 
       
    37 const TInt KMaxSoundFileLength = 256;
       
    38 // Used when dividing some values. Used only for preventing the use of magic 
       
    39 // numbers
       
    40 // Audio sample is repeated indefinitely.
       
    41 const TInt KSoundPlayerRepeatForever = KMdaRepeatForever;
       
    42 
       
    43 // ----------------------------------------------------------------------------
       
    44 // SatAppPlayToneProvider::SatAppPlayToneProvider
       
    45 // (other items were commented in a header).
       
    46 // ----------------------------------------------------------------------------
       
    47 //
       
    48 SatAppPlayToneProvider::SatAppPlayToneProvider(QObject *parent) :
       
    49     QObject(parent), mWarningAndPlayTones(false),mVolume(0),
       
    50     mPlayer(0),mPlayToneError(ESatSuccess), mTimer(0),mLoop(0),
       
    51     mPermanentNote(0), mAudioPlayer(0)
       
    52 {
       
    53     TFLOGSTRING("SATAPP: SatAppPlayToneProvider::SatAppPlayToneProvider call")
       
    54     TFLOGSTRING("SATAPP: SatAppPlayToneProvider::SatAppPlayToneProvider exit")
       
    55 }
       
    56 
       
    57 // ----------------------------------------------------------------------------
       
    58 // SatAppPlayToneProvider::~SatAppPlayToneProvider
       
    59 // Sets a pointer to CSatUiViewAppUi object.
       
    60 // (other items were commented in a header).
       
    61 // ----------------------------------------------------------------------------
       
    62 //
       
    63 SatAppPlayToneProvider::~SatAppPlayToneProvider()
       
    64 {
       
    65     TFLOGSTRING("SATAPP: SatAppPlayToneProvider::~SatAppPlayToneProvider call")
       
    66     stopPlayTone();
       
    67     if (mPermanentNote) {
       
    68         TFLOGSTRING("SATAPP: SatAppPlayToneProvider::~SatAppPlayToneProvider note 0")
       
    69         delete mPermanentNote;
       
    70         mPermanentNote = 0;
       
    71     }
       
    72     if (mTimer) {
       
    73         TFLOGSTRING("SATAPP: SatAppPlayToneProvider::~SatAppPlayToneProvider timer 0")
       
    74         delete mTimer;
       
    75         mTimer = 0;
       
    76     }
       
    77     if (mLoop) {
       
    78         TFLOGSTRING("SatAppPlayToneProvider::~SatAppPlayToneProvider loop 0")
       
    79         delete mLoop;
       
    80         mLoop = 0;
       
    81     }
       
    82     TFLOGSTRING("SATAPP: SatAppPlayToneProvider::~SatAppPlayToneProvider exit")
       
    83 }
       
    84 
       
    85 //-----------------------------------------------------------------------------
       
    86 // SatAppPlayToneProvider::PlayStandardToneL
       
    87 // (other items were commented in a header).
       
    88 // ----------------------------------------------------------------------------
       
    89 //
       
    90 TSatUiResponse SatAppPlayToneProvider::PlayStandardToneL( const TDesC& aText,
       
    91     const TDesC8& aSequence,
       
    92     TTimeIntervalMicroSeconds aDuration,
       
    93     const CFbsBitmap* /*aIconBitmap*/,
       
    94     const TBool aSelfExplanatory )
       
    95 {
       
    96     TFLOGSTRING("SATAPP: SatAppPlayToneProvider::PlayStandardToneL call")
       
    97     if (mTimer) {
       
    98         if (mTimer->isActive()) {
       
    99             mTimer->stop();
       
   100         }
       
   101         delete mTimer;
       
   102         mTimer = 0;
       
   103         TFLOGSTRING("SatAppPlayToneProvider::PlayStandardToneL delete timer")
       
   104     }
       
   105     if (mLoop) {
       
   106         TFLOGSTRING("SatAppPlayToneProvider::PlayStandardToneL delete loop")
       
   107         if (mLoop->isRunning()) {
       
   108             mLoop->exit();
       
   109         }
       
   110         delete mLoop;
       
   111         mLoop = 0;
       
   112     }
       
   113 
       
   114     TSatUiResponse response(ESatSuccess);
       
   115     unsigned int duration(0);
       
   116     if (aDuration > 0) {
       
   117         duration = aDuration.Int64() / 1000;
       
   118     }
       
   119     TFLOGSTRING2("SATAPP: SatAppPlayToneProvider::PlayStandardToneL \
       
   120      duration microseconds %d", duration)
       
   121     QString text;
       
   122     mLoop = new QEventLoop(this);
       
   123     if (aText.Length() > 0) {
       
   124         text = QString::fromUtf16(aText.Ptr(), aText.Length());
       
   125         TFLOGSTRING2("SATAPP: SatAppPlayToneProvider::PlayStandardToneL \
       
   126             text=%S", &aText)
       
   127         mPermanentNote = new HbMessageBox(HbMessageBox::MessageTypeInformation);
       
   128         bool ret = connect(mPermanentNote, SIGNAL(aboutToClose()),
       
   129                 this, SLOT(stopPlayTone()));
       
   130         TFLOGSTRING2("SATAPP: SatAppPlayToneProvider::PlayStandardToneL connect \
       
   131            note close to timer stop: %d", ret)
       
   132 
       
   133         bool selfExplanatory = aSelfExplanatory;
       
   134         if (!selfExplanatory) {
       
   135             mPermanentNote->setText(text);
       
   136             if (duration > 0 ) {
       
   137                 mPermanentNote->setTimeout(duration);
       
   138             }
       
   139             mPermanentNote->setDismissPolicy(HbPopup::TapAnywhere);
       
   140             TFLOGSTRING("SatAppPlayToneProvider::PlayStandardToneL show before")
       
   141             mPermanentNote->show();
       
   142             TFLOGSTRING("SatAppPlayToneProvider::PlayStandardToneL show after")
       
   143         }
       
   144     }
       
   145 
       
   146     if (mPlayer) {
       
   147         delete mPlayer;
       
   148         mPlayer = 0;
       
   149     }
       
   150     mPlayer = CMdaAudioToneUtility::NewL(*this);
       
   151     TInt volume(mPlayer->MaxVolume());
       
   152     mPlayer->SetVolume(volume);
       
   153     mPlayer->PrepareToPlayDesSequence(aSequence);
       
   154 
       
   155     if (duration > 0) {
       
   156         mTimer = new QTimer(this);
       
   157         bool ret = connect(mTimer, SIGNAL(timeout()),
       
   158                 this, SLOT(stopPlayTone()));
       
   159         TFLOGSTRING2("SATAPP: SatAppPlayToneProvider::PlayStandardToneL \
       
   160                 connect mTimer stop: %d", ret)
       
   161         mTimer->start(duration);
       
   162     }
       
   163 
       
   164     if (mLoop) {
       
   165         TFLOGSTRING("SATAPP: SatAppPlayToneProvider::PlayStandardToneL loop")
       
   166         mLoop->exec(QEventLoop::AllEvents);
       
   167         TFLOGSTRING("SATAPP: SatAppPlayToneProvider::PlayStandardToneL quit loop")
       
   168         delete mLoop;
       
   169         mLoop = 0;
       
   170     }
       
   171     if (mPermanentNote) {
       
   172         TFLOGSTRING("SATAPP: SatAppPlayToneProvider::PlayStandardToneL note 0")
       
   173         delete mPermanentNote;
       
   174         mPermanentNote = 0;
       
   175     }
       
   176     if (mTimer) {
       
   177         TFLOGSTRING("SATAPP: SatAppPlayToneProvider::PlayStandardToneL timer 0")
       
   178         delete mTimer;
       
   179         mTimer = 0;
       
   180     }
       
   181 
       
   182 
       
   183     TFLOGSTRING("SATAPP: SatAppPlayToneProvider::PlayStandardToneL before play cancel")
       
   184     mPlayer->CancelPlay();
       
   185     delete mPlayer;
       
   186     mPlayer = NULL;
       
   187 
       
   188     //get warning and game tones setting from active profile
       
   189     GetProfileParamsL();
       
   190     if((EFalse == mWarningAndPlayTones) && 
       
   191           (ESatSuccess == mPlayToneError)) {
       
   192         mPlayToneError = ESatSuccessToneNotPlayed;
       
   193     }
       
   194     response = mPlayToneError;
       
   195     TFLOGSTRING("SATAPP: SatAppPlayToneProvider::PlayStandardToneL exit")
       
   196     return response;
       
   197 }
       
   198 
       
   199 
       
   200 // ---------------------------------------------------------
       
   201 // SatAppCommandHandler::GetProfileParamsL
       
   202 // Get and store settings from current profile 
       
   203 // (other items were commented in a header).
       
   204 // ---------------------------------------------------------
       
   205 //
       
   206 void SatAppPlayToneProvider::GetProfileParamsL( TSatTone aTone /*= ESatToneNotSet*/,
       
   207                                          TDes* aToneName /*= NULL*/ )
       
   208 {
       
   209     TFLOGSTRING( "SatAppCommandHandler::GetProfileParamsL calling" )
       
   210     MProfile* profile = NULL;
       
   211     MProfileEngine* engine = NULL;
       
   212     engine = CreateProfileEngineL();
       
   213     CleanupReleasePushL( *engine );
       
   214 
       
   215     profile = engine->ActiveProfileLC();
       
   216 
       
   217     const MProfileTones& tones = profile->ProfileTones();
       
   218 
       
   219     // Takes a current warning and gametones setting.
       
   220     const TProfileToneSettings& ts = tones.ToneSettings();
       
   221     mWarningAndPlayTones = ts.iWarningAndGameTones;
       
   222     mVolume = ts.iRingingVolume;
       
   223     if ( ( ESatUserSelectedToneIncomingSms == aTone ) && ( aToneName ) )
       
   224         {
       
   225         TFLOGSTRING("SatAppCommandHandler::GetProfileParamsL message tone")
       
   226         aToneName->Copy( tones.MessageAlertTone() );
       
   227     } else if( aToneName ) {
       
   228         TFLOGSTRING("SatAppCommandHandler::GetProfileParamsL ring tone")
       
   229         aToneName->Copy( tones.RingingTone1() );
       
   230     }
       
   231 
       
   232     CleanupStack::PopAndDestroy(2); // engine, profile
       
   233     TFLOGSTRING("SatAppCommandHandler::GetProfileParamsL exits")
       
   234 }
       
   235 
       
   236 // ---------------------------------------------------------
       
   237 // SatAppPlayToneProvider::MatoPrepareComplete
       
   238 // Indicates success or failure.
       
   239 // (other items were commented in a header).
       
   240 // ---------------------------------------------------------
       
   241 //
       
   242 void SatAppPlayToneProvider::MatoPrepareComplete(TInt aError)
       
   243 {
       
   244     TFLOGSTRING2("SatAppPlayToneProvider::MatoPrepareComplete called\
       
   245         aError = %d", aError)
       
   246     if (KErrNone == aError && mPlayer) {
       
   247         mPlayToneError = ESatSuccess;
       
   248         TTimeIntervalMicroSeconds zero(static_cast<TInt64>( 0 ));
       
   249         mPlayer->SetPriority(KAudioPriorityLowLevel,
       
   250                STATIC_CAST(TMdaPriorityPreference, KAudioPrefConfirmation));
       
   251         mPlayer->SetRepeats( KMdaAudioToneRepeatForever, zero );
       
   252         mPlayer->Play();
       
   253     } else {
       
   254         mPlayToneError = ESatFailure;
       
   255     }
       
   256     TFLOGSTRING( "SatAppPlayToneProvider::MatoPrepareComplete exit" )
       
   257 }
       
   258 
       
   259 //-----------------------------------------------------------------------------
       
   260 // SatAppPlayToneProvider::MatoPlayComplete
       
   261 // Indicates success or failure.
       
   262 // (other items were commented in a header).
       
   263 // ----------------------------------------------------------------------------
       
   264 //
       
   265 void SatAppPlayToneProvider::MatoPlayComplete( TInt aError )
       
   266 {
       
   267     TFLOGSTRING("SatAppPlayToneProvider::MatoPlayComplete calling")
       
   268     if (KErrNone == aError && mPlayer) {
       
   269         TFLOGSTRING("SatAppPlayToneProvider::MatoPlayComplete play")
       
   270         mPlayer->Play();
       
   271     } else {
       
   272         TFLOGSTRING( "SatAppPlayToneProvider::MatoPlayComplete stop playing")
       
   273         // Stops playing if error.
       
   274         stopPlayTone();
       
   275     }
       
   276     TFLOGSTRING2("SatAppPlayToneProvider::MatoPlayComplete exit error %d", aError)
       
   277 }
       
   278 
       
   279 //-----------------------------------------------------------------------------
       
   280 // SatAppPlayToneProvider::PlayUserSelectedToneL
       
   281 // (other items were commented in a header).
       
   282 // ----------------------------------------------------------------------------
       
   283 //
       
   284 TSatUiResponse SatAppPlayToneProvider::PlayUserSelectedToneL(
       
   285         const TDesC &aText,
       
   286         TTimeIntervalMicroSeconds aDuration,
       
   287         TSatTone aTone,
       
   288         const CFbsBitmap* /*aIconBitmap*/,
       
   289         const TBool aSelfExplanatory )
       
   290 {
       
   291     TFLOGSTRING("SatAppPlayToneProvider::PlayUserSelectedToneL calling")
       
   292     if (mTimer) {
       
   293         delete mTimer;
       
   294         mTimer = 0;
       
   295         TFLOGSTRING("SatAppPlayToneProvider::PlayUserSelectedToneL delete timer")
       
   296     }
       
   297     if (mLoop) {
       
   298         delete mLoop;
       
   299         mLoop = 0;
       
   300         TFLOGSTRING("SatAppPlayToneProvider::PlayUserSelectedToneL delete loop")
       
   301     }
       
   302     unsigned int duration(0);
       
   303     if (aDuration > 0) {
       
   304         duration = aDuration.Int64() / KPlayToneSymbianConvertQtTime;
       
   305         TFLOGSTRING2("SatAppPlayToneProvider::PlayUserSelectedToneL duration %d",
       
   306                 duration)
       
   307     }
       
   308 
       
   309     QString text;
       
   310     if (aText.Length() > 0) {
       
   311         text = QString::fromUtf16(aText.Ptr(), aText.Length());
       
   312         TFLOGSTRING2("SATAPP: SatAppPlayToneProvider::PlayUserSelectedToneL \
       
   313             text=%S", &aText)
       
   314         mPermanentNote = new HbMessageBox(HbMessageBox::MessageTypeInformation);
       
   315         bool selfExplanatory = aSelfExplanatory;
       
   316         if (!selfExplanatory) {
       
   317             mPermanentNote->setText(text);
       
   318             if (duration) {
       
   319                 mPermanentNote->setTimeout(duration);
       
   320             }
       
   321             mPermanentNote->setDismissPolicy(HbPopup::TapAnywhere);
       
   322             TFLOGSTRING("SatAppPlayToneProvider::PlayUserSelectedToneL show before")
       
   323             mPermanentNote->show();
       
   324             TFLOGSTRING("SatAppPlayToneProvider::PlayUserSelectedToneL show after")
       
   325         }
       
   326     }
       
   327 
       
   328     // If several messages/calls arrive during a small amount of time and if the
       
   329     // message received or incoming call tone is already being played we do not 
       
   330     // restart it.
       
   331     if (mAudioPlayer) {
       
   332         TFLOGSTRING( "SatAppPlayToneProvider::\
       
   333             PlayUserSelectedToneL Error - already played" )
       
   334         return ESatFailure;
       
   335     }
       
   336 
       
   337     TSatUiResponse response(ESatSuccess);
       
   338     // This defines name for the current message alert or incoming call tone. 
       
   339     TBuf<KMaxSoundFileLength> soundFileName;
       
   340     GetProfileParamsL( aTone, &soundFileName );
       
   341     // This defines the behaviour to be adopted by an
       
   342     // audio client if a higher priority client takes over the device.
       
   343     TInt mdaPriority( KAudioPrefIncomingCall );
       
   344     // This is used to resolve conflicts when more than one client tries to 
       
   345     // access the same sound output device simultaneously.
       
   346     TInt audioPriority( KAudioPriorityPhoneCall );
       
   347 
       
   348     TFLOGSTRING2( "SATAPP: SatAppPlayToneProvider::PlayUserSelectedToneL\
       
   349         Volume is %d ", mVolume )
       
   350 
       
   351     // Creates the audio player.
       
   352     mAudioPlayer = CMdaAudioPlayerUtility::NewFilePlayerL( 
       
   353         soundFileName,
       
   354         *this,
       
   355         audioPriority,
       
   356         ( TMdaPriorityPreference ) mdaPriority );
       
   357 
       
   358     if (aDuration > 0) {
       
   359         TFLOGSTRING( "SATAPP: SatAppPlayToneProvider::PlayUserSelectedToneL\
       
   360          duration not 0" )
       
   361         mAudioPlayer->SetRepeats( KSoundPlayerRepeatForever, 
       
   362                                   TTimeIntervalMicroSeconds( 
       
   363                                   static_cast<TInt64>( 0 ) ) );
       
   364         mTimer = new QTimer(this);
       
   365         mTimer->start(duration);
       
   366         mLoop = new QEventLoop(this);
       
   367         bool ret = connect(mTimer, SIGNAL(timeout()), this, SLOT(stopPlayTone()));
       
   368         TFLOGSTRING2("SATAPP: SatAppPlayToneProvider::PlayUserSelectedToneL\
       
   369                 connect mTimer stop: %d", ret)
       
   370 
       
   371         if (mPermanentNote) {
       
   372             ret = connect(mPermanentNote, SIGNAL(aboutToClose()),
       
   373                     this, SLOT(stopPlayTone()));
       
   374             TFLOGSTRING2("SATAPP: SatAppPlayToneProvider::PlayUserSelectedToneL \
       
   375                connect note close to timer stop: %d", ret)
       
   376         }
       
   377         if (mLoop) {
       
   378             mLoop->exec(QEventLoop::AllEvents);
       
   379             TFLOGSTRING("SATAPP: SatAppPlayToneProvider::PlayUserSelectedToneL quit loop")
       
   380             delete mLoop;
       
   381             mLoop = 0;
       
   382         }
       
   383         if (mPermanentNote) {
       
   384             TFLOGSTRING("SATAPP: SatAppPlayToneProvider::PlayUserSelectedToneL note 0")
       
   385             delete mPermanentNote;
       
   386             mPermanentNote = 0;
       
   387         }
       
   388         if (mTimer) {
       
   389             TFLOGSTRING("SATAPP: SatAppPlayToneProvider::PlayUserSelectedToneL timer 0")
       
   390             delete mTimer;
       
   391             mTimer = 0;
       
   392         }
       
   393         // Sample is played in forever loop for the duration.
       
   394         // After duration call back timers are destroyed       
       
   395         // If player exists, stop playing and delete player. MapcPlayComplete
       
   396         // is not called because CallBackTimer stops the playing.
       
   397         if (mAudioPlayer) {
       
   398             mAudioPlayer->Stop();
       
   399             delete mAudioPlayer;
       
   400             mAudioPlayer = 0;
       
   401             TFLOGSTRING( "SatAppPlayToneProvider::PlayUserSelectedToneL\
       
   402                 mAudioPlayer deleted" )
       
   403         }
       
   404     } else {
       
   405         // If duration is zero then tone is played only once.
       
   406         // Playing duration is same as duration of the sample.
       
   407         mAudioPlayer->SetRepeats(
       
   408             0, TTimeIntervalMicroSeconds( static_cast<TInt64>( 0 ) ) );
       
   409         TFLOGSTRING( "SatAppPlayToneProvider::PlayUserSelectedToneL SetRepeats 0" )
       
   410     }
       
   411 
       
   412     TFLOGSTRING( "SatAppPlayToneProvider::PlayUserSelectedToneL exit" )
       
   413     if( EFalse == mWarningAndPlayTones ) {
       
   414         response = ESatSuccessToneNotPlayed;
       
   415     }
       
   416 
       
   417     TFLOGSTRING( "SatAppPlayToneProvider::PlayUserSelectedToneL exit" )
       
   418     return response;
       
   419 }
       
   420 
       
   421 //-----------------------------------------------------------------------------
       
   422 // SatAppPlayToneProvider::MapcInitComplete
       
   423 // Plays the tone.
       
   424 // (other items were commented in a header).
       
   425 // ----------------------------------------------------------------------------
       
   426 void SatAppPlayToneProvider::MapcInitComplete( TInt aError, 
       
   427     const TTimeIntervalMicroSeconds& /*aDuration*/ )
       
   428 {
       
   429     TFLOGSTRING( "SatAppPlayToneProvider::MapcInitComplete called" )
       
   430     // Audio player is initialised, so if there is no error, we can start 
       
   431     // playing the tone.
       
   432     if (KErrNone == aError && mAudioPlayer) {
       
   433         const TInt volume( Max(0, Min(mVolume, 
       
   434                            mAudioPlayer->MaxVolume())));
       
   435         TFLOGSTRING2("CSatUiViewAppUi::\
       
   436             MapcInitComplete SetVolume %d", volume )
       
   437         // Set volume according Settings. 
       
   438         mAudioPlayer->SetVolume( volume );
       
   439         mAudioPlayer->Play();
       
   440         TFLOGSTRING( "SatAppPlayToneProvider::MapcInitComplete Play" )
       
   441     } else {
       
   442         // Otherwise, we delete the initialised audio player.
       
   443         if ( mAudioPlayer ) {
       
   444             TFLOGSTRING( "SatAppPlayToneProvider::MapcInitComplete mAudioPlayer \
       
   445                           true" )
       
   446             delete mAudioPlayer;
       
   447             mAudioPlayer = 0;
       
   448      }
       
   449 
       
   450         // Remove also the note for play tone
       
   451         // If there was a duration for play tone, stop waiting
       
   452         stopPlayTone();
       
   453 
       
   454         TFLOGSTRING2( "SatAppPlayToneProvider::MapcInitComplete Error %d", aError )
       
   455     }
       
   456     TFLOGSTRING( "SatAppPlayToneProvider::MapcInitComplete exit" )
       
   457 }
       
   458 
       
   459 //-----------------------------------------------------------------------------
       
   460 // SatAppPlayToneProvider::MapcPlayComplete
       
   461 // Deletes audio player after playing is completed.
       
   462 // (other items were commented in a header).
       
   463 // ----------------------------------------------------------------------------
       
   464 void SatAppPlayToneProvider::MapcPlayComplete( TInt /*aError*/ )
       
   465 {
       
   466     TFLOGSTRING( "SatAppPlayToneProvider::MapcPlayComplete called" )
       
   467 
       
   468     // When playing is completed, deleting the audio player.
       
   469     if ( mAudioPlayer ) {
       
   470         TFLOGSTRING("SatAppPlayToneProvider::MapcPlayComplete delete mAudioPlayer")
       
   471         delete mAudioPlayer;
       
   472         mAudioPlayer = 0;
       
   473     }
       
   474     // Remove note after play has completed.
       
   475     stopPlayTone();
       
   476     TFLOGSTRING("SatAppPlayToneProvider::MapcPlayComplete exit")
       
   477 }
       
   478 
       
   479 // ----------------------------------------------------------------------------
       
   480 // SatAppPlayToneProvider::clearScreen
       
   481 // (other items were commented in a header).
       
   482 // ----------------------------------------------------------------------------
       
   483 //
       
   484 void SatAppPlayToneProvider::clearScreen()
       
   485 {
       
   486     TFLOGSTRING("SATAPP: SatAppEventProvider::ClearScreen call")
       
   487     stopPlayTone();
       
   488     TFLOGSTRING("SATAPP: SatAppEventProvider::ClearScreen exit")
       
   489 }
       
   490 
       
   491 // ----------------------------------------------------------------------------
       
   492 // SatAppPlayToneProvider::clearScreen
       
   493 // (other items were commented in a header).
       
   494 // ----------------------------------------------------------------------------
       
   495 //
       
   496 void SatAppPlayToneProvider::closeSatUI()
       
   497 {
       
   498     TFLOGSTRING("SATAPP: SatAppEventProvider::closeSatUI call")
       
   499     clearScreen();
       
   500     TFLOGSTRING("SATAPP: SatAppEventProvider::closeSatUI exit")
       
   501 }
       
   502 
       
   503 // ----------------------------------------------------------------------------
       
   504 // SatAppPlayToneProvider::stopPlayTone
       
   505 // (other items were commented in a header).
       
   506 // ----------------------------------------------------------------------------
       
   507 //
       
   508 void SatAppPlayToneProvider::stopPlayTone()
       
   509 {
       
   510     TFLOGSTRING("SATAPP: SatAppEventProvider::stopPlayTone call")
       
   511      if (mPermanentNote) {
       
   512         TFLOGSTRING("SatAppPlayToneProvider::stopPlayTone delete mPermanentNote")
       
   513         disconnect(mPermanentNote,SIGNAL(aboutToClose()),
       
   514                 this, SLOT(stopPlayTone())); 
       
   515         mPermanentNote->close();
       
   516     }
       
   517     if (mTimer) {
       
   518         TFLOGSTRING("SatAppPlayToneProvider::stopPlayTone delete timer")
       
   519         disconnect(mTimer,SIGNAL(timeout()), this, SLOT(stopPlayTone()));
       
   520         if (mTimer->isActive()) {
       
   521             mTimer->stop();
       
   522         }
       
   523     }
       
   524     if (mLoop && mLoop->isRunning()) {
       
   525         TFLOGSTRING("SatAppPlayToneProvider::stopPlayTone exit loop")
       
   526         mLoop->exit();
       
   527     }
       
   528     TFLOGSTRING("SATAPP: SatAppEventProvider::stopPlayTone exit")
       
   529 }
       
   530 
       
   531  //End of file