Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Regular Contributor
Posts: 68
Registered: ‎03-13-2012
My Device: Playbook
My Carrier: Rodgers

Clean way to inherit the multimedia bb10 camera?

So I am looking at this code

 

http://developer.blackberry.com/cascades/documentation/design/camera/code_samples.html

 

And I realized what they did was create a "Custom" c++ camera back end, and reference the original bb10 multimedia camera, in qml

 

 // The root container.
    content: Container {
        id: cntrRoot
 
        // The Camera control.
        Camera
{
            id: camera1
            objectName: "myCameraObj"
             
        }
    } // End of root container.
 
and then they reference the qml camera created in qml code through the findChild by name in c++ code,
connect the "custom c++ backend " with the bb10 multimedia camera in the front end.

// Set the pointer to point to your specific Camera object.
    cameraObj =
        root->findChild<bb::cascades::multimedia::Camera*>("myCameraObj");

// Connect some signals and slots.
    connect(cameraObj, SIGNAL(touch(bb::cascades::TouchEvent*)),
        this, SLOT(onTouch()));
    connect(cameraObj, SIGNAL(cameraOpened()), this,SLOT(onCameraOpened()));
    connect(cameraObj, SIGNAL(shutterFired()), this,SLOT(onShutterFired()));
    connect(cameraObj, SIGNAL(viewfinderStarted()),
        this, SLOT(onViewfinderStarted()));
    connect(cameraObj, SIGNAL(photoSaved(const QString &, quint64)), this,
            SLOT(onPhotoSaved()));
    connect(cameraObj, SIGNAL(previewFrameAvailable(
                    SharedUCharPointer,
                    quint64,
                    unsigned int,
                    unsigned int,
                    unsigned int)),
            &processor, SLOT(onPreviewFrameAvailable(
                    SharedUCharPointer,
                    quint64,
                    unsigned int,
                    unsigned int,
                    unsigned int)));
 
 
Which seems odd, this would imply that the backend wraps the qml code uncleanly also you created two cameras, one registered with qml, and one that is in your c++ backend.
 
Inshort I want to be able to
1. qmlregistertype<customcamera>(etc... ) // register my camera type.
2. have a c++ backend that has access to all the bb10 multimedia properties without this horrible work around.
3. create the customcamera in qml and call c++ backend code.
 
I have a feeling that it has to do with inheriting the c++ bb10 multimedia camera and just registering the type.
I will try that now but if anyone knows the answer let me know.
 
Thanks.
 
Regular Contributor
Posts: 68
Registered: ‎03-13-2012
My Device: Playbook
My Carrier: Rodgers

Re: Clean way to inherit the multimedia bb10 camera?

Figured it out. 

Developer
Posts: 107
Registered: ‎06-12-2012
My Device: Dev Alpha C, Playbook
My Carrier: Loop

Re: Clean way to inherit the multimedia bb10 camera?

Posting the solution might help others looking for similar solutions. Thank you.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.