main.cpp Example File
SensorDemo/src/main.cpp
#include "Flashlight.hpp"
#include <bb/cascades/AbstractPane>
#include <bb/cascades/Application>
#include <bb/cascades/QmlDocument>
#include <bb/device/VibrationController>
#include <QLocale>
#include <QTranslator>
using namespace bb::cascades;
using namespace bb::device;
Q_DECL_EXPORT int main(int argc, char **argv)
{
Application app(argc, argv);
qmlRegisterType<VibrationController>("bb.vibrationController", 1, 0, "VibrationController");
qmlRegisterType<Flashlight>("Flashlight", 1, 0, "Flashlight");
QTranslator translator;
const QString locale_string = QLocale().name();
const QString filename = QString::fromLatin1("SensorDemo_%1").arg(locale_string);
if (translator.load(filename, "app/native/qm")) {
app.installTranslator(&translator);
}
QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(&app);
AbstractPane *root = qml->createRootObject<AbstractPane>();
app.setScene(root);
return Application::exec();
}