Ejemplo n.º 1
0
void searchByCategory(Data* data){
	clearScreen();
	string answer;
	cout << "\nInsert what category you would like to search for\n"
			"( Agriculture, Animals, BabyAndChildren, Fashion, Home, Job, Leisure,\n"
			"PhonesAndTablets, RealEstate, Services, Sports, Technology, Vehicles,\n"
			"Others ) : ";
	getline(cin, answer);
	vector<Advertisement* > results;
	if (validCategory(answer)){
		Category searchCategory=stringToCategory(answer);
		results=data->searchForAdsCategory(searchCategory);
		saleOrPurchase(results,data);
		SearchMenu menu(data, results);
		menu.createMenu();
	}
	else {
		cout<<"Invalid Category\n"
				"Do you want to search again?(Y/N)?\n";
		getline(cin, answer);
		if (answer=="y"||answer=="Y")
			searchByCategory(data);
		else if(data->getSignedInUser() != NULL)
			signedInMenu(data);
		else
			mainMenu(data);
	}

	if(data->getSignedInUser() != NULL)
		signedInMenu(data);
	else
		mainMenu(data);
}
Ejemplo n.º 2
0
// Takes care of all the choices the user can
// make with the menu.
void LogIn::menuChoices()
{
	switch(choice)
	{
	case 1:
		createAccount();
		cout << endl;
		mainMenu();
		break;
	case 2:
		getUserInfo();
		cout << endl;
		mainMenu();
		break;
	case 3: 
		deleteQuery();
		deleteAccount();
		break;
	case 4:
		displayContents();
		mainMenu();
		break;
	case 9:
		cout << "You have exitted the program.\n";
		exit(EXIT_SUCCESS);
	}
}
Ejemplo n.º 3
0
int main() {
	suInit();
	gfxInitDefault();
	consoleInit(GFX_TOP, &topConsole);
	consoleSelect(&topConsole);

	cfguInit();
	fsInit();
	amInit();

	fbTopLeft = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL);
	fbTopRight = gfxGetFramebuffer(GFX_TOP, GFX_RIGHT, NULL, NULL);
	fbBottom = gfxGetFramebuffer(GFX_BOTTOM, 0, NULL, NULL);

	u8 next = mainMenu();
	while (aptMainLoop()) {
		switch (next) {
			case 0: break;
			case 1: next = mainMenu(); break;
			//case 2: next = legitInstallMenu(); break;
			case 3: next = downgradeMenu(); break;
			//case 4: next = downgradeMSETMenu(); break;
			//case 5: next = downgradeBrowserMenu(); break;
			default: next = mainMenu();
		}
		if (next == 0) break;
	}

	gfxExit();
	return 0;
}
Ejemplo n.º 4
0
void DemoSimApplication::toneMenu( const QSimTerminalResponse& resp )
{
    QSimCommand cmd;

    if ( resp.result() == QSimTerminalResponse::Success ) {
        // Item selected.
        cmd.setType( QSimCommand::PlayTone );
        cmd.setDestinationDevice( QSimCommand::Earpiece );
        cmd.setTone( (QSimCommand::Tone)( resp.menuItem() ) );
        if ( cmd.tone() == QSimCommand::ToneDial )
            cmd.setDuration( 5000 );
        else if ( cmd.tone() == QSimCommand::ToneGeneralBeep ||
                  cmd.tone() == QSimCommand::TonePositiveBeep ||
                  cmd.tone() == QSimCommand::ToneNegativeBeep )
            cmd.setDuration( 1000 );
        else
            cmd.setDuration( 3000 );
        command( cmd, this, SLOT(sendToneMenu()) );
    } else if ( resp.result() == QSimTerminalResponse::BackwardMove ) {
        // Request to move backward.
        mainMenu();
    } else {
        // Unknown response - just go back to the main menu.
        mainMenu();
    }
}
Ejemplo n.º 5
0
void DemoSimApplication::getInputLoop( const QSimTerminalResponse& resp )
{
    QSimCommand cmd;
    if ( resp.result() == QSimTerminalResponse::HelpInformationRequested ) {
        // Display help for the game.
        cmd.setType( QSimCommand::DisplayText );
        cmd.setDestinationDevice( QSimCommand::Display );
        cmd.setText("Enter code of the company." );
        command( cmd, this, SLOT(mainMenu()) );
    } else {
        mainMenu();
    }
}
Ejemplo n.º 6
0
void process(Tree tree, char *flag, char *XXX){
    switch(flag[0]) {
        case 'i':
            printf("Inserting value %d\n", atoi(XXX));
            break;
        case 'd':
            printf("Deleting value %d\n", atoi(XXX));
            break;
        case 'f':
            printf("Finding value %d\n", atoi(XXX));
            break;
        case 'v':
            printf("Visualizing tree\n");
            break;
        case 'V':
            printf("Verify the tree\n");
            break;
        case 'b':
            printf("Injecting fault of type %s into tree\n", XXX);
            break;
        case 'p':
            printf("Populating the tree with integers from file %s\n", XXX);
            break;
        case 'g':
            printf("Generating %d unique random integers to populate the tree with\n", atoi(XXX));
            break;
        case 's':
            printf("Printing statistics concerning current state of tree\n");
            break;
        case 'l':
            printf("Listing elements in %s traversal\n", XXX);
            break;
        case 'c':
            printf("Cleaning up the screen...\n");
            sleep(1);
            system("clear");
            mainMenu();
            break;
        case 'e':
            printf("EXITING INTERPRETER...\n");
            sleep(1);
            exit(1);
        default:
            printf("Error invalid input...\n");
            sleep(1);
            system("clear");
            mainMenu();
    }
}
Ejemplo n.º 7
0
int main()
{
    GameState g;
    STATE current = INIT;

    while (true)
    {
        switch (current)
        {
        case INIT:
            splash();
        case MAIN:
            current = mainMenu();
            break;
        case PLAY:
            g.play();
        case GAME:
            current = g.update();
            break;
        case EXIT:
            fareTheWell();
            return 0;
        }
    }
}
Ejemplo n.º 8
0
int main()
{
	sfg::SFGUI sfgui;

	std::vector<Screen*> screens;
	int currentScreen = 0;

	sf::RenderWindow window(sf::VideoMode(Entity::WindowStartSize_X, Entity::WindowStartSize_Y, 32), "Chess");
	window.setMouseCursorVisible(true);

	EventHandler eventHandler;

	MainMenuScreen mainMenu(sfgui, resourceManager, eventHandler);
	GameplayScreen gameplayScreen(sfgui, resourceManager, eventHandler);
	screens.push_back(&mainMenu);
	screens.push_back(&gameplayScreen);

	while (currentScreen >= 0)
	{
		currentScreen = screens[currentScreen]->run(window);
		if (currentScreen == -1) break;
	}

	return EXIT_SUCCESS;
}
void CommandLineInterface::selectFactory() {
  while (true) {
    std::cout << "\n";
    std::cout << "Please pick first a factory type:" << "\n";
    std::cout << "\n";
    std::cout << "* (1) Basic Factory. Simple factory with concurrent producers and consumers." << std::endl;
    std::cout << "\n";
    std::cout << "> ";
    std::string input;
    std::getline(std::cin, input);
    int typecode;
    if (string_utils::is_number(input)) {
      typecode = std::stoi(input);
    } else {
      std::cout << "Invalid input." << std::endl;
      continue;
    }
    factory = Factory::getFactory(typecode);
    if (factory == nullptr) {
      std::cout << "Not a valid factory." << std::endl;
    } else {
      break;
    }
  }
  mainMenu();
}
Ejemplo n.º 10
0
int loadMenu(SDL_Window* Window, SDL_Surface* ScreenSurface, TTF_Font* font, Mix_Chunk* effect)
{
    bool success = true;
    int i = mainMenu(Window,ScreenSurface,font,effect);
    if(i==3) //Go to instructions
    {
        int j = instMenu(Window,ScreenSurface,font,effect);
        if(j==0)
        {
            return 0;   //0 success
        }
        else if(j==1)
        {
            return -1; //1 failure
        }
        else if(j==2)
        {
            return 2; //Close the window
        }
    }
    else if(i==1)
    {
        return -1;
    }
    else if (i==0)
    {
        return 0;
    }

}
Ejemplo n.º 11
0
int searchMessage(int state){
	Point pos = { SUBMENU_TEXT_X_POS, SUBMENU_TEXT_Y_POS };
	system("cls");
	mainMenu(5);

	//메뉴 출력 (ID, 이름, 전화번호, 취소)
	gotoxy(pos); printf(SUBMENU_1);
	pos.y += VERTIMOVE_SEARCH;
	gotoxy(pos); printf(SUBMENU_2);
	pos.y += VERTIMOVE_SEARCH;
	gotoxy(pos); printf(SUBMENU_3);
	pos.y += VERTIMOVE_SEARCH;
	gotoxy(pos); printf(SUBMENU_4);

	//Cursor 시작
	pos.x -= SUBMENU_TEXT_X_POS - SUBMENU_CURSOR_X_POS;
	pos.y -= (MENUSIZE_SEARCH - 1) * VERTIMOVE_SEARCH;
	state = cursorPosVerti(pos, MENUSIZE_SEARCH, VERTIMOVE_SEARCH, state);

	//맨위로 올린후 리턴.
	pos.x = SUBMENU_MAIN_X_POS;
	pos.y = SUBMENU_MAIN_Y_POS;
	gotoxy(pos);

	return state;
}
Ejemplo n.º 12
0
int deleteMessage(int state){
	Point pos = { SUBMENU_TEXT_X_POS, SUBMENU_TEXT_Y_POS };
	system("cls");
	mainMenu(3);
	//각 서브메뉴 출력 (ID, 이름, 전화번호, 취소)
	gotoxy(pos); printf(SUBMENU_1);
	pos.y += VERTIMOVE_DELETE;
	gotoxy(pos); printf(SUBMENU_2);
	pos.y += VERTIMOVE_DELETE;
	gotoxy(pos); printf(SUBMENU_3);
	pos.y += VERTIMOVE_DELETE;
	gotoxy(pos); printf(SUBMENU_4);

	//Cursor 시작
	pos.x -= SUBMENU_TEXT_X_POS - SUBMENU_CURSOR_X_POS;
	pos.y -= (MENUSIZE_DELETE - 1) * VERTIMOVE_DELETE;

	state = cursorPosVerti(pos, MENUSIZE_DELETE, VERTIMOVE_DELETE, state);

	//맨위로 복귀후 종료
	pos.x = SUBMENU_MAIN_X_POS;
	pos.y = SUBMENU_MAIN_Y_POS;
	gotoxy(pos);

	return state;

}
Ejemplo n.º 13
0
void main()
{
	DataBase dataBase;

	Menu mainMenu("Main Menu",dataBase);
	mainMenu.AddBranch(Menu("Clients",mainMenu.Data()));
	mainMenu.AddBranch(Menu("Warehouse",mainMenu.Data()));
	mainMenu.AddBranch(Menu("Orders",mainMenu.Data()));

	mainMenu.Branch(0).AddBranch(Menu("Show",mainMenu.Data()));
	mainMenu.Branch(0).AddItem(MenuItem("Add new client",AddClient));
	mainMenu.Branch(0).Branch(0).AddItem(MenuItem("Show all",ShowAllClients));

	mainMenu.Branch(1).AddBranch(Menu("Show",mainMenu.Data()));
	mainMenu.Branch(1).AddItem(MenuItem("Add Item", AddItem));
	mainMenu.Branch(1).AddItem(MenuItem("Set quantity",SetQuantity));
	mainMenu.Branch(1).Branch(0).AddItem(MenuItem("Show all",ShowWarehouse));

	mainMenu.Branch(2).AddBranch(Menu("Show",mainMenu.Data()));
	mainMenu.Branch(2).Branch(0).AddItem(MenuItem("Show all orders",ShowAllOrders));
	mainMenu.Branch(2).Branch(0).AddItem(MenuItem("Details",ShowOrder));
	mainMenu.Branch(2).AddItem(MenuItem("Add Order",AddOrder));	

	RandomDataBase(dataBase);

	mainMenu.Run();
}
Ejemplo n.º 14
0
int main()
{
	int output = 0;
	
	//Fancy Startupscreen - pretend to be loading something
	system("clear");
	printf("SchedulePlanMaster 2000 is starting up...");
	fflush(stdout);
	sleep(1);
	system("clear");
	
	mainMenu();

	checkSchedule();

	printSchedule();

	mostNightshift();
	
	output = chooseOutputType();

	saveFile(output);

    system( "read -n 1 -s -p \"Press any Key...\"" );
    	
	printf("\n\n");
	
	return 0;
}
Ejemplo n.º 15
0
void main(void) {
	// Clear Screen
	cpct_memset(SCR_VMEM, 0, 0x4000);
	initCPC();
	gameScene=CALIVGAMESSCREEN;
	//gameScene=MENUSCREEN;
	// Loop forever
	while (1) {
		switch (gameScene) {
		    case CALIVGAMESSCREEN: calivGames();
				break;
			case MENUSCREEN: mainMenu();
				break;
			case PLAYGAMESCREEN: infinityMode();
				break;
    		case NEXTLEVELSCREEN: newLevel();
	    		break;
			case CONTROLSSCREEN: controls();
				break;
		    case GAMEOVERSCREEN: gameOver();
				break;
			case CREDITSSCEENE: credits();
				break;
		}
	};
}
Ejemplo n.º 16
0
int Game::exec() {
	if (state == UNINITIALIZED) {
		cout << "Error: Game state still UNINITIALIZED";
		return -1;
	}	
	if (state == INITIALIZED)
		state = MAINMENU;


	// enter main loop
	while (state != CLOSING) {
		switch (state) {
			case MAINMENU:
				mainMenu();
				break;
			case GAME:
				game();
				break;
			default:
				cout << "Error: wrong state of game";
				return -1;
				break;
		}
	}

	return 0;
}
Ejemplo n.º 17
0
//constructor
Menu::Menu(SDL_Window *sentWindow){
  	window = sentWindow;

  	//creates the renderer to be used
  	ren = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
  	if (ren == nullptr){
    	SDL_DestroyWindow(window);
	    std::cout << "SDL_CreateMenuRenderer Error: " << SDL_GetError() << std::endl;
	    SDL_Quit();
  	}

  	//creates the menu's textures
  	const string menuPath = getResourcePath("magicworm") + "menu.bmp";
  	SDL_Surface *bmp = SDL_LoadBMP(menuPath.c_str());
  	if (bmp == nullptr){
    	SDL_DestroyRenderer(ren);
    	SDL_DestroyWindow(window);
    	std::cout << "SDL_LoadMenuBMP Error: " << SDL_GetError() << std::endl;
    	SDL_Quit();
  	}

  	menTex = SDL_CreateTextureFromSurface(ren, bmp);
  	SDL_FreeSurface(bmp);
  	if (menTex == nullptr){
  	  	SDL_DestroyRenderer(ren);
  	  	SDL_DestroyWindow(window);
  	  	std::cout << "SDL_CreateMenuTextureFromSurface Error: " << SDL_GetError() << std::endl;
  	  	SDL_Quit();
  	}

  	mainMenu();
}
Ejemplo n.º 18
0
int main(){
  int op;
  std::list<student> studentlist;
  readIn(studentlist);
  cout<<"Main menu start\n\n\n";
    do{
      op=mainMenu();
      switch(op){
	 case 1:printMenu(studentlist);
         break;
	 case 2: findStudents(studentlist);
	 break;
	 case 3: addStudent(studentlist);
	 break;
	 case 4: modifyStudentMenu(studentlist);
	 break;
	 case 5: deleteStudentMenu(studentlist);
	 break;
	 case 6:writeToFile(studentlist);
       }
  }while(op!=6);
 return 0;
    

}
Ejemplo n.º 19
0
bool ReservationSystem::runMenu()
{
	//Initialize selection variable.
	char selection;

	//Print menu.
	mainMenu();

	//Menu switch.
	selection = getMainMenuChoice();
	switch (selection)
	{
	case '1': passengerDisplayMenu();
		break;
	case '2': flightDisplayMenu();
		break;
	case '3': passengerSearch_Option();
		break;
	case '4': flightSearch_Option();
		break;
	case '5': deletePassenger_Option();
		break;
	}

	if (selection == '0')
		return false;

	return true;
}
Ejemplo n.º 20
0
void SjCoverBrowser::OnContextMenu(int clickX, int clickY)
{
	SjMenu  mainMenu(0);
	SjCol* cover;
	long found = FindCover(clickX, clickY, &cover);
	if( found == FOUND_COVER && cover->m_rowCount > 0 && cover->m_rows[0]->m_roughType == SJ_RRTYPE_COVER )
	{
		// select the item under the mouse
		if( cover->FindFirstSelectedRow() == NULL )
		{
			g_mainFrame->m_columnMixer.SelectAll(FALSE);
			SelectAllRows(cover);
			RefreshSelection();
		}

		m_lastClickedCover = cover;
		cover->m_rows[0]->CreateContextMenu(mainMenu);
	}
	else
	{
		m_lastClickedCover = NULL;
	}

	// add main items to menu
	g_mainFrame->CreateContextMenu_(mainMenu);

	// show menu
	if( mainMenu.GetMenuItemCount() )
	{
		m_window->PopupMenu(&mainMenu);
	}
}
Ejemplo n.º 21
0
void signIn(Data* data){
	clearScreen();
	string email, password,input;


	cout << "\nEmail: ";
	getline(cin, email);

	cout << "\nPassword: "******"Wrong email and password combination.\n";
		cout << "Try Again? (Y/N)"<<endl;
		cin>>input;
		if (input=="y"||input=="Y")
		{
			cin.ignore();
			cin.clear();
			signIn(data);
		}
		else mainMenu(data);
	}
}
Ejemplo n.º 22
0
int main(int argc,char *args[])
{
	//----------------------------------------------------------
	  /* SSL 库初始化 */
  SSL_library_init();
  OpenSSL_add_all_algorithms();
  SSL_load_error_strings();
  ctx = SSL_CTX_new(SSLv23_client_method());
  if (ctx == NULL)
  {
    ERR_print_errors_fp(stdout);
    exit(1);
  }
  //----------------------------------------------------------
  strcpy(ipaddr,args[1]);
	if((connectto(argc,args))!=1)
		exit(0);
	if(login(username,userpasswd)==0)
		{
			printf("login error");
			exit(0);
		}
	
	log();
	mainMenu();
	return 0;
}
Ejemplo n.º 23
0
/*!
  It creates the PauseMenu.
*/
PauseMenu::PauseMenu(MainWindow *window)
{
    // init
    this->window = window;

    // Gereral window
    setWindowOpacity(0.9);

    // Buttons
    layout = new QVBoxLayout();
    hLayout = new QHBoxLayout();

    label = new QLabel("<h2 align=\"center\">Pause menu</h2>");
    resumeButton = new QPushButton("&Resume");
    resumeButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
    connect(resumeButton, SIGNAL(clicked()), this, SLOT(resume()));
    mainMenuButton = new QPushButton("&Main Menu");
    mainMenuButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
    connect(mainMenuButton, SIGNAL(clicked()), this, SLOT(mainMenu()));

    layout->insertSpacing(0, 100);
    layout->addWidget(label);
    layout->insertSpacing(1, 100);
    layout->addWidget(resumeButton);
    layout->addWidget(mainMenuButton);
    layout->insertSpacing(5, 250);

    hLayout->insertSpacing(0, 300);
    hLayout->addLayout(layout);
    hLayout->insertSpacing(2, 300);

    setLayout(hLayout);
}
Ejemplo n.º 24
0
void DemoSimApplication::displayTextResponse( const QSimTerminalResponse& resp )
{
    QSimCommand cmd;

    if ( resp.result() == QSimTerminalResponse::Success ) {
        if ( immediateResponse )
            return;
        mainMenu();
    } else if ( resp.result() == QSimTerminalResponse::BackwardMove ) {
        // Request to move backward.
        mainMenu();
    } else {
        // Unknown response - just go back to the main menu.
        mainMenu();
    }
}
Ejemplo n.º 25
0
void DemoSimApplication::iconSEMenu( const QSimTerminalResponse& resp )
{
    if ( resp.result() == QSimTerminalResponse::Success )
        sendIconSEMenu();
    else
        mainMenu();
}
Ejemplo n.º 26
0
void DemoSimApplication::sticksGamePlayAgain( const QSimTerminalResponse& resp )
{
    if ( resp.text() == "Yes" )
        startSticksGame();
    else
        mainMenu();
}
Ejemplo n.º 27
0
/**
 * Programme principal
 */
