Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Default empty project template
- #include "AppName.hpp"
- #include <bb/cascades/Application>
- #include <bb/cascades/QmlDocument>
- #include <bb/cascades/AbstractPane>
- //Remove if unable to run//////////////
- #include <QtGui/QImage>
- #include <QtGui/QImageReader>
- #include <bb/cascades/Page>
- #include <bb/cascades/multimedia/Camera>
- #include <bb/system/InvokeRequest>
- #include <bb/system/InvokeManager>
- ///////////////////////////////////////
- using namespace bb::cascades;
- using namespace bb::cascades::multimedia;
- // Remove if unable to run/////////////
- using namespace bb::system;
- ///////////////////////////////////////
- AppName::AppName(bb::cascades::Application *app)
- : QObject(app)
- {
- qmlRegisterType < Camera > ("bb.cascades.multimedia", 1, 0, "Camera");
- // create scene document from main.qml asset
- // set parent to created document to ensure it exists for the whole application lifetime
- QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
- qml->setContextProperty("photoBomber", this);
- // create root object for the UI
- //AbstractPane *root = qml->createRootObject<AbstractPane>();
- // Remove if unable to run/////////////
- Page *appPage = qml->createRootObject<Page>();
- ///////////////////////////////////////
- // set created root object as a scene
- fprintf(stderr, "Before setting scene");
- app->setScene(appPage);
- fprintf(stderr, "After setting scene");
- // Remove if unable to run/////////////
- Camera *camera = appPage->findChild<Camera*>("myCamera");
- fprintf(stderr, "\n Camera variable: %s", camera->isCameraAccessible(CameraUnit::Front)); // This doesn't print to console
- camera->open(CameraUnit::Front);
- fprintf(stderr, "Gets to the end");
- ///////////////////////////////////////
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement