Sophie

Sophie

distrib > Mandriva > current > x86_64 > by-pkgid > 4272c97b1af3db3f39a3b697bcba7e48 > files > 1477

albumshaper-2.1-7mdv2010.1.x86_64.rpm

<!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: questionDialog.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&nbsp;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&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
<h1>questionDialog.cpp</h1><a href="questionDialog_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 &lt;qdialog.h&gt;</span>
<a name="l00013"></a>00013 <span class="preprocessor">#include &lt;qlayout.h&gt;</span>
<a name="l00014"></a>00014 <span class="preprocessor">#include &lt;qlabel.h&gt;</span>
<a name="l00015"></a>00015 <span class="preprocessor">#include &lt;qtextedit.h&gt;</span>
<a name="l00016"></a>00016 <span class="preprocessor">#include &lt;qfont.h&gt;</span>
<a name="l00017"></a>00017 <span class="preprocessor">#include &lt;qpushbutton.h&gt;</span>
<a name="l00018"></a>00018 <span class="preprocessor">#include &lt;qpixmap.h&gt;</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 &quot;<a class="code" href="questionDialog_8h.html">questionDialog.h</a>&quot;</span>
<a name="l00022"></a>00022 <span class="preprocessor">#include &quot;../../config.h&quot;</span>
<a name="l00023"></a>00023 
<a name="l00024"></a>00024 <span class="comment">//==============================================</span>
<a name="l00025"></a><a class="code" href="classQuestionDialog.html#a780ed48e9f32a8cc419c7f0ef6cef268">00025</a> <a class="code" href="classQuestionDialog.html#a780ed48e9f32a8cc419c7f0ef6cef268" title="Basic constructor.">QuestionDialog::QuestionDialog</a>( QString question,
<a name="l00026"></a>00026                                               QString message,
<a name="l00027"></a>00027                                               QString questionIconName,
<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="classQuestionDialog.html#ae71f25f7e07f46e7c950489c5b79f4c9" 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="classQuestionDialog.html#ae6eb096d3cf375665180773ebbecc211" title="Question displayed in window.">questionText</a> = <span class="keyword">new</span> <a class="code" href="classQLabel.html">QLabel</a>( <a class="code" href="classQuestionDialog.html#ae71f25f7e07f46e7c950489c5b79f4c9" title="Top and bottom frames.">topFrame</a> );
<a name="l00037"></a>00037   <a class="code" href="classQuestionDialog.html#ae6eb096d3cf375665180773ebbecc211" title="Question displayed in window.">questionText</a>-&gt;setText( question );
<a name="l00038"></a>00038 
<a name="l00039"></a>00039   QFont questionFont = <a class="code" href="classQuestionDialog.html#ae6eb096d3cf375665180773ebbecc211" title="Question displayed in window.">questionText</a>-&gt;font();
<a name="l00040"></a>00040   questionFont.setWeight(QFont::Bold);
<a name="l00041"></a>00041   <a class="code" href="classQuestionDialog.html#ae6eb096d3cf375665180773ebbecc211" title="Question displayed in window.">questionText</a>-&gt;setFont( questionFont );
<a name="l00042"></a>00042 
<a name="l00043"></a>00043   <a class="code" href="classQuestionDialog.html#ae0b0f1b855bbc45d711884dabec3a16e" title="Question icon.">questionIcon</a> = <span class="keyword">new</span> QPixmap(QString(<a class="code" href="config_8cpp.html#a59e02362a9a29a755712dc830a3eb513">IMAGE_PATH</a>)+questionIconName);
<a name="l00044"></a>00044   <a class="code" href="classQuestionDialog.html#abdf466aaa74797c0797e20c7fa8b92aa" title="Label which shows question icon.">questionIconLabel</a> = <span class="keyword">new</span> <a class="code" href="classQLabel.html">QLabel</a>( <a class="code" href="classQuestionDialog.html#ae71f25f7e07f46e7c950489c5b79f4c9" title="Top and bottom frames.">topFrame</a> );
<a name="l00045"></a>00045   <a class="code" href="classQuestionDialog.html#abdf466aaa74797c0797e20c7fa8b92aa" title="Label which shows question icon.">questionIconLabel</a>-&gt;setPixmap( *<a class="code" href="classQuestionDialog.html#ae0b0f1b855bbc45d711884dabec3a16e" title="Question icon.">questionIcon</a> );
<a name="l00046"></a>00046 
<a name="l00047"></a>00047   <a class="code" href="classQuestionDialog.html#a7794bebfc7ffb1a73b7915979db17487" title="Message displayed in window.">messageText</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="classQuestionDialog.html#a7794bebfc7ffb1a73b7915979db17487" title="Message displayed in window.">messageText</a>-&gt;setReadOnly(<span class="keyword">true</span>);
<a name="l00049"></a>00049   <a class="code" href="classQuestionDialog.html#a7794bebfc7ffb1a73b7915979db17487" title="Message displayed in window.">messageText</a>-&gt;setText( message );
<a name="l00050"></a>00050   
<a name="l00051"></a>00051   
<a name="l00052"></a>00052   <a class="code" href="classQuestionDialog.html#a6bded3756a3b3f4e52207579d97d5443">bottomFrame</a> = <span class="keyword">new</span> <a class="code" href="classQFrame.html">QFrame</a>( <span class="keyword">this</span> );
<a name="l00053"></a>00053 
<a name="l00054"></a>00054   <a class="code" href="classQuestionDialog.html#ace32e486cdc1127d24d61c581e2d3dc1" title="Ok button.">okButton</a> = <span class="keyword">new</span> QPushButton( tr(<span class="stringliteral">&quot;Yes&quot;</span>), <a class="code" href="classQuestionDialog.html#a6bded3756a3b3f4e52207579d97d5443">bottomFrame</a> );
<a name="l00055"></a>00055   <a class="code" href="classQuestionDialog.html#ace32e486cdc1127d24d61c581e2d3dc1" title="Ok button.">okButton</a>-&gt;setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
<a name="l00056"></a>00056   <a class="code" href="classQuestionDialog.html#ace32e486cdc1127d24d61c581e2d3dc1" title="Ok button.">okButton</a>-&gt;setDefault(<span class="keyword">true</span>);
<a name="l00057"></a>00057   <a class="code" href="classQuestionDialog.html#ace32e486cdc1127d24d61c581e2d3dc1" title="Ok button.">okButton</a>-&gt;setFocus();
<a name="l00058"></a>00058 
<a name="l00059"></a>00059   connect( <a class="code" href="classQuestionDialog.html#ace32e486cdc1127d24d61c581e2d3dc1" title="Ok button.">okButton</a>, SIGNAL(clicked()), SLOT(accept()) );
<a name="l00060"></a>00060 
<a name="l00061"></a>00061   <a class="code" href="classQuestionDialog.html#a03954dc297b33dff234f9ce254a97e12" title="Cancel button.">cancelButton</a> = <span class="keyword">new</span> QPushButton( tr(<span class="stringliteral">&quot;No&quot;</span>), <a class="code" href="classQuestionDialog.html#a6bded3756a3b3f4e52207579d97d5443">bottomFrame</a> );
<a name="l00062"></a>00062   <a class="code" href="classQuestionDialog.html#a03954dc297b33dff234f9ce254a97e12" title="Cancel button.">cancelButton</a>-&gt;setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
<a name="l00063"></a>00063   connect( <a class="code" href="classQuestionDialog.html#a03954dc297b33dff234f9ce254a97e12" title="Cancel button.">cancelButton</a>, SIGNAL(clicked()), SLOT(reject()) );
<a name="l00064"></a>00064   <span class="comment">//-------------------------------</span>
<a name="l00065"></a>00065   <span class="comment">//create grid and place widgets</span>
<a name="l00066"></a>00066   <a class="code" href="classQuestionDialog.html#a66adc6c635d8d62b08253c98c2ca28d4" title="Grids objects placed in.">gridTop</a>     = <span class="keyword">new</span> QGridLayout( <a class="code" href="classQuestionDialog.html#ae71f25f7e07f46e7c950489c5b79f4c9" title="Top and bottom frames.">topFrame</a>, 1, 2, 0);
<a name="l00067"></a>00067   <a class="code" href="classQuestionDialog.html#a66adc6c635d8d62b08253c98c2ca28d4" title="Grids objects placed in.">gridTop</a>-&gt;addWidget( <a class="code" href="classQuestionDialog.html#ae6eb096d3cf375665180773ebbecc211" title="Question displayed in window.">questionText</a>, 0, 0 );
<a name="l00068"></a>00068   <a class="code" href="classQuestionDialog.html#a66adc6c635d8d62b08253c98c2ca28d4" title="Grids objects placed in.">gridTop</a>-&gt;addWidget( <a class="code" href="classQuestionDialog.html#abdf466aaa74797c0797e20c7fa8b92aa" title="Label which shows question icon.">questionIconLabel</a>, 0, 1, Qt::AlignRight );
<a name="l00069"></a>00069 
<a name="l00070"></a>00070   <a class="code" href="classQuestionDialog.html#a8186cd4978482e24b1aca449431eb68a">gridBottom</a>  = <span class="keyword">new</span> QGridLayout( <a class="code" href="classQuestionDialog.html#a6bded3756a3b3f4e52207579d97d5443">bottomFrame</a>, 1, 2, 0);
<a name="l00071"></a>00071   <a class="code" href="classQuestionDialog.html#a8186cd4978482e24b1aca449431eb68a">gridBottom</a>-&gt;addWidget( <a class="code" href="classQuestionDialog.html#ace32e486cdc1127d24d61c581e2d3dc1" title="Ok button.">okButton</a>, 0, 0 );
<a name="l00072"></a>00072   <a class="code" href="classQuestionDialog.html#a8186cd4978482e24b1aca449431eb68a">gridBottom</a>-&gt;addWidget( <a class="code" href="classQuestionDialog.html#a03954dc297b33dff234f9ce254a97e12" title="Cancel button.">cancelButton</a>, 0, 1);
<a name="l00073"></a>00073 
<a name="l00074"></a>00074   <a class="code" href="classQuestionDialog.html#a7ae3b01bd0ed0bfb97f748c979a01dad">gridFull</a>    = <span class="keyword">new</span> QGridLayout( <span class="keyword">this</span>, 3, 1, 0);
<a name="l00075"></a>00075   <a class="code" href="classQuestionDialog.html#a7ae3b01bd0ed0bfb97f748c979a01dad">gridFull</a>-&gt;addWidget( <a class="code" href="classQuestionDialog.html#ae71f25f7e07f46e7c950489c5b79f4c9" title="Top and bottom frames.">topFrame</a>, 0, 0);
<a name="l00076"></a>00076   <a class="code" href="classQuestionDialog.html#a7ae3b01bd0ed0bfb97f748c979a01dad">gridFull</a>-&gt;addWidget( <a class="code" href="classQuestionDialog.html#a7794bebfc7ffb1a73b7915979db17487" title="Message displayed in window.">messageText</a>, 1, 0);
<a name="l00077"></a>00077   <a class="code" href="classQuestionDialog.html#a7ae3b01bd0ed0bfb97f748c979a01dad">gridFull</a>-&gt;addWidget( <a class="code" href="classQuestionDialog.html#a6bded3756a3b3f4e52207579d97d5443">bottomFrame</a>, 2, 0);
<a name="l00078"></a>00078 
<a name="l00079"></a>00079   <a class="code" href="classQuestionDialog.html#a7ae3b01bd0ed0bfb97f748c979a01dad">gridFull</a>-&gt;setRowStretch( 1, 1 );
<a name="l00080"></a>00080   <a class="code" href="classQuestionDialog.html#a7ae3b01bd0ed0bfb97f748c979a01dad">gridFull</a>-&gt;setResizeMode( QLayout::FreeResize );
<a name="l00081"></a>00081   <a class="code" href="classQuestionDialog.html#a7ae3b01bd0ed0bfb97f748c979a01dad">gridFull</a>-&gt;setMargin(<a class="code" href="config_8h.html#a07d364596a27705c900f07340515d5db">WIDGET_SPACING</a>);
<a name="l00082"></a>00082   <a class="code" href="classQuestionDialog.html#a7ae3b01bd0ed0bfb97f748c979a01dad">gridFull</a>-&gt;setSpacing(<a class="code" href="config_8h.html#a07d364596a27705c900f07340515d5db">WIDGET_SPACING</a>);
<a name="l00083"></a>00083 
<a name="l00084"></a>00084   <span class="comment">//-------------------------------</span>
<a name="l00085"></a>00085   <span class="comment">//setup window title bar</span>
<a name="l00086"></a>00086   setCaption( question );
<a name="l00087"></a>00087   <span class="comment">//-------------------------------</span>
<a name="l00088"></a>00088   <span class="comment">//set window to not be resizeable</span>
<a name="l00089"></a>00089   setMinimumWidth(300);
<a name="l00090"></a>00090   this-&gt;show();
<a name="l00091"></a>00091   setFixedSize(size());
<a name="l00092"></a>00092   <span class="comment">//-------------------------------</span>
<a name="l00093"></a>00093 }
<a name="l00094"></a>00094 <span class="comment">//==============================================</span>
<a name="l00095"></a><a class="code" href="classQuestionDialog.html#afcaa4a33e727449cd8be02c6cfa25547">00095</a> <a class="code" href="classQuestionDialog.html#afcaa4a33e727449cd8be02c6cfa25547" title="Destructor.">QuestionDialog::~QuestionDialog</a>()
<a name="l00096"></a>00096 {
<a name="l00097"></a>00097   <span class="keyword">delete</span> <a class="code" href="classQuestionDialog.html#ae0b0f1b855bbc45d711884dabec3a16e" title="Question icon.">questionIcon</a>;
<a name="l00098"></a>00098 }
<a name="l00099"></a>00099 <span class="comment">//==============================================</span>
</pre></div></div>
<hr size="1"/><address style="text-align: right;"><small>Generated by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.2 </small></address>
</body>
</html>