예제 #1
0
int main(int argc, char *argv[])
{ 
    QApplication::setGraphicsSystem("raster");
    QApplication a(argc, argv);

    QTextCodec::setCodecForTr(QTextCodec::codecForLocale());

    QString privatePathQt(QApplication::applicationDirPath());
    QString path(privatePathQt);
    path = QDir::toNativeSeparators(path);

    Server server;
    if (!server.listen(QHostAddress::Any, 6177)) {
        std::cerr << "Failed to bind to port" << std::endl;
        return 1;
    }

    QDeclarativeView view;
    view.engine()->setOfflineStoragePath(path);
    QObject::connect((QObject*)view.engine(), SIGNAL(quit()), &a, SLOT(quit()));

    view.setSource(QUrl("qrc:/qml/main.qml"));
    view.show();

    QString md5;
    QString dbname="DemoDB";
    QByteArray ba;
    ba = QCryptographicHash::hash (dbname.toAscii(), QCryptographicHash::Md5);
    md5.append(ba.toHex());
    md5.append(".sqlite");

    path.append(QDir::separator()).append("Databases");
    path.append(QDir::separator()).append(md5);
    QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
    db.setDatabaseName(path);
    if (!db.open()) {
        std::cerr << "Cannot open database" << std::endl;
        return 1;
    }

    OrderManager orderManager;
    view.rootContext()->setContextProperty("server", &server);
    view.rootContext()->setContextProperty("orderManager", &orderManager);

    Client client;
    QObject::connect(&orderManager, SIGNAL(send()), &client, SLOT(sendOrder()));
    QObject::connect(&server, SIGNAL(paied(quint32)), &orderManager, SLOT(payOrder(quint32)));

    DeviceManager deviceManager;
    QObject::connect(&deviceManager, SIGNAL(registerSignal()), &client, SLOT(sendRegistration()));
    view.rootContext()->setContextProperty("deviceManager", &deviceManager);
    deviceManager.registerDevice();

    return a.exec();
}
예제 #2
0
파일: main.cpp 프로젝트: chegestar/butaca
Q_DECL_EXPORT int main(int argc, char *argv[])
{
    QApplication *app;
#ifdef QT_SIMULATOR
    app = new QApplication(argc, argv);
#else
    app = MDeclarativeCache::qApplication(argc, argv);
#endif
    app->setApplicationName("Butaca");
    app->setOrganizationDomain("com.simonpena");
    app->setOrganizationName("simonpena");

    // Assume that strings in source files are UTF-8
    QTextCodec::setCodecForTr(QTextCodec::codecForName("utf8"));

    QString locale(QLocale::system().name());
    QTranslator translator;

    if (translator.load("l10n/butaca." + locale, ":/")) {
        app->installTranslator(&translator);
    } else {
        translator.load("l10n/butaca.en.qm", ":/");
        app->installTranslator(&translator);
    }

    QDeclarativeView *view;
#ifdef QT_SIMULATOR
    view = new QDeclarativeView();
#else
    view = MDeclarativeCache::qDeclarativeView();
#endif

    view->engine()->setOfflineStoragePath(
                QDesktopServices::storageLocation(QDesktopServices::DataLocation));

    QDeclarativeContext *context = view->rootContext();

    // The Movie Database uses "-" as the divider between language and country code
    context->setContextProperty("appLocale", locale.left(locale.indexOf("_")));
    Controller *controller = new Controller(context);

    view->engine()->setNetworkAccessManagerFactory(new CustomNetworkAccessManagerFactory);
    view->setSource(QUrl("qrc:/qml/main.qml"));
    view->showFullScreen();

    int result = app->exec();

    delete controller;
    delete view;
    delete app;

    return result;
}
예제 #3
0
Q_DECL_EXPORT int main(int argc, char *argv[])
{
#ifdef MEEGO_EDITION_HARMATTAN
    QApplication *app = MDeclarativeCache::qApplication(argc, argv);
    QDeclarativeView *view = MDeclarativeCache::qDeclarativeView();
#else
    QApplication *app = new QApplication(argc, argv);
    QDeclarativeView *view = new QDeclarativeView();
    QDeclarativeView *aboutview = new QDeclarativeView();
#endif
#ifdef Q_WS_MAEMO_5
    view->setAttribute(Qt::WA_Maemo5LandscapeOrientation);
    view->setAttribute(Qt::WA_Maemo5NonComposited);
    view->connect(view->engine(), SIGNAL(quit()), SLOT(close()));
#endif

    // For QSettings
    QCoreApplication::setOrganizationName("AnttiPohjola");
    QCoreApplication::setApplicationName("Nine Men's Morris");
/*
#ifndef Q_WS_MAEMO_5
    // Qt 4.7.0 doesn't have qsTrId() support in QML
    GConfClient *gconf = gconf_client_get_default();
    QString locale = gconf_client_get_string(gconf, "/meegotouch/i18n/region", NULL);
    QTranslator translator;
    if (translator.load("qmuehle_" + locale, "/usr/share/l10n/meegotouch"))
        app->installTranslator(&translator);
    else
        qDebug() << "Failed to load translation" <<  ("/usr/share/l10n/meegotouch/qmuehle_" + locale +".qm");
#endif
*/
    // Export the Game and Settings classes through the Muehle 1.0 QML module
    qmlRegisterType<Game>("Muehle", 1, 0, "Game");
    qmlRegisterType<HistoryModel>("Muehle", 1, 0, "HistoryModel");
    qmlRegisterType<Settings>("Muehle", 1, 0, "Settings");

    view->setSource(QUrl("qrc:/qml/main.qml"));
    aboutview->setSource(QUrl("qrc:/qml/AboutPage.qml"));

    ViewController* controller = new ViewController(view, aboutview);

    //"image://myimageprovider/image.png"
    view->engine()->addImageProvider("boardicons", new BoardIconProvider());

    // FIXME - for now, don't show fullscreen if screen height >= 800 or width >= 1024
/*    QRect screenGeometry=QApplication::desktop()->screenGeometry();
    if((screenGeometry.height()<800) && (screenGeometry.width()<1024))
         view->showFullScreen();
    else view->show();
*/
    view->showFullScreen();
    return app->exec();
}
예제 #4
0
int main(int argc, char **argv)
{
    qRegisterMetaType<QVector<QFileInfo> >();
    qmlRegisterType<DirModel>("FBrowser", 1, 0, "DirModel");
    QApplication a(argc, argv);

    QDeclarativeView v;

    QDeclarativeEngine *e = v.engine();
    e->addImageProvider(QLatin1String("nemoThumbnail"), new FileThumbnailImageProvider);

    QDeclarativeContext *c = v.rootContext();
    c->setContextProperty("fileBrowserUtils", new Utils);

    if (QFile::exists("main.qml"))
        v.setSource(QUrl::fromLocalFile("main.qml"));
    else
        v.setSource(QUrl("qrc:/qml/main.qml"));

    if (QCoreApplication::arguments().contains("-fullscreen")) {
        qDebug() << Q_FUNC_INFO << "Starting in fullscreen mode";
        v.showFullScreen();
    } else {
        qDebug() << Q_FUNC_INFO << "Starting in windowed mode";
        v.show();
    }

    return a.exec();
}
예제 #5
0
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QDeclarativeView view;
    QDeclarativeContext *context = view.rootContext();
    context->setContextProperty("backgroundColor",
                                QColor(Qt::yellow));

    KDeclarative kdeclarative;
    kdeclarative.setDeclarativeEngine(view.engine());
    kdeclarative.initialize();
    //binds things like kconfig and icons
    kdeclarative.setupBindings();

    //If all gone well, the QScriptEngine has been extracted
    QScriptEngine *scriptEngine = kdeclarative.scriptEngine();
    Q_ASSERT(scriptEngine);

    //Bind a test QObject in the "QtScript way"
    QScriptValue global = scriptEngine->globalObject();
    TestObject *testObject = new TestObject();
    QScriptValue testValue = scriptEngine->newQObject(testObject);
    testValue.setScope(global);
    global.setProperty("testObject", testValue);

    view.setSource(QUrl::fromLocalFile("test.qml"));
    view.show();

    return app.exec();
}
예제 #6
0
파일: mainwindow.cpp 프로젝트: KDE/gluon
MainWindow::MainWindow()
{
    QDeclarativeView *view = new QDeclarativeView(this);
    view->rootContext()->setContextProperty( "installedGamesModel",
                                                          GluonPlayer::GameManager::instance()->installedGamesModel() );
    view->rootContext()->setContextProperty( "downloadableGamesModel",
                                                          GluonPlayer::GameManager::instance()->downloadableGamesModel() );
    view->rootContext()->setContextProperty( "serviceProvider",
                                                          GluonPlayer::ServiceProvider::instance() );
    view->rootContext()->setContextProperty( "mainWindow",
                                                          this );
    qmlRegisterType<GluonPlayer::GameMetadata>( "org.kde.gluon.playercomponents", 1, 0, "GameMetadata" );
    qmlRegisterType<GluonPlayer::CommentItemsModel>( "org.kde.gluon.playercomponents", 1, 0, "CommentItemsModel" );
    qmlRegisterUncreatableType<GluonPlayer::GameItem>( "org.kde.gluon.playercomponents", 1, 0, "GameItem", "To be used only for enums" );
    qmlRegisterUncreatableType<GluonPlayer::GameDownloadJob>( "org.kde.gluon.playercomponents", 1, 0, "GameDownloadJob", "Get an instance from serviceProvider" );

    m_kdeclarative.setDeclarativeEngine(view->engine());
    m_kdeclarative.initialize();
    m_kdeclarative.setupBindings();

    view->setResizeMode(QDeclarativeView::SizeRootObjectToView);
    Plasma::Package *package = new Plasma::Package(QString(), "org.kde.gluon.player", Plasma::PackageStructure::load("Plasma/Generic"));
    view->setSource(QUrl(package->filePath("mainscript")));
    setCentralWidget(view);

    resize(1024, 768);
}
예제 #7
0
파일: main.cpp 프로젝트: emdash/QT-GES-Demo
int main(int argc, char **argv)
{
  QApplication app(argc, argv);
  gst_init(&argc, &argv);
  ges_init();

  registerTypes();

  QDeclarativeView view;
  QGLWidget *g = new QGLWidget;
  
  view.setViewport(g);

  createGLSurface("timelineSurface", &view);
  createGLSurface("editorSurface", &view);

  view.setSource(QUrl::fromLocalFile("Timeline.qml"));
  view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
  view.resize(640, 480);
  view.show();

  if (!QDir::current().exists("media")) {
      qDebug () << "Media files missing. Download them by running './download.sh'";
      return -1;
  }

  QObject::connect((QObject*)view.engine(), SIGNAL(quit()), &app, SLOT(quit()));
  
  return app.exec();
}
예제 #8
0
int main(int argc, char **argv)
{
    QApplication app(argc, argv);

    QUrl proxyUrl(qgetenv("http_proxy"));
    if (proxyUrl.isValid() && !proxyUrl.host().isEmpty()) {
        int proxyPort = (proxyUrl.port() > 0) ? proxyUrl.port() : 8080;
        QNetworkProxy proxy(QNetworkProxy::HttpProxy, proxyUrl.host(), proxyPort);
        QNetworkProxy::setApplicationProxy(proxy);
    }
    else {
        QNetworkProxyQuery query(QUrl(QLatin1String("http://www.flickr.com")));
        QNetworkProxy proxy = QNetworkProxyFactory::systemProxyForQuery(query).value(0);
        if (proxy.type() != QNetworkProxy::NoProxy)
            QNetworkProxy::setApplicationProxy(proxy);
    }

    QDeclarativeView view;
    view.setSource(QUrl("qrc:/qml/flickr.qml"));

#if defined(FLICKR_FULLSCREEN)
    view.window()->showFullScreen();
#else
    view.window()->show();
#endif

    QObject::connect(view.engine(), SIGNAL(quit()), &view, SLOT(close()));
    return app.exec();
}
예제 #9
0
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QDesktopWidget* desktopWidget = QApplication::desktop();
    QRect clientRect = desktopWidget->screenGeometry();
    QDeclarativeView view;
    QObject *item = (QObject*)view.rootObject();
    Model m(item);
    view.rootContext()->setContextProperty("appModel", &m);

