Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

alertDialog.cpp

Go to the documentation of this file.
00001 //==============================================
00002 //  copyright            : (C) 2003 by Will Stokes
00003 //==============================================
00004 //  This program is free software; you can redistribute it 
00005 //  and/or modify it under the terms of the GNU General 
00006 //  Public License as published by the Free Software 
00007 //  Foundation; either version 2 of the License, or  
00008 //  (at your option) any later version.         
00009 //
00010 //  As a special exception, Will Stokes gives permission to 
00011 //  link this program with Qt non-commercial edition, and 
00012 //  distribute the resulting executable, without including the 
00013 //  source code for the Qt non-commercial edition in the 
00014 //  source distribution. 
00015 //==============================================
00016 
00017 //Systemwide includes
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 //Projectwide includes
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   //create widgets   
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   //create grid and place widgets
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   //set the background of the widget to be white
00087   setPaletteBackgroundColor( QColor(255, 255, 255) );
00088   //-------------------------------
00089   //setup window title bar
00090   setIcon( *windowIcon );
00091   setCaption( message );
00092   //-------------------------------
00093   //set window to not be resizeable
00094   this->show();
00095   setFixedSize(size());
00096   //-------------------------------
00097 }
00098 //==============================================
00099 AlertDialog::~AlertDialog()
00100 {
00101   delete windowIcon;
00102   delete alertIcon;
00103 }
00104 //==============================================

Generated on Thu Nov 13 00:10:53 2003 for AlbumShaper by doxygen 1.3.4