int main(){
	srand(time(NULL));
	checkSignal();
	
	mainMenu(grid);

	return 0;
}
Ejemplo n.º 28
0
int main(int argc, char* argv[])
{
	const char* path = argv[1] ? argv[1] : "lunch-place-info.txt";
	Engine* engine = new Engine(path);
	
	while(1 != mainMenu(engine)) {}
	return 0;
}
Ejemplo n.º 29
0
/*!
    Aborts the SIM application and forces it to return to the main menu.
    The default implementation clears the pending command for FETCH
    and then calls mainMenu().

    This function is called whenever a \c{TERMINAL PROFILE} command is
    received from the ME.

    \sa start(), mainMenu()
*/
void SimApplication::abort()
{
    d->expectedType = QSimCommand::NoCommand;
    d->currentCommand = QByteArray();
    d->target = 0;
    d->slot = 0;
    mainMenu();
}
Ejemplo n.º 30
0
void DemoSimApplication::sportsMenu( const QSimTerminalResponse& resp )
{
    QSimCommand cmd;

    if ( resp.result() == QSimTerminalResponse::Success ) {
        // Item selected.
        switch ( resp.menuItem() ) {

            case SportsMenu_Chess:
            {
                cmd.setType( QSimCommand::DisplayText );
                cmd.setDestinationDevice( QSimCommand::Display );
                cmd.setText( "Kasparov 3, Deep Blue 4" );
                command( cmd, this, SLOT(sendSportsMenu()) );
            }
            break;

            case SportsMenu_Painting:
            {
                cmd.setType( QSimCommand::DisplayText );
                cmd.setDestinationDevice( QSimCommand::Display );
                cmd.setText( "Little Johnny 4, Little Sally 6" );
                command( cmd, this, SLOT(sendSportsMenu()) );
            }
            break;

            case SportsMenu_Snakes:
            {
                cmd.setType( QSimCommand::DisplayText );
                cmd.setDestinationDevice( QSimCommand::Display );
                cmd.setText( "Little Johnny 0, Little Sally 2" );
                cmd.setClearAfterDelay( true );
                command( cmd, this, SLOT(sendSportsMenu()) );
            }
            break;

            default:    mainMenu(); break;
        }
    } else if ( resp.result() == QSimTerminalResponse::BackwardMove ) {
        // Request to move backward.
        mainMenu();
    } else {
        // Unknown response - just go back to the main menu.
        mainMenu();
    }
}