#if QT_VERSION > 0x040701
    view.setAttribute( Qt::WA_LockPortraitOrientation, true);
#endif

    view.setSource(QUrl("qrc:/ui.qml"));

    view.setSceneRect(clientRect);
    view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
    view.showFullScreen();


    QObject::connect((QObject*)view.engine(), SIGNAL(quit()), &app, SLOT(quit()));
    QObject::connect(&m, SIGNAL(canQuit()), &app, SLOT(quit()));
    QObject::connect(&m, SIGNAL(viewToBeShown()), (QObject*)view.rootObject(), SLOT(qmlviewabouttobeshown()));

    m.viewToBeShownNow();
    view.show();

    return app.exec();
}
예제 #10
0
파일: main.cpp 프로젝트: zhangxj/LotNo
Q_DECL_EXPORT int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    InitProduct(argc, argv);
    app.setWindowIcon(QIcon("logo.ico"));
    QDesktopWidget* desktopWidget = QApplication::desktop();
    //获取可用桌面大小
    QRect deskRect =desktopWidget->availableGeometry();
    //获取设备屏幕大小
    //QRect screenRect =desktopWidget->screenGeometry();

    DataFilter dataFilter;
    QDeclarativeView viewer;
    viewer.setWindowFlags(Qt::FramelessWindowHint);
    QDeclarativeEngine *engine=viewer.engine();
    QDeclarativeContext *context=engine->rootContext();
    context->setContextProperty("dataFilter", &dataFilter);
    context->setContextProperty("app", &app);
    context->setContextProperty("main_window", &viewer);
    context->setContextProperty("windowTitle", WindowTitle);
    context->setContextProperty("SMF_Product", SMF_Product);
    context->setContextProperty("WIDTH", deskRect.width());
    context->setContextProperty("HEIGHT", deskRect.height());
    viewer.setSource(QUrl("qml/LotNo/main.qml"));
    viewer.show();
    return app.exec();
}
예제 #11
0
int main(int argc, char *argv[])
{
    QApplication application(argc, argv);

#ifndef Q_OS_SYMBIAN
    registerExampleService();
#endif

    const QString mainQmlApp = QLatin1String("qrc:/declarative-sfw-dialer.qml");
    QDeclarativeView view;
    view.setSource(QUrl(mainQmlApp));
    view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
    // Qt.quit() called in embedded .qml by default only emits
    // quit() signal, so do this (optionally use Qt.exit()).
    QObject::connect(view.engine(), SIGNAL(quit()), qApp, SLOT(quit()));
#if defined(Q_OS_SYMBIAN)
    view.showFullScreen();
#else // Q_OS_SYMBIAN
    view.show();
#endif // Q_OS_SYMBIAN

    int ret = application.exec();
#ifndef Q_OS_SYMBIAN
    unregisterExampleService();
#endif
    return ret;
}
예제 #12
0
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QDeclarativeView view;

    QDeclarativeEngine *engine = view.engine();

    AccelerometerReader reader;

    engine->rootContext()->setContextProperty("accelerometerReader", &reader);

    view.setSource(QUrl("qrc:/Gui.qml"));
    view.setResizeMode(QDeclarativeView::SizeRootObjectToView);

