Salome HOME
Merge remote-tracking branch 'origin/BR_SHP_FORMAT2' into BR_LAND_COVER_MAP
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ExportLandCoverMapDlg.cxx
1 // Copyright (C) 2014-2015  EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
6 //
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10 // Lesser General Public License for more details.
11 //
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
15 //
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
17 //
18
19 #include "HYDROGUI_ExportLandCoverMapDlg.h"
20
21 #include <SUIT_MessageBox.h>
22
23 #include <QCheckBox>
24 #include <QVBoxLayout>
25 #include <QComboBox>
26
27 HYDROGUI_ExportLandCoverMapDlg::HYDROGUI_ExportLandCoverMapDlg( QWidget* theParent, const QStringList& theAttrItems )
28   : QtxDialog( theParent, false, true, QtxDialog::OKCancel )
29 {
30   setWindowTitle( tr( "EXPORT_LANDCOVERMAP" ) );
31   setButtonPosition( Left, OK );
32   setButtonPosition( Right, Cancel );
33
34   myAttrCheckBox = new QCheckBox( tr( "WRITE_ST_AS_ATTRS_TO_DBF" ), mainFrame() );
35   myAttrCheckBox->setChecked(false);
36   myAvFields = new QComboBox( mainFrame() );
37   myAvFields->setEnabled(false);
38   myAvFields->addItems( theAttrItems );
39
40   QGridLayout* aLayout = new QGridLayout( mainFrame() );
41   aLayout->setMargin( 5 );
42   aLayout->setSpacing( 5 );
43   aLayout->addWidget( myAttrCheckBox, 0, 0 );
44   aLayout->addWidget( myAvFields, 1, 0, 1, 2 );
45
46   setMinimumSize( 300, 100 );
47
48   connect( myAttrCheckBox, SIGNAL(clicked(bool)), this, SLOT(onAttrCBChecked(bool)));
49
50 }
51
52 HYDROGUI_ExportLandCoverMapDlg::~HYDROGUI_ExportLandCoverMapDlg()
53 {
54 }
55
56 void HYDROGUI_ExportLandCoverMapDlg::onAttrCBChecked( bool theState )
57 {
58   if (theState)
59     myAvFields->setEnabled(true);
60   else
61     myAvFields->setEnabled(false);
62 }
63
64 QString HYDROGUI_ExportLandCoverMapDlg::getCurrentItem() const
65 {
66   return myAvFields->currentText();
67 }
68
69 bool HYDROGUI_ExportLandCoverMapDlg::getAttrCheckBoxState()
70 {
71   return myAttrCheckBox->isChecked();
72 }