From 63ac729b32331438a607ec5b8be046143c7592e6 Mon Sep 17 00:00:00 2001 From: deva Date: Sat, 26 Mar 2005 10:32:50 +0000 Subject: Added an error object for genereic error message handling. --- src/mainwindow.cc | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'src/mainwindow.cc') diff --git a/src/mainwindow.cc b/src/mainwindow.cc index b26d6ce..869d5c3 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -90,7 +90,13 @@ MainWindow::MainWindow( QWidget* parent, const char* name ) createGui(); show(); - camera = new Camera(cfg.readString("server_addr")->c_str(), cfg.readInt("server_port")); + camera = new Camera(); + camera->connect(cfg.readString("server_addr")->c_str(), + cfg.readInt("server_port")); + + if(camera->hasError()) { + MessageBox(this, "", camera->getErrorString().c_str(), TYPE_OK, ICON_ERROR).exec(); + } recording = false; frozen = false; @@ -242,8 +248,20 @@ void MainWindow::logo_clicked() void MainWindow::cpr_clicked() { + { + // TODO: Save CPR and name, from the labels. + } + + // Create and call the CPRQueryDialog. CPRQueryDialog dlg(lbl_cpr, lbl_name, this, "CPRQueryDialog"); - printf("Cpr Dialog returned: %d\n", dlg.exec()); + + if(dlg.exec() == 0) { + printf("Cancel!\n"); + // TODO: Restore old CPR and name, in the labels. + } else { + printf("CPR changed\n"); + // TODO: Change CPR camera. + } } void MainWindow::rec_clicked() @@ -252,11 +270,11 @@ void MainWindow::rec_clicked() if(recording) { img_recedge->setBackgroundColor(red); btn_rec->setPixmap(*pix_stop); - camera->stop(); + camera->start(); } else { img_recedge->setBackgroundColor(QColor(160,160,160)); btn_rec->setPixmap(*pix_record); - camera->start(); + camera->stop(); } } -- cgit v1.2.3