summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordeva <deva>2005-06-15 08:28:58 +0000
committerdeva <deva>2005-06-15 08:28:58 +0000
commit6856d545cbaba8ea8945f8ff880377bed4aa404c (patch)
tree2e5add5a907c9ff4a185857ccf381bc2899d1049
parent35f79080273e736107e70c23675c89220bc2feda (diff)
Added logging to mainwindow, removed newline in log entry from file
-rw-r--r--src/mainwindow.cc35
1 files changed, 29 insertions, 6 deletions
diff --git a/src/mainwindow.cc b/src/mainwindow.cc
index 9e5353d..0e84dbf 100644
--- a/src/mainwindow.cc
+++ b/src/mainwindow.cc
@@ -31,6 +31,9 @@
/*
* $Log$
+ * Revision 1.30 2005/06/15 08:28:58 deva
+ * Added logging to mainwindow, removed newline in log entry from file
+ *
* Revision 1.29 2005/06/14 12:29:40 deva
* Incorporated the use of the Info object everywhere... also using the log functionality.
*
@@ -43,7 +46,6 @@
* Made some cleanup in the status bar.
*
* Revision 1.26 2005/05/16 16:00:56 deva
- *
* Lots of stuff!
*
* Revision 1.25 2005/05/03 09:22:12 deva
@@ -53,16 +55,13 @@
* Removed the error object, and replaced it with a more generic info object.
*
* 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
* how to stop before trying to change the cpr number again.
*
* Revision 1.21 2005/05/02 18:47:21 deva
- *
* Cpr now sent to decoder. And saved prioer to editing, in order to be able
* to disable editing session and revert to old cpr.
*
@@ -114,6 +113,8 @@ MainWindow::MainWindow(QApplication *qApp, QWidget* parent, const char* name )
{
info = new InfoGui(qApp, this, config);
+ info->log("Starting MIaV.");
+
video_width = config->readInt("video_width");
video_height = config->readInt("video_height");
@@ -172,15 +173,20 @@ MainWindow::MainWindow(QApplication *qApp, QWidget* parent, const char* name )
recording = false;
frozen = false;
+ info->log("MIaV is ready.");
+
// Open the CPR Dialog
cpr_clicked();
-
}
MainWindow::~MainWindow()
{
+ info->log("MIaV is shutting down.");
+
delete camera;
delete btn_cpr;
+
+ info->log("MIaV is shut down.");
}
void MainWindow::createGui()
@@ -302,12 +308,17 @@ static struct timeval starttime;
static int h = 0;
static int m = 0;
static int s = 0;
+static int watchdog = 0;
void MainWindow::taskbar_update()
{
struct timeval time;
if(recording) {
+ watchdog++;
+ if(watchdog % 300 || (camera->getQueueLength() > 1000 && watchdog % 10))
+ info->log("Queue length: %d", camera->getQueueLength());
+
gettimeofday(&time, NULL);
s = time.tv_sec - starttime.tv_sec;
@@ -356,10 +367,12 @@ QLabel *MainWindow::createLabel(char *caption, int width, int height)
void MainWindow::message(char *msg)
{
status->message(msg);
+ info->log("Message: %s", msg);
}
void MainWindow::clear_clicked()
{
+ info->log("Clearing screen.");
if(MessageBox(this,
TXT_ASK_CLEAR_SCREEN_TITLE,
TXT_ASK_CLEAR_SCREEN,
@@ -389,7 +402,7 @@ void MainWindow::cpr_clicked()
ICON_WARNING).exec();
return;
}
-
+ info->log("Activated CPR chooser.");
// Save CPR and name, from the labels.
strcpy(oldname, lbl_name->text().ascii());
@@ -402,8 +415,10 @@ void MainWindow::cpr_clicked()
// Restore old CPR and name, in the labels.
lbl_name->setText(oldname);
lbl_cpr->setText(oldcpr);
+ info->log("Cancelled CPR chooser.");
} else {
// Change CPR camera.
+ info->log("New CPR %s (old %s).", (char*)lbl_cpr->text().ascii(), oldcpr);
camera->setCpr((char*)lbl_cpr->text().ascii());
}
}
@@ -411,6 +426,7 @@ void MainWindow::cpr_clicked()
void MainWindow::rec_clicked()
{
if(!recording) {
+ info->log("Start recording.");
recording = 1;
// Start flashing the edge
rec_edge_counter = 0.0f;
@@ -424,6 +440,7 @@ void MainWindow::rec_clicked()
TYPE_YES_NO_MAYBE_CANCEL,
ICON_QUESTION).exec()) {
case MSG_YES:
+ info->log("Stop recording (Said yes to save).");
recording = 0;
camera->stop(SAVE);
timer->stop();
@@ -432,6 +449,7 @@ void MainWindow::rec_clicked()
break;
case MSG_NO:
+ info->log("Stop recording (Said no to save).");
recording = 0;
camera->stop(DELETE);
timer->stop();
@@ -440,6 +458,7 @@ void MainWindow::rec_clicked()
break;
case MSG_MAYBE:
+ info->log("Stop recording (Said maybe to save).");
recording = 0;
camera->stop(LATER);
timer->stop();
@@ -448,6 +467,7 @@ void MainWindow::rec_clicked()
break;
case MSG_CANCEL:
+ info->log("Didn't stop recording (canceled).");
break;
}
}
@@ -456,6 +476,7 @@ void MainWindow::rec_clicked()
void MainWindow::shoot_clicked()
{
// unsigned char pixels[720*576*3];
+ info->log("Snapshot (%s).", frozen?"frozen":"unfrozen");
QImage image(720, 576, 32);
@@ -481,11 +502,13 @@ void MainWindow::shoot_clicked()
void MainWindow::freeze_clicked()
{
if(frozen) {
+ info->log("Unfreeze.");
camera->unfreeze();
btn_freeze->setPixmap(*pix_freeze);
btn_freeze->setOn(false);
frozen = false;
} else {
+ info->log("Freeze.");
camera->freeze();
btn_freeze->setPixmap(*pix_unfreeze);
btn_freeze->setOn(true);