summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mainwindow.cc34
-rw-r--r--src/mainwindow.h8
2 files changed, 23 insertions, 19 deletions
diff --git a/src/mainwindow.cc b/src/mainwindow.cc
index fa2287a..bef8514 100644
--- a/src/mainwindow.cc
+++ b/src/mainwindow.cc
@@ -31,7 +31,7 @@
/*
* $Log$
- * Revision 1.36 2005/07/23 09:09:24 deva
+ * Revision 1.37 2005/07/23 10:11:45 deva
* *** empty log message ***
*
* Revision 1.35 2005/07/22 19:20:28 deva
@@ -142,7 +142,9 @@ MainWindow::MainWindow(QApplication *qApp, QWidget* parent, const char* name )
int resolution_w = config->readInt("pixel_width");
int resolution_h = config->readInt("pixel_height");
- unit = ((float)resolution_w / (float)(config->readFloat("screensize") * 3.1f));
+ unit = ((float)resolution_w / config->readFloat("screensize")) / INCH_IN_CM;
+
+ printf("Unit: %f\n", unit);
move(0,0);
resize(resolution_w, resolution_h);
@@ -203,7 +205,7 @@ QImage *MainWindow::loadButtonIcon( char *name )
img = new QImage();
img->load( name );
- int h = (int)(3.0 * unit);
+ int h = (int)(BUTTON_HEIGHT * unit);
int w = (int)((float)img->width() / (float)(img->height() / (float)h));
scaled = img->smoothScale(w, h);
@@ -284,7 +286,7 @@ void MainWindow::createGui()
g1->addMultiCellWidget ( img_recedge, 0, 0, 0, 2, Qt::AlignHCenter);
// CPR/NAME LABEL + CPR button
- lbl_cpr = createLabel("", 18, 3);
+ lbl_cpr = createLabel("", output_width - (int)(BUTTON_WIDTH * unit), BUTTON_HEIGHT);
g1->addMultiCellWidget ( lbl_cpr, 1, 1, 0, 1);
btn_cpr = createButton("");
@@ -294,7 +296,7 @@ void MainWindow::createGui()
// Will also be connected in the MGUI code
g1->addWidget(btn_cpr, 1, 2);
- lbl_name = createLabel("", 18, 2);
+ lbl_name = createLabel("", output_width, (int)(BUTTON_HEIGHT * 0.8f));
g1->addMultiCellWidget ( lbl_name, 2, 2, 0, 2);
/*
btn_clear = createButton("");
@@ -320,8 +322,8 @@ void MainWindow::createGui()
g1->addWidget(btn_freeze, 3, 2);
// History widgets
- int w = (int)(BUTTON_WIDTH * unit);
- int h = (int)(192.0f / (240.0f / ((float)BUTTON_WIDTH * unit)));
+ int w = (int)((BUTTON_WIDTH + 2) * unit);
+ int h = (int)(576.0f / (720.0f / ((float)BUTTON_WIDTH * unit)));
QImage dummy_resized = img_dummy->smoothScale(w, h);
@@ -339,20 +341,18 @@ void MainWindow::createGui()
// Statusbar
status = new QStatusBar(this);
status->setSizeGripEnabled(FALSE);
+ // status->setFont(QFont( "Sans Serif", (int)(unit * height / 3), QFont::Normal ));
g0->addMultiCellWidget(status, 4, 4, 0, 1);
- lbl_recordtime = createLabel("", 18, 1);
- lbl_recordtime->setFixedWidth(265);
- status->addWidget(lbl_recordtime, 0, TRUE);
+ lbl_recordtime = createLabel("", BUTTON_WIDTH, 1);
+ status->addWidget(lbl_recordtime, 1, TRUE);
- lbl_version = createLabel("MIaV-Grab v" VERSION, 18, 1);
- lbl_version->setFixedWidth(265);
- status->addWidget(lbl_version, 0, TRUE);
+ lbl_version = createLabel("MIaV-Grab v" VERSION, BUTTON_WIDTH, 1);
+ status->addWidget(lbl_version, 1, TRUE);
status->message( TXT_READY );
}
-
#include <sys/time.h>
static struct timeval starttime;
static int h = 0;
@@ -408,7 +408,7 @@ QPushButton *MainWindow::createButton(char *caption, int width, int 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->setFont( QFont( "Sans Serif", (int)(unit * height / 2), QFont::Bold ) );
btn->setFixedHeight((int)(unit * height));
return btn;
}
@@ -416,7 +416,9 @@ QPushButton *MainWindow::createButton(char *caption, QWidget *parent, int width,
QLabel *MainWindow::createLabel(char *caption, int width, int height)
{
QLabel *lbl = new QLabel(caption, this);
- lbl->setFont( QFont( "Arial", (int)(unit * height / 2), (height>1)?QFont::Bold:QFont::Normal ) );
+ lbl->setFont( QFont( "Sans Serif",
+ (height>1)?(int)(unit * height / 2):(int)(unit * height / 3),
+ (height>1)?QFont::Bold:QFont::Normal ) );
lbl->setFixedHeight((int)(unit * height));
return lbl;
}
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 5a5f99c..7f85af2 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -31,7 +31,7 @@
/*
* $Log$
- * Revision 1.18 2005/07/23 09:09:24 deva
+ * Revision 1.19 2005/07/23 10:11:45 deva
* *** empty log message ***
*
* Revision 1.17 2005/07/22 19:20:28 deva
@@ -96,13 +96,15 @@ using namespace std;
#include "info_gui.h"
+#define INCH_IN_CM 2.54f
+
/**
* First some GUI specs
*/
#define NUM_HISTORY 3
// Button sizes in cm (metric)
-#define BUTTON_WIDTH 12
-#define BUTTON_HEIGHT 3
+#define BUTTON_WIDTH 8
+#define BUTTON_HEIGHT 2
/**
* Textstrings