Fixed placing time value in the wrong column. Added misc use changed. Tab 4 layout changed.

Sun, 17 Apr 2022 10:50:48 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sun, 17 Apr 2022 10:50:48 +0200
changeset 140
6638609328c2
parent 139
f947c6988e91
child 141
eea8a9e7e1f6

Fixed placing time value in the wrong column. Added misc use changed. Tab 4 layout changed.

src/EditRecipeTab4.cpp file | annotate | diff | comparison | revisions
ui/EditRecipe.ui file | annotate | diff | comparison | revisions
--- a/src/EditRecipeTab4.cpp	Sat Apr 16 21:54:43 2022 +0200
+++ b/src/EditRecipeTab4.cpp	Sun Apr 17 10:50:48 2022 +0200
@@ -338,7 +338,7 @@
 	item = new QTableWidgetItem(QString(""));
     }
     item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
-    ui->miscsTable->setItem(recipe->miscs_row, 4, item);
+    ui->miscsTable->setItem(recipe->miscs_row, 3, item);
 
     this->ignoreChanges = false;
     is_changed();
@@ -459,7 +459,37 @@
 
 void EditRecipe::misc_useat_changed(int val)
 {
+    QTableWidgetItem *item;
 
+    qDebug() << "misc_useat_changed" << val;
+    this->ignoreChanges = true;
+    recipe->miscs[recipe->miscs_row].m_use_use = val;
+    item = new QTableWidgetItem(m_uses[val]);
+    item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter);
+    ui->miscsTable->setItem(recipe->miscs_row, 2, item);
+
+    if (val == 3 || val == 4) {     // Fermentation stages
+	recipe->miscs[recipe->miscs_row].m_time = mtimeEdit->value() * 1440;
+        mtimeEdit->setReadOnly(false);
+        mtimeLabel->setText(tr("Time in days:"));
+        item = new QTableWidgetItem(QString("%1 days.").arg(recipe->miscs.at(recipe->miscs_row).m_time / 1440, 1, 'f', 0, '0'));
+    } else if (val == 2) {    // Boil
+	recipe->miscs[recipe->miscs_row].m_time = mtimeEdit->value();
+        mtimeEdit->setReadOnly(false);
+        mtimeLabel->setText(tr("Time in minutes:"));
+        item = new QTableWidgetItem(QString("%1 min.").arg(recipe->miscs.at(recipe->miscs_row).m_time, 1, 'f', 0, '0'));
+    } else {
+	recipe->miscs[recipe->miscs_row].m_time = 0;
+	mtimeEdit->setValue(0);
+        mtimeEdit->setReadOnly(true);
+        mtimeLabel->setText("");
+        item = new QTableWidgetItem(QString(""));
+    }
+    item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
+    ui->miscsTable->setItem(recipe->miscs_row, 3, item);
+
+    this->ignoreChanges = false;
+    is_changed();
 }
 
 
--- a/ui/EditRecipe.ui	Sat Apr 16 21:54:43 2022 +0200
+++ b/ui/EditRecipe.ui	Sun Apr 17 10:50:48 2022 +0200
@@ -1544,18 +1544,18 @@
        <widget class="QTableWidget" name="miscsTable">
         <property name="geometry">
          <rect>
-          <x>10</x>
-          <y>70</y>
-          <width>1101</width>
-          <height>391</height>
+          <x>140</x>
+          <y>10</y>
+          <width>849</width>
+          <height>451</height>
          </rect>
         </property>
        </widget>
        <widget class="QPushButton" name="addMisc">
         <property name="geometry">
          <rect>
-          <x>140</x>
-          <y>30</y>
+          <x>30</x>
+          <y>40</y>
           <width>80</width>
           <height>23</height>
          </rect>

mercurial