Added date set/clear buttons for inventory Fermentables and Yeasts.

Wed, 15 Jun 2022 16:45:43 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Wed, 15 Jun 2022 16:45:43 +0200
changeset 293
6df94ca2bfde
parent 292
b6ec2e275736
child 294
afc763d9fd89

Added date set/clear buttons for inventory Fermentables and Yeasts.

src/EditFermentable.cpp file | annotate | diff | comparison | revisions
src/EditFermentable.h file | annotate | diff | comparison | revisions
src/EditYeast.cpp file | annotate | diff | comparison | revisions
src/EditYeast.h file | annotate | diff | comparison | revisions
ui/EditFermentable.ui file | annotate | diff | comparison | revisions
ui/EditYeast.ui file | annotate | diff | comparison | revisions
--- a/src/EditFermentable.cpp	Wed Jun 15 14:48:10 2022 +0200
+++ b/src/EditFermentable.cpp	Wed Jun 15 16:45:43 2022 +0200
@@ -133,7 +133,11 @@
     connect(ui->diphEdit, &QDoubleSpinBox::textChanged, this, &EditFermentable::is_changed);
     connect(ui->acidphEdit, &QDoubleSpinBox::textChanged, this, &EditFermentable::is_changed);
     connect(ui->prodEdit, &QDateEdit::dateChanged, this, &EditFermentable::is_changed);
+    connect(ui->prodButton1, SIGNAL(clicked()), this, SLOT(prod_date_today()));
+    connect(ui->prodButton2, SIGNAL(clicked()), this, SLOT(prod_date_clear()));
     connect(ui->thtEdit, &QDateEdit::dateChanged, this, &EditFermentable::is_changed);
+    connect(ui->thtButton1, SIGNAL(clicked()), this, SLOT(tht_date_today()));
+    connect(ui->thtButton2, SIGNAL(clicked()), this, SLOT(tht_date_clear()));
 
     ui->saveButton->setEnabled(false);
     ui->deleteButton->setEnabled((ui->inventoryEdit->value() == 0 && id >= 0) ? true:false);
@@ -322,3 +326,32 @@
     this->close();
     this->setResult(1);
 }
+
+
+void EditFermentable::prod_date_clear()
+{
+    ui->prodEdit->setDate(QDate());
+    is_changed();
+}
+
+
+void EditFermentable::prod_date_today()
+{
+    ui->prodEdit->setDate(QDate::currentDate());
+    is_changed();
+}
+
+
+void EditFermentable::tht_date_clear()
+{
+    ui->thtEdit->setDate(QDate());
+    is_changed();
+}
+
+
+void EditFermentable::tht_date_today()
+{
+    ui->thtEdit->setDate(QDate::currentDate());
+    is_changed();
+}
+
--- a/src/EditFermentable.h	Wed Jun 15 14:48:10 2022 +0200
+++ b/src/EditFermentable.h	Wed Jun 15 16:45:43 2022 +0200
@@ -26,6 +26,10 @@
     void is_changed();
     void wk_changed(double val);
     void lintner_changed(double val);
+    void prod_date_clear();
+    void prod_date_today();
+    void tht_date_clear();
+    void tht_date_today();
 
 private:
     Ui::EditFermentable *ui;
--- a/src/EditYeast.cpp	Wed Jun 15 14:48:10 2022 +0200
+++ b/src/EditYeast.cpp	Wed Jun 15 16:45:43 2022 +0200
@@ -130,7 +130,11 @@
     connect(ui->inventoryEdit, &QDoubleSpinBox::textChanged, this, &EditYeast::is_changed);
     connect(ui->costEdit, &QDoubleSpinBox::textChanged, this, &EditYeast::is_changed);
     connect(ui->prodEdit, &QDateEdit::dateChanged, this, &EditYeast::is_changed);
+    connect(ui->prodButton1, SIGNAL(clicked()), this, SLOT(prod_date_today()));
+    connect(ui->prodButton2, SIGNAL(clicked()), this, SLOT(prod_date_clear()));
     connect(ui->thtEdit, &QDateEdit::dateChanged, this, &EditYeast::is_changed);