#if defined(Q_WS_MAEMO_5) || defined(Q_OS_SYMBIAN) || defined(Q_WS_SIMULATOR)
    view.setGeometry(QApplication::desktop()->screenGeometry());
    view.showFullScreen();
#else
    view.setGeometry((QRect(100, 100, 800, 480)));
    view.show();
#endif

    return app.exec();
}
예제 #13
0
Q_DECL_EXPORT int main(int argc, char *argv[])
{
    qDebug() << "THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.";
    QApplication *app = MDeclarativeCache::qApplication(argc, argv);
    app->setOrganizationName("frals");
    app->setOrganizationDomain("frals.se");
    app->setApplicationName("lpmcustomizer");

    QFont font = QFont("Nokia Pure Text Light");
    app->setFont(font);

    QDeclarativeView *view = MDeclarativeCache::qDeclarativeView();
    QDeclarativeContext *ctx = view->rootContext();

    view->setResizeMode(QDeclarativeView::SizeRootObjectToView);
    view->setInputMethodHints(Qt::ImhNoPredictiveText);

    qmlRegisterType<GalleryItem>("LPM", 1, 0, "GalleryItem");

    PlatformIntegration *p = new PlatformIntegration(ctx);
    ImageGenerator *ig = new ImageGenerator();
    ImageSaver *is = new ImageSaver(ig);

    QObject::connect(is, SIGNAL(imageSaved(QString)), p, SLOT(onImageSaved(QString)));

    view->engine()->addImageProvider(QString("logocreator"), ig);

    ctx->setContextProperty("platform", p);
    ctx->setContextProperty("imageSaver", is);

    p->updateGallery();

    QObject::connect(view->engine(), SIGNAL(quit()), app, SLOT(quit()));

//    QString pathInInstallDir = QCoreApplication::applicationDirPath()
//            + QLatin1String("/../") + "qml/lpmcustomizer";

    view->setSource(QUrl("qrc:/qml/main.qml"));
    view->showFullScreen();

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

    return app->exec();
}
예제 #14
0
int main(int argc, char *argv[])
{
#ifdef Q_OS_SYMBIAN
    QApplication::setGraphicsSystem(QLatin1String("openvg"));
#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6)
    QApplication::setGraphicsSystem(QLatin1String("opengl"));
#else
    QApplication::setGraphicsSystem(QLatin1String("opengl"));
#endif

    QApplication app(argc, argv);
    //app.setProperty("NoMStyle", true);

    QDeclarativeView viewer;

#ifdef HAVE_GLWIDGET
    QGLWidget *glWidget = new QGLWidget(&viewer);
    viewer.setViewport(glWidget);
#endif
    viewer.setAttribute(Qt::WA_NoSystemBackground);
    viewer.setAttribute(Qt::WA_OpaquePaintEvent);
    viewer.viewport()->setAttribute(Qt::WA_OpaquePaintEvent);
    viewer.viewport()->setAttribute(Qt::WA_NoSystemBackground);

#ifdef Q_WS_MAEMO_5
    viewer.engine()->addImportPath(QString("/opt/qtm11/imports"));
    viewer.engine()->addPluginPath(QString("/opt/qtm11/plugins"));
#endif

    //WindowHelper *windowHelper = new WindowHelper();
    AppHelper *appHelper = new AppHelper();
    viewer.rootContext()->setContextProperty("helper", appHelper);
    //viewer.rootContext()->setContextProperty("windowHelper", windowHelper);

    //viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
    viewer.setSource(QUrl("qrc:/qml/main.qml"));
#ifdef Q_OS_SYMBIAN
    viewer.showFullScreen();
#elif defined(Q_WS_MAEMO_5)
    viewer.showFullScreen();
#elif defined(Q_WS_SIMULATOR)
    viewer.showFullScreen();
#else
    viewer.showFullScreen();
    // we don't want full screen on meego tablets at least
    //viewer.showMaximized();
#endif

    return app.exec();
    /*
    QDeclarativeView view;
    view.setSource(QUrl("qrc:/qml/main.qml"));
    view.showFullScreen();
    AppHelper *appHelper = new AppHelper();
    view.rootContext()->setContextProperty("helper", appHelper);
    return app.exec();
    */
}
예제 #15
0
파일: main.cpp 프로젝트: iksaif/lugdulov
int main(int argc, char *argv[])
{
#if defined(LUGDULOV_MEEGO)
    QCoreApplication::setOrganizationName("net.iksaif.lugdulov");
#else
    QCoreApplication::setOrganizationName("Lugdulov");
#endif
    QCoreApplication::setApplicationName("Lugdulov");
    QCoreApplication::setApplicationVersion(LUGDULOV_VERSION);

#ifdef HAVE_MEEGOTOUCH
    QApplication *app = MDeclarativeCache::qApplication(argc, argv);
#else
    QApplication application(argc, argv);
    QApplication *app = &application;
#endif

    init_translations();
    init_libraries();

    Settings *settings = Settings::settings();
    PluginsModel *plugins = PluginsModel();

    qmlRegisterUncreatableType<Settings>("net.iksaif.lugdulov", 1, 0, "Settings");
    qmlRegisterUncreatableType<PluginsModel>("net.iksaif.lugdulov", 1, 0, "PluginsModel", "This object is created in the model.");
    qmlRegisterUncreatableType<StationsModel>("net.iksaif.lugdulov", 1, 0, "StationsModel", "This object is created in the model.");
    qmlRegisterUncreatableType<StationsSortFilterProxyModel>("net.iksaif.lugdulov", 1, 0, "StationsSortFilterModel", "This object is created in the model.");

#ifdef HAVE_MEEGOTOUCH
    QDeclarativeView *view = MDeclarativeCache::qDeclarativeView();
#else
    QDeclarativeView *view = new QDeclarativeView();
#endif

    QObject::connect(view->engine(), SIGNAL(quit()), app, SLOT(quit()));
    view->rootContext()->setContextProperty("plugins", plugins);
    view->rootContext()->setContextProperty("settings", settings);

#ifdef LUGDULOV_PLATFORM_HARMATTAN
    view->setSource(QUrl("qrc:/qml/harmattan/main.qml"));
    view->showFullScreen();
#elif defined(Q_OS_SYMBIAN)
    view->setSource(QUrl("qrc:/qml/symbian/main.qml"));
    view->showFullScreen();
#else
    view->setSource(QUrl("qrc:/qml/generic/main.qml"));
    view->show();
#endif


    int result = app->exec();
    delete view;
    delete app;
    return result;
}
예제 #16
0
파일: main.cpp 프로젝트: TatianaZ/homework
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    QDeclarativeView canvas;
    Game game;

    canvas.setSource(QString("qrc:main.qml"));

    canvas.engine()->rootContext()->setContextObject(&game);
    canvas.engine()->rootContext()->setContextProperty("game", &game);

    canvas.setResizeMode(QDeclarativeView::SizeRootObjectToView);
   // qmlRegisterType<Game>();
    QObject::connect(canvas.engine(), SIGNAL(quit()), &app, SLOT(quit()));

    canvas.setGeometry(QRect(10, 30, 800, 600));
    canvas.show();

    return app.exec();
}
예제 #17
0
파일: main.cpp 프로젝트: GaryLee/qmlbook
int main(int argc, char **argv)
{
	QApplication app(argc, argv);

	QDeclarativeView view;
	view.engine()->addImageProvider("stockimages", new StockImageProvider());
	view.setSource(QUrl::fromLocalFile("main.qml"));
	view.show();

	return app.exec();
}
예제 #18
0
파일: qmlflickr.cpp 프로젝트: Andreas665/qt
int main(int argc, char *argv[])
{
    QApplication application(argc, argv);

    NetworkAccessManagerFactory networkAccessManagerFactory;

    const QString mainQmlApp = QLatin1String("flickr.qml");
    QDeclarativeView view;
    view.engine()->setNetworkAccessManagerFactory(&networkAccessManagerFactory);
    view.setSource(QUrl(mainQmlApp));
    view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
    QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit()));
    
