Example #1
0
Q_DECL_EXPORT int main(int argc, char *argv[])
{
    QScopedPointer<QApplication> app(createApplication(argc, argv));

    QmlApplicationViewer viewer;
    viewer.addImportPath(QLatin1String("modules"));
    viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
    viewer.setMainQmlFile(QLatin1String("qml/example/main.qml"));
    viewer.showExpanded();

    return app->exec();
}
Example #2
0
Q_DECL_EXPORT int main(int argc, char *argv[])
{
    QScopedPointer<QApplication> app(createApplication(argc, argv));

    QmlApplicationViewer viewer;
    viewer.addImportPath(QLatin1String("modules"));
    viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
    viewer.setMainQmlFile(QLatin1String("../../KANR/qml/KANR/main.qml"));
    viewer.showExpanded();

    Manager manager(new Sinus(), viewer.rootObject());

    return app->exec();
}
Example #3
0
int main(int argc, char *argv[]) {
    QScopedPointer<QApplication> app(createApplication(argc, argv));

    qmlRegisterType<TileData>();
    Core* game = new Core;
    QmlApplicationViewer viewer;
    viewer.engine()->rootContext()->setContextObject(game);
    viewer.engine()->rootContext()->setContextProperty("core", game);
    viewer.addImportPath(QLatin1String("modules")); // ADDIMPORTPATH
    viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockPortrait); // ORIENTATION
    viewer.setMainQmlFile(QLatin1String("qml/main.qml")); // MAINQML
    viewer.showExpanded();

    return app->exec();
}
Example #4
0
Q_DECL_EXPORT int main(int argc, char *argv[])
{
    QScopedPointer<QApplication> app(createApplication(argc, argv));

    QmlApplicationViewer viewer;
    viewer.addImportPath(QLatin1String("imports"));
    viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockPortrait);
#ifdef Q_OS_BLACKBERRY
    Scoreloop scoreloop;
    viewer.rootContext()->setContextProperty("scoreloop", &scoreloop);
#endif
    viewer.setSource(QUrl("qrc:/qml/game/main.qml"));
    viewer.showExpanded();

    return app->exec();
}
Example #5
0
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    bool use_qml;
#ifdef USE_QML
    use_qml = true;
#else 
    use_qml = false;
#endif

    QStringList options = app.arguments();
    if (options.contains("--use-qml"))
        use_qml = true;
    if (options.contains("--dont-use-qml"))
        use_qml = false;

    if (use_qml) {
        qRegisterMetaType<DNSSECTest>("DNSSECTest");
        qmlRegisterType<DNSSECTest, 1>("DNSSECTools", 1, 0, "DNSSECTest");
        qmlRegisterType<TestManager, 1>("DNSSECTools", 1, 0, "TestManager");

        QmlApplicationViewer viewer;
        QDeclarativeContext *context;
        viewer.addImportPath(":/qml");
        viewer.setWindowIcon(QIcon(":/images/dnssec-check-64x64.png"));
        viewer.setWindowTitle("DNSSEC-Check");

        TestManager manager;
        context = viewer.rootContext();
        context->setContextProperty("testManager", &manager);

        #ifdef IS_MEEGO
        viewer.setSource(QUrl("qrc:/qml/MeegoDnssecCheck.qml"));
        #else
        viewer.setSource(QUrl("qrc:/qml/DnssecCheck.qml"));
        #endif


        viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape);
        #ifdef IS_MEEGO
        viewer.showFullScreen();
        #else
        viewer.show();
        #endif

        return app.exec();
    } else { // don't use QML
        MainWindow mainWindow;
        mainWindow.setOrientation(MainWindow::Auto);

        #ifdef Q_OS_SYMBIAN
        mainWindow.showFullScreen();
        #elif defined(Q_WS_MAEMO_5)
        mainWindow.showMaximized();
        #else
        mainWindow.show();
        #endif

        return app.exec();
    }
}
Example #6
0
int main( int argc, char** argv )
{
    // init application
#if defined( QML_UI )
    QScopedPointer<QApplication> app( createApplication( argc, argv ) );
#else
    QScopedPointer<QApplication> app( new QApplication( argc, argv ) );
#endif
    app->setApplicationName( "Housing" );
    app->setApplicationVersion( "1.0.0" );
    app->setOrganizationDomain( "sodream.org" );
    app->setOrganizationName( "SoDream" );
	
#if !( defined( Q_OS_UNIX ) && !defined( Q_OS_MAC ) ) || defined( Q_OS_BLACKBERRY )
	const QStringList themesPaths = QIcon::themeSearchPaths()
#if defined( Q_OS_MACX )
        << QString( "%1/../../../Resources" ).arg( QApplication::applicationDirPath() )
#elif defined( Q_OS_BLACKBERRY )
        << QApplication::applicationDirPath()
#else
        << QApplication::applicationDirPath()
#endif
	;
	
	QIcon::setThemeSearchPaths( themesPaths );
	QIcon::setThemeName( "Oxygen" );
#endif
	
    app->setWindowIcon( QIcon::fromTheme( "go-home" ) );
    
    const QStringList paths = QStringList()
        << QLibraryInfo::location( QLibraryInfo::TranslationsPath )
        << QFileInfo( __FILE__ ).absolutePath().append( "/../translations" )
#if defined( Q_OS_MACX )
        << QString( "%1/../../../translations" ).arg( QApplication::applicationDirPath() )
#else
        << QString( "%1/translations" ).arg( QApplication::applicationDirPath() )
#endif
    ;
    
    pTranslationManager* translationManager = pTranslationManager::instance();
    translationManager->setFakeCLocaleEnabled( true );
	translationManager->addTranslationsMask( "qt*.qm" );
	translationManager->addTranslationsMask( "fresh*.qm" );
	translationManager->addTranslationsMask( "housing*.qm" );
	translationManager->addForbiddenTranslationsMask( "qt_help*.qm" );
	translationManager->setCurrentLocale( QLocale::system().name() );
    translationManager->setTranslationsPaths( paths );
    translationManager->reloadTranslations();
    
    // register drivers
    AbstractHousingDriver::registerDriver( new SeLogerHousingDriver );

    // init main window
#if defined( DESKTOP_UI ) || defined( MOBILE_UI )
    UIMain w;
    w.setWindowTitle( app->applicationName() );
    w.showMaximized();
#elif defined( QML_UI )
    QmlApplicationViewer viewer;
    viewer.addImportPath(fixedPath("modules")); // ADDIMPORTPATH
    viewer.addImportPath("/opt/Qt4.8.4/imports"); // ADDIMPORTPATH
    viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); // ORIENTATION
    viewer.setMainQmlFile(fixedPath("qml/main.qml")); // MAINQML
    viewer.showExpanded();
