diff options
| -rw-r--r-- | pixmaps/Makefile.am | 2 | ||||
| -rw-r--r-- | pixmaps/clear.png | bin | 41841 -> 40595 bytes | |||
| -rw-r--r-- | pixmaps/cpr.png | bin | 6170 -> 61742 bytes | |||
| -rw-r--r-- | pixmaps/freeze.png | bin | 30457 -> 28796 bytes | |||
| -rw-r--r-- | pixmaps/record.png | bin | 46429 -> 43407 bytes | |||
| -rw-r--r-- | pixmaps/snapshot.png | bin | 44768 -> 42660 bytes | |||
| -rw-r--r-- | pixmaps/stop.png | bin | 76462 -> 72097 bytes | |||
| -rw-r--r-- | pixmaps/unfreeze.png | bin | 32818 -> 31325 bytes | |||
| -rw-r--r-- | src/mainwindow.cc | 103 | ||||
| -rw-r--r-- | 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.pngBinary files differ index a43c535..5eb2fea 100644 --- a/pixmaps/clear.png +++ b/pixmaps/clear.png diff --git a/pixmaps/cpr.png b/pixmaps/cpr.pngBinary files differ index 7850288..8ebdcb8 100644 --- a/pixmaps/cpr.png +++ b/pixmaps/cpr.png diff --git a/pixmaps/freeze.png b/pixmaps/freeze.pngBinary files differ index 821e03c..a2b5c3b 100644 --- a/pixmaps/freeze.png +++ b/pixmaps/freeze.png diff --git a/pixmaps/record.png b/pixmaps/record.pngBinary files differ index 5df7c40..4d4a237 100644 --- a/pixmaps/record.png +++ b/pixmaps/record.png diff --git a/pixmaps/snapshot.png b/pixmaps/snapshot.pngBinary files differ index 9ef8061..3b90b15 100644 --- a/pixmaps/snapshot.png +++ b/pixmaps/snapshot.png diff --git a/pixmaps/stop.png b/pixmaps/stop.pngBinary files differ index 1968de1..bdd1ab6 100644 --- a/pixmaps/stop.png +++ b/pixmaps/stop.png diff --git a/pixmaps/unfreeze.png b/pixmaps/unfreeze.pngBinary files differ index 291395d..98fc67e 100644 --- a/pixmaps/unfreeze.png +++ b/pixmaps/unfreeze.png 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; | 