#if defined(Q_OS_SYMBIAN)
    view.showFullScreen();
#else // Q_OS_SYMBIAN
    view.setGeometry(QRect(100, 100, 360, 640));
    view.show();
#endif // Q_OS_SYMBIAN
    return application.exec();
}
예제 #19
0
Q_DECL_EXPORT
#endif
int main(int argc, char **argv)
{
    QApplication *application;
    QDeclarativeView *view;
#ifdef HAS_BOOSTER
    application = MDeclarativeCache::qApplication(argc, argv);
    view = MDeclarativeCache::qDeclarativeView();
#else
    qWarning() << Q_FUNC_INFO << "Warning! Running without booster. This may be a bit slower.";
    QApplication stackApp(argc, argv);
    QDeclarativeView stackView;
    application = &stackApp;
    view = &stackView;
#endif

    bool isFullscreen = false;
    QStringList arguments = application->arguments();
    for (int i = 0; i < arguments.count(); ++i) {
        QString parameter = arguments.at(i);
        if (parameter == "-fullscreen") {
            isFullscreen = true;
        } else if (parameter == "-help") {
            qDebug() << "Contacts application";
            qDebug() << "-fullscreen   - show QML fullscreen";
            exit(0);
        }
    }

    QObject::connect(view->engine(), SIGNAL(quit()), application, SLOT(quit()));

    if (QFile::exists("main.qml"))
        view->setSource(QUrl::fromLocalFile("main.qml"));
    else
        view->setSource(QUrl("qrc:/qml/main.qml"));

    view->setAttribute(Qt::WA_OpaquePaintEvent);
    view->setAttribute(Qt::WA_NoSystemBackground);
    view->viewport()->setAttribute(Qt::WA_OpaquePaintEvent);
    view->viewport()->setAttribute(Qt::WA_NoSystemBackground);

    // TODO: we could do with a plugin to access QDesktopServices paths
    view->rootContext()->setContextProperty("systemAvatarDirectory", QDesktopServices::storageLocation(QDesktopServices::PicturesLocation));
    view->rootContext()->setContextProperty("DocumentsLocation", QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation));

    if (isFullscreen)
        view->showFullScreen();
    else
        view->show();

    return application->exec();
}
예제 #20
0
파일: main.cpp 프로젝트: Hnz/qtmc
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    // Load settings
    QSettings settings;
    settings.setValue("dbtype", "QSQLITE");
    settings.setValue("dbname", "/tmp/testdb.sqlite3");

    // Translator
    QString translationfile = QString("qtmc_nl");
    QTranslator translator;
    if (!translator.load(translationfile) &&
            !translator.load(translationfile,
                             app.applicationDirPath() +  "../lib/qtmc/translations/")) {
        qWarning() << "Failed to load translation file";
    }
    app.installTranslator(&translator);

    // Open database
    QSqlDatabase db = QSqlDatabase::addDatabase(settings.value("dbtype").toString());
    db.setDatabaseName(settings.value("dbname").toString());
    //db.setDatabaseName(":memory:");

    // Check if database is open
    if (!db.open()) {
        qWarning() << app.tr("Cannot open database") << settings.value("dbname");
        return 1;
    }

    // Create mediadb
    MediaDB *mediadb = new MediaDB();
    qDebug() << app.tr("QtMC version") << QString(QTMC_VERSION);
    qDebug() << app.tr("MediaDB version") << mediadb->version();

    // Create qml-view and connect quit-signal
    QDeclarativeView *view = new QDeclarativeView;
    QObject::connect(view->engine(), SIGNAL(quit()), view, SLOT(close()));

    // Expose c++ object to qml
    QDeclarativeContext *ctxt = view->rootContext();
    ctxt->setContextProperty("MediaDB", mediadb);
    ctxt->setContextProperty("Settings", &settings);

    // Run view
    view->setSource(QUrl(app.applicationDirPath() + "/../lib/qtmc/qml/QtMC.qml"));
    view->show();
    //view->showFullScreen();

    return app.exec();
}
예제 #21
0
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    QDeclarativeView canvas;
    
    qmlRegisterType<TileData>();
    MinehuntGame* game = new MinehuntGame();
    
