diff options
author | deva <deva> | 2005-03-29 21:02:39 +0000 |
---|---|---|
committer | deva <deva> | 2005-03-29 21:02:39 +0000 |
commit | 5023167ffc89c413eede025a1984edf12d3784bb (patch) | |
tree | 5f1c4ff4ac443c69942745786c9f2006deea2005 /src/messagebox.cc | |
parent | 0e00efae89cd5a9bde70088b3ca51cbfba94d234 (diff) |
Added text defines and pixmap defines.
Added new icons.
Diffstat (limited to 'src/messagebox.cc')
-rw-r--r-- | src/messagebox.cc | 112 |
1 files changed, 20 insertions, 92 deletions
diff --git a/src/messagebox.cc b/src/messagebox.cc index fe255ae..fe5420f 100644 --- a/src/messagebox.cc +++ b/src/messagebox.cc @@ -38,6 +38,7 @@ MessageBox::MessageBox(QWidget* parent, msg_icon icon) : QDialog(parent, name, TRUE) { + setCaption(name); QFrame *topf = new QFrame(this); topf->setFrameStyle(QFrame::Box | QFrame::Raised); topf->setLineWidth(3); @@ -46,7 +47,7 @@ MessageBox::MessageBox(QWidget* parent, QLabel *lbl_text = new QLabel(topf); lbl_text->setText(text); - lbl_text->setFont(QFont("Lucida", 18)); + lbl_text->setFont(QFont("Arial", 18)); QFrame *f = new QFrame(topf); QVBoxLayout *blayout = new QVBoxLayout(topf, 20, 20); @@ -64,38 +65,38 @@ MessageBox::MessageBox(QWidget* parent, { switch(type) { case TYPE_OK: - pix_icon->load( "info.png" ); + pix_icon->load( PIXMAP_INFO ); break; case TYPE_OK_CANCEL: - pix_icon->load( "warning.png" ); + pix_icon->load( PIXMAP_WARNING ); break; case TYPE_YES_NO: - pix_icon->load( "question.png" ); + pix_icon->load( PIXMAP_QUESTION ); break; case TYPE_YES_NO_CANCEL: - pix_icon->load( "question.png" ); + pix_icon->load( PIXMAP_QUESTION ); break; } break; } case ICON_INFO: // An info icon (matching the ok button) { - pix_icon->load( "info.png" ); + pix_icon->load( PIXMAP_INFO ); break; } - case ICON_WARN: // An warning icon (matching the ok/cancel button) + case ICON_WARNING: // An warning icon (matching the ok/cancel button) { - pix_icon->load( "warning.png" ); + pix_icon->load( PIXMAP_WARNING ); break; } case ICON_ERROR: // An critical error icon { - pix_icon->load( "error.png" ); + pix_icon->load( PIXMAP_ERROR ); break; } case ICON_QUESTION:// An question icon (matching the yes/no and yes/no/cancel buttons) { - pix_icon->load( "question.png" ); + pix_icon->load( PIXMAP_QUESTION ); break; } } @@ -104,7 +105,7 @@ MessageBox::MessageBox(QWidget* parent, switch(type) { case TYPE_OK: { - QPushButton *bok = createButton(f, "Ok"); + QPushButton *bok = createButton(f, TXT_OK ); QGridLayout *glayout = new QGridLayout(f, 1, 1, 20, 20); glayout->addWidget(bok, 0, 0); connect(bok, SIGNAL( clicked() ), SLOT(bok_clicked())); @@ -112,8 +113,8 @@ MessageBox::MessageBox(QWidget* parent, } case TYPE_OK_CANCEL: { - QPushButton *bok = createButton(f, "Ok"); - QPushButton *bcancel = createButton(f, "Cancel"); + QPushButton *bok = createButton(f, TXT_OK ); + QPushButton *bcancel = createButton(f, TXT_CANCEL ); QGridLayout *glayout = new QGridLayout(f, 1, 2, 20, 20); glayout->addWidget(bcancel, 0, 1); glayout->addWidget(bok, 0, 2); @@ -123,8 +124,8 @@ MessageBox::MessageBox(QWidget* parent, } case TYPE_YES_NO: { - QPushButton *byes = createButton(f, "Ja"); - QPushButton *bno = createButton(f, "Nej"); + QPushButton *byes = createButton(f, TXT_YES ); + QPushButton *bno = createButton(f, TXT_NO ); QGridLayout *glayout = new QGridLayout(f, 1, 2, 20, 20); glayout->addWidget(bno, 0, 0); glayout->addWidget(byes, 0, 1); @@ -134,9 +135,9 @@ MessageBox::MessageBox(QWidget* parent, } case TYPE_YES_NO_CANCEL: { - QPushButton *byes = createButton(f, "Ja"); - QPushButton *bcancel = createButton(f, "Cancel"); - QPushButton *bno = createButton(f, "Nej"); + QPushButton *byes = createButton(f, TXT_YES ); + QPushButton *bcancel = createButton(f, TXT_CANCEL ); + QPushButton *bno = createButton(f, TXT_NO ); QGridLayout *glayout = new QGridLayout(f, 1, 3, 20, 20); glayout->addWidget(bno, 0, 0); glayout->addWidget(bcancel, 0, 1); @@ -159,7 +160,7 @@ QPushButton *MessageBox::createButton(QWidget *parent, const char *text) { QPushButton *q = new QPushButton(parent); q->setText(text); - q->setFont(QFont("Lucida", 18)); + q->setFont(QFont("Arial", 18)); q->setFixedSize(200, 75); return q; } @@ -183,76 +184,3 @@ void MessageBox::bno_clicked() { done(MSG_NO); } - - -/* -//////////////////////////////////////////////////////////////////////////////////////// -// A generic alert dialog that can either give the user a choice -// (yes or no - returns true or false) or simply give a statement and await the users -// acknowledgement (OK - returns true) -// - -Alert::Alert(QWidget *parent, const char *text, bool single, const char* name, bool mode) -: QDialog(parent, name, mode) -// Sets up the dialog. Two buttons if mode=true otherwise one button -{ - - QPushButton *b_true; ; - QPushButton *b_false; - - QFrame *topf = new QFrame(this); - topf->setFrameStyle(QFrame::Box | QFrame::Raised); - topf->setLineWidth(3); - QVBoxLayout *bl1 = new QVBoxLayout(topf, 20, 20); - - QLabel *l_text = new QLabel(topf); - QFont font("Lucida", 18); - l_text->setText(text); - l_text->setFont(font); - - QFrame *f = new QFrame(topf); - QHBoxLayout *bl2 = new QHBoxLayout(f, 20, 20); - - - QVBoxLayout *toplayout = new QVBoxLayout(this); - toplayout->addWidget(topf); - bl1->addWidget(l_text); - bl1->addWidget(f); - if(!single) - { - b_true = createButton(f, M_YES); - b_false = createButton(f, M_NO); - bl2->addWidget(b_false); - bl2->addWidget(b_true); - connect(b_false, SIGNAL(clicked()), SLOT(false_clicked())); - connect(b_true, SIGNAL(clicked()), SLOT(true_clicked())); - } - else - { - b_true = createButton(f, M_OK); - bl2->addWidget(b_true); - connect(b_true, SIGNAL(clicked()), SLOT(true_clicked())); - } - -} - -QPushButton *Alert::createButton(QWidget *parent, const char *text) -{ - QPushButton *q = new QPushButton(parent); - QFont font("Lucida", 18); - q->setFont(font); - q->setText(text); - q->setFixedSize(200,75); - return q; -} - -void Alert::true_clicked() -{ - accept(); -} - -void Alert::false_clicked() -{ - reject(); -} -*/ |