Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/gui.git] / src / SalomeApp / SalomeApp_ExitDlg.cxx
1 // Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
2 // 
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either 
6 // version 2.1 of the License.
7 // 
8 // This library is distributed in the hope that it will be useful 
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public  
14 // License along with this library; if not, write to the Free Software 
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // File:      SalomeApp_ExitDlg.cxx
20 // Author:    Margarita KARPUNINA, Open CASCADE S.A.S.
21 //
22
23 #include "SalomeApp_ExitDlg.h"
24
25 #include <qlabel.h> 
26 #include <qlayout.h> 
27 #include <qpushbutton.h>
28 #include <qmessagebox.h>
29 #include <qcheckbox.h>
30
31 /*!
32  * \brief creates a Exit dialog box
33  * \param parent a parent widget
34  * \param modal bool argument, if true the dialog box is a modal dialog box
35  * \param f style flags
36  */
37 SalomeApp_ExitDlg::SalomeApp_ExitDlg( QWidget* parent )
38   : QDialog( parent, "SalomeApp_ExitDlg", true )
39 {
40   setSizeGripEnabled( true );
41   setCaption( tr( "INF_DESK_EXIT" ) );
42
43   QVBoxLayout* m_vbL = new QVBoxLayout( this );
44   m_vbL->setMargin( 11 );
45   m_vbL->setSpacing( 6 );
46
47   QLabel* m_lIcon = new QLabel( this, "m_lDescr" );
48   QPixmap pm = QMessageBox::standardIcon( QMessageBox::Question );
49   m_lIcon->setPixmap( pm );
50   m_lIcon->setScaledContents( false );
51   m_lIcon->setAlignment( Qt::AlignCenter );
52
53   QLabel* m_lDescr = new QLabel (this, "m_lDescr");
54   m_lDescr->setText ( tr ("QUE_DESK_EXIT") );
55   m_lDescr->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
56
57   myServersShutdown = new QCheckBox( tr("SHUTDOWN_SERVERS"), this );
58   myServersShutdown->setChecked(true);
59   
60   QVBoxLayout* m_vl1 = new QVBoxLayout();
61   m_vl1->setMargin( 10 ); m_vl1->setSpacing( 16 );
62   m_vl1->addWidget( m_lDescr );
63   m_vl1->addWidget( myServersShutdown );
64
65   QHBoxLayout* m_hl1 = new QHBoxLayout();
66   m_hl1->setMargin( 0 ); m_hl1->setSpacing( 6 );
67   m_hl1->addWidget( m_lIcon );
68   m_hl1->addStretch(); 
69   m_hl1->addLayout( m_vl1 );
70   m_hl1->addStretch();
71
72   QPushButton* m_pbOk     = new QPushButton( tr( "BUT_OK" ),     this );
73   QPushButton* m_pbCancel = new QPushButton( tr( "BUT_CANCEL" ), this );
74
75   QGridLayout* m_hl2 = new QGridLayout();
76   m_hl2->setMargin( 0 ); m_hl2->setSpacing( 6 );
77   m_hl2->addWidget( m_pbOk, 0, 0 );
78   m_hl2->setColStretch( 1, 5 );
79   m_hl2->addWidget( m_pbCancel, 0, 2 );
80   
81   m_vbL->addStretch();
82   m_vbL->addLayout( m_hl1 );
83   m_vbL->addStretch();
84   m_vbL->addLayout( m_hl2 );
85
86   connect( m_pbOk,     SIGNAL( clicked() ), this, SLOT( accept() ) );
87   connect( m_pbCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
88 }
89
90 /*!
91  * \brief Destructor
92  */
93 SalomeApp_ExitDlg::~SalomeApp_ExitDlg()
94 {
95 }
96
97 /*!
98  * \brief get the check box status
99  */
100 bool SalomeApp_ExitDlg::isServersShutdown()
101 {
102   return myServersShutdown->isChecked();
103 }
104