📄 vrexappui.cpp
字号:
void CVRexAppUi::PlayVideoFile(TDesC& aFileName)
Description: This method plays a video clip.
Comments :
Return values: N/A
-----------------------------------------------------------------------------
*/
void CVRexAppUi::PlayVideoFileL(TDesC& aFileName)
{
iEngine->iVPlayer->SetNewFileL(aFileName);
// Set time navi pane to indicate loading
SetNaviLabelL( KVRexLoading );
// Init the controller
DoInitControllerL();
}
/*
-----------------------------------------------------------------------------
void CVRexAppUi::DoRecordL()
Description: This method starts recording a video clip.
Comments :
Return values: N/A
-----------------------------------------------------------------------------
*/
void CVRexAppUi::DoRecordL()
{
iEngine->iVRecorder->StartL(this, iView->Finder()->CameraHandle());
}
/*
-----------------------------------------------------------------------------
void CVRexAppUi::DoResumeL()
Description: This method resumes playback of a video clip.
Comments :
Return values: N/A
-----------------------------------------------------------------------------
*/
void CVRexAppUi::DoResumeL()
{
if(iEngine->iVPlayer->State() != CVideoPlayerAdapter::EPaused)
return;
iEngine->iVPlayer->PlayL();
}
/*
-----------------------------------------------------------------------------
void CVRexAppUi::DoStopL()
Description: This method stops playback or recording of a video clip.
Comments :
Return values: N/A
-----------------------------------------------------------------------------
*/
void CVRexAppUi::DoStopL()
{
SetNaviLabelL(KNullDesC);
if((iEngine->iVPlayer->State() == CVideoPlayerAdapter::EPlaying) ||
(iEngine->iVPlayer->State() == CVideoPlayerAdapter::EPaused))
iEngine->iVPlayer->Stop();
if(iEngine->iVRecorder->State() == CVideoRecorderAdapter::ERecording)
iEngine->iVRecorder->Stop();
}
/*
-----------------------------------------------------------------------------
void CVRexAppUi::InitControllerCompletedL(TInt aError)
Description: Controller initialization completed.
Comments :
Return values: N/A
-----------------------------------------------------------------------------
*/
void CVRexAppUi::InitControllerCompletedL(TInt /*aError*/)
{
// Play the video
iEngine->iVPlayer->PlayL();
}
/*
-----------------------------------------------------------------------------
void CVRexAppUi::PlayCompletedL(TInt aError)
Description: Video clip playback completed.
Comments :
Return values: N/A
-----------------------------------------------------------------------------
*/
void CVRexAppUi::PlayCompletedL(TInt /*aError*/)
{
// The play has been completed, we need to refresh the display now.
iView->DrawNow();
SetNaviLabelL(KNullDesC);
}
/*
-----------------------------------------------------------------------------
void CVRexAppUi::RecordCompletedL(TInt aError)
Description: Video clip record completed.
Comments :
Return values: N/A
-----------------------------------------------------------------------------
*/
void CVRexAppUi::RecordCompletedL(TInt /*aError*/)
{
iView->StopFinder();
// The recording has been completed, we need to refresh the display now.
iView->DrawNow();
SetNaviLabelL(KNullDesC);
// Refresh the directory listing
iView->UpdateFileListL();
}
/*
-----------------------------------------------------------------------------
void CVRexAppUi::DoInitControllerL()
Description: This method initializes video playback controller.
Comments :
Return values: N/A
-----------------------------------------------------------------------------
*/
void CVRexAppUi::DoInitControllerL()
{
if(iView)
{
TRect tmp = iView->VideoRect();
iEngine->iVPlayer->InitControllerL(this, iView->ClientWsSession(),
iView->ScreenDevice(),
iView->ClientWindow(), tmp, tmp);
}
}
/*
-----------------------------------------------------------------------------
void CVRexAppUi::DoPauseL()
Description: This method pauses playback of video clip.
Comments :
Return values: N/A
-----------------------------------------------------------------------------
*/
void CVRexAppUi::DoPauseL()
{
iEngine->iVPlayer->PauseL();
}
/*
-----------------------------------------------------------------------------
void CVRexAppUi::DoDocPlayL()
Description: This method launches external viewer to play back video.
Comments :
Return values: N/A
-----------------------------------------------------------------------------
*/
void CVRexAppUi::DoDocPlayL()
{
TDataType data = TDataType(KNullUid);
// Set the file name first
TFileName fileName;
iView->GetCurrentVideoFileNameL( fileName );
iEngine->iVPlayer->DocumentHandlerL().OpenFileEmbeddedL(fileName, data);
}
/*
-----------------------------------------------------------------------------
CAknNavigationDecorator* CVRexAppUi::CreateTimeNaviL()
Description: This method creates time display navigation decorator.
Comments :
Return values: CAknNavigationDecorator object pointer
-----------------------------------------------------------------------------
*/
CAknNavigationDecorator* CVRexAppUi::CreateTimeNaviL()
{
CVideoNaviDecoratorTime* timeNavi = CVideoNaviDecoratorTime::NewL();
CleanupStack::PushL(timeNavi);
CAknNavigationDecorator* decoratedFolder =
CAknNavigationDecorator::NewL(iNaviPane, timeNavi,
CAknNavigationDecorator::ENotSpecified);
CleanupStack::Pop(); // timeNavi, decoratedFolder owns it now.
CleanupStack::PushL(decoratedFolder);
decoratedFolder->SetContainerWindowL(*iNaviPane);
timeNavi->SetContainerWindowL(*decoratedFolder);
CleanupStack::Pop(); // decoratedFolder
decoratedFolder->MakeScrollButtonVisible(EFalse);
return decoratedFolder;
}
/*
-----------------------------------------------------------------------------
void CVRexAppUi::SetNaviLabelL(const TDesC &aLabel)
Description: This method sets navigation decorator label.
Comments :
Return values: N/A
-----------------------------------------------------------------------------
*/
void CVRexAppUi::SetNaviLabelL(const TDesC &aLabel)
{
CVideoNaviDecoratorTime* timeNavi =
static_cast<CVideoNaviDecoratorTime*>(iTimeNavi->DecoratedControl());
timeNavi->SetLabelL(aLabel);
}
/*
-----------------------------------------------------------------------------
void CVRexAppUi::DoGetFileInfoL()
Description: This method shows file details in dialog.
Comments :
Return values: N/A
-----------------------------------------------------------------------------
*/
void CVRexAppUi::DoGetFileInfoL()
{
CVideoFileDetailsDialog* dlg = CVideoFileDetailsDialog::NewL();
TFileName fileName;
iView->GetCurrentVideoFileNameL( fileName );
dlg->ExecuteLD( fileName);
}
/*
-----------------------------------------------------------------------------
void CVRexAppUi::PlaybackPositionChangedL(TInt64 aPlaybackPosInSeconds, TInt64 aTotalLengthInSeconds)
Description: Video clip position changed.
Comments : If aTotalLenght is 0, only position is displayed (used in
reporting position in recording or if total length is not
known)
Return values: N/A
-----------------------------------------------------------------------------
*/
void CVRexAppUi::PlaybackPositionChangedL(TInt64 aPlaybackPosInSeconds, TInt64 aTotalLengthInSeconds)
{
TTime posTime = TTime(aPlaybackPosInSeconds*KMPOneSecond);
TTime durTime = TTime(aTotalLengthInSeconds*KMPOneSecond);
TBuf<16> pos;
TBuf<16> dur;
if(aTotalLengthInSeconds > 0 && aTotalLengthInSeconds < KOneHourInSeconds)
{
// Format time to user readable format. (min:sec)
posTime.FormatL(pos, *iMinSecFormatString);
durTime.FormatL(dur, *iMinSecFormatString);
}
else
{
// Format time to user readable format. (hour:min:sec)
posTime.FormatL(pos, *iHourMinSecFormatString);
aTotalLengthInSeconds = 0;
}
// If duration greater than 0, show postion in 00:00/00:00 format
if (aTotalLengthInSeconds > 0)
{
CDesCArrayFlat* strings = new CDesCArrayFlat(2);
CleanupStack::PushL(strings);
strings->AppendL(pos); //First string (position)
strings->AppendL(dur); //Second string (duration)
HBufC* stringholder = StringLoader::LoadLC(R_VREX_NAVI_TIME,*strings,iEikonEnv);
static_cast<CVideoNaviDecoratorTime*> (iTimeNavi->DecoratedControl())->SetLabelL(*stringholder);
CleanupStack::PopAndDestroy(2); // strings & stringholder
}
else // Show position in 00:00:00 format
{
static_cast<CVideoNaviDecoratorTime*>(iTimeNavi->DecoratedControl())->SetLabelL(pos);
}
}
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -