Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef SMESHGUI_FILTERLIBRARYDLG_H
00028 #define SMESHGUI_FILTERLIBRARYDLG_H
00029
00030
00031 #include "SMESH_SMESHGUI.hxx"
00032
00033
00034 #include <QDialog>
00035 #include <QList>
00036 #include <QMap>
00037
00038
00039 #include <SALOMEconfig.h>
00040 #include CORBA_SERVER_HEADER(SMESH_Filter)
00041
00042 class QListWidget;
00043 class QListWidgetItem;
00044 class QLineEdit;
00045 class QPushButton;
00046 class SMESHGUI;
00047 class SMESHGUI_FilterTable;
00048
00049
00050
00051
00052
00053
00054 class SMESHGUI_EXPORT SMESHGUI_FilterLibraryDlg : public QDialog
00055 {
00056 Q_OBJECT
00057
00058
00059 enum { BTN_OK, BTN_Apply, BTN_Close, BTN_Help };
00060
00061 class Dialog;
00062
00063 public:
00064
00065
00066 enum { ADD_TO, COPY_FROM, EDIT };
00067
00068 public:
00069 SMESHGUI_FilterLibraryDlg( SMESHGUI*, QWidget*, const QList<int>&, const int );
00070 SMESHGUI_FilterLibraryDlg( SMESHGUI*, QWidget*, const int, const int );
00071 virtual ~SMESHGUI_FilterLibraryDlg();
00072
00073 void Init( const QList<int>&, const int );
00074 void Init( const int, const int );
00075
00076 const SMESHGUI_FilterTable* GetTable() const;
00077 void SetTable( const SMESHGUI_FilterTable* );
00078
00079 private:
00080 void closeEvent( QCloseEvent* );
00081 void enterEvent( QEvent* );
00082 void keyPressEvent( QKeyEvent* );
00083
00084 private slots:
00085 void onOk();
00086 bool onApply();
00087 void onClose();
00088 void onHelp();
00089
00090 void onDeactivate();
00091
00092 void onBrowse();
00093 void onReturnPressed();
00094 void onFilterChanged();
00095 void onAddBtnPressed();
00096 void onDeleteBtnPressed();
00097 void onFilterNameChanged( const QString& );
00098 void onEntityTypeChanged( const int );
00099 void onNeedValidation();
00100
00101 private:
00102 void construct( const QList<int>&, const int );
00103 QWidget* createButtonFrame( QWidget* );
00104 QWidget* createMainFrame( QWidget* );
00105 bool isValid( const bool = true ) const;
00106 bool isNameValid( const bool = true ) const;
00107 SMESH::Filter_ptr createFilter( const int = -1 );
00108 QStringList prepareFilters() const;
00109 QString autoExtension( const QString& ) const;
00110 bool setSelected( const QString& );
00111 int getIndex( const QString& ) const;
00112 void updateControlsVisibility();
00113 void updateMainButtons();
00114 void enableMainButtons();
00115 void processNewLibrary();
00116 QString getFileName() const;
00117 void setFileName( const QString&, const bool = true );
00118 QStringList filterWildCards( const QString& ) const;
00119 QString& getDefaultLibraryName() const;
00120 QString getDefaultFilterName() const;
00121 void addFilterToLib( const QString& );
00122 void updateList();
00123 bool isPermissionValid( const bool );
00124
00125 private:
00126
00127 QWidget* myMainFrame;
00128 QMap<int, QPushButton*> myButtons;
00129 SMESHGUI_FilterTable* myTable;
00130 QLineEdit* myFileName;
00131 QPushButton* myOpenBtn;
00132 QListWidget* myListBox;
00133 QPushButton* myAddBtn;
00134 QPushButton* myDeleteBtn;
00135 QWidget* myNameGrp;
00136 QLineEdit* myName;
00137 SMESHGUI* mySMESHGUI;
00138
00139 QList<int> myTypes;
00140 int myMode;
00141
00142 SMESH::FilterLibrary_var myLibrary;
00143 QString myCurrFilterName;
00144 int myCurrFilter;
00145
00146 QString myHelpFileName;
00147 };
00148
00149 #endif // SMESHGUI_FILTERLIBRARYDLG_H