summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordeva <deva>2005-07-22 19:20:27 +0000
committerdeva <deva>2005-07-22 19:20:27 +0000
commite6087e879758abb9b08e4fb14ad2fd329a00573d (patch)
treec3e7e8fae0feb7c5de90c3d6aea14ef20352a6c4 /src
parent7b6ec28675bf983a010fd3b0213360e3e3e2fbe6 (diff)
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r--src/mainwindow.cc103
-rw-r--r--src/mainwindow.h25
2 files changed, 75 insertions, 53 deletions
diff --git a/src/mainwindow.cc b/src/mainwindow.cc
index 3b8ca74..43268e1 100644
--- a/src/mainwindow.cc
+++ b/src/mainwindow.cc
@@ -31,6 +31,9 @@
/*
* $Log$
+ * Revision 1.35 2005/07/22 19:20:28 deva
+ * *** empty log message ***
+ *
* Revision 1.34 2005/06/19 11:44:14 deva
* Cleaned up a log of logging.
* Fixed server queue (shouldn't happen).
@@ -122,7 +125,6 @@
#include <config.h>
//"miav-grab.h"
-
//#define WITH_DV
MainWindow::MainWindow(QApplication *qApp, QWidget* parent, const char* name )
: QWidget( parent, name, WStyle_Customize | WStyle_NoBorder )
@@ -142,33 +144,17 @@ MainWindow::MainWindow(QApplication *qApp, QWidget* parent, const char* name )
move(0,0);
resize(resolution_w, resolution_h);
- // Load images
- pix_record = new QPixmap();
- pix_record->load( PIXMAP_RECORD );
-
- pix_stop = new QPixmap();
- pix_stop->load( PIXMAP_STOP );
-
- pix_freeze = new QPixmap();
- pix_freeze->load( PIXMAP_FREEZE );
-
- pix_unfreeze = new QPixmap();
- pix_unfreeze->load( PIXMAP_UNFREEZE );
-
- pix_cpr = new QPixmap();
- pix_cpr->load( PIXMAP_CPR );
-
- pix_clear = new QPixmap();
- pix_clear->load( PIXMAP_CLEAR );
-
- pix_snapshot = new QPixmap();
- pix_snapshot->load( PIXMAP_SNAPSHOT );
-
- pix_logo = new QPixmap();
- pix_logo->load( PIXMAP_LOGO_SMALL );
-
- pix_dummy = new QImage();
- pix_dummy->load( PIXMAP_DUMMY );
+ // Load icons
+ img_record = loadButtonIcon( PIXMAP_RECORD );
+ img_stop = loadButtonIcon( PIXMAP_STOP );
+ img_freeze = loadButtonIcon( PIXMAP_FREEZE );
+ img_unfreeze = loadButtonIcon( PIXMAP_UNFREEZE );
+ img_cpr = loadButtonIcon( PIXMAP_CPR );
+ img_clear = loadButtonIcon( PIXMAP_CLEAR );
+ img_snapshot = loadButtonIcon( PIXMAP_SNAPSHOT );
+ // img_logo = loadButtonIcon( PIXMAP_LOGO_SMALL );
+
+ img_dummy = loadImage( PIXMAP_DUMMY );
timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), SLOT(redraw_edge()));
@@ -205,6 +191,35 @@ MainWindow::~MainWindow()
info->log("MIaV is shut down.");
}
+QImage *MainWindow::loadButtonIcon( char *name )
+{
+
+ QImage scaled;
+ QImage *img;
+
+ img = new QImage();
+ img->load( name );
+
+ int h = (int)(3.0 * unit);
+ int w = (int)((float)img->width() / (float)(img->height() / (float)h));
+
+ scaled = img->smoothScale(w, h);
+ delete img;
+ img = new QImage(scaled);
+
+ return img;
+}
+
+QImage *MainWindow::loadImage( char *name )
+{
+ QImage *img;
+
+ img = new QImage();
+ img->load( name );
+
+ return img;
+}
+
void MainWindow::createGui()
{
// Layout widgets
@@ -250,7 +265,7 @@ void MainWindow::createGui()
img_recedge->setFixedSize(video_width + 20, video_height + 20);
img_live = new VideoWidget(img_recedge);
- // img_live->setErasePixmap( *pix_dummy );
+ // img_live->setErasePixmap( *img_dummy );
img_live->setFixedSize(video_width, video_height);
img_live->move(10,10);
g1->addMultiCellWidget ( img_recedge, 0, 0, 0, 2, Qt::AlignHCenter);
@@ -261,7 +276,7 @@ void MainWindow::createGui()
btn_cpr = createButton("", 8, 3);
btn_cpr->setFocus();
- btn_cpr->setPixmap(*pix_cpr);
+ btn_cpr->setPixmap(*img_cpr);
QObject::connect( btn_cpr, SIGNAL(clicked()), this, SLOT(cpr_clicked()) );
// Will also be connected in the MGUI code
g1->addWidget(btn_cpr, 1, 2);
@@ -270,29 +285,29 @@ void MainWindow::createGui()
g1->addMultiCellWidget ( lbl_name, 2, 2, 0, 2);
/*
btn_clear = createButton("Clear", 8, 3);
- // btn_clear->setPixmap(*pix_clear);
+ // btn_clear->setPixmap(*img_clear);
QObject::connect( btn_clear, SIGNAL(clicked()), this, SLOT(clear_clicked()) );
// Will also be connected in the MGUI code
g1->addWidget(btn_clear, 1, 2);
*/
// Rec + Shot + Freeze buttons
btn_rec = createButton("", 8, 3);
- btn_rec->setPixmap(*pix_record);
+ btn_rec->setPixmap(*img_record);
QObject::connect( btn_rec, SIGNAL(clicked()), this, SLOT(rec_clicked()) );
g1->addWidget(btn_rec, 3, 0);
btn_shoot = createButton("", 8, 3);
- btn_shoot->setPixmap(*pix_snapshot);
+ btn_shoot->setPixmap(*img_snapshot);
QObject::connect( btn_shoot, SIGNAL(clicked()), this, SLOT(shoot_clicked()) );
g1->addWidget(btn_shoot, 3, 1);
btn_freeze = createButton("", 8, 3);
- btn_freeze->setPixmap(*pix_freeze);
+ btn_freeze->setPixmap(*img_freeze);
QObject::connect( btn_freeze, SIGNAL(clicked()), this, SLOT(freeze_clicked()) );
g1->addWidget(btn_freeze, 3, 2);
// History widgets
- QImage dummy_resized = pix_dummy->smoothScale(240, 192);
+ QImage dummy_resized = img_dummy->smoothScale(240, 192);
for(int i = 0; i < NUM_HISTORY; i++) {
img_history[i] = new QLabel(gb);
@@ -307,7 +322,7 @@ void MainWindow::createGui()
btn_clear->setFont( QFont( "Arial", (int)(unit * 3 / 2), QFont::Bold ) );
btn_clear->setFixedHeight((int)(unit * 3));
- // btn_clear->setPixmap(*pix_clear);
+ btn_clear->setPixmap(*img_clear);
QObject::connect( btn_clear, SIGNAL(clicked()), this, SLOT(clear_clicked()) );
// Will also be connected in the MGUI code
@@ -402,7 +417,7 @@ void MainWindow::clear()
{
info->log("Clearing screen.");
// History widgets
- QImage dummy_resized = pix_dummy->smoothScale(240, 192);
+ QImage dummy_resized = img_dummy->smoothScale(240, 192);
for(int i = 0; i < NUM_HISTORY; i++) {
img_history[i]->setPixmap(dummy_resized);
@@ -473,7 +488,7 @@ void MainWindow::rec_clicked()
// Start flashing the edge
rec_edge_counter = 0.0f;
timer->start(100);
- btn_rec->setPixmap(*pix_stop);
+ btn_rec->setPixmap(*img_stop);
camera->start();
} else {
switch(MessageBox(this,
@@ -487,7 +502,7 @@ void MainWindow::rec_clicked()
camera->stop(SAVE);
timer->stop();
img_recedge->setBackgroundColor(QColor(160,160,160));
- btn_rec->setPixmap(*pix_record);
+ btn_rec->setPixmap(*img_record);
break;
case MSG_NO:
@@ -496,7 +511,7 @@ void MainWindow::rec_clicked()
camera->stop(DELETE);
timer->stop();
img_recedge->setBackgroundColor(QColor(160,160,160));
- btn_rec->setPixmap(*pix_record);
+ btn_rec->setPixmap(*img_record);
break;
case MSG_MAYBE:
@@ -505,7 +520,7 @@ void MainWindow::rec_clicked()
camera->stop(LATER);
timer->stop();
img_recedge->setBackgroundColor(QColor(160,160,160));
- btn_rec->setPixmap(*pix_record);
+ btn_rec->setPixmap(*img_record);
break;
case MSG_CANCEL:
@@ -535,7 +550,7 @@ void MainWindow::shoot_clicked()
if(frozen) {
camera->unfreeze();
- btn_freeze->setPixmap(*pix_freeze);
+ btn_freeze->setPixmap(*img_freeze);
btn_freeze->setOn(false);
frozen = false;
}
@@ -546,13 +561,13 @@ void MainWindow::freeze_clicked()
if(frozen) {
info->log("Unfreeze.");
camera->unfreeze();
- btn_freeze->setPixmap(*pix_freeze);
+ btn_freeze->setPixmap(*img_freeze);
btn_freeze->setOn(false);
frozen = false;
} else {
info->log("Freeze.");
camera->freeze();
- btn_freeze->setPixmap(*pix_unfreeze);
+ btn_freeze->setPixmap(*img_unfreeze);
btn_freeze->setOn(true);
frozen = true;
}
diff --git a/src/mainwindow.h b/src/mainwindow.h
index d4c4c5b..1a2b76d 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -31,6 +31,9 @@
/*
* $Log$
+ * Revision 1.17 2005/07/22 19:20:28 deva
+ * *** empty log message ***
+ *
* Revision 1.16 2005/06/16 21:28:57 deva
* Rewrote thread object
* Fixed bug in mov_encoder (pushed read_sem too many times, whihc lead to
@@ -152,16 +155,20 @@ private:
Camera *camera;
Info *cam_info;
- QPixmap *pix_unfreeze;
- QPixmap *pix_freeze;
- QPixmap *pix_snapshot;
- QPixmap *pix_cpr;
- QPixmap *pix_clear;
- QPixmap *pix_record;
- QPixmap *pix_stop;
- QPixmap *pix_logo;
+ // Image loading routines.
+ QImage *loadButtonIcon( char *name );
+ QImage *loadImage( char *name );
+
+ QImage *img_unfreeze;
+ QImage *img_freeze;
+ QImage *img_snapshot;
+ QImage *img_cpr;
+ QImage *img_clear;
+ QImage *img_record;
+ QImage *img_stop;
+ QImage *img_logo;
- QImage *pix_dummy;
+ QImage *img_dummy;
QLabel *lbl_version;
QLabel *lbl_cpr;