Version: 9.15.0
SalomeApp_NoteBook.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2025 CEA, EDF, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 // File: SalomeApp_NoteBook.h
21 // Author : Roman NIKOLAEV, Open CASCADE S.A.S.
22 // Module : GUI
23 //
24 #ifndef SALOMEAPP_NOTEBOOK_H
25 #define SALOMEAPP_NOTEBOOK_H
26 
27 #include "SalomeApp.h"
28 
29 #include "SALOMEDSClient_ClientFactory.hxx"
30 #include CORBA_SERVER_HEADER(SALOMEDS)
31 
32 #include <QWidget>
33 #include <QTableWidget>
34 #include <QList>
35 
36 class QWidget;
37 class QPushButton;
38 class QTableWidgetItem;
39 class NoteBook_Table;
40 
42 {
44  NoteBoox_Variable( const QString& theName, const QString& theValue )
45  {
46  Name = theName;
47  Value = theValue;
48  }
49  QString Name;
50  QString Value;
51 };
52 
53 typedef QMap< int, NoteBoox_Variable > VariableMap;
54 
56 {
57  public:
58  NoteBook_TableRow(int, NoteBook_Table* parentTable, QWidget* parent=0 );
59  virtual ~NoteBook_TableRow();
60 
61  int GetIndex() const { return myIndex; }
62 
63  void AddToTable(QTableWidget *theTable);
64 
65  void SetName(const QString theName);
66  void SetValue(const QString theValue);
67 
68  QString GetValue() const;
69  QString GetName() const;
70 
71  bool CheckName();
72  bool CheckValue();
73 
74  QTableWidgetItem* GetVariableItem();
75  QTableWidgetItem* GetNameItem();
76  QTableWidgetItem* GetHeaderItem();
77 
78  static bool IsRealValue(const QString theValue, double* theResult = 0);
79  static bool IsIntegerValue(const QString theValue, int* theResult = 0);
80  static bool IsBooleanValue(const QString theValue, bool* theResult = 0);
81  bool IsValidStringValue(const QString theName);
82 
83  private:
84  int myIndex;
86  QTableWidgetItem* myRowHeader;
87  QTableWidgetItem* myVariableName;
88  QTableWidgetItem* myVariableValue;
89 };
90 
92 {
93  Q_OBJECT
94  public:
95  NoteBook_Table(QWidget * parent = 0);
96  virtual ~NoteBook_Table();
97 
98  void Init();
99  static QString Variable2String(const std::string& theVarName);
100 
101  bool IsValid() const;
102 
103  void AddRow( const QString& theName = QString::null, const QString& theValue = QString::null );
104  void AddEmptyRow();
105  NoteBook_TableRow* GetRowByItem(const QTableWidgetItem* theItem) const;
106  bool IsLastRow(const NoteBook_TableRow* aRow) const;
107 
108  void RemoveSelected();
109 
110  void SetProcessItemChangedSignalFlag(const bool enable);
111  bool GetProcessItemChangedSignalFlag()const;
112 
113  bool IsUniqueName(const NoteBook_TableRow* theRow) const;
114  QList<NoteBook_TableRow*> GetRows() const;
115 
116  bool IsModified() const { return myIsModified; }
117  const QList<int>& GetRemovedRows() const { return myRemovedRows; }
118  const VariableMap& GetVariableMap() const { return myVariableMap; }
119  const VariableMap& GetVariableMapRef() const { return myVariableMapRef; }
120  void RenumberRowItems();
121 
122  void ResetMaps();
123 
125 
126  public slots:
127  void onItemChanged(QTableWidgetItem* theItem);
128 
129  private:
130  int getUniqueIndex() const;
131 
132  private:
134 
139 };
140 
142 {
143  Q_OBJECT
144  public:
145  SalomeApp_NoteBook(QWidget * parent);
146  virtual ~SalomeApp_NoteBook();
147 
148  void Init();
149 
150  QString getDumpedStudyName() { return myDumpedStudyName; }
151  void setDumpedStudyName(QString theName) { myDumpedStudyName = theName; }
152 
153  QString getDumpedStudyScript() { return myDumpedStudyScript; }
154  void setDumpedStudyScript(QString theScript) { myDumpedStudyScript = theScript; }
155 
156  bool isDumpedStudySaved() { return myIsDumpedStudySaved; }
157  void setIsDumpedStudySaved(bool isSaved) { myIsDumpedStudySaved = isSaved; }
158 
159  public slots:
160  void onApply();
161  void onRemove();
162  void onUpdateStudy();
163  void onVarUpdate( QString theVarName );
164 
165  private:
167  QPushButton* myRemoveButton;
168  QPushButton* myUpdateStudyBtn;
169 
170  QString myDumpedStudyScript; // path to script of dumped study
173 };
174 
175 #endif //SALOMEAPP_NOTEBOOK_H
#define SALOMEAPPIMPL_EXPORT
Definition: SalomeApp.h:55
QMap< int, NoteBoox_Variable > VariableMap
Definition: SalomeApp_NoteBook.h:53
Definition: SalomeApp_NoteBook.h:56
QTableWidgetItem * myVariableValue
Definition: SalomeApp_NoteBook.h:88
NoteBook_Table * myParentTable
Definition: SalomeApp_NoteBook.h:85
QTableWidgetItem * myRowHeader
Definition: SalomeApp_NoteBook.h:86
QTableWidgetItem * myVariableName
Definition: SalomeApp_NoteBook.h:87
int myIndex
Definition: SalomeApp_NoteBook.h:84
int GetIndex() const
Definition: SalomeApp_NoteBook.h:61
Definition: SalomeApp_NoteBook.h:92
const QList< int > & GetRemovedRows() const
Definition: SalomeApp_NoteBook.h:117
bool isProcessItemChangedSignal
Definition: SalomeApp_NoteBook.h:133
bool myIsModified
Definition: SalomeApp_NoteBook.h:135
bool IsModified() const
Definition: SalomeApp_NoteBook.h:116
const VariableMap & GetVariableMapRef() const
Definition: SalomeApp_NoteBook.h:119
QList< NoteBook_TableRow * > myRows
Definition: SalomeApp_NoteBook.h:124
VariableMap myVariableMapRef
Definition: SalomeApp_NoteBook.h:137
VariableMap myVariableMap
Definition: SalomeApp_NoteBook.h:138
const VariableMap & GetVariableMap() const
Definition: SalomeApp_NoteBook.h:118
QList< int > myRemovedRows
Definition: SalomeApp_NoteBook.h:136
Definition: SalomeApp_NoteBook.h:142
QString myDumpedStudyScript
Definition: SalomeApp_NoteBook.h:170
QString getDumpedStudyScript()
Definition: SalomeApp_NoteBook.h:153
QString myDumpedStudyName
Definition: SalomeApp_NoteBook.h:171
bool isDumpedStudySaved()
Definition: SalomeApp_NoteBook.h:156
QPushButton * myRemoveButton
Definition: SalomeApp_NoteBook.h:167
void setIsDumpedStudySaved(bool isSaved)
Definition: SalomeApp_NoteBook.h:157
QString getDumpedStudyName()
Definition: SalomeApp_NoteBook.h:150
NoteBook_Table * myTable
Definition: SalomeApp_NoteBook.h:166
void setDumpedStudyName(QString theName)
Definition: SalomeApp_NoteBook.h:151
void setDumpedStudyScript(QString theScript)
Definition: SalomeApp_NoteBook.h:154
QPushButton * myUpdateStudyBtn
Definition: SalomeApp_NoteBook.h:168
bool myIsDumpedStudySaved
Definition: SalomeApp_NoteBook.h:172
Definition: SalomeApp_NoteBook.h:42
QString Name
Definition: SalomeApp_NoteBook.h:49
NoteBoox_Variable(const QString &theName, const QString &theValue)
Definition: SalomeApp_NoteBook.h:44
QString Value
Definition: SalomeApp_NoteBook.h:50
NoteBoox_Variable()
Definition: SalomeApp_NoteBook.h:43