Salome HOME
GUI of YDFX is in for uncertainties and parametric users.
[modules/yacs.git] / src / ydfx_gui / YDFXGUIHostParametrizer.hxx
1 // Copyright (C) 2016  CEA/DEN, EDF R&D
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 // Author : Anthony Geay (EDF R&D)
20
21 #ifndef __YDFXGUIHOSTPARAMETRIZER_HXX__
22 #define __YDFXGUIHOSTPARAMETRIZER_HXX__
23
24 #include "ydfxwidgetsExport.hxx"
25
26 #include <QWidget>
27 #include <QValidator>
28
29 class QComboBox;
30 class QLineEdit;
31 class QSettings;
32 class QDialogButtonBox;
33
34 class YACSEvalYFXWrap;
35 class YDFXGUIBatchInfo;
36
37 class YDFXGUIHostParametrizer : public QWidget
38 {
39   Q_OBJECT
40 public:
41   YDFXWIDGETS_EXPORT YDFXGUIHostParametrizer(QWidget *parent, YACSEvalYFXWrap *efx);
42   YDFXWIDGETS_EXPORT QDialogButtonBox *getDialogButtonBox() { return _buttonBox; }
43   YDFXWIDGETS_EXPORT void loadFromSettings(const QSettings& settings);
44   YDFXWIDGETS_EXPORT void learnSettings(QSettings& settings) const;
45   YDFXWIDGETS_EXPORT void applyToEFX();
46   YDFXWIDGETS_EXPORT QString getNameOfHost();
47 public slots:
48   YDFXWIDGETS_EXPORT void changeMachine(const QString& newMachineSelected);
49   YDFXWIDGETS_EXPORT void clusterAdvParamStatusChanged(bool newStatus);
50 signals:
51   void readyForRunSignal(bool);
52   void interactivityChanged(bool);
53 public:
54   YDFXWIDGETS_EXPORT static const char MACHINE[];
55 private:
56   QComboBox *_hostSelector;
57   YDFXGUIBatchInfo *_clusterAdvInfo;
58   QDialogButtonBox *_buttonBox;
59   YACSEvalYFXWrap *_efx;
60   bool _wasInteractive;
61 };
62
63 class YDFXGUIDurationValidator : public QValidator
64 {
65 public:
66   YDFXWIDGETS_EXPORT YDFXGUIDurationValidator(QObject *parent):QValidator(parent) { }
67   YDFXWIDGETS_EXPORT QValidator::State validate(QString & input, int & pos) const;
68 };
69
70 class YACSEvalParamsForCluster;
71
72 class YDFXGUIBatchInfo : public QWidget
73 {
74   Q_OBJECT
75 public:
76   YDFXWIDGETS_EXPORT YDFXGUIBatchInfo(QWidget *parent, YACSEvalYFXWrap *efx);
77   YDFXWIDGETS_EXPORT void showEvent(QShowEvent *event);
78   YDFXWIDGETS_EXPORT bool isOK() const;
79   YDFXWIDGETS_EXPORT void loadFromSettings(const QSettings& settings);
80   YDFXWIDGETS_EXPORT void learnSettings(QSettings& settings) const;
81   YDFXWIDGETS_EXPORT void applyToParams(YACSEvalParamsForCluster& ps) const;
82   YDFXWIDGETS_EXPORT QString getNameOfHost();
83 public slots:
84   YDFXWIDGETS_EXPORT void somethingChanged();
85 public:
86   YDFXWIDGETS_EXPORT static const char NBPROCS[];
87   YDFXWIDGETS_EXPORT static const char REMOTEDIR[];
88   YDFXWIDGETS_EXPORT static const char LOCALDIR[];
89   YDFXWIDGETS_EXPORT static const char WCKEY[];
90   YDFXWIDGETS_EXPORT static const char MAXDUR[];
91 signals:
92   void statusOfEntryChanged(bool newStatus);
93 private:
94   static QString NormalizeDuration(const QString& txt);
95 private:
96   YACSEvalYFXWrap *_efx;
97   QLineEdit *_nbProcs;
98   QLineEdit *_remoteDir;
99   QLineEdit *_localDir;
100   QLineEdit *_WCKey;
101   QLineEdit *_maxDuration;
102   bool _wasOK;
103 };
104
105 #endif