int main(int argc, char **argv) { #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) QGuiApplication app(argc, argv); #else QApplication app(argc, argv); #endif app.setProperty("NoMStyle", QVariant(true)); QDir::setCurrent(app.applicationDirPath()); #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) QQuickView window; #else QDeclarativeView window; #endif window.setSource(QUrl("qrc:/main.qml")); #ifdef __arm__ window.showFullScreen(); #else window.show(); #endif return app.exec(); }
int main(int argc, char** argv) { QCoreApplication::setOrganizationName("com.ubuntu.developer.mzanetti.kodimote"); QCoreApplication::setApplicationName("kodimote"); QGuiApplication application(argc, argv); // Load language file QString language = QLocale::system().bcp47Name(); qDebug() << "got language:" << language; QTranslator qtTranslator; if(!qtTranslator.load("qt_" + language, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) { qDebug() << "couldn't load qt_" + language; } application.installTranslator(&qtTranslator); QTranslator translator; if (!translator.load(":/kodimote_" + language + ".qm")) { qDebug() << "Cannot load translation file" << "kodimote_" + language + ".pm"; } application.installTranslator(&translator); Kodi::instance()->setDataPath(QDir::homePath() + "/.cache/com.ubuntu.developer.mzanetti.kodimote/"); Kodi::instance()->eventClient()->setApplicationThumbnail("kodimote80.png"); QQuickView *view = new QQuickView(); Settings settings; UbuntuHelper helper(view, &settings); ProtocolManager protocols; MprisController controller(&protocols, &helper); Q_UNUSED(controller) view->setResizeMode(QQuickView::SizeRootObjectToView); view->engine()->setNetworkAccessManagerFactory(new NetworkAccessManagerFactory()); view->setTitle("Kodimote"); view->engine()->rootContext()->setContextProperty("kodi", Kodi::instance()); view->engine()->rootContext()->setContextProperty("settings", &settings); view->engine()->rootContext()->setContextProperty("protocolManager", &protocols); view->setSource(QUrl("qrc:///qml/main.qml")); if(QGuiApplication::arguments().contains("--fullscreen")) { view->showFullScreen(); } else { // view->resize(QSize(720, 1280)); view->show(); } return application.exec(); }
Q_DECL_EXPORT int main(int argc, char *argv[]) { QGuiApplication *lApplication = new QGuiApplication(argc, argv); QQuickView *lView = new QQuickView; lView->setResizeMode(QQuickView::SizeRootObjectToView); QVariantList lLevelList; createAllLevels(lLevelList); lView->rootContext()->setContextProperty(QStringLiteral("gLevels"), lLevelList); QNetworkAccessManager lNetworkManager; LevelModel *lLevelModel = new LevelModel(lLevelList.count(), &lNetworkManager, lApplication); lView->rootContext()->setContextProperty(QStringLiteral("gLevelModel"), lLevelModel); HighScoresModel *lHighScoresModel = new HighScoresModel(lApplication); lView->rootContext()->setContextProperty(QStringLiteral("gHighScoresModel"), lHighScoresModel); QObject::connect(lLevelModel, SIGNAL(postingSucceded()), lHighScoresModel, SLOT(readScoresFromFile())); QObject::connect(lView->engine(), SIGNAL(quit()), lApplication, SLOT(quit())); qmlRegisterType<LevelHighScoresModel>("ChimpModels", 1, 0, "LevelHighScoreModel"); LevelHighScoresModel::registerOtherModels(lLevelModel, lHighScoresModel); lView->setSource(QStringLiteral("qrc:///qml/Game.qml")); lView->showFullScreen(); return lApplication->exec(); }
int main(int argc, char* argv[]) { QGuiApplication app(argc,argv); qmlRegisterType<Connector>("Connector", 1, 0, "Connector"); app.setOrganizationName("QtProject");\ app.setOrganizationDomain("qt-project.org");\ app.setApplicationName(QFileInfo(app.applicationFilePath()).baseName());\ QQuickView view;\ if (qgetenv("QT_QUICK_CORE_PROFILE").toInt()) {\ QSurfaceFormat f = view.format();\ f.setProfile(QSurfaceFormat::CoreProfile);\ f.setVersion(4, 4);\ view.setFormat(f);\ }\ view.connect(view.engine(), SIGNAL(quit()), &app, SLOT(quit()));\ new QQmlFileSelector(view.engine(), &view);\ view.setSource(QUrl("qrc:///demos/tweetsearch/tweetsearch.qml")); \ view.setResizeMode(QQuickView::SizeRootObjectToView);\ if (QGuiApplication::platformName() == QLatin1String("qnx") || \ QGuiApplication::platformName() == QLatin1String("eglfs")) {\ view.showFullScreen();\ } else {\ view.show();\ }\ return app.exec();\ }
/*------------------------------------------------------------------------------ | main +-----------------------------------------------------------------------------*/ int main(int argc, char* argv[]) { QApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true); QApplication a(argc, argv); QStringList args = a.arguments(); const bool opengl = !args.contains("--no-opengl"); args.removeAll("--no-opengl"); if (opengl) { qDebug("QML QtWebEngine..."); QQuickView* view = new QQuickView; view->setSource(QUrl("qrc:/poc_main.qml")); view->showFullScreen(); QObject* o = view->rootObject()->findChild<QObject*>("webEngineView"); o->setProperty("url", args.at(1)); } else { qDebug("Widget QtWebEngine..."); QWebEngineView* view = new QWebEngineView; view->load(QUrl(args.at(1))); view->show(); } return a.exec(); }
/*---------------------------------------------------------------------- | definitions +---------------------------------------------------------------------*/ int main(int argc, char *argv[]) { #if 0 signal(SIGSEGV, handlerSigsegv); signal(SIGINT, handlerSigint); #endif QApplication a(argc, argv); // Registers all the codecs. av_register_all(); #ifdef ENABLE_CUBE_SAMPLE // Check arguments. if (argc < 3) { LOG_ERROR(LOG_TAG, "You have to provide a prefix for the textures to use and the path to the video."); LOG_ERROR(LOG_TAG, "You'll need 6 textures whose abs path is <prefix><n>.jpg with <n> in [0, 5]."); LOG_ERROR(LOG_TAG, "Then start the application with <prefix> as the" " first param and <video_path> as the second."); return -1; } // Check file existance. for (int i = 0; i < 6; i++) { QString filePath = QString("%1%2%3").arg(a.arguments().at(1)).arg(i).arg(".jpg"); if (!QFile(filePath).exists()) { LOG_ERROR(LOG_TAG, "Couldn't find %s.", qPrintable(filePath)); return -1; } } if (!QFile(a.arguments().at(2)).exists()) { LOG_ERROR(LOG_TAG, "Video file does not exist."); return -1; } // Build scene. GLWidget widget(a.arguments().at(1), a.arguments().at(2)); widget.show(); #elif ENABLE_QML_SAMPLE #ifdef ENABLE_VIDEO_TEST qRegisterMetaType<GLuint>("GLuint"); qRegisterMetaType<OMX_TextureData*>("OMX_TextureData*"); qmlRegisterType<OMX_ImageElement>("com.luke.qml", 1, 0, "OMXImage"); qmlRegisterType<OMX_VideoSurfaceElement>("com.luke.qml", 1, 0, "OMXVideoSurface"); qmlRegisterType<OMX_CameraSurfaceElement>("com.luke.qml", 1, 0, "OMXCameraSurface"); qmlRegisterType<OMX_MediaProcessorElement>("com.luke.qml", 1, 0, "OMXMediaProcessor"); QQuickView view; view.setSource(QUrl("qrc:///main.qml")); view.setResizeMode(view.SizeRootObjectToView); view.showFullScreen(); #else OMX_AudioProcessor proc; proc.play(); #endif // ENABLE_VIDEO_TEST #endif // ENABLE_CUBE_SAMPLE return a.exec(); }
int main(int argc, char *argv[]) { QGuiApplication app(argc,argv); QQuickView view; view.setResizeMode(QQuickView::SizeRootObjectToView); QObject::connect(view.engine(), SIGNAL(quit()), qApp, SLOT(quit())); view.setSource(QUrl("qrc:///LoginContainer.qml")); view.resize(800, 480); view.showFullScreen(); return app.exec(); }
int main(int argc, char *argv[]) { QGuiApplication *app = SailfishApp::application(argc, argv); QString locale = QLocale::system().name(); QTranslator translator; translator.load(locale,SailfishApp::pathTo(QString("localization")).toLocalFile()); app->installTranslator(&translator); QQuickView *view = SailfishApp::createView(); view->setSource(SailfishApp::pathTo("qml/main.qml")); view->showFullScreen(); return app->exec(); }
int main(int argc, char **argv) { QGuiApplication app(argc, argv); QQuickView view; qDebug() << "Welcome to my SmartDevCon 2012 presentation!"; QObject::connect(view.engine(), SIGNAL(quit()), &app, SLOT(quit())); view.setResizeMode(QQuickView::SizeRootObjectToView); view.setSource(QUrl("qrc:/qml/Main.qml")); view.showFullScreen(); return app.exec(); }
int main(int argc, char *argv[]) { QApplication a(argc, argv); qmlRegisterType<FileIO, 1>("FileIO", 1, 0, "FileIO"); // MyQuickView w; // w.resize(400,700); // w.show(); QQuickView view; view.setSource(QUrl("qrc:/gameMainUi.qml")); view.setFlags(Qt::FramelessWindowHint |Qt::WindowStaysOnTopHint); view.showFullScreen(); return a.exec(); }
int main(int argc, char **argv) { QGuiApplication app(argc, argv); QQuickView window; window.setSource(QUrl("qrc:/main.qml")); #ifdef __arm__ window.showFullScreen(); #else window.resize(window.initialSize().width(), window.initialSize().height()); window.show(); #endif return app.exec(); }
int main(int argc, char* argv[]) { pthread_t trade_thread, md_thread; QGuiApplication app(argc,argv); qmlRegisterType<Graph>("Graph", 1, 0, "Graph"); app.setOrganizationName("QtProject"); app.setOrganizationDomain("qt-project.org"); app.setApplicationName(QFileInfo(app.applicationFilePath()).baseName()); QQmlEngine engine; QQmlComponent component(&engine, QUrl("qrc:///demos/stocqt/content/Tradepanel.qml")); // if( component.status != component.Ready ) // { // if( component.status == component.Error ) // console.debug("Error:"+ component.errorString() ); // return; // or maybe throw // } object = component.create(); QQuickView view; tradepanel.object=object; PublicFuncs tradeFun(object); view.rootContext()->setContextProperty("myObject", &tradepanel); view.rootContext()->setContextProperty("myObject_t", &tradeFun); if (qgetenv("QT_QUICK_CORE_PROFILE").toInt()) { QSurfaceFormat f = view.format(); f.setProfile(QSurfaceFormat::CoreProfile); f.setVersion(4, 4); view.setFormat(f); } view.connect(view.engine(), SIGNAL(quit()), &app, SLOT(quit())); new QQmlFileSelector(view.engine(), &view); view.setSource(QUrl("qrc:///demos/stocqt/stocqt.qml")); view.setResizeMode(QQuickView::SizeRootObjectToView); if (QGuiApplication::platformName() == QLatin1String("qnx") || QGuiApplication::platformName() == QLatin1String("eglfs")) { view.showFullScreen(); } else { view.show(); } pthread_create(&md_thread, NULL, Msclient, NULL); pthread_create(&trade_thread, NULL, trade_main, NULL); return app.exec(); }
int MascaraInterfaceV1::showDialog(const QString &dialogType) { qDebug() << Q_FUNC_INFO << "Showing " << dialogType; int serialNo = m_windowSerial++; QQuickView *view = new QQuickView; m_windows.insert(serialNo, view); view->setSource(QUrl::fromLocalFile("/home/nemo/dialogs/" + dialogType + "/" + dialogType + ".qml")); // HACK connect(view->engine(), SIGNAL(quit()), QGuiApplication::instance(), SLOT(quit())); view->showFullScreen(); view->create(); // TODO: better to hook to expose? lazy QGuiApplication::platformNativeInterface()->setWindowProperty(view->handle(), QLatin1String("CATEGORY"), QLatin1String("dialog")); view->setProperty("MascaraWindowId", serialNo); m_closeTimer.stop(); view->installEventFilter(this); return serialNo; }
int main(int argc, char *argv[]) { QGuiApplication *app = SailfishApp::application(argc, argv); QQuickView *view = SailfishApp::createView(); Settings *settings = new Settings(); // SailfishApp::main() will display "qml/template.qml", if you need more // control over initialization, you can use: // // - SailfishApp::application(int, char *[]) to get the QGuiApplication * // - SailfishApp::createView() to get a new QQuickView * instance // - SailfishApp::pathTo(QString) to get a QUrl to a resource file // // To display the view, call "show()" (will show fullscreen on device). view->rootContext()->setContextProperty("settings", settings); view->setSource(SailfishApp::pathTo("qml/harbour-scocadigo.qml")); view->showFullScreen(); return app->exec(); }
int main(int argc, char* argv[]) { QGuiApplication app(argc,argv); QQuickView view; GameData *game = new GameData(); view.engine()->rootContext()->setContextObject(game); view.engine()->rootContext()->setContextProperty("gameData", game); view.connect(view.engine(), SIGNAL(quit()), &app, SLOT(quit())); view.setSource(QUrl::fromLocalFile(QString("rsc/main.qml"))); if (QGuiApplication::platformName() == QLatin1String("qnx") || QGuiApplication::platformName() == QLatin1String("eglfs")) { view.setResizeMode(QQuickView::SizeRootObjectToView); view.showFullScreen(); } else { view.show(); } return app.exec(); }
int main(int argc, char **argv) { qputenv("QT_LOGGING_RULES", "qt.qpa.*=true"); qputenv("QSG_INFO", "1"); QGuiApplication app(argc, argv); QList<QScreen *> screens = app.screens(); qDebug("Application sees %d screens", screens.count()); qDebug() << screens; QVector<QQuickView *> views; for (int i = 0; i < screens.count(); ++i) { QQuickView *v = addView(screens[i], i); views.append(v); v->showFullScreen(); } int r = app.exec(); qDeleteAll(views); return r; }
/*---------------------------------------------------------------------- | main +---------------------------------------------------------------------*/ int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); // Utility. POC_QMLUtils qmlUtils; QQuickView view; view.engine()->rootContext()->setContextProperty("utils", &qmlUtils); view.setSource(QUrl("qrc:///qml/main.qml")); view.setResizeMode(QQuickView::SizeRootObjectToView); #ifdef RASPBERRY view.showFullScreen(); #else view.resize(800, 400); view.show(); #endif // RASPBERRY qApp->connect(view.engine(), SIGNAL(quit()), qApp, SLOT(quit())); // If file path is provided from the command line, I start the player // immediately. QStringList args = app.arguments(); if (args.size() > 1) { QFile f(args.at(1)); if (!f.exists()) qWarning("File provided does not exist."); else { QObject* rootObject = dynamic_cast<QObject*>(view.rootObject()); QObject* mediaOutput = rootObject->findChild<QObject*>("mediaOutput"); //mediaPlayer->setProperty("source", QUrl::fromLocalFile(args.at(1))); QMetaObject::invokeMethod(mediaOutput, "showLocalMedia", Q_ARG(QVariant, args.at(1))); } } return app.exec(); }
int main(int argc, char *argv[]) { QGuiApplication *app = SailfishApp::application(argc, argv); app->setApplicationName("harbour-tinytodo"); app->setApplicationVersion(QString(APP_VERSION)+QString(APP_VERSION_SUFFIX)); qDebug()<<app->applicationName()<<" version "<<app->applicationVersion(); QTranslator translator; //QString translationLocation = QLibraryInfo::location(QLibraryInfo::TranslationsPath); QString translationLocation = "/usr/share/harbour-tinytodo/locale"; QString translation = "harbour-tinytodo_" + QLocale::system().name(); qDebug()<<"Translation location: "<<translationLocation; qDebug()<<"Translation: "<<translation; translator.load(translation, translationLocation); app->installTranslator(&translator); QQuickView *view = SailfishApp::createView(); view->rootContext()->setContextProperty("appVersion", app->applicationVersion()); view->setSource(SailfishApp::pathTo("qml/harbour-tinytodo.qml")); view->showFullScreen(); return app->exec(); }
int main(int argc, char *argv[]) { QGuiApplication app(argc,argv); app.setOrganizationName("David A Roberts"); app.setOrganizationDomain("davidar.io"); app.setApplicationName("Tensor"); QQuickView view; if(qgetenv("QT_QUICK_CORE_PROFILE").toInt()) { QSurfaceFormat f = view.format(); f.setProfile(QSurfaceFormat::CoreProfile); f.setVersion(4, 4); view.setFormat(f); } view.connect(view.engine(), SIGNAL(quit()), &app, SLOT(quit())); new QQmlFileSelector(view.engine(), &view); view.setSource(QUrl("qrc:///src/Tensor.qml")); view.setResizeMode(QQuickView::SizeRootObjectToView); if(QGuiApplication::platformName() == QLatin1String("qnx") || QGuiApplication::platformName() == QLatin1String("eglfs")) { view.showFullScreen(); } else { view.show(); } return app.exec(); }
Q_DECL_EXPORT #endif int main(int argc, char *argv[]) { qsrand(QDateTime::currentDateTimeUtc().toTime_t()); #if defined(BUILD_FOR_SAILFISHOS) //To support calendar access #if defined(BUILD_FOR_OPENREPOS) qDebug()<<"openrepos.net build"; setuid(getpwnam("nemo")->pw_uid); setgid(getgrnam("privileged")->gr_gid); #endif QGuiApplication* app = SailfishApp::application(argc, argv); #elif defined(HAVE_DECLARATIVE_CACHE) QApplication* app = MDeclarativeCache::qApplication(argc, argv); #elif defined(BUILD_FOR_UBUNTU) QGuiApplication* app = new QGuiApplication(argc, argv); app->setWindowIcon(QIcon(":/fahrplan2.svg")); #else QApplication* app = new QApplication(argc, argv); #if defined(BUILD_FOR_DESKTOP) app->setWindowIcon(QIcon(":/fahrplan2_64.png")); #endif #endif QString localeName = QLocale().name(); qDebug() <<"Using "<<localeName<<" locale"; // Install translations QTranslator translator; translator.load(QString("fahrplan_%1").arg(localeName), ":/translations"); app->installTranslator(&translator); qDebug()<<"Startup"; qRegisterMetaType<Station>(); qRegisterMetaType<StationsList>(); qRegisterMetaType<TimetableEntry>(); qRegisterMetaType<TimetableEntriesList>(); qRegisterMetaType<Fahrplan::StationType>(); qRegisterMetaType<Fahrplan::Mode>(); #if defined(BUILD_FOR_HARMATTAN) || defined(BUILD_FOR_MAEMO_5) || defined(BUILD_FOR_SYMBIAN) || defined(BUILD_FOR_BLACKBERRY) || defined(BUILD_FOR_UBUNTU) || defined(BUILD_FOR_SAILFISHOS) qDebug()<<"QML"; qmlRegisterType<Fahrplan>("Fahrplan", 1, 0, "FahrplanBackend"); qmlRegisterType<ParserAbstract>("Fahrplan", 1, 0, "ParserAbstract"); qmlRegisterType<FahrplanParserThread>("Fahrplan", 1, 0, "FahrplanParserThread"); qmlRegisterType<FahrplanCalendarManager>("Fahrplan", 1, 0, "CalendarManager"); qmlRegisterUncreatableType<StationSearchResults>("Fahrplan", 1, 0, "StationSearchResults" , "StationSearchResults cannot be created from QML. " "Access it through FahrplanBackend.stationSearchResults."); qmlRegisterUncreatableType<Favorites>("Fahrplan", 1, 0, "Favorites" , "Favorites cannot be created from QML. " "Access it through FahrplanBackend.favorites."); qmlRegisterUncreatableType<Timetable>("Fahrplan", 1, 0, "Timetable" , "Timetable cannot be created from QML. " "Access it through FahrplanBackend.timetable."); qmlRegisterUncreatableType<Trainrestrictions>("Fahrplan", 1, 0, "Trainrestrictions" , "Trainrestrictions cannot be created from QML. " "Access it through FahrplanBackend.trainrestrictions."); qmlRegisterUncreatableType<Backends>("Fahrplan", 1, 0, "Backends" , "Backends cannot be created from QML. " "Access it through FahrplanBackend.backends."); qmlRegisterType<JourneyResultList>("Fahrplan", 1, 0, "JourneyResultList"); qmlRegisterType<JourneyResultItem>("Fahrplan", 1, 0, "JourneyResultItem"); qmlRegisterType<JourneyDetailResultList>("Fahrplan", 1, 0, "JourneyDetailResultList"); qmlRegisterType<JourneyDetailResultItem>("Fahrplan", 1, 0, "JourneyDetailResultItem"); #if defined(BUILD_FOR_SAILFISHOS) QQuickView *view = SailfishApp::createView(); #elif defined(HAVE_DECLARATIVE_CACHE) QDeclarativeView* view = MDeclarativeCache::qDeclarativeView(); #elif defined(BUILD_FOR_QT5) QQuickView *view = new QQuickView(); #else QDeclarativeView* view = new QDeclarativeView(); #endif #if defined(BUILD_FOR_HARMATTAN) qDebug()<<"Harmattan"; view->setSource(QUrl("qrc:/src/gui/harmattan/main.qml")); view->showFullScreen(); #elif defined(BUILD_FOR_MAEMO_5) qDebug()<<"Maemo5"; qmlRegisterType<HildonHelper>("HildonHelper", 1, 0, "HildonHelper"); view->setSource(QUrl("qrc:/src/gui/fremantle/main.qml")); view->show(); #elif defined(BUILD_FOR_SYMBIAN) qDebug()<<"Symbian"; view->setSource(QUrl("qrc:/src/gui/symbian/main.qml")); view->showFullScreen(); #elif defined(BUILD_FOR_UBUNTU) qDebug()<<"Ubuntu"; view->setSource(QUrl("qrc:/src/gui/ubuntu/main.qml")); view->setResizeMode(QQuickView::SizeRootObjectToView); view->show(); QSettings settings(FAHRPLAN_SETTINGS_NAMESPACE, "fahrplan2"); view->setGeometry(settings.value("geometry", QRect(100, 100, 400, 600)).toRect()); #elif defined(BUILD_FOR_SAILFISHOS) qDebug()<<"SailfishOs"; view->setSource(QUrl("qrc:/src/gui/sailfishos/main.qml")); view->showFullScreen(); #elif defined(BUILD_FOR_BLACKBERRY) qDebug() << "Blackberry"; // QML wrapper around Qt Mobility Subset qmlRegisterType<QtMobilitySubset::BlackBerryPositionSource>("QtMobility.location", 1, 1, "PositionSource"); qmlRegisterUncreatableType<QtMobilitySubset::BlackBerryPosition>("QtMobility.location", 1, 1, "Position", "Cant't create Position type"); qmlRegisterUncreatableType<QtMobilitySubset::BlackBerryCoordinate>("QtMobility.location", 1, 1, "Coordinate", "Cant't create Coordinate type"); QSettings *settings = new QSettings(FAHRPLAN_SETTINGS_NAMESPACE, "fahrplan2"); // Check if GPS Location permission is set // and geolocation services are enabled. int res = geolocation_request_events(0); if (res == BPS_SUCCESS) geolocation_stop_events(0); settings->setValue("enableGps", res == BPS_SUCCESS); delete settings; // Improves touch handling QApplication::setStartDragDistance(42); QGLWidget *gl = new QGLWidget(); view->setViewport(gl); view->setViewportUpdateMode(QGraphicsView::FullViewportUpdate); view->setSource(QUrl("qrc:/src/gui/symbian/main.qml")); // Hide Symbian-style status bar on BlackBerry view->rootObject()->setProperty("showStatusBar", false); view->showFullScreen(); #endif #else qDebug()<<"Desktop"; MainWindow w; w.show(); #endif qDebug()<<"Exec"; int error = app->exec(); #if defined(BUILD_FOR_UBUNTU) settings.setValue("geometry", view->geometry()); #endif #ifndef Q_OS_BLACKBERRY // For some reason, this causes a weird freeze of // Fahrplan on BlackBerry 10 so that it can only // be closed by restarting the phone. delete app; #endif return error; }
int main(int argc, char **argv) { setenv("QML_BAD_GUI_RENDER_LOOP", "1", 1); QGuiApplication app(argc, argv); QString path, urlstring, qmlstring; bool isFullscreen = false; QStringList arguments = app.arguments(); for (int i = 0; i < arguments.count(); ++i) { QString parameter = arguments.at(i); if (parameter == "-path") { if (i + 1 >= arguments.count()) qFatal("-path requires an argument"); path = arguments.at(i + 1); i++; } else if (parameter == "-url") { if (i + 1 >= arguments.count()) qFatal("-url requires an argument"); urlstring = arguments.at(i + 1); i++; } else if (parameter == "-qml") { if (i + 1 >= arguments.count()) qFatal("-qml requires an argument"); qmlstring = arguments.at(i + 1); i++; } else if (parameter == "-fullscreen") { isFullscreen = true; } else if (parameter == "-help") { qDebug() << "EMail application"; qDebug() << "-fullscreen - show QML fullscreen"; qDebug() << "-path - path to cd to before launching -url"; qDebug() << "-qml - file to launch (default: main.qml inside -path)"; qDebug() << "-url - url to load"; exit(0); } } QQuickView view; view.setResizeMode(QQuickView::SizeRootObjectToView); view.rootContext()->setContextProperty("startURL", QVariant(urlstring)); view.rootContext()->setContextProperty("createParentID", QVariant(0)); view.rootContext()->setContextProperty("MozContext", QMozContext::GetInstance()); view.setSource(qmlstring.isEmpty() ? QUrl("qrc:/qml/MainPageQuick.qml") : QUrl(qmlstring)); if (isFullscreen) { QRect r = QGuiApplication::primaryScreen()->geometry(); view.resize(r.width(), r.height()); view.showFullScreen(); } else { view.resize(800, 600); view.show(); } QString componentPath(DEFAULT_COMPONENTS_PATH); qDebug() << "Load components from:" << componentPath + QString("/components") + QString("/EmbedLiteBinComponents.manifest"); QMozContext::GetInstance()->addComponentManifest(componentPath + QString("/components") + QString("/EmbedLiteBinComponents.manifest")); qDebug() << "Load components from:" << componentPath + QString("/components") + QString("/EmbedLiteJSComponents.manifest"); QMozContext::GetInstance()->addComponentManifest(componentPath + QString("/components") + QString("/EmbedLiteJSComponents.manifest")); qDebug() << "Load components from:" << componentPath + QString("/chrome") + QString("/EmbedLiteJSScripts.manifest"); QMozContext::GetInstance()->addComponentManifest(componentPath + QString("/chrome") + QString("/EmbedLiteJSScripts.manifest")); qDebug() << "Load components from:" << componentPath + QString("/chrome") + QString("/EmbedLiteOverrides.manifest"); QMozContext::GetInstance()->addComponentManifest(componentPath + QString("/chrome") + QString("/EmbedLiteOverrides.manifest")); QTimer::singleShot(0, QMozContext::GetInstance(), SLOT(runEmbedding())); return app.exec(); }
int main(int argc, char* argv[]) { QGuiApplication app(argc,argv); #ifdef QT_WEBVIEW_WEBENGINE_BACKEND QtWebEngine::initialize(); #endif // QT_WEBVIEW_WEBENGINE_BACKEND qreal screenH=0; qreal screenW=0; bool firstLaunch=false; FileService fileservice; InternetServices internetservices; //Translation QTranslator translator; QDropbox dropbox(APP_KEY, APP_SECRET); DropBoxOperations dropboxOperations; dropboxOperations.setDropboxObject(&dropbox); #ifdef IOS qmlRegisterType<PDFVisu>("PDFVisu", 1, 0, "PDFVisu"); #endif #ifdef ANDROID qmlRegisterType<PdfCore>("ANDPDFVisu", 1, 0, "ANDPDFVisu"); #endif translator.load(":/playlistPlayer."+ QLocale::system().name()); if(QGuiApplication::screens().length()>1){ QScreen *scrn = QGuiApplication::primaryScreen(); screenH=scrn->availableGeometry().size().height(); screenW=scrn->availableGeometry().size().width(); } app.setOrganizationName("Monasys"); app.setOrganizationDomain("Monasys.fr"); app.setApplicationName(QFileInfo(app.applicationFilePath()).baseName()); //Translation app.installTranslator(&translator); QQuickView view; view.connect(view.engine(), SIGNAL(quit()), &app, SLOT(quit())); // Test if local Documents Dir exists, if not creates it if(!QDir(documents).exists()){ if(QDir(documents.left(documents.lastIndexOf("/"))).exists()){ QDir(documents.left(documents.lastIndexOf("/"))).mkdir(QDir(documents).dirName()); } } if(!QDir(documents + "/playlists").exists()){ // First launch, install examples QDir(documents).mkdir("playlists"); QDir(documents + "/playlists").mkdir("audio"); QDir(documents + "/playlists").mkdir("chords"); QDir(documents + "/playlists").mkdir("lyrics"); QFile::copy(":/playlists/mysetlist.csv",documents + "/playlists/example.csv") ; QFile::copy(":/playlists/audio/onemore.mp3",documents + "/playlists/audio/onemore.mp3") ; QFile::copy(":/playlists/lyrics/onemore.txt",documents + "/playlists/lyrics/onemore.txt") ; QFile::copy(":/playlists/lyrics/mysong.txt",documents + "/playlists/lyrics/mysong.txt") ; QFile::copy(":/playlists/chords/onemore.png", documents + "/playlists/chords/onemore.png") ; setFileAttribute(documents + "/playlists/example.csv"); setFileAttribute(documents + "/playlists/audio/onemore.mp3"); setFileAttribute(documents + "/playlists/lyrics/onemore.txt"); setFileAttribute(documents + "/playlists/lyrics/mysong.txt"); setFileAttribute(documents + "/playlists/chords/onemore.png"); #ifdef IOS // 20160124 Rend ces fichiers non sauvegardable sur iCloud backupAttrib bckAtt; bool statAttrib; setFileAttribute(documents + "/playlists/example.csv"); setFileAttribute(documents + "/playlists/audio/onemore.mp3"); setFileAttribute(documents + "/playlists/lyrics/onemore.txt"); setFileAttribute(documents + "/playlists/lyrics/mysong.txt"); setFileAttribute(documents + "/playlists/chords/onemore.png"); statAttrib = bckAtt.setAttribExclude(documents + "/playlists/example.csv"); statAttrib = bckAtt.setAttribExclude(documents + "/playlists/audio/onemore.mp3"); statAttrib = bckAtt.setAttribExclude(documents + "/playlists/lyrics/onemore.txt"); statAttrib = bckAtt.setAttribExclude(documents + "/playlists/lyrics/mysong.txt"); statAttrib = bckAtt.setAttribExclude(documents + "/playlists/chords/onemore.png"); #endif firstLaunch=true; } //qDebug() << ">>>>>>>>>>>>> Kernel " << QSysInfo::productType() << QSysInfo::kernelVersion() << " Location " << documents; /***** if (qgetenv("QT_QUICK_CORE_PROFILE").toInt()) { QSurfaceFormat f = view.format(); f.setProfile(QSurfaceFormat::CoreProfile); f.setVersion(4, 4); view.setFormat(f); } ******/ view.rootContext()->setContextProperty("firstLaunch",firstLaunch); view.rootContext()->setContextProperty("fileService",&fileservice); view.rootContext()->setContextProperty("internetServices",&internetservices); view.rootContext()->setContextProperty("deviceType",QSysInfo::productType()); view.rootContext()->setContextProperty("screenH",screenH); view.rootContext()->setContextProperty("screenW",screenW); view.rootContext()->setContextProperty("liteMode",LiteMode); //20150723 Ajout de la property setlistDir view.rootContext()->setContextProperty("setlistDir",documents + "/playlists/"); view.rootContext()->setContextProperty("dropBoxOperations",&dropboxOperations); view.rootContext()->setContextProperty("android",false); view.setSource(QUrl("qrc:/qml/main.qml")); view.setResizeMode(QQuickView::SizeRootObjectToView); if (QGuiApplication::platformName() == QLatin1String("qnx") || QGuiApplication::platformName() == QLatin1String("eglfs")) { view.showFullScreen(); } else { view.show() ; } QObject *qmlRoot = view.rootObject() ; QMetaObject::invokeMethod(qmlRoot, "main"); return app.exec(); }
int main(int argc, char **argv) { QStringList arguments; for(int ii = 0; ii < argc; ii++) { arguments << argv[ii]; } if ( arguments.indexOf("--help") > 0 || arguments.indexOf("-h") > 0 ) { showUsageHelp(argv[0]); return 1; } #ifdef USE_QT5 // install message handler qInstallMessageHandler(SDDM::MessageHandler); // create application QGuiApplication app(argc, argv); // create view QQuickView view; view.setResizeMode(QQuickView::SizeRootObjectToView); #else // create application QApplication app(argc, argv); // create view QDeclarativeView view; view.setResizeMode(QDeclarativeView::SizeRootObjectToView); #endif view.engine()->addImportPath(IMPORTS_INSTALL_DIR); // create configuration instance Configuration configuration(CONFIG_FILE); // get socket name QString socket = parameter(app.arguments(), "--socket", ""); // get theme path QString theme = parameter(app.arguments(), "--theme", ""); // read theme metadata ThemeMetadata metadata(QString("%1/metadata.desktop").arg(theme)); // get theme config file QString configFile = QString("%1/%2").arg(theme).arg(metadata.configFile()); // read theme config ThemeConfig config(configFile); // create models SessionModel sessionModel; ScreenModel screenModel; UserModel userModel; GreeterProxy proxy(socket); proxy.setSessionModel(&sessionModel); // set context properties view.rootContext()->setContextProperty("sessionModel", &sessionModel); view.rootContext()->setContextProperty("screenModel", &screenModel); view.rootContext()->setContextProperty("userModel", &userModel); view.rootContext()->setContextProperty("config", config); view.rootContext()->setContextProperty("sddm", &proxy); // connect proxy signals QObject::connect(&proxy, SIGNAL(loginSucceeded()), &view, SLOT(close())); // get theme main script QString mainScript = QString("%1/%2").arg(theme).arg(metadata.mainScript()); // set main script as source view.setSource(QUrl::fromLocalFile(mainScript)); // show view view.showFullScreen(); view.setGeometry(screenModel.geometry()); // run application return app.exec(); }
int main(int argc, char *argv[]) { // SailfishApp::main() will display "qml/template.qml", if you need more // control over initialization, you can use: // // - SailfishApp::application(int, char *[]) to get the QGuiApplication * // - SailfishApp::createView() to get a new QQuickView * instance // - SailfishApp::pathTo(QString) to get a QUrl to a resource file // QProcess appinfo; QString appversion; // read app version from rpm database on startup appinfo.start("/bin/rpm", QStringList() << "-qa" << "--queryformat" << "%{version}-%{RELEASE}" << "harbour-worldclock"); appinfo.waitForFinished(-1); if (appinfo.bytesAvailable() > 0) { appversion = appinfo.readAll(); } QScopedPointer<QGuiApplication> app(SailfishApp::application(argc, argv)); QQuickView* view = SailfishApp::createView(); qmlRegisterType<TimeZone>("harbour.worldclock.TimeZone", 1 , 0 , "TZ"); qmlRegisterType<Launcher>("harbour.worldclock.Launcher", 1 , 0 , "App"); qmlRegisterType<Settings>("harbour.worldclock.Settings", 1 , 0 , "MySettings"); qmlRegisterType<settingsPublic::Languages>("harbour.worldclock.Settings", 1, 0, "Languages"); // QString locale_appname = "harbour-worldclock-" + QLocale::system().name(); // qDebug() << "Translations:" << SailfishApp::pathTo("translations").toLocalFile() + "/" + locale_appname + ".qm"; // Check if user has set language explicitly to be used in the app QString locale = QLocale::system().name(); QSettings mySets; int languageNbr = mySets.value("language","0").toInt(); QTranslator translator; if (settingsPublic::Languages::SYSTEM_DEFAULT != languageNbr) { switch (languageNbr) { // Swedish case settingsPublic::Languages::SV: translator.load("harbour-worldclock-sv.qm", SailfishApp::pathTo(QString("translations")).toLocalFile()); break; // Dutch case settingsPublic::Languages::NL: translator.load("harbour-worldclock-nl.qm", SailfishApp::pathTo(QString("translations")).toLocalFile()); break; // German case settingsPublic::Languages::DE: translator.load("harbour-worldclock-de.qm", SailfishApp::pathTo(QString("translations")).toLocalFile()); break; // Russian case settingsPublic::Languages::RU: translator.load("harbour-worldclock-ru.qm", SailfishApp::pathTo(QString("translations")).toLocalFile()); break; // Hungarian case settingsPublic::Languages::HU_HU: translator.load("harbour-worldclock-hu_HU.qm", SailfishApp::pathTo(QString("translations")).toLocalFile()); break; // Polish case settingsPublic::Languages::PL_PL: translator.load("harbour-worldclock-pl_PL.qm", SailfishApp::pathTo(QString("translations")).toLocalFile()); break; // French case settingsPublic::Languages::FR_FR: translator.load("harbour-worldclock-fr_FR.qm", SailfishApp::pathTo(QString("translations")).toLocalFile()); break; // Italian case settingsPublic::Languages::IT: translator.load("harbour-worldclock-it.qm", SailfishApp::pathTo(QString("translations")).toLocalFile()); break; // Greek case settingsPublic::Languages::EL: translator.load("harbour-worldclock-el.qm", SailfishApp::pathTo(QString("translations")).toLocalFile()); break; // Arabic case settingsPublic::Languages::AR: translator.load("harbour-worldclock-ar.qm", SailfishApp::pathTo(QString("translations")).toLocalFile()); break; // English default: translator.load("harbour-worldclock.qm", SailfishApp::pathTo(QString("translations")).toLocalFile()); break; } // install translator for specific language // otherwise the system language will be set by SailfishApp app->installTranslator(&translator); } view->rootContext()->setContextProperty("DebugLocale",QVariant(locale)); view->rootContext()->setContextProperty("version", appversion); view->setSource(SailfishApp::pathTo("qml/worldclock.qml")); view->showFullScreen(); return app->exec(); }
/*---------------------------------------------------------------------- | main +---------------------------------------------------------------------*/ int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); // Utility. QStringList args = app.arguments(); POC_Mode currentMode; if (args.contains("--animations")) currentMode = MODE_ANIMATIONS; else if (args.contains("--loop")) currentMode = MODE_LOOP; else if (args.contains("--seektest")) currentMode = MODE_SEEK; else currentMode = MODE_PLAYER; POC_QMLUtils qmlUtils; QQuickView view; // Set EGL to 24bit color depth. QSurfaceFormat curSurface = view.format(); curSurface.setRedBufferSize(8); curSurface.setGreenBufferSize(8); curSurface.setBlueBufferSize(8); curSurface.setAlphaBufferSize(0); view.setFormat(curSurface); view.engine()->rootContext()->setContextProperty("utils", &qmlUtils); switch (currentMode) { case MODE_ANIMATIONS: view.setSource(QUrl("qrc:///qml/main_animations.qml")); break; case MODE_LOOP: view.setSource(QUrl("qrc:///qml/main_loop.qml")); break; case MODE_SEEK: view.setSource(QUrl(QStringLiteral("qrc:///qml/main_seektest.qml"))); break; default: view.setSource(QUrl("qrc:///qml/main.qml")); break; } qInstallMessageHandler(&log_handler); LC_QMLLogger::registerObject(view.rootContext()); view.setResizeMode(QQuickView::SizeRootObjectToView); #ifdef RASPBERRY view.showFullScreen(); #else view.resize(800, 400); view.show(); #endif // RASPBERRY qApp->connect(view.engine(), SIGNAL(quit()), qApp, SLOT(quit())); // If file path is provided from the command line, I start the player // immediately. switch (currentMode) { case MODE_LOOP: { QStringList list; for (int i = 2; i < args.size(); i++) list << args.at(i); if (list.size() < 1) return log_warn("No items to play."); if (!show_media(&view, list)) return 1; break; } case MODE_PLAYER: if (args.size() > 1) if (!show_media(&view, args.at(1))) return 1; break; default: if (args.size() > 2) if (!show_media(&view, args.at(2))) return 1; break; } return app.exec(); }
int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QCoreApplication::setApplicationName(kApplicationName); QCoreApplication::setApplicationVersion(kApplicationVersion); QCoreApplication::setOrganizationName(kOrganizationName); #ifdef Q_OS_MAC QCoreApplication::setOrganizationDomain(kOrganizationName); #else QCoreApplication::setOrganizationDomain(kOrganizationDomain); #endif QSettings::setDefaultFormat(kSettingsFormat); #ifdef Q_OS_WIN // Force usage of OpenGL ES through ANGLE on Windows QCoreApplication::setAttribute(Qt::AA_UseOpenGLES); #endif // Before initializing ArcGIS Runtime, first set the // ArcGIS Runtime license setting required for your application. // ArcGISRuntimeEnvironment::setLicense("Place license string in here"); // use this code to check for initialization errors // QObject::connect(ArcGISRuntimeEnvironment::instance(), &ArcGISRuntimeEnvironment::errorOccurred, [](const Error& error){ // QMessageBox msgBox; // msgBox.setText(error.message); // msgBox.exec(); // }); // if (ArcGISRuntimeEnvironment::initialize() == false) // { // application.quit(); // return 1; // } // Register the map view for QML qmlRegisterType<MapQuickView>("Esri.GeocodeWhat3Words", 1, 0, "MapView"); // Register the GeocodeWhat3Words (QQuickItem) for QML qmlRegisterType<GeocodeWhat3Words>("Esri.GeocodeWhat3Words", 1, 0, "GeocodeWhat3Words"); // Intialize application view QQuickView view; view.setResizeMode(QQuickView::SizeRootObjectToView); // Add the import Path view.engine()->addImportPath(QDir(QCoreApplication::applicationDirPath()).filePath("qml")); QString arcGISRuntimeImportPath = QUOTE(ARCGIS_RUNTIME_IMPORT_PATH); QString arcGISToolkitImportPath = QUOTE(ARCGIS_TOOLKIT_IMPORT_PATH); #if defined(LINUX_PLATFORM_REPLACEMENT) // on some linux platforms the string 'linux' is replaced with 1 // fix the replacement paths which were created QString replaceString = QUOTE(LINUX_PLATFORM_REPLACEMENT); arcGISRuntimeImportPath = arcGISRuntimeImportPath.replace(replaceString, "linux", Qt::CaseSensitive); arcGISToolkitImportPath = arcGISToolkitImportPath.replace(replaceString, "linux", Qt::CaseSensitive); #endif // Add the Runtime and Extras path view.engine()->addImportPath(arcGISRuntimeImportPath); // Add the Toolkit path view.engine()->addImportPath(arcGISToolkitImportPath); // Set the source view.setSource(QUrl(kApplicationSourceUrl)); #if !defined(Q_OS_IOS) && !defined(Q_OS_ANDROID) // Process command line QCommandLineOption showOption(kArgShowName, kArgShowDescription, kArgShowValueName, kArgShowDefault); QCommandLineParser commandLineParser; commandLineParser.setApplicationDescription(kApplicationDescription); commandLineParser.addOption(showOption); commandLineParser.addHelpOption(); commandLineParser.addVersionOption(); commandLineParser.process(app); // Show app window auto showValue = commandLineParser.value(kArgShowName).toLower(); if (showValue.compare(kShowMaximized) == 0) { view.showMaximized(); } else if (showValue.compare(kShowMinimized) == 0) { view.showMinimized(); } else if (showValue.compare(kShowFullScreen) == 0) { view.showFullScreen(); } else if (showValue.compare(kShowNormal) == 0) { view.showNormal(); } else { view.show(); } #else view.show(); #endif return app.exec(); }