#endif

    // run application
    QObject::connect( app.data(), SIGNAL( lastWindowClosed() ), app.data(), SLOT( quit() ) );
    return app->exec();
}
Example #7
0
Q_DECL_EXPORT int main(int argc, char *argv[])
{
    QApplication *app = createApplication(argc, argv);
    QmlApplicationViewer viewer;

#if defined(Q_OS_MAEMO)
    QPixmap pixmap("/opt/nelisquare/qml/pics/splash-turned.png");
    QSplashScreen splash(pixmap);
    EventDisabler eventDisabler;
    splash.installEventFilter(&eventDisabler);
    splash.showFullScreen();
#endif

#if defined(Q_OS_MAEMO)
    viewer.addImportPath(QString("/opt/qtm12/imports"));
    viewer.engine()->addImportPath(QString("/opt/qtm12/imports"));
    viewer.engine()->addPluginPath(QString("/opt/qtm12/plugins"));
#endif

    QCoreApplication::addLibraryPath(QString("/opt/nelisquare/plugins"));

    viewer.setAttribute(Qt::WA_OpaquePaintEvent);
    viewer.setAttribute(Qt::WA_NoSystemBackground);
    viewer.viewport()->setAttribute(Qt::WA_OpaquePaintEvent);
    viewer.viewport()->setAttribute(Qt::WA_NoSystemBackground);

    WindowHelper *windowHelper = new WindowHelper(&viewer);
    PictureHelper *pictureHelper = new PictureHelper();
    Cache *cache = new Cache();
    viewer.rootContext()->setContextProperty("windowHelper", windowHelper);
    viewer.rootContext()->setContextProperty("pictureHelper", pictureHelper);
    viewer.rootContext()->setContextProperty("cache", cache);

    Molome *molome = new Molome();
    viewer.rootContext()->setContextProperty("molome", molome);

#if defined(Q_OS_HARMATTAN) || defined(Q_WS_SIMULATOR) || defined(Q_OS_MAEMO)
    PlatformUtils platformUtils(app,cache);
    viewer.rootContext()->setContextProperty("platformUtils", &platformUtils);
#endif

#if defined(Q_OS_MAEMO)
    viewer.installEventFilter(windowHelper);
#elif defined(Q_OS_HARMATTAN)
    viewer.installEventFilter(new EventFilter);
#endif

    viewer.setMainQmlFile(QLatin1String("qml/main.qml"));

    QObject *rootObject = qobject_cast<QObject*>(viewer.rootObject());
#if defined(Q_OS_HARMATTAN) || defined(Q_OS_MAEMO)
    new NelisquareDbus(app, &viewer);
#endif

#if defined(Q_OS_MAEMO)
    viewer.showFullScreen();
#elif defined(Q_OS_HARMATTAN)
    rootObject->connect(molome,SIGNAL(infoUpdated(QVariant,QVariant)),SLOT(onMolomeInfoUpdate(QVariant,QVariant)));
    rootObject->connect(molome,SIGNAL(photoRecieved(QVariant,QVariant)),SLOT(onMolomePhoto(QVariant,QVariant)));
    viewer.showExpanded();
    molome->updateinfo();
#else
    viewer.showExpanded();
#endif
    rootObject->connect(pictureHelper,SIGNAL(pictureUploaded(QVariant, QVariant)),SLOT(onPictureUploaded(QVariant, QVariant)));

#if defined(Q_OS_MAEMO)
    splash.finish(&viewer);
#endif

    return app->exec();
}