void addShowDialog::on_addShowButton_clicked() { //Get the date and time QDate date; QTime time; date = ui->calendarWidget->selectedDate(); time = ui->timeEdit->time(); //Merge them into a QDateTime QDateTime dateTime(date, time); //Get movie int movieID = movieModel->getMovieID(ui->movieCBB->currentIndex()); //Get hall int hallID = hallModel->getHallID(ui->hallCBB->currentIndex()); //Get 3D bool DDD = ui->DDDYesRB->isChecked(); //Get subs bool subs = ui->subYesRB->isChecked(); //Get language QString lang = ui->languageCBB->currentText(); //Get price double price = ui->priceSpinBox->value(); //set sail! wohoo if(role == Add) emit add_Show(dateTime, price, lang, DDD, subs, movieID, hallID); if(role == Edit) { QMessageBox msgBox(QMessageBox::Question, "Edit Show", "Are you sure you want to edit this show?" "\n\nWarning: All bookings connected to this show will be deleted.", QMessageBox::Yes | QMessageBox::No ); if(msgBox.exec() == QMessageBox::Yes) { emit edit_show(showID, dateTime, price, lang, DDD, subs, movieID, hallID); } else { return; } } close(); }
void edit_main(LIFE life_pt[]){ int ch,xy; CURSOR c; c.x=FORIGINX; c.y=FORIGINY; clear(); timeout(-1); while(ch!='s'){ /*cursor keys */ if(ch==KEY_DOWN)c.y++; if(ch==KEY_UP)c.y--; if(ch==KEY_RIGHT)c.x++; if(ch==KEY_LEFT)c.x--; if(c.x-FORIGINX>=LIFEMAXW)c.x=FORIGINX; if(c.y-FORIGINY>=LIFEMAXH)c.y=FORIGINY; if(c.x-FORIGINX<0)c.x=LIFEMAXW; if(c.y-FORIGINY<0)c.y=LIFEMAXH; /*end cursor keys */ xy=(c.y-1)*LIFEMAXW+c.x-1; edit_show(life_pt,c); mvprintw(LIFEMAXH/2-10,LIFEMAXW+5,"EDIT MODE"); mvprintw(LIFEMAXH/2-5,LIFEMAXW+5,"LIFE STATUS"); mvprintw(LIFEMAXH/2-4,LIFEMAXW+5,"(%3d,%2d)=%d",life_pt[xy].x,life_pt[xy].y,life_pt[xy].live); mvprintw(LIFEMAXH/2+1,LIFEMAXW+5,"s key :End Edit Mode and Go to Simulation!"); mvprintw(LIFEMAXH/2+2,LIFEMAXW+5,"r key :Random set Life!"); mvprintw(LIFEMAXH/2+3,LIFEMAXW+5,"c key :All Clear Life!"); mvprintw(LIFEMAXH/2+4,LIFEMAXW+5,"Cursor keys :Move Cursor(X)"); mvprintw(LIFEMAXH/2+5,LIFEMAXW+5,"Space key :toggle Life and Death"); ch=getch(); if(ch==' ')life_pt[xy].live=toggle_life(life_pt[xy].live); if(ch=='r')rand_life2(life_pt); if(ch=='c')clear_life(life_pt); if(ch=='p')outlife(life_pt); } timeout(0); return ; }