⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cameraappcontroller.cpp

📁 Symbian智能手机操作系统源代码值的参考_摄像头
💻 CPP
📖 第 1 页 / 共 2 页
字号:
-----------------------------------------------------------------------------
*/
CFbsBitmap& CCameraAppController::GetSnappedImage() 
    {
    return *iBitmapSnap;
    }

/*
-----------------------------------------------------------------------------

	void CCameraAppController::SaveImageL()

	Description: Saves the snapped image on disk
	Comments   :

    Return values: N/A

-----------------------------------------------------------------------------
*/
void CCameraAppController::SaveImageL()
    {    
    // Get the next usable file name
    GetNextUsableFileName();

    // Save the image
    iCameraCaptureEngine->SaveImageL( QualityFactor(), &iNewFileName, 
        &(iEikEnv->FsSession()) );
    }

/*
-----------------------------------------------------------------------------

	TJpegQualityFactor CCameraAppController::QualityFactor() const

	Description: Returns current quality factor
	Comments   :

    Return values: N/A

-----------------------------------------------------------------------------
*/
TJpegQualityFactor CCameraAppController::QualityFactor() const
    {
    return KHighQualityFactor; 
    }

/*
-----------------------------------------------------------------------------

	void CCameraAppController::CreateSoundPlayerL()

	Description: Initializes snap sound player
	Comments   :

    Return values: N/A

-----------------------------------------------------------------------------
*/
void CCameraAppController::CreateSoundPlayerL()
    {
    TFileName soundFile;
    #ifdef __SERIES60_3X__    
        // Only in 3rd Edition. The snap sound file can be found 
        // in \private\<UID3>\ folder.
        RFs& fs = iEikEnv->FsSession();
        User::LeaveIfError( fs.CreatePrivatePath( EDriveC ) );
        User::LeaveIfError( fs.SetSessionToPrivate( EDriveC ) );
        User::LeaveIfError( fs.PrivatePath(soundFile) );
    #else
        #ifndef __WINS__  // don't save settings to z-drive in emulator
        // In 2nd Ed device the snap sound file will be in 
        // \system\apps\cameraapp\ folder.
        TFileName appFullName = (iAppUi.Application())->AppFullName();
        TParsePtr appPath(appFullName);
        soundFile = appPath.DriveAndPath();
        #else 
        // For 2nd Ed emulator
        soundFile.Append(KEmulatorPath);
        #endif //__WINS__
    #endif

    soundFile.Append(KSnapSoundFile);
        
    iSoundPlayer = CMdaAudioPlayerUtility::NewFilePlayerL(soundFile, 
        *this, EMdaPriorityMin, EMdaPriorityPreferenceNone);
    }

/*
-----------------------------------------------------------------------------

	void CCameraAppController::PlaySnapSound( )

	Description: Plays snap sound
	Comments   :

    Return values: N/A

-----------------------------------------------------------------------------
*/
void CCameraAppController::PlaySnapSound( )
    {
    if ( iSoundPlayerReady )
        {
            iSoundPlayer->Play();
        }
    }

/*
-----------------------------------------------------------------------------

	void CCameraAppController::ShowConversionStatusL( const TDesC &aStatus )

	Description: show the status of the current image converting status
	omments   :

    Return values: N/A

-----------------------------------------------------------------------------
*/
void CCameraAppController::ShowConversionStatusL( const TDesC &aStatus )
    {
    if ( iContainer )
        {
        (STATIC_CAST(CCameraAppBaseContainer*, iContainer))->
                ShowConversionStatusL( aStatus );
        }
    }

/*
-----------------------------------------------------------------------------

	TBool CCameraAppController::IsImageConversionInProgress()

	Description: return to status showing whether the image conversion is 
				 in progress or not.
	omments   :

    Return values: true if image is being converted

-----------------------------------------------------------------------------
*/
TBool CCameraAppController::IsImageConversionInProgress()
    {
    return iCameraCaptureEngine->IsImageConversionInProgress();		
    }

/*
-----------------------------------------------------------------------------

	void CCameraAppController::RedrawNaviTabsL()

	Description: redraw navi tabs, showing "Standard" and "Portrait"
	omments   :

    Return values: N/A

-----------------------------------------------------------------------------
*/
void CCameraAppController::RedrawNaviTabsL()
    {
    if ( iContainer )
        {
        CCameraAppAppUi* appUi = STATIC_CAST(CCameraAppAppUi*, &iAppUi);
        (STATIC_CAST(CCameraAppBaseContainer*, iContainer))->
            RedrawNaviTabsL(appUi->GetDecoratedTabGroup());
        }

    if ( iCameraCaptureEngine )
        {
        iCameraCaptureEngine->SetEngineState( EEngineIdle );
        }
    }

