void CaptureFilePropertiesDialog::updateWidgets() { QPushButton *refresh_bt = ui->buttonBox->button(QDialogButtonBox::Reset); QPushButton *save_bt = ui->buttonBox->button(QDialogButtonBox::Save); if (file_closed_ || !cap_file_.isValid()) { if (refresh_bt) { refresh_bt->setEnabled(false); } ui->commentsTextEdit->setReadOnly(true); if (save_bt) { save_bt->setEnabled(false); } WiresharkDialog::updateWidgets(); return; } bool enable = wtap_dump_can_write(cap_file_.capFile()->linktypes, WTAP_COMMENT_PER_SECTION); save_bt->setEnabled(enable); ui->commentsTextEdit->setEnabled(enable); fillDetails(); ui->commentsTextEdit->setText(cf_read_shb_comment(cap_file_.capFile())); WiresharkDialog::updateWidgets(); }
void kitchenFrame::OnUrlClick(wxHtmlLinkEvent& event) { long templong; wxString link = event.GetLinkInfo().GetHref(); link.Mid(0,link.Find(_T(":"))).ToLong(&templong); href=true; int num = templong; wxString temp; temp << num; mysqlpp::Query query = conn->query(); wxString dishId = link.Mid(link.Find(_T(":"))+1); query <<"UPDATE `orders_dishes` SET `ready` = '1' \ WHERE `orders_dishes`.`id` =" << wx2std(dishId, wxConvUI) << " LIMIT 1"; query.execute(); //we just set to ready only one dish from order int orderId; query << "SELECT `order_id` FROM `orders_dishes` WHERE `id`="<< wx2std(dishId, wxConvUI); mysqlpp::StoreQueryResult res = query.store(); if(res) { mysqlpp::Row row; row = res.at(0); orderId = int(row["order_id"]); } query << "SELECT `id` FROM `orders_dishes` WHERE `ready`=0 AND `order_id`="<< orderId; res = query.store(); if(res) { if(!res.num_rows()) //no dishes to prepare { query << "UPDATE `orders` SET `status` = '4' WHERE `orders`.`id` ="<< orderId <<" LIMIT 1 "; query.execute(); //set the whole order to ready state //redo the pages to update status fillAll(); wxString tem; tem << _T("r:") << orderId; sendMessageToServer(SocketClient1, tem); } } wxString prodName = StaticText9->GetLabel(); fillDetails(prodName); fillMain(); }
void kitchenFrame::OnListBox3Select(wxCommandEvent& event) { toSearch = Lst3[ListBox3->GetSelection()]; fillDetails(toSearch); ListBox2->SetSelection(-1); }
void kitchenFrame::fillMain() { ListBox2->Clear(); Lst2.Clear(); ListBox3->Clear(); Lst3.Clear(); ListBox4->Clear(); wxDateTime current = wxDateTime::Now(); mysqlpp::Query query = conn->query(); wxString orderBy; if(ToggleButton2->GetValue()) { orderBy = _T("`time_avg` ASC"); } else if(ToggleButton1->GetValue()) { orderBy = _T("`qty` DESC"); } query << "SELECT SUM( `qty` ) AS `qty`,`orders_dishes`.`name`,MIN(`orders`.`time`) \ AS `time_min`,MAX(`orders`.`time`) AS `time_max`,FROM_UNIXTIME(AVG(UNIX_TIMESTAMP(`orders`.`time`)))\ AS `time_avg` FROM `orders_dishes`,`orders` WHERE `orders`.`time` > '"<< wx2std(current.FormatISODate(), wxConvUI) <<"' \ AND `orders`.`status`=3 AND `orders_dishes`.`kitchen`=1 AND `orders_dishes`.`ready`=0 AND `orders_dishes`.`order_id`=`orders`.`id` \ GROUP BY `orders_dishes`.`name` ORDER BY "<< wx2std(orderBy, wxConvUI); mysqlpp::StoreQueryResult res = query.store(); if (res) { mysqlpp::Row row; mysqlpp::StoreQueryResult::size_type i; bool first = true; wxDateTime avg; for (i = 0; i < res.num_rows(); ++i) { row = res[i]; avg.ParseDateTime(std2wx(std::string(row["time_avg"]),wxConvUI)); wxTimeSpan diff = wxDateTime::Now() - avg; wxString toAppend = _("<font size = 5>") + std2wx(std::string(row["name"]),wxConvUI) + _("</font><br align=center>Avg. time: <b>") + diff.Format(_T("%M")) + _(" min.</b> Quantity: <font size = 5>") + std2wx(std::string(row["qty"]),wxConvUI) + _T("</font>"); if(first) { ListBox2->Append(toAppend); Lst2.Add(std2wx(std::string(row["name"]),wxConvUI)); ListBox2->Append(_T("Preved!Medved")); if(!ListBox2->IsVisible(ListBox2->GetCount()-1)) { first = false; ListBox2->Delete(ListBox2->GetCount()-2); Lst2.RemoveAt(Lst2.GetCount()-1); ListBox3->Append(toAppend); Lst3.Add(std2wx(std::string(row["name"]),wxConvUI)); } ListBox2->Delete(ListBox2->GetCount()-1); } else { ListBox3->Append(toAppend); Lst3.Add(std2wx(std::string(row["name"]),wxConvUI)); } } } //wxMessageBox(toSearch); int Lst2Index = Lst2.Index(toSearch); int Lst3Index = Lst3.Index(toSearch); if(Lst2Index != wxNOT_FOUND || Lst3Index != wxNOT_FOUND ) { if(Lst2Index != wxNOT_FOUND) { //making selection in first listbox fillDetails(Lst2[Lst2Index]); ListBox2->SetSelection(Lst2Index); } else { //making selection in second listbox fillDetails(Lst3[Lst3Index]); ListBox3->SetSelection(Lst3Index); } } else if(Lst2.GetCount() != 0) //if none of those has our dish - just selecting first one { fillDetails(Lst2[0]); ListBox2->SetSelection(0); toSearch = Lst2[0]; } }