From 856ab0ece3e73e2b520d55aeab9adfbccdb6aa93 Mon Sep 17 00:00:00 2001 From: deva Date: Mon, 16 May 2005 16:00:56 +0000 Subject: Lots of stuff! --- src/mainwindow.cc | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'src/mainwindow.cc') diff --git a/src/mainwindow.cc b/src/mainwindow.cc index 577058f..496817b 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -31,6 +31,10 @@ /* * $Log$ + * Revision 1.26 2005/05/16 16:00:56 deva + * + * Lots of stuff! + * * Revision 1.25 2005/05/03 09:22:12 deva * Implemented the gui part of the info object. * @@ -146,6 +150,11 @@ MainWindow::MainWindow(QApplication *qApp, QWidget* parent, const char* name ) camera->connect(config->readString("server_addr")->c_str(), config->readInt("server_port")); + // Make sure this is created *after* the camera object! + taskbartimer = new QTimer(this); + connect(taskbartimer, SIGNAL(timeout()), SLOT(taskbar_update())); + taskbartimer->start(200); + recording = false; frozen = false; @@ -261,6 +270,36 @@ void MainWindow::createGui() status->message( TXT_READY ); } + +#include +static struct timeval starttime; +static int h = 0; +static int m = 0; +static int s = 0; + +void MainWindow::taskbar_update() +{ + struct timeval time; + + if(recording) { + gettimeofday(&time, NULL); + + s = time.tv_sec - starttime.tv_sec; + + h = s / (60 * 60); + s -= h * (60 *60); + m = s / 60; + s -= m * 60; + } else { + gettimeofday(&starttime, NULL); + } + + char msg[256]; + int l = camera->getQueueLength(); + sprintf(msg, "Recording time: %d:%d:%d - Queue length: %d", h, m, s, l); + message(msg); +} + #define GREY 160 #define SPEED 0.07f void MainWindow::redraw_edge() -- cgit v1.2.3