//Entrance Control Tab
tab->addTab(entrancetab=new QWidget,tr("Entrance"));
entrancetab->setLayout(vl=new QVBoxLayout);
+ vl->addWidget(entranceevent=new QComboBox,0);
+ entranceevent->setEditable(false);
+ vl->addSpacing(30);
+ vl->addWidget(new QLabel(tr("Enter or scan Ticket-ID:")),0);
vl->addWidget(entrancescan=new QLineEdit,0);
connect(entrancescan,SIGNAL(editingFinished()),this,SLOT(entranceValidate()));
vl->addWidget(entrancelabel=new QLabel(" "),10);
{
QWidget*w=tab->currentWidget();
if(w==entrancetab){
+ //fill combobox from eventmodel
+ int ci=entranceevent->currentIndex();
+ int cev=-1;
+ if(ci>=0)cev=entranceevent->itemData(ci).toInt();
+ ci=-1;
+ entranceevent->clear();
+ for(int i=0;i<eventmodel->rowCount();i++){
+ QString ev=eventmodel->data(eventmodel->index(i,0)).toString()+" "+
+ eventmodel->data(eventmodel->index(i,1)).toString();
+ int eid=eventmodel->data(eventmodel->index(i,0),Qt::UserRole).toInt();
+ entranceevent->addItem(ev,eid);
+ if(eid==cev)ci=i;
+ }
+ if(ci>=0)entranceevent->setCurrentIndex(ci);
+ //set focus on scanner
entrancescan->setFocus(Qt::OtherFocusReason);
entrancescan->setText("");
}
void MOverview::entranceValidate()
{
+ //get event ID
+ int ci=entranceevent->currentIndex();
+ if(ci<0)return;
+ int cev=entranceevent->itemData(ci).toInt();
//check content
QString tid=entrancescan->text().trimmed();
//avoid spurious events
entrancelabel->setText(tr("Ticket \"%1\" Not Valid").arg(tid));
pal.setColor(rl,Qt::red);
}else
+ if(tick.eventID()!=cev){
+ entrancelabel->setText(tr("Ticket \"%1\" is not for this event.").arg(tid));
+ pal.setColor(rl,Qt::red);
+ }else
if(tick.status()==MTicket::Used){
entrancelabel->setText(tr("Ticket \"%1\" has already been used").arg(tid));
pal.setColor(rl,Qt::magenta);