src/DetailFermenter.cpp

changeset 391
42936c86cbac
parent 333
499c95108bbd
child 414
6582a2a95583
equal deleted inserted replaced
390:2a69be28a925 391:42936c86cbac
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 #include "DetailFermenter.h" 17 #include "DetailFermenter.h"
18 #include "ChartFermenter.h" 18 #include "ChartFermenter.h"
19 #include "Webcam.h"
19 #include "../ui/ui_DetailFermenter.h" 20 #include "../ui/ui_DetailFermenter.h"
20 #include "global.h" 21 #include "global.h"
21 #include "MainWindow.h" 22 #include "MainWindow.h"
22 23
23 24
86 connect(ui->modeEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &DetailFermenter::mode_changed); 87 connect(ui->modeEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &DetailFermenter::mode_changed);
87 connect(ui->stageEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &DetailFermenter::stage_changed); 88 connect(ui->stageEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &DetailFermenter::stage_changed);
88 connect(ui->codePick, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &DetailFermenter::code_changed); 89 connect(ui->codePick, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &DetailFermenter::code_changed);
89 connect(ui->profilePick, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &DetailFermenter::profile_changed); 90 connect(ui->profilePick, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &DetailFermenter::profile_changed);
90 connect(ui->logButton, SIGNAL(clicked()), this, SLOT(on_ChartButton_clicked())); 91 connect(ui->logButton, SIGNAL(clicked()), this, SLOT(on_ChartButton_clicked()));
92 connect(ui->camButton, SIGNAL(clicked()), this, SLOT(on_WebcamButton_clicked()));
91 connect(parent, SIGNAL(updateFermenter(QString)), this, SLOT(refreshFermenter(QString))); 93 connect(parent, SIGNAL(updateFermenter(QString)), this, SLOT(refreshFermenter(QString)));
92 emit refreshTable(); 94 emit refreshTable();
93 } 95 }
94 96
95 97
120 _node = query.value("node").toString(); 122 _node = query.value("node").toString();
121 _alias = query.value("alias").toString(); 123 _alias = query.value("alias").toString();
122 _uuid = query.value("uuid").toString(); 124 _uuid = query.value("uuid").toString();
123 _beercode = query.value("beercode").toString(); 125 _beercode = query.value("beercode").toString();
124 _beername = query.value("beername").toString(); 126 _beername = query.value("beername").toString();
127 _webcam_url = query.value("webcam_url").toString();
128 _webcam_light = query.value("webcam_light").toInt();
125 129
126 ui->uuidEdit->setText(_uuid); 130 ui->uuidEdit->setText(_uuid);
127 ui->systemEdit->setText(_node+"/"+_alias); 131 ui->systemEdit->setText(_node+"/"+_alias);
128 ui->codePick->setItemText(0, _alias.toUpper()+" - "+_alias); 132 ui->codePick->setItemText(0, _alias.toUpper()+" - "+_alias);
129 133
276 ui->modeButton1->hide(); 280 ui->modeButton1->hide();
277 ui->modeButton2->hide(); 281 ui->modeButton2->hide();
278 _profile = QString(""); 282 _profile = QString("");
279 } 283 }
280 284
281 if (query.value("webcam_url").toString() == "") { 285 if (_webcam_url == "") {
282 ui->camButton->hide(); 286 ui->camButton->hide();
283 } else { 287 } else {
284 ui->camButton->show(); 288 ui->camButton->show();
285 } 289 }
286 290
335 339
336 340
337 void DetailFermenter::on_ChartButton_clicked() 341 void DetailFermenter::on_ChartButton_clicked()
338 { 342 {
339 ChartFermenter dialog(_beercode, _beername, this); 343 ChartFermenter dialog(_beercode, _beername, this);
344 }
345
346
347 void DetailFermenter::on_WebcamButton_clicked()
348 {
349 QString msg = QString("{\"device\":\"fermenters\",\"node\":\""+_node+"\",\"unit\":\""+_alias+"\",\"light_state\":100}");
350 webSocket->sendTextMessage(msg);
351 Webcam dialog(_webcam_url, this);
340 } 352 }
341 353
342 354
343 void DetailFermenter::on_quitButton_clicked() 355 void DetailFermenter::on_quitButton_clicked()
344 { 356 {

mercurial