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 = SailfishApp::application(argc, argv); QQuickView* view = SailfishApp::createView(); Configurator config; config.load(); //qmlRegisterType<Request>("Sailbook.Request", 1, 0, "Request"); qmlRegisterUncreatableType<Request>("App.Sailbook", 1, 0, "Request", QStringLiteral("Error")); //qmlRegisterInterface<SessionManager>("SessionManager"); SessionManager session(QStringLiteral(APPID), config.getValue(QStringLiteral("token")).toString()); session.setExtendedPermission(SessionManager::ExtendedPermissions( SessionManager::Email | SessionManager::ManageNotifications | SessionManager::ManagePages | SessionManager::PublishActions | SessionManager::ReadFriendList | SessionManager::ReadInsights | SessionManager::ReadMailbox | SessionManager::ReadPageMailboxes | SessionManager::ReadStream | SessionManager::RsvpEvent )); session.setUserDataPermission(SessionManager::UserDataPermissions( SessionManager::UserAboutMe | SessionManager::UserActionsBooks | SessionManager::UserActionsMusic | SessionManager::UserActionsNews | SessionManager::UserActionsVideo | SessionManager::UserActivities | SessionManager::UserBirthday | SessionManager::UserEducationHistory | SessionManager::UserEvents | SessionManager::UserFriends | SessionManager::UserGamesActivity | SessionManager::UserGroups | SessionManager::UserHometown | SessionManager::UserInterests | SessionManager::UserLikes | SessionManager::UserLocation | SessionManager::UserPhotos | SessionManager::UserRelationshipDetails | SessionManager::UserRelationships | SessionManager::UserReligionPolitics | SessionManager::UserStatus | SessionManager::UserTaggedPlaces | SessionManager::UserVideos | SessionManager::UserWebsite | SessionManager::UserWorkHistory )); view->rootContext()->setContextProperty("SessionManager", &session); view->rootContext()->setContextProperty("Configurator", &config); view->setSource(SailfishApp::pathTo("qml/sailbook.qml")); view->show(); return app->exec(); }
int main(int argc, char **argv) { QGuiApplication *app = SailfishApp::application(argc, argv); qmlRegisterType<Mainview>("harbour.monav", 1, 0, "Mainview"); qmlRegisterType<TapMenu>("harbour.monav", 1, 0, "TapMenu"); qmlRegisterType<MapPackages>("harbour.monav", 1, 0, "MapPackages"); qmlRegisterType<Bookmarks>("harbour.monav", 1, 0, "Bookmarks"); qmlRegisterType<PaintWidget>("harbour.monav", 1, 0, "PaintWidget"); qmlRegisterType<WorldMapChooser>("harbour.monav", 1, 0, "WorldMapChooser"); QQuickView *view = SailfishApp::createView(); view->setSource(SailfishApp::pathTo("qml/Main.qml")); view->show(); view->setResizeMode(QQuickView::SizeRootObjectToView); QObject *object = (QObject *) view->rootObject(); Mainview *mainview = object->findChild<Mainview *>("mainview"); mainview->init(); app->connect( app, SIGNAL(aboutToQuit()), MapData::instance(), SLOT(cleanup()) ); app->connect( app, SIGNAL(aboutToQuit()), RoutingLogic::instance(), SLOT(cleanup()) ); app->connect( app, SIGNAL(aboutToQuit()), Logger::instance(), SLOT(cleanup()) ); app->connect( app, SIGNAL(aboutToQuit()), mainview, SLOT(cleanup()) ); 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 // // To display the view, call "show()" (will show fullscreen on device). QCoreApplication::setOrganizationName("org"); QCoreApplication::setOrganizationDomain("Sparkeyy"); QCoreApplication::setApplicationName("harbour-spritradar"); qmlRegisterType<Settings>("harbour.spritradar.Settings", 1,0, "Settings"); QGuiApplication* app = SailfishApp::application(argc, argv); QQuickView* view = SailfishApp::createView(); QObject::connect(view->engine(), SIGNAL(quit()), app, SLOT(quit())); view->rootContext()->setContextProperty("tankerkoenig_apikey", TANKERKOENIG_APIKEY); //Claim here: https://creativecommons.tankerkoenig.de/#register // has to be set as additional qmake argument to the project configuration (armv7hl, i486 and debug/release for both), like this: "TANKERKOENIG_APIKEY=<your_apikey>" view->setSource(SailfishApp::pathTo("qml/harbour-spritradar.qml")); view->show(); 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 // // To display the view, call "show()" (will show fullscreen on device). QGuiApplication *app = SailfishApp::application(argc, argv); QTranslator translator; translator.load(QLocale::system(), "ownNotes", "_", SailfishApp::pathTo("i18n").toLocalFile(), ".qm"); app->installTranslator(&translator); QPython::registerQML(); qmlRegisterType<DocumentHandler>("net.khertan.documenthandler", 1, 0, "DocumentHandler"); QQuickView *view = SailfishApp::createView(); view->setSource(SailfishApp::pathTo("qml/ownNotes.qml")); view->engine()->rootContext()->setContextProperty("VERSION", VERSION); view->show(); 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 // // To display the view, call "show()" (will show fullscreen on device). qRegisterMetaType<QList<FileInfoEntry*> >(); QGuiApplication *app = SailfishApp::application(argc, argv); QQuickView *view = SailfishApp::createView(); // Add image providers and C++ classes view->engine()->addImageProvider(QLatin1String("thumbnail"), new ThumbnailProvider); FileEngine fileEngine; view->engine()->rootContext()->setContextProperty("engine", &fileEngine); view->engine()->rootContext()->setContextProperty("fileList", fileEngine.fileList); view->engine()->rootContext()->setContextProperty("fileInfo", fileEngine.fileInfo); view->engine()->rootContext()->setContextProperty("fileProcess", fileEngine.fileProcess); view->engine()->rootContext()->setContextProperty("clipboard", fileEngine.clipboard); view->engine()->rootContext()->setContextProperty("settings", fileEngine.settings); view->engine()->rootContext()->setContextProperty("coverModel", fileEngine.coverModel); // Show the application view->setSource(SailfishApp::pathTo("qml/Filetug.qml")); view->show(); return app->exec(); }
int main(int argc, char *argv[]) { QGuiApplication *app = new QGuiApplication(argc, argv); Gist *gist = new Gist(app); QTimer::singleShot(1, gist, SLOT(start())); return app->exec(); }
/** * TODO: get log level from cmake file */ int main ( int argc, char *argv[] ) { QGuiApplication app ( argc, argv ); QQmlApplicationEngine engine; qmlRegisterSingletonType<QtConverter> ( "jogesayu", 1, 0, "Converter", converter_qml_singleton_provider ); engine.load ( QUrl ( QStringLiteral ( "qrc:///main.qml" ) ) ); return app.exec(); }
Q_DECL_EXPORT int main(int argc, char *argv[]) { QGuiApplication* app = SailfishApp::application(argc, argv); qmlRegisterType<Creature>("harbour.morzyn", 1,0 , "Creature"); qmlRegisterType<Player>("harbour.morzyn", 1,0 , "Player"); qmlRegisterType<Game>("harbour.morzyn", 1,0 , "Game"); qmlRegisterType<Scroll>("harbour.morzyn", 1,0 , "Scroll"); qmlRegisterType<Statistics>("harbour.morzyn", 1,0 , "Statistics"); qmlRegisterType<Library>("harbour.morzyn", 1,0 , "Library"); QSettings settings(QSettings::IniFormat, QSettings::UserScope, "harbour-morzyn", "morzyn"); if (!settings.contains("fullscreen")) settings.setValue("fullscreen", QVariant((bool)true)); if (!settings.contains("music")) settings.setValue("music", QVariant((bool)true)); if (!settings.contains("sound")) settings.setValue("sound", QVariant((bool)true)); qsrand ( time(NULL) ); QString locale = QLocale::system().name(); QTranslator translator; translator.load(QString("morzyn_") + locale.left(2).toLower(), SailfishApp::pathTo("translations").toString()); app->installTranslator(&translator); GameService gs; Game g; Constants c; c.HCOUNT = 10; c.VCOUNT = 10; Library library; Statistics s; gs.setGame(&g); gs.setConstants(&c); gs.setLibrary(&library); gs.setStatistics(&s); gs.setSettings(&settings); QQuickView* view = SailfishApp::createView(); view->rootContext()->setContextProperty("gameService", &gs); view->rootContext()->setContextProperty("game", &g); view->rootContext()->setContextProperty("library", &library); view->rootContext()->setContextProperty("statistics", &s); view->rootContext()->setContextProperty("os", QVariant("sailfish")); view->rootContext()->setContextProperty("hCount", QVariant(c.HCOUNT)); view->rootContext()->setContextProperty("vCount", QVariant(c.VCOUNT)); view->rootContext()->setContextProperty("version", QVariant("0.7.17")); view->setTitle("Morzyn v0.7.17"); view->setSource(SailfishApp::pathTo("qml/morzyn.qml")); view->show(); return app->exec(); }
int main(int argc, char *argv[]) { // QLoggingCategory::setFilterRules(QLatin1String("*.debug=false")); qmlRegisterUncreatableType<qml::DataRepositoryObject>("harbour.twablet", 1, 0, "DataRepository", QLatin1String("Uncreatable")); qmlRegisterUncreatableType<qml::IModel>("harbour.twablet", 1, 0, "Model", QLatin1String("Uncreatable")); qmlRegisterUncreatableType<qml::AccountObject>("harbour.twablet", 1, 0, "Account", QLatin1String("Uncreatable")); qmlRegisterUncreatableType<qml::LayoutObject>("harbour.twablet", 1, 0, "Layout", QLatin1String("Uncreatable")); qmlRegisterUncreatableType<qml::QueryTypeObject>("harbour.twablet", 1, 0, "QueryType", QLatin1String("Uncreatable")); qmlRegisterUncreatableType<qml::TweetObject>("harbour.twablet", 1, 0, "Tweet", QLatin1String("Uncreatable")); qmlRegisterUncreatableType<qml::QuotedTweetObject>("harbour.twablet", 1, 0, "QuotedTweet", QLatin1String("Uncreatable")); qmlRegisterUncreatableType<qml::UserObject>("harbour.twablet", 1, 0, "User", QLatin1String("Uncreatable")); qmlRegisterUncreatableType<qml::MediaObject>("harbour.twablet", 1, 0, "Media", QLatin1String("Uncreatable")); qmlRegisterUncreatableType<qml::MediaModel>("harbour.twablet", 1, 0, "MediaModel", QLatin1String("Uncreatable")); qmlRegisterUncreatableType<qml::IQueryItem>("harbour.twablet", 1, 0, "QueryItem", QLatin1String("Uncreatable")); qmlRegisterUncreatableType<Info>("harbour.twablet", 1, 0, "Info", QLatin1String("Uncreatable")); qmlRegisterType<qml::TwitterAuthentification>("harbour.twablet", 1, 0, "TwitterAuthentification"); qmlRegisterType<qml::AccountModel>("harbour.twablet", 1, 0, "AccountModel"); qmlRegisterType<qml::AccountSelectionModel>("harbour.twablet", 1, 0, "AccountSelectionModel"); qmlRegisterType<qml::LayoutModel>("harbour.twablet", 1, 0, "LayoutModel"); qmlRegisterType<qml::TweetModel>("harbour.twablet", 1, 0, "TweetModel"); qmlRegisterType<qml::QueryTypeModel>("harbour.twablet", 1, 0, "QueryTypeModel"); qmlRegisterType<qml::DescriptionFormatter>("harbour.twablet", 1, 0, "DescriptionFormatter"); qmlRegisterType<qml::TweetFormatter>("harbour.twablet", 1, 0, "TweetFormatter"); qmlRegisterType<qml::QuotedTweetFormatter>("harbour.twablet", 1, 0, "QuotedTweetFormatter"); qmlRegisterType<qml::UserModel>("harbour.twablet", 1, 0, "UserModel"); qmlRegisterType<qml::TweetQueryItem>("harbour.twablet", 1, 0, "TweetQueryItem"); qmlRegisterType<qml::UserQueryItem>("harbour.twablet", 1, 0, "UserQueryItem"); qmlRegisterType<qml::TweetListQueryWrapperObject>("harbour.twablet", 1, 0, "TweetListQuery"); qmlRegisterType<qml::UserListQueryWrapperObject>("harbour.twablet", 1, 0, "UserListQuery"); qmlRegisterType<qml::StatusUpdateQueryWrapperObject>("harbour.twablet", 1, 0, "StatusUpdateQuery"); qmlRegisterType<qml::TweetSpecificQueryWrapperObject>("harbour.twablet", 1, 0, "TweetQuery"); qmlRegisterType<qml::UserSpecificQueryWrapperObject>("harbour.twablet", 1, 0, "UserQuery"); qmlRegisterSingletonType<qml::DataRepositoryObject>("harbour.twablet", 1, 0, "Repository", [](QQmlEngine *e, QJSEngine *) -> QObject * { return new qml::DataRepositoryObject(e); }); qmlRegisterSingletonType<Info>("harbour.twablet", 1, 0, "INFO", [](QQmlEngine *e, QJSEngine *) -> QObject * { return new Info(e); }); qmlRegisterSingletonType<NetworkMonitor>("harbour.twablet", 1, 0, "NetworkMonitor", [](QQmlEngine *e, QJSEngine *) -> QObject * { return new NetworkMonitor(e); }); #ifndef DESKTOP return SailfishApp::main(argc, argv); #else QGuiApplication app {argc, argv}; QQuickView view {}; view.setSource(QUrl(QLatin1String("qrc:/qml/harbour-twablet.qml"))); view.setResizeMode(QQuickView::SizeRootObjectToView); view.show(); return app.exec(); #endif }
int main (int argc, char ** argv) { QGuiApplication app (argc, argv); GlWindow window (QSize (480, 480)); // Here is the size of the jacobi map (doesn't change with the window size) window.resize (480, 480); window.show (); window.setAnimating (true); 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[]) { if (argc < 2) return -1; // QCoreApplication::setAttribute(Qt::AA_X11InitThreads); // QApplication app(argc, argv); // QGuiApplication *app = SailfishApp::application(argc, argv); // QQuickView *view = SailfishApp::createView(); QGuiApplication *app = new QGuiApplication(argc, argv); QQuickView *view = new QQuickView(); EmuView emuView(&snesEmu, argv[1], view); return app->exec(); }
int main(int argc, char *argv[]) { int result = 0; QGuiApplication *app = SailfishApp::application(argc, argv); QQuickView *view = SailfishApp::createView(); qmlRegisterType<PlotWidget>("harbour.messwerk.MesswerkWidgets", 1, 0, "PlotWidget"); qmlRegisterType<SatellitePosWidget>("harbour.messwerk.MesswerkWidgets", 1, 0, "SatellitePosWidget"); qmlRegisterType<SatelliteStrengthWidget>("harbour.messwerk.MesswerkWidgets", 1, 0, "SatelliteStrengthWidget"); QTimer refreshTimer; Accelerometer accelerometer(false); Gyroscope gyroscope(false); Magnetometer magnetometer(false); Rotation rotation(false); Light light(false); Proximity proximity(true); SatelliteInfo satelliteinfo; Position position; // connect not self-refreshing sensors to the global timer QObject::connect(&refreshTimer, SIGNAL(timeout()), &accelerometer, SLOT(refresh())); QObject::connect(&refreshTimer, SIGNAL(timeout()), &gyroscope, SLOT(refresh())); QObject::connect(&refreshTimer, SIGNAL(timeout()), &magnetometer, SLOT(refresh())); QObject::connect(&refreshTimer, SIGNAL(timeout()), &rotation, SLOT(refresh())); QObject::connect(&refreshTimer, SIGNAL(timeout()), &light, SLOT(refresh())); QString qml = QString("qml/%1.qml").arg("Messwerk"); view->rootContext()->setContextProperty("accelerometer", &accelerometer); view->rootContext()->setContextProperty("gyroscope", &gyroscope); view->rootContext()->setContextProperty("magnetometer", &magnetometer); view->rootContext()->setContextProperty("rotationsensor", &rotation); view->rootContext()->setContextProperty("lightsensor", &light); view->rootContext()->setContextProperty("proximitysensor", &proximity); view->rootContext()->setContextProperty("satelliteinfo", &satelliteinfo); view->rootContext()->setContextProperty("positionsensor", &position); view->rootContext()->setContextProperty("settings", &(Settings::instance())); view->setSource(SailfishApp::pathTo(qml)); view->show(); refreshTimer.start(100); result = app->exec(); delete view; delete app; return result; }
int main(int argc, char *argv[]) { QProcess appinfo; QString appversion; QString appname = "TaskList"; QString pkgname = "harbour-tasklist"; QCoreApplication::setOrganizationName(pkgname); QCoreApplication::setApplicationName(pkgname); // read app version from rpm database on startup appinfo.start("/bin/rpm", QStringList() << "-qa" << "--queryformat" << "%{version}" << pkgname); appinfo.waitForFinished(-1); if (appinfo.bytesAvailable() > 0) { appversion = appinfo.readAll(); } /* Internationalization Support thanks to Antoine Reversat who mentioned this here: https://www.mail-archive.com/[email protected]/msg02602.html */ QGuiApplication* app = SailfishApp::application(argc, argv); // load default translator and system locale's translator afterwards QTranslator defaultTranslator; defaultTranslator.load("en_US", SailfishApp::pathTo(QString("localization")).toLocalFile()); app->installTranslator(&defaultTranslator); QSettings settings; QString locale = settings.value("language", "").toString(); if (locale.isEmpty() || locale == QString("system_default")) { /* use system locale by default */ if (locale.isEmpty()) settings.setValue("language", "system_default"); locale = QLocale::system().name(); } QTranslator translator; translator.load(locale, SailfishApp::pathTo(QString("localization")).toLocalFile()); app->installTranslator(&translator); qmlRegisterType<TasksExport>("harbour.tasklist.tasks_export", 1, 0, "TasksExport"); QQuickView* view = SailfishApp::createView(); QObject::connect(view->engine(), SIGNAL(quit()), app, SLOT(quit())); view->rootContext()->setContextProperty("version", appversion); view->rootContext()->setContextProperty("appname", appname); view->setSource(SailfishApp::pathTo("qml/harbour-tasklist.qml")); view->show(); return app->exec(); }
int main(int argc, char *argv[]) { QGuiApplication *app = SailfishApp::application(argc, argv); qInstallMessageHandler(myQt5MessageOutput); MainWindow *win = new MainWindow(app); Q_UNUSED(win); int rv = app->exec(); delete win; return rv; }
int main(int argc, char *argv[]) { QGuiApplication *app = SailfishApp::application(argc, argv); QQuickView *view = SailfishApp::createView(); QQmlContext *context = view->rootContext(); // This will hook into the view and render OpenGL on top of it ShaderToyGLView shaderToyView(view); context->setContextProperty("shaderToy", &shaderToyView); view->setSource(SailfishApp::pathTo("qml/shadertoy.qml")); view->show(); return app->exec(); }
int main(int argc, char *argv[]) { QGuiApplication *app = new QGuiApplication(argc, argv); QQuickView *view = new QQuickView; qmlRegisterSingletonType<Mpris>("org.nemomobile.qtmpris", 1, 0, "Mpris", Mpris::api_factory); qmlRegisterType<MprisPlayer>("org.nemomobile.qtmpris", 1, 0, "MprisPlayer"); view->setSource(app->applicationDirPath().append("/../qml/player.qml")); view->show(); int retVal = app->exec(); return retVal; }
int main(int argc, char **argv) { QGuiApplication app (argc, argv); app.setOrganizationName("SfietKonstantin"); app.setApplicationName("qfb-demo"); Bridge bridge; QQuickView view; view.engine()->addImportPath(IMPORT_PATH); view.rootContext()->setContextProperty("BRIDGE", &bridge); view.setSource(QUrl(MAIN_QML_FILE)); view.show(); return app.exec(); }
int main(int argc, char *argv[]) { QGuiApplication* app = SailfishApp::application(argc, argv); QQuickView* view = SailfishApp::createView(); Settings* settings = new Settings("harbour-badvoltage", "BadVoltage"); FileDownloader* downloader = new FileDownloader(settings); QObject::connect(app, SIGNAL(aboutToQuit()), downloader, SLOT(doEnd())); QObject::connect(app, SIGNAL(aboutToQuit()), settings, SLOT(sync())); view->rootContext()->setContextProperty("settings", settings); view->rootContext()->setContextProperty("downloader", downloader); view->setSource(SailfishApp::pathTo("qml/harbour-badvoltage.qml")); view->show(); 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 // // To display the view, call "show()" (will show fullscreen on device). QGuiApplication* app = SailfishApp::application(argc, argv); QQuickView* view = SailfishApp::createView(); view->setSource(SailfishApp::pathTo("qml/harbour-littlerace.qml")); view->show(); QObject::connect((QObject*)view->engine(), SIGNAL(quit()), app, SLOT(quit())); return app->exec(); //return SailfishApp::main(argc, argv); }
int main(int argc, char *argv[]) { Q_INIT_RESOURCE(preload); QGuiApplication app (argc, argv); if (app.arguments().count() != 2) { return 10; } QmlModule::registerTypes(); QString source = app.arguments().at(1); QmlRuntime::Ptr runtime (QmlRuntimeFactory::create()); bool preloaded = runtime->preload(QUrl(QLatin1String("qrc:/preload.qml"))); Q_ASSERT(preloaded); Q_UNUSED(preloaded); runtime->execute(QUrl(source)); return app.exec(); }
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 = SailfishApp::application(argc, argv); QQuickView *view = SailfishApp::createView(); QCoreApplication::setOrganizationName("ruedigergad.com"); QCoreApplication::setOrganizationDomain("ruedigergad.com"); QCoreApplication::setApplicationName("SkippingStones"); qmlRegisterType<BtConnector>("harbour.skippingstones", 1, 0, "BtConnector"); qmlRegisterType<BtMessage>("harbour.skippingstones", 1, 0, "BtMessage"); qmlRegisterType<DbusAdapter>("harbour.skippingstones", 1, 0, "DbusAdapter"); qmlRegisterType<FileSystemHelper>("harbour.skippingstones", 1, 0, "FileSystemHelper"); qmlRegisterType<SettingsAdapter>("harbour.skippingstones", 1, 0, "SettingsAdapter"); view->setSource(QUrl("/usr/share/harbour-skippingstones/qml/main.qml")); view->show(); 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 // // To display the view, call "show()" (will show fullscreen on device). QGuiApplication *app = SailfishApp::application(argc, argv); QQuickView *view = SailfishApp::createView(); view->rootContext()->setContextProperty("Base64", new Base64); view->rootContext()->setContextProperty("FileUtils", new FileUtils); view->rootContext()->setContextProperty("ImageUtils", new ImageUtils); view->setSource(SailfishApp::pathTo("qml/cordova-sailfish.qml")); view->show(); return app->exec(); }
int main(int argc, char *argv[]) { qmlRegisterUncreatableType<DataRepositoryObject>("harbour.twablet", 1, 0, "DataRepository", QLatin1String("Uncreatable")); qmlRegisterUncreatableType<IModel>("harbour.twablet", 1, 0, "Model", QLatin1String("Uncreatable")); qmlRegisterUncreatableType<AccountObject>("harbour.twablet", 1, 0, "Account", QLatin1String("Uncreatable")); qmlRegisterUncreatableType<LayoutObject>("harbour.twablet", 1, 0, "Layout", QLatin1String("Uncreatable")); qmlRegisterUncreatableType<QueryObject>("harbour.twablet", 1, 0, "Query", QLatin1String("Uncreatable")); qmlRegisterUncreatableType<TweetObject>("harbour.twablet", 1, 0, "Tweet", QLatin1String("Uncreatable")); qmlRegisterUncreatableType<UserObject>("harbour.twablet", 1, 0, "User", QLatin1String("Uncreatable")); qmlRegisterUncreatableType<MediaObject>("harbour.twablet", 1, 0, "Media", QLatin1String("Uncreatable")); qmlRegisterUncreatableType<MediaModel>("harbour.twablet", 1, 0, "MediaModel", QLatin1String("Uncreatable")); qmlRegisterUncreatableType<AbstractQueryItem>("harbour.twablet", 1, 0, "QueryItem", QLatin1String("Uncreatable")); qmlRegisterType<TwitterAuthentification>("harbour.twablet", 1, 0, "TwitterAuthentification"); qmlRegisterType<AccountModel>("harbour.twablet", 1, 0, "AccountModel"); qmlRegisterType<AccountSelectionModel>("harbour.twablet", 1, 0, "AccountSelectionModel"); qmlRegisterType<LayoutModel>("harbour.twablet", 1, 0, "LayoutModel"); qmlRegisterType<TweetModel>("harbour.twablet", 1, 0, "TweetModel"); qmlRegisterType<QueryListModel>("harbour.twablet", 1, 0, "QueryListModel"); qmlRegisterType<TweetQueryItem>("harbour.twablet", 1, 0, "TweetQueryItem"); qmlRegisterType<UserQueryItem>("harbour.twablet", 1, 0, "UserQueryItem"); qmlRegisterType<DescriptionFormatter>("harbour.twablet", 1, 0, "DescriptionFormatter"); qmlRegisterType<TweetFormatter>("harbour.twablet", 1, 0, "TweetFormatter"); qmlRegisterSingletonType<DataRepositoryObject>("harbour.twablet", 1, 0, "Repository", [](QQmlEngine *e, QJSEngine *) -> QObject * { return new DataRepositoryObject(e); }); #ifndef DESKTOP return SailfishApp::main(argc, argv); #else QGuiApplication app {argc, argv}; QQuickView view {}; view.setSource(QUrl(QLatin1String("qrc:/qml/harbour-twablet.qml"))); view.setResizeMode(QQuickView::SizeRootObjectToView); view.show(); return app.exec(); #endif }
Q_DECL_EXPORT int main(int argc, char *argv[]) { #if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) QScopedPointer<QApplication> app(createApplication(argc, argv)); QZXing::registerQMLTypes(); QmlApplicationViewer viewer; viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); qmlRegisterType<DropArea>("DropArea", 1, 0, "DropArea"); viewer.setMainQmlFile(QLatin1String("qml/QZXingTestApp/main_QtQuick1.qml")); #else QGuiApplication* app = new QGuiApplication(argc, argv); QZXing::registerQMLTypes(); QtQuick2ApplicationViewer viewer; viewer.setMainQmlFile(QStringLiteral("qml/QZXingTestApp/main_QtQuick2.qml")); #endif viewer.showExpanded(); return app->exec(); }
int main(int argc, char *argv[]) { qmlRegisterType<DiskCache, 1>("harbour.toomiich.DiskCache", 1, 0, "DiskCache"); qmlRegisterType<Oledify, 1>("harbour.toomiich.Oledify", 1, 0, "Oledify"); qmlRegisterType<PersistentTimer, 1>("harbour.toomiich.PersistentTimer", 1, 0, "PersistentTimer"); qmlRegisterType<DeclarativeDBusInterface, 1>("harbour.toomiich.DBusInterface", 1, 0, "DBusInterface"); qmlRegisterType<DeclarativeDBusAdaptor, 1>("harbour.toomiich.DBusAdaptor", 1, 0, "DBusAdaptor"); qmlRegisterType<TzDateParser, 1>("harbour.toomiich.TzDateParser", 1, 0, "TzDateParser"); qmlRegisterType<HtmlListModel, 1>("harbour.toomiich.HtmlListModel", 1, 0, "HtmlListModel"); qmlRegisterType<HtmlRole, 1>("harbour.toomiich.HtmlListModel", 1, 0, "HtmlRole"); int result = 0; QGuiApplication *app = SailfishApp::application(argc, argv); QQuickView *view = SailfishApp::createView(); view->engine()->addImageProvider(QLatin1String("cache"), new DiskCacheImageProvider(QQuickImageProvider::ForceAsynchronousImageLoading)); QString qml = QString("qml/harbour-toomiich.qml"); view->setSource(SailfishApp::pathTo(qml)); view->show(); result = app->exec(); delete view; delete app; return result; }
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(); }
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; }