+    connect(ui->thtButton1, SIGNAL(clicked()), this, SLOT(tht_date_today()));
+    connect(ui->thtButton2, SIGNAL(clicked()), this, SLOT(tht_date_clear()));
     connect(ui->cellsEdit, &QDoubleSpinBox::textChanged, this, &EditYeast::is_changed);
     connect(ui->sta1Edit, &QCheckBox::stateChanged, this, &EditYeast::is_changed);
     connect(ui->bacteriaEdit, &QCheckBox::stateChanged, this, &EditYeast::is_changed);
@@ -423,3 +427,32 @@
     this->close();
     this->setResult(1);
 }
+
+
+void EditYeast::prod_date_clear()
+{
+    ui->prodEdit->setDate(QDate());
+    is_changed();
+}
+
+
+void EditYeast::prod_date_today()
+{
+    ui->prodEdit->setDate(QDate::currentDate());
+    is_changed();
+}
+
+
+void EditYeast::tht_date_clear()
+{
+    ui->thtEdit->setDate(QDate());
+    is_changed();
+}
+
+
+void EditYeast::tht_date_today()
+{
+    ui->thtEdit->setDate(QDate::currentDate());
+    is_changed();
+}
+
--- a/src/EditYeast.h	Wed Jun 15 14:48:10 2022 +0200
+++ b/src/EditYeast.h	Wed Jun 15 16:45:43 2022 +0200
@@ -30,6 +30,10 @@
     void sglo_changed();
     void grhlhi_changed();
     void sghi_changed();
+    void prod_date_clear();
+    void prod_date_today();
+    void tht_date_clear();
+    void tht_date_today();
 
 private:
     Ui::EditYeast *ui;
--- a/ui/EditFermentable.ui	Wed Jun 15 14:48:10 2022 +0200
+++ b/ui/EditFermentable.ui	Wed Jun 15 16:45:43 2022 +0200
@@ -387,7 +387,7 @@
      <widget class="QLabel" name="prodLabel">
       <property name="geometry">
        <rect>
-        <x>660</x>
+        <x>590</x>
         <y>440</y>
         <width>141</width>
         <height>20</height>
@@ -403,7 +403,7 @@
      <widget class="QLabel" name="thtLabel">
       <property name="geometry">
        <rect>
-        <x>660</x>
+        <x>590</x>
         <y>470</y>
         <width>141</width>
         <height>20</height>
@@ -555,6 +555,9 @@
       <property name="accelerated">
        <bool>true</bool>
       </property>
+      <property name="suffix">
+       <string> Kg</string>
+      </property>
       <property name="decimals">
        <number>3</number>
       </property>
@@ -583,6 +586,9 @@
       <property name="accelerated">
        <bool>true</bool>
       </property>
+      <property name="suffix">
+       <string> €</string>
+      </property>
       <property name="maximum">
        <double>100000.000000000000000</double>
       </property>
@@ -849,7 +855,7 @@
      <widget class="NullDateEdit" name="prodEdit">
       <property name="geometry">
        <rect>
-        <x>810</x>
+        <x>740</x>
         <y>440</y>
         <width>121</width>
         <height>24</height>
@@ -892,7 +898,7 @@
      <widget class="NullDateEdit" name="thtEdit">
       <property name="geometry">
        <rect>
-        <x>810</x>
+        <x>740</x>
         <y>470</y>
         <width>121</width>
         <height>24</height>
@@ -996,6 +1002,12 @@
       <property name="buttonSymbols">
        <enum>QAbstractSpinBox::NoButtons</enum>
       </property>
+      <property name="suffix">
+       <string> €</string>
+      </property>
+      <property name="maximum">
+       <double>1000000.000000000000000</double>
+      </property>
      </widget>
      <widget class="QLabel" name="lintnerLabel">
       <property name="geometry">
@@ -1041,6 +1053,86 @@
        <double>0.500000000000000</double>
       </property>
      </widget>
