diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mainwindow.cc | 4 | ||||
-rw-r--r-- | src/mainwindow.h | 2 | ||||
-rw-r--r-- | src/messagebox.cc | 20 | ||||
-rw-r--r-- | src/messagebox.h | 1 |
4 files changed, 21 insertions, 6 deletions
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 <config.h> #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); }; |