Exemple #1
0
void userMenu(user *userList)
{
    int choose = 0;
    printf("==========================\n");
    printf("------ MENU USUÁRIO ------\n");
    printf("==========================\n");
    printf("[1]CADASTRO\n"); //Coloca novo usuário no fim da lista
    printf("[2]ALTERAR\n");  //Altera um usuário na lista
    printf("[3]CONSULTAR\n"); //Consulta um dado usuário na lista
    printf("[4]LISTAR\n");    //Lista todos os usuários da lista
    printf("[5]EXCLUIR\n");   //Exclui usuário da lista
    printf("[6]VOLTAR\n");
    scanf("%i", &choose);
    fflush(stdin);

    switch(choose)
    {
        case 1:
            userRegister(userList); break;
        case 2:
            userModify(userList); break;
        case 3:
            userSearch(userList); break;
        case 4:
            showList(userList); break;
        case 5:
            userDelete(userList); break;
        case 6:
            break;
        default:
            printf("OPÇÃO INVÁLIDA\n");
    }
}
searchwidget::searchwidget(account* acc, legami* boss, QWidget *parent) :
    QWidget(parent), Boss(boss), Searcher(acc)
{
    userInfoBox=0;
    companyInfoBox=0;
    experienceBox=0;
    usersListView=0;
    showButton=0;

    if((dynamic_cast<companyaccount*>(Searcher) && dynamic_cast<companyaccount*>(Searcher)->type()!=0) || dynamic_cast<useraccount*>(Searcher)){
        layout= new QGridLayout(this);

        usernsearchBox=new QGroupBox(tr("Username Search"), this);
        if((dynamic_cast<companyaccount*>(Searcher) && dynamic_cast<companyaccount*>(Searcher)->type()==2) || dynamic_cast<useraccount*>(Searcher)) usernsearchBox->setCheckable(true);
        QGridLayout* usernsearchLayout= new QGridLayout(usernsearchBox);
        QLabel* usernLabel= new QLabel(tr("Username:"******"Company Search"), this);
            connect(companySearchRadio, SIGNAL(clicked()), this, SLOT(companySearch()));
            userSearchRadio= new QRadioButton(tr("User Search"), this);
            connect(userSearchRadio, SIGNAL(clicked()), this, SLOT(userSearch()));

            layout->addWidget(companySearchRadio, 1, 1);
            layout->addWidget(userSearchRadio, 1, 0);
        }

        searchButton= new QPushButton(tr("Search"), this);
        connect(searchButton, SIGNAL(clicked()), this, SLOT(search()));
        layout->addWidget(usernsearchBox, 0, 0);

        layout->addWidget(searchButton, 2, 0);

        setLayout(layout);
    }
    else QMessageBox::warning(this, tr("Error"), tr("Company basic account are not allowed to perform any search."), QMessageBox::Ok, QMessageBox::Ok);
}