Example #1
0
Cliente::Cliente(QWidget* _parent) : QWidget(_parent)
{
    this->setFixedHeight(720);

    this->game_over = false;
    this->game_started = false;
    this->server_process = NULL;
    this->server_bin = new QFileInfo("../server/server");

    QHBoxLayout*
    layout_tela_principal = new QHBoxLayout(this);

    layout_tela_principal->setDirection(QHBoxLayout::LeftToRight);

    this->tabuleiro_principal = new Tabuleiro("boga", this);
    this->rede = new Rede_Cliente::Tradutor();
    this->layout()->addWidget(this->tabuleiro_principal);

    this->telaloginInit();
    this->telachatInit();

    QObject::connect(this->tabuleiro_principal,SIGNAL(gameover(int)),
                     this, SLOT(gameOver(int)));

    QObject::connect(this->tabuleiro_principal,SIGNAL(aziasMudou(int)),
                     this, SLOT(aziasMudou(int)));

    QObject::connect(this->tabuleiro_principal, SIGNAL(encaixe()),
                     this->rede,SLOT(encaixe()));

    QObject::connect(this->rede, SIGNAL(startjogo(quint16,quint16)),
                     this, SLOT(startJogo()));

    QObject::connect(this->rede, SIGNAL(over(quint16,quint16)),
                     this, SLOT(jogadorOver(quint16,quint16)));

    this->connectsIncommingDataFromNet();

    this->aziaMaster = new AziaMaster(this);


}
Example #2
0
void conclusao(reservas lista_reservas, prereservas lista_pre, char op) {
    reservas aux=lista_reservas;
    int menu=9;
    int dia_a;
    int mes_a;
    int ano_a;
    int hora_a;
    int min_a;
    int reservas_lavagem;
    int reservas_manutencao;
    get_date(&dia_a, &mes_a, &ano_a);
    get_time(&hora_a, &min_a);
    count_reservas(lista_reservas, &reservas_lavagem, &reservas_manutencao);
    if(reservas_lavagem==0 && op=='L') {
        printf("Não existem reservas de lavagem! A regressar ao menu principal...\n");
        return;
    } else if(reservas_manutencao==0 && op=='M') {
        printf("Não existem reservas de manutenção! A regressar ao menu principal...\n");
        return;
    }
    //Achar o anterior a primeira reserva
    while(aux->next!=NULL) {
        if(aux->next->op==op) {
            break;
        }
        aux=aux->next;
    }
    if(aux->next->dia!=dia_a || aux->next->mes!=mes_a || aux->next->ano!=ano_a) {
        printf("Não é possivel uma operação demorar mais que um dia ou concluir uma operação futura!\n");
        return;
    } else if(aux->next->hora>hora_a || (aux->next->hora==hora_a && aux->next->min>min_a)) {
        printf("Não é possivel concluir uma operação futura!\n");
        return;
    } else {
        printf("Tem a certeza que a operação foi concluida?(1-Sim) \n");
        scanf("%d", &menu);
        getchar();
        if(menu==1) {
            delete_reserva(aux);
            if(encaixe(aux, hora_a, min_a, op)==0) {
                update_apos_cancelamento(lista_reservas, lista_pre, dia_a, mes_a, ano_a,hora_a, min_a, op);
            }
        } else {
            clear_screen();
            printf("A retornar ao menu principal...\n");
            return;
        }
    }
}