From 65631ae8017a816145b8e0120bb319bcc7756b7b Mon Sep 17 00:00:00 2001 From: deva Date: Sat, 23 Jul 2005 09:09:24 +0000 Subject: *** empty log message *** --- src/mainwindow.cc | 56 ++++++++++++++++++++++++++++++++++--------------------- src/mainwindow.h | 12 +++++++++++- 2 files changed, 46 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/mainwindow.cc b/src/mainwindow.cc index 43268e1..fa2287a 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -31,6 +31,9 @@ /* * $Log$ + * Revision 1.36 2005/07/23 09:09:24 deva + * *** empty log message *** + * * Revision 1.35 2005/07/22 19:20:28 deva * *** empty log message *** * @@ -260,13 +263,23 @@ void MainWindow::createGui() gb->setFlat(true); g0->addWidget(gb, 0, 1); + int output_width = this->width() - + (int)(BUTTON_WIDTH * unit) - + (gb->insideMargin() * 2) - + g1->margin() * 2 - + g0->margin() * 2; + + int output_height = this->height() - + (int)(3 * BUTTON_HEIGHT * unit) - + g1->margin() * 5 - + g0->margin() * 3; + img_recedge = new QLabel(this); img_recedge->setBackgroundColor(QColor(160,160,160)); - img_recedge->setFixedSize(video_width + 20, video_height + 20); + img_recedge->setFixedSize(output_width, output_height); img_live = new VideoWidget(img_recedge); - // img_live->setErasePixmap( *img_dummy ); - img_live->setFixedSize(video_width, video_height); + img_live->setFixedSize(output_width - 20, output_height - 20); img_live->move(10,10); g1->addMultiCellWidget ( img_recedge, 0, 0, 0, 2, Qt::AlignHCenter); @@ -274,7 +287,7 @@ void MainWindow::createGui() lbl_cpr = createLabel("", 18, 3); g1->addMultiCellWidget ( lbl_cpr, 1, 1, 0, 1); - btn_cpr = createButton("", 8, 3); + btn_cpr = createButton(""); btn_cpr->setFocus(); btn_cpr->setPixmap(*img_cpr); QObject::connect( btn_cpr, SIGNAL(clicked()), this, SLOT(cpr_clicked()) ); @@ -284,48 +297,44 @@ void MainWindow::createGui() lbl_name = createLabel("", 18, 2); g1->addMultiCellWidget ( lbl_name, 2, 2, 0, 2); /* - btn_clear = createButton("Clear", 8, 3); - // btn_clear->setPixmap(*img_clear); + btn_clear = createButton(""); + 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 = createButton(""); 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 = createButton(""); 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 = createButton(""); 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 = img_dummy->smoothScale(240, 192); + int w = (int)(BUTTON_WIDTH * unit); + int h = (int)(192.0f / (240.0f / ((float)BUTTON_WIDTH * unit))); + + QImage dummy_resized = img_dummy->smoothScale(w, h); for(int i = 0; i < NUM_HISTORY; i++) { img_history[i] = new QLabel(gb); 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]); + img_history[i]->setFixedSize(w, h); } - // FIXME: Create button like the other buttons - btn_clear = new QPushButton("Clear", gb); - btn_clear->setFont( QFont( "Arial", (int)(unit * 3 / 2), QFont::Bold ) ); - btn_clear->setFixedHeight((int)(unit * 3)); - + // Clear button + btn_clear = createButton("", gb); btn_clear->setPixmap(*img_clear); QObject::connect( btn_clear, SIGNAL(clicked()), this, SLOT(clear_clicked()) ); - // Will also be connected in the MGUI code - // Statusbar status = new QStatusBar(this); @@ -393,7 +402,12 @@ void MainWindow::redraw_edge() QPushButton *MainWindow::createButton(char *caption, int width, int height) { - QPushButton *btn = new QPushButton(caption, this); + return createButton(caption, this, width, height); +} + +QPushButton *MainWindow::createButton(char *caption, QWidget *parent, int width, int height) +{ + QPushButton *btn = new QPushButton(caption, parent); btn->setFont( QFont( "Arial", (int)(unit * height / 2), QFont::Bold ) ); btn->setFixedHeight((int)(unit * height)); return btn; diff --git a/src/mainwindow.h b/src/mainwindow.h index 1a2b76d..5a5f99c 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -31,6 +31,9 @@ /* * $Log$ + * Revision 1.18 2005/07/23 09:09:24 deva + * *** empty log message *** + * * Revision 1.17 2005/07/22 19:20:28 deva * *** empty log message *** * @@ -93,7 +96,13 @@ using namespace std; #include "info_gui.h" +/** + * First some GUI specs + */ #define NUM_HISTORY 3 +// Button sizes in cm (metric) +#define BUTTON_WIDTH 12 +#define BUTTON_HEIGHT 3 /** * Textstrings @@ -204,7 +213,8 @@ private: int video_width; int video_height; - QPushButton *createButton(char *caption, int width, int height); + QPushButton *createButton(char *caption, int width = BUTTON_WIDTH, int height = BUTTON_HEIGHT); + QPushButton *createButton(char *caption, QWidget *parent, int width = BUTTON_WIDTH, int height = BUTTON_HEIGHT); QLabel *createLabel(char *caption, int width, int height); }; -- cgit v1.2.3