#ifdef Q_OS_SYMBIAN
    canvas.setResizeMode(QDeclarativeView::SizeRootObjectToView);
#endif
    canvas.engine()->rootContext()->setContextObject(game);        
    canvas.setSource(QString("qrc:minehunt.qml"));
    QObject::connect(canvas.engine(), SIGNAL(quit()), &app, SLOT(quit()));
    
#ifdef Q_OS_SYMBIAN
    canvas.showFullScreen();
#else
    canvas.setGeometry(QRect(100, 100, 450, 450));
    canvas.show();
#endif
    return app.exec();
}
예제 #22
0
/**
 * @short Main
 *
 * Entry point of the application.
 *
 * @param argc argc.
 * @param argv argv.
 * @return exit code.
 */
Q_DECL_EXPORT int main(int argc, char *argv[])
{
#ifdef MEEGO_EDITION_HARMATTAN
    QScopedPointer<QApplication> scopedApp(MDeclarativeCache::qApplication(argc, argv));
    QScopedPointer<QDeclarativeView> scopedView (MDeclarativeCache::qDeclarativeView());
    QApplication *app = scopedApp.data();
    QDeclarativeView *view = scopedView.data();
#else
    QApplication *app = new QApplication(argc, argv);
    QDeclarativeView *view = new QDeclarativeView();
#endif
    app->setApplicationName("Widgets");
    app->setOrganizationName("SfietKonstantin");


    qmlRegisterType<RemoteSettingsManager>("org.SfietKonstantin.widgets.app", 1, 0,
                                           "RemoteSettingsManager");
    qmlRegisterType<ImageSupport>("org.SfietKonstantin.widgets.app", 1, 0, "ImageSupport");
    qmlRegisterType<WebAndMailHandler>("org.SfietKonstantin.widgets.app", 1, 0,
                                       "WebAndMailHandler");
    view->rootContext()->setContextProperty("BACKGROUND_FOLDER", BACKGROUND_FOLDER);


#ifdef IMPORT_DIR
    view->engine()->addImportPath(IMPORT_DIR);
#endif
    view->setSource(QUrl(MAIN_QML_PATH));

    QObject::connect(view->engine(), SIGNAL(quit()), view, SLOT(close()));
#ifdef MEEGO_EDITION_HARMATTAN
    view->showFullScreen();
#else
    view->show();
#endif

    return app->exec();
}
예제 #23
0
파일: main.cpp 프로젝트: zsombi/kuemelappz
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