/*
-----------------------------------------------------------------------------

	TEngineState CCameraAppController::GetEngineState()

	Description: get engine state
	omments   :

    Return values: engine state

-----------------------------------------------------------------------------
*/
TEngineState CCameraAppController::GetEngineState()
    {
    return iCameraCaptureEngine->GetEngineState();
    }

/*
-----------------------------------------------------------------------------

	TEngineState CCameraAppController::GetEngineState()

	Description: set engine state
	omments   :

    Return values: N/A

-----------------------------------------------------------------------------
*/
void CCameraAppController::SetEngineState( TEngineState aState )
    {
    iCameraCaptureEngine->SetEngineState( aState );
    }

/*
-----------------------------------------------------------------------------

	void CCameraAppController::GetNextUsableFileName()

	Description: get the next usable file name
	omments   :

    Return values: N/A

-----------------------------------------------------------------------------
*/
void CCameraAppController::GetNextUsableFileName()
    {	
    TInt index = 0;

    do {
        iNewFileName.Copy( iImagePath->Des() );
        iNewFileName.Append( KImageFileName );

        TBuf<KFileNameIndexMaxLength> num;
        num.Num( index );
        iNewFileName.Append( num );
        
        iNewFileName.Append( KJpgFileExtension );
        if ( !BaflUtils::FileExists( iEikEnv->FsSession(),
            iNewFileName ) )
            break;

        index ++;
        } while ( 1 );
    }

/*
-----------------------------------------------------------------------------

	void CCameraAppController::HandleError(TInt aError)
	
	Description: handle to error messages from the capture engine
	omments   :

    Return values: N/A

-----------------------------------------------------------------------------
*/
void CCameraAppController::HandleError(TInt aError)
    {
    TInt reason(KErrNone);
    switch( aError )
        {
        case KErrNone:
            reason = KErrNone;
            break;
        case KErrInUse:
            reason = ECameraInUse;
            // Since the camera is in use, we need to display a message, 
            // showing the message "Camera in use by another application"
            if ( iContainer )
                STATIC_CAST(CCameraAppBaseContainer*, iContainer)->
                ShowErrorMessage( KCameraInUse );
            break;
        }
    }

/*
-----------------------------------------------------------------------------

	TBool CCameraAppController::IsCameraUsedByAnotherApp()
	
	Description: return whether the camera is being used another app.
	Comments   : 

    Return values: true if it is used by another app.

-----------------------------------------------------------------------------
*/
TBool CCameraAppController::IsCameraUsedByAnotherApp()
    {
    return iCameraCaptureEngine->IsCameraUsedByAnotherApp();
    }

/*
-----------------------------------------------------------------------------

	TInt CCameraAppController::SetZoomL(TBool aEnable)
	
	Description: Set the zoom factor. It will increase or decrease the zoom 
				 factor
	Comments   : 

    Return values: zoom factor of the camera

-----------------------------------------------------------------------------
*/
TInt CCameraAppController::SetZoomL(TBool aEnable)
    {
    return iCameraCaptureEngine->SetZoomFactorL( aEnable );
    }


/*
-----------------------------------------------------------------------------

    void CCameraAppController::MapcInitComplete(TInt aError, 
        const TTimeIntervalMicroSeconds &aDuration)
    
    Description: From MMdaAudioPlayerCallback. Called when initialization is
                 complete.
    Comments   : 

    Return values:

-----------------------------------------------------------------------------
*/
void CCameraAppController::MapcInitComplete(TInt aError, 
    const TTimeIntervalMicroSeconds& /*aDuration*/)
    {
        if (!aError)
            {
                iSoundPlayerReady = ETrue;
            }
        else
            {
                iSoundPlayerReady = EFalse;                
            }
    }

/*
-----------------------------------------------------------------------------

    void CCameraAppController::MapcPlayComplete(TInt aError)
    
    Description: From MMdaAudioPlayerCallback. Called when playback is
                 complete.
    Comments   : 

    Return values:

-----------------------------------------------------------------------------
*/
void CCameraAppController::MapcPlayComplete(TInt /*aError*/)
    {
        // Nothing to do here
    }


/*
-----------------------------------------------------------------------------

    void CCameraAppController::ClientRectChangedL(TRect& aRect)
    
    Description: Notify the controller if the client rect size changes
    Comments   : 

    Return values: N/A

-----------------------------------------------------------------------------
*/
void CCameraAppController::ClientRectChangedL(const TRect& aRect)
    {
    iCameraCaptureEngine->ClientRectChangedL(aRect);
    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -