Salome HOME
d1bc561dd2ecd22b476dbfe48abe2b5180d7f30c
[modules/gui.git] / src / SalomeApp / SalomeApp_ExitDlg.cxx
1 // Copyright (C) 2007-2022  CEA/DEN, EDF R&D, OPEN CASCADE
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, or (at your option) any later version.
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
20 // File:      SalomeApp_ExitDlg.cxx
21 // Author:    Margarita KARPUNINA, Open CASCADE S.A.S.
22 //
23 #include "SalomeApp_ExitDlg.h"
24 #include "KernelBasis.hxx"
25
26 #include <QLabel> 
27 #include <QVBoxLayout> 
28 #include <QHBoxLayout> 
29 #include <QGridLayout> 
30 #include <QPushButton>
31 #include <QMessageBox>
32 #include <QCheckBox>
33
34 /*!
35  * \brief creates a Exit dialog box
36  * \param parent a parent widget
37  * \param modal bool argument, if true the dialog box is a modal dialog box
38  * \param f style flags
39  */
40 SalomeApp_ExitDlg::SalomeApp_ExitDlg( QWidget* parent )
41   : QDialog( parent )
42 {
43   setModal( true );
44   setWindowTitle( tr( "INF_DESK_EXIT" ) );
45
46   QVBoxLayout* m_vbL = new QVBoxLayout( this );
47   m_vbL->setMargin( 11 );
48   m_vbL->setSpacing( 6 );
49
50   QLabel* m_lIcon = new QLabel( this );
51   QPixmap pm = QMessageBox::standardIcon( QMessageBox::Question );
52   m_lIcon->setPixmap( pm );
53   m_lIcon->setScaledContents( false );
54   m_lIcon->setAlignment( Qt::AlignCenter );
55
56   QLabel* m_lDescr = new QLabel( this );
57   m_lDescr->setText( tr( "QUE_DESK_EXIT" ) );
58   m_lDescr->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
59
60   myServersShutdown = new QCheckBox( tr( "SHUTDOWN_SERVERS" ), this );
61   myServersShutdown->setChecked( true );
62   myServersShutdown->setVisible( !getSSLMode() );
63   
64   QVBoxLayout* m_vl1 = new QVBoxLayout();
65   m_vl1->setMargin( 10 ); m_vl1->setSpacing( 16 );
66   m_vl1->addWidget( m_lDescr );
67   m_vl1->addWidget( myServersShutdown );
68
69   QHBoxLayout* m_hl1 = new QHBoxLayout();
70   m_hl1->setMargin( 0 ); m_hl1->setSpacing( 6 );
71   m_hl1->addWidget( m_lIcon );
72   m_hl1->addStretch(); 
73   m_hl1->addLayout( m_vl1 );
74   m_hl1->addStretch();
75
76   QPushButton* m_pbOk     = new QPushButton( tr( "BUT_OK" ),     this );
77   QPushButton* m_pbCancel = new QPushButton( tr( "BUT_CANCEL" ), this );
78
79   QGridLayout* m_hl2 = new QGridLayout();
80   m_hl2->setMargin( 0 ); m_hl2->setSpacing( 6 );
81   m_hl2->addWidget( m_pbOk, 0, 0 );
82   m_hl2->setColumnStretch( 1, 5 );
83   m_hl2->addWidget( m_pbCancel, 0, 2 );
84   
85   m_vbL->addStretch();
86   m_vbL->addLayout( m_hl1 );
87   m_vbL->addStretch();
88   m_vbL->addLayout( m_hl2 );
89
90   connect( m_pbOk,     SIGNAL( clicked() ), this, SLOT( accept() ) );
91   connect( m_pbCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
92 }
93
94 /*!
95  * \brief Destructor
96  */
97 SalomeApp_ExitDlg::~SalomeApp_ExitDlg()
98 {
99 }
100
101 /*!
102  * \brief get the check box status
103  */
104 bool SalomeApp_ExitDlg::isServersShutdown()
105 {
106   return myServersShutdown->isChecked();
107 }
108