300 |
300 |
301 QPushButton *pb = qobject_cast<QPushButton *>(QObject::sender()); |
301 QPushButton *pb = qobject_cast<QPushButton *>(QObject::sender()); |
302 int row = pb->objectName().toInt(); |
302 int row = pb->objectName().toInt(); |
303 qDebug() << "Move up mash row" << row << recipe->mashs.size(); |
303 qDebug() << "Move up mash row" << row << recipe->mashs.size(); |
304 |
304 |
305 Mashs temp; |
305 MashSteps temp; |
306 temp = recipe->mashs[row - 1]; |
306 temp = recipe->mashs[row - 1]; |
307 recipe->mashs[row - 1] = recipe->mashs[row]; |
307 recipe->mashs[row - 1] = recipe->mashs[row]; |
308 recipe->mashs[row] = temp; |
308 recipe->mashs[row] = temp; |
309 is_changed(); |
309 is_changed(); |
310 emit refreshAll(); |
310 emit refreshAll(); |
318 |
318 |
319 QPushButton *pb = qobject_cast<QPushButton *>(QObject::sender()); |
319 QPushButton *pb = qobject_cast<QPushButton *>(QObject::sender()); |
320 int row = pb->objectName().toInt(); |
320 int row = pb->objectName().toInt(); |
321 qDebug() << "Move down mash row" << row << recipe->mashs.size(); |
321 qDebug() << "Move down mash row" << row << recipe->mashs.size(); |
322 |
322 |
323 Mashs temp; |
323 MashSteps temp; |
324 temp = recipe->mashs[row + 1]; |
324 temp = recipe->mashs[row + 1]; |
325 recipe->mashs[row + 1] = recipe->mashs[row]; |
325 recipe->mashs[row + 1] = recipe->mashs[row]; |
326 recipe->mashs[row] = temp; |
326 recipe->mashs[row] = temp; |
327 is_changed(); |
327 is_changed(); |
328 emit refreshAll(); |
328 emit refreshAll(); |
434 return; |
434 return; |
435 |
435 |
436 QPushButton *pb = qobject_cast<QPushButton *>(QObject::sender()); |
436 QPushButton *pb = qobject_cast<QPushButton *>(QObject::sender()); |
437 recipe->mashs_row = pb->objectName().toInt(); |
437 recipe->mashs_row = pb->objectName().toInt(); |
438 qDebug() << "Edit mash row" << recipe->mashs_row; |
438 qDebug() << "Edit mash row" << recipe->mashs_row; |
439 Mashs backup = recipe->mashs.at(recipe->mashs_row); |
439 MashSteps backup = recipe->mashs.at(recipe->mashs_row); |
440 |
440 |
441 QDialog* dialog = new QDialog(this); |
441 QDialog* dialog = new QDialog(this); |
442 dialog->resize(738, 230); |
442 dialog->resize(738, 230); |
443 QDialogButtonBox *buttonBox = new QDialogButtonBox(dialog); |
443 QDialogButtonBox *buttonBox = new QDialogButtonBox(dialog); |
444 buttonBox->setObjectName(QString::fromUtf8("buttonBox")); |
444 buttonBox->setObjectName(QString::fromUtf8("buttonBox")); |
640 ui->mashsTable->clear(); |
640 ui->mashsTable->clear(); |
641 } |
641 } |
642 if (newsteps.isArray()) { |
642 if (newsteps.isArray()) { |
643 for (i = 0; i < newsteps.array().size(); i++) { |
643 for (i = 0; i < newsteps.array().size(); i++) { |
644 QJsonObject obj = newsteps.array().at(i).toObject(); |
644 QJsonObject obj = newsteps.array().at(i).toObject(); |
645 Mashs m; |
645 MashSteps m; |
646 m.step_name = obj["step_name"].toString(); |
646 m.step_name = obj["step_name"].toString(); |
647 if (obj["step_type"].isString()) |
647 if (obj["step_type"].isString()) |
648 m.step_type = QString(obj["step_type"].toString()).toInt(); |
648 m.step_type = QString(obj["step_type"].toString()).toInt(); |
649 else |
649 else |
650 m.step_type = obj["step_type"].toInt(); |
650 m.step_type = obj["step_type"].toInt(); |