From 3ed6455c3166079d9b8fc1653b307b3c8349055d Mon Sep 17 00:00:00 2001 From: deva Date: Fri, 25 Nov 2005 21:52:29 +0000 Subject: *** empty log message *** --- src/mainwindow.cc | 4 ++-- src/mainwindow.h | 2 +- src/messagebox.cc | 20 +++++++++++++++++--- src/messagebox.h | 1 + 4 files changed, 21 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mainwindow.cc b/src/mainwindow.cc index 9f2197a..5e64a75 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -319,7 +319,7 @@ void MainWindow::createGui() QPushButton *MainWindow::createButton(char *caption, int width, int height) { - return createButton(caption, this, width, height); + return createButton(caption, this);//, width, height); } @@ -328,7 +328,7 @@ QPushButton *MainWindow::createButton(char *caption, QWidget *parent, int width, QPushButton *btn = new QPushButton(caption, parent); btn->setFont( QFont( "Sans Serif", (int)(unit * height / 2), QFont::Bold ) ); btn->setFixedHeight((int)(unit * height)); - btn->setFixedWidth((int)(unit * width)); + // btn->setFixedWidth((int)(unit * width)); return btn; } diff --git a/src/mainwindow.h b/src/mainwindow.h index e95933d..2ac7d82 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -55,7 +55,7 @@ using namespace std; */ //#define NUM_HISTORY 3 // moved to a genuine variable // Button sizes in cm (metric) -#define BUTTON_WIDTH 8 +#define BUTTON_WIDTH 7 #define BUTTON_HEIGHT 2 #define HISTORY_LIST_MARGIN 25 diff --git a/src/messagebox.cc b/src/messagebox.cc index df0e813..fd812eb 100644 --- a/src/messagebox.cc +++ b/src/messagebox.cc @@ -27,6 +27,10 @@ #include #ifdef USE_GUI #include "messagebox.h" +#include "miav_config.h" + +// For button sizes! +#include "mainwindow.h" //////////////////////////////////////////////////////////////////////////////////////// /* If the cpr input by the user is not valid, this dialog @@ -41,6 +45,11 @@ MessageBox::MessageBox(QWidget* parent, msg_icon icon) : QDialog(parent, name, TRUE) { + int resolution_w = config->readInt("pixel_width"); + //int resolution_h = config->readInt("pixel_height"); + unit = ((float)resolution_w / config->readFloat("screensize")) / INCH_IN_CM; + + setCaption(name); QFrame *topf = new QFrame(this); topf->setFrameStyle(QFrame::Box | QFrame::Raised); @@ -99,7 +108,12 @@ MessageBox::MessageBox(QWidget* parent, QLabel *lbl_text = new QLabel(topf); lbl_text->setText(text); - lbl_text->setFont(QFont("Arial", 18)); + lbl_text->setFont( QFont( "Sans Serif", + //(height>1)?(int)(unit * height / 2):(int)(unit * height / 2), + (int)(unit * 0.7 * BUTTON_HEIGHT / 2), + QFont::Normal ) ); + lbl_text->setFixedHeight((int)(unit * BUTTON_HEIGHT)); + // lbl_text->setFont(QFont("Arial", 18)); QFrame *f = new QFrame(topf); QVBoxLayout *blayout = new QVBoxLayout(topf, 20, 20); @@ -198,8 +212,8 @@ QPushButton *MessageBox::createButton(QWidget *parent, const char *text) { QPushButton *q = new QPushButton(parent); q->setText(text); - q->setFont(QFont("Arial", 18)); - q->setFixedSize(200, 75); + q->setFont( QFont( "Sans Serif", (int)(unit * 0.7 * BUTTON_HEIGHT / 2 ), QFont::Normal ) ); + q->setFixedSize((int)(BUTTON_WIDTH * unit), (int)(BUTTON_HEIGHT * unit)); return q; } diff --git a/src/messagebox.h b/src/messagebox.h index c6786ca..30a8307 100644 --- a/src/messagebox.h +++ b/src/messagebox.h @@ -102,6 +102,7 @@ public slots: void bmaybe_clicked(); private: + float unit; QPixmap *pix_icon; QPushButton *createButton(QWidget *parent, const char *text); }; -- cgit v1.2.3