This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Dec 7th, 2012  |  syntax: C++  |  size: 1.79 KB  |  views: 41  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. // Default empty project template
  2. #include "AppName.hpp"
  3.  
  4. #include <bb/cascades/Application>
  5. #include <bb/cascades/QmlDocument>
  6. #include <bb/cascades/AbstractPane>
  7.  
  8. //Remove if unable to run//////////////
  9. #include <QtGui/QImage>
  10. #include <QtGui/QImageReader>
  11.  
  12. #include <bb/cascades/Page>
  13. #include <bb/cascades/multimedia/Camera>
  14.  
  15. #include <bb/system/InvokeRequest>
  16. #include <bb/system/InvokeManager>
  17. ///////////////////////////////////////
  18.  
  19. using namespace bb::cascades;
  20. using namespace bb::cascades::multimedia;
  21.  
  22. // Remove if unable to run/////////////
  23. using namespace bb::system;
  24. ///////////////////////////////////////
  25.  
  26. AppName::AppName(bb::cascades::Application *app)
  27. : QObject(app)
  28. {
  29.         qmlRegisterType < Camera > ("bb.cascades.multimedia", 1, 0, "Camera");
  30.     // create scene document from main.qml asset
  31.     // set parent to created document to ensure it exists for the whole application lifetime
  32.     QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
  33.     qml->setContextProperty("photoBomber", this);
  34.     // create root object for the UI
  35.     //AbstractPane *root = qml->createRootObject<AbstractPane>();
  36.     // Remove if unable to run/////////////
  37.     Page *appPage = qml->createRootObject<Page>();
  38.     ///////////////////////////////////////
  39.     // set created root object as a scene
  40.     fprintf(stderr, "Before setting scene");
  41.     app->setScene(appPage);
  42.     fprintf(stderr, "After setting scene");
  43.  
  44.     // Remove if unable to run/////////////
  45.     Camera *camera = appPage->findChild<Camera*>("myCamera");
  46.     fprintf(stderr, "\n Camera variable: %s", camera->isCameraAccessible(CameraUnit::Front)); // This doesn't print to console
  47.     camera->open(CameraUnit::Front);
  48.     fprintf(stderr, "Gets to the end");
  49.     ///////////////////////////////////////
  50. }
clone this paste RAW Paste Data