int main( int argc, char ** argv ) { QApplication a( argc, argv ); // dSelectDB dselectdb; dLogin dlogin; // application = &a; int rc = 1; bool ok; QPixmap pixmap; BrInitError error; QTextCodec::setCodecForCStrings( QTextCodec::codecForName("UTF8") ); aLog::init("",aLog::MT_DEBUG); #ifndef _Windows if (br_init_lib(&error) == 0 && error != BR_INIT_ERROR_DISABLED) { aLog::print(aLog::MT_INFO, QObject::tr("Warning: BinReloc failed to initialize (error code %1)\n").arg(error)); aLog::print(aLog::MT_INFO, QObject::tr("Will fallback to hardcoded default path.\n")); } aLog::print(aLog::MT_DEBUG, QObject::tr("main - BinReloc path to data dir is %1.\n").arg( br_find_data_dir("/usr/share") )); aLog::print(aLog::MT_DEBUG, QObject::tr("main - BinReloc path to lib dir is %1.\n").arg( br_find_data_dir("/usr/lib") )); #endif if ( parseCommandLine( qApp->argc(), qApp->argv() ) ) return 1; qApp->installTranslator( &tr_app ); qApp->installTranslator( &tr_lib ); qApp->installTranslator( &tr_plugins ); pixmap = QPixmap::fromMimeSource( "engine-splash-"+lang+".png" ); if ( pixmap.isNull() ) #ifdef _Windows pixmap = QPixmap::fromMimeSource( qApp->applicationDirPath()+"/engine-splash-"+lang+".png" ); qApp->addLibraryPath( qApp->applicationDirPath() ); #else pixmap = QPixmap::fromMimeSource( QString(br_find_data_dir("/usr/share") ) + "/ananas/designer/locale/engine-splash-"+lang+".png"); qApp->addLibraryPath( QString( br_find_lib_dir("/usr/lib")) + "/ananas/qt3plugins" ); QStringList list = a.libraryPaths(); QString libPath = ""; QStringList::Iterator it = list.begin(); while( it != list.end() ) { libPath += *it+":"; ++it; } aLog::print(aLog::MT_DEBUG, QString("main - qt library path is '%1'\n").arg( libPath)); #endif printf("extensions: \n%s\n",( const char *) AExtensionFactory::keys().join("\n") ); // Test create extension // AExtension *e = AExtensionFactory::create("AExtTest"); // if (e) printf("EXT OK\n"); else printf("NO EXT OK\n"); if ( pixmap.isNull() ) pixmap = QPixmap::fromMimeSource( "engine-splash-en.png" ); QSplashScreen *splash = new QSplashScreen( pixmap ); if ( ananas_login( rcfile, username, userpassword ) ){ // if ( rcfile.isEmpty() ) { // if (dselectdb.exec()==QDialog::Accepted) rcfile = dselectdb.rcfile; // } // if ( !rcfile.isEmpty() ) { // if (dlogin.exec()==QDialog::Accepted) { // username = dlogin.username; // userpassword = dlogin.password; // } // if (dselectdb.rcfile.isEmpty()) return 0; splash->show(); splash->message( QObject::tr("Init application"), Qt::AlignBottom, Qt::white ); MainForm *w = new MainForm( 0, "MainForm"); mainform = w; mainformws = mainform->ws; mainformwl = mainform->wl; qApp->setMainWidget( w ); w->rcfile = rcfile; // printf( "rcfile = %s\n", rcfile.ascii() ); w->show(); ok = w->init(); splash->clear(); splash->finish( w ); delete splash; if ( ok ) { qApp->connect( qApp, SIGNAL( lastWindowClosed() ), qApp, SLOT( quit() ) ); rc = qApp->exec(); if( w ) delete w; w=0; } else { QMessageBox::critical(0, QObject::tr("Error"), QObject::tr("Ananas runtime init error. See message window and log file for details.")); } aLog::close(); return rc; } else { aLog::close(); return 0; } }