int main ( int argc, char ** argv ) { QApplication app ( argc, argv ); PasswordImpl pwd; if ( pwd.exec() ==QDialog::Accepted ) { DialogImpl win; win.show(); app.connect ( &app, SIGNAL ( lastWindowClosed() ), &app, SLOT ( quit() ) ); return app.exec(); } app.connect ( &app, SIGNAL ( lastWindowClosed() ), &app, SLOT ( quit() ) ); return 1; }
int main(int argc, char * argv[]) { ULogger::setType(ULogger::kTypeConsole); ULogger::setLevel(ULogger::kInfo); QApplication * app = new QApplication(argc, argv); DatabaseViewer * mainWindow = new DatabaseViewer(); mainWindow->showNormal(); if(argc == 2) { mainWindow->openDatabase(argv[1]); } // Now wait for application to finish app->connect( app, SIGNAL( lastWindowClosed() ), app, SLOT( quit() ) ); app->exec();// MUST be called by the Main Thread delete mainWindow; delete app; return 0; }
int mainAdapterWidget(QApplication& a, osg::ArgumentParser& arguments) { // load the scene. osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments); if (!loadedModel) { std::cout << arguments[0] <<": No data loaded." << std::endl; return 1; } std::cout<<"Using AdapterWidget - QGLWidget subclassed to integrate with osgViewer using its embedded graphics window support."<<std::endl; ViewerQT* viewerWindow = new ViewerQT; viewerWindow->setCameraManipulator(new osgGA::TrackballManipulator); viewerWindow->setSceneData(loadedModel.get()); viewerWindow->show(); a.connect( &a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()) ); return a.exec(); }
/*! \mainpage Raymini Documentation * * \section intro_sec Introduction * RayMini is a minimal raytracer implemented in C++/OpenGL/Qt. * This software package is meants to be distributed to Telecom ParisTech student only. * \section install_sec Installation * * \subsection tools_subsec Tools required: * <ul> * <li>GCC >v4 </li> * <li> OpenGL </li> * <li> QT >v4.4 </li> * <li> libQGLViewer </li> * <li> GLEW (for GPU extensions) </li> * </ul> * <VAR> * Edit the file raymini.pro to adapt it to your configuration (has been tested under Linux Ubuntu, Linux Fedora and Win7). * </VAR> * * \subsection running Running the program * - On linux: * -# qmake-qt4 raymini.pro * -# make * -# ./raymini * * * - On windows: * <BR> Use QT Creator and do not forget to setup the run configuration properly so that the raymini directory is the working directory. * <BR> Otherwise, the 'models' directory will not be found by the raymini executable. * <BR> If you want to run the executable directly (by double-clikcing on it in the Windows file explorer), copy the model directory into the release directory first * and double-click on raymini.exe. * * \section authors Authors * - Tamy Boubekeur ([email protected]) * - Junxian Xu ([email protected]) * - Maxim Karpushin ([email protected]) * - Tiago C. Silva ([email protected]) * - Vinicius Gardelli ([email protected]) */ int main (int argc, char **argv) { try { QApplication raymini (argc, argv); setBoubekQTStyle (raymini); QApplication::setStyle (QStyleFactory::create("fusion")); raymini.setAttribute(Qt::AA_DontUseNativeMenuBar,true); Window * window = new Window (); window->setWindowTitle ("RayMini: A minimal raytracer."); window->show(); raymini.connect (&raymini, SIGNAL (lastWindowClosed()), &raymini, SLOT (quit())); return raymini.exec (); } catch (exception e) { cerr << e.what() << endl; //exit (1); } catch (Mesh::Exception e) { cerr << e.getMessage() << endl; //exit (1); } }
int main (int argc, char *argv[]) { try{ Tribots::ConfigReader cfg; std::string cfg_file = "../config_files/teamcontrol.cfg"; if (argc>1) { if (std::string(argv[1])=="--help" || std::string(argv[1])=="-h") { std::cout << "Aufruf: " << argv[0] << " [Konfigurationsdatei]\n"; std::cout << "Fehlt die Konfigurationsdatei, wird ../config_files/teamcontrol.cfg verwendet\n"; return -1; } else { cfg_file = argv[1]; } } cfg.append_from_file (cfg_file.c_str()); QApplication app (argc,argv); Tribots::Journal::the_journal.set_mode (cfg); TeamcontrolMainWidget tcw (0); tcw.init (cfg); app.connect( &tcw, SIGNAL(widgetClosed()), &app, SLOT(quit()) ); tcw.show(); return app.exec (); }catch (Tribots::TribotsException& e) { std::cerr << e.what() << '\n'; return -1; }catch (std::exception& e) { std::cerr << e.what() << '\n'; return -1; } }
int main(int argc, char *argv[]) { /* look for dynamic linker */ try { static Genode::Rom_connection rom("ld.lib.so"); Genode::Process::dynamic_linker(rom.dataspace()); } catch (...) { } int result; QApplication *a = new QApplication(argc, argv); Qt_launchpad *launchpad = new Qt_launchpad(Genode::env()->ram_session()->quota()); launchpad->add_launcher("calculatorform", 18*1024*1024); launchpad->add_launcher("tetrix", 18*1024*1024); launchpad->move(300,100); launchpad->show(); a->connect(a, SIGNAL(lastWindowClosed()), a, SLOT(quit())); result = a->exec(); delete launchpad; delete a; return result; }
int main( int argc, char ** argv ) { hw = new HWSRV(1); int error = hw->ErrNum; QApplication a (argc, argv); QDesktopWidget * d = a.desktop(); int resolution_width = d->width(); int resolution_heigth = d->height(); w = new Configurations; int wid = w->width(); int heig = w->height(); if ((wid>resolution_width)||(heig>resolution_heigth)){ w->setWindowState(Qt::WindowFullScreen); w->setMinimumSize(QSize(resolution_width,resolution_heigth)); w->setMaximumSize(QSize(resolution_width,resolution_heigth)); w->adjustSize(); } w -> show(); a. processEvents(); a.connect( &a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()) ); sigset(SIGUSR1,catch_sig); if (error>2){ QString er_str; QString er_id; HWSRVErrorText(error,er_str,er_id); InterfaceErrorWin(er_str, er_id); return error; } int ret = a.exec(); return ret; }
int main(int argc, char ** argv) { QApplication * app = new QApplication(argc, argv); int cx = -1; int cy = -1; int w = QApplication::desktop()->width(); int h = QApplication::desktop()->height(); QSettings settings(QSettings::IniFormat, QSettings::UserScope, "DoUML", "settings"); settings.setIniCodec(QTextCodec::codecForName("UTF-8")); int uid = settings.value("Main/id", -1).toInt(); int l, t, r, b; l = settings.value("Desktop/left", -1).toInt(); r = settings.value("Desktop/right", -1).toInt(); t = settings.value("Desktop/top", -1).toInt(); b = settings.value("Desktop/bottom", -1).toInt(); if(l != -1 && r != -1 && t != -1 && b != -1) { if (!((r == 0) && (t == 0) && (r == 0) && (b == 0)) && !((r < 0) || (t < 0) || (r < 0) || (b < 0)) && !((r <= l) || (b <= t))) { cx = (r + l) / 2; cy = (t + b) / 2; w = r - l; h = b - t; } } if (uid == -1) QMessageBox::critical(0, "Synchro project", "Own identifier not defined"); else if ((uid < 2) || (uid > 127)) QMessageBox::critical(0, "Synchro project", "invalid Identifier"); else { set_user_id(uid, homeDir.dirName()); app->connect(app, SIGNAL(lastWindowClosed()), SLOT(quit())); init_pixmaps(); SynchroWindow * ww = new SynchroWindow(); ww->resize((w * 3) / 5, (h * 3) / 5); if (cx != -1) ww->move(ww->x() + cx - (ww->x() + ww->width() / 2), ww->y() + cy - (ww->y() + ww->height() / 2)); ww->show(); if (argc > 1) ww->load(argc - 1, argv + 1); app->exec(); } return 0; }
int main ( int argc, char **argv ) { QApplication app ( argc, argv ); QCardReader *qcr = new QCardReader(); qcr->show(); app.connect ( &app, SIGNAL ( lastWindowClosed() ), &app, SLOT ( quit() ) ); return app.exec(); }
int main(int argc, char **argv) { /********************* ** Qt **********************/ QApplication* app = 0; StructureGL* glWindow = 0; app = new QApplication(argc, argv); glWindow = new StructureGL(); GuiNode n(argc, argv); n.init(glWindow); glWindow->show(); app->connect(app, SIGNAL(lastWindowClosed()), app, SLOT(quit())); app->connect(&n, SIGNAL(finished()), app, SLOT(quit())); int result = app->exec(); n.stop(); n.wait(); return result; }
int main (int argc, char **argv) { QApplication raymini (argc, argv); setBoubekQTStyle (raymini); QApplication::setStyle (new QPlastiqueStyle); Window * window = new Window (); window->setWindowTitle ("RayMini: A minimal raytracer."); window->show(); raymini.connect (&raymini, SIGNAL (lastWindowClosed()), &raymini, SLOT (quit())); return raymini.exec (); }
int main(int argc,char *argv[]) { int retval = 0; /* Initialize rtdk */ #ifdef _RTUTILS_H rt_print_auto_init(1); #endif /* Try to Exit Cleanly on Signals */ parentThread = getpid(); signal(SIGINT,signal_handler); signal(SIGABRT,signal_handler); signal(SIGSEGV,signal_handler); /* Handle Command-Line Options */ cli_options_t cli_options; if (!parse_cli_options(argc,argv,&cli_options)) return -EINVAL; /* Find Configuration File */ std::string config_file; if (cli_options.config_file.length()) config_file = cli_options.config_file; else if (getenv("RTXI_CONF")) config_file = getenv("RTXI_CONF"); else config_file = "/etc/rtxi.conf"; /************************************************************ * Create Main System Components * * * * These need to be created early because they should have * * Settings::IDs of 0 and 1. * ************************************************************/ /* Create GUI Objects */ QApplication *app = new QApplication(argc,argv); app->connect(app,SIGNAL(lastWindowClosed()),app,SLOT(quit())); MainWindow::getInstance()->showMaximized(); CmdLine::getInstance(); RT::System::getInstance(); IO::Connector::getInstance(); /* Bootstrap the System */ Settings::Manager::getInstance()->load(config_file); retval = app->exec(); Plugin::Manager::getInstance()->unloadAll(); return retval; }
int visapp1( int argc, char** argv ) { logger::need_to_log(/*true*/); QApplication app (argc, argv); app.setQuitOnLastWindowClosed(false); async_services_initializer init(true); __main_srvc__ = &init.get_service(); logging::add_console_writer(); logging::add_default_file_writer(); //cmd_line::arg_map am; //if (!am.parse(cmd_line::naive_parser().add_arg("task_id", true), argc, argv)) //{ // LogError("Invalid command line"); // return 1; //} //optional<binary::size_type> task_id; //if (am.contains("task_id")) // task_id = am.extract<binary::size_type>("task_id"); try { endpoint peer(cfg().network.local_address); kernel::vis_sys_props props_; props_.base_point = ::get_base(); visapp s(peer, props_ , argc, argv); tray_icon tricon(":/resources/projector.png", &app); app.connect(&tricon, SIGNAL(menu_exit()), &app, SLOT(quit())); tricon.show(); return app.exec(); } catch(const boost::filesystem::filesystem_error& e) { auto c = e.code().message(); LogError(c); } return 0; }
int mainAdapterWidget(QApplication& a, osg::ArgumentParser& arguments) { // load the scene. osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments); if (!loadedModel) { std::cerr << arguments[0] << ": No data loaded." << std::endl; std::cout << "usage: " << arguments[0] << " [--mdi] nodefile" << std::endl; return 1; } std::cout << "Using AdapterWidget - QGLWidget subclassed to integrate with " "osgViewer using its embedded graphics window support." << std::endl; if (arguments.read("--mdi")) { std::cout << "Using ViewetQT MDI version" << std::endl; /* Following problems are found here: - miminize causes loaded model to disappear (some problem with Camera matrix? - clampProjectionMatrix is invalid) */ ViewerQT* viewerWindow = new ViewerQT; viewerWindow->setCameraManipulator(new osgGA::TrackballManipulator); viewerWindow->setSceneData(loadedModel.get()); QMainWindow* mw = new QMainWindow(); QMdiArea* mdiArea = new QMdiArea(mw); mw->setCentralWidget(mdiArea); QMdiSubWindow* subWindow = mdiArea->addSubWindow(viewerWindow); subWindow->showMaximized(); subWindow->setWindowTitle("New Window"); mw->show(); } else { ViewerQT* viewerWindow = new ViewerQT; viewerWindow->setCameraManipulator(new osgGA::TrackballManipulator); viewerWindow->setSceneData(loadedModel.get()); viewerWindow->show(); } a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); return a.exec(); }
QApplication *QApplication_new (char **argv) { QApplication *app; int argc = 0; char **my_argv; int i; while (argv[argc] != 0) argc++; my_argv = (char**)___alloc_mem ((argc+1) * sizeof (char*)); for (i=0; i<argc; i++) my_argv[i] = strcpy ((char*)___alloc_mem (strlen (argv[i]) + 1), argv[i]); my_argv[i] = 0; qInstallMsgHandler( myMessageOutput ); app = new QApplication (argc, my_argv); app->connect (app, SIGNAL(lastWindowClosed()), app, SLOT(quit())); return app; }
int main(int argc, char* argv[]) { /* oomUser = getenv("MUSEHOME"); if (oomUser == 0) oomUser = getenv("HOME"); oomGlobalShare = getenv("MUSE"); if (oomGlobalShare == 0) { oomGlobalShare = "/usr/oom"; if (access(oomGlobalShare.toLatin1(), R_OK) != 0) { oomGlobalShare = "/usr/local/oom"; if (access(oomGlobalShare.toLatin1(), R_OK) != 0) oomGlobalShare = oomUser; } }*/ char * instanceName = argv[1]; QApplication app (argc, argv, true); QWidget* w = new FluidSynthGui (); if (argc > 1) w->setCaption(QString(instanceName)); w->show(); app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit())); qApp->exec(); }
int main( int argc, char ** argv ) { QApplication* app = new QApplication( argc, argv ); Browser* w = new Browser; #if defined(_WS_QWS) || defined(Q_WS_QWS) w->showFullScreen(); int ww = w->width(); int wh = w->height(); int dim = (ww > wh) ? wh : ww; dim = dim * 3 / 4; w->setSlideSize(QSize(3*dim/5, dim)); #else w->setSlideSize(QSize(3*40, 5*40)); w->resize(750, 270); #endif QStringList files = (argc > 1) ? findFiles(QString(argv[1])) : findFiles(); QImage img; for(int i = 0; i < (int)files.count(); i++) if(img.load(files[i])) w->addSlide(img); w->setCenterIndex(w->slideCount()/2); w->setBackgroundColor(Qt::white); w->show(); app->connect( app, SIGNAL(lastWindowClosed()), app, SLOT(quit()) ); int result = app->exec(); delete w; delete app; return result; }
int main(int argc, char ** argv) { QApplication * app = new QApplication(argc, argv); int uid = -1; // note : QFile fp(QDir::home().absFilePath(".boumlrc")) doesn't work // if the path contains non latin1 characters, for instance cyrillic ! QDir homeDir = QDir::home(); QString s = homeDir.absFilePath(".boumlrc"); FILE * fp = fopen((const char *) s, "r"); int cx = -1; int cy = -1; int w = QApplication::desktop()->width(); int h = QApplication::desktop()->height(); if (fp != 0) { char line[512]; while (fgets(line, sizeof(line) - 1, fp) != 0) { remove_crlf(line); if (!strncmp(line, "ID ", 3)) { sscanf(line+3, "%d", &uid); break; } else if (!strncmp(line, "DESKTOP ", 8)) { int l, t, r, b; if (sscanf(line+8, "%d %d %d %d", &l, &t, &r, &b) == 4) { if (!((r == 0) && (t == 0) && (r == 0) && (b == 0)) && !((r < 0) || (t < 0) || (r < 0) || (b < 0)) && !((r <= l) || (b <= t))) { cx = (r + l) / 2; cy = (t + b) / 2; w = r - l; h = b - t; } } } } fclose(fp); } if (uid == -1) QMessageBox::critical(0, "Control project", "Own identifier not defined"); else if ((uid < 2) || (uid > 127)) QMessageBox::critical(0, "Control project", "invalid Identifier"); else { set_user_id(uid, homeDir.dirName()); app->connect(app, SIGNAL(lastWindowClosed()), SLOT(quit()) ); init_pixmaps(); ControlWindow * ww = new ControlWindow(homeDir); ww->resize((w * 3)/5, (h * 3)/5); if (cx != -1) ww->move(ww->x() + cx - (ww->x() + ww->width() / 2), ww->y() + cy - (ww->y() + ww->height() / 2)); ww->show(); app->exec(); } return 0; }
int main( int argc, char **argv ) { int i; QString m1,n1,o1; struct args pargs; QApplication *a; InitWidget *b; ScreenWidget *c; TextWidget *textOut; QProgressDialog *qProg; QPixmap *qpxMeshIcon=NULL; struct model_error model1,model2; int rcode; struct outbuf *log; struct prog_reporter pr; /* Initialize application */ a = NULL; b = NULL; c = NULL; qProg = NULL; memset(&model1,0,sizeof(model1)); memset(&model2,0,sizeof(model2)); memset(&pr,0,sizeof(pr)); log = NULL; i = 0; while (i<argc) { if (strcmp(argv[i],"-t") == 0) /* text version requested */ break; if (strcmp(argv[i],"-h") == 0) /* just asked for command line help */ break; i++; } if (i == argc) { /* no text version requested, initialize QT */ a = new QApplication( argc, argv ); /* Load pixmap for icon */ qpxMeshIcon = new QPixmap((const char**)meshIcon); if (a != NULL) a->connect( a, SIGNAL(lastWindowClosed()), a, SLOT(quit()) ); } else { a = NULL; /* No QT app needed */ } /* Parse arguments */ parse_args(argc,argv,&pargs); /* Display starting dialog if insufficient arguments */ if (pargs.m1_fname != NULL || pargs.m2_fname != NULL) { if (pargs.m1_fname == NULL || pargs.m2_fname == NULL) { fprintf(stderr,"ERROR: missing file name(s) in command line\n"); exit(1); } if (!pargs.do_wlog) { log = outbuf_new(stdio_puts,stdout); } else { textOut = new TextWidget(); textOut->setIcon(*qpxMeshIcon); log = outbuf_new(TextWidget_puts,textOut); textOut->show(); } if (pargs.no_gui) { pr.prog = stdio_prog; pr.cb_out = stdout; } else { qProg = new QProgressDialog("Calculating distance",0,100); qProg->setIcon(*qpxMeshIcon); qProg->setMinimumDuration(1500); pr.prog = QT_prog; pr.cb_out = qProg; } mesh_run(&pargs, &model1, &model2, log, &pr); } else { b = new InitWidget(pargs, &model1, &model2); b->setIcon(*qpxMeshIcon); b->show(); } if (a != NULL) { if (pargs.m1_fname != NULL || pargs.m2_fname != NULL) { c = new ScreenWidget(&model1, &model2, &pargs); c->setIcon(*qpxMeshIcon); a->setMainWidget(c); c->show(); } rcode = a->exec(); } else { rcode = 0; } /* Free widgets */ outbuf_delete(log); delete qProg; delete qpxMeshIcon; delete b; delete c; delete a; // QApplication must be last QT thing to delete /* Free model data */ if (model1.mesh != NULL) __free_raw_model(model1.mesh); free(model1.verror); free(model1.info); free_face_error(model1.fe); if (model2.mesh != NULL) __free_raw_model(model2.mesh); free(model2.verror); free(model2.info); /* Return exit code */ return rcode; }
int mainAdapterWidget(QApplication& a, osg::ArgumentParser& arguments) { // load the scene. osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments); if (!loadedModel) { std::cout << arguments[0] <<": No data loaded." << std::endl; return 1; } std::cout<<"Using AdapterWidget - QGLWidget subclassed to integrate with osgViewer using its embedded graphics window support."<<std::endl; if (arguments.read("--CompositeViewer")) { CompositeViewerQT* viewerWindow = new CompositeViewerQT; unsigned int width = viewerWindow->width(); unsigned int height = viewerWindow->height(); { osgViewer::View* view1 = new osgViewer::View; view1->getCamera()->setGraphicsContext(viewerWindow->getGraphicsWindow()); view1->getCamera()->setProjectionMatrixAsPerspective(30.0f, static_cast<double>(width)/static_cast<double>(height/2), 1.0, 1000.0); view1->getCamera()->setViewport(new osg::Viewport(0,0,width,height/2)); view1->setCameraManipulator(new osgGA::TrackballManipulator); view1->setSceneData(loadedModel.get()); viewerWindow->addView(view1); } { osgViewer::View* view2 = new osgViewer::View; view2->getCamera()->setGraphicsContext(viewerWindow->getGraphicsWindow()); view2->getCamera()->setProjectionMatrixAsPerspective(30.0f, static_cast<double>(width)/static_cast<double>(height/2), 1.0, 1000.0); view2->getCamera()->setViewport(new osg::Viewport(0,height/2,width,height/2)); view2->setCameraManipulator(new osgGA::TrackballManipulator); view2->setSceneData(loadedModel.get()); viewerWindow->addView(view2); } viewerWindow->show(); } else if (arguments.read("--mdi")) { std::cout<<"Using ViewetQT MDI version"<<std::endl; /* Following problems are found here: - miminize causes loaded model to disappear (some problem with Camera matrix? - clampProjectionMatrix is invalid) */ ViewerQT* viewerWindow = new ViewerQT; viewerWindow->setCameraManipulator(new osgGA::TrackballManipulator); viewerWindow->setSceneData(loadedModel.get()); QMainWindow* mw = new QMainWindow(); QMdiArea* mdiArea = new QMdiArea(mw); mw->setCentralWidget(mdiArea); QMdiSubWindow *subWindow = mdiArea->addSubWindow(viewerWindow); subWindow->showMaximized(); subWindow->setWindowTitle("New Window"); mw->show(); } else { ViewerQT* viewerWindow = new ViewerQT; viewerWindow->setCameraManipulator(new osgGA::TrackballManipulator); viewerWindow->setSceneData(loadedModel.get()); viewerWindow->show(); } a.connect( &a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()) ); return a.exec(); }