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.
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.
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
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #include <HYDROGUI_ExportSinusXDlg.h>
20 #include <HYDROGUI_Module.h>
21 #include <QtxDoubleSpinBox.h>
24 #include <QStackedWidget>
25 #include <QPushButton>
26 #include "HYDROGUI_Module.h"
27 #include <CAM_Application.h>
28 #include <SUIT_Desktop.h>
29 #include <QListWidget.h>
32 HYDROGUI_ExportSinusXDlg::HYDROGUI_ExportSinusXDlg( HYDROGUI_Module* theModule, const QString& theTitle )
33 : HYDROGUI_InputPanel( theModule, theTitle, false )
35 QFrame* aFrame = new QFrame( mainFrame() );
36 addWidget( aFrame, 1 );
38 QGridLayout* aLayout = new QGridLayout( aFrame );
39 aLayout->setMargin( 5 );
40 aLayout->setSpacing( 5 );
42 myQListW = new QListWidget(mainFrame());
44 myQListW->setSelectionMode(QAbstractItemView::ExtendedSelection);
45 aLayout->addWidget(myQListW, 0, 0, 1, 2);
47 myIncludeBtn = new QPushButton( tr( "INCLUDE" ) );
48 myExcludeBtn = new QPushButton( tr( "EXCLUDE" ) );
49 aLayout->addWidget(myIncludeBtn, 1, 0 );
50 aLayout->addWidget(myExcludeBtn, 1, 1 );
52 myExport = new QPushButton( tr( "EXPORT" ) );
54 QHBoxLayout* aBtnsLayout = qobject_cast<QHBoxLayout*>(buttonFrame()->layout());
55 aBtnsLayout->addWidget( myExport, 0 );
56 aBtnsLayout->addWidget( myCancel, 0 );
57 aBtnsLayout->addStretch( 1 );
58 aBtnsLayout->addWidget( myHelp, 0 );
61 //connect( myExport, SIGNAL( clicked() ), SLOT( onExport() ) );
62 connect( myIncludeBtn, SIGNAL( clicked() ), SIGNAL( IncludeItems() ) );
63 connect( myExcludeBtn, SIGNAL( clicked() ), SIGNAL( ExcludeItems() ) );
69 HYDROGUI_ExportSinusXDlg::~HYDROGUI_ExportSinusXDlg()
73 void HYDROGUI_ExportSinusXDlg::addItems(const HYDROData_SequenceOfObjects& theSelectedItems)
75 for (int i = 1; i <= theSelectedItems.Size(); i++)
77 QString anEntName = theSelectedItems.Value(i)->GetName();
78 if (!myEnt2WIMap.contains(anEntName))
80 QListWidgetItem* aWI = new QListWidgetItem();
81 aWI->setText(anEntName);
82 myEnt2WIMap[anEntName] = aWI; ///TODO free this map
83 myQListW->addItem(aWI);
89 void HYDROGUI_ExportSinusXDlg::RemoveItems()
91 for (int i = 0; i < myQListW->selectedItems().size(); i++)
93 QListWidgetItem* anItem = myQListW->selectedItems()[i];
94 QMap<QString, QListWidgetItem*>::iterator aMapIt;
95 for (aMapIt = myEnt2WIMap.begin(); aMapIt != myEnt2WIMap.end(); ++aMapIt)
96 if (aMapIt.value() == anItem)
98 aMapIt = myEnt2WIMap.erase(aMapIt);
100 //myQListW->takeItem(anItem);