94 else |
108 else |
95 item = new QTableWidgetItem(QString("%1 ml").arg(product->miscs.at(i).amount * 1000.0, 3, 'f', 2, '0')); |
109 item = new QTableWidgetItem(QString("%1 ml").arg(product->miscs.at(i).amount * 1000.0, 3, 'f', 2, '0')); |
96 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
110 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
97 ui->miscsTable->setItem(i, 4, item); |
111 ui->miscsTable->setItem(i, 4, item); |
98 |
112 |
99 if (product->miscs.at(i).amount_is_weight) |
113 if (block_misc(product->stage, product->miscs.at(i).use_use)) { |
100 item = new QTableWidgetItem(QString("%1 gr").arg(product->miscs.at(i).inventory * 1000.0, 3, 'f', 2, '0')); |
114 item = new QTableWidgetItem(QString("")); |
101 else |
115 } else { |
102 item = new QTableWidgetItem(QString("%1 ml").arg(product->miscs.at(i).inventory * 1000.0, 3, 'f', 2, '0')); |
116 if (product->miscs.at(i).amount_is_weight) |
103 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
117 item = new QTableWidgetItem(QString("%1 gr").arg(product->miscs.at(i).inventory * 1000.0, 3, 'f', 2, '0')); |
104 if (product->miscs.at(i).inventory < product->miscs.at(i).amount) |
118 else |
105 item->setForeground(QBrush(QColor(Qt::red))); |
119 item = new QTableWidgetItem(QString("%1 ml").arg(product->miscs.at(i).inventory * 1000.0, 3, 'f', 2, '0')); |
|
120 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
|
121 if (product->miscs.at(i).inventory < product->miscs.at(i).amount) |
|
122 item->setForeground(QBrush(QColor(Qt::red))); |
|
123 } |
106 ui->miscsTable->setItem(i, 5, item); |
124 ui->miscsTable->setItem(i, 5, item); |
107 |
125 |
108 /* |
126 /* |
109 * Add the Delete and Edit row buttons. |
127 * Add the Delete and Edit row buttons. |
110 * Not for water agents, these are set on the water tab. |
128 * Not for water agents, these are set on the water tab. |
|
129 * And also not if the ingredient has been used. |
111 */ |
130 */ |
112 if (product->miscs.at(i).type == MISC_TYPES_WATER_AGENT) { |
131 if (product->miscs.at(i).type == MISC_TYPES_WATER_AGENT) { |
113 ui->miscsTable->removeCellWidget(i, 6); /* to remove the unneeded button */ |
132 ui->miscsTable->removeCellWidget(i, 6); /* to remove the unneeded button */ |
114 item = new QTableWidgetItem(""); |
133 item = new QTableWidgetItem(""); |
115 item->setToolTip(tr("Edit this from the water tab")); |
134 item->setToolTip(tr("Edit this from the water tab")); |
116 ui->miscsTable->setItem(i, 6, item); |
135 ui->miscsTable->setItem(i, 6, item); |
117 ui->miscsTable->removeCellWidget(i, 7); |
136 ui->miscsTable->removeCellWidget(i, 7); |
118 item = new QTableWidgetItem(""); |
137 item = new QTableWidgetItem(""); |
119 item->setToolTip(tr("Edit this from the water tab")); |
138 item->setToolTip(tr("Edit this from the water tab")); |
|
139 ui->miscsTable->setItem(i, 7, item); |
|
140 } else if (block_misc(product->stage, product->miscs.at(i).use_use)) { |
|
141 ui->miscsTable->removeCellWidget(i, 6); /* to remove the unneeded button */ |
|
142 item = new QTableWidgetItem(""); |
|
143 item->setToolTip(tr("Misc already used")); |
|
144 ui->miscsTable->setItem(i, 6, item); |
|
145 ui->miscsTable->removeCellWidget(i, 7); |
|
146 item = new QTableWidgetItem(""); |
|
147 item->setToolTip(tr("Misc already used")); |
120 ui->miscsTable->setItem(i, 7, item); |
148 ui->miscsTable->setItem(i, 7, item); |
121 } else { |
149 } else { |
122 if (ui->miscsTable->item(i, 6)) { |
150 if (ui->miscsTable->item(i, 6)) { |
123 ui->miscsTable->takeItem(i, 6); /* to remove the old tooltip */ |
151 ui->miscsTable->takeItem(i, 6); /* to remove the old tooltip */ |
124 } |
152 } |