ApplicationUI::ApplicationUI(bb::cascades::Application *app) :
		QObject(app) {
	// 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);

	// Expose this class to QML such that our Q_INVOKABLE methods defined in applicationui.hpp
	// can be called from our QML classes.
	qml->setContextProperty("cpp", this);

	// create root object for the UI
	AbstractPane *root = qml->createRootObject<AbstractPane>();
	// set created root object as a scene
	app->setScene(root);

	// The code from here down to "void ApplicationUI::logEvent" is used to determine the device
	// location and log the result to the Flurry server. Any errors in the process will also be
	// logged
	QGeoPositionInfoSource *source =
			QGeoPositionInfoSource::createDefaultSource(this);

	if (source) {
		bool positionUpdatedConnected = connect(source,
				SIGNAL(positionUpdated (const QGeoPositionInfo &)), this,
				SLOT(positionUpdated (const QGeoPositionInfo &)));

		if (positionUpdatedConnected) {
			source->requestUpdate();
		} else {
			qDebug() << "positionUpdated connection failed";
			Flurry::Analytics::LogError("positionUpdated connection failed");
		}
	} else {
StampCollectorApp::StampCollectorApp()
{
    // The entire UI is a drill down list, which means that when an item is selected
    // a navigation takes place to a Content View with a large stamp image and a descriptive text.
    // The main.qml contain the navigation pane and the first page (the list).
    QmlDocument *qml = QmlDocument::create().load("main.qml");
    qml->setParent(this);
    mNav = qml->createRootNode<NavigationPane>();

    // We get the ListView from QML, so that we can connect to the selctionChange signal and set
    // up a DataModel for JSON data.
    ListView *stampList = mNav->findChild<ListView*>("stampList");
    setUpStampListModel(stampList);
    QObject::connect(stampList, SIGNAL(selectionChanged(const QVariantList, bool)), this,
            SLOT(onSelectionChanged(const QVariantList, bool)));

    // The second page, with a detailed description and large stamp image is set up in QML
    // Navigation to this page is handled in the onSelectionChanged Slot function.
    QmlDocument *contentQml = QmlDocument::create().load("ContentPage.qml");
    contentQml->setParent(this);
    mQmlContext = contentQml->documentContext();

    // Set up a context property to the navigation pane so that it is possible to navigate back to the list
    // and create the content page.
    mQmlContext->setContextProperty("_nav", mNav);
    mContentPage = contentQml->createRootNode<Page>();

    // Create the application scene and we are done.
    Application::setScene(mNav);
}
ApplicationUI::ApplicationUI(bb::cascades::Application *app)
	: QObject(app)
{
	ThemeSupport* themeSupport = app->themeSupport();
	Theme* currentTheme = themeSupport->theme();
	ColorTheme* colorTheme = currentTheme->colorTheme();
	VisualStyle::Type style = colorTheme->style();
	switch (style)
	{
	case VisualStyle::Bright:
		m_theme = Bright;
		break;
	case VisualStyle::Dark:
		m_theme = Dark;
		break;
	}
    // 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("_native", this);

    // create root object for the UI
    AbstractPane *root = qml->createRootObject<AbstractPane>();
    // set created root object as a scene
    app->setScene(root);
}
HelloForeignWindowApp::HelloForeignWindowApp()
{
    mTvOn = false;
    mTvInitialized = false;

    // Here we create a QMLDocument and load the main UI QML file.
    QmlDocument *qml = QmlDocument::create().load("helloforeignwindow.qml");

    if (!qml->hasErrors()) {

        // Set a context property for the QML to the application object, so that we
        // can call invokable functions in the app from QML.
        qml->setContextProperty("foreignWindowApp", this);

        // The application Page is created from QML.
        mAppPage = qml->createRootNode<Page>();

        if (mAppPage) {

            Application::setScene(mAppPage);

            // Start the thread in which we render to the custom window.
            start();
        }
    }
}
Beispiel #5
0
//! [0]
App::App(QObject *parent)
    : QObject(parent)
    , m_targetType(0)
    , m_action(QLatin1String("bb.action.OPEN"))
    , m_mimeType(QLatin1String("image/png"))
    , m_model(new GroupDataModel(this))
    , m_invokeManager(new InvokeManager(this))
    , m_dialog(new SystemDialog(this))
{
    // Disable item grouping in the targets result list
    m_model->setGrouping(ItemGrouping::None);

    // Create signal/slot connections to handle card status changes
    bool ok = connect(m_invokeManager,
                      SIGNAL(childCardDone(const bb::system::CardDoneMessage&)), this,
                      SLOT(childCardDone(const bb::system::CardDoneMessage&)));
    Q_ASSERT(ok);
    ok = connect(m_invokeManager, SIGNAL(peekStarted(bb::system::CardPeek::Type)),
                 this, SLOT(peekStarted(bb::system::CardPeek::Type)));
    Q_ASSERT(ok);
    ok = connect(m_invokeManager, SIGNAL(peekEnded()), this, SLOT(peekEnded()));
    Q_ASSERT(ok);

    // Load the UI from the QML file
    QmlDocument *qml = QmlDocument::create("asset:///main.qml");
    qml->setContextProperty("_app", this);

    AbstractPane *root = qml->createRootObject<AbstractPane>();
    Application::instance()->setScene(root);
}
ApplicationUI::ApplicationUI(bb::cascades::Application *app) :
        				QObject(app)
{
	// prepare the localization
	m_pTranslator = new QTranslator(this);
	m_pLocaleHandler = new LocaleHandler(this);
	if(!QObject::connect(m_pLocaleHandler, SIGNAL(systemLanguageChanged()), this, SLOT(onSystemLanguageChanged()))) {
		// This is an abnormal situation! Something went wrong!
		// Add own code to recover here
		qWarning() << "Recovering from a failed connect()";
	}
	// initial load
	onSystemLanguageChanged();

	// Create scene document from main.qml asset, the parent is set
	// to ensure the document gets destroyed properly at shut down.
	QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);

	qml->setContextProperty("app", this);

	// Create root object for the UI
	AbstractPane *root = qml->createRootObject<AbstractPane>();

	// Set created root object as the application scene
	app->setScene(root);

	// set status message of the button
	//this->setStatus(QString("Next bus information here"));

	//set a value of a component in QML from CPP
	//root->setProperty("tempText", "Hello World...");

}
ApplicationUI::ApplicationUI(bb::cascades::Application *app) :
        QObject(app)
{
    // prepare the localization
    m_pTranslator = new QTranslator(this);
    m_pLocaleHandler = new LocaleHandler(this);

    qmlRegisterType< MyModel >("MyModel", 1, 0, "MyModel");

    bool res = QObject::connect(m_pLocaleHandler, SIGNAL(systemLanguageChanged()), this, SLOT(onSystemLanguageChanged()));
    // This is only available in Debug builds
    Q_ASSERT(res);
    // Since the variable is not used in the app, this is added to avoid a
    // compiler warning
    Q_UNUSED(res);

    // initial load
    onSystemLanguageChanged();

    // Create scene document from main.qml asset, the parent is set
    // to ensure the document gets destroyed properly at shut down.
    QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
    qml->setContextProperty("Application", this);

    // Create root object for the UI
    AbstractPane *root = qml->createRootObject<AbstractPane>();

    // Set created root object as the application scene
    app->setScene(root);
}
Beispiel #8
0
//! [0]
App::App(QObject *parent)
    : QObject(parent)
    , m_invokeManager(new InvokeManager(this))
    , m_backButtonVisible(false)
{
    // Listen to incoming invocation requests
    connect(m_invokeManager, SIGNAL(invoked(const bb::system::InvokeRequest&)), this, SLOT(handleInvoke(const bb::system::InvokeRequest&)));
    connect(m_invokeManager, SIGNAL(cardResizeRequested(const bb::system::CardResizeMessage&)), this, SLOT(resized(const bb::system::CardResizeMessage&)));
    connect(m_invokeManager, SIGNAL(cardPooled(const bb::system::CardDoneMessage&)), this, SLOT(pooled(const bb::system::CardDoneMessage&)));

    // Initialize properties with default values
    switch (m_invokeManager->startupMode()) {
        case ApplicationStartupMode::LaunchApplication:
            m_startupMode = tr("Launch");
            break;
        case ApplicationStartupMode::InvokeApplication:
            m_startupMode = tr("Invoke");
            break;
        case ApplicationStartupMode::InvokeCard:
            m_startupMode = tr("Card");
            break;
    }

    m_source = m_target = m_action = m_mimeType = m_uri = m_data = m_status = tr("--");
    m_title = tr("InvokeClient");

    // Create the UI
    QmlDocument *qml = QmlDocument::create("asset:///main.qml");
    qml->setContextProperty("_app", this);
    AbstractPane *root = qml->createRootObject<AbstractPane>();
    Application::instance()->setScene(root);
}
ApplicationUI::ApplicationUI() :
        QObject(),
        m_translator(new QTranslator(this)),
        m_localeHandler(new LocaleHandler(this)),
        m_invokeManager(new InvokeManager(this))
{
    // prepare the localization
    if (!QObject::connect(m_localeHandler, SIGNAL(systemLanguageChanged()),
            this, SLOT(onSystemLanguageChanged()))) {
        // This is an abnormal situation! Something went wrong!
        // Add own code to recover here
        qWarning() << "Recovering from a failed connect()";
    }

    // initial load
    onSystemLanguageChanged();

    // Create scene document from main.qml asset, the parent is set
    // to ensure the document gets destroyed properly at shut down.
    QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);

    // Make app available to the qml.
    qml->setContextProperty("app", this);

    // Create root object for the UI
    AbstractPane *root = qml->createRootObject<AbstractPane>();

    // Set created root object as the application scene
    Application::instance()->setScene(root);
}
void WeatherGuesserApp::createCitiesPage()
{
    QmlDocument *qml = QmlDocument::create().load("ContinentCitiesPage.qml");

    if (!qml->hasErrors()) {

        mContinentCitiesPage = qml->createRootNode<Page>();

        if (mContinentCitiesPage) {

            // Set up a cities model for the page, this model will load different cities depending
            // on which continent is selected.
            ListView *citiesList = mContinentCitiesPage->findChild<ListView*>("citiesList");
            CityModel *cityModel = new CityModel(QStringList() << "name", "continents_connection",
                    this);
            citiesList->setDataModel(cityModel);

            // Connect to the continents page custom signal.
            Page *continents = mNavigation->findChild<Page*>("continents");
            connect(continents, SIGNAL(showContinentCities(QString)), cityModel,
                    SLOT(onChangeContinent(QString)));

            qml->documentContext()->setContextProperty("_navigation", mNavigation);
        }
    }
}
void WeatherGuesserApp::createWeatherPage()
{
    QmlDocument *qml = QmlDocument::create().load("WeatherPage.qml");

    if (!qml->hasErrors()) {

        mWeatherPage = qml->createRootNode<Page>();

        if (mWeatherPage) {

            // Set up a weather model the list, the model will load weather data
            ListView *weatherList = mWeatherPage->findChild<ListView*>("weatherList");
            WeatherModel *weatherModel = new WeatherModel(this);
            weatherList->setDataModel(weatherModel);

            // Connect the weather model to page signals that updates city for which model should be shown.
            connect(mContinentCitiesPage, SIGNAL(showWeather(QString)), weatherModel,
                    SLOT(onUpdateWeatherCity(QString)));

            Page *favorites = mNavigation->findChild<Page*>("favorites");
            connect(favorites, SIGNAL(showWeather(QString)), weatherModel,
                    SLOT(onUpdateWeatherCity(QString)));

            qml->documentContext()->setContextProperty("_navigation", mNavigation);
        }
    }
}
Beispiel #12
0
millionSec::millionSec()
{
    // Obtain a QMLDocument and load it into the qml variable, using build patterns.
    QmlDocument *qml = QmlDocument::create("asset:///second.qml");
    qml->setParent(this);
    NavigationPane *nav = qml->createRootObject<NavigationPane>();

    // If the QML document is valid, we process it.
    if (!qml->hasErrors()) {

        // Create the application Page from QMLDocument.
        //Page *appPage = qml->createRootObject<Page>();

        if (nav) {
            // Set the main scene for the application to the Page.
            Application::instance()->setScene(nav);
            DropDown *day = DropDown::create();
            int date = day->selectedIndex();

            DropDown *month = DropDown::create();
            month->add(Option::create().text("Jan"));
            month->add(Option::create().text("Feb"));
        }
    }
}
Q_DECL_EXPORT int main(int argc, char **argv)
{
//! [0]
    // Register our custom types with QML, so that they can be used as property types
    qmlRegisterUncreatableType<EventEditor>("com.example.bb10samples.pim.calendar", 1, 0, "EventEditor", "Usage as property type and access to enums");
    qmlRegisterType<EventViewer>();
//! [0]

    Application app(argc, argv);

    // localization support
    QTranslator translator;
    const QString locale_string = QLocale().name();
    const QString filename = QString::fromLatin1("calendar_%1").arg(locale_string);
    if (translator.load(filename, "app/native/qm")) {
        app.installTranslator(&translator);
    }

//! [1]
    // Load the UI description from main.qml
    QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(&app);

    // Make the Calendar object available to the UI as context property
    qml->setContextProperty("_calendar", new Calendar(&app));
//! [1]

    // Create the application scene
    AbstractPane *appPage = qml->createRootObject<AbstractPane>();
    Application::instance()->setScene(appPage);

    return Application::exec();
}
ApplicationUI::ApplicationUI(bb::cascades::Application *app) : QObject(app)
{
    qRegisterMetaType<GroupDataModel*>("GroupDataModel*");

    qmlRegisterType<ViewState>("enums", 1, 0, "ViewState");

    TicTacService *service = new TicTacService(this);
    service->connectToHost(QHostAddress("192.168.0.247"), 1337);

    LoginViewModel* loginVM = new LoginViewModel(service, this);
    MainViewModel* mainVM = new MainViewModel(service, this);

    // prepare the localization
    m_pTranslator = new QTranslator(this);
    m_pLocaleHandler = new LocaleHandler(this);
    if(!QObject::connect(m_pLocaleHandler, SIGNAL(systemLanguageChanged()), this, SLOT(onSystemLanguageChanged()))) {
        // This is an abnormal situation! Something went wrong!
        // Add own code to recover here
        qWarning() << "Recovering from a failed connect()";
    }
    // initial load
    onSystemLanguageChanged();

    // Create scene document from main.qml asset, the parent is set
    // to ensure the document gets destroyed properly at shut down.
    QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
    qml->setContextProperty("mainVM", mainVM);
    qml->setContextProperty("loginVM", loginVM);

    // Create root object for the UI
    AbstractPane *root = qml->createRootObject<AbstractPane>();

    // Set created root object as the application scene
    app->setScene(root);
}
Beispiel #15
0
KakelApp::KakelApp()
{

  // Create and Load the QMLDocument, using build patterns.
  QmlDocument *qml = QmlDocument::create("asset:///main.qml");

  if (!qml->hasErrors()) {

    setNumMoves(0);
    mNumTiles = 4;

    // Set the context property we want to use from inside the QML file. Functions exposed
    // via Q_INVOKABLE will be found with the property and the name of the function.
    qml->setContextProperty("kakel", this);

    // The application Page is created from the QML file.
    mAppPage = qml->createRootObject<Page>();

    findPlayAreaAndInitialize(mAppPage);

    if (mAppPage) {
      // Finally the main scene for the application is set to the Page.
      Application::instance()->setScene(mAppPage);
    }
  }
}
ApplicationHeadless::ApplicationHeadless(bb::cascades::Application *app)
    : QObject(app)
    , m_remainingFlashCount(-1)
{
    // prepare the localization
    m_pTranslator = new QTranslator(this);
    m_pLocaleHandler = new LocaleHandler(this);

    QSettings settings(m_author, m_appName);
    // Force the creation of the settings file so that we can watch it for changes.
    settings.sync();
    // Watcher for changes in the settings file.
    settingsWatcher = new QFileSystemWatcher(this);
    settingsWatcher->addPath(settings.fileName());
    connect(settingsWatcher, SIGNAL(fileChanged(const QString&)), this, SLOT(settingsChanged(const QString&)));

    // initial load
    // Create scene document from main.qml asset, the parent is set
    // to ensure the document gets destroyed properly at shut down.
    QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
    // expose this class to the qml context so that we can query it for the necessary values
    // via properties, slots or invokable methods
    qml->setContextProperty("_app", this);
    // Create root object for the UI
    AbstractPane *root = qml->createRootObject<AbstractPane>();

    // Set created root object as the application scene
    app->setScene(root);
}
Beispiel #17
0
RocknRoll::RocknRoll(bb::cascades::Application *app)
: QObject(app)
{
    // 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);

    AlbumsDataModel *p1DataModel = new AlbumsDataModel(this);
    SongsDataModel *p2DataModel = new SongsDataModel(this);
    qml->setContextProperty("_model1", p1DataModel);
    qml->setContextProperty("_model2", p2DataModel);

    qmlRegisterType<QTimer>("QTimer", 1, 0, "QTimer");
    qmlRegisterType<SceneCover>("bb.cascades", 1, 0, "SceneCover");
    qmlRegisterUncreatableType<AbstractCover>("bb.cascades", 1, 0, "AbstractCover", "An AbstractCover cannot be created.");

    // create root object for the UI
    AbstractPane *root = qml->createRootObject<AbstractPane>();

    // set created root object as a scene
    app->setScene(root);

    startNetworkManager();
    //parseJSON();
}
WeatherGuesserApp::WeatherGuesserApp()
{
    // Register QML types, so they can be used in QML.
    qmlRegisterType<SqlHeaderDataQueryEx>("bb.cascades.datamanager", 1, 2, "SqlHeaderDataQueryEx");
    qmlRegisterType<PullToRefresh>("com.weather", 1, 0, "PullToRefresh");
    qmlRegisterType<CityDataSource>("com.weather", 1, 0, "CityDataSource");
    qmlRegisterType<LoadModelDecorator>("com.weather", 1, 0, "LoadModelDecorator");
    qmlRegisterType<WeatherDataSource>("com.weather", 1, 0, "WeatherDataSource");
    qmlRegisterUncreatableType<WeatherError>("com.weather", 1, 0, "WeatherError", "Uncreatable type");

    // Prepare localization. Connect to the LocaleHandlers systemLanguaged change signal, this will
    // tell the application when it is time to load a new set of language strings.
    mTranslator = new QTranslator(this);
    mLocaleHandler = new LocaleHandler(this);
    onSystemLanguageChanged();
    bool connectResult = connect(mLocaleHandler, SIGNAL(systemLanguageChanged()), SLOT(onSystemLanguageChanged()));
    Q_ASSERT(connectResult);
    Q_UNUSED(connectResult);

    // Create a QMLDocument and load it, using build patterns.
    QmlDocument *qmlDocument = QmlDocument::create("asset:///main.qml").parent(this);

    if (!qmlDocument->hasErrors()) {
        // Make the settings object available to QML
        qmlDocument->setContextProperty("_appSettings", new AppSettings(this));

        // The application navigationPane is created from QML.
        AbstractPane *appPane = qmlDocument->createRootObject<AbstractPane>();

        if (appPane) {
            // Set the main application scene to NavigationPane.
            Application::instance()->setScene(appPane);
        }
    }
}
Q_DECL_EXPORT int main(int argc, char **argv)
{
    Application app(argc, argv);

    // localization support
    QTranslator translator;
    QString locale_string = QLocale().name();
    QString filename = QString( "dictaphone_%1" ).arg( locale_string );
    if (translator.load(filename, "app/native/qm")) {
        app.installTranslator( &translator );
    }

//! [0]
    // Load the UI description from main.qml
    QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(&app);

    // Make the TrackManager object available to the UI as context property
    qml->setContextProperty("_trackManager", new TrackManager(&app));
//! [0]

    // Create the application scene
    AbstractPane *appPage = qml->createRootObject<AbstractPane>();
    Application::instance()->setScene(appPage);

    return Application::exec();
}
Beispiel #20
0
int main(int argc, char **argv)
{
    // We need to register the QML types in the multimedia-library,
    // otherwise we will get an error from the QML.
    qmlRegisterType<bb::community::barcode::BarcodeDecoderControl>(
            "bb.community.barcode", 1, 0, "BarcodeDecoder");

    //-- this is where the server is started etc
    Application app(argc, argv);

    //-- localization support
    QTranslator translator;
    const QString filename = QString("barcodescanner_%1").arg(QLocale().name());
    if (translator.load(filename, "app/native/qm")) {
        app.installTranslator(&translator);
    }

    BarcodeScannerApp* barcodeScanner = new BarcodeScannerApp(&app);

    QmlDocument *qml = QmlDocument::create("asset:///main.qml");

    // expose BarcodeScannerApp object in QML as an variable
    qml->setContextProperty("_barcodeScanner", barcodeScanner);
    AbstractPane *root = qml->createRootObject<AbstractPane>();

    Application::instance()->setScene(root);

    return Application::exec();
}
ApplicationUI::ApplicationUI() :
        QObject(),
        m_settings(new QSettings(this))
{
    m_pTranslator = new QTranslator(this);
    m_pLocaleHandler = new LocaleHandler(this);

    bool res = QObject::connect(m_pLocaleHandler, SIGNAL(systemLanguageChanged()), this, SLOT(onSystemLanguageChanged()));
    Q_ASSERT(res);
    Q_UNUSED(res);

    onSystemLanguageChanged();

    QmlDocument *qml = QmlDocument::create("asset:///Main.qml").parent(this);
    qml->setContextProperty("_app", this);
    qml->setContextProperty("_notes", new Notes(this));

    DisplayInfo display;
    int width = display.pixelSize().width();
    int height = display.pixelSize().height();

    QDeclarativePropertyMap* displayProperties = new QDeclarativePropertyMap;
    displayProperties->insert("width", QVariant(width));
    displayProperties->insert("height", QVariant(height));

    qml->setContextProperty("DisplayInfo", displayProperties);

    AbstractPane *root = qml->createRootObject<AbstractPane>();
    Application::instance()->setScene(root);
}
Beispiel #22
0
ApplicationUI::ApplicationUI(bb::cascades::Application *app)
: QObject(app)
, m_model(new FileDataListModel(false, this))
{
	QThreadPool::globalInstance ()->setMaxThreadCount(BBFM_THREAD_POOL_SIZE);

    // Load file icons
    FileDataIcon::loadIcons();

    // prepare the localization
    m_pTranslator = new QTranslator(this);
    m_pLocaleHandler = new LocaleHandler(this);
    if(!QObject::connect(m_pLocaleHandler, SIGNAL(systemLanguageChanged()), this, SLOT(onSystemLanguageChanged()))) {
        // This is an abnormal situation! Something went wrong!
        // Add own code to recover here
        qWarning() << "Recovering from a failed connect()";
    }
    // initial load
    onSystemLanguageChanged();

    // Create scene document from main.qml asset, the parent is set
    // to ensure the document gets destroyed properly at shut down.
    QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
    qml->setContextProperty("_app", this);

    // Create root object for the UI
    AbstractPane *root = qml->createRootObject<AbstractPane>();

    // Set created root object as the application scene
    app->setScene(root);
}
ApplicationUI::ApplicationUI(bb::cascades::Application *app) :
        QObject(app)
{
    // prepare the localization
    m_pTranslator = new QTranslator(this);
    m_pLocaleHandler = new LocaleHandler(this);
    if (!QObject::connect(m_pLocaleHandler, SIGNAL(systemLanguageChanged()), this, SLOT(onSystemLanguageChanged()))) {
        // This is an abnormal situation! Something went wrong!
        // Add own code to recover here
        qWarning() << "Recovering from a failed connect()";
    }
    // initial load
    onSystemLanguageChanged();

    // Create scene document from main.qml asset, the parent is set
    // to ensure the document gets destroyed properly at shut down.
    QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);

    // Create root object for the UI
    _root = qml->createRootObject<AbstractPane>();

    // expose this object to QML
    qml->setContextProperty("ame", this);

    // Set created root object as the application scene
    app->setScene(_root);
}
ApplicationUI::ApplicationUI() :
        QObject()
{
    // prepare the localization
    m_pTranslator = new QTranslator(this);
    m_pLocaleHandler = new LocaleHandler(this);

    bool res = QObject::connect(m_pLocaleHandler, SIGNAL(systemLanguageChanged()), this, SLOT(onSystemLanguageChanged()));
    // This is only available in Debug builds
    Q_ASSERT(res);
    // Since the variable is not used in the app, this is added to avoid a
    // compiler warning
    Q_UNUSED(res);

    // initial load
    onSystemLanguageChanged();

    // Create scene document from main.qml asset, the parent is set
    // to ensure the document gets destroyed properly at shut down.
    QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);

    // Make the PizzeriaSearcher object available to the UI as context property
    qml->setContextProperty("_pizzeriaSearcher", new PizzeriaSearcher(this));

    // Create root object for the UI
    AbstractPane *root = qml->createRootObject<AbstractPane>();

    if(root) {
        // Set created root object as the application scene
        Application::instance()->setScene(root);
    }
}
ApplicationUI::ApplicationUI() :
        QObject()
{
    // prepare the localization
    m_pTranslator = new QTranslator(this);
    m_pLocaleHandler = new LocaleHandler(this);

    bool res = QObject::connect(m_pLocaleHandler, SIGNAL(systemLanguageChanged()), this, SLOT(onSystemLanguageChanged()));
    // This is only available in Debug builds
    Q_ASSERT(res);
    // Since the variable is not used in the app, this is added to avoid a
    // compiler warning
    Q_UNUSED(res);

    // initial load
    onSystemLanguageChanged();

    // Create scene document from main.qml asset, the parent is set
    // to ensure the document gets destroyed properly at shut down.
    QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
    qml->setContextProperty("_app", this);

    // Create root object for the UI
    AbstractPane *root = qml->createRootObject<AbstractPane>();

    // Set created root object as the application scene
    Application::instance()->setScene(root);

    // Creates the MessageService object
    m_messageService = new bb::pim::message::MessageService(this);
    // Connect to the messageAdded signal
    connect(m_messageService, SIGNAL(messageAdded(bb::pim::account::AccountKey, bb::pim::message::ConversationKey, bb::pim::message::MessageKey)), SLOT(onMessageAdded(bb::pim::account::AccountKey, bb::pim::message::ConversationKey, bb::pim::message::MessageKey)));
    connect(m_messageService, SIGNAL(messageUpdated(bb::pim::account::AccountKey, bb::pim::message::ConversationKey, bb::pim::message::MessageKey, bb::pim::message::MessageUpdate)), SLOT(onMessageUpdated(bb::pim::account::AccountKey, bb::pim::message::ConversationKey, bb::pim::message::MessageKey, bb::pim::message::MessageUpdate)));
}
MalcomLibBb10::MalcomLibBb10(bb::cascades::Application *app)
: QObject(app)
{
    // 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);

    connect(app, SIGNAL(fullscreen()), this, SLOT(onFullscreen()));
    connect(app, SIGNAL(thumbnail()), this, SLOT(onThumbnail()));

    root = qml->createRootObject<AbstractPane>();

    MalcomLib::Instance() -> initMalcom(uuidMalcom, secretKeyMalcom);

    QVariantList tags;
    tags << "tag1" << "tag2" << "tag3" << "tag4";

    MalcomLib::Instance() -> setTags(tags);

    QDeclarativePropertyMap malcom;
    malcom.insert("uuid", uuidMalcom);
    malcom.insert("secretKey", secretKeyMalcom);

    qml->setContextProperty("malcom", &malcom);

    // create root object for the UI
    AbstractPane *root = qml->createRootObject<AbstractPane>();
    // set created root object as a scene
    app->setScene(root);
}
Beispiel #27
0
RegistrationHandler::RegistrationHandler(const QUuid &uuid, QObject *parent)
    : QObject(parent)
    , m_context(uuid)
    , m_isAllowed(false)
    , m_progress(BbmRegistrationProgress::NotStarted)
    , m_temporaryError(false)
    , m_statusMessage(tr("Please wait while the application connects to BBM."))
{
    QmlDocument* qml = QmlDocument::create("asset:///registration.qml")
                       .parent(this);
    qml->setContextProperty("_registrationHandler", this);
    AbstractPane *root = qml->createRootObject<AbstractPane>();

    if (uuid.isNull()) {
    	SystemDialog *uuidDialog = new SystemDialog("OK");
    	uuidDialog->setTitle("UUID Error");
        uuidDialog->setBody("Invalid/Empty UUID, please set correctly in main.cpp");
        connect(uuidDialog, SIGNAL(finished(bb::system::SystemUiResult::Type)), this, SLOT(dialogFinished(bb::system::SystemUiResult::Type)));
        uuidDialog->show();
        return;
    }
    connect(&m_context,
            SIGNAL(registrationStateUpdated(
                   bb::platform::bbm::RegistrationState::Type)),
            this,
            SLOT(processRegistrationStatus(
                 bb::platform::bbm::RegistrationState::Type)));

    if (m_context.isAccessAllowed()){ // jika sudah teregister langsung ke main app
    	qDebug() << "access allowed";
    	finishRegistration();
    }else{ // jika belum, tampilkan halaman registrasi ini.
        Application::instance()->setScene(root);
    }
}
HelloForeignWindowApp::HelloForeignWindowApp()
{
    mTvOn = false;
    mTvInitialized = false;

    // Create a QML document and load the main UI QML file, using build patterns.
    QmlDocument *qml = QmlDocument::create("asset:///helloforeignwindow.qml");

    if (!qml->hasErrors()) {

        // Set the context property we want to use from inside the QML document. Functions exposed
        // via Q_INVOKABLE will be found with this property and the name of the function.
        qml->setContextProperty("foreignWindowApp", this);

        // The application Page is created from QML.
        mAppPage = qml->createRootObject<Page>();

        if (mAppPage) {

            Application::instance()->setScene(mAppPage);

            // Initialize the foreign window.
            initForeignWindow();

            // Start the thread in which we render to the custom window.
            start();
        }
    }
}
ApplicationUI::ApplicationUI()
    : QObject(), world(), carrier(), search(), scanner()
{
    // prepare the localization
    m_pTranslator = new QTranslator(this);
    m_pLocaleHandler = new LocaleHandler(this);

    QObject::connect(m_pLocaleHandler, SIGNAL(systemLanguageChanged()), this, SLOT(onSystemLanguageChanged()));

    qmlRegisterType<CodePickerProvider>("custom.pickers", 1, 0, "CodePickerProvider");
    qmlRegisterType<OSPickerProvider>("custom.pickers", 1, 0, "OSPickerProvider");

    // initial load
    onSystemLanguageChanged();

    // Create scene document from main.qml asset, the parent is set
    // to ensure the document gets destroyed properly at shut down.
    qmlRegisterType<AppWorldApps>();
    qmlRegisterType<DiscoveredRelease>();
    qmlRegisterType<UpdateBundles>();
    qmlRegisterType<WebImageView>("org.labsquare", 1, 0, "WebImageView");
    QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
    qml->setContextProperty("world", &world);
    qml->setContextProperty("carrier", &carrier);
    qml->setContextProperty("search", &search);
    qml->setContextProperty("scanner", &scanner);

    // Create root object for the UI
    AbstractPane *root = qml->createRootObject<AbstractPane>();

    // Set created root object as the application scene
    Application::instance()->setScene(root);
}
ApplicationUI::ApplicationUI(bb::cascades::Application *app) :
		QObject(app) {
	QSettings settings;

	char montreal[] = "Montr\xc3\xa9" "al";

	_plainText = settings.value("plainText",
			QString::fromUtf8(montreal, strlen(montreal))).toString();
	_key = settings.value("key", generate()).toString();
	_iv = settings.value("iv", generate()).toString();
	_cipherText = settings.value("cipherText", "").toString();
	_recoveredPlainText = settings.value("recoveredPlainText", "").toString();

	// Create scene document from main.qml asset, the parent is set
	// to ensure the document gets destroyed properly at shut down.
	QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);

	qml->setContextProperty("app", this);

	// Create root object for the UI
	AbstractPane *root = qml->createRootObject<AbstractPane>();

	// Set created root object as the application scene
	app->setScene(root);

	if (!isCryptoAvailable()) {
		toast("Need to double check our code - crypto isn't available...");
	}
}