356 if (record < 1) { |
356 if (record < 1) { |
357 recipeBox->setEnabled(false); |
357 recipeBox->setEnabled(false); |
358 return; |
358 return; |
359 } |
359 } |
360 |
360 |
|
361 qDebug() << "showRecipe 2"; |
361 /* |
362 /* |
362 * Fill in basic details of the selected recipe. |
363 * Fill in basic details of the selected recipe. |
363 */ |
364 */ |
364 QSqlQuery query; |
365 QSqlQuery query; |
365 query.prepare("SELECT batch_size,boil_size,boil_time,efficiency,est_og,est_fg,est_abv,est_color,color_method,est_ibu,ibu_method,est_carb,notes,name " |
366 query.prepare("SELECT batch_size,boil_size,boil_time,efficiency,est_og,est_fg,est_abv,est_color,color_method,est_ibu,ibu_method,est_carb,notes,name " |
366 "FROM recipes WHERE record=:record"); |
367 "FROM recipes WHERE record=:record"); |
367 query.bindValue(":record", record); |
368 query.bindValue(":record", record); |
|
369 qDebug() << "showRecipe 3"; |
368 query.exec(); |
370 query.exec(); |
|
371 qDebug() << "showRecipe 4"; |
369 if (query.size() == 1) { |
372 if (query.size() == 1) { |
|
373 qDebug() << "showRecipe 5 ok"; |
370 query.first(); |
374 query.first(); |
|
375 qDebug() << "showRecipe 6"; |
371 volumeEdit->setValue(query.value(0).toDouble()); |
376 volumeEdit->setValue(query.value(0).toDouble()); |
372 boilvolumeEdit->setValue(query.value(1).toDouble()); |
377 boilvolumeEdit->setValue(query.value(1).toDouble()); |
373 boiltimeEdit->setValue(query.value(2).toInt()); |
378 boiltimeEdit->setValue(query.value(2).toInt()); |
374 efficiencyEdit->setValue(query.value(3).toDouble()); |
379 efficiencyEdit->setValue(query.value(3).toDouble()); |
375 ogEdit->setValue(query.value(4).toDouble()); |
380 ogEdit->setValue(query.value(4).toDouble()); |
381 ibumethodEdit->setText(i_method[query.value(10).toInt()]); |
386 ibumethodEdit->setText(i_method[query.value(10).toInt()]); |
382 co2Edit->setValue(query.value(11).toDouble()); |
387 co2Edit->setValue(query.value(11).toDouble()); |
383 remarksEdit->setPlainText(query.value(12).toString()); |
388 remarksEdit->setPlainText(query.value(12).toString()); |
384 recipeBox->setTitle(query.value(13).toString()); |
389 recipeBox->setTitle(query.value(13).toString()); |
385 recipeBox->setEnabled(true); |
390 recipeBox->setEnabled(true); |
|
391 qDebug() << "showRecipe 7"; |
386 } else { |
392 } else { |
|
393 qDebug() << "showRecipe 5 error"; |
387 qDebug() << "Error getting recipe record" << record; |
394 qDebug() << "Error getting recipe record" << record; |
388 } |
395 } |
389 } |
396 } |
390 |
397 |
391 |
398 |
397 qDebug() << "edit" << recno; |
404 qDebug() << "edit" << recno; |
398 EditRecipe dialog(recno, this); |
405 EditRecipe dialog(recno, this); |
399 /* Signal from editor if a refresh is needed */ |
406 /* Signal from editor if a refresh is needed */ |
400 connect(&dialog, SIGNAL(entry_changed()), this, SLOT(refreshTable())); |
407 connect(&dialog, SIGNAL(entry_changed()), this, SLOT(refreshTable())); |
401 dialog.setModal(true); |
408 dialog.setModal(true); |
402 dialog.exec(); |
409 int rc = dialog.exec(); |
|
410 qDebug() << "edit is ready rc=" << rc; |
403 } |
411 } |
404 |
412 |
405 |
413 |
406 void RecipesTree::on_openButton_clicked() |
414 void RecipesTree::on_openButton_clicked() |
407 { |
415 { |