diff options
author | deva <deva> | 2005-04-10 20:38:45 +0000 |
---|---|---|
committer | deva <deva> | 2005-04-10 20:38:45 +0000 |
commit | b03406e31c5e5d4f8a4e065b03e68330885a3832 (patch) | |
tree | 0d636129516814509df07afd918daef086be3133 /src/mainwindow.cc | |
parent | 55a7afdedc7cee2df9012f600dd51aff92ad1af3 (diff) |
lots of styff!
Diffstat (limited to 'src/mainwindow.cc')
-rw-r--r-- | src/mainwindow.cc | 75 |
1 files changed, 57 insertions, 18 deletions
diff --git a/src/mainwindow.cc b/src/mainwindow.cc index 8bfc53e..85b04cd 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -52,6 +52,9 @@ MainWindow::MainWindow( QWidget* parent, const char* name ) { error = new Error(); MiavConfig cfg("miav.conf", error); + video_width = cfg.readInt("video_width"); + video_height = cfg.readInt("video_height"); + int resolution_w = cfg.readInt("pixel_width"); int resolution_h = cfg.readInt("pixel_height"); while(error->hasError()) { @@ -65,16 +68,6 @@ MainWindow::MainWindow( QWidget* parent, const char* name ) resize(resolution_w, resolution_h); // Load images -/* - QPainter *paint = new QPainter(); - QPicture *pic = new QPicture(); - pic->load(fname, "svg"); - paint->begin(this); - paint->setWindow(pic->boundingRect()); - paint->drawPicture(0, 0, *pic); - paint->end(); - */ - pix_record = new QPixmap(); pix_record->load( PIXMAP_RECORD ); @@ -99,6 +92,10 @@ MainWindow::MainWindow( QWidget* parent, const char* name ) pix_logo = new QPixmap(); pix_logo->load( PIXMAP_LOGO_SMALL ); + timer = new QTimer(this); + connect(timer, SIGNAL(timeout()), SLOT(redraw_edge())); + rec_edge_counter = 0.0f; + createGui(); show(); @@ -158,11 +155,11 @@ void MainWindow::createGui() img_recedge = new QLabel(this); img_recedge->setBackgroundColor(QColor(160,160,160)); - img_recedge->setFixedSize(740,596); + img_recedge->setFixedSize(video_width + 20, video_height + 20); img_live = new VideoWidget(img_recedge); // img_live->setErasePixmap( *pix_dummy ); - img_live->setFixedSize(720,576); + img_live->setFixedSize(video_width, video_height); img_live->move(10,10); g1->addMultiCellWidget ( img_recedge, 0, 0, 0, 2, Qt::AlignHCenter); @@ -216,6 +213,17 @@ void MainWindow::createGui() status->message( TXT_READY ); } +#define GREY 160 +#define SPEED 0.1f +void MainWindow::redraw_edge() +{ + rec_edge_counter += SPEED; + float val = abs(sin(rec_edge_counter)); + img_recedge->setBackgroundColor(QColor((int) ((255 - GREY) * val + GREY), + (int) (GREY - (GREY * val)), + (int) (GREY - (GREY * val)))); +} + QPushButton *MainWindow::createButton(char *caption, int width, int height) { QPushButton *btn = new QPushButton(caption, this); @@ -264,16 +272,47 @@ void MainWindow::checkErrors() void MainWindow::rec_clicked() { - recording = 1 - recording; - if(recording) { - img_recedge->setBackgroundColor(red); + if(!recording) { + recording = 1; + // Start flashing the edge + rec_edge_counter = 0.0f; + timer->start(200); btn_rec->setPixmap(*pix_stop); camera->start(); checkErrors(); } else { - img_recedge->setBackgroundColor(QColor(160,160,160)); - btn_rec->setPixmap(*pix_record); - camera->stop(); + switch(MessageBox(this, + TXT_ASK_SAVE_TITLE, + TXT_ASK_SAVE, + TYPE_YES_NO_MAYBE_CANCEL, + ICON_QUESTION).exec()) { + case MSG_YES: + recording = 0; + camera->stop(SAVE); + timer->stop(); + img_recedge->setBackgroundColor(QColor(160,160,160)); + btn_rec->setPixmap(*pix_record); + break; + + case MSG_NO: + recording = 0; + camera->stop(DELETE); + timer->stop(); + img_recedge->setBackgroundColor(QColor(160,160,160)); + btn_rec->setPixmap(*pix_record); + break; + + case MSG_MAYBE: + recording = 0; + camera->stop(LATER); + timer->stop(); + img_recedge->setBackgroundColor(QColor(160,160,160)); + btn_rec->setPixmap(*pix_record); + break; + + case MSG_CANCEL: + break; + } checkErrors(); } } |