Ejemplo n.º 1
0
/**
 * Renderiza o menu baseado na seleção
 * \param tela Tela onde o menu será renderizado
 */
void gunther_menu(SDL_Surface* screen)
{
	int section = TITLE;

	while (section != QUIT){
		switch(section){
			case TITLE:
				section = title(screen);
				break;
			case NEWGAME:
				section = newgame(screen);
				break;
			case LOADGAME:
				section = loadgame(screen);
				break;
			case OPTIONS:
				section = options(screen);
				break;
			case MANUAL:
				section = manual(screen,0);
				break;
			case COMMANDS:
				section = manual(screen,COMMANDS);
				break;
			case CREDITS:
				section = credits(screen);
				break;
			default:
				section = QUIT;
		}
	}
}
Ejemplo n.º 2
0
 void GasBlender::createActions()
 {
     newAct = new QAction(tr("&New"), this);
     //     newAct->setIcon(QIcon(":/images/new.png"));     
     newAct->setShortcuts(QKeySequence::New);
     //newAct->setStatusTip(tr("Create a new file"));
     connect(newAct, SIGNAL(triggered()), this, SLOT(newFile()));

     aboutAct = new QAction(tr("&About"),this);
     // aboutAct->setStatusTip(tr("Show the application's About box"));
     connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));

     manualAct = new QAction(tr("&Manual"),this);
     // aboutAct->setStatusTip(tr("Show the application's About box"));
     connect(manualAct, SIGNAL(triggered()), this, SLOT(manual()));

     documentationAct = new QAction(tr("&Documentation"),this);
     // aboutAct->setStatusTip(tr("Show the application's About box"));
     connect(documentationAct, SIGNAL(triggered()), this, SLOT(documentation()));


     //     aboutQtAct = new QAction(tr("About &Qt"), this);
     //aboutQtAct->setStatusTip(tr("Show the Qt library's About box"));
     //connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));

     quitAct = new QAction(tr("&Quit"), this);
     quitAct->setShortcuts(QKeySequence::Quit);
     //     quitAct->setStatusTip(tr("Exit the application"));
     connect(quitAct, SIGNAL(triggered()), this, SLOT(close()));
 }
Ejemplo n.º 3
0
int main(int argc, char *argv[]){
    //poner las variables que no se necesiten en el main en partida
    int opcion2;
    initscr();
    raw();
    noecho();
    srand(time(NULL));

    do{
	switch(opcion2 = menu()){
	    case jugar:
		partida();
		break;
	    case instrucciones:
		manual();
		break;
	    case top:
		top_puntuaciones();
		break;
	    case salir:
		printw("Adios\n");
		break;
	}//fin switch
    }while(opcion2 != salir);
    endwin();
    return EXIT_SUCCESS;  
}
Ejemplo n.º 4
0
/**
 * Runs the program in the specified mode.
 * @param c     Pointer to crossing
 * @param mode  Mode to run program in (0 = simulated, 1 = manual)
 */
void run(Crossing* c, int mode) {
    if ( mode == 0 ) {
        printf("\nSimulated run was selected!\n");
        simulation(c);
    } else {
        printf("\nManual run was selected!\n");
        manual(c);
    }
}
Ejemplo n.º 5
0
UserManual::UserManual(QWidget *parent) : QMainWindow(parent),
	ui(new Ui::UserManual)
{
	ui->setupUi(this);

	QShortcut *closeKey = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this);
	connect(closeKey, SIGNAL(activated()), this, SLOT(close()));
	QShortcut *quitKey = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this);
	connect(quitKey, SIGNAL(activated()), parent, SLOT(close()));

	QAction *actionShowSearch = new QAction(this);
	actionShowSearch->setShortcut(Qt::CTRL + Qt::Key_F);
	actionShowSearch->setShortcutContext(Qt::WindowShortcut);
	addAction(actionShowSearch);

	QAction *actionHideSearch = new QAction(this);
	actionHideSearch->setShortcut(Qt::Key_Escape);
	actionHideSearch->setShortcutContext(Qt::WindowShortcut);
	addAction(actionHideSearch);

	setWindowTitle(tr("User Manual"));

	ui->webView->page()->setLinkDelegationPolicy(QWebPage::DelegateExternalLinks);
	QString searchPath = getSubsurfaceDataPath("Documentation");
	if (searchPath.size()) {
		// look for localized versions of the manual first
		QString lang = uiLanguage(NULL);
		QString prefix = searchPath.append("/user-manual");
		QFile manual(prefix + "_" + lang + ".html");
		if (!manual.exists())
			manual.setFileName(prefix + "_" + lang.left(2) + ".html");
		if (!manual.exists())
			manual.setFileName(prefix + ".html");
		if (!manual.exists()) {
			ui->webView->setHtml(tr("Cannot find the Subsurface manual"));
		} else {
			QString urlString = QString("file:///") + manual.fileName();
			QUrl url(urlString, QUrl::TolerantMode);
			ui->webView->setUrl(url);
		}
	} else {
		ui->webView->setHtml(tr("Cannot find the Subsurface manual"));
	}
	ui->searchPanel->setParent(this);
	ui->searchPanel->hide();

	connect(actionShowSearch, SIGNAL(triggered(bool)), this, SLOT(showSearchPanel()));
	connect(actionHideSearch, SIGNAL(triggered(bool)), this, SLOT(hideSearchPanel()));
	connect(ui->webView, SIGNAL(linkClicked(QUrl)), this, SLOT(linkClickedSlot(QUrl)));
	connect(ui->searchEdit, SIGNAL(textChanged(QString)), this, SLOT(searchTextChanged(QString)));
	connect(ui->findNext, SIGNAL(clicked()), this, SLOT(searchNext()));
	connect(ui->findPrev, SIGNAL(clicked()), this, SLOT(searchPrev()));
}
Ejemplo n.º 6
0
//selected: manual mode
void mnl(void)
{
     //Start Color Selection
     int color[5]; 
     /* color[0]:green front
      * color[1]:green back
      * color[2]:red front
      * color[3]:red back
      * color[4]:null character
      */
     printf("\n\nPlease enter desired color code in sequence: \n(green light front, "
            "green light back, red light front, red light back)\n"
            "Code menu:\n"
            " 0: Black      1: Blue          2: Green         3: Cyan\n"
            " 4: Red        5: Purple        6: Yellow        7: Light Gray\n"
            " 8: Gray       9: Light Blue   10: Light Green  11: Light Cyan\n"
            "12: Light Red 13: Light Purple 14: Light Yellow 15: White \n");
     printf("Your choice?");
     _flushall();
     
     if(scanf("(%d, %d, %d, %d)", 
                           &color[0], &color[1], &color[2], &color[3])== 4){
          if(color[0]<16 && color[1]<16 && color[2]<16 && color[3]<16){
                   if(color[0]>=0 && color[1]>=0 && color[2]>=0 && color[3]>=0){
                        printf("Press any bottom to continue...\n");
                        getch();
                   }
          }
     }
     
     else{
       printf("You didn't enter the correct form. Proceed with default value.");
       color[0]=2; color[1]=0; color[2]=4; color[3]=0;
       
       _flushall();
       getch();
     }
     
     //Manual: use enter to view
     printf("\n\nUse enter to view manually."
            "Press any key to continue...");
     getch();
     system("cls");
     
     //Start showing frames
     manual(color[0], color[1], color[2], color[3]);
     
     //end showing; clear screen; back to menu
     system("cls");
}
int main(void)
{
	Timer_Init();					//Initialize timers
	Ultrasonic_Init();				//Initialize sensors
	LED_Init();						//Initialize LEDs
	UART_Init();					//Initialize UART
	Motors_Init();					//Initialize motors
	sei();							//Enable interrupts

	while(1)						//Main loop
	{
		state = 1;
		if (check_command(REMOTECONTROLMODE))
		{
			state = 0;
			manual();
		}
		else if (check_command(LATERALPARKINGMODE))
		{
			state = 0;
			lateral_parking();
		}
		else if (check_command(MAINPARKINGMODE))
		{
			state = 0;
			random_parking();
		}
		else if (check_command(FIXEDPARKINGMODE))
		{
			state = 0;
			fixed_parking();
		}
		else if (check_command(OBSTACLEDODGEMODE))
		{
			state = 0;
			obstacle_dodge();
		}
		else if (check_command(FOLLOWMODE))
		{
			state = 0;
			follow();
		}/*
		else if (confirm_input(DANCE))
		{
			state = 4;
			dance();
		}*/
	}
}
Ejemplo n.º 8
0
int main(int argc, char *argv[])
{
	

	auto dir = program_dir(argv);

	// load ffmpeg...
	fs::path ffmpeg_path;
	// load ffmpeg options
	std::string ffmpeg_options;

	// load settings.
	load_settings(dir, ffmpeg_path, ffmpeg_options);

	std::cout << "using ffmpeg at " << ffmpeg_path.string() << std::endl;

	auto unprocessed_files = get_unprocessed_file(dir);

	fs::ofstream out("out.bat");

	for (auto & video : unprocessed_files)
	{
		std::cout << video << std::endl;

		cm_check manual(video);

		if (manual.ok())
		{
			while (manual.command())
			{
				manual.show();
				manual.show_main_contents();
				manual.input();
			}
		}

		clear_screen();

		std::cout << "selected contents for " << video << std::endl;
		manual.show_main_contents();

		trim(out, video, manual.get(), ffmpeg_path, ffmpeg_options);
	}

	return 0;
}
Ejemplo n.º 9
0
int main(){
int section = TITLE;

SDL_Surface *screen = NULL;

/* incializa tela */
if(SDL_Init(SDL_INIT_EVERYTHING) == -1) return 1;

screen = SDL_SetVideoMode(WIDTH,HEIGHT,RESOLUTION,SDL_SWSURFACE);

if(screen == NULL) return 1;

while (section != QUIT){
switch(section){
case TITLE:
section = title(screen);
break;
/* case NEWGAME:
section = Game(screen,NULL);
break;
case LOADGAME:
section = loadgame(screen);
break;
case OPTIONS:
section = options(screen);
break;
*/ case MANUAL:
section = manual(screen,0);
break;
/* case COMMANDS:
section = manual(screen,COMMANDS);
break;
case CREDITS:
section = credits(screen);
break;
*/ default:
printf(" %d\n",section);
return 1;
}
}

SDL_Quit();
return 0;
}
Ejemplo n.º 10
0
void Jogo::menu2(){
	while (!teclado.soltou[TECLA_ESC] && !aplicacao.sair)
	{
		uniIniciarFrame();
		menu.desenhar2();
		if (menu.jogo == 4){
			break;
		}
		if (menu.jogo == 3){
			manual();
		}
		if (menu.jogo == 1){
			executar();
		}
		menu.atualizar();
		uniTerminarFrame();

	}
	}
