#ifndef QT_INPUT_PHYSICS_HPP
#define QT_INPUT_PHYSICS_HPP

#include <iostream>
#include <QLabel>
#include <QWidget>
#include <QGroupBox>
#include <QComboBox>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QLineEdit>
#include <QDoubleValidator>
#include <fstream>

#include "physics.hpp"

using namespace std;

static const size_t max_model_parameters=6;

class QtInputPhysics:public QWidget{
  Q_OBJECT
private:
  QGroupBox* phy_common_box;
  QGroupBox* phy_model_box;
  QComboBox* phy_model_selection_box;
  QLabel* g_label;
  QLabel* rho_label;
  QLabel* phi_label;
  QLabel* k0_label;
  QLabel* nivrivsat_label;
  QLabel* model_label[max_model_parameters];
  QLineEdit* g_input;
  QLineEdit* rho_input;
  QLineEdit* phi_input;
  QLineEdit* k0_input;
  QLineEdit* nivrivsat_input;
  QLineEdit* model_input[max_model_parameters];
  QHBoxLayout* base_layout;
  QVBoxLayout* phy_common_layout;
  QVBoxLayout* phy_model_layout;
  QSpacerItem* phy_model_layout_spacer;
  QDoubleValidator* double_validator;
  QDoubleValidator* positive_double_validator;
  size_t nb_model_parameters;
public:
  QtInputPhysics();
  ~QtInputPhysics();
  QWidget* validate();
  void save(fstream& file);
  void load(fstream& file);
  void loadData();
private slots:
  void modelChoosed(int index);
};

#endif
