Main Page   Compound List   File List   Compound Members   File Members  

questionDialog.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 "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   //create widgets   
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   //create grid and place widgets
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   //set the background of the widget to be white
00091   setPaletteBackgroundColor( QColor(255, 255, 255) );
00092   //-------------------------------
00093   //setup window title bar
00094   setIcon( *windowIcon );
00095   setCaption( question );
00096   //-------------------------------
00097 }
00098 //==============================================
00099 QuestionDialog::~QuestionDialog()
00100 {
00101   delete windowIcon;
00102   delete questionIcon;
00103 }
00104 //==============================================

Generated on Tue Jun 10 23:41:21 2003 for AlbumShaper by doxygen 1.3.1