Q_DECL_EXPORT int main(int argc, char *argv[]) { QScopedPointer<QApplication> app(createApplication(argc, argv)); QFile file("D:\\pureclean.txt"); if (file.exists()){file.remove();} //qInstallMsgHandler(myMessageHandler); //QCoreApplication::setAttribute(Qt::AA_S60DisablePartialScreenInputMode, true); QTranslator myTranslator; myTranslator.load("bellecleaner_" + QLocale::system().name()); app.data()->installTranslator(&myTranslator); //qt_s60_setPartialScreenAutomaticTranslation(false); //qt_s60_setPartialScreenInputMode(true); QmlApplicationViewer viewer; qmlRegisterType<DeleteItem>("App", 1,0,"DeleteItem"); Application* a=new Application(); FileModel fileModel; viewer.rootContext()->setContextProperty("fileModel", &fileModel); viewer.rootContext()->setContextProperty("application",a); //viewer.rootContext()->setContextProperty("mymodel",QVariant::fromValue(a->getCategoryModel())); viewer.setMainQmlFile(QLatin1String("qml/PureClean/main.qml")); viewer.showExpanded(); return app->exec(); }
MuseBox::MuseBox(QWidget *parent) : QMainWindow(parent) { //TODO add a splash screen here? would be totally fun! qmlRegisterType<TrackArrangementBackground>("TrackArrangement",1,0,"TrackArrangementBackground"); qmlRegisterType<CursorRuler>("TrackArrangement",1,0,"CursorRuler"); qmlRegisterType<PatternModel>("DataModel",1,0,"PatternModel"); qmlRegisterType<NoteModel>("DataModel",1,0,"NoteModel"); qmlRegisterType<PatternDisplay>("TrackArrangement",1,0,"PatternDisplay"); qmlRegisterType<PatternNoteDisplay>("TrackArrangement",1,0,"PatternNoteDisplay"); QmlApplicationViewer *view = new QmlApplicationViewer(); view->rootContext()->setContextProperty("musebox", this); view->rootContext()->setContextProperty("trackModel", &this->trackModel); view->setSource(QUrl::fromLocalFile("qml/MuseBox/main.qml")); view->setResizeMode(QDeclarativeView::SizeRootObjectToView); QGLFormat format = QGLFormat::defaultFormat(); format.setSampleBuffers(false); QGLWidget *glWidget = new QGLWidget(format); glWidget->setAutoFillBackground(false); view->setViewport(glWidget); setCentralWidget(view); Hardware::Init(); view->rootContext()->setContextProperty("transposeMachine", Hardware::TransposeMachine); Hardware::StartAudio(); }
Q_DECL_EXPORT int main(int argc, char *argv[]) { QApplication *lApplication = createApplication(argc, argv); QmlApplicationViewer *lView = QmlApplicationViewer::create(); QVariantList lLevelList; createAllLevels(lLevelList); lView->rootContext()->setContextProperty(QLatin1String("gLevels"), lLevelList); QNetworkAccessManager lNetworkManager; LevelModel *lLevelModel = new LevelModel(lLevelList.count(), &lNetworkManager, lApplication); lView->rootContext()->setContextProperty(QLatin1String("gLevelModel"), lLevelModel); HighScoresModel *lHighScoresModel = new HighScoresModel(lApplication); lView->rootContext()->setContextProperty(QLatin1String("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->setMainQmlFile(QLatin1String("qml/Game.qml")); lView->showFullScreen(); return lApplication->exec(); }
Q_DECL_EXPORT int main(int argc, char *argv[]) { QScopedPointer<QApplication> App(createApplication(argc, argv)); QTranslator Translator; if (!Translator.load("tr_"+QLocale::system().name(), ":/i18n")) Translator.load("tr_en", ":/i18n"); App->installTranslator(&Translator); ConTranslator ConsoleMsgs; ConsoleMsgs.load("conmsgs", ":/i18n"); App->installTranslator(&ConsoleMsgs); IconProvider::SetToCurrentSystemTheme(); Context Ctx(argc, argv); ScopedIntercomHandler Intercom; if (Ctx.IfExit()) return Intercom->GetExitCode(); { ModesModel ModesList(Ctx.CheckMode(), Ctx.CheckMode()==RunModes::PRINT); UsersModel UsersList(Ctx.GetTargetUser(), Ctx.CheckMode()==RunModes::PRINT); DesktopModel AppList; PswTools PassCheck; QmlApplicationViewer Viewer; qmlRegisterUncreatableType<RunModes>("com.lcferrum.hmtsu", 1, 0, "RunModes", "Exports RunModes enum to QML"); Viewer.engine()->addImageProvider("icon", new IconProvider()); //It is QDeclarativeEngine's responsibility to destroy added image providers Viewer.rootContext()->setContextProperty("objModesList", &ModesList); Viewer.rootContext()->setContextProperty("objUsersList", &UsersList); Viewer.rootContext()->setContextProperty("objAppList", &AppList); Viewer.rootContext()->setContextProperty("objContext", &Ctx); Viewer.rootContext()->setContextProperty("objIntercom", &Intercom); Viewer.rootContext()->setContextProperty("objPassCheck", &PassCheck); Viewer.rootContext()->setContextProperty("HMTSU_VERSION_STRING", HMTSU_VERSION_STRING IF_DEBUG(" (DEBUG)")); Viewer.rootContext()->setContextProperty("HMTSU_COPYRIGHT_STRING", HMTSU_COPYRIGHT_STRING); Viewer.rootContext()->setContextProperty("CANCELED_EXIT_CODE", CANCELED_EXIT_CODE); Viewer.rootContext()->setContextProperty("DENIED_EXIT_CODE", DENIED_EXIT_CODE); Viewer.rootContext()->setContextProperty("NORMAL_EXIT_CODE", NORMAL_EXIT_CODE); Viewer.rootContext()->setContextProperty("MAX_PSW_ATTEMPTS", MAX_PSW_ATTEMPTS); Viewer.setSource(QUrl("qrc:/main.qml")); Viewer.showExpanded(); App->exec(); } Ctx.Run(); return Intercom->GetExitCode(); }
int main(int argc, char *argv[]) { QApplication app(argc, argv); QmlApplicationViewer viewer; RomFilter filter; // = new RomFilter(); viewer.rootContext()->setContextProperty("romModel", filter.model()); viewer.rootContext()->setContextProperty("romFilter", &filter); viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); viewer.setMainQmlFile(QLatin1String("qml/qmlSelector/main.qml")); viewer.showExpanded(); return app.exec(); }
//Main Q_DECL_EXPORT int main(int argc, char *argv[]) { QScopedPointer<QApplication> app(createApplication(argc, argv)); QmlApplicationViewer viewer; //system("sudo ifup wlan0"); Downloader d; d.doDownload("http://www.vesta-tab.com/jo/showId.php"); Object data; viewer.setCursor(Qt::BlankCursor); viewer.rootContext()->setContextProperty("image", &data); viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); //viewer.setMainQmlFile("qrc:/main.qml"); viewer.setSource(QUrl("qrc:/qml/BBB/main.qml")); viewer.showFullScreen(); return app->exec(); }
Q_DECL_EXPORT int main(int argc, char *argv[]) { #if defined(Q_OS_SYMBIAN) int platformId = 0; #elif defined(Q_WS_MAEMO_5) int platformId = 1; #elif defined(Q_WS_MAEMO_6) int platformId = 2; #elif defined(QT_WS_SIMULATOR) int platformId = 3; #elif defined(QT_SIMULATOR) int platformId = 4; #elif defined(Q_OS_MAC64) int platformId = 5; #elif defined(Q_WS_MEEGO) int platformId = 6; #else // desktop probably int platformId = 99; #endif QScopedPointer<QApplication> app(createApplication(argc, argv)); QmlApplicationViewer viewer; viewer.rootContext()->setContextProperty("platform", platformId); viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); viewer.setMainQmlFile(QLatin1String("qml/landedsettings21/main.qml")); viewer.showExpanded(); return app->exec(); }
Q_DECL_EXPORT int main(int argc, char *argv[]) { QScopedPointer<QApplication> app(createApplication(argc, argv)); app.data()->setOrganizationName("sardini"); app.data()->setApplicationName("freeboxremote"); Style style; SettingsManager settingsManager; QmlApplicationViewer viewer; viewer.rootContext()->setContextProperty("STYLE", &style); viewer.rootContext()->setContextProperty("SETTINGS_MANAGER", &settingsManager); viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); viewer.setMainQmlFile(QLatin1String("qml/main.qml")); viewer.showExpanded(); return app->exec(); }
Q_DECL_EXPORT int main(int argc, char *argv[]) { bool simulator = isSimulator(); //expose an enum of operating systems types to QML qmlRegisterUncreatableType<OperatingSystem>("OperatingSystem", 1, 0, "OperatingSystem", ""); int OperatingSystemId = getOperatingSystem(); //expose an enum of windowing system types to QML qmlRegisterUncreatableType<WindowingSystem>("WindowingSystem", 1, 0, "WindowingSystem", ""); int WindowingSystemId = getWindowingSystem(); /* QT Simulator running on OSX gives: simulator is : true operating system is : Mac64 --> Q_OS_MAC64 windowing system is : Simulator --> Q_WS_SIMULATOR) SailfishOS Emulator hosted on OSX gives: simulator is : false operating system is : Unix --> Q_OS_UNIX windowing system is : X11 --> Q_WS_X11 Nokia N9 Harmattan gives: simulator is : false operating system is : Unix --> Q_OS_UNIX windowing system is : X11 --> Q_WS_X11 */ QScopedPointer<QApplication> app(createApplication(argc, argv)); qmlRegisterType<TelepathyHelper>("TelepathyHelper",1,0,"TelepathyHelper"); qmlRegisterType<LandedTorch>("LandedTorch",1,0,"LandedTorch"); qmlRegisterType<SatInfoSource>("SatInfoSource",1,0,"SatInfoSource"); QmlApplicationViewer viewer; viewer.rootContext()->setContextProperty("OperatingSystemId", OperatingSystemId); viewer.rootContext()->setContextProperty("WindowingSystemId", WindowingSystemId); viewer.rootContext()->setContextProperty("simulator", simulator); viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); viewer.setMainQmlFile(QLatin1String("qml/landed25/main.qml")); viewer.showExpanded(); return app->exec(); }
void TemplateManager::initialize(QmlApplicationViewer& viewer, const QString& modelName, FriendsManager* friendManager) { Manager::initialize(viewer, modelName); connectWithFriendManager(friendManager); //настроить фильр tuneFilterProxy(); //зарегистрировать фильтр viewer.rootContext()->setContextProperty(modelName + "Proxy", templateFilterProxy); }
Q_DECL_EXPORT int main(int argc, char *argv[]) { QScopedPointer<QApplication> app(createApplication(argc, argv)); ImageProvider engine; QmlApplicationViewer viewer; viewer.rootContext()->setContextProperty("imageengine",(QObject*)&engine); viewer.engine()->addImageProvider(QLatin1String("sortedimages"),&engine); viewer.setMainQmlFile(QLatin1String("qml/Imagesort/main.qml")); viewer.showExpanded(); return app->exec(); }
int main(int argc, char *argv[]) { QApplication app(argc, argv); app.setApplicationName("imgrup"); app.setApplicationVersion("0.0.4a"); app.setOrganizationName("ZogG"); Upload upload_img; Gallery gallery_req; Tools extra_tools; QmlApplicationViewer viewer; // viewer.setResizeMode(QmlApplicationViewer::SizeRootObjectToView); viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockPortrait); viewer.rootContext()->setContextProperty("uploader",&upload_img); viewer.rootContext()->setContextProperty("gallery_req",&gallery_req); viewer.rootContext()->setContextProperty("shareit",&extra_tools); QResource::registerResource("imgrup.qrc"); viewer.setMainQmlFile(QLatin1String("qml/imgrup/main.qml")); viewer.showExpanded(); return app.exec(); }
Q_DECL_EXPORT int main(int argc, char *argv[]) { QScopedPointer<QApplication> app(createApplication(argc, argv)); ServerComm sc; QmlApplicationViewer viewer; viewer.rootContext()->setContextProperty("serverComm", &sc); viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); viewer.setMainQmlFile(QLatin1String("qml/CuteSoma/main.qml")); viewer.showExpanded(); return app->exec(); }
Q_DECL_EXPORT int main(int argc, char *argv[]) { QScopedPointer<QApplication> app(createApplication(argc, argv)); QmlApplicationViewer viewer; QDeclarativeContext *ctxt = viewer.rootContext(); ctxt->setContextProperty("KipptConnector", new KipptConnector()); viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); viewer.setMainQmlFile(QLatin1String("qml/klippr/main.qml")); viewer.showExpanded(); return app->exec(); }
int main(int argc, char *argv[]) { QApplication app(argc, argv); QmlApplicationViewer viewer; QDirModel model; viewer.rootContext()->setContextProperty( "dirModel", &model); viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); viewer.setMainQmlFile(QLatin1String("qml/qdirmodel/main.qml")); viewer.showExpanded(); return app.exec(); }
Q_DECL_EXPORT int main(int argc, char *argv[]) { QScopedPointer<QApplication> app(createApplication(argc, argv)); MusicShaker *shaker = new MusicShaker(); qWarning() << shaker; QmlApplicationViewer viewer; viewer.rootContext()->setContextProperty("shaker", shaker); viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); viewer.setMainQmlFile(QLatin1String("qml/musicshaker/main.qml")); viewer.showExpanded(); return app->exec(); }
Q_DECL_EXPORT int main(int argc, char *argv[]) { QScopedPointer<QApplication> app(createApplication(argc, argv)); app->setApplicationName("Quickddit"); app->setOrganizationName("Quickddit"); app->setApplicationVersion(APP_VERSION); qmlRegisterType<AppSettings>("Quickddit.Core", 1, 0, "AppSettings"); qmlRegisterType<QuickdditManager>("Quickddit.Core", 1, 0, "QuickdditManager"); qmlRegisterType<LinkModel>("Quickddit.Core", 1, 0, "LinkModel"); qmlRegisterType<CommentModel>("Quickddit.Core", 1, 0, "CommentModel"); qmlRegisterType<SubredditModel>("Quickddit.Core", 1, 0, "SubredditModel"); qmlRegisterType<AboutSubredditManager>("Quickddit.Core", 1, 0, "AboutSubredditManager"); qmlRegisterType<MultiredditModel>("Quickddit.Core", 1, 0, "MultiredditModel"); qmlRegisterType<AboutMultiredditManager>("Quickddit.Core", 1, 0, "AboutMultiredditManager"); qmlRegisterType<MessageModel>("Quickddit.Core", 1, 0, "MessageModel"); qmlRegisterType<MessageManager>("Quickddit.Core", 1, 0, "MessageManager"); qmlRegisterType<ImgurManager>("Quickddit.Core", 1, 0, "ImgurManager"); qmlRegisterType<VoteManager>("Quickddit.Core", 1, 0, "VoteManager"); qmlRegisterType<CommentManager>("Quickddit.Core", 1, 0, "CommentManager"); qmlRegisterType<CaptchaManager>("Quickddit.Core", 1, 0, "CaptchaManager"); qmlRegisterType<LinkManager>("Quickddit.Core", 1, 0, "LinkManager"); QmlApplicationViewer viewer; viewer.rootContext()->setContextProperty("APP_VERSION", APP_VERSION); QMLUtils qmlUtils; viewer.rootContext()->setContextProperty("QMLUtils", &qmlUtils); viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); viewer.setMainQmlFile(QLatin1String("qml/quickddit/main.qml")); viewer.showExpanded(); return app->exec(); }
Q_DECL_EXPORT int main(int argc, char *argv[]) { QScopedPointer<QApplication> app(createApplication(argc, argv)); QDir::setCurrent(QCoreApplication::applicationDirPath()); App application; qmlRegisterType<App>("App", 1, 0, "App"); qmlRegisterType<CollectionModel>("CollectionModel", 1, 0, "CollectionModel"); qmlRegisterType<QStringListModel>("QStringListModel", 1, 0, "QStringListModel"); QmlApplicationViewer viewer; viewer.setWindowIcon(QIcon(":/new/g/dictionary-icon.png")); viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); viewer.rootContext()->setContextProperty("app", &application); viewer.rootContext()->setContextProperty("checkModeCpp", &application.getCheckMode()); viewer.rootContext()->setContextProperty("dictionaryModeCpp", &application.getDictionaryMode()); viewer.rootContext()->setContextProperty("rememberModeCpp", &application.getRememberMode()); viewer.setMainQmlFile(QLatin1String("qml/main.qml")); viewer.showExpanded(); return app->exec(); }
Q_DECL_EXPORT int main(int argc, char *argv[]) { QScopedPointer<QApplication> app(createApplication(argc, argv)); QmlApplicationViewer viewer; viewer.addImportPath(QLatin1String("imports")); viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockPortrait); #ifdef Q_OS_BLACKBERRY Scoreloop scoreloop; viewer.rootContext()->setContextProperty("scoreloop", &scoreloop); #endif viewer.setSource(QUrl("qrc:/qml/game/main.qml")); viewer.showExpanded(); return app->exec(); }
Q_DECL_EXPORT int main(int argc, char *argv[]) { QScopedPointer<QApplication> app(createApplication(argc, argv)); manager mn; QmlApplicationViewer viewer; viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); app->setStartDragDistance(20); viewer.rootContext()->setContextProperty("mn", &mn); viewer.setMainQmlFile(QLatin1String("qml/hildonComponentsTest/main.qml")); viewer.showFullScreen(); return app->exec(); }
Q_DECL_EXPORT int main(int argc, char *argv[]) { QScopedPointer<QApplication> app(createApplication(argc, argv)); connection theconnection; QmlApplicationViewer viewer; viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); viewer.setMainQmlFile(QLatin1String("qml/mynewmousec/main.qml")); viewer.rootContext()->setContextProperty("connection",&theconnection); viewer.showExpanded(); return app->exec(); }
Q_DECL_EXPORT int main(int argc, char *argv[]) { QScopedPointer<QApplication> app(createApplication(argc, argv)); QmlApplicationViewer viewer; viewer.setAttribute(Qt::WA_LockPortraitOrientation); Helper helper; viewer.setResizeMode(QDeclarativeView::SizeRootObjectToView); viewer.rootContext()->setContextProperty("Helper", &helper); viewer.setAttribute(Qt::WA_OpaquePaintEvent); viewer.setAttribute(Qt::WA_NoSystemBackground); viewer.viewport()->setAttribute(Qt::WA_OpaquePaintEvent); viewer.viewport()->setAttribute(Qt::WA_NoSystemBackground); viewer.setSource(QUrl("qrc:/qml/main.qml")); viewer.showFullScreen(); return app->exec(); }
int main(int argc, char *argv[]) { QApplication app(argc, argv); QmlApplicationViewer viewer; LeoEngine* mdl = new LeoEngine; viewer.rootContext()->setContextProperty("leoEngine", mdl); viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); viewer.setMainQmlFile(QLatin1String("qml/leoqviewer/main.qml")); viewer.showExpanded(); //LeoqDb* db = new LeoqDb(); //db->openDb("/home/ville/treefrag.db"); //db->childNodes(0); return app.exec(); }
Q_DECL_EXPORT int main(int argc, char *argv[]) { QScopedPointer<QApplication> app(createApplication(argc, argv)); WallClockObserver *obs = new WallClockObserver(QCoreApplication::instance()); if (!QDBusConnection::systemBus().registerObject(WALLCLOCK_OBSERVER_PATH, obs, QDBusConnection::ExportAllSlots)) qWarning() << "Error registering wallclock observer on D-Bus."; QmlApplicationViewer viewer; viewer.rootContext()->setContextProperty("observer", obs); viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); viewer.setMainQmlFile(QLatin1String("qml/observer/main.qml")); viewer.showExpanded(); return app->exec(); }
//![0] int main(int argc, char ** argv) { QApplication app(argc, argv); QmlApplicationViewer viewer; AnimalModel model; model.addAnimal(Animal("Wolf", "Medium")); model.addAnimal(Animal("Polar bear", "Large")); model.addAnimal(Animal("Quoll", "Small")); QDeclarativeContext *ctxt = viewer.rootContext(); ctxt->setContextProperty("myModel", &model); //![0] viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape); viewer.setMainQmlFile(QLatin1String("qml/abstractitemmodel/view.qml")); viewer.showExpanded(); return app.exec(); }
//![0] int main(int argc, char ** argv) { QApplication app(argc, argv); QmlApplicationViewer viewer; QList<QObject*> dataList; dataList.append(new DataObject("Item 1", "red")); dataList.append(new DataObject("Item 2", "green")); dataList.append(new DataObject("Item 3", "blue")); dataList.append(new DataObject("Item 4", "yellow")); QDeclarativeContext *ctxt = viewer.rootContext(); ctxt->setContextProperty("myModel", QVariant::fromValue(dataList)); //![0] viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); viewer.setMainQmlFile(QLatin1String("qml/objectlistmodel/view.qml")); viewer.showExpanded(); return app.exec(); }
Q_DECL_EXPORT int main(int argc, char *argv[]) { QScopedPointer<QApplication> app(createApplication(argc, argv)); QmlApplicationViewer viewer; CDownLoadFile data; qmlRegisterType<ShareCommand>("ShareCommand", 1, 0, "ShareCommand"); viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockPortrait); viewer.rootContext()->setContextProperty("ApplicationData", &data); viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockPortrait); viewer.setMainQmlFile(QLatin1String("qml/vn9/main.qml")); viewer.showExpanded(); QDeclarativeView window; window.setAttribute(Qt::WA_OpaquePaintEvent); window.setAttribute(Qt::WA_NoSystemBackground); window.viewport()->setAttribute(Qt::WA_OpaquePaintEvent); window.viewport()->setAttribute(Qt::WA_NoSystemBackground); return app->exec(); }
Q_DECL_EXPORT int main(int argc, char *argv[]) { QScopedPointer<QApplication> app(createApplication(argc, argv)); QString locale = QLocale::system().name(); QTranslator translator; if (!translator.load(QLatin1String("tr_") + locale, QLatin1String(":/"))) { translator.load(QLatin1String("tr_en"), QLatin1String(":/")); } app->installTranslator(&translator); QmlApplicationViewer viewer; RygelSettings settings; FocusEventFilter focusEventFilter(&settings); QDeclarativeContext *root = viewer.rootContext(); root->setContextProperty(QLatin1String("upnpSettings"), &settings); viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockPortrait); viewer.setMainQmlFile(QLatin1String("qml/TweakUp/main.qml")); viewer.installEventFilter(&focusEventFilter); viewer.showExpanded(); return app->exec(); }
Q_DECL_EXPORT int main(int argc, char *argv[]) { QScopedPointer<QApplication> app(createApplication(argc, argv)); QmlApplicationViewer viewer; viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); QDir dir = QDir(QDir::home()); dir.cd("Videos"); dir.setFilter(QDir::Files); QStringList entries = dir.entryList(); QDeclarativeContext *ctxt = viewer.rootContext(); ctxt->setContextProperty("filesModel", QVariant::fromValue(entries)); ctxt->setContextProperty("filesRoot", QVariant::fromValue(dir.absolutePath())); QPixmap nullCursor(16, 16); nullCursor.fill(Qt::transparent); // QApplication::setOverrideCursor(QCursor(nullCursor)); viewer.setMainQmlFile(QLatin1String("qml/nakkikioski/main.qml")); viewer.setResizeMode(QDeclarativeView::SizeRootObjectToView); viewer.showExpanded(); viewer.showFullScreen(); return app->exec(); }
int main(int argc, char *argv[]) { QScopedPointer<QApplication> app(createApplication(argc, argv)); #ifdef Q_OS_SYMBIAN // Translation for NFC Status messages QString locale = QLocale::system().name(); QTranslator translator; translator.load(QString("nfcinteractor_") + locale); app->installTranslator(&translator); QTextCodec::setCodecForTr(QTextCodec::codecForName("utf8")); #endif // Create a variable that stores the platform, to customize the // screen appearance in QML accordingly. #if defined(Q_OS_SYMBIAN) int platformId = 0; #elif defined(MEEGO_EDITION_HARMATTAN) int platformId = 1; #elif defined(QT_SIMULATOR) int platformId = 2; #else int platformId = 3; #endif // Register the Nfc interaction classes to the QML environment qmlRegisterType<NfcInfo>("Nfc", 1, 0, "NfcInfo"); qmlRegisterType<NfcRecordModel>("Nfc", 1, 0, "NfcRecordModel"); qmlRegisterType<NfcRecordItem>("Nfc", 1, 0, "NfcRecordItem"); qmlRegisterUncreatableType<NfcTypes>("com.nfcinfo.types", 1, 0, "NfcTypes", "This exports NfcTypes enums to QML"); // Setup QML Viewer QmlApplicationViewer viewer; viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); viewer.rootContext()->setContextProperty("platform", platformId); // On MeeGo, only allow activating SNEP if compiled with the library support // (not permitted otherwise). bool useSnep = true; #if defined(MEEGO_EDITION_HARMATTAN) && !defined(USE_SNEP) useSnep = false; #endif viewer.rootContext()->setContextProperty("allowSnep", QVariant(useSnep)); AppSettings* settings = new AppSettings(); // Ownership will be transferred to NfcInfo* viewer.rootContext()->setContextProperty("settings", settings); // Symbian has style constants defined in platformStyle, MeeGo has a // different system. // To minimize QML code differences between both versions, define // a customPlatformStyle here, used by both versions. // (Unfortunately it's not possible to use the original // "platformStyle" on Symbian and set a "platformStyle" on MeeGo, // because the Window already has platformStyle property, which // would have preference over setting a context property from here) QScopedPointer<QDeclarativePropertyMap> platformStyle(new QDeclarativePropertyMap()); platformStyle->insert("paddingSmall", QVariant(4)); platformStyle->insert("paddingMedium", QVariant(8)); platformStyle->insert("paddingLarge", QVariant(12)); platformStyle->insert("fontSizeSmall", QVariant(18)); platformStyle->insert("colorNormalLight", QVariant(QColor(255, 255, 255))); platformStyle->insert("colorNormalMid", QVariant(QColor(153, 153, 153))); #if defined(MEEGO_EDITION_HARMATTAN) qDebug() << "MeeGo UI platform style"; platformStyle->insert("fontFamilyRegular", QVariant(QString("Nokia Pure Text"))); platformStyle->insert("fontSizeMedium", QVariant(22)); platformStyle->insert("fontHeightMedium", QVariant(getFontHeight(QString("Nokia Pure Text"), 22))); platformStyle->insert("fontSizeLarge", QVariant(26)); #else qDebug() << "Symbian UI platform style"; platformStyle->insert("fontFamilyRegular", QVariant(QFont().defaultFamily())); platformStyle->insert("fontSizeMedium", QVariant(20)); platformStyle->insert("fontHeightMedium", QVariant(getFontHeight(QFont().defaultFamily(), 20))); platformStyle->insert("fontSizeLarge", QVariant(22)); #endif viewer.rootContext()->setContextProperty("customPlatformStyle", platformStyle.data()); // Register the image provider class to QML TagImageCache *tagImageCache = new TagImageCache(); viewer.engine()->addImageProvider(QLatin1String("nfcimageprovider"), tagImageCache); #ifdef USE_IAP // In App Purchasing qDebug() << "Using IAP"; viewer.rootContext()->setContextProperty("useIap", QVariant(true)); #if defined(Q_OS_SYMBIAN) // In App Purchasing APIs on Symbian QScopedPointer<IapManager> iapManager(new IapManager()); // Add the known items to the list // Also retrieves if the user has already purchased the items // from the internal DB, to prevent the need to go online // every time. iapManager->addIapProduct(IAP_ID_ADV_TAGS); iapManager->addIapProduct(IAP_ID_REMOVE_ADS); iapManager->addIapProduct(IAP_ID_UNLIMITED); viewer.rootContext()->setContextProperty("iapManager", iapManager.data()); viewer.rootContext()->setContextProperty("iapIdAdvTags", QVariant(IAP_ID_ADV_TAGS)); viewer.rootContext()->setContextProperty("iapIdRemoveAds", QVariant(IAP_ID_REMOVE_ADS)); viewer.rootContext()->setContextProperty("iapIdUnlimited", QVariant(IAP_ID_UNLIMITED)); #else // Unlimited version on Harmattan // No IAP APIs available -> separate product on Nokia Store #endif #else viewer.rootContext()->setContextProperty("useIap", QVariant(false)); #endif #ifdef IAP_TEST_MODE qDebug() << "IAP Test Mode"; viewer.rootContext()->setContextProperty("iapTestMode", QVariant(true)); #else viewer.rootContext()->setContextProperty("iapTestMode", QVariant(false)); #endif #ifdef USE_IAA // In App Advertising qDebug() << "Using IAA"; #if defined(Q_OS_SYMBIAN) && defined(USE_IAP) // Define the pointer here; creating it in the if would instantly // destroy it again after the if ends, but we obviously need to // keep the instance alive till the app exits. // Use a scoped pointer so that we only need to create the instance // when the user hasn't purchased the remove ads upgrade, to speed // up app startup time if he has. //QScopedPointer<AdInterface> adI; // Symbian & using IAP - only start the ad interface if the user // didn't already purchase the remove ads upgrade if (!iapManager->isProductPurchased(IAP_ID_REMOVE_ADS)) { // IAA Upgrade not purchased - use IAA //AdInterface adI; //adI.reset(new AdInterface()); //viewer.rootContext()->setContextProperty("adInterface", adI.data()); inneractivePlugin::initializeEngine(viewer.engine()); viewer.rootContext()->setContextProperty("useIaa", QVariant(true)); } else { // IAA Upgrade purchased - don't use IAA viewer.rootContext()->setContextProperty("useIaa", QVariant(false)); } #else // [Symbian and no IAP] or Harmattan //QScopedPointer<AdInterface> adI(new AdInterface()); //viewer.rootContext()->setContextProperty("adInterface", adI.data()); inneractivePlugin::initializeEngine(viewer.engine()); viewer.rootContext()->setContextProperty("useIaa", QVariant(true)); #endif #else // IAA not activated viewer.rootContext()->setContextProperty("useIaa", QVariant(false)); #endif QScopedPointer<NfcInfo> nfcInfo(new NfcInfo()); // Give the ndef manager a pointer to our declarative view, // so that it can raise the app to the foreground when an // autostart tag is touched and the app is already running. nfcInfo->setDeclarativeView(viewer); nfcInfo->setAppSettings(settings); nfcInfo->setImageCache(tagImageCache); // Pass the record model back to the QML // Could be easier to just make the model a property? viewer.rootContext()->setContextProperty("recordModel", nfcInfo->recordModel()); #ifdef USE_IAP #ifdef Q_OS_SYMBIAN // Symbian: set unlimited tags according to whether it has been purchased already nfcInfo->setUnlimitedAdvancedMsgs(iapManager->isProductPurchased(IAP_ID_ADV_TAGS) || iapManager->isProductPurchased(IAP_ID_UNLIMITED)); #else // Harmattan: set unlimited tags according to whether IAP is enabled in the .pro file. // (if it is enabled, limit tag writing. If USE_IAP isn't set, use unlimited tag writing) nfcInfo->setUnlimitedAdvancedMsgs(false); #endif #endif // Make the nfcPeerToPeer class known in the QML world viewer.rootContext()->setContextProperty("nfcInfo", nfcInfo.data()); // Finally, load the main QML file to the viewer. viewer.setMainQmlFile(QLatin1String("qml/main.qml")); viewer.showExpanded(); //nfcInfo->initAndStartNfcAsync(); //#ifdef Q_OS_SYMBIAN // // Prevent screensaver from kicking in on Symbian // QSystemScreenSaver *screensaver = new QSystemScreenSaver ( &viewer ); // screensaver->setScreenSaverInhibit(); //#endif return app->exec(); }