+     <widget class="QToolButton" name="thtButton1">
+      <property name="geometry">
+       <rect>
+        <x>870</x>
+        <y>470</y>
+        <width>28</width>
+        <height>22</height>
+       </rect>
+      </property>
+      <property name="toolTip">
+       <string>Set the tht date to today.</string>
+      </property>
+      <property name="text">
+       <string>...</string>
+      </property>
+      <property name="icon">
+       <iconset resource="../../../../../../home/mbroek/MyProjects/bmsapp/resources/icons.qrc">
+        <normaloff>:/icons/silk/date.png</normaloff>:/icons/silk/date.png</iconset>
+      </property>
+     </widget>
+     <widget class="QToolButton" name="thtButton2">
+      <property name="geometry">
+       <rect>
+        <x>902</x>
+        <y>470</y>
+        <width>28</width>
+        <height>22</height>
+       </rect>
+      </property>
+      <property name="toolTip">
+       <string>Clear tht date</string>
+      </property>
+      <property name="text">
+       <string>...</string>
+      </property>
+      <property name="icon">
+       <iconset resource="../../../../../../home/mbroek/MyProjects/bmsapp/resources/icons.qrc">
+        <normaloff>:/icons/silk/delete.png</normaloff>:/icons/silk/delete.png</iconset>
+      </property>
+     </widget>
+     <widget class="QToolButton" name="prodButton1">
+      <property name="geometry">
+       <rect>
+        <x>870</x>
+        <y>440</y>
+        <width>28</width>
+        <height>22</height>
+       </rect>
+      </property>
+      <property name="toolTip">
+       <string>Set the production date to today.</string>
+      </property>
+      <property name="text">
+       <string>...</string>
+      </property>
+      <property name="icon">
+       <iconset resource="../../../../../../home/mbroek/MyProjects/bmsapp/resources/icons.qrc">
+        <normaloff>:/icons/silk/date.png</normaloff>:/icons/silk/date.png</iconset>
+      </property>
+     </widget>
+     <widget class="QToolButton" name="prodButton2">
+      <property name="geometry">
+       <rect>
+        <x>902</x>
+        <y>440</y>
+        <width>28</width>
+        <height>22</height>
+       </rect>
+      </property>
+      <property name="toolTip">
+       <string>Clear production date</string>
+      </property>
+      <property name="text">
+       <string>...</string>
+      </property>
+      <property name="icon">
+       <iconset resource="../../../../../../home/mbroek/MyProjects/bmsapp/resources/icons.qrc">
+        <normaloff>:/icons/silk/delete.png</normaloff>:/icons/silk/delete.png</iconset>
+      </property>
+     </widget>
     </widget>
    </item>
   </layout>
--- a/ui/EditYeast.ui	Wed Jun 15 14:48:10 2022 +0200
+++ b/ui/EditYeast.ui	Wed Jun 15 16:45:43 2022 +0200
@@ -99,7 +99,7 @@
      <widget class="QLabel" name="prodLabel">
       <property name="geometry">
        <rect>
-        <x>660</x>
+        <x>590</x>
         <y>430</y>
         <width>141</width>
         <height>20</height>
@@ -115,7 +115,7 @@
      <widget class="QLabel" name="thtLabel">
       <property name="geometry">
        <rect>
-        <x>660</x>
+        <x>590</x>
         <y>460</y>
         <width>141</width>
         <height>20</height>
@@ -206,6 +206,9 @@
       <property name="accelerated">
        <bool>true</bool>
       </property>
+      <property name="suffix">
+       <string> €</string>
+      </property>
       <property name="maximum">
        <double>1000.000000000000000</double>
       </property>
@@ -216,16 +219,26 @@
        <enum>QAbstractSpinBox::DefaultStepType</enum>
       </property>
      </widget>
-     <widget class="NullDateEdit" name="prodEdit" native="true">
+     <widget class="NullDateEdit" name="prodEdit">
       <property name="geometry">
        <rect>
-        <x>810</x>
+        <x>740</x>
         <y>430</y>
         <width>121</width>
         <height>24</height>
        </rect>
       </property>
-      <property name="dateTime" stdset="0">
+      <property name="dateTime">
+       <datetime>
+        <hour>0</hour>
+        <minute>0</minute>
+        <second>0</second>
+        <year>2000</year>
+        <month>1</month>
+        <day>1</day>
+       </datetime>
+      </property>
+      <property name="minimumDateTime">
        <datetime>
         <hour>0</hour>
         <minute>0</minute>
@@ -235,26 +248,46 @@
         <day>1</day>
        </datetime>
       </property>
-      <property name="displayFormat" stdset="0">
+      <property name="displayFormat">
        <string>yyyy-MM-dd</string>
       </property>
-      <property name="calendarPopup" stdset="0">
+      <property name="calendarPopup">
        <bool>true</bool>
       </property>
      </widget>
-     <widget class="NullDateEdit" name="thtEdit" native="true">
+     <widget class="NullDateEdit" name="thtEdit">
       <property name="geometry">
        <rect>
