void View::Management::ProductDialog::loadProduct() { int precisionMoney = Persistence::Manager::readConfig("Money", "Application/Precision").toInt(); updateId(); _idLineEdit -> setEnabled(!IS_NEW(_product -> id())); _autoIdCheckBox -> setChecked(IS_NEW(_product -> id())); _nameLineEdit -> setText(_product -> name()); _categoryComboBox -> setCurrentIndex(_categoryComboBox->findText(_product -> category() -> name())); _descriptionTextEdit -> setPlainText(_product -> description()); _priceLineEdit -> setText(QString::number(_product -> price(),'f', precisionMoney)); _priceTypeComboBox -> setCurrentIndex(static_cast<int>(_product -> priceType())); productModified(false); }
void View::Management::ProductDialog::updateId() { int id = (_autoIdCheckBox -> isChecked() ? Model::Management::ProductManager::getId() : _product -> id()); _idLineEdit -> setText((!IS_NEW(id) ? QString::number(id) : "")); }
int main(void){ int datafd; struct s_dev *first_dev, *dev, **pp_dev; si_verbose = 1; // set si library verbose level if(sizeof(struct s_sidata) > PIPE_BUF){ error(EXIT_FAILURE, ERR_SIZE, "Size of card data too big.\n"); } if(access(FIFO_NAME, F_OK) == -1){ error(EXIT_FAILURE, errno, "Cannot access fifo %s.\n", FIFO_NAME); } if(si_detect_devices(&first_dev) == 0){ error(EXIT_FAILURE, 0, "No SI devices detected."); } pp_dev = &first_dev; while(*pp_dev != NULL){ if(((*pp_dev)->fd = si_initserial((*pp_dev)->devfile)) == -1){ error(EXIT_SUCCESS, errno, "Cannot open device %s", (*pp_dev)->devfile); *pp_dev = (*pp_dev)->next; // Excluded from list, but NOT freed from memory }else if(! IS_NEW(si_station_detect((*pp_dev)->fd))){ error(EXIT_SUCCESS, 0, "Old SI station (%s) is not supported.", (*pp_dev)->devfile); *pp_dev = (*pp_dev)->next; // Excluded from list, but NOT freed from memory }else if(((*pp_dev)->prot = si_station_setprot((*pp_dev)->fd)) == -1){ error(EXIT_SUCCESS, 0, "Cannot setup SI station (%s) protocol.", (*pp_dev)->devfile); *pp_dev = (*pp_dev)->next; // Excluded from list, but NOT freed from memory }else{ pp_dev = &((*pp_dev)->next); } } if(first_dev == NULL){ error(EXIT_FAILURE, 0, "No devices can be opened."); } signal(SIGINT, termination_handler); signal(SIGQUIT, termination_handler); signal(SIGTERM, termination_handler); signal(SIGHUP, termination_handler); if((datafd = open(FIFO_NAME, O_WRONLY)) == -1){ error(EXIT_FAILURE, errno, "Cannot open fifo.\n"); }else{ si_reader_m(first_dev, datafd, READER_TICK_TIMER); close(datafd); } // SI device reset to original state procedure dev = first_dev; while(dev != NULL){ if(si_station_resetprot(dev->fd, dev->prot) < 0){ error(EXIT_SUCCESS, 0, "Reset SI station setup failed for %s.", dev->devfile); } dev = dev->next; } return 0; }
void View::Management::EntityDialog::setTitle() { QString entityType; switch(static_cast<int>(_entity -> type())) { case Model::Domain::CustomerEntity: entityType = tr("Customer"); break; case Model::Domain::SupplierEntity: entityType = tr("Supplier"); break; case Model::Domain::BusinessEntity: entityType = tr("Business"); break; entityType = tr("Unknown"); } setWindowTitle(QString("%1 - %2") .arg(entityType) .arg(!IS_NEW(_entity -> id()) ? ("#" + QString::number(_entity -> id())) : tr("New")) + "[*]"); }