From 2e33fab9c99395d30da0859533f2ba27c8406908 Mon Sep 17 00:00:00 2001 From: deva Date: Mon, 2 May 2005 20:34:38 +0000 Subject: Some hacked borky ugly scumm code to check for errors! :( --- src/encoder.cc | 17 ++++++++++++++++- src/mainwindow.cc | 17 +++++++++++++++++ src/mainwindow.h | 8 ++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/encoder.cc b/src/encoder.cc index e6cbb92..0af6ad4 100644 --- a/src/encoder.cc +++ b/src/encoder.cc @@ -25,6 +25,10 @@ */ /* * $Log$ + * Revision 1.25 2005/05/02 20:34:38 deva + * + * Some hacked borky ugly scumm code to check for errors! :( + * * Revision 1.24 2005/05/02 10:35:23 deva * Fixed wrongly showed snapshot thumbnails. * @@ -106,7 +110,8 @@ void Encoder::encode() frame = queue->pop(); - if(frame) { + // If errors has occurred we better not try sending something over the network! + if(frame && !errobj->hasError()) { if(frame->freeze) frozen = true; if(frame->shoot) frozen = false; @@ -119,6 +124,15 @@ void Encoder::encode() s = new Socket(port, errobj); s->sconnect(ip); n = new Network(s, errobj); + // FIXME: This is darn ugly! + if(errobj->hasError()) { + delete n; + delete s; + s = NULL; + n = NULL; + // break; + goto getout; + } } n_header h; @@ -147,6 +161,7 @@ void Encoder::encode() } } } + getout: if(frame) delete frame; } } diff --git a/src/mainwindow.cc b/src/mainwindow.cc index 829d0fd..80b99b6 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -27,6 +27,10 @@ */ /* * $Log$ + * Revision 1.23 2005/05/02 20:34:38 deva + * + * Some hacked borky ugly scumm code to check for errors! :( + * * Revision 1.22 2005/05/02 19:56:17 deva * * cpr_clicked is now blocked, if a recording session on. A messagebox explains @@ -148,6 +152,10 @@ MainWindow::MainWindow( QWidget* parent, const char* name ) // Open the CPR Dialog cpr_clicked(); + + errtimer = new QTimer(this); + connect(errtimer, SIGNAL(timeout()), SLOT(check_errors())); + errtimer->start(2000); } MainWindow::~MainWindow() @@ -422,4 +430,13 @@ void MainWindow::freeze_clicked() } } +void MainWindow::check_errors() +{ + while(cam_error->hasError()) { + MessageBox(this, TXT_ERROR_TITLE, cam_error->popErrorString().c_str(), + TYPE_OK, ICON_ERROR).exec(); + } +} + + #endif /*USE_GUI*/ diff --git a/src/mainwindow.h b/src/mainwindow.h index 716ca39..2390c21 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -27,6 +27,10 @@ */ /* * $Log$ + * Revision 1.10 2005/05/02 20:34:38 deva + * + * Some hacked borky ugly scumm code to check for errors! :( + * * Revision 1.9 2005/05/02 19:56:17 deva * * cpr_clicked is now blocked, if a recording session on. A messagebox explains @@ -101,6 +105,7 @@ public slots: void shoot_clicked(); void freeze_clicked(); void redraw_edge(); + void check_errors(); private: Error *error; @@ -124,6 +129,9 @@ private: QLabel *lbl_cpr; QLabel *lbl_name; + // Used for the check_for_error_once_per_2_seconds (very ugly) + QTimer *errtimer; + float rec_edge_counter; QTimer *timer; QLabel *img_recedge; -- cgit v1.2.3