221 for (int i = 0; i < recipe->hops.size(); i++) { |
221 for (int i = 0; i < recipe->hops.size(); i++) { |
222 if (recipe->hops.at(i).h_amount == 0 && recipe->hops.at(i).h_alpha == 0) |
222 if (recipe->hops.at(i).h_amount == 0 && recipe->hops.at(i).h_alpha == 0) |
223 return; // Add only one at a time. |
223 return; // Add only one at a time. |
224 } |
224 } |
225 |
225 |
|
226 newh.h_name = "Select one"; |
|
227 newh.h_origin = ""; |
|
228 newh.h_amount = 0; |
|
229 newh.h_cost = 0; |
|
230 newh.h_type = 0; |
|
231 newh.h_form = 0; |
|
232 newh.h_useat = 2; |
|
233 newh.h_time = 0; |
|
234 newh.h_alpha = 0; |
|
235 newh.h_beta = 0; |
|
236 newh.h_hsi = 0; |
|
237 newh.h_humulene = 0; |
|
238 newh.h_caryophyllene = 0; |
|
239 newh.h_cohumulone = 0; |
|
240 newh.h_myrcene = 0; |
|
241 newh.h_total_oil = 0; |
|
242 |
|
243 recipe->hops.append(newh); |
226 emit refreshAll(); |
244 emit refreshAll(); |
227 } |
245 } |
228 |
246 |
229 |
247 |
230 void EditRecipe::on_deleteHopRow_clicked() |
248 void EditRecipe::on_deleteHopRow_clicked() |
239 int rc = QMessageBox::warning(this, tr("Delete hop"), tr("Delete %1").arg(recipe->hops.at(row).h_name), |
257 int rc = QMessageBox::warning(this, tr("Delete hop"), tr("Delete %1").arg(recipe->hops.at(row).h_name), |
240 QMessageBox::Yes | QMessageBox::No, QMessageBox::No); |
258 QMessageBox::Yes | QMessageBox::No, QMessageBox::No); |
241 if (rc == QMessageBox::No) |
259 if (rc == QMessageBox::No) |
242 return; |
260 return; |
243 |
261 |
244 |
262 this->ignoreChanges = true; |
|
263 recipe->hops.removeAt(row); |
|
264 this->ignoreChanges = false; |
|
265 is_changed(); |
|
266 emit refreshAll(); |
245 } |
267 } |
246 |
268 |
247 |
269 |
248 void EditRecipe::hop_amount_changed(double val) |
270 void EditRecipe::hop_amount_changed(double val) |
249 { |
271 { |