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

alertDialog.cpp

Go to the documentation of this file.
00001 //==============================================
00002 //  copyright            : (C) 2003-2005 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 
00011 //Systemwide includes
00012 #include <qdialog.h>
00013 #include <qlayout.h>
00014 #include <qlabel.h>
00015 #include <qtextedit.h>
00016 #include <qfont.h>
00017 #include <qpushbutton.h>
00018 #include <qpixmap.h>
00019 
00020 //Projectwide includes
00021 #include "alertDialog.h"
00022 #include "../../config.h"
00023 
00024 //==============================================
00025 AlertDialog::AlertDialog( QString message,
00026                                   QString description,
00027                                   QString alertIconName,
00028                                   QWidget* parent,
00029                                   const char* name ) :
00030                                   QDialog(parent, name, true )
00031 {
00032   //-------------------------------
00033   //create widgets
00034   topFrame = new QFrame( this );
00035 
00036   alertText = new QLabel( topFrame );
00037   alertText->setText( message );
00038   alertText->setFont( QFont( "Times", 12, QFont::Bold ) );
00039 
00040   alertIcon = new QPixmap(QString(IMAGE_PATH)+alertIconName);
00041   alertIconLabel = new QLabel( topFrame );
00042   alertIconLabel->setPixmap( *alertIcon );
00043 
00044   descriptionText = new QTextEdit( this );
00045   descriptionText->setReadOnly(true);
00046   descriptionText->setText( description );
00047   descriptionText->setFont( QFont( "Times", 12, QFont::Normal ) );
00048 
00049   bottomFrame = new QFrame( this );
00050   okButton = new QPushButton( tr("OK"), bottomFrame );
00051   okButton->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
00052   okButton->setDefault(true);
00053   okButton->setFocus();
00054 
00055   connect( okButton, SIGNAL(clicked()), SLOT(accept()) );
00056   //-------------------------------
00057   //create grid and place widgets
00058   gridTop     = new QGridLayout( topFrame, 1, 2, 0);
00059   gridTop->addWidget( alertText, 0, 0 );
00060   gridTop->addWidget( alertIconLabel, 0, 1, Qt::AlignRight );
00061 
00062   gridBottom  = new QGridLayout( bottomFrame, 1, 1, 0);
00063   gridBottom->addWidget( okButton, 0, 0 );
00064 
00065   gridFull    = new QGridLayout( this, 3, 1, 0);
00066   gridFull->addWidget( topFrame, 0, 0);
00067   gridFull->addWidget( descriptionText, 1, 0);
00068   gridFull->addWidget( bottomFrame, 2, 0);
00069 
00070   gridFull->setRowStretch( 1, 1 );
00071   gridFull->setResizeMode( QLayout::FreeResize );
00072   gridFull->setMargin(WIDGET_SPACING);
00073   gridFull->setSpacing(WIDGET_SPACING);
00074 
00075   setMinimumWidth(300);
00076   setMaximumWidth(300);
00077   //-------------------------------
00078   //setup window title bar
00079   setCaption( message );
00080   //-------------------------------
00081   //set window to not be resizeable
00082   this->show();
00083   setFixedSize(size());
00084   //-------------------------------
00085 }
00086 //==============================================
00087 AlertDialog::~AlertDialog()
00088 {
00089   delete alertIcon;
00090 }
00091 //==============================================

Generated on Sat Apr 2 05:44:04 2005 for AlbumShaper by  doxygen 1.3.9.1