summaryrefslogtreecommitdiff
path: root/client/mainwindow.cc
diff options
context:
space:
mode:
authordeva <deva>2006-03-07 10:37:59 +0000
committerdeva <deva>2006-03-07 10:37:59 +0000
commit1390ddfe6afe41dba141f8170f9b277573ebe8cd (patch)
treefd6861f3eab3a4721f2445540279a8223d7cd1a3 /client/mainwindow.cc
parent19ade36987f86c9b4cd4c5ec3fc6c499205c61ec (diff)
*** empty log message ***
Diffstat (limited to 'client/mainwindow.cc')
-rw-r--r--client/mainwindow.cc76
1 files changed, 41 insertions, 35 deletions
diff --git a/client/mainwindow.cc b/client/mainwindow.cc
index e813d00..8efcad0 100644
--- a/client/mainwindow.cc
+++ b/client/mainwindow.cc
@@ -42,6 +42,8 @@
#include <math.h>
+#include "info.h"
+
//#include "mgui_alert.h"
//#include "mgui_datasocket.h"
@@ -54,9 +56,9 @@
MainWindow::MainWindow(QWidget* parent )
: QWidget( parent, Qt::FramelessWindowHint )
{
- info = new InfoGui(qApp, this, config);
+ // info = new InfoGui(qApp, this, config);
- info->log("Starting MIaV v. %s.", VERSION);
+ gInfo::info->info("Starting MIaV v. %s.", VERSION);
video_width = config->readInt("video_width");
video_height = config->readInt("video_height");
@@ -90,15 +92,16 @@ MainWindow::MainWindow(QWidget* parent )
rec_edge_counter = 0.0f;
// This must be defined before the gui i created (img_live uses it as parameter)
- camera = new Camera(info);
+ // camera = new Camera(info);
createGui();
show();
+ /*
camera->connect(config->readString("server_addr")->c_str(),
config->readInt("server_port"),
img_live->width(), img_live->height());
-
+ */
// Make sure this is created *after* the camera object!
taskbartimer = new QTimer(this);
connect(taskbartimer, SIGNAL(timeout()), SLOT(taskbar_update()));
@@ -108,7 +111,7 @@ MainWindow::MainWindow(QWidget* parent )
frozen = false;
muted = false;
- info->log("MIaV is ready.");
+ gInfo::info->log("MIaV is ready.");
// Open the CPR Dialog
cpr_clicked();
@@ -117,13 +120,13 @@ MainWindow::MainWindow(QWidget* parent )
MainWindow::~MainWindow()
{
- info->log("MIaV is shutting down.");
+ gInfo::info->log("MIaV is shutting down.");
delete img_history;
- delete camera;
+ // delete camera;
delete btn_cpr;
- info->log("MIaV is shut down.");
+ gInfo::info->log("MIaV is shut down.");
}
QImage *MainWindow::loadButtonIcon( char *name, int height )
@@ -215,7 +218,7 @@ void MainWindow::createGui()
img_recedge->setPalette(palette);
img_recedge->setFixedSize(output_width, output_height);
- img_live = new VideoWidget(img_recedge, camera);
+ img_live = new VideoWidget(img_recedge);
img_live->setFixedSize(output_width - 20, output_height - 20);
img_live->move(10,10);
g1->addWidget( img_recedge, 0, 0, 1, 3, Qt::AlignHCenter);
@@ -362,9 +365,10 @@ void MainWindow::taskbar_update()
watchdog++;
if(recording) {
+ /*
if((watchdog % 300 == 0) || ((camera->getQueueLength() > 1000) && (watchdog % 50 == 0)))
info->log("Queue length: %d (active)", camera->getQueueLength());
-
+ */
gettimeofday(&time, NULL);
s = time.tv_sec - starttime.tv_sec;
@@ -374,13 +378,15 @@ void MainWindow::taskbar_update()
m = s / 60;
s -= m * 60;
} else {
+ /*
if((camera->getQueueLength() > 0) && (watchdog % 300 == 0))
info->log("Queue length: %d (passive)", camera->getQueueLength());
+ */
gettimeofday(&starttime, NULL);
}
char msg[256];
- int l = camera->getQueueLength();
+ int l = 0;//camera->getQueueLength();
sprintf(msg, TXT_TIME " %.02d:%.02d:%.02d " TXT_QUEUELENGTH " %d", h, m, s, l);
lbl_recordtime->setText(msg);
}
@@ -402,12 +408,12 @@ void MainWindow::redraw_edge()
void MainWindow::message(char *msg)
{
status->showMessage(msg);
- info->log("Message: %s", msg);
+ gInfo::info->log("Message: %s", msg);
}
void MainWindow::clear()
{
- info->log("Clearing screen.");
+ gInfo::info->log("Clearing screen.");
// History widgets
@@ -451,7 +457,7 @@ void MainWindow::cpr_clicked()
ICON_WARNING).exec();
return;
}
- info->log("Activated CPR chooser.");
+ gInfo::info->log("Activated CPR chooser.");
// Save CPR and name, from the labels.
strcpy(oldname, lbl_name->text().toStdString().c_str());
@@ -460,22 +466,22 @@ void MainWindow::cpr_clicked()
clear();
// Create and call the CPRQueryDialog.
- CPRQueryDialog dlg(info, lbl_cpr, lbl_name, this, TXT_CPRDLG_TITLE, status);
+ CPRQueryDialog dlg(lbl_cpr, lbl_name, this, TXT_CPRDLG_TITLE, status);
if(dlg.exec() == 0) {
// Restore old CPR and name, in the labels.
lbl_name->setText(oldname);
lbl_cpr->setText(oldcpr);
- info->log("Cancelled CPR chooser.");
+ gInfo::info->log("Cancelled CPR chooser.");
} else {
// Change CPR camera.
- info->log("New CPR %s (old %s).", (char*)lbl_cpr->text().toStdString().c_str(), oldcpr);
+ gInfo::info->log("New CPR %s (old %s).", (char*)lbl_cpr->text().toStdString().c_str(), oldcpr);
strcpy(oldname, lbl_name->text().toStdString().c_str());
strcpy(oldcpr, lbl_cpr->text().toStdString().c_str());
clear();
lbl_name->setText(oldname);
lbl_cpr->setText(oldcpr);
- camera->setCpr((char*)lbl_cpr->text().toStdString().c_str(), (char*)lbl_name->text().toStdString().c_str());
+ // camera->setCpr((char*)lbl_cpr->text().toStdString().c_str(), (char*)lbl_name->text().toStdString().c_str());
}
}
@@ -485,14 +491,14 @@ void MainWindow::rec_clicked()
QPixmap pixmap;
if(!recording) {
- info->log("Start recording.");
+ gInfo::info->log("Start recording.");
recording = 1;
// Start flashing the edge
rec_edge_counter = 0.0f;
timer->start(100);
pixmap.fromImage(*img_stop);
btn_rec->setIcon(pixmap);
- camera->start();
+ // camera->start();
} else {
switch(MessageBox(this,
TXT_ASK_SAVE_TITLE,
@@ -500,9 +506,9 @@ void MainWindow::rec_clicked()
TYPE_YES_NO_MAYBE_CANCEL,
ICON_QUESTION).exec()) {
case MSG_YES:
- info->log("Stop recording (Said yes to save).");
+ gInfo::info->log("Stop recording (Said yes to save).");
recording = 0;
- camera->stop(SAVE);
+ // camera->stop(SAVE);
timer->stop();
palette.setColor(img_recedge->backgroundRole(), QColor(160,160,160));
img_recedge->setPalette(palette);
@@ -511,9 +517,9 @@ void MainWindow::rec_clicked()
break;
case MSG_NO:
- info->log("Stop recording (Said no to save).");
+ gInfo::info->log("Stop recording (Said no to save).");
recording = 0;
- camera->stop(DELETE);
+ // camera->stop(DELETE);
timer->stop();
palette.setColor(img_recedge->backgroundRole(), QColor(160,160,160));
img_recedge->setPalette(palette);
@@ -522,9 +528,9 @@ void MainWindow::rec_clicked()
break;
case MSG_MAYBE:
- info->log("Stop recording (Said maybe to save).");
+ gInfo::info->log("Stop recording (Said maybe to save).");
recording = 0;
- camera->stop(LATER);
+ // camera->stop(LATER);
timer->stop();
palette.setColor(img_recedge->backgroundRole(), QColor(160,160,160));
img_recedge->setPalette(palette);
@@ -533,7 +539,7 @@ void MainWindow::rec_clicked()
break;
case MSG_CANCEL:
- info->log("Didn't stop recording (canceled).");
+ gInfo::info->log("Didn't stop recording (canceled).");
break;
}
}
@@ -542,11 +548,11 @@ void MainWindow::rec_clicked()
void MainWindow::shoot_clicked()
{
// unsigned char pixels[720*576*3];
- info->log("Snapshot (%s).", frozen?"frozen":"unfrozen");
+ gInfo::info->log("Snapshot (%s).", frozen?"frozen":"unfrozen");
QImage screenshot(720, 576, QImage::Format_RGB32);
- camera->snapshot(screenshot.bits());
+ // camera->snapshot(screenshot.bits());
QImage *image;
for(int cnt = (num_history-1); cnt > 0; cnt--) {
@@ -556,7 +562,7 @@ void MainWindow::shoot_clicked()
img_history[0]->set_image(&screenshot);
if(frozen) {
- camera->unfreeze();
+ // camera->unfreeze();
QPixmap pixmap;
pixmap.fromImage(*img_freeze);
@@ -570,8 +576,8 @@ void MainWindow::shoot_clicked()
void MainWindow::freeze_clicked()
{
if(frozen) {
- info->log("Unfreeze.");
- camera->unfreeze();
+ gInfo::info->log("Unfreeze.");
+ // camera->unfreeze();
QPixmap pixmap;
pixmap.fromImage(*img_freeze);
@@ -580,8 +586,8 @@ void MainWindow::freeze_clicked()
btn_freeze->setDown(false);
frozen = false;
} else {
- info->log("Freeze.");
- camera->freeze();
+ gInfo::info->log("Freeze.");
+ // camera->freeze();
QPixmap pixmap;
pixmap.fromImage(*img_freeze);
@@ -605,7 +611,7 @@ void MainWindow::mute_clicked()
btn_mute->setIcon(pixmap);
}
- camera->setMute(muted);
+ // camera->setMute(muted);
}
#endif /*USE_GUI*/