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
00059 okButton = new QPushButton( QPixmap(QString(IMAGE_PATH)+"button_ok.png"),
00060 tr("Ok"),
00061 bottomFrame );
00062 okButton->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Maximum );
00063 okButton->setDefault(true);
00064 okButton->setFocus();
00065
00066 connect( okButton, SIGNAL(clicked()), SLOT(accept()) );
00067
00068 cancelButton = new QPushButton( QPixmap(QString(IMAGE_PATH)+"button_cancel.png"),
00069 tr("Cancel"),
00070 bottomFrame );
00071 cancelButton->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Maximum );
00072 connect( cancelButton, SIGNAL(clicked()), SLOT(reject()) );
00073
00074
00075 gridTop = new QGridLayout( topFrame, 1, 2, 0);
00076 gridTop->addWidget( questionText, 0, 0 );
00077 gridTop->addWidget( questionIconLabel, 0, 1, Qt::AlignRight );
00078
00079 gridBottom = new QGridLayout( bottomFrame, 1, 2, 0);
00080 gridBottom->addWidget( okButton, 0, 0 );
00081 gridBottom->addWidget( cancelButton, 0, 1);
00082
00083 gridFull = new QGridLayout( this, 3, 1, 0);
00084 gridFull->addWidget( topFrame, 0, 0);
00085 gridFull->addWidget( messageText, 1, 0);
00086 gridFull->addWidget( bottomFrame, 2, 0);
00087
00088 gridFull->setRowStretch( 1, 1 );
00089 gridFull->setResizeMode( QLayout::FreeResize );
00090
00091 setMinimumWidth(300);
00092 setMaximumWidth(300);
00093
00094
00095 setPaletteBackgroundColor( QColor(255, 255, 255) );
00096
00097
00098 setIcon( *windowIcon );
00099 setCaption( question );
00100
00101
00102 this->show();
00103 setFixedSize(size());
00104
00105 }
00106
00107 QuestionDialog::~QuestionDialog()
00108 {
00109 delete windowIcon;
00110 delete questionIcon;
00111 }
00112