00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include <qdialog.h>
00019 #include <qlayout.h>
00020 #include <qlabel.h>
00021 #include <qtextedit.h>
00022 #include <qfont.h>
00023 #include <qpushbutton.h>
00024 #include <qpixmap.h>
00025
00026
00027 #include "questionDialog.h"
00028 #include "../config.h"
00029
00030
00031 QuestionDialog::QuestionDialog( QString question,
00032 QString message,
00033 QString questionIconName,
00034 QWidget* parent,
00035 const char* name ) :
00036 QDialog(parent, name, true )
00037 {
00038
00039
00040 windowIcon = new QPixmap(QString(IMAGE_PATH)+"albumShaperIcon.png");
00041
00042 topFrame = new QFrame( this );
00043
00044 questionText = new QLabel( topFrame );
00045 questionText->setText( question );
00046 questionText->setFont( QFont( "Times", 12, QFont::Bold ) );
00047
00048 questionIcon = new QPixmap(QString(IMAGE_PATH)+questionIconName);
00049 questionIconLabel = new QLabel( topFrame );
00050 questionIconLabel->setPixmap( *questionIcon );
00051
00052 messageText = new QTextEdit( this );
00053 messageText->setReadOnly(true);
00054 messageText->setText( message );
00055 messageText->setFont( QFont( "Times", 12, QFont::Normal ) );
00056
00057 bottomFrame = new QFrame( this );
00058 okButton = new QPushButton( QPixmap(QString(IMAGE_PATH)+"button_ok.png"),
00059 "Ok",
00060 bottomFrame );
00061 okButton->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Maximum );
00062 connect( okButton, SIGNAL(clicked()), SLOT(accept()) );
00063
00064 cancelButton = new QPushButton( QPixmap(QString(IMAGE_PATH)+"button_cancel.png"),
00065 "Cancel",
00066 bottomFrame );
00067 cancelButton->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Maximum );
00068 connect( cancelButton, SIGNAL(clicked()), SLOT(reject()) );
00069
00070
00071 gridTop = new QGridLayout( topFrame, 1, 2, 0);
00072 gridTop->addWidget( questionText, 0, 0 );
00073 gridTop->addWidget( questionIconLabel, 0, 1, Qt::AlignRight );
00074
00075 gridBottom = new QGridLayout( bottomFrame, 1, 2, 0);
00076 gridBottom->addWidget( okButton, 0, 0 );
00077 gridBottom->addWidget( cancelButton, 0, 1);
00078
00079 gridFull = new QGridLayout( this, 3, 1, 0);
00080 gridFull->addWidget( topFrame, 0, 0);
00081 gridFull->addWidget( messageText, 1, 0);
00082 gridFull->addWidget( bottomFrame, 2, 0);
00083
00084 gridFull->setRowStretch( 1, 1 );
00085 gridFull->setResizeMode( QLayout::FreeResize );
00086
00087 setMinimumWidth(300);
00088 setMaximumWidth(300);
00089
00090
00091 setPaletteBackgroundColor( QColor(255, 255, 255) );
00092
00093
00094 setIcon( *windowIcon );
00095 setCaption( question );
00096
00097 }
00098
00099 QuestionDialog::~QuestionDialog()
00100 {
00101 delete windowIcon;
00102 delete questionIcon;
00103 }
00104