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 "alertDialog.h"
00028 #include "../config.h"
00029
00030
00031 AlertDialog::AlertDialog( QString message,
00032 QString description,
00033 QString alertIconName,
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 alertText = new QLabel( topFrame );
00045 alertText->setText( message );
00046 alertText->setFont( QFont( "Times", 12, QFont::Bold ) );
00047
00048 alertIcon = new QPixmap(QString(IMAGE_PATH)+alertIconName);
00049 alertIconLabel = new QLabel( topFrame );
00050 alertIconLabel->setPixmap( *alertIcon );
00051
00052 descriptionText = new QTextEdit( this );
00053 descriptionText->setReadOnly(true);
00054 descriptionText->setText( description );
00055 descriptionText->setFont( QFont( "Times", 12, QFont::Normal ) );
00056
00057 bottomFrame = new QFrame( this );
00058 okButton = new QPushButton( QPixmap(QString(IMAGE_PATH)+"button_ok.png"),
00059 tr("Ok"),
00060 bottomFrame );
00061 okButton->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Maximum );
00062 okButton->setDefault(true);
00063 okButton->setFocus();
00064
00065 connect( okButton, SIGNAL(clicked()), SLOT(accept()) );
00066
00067
00068 gridTop = new QGridLayout( topFrame, 1, 2, 0);
00069 gridTop->addWidget( alertText, 0, 0 );
00070 gridTop->addWidget( alertIconLabel, 0, 1, Qt::AlignRight );
00071
00072 gridBottom = new QGridLayout( bottomFrame, 1, 1, 0);
00073 gridBottom->addWidget( okButton, 0, 0 );
00074
00075 gridFull = new QGridLayout( this, 3, 1, 0);
00076 gridFull->addWidget( topFrame, 0, 0);
00077 gridFull->addWidget( descriptionText, 1, 0);
00078 gridFull->addWidget( bottomFrame, 2, 0);
00079
00080 gridFull->setRowStretch( 1, 1 );
00081 gridFull->setResizeMode( QLayout::FreeResize );
00082
00083 setMinimumWidth(300);
00084 setMaximumWidth(300);
00085
00086
00087 setPaletteBackgroundColor( QColor(255, 255, 255) );
00088
00089
00090 setIcon( *windowIcon );
00091 setCaption( message );
00092
00093
00094 this->show();
00095 setFixedSize(size());
00096
00097 }
00098
00099 AlertDialog::~AlertDialog()
00100 {
00101 delete windowIcon;
00102 delete alertIcon;
00103 }
00104