Main Page | Namespace List | Class Hierarchy | Class List | 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 00039 QFont alertFont = alertText->font(); 00040 alertFont.setWeight(QFont::Bold); 00041 alertText->setFont( alertFont ); 00042 00043 alertIcon = new QPixmap(QString(IMAGE_PATH)+alertIconName); 00044 alertIconLabel = new QLabel( topFrame ); 00045 alertIconLabel->setPixmap( *alertIcon ); 00046 00047 descriptionText = new QTextEdit( this ); 00048 descriptionText->setReadOnly(true); 00049 descriptionText->setText( description ); 00050 00051 bottomFrame = new QFrame( this ); 00052 okButton = new QPushButton( tr("OK"), bottomFrame ); 00053 okButton->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); 00054 okButton->setDefault(true); 00055 okButton->setFocus(); 00056 00057 connect( okButton, SIGNAL(clicked()), SLOT(accept()) ); 00058 //------------------------------- 00059 //create grid and place widgets 00060 gridTop = new QGridLayout( topFrame, 1, 2, 0); 00061 gridTop->addWidget( alertText, 0, 0 ); 00062 gridTop->addWidget( alertIconLabel, 0, 1, Qt::AlignRight ); 00063 00064 gridBottom = new QGridLayout( bottomFrame, 1, 1, 0); 00065 gridBottom->addWidget( okButton, 0, 0 ); 00066 00067 gridFull = new QGridLayout( this, 3, 1, 0); 00068 gridFull->addWidget( topFrame, 0, 0); 00069 gridFull->addWidget( descriptionText, 1, 0); 00070 gridFull->addWidget( bottomFrame, 2, 0); 00071 00072 gridFull->setRowStretch( 1, 1 ); 00073 gridFull->setResizeMode( QLayout::FreeResize ); 00074 gridFull->setMargin(WIDGET_SPACING); 00075 gridFull->setSpacing(WIDGET_SPACING); 00076 00077 setMinimumWidth(300); 00078 setMaximumWidth(300); 00079 //------------------------------- 00080 //setup window title bar 00081 setCaption( message ); 00082 //------------------------------- 00083 //set window to not be resizeable 00084 this->show(); 00085 setFixedSize(size()); 00086 //------------------------------- 00087 } 00088 //============================================== 00089 AlertDialog::~AlertDialog() 00090 { 00091 delete alertIcon; 00092 } 00093 //==============================================

Generated on Sun Mar 4 19:42:55 2007 for AlbumShaper by doxygen 1.3.7