1 // Copyright (C) 2016-2019 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (EDF R&D)
21 #ifndef __YDFXGUIPUSHBUTTONS_HXX__
22 #define __YDFXGUIPUSHBUTTONS_HXX__
24 #include "ydfxwidgetsExport.hxx"
26 #include <QPushButton>
32 class YACSEvalSession;
33 class YACSEvalYFXWrap;
34 class YDFXGUIAllPorts;
36 class YDFXGUIPushButton1 : public QPushButton
40 YDFXWIDGETS_EXPORT YDFXGUIPushButton1(QWidget *parent, YACSEvalYFXWrap *efx, YDFXGUIAllPorts *ports);
42 YACSEvalYFXWrap *_efx;
43 YDFXGUIAllPorts *_ports;
46 class YDFXGUIResourcePushButton : public YDFXGUIPushButton1
50 YDFXWIDGETS_EXPORT YDFXGUIResourcePushButton(QWidget *parent, YACSEvalYFXWrap *efx, YDFXGUIAllPorts *ports);
52 void resourceAssignmentRequested();
57 class YDFXGUISeqInitButton : public YDFXGUIPushButton1
61 YDFXWIDGETS_EXPORT YDFXGUISeqInitButton(QWidget *parent, YACSEvalYFXWrap *efx, YDFXGUIAllPorts *ports);
63 void sequenceInitRequested();
65 void sequenceWellDefined(bool);
67 QMap<QString,QString> _state;
70 class YDFXGUIMachineDialog : public QDialog
74 YDFXWIDGETS_EXPORT YDFXGUIMachineDialog(QWidget *wid);
75 YDFXWIDGETS_EXPORT void setWidget(QWidget *wid) { _wid=wid; }
77 void interactivityStatusChanged(bool newStatus);
82 class YDFXGUIRunInfo : public QObject
86 YDFXWIDGETS_EXPORT YDFXGUIRunInfo(QObject *parent, int nbOfItems);
87 YDFXWIDGETS_EXPORT std::vector<char> getItems() const;
88 YDFXWIDGETS_EXPORT int getNbOfItems() const;
89 YDFXWIDGETS_EXPORT void setNbOfItems(int nbOfItems);
90 YDFXWIDGETS_EXPORT bool getComputationStatus() const;
92 YDFXWIDGETS_EXPORT void startComputation();
93 YDFXWIDGETS_EXPORT void endComputation();
94 YDFXWIDGETS_EXPORT void sampleOK(int);
95 YDFXWIDGETS_EXPORT void sampleKO(int);
97 void somethingChanged();
99 bool _computationInProgress;
100 std::vector<char> _items;
104 class YDFXGUIRunThread : public QThread
107 YDFXWIDGETS_EXPORT YDFXGUIRunThread(QObject *parent, YACSEvalYFXWrap *efx, YACSEvalSession *session, YDFXGUIRunInfo *info);
108 YDFXWIDGETS_EXPORT ~YDFXGUIRunThread();
109 YDFXWIDGETS_EXPORT bool getReturns(int& ret1) const;
110 YDFXWIDGETS_EXPORT YACSEvalYFXWrap *getEFX() const { return _efx; }
111 YDFXWIDGETS_EXPORT YACSEvalSession *getSess() const { return _session; }
113 YDFXWIDGETS_EXPORT void run();
115 YACSEvalYFXWrap *_efx;
116 YACSEvalSession *_session;
117 YDFXGUIRunInfo *_info;
122 class YDFXGUIRunningButton : public QPushButton
126 YDFXWIDGETS_EXPORT YDFXGUIRunningButton(QWidget *parent);
127 YDFXWIDGETS_EXPORT YACSEvalYFXWrap *getEFX();
128 YDFXWIDGETS_EXPORT YDFXGUIRunInfo *getInfo();
129 YDFXWIDGETS_EXPORT YACSEvalSession *getSess();
130 YDFXWIDGETS_EXPORT YDFXGUIRunThread *getThread();
132 YDFXWIDGETS_EXPORT void runWizardSlot();
133 YDFXWIDGETS_EXPORT void evaluationFinished();
135 void runEvaluation();
137 static bool ComputeStateRes(YACSEvalYFXWrap *efx, int& nbOfSamples);
138 static bool ComputeStateSeq(YACSEvalYFXWrap *efx);
141 class YDFXGUIRunningPB : public QWidget
145 YDFXWIDGETS_EXPORT YDFXGUIRunningPB(QWidget *parent, YDFXGUIRunInfo *info);
146 YDFXWIDGETS_EXPORT void startComputation();
147 YDFXWIDGETS_EXPORT void paintEvent(QPaintEvent *event);
148 YDFXWIDGETS_EXPORT QSize sizeHint() const;
149 YDFXWIDGETS_EXPORT QSize minimumSizeHint() const;
151 YDFXGUIRunInfo *_info;
154 class YDFXGUIRunButton : public QWidget
158 YDFXWIDGETS_EXPORT YDFXGUIRunButton(QWidget *parent, YACSEvalSession *session, YACSEvalYFXWrap *efx);
159 YDFXWIDGETS_EXPORT QSize sizeHint() const;
160 YDFXWIDGETS_EXPORT QSize minimumSizeHint() const;
161 YDFXWIDGETS_EXPORT YACSEvalYFXWrap *getEFX() { return _th->getEFX(); }
162 YDFXWIDGETS_EXPORT YDFXGUIRunInfo *getInfo() { return _info; }
163 YDFXWIDGETS_EXPORT YACSEvalSession *getSess() { return _th->getSess(); }
164 YDFXWIDGETS_EXPORT YDFXGUIRunThread *getThread() { return _th; }
165 YDFXWIDGETS_EXPORT YDFXGUIRunningButton *getPush() { return _push; }
167 YDFXWIDGETS_EXPORT void update();
168 YDFXWIDGETS_EXPORT void setEnabled(bool);
169 YDFXWIDGETS_EXPORT void setDisabled(bool);
171 YDFXGUIRunInfo *_info;
172 YDFXGUIRunThread *_th;
173 YDFXGUIRunningButton *_push;
174 YDFXGUIRunningPB *_pb;