int main(int argc, char *argv[]) { QApplication lApp(argc, argv); MainWindow lWin; #if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) lWin.showMaximized(); #else lWin.showMaximized(); #endif QStringList lArgs = lApp.arguments(); if(lArgs.size()==2) { lWin.setFileName(lArgs.at(1)); } return lApp.exec(); }
int main( int argc, char ** argv ) { // Print out command-line arguments //cout << argc << endl; //for (int i=0; i<argc; i++){ // cout << argv[i] << " "; //} //cout << endl; // Was getting XSync errors when trying to save screenshots to file. // This seems to fix it. #ifdef Q_WS_X11 XInitThreads(); #endif SteererMainWindow *lSteererMainWindow = kNULL; gSteererMainWindowSelfPtr = kNULL; signal(SIGINT, signalHandler); //ctrl-c signal(SIGTERM, signalHandler); //kill (note cannot (and should not) catch kill -9) signal(SIGSEGV, signalHandler); signal(SIGILL, signalHandler); signal(SIGABRT, signalHandler); signal(SIGFPE, signalHandler); #ifndef WIN32 std::set_new_handler( failedNewHandler ); #else _set_new_handler( failedNewHandler ); #endif int result = 1; // output some ReG library constants REG_DBGLOG("ReG steering library info:"); REG_DBGLOG1("REG_MAX_NUM_FILES", REG_MAX_NUM_FILES); REG_DBGLOG1("REG_MAX_NUM_STR_CMDS", REG_MAX_NUM_STR_CMDS); REG_DBGLOG1("REG_MAX_NUM_STR_PARAMS", REG_MAX_NUM_STR_PARAMS); REG_DBGLOG1("REG_MAX_STRING_LENGTH",REG_MAX_STRING_LENGTH); REG_DBGLOG1("REG_MAX_LINE_LEN ",REG_MAX_LINE_LEN ); REG_DBGLOG1("REG_MAX_MSG_SIZE",REG_MAX_MSG_SIZE); #ifdef UNICORE_DEMO REG_DBGLOG("UNICORE_DEMO defined"); #else REG_DBGLOG("UNICORE_DEMO not defined\n"); #endif REG_DBGLOG("Steerer starting...\n"); // note no need to lock mutex here as commsthread not running // initialise steerer via library if (Steerer_initialize() == REG_SUCCESS) //ReG library { QApplication lApp( argc, argv ); /* Don't set the window style explicitly - use system default //lApp.setFont(QFont("Times", 10)); #ifndef WIN32 lApp.setStyle(new QMotifPlusStyle); #else lApp.setStyle(new QWindowsStyle); #endif */ // MR Check to see if we were supplied with an SGS as a command line arg // if so - we've been started from the QT launcher, so go directly to the // main Steering window without using the Grid Attach dialog. if (argc == 2) lSteererMainWindow = new SteererMainWindow(true, argv[1]); else lSteererMainWindow = new SteererMainWindow(); gSteererMainWindowSelfPtr = lSteererMainWindow; lApp.setMainWidget( lSteererMainWindow ); lSteererMainWindow->show(); lApp.connect( &lApp, SIGNAL( lastWindowClosed() ), &lApp, SLOT( quit() ) ); result = lApp.exec(); delete lSteererMainWindow; REG_DBGLOG("Steerer quitting."); if (Steerer_finalize() != REG_SUCCESS) { REG_DBGEXCP("Steerer_finalize failed"); } return result; } else { cerr << "Quitting steerer...\n"; cerr << "Library call Steerer_initialize failed\n"; cerr << "Check environment variables and restart steerer\n" << endl; return result; } }