16 * You should have received a copy of the GNU General Public License |
16 * You should have received a copy of the GNU General Public License |
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
18 */ |
18 */ |
19 |
19 |
20 |
20 |
|
21 /** |
|
22 * @brief Check the state by examining the date values. |
|
23 * 1. startdate and enddate invalid, planning/wait status. |
|
24 * The enddate cannot be set. |
|
25 * 2. startdate valid and endate invalid, brewdate is planned. |
|
26 * The fase will be brew. Enable setting of enddate. |
|
27 * 3. startdate valid, enddate and start and endtime can be set. |
|
28 * The enddate cannot be before the startdate and not after 4 |
|
29 * days from the start. |
|
30 * 4. startdate and enddate and times are set and valid. Block |
|
31 * the startdate setting. But only after setting a lot of |
|
32 * brewdata move the fase to primary. |
|
33 * |
|
34 */ |
|
35 void EditProduct::updateBrewday() |
|
36 { |
|
37 setStage(); |
|
38 |
|
39 qDebug() << "updateBrewday" << product->brew_date_start.date() << product->brew_date_end.date(); |
|
40 |
|
41 ui->brew_startDate->setDate(product->brew_date_start.date()); |
|
42 ui->brew_startTime->setTime(product->brew_date_start.time()); |
|
43 ui->brew_endDate->setDate(product->brew_date_end.date()); |
|
44 ui->brew_endTime->setTime(product->brew_date_end.time()); |
|
45 } |
|
46 |
|
47 |
|
48 void EditProduct::brew_date_clear() |
|
49 { |
|
50 product->brew_date_start.setDate(QDate()); |
|
51 ui->brew_startDate->setDate(QDate()); |
|
52 } |
|
53 |
|
54 |
|
55 void EditProduct::brew_date_today() |
|
56 { |
|
57 product->brew_date_start.setDate(QDate::currentDate()); |
|
58 ui->brew_startDate->setDate(QDate::currentDate()); |
|
59 } |
|
60 |
|
61 |
|
62 void EditProduct::brew_start_date_changed(QDate val) |
|
63 { |
|
64 product->brew_date_start.setDate(ui->brew_startDate->nullDate()); |
|
65 qDebug() << "brew_start_date_changed" << product->brew_date_start.date(); |
|
66 updateBrewday(); |
|
67 } |
|
68 |
|
69 |
|
70 void EditProduct::brew_end_today() |
|
71 { |
|
72 } |
|
73 |
|
74 |
|
75 void EditProduct::brew_end_date_changed(QDate val) |
|
76 { |
|
77 qDebug() << "brew_end_date_changed" << val; |
|
78 } |
|
79 |
|
80 |