Salome HOME
Empty list of objects to delete (bug 19263) fix
[modules/geom.git] / src / GEOMToolsGUI / GEOMToolsGUI_DeleteDlg.cxx
1 // GEOM GEOMGUI : GUI for Geometry component
2 //
3 // Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 // File   : GEOMToolsGUI_DeleteDlg.cxx
23 // Author : Dmitry Matveitchev, Open CASCADE S.A.S.
24 //
25
26 #include "GEOMToolsGUI_DeleteDlg.h"
27
28 #include <QLabel>
29 #include <QPushButton>
30 #include <QTextBrowser>
31 #include <QStringList>
32 #include <QGridLayout>
33
34 /*!
35   \brief Constructor.
36   \param parent parent widget
37 */
38 GEOMToolsGUI_DeleteDlg::GEOMToolsGUI_DeleteDlg( QWidget* parent, const QStringList& objects )
39 : QDialog( parent )
40 {
41   setModal( true );
42   setObjectName( "GEOMToolsGUI_DeleteDlg" );
43
44   setWindowTitle( tr( "GEOM_DELETE_OBJECTS" ) );
45   setSizeGripEnabled( true );
46
47   QGridLayout* topLayout = new QGridLayout( this );
48
49   topLayout->setSpacing( 6 );
50   topLayout->setMargin( 11 );
51
52   QLabel* lab = new QLabel( tr( "GEOM_REALLY_DELETE" ).arg( objects.count() ), this );
53
54   QTextBrowser* viewer = new QTextBrowser( this );
55   viewer->setText( QString( "-%1" ).arg( objects.join( "<br> -" ) ) );
56
57   QPushButton* buttonYes = new QPushButton( tr( "GEOM_BUT_YES" ), this );
58   QPushButton* buttonNo  = new QPushButton( tr( "GEOM_BUT_NO" ),  this );
59
60   topLayout->addWidget( lab,       0, 0, 1, 3 );
61   topLayout->addWidget( viewer,    1, 0, 1, 3 );
62   topLayout->addWidget( buttonYes, 2, 0 );
63   topLayout->addWidget( buttonNo,  2, 2 );
64
65   /* signals and slots connections */
66   connect( buttonYes, SIGNAL( clicked() ), this, SLOT( accept() ) );
67   connect( buttonNo,  SIGNAL( clicked() ), this, SLOT( reject() ) );
68 }
69
70 GEOMToolsGUI_DeleteDlg::~GEOMToolsGUI_DeleteDlg()
71 {
72 }
73
74
75