main.cpp Example File
nfcshare/src/main.cpp
#include "NfcShareHandler.hpp"
#include <bb/cascades/AbstractPane>
#include <bb/cascades/Application>
#include <bb/cascades/QmlDocument>
#include <bb/cascades/pickers/FilePicker>
#include <bb/cascades/pickers/FileType>
#include <QLocale>
#include <QTranslator>
using namespace bb::cascades;
Q_DECL_EXPORT int main(int argc, char **argv)
{
Application app(argc, argv);
QTranslator translator;
const QString locale_string = QLocale().name();
const QString filename = QString::fromLatin1("nfcsharehandler_%1").arg(locale_string);
if (translator.load(filename, "app/native/qm")) {
app.installTranslator(&translator);
}
qmlRegisterUncreatableType<NfcShareHandler>("custom", 1, 0, "NfcShareHandler", "Access to enums");
qmlRegisterType<bb::cascades::pickers::FilePicker>("custom", 1, 0, "FilePicker");
qmlRegisterUncreatableType<bb::cascades::pickers::FileType>("custom", 1, 0, "FileType", "Access to enums");
qmlRegisterType<FileListModel>();
NfcShareHandler nfcShareHandler;
QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(&app);
qml->setContextProperty("_nfcShareHandler", &nfcShareHandler);
AbstractPane *root = qml->createRootObject<AbstractPane>();
Application::instance()->setScene(root);
return Application::exec();
}