Version: 9.16.0
SMESHGUI_FilterLibraryDlg.h
Go to the documentation of this file.
1// Copyright (C) 2007-2026 CEA, EDF, OPEN CASCADE
2//
3// Copyright (C) 2003-2007 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, or (at your option) any later version.
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
23// SMESH SMESHGUI : GUI for SMESH component
24// File : SMESHGUI_FilterLibraryDlg.h
25// Author : Sergey LITONIN, Open CASCADE S.A.S.
26//
27#ifndef SMESHGUI_FILTERLIBRARYDLG_H
28#define SMESHGUI_FILTERLIBRARYDLG_H
29
30// SMESH includes
31#include "SMESH_SMESHGUI.hxx"
32
33// Qt includes
34#include <QDialog>
35#include <QList>
36#include <QMap>
37
38// IDL includes
39#include <SALOMEconfig.h>
40#include CORBA_SERVER_HEADER(SMESH_Filter)
41
42class QListWidget;
43class QListWidgetItem;
44class QLineEdit;
45class QPushButton;
46class SMESHGUI;
48
49/*
50 Class : SMESHGUI_FilterLibraryDlg
51 Description : Dialog to specify filters for VTK viewer
52*/
53
55{
56 Q_OBJECT
57
58 // Buttons
59 enum { BTN_OK, BTN_Apply, BTN_Close, BTN_Help };
60
61 class Dialog;
62
63public:
64
65 // Mode
66 enum { ADD_TO, COPY_FROM, EDIT };
67
68public:
69 SMESHGUI_FilterLibraryDlg( SMESHGUI*, QWidget*, const QList<int>&, const int );
70 SMESHGUI_FilterLibraryDlg( SMESHGUI*, QWidget*, const int, const int );
72
73 void Init( const QList<int>&, const int );
74 void Init( const int, const int );
75
76 const SMESHGUI_FilterTable* GetTable() const;
77 void SetTable( const SMESHGUI_FilterTable* );
78
79private:
80 void enterEvent( QEvent* );
81 void keyPressEvent( QKeyEvent* );
82
83protected slots:
84 virtual void reject();
85
86private slots:
87 void onOk();
88 bool onApply();
89 void onHelp();
90
91 void onDeactivate();
92
93 void onBrowse();
94 void onReturnPressed();
95 void onFilterChanged();
96 void onAddBtnPressed();
97 void onDeleteBtnPressed();
98 void onFilterNameChanged( const QString& );
99 void onEntityTypeChanged( const int );
100 void onNeedValidation();
101 void onSelectionDone();
102
103private:
104 void construct( const QList<int>&, const int );
105 QWidget* createButtonFrame( QWidget* );
106 QWidget* createMainFrame( QWidget* );
107 bool isValid( const bool = true ) const;
108 bool isNameValid( const bool = true ) const;
109 SMESH::Filter_ptr createFilter( const int = -1 );
110 QStringList prepareFilters() const;
111 QString autoExtension( const QString& ) const;
112 bool setSelected( const QString& );
113 int getIndex( const QString& ) const;
114 void updateControlsVisibility();
115 void updateMainButtons();
116 void enableMainButtons();
117 void processNewLibrary();
118 QString getFileName() const;
119 void setFileName( const QString&, const bool = true );
120 QStringList filterWildCards( const QString& ) const;
121 QString& getDefaultLibraryName() const;
122 QString getDefaultFilterName() const;
123 void addFilterToLib( const QString& );
124 void updateList();
125 bool isPermissionValid( const bool );
126
127private:
128
130 QMap<int, QPushButton*> myButtons;
132 QLineEdit* myFileName;
133 QPushButton* myOpenBtn;
134 QListWidget* myListBox;
135 QPushButton* myAddBtn;
136 QPushButton* myDeleteBtn;
138 QLineEdit* myName;
140
141 QList<int> myTypes;
143
144 SMESH::FilterLibrary_var myLibrary;
147
149};
150
151#endif // SMESHGUI_FILTERLIBRARYDLG_H
#define SMESHGUI_EXPORT
Definition: SMESH_SMESHGUI.hxx:36
Definition: SMESHGUI_FilterLibraryDlg.h:55
SMESH::FilterLibrary_var myLibrary
Definition: SMESHGUI_FilterLibraryDlg.h:144
int myCurrFilter
Definition: SMESHGUI_FilterLibraryDlg.h:146
QList< int > myTypes
Definition: SMESHGUI_FilterLibraryDlg.h:141
@ BTN_Apply
Definition: SMESHGUI_FilterLibraryDlg.h:59
QLineEdit * myFileName
Definition: SMESHGUI_FilterLibraryDlg.h:132
QListWidget * myListBox
Definition: SMESHGUI_FilterLibraryDlg.h:134
QString myHelpFileName
Definition: SMESHGUI_FilterLibraryDlg.h:148
SMESHGUI_FilterTable * myTable
Definition: SMESHGUI_FilterLibraryDlg.h:131
SMESHGUI * mySMESHGUI
Definition: SMESHGUI_FilterLibraryDlg.h:139
QString myCurrFilterName
Definition: SMESHGUI_FilterLibraryDlg.h:145
QWidget * myMainFrame
Definition: SMESHGUI_FilterLibraryDlg.h:129
QMap< int, QPushButton * > myButtons
Definition: SMESHGUI_FilterLibraryDlg.h:130
QPushButton * myAddBtn
Definition: SMESHGUI_FilterLibraryDlg.h:135
QPushButton * myDeleteBtn
Definition: SMESHGUI_FilterLibraryDlg.h:136
@ ADD_TO
Definition: SMESHGUI_FilterLibraryDlg.h:66
QWidget * myNameGrp
Definition: SMESHGUI_FilterLibraryDlg.h:137
QLineEdit * myName
Definition: SMESHGUI_FilterLibraryDlg.h:138
QPushButton * myOpenBtn
Definition: SMESHGUI_FilterLibraryDlg.h:133
int myMode
Definition: SMESHGUI_FilterLibraryDlg.h:142
Class : SMESHGUI_FilterTable Description : Frame containing.
Definition: SMESHGUI_FilterDlg.h:75
Definition: SMESHGUI.h:84
void setFileName(_PTR(SObject) theSObject, const QString &theValue)
Definition: SMESHGUI_Utils.cxx:154