]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
sinusX p.6 // Export // GUI Part // moving to new listbox
authorisn <isn@opencascade.com>
Thu, 18 Jun 2015 12:21:07 +0000 (15:21 +0300)
committerisn <isn@opencascade.com>
Thu, 18 Jun 2015 12:41:45 +0000 (15:41 +0300)
src/HYDROGUI/HYDROGUI_ExportSinusXDlg.cxx
src/HYDROGUI/HYDROGUI_ExportSinusXDlg.h
src/HYDROGUI/HYDROGUI_ExportSinusXOp.cxx
src/HYDROGUI/HYDROGUI_ExportSinusXOp.h

index 49f6711dd77ce88583c445ae5b0274899aef0d83..e0da77a5d326fc6365e9e9df57481547dc98cd1b 100644 (file)
@@ -27,6 +27,7 @@
 #include <CAM_Application.h>
 #include <SUIT_Desktop.h>
 #include <QListWidget.h>
+#include <HYDROGUI_ObjListBox.h>
 
 
 HYDROGUI_ExportSinusXDlg::HYDROGUI_ExportSinusXDlg( HYDROGUI_Module* theModule, const QString& theTitle )
@@ -39,30 +40,23 @@ HYDROGUI_ExportSinusXDlg::HYDROGUI_ExportSinusXDlg( HYDROGUI_Module* theModule,
   aLayout->setMargin( 5 );
   aLayout->setSpacing( 5 );
 
-  myQListW = new QListWidget(mainFrame());
+  QList<ObjectKind> anAllowedTypesToSave;
+  anAllowedTypesToSave.append(KIND_BATHYMETRY);   
+  anAllowedTypesToSave.append(KIND_POLYLINEXY);
+  anAllowedTypesToSave.append(KIND_PROFILE);
 
-  myQListW->setSelectionMode(QAbstractItemView::ExtendedSelection);
-  aLayout->addWidget(myQListW, 0, 0, 1, 2);
+  myList = new HYDROGUI_ObjListBox( theModule, tr( "OBJECT_TO_EXPORT" ), anAllowedTypesToSave, mainFrame() );
+  aLayout->addWidget( myList, 0, 0 );
 
-  myIncludeBtn = new QPushButton( tr( "INCLUDE" ) );
-  myExcludeBtn = new QPushButton( tr( "EXCLUDE" ) );
-  aLayout->addWidget(myIncludeBtn, 1, 0 );
-  aLayout->addWidget(myExcludeBtn, 1, 1 );
-
-  myExport = new QPushButton( tr( "EXPORT" ) );
+  myExportBtn = new QPushButton( tr( "EXPORT" ) );
 
   QHBoxLayout* aBtnsLayout = qobject_cast<QHBoxLayout*>(buttonFrame()->layout());
-  aBtnsLayout->addWidget( myExport, 0 );
+  aBtnsLayout->addWidget( myExportBtn, 0 );
   aBtnsLayout->addWidget( myCancel, 0 );
   aBtnsLayout->addStretch( 1 );
   aBtnsLayout->addWidget( myHelp, 0 );
-  
-  //TODO connect 
-  //connect( myExport,  SIGNAL( clicked() ), SLOT( onExport() ) );
-  connect( myIncludeBtn, SIGNAL( clicked() ), SIGNAL( IncludeItems() ) );
-  connect( myExcludeBtn, SIGNAL( clicked() ), SIGNAL( ExcludeItems() ) );
 
-  myEnt2WIMap.clear();
+  connect( myExportBtn, SIGNAL( clicked() ), SIGNAL( ExportItems() ) );
 
 }
 
@@ -70,38 +64,8 @@ HYDROGUI_ExportSinusXDlg::~HYDROGUI_ExportSinusXDlg()
 {
 }
 
-void HYDROGUI_ExportSinusXDlg::addItems(const HYDROData_SequenceOfObjects& theSelectedItems)
-{
-  for (int i = 1; i <= theSelectedItems.Size(); i++)
-  {
-    QString anEntName = theSelectedItems.Value(i)->GetName();
-    if (!myEnt2WIMap.contains(anEntName))
-    {
-      QListWidgetItem* aWI = new QListWidgetItem();
-      aWI->setText(anEntName);
-      myEnt2WIMap[anEntName] = aWI; ///TODO free this map
-      myQListW->addItem(aWI);
-    }
-  }
-  myQListW->update();
-}
 
-void HYDROGUI_ExportSinusXDlg::RemoveItems()
+HYDROData_SequenceOfObjects HYDROGUI_ExportSinusXDlg::GetSelectedEntities()
 {
-  for (int i = 0; i < myQListW->selectedItems().size(); i++)
-  {
-    QListWidgetItem* anItem = myQListW->selectedItems()[i];
-    QMap<QString, QListWidgetItem*>::iterator aMapIt;
-    for (aMapIt = myEnt2WIMap.begin(); aMapIt != myEnt2WIMap.end(); ++aMapIt)
-      if (aMapIt.value() == anItem)
-      {
-        aMapIt = myEnt2WIMap.erase(aMapIt);
-        delete anItem;
-        //myQListW->takeItem(anItem);
-      }
-      else
-        ++aMapIt;
-  }
-  myQListW->update();
-}
-
+  return myList->selectedObjects();
+}
\ No newline at end of file
index 648c0c087065ad4a4940e015411e63925fef8743..72e294a51b316b69c7a4dbc99adffba4da788fb8 100644 (file)
@@ -16,8 +16,8 @@
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
-#ifndef HYDROGUI_ExportSinusXDlg_H
-#define HYDROGUI_ExportSinusXDlg_H
+#ifndef HYDROGUI_EXPORTSINUSXDLG_H
+#define HYDROGUI_EXPORTSINUSXDLG_H
 
 #include "HYDROGUI_InputPanel.h"
 #include <HYDROData_Entity.h>
