Q_DECL_EXPORT int main(int argc, char *argv[]) { #ifdef MEEGO_EDITION_HARMATTAN QApplication *app = MDeclarativeCache::qApplication(argc, argv); QDeclarativeView *view = MDeclarativeCache::qDeclarativeView(); #else QApplication *app = new QApplication(argc, argv); QDeclarativeView *view = new QDeclarativeView(); QDeclarativeView *aboutview = new QDeclarativeView(); #endif #ifdef Q_WS_MAEMO_5 view->setAttribute(Qt::WA_Maemo5LandscapeOrientation); view->setAttribute(Qt::WA_Maemo5NonComposited); view->connect(view->engine(), SIGNAL(quit()), SLOT(close())); #endif // For QSettings QCoreApplication::setOrganizationName("AnttiPohjola"); QCoreApplication::setApplicationName("Nine Men's Morris"); /* #ifndef Q_WS_MAEMO_5 // Qt 4.7.0 doesn't have qsTrId() support in QML GConfClient *gconf = gconf_client_get_default(); QString locale = gconf_client_get_string(gconf, "/meegotouch/i18n/region", NULL); QTranslator translator; if (translator.load("qmuehle_" + locale, "/usr/share/l10n/meegotouch")) app->installTranslator(&translator); else qDebug() << "Failed to load translation" << ("/usr/share/l10n/meegotouch/qmuehle_" + locale +".qm"); #endif */ // Export the Game and Settings classes through the Muehle 1.0 QML module qmlRegisterType<Game>("Muehle", 1, 0, "Game"); qmlRegisterType<HistoryModel>("Muehle", 1, 0, "HistoryModel"); qmlRegisterType<Settings>("Muehle", 1, 0, "Settings"); view->setSource(QUrl("qrc:/qml/main.qml")); aboutview->setSource(QUrl("qrc:/qml/AboutPage.qml")); ViewController* controller = new ViewController(view, aboutview); //"image://myimageprovider/image.png" view->engine()->addImageProvider("boardicons", new BoardIconProvider()); // FIXME - for now, don't show fullscreen if screen height >= 800 or width >= 1024 /* QRect screenGeometry=QApplication::desktop()->screenGeometry(); if((screenGeometry.height()<800) && (screenGeometry.width()<1024)) view->showFullScreen(); else view->show(); */ view->showFullScreen(); return app->exec(); }
int main( int argc, char** argv ) { QApplication app( argc, argv ); Config* config = new Config( &app ); // If we can't process the command-line or set up the database // there's no point continuing if ( !processCommandLine() || !setupDatabase() ) return 0; QDeclarativeView view; view.connect( view.engine(), SIGNAL(quit()), SLOT(close()) ); view.setResizeMode( QDeclarativeView::SizeRootObjectToView ); // Register custom types for access to certail enums from QML qmlRegisterType< SoundEngine >( "net.randalflagg.llamaui", 1, 0, "SoundEngine" ); qmlRegisterType< KeyboardMap >( "net.randalflagg.llamaui", 1, 0, "KeyboardMap" ); qmlRegisterType< SystemProcess >( "net.randalflagg.llamaui", 1, 0, "SystemProcess" ); QDeclarativeContext* rootContext = view.rootContext(); // Initalise the keyboard key/action mapper if ( !initKeyboardMap( rootContext ) ) return 0; rootContext->setContextProperty( "config", config ); initSoundEngine( rootContext ); initGameMenu( rootContext ); initEmulatorMenu( rootContext ); initSystemMenu( rootContext ); initGameLauncher( rootContext ); // Create the interface QDir dir( Config::instance()->value( "paths", "qmlDir" ).toString() ); view.setSource( QUrl::fromLocalFile( dir.absoluteFilePath( "main.qml" ) ) ); view.showFullScreen(); // Hide the mouse cursor app.setOverrideCursor( QCursor( Qt::BlankCursor ) ); return app.exec(); }