-        <x>810</x>
+        <x>740</x>
         <y>460</y>
         <width>121</width>
         <height>24</height>
        </rect>
       </property>
-      <property name="displayFormat" stdset="0">
+      <property name="dateTime">
+       <datetime>
+        <hour>0</hour>
+        <minute>0</minute>
+        <second>0</second>
+        <year>2000</year>
+        <month>1</month>
+        <day>1</day>
+       </datetime>
+      </property>
+      <property name="minimumDateTime">
+       <datetime>
+        <hour>0</hour>
+        <minute>0</minute>
+        <second>0</second>
+        <year>2000</year>
+        <month>1</month>
+        <day>1</day>
+       </datetime>
+      </property>
+      <property name="displayFormat">
        <string>yyyy-MM-dd</string>
       </property>
-      <property name="calendarPopup" stdset="0">
+      <property name="calendarPopup">
        <bool>true</bool>
       </property>
      </widget>
@@ -339,6 +372,9 @@
       <property name="buttonSymbols">
        <enum>QAbstractSpinBox::NoButtons</enum>
       </property>
+      <property name="suffix">
+       <string> €</string>
+      </property>
      </widget>
      <widget class="QLabel" name="productidLabel">
       <property name="geometry">
@@ -1103,6 +1139,86 @@
        <string>@</string>
       </property>
      </widget>
+     <widget class="QToolButton" name="thtButton2">
+      <property name="geometry">
+       <rect>
+        <x>902</x>
+        <y>460</y>
+        <width>28</width>
+        <height>22</height>
+       </rect>
+      </property>
+      <property name="toolTip">
+       <string>Clear tht date</string>
+      </property>
+      <property name="text">
+       <string>...</string>
+      </property>
+      <property name="icon">
+       <iconset resource="../../../../../../home/mbroek/MyProjects/bmsapp/resources/icons.qrc">
+        <normaloff>:/icons/silk/delete.png</normaloff>:/icons/silk/delete.png</iconset>
+      </property>
+     </widget>
+     <widget class="QToolButton" name="prodButton2">
+      <property name="geometry">
+       <rect>
+        <x>902</x>
+        <y>430</y>
+        <width>28</width>
+        <height>22</height>
+       </rect>
+      </property>
+      <property name="toolTip">
+       <string>Clear production date</string>
+      </property>
+      <property name="text">
+       <string>...</string>
+      </property>
+      <property name="icon">
+       <iconset resource="../../../../../../home/mbroek/MyProjects/bmsapp/resources/icons.qrc">
+        <normaloff>:/icons/silk/delete.png</normaloff>:/icons/silk/delete.png</iconset>
+      </property>
+     </widget>
+     <widget class="QToolButton" name="prodButton1">
+      <property name="geometry">
+       <rect>
+        <x>870</x>
+        <y>430</y>
+        <width>28</width>
+        <height>22</height>
+       </rect>
+      </property>
+      <property name="toolTip">
+       <string>Set the production date to today.</string>
+      </property>
+      <property name="text">
+       <string>...</string>
+      </property>
+      <property name="icon">
+       <iconset resource="../../../../../../home/mbroek/MyProjects/bmsapp/resources/icons.qrc">
+        <normaloff>:/icons/silk/date.png</normaloff>:/icons/silk/date.png</iconset>
+      </property>
+     </widget>
+     <widget class="QToolButton" name="thtButton1">
+      <property name="geometry">
+       <rect>
+        <x>870</x>
+        <y>460</y>
+        <width>28</width>
+        <height>22</height>
+       </rect>
+      </property>
+      <property name="toolTip">
+       <string>Set the tht date to today.</string>
+      </property>
+      <property name="text">
+       <string>...</string>
+      </property>
+      <property name="icon">
+       <iconset resource="../../../../../../home/mbroek/MyProjects/bmsapp/resources/icons.qrc">
+        <normaloff>:/icons/silk/date.png</normaloff>:/icons/silk/date.png</iconset>
+      </property>
+     </widget>
     </widget>
    </item>
   </layout>
@@ -1110,7 +1226,7 @@
  <customwidgets>
   <customwidget>
    <class>NullDateEdit</class>
-   <extends>QWidget</extends>
+   <extends>QDateEdit</extends>
    <header>NullDateEdit.h</header>
   </customwidget>
  </customwidgets>

mercurial