#ifdef ENABLE_QML_TRACES
    QByteArray data = "1";
    qputenv("QML_IMPORT_TRACE", data);
#endif

    QDeclarativeView view;

    view.engine()->rootContext()->setContextProperty("appResAlias", "apptheme");
    view.engine()->rootContext()->setContextProperty("appResFile", "qml/testapp/apptheme.rcc");
    //view.setSource(QUrl::fromLocalFile("qml/testapp/main.qml"));
    view.setSource(QUrl("qrc:/main.qml"));

#if defined(Q_OS_SYMBIAN) || defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR) || defined(Q_OS_SIMULATOR) || defined(Q_WS_MAEMO_5)
    view.showFullScreen();
#else
    view.show();
#endif

    return app.exec();
}
예제 #24
0
int main(int argc, char **argv)
{
    QApplication app (argc, argv);
    app.setOrganizationName("SfietKonstantin");
    app.setApplicationName("qfb-demo");

    Bridge bridge;

    QDeclarativeView view;
    view.engine()->addImportPath(IMPORT_PATH);
    view.rootContext()->setContextProperty("BRIDGE", &bridge);
    view.setSource(QUrl(MAIN_QML_FILE));
    view.show();

    return app.exec();
}
예제 #25
0
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QDeclarativeView view;

    DBusService dbusservice;

    view.engine()->rootContext()->setContextProperty("dbusservice", &dbusservice);

    view.setSource(QUrl(FILEPATH));

    view.show();

    return app.exec();
}
예제 #26
0
Q_DECL_EXPORT int main(int argc, char *argv[])
{
    QScopedPointer<QApplication> app(new QApplication(argc, argv));

    //QNetworkProxyFactory::setUseSystemConfiguration(true);

    // Construct and register the Social Connect plug-in
    SocialConnectPlugin socialConnectPlugin;
    socialConnectPlugin.registerTypes("SocialConnect");

    QDeclarativeView view;
    view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
    QObject::connect(view.engine(), SIGNAL(quit()), app.data(), SLOT(quit()));
    view.setSource(QUrl("qrc:/main.qml"));
    view.showFullScreen();

    return app->exec();
}
예제 #27
0
int main(int argc, char *argv[])
{
    QApplication application(argc, argv);
    const QString mainQmlApp = QLatin1String("qrc:///flickr.qml");
    QDeclarativeView view;
    view.setSource(QUrl(mainQmlApp));
    view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
    // Qt.quit() called in embedded .qml by default only emits
    // quit() signal, so do this (optionally use Qt.exit()).
    QObject::connect(view.engine(), SIGNAL(quit()), qApp, SLOT(quit()));
#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_6)
    view.showFullScreen();
#else
    view.setGeometry(QRect(100, 100, 360, 640));
    view.show();
#endif
    return application.exec();
}
예제 #28
0
파일: main.cpp 프로젝트: jedillama/llamaui
int main( int argc, char** argv )
{
	QApplication app( argc, argv );

	Config* config = new Config( &app );

	// If we can't process the command-line or set up the database
	// there's no point continuing
	if ( !processCommandLine() || !setupDatabase() )
		return 0;

	QDeclarativeView view;

	view.connect( view.engine(), SIGNAL(quit()), SLOT(close()) );
	view.setResizeMode( QDeclarativeView::SizeRootObjectToView );

	// Register custom types for access to certail enums from QML
	qmlRegisterType< SoundEngine >( "net.randalflagg.llamaui", 1, 0, "SoundEngine" );
	qmlRegisterType< KeyboardMap >( "net.randalflagg.llamaui", 1, 0, "KeyboardMap" );
	qmlRegisterType< SystemProcess >( "net.randalflagg.llamaui", 1, 0, "SystemProcess" );

	QDeclarativeContext* rootContext = view.rootContext();

	// Initalise the keyboard key/action mapper
	if ( !initKeyboardMap( rootContext ) )
		return 0;

	rootContext->setContextProperty( "config", config );
	initSoundEngine( rootContext );
	initGameMenu( rootContext );
	initEmulatorMenu( rootContext );
	initSystemMenu( rootContext );
	initGameLauncher( rootContext );

	// Create the interface
	QDir dir( Config::instance()->value( "paths", "qmlDir" ).toString() );
	view.setSource( QUrl::fromLocalFile( dir.absoluteFilePath( "main.qml" ) ) );
	view.showFullScreen();

	// Hide the mouse cursor
	app.setOverrideCursor( QCursor( Qt::BlankCursor ) );

	return app.exec();
}
예제 #29
0
파일: main.cpp 프로젝트: dididu/HiCast
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);   

    qmlRegisterType<Episode>("PodcastLib", 1, 0, "Episode");

    PodcastListModel model;

    model.addPodcast(Podcast("RT1", "http://feed1here"));
    model.addPodcast(Podcast("RT2", "http://feed2here"));
    model.addPodcast(Podcast("RT3", "http://feed3here"));

