Opening Symbian Video editor from Qt
Article Metadata
Code Example
Article
Contents |
Overview
Here in this article we will learn how to launch Video Editor in Symbian^3 Device. We will open the Default Video Editor with a specific video file. This solution will work if a Video editor is present in the device. Any Video editor that is registered as a service will work.You can give a image file instead of the video file and it will still open in the Video editor. If you change KVideoType to be image/jpeg it will open the image editor instead.
If you plan to release the application on some other platform, it is suggested to use #ifdef Q_OS_SYMBIAN .. #endif around the Symbian specific parts (but not in the .pro file).
.PRO file
First step is to include necessary libary in the .pro file's symbian{} section.
symbian {
LIBS += -lservicehandler
}
Header file
In the header file of the class you plan to launch the request from:
#include <AiwServiceHandler.h>Inside the class add this member variable:
CAiwServiceHandler* iAiwServiceHandler;
Source file
In the constructor initialize the member variable and tell it that we will be interested in KAiwCmdEdit-services.
MyClass::MyClass()
{
// ...
//Your other code here
//
iAiwServiceHandler = CAiwServiceHandler::NewL();
RCriteriaArray interest;
CleanupClosePushL(interest);
//We are interested on all "KAiCmdEdit" types
_LIT8(KAllTypes, "*");
CAiwCriteriaItem* criteria = CAiwCriteriaItem::NewLC(KAiwCmdEdit, KAiwCmdEdit, KAllTypes);
TUid base;
base.iUid = KAiwClassBase;
criteria->SetServiceClass(base);
User::LeaveIfError(interest.Append(criteria));
iAiwServiceHandler->AttachL(interest);
CleanupStack::PopAndDestroy(criteria);
CleanupStack::PopAndDestroy(&interest);
}
And remember to reset and delete the variable in the destructor.
MyClass::~MyClass()
{
if ( iAiwServiceHandler )
{
iAiwServiceHandler->Reset();
delete iAiwServiceHandler;
}
}
Then add a method to do the request.
void MyClass::openVideoEditorWithFile(QString file)
{
CAiwGenericParamList& inputParams = iAiwServiceHandler->InParamListL();
TFileName filename(file.utf16());
TAiwGenericParam param(EGenericParamFile);
param.Value().Set(filename);
inputParams.AppendL(param);
TAiwVariant param2Variant;
_LIT( KVideoType, "video/*" );
param2Variant.Set(KVideoType);
TAiwGenericParam param2(EGenericParamMIMEType, param2Variant);
inputParams.AppendL(param2);
iAiwServiceHandler->ExecuteServiceCmdL(KAiwCmdEdit, inputParams, iAiwServiceHandler->OutParamListL());
}
Fixing the build error
You might get a build error concerning AiwCommon.h To fix it, do one change in it.
IMPORT_C TAiwVariant& TAiwVariant::operator=(const TAiwVariant& aValue);
to
IMPORT_C TAiwVariant& operator=(const TAiwVariant& aValue);
Download Source Code
The full source code presented in this article is available here File:Launchvideoeditor.zip


(no comments yet)