From e6087e879758abb9b08e4fb14ad2fd329a00573d Mon Sep 17 00:00:00 2001 From: deva Date: Fri, 22 Jul 2005 19:20:27 +0000 Subject: *** empty log message *** --- pixmaps/Makefile.am | 2 + pixmaps/clear.png | Bin 41841 -> 40595 bytes pixmaps/cpr.png | Bin 6170 -> 61742 bytes pixmaps/freeze.png | Bin 30457 -> 28796 bytes pixmaps/record.png | Bin 46429 -> 43407 bytes pixmaps/snapshot.png | Bin 44768 -> 42660 bytes pixmaps/stop.png | Bin 76462 -> 72097 bytes pixmaps/unfreeze.png | Bin 32818 -> 31325 bytes src/mainwindow.cc | 103 +++++++++++++++++++++++++++++---------------------- src/mainwindow.h | 25 ++++++++----- 10 files changed, 77 insertions(+), 53 deletions(-) diff --git a/pixmaps/Makefile.am b/pixmaps/Makefile.am index 200228a..af77512 100644 --- a/pixmaps/Makefile.am +++ b/pixmaps/Makefile.am @@ -1,4 +1,5 @@ EXTRA_DIST = \ + clear.png \ cpr.png \ dummy.png \ freeze.png \ @@ -18,6 +19,7 @@ EXTRA_DIST = \ pixmapdir = $(datadir)/pixmaps pixmap_DATA = \ + clear.png \ cpr.png \ dummy.png \ freeze.png \ diff --git a/pixmaps/clear.png b/pixmaps/clear.png index a43c535..5eb2fea 100644 Binary files a/pixmaps/clear.png and b/pixmaps/clear.png differ diff --git a/pixmaps/cpr.png b/pixmaps/cpr.png index 7850288..8ebdcb8 100644 Binary files a/pixmaps/cpr.png and b/pixmaps/cpr.png differ diff --git a/pixmaps/freeze.png b/pixmaps/freeze.png index 821e03c..a2b5c3b 100644 Binary files a/pixmaps/freeze.png and b/pixmaps/freeze.png differ diff --git a/pixmaps/record.png b/pixmaps/record.png index 5df7c40..4d4a237 100644 Binary files a/pixmaps/record.png and b/pixmaps/record.png differ diff --git a/pixmaps/snapshot.png b/pixmaps/snapshot.png index 9ef8061..3b90b15 100644 Binary files a/pixmaps/snapshot.png and b/pixmaps/snapshot.png differ diff --git a/pixmaps/stop.png b/pixmaps/stop.png index 1968de1..bdd1ab6 100644 Binary files a/pixmaps/stop.png and b/pixmaps/stop.png differ diff --git a/pixmaps/unfreeze.png b/pixmaps/unfreeze.png index 291395d..98fc67e 100644 Binary files a/pixmaps/unfreeze.png and b/pixmaps/unfreeze.png differ 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 //"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; -- cgit v1.2.3