ControlPanel *PanelScrollView::addControlPanel(MetaGear *metaGear) { ControlPanel *controlPanel = new ControlPanel(_mainVBox, metaGear); metaGear->associateControlPanel(controlPanel); controlPanel->show(); return controlPanel; }
int main(int argc, char *argv[]) { QApplication a(argc, argv); ControlPanel w; // Make sure ROS shuts down correctly //QObject::connect(&a, SIGNAL(aboutToQuit()), &w.ros_interface, SLOT(shutdown())); w.show(); return a.exec(); }
int main(int argc, char *argv[]) { QApplication a(argc, argv); printf("start\n"); int port = 1000; if (argc > 1) port = atoi(argv[1]); boost::asio::io_service io_service; boost::asio::ip::tcp::endpoint endp(boost::asio::ip::address::from_string("127.0.0.1"), port); boost::shared_ptr<rc::DataBuffer> buf(new rc::DataBuffer(50 * 1024 * 1024)); boost::shared_ptr<rc::Decode> decode(new rc::Decode(buf)); boost::shared_ptr<ScreenClient> client(new ScreenClient(io_service, endp, buf)); client->on_recved_init_info = [decode](InitInfo& info) { printf("client set init info\n"); decode->init(info); }; printf("starting client\n"); boost::thread([client]{client->start(); }); ControlPanel* panel = new ControlPanel(QRect(50, 50, 1000, 700)); panel->show(); printf("starting decode\n"); decode->set_panel(panel); boost::thread([decode]{decode->start(); }); printf("starting io_service\n"); boost::thread([&io_service]{io_service.run(); }); return a.exec(); }
int main(int argc, char **argv) { Logger::init("."); SoundManager::init(); LOG_INFO("Starting..."); QApplication app(argc, argv); QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8")); QString scenario; // set default values float period = 1; // seconds int numberOfItems = 10; int ratioOfExceptions = 10; // percent TestMode modeInhibition = MODE_ATTENTION; bool commandLine = false; const char * codec = 0; QStringList args = QCoreApplication::arguments(); int n = args.size(); int i = 1; while (i<n) { QString arg = args.at(i); //LOG_DEBUG("arg=" << arg.toLocal8Bit().constData()); if (arg == "-p") { // period i++; if (i >= n) usage(); period = args.at(i).toFloat(); } else if (arg == "-n") { i++; if (i >= n) usage(); numberOfItems = args.at(i).toInt(); } else if (arg == "--codec") { i++; if (i >= n) usage(); codec = args.at(i).toAscii().constData(); } else if (arg == "-x") { i++; if (i >= n) usage(); ratioOfExceptions = args.at(i).toInt(); } else if (arg == "-a") { modeInhibition = MODE_ATTENTION; } else if (arg == "-i") { modeInhibition = MODE_INHIBITION; } else if (arg == "-ads") { modeInhibition = MODE_DIVIDED_ATTENTION_SOUND; } else if (arg == "-adv") { modeInhibition = MODE_DIVIDED_ATTENTION_VISUAL; } else if (arg == "-h") { usage(); } else { // scenario scenario = args.at(i); commandLine = true; } i++; } if (codec) { QTextCodec::setCodecForCStrings(QTextCodec::codecForName(codec)); QTextCodec::setCodecForLocale(QTextCodec::codecForName(codec)); } ControlPanel *c = 0; QString player = ""; bool playGame = false; bool showGraph = false; bool withSound = true; while (1) { showGraph = false; playGame = false; if (commandLine) { // command line mode: // start immediately test with values given on the command line. LOG_DEBUG("scenario=" << scenario.toLocal8Bit().constData() << ", period=" << period << ", numberOfItems=" << numberOfItems << ", ratioOfExceptions=" << ratioOfExceptions << ", modeInhibition=" << modeInhibition); playGame = true; } else { // show control panel LOG_INFO("Show Contol Panel"); if (!c) c = new ControlPanel(); c->updateTable(); c->show(); int r = app.exec(); LOG_DEBUG("after app.exec(), r=" << r); if (0 == r) { // ctrl-Q, or closed window // really quit exit(0); } else { if (2 == r) { // show graph showGraph = true; } else { // play game playGame = true; } // retrieve values from object 'c'. LOG_DEBUG("player=" << c->getPlayer().toLocal8Bit().constData() << ", scenario=" << c->getScenario().toLocal8Bit().constData() << ", sound=" << c->getSound()); ratioOfExceptions = c->getRatio(); period = c->getPeriod()/1000; numberOfItems = c->getNumber(); modeInhibition = c->getType(); scenario = c->getScenario(); player = c->getPlayer(); withSound = c->getSound(); } } Scenario s(scenario.toLocal8Bit().constData(), period*1000, numberOfItems, ratioOfExceptions, modeInhibition, withSound); QString filename = User::getUserfile(player); if (playGame) { if (c) c->hide(); s.load(); s.generateItemList(); s.generateDistractors(); Viewer imageViewer(s); //imageViewer.showFullScreen(); imageViewer.show(); imageViewer.resize(800,600); int r = app.exec(); LOG_DEBUG("Return from Viewer: r=" << r); if (commandLine) exit(0); if (r == 0) { // closed window, of 'q' pressed // else 'q' pressed, do not store result into file } else { // nominal case if (!player.isEmpty()) { // store to file s.store(filename); // go to curve diagram showGraph = true; } } } if (showGraph) { if (c) c->hide(); // from user name, get list of scenarios // from these scenarii, only keep those matching the last one // (so that the curve compares things comparable) GraphPanel x(filename, s); x.show(); int r = app.exec(); } } }