Ejemplo n.º 11
0
HsvChannelConfigWidget::HsvChannelConfigWidget(const QModelIndex &index, QWidget *parent)
	: ChannelConfigWidget(index, parent),
	ui(new Ui::HsvChannelConfigWidget),
	m_numpad(new NumpadDialog("Enter Value"))
{
	ui->setupUi(this);
	
	Config deviceConfig;
	deviceConfig.beginGroup(CAMERA_GROUP);
	deviceConfig.setValue(CAMERA_NUM_CHANNELS_KEY, 1);
	deviceConfig.beginGroup((QString(CAMERA_CHANNEL_GROUP_PREFIX) + "0").toStdString());
	deviceConfig.setValue(CAMERA_CHANNEL_TYPE_KEY, CAMERA_CHANNEL_TYPE_HSV_KEY);
	deviceConfig.clearGroup();
	ui->camera->setConfig(&deviceConfig);
	
	visual();
	
	connect(ui->manualButton, SIGNAL(clicked()), SLOT(manual()));
	connect(ui->visualButton, SIGNAL(clicked()), SLOT(visual()));
	
	connect(ui->th, SIGNAL(textChanged(QString)), SLOT(manualEntry(QString)));
	connect(ui->ts, SIGNAL(textChanged(QString)), SLOT(manualEntry(QString)));
	connect(ui->tv, SIGNAL(textChanged(QString)), SLOT(manualEntry(QString)));
	connect(ui->bh, SIGNAL(textChanged(QString)), SLOT(manualEntry(QString)));
	connect(ui->bs, SIGNAL(textChanged(QString)), SLOT(manualEntry(QString)));
	connect(ui->bv, SIGNAL(textChanged(QString)), SLOT(manualEntry(QString)));
	
	connect(ui->visual, SIGNAL(minChanged(QColor)), SLOT(visualChanged()));
	connect(ui->visual, SIGNAL(maxChanged(QColor)), SLOT(visualChanged()));
	
	connect(ui->camera, SIGNAL(pressed(cv::Mat, int, int)), SLOT(imagePressed(cv::Mat, int, int)));
	
	connect(ui->done, SIGNAL(clicked()), SLOT(done()));
	
	ui->th->setInputProvider(m_numpad);
	ui->ts->setInputProvider(m_numpad);
	ui->tv->setInputProvider(m_numpad);
	ui->bh->setInputProvider(m_numpad);
	ui->bs->setInputProvider(m_numpad);
	ui->bv->setInputProvider(m_numpad);
  
  ui->camera->setTrackBlobs(true);
}
Ejemplo n.º 12
0
// This function is initiated in a separate thread, since nothing after
//  OSStart()
void monitorThread(void *pdata) {
	while (1) {
		printf("Beginning of monitor thread.\n");
		curISRState = ISRState;
		switch (ISRState) {
			case MANUAL_MODE:
				*(red_LED_ptr) = LED_MANUAL;
				ISRState = NORMAL_MODE; // Clear flag
				manual();
				break;
			case EMERGENCY_MODE:
				*(red_LED_ptr) = LED_EMERGENCY;
				ISRState = NORMAL_MODE; // Clear flag
				emergency();
				break;
			case BROKEN_MODE:
				*(red_LED_ptr) = LED_BROKEN;
				ISRState = NORMAL_MODE; // Clear flag
				broken();
				break;
			case TURN_MODE:
				*(red_LED_ptr) = LED_TURN;
				ISRState = NORMAL_MODE; // Clear flag
				turnLane();
				break;
			case PEDESTRIAN_MODE:
				*(red_LED_ptr) = LED_PEDESTRIAN;
				ISRState = NORMAL_MODE; // Clear flag
				pedestrian();
				break;
			default:
				*(red_LED_ptr) = LED_NORMAL;
				ISRState = NORMAL_MODE; // Clear flag
				normal();
				break;
		}
	}
}
Ejemplo n.º 13
0
int
main(int argc, char *argv[])
{
	extern char *optarg;
	extern int optind;
	TAG *searchlist;
	glob_t pg;
	size_t len;
	int ch, f_cat, f_how, found;
	const char *pager, *p_path;
	char **ap, *cmd, *machine, *p, *p_add, *sflag;
	char *conffile;

	if (argv[1] == NULL && strcmp(basename(__progname), "help") == 0) {
		static char *nargv[3];
		nargv[0] = "man";
		nargv[1] = "help";
		nargv[2] = NULL;
		argv = nargv;
		argc = 2;
	}

	machine = sflag = NULL;
	f_cat = f_how = 0;
	conffile = p_add = NULL;
	p_path = (const char *)NULL;
	while ((ch = getopt(argc, argv, "aC:cfhkM:m:P:s:S:w-")) != -1)
		switch (ch) {
		case 'a':
			f_all = 1;
			break;
		case 'C':
			conffile = optarg;
			break;
		case 'c':
		case '-':		/* Deprecated. */
			f_cat = 1;
			break;
		case 'h':
			f_how = 1;
			break;
		case 'm':
			p_add = optarg;
			break;
		case 'M':
		case 'P':		/* Backward compatibility. */
			p_path = optarg;
			break;
		case 's':		/* SVR4 compatibility. */
			sflag = optarg;
			break;
		case 'S':
			machine = optarg;
			break;
		/*
		 * The -f and -k options are backward compatible
		 * ways of calling whatis(1) and apropos(1).
		 */
		case 'f':
			jump(argv, "-f", "whatis");
			/* NOTREACHED */
		case 'k':
			jump(argv, "-k", "apropos");
			/* NOTREACHED */
		case 'w':
			f_where = 1;
			break;
		case '?':
		default:
			usage();
		}
	argc -= optind;
	argv += optind;

	if (!*argv)
		usage();

	if (!f_cat && !f_how && !f_where) {
		if (!isatty(1))
			f_cat = 1;
		else {
			pager = getenv("MANPAGER");
			if (pager == NULL || *pager == '\0')
				pager = getenv("PAGER");
			if (pager == NULL || *pager == '\0')
				pager = _PATH_PAGER;
		}
	}

	/* Read the configuration file. */
	config(conffile);

	/*
	 * 1: If the user specified a section,
	 *    use the section list from the configuration file.
	 *    Otherwise, fall back to the default list or to an empty list.
	 */
	if (sflag && (section = getlist(sflag)) == NULL)
		errx(1, "unknown manual section `%s'", sflag);
	else if (argv[1] && (section = getlist(*argv)) != NULL)
		++argv;

	searchlist = section;
	if (searchlist == NULL)
		searchlist = getlist("_default");
	if (searchlist == NULL)
		searchlist = addlist("_default");

	/*
	 * 2: If the user set the -M option or defined the MANPATH variable,
	 *    clear what we have and take the user's list instead.
	 */
	if (p_path == NULL)
		p_path = getenv("MANPATH");

	if (p_path) {
		clearlist(searchlist);
		parse_path(searchlist, p_path);
	}

	/*
	 * 3: If the user set the -m option, insert the user's list before
	 *    whatever list we have.
	 */
	if (p_add)
		parse_path(searchlist, p_add);

	/*
	 * 4: Append the _subdir list where appropriate,
	 *    and always append the machine type.
	 */
	if (machine || (machine = getenv("MACHINE"))) {
		/* Avoid mangling argv/environment. */
		if ((machine = strdup(machine)) == NULL)
			err(1, NULL);
		for (p = machine; *p; ++p)
			*p = tolower(*p);
	} else
		machine = MACHINE;

	append_subdirs(searchlist, machine);

	/*
	 * 5: Search for the files.  Set up an interrupt handler, so the
	 *    temporary files go away.
	 */
	(void)signal(SIGINT, onsig);
	(void)signal(SIGHUP, onsig);

	sigemptyset(&blocksigs);
	sigaddset(&blocksigs, SIGINT);
	sigaddset(&blocksigs, SIGHUP);

	memset(&pg, 0, sizeof(pg));
	for (found = 0; *argv; ++argv)
		if (manual(*argv, searchlist, &pg))
			found = 1;

	/* 6: If nothing found, we're done. */
	if (!found) {
		(void)cleanup(0);
		exit (1);
	}

	/* 7: If it's simple, display it fast. */
	if (f_cat) {
		for (ap = pg.gl_pathv; *ap != NULL; ++ap) {
			if (**ap == '\0')
				continue;
			cat(*ap);
		}
		exit (cleanup(0));
	}
	if (f_how) {
		for (ap = pg.gl_pathv; *ap != NULL; ++ap) {
			if (**ap == '\0')
				continue;
			how(*ap);
		}
		exit(cleanup(0));
	}
	if (f_where) {
		for (ap = pg.gl_pathv; *ap != NULL; ++ap) {
			if (**ap == '\0')
				continue;
			(void)puts(*ap);
		}
		exit(cleanup(0));
	}

	/*
	 * 8: We display things in a single command; build a list of things
	 *    to display.
	 */
	for (ap = pg.gl_pathv, len = strlen(pager) + 1; *ap != NULL; ++ap) {
		if (**ap == '\0')
			continue;
		len += strlen(*ap) + 1;
	}
	if ((cmd = malloc(len)) == NULL) {
		warn(NULL);
		(void)cleanup(0);
		exit(1);
	}
	p = cmd;
	len = strlen(pager);
	memcpy(p, pager, len);
	p += len;
	*p++ = ' ';
	for (ap = pg.gl_pathv; *ap != NULL; ++ap) {
		if (**ap == '\0')
			continue;
		len = strlen(*ap);
		memcpy(p, *ap, len);
		p += len;
		*p++ = ' ';
	}
	*--p = '\0';

	/* Use system(3) in case someone's pager is "pager arg1 arg2". */
	(void)system(cmd);

	exit(cleanup(0));
}
Ejemplo n.º 14
0
MainWindow::MainWindow()
{
	openAction = new QAction(tr("&Open"), this);
	saveAction = new QAction(tr("&Save"), this);
	exitAction = new QAction(tr("E&xit"), this);
	equalAction = new QAction(tr("&Equalization"), this);
	otsuAction = new QAction(tr("&otsu"), this);
	isodataAction = new QAction(tr("&Isodata"), this);
	manualAction = new QAction(tr("&Manual"), this);
	gammaAction = new QAction(tr("&Gamma"), this);
	stretchingAction = new QAction(tr("&Stretching"), this);
	sigmaAction = new QAction(tr("&Sigma"), this);
	medianAction = new QAction(tr("&Median"), this);
	lineAction = new QAction(tr("&Lines"), this);
	pixelAction = new QAction(tr("&Pixels"), this);
	gaussianAction = new QAction(tr("&Gaussian"), this);
	sobelAction = new QAction(tr("&Sobel"), this);	
	horizontalAction = new QAction(tr("&Line Intensity"), this);
	cannyAction = new QAction(tr("&Canny"),this);
	sumAction = new QAction(tr("&Add"),this);
	resAction = new QAction(tr("&Substract"),this);
	multAction = new QAction(tr("&Multiply"),this);
	divAction = new QAction(tr("&Divide"),this);
	avgAction = new QAction(tr("A&verage"),this);
	andAction = new QAction(tr("&And"),this);
	orAction = new QAction(tr("&Or"),this);
	xorAction = new QAction(tr("&Xor"),this);
	notAction = new QAction(tr("&Not"),this);
	minAction = new QAction(tr("M&in"),this);
	maxAction = new QAction(tr("M&ax"),this);
	kmeansAction = new QAction(tr("&Kmeans"),this);

	saveAction->setEnabled(false);

	connect(openAction, SIGNAL(triggered()), this, SLOT(open()));
	connect(saveAction, SIGNAL(triggered()), this, SLOT(save()));
	connect(exitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
	connect(equalAction, SIGNAL(triggered()), this, SLOT(equalization()));
	connect(otsuAction, SIGNAL(triggered()), this, SLOT(otsuThresh()));
	connect(isodataAction, SIGNAL(triggered()), this, SLOT(isodataSlot()));
	connect(manualAction, SIGNAL(triggered()), this, SLOT(manual()));
	connect(gammaAction,SIGNAL(triggered()),this,SLOT(gamma()));
	connect(stretchingAction,SIGNAL(triggered()),this,SLOT(stretching()));
	connect(sigmaAction, SIGNAL(triggered()), this, SLOT(sigma()));
	connect(medianAction, SIGNAL(triggered()), this, SLOT(median()));
	connect(lineAction, SIGNAL(triggered()), this, SLOT(line()));
	connect(pixelAction, SIGNAL(triggered()), this, SLOT(pixel()));
	connect(gaussianAction, SIGNAL(triggered()), this, SLOT(gaussian()));
	connect(sobelAction, SIGNAL(triggered()), this, SLOT(sobelEdges()));
	connect(horizontalAction,SIGNAL(triggered()),this,SLOT(horizontal()));
	connect(cannyAction,SIGNAL(triggered()),this,SLOT(cannySlot()));
	connect(sumAction,SIGNAL(triggered()),this,SLOT(sum()));
	connect(resAction,SIGNAL(triggered()),this,SLOT(res()));
	connect(multAction,SIGNAL(triggered()),this,SLOT(mult()));
	connect(divAction,SIGNAL(triggered()),this,SLOT(div()));
	connect(avgAction,SIGNAL(triggered()),this,SLOT(avg()));
	connect(andAction,SIGNAL(triggered()),this,SLOT(andSlot()));
	connect(orAction,SIGNAL(triggered()),this,SLOT(orSlot()));
	connect(xorAction,SIGNAL(triggered()),this,SLOT(xorSlot()));
	connect(notAction,SIGNAL(triggered()),this,SLOT(notSlot()));
	connect(minAction,SIGNAL(triggered()),this,SLOT(minSlot()));
	connect(maxAction,SIGNAL(triggered()),this,SLOT(maxSlot()));
	connect(kmeansAction,SIGNAL(triggered()),this,SLOT(kmeansSlot()));
	
	fileMenu = menuBar()->addMenu(tr("&File"));
	equalizationMenu = menuBar()->addMenu(tr("&Equalization"));
	thresholdMenu = menuBar()->addMenu(tr("&Thresholding"));
	contrastMenu = menuBar()->addMenu(tr("&Contrast"));
	noiseMenu = menuBar()->addMenu(tr("&Noise"));
	edgeMenu = menuBar()->addMenu(tr("E&dge"));
	operationMenu = menuBar()->addMenu(tr("&Operation"));
	boolMenu = operationMenu->addMenu(tr("&Boolean"));
	arithMenu = operationMenu->addMenu(tr("&Arithmetic"));
	relMenu = operationMenu->addMenu(tr("&Relational"));
	segmentationMenu = menuBar()->addMenu(tr("&Segmentation"));
	
	equalizationMenu->setEnabled(false);
	thresholdMenu->setEnabled(false);
	contrastMenu->setEnabled(false);
	noiseMenu->setEnabled(false);
	edgeMenu->setEnabled(false);
	operationMenu->setEnabled(false);
	segmentationMenu->setEnabled(false);
	
	fileMenu->addAction(openAction);
	fileMenu->addAction(saveAction);
	fileMenu->addSeparator();
	fileMenu->addAction(exitAction);

	equalizationMenu->addAction(equalAction);
	
	thresholdMenu->addAction(otsuAction);
	thresholdMenu->addAction(isodataAction);
	thresholdMenu->addAction(manualAction);
	
	contrastMenu->addAction(gammaAction);
	contrastMenu->addAction(stretchingAction);
	
	noiseMenu->addAction(sigmaAction);
	noiseMenu->addAction(medianAction);
	noiseMenu->addAction(lineAction);
	noiseMenu->addAction(pixelAction);
	noiseMenu->addAction(gaussianAction);
	
	edgeMenu->addAction(sobelAction);
	edgeMenu->addAction(horizontalAction);
	edgeMenu->addAction(cannyAction);

	boolMenu->addAction(andAction);
	boolMenu->addAction(orAction);
	boolMenu->addAction(xorAction);
	boolMenu->addAction(notAction);
	
	arithMenu->addAction(sumAction);
	arithMenu->addAction(resAction);
	arithMenu->addAction(multAction);
	arithMenu->addAction(divAction);
	arithMenu->addAction(avgAction);
	
	relMenu->addAction(minAction);
	relMenu->addAction(maxAction);
	
	segmentationMenu->addAction(kmeansAction);
	//-----

	viewer = new ImageViewer(this);
	
	QScrollArea * scrollArea = new QScrollArea;
	scrollArea->setWidget(viewer);
	scrollArea->setFixedWidth(600);
    scrollArea->setWidgetResizable(true);
    
 	boxW = new QSpinBox();
 	boxW->setEnabled(false);
 	boxW->setMaximum(65535);
 	
 	boxC = new QSpinBox();
 	boxC->setEnabled(false);
 	boxC->setMaximum(65535);
	
	histoViewer = new ImageViewer(this);
	QScrollArea * histoArea = new QScrollArea;
	histoArea->setWidget(histoViewer);
	histoArea->setFixedSize(268,278);
    histoArea->setWidgetResizable(false);
	
	QVBoxLayout * rightLayout = new QVBoxLayout;
	rightLayout->addWidget(new QLabel("Window:",this));
	rightLayout->addWidget(boxW);
	rightLayout->addWidget(new QLabel("Level:",this));
	rightLayout->addWidget(boxC);
	rightLayout->addWidget(histoArea);
	
	connect(boxW,SIGNAL(valueChanged(int)),this,SLOT(changeW(int)));
	connect(boxC,SIGNAL(valueChanged(int)),this,SLOT(changeC(int)));
	
	QWidget * rightSide = new QWidget;
	rightSide->setLayout(rightLayout);
	
	QHBoxLayout *mainLayout = new QHBoxLayout;
	mainLayout->addWidget(scrollArea);
	mainLayout->addWidget(rightSide);	

	
	QWidget * centralWidget = new QWidget();
	centralWidget->setLayout(mainLayout);
	
	
	setCentralWidget(centralWidget);

	setWindowTitle(tr("DICOM Image Processor"));
    setFixedSize(QSize(900,600));
}
Ejemplo n.º 15
0
MainWindow::MainWindow()
  : m_settings(QString::fromAscii("Doxygen.org"), QString::fromAscii("Doxywizard"))
{
  QMenu *file = menuBar()->addMenu(tr("File"));
  file->addAction(tr("Open..."), 
                  this, SLOT(openConfig()), Qt::CTRL+Qt::Key_O);
  m_recentMenu = file->addMenu(tr("Open recent"));
  file->addAction(tr("Save"), 
                  this, SLOT(saveConfig()), Qt::CTRL+Qt::Key_S);
  file->addAction(tr("Save as..."), 
                  this, SLOT(saveConfigAs()), Qt::SHIFT+Qt::CTRL+Qt::Key_S);
  file->addAction(tr("Quit"),  
                  this, SLOT(quit()), Qt::CTRL+Qt::Key_Q);

  QMenu *settings = menuBar()->addMenu(tr("Settings"));
  settings->addAction(tr("Reset to factory defaults"),
                  this,SLOT(resetToDefaults()));
  settings->addAction(tr("Use current settings at startup"),
                  this,SLOT(makeDefaults()));
  settings->addAction(tr("Clear recent list"),
                  this,SLOT(clearRecent()));

  QMenu *help = menuBar()->addMenu(tr("Help"));
  help->addAction(tr("Online manual"), 
                  this, SLOT(manual()), Qt::Key_F1);
  help->addAction(tr("About"), 
                  this, SLOT(about()) );

  m_expert = new Expert;
  m_wizard = new Wizard(m_expert->modelData());

  // ----------- top part ------------------
  QWidget *topPart = new QWidget;
  QVBoxLayout *rowLayout = new QVBoxLayout(topPart);

  // select working directory
  QHBoxLayout *dirLayout = new QHBoxLayout;
  m_workingDir = new QLineEdit;
  m_selWorkingDir = new QPushButton(tr("Select..."));
  dirLayout->addWidget(m_workingDir);
  dirLayout->addWidget(m_selWorkingDir);

  //------------- bottom part --------------
  QWidget *runTab = new QWidget;
  QVBoxLayout *runTabLayout = new QVBoxLayout(runTab);

  // run doxygen
  QHBoxLayout *runLayout = new QHBoxLayout;
  m_run = new QPushButton(tr("Run doxygen"));
  m_run->setEnabled(false);
  m_runStatus = new QLabel(tr("Status: not running"));
  m_saveLog = new QPushButton(tr("Save log..."));
  m_saveLog->setEnabled(false);
  QPushButton *showSettings = new QPushButton(tr("Show configuration"));
  runLayout->addWidget(m_run);
  runLayout->addWidget(m_runStatus);
  runLayout->addStretch(1);
  runLayout->addWidget(showSettings);
  runLayout->addWidget(m_saveLog);

  // output produced by doxygen
  runTabLayout->addLayout(runLayout);
  runTabLayout->addWidget(new QLabel(tr("Output produced by doxygen")));
  QGridLayout *grid = new QGridLayout;
  m_outputLog = new QTextEdit;
  m_outputLog->setReadOnly(true);
  m_outputLog->setFontFamily(QString::fromAscii("courier"));
  m_outputLog->setMinimumWidth(600);
  grid->addWidget(m_outputLog,0,0);
  grid->setColumnStretch(0,1);
  grid->setRowStretch(0,1);
  QHBoxLayout *launchLayout = new QHBoxLayout;
  m_launchHtml = new QPushButton(tr("Show HTML output"));
  launchLayout->addWidget(m_launchHtml);

  launchLayout->addStretch(1);
  grid->addLayout(launchLayout,1,0);
  runTabLayout->addLayout(grid);

  QTabWidget *tabs = new QTabWidget;
  tabs->addTab(m_wizard,tr("Wizard"));
  tabs->addTab(m_expert,tr("Expert"));
  tabs->addTab(runTab,tr("Run"));

  rowLayout->addWidget(new QLabel(tr("Step 1: Specify the working directory from which doxygen will run")));
  rowLayout->addLayout(dirLayout);
  rowLayout->addWidget(new QLabel(tr("Step 2: Configure doxygen using the Wizard and/or Expert tab, then switch to the Run tab to generate the documentation")));
  rowLayout->addWidget(tabs);

  setCentralWidget(topPart);
  statusBar()->showMessage(tr("Welcome to Doxygen"),messageTimeout);

  m_runProcess = new QProcess;
  m_running = false;
  m_timer = new QTimer;

  // connect signals and slots
  connect(tabs,SIGNAL(currentChanged(int)),SLOT(selectTab(int)));
  connect(m_selWorkingDir,SIGNAL(clicked()),SLOT(selectWorkingDir()));
  connect(m_recentMenu,SIGNAL(triggered(QAction*)),SLOT(openRecent(QAction*)));
  connect(m_workingDir,SIGNAL(returnPressed()),SLOT(updateWorkingDir()));
  connect(m_runProcess,SIGNAL(readyReadStandardOutput()),SLOT(readStdout()));
  connect(m_runProcess,SIGNAL(finished(int, QProcess::ExitStatus)),SLOT(runComplete()));
  connect(m_timer,SIGNAL(timeout()),SLOT(readStdout()));
  connect(m_run,SIGNAL(clicked()),SLOT(runDoxygen()));
  connect(m_launchHtml,SIGNAL(clicked()),SLOT(showHtmlOutput()));
  connect(m_saveLog,SIGNAL(clicked()),SLOT(saveLog()));
  connect(showSettings,SIGNAL(clicked()),SLOT(showSettings()));
  connect(m_expert,SIGNAL(changed()),SLOT(configChanged()));

  loadSettings();
  updateLaunchButtonState();
  m_modified = false;
  updateTitle();
  m_wizard->refresh();
}
Ejemplo n.º 16
0
int
main(int argc, char **argv)
{
	int		c, i;
	char		**pathv;
	char		*manpath = NULL;
	static struct man_node *mandirs = NULL;
	int		bmp_flags = 0;
	int		ret = 0;
	char		*opts;
	char		*mwstr;
	int		catman = 0;

	(void) setlocale(LC_ALL, "");
	(void) strcpy(language, setlocale(LC_MESSAGES, (char *)NULL));
	if (strcmp("C", language) != 0)
		(void) strlcpy(localedir, language, MAXPATHLEN);

#if !defined(TEXT_DOMAIN)
#define	TEXT_DOMAIN "SYS_TEST"
#endif
	(void) textdomain(TEXT_DOMAIN);

	if (strcmp(__progname, "apropos") == 0) {
		apropos++;
		opts = "M:ds:";
	} else if (strcmp(__progname, "whatis") == 0) {
		apropos++;
		whatis++;
		opts = "M:ds:";
	} else if (strcmp(__progname, "catman") == 0) {
		catman++;
		makewhatis++;
		opts = "P:M:w";
	} else if (strcmp(__progname, "makewhatis") == 0) {
		makewhatis++;
		makewhatishere++;
		manpath = ".";
		opts = "";
	} else {
		opts = "FM:P:T:adfklprs:tw";
		if (argc > 1 && strcmp(argv[1], "-") == 0) {
			pager = "cat";
			optind++;
		}
	}

	opterr = 0;
	while ((c = getopt(argc, argv, opts)) != -1) {
		switch (c) {
		case 'M':	/* Respecify path for man pages */
			manpath = optarg;
			break;
		case 'a':
			all++;
			break;
		case 'd':
			debug++;
			break;
		case 'f':
			whatis++;
			/*FALLTHROUGH*/
		case 'k':
			apropos++;
			break;
		case 'l':
			list++;
			all++;
			break;
		case 'p':
			printmp++;
			break;
		case 's':
			mansec = optarg;
			sargs++;
			break;
		case 'r':
			lintout++;
			break;
		case 't':
			psoutput++;
			break;
		case 'T':
		case 'P':
		case 'F':
			/* legacy options, compatibility only and ignored */
			break;
		case 'w':
			makewhatis++;
			break;
		case '?':
		default:
			if (apropos)
				usage_whatapro();
			else if (catman)
				usage_catman();
			else if (makewhatishere)
				usage_makewhatis();
			else
				usage_man();
		}
	}
	argc -= optind;
	argv += optind;

	if (argc == 0) {
		if (apropos) {
			(void) fprintf(stderr, gettext("%s what?\n"),
			    __progname);
			exit(1);
		} else if (!printmp && !makewhatis) {
			(void) fprintf(stderr,
			    gettext("What manual page do you want?\n"));
			exit(1);
		}
	}

	init_bintoman();
	if (manpath == NULL && (manpath = getenv("MANPATH")) == NULL) {
		if ((manpath = getenv("PATH")) != NULL)
			bmp_flags = BMP_ISPATH | BMP_APPEND_DEFMANDIR;
		else
			manpath = DEFMANDIR;
	}
	pathv = split(manpath, ':');
	mandirs = build_manpath(pathv, bmp_flags);
	freev(pathv);
	fullpaths(&mandirs);

	if (makewhatis) {
		do_makewhatis(mandirs);
		exit(0);
	}

	if (printmp) {
		print_manpath(mandirs);
		exit(0);
	}

	/* Collect environment information */
	if (isatty(STDOUT_FILENO) && (mwstr = getenv("MANWIDTH")) != NULL &&
	    *mwstr != '\0') {
		if (strcasecmp(mwstr, "tty") == 0) {
			struct winsize	ws;

			if (ioctl(0, TIOCGWINSZ, &ws) != 0)
				warn("TIOCGWINSZ");
			else
				manwidth = ws.ws_col;
		} else {
			manwidth = (int)strtol(mwstr, (char **)NULL, 10);
			if (manwidth < 0)
				manwidth = 0;
		}
	}
	if (manwidth != 0) {
		DPRINTF("-- Using non-standard page width: %d\n", manwidth);
	}

	if (pager == NULL) {
		if ((pager = getenv("PAGER")) == NULL || *pager == '\0')
			pager = PAGER;
	}
	DPRINTF("-- Using pager: %s\n", pager);

	for (i = 0; i < argc; i++) {
		char		*cmd;
		static struct man_node *mp;
		char		*pv[2];

		/*
		 * If full path to command specified, customize
		 * the manpath accordingly.
		 */
		if ((cmd = strrchr(argv[i], '/')) != NULL) {
			*cmd = '\0';
			if ((pv[0] = strdup(argv[i])) == NULL)
				err(1, "strdup");
			pv[1] = NULL;
			*cmd = '/';
			mp = build_manpath(pv,
			    BMP_ISPATH | BMP_FALLBACK_DEFMANDIR);
		} else {
			mp = mandirs;
		}

		if (apropos)
			whatapro(mp, argv[i]);
		else
			ret += manual(mp, argv[i]);

		if (mp != NULL && mp != mandirs) {
			free(pv[0]);
			free_manp(mp);
		}
	}

	return (ret == 0 ? 0 : 1);
}
Ejemplo n.º 17
0
/**************************************************************
 *
 *  add the static menu bars
 *
 *************************************************************/
void
MainWindow::addStaticMenuBarContent()
{
  qDebug("Beginning addStaticMenuBarContent");
  
  //File
  QPopupMenu* fileMenu = _menus.find(FILE_KEY);

  if(!fileMenu)
  {
    std::cout <<  "PROUT" << std::endl;
    
    QPopupMenu * file = new QPopupMenu( this );
    _menus.insert(FILE_KEY, file);
    menuBar()->insertItem( FILE_KEY, _menus[FILE_KEY]);
  }

  _menus[FILE_KEY]->insertSeparator();

  //Cylinder Menu
  QPopupMenu* cylinderMenu =  _menus.find(CYLINDER_KEY);
  if (!cylinderMenu)
  {
    QPopupMenu * help = new QPopupMenu( this );
    _menus.insert(CYLINDER_KEY, help);
    menuBar()->insertItem( CYLINDER_KEY, _menus[CYLINDER_KEY]);
  }
  
  
  QAction* generateCylinderAction = new QAction("generate",
                                                QIconSet( QPixmap(IMAGES_DIR + CYLINDER_IMAGE) ),
                                                "&Generate",
                                                CTRL+Key_G,
                                                this);
  
  connect(generateCylinderAction,
          SIGNAL( activated() ),
          this,
          SLOT( generateCylinder() ) );

  generateCylinderAction->addTo(_menus[CYLINDER_KEY]);
  _toolBar->addSeparator();
  generateCylinderAction->addTo(_toolBar);


  QAction* quitAction = new QAction("quit",
                                    QIconSet( QPixmap(IMAGES_DIR + QUIT_IMAGE) ),
                                    "&Quit",
                                    CTRL+Key_Q,
                                    this);
  connect(quitAction,
          SIGNAL( activated() ),
          qApp,
          SLOT( quit() ) );

  quitAction->addTo(_menus[FILE_KEY]);

  _toolBar->addSeparator();
  quitAction->addTo(_toolBar);

  //Tools Menu
  QPopupMenu* toolsMenu =  _menus.find(TOOLS_KEY);
  if (!toolsMenu)
  {
    QPopupMenu * tools = new QPopupMenu( this );
    _menus.insert(TOOLS_KEY, tools);
    menuBar()->insertItem( TOOLS_KEY, _menus[TOOLS_KEY]);
  }
  
  //_menus[TOOLS_KEY]->insertItem("Validate Solid", this, SLOT( validation() ) );
  
    
  //Help Menu with about
  QPopupMenu* helpMenu =  _menus.find(HELP_KEY);

  if (!helpMenu)
  {
    QPopupMenu * help = new QPopupMenu( this );
    _menus.insert(HELP_KEY, help);
    menuBar()->insertItem( HELP_KEY, _menus[HELP_KEY]);
  }

  _menus[HELP_KEY]->insertItem( "Getting &Started", this, SLOT(manual()));
  _menus[HELP_KEY]->insertItem( "&About", this, SLOT(about()));
  
}
Ejemplo n.º 18
0
void MenuBar::createActions()
{
    openAction = new QAction(this);
    saveAction = new QAction(this);
    saveAsAction = new QAction(this);
    exitAction = new QAction(this);
    undoAction = new QAction(this);
    redoAction = new QAction(this);
    cutAction = new QAction(this);
    copyAction = new QAction(this);
    pasteAction = new QAction(this);
    interpretAction = new QAction(this);
    fullscrAction = new QAction(this);
    chooseInterpreterAction = new QAction(this);
    languageActionGroup = new QActionGroup(this);
    rusAction = new QAction(languageActionGroup);
    engAction = new QAction(languageActionGroup);
    gerAction = new QAction(languageActionGroup);
    commentAction = new QAction(this);
    manualAction = new QAction(this);
    aboutAction = new QAction(this);
    aboutQtAction = new QAction(this);

    openAction->setIcon(QPixmap(":icons/open.png")); //setting up icons
    saveAction->setIcon(QPixmap(":icons/save.png"));
    saveAsAction->setIcon(QPixmap(":icons/saveAs.png"));
    exitAction->setIcon(QPixmap(":icons/exit.png"));
    undoAction->setIcon(QPixmap(":icons/undo.png"));
    redoAction->setIcon(QPixmap(":icons/redo.png"));
    cutAction->setIcon(QPixmap(":icons/cut.png"));
    copyAction->setIcon(QPixmap(":icons/copy.png"));
    pasteAction->setIcon(QPixmap(":icons/paste.png"));
    interpretAction->setIcon(QPixmap(":icons/compile.png"));
    fullscrAction->setIcon(QPixmap(":icons/fullscreen.png"));
    chooseInterpreterAction->setIcon(QPixmap(":icons/compiler.png"));
    engAction->setIcon(QPixmap(":icons/en.png"));
    rusAction->setIcon(QPixmap(":icons/ru.png"));
    gerAction->setIcon(QPixmap(":icons/de.png"));
    commentAction->setIcon(QPixmap(":icons/comment.png"));
    manualAction->setIcon(QPixmap(":icons/help.png"));
    aboutAction->setIcon(QPixmap(":icons/about.png"));
    aboutQtAction->setIcon(QPixmap(":icons/qt.png"));

    openAction->setShortcut(Qt::CTRL + Qt::Key_O); //setting up shortcuts
    saveAction->setShortcut(Qt::CTRL + Qt::Key_S);
    exitAction->setShortcut(Qt::CTRL + Qt::Key_W);
    undoAction->setShortcut(Qt::CTRL + Qt::Key_Z);
    redoAction->setShortcut(Qt::CTRL + Qt::Key_Y);
    cutAction->setShortcut(Qt::CTRL + Qt::Key_X);
    copyAction->setShortcut(Qt::CTRL + Qt::Key_C);
    pasteAction->setShortcut(Qt::CTRL + Qt::Key_V);
    interpretAction->setShortcut(Qt::CTRL + Qt::Key_R);
    fullscrAction->setShortcut(Qt::Key_F11);
    chooseInterpreterAction->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_I);
    engAction->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_E);
    rusAction->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_R);
    gerAction->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_G);
    commentAction->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_C);
    manualAction->setShortcut(Qt::Key_F1);

    fullscrAction->setCheckable(true); //setting up checkability
    rusAction->setCheckable(true);
    engAction->setCheckable(true);
    gerAction->setCheckable(true);

    connect(openAction, SIGNAL(triggered()), SIGNAL(open()));
    connect(saveAction, SIGNAL(triggered()), SIGNAL(save()));
    connect(saveAsAction, SIGNAL(triggered()), SIGNAL(saveAs()));
    connect(exitAction, SIGNAL(triggered()), SIGNAL(exit()));
    connect(undoAction, SIGNAL(triggered()), SIGNAL(undo()));
    connect(redoAction, SIGNAL(triggered()), SIGNAL(redo()));
    connect(cutAction, SIGNAL(triggered()), SIGNAL(cut()));
    connect(copyAction, SIGNAL(triggered()), SIGNAL(copy()));
    connect(pasteAction, SIGNAL(triggered()), SIGNAL(paste()));
    connect(commentAction, SIGNAL(triggered()), SIGNAL(comment()));
    connect(interpretAction, SIGNAL(triggered()), SIGNAL(interpret()));
    connect(fullscrAction, SIGNAL(triggered()), SIGNAL(fullscr()));
    connect(chooseInterpreterAction, SIGNAL(triggered()), SIGNAL(chooseInterpreter()));
    connect(languageActionGroup, SIGNAL(triggered(QAction*)), SIGNAL(groupLanguage(QAction*)));
    connect(aboutAction, SIGNAL(triggered()), SIGNAL(about()));
    connect(aboutQtAction, SIGNAL(triggered()), SIGNAL(aboutQt()));
    connect(manualAction, SIGNAL(triggered()), SIGNAL(manual()));
}
Ejemplo n.º 19
0
bool TrWindow::qt_invoke( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0:
        doneAndNext();
        break;
    case 1:
        prev();
        break;
    case 2:
        next();
        break;
    case 3:
        recentFileActivated((int)static_QUType_int.get(_o+1));
        break;
    case 4:
        setupRecentFilesMenu();
        break;
    case 5:
        open();
        break;
    case 6:
        save();
        break;
    case 7:
        saveAs();
        break;
    case 8:
        release();
        break;
    case 9:
        print();
        break;
    case 10:
        find();
        break;
    case 11:
        findAgain();
        break;
    case 12:
        replace();
        break;
    case 13:
        newPhraseBook();
        break;
    case 14:
        openPhraseBook();
        break;
    case 15:
        closePhraseBook((int)static_QUType_int.get(_o+1));
        break;
    case 16:
        editPhraseBook((int)static_QUType_int.get(_o+1));
        break;
    case 17:
        printPhraseBook((int)static_QUType_int.get(_o+1));
        break;
    case 18:
        manual();
        break;
    case 19:
        revertSorting();
        break;
    case 20:
        about();
        break;
    case 21:
        aboutQt();
        break;
    case 22:
        setupPhrase();
        break;
    case 23:
        static_QUType_bool.set(_o,maybeSave());
        break;
    case 24:
        updateCaption();
        break;
    case 25:
        showNewScope((QListViewItem*)static_QUType_ptr.get(_o+1));
        break;
    case 26:
        showNewCurrent((QListViewItem*)static_QUType_ptr.get(_o+1));
        break;
    case 27:
        updateTranslation((const QString&)static_QUType_QString.get(_o+1));
        break;
    case 28:
        updateFinished((bool)static_QUType_bool.get(_o+1));
        break;
    case 29:
        toggleFinished((QListViewItem*)static_QUType_ptr.get(_o+1),(const QPoint&)*((const QPoint*)static_QUType_ptr.get(_o+2)),(int)static_QUType_int.get(_o+3));
        break;
    case 30:
        prevUnfinished();
        break;
    case 31:
        nextUnfinished();
        break;
    case 32:
        findNext((const QString&)static_QUType_QString.get(_o+1),(int)static_QUType_int.get(_o+2),(bool)static_QUType_bool.get(_o+3));
        break;
    case 33:
        revalidate();
        break;
    case 34:
        toggleGuessing();
        break;
    case 35:
        focusSourceList();
        break;
    case 36:
        focusPhraseList();
        break;
    case 37:
        updateClosePhraseBook();
        break;
    case 38:
        toggleStatistics();
        break;
    case 39:
        updateStatistics();
        break;
    default:
        return QMainWindow::qt_invoke( _id, _o );
    }
    return TRUE;
}
Ejemplo n.º 20
0
int main(void)
{
	setup();
	uart_init();
	TWI_Init();
	input = getchar();
	while((input != 's'))//wait for user input to begin program
	{
		input = getchar();
	}
	sei();//global interrupts on
	IMU_setup();
	printf("\nLet's Begin\n\nChoose an option:\n\n  space bar - PID (loops forever)\n        'm' - manual control (loops forever)\n        'i' - check IMU\n        'x' - get x acceleration\n        'y' - get y acceleration\n        'z' - get z acceleration\n        'f' - bluetooth fast mode\n        't' - test IMU write\n        'a' - enter acceleration mode\n");
	while((1))
	{
		input = getchar();
		if ((input == ' '))//PID algorithm
		{
			output_timer_on();
			while((1))
			{
				PID();
			}
		}
		else if ((input == 'm'))//manual control
		{
			printf("\nManual Mode:\n\nInstructions:\n\n    'n' - forwards\n    'v' - reverse\n    'b' - stop\n  '1-9' - use the number keys to select the power level\n");
			while((1))
			{
				manual();
			}
		}
		else if ((input == 'i'))//check WHO_AM_I register
		{
			check_imu();	
		}
		else if ((input == 'x'))//get x direction acceleration
		{
			acceleration = get_accel('x');
			print_float(acceleration);
			printf("\n");
		}
		else if ((input == 'y'))//get y direction acceleration
		{
			acceleration = get_accel('y');
			print_float(acceleration);
			printf("\n");
		}
		else if ((input == 'z'))//get z direction acceleration
		{
			acceleration = get_accel('z');
			print_float(acceleration);
			printf("\n");
		}
		else if ((input == 'f'))//place RN-42 HID into fast mode
		{
			fast_mode();
		}
		else if ((input == 't'))//write a regsiter of the IMU and check it worked
		{
			TWI_WRITEBYTE(MPU6050_PWR_MGMT_1, 0x02);
			if ((TWI_READBYTE(MPU6050_PWR_MGMT_1) == 0x02))
				printf("\nSuccess\n");
			else
				printf("\nFailure\n");
		}
		else if ((input == 'a'))//acceleration mode for acquiring data
		{
			acceleration_mode();
		}
	}

}
Ejemplo n.º 21
0
void MainWindow::createMenus()
{
    openAct = new QAction(tr("读取地图(&M)"), this);
    saveAct = new QAction(tr("存档(&S)"), this);
    loadAct = new QAction(tr("读档(&R)"), this);
    rechargeAct = new QAction(tr("充值(&C)"), this);
    exitAct = new QAction(tr("退出(&E)"), this);

    restartAct = new QAction(tr("重新开始(&L)"), this);
    hardAct = new QAction(tr("困难"), this);
    mediumAct = new QAction(tr("中等"), this);
    easyAct = new QAction(tr("简单"), this);
    foresoundAct = new QAction(tr("音效开关(&O)"), this);

    manualAct = new QAction(tr("用户手册(&U)"), this);
    aboutAct = new QAction(tr("关于(&A)"), this);

    fileMenu = menuBar()->addMenu(tr("文件(&F)"));
    settingMenu = menuBar()->addMenu(tr("游戏设置(&G)"));
    helpMenu = menuBar()->addMenu(tr("帮助(&H)"));

    fileMenu->addAction(openAct);
    openAct->setShortcut(QKeySequence("Ctrl+m"));
    fileMenu->addSeparator();
    fileMenu->addAction(saveAct);
    saveAct->setShortcut(QKeySequence("Ctrl+s"));
    fileMenu->addAction(loadAct);
    loadAct->setShortcut(QKeySequence("Ctrl+r"));
    fileMenu->addSeparator();
    fileMenu->addAction(rechargeAct);
    rechargeAct->setShortcut(QKeySequence("Ctrl+c"));
    fileMenu->addSeparator();
    fileMenu->addAction(exitAct);
    exitAct->setShortcut(QKeySequence("Ctrl+e"));

    settingMenu->addAction(restartAct);
    restartAct->setShortcut(QKeySequence("Ctrl+l"));
    settingMenu->addSeparator();
    difficultyMenu = settingMenu->addMenu(tr("选择难度(&D)"));
    settingMenu->addSeparator();
    settingMenu->addAction(foresoundAct);
    foresoundAct->setCheckable(true);
    foresoundAct->setChecked(true);
    foresoundAct->setShortcut(QKeySequence("Ctrl+o"));

    difficultyMenu->addAction(hardAct);
    hardAct->setCheckable(true);
    hardAct->setChecked(false);
    difficultyMenu->addAction(mediumAct);
    mediumAct->setCheckable(true);
    mediumAct->setChecked(true);
    difficultyMenu->addAction(easyAct);
    easyAct->setCheckable(true);
    easyAct->setChecked(false);

    helpMenu->addAction(manualAct);
    manualAct->setShortcut(QKeySequence("Ctrl+u"));
    helpMenu->addAction(aboutAct);
    aboutAct->setShortcut(QKeySequence("Ctrl+a"));

    connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));
    connect(openAct, SIGNAL(triggered()), this, SLOT(open()));
    connect(saveAct, SIGNAL(triggered()), this, SLOT(save()));
    connect(loadAct, SIGNAL(triggered()), this, SLOT(load()));
    connect(rechargeAct, SIGNAL(triggered()),this, SLOT(recharge()));

    connect(restartAct, SIGNAL(triggered()), this, SLOT(restart()));
    connect(hardAct, SIGNAL(triggered()), this, SLOT(hard()));
    connect(mediumAct, SIGNAL(triggered()), this, SLOT(medium()));
    connect(easyAct, SIGNAL(triggered()), this, SLOT(easy()));
    connect(foresoundAct, SIGNAL(triggered()), this, SLOT(foresound()));

    connect(manualAct, SIGNAL(triggered()), this, SLOT(manual()));
    connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));
}