Esempio n. 1
0
int main( int argc, char** argv )
{
    QApplication app( argc, argv );
    
#if defined( Q_OS_MAC ) || defined( Q_OS_WIN )
    const QFileInfo themes( QString::fromUtf8( QICON_THEMES_PATH ) );
    
    if ( themes.exists() ) {
        QStringList paths = QIcon::themeSearchPaths();
        paths << themes.absoluteFilePath();
        QIcon::setThemeSearchPaths( paths );
        QIcon::setThemeName( "oxygen" );
    }
#endif
    
    QRect rect = QRect( QPoint(), QSize( 640, 480 ) );
    rect.moveCenter( QApplication::desktop()->availableGeometry().center() );
    
    UIMain window;
    window.setGeometry( rect );
    window.showMaximized();
    window.raise();
    
    return app.exec();
}
Esempio n. 2
0
int main( int argc, char** argv )
{
    // init application
#if defined( QML_UI )
    QScopedPointer<QApplication> app( createApplication( argc, argv ) );
#else
    QScopedPointer<QApplication> app( new QApplication( argc, argv ) );
#endif
    app->setApplicationName( "Housing" );
    app->setApplicationVersion( "1.0.0" );
    app->setOrganizationDomain( "sodream.org" );
    app->setOrganizationName( "SoDream" );
	
#if !( defined( Q_OS_UNIX ) && !defined( Q_OS_MAC ) ) || defined( Q_OS_BLACKBERRY )
	const QStringList themesPaths = QIcon::themeSearchPaths()
#if defined( Q_OS_MACX )
        << QString( "%1/../../../Resources" ).arg( QApplication::applicationDirPath() )
#elif defined( Q_OS_BLACKBERRY )
        << QApplication::applicationDirPath()
#else
        << QApplication::applicationDirPath()
#endif
	;
	
	QIcon::setThemeSearchPaths( themesPaths );
	QIcon::setThemeName( "Oxygen" );
#endif
	
    app->setWindowIcon( QIcon::fromTheme( "go-home" ) );
    
    const QStringList paths = QStringList()
        << QLibraryInfo::location( QLibraryInfo::TranslationsPath )
        << QFileInfo( __FILE__ ).absolutePath().append( "/../translations" )
#if defined( Q_OS_MACX )
        << QString( "%1/../../../translations" ).arg( QApplication::applicationDirPath() )
#else
        << QString( "%1/translations" ).arg( QApplication::applicationDirPath() )
#endif
    ;
    
    pTranslationManager* translationManager = pTranslationManager::instance();
    translationManager->setFakeCLocaleEnabled( true );
	translationManager->addTranslationsMask( "qt*.qm" );
	translationManager->addTranslationsMask( "fresh*.qm" );
	translationManager->addTranslationsMask( "housing*.qm" );
	translationManager->addForbiddenTranslationsMask( "qt_help*.qm" );
	translationManager->setCurrentLocale( QLocale::system().name() );
    translationManager->setTranslationsPaths( paths );
    translationManager->reloadTranslations();
    
    // register drivers
    AbstractHousingDriver::registerDriver( new SeLogerHousingDriver );

    // init main window
#if defined( DESKTOP_UI ) || defined( MOBILE_UI )
    UIMain w;
    w.setWindowTitle( app->applicationName() );
    w.showMaximized();
#elif defined( QML_UI )
    QmlApplicationViewer viewer;
    viewer.addImportPath(fixedPath("modules")); // ADDIMPORTPATH
    viewer.addImportPath("/opt/Qt4.8.4/imports"); // ADDIMPORTPATH
    viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); // ORIENTATION
    viewer.setMainQmlFile(fixedPath("qml/main.qml")); // MAINQML
    viewer.showExpanded();
#endif

    // run application
    QObject::connect( app.data(), SIGNAL( lastWindowClosed() ), app.data(), SLOT( quit() ) );
    return app->exec();
}