AlbumShaper  1.0a3
Public Member Functions | Private Attributes
AlertDialog Class Reference

A configurable alert dialog that displays an alert/error message. More...

#include <alertDialog.h>

Inheritance diagram for AlertDialog:
Inheritance graph
[legend]
Collaboration diagram for AlertDialog:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 AlertDialog (QString message, QString description, QString alertIconName, QWidget *parent=0, const char *name=0)
 Basic constructor.
 ~AlertDialog ()
 Destructor.

Private Attributes

QGridLayout * gridTop
 Grids objects placed in.
QGridLayout * gridBottom
QGridLayout * gridFull
QLabelalertText
 Message displayed in window.
QTextEditdescriptionText
 Description displayed in window.
QPushButton * okButton
 Ok button.
QPixmap * alertIcon
 Alert icon.
QLabelalertIconLabel
 Label which shows alert icon.
QFrametopFrame
 Top and bottom frames.
QFramebottomFrame

Detailed Description

A configurable alert dialog that displays an alert/error message.

Definition at line 31 of file alertDialog.h.


Constructor & Destructor Documentation

AlertDialog::AlertDialog ( QString  message,
QString  description,
QString  alertIconName,
QWidget parent = 0,
const char *  name = 0 
)

Basic constructor.

Definition at line 25 of file alertDialog.cpp.

References alertIcon, alertIconLabel, alertText, bottomFrame, descriptionText, gridBottom, gridFull, gridTop, IMAGE_PATH, okButton, topFrame, and WIDGET_SPACING.

                                                     :
                                  QDialog(parent, name, true )
{
  //-------------------------------
  //create widgets
  topFrame = new QFrame( this );

  alertText = new QLabel( topFrame );
  alertText->setText( message );
  
  QFont alertFont = alertText->font();
  alertFont.setWeight(QFont::Bold);
  alertText->setFont( alertFont );

  alertIcon = new QPixmap(QString(IMAGE_PATH)+alertIconName);
  alertIconLabel = new QLabel( topFrame );
  alertIconLabel->setPixmap( *alertIcon );

  descriptionText = new QTextEdit( this );
  descriptionText->setReadOnly(true);
  descriptionText->setText( description );

  bottomFrame = new QFrame( this );
  okButton = new QPushButton( tr("OK"), bottomFrame );
  okButton->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
  okButton->setDefault(true);
  okButton->setFocus();

  connect( okButton, SIGNAL(clicked()), SLOT(accept()) );
  //-------------------------------
  //create grid and place widgets
  gridTop     = new QGridLayout( topFrame, 1, 2, 0);
  gridTop->addWidget( alertText, 0, 0 );
  gridTop->addWidget( alertIconLabel, 0, 1, Qt::AlignRight );

  gridBottom  = new QGridLayout( bottomFrame, 1, 1, 0);
  gridBottom->addWidget( okButton, 0, 0 );

  gridFull    = new QGridLayout( this, 3, 1, 0);
  gridFull->addWidget( topFrame, 0, 0);
  gridFull->addWidget( descriptionText, 1, 0);
  gridFull->addWidget( bottomFrame, 2, 0);

  gridFull->setRowStretch( 1, 1 );
  gridFull->setResizeMode( QLayout::FreeResize );
  gridFull->setMargin(WIDGET_SPACING);
  gridFull->setSpacing(WIDGET_SPACING);

  setMinimumWidth(300);
  setMaximumWidth(300);
  //-------------------------------
  //setup window title bar
  setCaption( message );
  //-------------------------------
  //set window to not be resizeable
  this->show();
  setFixedSize(size());
  //-------------------------------
}
AlertDialog::~AlertDialog ( )

Destructor.

Definition at line 89 of file alertDialog.cpp.

References alertIcon.

{
  delete alertIcon;
}

Member Data Documentation

QPixmap* AlertDialog::alertIcon [private]

Alert icon.

Definition at line 60 of file alertDialog.h.

Referenced by AlertDialog(), and ~AlertDialog().

Label which shows alert icon.

Definition at line 63 of file alertDialog.h.

Referenced by AlertDialog().

Message displayed in window.

Definition at line 51 of file alertDialog.h.

Referenced by AlertDialog().

Definition at line 66 of file alertDialog.h.

Referenced by AlertDialog().

Description displayed in window.

Definition at line 54 of file alertDialog.h.

Referenced by AlertDialog().

QGridLayout * AlertDialog::gridBottom [private]

Definition at line 48 of file alertDialog.h.

Referenced by AlertDialog().

QGridLayout * AlertDialog::gridFull [private]

Definition at line 48 of file alertDialog.h.

Referenced by AlertDialog().

QGridLayout* AlertDialog::gridTop [private]

Grids objects placed in.

Definition at line 48 of file alertDialog.h.

Referenced by AlertDialog().

QPushButton* AlertDialog::okButton [private]

Ok button.

Definition at line 57 of file alertDialog.h.

Referenced by AlertDialog().

Top and bottom frames.

Definition at line 66 of file alertDialog.h.

Referenced by AlertDialog().


The documentation for this class was generated from the following files: