From 64efd74ecfa761c83b70ec2374bf448b6e42e254 Mon Sep 17 00:00:00 2001 From: deva Date: Thu, 2 Jun 2005 20:45:01 +0000 Subject: Added clear button Optimized the frame handling a little (very little!). --- src/mainwindow.cc | 43 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) (limited to 'src/mainwindow.cc') diff --git a/src/mainwindow.cc b/src/mainwindow.cc index 4acf391..c127585 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -31,6 +31,11 @@ /* * $Log$ + * Revision 1.28 2005/06/02 20:45:01 deva + * + * Added clear button + * Optimized the frame handling a little (very little!). + * * Revision 1.27 2005/05/23 19:30:36 deva * Made some cleanup in the status bar. * @@ -133,15 +138,18 @@ MainWindow::MainWindow(QApplication *qApp, QWidget* parent, const char* name ) 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_dummy = new QPixmap(); - pix_dummy->load( PIXMAP_DUMMY ); - pix_logo = new QPixmap(); pix_logo->load( PIXMAP_LOGO_SMALL ); + pix_dummy = new QImage(); + pix_dummy->load( PIXMAP_DUMMY ); + timer = new QTimer(this); connect(timer, SIGNAL(timeout()), SLOT(redraw_edge())); rec_edge_counter = 0.0f; @@ -231,11 +239,17 @@ void MainWindow::createGui() btn_cpr->setPixmap(*pix_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); + g1->addWidget(btn_cpr, 1, 1); lbl_name = createLabel("", 18, 2); g1->addMultiCellWidget ( lbl_name, 2, 2, 0, 2); + btn_clear = createButton("Clear", 8, 3); + // btn_clear->setPixmap(*pix_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); @@ -253,9 +267,11 @@ void MainWindow::createGui() g1->addWidget(btn_freeze, 3, 2); // History widgets + QImage dummy_resized = pix_dummy->smoothScale(240, 192); + for(int i = 0; i < NUM_HISTORY; i++) { img_history[i] = new QLabel(gb); - img_history[i]->setPixmap(*pix_dummy); + img_history[i]->setPixmap(dummy_resized); img_history[i]->setFixedSize(240,192); // g2->addWidget(img_history[i], i, 0, Qt::AlignHCenter & Qt::AlignVCenter); // g2->addWidget(img_history[i]); @@ -339,6 +355,23 @@ void MainWindow::message(char *msg) status->message(msg); } +void MainWindow::clear_clicked() +{ + if(MessageBox(this, + TXT_ASK_CLEAR_SCREEN_TITLE, + TXT_ASK_CLEAR_SCREEN, + TYPE_YES_NO, + ICON_QUESTION).exec() == MSG_YES) { + + // History widgets + QImage dummy_resized = pix_dummy->smoothScale(240, 192); + + for(int i = 0; i < NUM_HISTORY; i++) { + img_history[i]->setPixmap(dummy_resized); + } + } +} + void MainWindow::cpr_clicked() { char oldcpr[256]; -- cgit v1.2.3