@@ -28,6 +28,7 @@ class QStackedWidget;
 class QPushButton;
 class QListWidget;
 class QListWidgetItem;
+class HYDROGUI_ObjListBox;
 
 
 class HYDROGUI_ExportSinusXDlg : public HYDROGUI_InputPanel
@@ -37,20 +38,14 @@ class HYDROGUI_ExportSinusXDlg : public HYDROGUI_InputPanel
 public:
   HYDROGUI_ExportSinusXDlg( HYDROGUI_Module* theModule, const QString& theTitle );
   virtual ~HYDROGUI_ExportSinusXDlg();
-  void addItems(const HYDROData_SequenceOfObjects& theSelectedItems);
-  void RemoveItems();
+  HYDROData_SequenceOfObjects GetSelectedEntities();
 
 signals:
-  void            IncludeItems();
-  void            ExcludeItems();
-
+  void            ExportItems();
 private:
   
-  QPushButton*    myExport;
-  QPushButton*    myIncludeBtn;
-  QPushButton*    myExcludeBtn;
-  QListWidget*    myQListW;
-  QMap<QString, QListWidgetItem*> myEnt2WIMap;
+  HYDROGUI_ObjListBox* myList;
+  QPushButton*    myExportBtn;
 
 };
 
index ea53a0c6deec6ce203a07793e55f23524cbb1527..ef17ecdbbf53e91b8af34fce987920effd26e454 100644 (file)
@@ -25,6 +25,8 @@
 #include <HYDROData_PolylineXY.h>
 #include <HYDROData_Profile.h>
 #include <HYDROData_Entity.h>
+#include <HYDROGUI_ObjListBox.h>
+#include <QMessageBox>
 
 
 HYDROGUI_ExportSinusXOp::HYDROGUI_ExportSinusXOp( HYDROGUI_Module* theModule )
@@ -49,41 +51,14 @@ void HYDROGUI_ExportSinusXOp::startOperation()
 HYDROGUI_InputPanel* HYDROGUI_ExportSinusXOp::createInputPanel() const
 {
   HYDROGUI_ExportSinusXDlg* aPanel = new HYDROGUI_ExportSinusXDlg( module(), getName() );
-  connect( aPanel, SIGNAL( IncludeItems() ), SLOT( onIncludeItems() ) );
-  connect( aPanel, SIGNAL( ExcludeItems() ), SLOT( onExcludeItems() ) );
+  connect( aPanel, SIGNAL( ExportItems() ), SLOT( onExportItems() ) );
   return aPanel;
 }
 
-void HYDROGUI_ExportSinusXOp::onIncludeItems()
+void HYDROGUI_ExportSinusXOp::onExportItems()
 {
   HYDROGUI_ExportSinusXDlg* aPanel = ::qobject_cast<HYDROGUI_ExportSinusXDlg*>( inputPanel() );
   if ( !aPanel )
     return;
-
-  HYDROData_SequenceOfObjects aSeq = HYDROGUI_Tool::GetSelectedObjects( module() );
-  HYDROData_SequenceOfObjects aSelectedItems;
-
-  if ( aSeq.IsEmpty())
-    return;
-
-  for( int i = 1; i <= aSeq.Length(); i++ )
-  {
-    Handle_HYDROData_Entity anEnt = aSeq.Value( i );
-    if (anEnt->IsKind( STANDARD_TYPE( HYDROData_Bathymetry)) ||
-        anEnt->IsKind( STANDARD_TYPE( HYDROData_PolylineXY)) ||
-        anEnt->IsKind( STANDARD_TYPE( HYDROData_Profile))  )
-        aSelectedItems.Append(anEnt);
-  }
-  
-  aPanel->addItems( aSelectedItems );
-
-}
-
-void HYDROGUI_ExportSinusXOp::onExcludeItems()
-{
-  HYDROGUI_ExportSinusXDlg* aPanel = ::qobject_cast<HYDROGUI_ExportSinusXDlg*>( inputPanel() );
-  if ( !aPanel )
-    return;
-  aPanel->RemoveItems( );
-
+  int T = aPanel->GetSelectedEntities().Size();
 }
index 3d1a6bf840d061ac44d93b7ca870588ad471c063..b5e5bf612bfec7fdcaadd1032904b2d8f9fa9bda 100644 (file)
@@ -35,8 +35,7 @@ protected:
   virtual HYDROGUI_InputPanel* createInputPanel() const;
 
 protected slots:
-  void   onIncludeItems();
-  void   onExcludeItems();
+  void   onExportItems();
 
 };