<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>AlbumShaper: alertDialog.cpp Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.6.2 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> <h1>alertDialog.cpp</h1><a href="alertDialog_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">//==============================================</span> <a name="l00002"></a>00002 <span class="comment">// copyright : (C) 2003-2005 by Will Stokes</span> <a name="l00003"></a>00003 <span class="comment">//==============================================</span> <a name="l00004"></a>00004 <span class="comment">// This program is free software; you can redistribute it</span> <a name="l00005"></a>00005 <span class="comment">// and/or modify it under the terms of the GNU General</span> <a name="l00006"></a>00006 <span class="comment">// Public License as published by the Free Software</span> <a name="l00007"></a>00007 <span class="comment">// Foundation; either version 2 of the License, or</span> <a name="l00008"></a>00008 <span class="comment">// (at your option) any later version.</span> <a name="l00009"></a>00009 <span class="comment">//==============================================</span> <a name="l00010"></a>00010 <a name="l00011"></a>00011 <span class="comment">//Systemwide includes</span> <a name="l00012"></a>00012 <span class="preprocessor">#include <qdialog.h></span> <a name="l00013"></a>00013 <span class="preprocessor">#include <qlayout.h></span> <a name="l00014"></a>00014 <span class="preprocessor">#include <qlabel.h></span> <a name="l00015"></a>00015 <span class="preprocessor">#include <qtextedit.h></span> <a name="l00016"></a>00016 <span class="preprocessor">#include <qfont.h></span> <a name="l00017"></a>00017 <span class="preprocessor">#include <qpushbutton.h></span> <a name="l00018"></a>00018 <span class="preprocessor">#include <qpixmap.h></span> <a name="l00019"></a>00019 <a name="l00020"></a>00020 <span class="comment">//Projectwide includes</span> <a name="l00021"></a>00021 <span class="preprocessor">#include "<a class="code" href="alertDialog_8h.html">alertDialog.h</a>"</span> <a name="l00022"></a>00022 <span class="preprocessor">#include "../../config.h"</span> <a name="l00023"></a>00023 <a name="l00024"></a>00024 <span class="comment">//==============================================</span> <a name="l00025"></a><a class="code" href="classAlertDialog.html#ab7aea99441443423111a042693519644">00025</a> <a class="code" href="classAlertDialog.html#ab7aea99441443423111a042693519644" title="Basic constructor.">AlertDialog::AlertDialog</a>( QString message, <a name="l00026"></a>00026 QString description, <a name="l00027"></a>00027 QString alertIconName, <a name="l00028"></a>00028 <a class="code" href="classQWidget.html">QWidget</a>* parent, <a name="l00029"></a>00029 <span class="keyword">const</span> <span class="keywordtype">char</span>* name ) : <a name="l00030"></a>00030 <a class="code" href="classQDialog.html">QDialog</a>(parent, name, true ) <a name="l00031"></a>00031 { <a name="l00032"></a>00032 <span class="comment">//-------------------------------</span> <a name="l00033"></a>00033 <span class="comment">//create widgets</span> <a name="l00034"></a>00034 <a class="code" href="classAlertDialog.html#a55fa42eed5e59028bc37621e50845e30" title="Top and bottom frames.">topFrame</a> = <span class="keyword">new</span> <a class="code" href="classQFrame.html">QFrame</a>( <span class="keyword">this</span> ); <a name="l00035"></a>00035 <a name="l00036"></a>00036 <a class="code" href="classAlertDialog.html#ad339d7b13e67d13a17081acb3a0199c0" title="Message displayed in window.">alertText</a> = <span class="keyword">new</span> <a class="code" href="classQLabel.html">QLabel</a>( <a class="code" href="classAlertDialog.html#a55fa42eed5e59028bc37621e50845e30" title="Top and bottom frames.">topFrame</a> ); <a name="l00037"></a>00037 <a class="code" href="classAlertDialog.html#ad339d7b13e67d13a17081acb3a0199c0" title="Message displayed in window.">alertText</a>->setText( message ); <a name="l00038"></a>00038 <a name="l00039"></a>00039 QFont alertFont = <a class="code" href="classAlertDialog.html#ad339d7b13e67d13a17081acb3a0199c0" title="Message displayed in window.">alertText</a>->font(); <a name="l00040"></a>00040 alertFont.setWeight(QFont::Bold); <a name="l00041"></a>00041 <a class="code" href="classAlertDialog.html#ad339d7b13e67d13a17081acb3a0199c0" title="Message displayed in window.">alertText</a>->setFont( alertFont ); <a name="l00042"></a>00042 <a name="l00043"></a>00043 <a class="code" href="classAlertDialog.html#ae67fea12ccbc008bb58b6a50ffd5a34a" title="Alert icon.">alertIcon</a> = <span class="keyword">new</span> QPixmap(QString(<a class="code" href="config_8cpp.html#a59e02362a9a29a755712dc830a3eb513">IMAGE_PATH</a>)+alertIconName); <a name="l00044"></a>00044 <a class="code" href="classAlertDialog.html#a7e81fc1c47cde96ca54033cded01d749" title="Label which shows alert icon.">alertIconLabel</a> = <span class="keyword">new</span> <a class="code" href="classQLabel.html">QLabel</a>( <a class="code" href="classAlertDialog.html#a55fa42eed5e59028bc37621e50845e30" title="Top and bottom frames.">topFrame</a> ); <a name="l00045"></a>00045 <a class="code" href="classAlertDialog.html#a7e81fc1c47cde96ca54033cded01d749" title="Label which shows alert icon.">alertIconLabel</a>->setPixmap( *<a class="code" href="classAlertDialog.html#ae67fea12ccbc008bb58b6a50ffd5a34a" title="Alert icon.">alertIcon</a> ); <a name="l00046"></a>00046 <a name="l00047"></a>00047 <a class="code" href="classAlertDialog.html#aeed97a15a81fdf31bd6158dc09be45f2" title="Description displayed in window.">descriptionText</a> = <span class="keyword">new</span> <a class="code" href="classQTextEdit.html">QTextEdit</a>( <span class="keyword">this</span> ); <a name="l00048"></a>00048 <a class="code" href="classAlertDialog.html#aeed97a15a81fdf31bd6158dc09be45f2" title="Description displayed in window.">descriptionText</a>->setReadOnly(<span class="keyword">true</span>); <a name="l00049"></a>00049 <a class="code" href="classAlertDialog.html#aeed97a15a81fdf31bd6158dc09be45f2" title="Description displayed in window.">descriptionText</a>->setText( description ); <a name="l00050"></a>00050 <a name="l00051"></a>00051 <a class="code" href="classAlertDialog.html#a8fd835bc05b07fd4fb34a8d4179493e4">bottomFrame</a> = <span class="keyword">new</span> <a class="code" href="classQFrame.html">QFrame</a>( <span class="keyword">this</span> ); <a name="l00052"></a>00052 <a class="code" href="classAlertDialog.html#ad9869083a0e1c6cf511d20af4491f494" title="Ok button.">okButton</a> = <span class="keyword">new</span> QPushButton( tr(<span class="stringliteral">"OK"</span>), <a class="code" href="classAlertDialog.html#a8fd835bc05b07fd4fb34a8d4179493e4">bottomFrame</a> ); <a name="l00053"></a>00053 <a class="code" href="classAlertDialog.html#ad9869083a0e1c6cf511d20af4491f494" title="Ok button.">okButton</a>->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); <a name="l00054"></a>00054 <a class="code" href="classAlertDialog.html#ad9869083a0e1c6cf511d20af4491f494" title="Ok button.">okButton</a>->setDefault(<span class="keyword">true</span>); <a name="l00055"></a>00055 <a class="code" href="classAlertDialog.html#ad9869083a0e1c6cf511d20af4491f494" title="Ok button.">okButton</a>->setFocus(); <a name="l00056"></a>00056 <a name="l00057"></a>00057 connect( <a class="code" href="classAlertDialog.html#ad9869083a0e1c6cf511d20af4491f494" title="Ok button.">okButton</a>, SIGNAL(clicked()), SLOT(accept()) ); <a name="l00058"></a>00058 <span class="comment">//-------------------------------</span> <a name="l00059"></a>00059 <span class="comment">//create grid and place widgets</span> <a name="l00060"></a>00060 <a class="code" href="classAlertDialog.html#ac8df4978addd21fe813e3848d647920e" title="Grids objects placed in.">gridTop</a> = <span class="keyword">new</span> QGridLayout( <a class="code" href="classAlertDialog.html#a55fa42eed5e59028bc37621e50845e30" title="Top and bottom frames.">topFrame</a>, 1, 2, 0); <a name="l00061"></a>00061 <a class="code" href="classAlertDialog.html#ac8df4978addd21fe813e3848d647920e" title="Grids objects placed in.">gridTop</a>->addWidget( <a class="code" href="classAlertDialog.html#ad339d7b13e67d13a17081acb3a0199c0" title="Message displayed in window.">alertText</a>, 0, 0 ); <a name="l00062"></a>00062 <a class="code" href="classAlertDialog.html#ac8df4978addd21fe813e3848d647920e" title="Grids objects placed in.">gridTop</a>->addWidget( <a class="code" href="classAlertDialog.html#a7e81fc1c47cde96ca54033cded01d749" title="Label which shows alert icon.">alertIconLabel</a>, 0, 1, Qt::AlignRight ); <a name="l00063"></a>00063 <a name="l00064"></a>00064 <a class="code" href="classAlertDialog.html#aadf46bd7937fc62fcef201f284d4fdca">gridBottom</a> = <span class="keyword">new</span> QGridLayout( <a class="code" href="classAlertDialog.html#a8fd835bc05b07fd4fb34a8d4179493e4">bottomFrame</a>, 1, 1, 0); <a name="l00065"></a>00065 <a class="code" href="classAlertDialog.html#aadf46bd7937fc62fcef201f284d4fdca">gridBottom</a>->addWidget( <a class="code" href="classAlertDialog.html#ad9869083a0e1c6cf511d20af4491f494" title="Ok button.">okButton</a>, 0, 0 ); <a name="l00066"></a>00066 <a name="l00067"></a>00067 <a class="code" href="classAlertDialog.html#ab698c37a23a4466f30be6a10a682bb1e">gridFull</a> = <span class="keyword">new</span> QGridLayout( <span class="keyword">this</span>, 3, 1, 0); <a name="l00068"></a>00068 <a class="code" href="classAlertDialog.html#ab698c37a23a4466f30be6a10a682bb1e">gridFull</a>->addWidget( <a class="code" href="classAlertDialog.html#a55fa42eed5e59028bc37621e50845e30" title="Top and bottom frames.">topFrame</a>, 0, 0); <a name="l00069"></a>00069 <a class="code" href="classAlertDialog.html#ab698c37a23a4466f30be6a10a682bb1e">gridFull</a>->addWidget( <a class="code" href="classAlertDialog.html#aeed97a15a81fdf31bd6158dc09be45f2" title="Description displayed in window.">descriptionText</a>, 1, 0); <a name="l00070"></a>00070 <a class="code" href="classAlertDialog.html#ab698c37a23a4466f30be6a10a682bb1e">gridFull</a>->addWidget( <a class="code" href="classAlertDialog.html#a8fd835bc05b07fd4fb34a8d4179493e4">bottomFrame</a>, 2, 0); <a name="l00071"></a>00071 <a name="l00072"></a>00072 <a class="code" href="classAlertDialog.html#ab698c37a23a4466f30be6a10a682bb1e">gridFull</a>->setRowStretch( 1, 1 ); <a name="l00073"></a>00073 <a class="code" href="classAlertDialog.html#ab698c37a23a4466f30be6a10a682bb1e">gridFull</a>->setResizeMode( QLayout::FreeResize ); <a name="l00074"></a>00074 <a class="code" href="classAlertDialog.html#ab698c37a23a4466f30be6a10a682bb1e">gridFull</a>->setMargin(<a class="code" href="config_8h.html#a07d364596a27705c900f07340515d5db">WIDGET_SPACING</a>); <a name="l00075"></a>00075 <a class="code" href="classAlertDialog.html#ab698c37a23a4466f30be6a10a682bb1e">gridFull</a>->setSpacing(<a class="code" href="config_8h.html#a07d364596a27705c900f07340515d5db">WIDGET_SPACING</a>); <a name="l00076"></a>00076 <a name="l00077"></a>00077 setMinimumWidth(300); <a name="l00078"></a>00078 setMaximumWidth(300); <a name="l00079"></a>00079 <span class="comment">//-------------------------------</span> <a name="l00080"></a>00080 <span class="comment">//setup window title bar</span> <a name="l00081"></a>00081 setCaption( message ); <a name="l00082"></a>00082 <span class="comment">//-------------------------------</span> <a name="l00083"></a>00083 <span class="comment">//set window to not be resizeable</span> <a name="l00084"></a>00084 this->show(); <a name="l00085"></a>00085 setFixedSize(size()); <a name="l00086"></a>00086 <span class="comment">//-------------------------------</span> <a name="l00087"></a>00087 } <a name="l00088"></a>00088 <span class="comment">//==============================================</span> <a name="l00089"></a><a class="code" href="classAlertDialog.html#a5ea8838b691df53710d053c592ce2c7c">00089</a> <a class="code" href="classAlertDialog.html#a5ea8838b691df53710d053c592ce2c7c" title="Destructor.">AlertDialog::~AlertDialog</a>() <a name="l00090"></a>00090 { <a name="l00091"></a>00091 <span class="keyword">delete</span> <a class="code" href="classAlertDialog.html#ae67fea12ccbc008bb58b6a50ffd5a34a" title="Alert icon.">alertIcon</a>; <a name="l00092"></a>00092 } <a name="l00093"></a>00093 <span class="comment">//==============================================</span> </pre></div></div> <hr size="1"/><address style="text-align: right;"><small>Generated by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.2 </small></address> </body> </html>