//    model.saveModel(QString("hicast.dat"));

    //model.loadModel(QString("hicast.dat"));

    QDeclarativeView view;
    QDeclarativeContext *ctxt = view.rootContext();
    ctxt->setContextProperty("myModel", &model);       

    view.setSource(QUrl("qrc:/qml/Main.qml"));
    view.setResizeMode(QDeclarativeView::SizeRootObjectToView);

    QObject::connect((QObject*)view.engine(), SIGNAL(quit()), &a, SLOT(quit()));


#if defined(Q_WS_MAEMO_5)
    view.setGeometry(QRect(0, 0, 800, 480));
    view.showFullScreen();
#elif defined(Q_WS_S60)
    view.setGeometry(QRect(0, 0, 640, 360));
    view.showFullScreen();
#else
    view.setGeometry(QRect(100, 100, 800, 480));
    view.show();
#endif

    a.exec();

    PodcastStore::getInstance()->close();

    return 0;
}
예제 #30
0
int
main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    // Register the "PSMove" object for usage in QML
    PSMoveQt::registerQML();

    QDeclarativeView view;
    view.setWindowTitle("PS Move API - Move Trailers QML Example");
    view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
    view.setSource(QUrl("qrc:/trailers.qml"));
    view.showMaximized();

    QObject::connect(view.engine(), SIGNAL(quit()),
                     &app, SLOT(quit()));

    return app.exec();
}