void PrettyPrint::showMenu(){
    int command;
    do{
        printf("\n--------------------------------------------------------------\n\n");
        printf(" Please select the command.\n "
               "(1)FindRoute (2)Search Location (3)Show All Location (0)Exit\n"
               "[?] Select: ");
        scanf("%d", &command);
        printf("--------------------------------------------------------------\n\n");
        switch (command) {
            case 1:
                menuFindRoute();
                break;
            case 2:
                menuSearch();
                break;
            case 3:
                menuShowAll();
                break;
            case 0:
                break;
            default:
                printf("[!] Invalid command.\n");
                break;
        }
        sleep(3);
    }while(command != 0);
    printf("[!] By bye :D");
}
Example #2
0
void searchManage(Book b[],int n)            /*该函数完成根据条件查询功能*/
{
    Book b1;
	int i,choice,findnum,f[NUM];
	do
	{
		menuSearch( );                       /*显示对应的二级菜单*/
		printf("choose one operation you want to do:\n");
		scanf("%d",&choice);
		switch(choice)
		{
			case 1:   printf("Input a book\'s ISBN will be searched:\n");
			    scanf("%s",b1.ISBN);         /*输入待查图书的ISBN*/
				break;
			case 2:   printf("Input a book\'s name will be searched:\n");
				 scanf("%s",b1.name);	     /*输入待查图书书名*/
				 break;   
			case 3:   printf("Input an author  will be searched:\n");
				 scanf("%s",b1.author);      /*输入待查图书的作者*/
				 break;
			case 4:   printf("Input a press  will be searched:\n");
				  scanf("%s",b1.press);      /*输入待查图书的出版社*/
				  break;
            case 0:
				  break;
		}
		if (choice>=1 && choice<=4)
		{ 
			findnum=searchBook(b,n,b1,choice,f);    /*查找的符合条件元素的下标存于f数组中*/
			if (findnum)                            /*如果查找成功*/
			{
				for (i=0;i<findnum;i++)       /*循环控制f数组的下标*/
	      		printBook(&b[f[i]],1);        /*每次输出一条记录*/
			}
		    else
			    printf("this record does not exist!\n\n"); /*如果查找不到元素,则输出提示信息*/
		 }
	}while (choice);
}
Example #3
0
void MainWindow::setupMenuBar()
{
    QMenu *menu = menuBar()->addMenu(tr("&File"));

    QAction *action = menu->addAction(tr("Save layout..."));
    connect(action, SIGNAL(triggered()), this, SLOT(menuSaveLayout()));

    action = menu->addAction(tr("Load layout..."));
    connect(action, SIGNAL(triggered()), this, SLOT(menuLoadLayout()));

    action = menu->addAction(tr("Default layout"));
    connect(action, SIGNAL(triggered()), this, SLOT(defaultLoadLayout()));

    menu->addSeparator();

    menu->addAction(tr("&Quit"), this, SLOT(close()));

    // -- Dock Options menu
    mainWindowMenu = menuBar()->addMenu(tr("Main window"));

    action = mainWindowMenu->addAction(tr("Animated docks"));
    action->setCheckable(true);
    action->setChecked(dockOptions() & AnimatedDocks);
    connect(action, SIGNAL(toggled(bool)), this, SLOT(setDockOptions()));

    action = mainWindowMenu->addAction(tr("Allow nested docks"));
    action->setCheckable(true);
    action->setChecked(dockOptions() & AllowNestedDocks);
    connect(action, SIGNAL(toggled(bool)), this, SLOT(setDockOptions()));

    action = mainWindowMenu->addAction(tr("Allow tabbed docks"));
    action->setCheckable(true);
    action->setChecked(dockOptions() & AllowTabbedDocks);
    connect(action, SIGNAL(toggled(bool)), this, SLOT(setDockOptions()));

    action = mainWindowMenu->addAction(tr("Force tabbed docks"));
    action->setCheckable(true);
    action->setChecked(dockOptions() & ForceTabbedDocks);
    connect(action, SIGNAL(toggled(bool)), this, SLOT(setDockOptions()));

    action = mainWindowMenu->addAction(tr("Vertical tabs"));
    action->setCheckable(true);
    action->setChecked(dockOptions() & VerticalTabs);
    connect(action, SIGNAL(toggled(bool)), this, SLOT(setDockOptions()));

    // -- Dock Widgets menu
    dockWidgetMenu = menuBar()->addMenu(tr("&Dock Options"));

    menuBar()->addSeparator();

    // -- Scripts menu
    QMenu* debug_menu = menuBar()->addMenu(tr("&Debug"));

    action = debug_menu->addAction(tr("Stop  [Shift + F5]"));
    connect(action, SIGNAL(triggered()), this, SLOT(menuDebugStop()));

    action = debug_menu->addAction(tr("Run  [F5]"));
    connect(action, SIGNAL(triggered()), this, SLOT(menuDebugRun()));

    action = debug_menu->addAction(tr("Step Over  [F10]"));
    connect(action, SIGNAL(triggered()), this, SLOT(menuDebugStepOver()));

    action = debug_menu->addAction(tr("Step In  [F11]"));
    connect(action, SIGNAL(triggered()), this, SLOT(menuDebugStepIn()));

    action = debug_menu->addAction(tr("Step Out  [Shift + F11]"));
    connect(action, SIGNAL(triggered()), this, SLOT(menuDebugStepOut()));

    debug_menu->addSeparator();

    action = debug_menu->addAction(tr("Command History  [Ctrl + H]"));
    connect(action, SIGNAL(triggered()), this, SLOT(menuCommandHistory()));

    action = debug_menu->addAction(tr("Add Watch  [Ctrl + W]"));
    connect(action, SIGNAL(triggered()), this, SLOT(menuAddVariableWatch()));

    action = debug_menu->addAction(tr("Watch Var  [Ctrl + Shift + W]"));
    connect(action, SIGNAL(triggered()), this, SLOT(menuCreateVariableWatch()));

    action = debug_menu->addAction(tr("Inspect Object  [Ctrl + I]"));
    connect(action, SIGNAL(triggered()), this, SLOT(menuCreateObjectInspector()));

    action = debug_menu->addAction(tr("Break Condition  [Ctrl + Shift + B]"));
    connect(action, SIGNAL(triggered()), this, SLOT(menuSetBreakCondition()));

    action = debug_menu->addAction(tr("Function Assist  [F1]"));
    connect(action, SIGNAL(triggered()), this, SLOT(menuFunctionAssist()));

    // -- Scripts menu
    mScriptsMenu = menuBar()->addMenu(tr("&Scripts"));

    action = mScriptsMenu->addAction(tr("Open Script..."));
    connect(action, SIGNAL(triggered()), this, SLOT(menuOpenScript()));

    mScriptsMenu->addSeparator();

    action = mScriptsMenu->addAction(tr("Goto Line  [Ctrl + G]"));
    connect(action, SIGNAL(triggered()), this, SLOT(menuGoToLine()));

    action = mScriptsMenu->addAction(tr("Search  [Ctrl + F]"));
    connect(action, SIGNAL(triggered()), this, SLOT(menuSearch()));

    action = mScriptsMenu->addAction(tr("Search Again  [F3]"));
    connect(action, SIGNAL(triggered()), this, SLOT(menuSearchAgain()));

    mScriptsMenu->addSeparator();

}